Adding mapbox-gl branch

This commit is contained in:
Andreas Hocevar
2015-03-16 18:50:27 +01:00
parent 7985f030fa
commit 57ee7f52fd
3109 changed files with 943365 additions and 0 deletions

128442
mapbox-gl/build/ol-debug.js Normal file

File diff suppressed because it is too large Load Diff

1696
mapbox-gl/build/ol-deps.js Normal file

File diff suppressed because one or more lines are too long

956
mapbox-gl/build/ol.js Normal file
View File

@@ -0,0 +1,956 @@
// OpenLayers 3. See http://openlayers.org/
// License: https://raw.githubusercontent.com/openlayers/ol3/master/LICENSE.md
// Version: v3.3.0-49-g7512e78
(function (root, factory) {
if (typeof define === "function" && define.amd) {
define([], factory);
} else if (typeof exports === "object") {
module.exports = factory();
} else {
root.ol = factory();
}
}(this, function () {
var OPENLAYERS = {};
var l,aa=aa||{},ba=this;function m(b){return void 0!==b}function t(b,c,d){b=b.split(".");d=d||ba;b[0]in d||!d.execScript||d.execScript("var "+b[0]);for(var e;b.length&&(e=b.shift());)!b.length&&m(c)?d[e]=c:d[e]?d=d[e]:d=d[e]={}}function ca(){}function da(b){b.Pa=function(){return b.yf?b.yf:b.yf=new b}}
function ea(b){var c=typeof b;if("object"==c)if(b){if(b instanceof Array)return"array";if(b instanceof Object)return c;var d=Object.prototype.toString.call(b);if("[object Window]"==d)return"object";if("[object Array]"==d||"number"==typeof b.length&&"undefined"!=typeof b.splice&&"undefined"!=typeof b.propertyIsEnumerable&&!b.propertyIsEnumerable("splice"))return"array";if("[object Function]"==d||"undefined"!=typeof b.call&&"undefined"!=typeof b.propertyIsEnumerable&&!b.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==c&&"undefined"==typeof b.call)return"object";return c}function fa(b){return null===b}function ga(b){return"array"==ea(b)}function ha(b){var c=ea(b);return"array"==c||"object"==c&&"number"==typeof b.length}function ia(b){return"string"==typeof b}function ja(b){return"number"==typeof b}function ka(b){return"function"==ea(b)}function la(b){var c=typeof b;return"object"==c&&null!=b||"function"==c}function ma(b){return b[na]||(b[na]=++oa)}
var na="closure_uid_"+(1E9*Math.random()>>>0),oa=0;function pa(b,c,d){return b.call.apply(b.bind,arguments)}function qa(b,c,d){if(!b)throw Error();if(2<arguments.length){var e=Array.prototype.slice.call(arguments,2);return function(){var d=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(d,e);return b.apply(c,d)}}return function(){return b.apply(c,arguments)}}
function ra(b,c,d){ra=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?pa:qa;return ra.apply(null,arguments)}function sa(b,c){var d=Array.prototype.slice.call(arguments,1);return function(){var c=d.slice();c.push.apply(c,arguments);return b.apply(this,c)}}var ta=Date.now||function(){return+new Date};
function v(b,c){function d(){}d.prototype=c.prototype;b.T=c.prototype;b.prototype=new d;b.prototype.constructor=b;b.Om=function(b,d,g){for(var h=Array(arguments.length-2),k=2;k<arguments.length;k++)h[k-2]=arguments[k];return c.prototype[d].apply(b,h)}};var ua,va;function wa(b){if(Error.captureStackTrace)Error.captureStackTrace(this,wa);else{var c=Error().stack;c&&(this.stack=c)}b&&(this.message=String(b))}v(wa,Error);wa.prototype.name="CustomError";var xa;function ya(b,c){var d=b.length-c.length;return 0<=d&&b.indexOf(c,d)==d}function za(b,c){for(var d=b.split("%s"),e="",f=Array.prototype.slice.call(arguments,1);f.length&&1<d.length;)e+=d.shift()+f.shift();return e+d.join("%s")}var Aa=String.prototype.trim?function(b){return b.trim()}:function(b){return b.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};
function Ba(b){if(!Ca.test(b))return b;-1!=b.indexOf("&")&&(b=b.replace(Da,"&amp;"));-1!=b.indexOf("<")&&(b=b.replace(Ea,"&lt;"));-1!=b.indexOf(">")&&(b=b.replace(Fa,"&gt;"));-1!=b.indexOf('"')&&(b=b.replace(Ga,"&quot;"));-1!=b.indexOf("'")&&(b=b.replace(Ha,"&#39;"));-1!=b.indexOf("\x00")&&(b=b.replace(Ia,"&#0;"));return b}var Da=/&/g,Ea=/</g,Fa=/>/g,Ga=/"/g,Ha=/'/g,Ia=/\x00/g,Ca=/[\x00&<>"']/;
function La(b){b=m(void 0)?b.toFixed(void 0):String(b);var c=b.indexOf(".");-1==c&&(c=b.length);c=Math.max(0,2-c);return Array(c+1).join("0")+b}
function Ma(b,c){for(var d=0,e=Aa(String(b)).split("."),f=Aa(String(c)).split("."),g=Math.max(e.length,f.length),h=0;0==d&&h<g;h++){var k=e[h]||"",n=f[h]||"",p=RegExp("(\\d*)(\\D*)","g"),q=RegExp("(\\d*)(\\D*)","g");do{var r=p.exec(k)||["","",""],s=q.exec(n)||["","",""];if(0==r[0].length&&0==s[0].length)break;d=Na(0==r[1].length?0:parseInt(r[1],10),0==s[1].length?0:parseInt(s[1],10))||Na(0==r[2].length,0==s[2].length)||Na(r[2],s[2])}while(0==d)}return d}function Na(b,c){return b<c?-1:b>c?1:0};var Oa=Array.prototype;function Pa(b,c){return Oa.indexOf.call(b,c,void 0)}function Qa(b,c,d){Oa.forEach.call(b,c,d)}function Ra(b,c){return Oa.filter.call(b,c,void 0)}function Sa(b,c,d){return Oa.map.call(b,c,d)}function Ta(b,c){return Oa.some.call(b,c,void 0)}function Ua(b,c){var d=Va(b,c,void 0);return 0>d?null:ia(b)?b.charAt(d):b[d]}function Va(b,c,d){for(var e=b.length,f=ia(b)?b.split(""):b,g=0;g<e;g++)if(g in f&&c.call(d,f[g],g,b))return g;return-1}function Wa(b,c){return 0<=Pa(b,c)}
function Xa(b,c){var d=Pa(b,c),e;(e=0<=d)&&Oa.splice.call(b,d,1);return e}function Za(b){return Oa.concat.apply(Oa,arguments)}function $a(b){var c=b.length;if(0<c){for(var d=Array(c),e=0;e<c;e++)d[e]=b[e];return d}return[]}function ab(b,c){for(var d=1;d<arguments.length;d++){var e=arguments[d];if(ha(e)){var f=b.length||0,g=e.length||0;b.length=f+g;for(var h=0;h<g;h++)b[f+h]=e[h]}else b.push(e)}}function bb(b,c,d,e){Oa.splice.apply(b,cb(arguments,1))}
function cb(b,c,d){return 2>=arguments.length?Oa.slice.call(b,c):Oa.slice.call(b,c,d)}function db(b,c){b.sort(c||eb)}function fb(b,c){if(!ha(b)||!ha(c)||b.length!=c.length)return!1;for(var d=b.length,e=gb,f=0;f<d;f++)if(!e(b[f],c[f]))return!1;return!0}function eb(b,c){return b>c?1:b<c?-1:0}function gb(b,c){return b===c};var hb;a:{var ib=ba.navigator;if(ib){var jb=ib.userAgent;if(jb){hb=jb;break a}}hb=""}function kb(b){return-1!=hb.indexOf(b)};function ob(b,c,d){for(var e in b)c.call(d,b[e],e,b)}function pb(b,c){for(var d in b)if(c.call(void 0,b[d],d,b))return!0;return!1}function qb(b){var c=0,d;for(d in b)c++;return c}function rb(b){var c=[],d=0,e;for(e in b)c[d++]=b[e];return c}function sb(b){var c=[],d=0,e;for(e in b)c[d++]=e;return c}function tb(b,c){return c in b}function ub(b,c){for(var d in b)if(b[d]==c)return!0;return!1}function vb(b,c){for(var d in b)if(c.call(void 0,b[d],d,b))return d}
function wb(b){for(var c in b)return!1;return!0}function xb(b){for(var c in b)delete b[c]}function yb(b,c){c in b&&delete b[c]}function zb(b,c,d){return c in b?b[c]:d}function Ab(b,c){var d=[];return c in b?b[c]:b[c]=d}function Bb(b){var c={},d;for(d in b)c[d]=b[d];return c}var Cb="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");
function Db(b,c){for(var d,e,f=1;f<arguments.length;f++){e=arguments[f];for(d in e)b[d]=e[d];for(var g=0;g<Cb.length;g++)d=Cb[g],Object.prototype.hasOwnProperty.call(e,d)&&(b[d]=e[d])}}function Eb(b){var c=arguments.length;if(1==c&&ga(arguments[0]))return Eb.apply(null,arguments[0]);for(var d={},e=0;e<c;e++)d[arguments[e]]=!0;return d};var Fb=kb("Opera")||kb("OPR"),Gb=kb("Trident")||kb("MSIE"),Hb=kb("Gecko")&&-1==hb.toLowerCase().indexOf("webkit")&&!(kb("Trident")||kb("MSIE")),Ib=-1!=hb.toLowerCase().indexOf("webkit"),Jb=kb("Macintosh"),Kb=kb("Windows"),Lb=kb("Linux")||kb("CrOS");function Mb(){var b=ba.document;return b?b.documentMode:void 0}
var Nb=function(){var b="",c;if(Fb&&ba.opera)return b=ba.opera.version,ka(b)?b():b;Hb?c=/rv\:([^\);]+)(\)|;)/:Gb?c=/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/:Ib&&(c=/WebKit\/(\S+)/);c&&(b=(b=c.exec(hb))?b[1]:"");return Gb&&(c=Mb(),c>parseFloat(b))?String(c):b}(),Ob={};function Qb(b){return Ob[b]||(Ob[b]=0<=Ma(Nb,b))}var Rb=ba.document,Sb=Rb&&Gb?Mb()||("CSS1Compat"==Rb.compatMode?parseInt(Nb,10):5):void 0;var Tb="https:"===ba.location.protocol,Vb=Gb&&!Qb("9.0")&&""!==Nb;function Wb(b,c,d){return Math.min(Math.max(b,c),d)}function Xb(b,c){var d=b%c;return 0>d*c?d+c:d}function Yb(b,c,d){return b+d*(c-b)}function Zb(b){return b*Math.PI/180};function $b(b){return function(c){if(m(c))return[Wb(c[0],b[0],b[2]),Wb(c[1],b[1],b[3])]}}function ac(b){return b};function bc(b,c,d){var e=b.length;if(b[0]<=c)return 0;if(!(c<=b[e-1]))if(0<d)for(d=1;d<e;++d){if(b[d]<c)return d-1}else if(0>d)for(d=1;d<e;++d){if(b[d]<=c)return d}else for(d=1;d<e;++d){if(b[d]==c)return d;if(b[d]<c)return b[d-1]-c<c-b[d]?d-1:d}return e-1};function cc(b){return function(c,d,e){if(m(c))return c=bc(b,c,e),c=Wb(c+d,0,b.length-1),b[c]}}function dc(b,c,d){return function(e,f,g){if(m(e))return g=0<g?0:0>g?1:.5,e=Math.floor(Math.log(c/e)/Math.log(b)+g),f=Math.max(e+f,0),m(d)&&(f=Math.min(f,d)),c/Math.pow(b,f)}};function ec(b){if(m(b))return 0}function fc(b,c){if(m(b))return b+c}function gc(b){var c=2*Math.PI/b;return function(b,e){if(m(b))return b=Math.floor((b+e)/c+.5)*c}}function hc(){var b=Zb(5);return function(c,d){if(m(c))return Math.abs(c+d)<=b?0:c+d}};function ic(b,c,d){this.center=b;this.resolution=c;this.rotation=d};var jc=!Gb||Gb&&9<=Sb,kc=!Gb||Gb&&9<=Sb,lc=Gb&&!Qb("9");!Ib||Qb("528");Hb&&Qb("1.9b")||Gb&&Qb("8")||Fb&&Qb("9.5")||Ib&&Qb("528");Hb&&!Qb("8")||Gb&&Qb("9");function mc(){0!=nc&&(oc[ma(this)]=this);this.oa=this.oa;this.pa=this.pa}var nc=0,oc={};mc.prototype.oa=!1;mc.prototype.Jc=function(){if(!this.oa&&(this.oa=!0,this.P(),0!=nc)){var b=ma(this);delete oc[b]}};function pc(b,c){var d=sa(qc,c);b.oa?d.call(void 0):(b.pa||(b.pa=[]),b.pa.push(m(void 0)?ra(d,void 0):d))}mc.prototype.P=function(){if(this.pa)for(;this.pa.length;)this.pa.shift()()};function qc(b){b&&"function"==typeof b.Jc&&b.Jc()};function rc(b,c){this.type=b;this.b=this.target=c;this.e=!1;this.pg=!0}rc.prototype.pb=function(){this.e=!0};rc.prototype.preventDefault=function(){this.pg=!1};function tc(b){b.pb()}function uc(b){b.preventDefault()};var vc=Gb?"focusout":"DOMFocusOut";function wc(b){wc[" "](b);return b}wc[" "]=ca;function xc(b,c){rc.call(this,b?b.type:"");this.relatedTarget=this.b=this.target=null;this.i=this.f=this.button=this.screenY=this.screenX=this.clientY=this.clientX=this.offsetY=this.offsetX=0;this.k=this.c=this.d=this.n=!1;this.state=null;this.g=!1;this.a=null;b&&yc(this,b,c)}v(xc,rc);var zc=[1,4,2];
function yc(b,c,d){b.a=c;var e=b.type=c.type;b.target=c.target||c.srcElement;b.b=d;if(d=c.relatedTarget){if(Hb){var f;a:{try{wc(d.nodeName);f=!0;break a}catch(g){}f=!1}f||(d=null)}}else"mouseover"==e?d=c.fromElement:"mouseout"==e&&(d=c.toElement);b.relatedTarget=d;Object.defineProperties?Object.defineProperties(b,{offsetX:{configurable:!0,enumerable:!0,get:b.pf,set:b.am},offsetY:{configurable:!0,enumerable:!0,get:b.qf,set:b.bm}}):(b.offsetX=b.pf(),b.offsetY=b.qf());b.clientX=void 0!==c.clientX?c.clientX:
c.pageX;b.clientY=void 0!==c.clientY?c.clientY:c.pageY;b.screenX=c.screenX||0;b.screenY=c.screenY||0;b.button=c.button;b.f=c.keyCode||0;b.i=c.charCode||("keypress"==e?c.keyCode:0);b.n=c.ctrlKey;b.d=c.altKey;b.c=c.shiftKey;b.k=c.metaKey;b.g=Jb?c.metaKey:c.ctrlKey;b.state=c.state;c.defaultPrevented&&b.preventDefault()}function Ac(b){return(jc?0==b.a.button:"click"==b.type?!0:!!(b.a.button&zc[0]))&&!(Ib&&Jb&&b.n)}l=xc.prototype;
l.pb=function(){xc.T.pb.call(this);this.a.stopPropagation?this.a.stopPropagation():this.a.cancelBubble=!0};l.preventDefault=function(){xc.T.preventDefault.call(this);var b=this.a;if(b.preventDefault)b.preventDefault();else if(b.returnValue=!1,lc)try{if(b.ctrlKey||112<=b.keyCode&&123>=b.keyCode)b.keyCode=-1}catch(c){}};l.Ah=function(){return this.a};l.pf=function(){return Ib||void 0!==this.a.offsetX?this.a.offsetX:this.a.layerX};
l.am=function(b){Object.defineProperties(this,{offsetX:{writable:!0,enumerable:!0,configurable:!0,value:b}})};l.qf=function(){return Ib||void 0!==this.a.offsetY?this.a.offsetY:this.a.layerY};l.bm=function(b){Object.defineProperties(this,{offsetY:{writable:!0,enumerable:!0,configurable:!0,value:b}})};var Bc="closure_listenable_"+(1E6*Math.random()|0);function Cc(b){return!(!b||!b[Bc])}var Dc=0;function Ec(b,c,d,e,f){this.$b=b;this.a=null;this.src=c;this.type=d;this.Bc=!!e;this.yd=f;this.key=++Dc;this.uc=this.cd=!1}function Fc(b){b.uc=!0;b.$b=null;b.a=null;b.src=null;b.yd=null};function Gc(b){this.src=b;this.a={};this.d=0}Gc.prototype.add=function(b,c,d,e,f){var g=b.toString();b=this.a[g];b||(b=this.a[g]=[],this.d++);var h=Hc(b,c,e,f);-1<h?(c=b[h],d||(c.cd=!1)):(c=new Ec(c,this.src,g,!!e,f),c.cd=d,b.push(c));return c};Gc.prototype.remove=function(b,c,d,e){b=b.toString();if(!(b in this.a))return!1;var f=this.a[b];c=Hc(f,c,d,e);return-1<c?(Fc(f[c]),Oa.splice.call(f,c,1),0==f.length&&(delete this.a[b],this.d--),!0):!1};
function Ic(b,c){var d=c.type;if(!(d in b.a))return!1;var e=Xa(b.a[d],c);e&&(Fc(c),0==b.a[d].length&&(delete b.a[d],b.d--));return e}function Jc(b,c,d,e,f){b=b.a[c.toString()];c=-1;b&&(c=Hc(b,d,e,f));return-1<c?b[c]:null}function Kc(b,c,d){var e=m(c),f=e?c.toString():"",g=m(d);return pb(b.a,function(b){for(var c=0;c<b.length;++c)if(!(e&&b[c].type!=f||g&&b[c].Bc!=d))return!0;return!1})}
function Hc(b,c,d,e){for(var f=0;f<b.length;++f){var g=b[f];if(!g.uc&&g.$b==c&&g.Bc==!!d&&g.yd==e)return f}return-1};var Lc="closure_lm_"+(1E6*Math.random()|0),Nc={},Oc=0;function w(b,c,d,e,f){if(ga(c)){for(var g=0;g<c.length;g++)w(b,c[g],d,e,f);return null}d=Pc(d);return Cc(b)?b.Ra(c,d,e,f):Qc(b,c,d,!1,e,f)}function Qc(b,c,d,e,f,g){if(!c)throw Error("Invalid event type");var h=!!f,k=Rc(b);k||(b[Lc]=k=new Gc(b));d=k.add(c,d,e,f,g);if(d.a)return d;e=Sc();d.a=e;e.src=b;e.$b=d;b.addEventListener?b.addEventListener(c.toString(),e,h):b.attachEvent(Tc(c.toString()),e);Oc++;return d}
function Sc(){var b=Uc,c=kc?function(d){return b.call(c.src,c.$b,d)}:function(d){d=b.call(c.src,c.$b,d);if(!d)return d};return c}function Vc(b,c,d,e,f){if(ga(c)){for(var g=0;g<c.length;g++)Vc(b,c[g],d,e,f);return null}d=Pc(d);return Cc(b)?b.mb.add(String(c),d,!0,e,f):Qc(b,c,d,!0,e,f)}function Wc(b,c,d,e,f){if(ga(c))for(var g=0;g<c.length;g++)Wc(b,c[g],d,e,f);else d=Pc(d),Cc(b)?b.Ne(c,d,e,f):b&&(b=Rc(b))&&(c=Jc(b,c,d,!!e,f))&&Xc(c)}
function Xc(b){if(ja(b)||!b||b.uc)return!1;var c=b.src;if(Cc(c))return Ic(c.mb,b);var d=b.type,e=b.a;c.removeEventListener?c.removeEventListener(d,e,b.Bc):c.detachEvent&&c.detachEvent(Tc(d),e);Oc--;(d=Rc(c))?(Ic(d,b),0==d.d&&(d.src=null,c[Lc]=null)):Fc(b);return!0}function Tc(b){return b in Nc?Nc[b]:Nc[b]="on"+b}function Yc(b,c,d,e){var f=!0;if(b=Rc(b))if(c=b.a[c.toString()])for(c=c.concat(),b=0;b<c.length;b++){var g=c[b];g&&g.Bc==d&&!g.uc&&(g=Zc(g,e),f=f&&!1!==g)}return f}
function Zc(b,c){var d=b.$b,e=b.yd||b.src;b.cd&&Xc(b);return d.call(e,c)}
function Uc(b,c){if(b.uc)return!0;if(!kc){var d;if(!(d=c))a:{d=["window","event"];for(var e=ba,f;f=d.shift();)if(null!=e[f])e=e[f];else{d=null;break a}d=e}f=d;d=new xc(f,this);e=!0;if(!(0>f.keyCode||void 0!=f.returnValue)){a:{var g=!1;if(0==f.keyCode)try{f.keyCode=-1;break a}catch(h){g=!0}if(g||void 0==f.returnValue)f.returnValue=!0}f=[];for(g=d.b;g;g=g.parentNode)f.push(g);for(var g=b.type,k=f.length-1;!d.e&&0<=k;k--){d.b=f[k];var n=Yc(f[k],g,!0,d),e=e&&n}for(k=0;!d.e&&k<f.length;k++)d.b=f[k],n=
Yc(f[k],g,!1,d),e=e&&n}return e}return Zc(b,new xc(c,this))}function Rc(b){b=b[Lc];return b instanceof Gc?b:null}var $c="__closure_events_fn_"+(1E9*Math.random()>>>0);function Pc(b){if(ka(b))return b;b[$c]||(b[$c]=function(c){return b.handleEvent(c)});return b[$c]};function ad(b){return function(){return b}}var bd=ad(!1),cd=ad(!0),dd=ad(null);function ed(b){return b}function fd(b){var c;c=c||0;return function(){return b.apply(this,Array.prototype.slice.call(arguments,0,c))}}function gd(b){var c=arguments,d=c.length;return function(){for(var b,f=0;f<d;f++)b=c[f].apply(this,arguments);return b}}function hd(b){var c=arguments,d=c.length;return function(){for(var b=0;b<d;b++)if(!c[b].apply(this,arguments))return!1;return!0}};function id(){mc.call(this);this.mb=new Gc(this);this.qh=this;this.he=null}v(id,mc);id.prototype[Bc]=!0;l=id.prototype;l.addEventListener=function(b,c,d,e){w(this,b,c,d,e)};l.removeEventListener=function(b,c,d,e){Wc(this,b,c,d,e)};
l.dispatchEvent=function(b){var c,d=this.he;if(d)for(c=[];d;d=d.he)c.push(d);var d=this.qh,e=b.type||b;if(ia(b))b=new rc(b,d);else if(b instanceof rc)b.target=b.target||d;else{var f=b;b=new rc(e,d);Db(b,f)}var f=!0,g;if(c)for(var h=c.length-1;!b.e&&0<=h;h--)g=b.b=c[h],f=jd(g,e,!0,b)&&f;b.e||(g=b.b=d,f=jd(g,e,!0,b)&&f,b.e||(f=jd(g,e,!1,b)&&f));if(c)for(h=0;!b.e&&h<c.length;h++)g=b.b=c[h],f=jd(g,e,!1,b)&&f;return f};
l.P=function(){id.T.P.call(this);if(this.mb){var b=this.mb,c=0,d;for(d in b.a){for(var e=b.a[d],f=0;f<e.length;f++)++c,Fc(e[f]);delete b.a[d];b.d--}}this.he=null};l.Ra=function(b,c,d,e){return this.mb.add(String(b),c,!1,d,e)};l.Ne=function(b,c,d,e){return this.mb.remove(String(b),c,d,e)};
function jd(b,c,d,e){c=b.mb.a[String(c)];if(!c)return!0;c=c.concat();for(var f=!0,g=0;g<c.length;++g){var h=c[g];if(h&&!h.uc&&h.Bc==d){var k=h.$b,n=h.yd||h.src;h.cd&&Ic(b.mb,h);f=!1!==k.call(n,e)&&f}}return f&&0!=e.pg}function kd(b,c,d){return Kc(b.mb,m(c)?String(c):void 0,d)};function ld(){id.call(this);this.d=0}v(ld,id);function md(b){Xc(b)}l=ld.prototype;l.l=function(){++this.d;this.dispatchEvent("change")};l.u=function(){return this.d};l.s=function(b,c,d){return w(this,b,c,!1,d)};l.v=function(b,c,d){return Vc(this,b,c,!1,d)};l.t=function(b,c,d){Wc(this,b,c,!1,d)};l.A=md;function nd(b,c,d){rc.call(this,b);this.key=c;this.oldValue=d}v(nd,rc);function od(b,c,d,e){this.source=b;this.target=c;this.b=d;this.d=e;this.c=this.a=ed}od.prototype.transform=function(b,c){var d=pd(this.source,this.b);this.a=b;this.c=c;qd(this.source,this.b,d)};function rd(b){ld.call(this);ma(this);this.n={};this.Da={};this.ge={};m(b)&&this.C(b)}v(rd,ld);var sd={},td={},ud={};function vd(b){return sd.hasOwnProperty(b)?sd[b]:sd[b]="change:"+b}
function pd(b,c){var d=td.hasOwnProperty(c)?td[c]:td[c]="get"+(String(c.charAt(0)).toUpperCase()+String(c.substr(1)).toLowerCase()),d=b[d];return m(d)?d.call(b):b.get(c)}l=rd.prototype;l.K=function(b,c,d){d=d||b;this.L(b);var e=vd(d);this.ge[b]=w(c,e,function(c){qd(this,b,c.oldValue)},void 0,this);c=new od(this,c,b,d);this.Da[b]=c;qd(this,b,this.n[b]);return c};l.get=function(b){var c,d=this.Da;d.hasOwnProperty(b)?(b=d[b],c=pd(b.target,b.d),c=b.c(c)):this.n.hasOwnProperty(b)&&(c=this.n[b]);return c};
l.G=function(){var b=this.Da,c;if(wb(this.n)){if(wb(b))return[];c=b}else if(wb(b))c=this.n;else{c={};for(var d in this.n)c[d]=!0;for(d in b)c[d]=!0}return sb(c)};l.I=function(){var b={},c;for(c in this.n)b[c]=this.n[c];for(c in this.Da)b[c]=this.get(c);return b};function qd(b,c,d){var e;e=vd(c);b.dispatchEvent(new nd(e,c,d));b.dispatchEvent(new nd("propertychange",c,d))}
l.set=function(b,c){var d=this.Da;if(d.hasOwnProperty(b)){var e=d[b];c=e.a(c);var d=e.target,e=e.d,f=c,g=ud.hasOwnProperty(e)?ud[e]:ud[e]="set"+(String(e.charAt(0)).toUpperCase()+String(e.substr(1)).toLowerCase()),g=d[g];m(g)?g.call(d,f):d.set(e,f)}else d=this.n[b],this.n[b]=c,qd(this,b,d)};l.C=function(b){for(var c in b)this.set(c,b[c])};l.L=function(b){var c=this.ge,d=c[b];d&&(delete c[b],Xc(d),c=this.get(b),delete this.Da[b],this.n[b]=c)};l.M=function(){for(var b in this.ge)this.L(b)};function wd(b,c){b[0]+=c[0];b[1]+=c[1];return b}function xd(b,c){var d=b[0],e=b[1],f=c[0],g=c[1],h=f[0],f=f[1],k=g[0],g=g[1],n=k-h,p=g-f,d=0===n&&0===p?0:(n*(d-h)+p*(e-f))/(n*n+p*p||0);0>=d||(1<=d?(h=k,f=g):(h+=d*n,f+=d*p));return[h,f]}function yd(b,c){var d=Xb(b+180,360)-180,e=Math.abs(Math.round(3600*d));return Math.floor(e/3600)+"\u00b0 "+Math.floor(e/60%60)+"\u2032 "+Math.floor(e%60)+"\u2033 "+c.charAt(0>d?1:0)}
function zd(b,c,d){return m(b)?c.replace("{x}",b[0].toFixed(d)).replace("{y}",b[1].toFixed(d)):""}function Ad(b,c){for(var d=!0,e=b.length-1;0<=e;--e)if(b[e]!=c[e]){d=!1;break}return d}function Bd(b,c){var d=Math.cos(c),e=Math.sin(c),f=b[1]*d+b[0]*e;b[0]=b[0]*d-b[1]*e;b[1]=f;return b}function Cd(b,c){var d=b[0]-c[0],e=b[1]-c[1];return d*d+e*e}function Dd(b,c){return zd(b,"{x}, {y}",c)};function Ed(b){this.length=b.length||b;for(var c=0;c<this.length;c++)this[c]=b[c]||0}Ed.prototype.a=4;Ed.prototype.set=function(b,c){c=c||0;for(var d=0;d<b.length&&c+d<this.length;d++)this[c+d]=b[d]};Ed.prototype.toString=Array.prototype.join;"undefined"==typeof Float32Array&&(Ed.BYTES_PER_ELEMENT=4,Ed.prototype.BYTES_PER_ELEMENT=Ed.prototype.a,Ed.prototype.set=Ed.prototype.set,Ed.prototype.toString=Ed.prototype.toString,t("Float32Array",Ed,void 0));function Fd(b){this.length=b.length||b;for(var c=0;c<this.length;c++)this[c]=b[c]||0}Fd.prototype.a=8;Fd.prototype.set=function(b,c){c=c||0;for(var d=0;d<b.length&&c+d<this.length;d++)this[c+d]=b[d]};Fd.prototype.toString=Array.prototype.join;if("undefined"==typeof Float64Array){try{Fd.BYTES_PER_ELEMENT=8}catch(Gd){}Fd.prototype.BYTES_PER_ELEMENT=Fd.prototype.a;Fd.prototype.set=Fd.prototype.set;Fd.prototype.toString=Fd.prototype.toString;t("Float64Array",Fd,void 0)};function Hd(b,c,d,e,f){b[0]=c;b[1]=d;b[2]=e;b[3]=f};function Id(){var b=Array(16);Jd(b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return b}function Kd(){var b=Array(16);Jd(b,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return b}function Jd(b,c,d,e,f,g,h,k,n,p,q,r,s,u,z,y,A){b[0]=c;b[1]=d;b[2]=e;b[3]=f;b[4]=g;b[5]=h;b[6]=k;b[7]=n;b[8]=p;b[9]=q;b[10]=r;b[11]=s;b[12]=u;b[13]=z;b[14]=y;b[15]=A}
function Ld(b,c){b[0]=c[0];b[1]=c[1];b[2]=c[2];b[3]=c[3];b[4]=c[4];b[5]=c[5];b[6]=c[6];b[7]=c[7];b[8]=c[8];b[9]=c[9];b[10]=c[10];b[11]=c[11];b[12]=c[12];b[13]=c[13];b[14]=c[14];b[15]=c[15]}function Md(b){b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=0;b[5]=1;b[6]=0;b[7]=0;b[8]=0;b[9]=0;b[10]=1;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1}
function Nd(b,c,d){var e=b[0],f=b[1],g=b[2],h=b[3],k=b[4],n=b[5],p=b[6],q=b[7],r=b[8],s=b[9],u=b[10],z=b[11],y=b[12],A=b[13],D=b[14];b=b[15];var x=c[0],M=c[1],Q=c[2],O=c[3],W=c[4],Ja=c[5],lb=c[6],Ka=c[7],mb=c[8],Pb=c[9],Ya=c[10],Ub=c[11],nb=c[12],Mc=c[13],sc=c[14];c=c[15];d[0]=e*x+k*M+r*Q+y*O;d[1]=f*x+n*M+s*Q+A*O;d[2]=g*x+p*M+u*Q+D*O;d[3]=h*x+q*M+z*Q+b*O;d[4]=e*W+k*Ja+r*lb+y*Ka;d[5]=f*W+n*Ja+s*lb+A*Ka;d[6]=g*W+p*Ja+u*lb+D*Ka;d[7]=h*W+q*Ja+z*lb+b*Ka;d[8]=e*mb+k*Pb+r*Ya+y*Ub;d[9]=f*mb+n*Pb+s*Ya+A*Ub;
d[10]=g*mb+p*Pb+u*Ya+D*Ub;d[11]=h*mb+q*Pb+z*Ya+b*Ub;d[12]=e*nb+k*Mc+r*sc+y*c;d[13]=f*nb+n*Mc+s*sc+A*c;d[14]=g*nb+p*Mc+u*sc+D*c;d[15]=h*nb+q*Mc+z*sc+b*c}
function Od(b,c){var d=b[0],e=b[1],f=b[2],g=b[3],h=b[4],k=b[5],n=b[6],p=b[7],q=b[8],r=b[9],s=b[10],u=b[11],z=b[12],y=b[13],A=b[14],D=b[15],x=d*k-e*h,M=d*n-f*h,Q=d*p-g*h,O=e*n-f*k,W=e*p-g*k,Ja=f*p-g*n,lb=q*y-r*z,Ka=q*A-s*z,mb=q*D-u*z,Pb=r*A-s*y,Ya=r*D-u*y,Ub=s*D-u*A,nb=x*Ub-M*Ya+Q*Pb+O*mb-W*Ka+Ja*lb;0!=nb&&(nb=1/nb,c[0]=(k*Ub-n*Ya+p*Pb)*nb,c[1]=(-e*Ub+f*Ya-g*Pb)*nb,c[2]=(y*Ja-A*W+D*O)*nb,c[3]=(-r*Ja+s*W-u*O)*nb,c[4]=(-h*Ub+n*mb-p*Ka)*nb,c[5]=(d*Ub-f*mb+g*Ka)*nb,c[6]=(-z*Ja+A*Q-D*M)*nb,c[7]=(q*Ja-s*
Q+u*M)*nb,c[8]=(h*Ya-k*mb+p*lb)*nb,c[9]=(-d*Ya+e*mb-g*lb)*nb,c[10]=(z*W-y*Q+D*x)*nb,c[11]=(-q*W+r*Q-u*x)*nb,c[12]=(-h*Pb+k*Ka-n*lb)*nb,c[13]=(d*Pb-e*Ka+f*lb)*nb,c[14]=(-z*O+y*M-A*x)*nb,c[15]=(q*O-r*M+s*x)*nb)}function Pd(b,c,d){var e=b[1]*c+b[5]*d+0*b[9]+b[13],f=b[2]*c+b[6]*d+0*b[10]+b[14],g=b[3]*c+b[7]*d+0*b[11]+b[15];b[12]=b[0]*c+b[4]*d+0*b[8]+b[12];b[13]=e;b[14]=f;b[15]=g}
function Qd(b,c,d){Jd(b,b[0]*c,b[1]*c,b[2]*c,b[3]*c,b[4]*d,b[5]*d,b[6]*d,b[7]*d,1*b[8],1*b[9],1*b[10],1*b[11],b[12],b[13],b[14],b[15])}function Rd(b,c){var d=b[0],e=b[1],f=b[2],g=b[3],h=b[4],k=b[5],n=b[6],p=b[7],q=Math.cos(c),r=Math.sin(c);b[0]=d*q+h*r;b[1]=e*q+k*r;b[2]=f*q+n*r;b[3]=g*q+p*r;b[4]=d*-r+h*q;b[5]=e*-r+k*q;b[6]=f*-r+n*q;b[7]=g*-r+p*q}new Float64Array(3);new Float64Array(3);new Float64Array(4);new Float64Array(4);new Float64Array(4);new Float64Array(16);function Sd(b){for(var c=Td(),d=0,e=b.length;d<e;++d)Ud(c,b[d]);return c}function Vd(b,c,d){var e=Math.min.apply(null,b),f=Math.min.apply(null,c);b=Math.max.apply(null,b);c=Math.max.apply(null,c);return Wd(e,f,b,c,d)}function Xd(b,c,d){return m(d)?(d[0]=b[0]-c,d[1]=b[1]-c,d[2]=b[2]+c,d[3]=b[3]+c,d):[b[0]-c,b[1]-c,b[2]+c,b[3]+c]}function Yd(b,c){return m(c)?(c[0]=b[0],c[1]=b[1],c[2]=b[2],c[3]=b[3],c):b.slice()}
function Zd(b,c,d){c=c<b[0]?b[0]-c:b[2]<c?c-b[2]:0;b=d<b[1]?b[1]-d:b[3]<d?d-b[3]:0;return c*c+b*b}function $d(b,c){return b[0]<=c[0]&&c[2]<=b[2]&&b[1]<=c[1]&&c[3]<=b[3]}function ae(b,c,d){return b[0]<=c&&c<=b[2]&&b[1]<=d&&d<=b[3]}function be(b,c){var d=b[1],e=b[2],f=b[3],g=c[0],h=c[1],k=0;g<b[0]?k=k|16:g>e&&(k=k|4);h<d?k|=8:h>f&&(k|=2);0===k&&(k=1);return k}function Td(){return[Infinity,Infinity,-Infinity,-Infinity]}function Wd(b,c,d,e,f){return m(f)?(f[0]=b,f[1]=c,f[2]=d,f[3]=e,f):[b,c,d,e]}
function ce(b,c){var d=b[0],e=b[1];return Wd(d,e,d,e,c)}function de(b,c){return b[0]==c[0]&&b[2]==c[2]&&b[1]==c[1]&&b[3]==c[3]}function ee(b,c){c[0]<b[0]&&(b[0]=c[0]);c[2]>b[2]&&(b[2]=c[2]);c[1]<b[1]&&(b[1]=c[1]);c[3]>b[3]&&(b[3]=c[3]);return b}function Ud(b,c){c[0]<b[0]&&(b[0]=c[0]);c[0]>b[2]&&(b[2]=c[0]);c[1]<b[1]&&(b[1]=c[1]);c[1]>b[3]&&(b[3]=c[1])}
function fe(b,c,d,e,f){for(;d<e;d+=f){var g=b,h=c[d],k=c[d+1];g[0]=Math.min(g[0],h);g[1]=Math.min(g[1],k);g[2]=Math.max(g[2],h);g[3]=Math.max(g[3],k)}return b}function ge(b,c){var d;return(d=c.call(void 0,he(b)))||(d=c.call(void 0,ie(b)))||(d=c.call(void 0,je(b)))?d:(d=c.call(void 0,ke(b)))?d:!1}function he(b){return[b[0],b[1]]}function ie(b){return[b[2],b[1]]}function le(b){return[(b[0]+b[2])/2,(b[1]+b[3])/2]}
function me(b,c){var d;"bottom-left"===c?d=he(b):"bottom-right"===c?d=ie(b):"top-left"===c?d=ke(b):"top-right"===c&&(d=je(b));return d}function ne(b,c,d,e){var f=c*e[0]/2;e=c*e[1]/2;c=Math.cos(d);d=Math.sin(d);f=[-f,-f,f,f];e=[-e,e,-e,e];var g,h,k;for(g=0;4>g;++g)h=f[g],k=e[g],f[g]=b[0]+h*c-k*d,e[g]=b[1]+h*d+k*c;return Vd(f,e,void 0)}function oe(b){return b[3]-b[1]}
function pe(b,c,d){d=m(d)?d:Td();qe(b,c)&&(d[0]=b[0]>c[0]?b[0]:c[0],d[1]=b[1]>c[1]?b[1]:c[1],d[2]=b[2]<c[2]?b[2]:c[2],d[3]=b[3]<c[3]?b[3]:c[3]);return d}function ke(b){return[b[0],b[3]]}function je(b){return[b[2],b[3]]}function re(b){return b[2]-b[0]}function qe(b,c){return b[0]<=c[2]&&b[2]>=c[0]&&b[1]<=c[3]&&b[3]>=c[1]}function se(b){return b[2]<b[0]||b[3]<b[1]}function te(b,c){var d=(b[2]-b[0])/2*(c-1),e=(b[3]-b[1])/2*(c-1);b[0]-=d;b[2]+=d;b[1]-=e;b[3]+=e}
function ue(b,c,d){b=[b[0],b[1],b[0],b[3],b[2],b[1],b[2],b[3]];c(b,b,2);return Vd([b[0],b[2],b[4],b[6]],[b[1],b[3],b[5],b[7]],d)};/*
Latitude/longitude spherical geodesy formulae taken from
http://www.movable-type.co.uk/scripts/latlong.html
Licensed under CC-BY-3.0.
*/
function ve(b){this.radius=b}ve.prototype.d=function(b){for(var c=0,d=b.length,e=b[d-1][0],f=b[d-1][1],g=0;g<d;g++)var h=b[g][0],k=b[g][1],c=c+Zb(h-e)*(2+Math.sin(Zb(f))+Math.sin(Zb(k))),e=h,f=k;return c*this.radius*this.radius/2};ve.prototype.a=function(b,c){var d=Zb(b[1]),e=Zb(c[1]),f=(e-d)/2,g=Zb(c[0]-b[0])/2,d=Math.sin(f)*Math.sin(f)+Math.sin(g)*Math.sin(g)*Math.cos(d)*Math.cos(e);return 2*this.radius*Math.atan2(Math.sqrt(d),Math.sqrt(1-d))};
ve.prototype.offset=function(b,c,d){var e=Zb(b[1]);c/=this.radius;var f=Math.asin(Math.sin(e)*Math.cos(c)+Math.cos(e)*Math.sin(c)*Math.cos(d));return[180*(Zb(b[0])+Math.atan2(Math.sin(d)*Math.sin(c)*Math.cos(e),Math.cos(c)-Math.sin(e)*Math.sin(f)))/Math.PI,180*f/Math.PI]};var we=new ve(6370997);var xe={};xe.degrees=2*Math.PI*we.radius/360;xe.ft=.3048;xe.m=1;xe["us-ft"]=1200/3937;function ye(b){this.a=b.code;this.d=b.units;this.g=m(b.extent)?b.extent:null;this.c=m(b.worldExtent)?b.worldExtent:null;this.b=m(b.axisOrientation)?b.axisOrientation:"enu";this.e=m(b.global)?b.global:!1;this.f=null}l=ye.prototype;l.Bh=function(){return this.a};l.J=function(){return this.g};l.Sj=function(){return this.d};l.od=function(){return xe[this.d]};l.ii=function(){return this.c};function ze(b){return b.b}
l.Vi=function(){return this.e};l.Tj=function(b){this.g=b};l.hm=function(b){this.c=b};l.te=function(b,c){if("degrees"==this.d)return b;var d=Ae(this,Be("EPSG:4326")),e=[c[0]-b/2,c[1],c[0]+b/2,c[1],c[0],c[1]-b/2,c[0],c[1]+b/2],e=d(e,e,2),d=(we.a(e.slice(0,2),e.slice(2,4))+we.a(e.slice(4,6),e.slice(6,8)))/2,e=this.od();m(e)&&(d/=e);return d};var Ce={},De={};function Ee(b){Fe(b);Qa(b,function(c){Qa(b,function(b){c!==b&&Ge(c,b,He)})})}
function Ie(){var b=Je,c=Ke,d=Le;Qa(Me,function(e){Qa(b,function(b){Ge(e,b,c);Ge(b,e,d)})})}function Ne(b){Ce[b.a]=b;Ge(b,b,He)}function Fe(b){var c=[];Qa(b,function(b){c.push(Ne(b))})}function Pe(b){return null!=b?ia(b)?Be(b):b:Be("EPSG:3857")}function Ge(b,c,d){b=b.a;c=c.a;b in De||(De[b]={});De[b][c]=d}function Qe(b,c,d,e){b=Be(b);c=Be(c);Ge(b,c,Re(d));Ge(c,b,Re(e))}
function Re(b){return function(c,d,e){var f=c.length;e=m(e)?e:2;d=m(d)?d:Array(f);var g,h;for(h=0;h<f;h+=e)for(g=b([c[h],c[h+1]]),d[h]=g[0],d[h+1]=g[1],g=e-1;2<=g;--g)d[h+g]=c[h+g];return d}}
function Be(b){var c;if(b instanceof ye)c=b;else if(ia(b)){if(c=Ce[b],!m(c)&&"function"==typeof proj4){var d=proj4.defs(b);if(m(d)){c=d.units;!m(c)&&m(d.to_meter)&&(c=d.to_meter.toString(),xe[c]=d.to_meter);c=new ye({code:b,units:c,axisOrientation:d.axis});Ne(c);var e,f,g;for(e in Ce)f=proj4.defs(e),m(f)&&(g=Be(e),f===d?Ee([g,c]):(f=proj4(e,b),Qe(g,c,f.forward,f.inverse)))}else c=null}}else c=null;return c}function Se(b,c){return b===c?!0:b.d!=c.d?!1:Ae(b,c)===He}
function Te(b,c){var d=Be(b),e=Be(c);return Ae(d,e)}function Ae(b,c){var d=b.a,e=c.a,f;d in De&&e in De[d]&&(f=De[d][e]);m(f)||(f=Ue);return f}function Ue(b,c){if(m(c)&&b!==c){for(var d=0,e=b.length;d<e;++d)c[d]=b[d];b=c}return b}function He(b,c){var d;if(m(c)){d=0;for(var e=b.length;d<e;++d)c[d]=b[d];d=c}else d=b.slice();return d}function Ve(b,c,d){c=Te(c,d);return ue(b,c)};function B(b){rd.call(this);b=m(b)?b:{};this.q=[0,0];var c={};c.center=m(b.center)?b.center:null;this.p=Pe(b.projection);var d,e,f,g=m(b.minZoom)?b.minZoom:0;d=m(b.maxZoom)?b.maxZoom:28;var h=m(b.zoomFactor)?b.zoomFactor:2;if(m(b.resolutions))d=b.resolutions,e=d[0],f=d[d.length-1],d=cc(d);else{e=Pe(b.projection);f=e.J();var k=(null===f?360*xe.degrees/xe[e.d]:Math.max(re(f),oe(f)))/256/Math.pow(2,0),n=k/Math.pow(2,28);e=b.maxResolution;m(e)?g=0:e=k/Math.pow(h,g);f=b.minResolution;m(f)||(f=m(b.maxZoom)?
m(b.maxResolution)?e/Math.pow(h,d):k/Math.pow(h,d):n);d=g+Math.floor(Math.log(e/f)/Math.log(h));f=e/Math.pow(h,d-g);d=dc(h,e,d-g)}this.e=e;this.H=f;this.o=g;g=m(b.extent)?$b(b.extent):ac;(m(b.enableRotation)?b.enableRotation:1)?(e=b.constrainRotation,e=m(e)&&!0!==e?!1===e?fc:ja(e)?gc(e):fc:hc()):e=ec;this.D=new ic(g,d,e);m(b.resolution)?c.resolution=b.resolution:m(b.zoom)&&(c.resolution=this.constrainResolution(this.e,b.zoom-this.o));c.rotation=m(b.rotation)?b.rotation:0;this.C(c)}v(B,rd);
B.prototype.i=function(b){return this.D.center(b)};B.prototype.constrainResolution=function(b,c,d){return this.D.resolution(b,c||0,d||0)};B.prototype.constrainRotation=function(b,c){return this.D.rotation(b,c||0)};B.prototype.b=function(){return this.get("center")};B.prototype.getCenter=B.prototype.b;B.prototype.g=function(b){var c=this.b(),d=this.a();return[c[0]-d*b[0]/2,c[1]-d*b[1]/2,c[0]+d*b[0]/2,c[1]+d*b[1]/2]};B.prototype.N=function(){return this.p};B.prototype.a=function(){return this.get("resolution")};
B.prototype.getResolution=B.prototype.a;B.prototype.k=function(b,c){return Math.max(re(b)/c[0],oe(b)/c[1])};function We(b){var c=b.e,d=Math.log(c/b.H)/Math.log(2);return function(b){return c/Math.pow(2,b*d)}}B.prototype.c=function(){return this.get("rotation")};B.prototype.getRotation=B.prototype.c;function Xe(b){var c=b.e,d=Math.log(c/b.H)/Math.log(2);return function(b){return Math.log(c/b)/Math.log(2)/d}}
function Ye(b){var c=b.b(),d=b.p,e=b.a();b=b.c();return{center:c.slice(),projection:m(d)?d:null,resolution:e,rotation:b}}l=B.prototype;l.ki=function(){var b,c=this.a();if(m(c)){var d,e=0;do{d=this.constrainResolution(this.e,e);if(d==c){b=e;break}++e}while(d>this.H)}return m(b)?this.o+b:b};l.pe=function(b,c){if(!se(b)){this.Ha(le(b));var d=this.k(b,c),e=this.constrainResolution(d,0,0);e<d&&(e=this.constrainResolution(e,-1,0));this.f(e)}};
l.wh=function(b,c,d){var e=m(d)?d:{};d=m(e.padding)?e.padding:[0,0,0,0];var f=m(e.constrainResolution)?e.constrainResolution:!0,g=m(e.nearest)?e.nearest:!1,h;m(e.minResolution)?h=e.minResolution:m(e.maxZoom)?h=this.constrainResolution(this.e,e.maxZoom-this.o,0):h=0;var k=b.j,n=this.c(),e=Math.cos(-n),n=Math.sin(-n),p=Infinity,q=Infinity,r=-Infinity,s=-Infinity;b=b.B;for(var u=0,z=k.length;u<z;u+=b)var y=k[u]*e-k[u+1]*n,A=k[u]*n+k[u+1]*e,p=Math.min(p,y),q=Math.min(q,A),r=Math.max(r,y),s=Math.max(s,
A);c=this.k([p,q,r,s],[c[0]-d[1]-d[3],c[1]-d[0]-d[2]]);c=isNaN(c)?h:Math.max(c,h);f&&(h=this.constrainResolution(c,0,0),!g&&h<c&&(h=this.constrainResolution(h,-1,0)),c=h);this.f(c);n=-n;g=(p+r)/2+(d[1]-d[3])/2*c;d=(q+s)/2+(d[0]-d[2])/2*c;this.Ha([g*e-d*n,d*e+g*n])};l.oh=function(b,c,d){var e=this.c(),f=Math.cos(-e),e=Math.sin(-e),g=b[0]*f-b[1]*e;b=b[1]*f+b[0]*e;var h=this.a(),g=g+(c[0]/2-d[0])*h;b+=(d[1]-c[1]/2)*h;e=-e;this.Ha([g*f-b*e,b*f+g*e])};
l.rotate=function(b,c){if(m(c)){var d,e=this.b();m(e)&&(d=[e[0]-c[0],e[1]-c[1]],Bd(d,b-this.c()),wd(d,c));this.Ha(d)}this.r(b)};l.Ha=function(b){this.set("center",b)};B.prototype.setCenter=B.prototype.Ha;function Ze(b,c){b.q[1]+=c}B.prototype.f=function(b){this.set("resolution",b)};B.prototype.setResolution=B.prototype.f;B.prototype.r=function(b){this.set("rotation",b)};B.prototype.setRotation=B.prototype.r;B.prototype.S=function(b){b=this.constrainResolution(this.e,b-this.o,0);this.f(b)};function $e(b){return 1-Math.pow(1-b,3)};function af(b){return 3*b*b-2*b*b*b}function bf(b){return b}function cf(b){return.5>b?af(2*b):1-af(2*(b-.5))};function df(b){var c=b.source,d=m(b.start)?b.start:ta(),e=c[0],f=c[1],g=m(b.duration)?b.duration:1E3,h=m(b.easing)?b.easing:af;return function(b,c){if(c.time<d)return c.animate=!0,c.viewHints[0]+=1,!0;if(c.time<d+g){var p=1-h((c.time-d)/g),q=e-c.viewState.center[0],r=f-c.viewState.center[1];c.animate=!0;c.viewState.center[0]+=p*q;c.viewState.center[1]+=p*r;c.viewHints[0]+=1;return!0}return!1}}
function ef(b){var c=m(b.rotation)?b.rotation:0,d=m(b.start)?b.start:ta(),e=m(b.duration)?b.duration:1E3,f=m(b.easing)?b.easing:af,g=m(b.anchor)?b.anchor:null;return function(b,k){if(k.time<d)return k.animate=!0,k.viewHints[0]+=1,!0;if(k.time<d+e){var n=1-f((k.time-d)/e),n=(c-k.viewState.rotation)*n;k.animate=!0;k.viewState.rotation+=n;if(null!==g){var p=k.viewState.center;p[0]-=g[0];p[1]-=g[1];Bd(p,n);wd(p,g)}k.viewHints[0]+=1;return!0}return!1}}
function ff(b){var c=b.resolution,d=m(b.start)?b.start:ta(),e=m(b.duration)?b.duration:1E3,f=m(b.easing)?b.easing:af;return function(b,h){if(h.time<d)return h.animate=!0,h.viewHints[0]+=1,!0;if(h.time<d+e){var k=1-f((h.time-d)/e),n=c-h.viewState.resolution;h.animate=!0;h.viewState.resolution+=k*n;h.viewHints[0]+=1;return!0}return!1}};function gf(b,c,d,e){return m(e)?(e[0]=b,e[1]=c,e[2]=d,e):[b,c,d]}function hf(b,c,d){return b+"/"+c+"/"+d}function jf(b){var c=b[0],d=Array(c),e=1<<c-1,f,g;for(f=0;f<c;++f)g=48,b[1]&e&&(g+=1),b[2]&e&&(g+=2),d[f]=String.fromCharCode(g),e>>=1;return d.join("")}function kf(b){return hf(b[0],b[1],b[2])};function lf(b,c,d,e){this.a=b;this.c=c;this.b=d;this.d=e}function mf(b,c,d,e,f){return m(f)?(f.a=b,f.c=c,f.b=d,f.d=e,f):new lf(b,c,d,e)}lf.prototype.contains=function(b){return nf(this,b[1],b[2])};function nf(b,c,d){return b.a<=c&&c<=b.c&&b.b<=d&&d<=b.d}function of(b,c){return b.a==c.a&&b.b==c.b&&b.c==c.c&&b.d==c.d};function pf(b){this.d=b.html;this.a=m(b.tileRanges)?b.tileRanges:null}pf.prototype.b=function(){return this.d};var qf=!Gb||Gb&&9<=Sb;!Hb&&!Gb||Gb&&Gb&&9<=Sb||Hb&&Qb("1.9.1");Gb&&Qb("9");Eb("area base br col command embed hr img input keygen link meta param source track wbr".split(" "));Eb("action","cite","data","formaction","href","manifest","poster","src");Eb("embed","iframe","link","object","script","style","template");function rf(b,c){this.x=m(b)?b:0;this.y=m(c)?c:0}l=rf.prototype;l.clone=function(){return new rf(this.x,this.y)};l.ceil=function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this};l.floor=function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this};l.round=function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this};l.scale=function(b,c){var d=ja(c)?c:b;this.x*=b;this.y*=d;return this};function sf(b,c){this.width=b;this.height=c}l=sf.prototype;l.clone=function(){return new sf(this.width,this.height)};l.la=function(){return!(this.width*this.height)};l.ceil=function(){this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};l.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};l.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};
l.scale=function(b,c){var d=ja(c)?c:b;this.width*=b;this.height*=d;return this};function tf(b){return b?new uf(vf(b)):xa||(xa=new uf)}function wf(b){var c=document;return ia(b)?c.getElementById(b):b}function xf(b,c){ob(c,function(c,e){"style"==e?b.style.cssText=c:"class"==e?b.className=c:"for"==e?b.htmlFor=c:e in yf?b.setAttribute(yf[e],c):0==e.lastIndexOf("aria-",0)||0==e.lastIndexOf("data-",0)?b.setAttribute(e,c):b[e]=c})}
var yf={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"};function zf(b){b=b.document.documentElement;return new sf(b.clientWidth,b.clientHeight)}
function Af(b,c,d){var e=arguments,f=document,g=e[0],h=e[1];if(!qf&&h&&(h.name||h.type)){g=["<",g];h.name&&g.push(' name="',Ba(h.name),'"');if(h.type){g.push(' type="',Ba(h.type),'"');var k={};Db(k,h);delete k.type;h=k}g.push(">");g=g.join("")}g=f.createElement(g);h&&(ia(h)?g.className=h:ga(h)?g.className=h.join(" "):xf(g,h));2<e.length&&Bf(f,g,e,2);return g}
function Bf(b,c,d,e){function f(d){d&&c.appendChild(ia(d)?b.createTextNode(d):d)}for(;e<d.length;e++){var g=d[e];!ha(g)||la(g)&&0<g.nodeType?f(g):Qa(Cf(g)?$a(g):g,f)}}function Df(b){return document.createElement(b)}function Ef(b,c){Bf(vf(b),b,arguments,1)}function Ff(b){for(var c;c=b.firstChild;)b.removeChild(c)}function Gf(b,c,d){b.insertBefore(c,b.childNodes[d]||null)}function Hf(b){b&&b.parentNode&&b.parentNode.removeChild(b)}function If(b,c){var d=c.parentNode;d&&d.replaceChild(b,c)}
function Jf(b){if(void 0!=b.firstElementChild)b=b.firstElementChild;else for(b=b.firstChild;b&&1!=b.nodeType;)b=b.nextSibling;return b}function vf(b){return 9==b.nodeType?b:b.ownerDocument||b.document}function Cf(b){if(b&&"number"==typeof b.length){if(la(b))return"function"==typeof b.item||"string"==typeof b.item;if(ka(b))return"function"==typeof b.item}return!1}function uf(b){this.a=b||ba.document||document}function Kf(){return!0}
function Lf(b){var c=b.a;b=Ib?c.body||c.documentElement:c.documentElement;c=c.parentWindow||c.defaultView;return Gb&&Qb("10")&&c.pageYOffset!=b.scrollTop?new rf(b.scrollLeft,b.scrollTop):new rf(c.pageXOffset||b.scrollLeft,c.pageYOffset||b.scrollTop)}uf.prototype.appendChild=function(b,c){b.appendChild(c)};
uf.prototype.contains=function(b,c){if(b.contains&&1==c.nodeType)return b==c||b.contains(c);if("undefined"!=typeof b.compareDocumentPosition)return b==c||Boolean(b.compareDocumentPosition(c)&16);for(;c&&b!=c;)c=c.parentNode;return c==b};function Mf(b,c){var d=Df("CANVAS");m(b)&&(d.width=b);m(c)&&(d.height=c);return d.getContext("2d")}
var Nf=function(){var b;return function(){if(!m(b))if(ba.getComputedStyle){var c=Df("P"),d,e={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};document.body.appendChild(c);for(var f in e)f in c.style&&(c.style[f]="translate(1px,1px)",d=ba.getComputedStyle(c).getPropertyValue(e[f]));Hf(c);b=d&&"none"!==d}else b=!1;return b}}(),Of=function(){var b;return function(){if(!m(b))if(ba.getComputedStyle){var c=Df("P"),
d,e={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};document.body.appendChild(c);for(var f in e)f in c.style&&(c.style[f]="translate3d(1px,1px,1px)",d=ba.getComputedStyle(c).getPropertyValue(e[f]));Hf(c);b=d&&"none"!==d}else b=!1;return b}}();function Pf(b,c){var d=b.style;d.WebkitTransform=c;d.MozTransform=c;d.a=c;d.msTransform=c;d.transform=c;Gb&&!Vb&&(b.style.transformOrigin="0 0")}
function Qf(b,c){var d;if(Of()){if(m(6)){var e=Array(16);for(d=0;16>d;++d)e[d]=c[d].toFixed(6);d=e.join(",")}else d=c.join(",");Pf(b,"matrix3d("+d+")")}else if(Nf()){e=[c[0],c[1],c[4],c[5],c[12],c[13]];if(m(6)){var f=Array(6);for(d=0;6>d;++d)f[d]=e[d].toFixed(6);d=f.join(",")}else d=e.join(",");Pf(b,"matrix("+d+")")}else b.style.left=Math.round(c[12])+"px",b.style.top=Math.round(c[13])+"px"};var Sf=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function Tf(b,c){var d,e,f=Sf.length;for(e=0;e<f;++e)try{if(d=b.getContext(Sf[e],c),null!==d)return d}catch(g){}return null};var Uf,Vf=ba.devicePixelRatio||1,Wf="ArrayBuffer"in ba,Xf=!1,Yf=function(){if(!("HTMLCanvasElement"in ba))return!1;try{var b=Mf();if(null===b)return!1;m(b.setLineDash)&&(Xf=!0);return!0}catch(c){return!1}}(),Zf="DeviceOrientationEvent"in ba,$f="geolocation"in ba.navigator,ag="ontouchstart"in ba,bg="PointerEvent"in ba,cg=!!ba.navigator.msPointerEnabled,dg=!1,eg,fg=[];
if("WebGLRenderingContext"in ba)try{var gg=Df("CANVAS"),hg=Tf(gg,{vh:!0});null!==hg&&(dg=!0,eg=hg.getParameter(hg.MAX_TEXTURE_SIZE),fg=hg.getSupportedExtensions())}catch(ig){}Uf=dg;va=fg;ua=eg;function jg(b,c,d){rc.call(this,b,d);this.element=c}v(jg,rc);function kg(b){rd.call(this);this.a=m(b)?b:[];lg(this)}v(kg,rd);l=kg.prototype;l.clear=function(){for(;0<this.Ib();)this.pop()};l.ye=function(b){var c,d;c=0;for(d=b.length;c<d;++c)this.push(b[c]);return this};l.forEach=function(b,c){Qa(this.a,b,c)};l.kj=function(){return this.a};l.item=function(b){return this.a[b]};l.Ib=function(){return this.get("length")};l.zd=function(b,c){bb(this.a,b,0,c);lg(this);this.dispatchEvent(new jg("add",c,this))};
l.pop=function(){return this.Le(this.Ib()-1)};l.push=function(b){var c=this.a.length;this.zd(c,b);return c};l.remove=function(b){var c=this.a,d,e;d=0;for(e=c.length;d<e;++d)if(c[d]===b)return this.Le(d)};l.Le=function(b){var c=this.a[b];Oa.splice.call(this.a,b,1);lg(this);this.dispatchEvent(new jg("remove",c,this));return c};
l.Vl=function(b,c){var d=this.Ib();if(b<d)d=this.a[b],this.a[b]=c,this.dispatchEvent(new jg("remove",d,this)),this.dispatchEvent(new jg("add",c,this));else{for(;d<b;++d)this.zd(d,void 0);this.zd(b,c)}};function lg(b){b.set("length",b.a.length)};var mg=/^#(?:[0-9a-f]{3}){1,2}$/i,ng=/^(?:rgb)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2})\)$/i,og=/^(?:rgba)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|1|0\.\d{0,10})\)$/i;function pg(b){return ga(b)?b:qg(b)}function rg(b){if(!ia(b)){var c=b[0];c!=(c|0)&&(c=c+.5|0);var d=b[1];d!=(d|0)&&(d=d+.5|0);var e=b[2];e!=(e|0)&&(e=e+.5|0);b="rgba("+c+","+d+","+e+","+b[3]+")"}return b}
var qg=function(){var b={},c=0;return function(d){var e;if(b.hasOwnProperty(d))e=b[d];else{if(1024<=c){e=0;for(var f in b)0===(e++&3)&&(delete b[f],--c)}var g,h;mg.exec(d)?(h=3==d.length-1?1:2,e=parseInt(d.substr(1+0*h,h),16),f=parseInt(d.substr(1+1*h,h),16),g=parseInt(d.substr(1+2*h,h),16),1==h&&(e=(e<<4)+e,f=(f<<4)+f,g=(g<<4)+g),e=[e,f,g,1]):(h=og.exec(d))?(e=Number(h[1]),f=Number(h[2]),g=Number(h[3]),h=Number(h[4]),e=[e,f,g,h],e=sg(e,e)):(h=ng.exec(d))?(e=Number(h[1]),f=Number(h[2]),g=Number(h[3]),
e=[e,f,g,1],e=sg(e,e)):e=void 0;b[d]=e;++c}return e}}();function sg(b,c){var d=m(c)?c:[];d[0]=Wb(b[0]+.5|0,0,255);d[1]=Wb(b[1]+.5|0,0,255);d[2]=Wb(b[2]+.5|0,0,255);d[3]=Wb(b[3],0,1);return d};function tg(){this.g=Id();this.d=void 0;this.a=Id();this.c=void 0;this.b=Id();this.e=void 0;this.f=Id();this.i=void 0;this.n=Id()}
function ug(b,c,d,e,f){var g=!1;m(c)&&c!==b.d&&(g=b.a,Md(g),g[12]=c,g[13]=c,g[14]=c,g[15]=1,b.d=c,g=!0);if(m(d)&&d!==b.c){g=b.b;Md(g);g[0]=d;g[5]=d;g[10]=d;g[15]=1;var h=-.5*d+.5;g[12]=h;g[13]=h;g[14]=h;g[15]=1;b.c=d;g=!0}m(e)&&e!==b.e&&(g=Math.cos(e),h=Math.sin(e),Jd(b.f,.213+.787*g-.213*h,.213-.213*g+.143*h,.213-.213*g-.787*h,0,.715-.715*g-.715*h,.715+.285*g+.14*h,.715-.715*g+.715*h,0,.072-.072*g+.928*h,.072-.072*g-.283*h,.072+.928*g+.072*h,0,0,0,0,1),b.e=e,g=!0);m(f)&&f!==b.i&&(Jd(b.n,.213+.787*
f,.213-.213*f,.213-.213*f,0,.715-.715*f,.715+.285*f,.715-.715*f,0,.072-.072*f,.072-.072*f,.072+.928*f,0,0,0,0,1),b.i=f,g=!0);g&&(g=b.g,Md(g),m(d)&&Nd(g,b.b,g),m(c)&&Nd(g,b.a,g),m(f)&&Nd(g,b.n,g),m(e)&&Nd(g,b.f,g));return b.g};function vg(b){if(b.classList)return b.classList;b=b.className;return ia(b)&&b.match(/\S+/g)||[]}function wg(b,c){return b.classList?b.classList.contains(c):Wa(vg(b),c)}function xg(b,c){b.classList?b.classList.add(c):wg(b,c)||(b.className+=0<b.className.length?" "+c:c)}function yg(b,c){b.classList?b.classList.remove(c):wg(b,c)&&(b.className=Ra(vg(b),function(b){return b!=c}).join(" "))}function zg(b,c){wg(b,c)?yg(b,c):xg(b,c)};function Ag(b,c,d,e){this.top=b;this.right=c;this.bottom=d;this.left=e}l=Ag.prototype;l.clone=function(){return new Ag(this.top,this.right,this.bottom,this.left)};l.contains=function(b){return this&&b?b instanceof Ag?b.left>=this.left&&b.right<=this.right&&b.top>=this.top&&b.bottom<=this.bottom:b.x>=this.left&&b.x<=this.right&&b.y>=this.top&&b.y<=this.bottom:!1};
l.ceil=function(){this.top=Math.ceil(this.top);this.right=Math.ceil(this.right);this.bottom=Math.ceil(this.bottom);this.left=Math.ceil(this.left);return this};l.floor=function(){this.top=Math.floor(this.top);this.right=Math.floor(this.right);this.bottom=Math.floor(this.bottom);this.left=Math.floor(this.left);return this};l.round=function(){this.top=Math.round(this.top);this.right=Math.round(this.right);this.bottom=Math.round(this.bottom);this.left=Math.round(this.left);return this};
l.scale=function(b,c){var d=ja(c)?c:b;this.left*=b;this.right*=b;this.top*=d;this.bottom*=d;return this};function Bg(b,c,d,e){this.left=b;this.top=c;this.width=d;this.height=e}l=Bg.prototype;l.clone=function(){return new Bg(this.left,this.top,this.width,this.height)};l.contains=function(b){return b instanceof Bg?this.left<=b.left&&this.left+this.width>=b.left+b.width&&this.top<=b.top&&this.top+this.height>=b.top+b.height:b.x>=this.left&&b.x<=this.left+this.width&&b.y>=this.top&&b.y<=this.top+this.height};
function Cg(b,c){var d=c.x<b.left?b.left-c.x:Math.max(c.x-(b.left+b.width),0),e=c.y<b.top?b.top-c.y:Math.max(c.y-(b.top+b.height),0);return d*d+e*e}l.distance=function(b){return Math.sqrt(Cg(this,b))};l.ceil=function(){this.left=Math.ceil(this.left);this.top=Math.ceil(this.top);this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};
l.floor=function(){this.left=Math.floor(this.left);this.top=Math.floor(this.top);this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};l.round=function(){this.left=Math.round(this.left);this.top=Math.round(this.top);this.width=Math.round(this.width);this.height=Math.round(this.height);return this};l.scale=function(b,c){var d=ja(c)?c:b;this.left*=b;this.width*=b;this.top*=d;this.height*=d;return this};function Dg(b,c){var d=vf(b);return d.defaultView&&d.defaultView.getComputedStyle&&(d=d.defaultView.getComputedStyle(b,null))?d[c]||d.getPropertyValue(c)||"":""}function Eg(b,c){return Dg(b,c)||(b.currentStyle?b.currentStyle[c]:null)||b.style&&b.style[c]}function Fg(b,c,d){var e;c instanceof rf?(e=c.x,c=c.y):(e=c,c=d);b.style.left=Gg(e);b.style.top=Gg(c)}
function Hg(b){var c;try{c=b.getBoundingClientRect()}catch(d){return{left:0,top:0,right:0,bottom:0}}Gb&&b.ownerDocument.body&&(b=b.ownerDocument,c.left-=b.documentElement.clientLeft+b.body.clientLeft,c.top-=b.documentElement.clientTop+b.body.clientTop);return c}
function Ig(b){if(1==b.nodeType)return b=Hg(b),new rf(b.left,b.top);var c=ka(b.Ah),d=b;b.targetTouches&&b.targetTouches.length?d=b.targetTouches[0]:c&&b.a.targetTouches&&b.a.targetTouches.length&&(d=b.a.targetTouches[0]);return new rf(d.clientX,d.clientY)}function Gg(b){"number"==typeof b&&(b=b+"px");return b}
function Jg(b){var c=Kg;if("none"!=Eg(b,"display"))return c(b);var d=b.style,e=d.display,f=d.visibility,g=d.position;d.visibility="hidden";d.position="absolute";d.display="inline";b=c(b);d.display=e;d.position=g;d.visibility=f;return b}function Kg(b){var c=b.offsetWidth,d=b.offsetHeight,e=Ib&&!c&&!d;return m(c)&&!e||!b.getBoundingClientRect?new sf(c,d):(b=Hg(b),new sf(b.right-b.left,b.bottom-b.top))}function Lg(b,c){b.style.display=c?"":"none"}
function Mg(b,c,d,e){if(/^\d+px?$/.test(c))return parseInt(c,10);var f=b.style[d],g=b.runtimeStyle[d];b.runtimeStyle[d]=b.currentStyle[d];b.style[d]=c;c=b.style[e];b.style[d]=f;b.runtimeStyle[d]=g;return c}function Ng(b,c){var d=b.currentStyle?b.currentStyle[c]:null;return d?Mg(b,d,"left","pixelLeft"):0}
function Og(b,c){if(Gb){var d=Ng(b,c+"Left"),e=Ng(b,c+"Right"),f=Ng(b,c+"Top"),g=Ng(b,c+"Bottom");return new Ag(f,e,g,d)}d=Dg(b,c+"Left");e=Dg(b,c+"Right");f=Dg(b,c+"Top");g=Dg(b,c+"Bottom");return new Ag(parseFloat(f),parseFloat(e),parseFloat(g),parseFloat(d))}var Pg={thin:2,medium:4,thick:6};function Qg(b,c){if("none"==(b.currentStyle?b.currentStyle[c+"Style"]:null))return 0;var d=b.currentStyle?b.currentStyle[c+"Width"]:null;return d in Pg?Pg[d]:Mg(b,d,"left","pixelLeft")}
function Rg(b){if(Gb&&!(Gb&&9<=Sb)){var c=Qg(b,"borderLeft"),d=Qg(b,"borderRight"),e=Qg(b,"borderTop");b=Qg(b,"borderBottom");return new Ag(e,d,b,c)}c=Dg(b,"borderLeftWidth");d=Dg(b,"borderRightWidth");e=Dg(b,"borderTopWidth");b=Dg(b,"borderBottomWidth");return new Ag(parseFloat(e),parseFloat(d),parseFloat(b),parseFloat(c))};function Sg(b,c,d){rc.call(this,b);this.map=c;this.frameState=m(d)?d:null}v(Sg,rc);function Tg(b){rd.call(this);this.element=m(b.element)?b.element:null;this.a=this.i=null;this.q=[];this.render=m(b.render)?b.render:ca;m(b.target)&&this.b(b.target)}v(Tg,rd);Tg.prototype.P=function(){Hf(this.element);Tg.T.P.call(this)};Tg.prototype.f=function(){return this.a};
Tg.prototype.setMap=function(b){null===this.a||Hf(this.element);0!=this.q.length&&(Qa(this.q,Xc),this.q.length=0);this.a=b;null!==this.a&&((null===this.i?b.H:this.i).appendChild(this.element),this.render!==ca&&this.q.push(w(b,"postrender",this.render,!1,this)),b.render())};Tg.prototype.b=function(b){this.i=wf(b)};function Ug(b){b=m(b)?b:{};this.r=Df("UL");this.o=Df("LI");this.r.appendChild(this.o);Lg(this.o,!1);this.c=m(b.collapsed)?b.collapsed:!0;this.g=m(b.collapsible)?b.collapsible:!0;this.g||(this.c=!1);var c=m(b.className)?b.className:"ol-attribution",d=m(b.tipLabel)?b.tipLabel:"Attributions",e=m(b.collapseLabel)?b.collapseLabel:"\u00bb";this.D=ia(e)?Af("SPAN",{},e):e;e=m(b.label)?b.label:"i";this.H=ia(e)?Af("SPAN",{},e):e;d=Af("BUTTON",{type:"button",title:d},this.g&&!this.c?this.D:this.H);w(d,"click",
this.Ej,!1,this);w(d,["mouseout",vc],function(){this.blur()},!1);c=Af("DIV",c+" ol-unselectable ol-control"+(this.c&&this.g?" ol-collapsed":"")+(this.g?"":" ol-uncollapsible"),this.r,d);Tg.call(this,{element:c,render:m(b.render)?b.render:Vg,target:b.target});this.p=!0;this.k={};this.e={};this.N={}}v(Ug,Tg);
function Vg(b){b=b.frameState;if(null===b)this.p&&(Lg(this.element,!1),this.p=!1);else{var c,d,e,f,g,h,k,n,p,q=b.layerStatesArray,r=Bb(b.attributions),s={};d=0;for(c=q.length;d<c;d++)if(e=q[d].layer.a(),null!==e&&(p=ma(e).toString(),n=e.f,null!==n))for(e=0,f=n.length;e<f;e++)if(h=n[e],k=ma(h).toString(),!(k in r)){g=b.usedTiles[p];var u;if(u=m(g))a:if(null===h.a)u=!0;else{var z=u=void 0,y=void 0,A=void 0;for(A in g)if(A in h.a)for(y=g[A],u=0,z=h.a[A].length;u<z;++u){var D=h.a[A][u];if(D.a<=y.c&&D.c>=
y.a&&D.b<=y.d&&D.d>=y.b){u=!0;break a}}u=!1}u?(k in s&&delete s[k],r[k]=h):s[k]=h}c=[r,s];d=c[0];c=c[1];for(var x in this.k)x in d?(this.e[x]||(Lg(this.k[x],!0),this.e[x]=!0),delete d[x]):x in c?(this.e[x]&&(Lg(this.k[x],!1),delete this.e[x]),delete c[x]):(Hf(this.k[x]),delete this.k[x],delete this.e[x]);for(x in d)p=Df("LI"),p.innerHTML=d[x].d,this.r.appendChild(p),this.k[x]=p,this.e[x]=!0;for(x in c)p=Df("LI"),p.innerHTML=c[x].d,Lg(p,!1),this.r.appendChild(p),this.k[x]=p;x=!wb(this.e)||!wb(b.logos);
this.p!=x&&(Lg(this.element,x),this.p=x);x&&wb(this.e)?xg(this.element,"ol-logo-only"):yg(this.element,"ol-logo-only");var M;b=b.logos;x=this.N;for(M in x)M in b||(Hf(x[M]),delete x[M]);for(var Q in b)Q in x||(M=new Image,M.src=Q,d=b[Q],""===d?d=M:(d=Af("A",{href:d}),d.appendChild(M)),this.o.appendChild(d),x[Q]=d);Lg(this.o,!wb(b))}}l=Ug.prototype;l.Ej=function(b){b.preventDefault();Wg(this)};function Wg(b){zg(b.element,"ol-collapsed");b.c?If(b.D,b.H):If(b.H,b.D);b.c=!b.c}l.Dj=function(){return this.g};
l.Gj=function(b){this.g!==b&&(this.g=b,zg(this.element,"ol-uncollapsible"),!b&&this.c&&Wg(this))};l.Fj=function(b){this.g&&this.c!==b&&Wg(this)};l.Cj=function(){return this.c};function Xg(b){b=m(b)?b:{};var c=m(b.className)?b.className:"ol-rotate",d=m(b.label)?b.label:"\u21e7";this.c=null;ia(d)?this.c=Af("SPAN","ol-compass",d):(this.c=d,xg(this.c,"ol-compass"));d=Af("BUTTON",{"class":c+"-reset",type:"button",title:m(b.tipLabel)?b.tipLabel:"Reset rotation"},this.c);w(d,"click",Xg.prototype.o,!1,this);w(d,["mouseout",vc],function(){this.blur()},!1);c=Af("DIV",c+" ol-unselectable ol-control",d);Tg.call(this,{element:c,render:m(b.render)?b.render:Yg,target:b.target});this.g=
m(b.duration)?b.duration:250;this.e=m(b.autoHide)?b.autoHide:!0;this.k=void 0;this.e&&xg(this.element,"ol-hidden")}v(Xg,Tg);Xg.prototype.o=function(b){b.preventDefault();b=this.a;var c=b.a();if(null!==c){for(var d=c.c();d<-Math.PI;)d+=2*Math.PI;for(;d>Math.PI;)d-=2*Math.PI;m(d)&&(0<this.g&&b.La(ef({rotation:d,duration:this.g,easing:$e})),c.r(0))}};
function Yg(b){b=b.frameState;if(null!==b){b=b.viewState.rotation;if(b!=this.k){var c="rotate("+180*b/Math.PI+"deg)";if(this.e){var d=this.element;0===b?xg(d,"ol-hidden"):yg(d,"ol-hidden")}this.c.style.msTransform=c;this.c.style.webkitTransform=c;this.c.style.transform=c}this.k=b}};function Zg(b){b=m(b)?b:{};var c=m(b.className)?b.className:"ol-zoom",d=m(b.delta)?b.delta:1,e=m(b.zoomOutLabel)?b.zoomOutLabel:"\u2212",f=m(b.zoomOutTipLabel)?b.zoomOutTipLabel:"Zoom out",g=Af("BUTTON",{"class":c+"-in",type:"button",title:m(b.zoomInTipLabel)?b.zoomInTipLabel:"Zoom in"},m(b.zoomInLabel)?b.zoomInLabel:"+");w(g,"click",sa(Zg.prototype.e,d),!1,this);w(g,["mouseout",vc],function(){this.blur()},!1);e=Af("BUTTON",{"class":c+"-out",type:"button",title:f},e);w(e,"click",sa(Zg.prototype.e,
-d),!1,this);w(e,["mouseout",vc],function(){this.blur()},!1);c=Af("DIV",c+" ol-unselectable ol-control",g,e);Tg.call(this,{element:c,target:b.target});this.c=m(b.duration)?b.duration:250}v(Zg,Tg);Zg.prototype.e=function(b,c){c.preventDefault();var d=this.a,e=d.a();if(null!==e){var f=e.a();m(f)&&(0<this.c&&d.La(ff({resolution:f,duration:this.c,easing:$e})),d=e.constrainResolution(f,b),e.f(d))}};function $g(b){b=m(b)?b:{};var c=new kg;(m(b.zoom)?b.zoom:1)&&c.push(new Zg(b.zoomOptions));(m(b.rotate)?b.rotate:1)&&c.push(new Xg(b.rotateOptions));(m(b.attribution)?b.attribution:1)&&c.push(new Ug(b.attributionOptions));return c};var ah=Ib?"webkitfullscreenchange":Hb?"mozfullscreenchange":Gb?"MSFullscreenChange":"fullscreenchange";function bh(){var b=tf().a,c=b.body;return!!(c.webkitRequestFullscreen||c.mozRequestFullScreen&&b.mozFullScreenEnabled||c.msRequestFullscreen&&b.msFullscreenEnabled||c.requestFullscreen&&b.fullscreenEnabled)}
function ch(b){b.webkitRequestFullscreen?b.webkitRequestFullscreen():b.mozRequestFullScreen?b.mozRequestFullScreen():b.msRequestFullscreen?b.msRequestFullscreen():b.requestFullscreen&&b.requestFullscreen()}function dh(){var b=tf().a;return!!(b.webkitIsFullScreen||b.mozFullScreen||b.msFullscreenElement||b.fullscreenElement)};function eh(b){b=m(b)?b:{};this.e=m(b.className)?b.className:"ol-full-screen";var c=m(b.label)?b.label:"\u2194";this.c=ia(c)?document.createTextNode(String(c)):c;c=m(b.labelActive)?b.labelActive:"\u00d7";this.g=ia(c)?document.createTextNode(String(c)):c;c=m(b.tipLabel)?b.tipLabel:"Toggle full-screen";c=Af("BUTTON",{"class":this.e+"-"+dh(),type:"button",title:c},this.c);w(c,"click",this.p,!1,this);w(c,["mouseout",vc],function(){this.blur()},!1);w(ba.document,ah,this.k,!1,this);var d=this.e+" ol-unselectable ol-control "+
(bh()?"":"ol-unsupported"),c=Af("DIV",d,c);Tg.call(this,{element:c,target:b.target});this.o=m(b.keys)?b.keys:!1}v(eh,Tg);
eh.prototype.p=function(b){b.preventDefault();bh()&&(b=this.a,null!==b&&(dh()?(b=tf().a,b.webkitCancelFullScreen?b.webkitCancelFullScreen():b.mozCancelFullScreen?b.mozCancelFullScreen():b.msExitFullscreen?b.msExitFullscreen():b.exitFullscreen&&b.exitFullscreen()):(b=b.Fd(),b=wf(b),this.o?b.mozRequestFullScreenWithKeys?b.mozRequestFullScreenWithKeys():b.webkitRequestFullscreen?b.webkitRequestFullscreen():ch(b):ch(b))))};
eh.prototype.k=function(){var b=this.a;dh()?If(this.g,this.c):If(this.c,this.g);null===b||b.q()};function fh(b){b=m(b)?b:{};var c=Af("DIV",m(b.className)?b.className:"ol-mouse-position");Tg.call(this,{element:c,render:m(b.render)?b.render:gh,target:b.target});w(this,vd("projection"),this.S,!1,this);m(b.coordinateFormat)&&this.D(b.coordinateFormat);m(b.projection)&&this.r(Be(b.projection));this.W=m(b.undefinedHTML)?b.undefinedHTML:"";this.o=c.innerHTML;this.g=this.e=this.c=null}v(fh,Tg);
function gh(b){b=b.frameState;null===b?this.c=null:this.c!=b.viewState.projection&&(this.c=b.viewState.projection,this.e=null);hh(this,this.g)}fh.prototype.S=function(){this.e=null};fh.prototype.k=function(){return this.get("coordinateFormat")};fh.prototype.getCoordinateFormat=fh.prototype.k;fh.prototype.p=function(){return this.get("projection")};fh.prototype.getProjection=fh.prototype.p;fh.prototype.H=function(b){this.g=this.a.hd(b.a);hh(this,this.g)};
fh.prototype.N=function(){hh(this,null);this.g=null};fh.prototype.setMap=function(b){fh.T.setMap.call(this,b);null!==b&&(b=b.b,this.q.push(w(b,"mousemove",this.H,!1,this),w(b,"mouseout",this.N,!1,this)))};fh.prototype.D=function(b){this.set("coordinateFormat",b)};fh.prototype.setCoordinateFormat=fh.prototype.D;fh.prototype.r=function(b){this.set("projection",b)};fh.prototype.setProjection=fh.prototype.r;
function hh(b,c){var d=b.W;if(null!==c&&null!==b.c){if(null===b.e){var e=b.p();b.e=m(e)?Ae(b.c,e):Ue}e=b.a.ra(c);null!==e&&(b.e(e,e),d=b.k(),d=m(d)?d(e):e.toString())}m(b.o)&&d==b.o||(b.element.innerHTML=d,b.o=d)};function ih(b,c,d){mc.call(this);this.c=b;this.b=d;this.a=c||window;this.d=ra(this.kf,this)}v(ih,mc);l=ih.prototype;l.aa=null;l.Qe=!1;l.start=function(){jh(this);this.Qe=!1;var b=kh(this),c=lh(this);b&&!c&&this.a.mozRequestAnimationFrame?(this.aa=w(this.a,"MozBeforePaint",this.d),this.a.mozRequestAnimationFrame(null),this.Qe=!0):this.aa=b&&c?b.call(this.a,this.d):this.a.setTimeout(fd(this.d),20)};
function jh(b){if(null!=b.aa){var c=kh(b),d=lh(b);c&&!d&&b.a.mozRequestAnimationFrame?Xc(b.aa):c&&d?d.call(b.a,b.aa):b.a.clearTimeout(b.aa)}b.aa=null}l.kf=function(){this.Qe&&this.aa&&Xc(this.aa);this.aa=null;this.c.call(this.b,ta())};l.P=function(){jh(this);ih.T.P.call(this)};function kh(b){b=b.a;return b.requestAnimationFrame||b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame||b.oRequestAnimationFrame||b.msRequestAnimationFrame||null}
function lh(b){b=b.a;return b.cancelAnimationFrame||b.cancelRequestAnimationFrame||b.webkitCancelRequestAnimationFrame||b.mozCancelRequestAnimationFrame||b.oCancelRequestAnimationFrame||b.msCancelRequestAnimationFrame||null};function mh(b){ba.setTimeout(function(){throw b;},0)}function nh(b,c){var d=b;c&&(d=ra(b,c));d=oh(d);!ka(ba.setImmediate)||ba.Window&&ba.Window.prototype.setImmediate==ba.setImmediate?(ph||(ph=qh()),ph(d)):ba.setImmediate(d)}var ph;
function qh(){var b=ba.MessageChannel;"undefined"===typeof b&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&(b=function(){var b=document.createElement("iframe");b.style.display="none";b.src="";document.documentElement.appendChild(b);var c=b.contentWindow,b=c.document;b.open();b.write("");b.close();var d="callImmediate"+Math.random(),e="file:"==c.location.protocol?"*":c.location.protocol+"//"+c.location.host,b=ra(function(b){if(("*"==e||b.origin==e)&&b.data==d)this.port1.onmessage()},
this);c.addEventListener("message",b,!1);this.port1={};this.port2={postMessage:function(){c.postMessage(d,e)}}});if("undefined"!==typeof b&&!kb("Trident")&&!kb("MSIE")){var c=new b,d={},e=d;c.port1.onmessage=function(){if(m(d.next)){d=d.next;var b=d.ff;d.ff=null;b()}};return function(b){e.next={ff:b};e=e.next;c.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("script")?function(b){var c=document.createElement("script");c.onreadystatechange=function(){c.onreadystatechange=
null;c.parentNode.removeChild(c);c=null;b();b=null};document.documentElement.appendChild(c)}:function(b){ba.setTimeout(b,0)}}var oh=ed;function rh(b){if("function"==typeof b.ob)return b.ob();if(ia(b))return b.split("");if(ha(b)){for(var c=[],d=b.length,e=0;e<d;e++)c.push(b[e]);return c}return rb(b)}
function sh(b,c){if("function"==typeof b.forEach)b.forEach(c,void 0);else if(ha(b)||ia(b))Qa(b,c,void 0);else{var d;if("function"==typeof b.G)d=b.G();else if("function"!=typeof b.ob)if(ha(b)||ia(b)){d=[];for(var e=b.length,f=0;f<e;f++)d.push(f)}else d=sb(b);else d=void 0;for(var e=rh(b),f=e.length,g=0;g<f;g++)c.call(void 0,e[g],d&&d[g],b)}};function th(b,c){this.d={};this.a=[];this.b=0;var d=arguments.length;if(1<d){if(d%2)throw Error("Uneven number of arguments");for(var e=0;e<d;e+=2)this.set(arguments[e],arguments[e+1])}else if(b){b instanceof th?(d=b.G(),e=b.ob()):(d=sb(b),e=rb(b));for(var f=0;f<d.length;f++)this.set(d[f],e[f])}}l=th.prototype;l.Tb=function(){return this.b};l.ob=function(){uh(this);for(var b=[],c=0;c<this.a.length;c++)b.push(this.d[this.a[c]]);return b};l.G=function(){uh(this);return this.a.concat()};
l.la=function(){return 0==this.b};l.clear=function(){this.d={};this.b=this.a.length=0};l.remove=function(b){return vh(this.d,b)?(delete this.d[b],this.b--,this.a.length>2*this.b&&uh(this),!0):!1};function uh(b){if(b.b!=b.a.length){for(var c=0,d=0;c<b.a.length;){var e=b.a[c];vh(b.d,e)&&(b.a[d++]=e);c++}b.a.length=d}if(b.b!=b.a.length){for(var f={},d=c=0;c<b.a.length;)e=b.a[c],vh(f,e)||(b.a[d++]=e,f[e]=1),c++;b.a.length=d}}l.get=function(b,c){return vh(this.d,b)?this.d[b]:c};
l.set=function(b,c){vh(this.d,b)||(this.b++,this.a.push(b));this.d[b]=c};l.forEach=function(b,c){for(var d=this.G(),e=0;e<d.length;e++){var f=d[e],g=this.get(f);b.call(c,g,f,this)}};l.clone=function(){return new th(this)};function vh(b,c){return Object.prototype.hasOwnProperty.call(b,c)};function wh(){this.a=ta()}new wh;wh.prototype.set=function(b){this.a=b};wh.prototype.get=function(){return this.a};function xh(b){id.call(this);this.Wc=b||window;this.ud=w(this.Wc,"resize",this.Ni,!1,this);this.vd=zf(this.Wc||window)}v(xh,id);l=xh.prototype;l.ud=null;l.Wc=null;l.vd=null;l.P=function(){xh.T.P.call(this);this.ud&&(Xc(this.ud),this.ud=null);this.vd=this.Wc=null};l.Ni=function(){var b=zf(this.Wc||window),c=this.vd;b==c||b&&c&&b.width==c.width&&b.height==c.height||(this.vd=b,this.dispatchEvent("resize"))};function yh(b,c,d,e,f){if(!(Gb||Ib&&Qb("525")))return!0;if(Jb&&f)return zh(b);if(f&&!e)return!1;ja(c)&&(c=Ah(c));if(!d&&(17==c||18==c||Jb&&91==c))return!1;if(Ib&&e&&d)switch(b){case 220:case 219:case 221:case 192:case 186:case 189:case 187:case 188:case 190:case 191:case 192:case 222:return!1}if(Gb&&e&&c==b)return!1;switch(b){case 13:return!0;case 27:return!Ib}return zh(b)}
function zh(b){if(48<=b&&57>=b||96<=b&&106>=b||65<=b&&90>=b||Ib&&0==b)return!0;switch(b){case 32:case 63:case 107:case 109:case 110:case 111:case 186:case 59:case 189:case 187:case 61:case 188:case 190:case 191:case 192:case 222:case 219:case 220:case 221:return!0;default:return!1}}function Ah(b){if(Hb)b=Bh(b);else if(Jb&&Ib)a:switch(b){case 93:b=91;break a}return b}
function Bh(b){switch(b){case 61:return 187;case 59:return 186;case 173:return 189;case 224:return 91;case 0:return 224;default:return b}};function Ch(b,c){id.call(this);b&&Dh(this,b,c)}v(Ch,id);l=Ch.prototype;l.ba=null;l.Ad=null;l.ve=null;l.Bd=null;l.Qa=-1;l.Gb=-1;l.je=!1;
var Eh={3:13,12:144,63232:38,63233:40,63234:37,63235:39,63236:112,63237:113,63238:114,63239:115,63240:116,63241:117,63242:118,63243:119,63244:120,63245:121,63246:122,63247:123,63248:44,63272:46,63273:36,63275:35,63276:33,63277:34,63289:144,63302:45},Fh={Up:38,Down:40,Left:37,Right:39,Enter:13,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,"U+007F":46,Home:36,End:35,PageUp:33,PageDown:34,Insert:45},Gh=Gb||Ib&&Qb("525"),Hh=Jb&&Hb;
Ch.prototype.a=function(b){Ib&&(17==this.Qa&&!b.n||18==this.Qa&&!b.d||Jb&&91==this.Qa&&!b.k)&&(this.Gb=this.Qa=-1);-1==this.Qa&&(b.n&&17!=b.f?this.Qa=17:b.d&&18!=b.f?this.Qa=18:b.k&&91!=b.f&&(this.Qa=91));Gh&&!yh(b.f,this.Qa,b.c,b.n,b.d)?this.handleEvent(b):(this.Gb=Ah(b.f),Hh&&(this.je=b.d))};Ch.prototype.d=function(b){this.Gb=this.Qa=-1;this.je=b.d};
Ch.prototype.handleEvent=function(b){var c=b.a,d,e,f=c.altKey;Gb&&"keypress"==b.type?(d=this.Gb,e=13!=d&&27!=d?c.keyCode:0):Ib&&"keypress"==b.type?(d=this.Gb,e=0<=c.charCode&&63232>c.charCode&&zh(d)?c.charCode:0):Fb?(d=this.Gb,e=zh(d)?c.keyCode:0):(d=c.keyCode||this.Gb,e=c.charCode||0,Hh&&(f=this.je),Jb&&63==e&&224==d&&(d=191));var g=d=Ah(d),h=c.keyIdentifier;d?63232<=d&&d in Eh?g=Eh[d]:25==d&&b.c&&(g=9):h&&h in Fh&&(g=Fh[h]);this.Qa=g;b=new Ih(g,e,0,c);b.d=f;this.dispatchEvent(b)};
function Dh(b,c,d){b.Bd&&Jh(b);b.ba=c;b.Ad=w(b.ba,"keypress",b,d);b.ve=w(b.ba,"keydown",b.a,d,b);b.Bd=w(b.ba,"keyup",b.d,d,b)}function Jh(b){b.Ad&&(Xc(b.Ad),Xc(b.ve),Xc(b.Bd),b.Ad=null,b.ve=null,b.Bd=null);b.ba=null;b.Qa=-1;b.Gb=-1}Ch.prototype.P=function(){Ch.T.P.call(this);Jh(this)};function Ih(b,c,d,e){xc.call(this,e);this.type="key";this.f=b;this.i=c}v(Ih,xc);function Kh(b,c){id.call(this);var d=this.ba=b;(d=la(d)&&1==d.nodeType?this.ba:this.ba?this.ba.body:null)&&Eg(d,"direction");this.a=w(this.ba,Hb?"DOMMouseScroll":"mousewheel",this,c)}v(Kh,id);
Kh.prototype.handleEvent=function(b){var c=0,d=0,e=0;b=b.a;if("mousewheel"==b.type){d=1;if(Gb||Ib&&(Kb||Qb("532.0")))d=40;e=Lh(-b.wheelDelta,d);m(b.wheelDeltaX)?(c=Lh(-b.wheelDeltaX,d),d=Lh(-b.wheelDeltaY,d)):d=e}else e=b.detail,100<e?e=3:-100>e&&(e=-3),m(b.axis)&&b.axis===b.HORIZONTAL_AXIS?c=e:d=e;ja(this.d)&&Wb(c,-this.d,this.d);ja(this.b)&&(d=Wb(d,-this.b,this.b));c=new Mh(e,b,0,d);this.dispatchEvent(c)};function Lh(b,c){return Ib&&(Jb||Lb)&&0!=b%c?b:b/c}
Kh.prototype.P=function(){Kh.T.P.call(this);Xc(this.a);this.a=null};function Mh(b,c,d,e){xc.call(this,c);this.type="mousewheel";this.detail=b;this.q=e}v(Mh,xc);function Nh(b,c,d){rc.call(this,b);this.a=c;b=m(d)?d:{};this.buttons=Oh(b);this.pressure=Ph(b,this.buttons);this.bubbles=zb(b,"bubbles",!1);this.cancelable=zb(b,"cancelable",!1);this.view=zb(b,"view",null);this.detail=zb(b,"detail",null);this.screenX=zb(b,"screenX",0);this.screenY=zb(b,"screenY",0);this.clientX=zb(b,"clientX",0);this.clientY=zb(b,"clientY",0);this.button=zb(b,"button",0);this.relatedTarget=zb(b,"relatedTarget",null);this.pointerId=zb(b,"pointerId",0);this.width=zb(b,"width",0);this.height=
zb(b,"height",0);this.pointerType=zb(b,"pointerType","");this.isPrimary=zb(b,"isPrimary",!1);c.preventDefault&&(this.preventDefault=function(){c.preventDefault()})}v(Nh,rc);function Oh(b){if(b.buttons||Qh)b=b.buttons;else switch(b.which){case 1:b=1;break;case 2:b=4;break;case 3:b=2;break;default:b=0}return b}function Ph(b,c){var d=0;b.pressure?d=b.pressure:d=c?.5:0;return d}var Qh=!1;try{Qh=1===(new MouseEvent("click",{buttons:1})).buttons}catch(Rh){};function Sh(b,c){this.a=b;this.f=c};function Th(b){Sh.call(this,b,{mousedown:this.Xi,mousemove:this.Yi,mouseup:this.aj,mouseover:this.$i,mouseout:this.Zi});this.d=b.d;this.b=[]}v(Th,Sh);function Uh(b,c){for(var d=b.b,e=c.clientX,f=c.clientY,g=0,h=d.length,k;g<h&&(k=d[g]);g++){var n=Math.abs(f-k[1]);if(25>=Math.abs(e-k[0])&&25>=n)return!0}return!1}function Wh(b){var c=Xh(b,b.a),d=c.preventDefault;c.preventDefault=function(){b.preventDefault();d()};c.pointerId=1;c.isPrimary=!0;c.pointerType="mouse";return c}l=Th.prototype;
l.Xi=function(b){if(!Uh(this,b)){(1).toString()in this.d&&this.cancel(b);var c=Wh(b);this.d[(1).toString()]=b;Yh(this.a,Zh,c,b)}};l.Yi=function(b){if(!Uh(this,b)){var c=Wh(b);Yh(this.a,$h,c,b)}};l.aj=function(b){if(!Uh(this,b)){var c=this.d[(1).toString()];c&&c.button===b.button&&(c=Wh(b),Yh(this.a,ai,c,b),yb(this.d,(1).toString()))}};l.$i=function(b){if(!Uh(this,b)){var c=Wh(b);bi(this.a,c,b)}};l.Zi=function(b){if(!Uh(this,b)){var c=Wh(b);ci(this.a,c,b)}};
l.cancel=function(b){var c=Wh(b);this.a.cancel(c,b);yb(this.d,(1).toString())};function di(b){Sh.call(this,b,{MSPointerDown:this.fj,MSPointerMove:this.gj,MSPointerUp:this.jj,MSPointerOut:this.hj,MSPointerOver:this.ij,MSPointerCancel:this.ej,MSGotPointerCapture:this.cj,MSLostPointerCapture:this.dj});this.d=b.d;this.b=["","unavailable","touch","pen","mouse"]}v(di,Sh);function ei(b,c){var d=c;ja(c.a.pointerType)&&(d=Xh(c,c.a),d.pointerType=b.b[c.a.pointerType]);return d}l=di.prototype;l.fj=function(b){this.d[b.a.pointerId]=b;var c=ei(this,b);Yh(this.a,Zh,c,b)};
l.gj=function(b){var c=ei(this,b);Yh(this.a,$h,c,b)};l.jj=function(b){var c=ei(this,b);Yh(this.a,ai,c,b);yb(this.d,b.a.pointerId)};l.hj=function(b){var c=ei(this,b);ci(this.a,c,b)};l.ij=function(b){var c=ei(this,b);bi(this.a,c,b)};l.ej=function(b){var c=ei(this,b);this.a.cancel(c,b);yb(this.d,b.a.pointerId)};l.dj=function(b){this.a.dispatchEvent(new Nh("lostpointercapture",b,b.a))};l.cj=function(b){this.a.dispatchEvent(new Nh("gotpointercapture",b,b.a))};function fi(b){Sh.call(this,b,{pointerdown:this.ql,pointermove:this.rl,pointerup:this.ul,pointerout:this.sl,pointerover:this.tl,pointercancel:this.pl,gotpointercapture:this.li,lostpointercapture:this.Wi})}v(fi,Sh);l=fi.prototype;l.ql=function(b){gi(this.a,b)};l.rl=function(b){gi(this.a,b)};l.ul=function(b){gi(this.a,b)};l.sl=function(b){gi(this.a,b)};l.tl=function(b){gi(this.a,b)};l.pl=function(b){gi(this.a,b)};l.Wi=function(b){gi(this.a,b)};l.li=function(b){gi(this.a,b)};function hi(b,c){Sh.call(this,b,{touchstart:this.nm,touchmove:this.mm,touchend:this.lm,touchcancel:this.km});this.d=b.d;this.g=c;this.b=void 0;this.e=0;this.c=void 0}v(hi,Sh);l=hi.prototype;l.og=function(){this.e=0;this.c=void 0};
function ii(b,c,d){c=Xh(c,d);c.pointerId=d.identifier+2;c.bubbles=!0;c.cancelable=!0;c.detail=b.e;c.button=0;c.buttons=1;c.width=d.webkitRadiusX||d.radiusX||0;c.height=d.webkitRadiusY||d.radiusY||0;c.pressure=d.webkitForce||d.force||.5;c.isPrimary=b.b===d.identifier;c.pointerType="touch";c.clientX=d.clientX;c.clientY=d.clientY;c.screenX=d.screenX;c.screenY=d.screenY;return c}
function ji(b,c,d){function e(){c.preventDefault()}var f=Array.prototype.slice.call(c.a.changedTouches),g=f.length,h,k;for(h=0;h<g;++h)k=ii(b,c,f[h]),k.preventDefault=e,d.call(b,c,k)}
l.nm=function(b){var c=b.a.touches,d=sb(this.d),e=d.length;if(e>=c.length){var f=[],g,h,k;for(g=0;g<e;++g){h=d[g];k=this.d[h];var n;if(!(n=1==h))a:{n=c.length;for(var p=void 0,q=0;q<n;q++)if(p=c[q],p.identifier===h-2){n=!0;break a}n=!1}n||f.push(k.dc)}for(g=0;g<f.length;++g)this.ke(b,f[g])}c=qb(this.d);if(0===c||1===c&&(1).toString()in this.d)this.b=b.a.changedTouches[0].identifier,m(this.c)&&ba.clearTimeout(this.c);ki(this,b);this.e++;ji(this,b,this.ll)};
l.ll=function(b,c){this.d[c.pointerId]={target:c.target,dc:c,$f:c.target};var d=this.a;c.bubbles=!0;Yh(d,li,c,b);d=this.a;c.bubbles=!1;Yh(d,mi,c,b);Yh(this.a,Zh,c,b)};l.mm=function(b){b.preventDefault();ji(this,b,this.bj)};l.bj=function(b,c){var d=this.d[c.pointerId];if(d){var e=d.dc,f=d.$f;Yh(this.a,$h,c,b);e&&f!==c.target&&(e.relatedTarget=c.target,c.relatedTarget=f,e.target=f,c.target?(ci(this.a,e,b),bi(this.a,c,b)):(c.target=f,c.relatedTarget=null,this.ke(b,c)));d.dc=c;d.$f=c.target}};
l.lm=function(b){ki(this,b);ji(this,b,this.om)};l.om=function(b,c){Yh(this.a,ai,c,b);this.a.dc(c,b);var d=this.a;c.bubbles=!1;Yh(d,ni,c,b);yb(this.d,c.pointerId);c.isPrimary&&(this.b=void 0,this.c=ba.setTimeout(ra(this.og,this),200))};l.km=function(b){ji(this,b,this.ke)};l.ke=function(b,c){this.a.cancel(c,b);this.a.dc(c,b);var d=this.a;c.bubbles=!1;Yh(d,ni,c,b);yb(this.d,c.pointerId);c.isPrimary&&(this.b=void 0,this.c=ba.setTimeout(ra(this.og,this),200))};
function ki(b,c){var d=b.g.b,e=c.a.changedTouches[0];if(b.b===e.identifier){var f=[e.clientX,e.clientY];d.push(f);ba.setTimeout(function(){Xa(d,f)},2500)}};function oi(b){id.call(this);this.ba=b;this.d={};this.b={};this.a=[];bg?pi(this,new fi(this)):cg?pi(this,new di(this)):(b=new Th(this),pi(this,b),ag&&pi(this,new hi(this,b)));b=this.a.length;for(var c,d=0;d<b;d++)c=this.a[d],qi(this,sb(c.f))}v(oi,id);function pi(b,c){var d=sb(c.f);d&&(Qa(d,function(b){var d=c.f[b];d&&(this.b[b]=ra(d,c))},b),b.a.push(c))}oi.prototype.c=function(b){var c=this.b[b.type];c&&c(b)};function qi(b,c){Qa(c,function(b){w(this.ba,b,this.c,!1,this)},b)}
function ri(b,c){Qa(c,function(b){Wc(this.ba,b,this.c,!1,this)},b)}function Xh(b,c){for(var d={},e,f=0,g=si.length;f<g;f++)e=si[f][0],d[e]=b[e]||c[e]||si[f][1];return d}oi.prototype.dc=function(b,c){b.bubbles=!0;Yh(this,ti,b,c)};oi.prototype.cancel=function(b,c){Yh(this,ui,b,c)};function ci(b,c,d){b.dc(c,d);c.target.contains(c.relatedTarget)||(c.bubbles=!1,Yh(b,ni,c,d))}function bi(b,c,d){c.bubbles=!0;Yh(b,li,c,d);c.target.contains(c.relatedTarget)||(c.bubbles=!1,Yh(b,mi,c,d))}
function Yh(b,c,d,e){b.dispatchEvent(new Nh(c,e,d))}function gi(b,c){b.dispatchEvent(new Nh(c.type,c,c.a))}oi.prototype.P=function(){for(var b=this.a.length,c,d=0;d<b;d++)c=this.a[d],ri(this,sb(c.f));oi.T.P.call(this)};
var $h="pointermove",Zh="pointerdown",ai="pointerup",li="pointerover",ti="pointerout",mi="pointerenter",ni="pointerleave",ui="pointercancel",si=[["bubbles",!1],["cancelable",!1],["view",null],["detail",null],["screenX",0],["screenY",0],["clientX",0],["clientY",0],["ctrlKey",!1],["altKey",!1],["shiftKey",!1],["metaKey",!1],["button",0],["relatedTarget",null],["buttons",0],["pointerId",0],["width",0],["height",0],["pressure",0],["tiltX",0],["tiltY",0],["pointerType",""],["hwTimestamp",0],["isPrimary",
!1],["type",""],["target",null],["currentTarget",null],["which",0]];function vi(b,c,d,e,f){Sg.call(this,b,c,f);this.a=d;this.originalEvent=d.a;this.pixel=c.hd(this.originalEvent);this.coordinate=c.ra(this.pixel);this.dragging=m(e)?e:!1}v(vi,Sg);vi.prototype.preventDefault=function(){vi.T.preventDefault.call(this);this.a.preventDefault()};vi.prototype.pb=function(){vi.T.pb.call(this);this.a.pb()};function wi(b,c,d,e,f){vi.call(this,b,c,d.a,e,f);this.d=d}v(wi,vi);
function xi(b){id.call(this);this.b=b;this.e=0;this.g=!1;this.d=this.n=this.c=null;b=this.b.b;this.q=0;this.k={};this.f=new oi(b);this.a=null;this.n=w(this.f,Zh,this.Ji,!1,this);this.i=w(this.f,$h,this.Ll,!1,this)}v(xi,id);function yi(b,c){var d;d=new wi(zi,b.b,c);b.dispatchEvent(d);0!==b.e?(ba.clearTimeout(b.e),b.e=0,d=new wi(Ai,b.b,c),b.dispatchEvent(d)):b.e=ba.setTimeout(ra(function(){this.e=0;var b=new wi(Bi,this.b,c);this.dispatchEvent(b)},b),250)}
function Ci(b,c){c.type==Di||c.type==Ei?delete b.k[c.pointerId]:c.type==Fi&&(b.k[c.pointerId]=!0);b.q=qb(b.k)}l=xi.prototype;l.vf=function(b){Ci(this,b);var c=new wi(Di,this.b,b);this.dispatchEvent(c);!this.g&&0===b.button&&yi(this,this.d);0===this.q&&(Qa(this.c,Xc),this.c=null,this.g=!1,this.d=null,qc(this.a),this.a=null)};
l.Ji=function(b){Ci(this,b);var c=new wi(Fi,this.b,b);this.dispatchEvent(c);this.d=b;null===this.c&&(this.a=new oi(document),this.c=[w(this.a,Gi,this.yj,!1,this),w(this.a,Di,this.vf,!1,this),w(this.f,Ei,this.vf,!1,this)])};l.yj=function(b){if(b.clientX!=this.d.clientX||b.clientY!=this.d.clientY){this.g=!0;var c=new wi(Hi,this.b,b,this.g);this.dispatchEvent(c)}b.preventDefault()};l.Ll=function(b){this.dispatchEvent(new wi(b.type,this.b,b,null!==this.d&&(b.clientX!=this.d.clientX||b.clientY!=this.d.clientY)))};
l.P=function(){null!==this.i&&(Xc(this.i),this.i=null);null!==this.n&&(Xc(this.n),this.n=null);null!==this.c&&(Qa(this.c,Xc),this.c=null);null!==this.a&&(qc(this.a),this.a=null);null!==this.f&&(qc(this.f),this.f=null);xi.T.P.call(this)};var Bi="singleclick",zi="click",Ai="dblclick",Hi="pointerdrag",Gi="pointermove",Fi="pointerdown",Di="pointerup",Ei="pointercancel",Ii={Mm:Bi,Bm:zi,Cm:Ai,Fm:Hi,Im:Gi,Em:Fi,Lm:Di,Km:"pointerover",Jm:"pointerout",Gm:"pointerenter",Hm:"pointerleave",Dm:Ei};function Ji(b){rd.call(this);this.g=Be(b.projection);this.f=m(b.attributions)?b.attributions:null;this.D=b.logo;this.q=m(b.state)?b.state:"ready"}v(Ji,rd);l=Ji.prototype;l.Jd=ca;l.Y=function(){return this.f};l.X=function(){return this.D};l.Z=function(){return this.g};l.$=function(){return this.q};function Ki(b,c){b.q=c;b.l()};function C(b){rd.call(this);var c=Bb(b);c.brightness=m(b.brightness)?b.brightness:0;c.contrast=m(b.contrast)?b.contrast:1;c.hue=m(b.hue)?b.hue:0;c.opacity=m(b.opacity)?b.opacity:1;c.saturation=m(b.saturation)?b.saturation:1;c.visible=m(b.visible)?b.visible:!0;c.maxResolution=m(b.maxResolution)?b.maxResolution:Infinity;c.minResolution=m(b.minResolution)?b.minResolution:0;this.C(c)}v(C,rd);C.prototype.c=function(){return this.get("brightness")};C.prototype.getBrightness=C.prototype.c;
C.prototype.f=function(){return this.get("contrast")};C.prototype.getContrast=C.prototype.f;C.prototype.e=function(){return this.get("hue")};C.prototype.getHue=C.prototype.e;function Li(b){var c=b.c(),d=b.f(),e=b.e(),f=b.q(),g=b.k(),h=b.kb(),k=b.b(),n=b.J(),p=b.g(),q=b.i();return{layer:b,brightness:Wb(c,-1,1),contrast:Math.max(d,0),hue:e,opacity:Wb(f,0,1),saturation:Math.max(g,0),yc:h,visible:k,extent:n,maxResolution:p,minResolution:Math.max(q,0)}}C.prototype.J=function(){return this.get("extent")};
C.prototype.getExtent=C.prototype.J;C.prototype.g=function(){return this.get("maxResolution")};C.prototype.getMaxResolution=C.prototype.g;C.prototype.i=function(){return this.get("minResolution")};C.prototype.getMinResolution=C.prototype.i;C.prototype.q=function(){return this.get("opacity")};C.prototype.getOpacity=C.prototype.q;C.prototype.k=function(){return this.get("saturation")};C.prototype.getSaturation=C.prototype.k;C.prototype.b=function(){return this.get("visible")};
C.prototype.getVisible=C.prototype.b;C.prototype.D=function(b){this.set("brightness",b)};C.prototype.setBrightness=C.prototype.D;C.prototype.H=function(b){this.set("contrast",b)};C.prototype.setContrast=C.prototype.H;C.prototype.N=function(b){this.set("hue",b)};C.prototype.setHue=C.prototype.N;C.prototype.o=function(b){this.set("extent",b)};C.prototype.setExtent=C.prototype.o;C.prototype.S=function(b){this.set("maxResolution",b)};C.prototype.setMaxResolution=C.prototype.S;
C.prototype.W=function(b){this.set("minResolution",b)};C.prototype.setMinResolution=C.prototype.W;C.prototype.p=function(b){this.set("opacity",b)};C.prototype.setOpacity=C.prototype.p;C.prototype.ca=function(b){this.set("saturation",b)};C.prototype.setSaturation=C.prototype.ca;C.prototype.da=function(b){this.set("visible",b)};C.prototype.setVisible=C.prototype.da;function E(b){var c=Bb(b);delete c.source;C.call(this,c);this.va=null;w(this,vd("source"),this.zh,!1,this);this.fa(m(b.source)?b.source:null)}v(E,C);function Mi(b,c){return b.visible&&c>=b.minResolution&&c<b.maxResolution}E.prototype.Xa=function(b){b=m(b)?b:[];b.push(Li(this));return b};E.prototype.a=function(){var b=this.get("source");return m(b)?b:null};E.prototype.getSource=E.prototype.a;E.prototype.kb=function(){var b=this.a();return null===b?"undefined":b.q};E.prototype.mi=function(){this.l()};
E.prototype.zh=function(){null!==this.va&&(Xc(this.va),this.va=null);var b=this.a();null!==b&&(this.va=w(b,"change",this.mi,!1,this));this.l()};E.prototype.fa=function(b){this.set("source",b)};E.prototype.setSource=E.prototype.fa;function Ni(b,c,d,e,f){id.call(this);this.e=f;this.extent=b;this.f=d;this.resolution=c;this.state=e}v(Ni,id);Ni.prototype.J=function(){return this.extent};function Oi(b,c){id.call(this);this.a=b;this.state=c}v(Oi,id);function Pi(b){b.dispatchEvent("change")}Oi.prototype.qb=function(){return ma(this).toString()};Oi.prototype.e=function(){return this.a};function Qi(){this.b=0;this.c={};this.d=this.a=null}l=Qi.prototype;l.clear=function(){this.b=0;this.c={};this.d=this.a=null};function Ri(b,c){return b.c.hasOwnProperty(c)}l.forEach=function(b,c){for(var d=this.a;null!==d;)b.call(c,d.hc,d.Cd,this),d=d.eb};l.get=function(b){b=this.c[b];if(b===this.d)return b.hc;b===this.a?(this.a=this.a.eb,this.a.Mb=null):(b.eb.Mb=b.Mb,b.Mb.eb=b.eb);b.eb=null;b.Mb=this.d;this.d=this.d.eb=b;return b.hc};l.Tb=function(){return this.b};
l.G=function(){var b=Array(this.b),c=0,d;for(d=this.d;null!==d;d=d.Mb)b[c++]=d.Cd;return b};l.ob=function(){var b=Array(this.b),c=0,d;for(d=this.d;null!==d;d=d.Mb)b[c++]=d.hc;return b};l.pop=function(){var b=this.a;delete this.c[b.Cd];null!==b.eb&&(b.eb.Mb=null);this.a=b.eb;null===this.a&&(this.d=null);--this.b;return b.hc};l.set=function(b,c){var d={Cd:b,eb:null,Mb:this.d,hc:c};null===this.d?this.a=d:this.d.eb=d;this.d=d;this.c[b]=d;++this.b};function Si(b){Qi.call(this);this.f=m(b)?b:2048}v(Si,Qi);function Ti(b){return b.Tb()>b.f};function Ui(b){this.minZoom=m(b.minZoom)?b.minZoom:0;this.a=b.resolutions;this.maxZoom=this.a.length-1;this.c=m(b.origin)?b.origin:null;this.e=null;m(b.origins)&&(this.e=b.origins);this.d=null;m(b.tileSizes)&&(this.d=b.tileSizes);this.f=m(b.tileSize)?b.tileSize:null===this.d?256:void 0}var Vi=[0,0,0];l=Ui.prototype;l.Db=function(){return ed};l.gd=function(b,c,d,e,f){f=Wi(this,b,f);for(b=b[0]-1;b>=this.minZoom;){if(c.call(d,b,Xi(this,f,b,e)))return!0;--b}return!1};l.md=function(){return this.maxZoom};
l.pd=function(){return this.minZoom};l.Lb=function(b){return null===this.c?this.e[b]:this.c};l.na=function(b){return this.a[b]};l.Qd=function(){return this.a};l.td=function(b,c,d){return b[0]<this.maxZoom?(d=Wi(this,b,d),Xi(this,d,b[0]+1,c)):null};function Yi(b,c,d,e){Zi(b,c[0],c[1],d,!1,Vi);var f=Vi[1],g=Vi[2];Zi(b,c[2],c[3],d,!0,Vi);return mf(f,Vi[1],g,Vi[2],e)}function Xi(b,c,d,e){return Yi(b,c,b.na(d),e)}
function $i(b,c){var d=b.Lb(c[0]),e=b.na(c[0]),f=b.ua(c[0]);return[d[0]+(c[1]+.5)*f*e,d[1]+(c[2]+.5)*f*e]}function Wi(b,c,d){var e=b.Lb(c[0]),f=b.na(c[0]);b=b.ua(c[0]);var g=e[0]+c[1]*b*f;c=e[1]+c[2]*b*f;return Wd(g,c,g+b*f,c+b*f,d)}l.Wb=function(b,c,d){return Zi(this,b[0],b[1],c,!1,d)};function Zi(b,c,d,e,f,g){var h=bc(b.a,e,0),k=e/b.na(h),n=b.Lb(h);b=b.ua(h);c=k*(c-n[0])/(e*b);d=k*(d-n[1])/(e*b);f?(c=Math.ceil(c)-1,d=Math.ceil(d)-1):(c=Math.floor(c),d=Math.floor(d));return gf(h,c,d,g)}
l.Nc=function(b,c,d){return Zi(this,b[0],b[1],this.na(c),!1,d)};l.ua=function(b){return m(this.f)?this.f:this.d[b]};function aj(b,c,d){c=m(c)?c:42;d=m(d)?d:256;b=Math.max(re(b)/d,oe(b)/d);c+=1;d=Array(c);for(var e=0;e<c;++e)d[e]=b/Math.pow(2,e);return d}function bj(b){b=Be(b);var c=b.J();null===c&&(b=180*xe.degrees/b.od(),c=Wd(-b,-b,b,b));return c};function cj(b){Ji.call(this,{attributions:b.attributions,extent:b.extent,logo:b.logo,projection:b.projection,state:b.state});this.H=m(b.opaque)?b.opaque:!1;this.N=m(b.tilePixelRatio)?b.tilePixelRatio:1;this.tileGrid=m(b.tileGrid)?b.tileGrid:null;this.a=new Si}v(cj,Ji);function dj(b,c,d,e){for(var f=!0,g,h,k=d.a;k<=d.c;++k)for(var n=d.b;n<=d.d;++n)g=b.nb(c,k,n),h=!1,Ri(b.a,g)&&(g=b.a.get(g),(h=2===g.state)&&(h=!1!==e(g))),h||(f=!1);return f}l=cj.prototype;l.jd=function(){return 0};l.nb=hf;l.xa=function(){return this.tileGrid};
function ej(b,c){var d;if(null===b.tileGrid){if(d=c.f,null===d){d=bj(c);var e=m(void 0)?void 0:256,f=m(void 0)?void 0:"bottom-left",g=aj(d,void 0,e);d=new Ui({origin:me(d,f),resolutions:g,tileSize:e});c.f=d}}else d=b.tileGrid;return d}l.Xb=function(b,c,d){return ej(this,d).ua(b)*this.N};l.Pe=ca;function fj(b,c){rc.call(this,b);this.tile=c}v(fj,rc);function gj(b,c,d,e,f,g,h,k){Md(b);0===c&&0===d||Pd(b,c,d);1==e&&1==f||Qd(b,e,f);0!==g&&Rd(b,g);0===h&&0===k||Pd(b,h,k);return b}function hj(b,c){return b[0]==c[0]&&b[1]==c[1]&&b[4]==c[4]&&b[5]==c[5]&&b[12]==c[12]&&b[13]==c[13]}function ij(b,c,d){var e=b[1],f=b[5],g=b[13],h=c[0];c=c[1];d[0]=b[0]*h+b[4]*c+b[12];d[1]=e*h+f*c+g;return d};function jj(b){ld.call(this);this.a=b}v(jj,ld);l=jj.prototype;l.Ua=ca;l.cc=function(b,c,d,e){b=b.slice();ij(c.pixelToCoordinateMatrix,b,b);if(this.Ua(b,c,cd,this))return d.call(e,this.a)};l.Hd=bd;l.ed=function(b,c){return function(d,e){return dj(b,d,e,function(b){c[d]||(c[d]={});c[d][b.a.toString()]=b})}};l.Uj=function(b){2===b.target.state&&kj(this)};function mj(b,c){var d=c.state;2!=d&&3!=d&&Vc(c,"change",b.Uj,!1,b);0==d&&(c.load(),d=c.state);return 2==d}
function kj(b){var c=b.a;c.b()&&"ready"==c.kb()&&b.l()}function nj(b,c){Ti(c.a)&&b.postRenderFunctions.push(sa(function(b,c,f){c=ma(b).toString();b=b.a;f=f.usedTiles[c];for(var g;Ti(b)&&!(c=b.a.hc,g=c.a[0].toString(),g in f&&f[g].contains(c.a));)b.pop().Jc()},c))}function oj(b,c){if(null!=c){var d,e,f;e=0;for(f=c.length;e<f;++e)d=c[e],b[ma(d).toString()]=d}}function pj(b,c){var d=c.D;m(d)&&(ia(d)?b.logos[d]="":la(d)&&(b.logos[d.src]=d.href))}
function qj(b,c,d,e){c=ma(c).toString();d=d.toString();c in b?d in b[c]?(b=b[c][d],e.a<b.a&&(b.a=e.a),e.c>b.c&&(b.c=e.c),e.b<b.b&&(b.b=e.b),e.d>b.d&&(b.d=e.d)):b[c][d]=e:(b[c]={},b[c][d]=e)}function rj(b,c,d){return[c*(Math.round(b[0]/c)+d[0]%2/2),c*(Math.round(b[1]/c)+d[1]%2/2)]}
function sj(b,c,d,e,f,g,h,k,n,p){var q=ma(c).toString();q in b.wantedTiles||(b.wantedTiles[q]={});var r=b.wantedTiles[q];b=b.tileQueue;var s=d.minZoom,u,z,y,A,D,x;for(x=h;x>=s;--x)for(z=Xi(d,g,x,z),y=d.na(x),A=z.a;A<=z.c;++A)for(D=z.b;D<=z.d;++D)h-x<=k?(u=c.Vb(x,A,D,e,f),0==u.state&&(r[kf(u.a)]=!0,u.qb()in b.b||tj(b,[u,q,$i(d,u.a),y])),m(n)&&n.call(p,u)):c.Pe(x,A,D)};function uj(b){this.o=b.opacity;this.p=b.rotateWithView;this.i=b.rotation;this.k=b.scale;this.r=b.snapToPixel}l=uj.prototype;l.Ld=function(){return this.o};l.rd=function(){return this.p};l.Md=function(){return this.i};l.Nd=function(){return this.k};l.sd=function(){return this.r};l.Od=function(b){this.i=b};l.Pd=function(b){this.k=b};function vj(b){b=m(b)?b:{};this.f=m(b.anchor)?b.anchor:[.5,.5];this.c=null;this.d=m(b.anchorOrigin)?b.anchorOrigin:"top-left";this.g=m(b.anchorXUnits)?b.anchorXUnits:"fraction";this.n=m(b.anchorYUnits)?b.anchorYUnits:"fraction";var c=m(b.crossOrigin)?b.crossOrigin:null,d=m(b.img)?b.img:null,e=b.src;m(e)&&0!==e.length||null===d||(e=d.src);var f=m(b.src)?0:2,g=wj.Pa(),h=g.get(e,c);null===h&&(h=new xj(d,e,c,f),g.set(e,c,h));this.a=h;this.D=m(b.offset)?b.offset:[0,0];this.b=m(b.offsetOrigin)?b.offsetOrigin:
"top-left";this.e=null;this.q=m(b.size)?b.size:null;uj.call(this,{opacity:m(b.opacity)?b.opacity:1,rotation:m(b.rotation)?b.rotation:0,scale:m(b.scale)?b.scale:1,snapToPixel:m(b.snapToPixel)?b.snapToPixel:!0,rotateWithView:m(b.rotateWithView)?b.rotateWithView:!1})}v(vj,uj);l=vj.prototype;
l.wb=function(){if(null!==this.c)return this.c;var b=this.f,c=this.gb();if("fraction"==this.g||"fraction"==this.n){if(null===c)return null;b=this.f.slice();"fraction"==this.g&&(b[0]*=c[0]);"fraction"==this.n&&(b[1]*=c[1])}if("top-left"!=this.d){if(null===c)return null;b===this.f&&(b=this.f.slice());if("top-right"==this.d||"bottom-right"==this.d)b[0]=-b[0]+c[0];if("bottom-left"==this.d||"bottom-right"==this.d)b[1]=-b[1]+c[1]}return this.c=b};l.Bb=function(){return this.a.a};l.kd=function(){return this.a.d};
l.Pc=function(){return this.a.b};l.Kd=function(){var b=this.a;if(null===b.f)if(b.n){var c=b.d[0],d=b.d[1],e=Mf(c,d);e.fillRect(0,0,c,d);b.f=e.canvas}else b.f=b.a;return b.f};l.Cb=function(){if(null!==this.e)return this.e;var b=this.D;if("top-left"!=this.b){var c=this.gb(),d=this.a.d;if(null===c||null===d)return null;b=b.slice();if("top-right"==this.b||"bottom-right"==this.b)b[0]=d[0]-c[0]-b[0];if("bottom-left"==this.b||"bottom-right"==this.b)b[1]=d[1]-c[1]-b[1]}return this.e=b};l.Gk=function(){return this.a.e};
l.gb=function(){return null===this.q?this.a.d:this.q};l.xe=function(b,c){return w(this.a,"change",b,!1,c)};l.load=function(){this.a.load()};l.Oe=function(b,c){Wc(this.a,"change",b,!1,c)};function xj(b,c,d,e){id.call(this);this.f=null;this.a=null===b?new Image:b;null!==d&&(this.a.crossOrigin=d);this.c=null;this.b=e;this.d=null;this.e=c;this.n=!1}v(xj,id);xj.prototype.g=function(){this.b=3;Qa(this.c,Xc);this.c=null;this.dispatchEvent("change")};
xj.prototype.i=function(){this.b=2;this.d=[this.a.width,this.a.height];Qa(this.c,Xc);this.c=null;var b=Mf(1,1);b.drawImage(this.a,0,0);try{b.getImageData(0,0,1,1)}catch(c){this.n=!0}this.dispatchEvent("change")};xj.prototype.load=function(){if(0==this.b){this.b=1;this.c=[Vc(this.a,"error",this.g,!1,this),Vc(this.a,"load",this.i,!1,this)];try{this.a.src=this.e}catch(b){this.g()}}};function wj(){this.a={};this.d=0}da(wj);wj.prototype.clear=function(){this.a={};this.d=0};
wj.prototype.get=function(b,c){var d=c+":"+b;return d in this.a?this.a[d]:null};wj.prototype.set=function(b,c,d){this.a[c+":"+b]=d;++this.d};function yj(b,c){mc.call(this);this.g=c;this.b=null;this.e={};this.q={}}v(yj,mc);function zj(b){var c=b.viewState,d=b.coordinateToPixelMatrix;gj(d,b.size[0]/2,b.size[1]/2,1/c.resolution,-1/c.resolution,-c.rotation,-c.center[0],-c.center[1]);Od(d,b.pixelToCoordinateMatrix)}l=yj.prototype;l.P=function(){ob(this.e,qc);yj.T.P.call(this)};
function Aj(){var b=wj.Pa();if(32<b.d){var c=0,d,e;for(d in b.a){e=b.a[d];var f;if(f=0===(c++&3))Cc(e)?e=kd(e,void 0,void 0):(e=Rc(e),e=!!e&&Kc(e,void 0,void 0)),f=!e;f&&(delete b.a[d],--b.d)}}}
l.ze=function(b,c,d,e,f,g){var h,k=c.viewState,n=k.resolution,k=k.rotation;if(null!==this.b){var p={};if(h=this.b.b(b,n,k,{},function(b){var c=ma(b).toString();if(!(c in p))return p[c]=!0,d.call(e,b,null)}))return h}var k=c.layerStatesArray,q;for(q=k.length-1;0<=q;--q){h=k[q];var r=h.layer;if(Mi(h,n)&&f.call(g,r)&&(h=Bj(this,r).Ua(b,c,d,e)))return h}};
l.Lf=function(b,c,d,e,f,g){var h,k=c.viewState,n=k.resolution,k=k.rotation;if(null!==this.b){var p=this.g.ra(b);if(this.b.b(p,n,k,{},cd)&&(h=d.call(e,null)))return h}k=c.layerStatesArray;for(p=k.length-1;0<=p;--p){h=k[p];var q=h.layer;if(Mi(h,n)&&f.call(g,q)&&(h=Bj(this,q).cc(b,c,d,e)))return h}};l.Mf=function(b,c,d,e){b=this.ze(b,c,cd,this,d,e);return m(b)};function Bj(b,c){var d=ma(c).toString();if(d in b.e)return b.e[d];var e=b.ne(c);b.e[d]=e;b.q[d]=w(e,"change",b.Bi,!1,b);return e}l.Bi=function(){this.g.render()};
l.Yd=ca;l.Ql=function(b,c){for(var d in this.e)if(!(null!==c&&d in c.layerStates)){var e=d,f=this.e[e];delete this.e[e];Xc(this.q[e]);delete this.q[e];qc(f)}};function Cj(b,c){for(var d in b.e)if(!(d in c.layerStates)){c.postRenderFunctions.push(ra(b.Ql,b));break}};function Dj(b,c){this.e=b;this.f=c;this.a=[];this.d=[];this.b={}}Dj.prototype.clear=function(){this.a.length=0;this.d.length=0;xb(this.b)};function Ej(b){var c=b.a,d=b.d,e=c[0];1==c.length?(c.length=0,d.length=0):(c[0]=c.pop(),d[0]=d.pop(),Fj(b,0));c=b.f(e);delete b.b[c];return e}function tj(b,c){var d=b.e(c);Infinity!=d&&(b.a.push(c),b.d.push(d),b.b[b.f(c)]=!0,Gj(b,0,b.a.length-1))}Dj.prototype.Tb=function(){return this.a.length};Dj.prototype.la=function(){return 0===this.a.length};
function Fj(b,c){for(var d=b.a,e=b.d,f=d.length,g=d[c],h=e[c],k=c;c<f>>1;){var n=2*c+1,p=2*c+2,n=p<f&&e[p]<e[n]?p:n;d[c]=d[n];e[c]=e[n];c=n}d[c]=g;e[c]=h;Gj(b,k,c)}function Gj(b,c,d){var e=b.a;b=b.d;for(var f=e[d],g=b[d];d>c;){var h=d-1>>1;if(b[h]>g)e[d]=e[h],b[d]=b[h],d=h;else break}e[d]=f;b[d]=g}function Hj(b){var c=b.e,d=b.a,e=b.d,f=0,g=d.length,h,k,n;for(k=0;k<g;++k)h=d[k],n=c(h),Infinity==n?delete b.b[b.f(h)]:(e[f]=n,d[f++]=h);d.length=f;e.length=f;for(c=(b.a.length>>1)-1;0<=c;c--)Fj(b,c)};function Ij(b,c){Dj.call(this,function(c){return b.apply(null,c)},function(b){return b[0].qb()});this.n=c;this.c=0}v(Ij,Dj);Ij.prototype.g=function(b){b=b.target.state;if(2===b||3===b||4===b)--this.c,this.n()};function Jj(b,c,d){this.c=b;this.b=c;this.e=d;this.a=[];this.d=this.f=0}Jj.prototype.update=function(b,c){this.a.push(b,c,ta())};function Kj(b,c){var d=b.c,e=b.d,f=b.b-e,g=Lj(b);return df({source:c,duration:g,easing:function(b){return e*(Math.exp(d*b*g)-1)/f}})}function Lj(b){return Math.log(b.b/b.d)/b.c};function Mj(b){rd.call(this);this.k=null;this.c(!0);this.handleEvent=b.handleEvent}v(Mj,rd);Mj.prototype.b=function(){return this.get("active")};Mj.prototype.getActive=Mj.prototype.b;Mj.prototype.c=function(b){this.set("active",b)};Mj.prototype.setActive=Mj.prototype.c;Mj.prototype.setMap=function(b){this.k=b};function Nj(b,c,d,e,f){if(null!=d){var g=c.c(),h=c.b();m(g)&&m(h)&&m(f)&&0<f&&(b.La(ef({rotation:g,duration:f,easing:$e})),m(e)&&b.La(df({source:h,duration:f,easing:$e})));c.rotate(d,e)}}
function Oj(b,c,d,e,f){var g=c.a();d=c.constrainResolution(g,d,0);Pj(b,c,d,e,f)}function Pj(b,c,d,e,f){if(null!=d){var g=c.a(),h=c.b();m(g)&&m(h)&&m(f)&&0<f&&(b.La(ff({resolution:g,duration:f,easing:$e})),m(e)&&b.La(df({source:h,duration:f,easing:$e})));if(null!=e){var k;b=c.b();f=c.a();m(b)&&m(f)&&(k=[e[0]-d*(e[0]-b[0])/f,e[1]-d*(e[1]-b[1])/f]);c.Ha(k)}c.f(d)}};function Qj(b){b=m(b)?b:{};this.a=m(b.delta)?b.delta:1;Mj.call(this,{handleEvent:Rj});this.f=m(b.duration)?b.duration:250}v(Qj,Mj);function Rj(b){var c=!1,d=b.a;if(b.type==Ai){var c=b.map,e=b.coordinate,d=d.c?-this.a:this.a,f=c.a();Oj(c,f,d,e,this.f);b.preventDefault();c=!0}return!c};function Sj(b){b=b.a;return b.d&&!b.g&&b.c}function Tj(b){return"pointermove"==b.type}function Uj(b){return b.type==Bi}function Vj(b){b=b.a;return!b.d&&!b.g&&!b.c}function Wj(b){b=b.a;return!b.d&&!b.g&&b.c}function Xj(b){b=b.a.target.tagName;return"INPUT"!==b&&"SELECT"!==b&&"TEXTAREA"!==b}function Yj(b){return 1==b.d.pointerId};function Zj(b){b=m(b)?b:{};Mj.call(this,{handleEvent:m(b.handleEvent)?b.handleEvent:ak});this.ia=m(b.handleDownEvent)?b.handleDownEvent:bd;this.ka=m(b.handleDragEvent)?b.handleDragEvent:ca;this.va=m(b.handleMoveEvent)?b.handleMoveEvent:ca;this.Ea=m(b.handleUpEvent)?b.handleUpEvent:bd;this.p=!1;this.D={};this.f=[]}v(Zj,Mj);function bk(b){for(var c=b.length,d=0,e=0,f=0;f<c;f++)d+=b[f].clientX,e+=b[f].clientY;return[d/c,e/c]}
function ak(b){if(!(b instanceof wi))return!0;var c=!1,d=b.type;if(d===Fi||d===Hi||d===Di)d=b.d,b.type==Di?delete this.D[d.pointerId]:b.type==Fi?this.D[d.pointerId]=d:d.pointerId in this.D&&(this.D[d.pointerId]=d),this.f=rb(this.D);this.p&&(b.type==Hi?this.ka(b):b.type==Di&&(this.p=this.Ea(b)));b.type==Fi?(this.p=b=this.ia(b),c=this.r(b)):b.type==Gi&&this.va(b);return!c}Zj.prototype.r=ed;function ck(b){Zj.call(this,{handleDownEvent:dk,handleDragEvent:ek,handleUpEvent:fk});b=m(b)?b:{};this.a=b.kinetic;this.e=this.g=null;this.q=m(b.condition)?b.condition:Vj;this.i=!1}v(ck,Zj);function ek(b){var c=bk(this.f);this.a&&this.a.update(c[0],c[1]);if(null!==this.e){var d=this.e[0]-c[0],e=c[1]-this.e[1];b=b.map;var f=b.a(),g=Ye(f),e=d=[d,e],h=g.resolution;e[0]*=h;e[1]*=h;Bd(d,g.rotation);wd(d,g.center);d=f.i(d);b.render();f.Ha(d)}this.e=c}
function fk(b){b=b.map;var c=b.a();if(0===this.f.length){var d;if(d=!this.i&&this.a)if(d=this.a,6>d.a.length)d=!1;else{var e=ta()-d.e,f=d.a.length-3;if(d.a[f+2]<e)d=!1;else{for(var g=f-3;0<g&&d.a[g+2]>e;)g-=3;var e=d.a[f+2]-d.a[g+2],h=d.a[f]-d.a[g],f=d.a[f+1]-d.a[g+1];d.f=Math.atan2(f,h);d.d=Math.sqrt(h*h+f*f)/e;d=d.d>d.b}}d&&(d=this.a,d=(d.b-d.d)/d.c,f=this.a.f,g=c.b(),this.g=Kj(this.a,g),b.La(this.g),g=b.e(g),d=b.ra([g[0]-d*Math.cos(f),g[1]-d*Math.sin(f)]),d=c.i(d),c.Ha(d));Ze(c,-1);b.render();
return!1}this.e=null;return!0}function dk(b){if(0<this.f.length&&this.q(b)){var c=b.map,d=c.a();this.e=null;this.p||Ze(d,1);c.render();null!==this.g&&Xa(c.N,this.g)&&(d.Ha(b.frameState.viewState.center),this.g=null);this.a&&(b=this.a,b.a.length=0,b.f=0,b.d=0);this.i=1<this.f.length;return!0}return!1}ck.prototype.r=bd;function gk(b){b=m(b)?b:{};Zj.call(this,{handleDownEvent:hk,handleDragEvent:ik,handleUpEvent:jk});this.e=m(b.condition)?b.condition:Sj;this.a=void 0}v(gk,Zj);function ik(b){if(Yj(b)){var c=b.map,d=c.f();b=b.pixel;d=Math.atan2(d[1]/2-b[1],b[0]-d[0]/2);if(m(this.a)){b=d-this.a;var e=c.a(),f=e.c();c.render();Nj(c,e,f-b)}this.a=d}}function jk(b){if(!Yj(b))return!0;b=b.map;var c=b.a();Ze(c,-1);var d=c.c(),d=c.constrainRotation(d,0);Nj(b,c,d,void 0,250);return!1}
function hk(b){return Yj(b)&&Ac(b.a)&&this.e(b)?(b=b.map,Ze(b.a(),1),b.render(),this.a=void 0,!0):!1}gk.prototype.r=bd;function kk(){ld.call(this);this.k=Td();this.q=-1;this.e={};this.i=this.g=0}v(kk,ld);kk.prototype.f=function(b,c){var d=m(c)?c:[NaN,NaN];this.Ya(b[0],b[1],d,Infinity);return d};kk.prototype.Jb=bd;kk.prototype.J=function(b){this.q!=this.d&&(this.k=this.dd(this.k),this.q=this.d);var c=this.k;m(b)?(b[0]=c[0],b[1]=c[1],b[2]=c[2],b[3]=c[3]):b=c;return b};kk.prototype.transform=function(b,c){this.qa(Te(b,c));return this};function lk(b,c,d,e,f,g){var h=f[0],k=f[1],n=f[4],p=f[5],q=f[12];f=f[13];for(var r=m(g)?g:[],s=0;c<d;c+=e){var u=b[c],z=b[c+1];r[s++]=h*u+n*z+q;r[s++]=k*u+p*z+f}m(g)&&r.length!=s&&(r.length=s);return r};function mk(){kk.call(this);this.a="XY";this.B=2;this.j=null}v(mk,kk);function nk(b){if("XY"==b)return 2;if("XYZ"==b||"XYM"==b)return 3;if("XYZM"==b)return 4}l=mk.prototype;l.Jb=bd;l.dd=function(b){var c=this.j,d=this.j.length,e=this.B;b=Wd(Infinity,Infinity,-Infinity,-Infinity,b);return fe(b,c,0,d,e)};l.yb=function(){return this.j.slice(0,this.B)};l.zb=function(){return this.j.slice(this.j.length-this.B)};l.Ab=function(){return this.a};
l.ue=function(b){this.i!=this.d&&(xb(this.e),this.g=0,this.i=this.d);if(0>b||0!==this.g&&b<=this.g)return this;var c=b.toString();if(this.e.hasOwnProperty(c))return this.e[c];var d=this.oc(b);if(d.j.length<this.j.length)return this.e[c]=d;this.g=b;return this};l.oc=function(){return this};function ok(b,c,d){b.B=nk(c);b.a=c;b.j=d}
function pk(b,c,d,e){if(m(c))d=nk(c);else{for(c=0;c<e;++c){if(0===d.length){b.a="XY";b.B=2;return}d=d[0]}d=d.length;c=2==d?"XY":3==d?"XYZ":4==d?"XYZM":void 0}b.a=c;b.B=d}l.qa=function(b){null!==this.j&&(b(this.j,this.j,this.B),this.l())};l.Ia=function(b,c){var d=this.j;if(null!==d){var e=d.length,f=this.B,g=m(d)?d:[],h=0,k,n;for(k=0;k<e;k+=f)for(g[h++]=d[k]+b,g[h++]=d[k+1]+c,n=k+2;n<k+f;++n)g[h++]=d[n];m(d)&&g.length!=h&&(g.length=h);this.l()}};function qk(b,c,d,e){for(var f=0,g=b[d-e],h=b[d-e+1];c<d;c+=e)var k=b[c],n=b[c+1],f=f+(h*k-g*n),g=k,h=n;return f/2}function rk(b,c,d,e){var f=0,g,h;g=0;for(h=d.length;g<h;++g){var k=d[g],f=f+qk(b,c,k,e);c=k}return f};function sk(b,c,d,e,f,g){var h=f-d,k=g-e;if(0!==h||0!==k){var n=((b-d)*h+(c-e)*k)/(h*h+k*k);1<n?(d=f,e=g):0<n&&(d+=h*n,e+=k*n)}return tk(b,c,d,e)}function tk(b,c,d,e){b=d-b;c=e-c;return b*b+c*c};function uk(b,c,d,e,f,g,h){var k=b[c],n=b[c+1],p=b[d]-k,q=b[d+1]-n;if(0!==p||0!==q)if(g=((f-k)*p+(g-n)*q)/(p*p+q*q),1<g)c=d;else if(0<g){for(f=0;f<e;++f)h[f]=Yb(b[c+f],b[d+f],g);h.length=e;return}for(f=0;f<e;++f)h[f]=b[c+f];h.length=e}function vk(b,c,d,e,f){var g=b[c],h=b[c+1];for(c+=e;c<d;c+=e){var k=b[c],n=b[c+1],g=tk(g,h,k,n);g>f&&(f=g);g=k;h=n}return f}function wk(b,c,d,e,f){var g,h;g=0;for(h=d.length;g<h;++g){var k=d[g];f=vk(b,c,k,e,f);c=k}return f}
function xk(b,c,d,e,f,g,h,k,n,p,q){if(c==d)return p;var r;if(0===f){r=tk(h,k,b[c],b[c+1]);if(r<p){for(q=0;q<e;++q)n[q]=b[c+q];n.length=e;return r}return p}for(var s=m(q)?q:[NaN,NaN],u=c+e;u<d;)if(uk(b,u-e,u,e,h,k,s),r=tk(h,k,s[0],s[1]),r<p){p=r;for(q=0;q<e;++q)n[q]=s[q];n.length=e;u+=e}else u+=e*Math.max((Math.sqrt(r)-Math.sqrt(p))/f|0,1);if(g&&(uk(b,d-e,c,e,h,k,s),r=tk(h,k,s[0],s[1]),r<p)){p=r;for(q=0;q<e;++q)n[q]=s[q];n.length=e}return p}
function yk(b,c,d,e,f,g,h,k,n,p,q){q=m(q)?q:[NaN,NaN];var r,s;r=0;for(s=d.length;r<s;++r){var u=d[r];p=xk(b,c,u,e,f,g,h,k,n,p,q);c=u}return p};function zk(b,c){var d=0,e,f;e=0;for(f=c.length;e<f;++e)b[d++]=c[e];return d}function Ak(b,c,d,e){var f,g;f=0;for(g=d.length;f<g;++f){var h=d[f],k;for(k=0;k<e;++k)b[c++]=h[k]}return c}function Bk(b,c,d,e,f){f=m(f)?f:[];var g=0,h,k;h=0;for(k=d.length;h<k;++h)c=Ak(b,c,d[h],e),f[g++]=c;f.length=g;return f};function Ck(b,c,d,e,f){f=m(f)?f:[];for(var g=0;c<d;c+=e)f[g++]=b.slice(c,c+e);f.length=g;return f}function Dk(b,c,d,e,f){f=m(f)?f:[];var g=0,h,k;h=0;for(k=d.length;h<k;++h){var n=d[h];f[g++]=Ck(b,c,n,e,f[g]);c=n}f.length=g;return f};function Ek(b,c,d,e,f,g,h){var k=(d-c)/e;if(3>k){for(;c<d;c+=e)g[h++]=b[c],g[h++]=b[c+1];return h}var n=Array(k);n[0]=1;n[k-1]=1;d=[c,d-e];for(var p=0,q;0<d.length;){var r=d.pop(),s=d.pop(),u=0,z=b[s],y=b[s+1],A=b[r],D=b[r+1];for(q=s+e;q<r;q+=e){var x=sk(b[q],b[q+1],z,y,A,D);x>u&&(p=q,u=x)}u>f&&(n[(p-c)/e]=1,s+e<p&&d.push(s,p),p+e<r&&d.push(p,r))}for(q=0;q<k;++q)n[q]&&(g[h++]=b[c+q*e],g[h++]=b[c+q*e+1]);return h}
function Fk(b,c,d,e,f,g,h,k){var n,p;n=0;for(p=d.length;n<p;++n){var q=d[n];a:{var r=b,s=q,u=e,z=f,y=g;if(c!=s){var A=z*Math.round(r[c]/z),D=z*Math.round(r[c+1]/z);c+=u;y[h++]=A;y[h++]=D;var x=void 0,M=void 0;do if(x=z*Math.round(r[c]/z),M=z*Math.round(r[c+1]/z),c+=u,c==s){y[h++]=x;y[h++]=M;break a}while(x==A&&M==D);for(;c<s;){var Q,O;Q=z*Math.round(r[c]/z);O=z*Math.round(r[c+1]/z);c+=u;if(Q!=x||O!=M){var W=x-A,Ja=M-D,lb=Q-A,Ka=O-D;W*Ka==Ja*lb&&(0>W&&lb<W||W==lb||0<W&&lb>W)&&(0>Ja&&Ka<Ja||Ja==Ka||
0<Ja&&Ka>Ja)||(y[h++]=x,y[h++]=M,A=x,D=M);x=Q;M=O}}y[h++]=x;y[h++]=M}}k.push(h);c=q}return h};function Gk(b,c){mk.call(this);this.b=this.n=-1;this.V(b,c)}v(Gk,mk);l=Gk.prototype;l.clone=function(){var b=new Gk(null);Hk(b,this.a,this.j.slice());return b};l.Ya=function(b,c,d,e){if(e<Zd(this.J(),b,c))return e;this.b!=this.d&&(this.n=Math.sqrt(vk(this.j,0,this.j.length,this.B,0)),this.b=this.d);return xk(this.j,0,this.j.length,this.B,this.n,!0,b,c,d,e)};l.Oj=function(){return qk(this.j,0,this.j.length,this.B)};l.Q=function(){return Ck(this.j,0,this.j.length,this.B)};
l.oc=function(b){var c=[];c.length=Ek(this.j,0,this.j.length,this.B,b,c,0);b=new Gk(null);Hk(b,"XY",c);return b};l.O=function(){return"LinearRing"};l.V=function(b,c){null===b?Hk(this,"XY",null):(pk(this,c,b,1),null===this.j&&(this.j=[]),this.j.length=Ak(this.j,0,b,this.B),this.l())};function Hk(b,c,d){ok(b,c,d);b.l()};function Ik(b,c){mk.call(this);this.V(b,c)}v(Ik,mk);l=Ik.prototype;l.clone=function(){var b=new Ik(null);Jk(b,this.a,this.j.slice());return b};l.Ya=function(b,c,d,e){var f=this.j;b=tk(b,c,f[0],f[1]);if(b<e){e=this.B;for(c=0;c<e;++c)d[c]=f[c];d.length=e;return b}return e};l.Q=function(){return null===this.j?[]:this.j.slice()};l.dd=function(b){return ce(this.j,b)};l.O=function(){return"Point"};l.ja=function(b){return ae(b,this.j[0],this.j[1])};
l.V=function(b,c){null===b?Jk(this,"XY",null):(pk(this,c,b,0),null===this.j&&(this.j=[]),this.j.length=zk(this.j,b),this.l())};function Jk(b,c,d){ok(b,c,d);b.l()};function Kk(b,c,d,e,f){return!ge(f,function(f){return!Lk(b,c,d,e,f[0],f[1])})}function Lk(b,c,d,e,f,g){for(var h=!1,k=b[d-e],n=b[d-e+1];c<d;c+=e){var p=b[c],q=b[c+1];n>g!=q>g&&f<(p-k)*(g-n)/(q-n)+k&&(h=!h);k=p;n=q}return h}function Mk(b,c,d,e,f,g){if(0===d.length||!Lk(b,c,d[0],e,f,g))return!1;var h;c=1;for(h=d.length;c<h;++c)if(Lk(b,d[c-1],d[c],e,f,g))return!1;return!0};function Nk(b,c,d,e,f,g,h){var k,n,p,q,r,s=f[g+1],u=[],z=d[0];p=b[z-e];r=b[z-e+1];for(k=c;k<z;k+=e){q=b[k];n=b[k+1];if(s<=r&&n<=s||r<=s&&s<=n)p=(s-r)/(n-r)*(q-p)+p,u.push(p);p=q;r=n}z=NaN;r=-Infinity;u.sort();p=u[0];k=1;for(n=u.length;k<n;++k){q=u[k];var y=Math.abs(q-p);y>r&&(p=(p+q)/2,Mk(b,c,d,e,p,s)&&(z=p,r=y));p=q}isNaN(z)&&(z=f[g]);return m(h)?(h.push(z,s),h):[z,s]};function Ok(b,c,d,e,f,g){for(var h=[b[c],b[c+1]],k=[],n;c+e<d;c+=e){k[0]=b[c+e];k[1]=b[c+e+1];if(n=f.call(g,h,k))return n;h[0]=k[0];h[1]=k[1]}return!1};function Pk(b,c,d,e,f){var g=fe(Td(),b,c,d,e);return qe(f,g)?$d(f,g)||g[0]>=f[0]&&g[2]<=f[2]||g[1]>=f[1]&&g[3]<=f[3]?!0:Ok(b,c,d,e,function(b,c){var d=!1,e=be(f,b),g=be(f,c);if(1===e||1===g)d=!0;else{var r=f[0],s=f[1],u=f[2],z=f[3],y=c[0],A=c[1],D=(A-b[1])/(y-b[0]);g&2&&!(e&2)?(s=y-(A-z)/D,d=s>=r&&s<=u):g&4&&!(e&4)?(r=A-(y-u)*D,d=r>=s&&r<=z):g&8&&!(e&8)?(s=y-(A-s)/D,d=s>=r&&s<=u):g&16&&!(e&16)&&(r=A-(y-r)*D,d=r>=s&&r<=z)}return d}):!1}
function Qk(b,c,d,e,f){var g=d[0];if(!(Pk(b,c,g,e,f)||Lk(b,c,g,e,f[0],f[1])||Lk(b,c,g,e,f[0],f[3])||Lk(b,c,g,e,f[2],f[1])||Lk(b,c,g,e,f[2],f[3])))return!1;if(1===d.length)return!0;c=1;for(g=d.length;c<g;++c)if(Kk(b,d[c-1],d[c],e,f))return!1;return!0};function Rk(b,c,d,e){for(var f=0,g=b[d-e],h=b[d-e+1];c<d;c+=e)var k=b[c],n=b[c+1],f=f+(k-g)*(n+h),g=k,h=n;return 0<f}function Sk(b,c,d){var e=0,f,g;f=0;for(g=c.length;f<g;++f){var h=c[f],e=Rk(b,e,h,d);if(0===f?!e:e)return!1;e=h}return!0}function Tk(b,c,d,e){var f,g;f=0;for(g=d.length;f<g;++f){var h=d[f],k=Rk(b,c,h,e);if(0===f?!k:k)for(var k=b,n=h,p=e;c<n-p;){var q;for(q=0;q<p;++q){var r=k[c+q];k[c+q]=k[n-p+q];k[n-p+q]=r}c+=p;n-=p}c=h}return c};function F(b,c){mk.call(this);this.b=[];this.o=-1;this.p=null;this.H=this.r=this.D=-1;this.n=null;this.V(b,c)}v(F,mk);l=F.prototype;l.kh=function(b){null===this.j?this.j=b.j.slice():ab(this.j,b.j);this.b.push(this.j.length);this.l()};l.clone=function(){var b=new F(null);Uk(b,this.a,this.j.slice(),this.b.slice());return b};
l.Ya=function(b,c,d,e){if(e<Zd(this.J(),b,c))return e;this.r!=this.d&&(this.D=Math.sqrt(wk(this.j,0,this.b,this.B,0)),this.r=this.d);return yk(this.j,0,this.b,this.B,this.D,!0,b,c,d,e)};l.Jb=function(b,c){return Mk(Vk(this),0,this.b,this.B,b,c)};l.Rj=function(){return rk(Vk(this),0,this.b,this.B)};l.Q=function(){return Dk(this.j,0,this.b,this.B)};function Wk(b){if(b.o!=b.d){var c=le(b.J());b.p=Nk(Vk(b),0,b.b,b.B,c,0);b.o=b.d}return b.p}l.Mh=function(){return new Ik(Wk(this))};l.Sh=function(){return this.b.length};
l.Rh=function(b){if(0>b||this.b.length<=b)return null;var c=new Gk(null);Hk(c,this.a,this.j.slice(0===b?0:this.b[b-1],this.b[b]));return c};l.ld=function(){var b=this.a,c=this.j,d=this.b,e=[],f=0,g,h;g=0;for(h=d.length;g<h;++g){var k=d[g],n=new Gk(null);Hk(n,b,c.slice(f,k));e.push(n);f=k}return e};function Vk(b){if(b.H!=b.d){var c=b.j;Sk(c,b.b,b.B)?b.n=c:(b.n=c.slice(),b.n.length=Tk(b.n,0,b.b,b.B));b.H=b.d}return b.n}
l.oc=function(b){var c=[],d=[];c.length=Fk(this.j,0,this.b,this.B,Math.sqrt(b),c,0,d);b=new F(null);Uk(b,"XY",c,d);return b};l.O=function(){return"Polygon"};l.ja=function(b){return Qk(Vk(this),0,this.b,this.B,b)};l.V=function(b,c){if(null===b)Uk(this,"XY",null,this.b);else{pk(this,c,b,2);null===this.j&&(this.j=[]);var d=Bk(this.j,0,b,this.B,this.b);this.j.length=0===d.length?0:d[d.length-1];this.l()}};function Uk(b,c,d,e){ok(b,c,d);b.b=e;b.l()}
function Xk(b,c,d,e){var f=m(e)?e:32;e=[];var g;for(g=0;g<f;++g)ab(e,b.offset(c,d,2*Math.PI*g/f));e.push(e[0],e[1]);b=new F(null);Uk(b,"XY",e,[e.length]);return b};function Yk(b,c,d,e,f,g,h){rc.call(this,b,c);this.vectorContext=d;this.a=e;this.frameState=f;this.context=g;this.glContext=h}v(Yk,rc);function Zk(b){this.b=this.d=this.f=this.c=this.a=null;this.e=b}v(Zk,mc);function $k(b){var c=b.f,d=b.d;b=Sa([c,[c[0],d[1]],d,[d[0],c[1]]],b.a.ra,b.a);b[4]=b[0].slice();return new F([b])}Zk.prototype.P=function(){this.setMap(null)};Zk.prototype.g=function(b){var c=this.b,d=this.e;b.vectorContext.kc(Infinity,function(b){b.Ba(d.f,d.b);b.Ca(d.d);b.Rb(c,null)})};Zk.prototype.R=function(){return this.b};function al(b){null===b.a||null===b.f||null===b.d||b.a.render()}
Zk.prototype.setMap=function(b){null!==this.c&&(Xc(this.c),this.c=null,this.a.render(),this.a=null);this.a=b;null!==this.a&&(this.c=w(b,"postcompose",this.g,!1,this),al(this))};function bl(b,c){rc.call(this,b);this.coordinate=c}v(bl,rc);function cl(b){Zj.call(this,{handleDownEvent:dl,handleDragEvent:el,handleUpEvent:fl});b=m(b)?b:{};this.e=new Zk(m(b.style)?b.style:null);this.a=null;this.i=m(b.condition)?b.condition:cd}v(cl,Zj);function el(b){if(Yj(b)){var c=this.e;b=b.pixel;c.f=this.a;c.d=b;c.b=$k(c);al(c)}}cl.prototype.R=function(){return this.e.R()};cl.prototype.g=ca;
function fl(b){if(!Yj(b))return!0;this.e.setMap(null);var c=b.pixel[0]-this.a[0],d=b.pixel[1]-this.a[1];64<=c*c+d*d&&(this.g(b),this.dispatchEvent(new bl("boxend",b.coordinate)));return!1}function dl(b){if(Yj(b)&&Ac(b.a)&&this.i(b)){this.a=b.pixel;this.e.setMap(b.map);var c=this.e,d=this.a;c.f=this.a;c.d=d;c.b=$k(c);al(c);this.dispatchEvent(new bl("boxstart",b.coordinate));return!0}return!1};function gl(){this.d=-1};function hl(){this.d=-1;this.d=64;this.a=Array(4);this.f=Array(this.d);this.c=this.b=0;this.a[0]=1732584193;this.a[1]=4023233417;this.a[2]=2562383102;this.a[3]=271733878;this.c=this.b=0}v(hl,gl);
function il(b,c,d){d||(d=0);var e=Array(16);if(ia(c))for(var f=0;16>f;++f)e[f]=c.charCodeAt(d++)|c.charCodeAt(d++)<<8|c.charCodeAt(d++)<<16|c.charCodeAt(d++)<<24;else for(f=0;16>f;++f)e[f]=c[d++]|c[d++]<<8|c[d++]<<16|c[d++]<<24;c=b.a[0];d=b.a[1];var f=b.a[2],g=b.a[3],h=0,h=c+(g^d&(f^g))+e[0]+3614090360&4294967295;c=d+(h<<7&4294967295|h>>>25);h=g+(f^c&(d^f))+e[1]+3905402710&4294967295;g=c+(h<<12&4294967295|h>>>20);h=f+(d^g&(c^d))+e[2]+606105819&4294967295;f=g+(h<<17&4294967295|h>>>15);h=d+(c^f&(g^
c))+e[3]+3250441966&4294967295;d=f+(h<<22&4294967295|h>>>10);h=c+(g^d&(f^g))+e[4]+4118548399&4294967295;c=d+(h<<7&4294967295|h>>>25);h=g+(f^c&(d^f))+e[5]+1200080426&4294967295;g=c+(h<<12&4294967295|h>>>20);h=f+(d^g&(c^d))+e[6]+2821735955&4294967295;f=g+(h<<17&4294967295|h>>>15);h=d+(c^f&(g^c))+e[7]+4249261313&4294967295;d=f+(h<<22&4294967295|h>>>10);h=c+(g^d&(f^g))+e[8]+1770035416&4294967295;c=d+(h<<7&4294967295|h>>>25);h=g+(f^c&(d^f))+e[9]+2336552879&4294967295;g=c+(h<<12&4294967295|h>>>20);h=f+
(d^g&(c^d))+e[10]+4294925233&4294967295;f=g+(h<<17&4294967295|h>>>15);h=d+(c^f&(g^c))+e[11]+2304563134&4294967295;d=f+(h<<22&4294967295|h>>>10);h=c+(g^d&(f^g))+e[12]+1804603682&4294967295;c=d+(h<<7&4294967295|h>>>25);h=g+(f^c&(d^f))+e[13]+4254626195&4294967295;g=c+(h<<12&4294967295|h>>>20);h=f+(d^g&(c^d))+e[14]+2792965006&4294967295;f=g+(h<<17&4294967295|h>>>15);h=d+(c^f&(g^c))+e[15]+1236535329&4294967295;d=f+(h<<22&4294967295|h>>>10);h=c+(f^g&(d^f))+e[1]+4129170786&4294967295;c=d+(h<<5&4294967295|
h>>>27);h=g+(d^f&(c^d))+e[6]+3225465664&4294967295;g=c+(h<<9&4294967295|h>>>23);h=f+(c^d&(g^c))+e[11]+643717713&4294967295;f=g+(h<<14&4294967295|h>>>18);h=d+(g^c&(f^g))+e[0]+3921069994&4294967295;d=f+(h<<20&4294967295|h>>>12);h=c+(f^g&(d^f))+e[5]+3593408605&4294967295;c=d+(h<<5&4294967295|h>>>27);h=g+(d^f&(c^d))+e[10]+38016083&4294967295;g=c+(h<<9&4294967295|h>>>23);h=f+(c^d&(g^c))+e[15]+3634488961&4294967295;f=g+(h<<14&4294967295|h>>>18);h=d+(g^c&(f^g))+e[4]+3889429448&4294967295;d=f+(h<<20&4294967295|
h>>>12);h=c+(f^g&(d^f))+e[9]+568446438&4294967295;c=d+(h<<5&4294967295|h>>>27);h=g+(d^f&(c^d))+e[14]+3275163606&4294967295;g=c+(h<<9&4294967295|h>>>23);h=f+(c^d&(g^c))+e[3]+4107603335&4294967295;f=g+(h<<14&4294967295|h>>>18);h=d+(g^c&(f^g))+e[8]+1163531501&4294967295;d=f+(h<<20&4294967295|h>>>12);h=c+(f^g&(d^f))+e[13]+2850285829&4294967295;c=d+(h<<5&4294967295|h>>>27);h=g+(d^f&(c^d))+e[2]+4243563512&4294967295;g=c+(h<<9&4294967295|h>>>23);h=f+(c^d&(g^c))+e[7]+1735328473&4294967295;f=g+(h<<14&4294967295|
h>>>18);h=d+(g^c&(f^g))+e[12]+2368359562&4294967295;d=f+(h<<20&4294967295|h>>>12);h=c+(d^f^g)+e[5]+4294588738&4294967295;c=d+(h<<4&4294967295|h>>>28);h=g+(c^d^f)+e[8]+2272392833&4294967295;g=c+(h<<11&4294967295|h>>>21);h=f+(g^c^d)+e[11]+1839030562&4294967295;f=g+(h<<16&4294967295|h>>>16);h=d+(f^g^c)+e[14]+4259657740&4294967295;d=f+(h<<23&4294967295|h>>>9);h=c+(d^f^g)+e[1]+2763975236&4294967295;c=d+(h<<4&4294967295|h>>>28);h=g+(c^d^f)+e[4]+1272893353&4294967295;g=c+(h<<11&4294967295|h>>>21);h=f+(g^
c^d)+e[7]+4139469664&4294967295;f=g+(h<<16&4294967295|h>>>16);h=d+(f^g^c)+e[10]+3200236656&4294967295;d=f+(h<<23&4294967295|h>>>9);h=c+(d^f^g)+e[13]+681279174&4294967295;c=d+(h<<4&4294967295|h>>>28);h=g+(c^d^f)+e[0]+3936430074&4294967295;g=c+(h<<11&4294967295|h>>>21);h=f+(g^c^d)+e[3]+3572445317&4294967295;f=g+(h<<16&4294967295|h>>>16);h=d+(f^g^c)+e[6]+76029189&4294967295;d=f+(h<<23&4294967295|h>>>9);h=c+(d^f^g)+e[9]+3654602809&4294967295;c=d+(h<<4&4294967295|h>>>28);h=g+(c^d^f)+e[12]+3873151461&4294967295;
g=c+(h<<11&4294967295|h>>>21);h=f+(g^c^d)+e[15]+530742520&4294967295;f=g+(h<<16&4294967295|h>>>16);h=d+(f^g^c)+e[2]+3299628645&4294967295;d=f+(h<<23&4294967295|h>>>9);h=c+(f^(d|~g))+e[0]+4096336452&4294967295;c=d+(h<<6&4294967295|h>>>26);h=g+(d^(c|~f))+e[7]+1126891415&4294967295;g=c+(h<<10&4294967295|h>>>22);h=f+(c^(g|~d))+e[14]+2878612391&4294967295;f=g+(h<<15&4294967295|h>>>17);h=d+(g^(f|~c))+e[5]+4237533241&4294967295;d=f+(h<<21&4294967295|h>>>11);h=c+(f^(d|~g))+e[12]+1700485571&4294967295;c=d+
(h<<6&4294967295|h>>>26);h=g+(d^(c|~f))+e[3]+2399980690&4294967295;g=c+(h<<10&4294967295|h>>>22);h=f+(c^(g|~d))+e[10]+4293915773&4294967295;f=g+(h<<15&4294967295|h>>>17);h=d+(g^(f|~c))+e[1]+2240044497&4294967295;d=f+(h<<21&4294967295|h>>>11);h=c+(f^(d|~g))+e[8]+1873313359&4294967295;c=d+(h<<6&4294967295|h>>>26);h=g+(d^(c|~f))+e[15]+4264355552&4294967295;g=c+(h<<10&4294967295|h>>>22);h=f+(c^(g|~d))+e[6]+2734768916&4294967295;f=g+(h<<15&4294967295|h>>>17);h=d+(g^(f|~c))+e[13]+1309151649&4294967295;
d=f+(h<<21&4294967295|h>>>11);h=c+(f^(d|~g))+e[4]+4149444226&4294967295;c=d+(h<<6&4294967295|h>>>26);h=g+(d^(c|~f))+e[11]+3174756917&4294967295;g=c+(h<<10&4294967295|h>>>22);h=f+(c^(g|~d))+e[2]+718787259&4294967295;f=g+(h<<15&4294967295|h>>>17);h=d+(g^(f|~c))+e[9]+3951481745&4294967295;b.a[0]=b.a[0]+c&4294967295;b.a[1]=b.a[1]+(f+(h<<21&4294967295|h>>>11))&4294967295;b.a[2]=b.a[2]+f&4294967295;b.a[3]=b.a[3]+g&4294967295}
hl.prototype.update=function(b,c){m(c)||(c=b.length);for(var d=c-this.d,e=this.f,f=this.b,g=0;g<c;){if(0==f)for(;g<=d;)il(this,b,g),g+=this.d;if(ia(b))for(;g<c;){if(e[f++]=b.charCodeAt(g++),f==this.d){il(this,e);f=0;break}}else for(;g<c;)if(e[f++]=b[g++],f==this.d){il(this,e);f=0;break}}this.b=f;this.c+=c};function jl(b){b=m(b)?b:{};this.a=m(b.color)?b.color:null;this.c=b.lineCap;this.b=m(b.lineDash)?b.lineDash:null;this.f=b.lineJoin;this.e=b.miterLimit;this.d=b.width;this.g=void 0}l=jl.prototype;l.Mk=function(){return this.a};l.Oh=function(){return this.c};l.Nk=function(){return this.b};l.Ph=function(){return this.f};l.Vh=function(){return this.e};l.Ok=function(){return this.d};l.Pk=function(b){this.a=b;this.g=void 0};l.Yl=function(b){this.c=b;this.g=void 0};l.Qk=function(b){this.b=b;this.g=void 0};
l.Zl=function(b){this.f=b;this.g=void 0};l.$l=function(b){this.e=b;this.g=void 0};l.gm=function(b){this.d=b;this.g=void 0};
l.xb=function(){if(!m(this.g)){var b="s"+(null===this.a?"-":rg(this.a))+","+(m(this.c)?this.c.toString():"-")+","+(null===this.b?"-":this.b.toString())+","+(m(this.f)?this.f:"-")+","+(m(this.e)?this.e.toString():"-")+","+(m(this.d)?this.d.toString():"-"),c=new hl;c.update(b);var d=Array((56>c.b?c.d:2*c.d)-c.b);d[0]=128;for(b=1;b<d.length-8;++b)d[b]=0;for(var e=8*c.c,b=d.length-8;b<d.length;++b)d[b]=e&255,e/=256;c.update(d);d=Array(16);for(b=e=0;4>b;++b)for(var f=0;32>f;f+=8)d[e++]=c.a[b]>>>f&255;
if(8192>d.length)c=String.fromCharCode.apply(null,d);else for(c="",b=0;b<d.length;b+=8192)c+=String.fromCharCode.apply(null,cb(d,b,b+8192));this.g=c}return this.g};var kl=[0,0,0,1],ll=[],ml=[0,0,0,1];function nl(b){b=m(b)?b:{};this.a=m(b.color)?b.color:null;this.d=void 0}nl.prototype.b=function(){return this.a};nl.prototype.c=function(b){this.a=b;this.d=void 0};nl.prototype.xb=function(){m(this.d)||(this.d="f"+(null===this.a?"-":rg(this.a)));return this.d};function pl(b){b=m(b)?b:{};this.e=this.a=this.f=null;this.c=m(b.fill)?b.fill:null;this.d=m(b.stroke)?b.stroke:null;this.b=b.radius;this.q=[0,0];this.n=this.D=this.g=null;var c=b.atlasManager,d,e=null,f,g=0;null!==this.d&&(f=rg(this.d.a),g=this.d.d,m(g)||(g=1),e=this.d.b,Xf||(e=null));var h=2*(this.b+g)+1;f={strokeStyle:f,Uc:g,size:h,lineDash:e};m(c)?(h=Math.round(h),(e=null===this.c)&&(d=ra(this.Sf,this,f)),g=this.xb(),f=c.add(g,h,h,ra(this.Tf,this,f),d),this.a=f.image,this.q=[f.offsetX,f.offsetY],
d=f.image.width,this.e=e?f.xf:this.a):(this.a=Df("CANVAS"),this.a.height=h,this.a.width=h,d=h=this.a.width,c=this.a.getContext("2d"),this.Tf(f,c,0,0),null===this.c?(c=this.e=Df("CANVAS"),c.height=f.size,c.width=f.size,c=c.getContext("2d"),this.Sf(f,c,0,0)):this.e=this.a);this.g=[h/2,h/2];this.D=[h,h];this.n=[d,d];uj.call(this,{opacity:1,rotateWithView:!1,rotation:0,scale:1,snapToPixel:m(b.snapToPixel)?b.snapToPixel:!0})}v(pl,uj);l=pl.prototype;l.wb=function(){return this.g};l.Dk=function(){return this.c};
l.Kd=function(){return this.e};l.Bb=function(){return this.a};l.Pc=function(){return 2};l.kd=function(){return this.n};l.Cb=function(){return this.q};l.Ek=function(){return this.b};l.gb=function(){return this.D};l.Fk=function(){return this.d};l.xe=ca;l.load=ca;l.Oe=ca;
l.Tf=function(b,c,d,e){c.setTransform(1,0,0,1,0,0);c.translate(d,e);c.beginPath();c.arc(b.size/2,b.size/2,this.b,0,2*Math.PI,!0);null!==this.c&&(c.fillStyle=rg(this.c.a),c.fill());null!==this.d&&(c.strokeStyle=b.strokeStyle,c.lineWidth=b.Uc,null===b.lineDash||c.setLineDash(b.lineDash),c.stroke());c.closePath()};
l.Sf=function(b,c,d,e){c.setTransform(1,0,0,1,0,0);c.translate(d,e);c.beginPath();c.arc(b.size/2,b.size/2,this.b,0,2*Math.PI,!0);c.fillStyle=kl;c.fill();null!==this.d&&(c.strokeStyle=b.strokeStyle,c.lineWidth=b.Uc,null===b.lineDash||c.setLineDash(b.lineDash),c.stroke());c.closePath()};l.xb=function(){var b=null===this.d?"-":this.d.xb(),c=null===this.c?"-":this.c.xb();if(null===this.f||b!=this.f[1]||c!=this.f[2]||this.b!=this.f[3])this.f=["c"+b+c+(m(this.b)?this.b.toString():"-"),b,c,this.b];return this.f[0]};function ql(b){b=m(b)?b:{};this.g=null;this.c=rl;m(b.geometry)&&this.Wf(b.geometry);this.f=m(b.fill)?b.fill:null;this.e=m(b.image)?b.image:null;this.b=m(b.stroke)?b.stroke:null;this.d=m(b.text)?b.text:null;this.a=b.zIndex}l=ql.prototype;l.R=function(){return this.g};l.Ih=function(){return this.c};l.Rk=function(){return this.f};l.Sk=function(){return this.e};l.Tk=function(){return this.b};l.Uk=function(){return this.d};l.ji=function(){return this.a};
l.Wf=function(b){ka(b)?this.c=b:ia(b)?this.c=function(c){return c.get(b)}:null===b?this.c=rl:m(b)&&(this.c=function(){return b});this.g=b};l.im=function(b){this.a=b};function sl(b){ka(b)||(b=ga(b)?b:[b],b=ad(b));return b}function tl(){var b=new nl({color:"rgba(255,255,255,0.4)"}),c=new jl({color:"#3399CC",width:1.25}),d=[new ql({image:new pl({fill:b,stroke:c,radius:5}),fill:b,stroke:c})];tl=function(){return d};return d}
function ul(){var b={},c=[255,255,255,1],d=[0,153,255,1];b.Polygon=[new ql({fill:new nl({color:[255,255,255,.5]})})];b.MultiPolygon=b.Polygon;b.LineString=[new ql({stroke:new jl({color:c,width:5})}),new ql({stroke:new jl({color:d,width:3})})];b.MultiLineString=b.LineString;b.Circle=b.Polygon.concat(b.LineString);b.Point=[new ql({image:new pl({radius:6,fill:new nl({color:d}),stroke:new jl({color:c,width:1.5})}),zIndex:Infinity})];b.MultiPoint=b.Point;b.GeometryCollection=b.Polygon.concat(b.Point);
return b}function rl(b){return b.R()};function vl(b){var c=m(b)?b:{};b=m(c.condition)?c.condition:Wj;c=m(c.style)?c.style:new ql({stroke:new jl({color:[0,0,255,1]})});cl.call(this,{condition:b,style:c})}v(vl,cl);vl.prototype.g=function(){var b=this.k,c=b.a(),d=this.R().J(),e=le(d),f=b.f(),d=c.k(d,f),d=c.constrainResolution(d,0,void 0);Pj(b,c,d,e,200)};function wl(b){Mj.call(this,{handleEvent:xl});b=m(b)?b:{};this.a=m(b.condition)?b.condition:hd(Vj,Xj);this.f=m(b.pixelDelta)?b.pixelDelta:128}v(wl,Mj);
function xl(b){var c=!1;if("key"==b.type){var d=b.a.f;if(this.a(b)&&(40==d||37==d||39==d||38==d)){var e=b.map,c=e.a(),f=Ye(c),g=f.resolution*this.f,h=0,k=0;40==d?k=-g:37==d?h=-g:39==d?h=g:k=g;d=[h,k];Bd(d,f.rotation);f=c.b();m(f)&&(m(100)&&e.La(df({source:f,duration:100,easing:bf})),e=c.i([f[0]+d[0],f[1]+d[1]]),c.Ha(e));b.preventDefault();c=!0}}return!c};function yl(b){Mj.call(this,{handleEvent:zl});b=m(b)?b:{};this.f=m(b.condition)?b.condition:Xj;this.a=m(b.delta)?b.delta:1;this.e=m(b.duration)?b.duration:100}v(yl,Mj);function zl(b){var c=!1;if("key"==b.type){var d=b.a.i;if(this.f(b)&&(43==d||45==d)){c=b.map;d=43==d?this.a:-this.a;c.render();var e=c.a();Oj(c,e,d,void 0,this.e);b.preventDefault();c=!0}}return!c};function Al(b){Mj.call(this,{handleEvent:Bl});b=m(b)?b:{};this.a=0;this.q=m(b.duration)?b.duration:250;this.e=null;this.g=this.f=void 0}v(Al,Mj);function Bl(b){var c=!1;if("mousewheel"==b.type){var c=b.map,d=b.a;this.e=b.coordinate;this.a+=d.q;m(this.f)||(this.f=ta());d=Math.max(80-(ta()-this.f),0);ba.clearTimeout(this.g);this.g=ba.setTimeout(ra(this.i,this,c),d);b.preventDefault();c=!0}return!c}
Al.prototype.i=function(b){var c=Wb(this.a,-1,1),d=b.a();b.render();Oj(b,d,-c,this.e,this.q);this.a=0;this.e=null;this.g=this.f=void 0};function Cl(b){Zj.call(this,{handleDownEvent:Dl,handleDragEvent:El,handleUpEvent:Fl});b=m(b)?b:{};this.e=null;this.g=void 0;this.a=!1;this.i=0;this.q=m(b.threshold)?b.threshold:.3}v(Cl,Zj);
function El(b){var c=0,d=this.f[0],e=this.f[1],d=Math.atan2(e.clientY-d.clientY,e.clientX-d.clientX);m(this.g)&&(c=d-this.g,this.i+=c,!this.a&&Math.abs(this.i)>this.q&&(this.a=!0));this.g=d;b=b.map;d=Ig(b.b);e=bk(this.f);e[0]-=d.x;e[1]-=d.y;this.e=b.ra(e);this.a&&(d=b.a(),e=d.c(),b.render(),Nj(b,d,e+c,this.e))}function Fl(b){if(2>this.f.length){b=b.map;var c=b.a();Ze(c,-1);if(this.a){var d=c.c(),e=this.e,d=c.constrainRotation(d,0);Nj(b,c,d,e,250)}return!1}return!0}
function Dl(b){return 2<=this.f.length?(b=b.map,this.e=null,this.g=void 0,this.a=!1,this.i=0,this.p||Ze(b.a(),1),b.render(),!0):!1}Cl.prototype.r=bd;function Gl(b){Zj.call(this,{handleDownEvent:Hl,handleDragEvent:Il,handleUpEvent:Jl});b=m(b)?b:{};this.e=null;this.i=m(b.duration)?b.duration:400;this.a=void 0;this.g=1}v(Gl,Zj);function Il(b){var c=1,d=this.f[0],e=this.f[1],f=d.clientX-e.clientX,d=d.clientY-e.clientY,f=Math.sqrt(f*f+d*d);m(this.a)&&(c=this.a/f);this.a=f;1!=c&&(this.g=c);b=b.map;var f=b.a(),d=f.a(),e=Ig(b.b),g=bk(this.f);g[0]-=e.x;g[1]-=e.y;this.e=b.ra(g);b.render();Pj(b,f,d*c,this.e)}
function Jl(b){if(2>this.f.length){b=b.map;var c=b.a();Ze(c,-1);var d=c.a(),e=this.e,f=this.i,d=c.constrainResolution(d,0,this.g-1);Pj(b,c,d,e,f);return!1}return!0}function Hl(b){return 2<=this.f.length?(b=b.map,this.e=null,this.a=void 0,this.g=1,this.p||Ze(b.a(),1),b.render(),!0):!1}Gl.prototype.r=bd;function Kl(b){b=m(b)?b:{};var c=new kg,d=new Jj(-.005,.05,100);(m(b.altShiftDragRotate)?b.altShiftDragRotate:1)&&c.push(new gk);(m(b.doubleClickZoom)?b.doubleClickZoom:1)&&c.push(new Qj({delta:b.zoomDelta,duration:b.zoomDuration}));(m(b.dragPan)?b.dragPan:1)&&c.push(new ck({kinetic:d}));(m(b.pinchRotate)?b.pinchRotate:1)&&c.push(new Cl);(m(b.pinchZoom)?b.pinchZoom:1)&&c.push(new Gl({duration:b.zoomDuration}));if(m(b.keyboard)?b.keyboard:1)c.push(new wl),c.push(new yl({delta:b.zoomDelta,duration:b.zoomDuration}));
(m(b.mouseWheelZoom)?b.mouseWheelZoom:1)&&c.push(new Al({duration:b.zoomDuration}));(m(b.shiftDragZoom)?b.shiftDragZoom:1)&&c.push(new vl);return c};function G(b){var c=m(b)?b:{};b=Bb(c);delete b.layers;c=c.layers;C.call(this,b);this.a=null;w(this,vd("layers"),this.Di,!1,this);null!=c?ga(c)&&(c=new kg(c.slice())):c=new kg;this.r(c)}v(G,C);l=G.prototype;l.tf=function(){this.b()&&this.l()};
l.Di=function(){null!==this.a&&(Qa(rb(this.a),Xc),this.a=null);var b=this.ac();if(null!=b){this.a={add:w(b,"add",this.Ci,!1,this),remove:w(b,"remove",this.Ei,!1,this)};var b=b.a,c,d,e;c=0;for(d=b.length;c<d;c++)e=b[c],this.a[ma(e).toString()]=w(e,["propertychange","change"],this.tf,!1,this)}this.l()};l.Ci=function(b){b=b.element;this.a[ma(b).toString()]=w(b,["propertychange","change"],this.tf,!1,this);this.l()};l.Ei=function(b){b=ma(b.element).toString();Xc(this.a[b]);delete this.a[b];this.l()};
l.ac=function(){return this.get("layers")};G.prototype.getLayers=G.prototype.ac;G.prototype.r=function(b){this.set("layers",b)};G.prototype.setLayers=G.prototype.r;
G.prototype.Xa=function(b){var c=m(b)?b:[],d=c.length;this.ac().forEach(function(b){b.Xa(c)});b=Li(this);var e,f;for(e=c.length;d<e;d++)f=c[d],f.brightness=Wb(f.brightness+b.brightness,-1,1),f.contrast*=b.contrast,f.hue+=b.hue,f.opacity*=b.opacity,f.saturation*=b.saturation,f.visible=f.visible&&b.visible,f.maxResolution=Math.min(f.maxResolution,b.maxResolution),f.minResolution=Math.max(f.minResolution,b.minResolution),m(b.extent)&&(f.extent=m(f.extent)?pe(f.extent,b.extent):b.extent);return c};
G.prototype.kb=function(){return"ready"};function Ll(b){ye.call(this,{code:b,units:"m",extent:Ml,global:!0,worldExtent:Nl})}v(Ll,ye);Ll.prototype.te=function(b,c){var d=c[1]/6378137;return b/((Math.exp(d)+Math.exp(-d))/2)};var Ol=6378137*Math.PI,Ml=[-Ol,-Ol,Ol,Ol],Nl=[-180,-85,180,85],Je=Sa("EPSG:3857 EPSG:102100 EPSG:102113 EPSG:900913 urn:ogc:def:crs:EPSG:6.18:3:3857 urn:ogc:def:crs:EPSG::3857 http://www.opengis.net/gml/srs/epsg.xml#3857".split(" "),function(b){return new Ll(b)});
function Ke(b,c,d){var e=b.length;d=1<d?d:2;m(c)||(2<d?c=b.slice():c=Array(e));for(var f=0;f<e;f+=d)c[f]=6378137*Math.PI*b[f]/180,c[f+1]=6378137*Math.log(Math.tan(Math.PI*(b[f+1]+90)/360));return c}function Le(b,c,d){var e=b.length;d=1<d?d:2;m(c)||(2<d?c=b.slice():c=Array(e));for(var f=0;f<e;f+=d)c[f]=180*b[f]/(6378137*Math.PI),c[f+1]=360*Math.atan(Math.exp(b[f+1]/6378137))/Math.PI-90;return c};function Pl(b,c){ye.call(this,{code:b,units:"degrees",extent:Ql,axisOrientation:c,global:!0,worldExtent:Ql})}v(Pl,ye);Pl.prototype.te=function(b){return b};var Ql=[-180,-90,180,90],Me=[new Pl("CRS:84"),new Pl("EPSG:4326","neu"),new Pl("urn:ogc:def:crs:EPSG::4326","neu"),new Pl("urn:ogc:def:crs:EPSG:6.6:4326","neu"),new Pl("urn:ogc:def:crs:OGC:1.3:CRS84"),new Pl("urn:ogc:def:crs:OGC:2:84"),new Pl("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Pl("urn:x-ogc:def:crs:EPSG:4326","neu")];function Rl(){Ee(Je);Ee(Me);Ie()};function H(b){E.call(this,m(b)?b:{})}v(H,E);function I(b){b=m(b)?b:{};var c=Bb(b);delete c.preload;delete c.useInterimTilesOnError;E.call(this,c);this.ia(m(b.preload)?b.preload:0);this.ka(m(b.useInterimTilesOnError)?b.useInterimTilesOnError:!0)}v(I,E);I.prototype.r=function(){return this.get("preload")};I.prototype.getPreload=I.prototype.r;I.prototype.ia=function(b){this.set("preload",b)};I.prototype.setPreload=I.prototype.ia;I.prototype.ea=function(){return this.get("useInterimTilesOnError")};I.prototype.getUseInterimTilesOnError=I.prototype.ea;
I.prototype.ka=function(b){this.set("useInterimTilesOnError",b)};I.prototype.setUseInterimTilesOnError=I.prototype.ka;function J(b){b=m(b)?b:{};var c=Bb(b);delete c.style;delete c.renderBuffer;delete c.updateWhileAnimating;E.call(this,c);this.ea=m(b.renderBuffer)?b.renderBuffer:100;this.vc=null;this.r=void 0;this.ka(b.style);this.Ac=m(b.updateWhileAnimating)?b.updateWhileAnimating:!1}v(J,E);J.prototype.af=function(){return this.vc};J.prototype.df=function(){return this.r};J.prototype.ka=function(b){this.vc=m(b)?b:tl;this.r=null===b?void 0:sl(this.vc);this.l()};function Sl(b,c,d,e,f){this.o={};this.b=b;this.r=c;this.f=d;this.H=e;this.kb=f;this.e=this.a=this.d=this.fa=this.pa=this.oa=null;this.ea=this.Da=this.q=this.W=this.S=this.N=0;this.ia=!1;this.g=this.ka=0;this.va=!1;this.ca=0;this.c="";this.i=this.D=this.Fa=this.Ea=0;this.da=this.k=this.n=null;this.p=[];this.Xa=Id()}
function Tl(b,c,d){if(null!==b.e){c=lk(c,0,d,2,b.H,b.p);d=b.b;var e=b.Xa,f=d.globalAlpha;1!=b.q&&(d.globalAlpha=f*b.q);var g=b.ka;b.ia&&(g+=b.kb);var h,k;h=0;for(k=c.length;h<k;h+=2){var n=c[h]-b.N,p=c[h+1]-b.S;b.va&&(n=n+.5|0,p=p+.5|0);if(0!==g||1!=b.g){var q=n+b.N,r=p+b.S;gj(e,q,r,b.g,b.g,g,-q,-r);d.setTransform(e[0],e[1],e[4],e[5],e[12],e[13])}d.drawImage(b.e,b.Da,b.ea,b.ca,b.W,n,p,b.ca,b.W)}0===g&&1==b.g||d.setTransform(1,0,0,1,0,0);1!=b.q&&(d.globalAlpha=f)}}
function Ul(b,c,d,e){var f=0;if(null!==b.da&&""!==b.c){null===b.n||Vl(b,b.n);null===b.k||Wl(b,b.k);var g=b.da,h=b.b,k=b.fa;null===k?(h.font=g.font,h.textAlign=g.textAlign,h.textBaseline=g.textBaseline,b.fa={font:g.font,textAlign:g.textAlign,textBaseline:g.textBaseline}):(k.font!=g.font&&(k.font=h.font=g.font),k.textAlign!=g.textAlign&&(k.textAlign=h.textAlign=g.textAlign),k.textBaseline!=g.textBaseline&&(k.textBaseline=h.textBaseline=g.textBaseline));c=lk(c,f,d,e,b.H,b.p);for(g=b.b;f<d;f+=e){h=c[f]+
b.Ea;k=c[f+1]+b.Fa;if(0!==b.D||1!=b.i){var n=gj(b.Xa,h,k,b.i,b.i,b.D,-h,-k);g.setTransform(n[0],n[1],n[4],n[5],n[12],n[13])}null===b.k||g.strokeText(b.c,h,k);null===b.n||g.fillText(b.c,h,k)}0===b.D&&1==b.i||g.setTransform(1,0,0,1,0,0)}}function Xl(b,c,d,e,f,g){var h=b.b;b=lk(c,d,e,f,b.H,b.p);h.moveTo(b[0],b[1]);for(c=2;c<b.length;c+=2)h.lineTo(b[c],b[c+1]);g&&h.lineTo(b[0],b[1]);return e}function Yl(b,c,d,e,f){var g=b.b,h,k;h=0;for(k=e.length;h<k;++h)d=Xl(b,c,d,e[h],f,!0),g.closePath();return d}
l=Sl.prototype;l.kc=function(b,c){var d=b.toString(),e=this.o[d];m(e)?e.push(c):this.o[d]=[c]};l.lc=function(b){if(qe(this.f,b.J())){if(null!==this.d||null!==this.a){null===this.d||Vl(this,this.d);null===this.a||Wl(this,this.a);var c;c=b.j;c=null===c?null:lk(c,0,c.length,b.B,this.H,this.p);var d=c[2]-c[0],e=c[3]-c[1],d=Math.sqrt(d*d+e*e),e=this.b;e.beginPath();e.arc(c[0],c[1],d,0,2*Math.PI);null===this.d||e.fill();null===this.a||e.stroke()}""!==this.c&&Ul(this,b.Oc(),2,2)}};
l.oe=function(b,c){var d=(0,c.c)(b);if(null!=d&&qe(this.f,d.J())){var e=c.a;m(e)||(e=0);this.kc(e,function(b){b.Ba(c.f,c.b);b.ib(c.e);b.Ca(c.d);$l[d.O()].call(b,d,null)})}};l.fd=function(b,c){var d=b.c,e,f;e=0;for(f=d.length;e<f;++e){var g=d[e];$l[g.O()].call(this,g,c)}};l.ub=function(b){var c=b.j;b=b.B;null===this.e||Tl(this,c,c.length);""!==this.c&&Ul(this,c,c.length,b)};l.tb=function(b){var c=b.j;b=b.B;null===this.e||Tl(this,c,c.length);""!==this.c&&Ul(this,c,c.length,b)};
l.Eb=function(b){if(qe(this.f,b.J())){if(null!==this.a){Wl(this,this.a);var c=this.b,d=b.j;c.beginPath();Xl(this,d,0,d.length,b.B,!1);c.stroke()}""!==this.c&&(b=am(b),Ul(this,b,2,2))}};l.mc=function(b){var c=b.J();if(qe(this.f,c)){if(null!==this.a){Wl(this,this.a);var c=this.b,d=b.j,e=0,f=b.b,g=b.B;c.beginPath();var h,k;h=0;for(k=f.length;h<k;++h)e=Xl(this,d,e,f[h],g,!1);c.stroke()}""!==this.c&&(b=bm(b),Ul(this,b,b.length,2))}};
l.Rb=function(b){if(qe(this.f,b.J())){if(null!==this.a||null!==this.d){null===this.d||Vl(this,this.d);null===this.a||Wl(this,this.a);var c=this.b;c.beginPath();Yl(this,Vk(b),0,b.b,b.B);null===this.d||c.fill();null===this.a||c.stroke()}""!==this.c&&(b=Wk(b),Ul(this,b,2,2))}};
l.nc=function(b){if(qe(this.f,b.J())){if(null!==this.a||null!==this.d){null===this.d||Vl(this,this.d);null===this.a||Wl(this,this.a);var c=this.b,d=cm(b),e=0,f=b.b,g=b.B,h,k;h=0;for(k=f.length;h<k;++h){var n=f[h];c.beginPath();e=Yl(this,d,e,n,g);null===this.d||c.fill();null===this.a||c.stroke()}}""!==this.c&&(b=dm(b),Ul(this,b,b.length,2))}};function em(b){var c=Sa(sb(b.o),Number);db(c);var d,e,f,g,h;d=0;for(e=c.length;d<e;++d)for(f=b.o[c[d].toString()],g=0,h=f.length;g<h;++g)f[g](b)}
function Vl(b,c){var d=b.b,e=b.oa;null===e?(d.fillStyle=c.fillStyle,b.oa={fillStyle:c.fillStyle}):e.fillStyle!=c.fillStyle&&(e.fillStyle=d.fillStyle=c.fillStyle)}
function Wl(b,c){var d=b.b,e=b.pa;null===e?(d.lineCap=c.lineCap,Xf&&d.setLineDash(c.lineDash),d.lineJoin=c.lineJoin,d.lineWidth=c.lineWidth,d.miterLimit=c.miterLimit,d.strokeStyle=c.strokeStyle,b.pa={lineCap:c.lineCap,lineDash:c.lineDash,lineJoin:c.lineJoin,lineWidth:c.lineWidth,miterLimit:c.miterLimit,strokeStyle:c.strokeStyle}):(e.lineCap!=c.lineCap&&(e.lineCap=d.lineCap=c.lineCap),Xf&&!fb(e.lineDash,c.lineDash)&&d.setLineDash(e.lineDash=c.lineDash),e.lineJoin!=c.lineJoin&&(e.lineJoin=d.lineJoin=
c.lineJoin),e.lineWidth!=c.lineWidth&&(e.lineWidth=d.lineWidth=c.lineWidth),e.miterLimit!=c.miterLimit&&(e.miterLimit=d.miterLimit=c.miterLimit),e.strokeStyle!=c.strokeStyle&&(e.strokeStyle=d.strokeStyle=c.strokeStyle))}
l.Ba=function(b,c){if(null===b)this.d=null;else{var d=b.a;this.d={fillStyle:rg(null===d?kl:d)}}if(null===c)this.a=null;else{var d=c.a,e=c.c,f=c.b,g=c.f,h=c.d,k=c.e;this.a={lineCap:m(e)?e:"round",lineDash:null!=f?f:ll,lineJoin:m(g)?g:"round",lineWidth:this.r*(m(h)?h:1),miterLimit:m(k)?k:10,strokeStyle:rg(null===d?ml:d)}}};
l.ib=function(b){if(null===b)this.e=null;else{var c=b.wb(),d=b.Bb(1),e=b.Cb(),f=b.gb();this.N=c[0];this.S=c[1];this.W=f[1];this.e=d;this.q=b.o;this.Da=e[0];this.ea=e[1];this.ia=b.p;this.ka=b.i;this.g=b.k;this.va=b.r;this.ca=f[0]}};
l.Ca=function(b){if(null===b)this.c="";else{var c=b.a;null===c?this.n=null:(c=c.a,this.n={fillStyle:rg(null===c?kl:c)});var d=b.e;if(null===d)this.k=null;else{var c=d.a,e=d.c,f=d.b,g=d.f,h=d.d,d=d.e;this.k={lineCap:m(e)?e:"round",lineDash:null!=f?f:ll,lineJoin:m(g)?g:"round",lineWidth:m(h)?h:1,miterLimit:m(d)?d:10,strokeStyle:rg(null===c?ml:c)}}var c=b.c,e=b.i,f=b.k,g=b.f,h=b.d,d=b.b,k=b.g;b=b.n;this.da={font:m(c)?c:"10px sans-serif",textAlign:m(k)?k:"center",textBaseline:m(b)?b:"middle"};this.c=
m(d)?d:"";this.Ea=m(e)?this.r*e:0;this.Fa=m(f)?this.r*f:0;this.D=m(g)?g:0;this.i=this.r*(m(h)?h:1)}};var $l={Point:Sl.prototype.ub,LineString:Sl.prototype.Eb,Polygon:Sl.prototype.Rb,MultiPoint:Sl.prototype.tb,MultiLineString:Sl.prototype.mc,MultiPolygon:Sl.prototype.nc,GeometryCollection:Sl.prototype.fd,Circle:Sl.prototype.lc};var fm=["Polygon","LineString","Image","Text"];function gm(b,c,d){this.fa=b;this.ca=c;this.c=null;this.f=0;this.resolution=d;this.S=this.N=null;this.d=[];this.coordinates=[];this.oa=Id();this.a=[];this.da=[];this.pa=Id()}
function hm(b,c,d,e,f,g){var h=b.coordinates.length,k=b.re(),n=[c[d],c[d+1]],p=[NaN,NaN],q=!0,r,s,u;for(r=d+f;r<e;r+=f)p[0]=c[r],p[1]=c[r+1],u=be(k,p),u!==s?(q&&(b.coordinates[h++]=n[0],b.coordinates[h++]=n[1]),b.coordinates[h++]=p[0],b.coordinates[h++]=p[1],q=!1):1===u?(b.coordinates[h++]=p[0],b.coordinates[h++]=p[1],q=!1):q=!0,n[0]=p[0],n[1]=p[1],s=u;r===d+f&&(b.coordinates[h++]=n[0],b.coordinates[h++]=n[1]);g&&(b.coordinates[h++]=c[d],b.coordinates[h++]=c[d+1]);return h}
function im(b,c){b.N=[0,c,0];b.d.push(b.N);b.S=[0,c,0];b.a.push(b.S)}
function jm(b,c,d,e,f,g,h,k,n){var p;hj(e,b.oa)?p=b.da:(p=lk(b.coordinates,0,b.coordinates.length,2,e,b.da),Ld(b.oa,e));e=0;var q=h.length,r=0,s;for(b=b.pa;e<q;){var u=h[e],z,y,A,D;switch(u[0]){case 0:r=u[1];s=ma(r).toString();m(g[s])?e=u[2]:m(n)&&!qe(n,r.R().J())?e=u[2]:++e;break;case 1:c.beginPath();++e;break;case 2:r=u[1];s=p[r];var x=p[r+1],M=p[r+2]-s,r=p[r+3]-x;c.arc(s,x,Math.sqrt(M*M+r*r),0,2*Math.PI,!0);++e;break;case 3:c.closePath();++e;break;case 4:r=u[1];s=u[2];z=u[3];A=u[4]*d;var Q=u[5]*
d,O=u[6];y=u[7];var W=u[8],Ja=u[9],x=u[11],M=u[12],lb=u[13],Ka=u[14];for(u[10]&&(x+=f);r<s;r+=2){u=p[r]-A;D=p[r+1]-Q;lb&&(u=u+.5|0,D=D+.5|0);if(1!=M||0!==x){var mb=u+A,Pb=D+Q;gj(b,mb,Pb,M,M,x,-mb,-Pb);c.setTransform(b[0],b[1],b[4],b[5],b[12],b[13])}mb=c.globalAlpha;1!=y&&(c.globalAlpha=mb*y);c.drawImage(z,W,Ja,Ka,O,u,D,Ka*d,O*d);1!=y&&(c.globalAlpha=mb);1==M&&0===x||c.setTransform(1,0,0,1,0,0)}++e;break;case 5:r=u[1];s=u[2];A=u[3];Q=u[4]*d;O=u[5]*d;x=u[6];M=u[7]*d;z=u[8];for(y=u[9];r<s;r+=2){u=p[r]+
Q;D=p[r+1]+O;if(1!=M||0!==x)gj(b,u,D,M,M,x,-u,-D),c.setTransform(b[0],b[1],b[4],b[5],b[12],b[13]);y&&c.strokeText(A,u,D);z&&c.fillText(A,u,D);1==M&&0===x||c.setTransform(1,0,0,1,0,0)}++e;break;case 6:if(m(k)&&(r=u[1],r=k(r)))return r;++e;break;case 7:c.fill();++e;break;case 8:r=u[1];s=u[2];c.moveTo(p[r],p[r+1]);for(r+=2;r<s;r+=2)c.lineTo(p[r],p[r+1]);++e;break;case 9:c.fillStyle=u[1];++e;break;case 10:r=m(u[7])?u[7]:!0;s=u[2];c.strokeStyle=u[1];c.lineWidth=r?s*d:s;c.lineCap=u[3];c.lineJoin=u[4];c.miterLimit=
u[5];Xf&&c.setLineDash(u[6]);++e;break;case 11:c.font=u[1];c.textAlign=u[2];c.textBaseline=u[3];++e;break;case 12:c.stroke();++e;break;default:++e}}}gm.prototype.bc=function(b,c,d,e,f){jm(this,b,c,d,e,f,this.d,void 0)};function km(b){var c=b.a;c.reverse();var d,e=c.length,f,g,h=-1;for(d=0;d<e;++d)if(f=c[d],g=f[0],6==g)h=d;else if(0==g){f[2]=d;f=b.a;for(g=d;h<g;){var k=f[h];f[h]=f[g];f[g]=k;++h;--g}h=-1}}
function lm(b,c){b.N[2]=b.d.length;b.N=null;b.S[2]=b.a.length;b.S=null;var d=[6,c];b.d.push(d);b.a.push(d)}gm.prototype.Kb=ca;gm.prototype.re=function(){return this.ca};function mm(b,c,d){gm.call(this,b,c,d);this.n=this.W=null;this.H=this.D=this.r=this.p=this.o=this.q=this.k=this.i=this.g=this.e=this.b=void 0}v(mm,gm);
mm.prototype.ub=function(b,c){if(null!==this.n){im(this,c);var d=b.j,e=this.coordinates.length,d=hm(this,d,0,d.length,b.B,!1);this.d.push([4,e,d,this.n,this.b,this.e,this.g,this.i,this.k,this.q,this.o,this.p,this.r,this.D,this.H]);this.a.push([4,e,d,this.W,this.b,this.e,this.g,this.i,this.k,this.q,this.o,this.p,this.r,this.D,this.H]);lm(this,c)}};
mm.prototype.tb=function(b,c){if(null!==this.n){im(this,c);var d=b.j,e=this.coordinates.length,d=hm(this,d,0,d.length,b.B,!1);this.d.push([4,e,d,this.n,this.b,this.e,this.g,this.i,this.k,this.q,this.o,this.p,this.r,this.D,this.H]);this.a.push([4,e,d,this.W,this.b,this.e,this.g,this.i,this.k,this.q,this.o,this.p,this.r,this.D,this.H]);lm(this,c)}};mm.prototype.Kb=function(){km(this);this.e=this.b=void 0;this.n=this.W=null;this.H=this.D=this.p=this.o=this.q=this.k=this.i=this.r=this.g=void 0};
mm.prototype.ib=function(b){var c=b.wb(),d=b.gb(),e=b.Kd(1),f=b.Bb(1),g=b.Cb();this.b=c[0];this.e=c[1];this.W=e;this.n=f;this.g=d[1];this.i=b.o;this.k=g[0];this.q=g[1];this.o=b.p;this.p=b.i;this.r=b.k;this.D=b.r;this.H=d[0]};function nm(b,c,d){gm.call(this,b,c,d);this.b={Ic:void 0,Dc:void 0,Ec:null,Fc:void 0,Gc:void 0,Hc:void 0,we:0,strokeStyle:void 0,lineCap:void 0,lineDash:null,lineJoin:void 0,lineWidth:void 0,miterLimit:void 0}}v(nm,gm);
function om(b,c,d,e,f){var g=b.coordinates.length;c=hm(b,c,d,e,f,!1);g=[8,g,c];b.d.push(g);b.a.push(g);return e}l=nm.prototype;l.re=function(){null===this.c&&(this.c=Yd(this.ca),0<this.f&&Xd(this.c,this.resolution*(this.f+1)/2,this.c));return this.c};
function pm(b){var c=b.b,d=c.strokeStyle,e=c.lineCap,f=c.lineDash,g=c.lineJoin,h=c.lineWidth,k=c.miterLimit;c.Ic==d&&c.Dc==e&&fb(c.Ec,f)&&c.Fc==g&&c.Gc==h&&c.Hc==k||(c.we!=b.coordinates.length&&(b.d.push([12]),c.we=b.coordinates.length),b.d.push([10,d,h,e,g,k,f],[1]),c.Ic=d,c.Dc=e,c.Ec=f,c.Fc=g,c.Gc=h,c.Hc=k)}
l.Eb=function(b,c){var d=this.b,e=d.lineWidth;m(d.strokeStyle)&&m(e)&&(pm(this),im(this,c),this.a.push([10,d.strokeStyle,d.lineWidth,d.lineCap,d.lineJoin,d.miterLimit,d.lineDash],[1]),d=b.j,om(this,d,0,d.length,b.B),this.a.push([12]),lm(this,c))};
l.mc=function(b,c){var d=this.b,e=d.lineWidth;if(m(d.strokeStyle)&&m(e)){pm(this);im(this,c);this.a.push([10,d.strokeStyle,d.lineWidth,d.lineCap,d.lineJoin,d.miterLimit,d.lineDash],[1]);var d=b.b,e=b.j,f=b.B,g=0,h,k;h=0;for(k=d.length;h<k;++h)g=om(this,e,g,d[h],f);this.a.push([12]);lm(this,c)}};l.Kb=function(){this.b.we!=this.coordinates.length&&this.d.push([12]);km(this);this.b=null};
l.Ba=function(b,c){var d=c.a;this.b.strokeStyle=rg(null===d?ml:d);d=c.c;this.b.lineCap=m(d)?d:"round";d=c.b;this.b.lineDash=null===d?ll:d;d=c.f;this.b.lineJoin=m(d)?d:"round";d=c.d;this.b.lineWidth=m(d)?d:1;d=c.e;this.b.miterLimit=m(d)?d:10;this.b.lineWidth>this.f&&(this.f=this.b.lineWidth,this.c=null)};
function qm(b,c,d){gm.call(this,b,c,d);this.b={gf:void 0,Ic:void 0,Dc:void 0,Ec:null,Fc:void 0,Gc:void 0,Hc:void 0,fillStyle:void 0,strokeStyle:void 0,lineCap:void 0,lineDash:null,lineJoin:void 0,lineWidth:void 0,miterLimit:void 0}}v(qm,gm);
function rm(b,c,d,e,f){var g=b.b,h=[1];b.d.push(h);b.a.push(h);var k,h=0;for(k=e.length;h<k;++h){var n=e[h],p=b.coordinates.length;d=hm(b,c,d,n,f,!0);d=[8,p,d];p=[3];b.d.push(d,p);b.a.push(d,p);d=n}c=[7];b.a.push(c);m(g.fillStyle)&&b.d.push(c);m(g.strokeStyle)&&(g=[12],b.d.push(g),b.a.push(g));return d}l=qm.prototype;
l.lc=function(b,c){var d=this.b,e=d.strokeStyle;if(m(d.fillStyle)||m(e)){sm(this);im(this,c);this.a.push([9,rg(kl)]);m(d.strokeStyle)&&this.a.push([10,d.strokeStyle,d.lineWidth,d.lineCap,d.lineJoin,d.miterLimit,d.lineDash]);var f=b.j,e=this.coordinates.length;hm(this,f,0,f.length,b.B,!1);f=[1];e=[2,e];this.d.push(f,e);this.a.push(f,e);e=[7];this.a.push(e);m(d.fillStyle)&&this.d.push(e);m(d.strokeStyle)&&(d=[12],this.d.push(d),this.a.push(d));lm(this,c)}};
l.Rb=function(b,c){var d=this.b,e=d.strokeStyle;if(m(d.fillStyle)||m(e))sm(this),im(this,c),this.a.push([9,rg(kl)]),m(d.strokeStyle)&&this.a.push([10,d.strokeStyle,d.lineWidth,d.lineCap,d.lineJoin,d.miterLimit,d.lineDash]),d=b.b,e=Vk(b),rm(this,e,0,d,b.B),lm(this,c)};
l.nc=function(b,c){var d=this.b,e=d.strokeStyle;if(m(d.fillStyle)||m(e)){sm(this);im(this,c);this.a.push([9,rg(kl)]);m(d.strokeStyle)&&this.a.push([10,d.strokeStyle,d.lineWidth,d.lineCap,d.lineJoin,d.miterLimit,d.lineDash]);var d=b.b,e=cm(b),f=b.B,g=0,h,k;h=0;for(k=d.length;h<k;++h)g=rm(this,e,g,d[h],f);lm(this,c)}};l.Kb=function(){km(this);this.b=null;var b=this.fa;if(0!==b){var c=this.coordinates,d,e;d=0;for(e=c.length;d<e;++d)c[d]=b*Math.round(c[d]/b)}};
l.re=function(){null===this.c&&(this.c=Yd(this.ca),0<this.f&&Xd(this.c,this.resolution*(this.f+1)/2,this.c));return this.c};
l.Ba=function(b,c){var d=this.b;if(null===b)d.fillStyle=void 0;else{var e=b.a;d.fillStyle=rg(null===e?kl:e)}null===c?(d.strokeStyle=void 0,d.lineCap=void 0,d.lineDash=null,d.lineJoin=void 0,d.lineWidth=void 0,d.miterLimit=void 0):(e=c.a,d.strokeStyle=rg(null===e?ml:e),e=c.c,d.lineCap=m(e)?e:"round",e=c.b,d.lineDash=null===e?ll:e.slice(),e=c.f,d.lineJoin=m(e)?e:"round",e=c.d,d.lineWidth=m(e)?e:1,e=c.e,d.miterLimit=m(e)?e:10,d.lineWidth>this.f&&(this.f=d.lineWidth,this.c=null))};
function sm(b){var c=b.b,d=c.fillStyle,e=c.strokeStyle,f=c.lineCap,g=c.lineDash,h=c.lineJoin,k=c.lineWidth,n=c.miterLimit;m(d)&&c.gf!=d&&(b.d.push([9,d]),c.gf=c.fillStyle);!m(e)||c.Ic==e&&c.Dc==f&&c.Ec==g&&c.Fc==h&&c.Gc==k&&c.Hc==n||(b.d.push([10,e,k,f,h,n,g]),c.Ic=e,c.Dc=f,c.Ec=g,c.Fc=h,c.Gc=k,c.Hc=n)}function tm(b,c,d){gm.call(this,b,c,d);this.D=this.r=this.p=null;this.n="";this.o=this.q=this.k=this.i=0;this.g=this.e=this.b=null}v(tm,gm);
tm.prototype.vb=function(b,c,d,e,f,g){if(""!==this.n&&null!==this.g&&(null!==this.b||null!==this.e)){if(null!==this.b){f=this.b;var h=this.p;if(null===h||h.fillStyle!=f.fillStyle){var k=[9,f.fillStyle];this.d.push(k);this.a.push(k);null===h?this.p={fillStyle:f.fillStyle}:h.fillStyle=f.fillStyle}}null!==this.e&&(f=this.e,h=this.r,null===h||h.lineCap!=f.lineCap||h.lineDash!=f.lineDash||h.lineJoin!=f.lineJoin||h.lineWidth!=f.lineWidth||h.miterLimit!=f.miterLimit||h.strokeStyle!=f.strokeStyle)&&(k=[10,
f.strokeStyle,f.lineWidth,f.lineCap,f.lineJoin,f.miterLimit,f.lineDash,!1],this.d.push(k),this.a.push(k),null===h?this.r={lineCap:f.lineCap,lineDash:f.lineDash,lineJoin:f.lineJoin,lineWidth:f.lineWidth,miterLimit:f.miterLimit,strokeStyle:f.strokeStyle}:(h.lineCap=f.lineCap,h.lineDash=f.lineDash,h.lineJoin=f.lineJoin,h.lineWidth=f.lineWidth,h.miterLimit=f.miterLimit,h.strokeStyle=f.strokeStyle));f=this.g;h=this.D;if(null===h||h.font!=f.font||h.textAlign!=f.textAlign||h.textBaseline!=f.textBaseline)k=
[11,f.font,f.textAlign,f.textBaseline],this.d.push(k),this.a.push(k),null===h?this.D={font:f.font,textAlign:f.textAlign,textBaseline:f.textBaseline}:(h.font=f.font,h.textAlign=f.textAlign,h.textBaseline=f.textBaseline);im(this,g);f=this.coordinates.length;b=hm(this,b,c,d,e,!1);b=[5,f,b,this.n,this.i,this.k,this.q,this.o,null!==this.b,null!==this.e];this.d.push(b);this.a.push(b);lm(this,g)}};
tm.prototype.Ca=function(b){if(null===b)this.n="";else{var c=b.a;null===c?this.b=null:(c=c.a,c=rg(null===c?kl:c),null===this.b?this.b={fillStyle:c}:this.b.fillStyle=c);var d=b.e;if(null===d)this.e=null;else{var c=d.a,e=d.c,f=d.b,g=d.f,h=d.d,d=d.e,e=m(e)?e:"round",f=null!=f?f.slice():ll,g=m(g)?g:"round",h=m(h)?h:1,d=m(d)?d:10,c=rg(null===c?ml:c);if(null===this.e)this.e={lineCap:e,lineDash:f,lineJoin:g,lineWidth:h,miterLimit:d,strokeStyle:c};else{var k=this.e;k.lineCap=e;k.lineDash=f;k.lineJoin=g;k.lineWidth=
h;k.miterLimit=d;k.strokeStyle=c}}var n=b.c,c=b.i,e=b.k,f=b.f,h=b.d,d=b.b,g=b.g,k=b.n;b=m(n)?n:"10px sans-serif";g=m(g)?g:"center";k=m(k)?k:"middle";null===this.g?this.g={font:b,textAlign:g,textBaseline:k}:(n=this.g,n.font=b,n.textAlign=g,n.textBaseline=k);this.n=m(d)?d:"";this.i=m(c)?c:0;this.k=m(e)?e:0;this.q=m(f)?f:0;this.o=m(h)?h:1}};function um(b,c,d,e){this.i=b;this.c=c;this.n=d;this.f=e;this.d={};this.e=Mf(1,1);this.g=Id()}
function vm(b){for(var c in b.d){var d=b.d[c],e;for(e in d)d[e].Kb()}}um.prototype.b=function(b,c,d,e,f){var g=this.g;gj(g,.5,.5,1/c,-1/c,-d,-b[0],-b[1]);var h=this.e;h.clearRect(0,0,1,1);var k;m(this.f)&&(k=Td(),Ud(k,b),Xd(k,c*this.f,k));return wm(this,h,g,d,e,function(b){if(0<h.getImageData(0,0,1,1).data[3]){if(b=f(b))return b;h.clearRect(0,0,1,1)}},k)};
um.prototype.a=function(b,c){var d=m(b)?b.toString():"0",e=this.d[d];m(e)||(e={},this.d[d]=e);d=e[c];m(d)||(d=new xm[c](this.i,this.c,this.n),e[c]=d);return d};um.prototype.la=function(){return wb(this.d)};
function ym(b,c,d,e,f,g){var h=Sa(sb(b.d),Number);db(h);var k=b.c,n=k[0],p=k[1],q=k[2],k=k[3],n=[n,p,n,k,q,k,q,p];lk(n,0,8,2,e,n);c.save();c.beginPath();c.moveTo(n[0],n[1]);c.lineTo(n[2],n[3]);c.lineTo(n[4],n[5]);c.lineTo(n[6],n[7]);c.closePath();c.clip();for(var r,s,n=0,p=h.length;n<p;++n)for(r=b.d[h[n].toString()],q=0,k=fm.length;q<k;++q)s=r[fm[q]],m(s)&&s.bc(c,d,e,f,g);c.restore()}
function wm(b,c,d,e,f,g,h){var k=Sa(sb(b.d),Number);db(k,function(b,c){return c-b});var n,p,q,r,s;n=0;for(p=k.length;n<p;++n)for(r=b.d[k[n].toString()],q=fm.length-1;0<=q;--q)if(s=r[fm[q]],m(s)&&(s=jm(s,c,1,d,e,f,s.a,g,h)))return s}var xm={Image:mm,LineString:nm,Polygon:qm,Text:tm};function zm(b){jj.call(this,b);this.r=Id()}v(zm,jj);
zm.prototype.q=function(b,c,d){Am(this,"precompose",d,b,void 0);var e=this.Id();if(null!==e){var f=c.extent,g=m(f);if(g){var h=b.pixelRatio,k=ke(f),n=je(f),p=ie(f),f=he(f);ij(b.coordinateToPixelMatrix,k,k);ij(b.coordinateToPixelMatrix,n,n);ij(b.coordinateToPixelMatrix,p,p);ij(b.coordinateToPixelMatrix,f,f);d.save();d.beginPath();d.moveTo(k[0]*h,k[1]*h);d.lineTo(n[0]*h,n[1]*h);d.lineTo(p[0]*h,p[1]*h);d.lineTo(f[0]*h,f[1]*h);d.clip()}h=this.of();k=d.globalAlpha;d.globalAlpha=c.opacity;0===b.viewState.rotation?
(c=h[13],n=e.width*h[0],p=e.height*h[5],d.drawImage(e,0,0,+e.width,+e.height,Math.round(h[12]),Math.round(c),Math.round(n),Math.round(p))):(d.setTransform(h[0],h[1],h[4],h[5],h[12],h[13]),d.drawImage(e,0,0),d.setTransform(1,0,0,1,0,0));d.globalAlpha=k;g&&d.restore()}Am(this,"postcompose",d,b,void 0)};function Am(b,c,d,e,f){var g=b.a;kd(g,c)&&(b=m(f)?f:Bm(b,e),b=new Sl(d,e.pixelRatio,e.extent,b,e.viewState.rotation),g.dispatchEvent(new Yk(c,g,b,null,e,d,null)),em(b))}
function Bm(b,c){var d=c.viewState,e=c.pixelRatio;return gj(b.r,e*c.size[0]/2,e*c.size[1]/2,e/d.resolution,-e/d.resolution,-d.rotation,-d.center[0],-d.center[1])}function Cm(b,c){var d=[0,0];ij(c,b,d);return d}
var Dm=function(){var b=null,c=null;return function(d){if(null===b){b=Mf(1,1);c=b.createImageData(1,1);var e=c.data;e[0]=42;e[1]=84;e[2]=126;e[3]=255}var e=b.canvas,f=d[0]<=e.width&&d[1]<=e.height;f||(e.width=d[0],e.height=d[1],e=d[0]-1,d=d[1]-1,b.putImageData(c,e,d),d=b.getImageData(e,d,1,1),f=fb(c.data,d.data));return f}}();function Em(b,c,d){mk.call(this);this.rg(b,m(c)?c:0,d)}v(Em,mk);l=Em.prototype;l.clone=function(){var b=new Em(null);ok(b,this.a,this.j.slice());b.l();return b};l.Ya=function(b,c,d,e){var f=this.j;b-=f[0];var g=c-f[1];c=b*b+g*g;if(c<e){if(0===c)for(e=0;e<this.B;++e)d[e]=f[e];else for(e=this.Hf()/Math.sqrt(c),d[0]=f[0]+e*b,d[1]=f[1]+e*g,e=2;e<this.B;++e)d[e]=f[e];d.length=this.B;return c}return e};l.Jb=function(b,c){var d=this.j,e=b-d[0],d=c-d[1];return e*e+d*d<=Fm(this)};
l.Oc=function(){return this.j.slice(0,this.B)};l.dd=function(b){var c=this.j,d=c[this.B]-c[0];return Wd(c[0]-d,c[1]-d,c[0]+d,c[1]+d,b)};l.Hf=function(){return Math.sqrt(Fm(this))};function Fm(b){var c=b.j[b.B]-b.j[0];b=b.j[b.B+1]-b.j[1];return c*c+b*b}l.O=function(){return"Circle"};l.Mj=function(b){var c=this.B,d=b.slice();d[c]=d[0]+(this.j[c]-this.j[0]);var e;for(e=1;e<c;++e)d[c+e]=b[e];ok(this,this.a,d);this.l()};
l.rg=function(b,c,d){if(null===b)ok(this,"XY",null);else{pk(this,d,b,0);null===this.j&&(this.j=[]);d=this.j;b=zk(d,b);d[b++]=d[0]+c;var e;c=1;for(e=this.B;c<e;++c)d[b++]=d[c];d.length=b}this.l()};l.If=function(b){this.j[this.B]=this.j[0]+b;this.l()};function Gm(b){kk.call(this);this.c=m(b)?b:null;Hm(this)}v(Gm,kk);function Im(b){var c=[],d,e;d=0;for(e=b.length;d<e;++d)c.push(b[d].clone());return c}function Jm(b){var c,d;if(null!==b.c)for(c=0,d=b.c.length;c<d;++c)Wc(b.c[c],"change",b.l,!1,b)}function Hm(b){var c,d;if(null!==b.c)for(c=0,d=b.c.length;c<d;++c)w(b.c[c],"change",b.l,!1,b)}l=Gm.prototype;l.clone=function(){var b=new Gm(null);b.sg(this.c);return b};
l.Ya=function(b,c,d,e){if(e<Zd(this.J(),b,c))return e;var f=this.c,g,h;g=0;for(h=f.length;g<h;++g)e=f[g].Ya(b,c,d,e);return e};l.Jb=function(b,c){var d=this.c,e,f;e=0;for(f=d.length;e<f;++e)if(d[e].Jb(b,c))return!0;return!1};l.dd=function(b){Wd(Infinity,Infinity,-Infinity,-Infinity,b);for(var c=this.c,d=0,e=c.length;d<e;++d)ee(b,c[d].J());return b};l.nf=function(){return Im(this.c)};
l.ue=function(b){this.i!=this.d&&(xb(this.e),this.g=0,this.i=this.d);if(0>b||0!==this.g&&b<this.g)return this;var c=b.toString();if(this.e.hasOwnProperty(c))return this.e[c];var d=[],e=this.c,f=!1,g,h;g=0;for(h=e.length;g<h;++g){var k=e[g],n=k.ue(b);d.push(n);n!==k&&(f=!0)}if(f)return b=new Gm(null),Jm(b),b.c=d,Hm(b),b.l(),this.e[c]=b;this.g=b;return this};l.O=function(){return"GeometryCollection"};l.ja=function(b){var c=this.c,d,e;d=0;for(e=c.length;d<e;++d)if(c[d].ja(b))return!0;return!1};
l.la=function(){return 0==this.c.length};l.sg=function(b){b=Im(b);Jm(this);this.c=b;Hm(this);this.l()};l.qa=function(b){var c=this.c,d,e;d=0;for(e=c.length;d<e;++d)c[d].qa(b);this.l()};l.Ia=function(b,c){var d=this.c,e,f;e=0;for(f=d.length;e<f;++e)d[e].Ia(b,c);this.l()};l.P=function(){Jm(this);Gm.T.P.call(this)};function Km(b,c,d,e,f){var g=NaN,h=NaN,k=(d-c)/e;if(0!==k)if(1==k)g=b[c],h=b[c+1];else if(2==k)g=.5*b[c]+.5*b[c+e],h=.5*b[c+1]+.5*b[c+e+1];else{var h=b[c],k=b[c+1],n=0,g=[0],p;for(p=c+e;p<d;p+=e){var q=b[p],r=b[p+1],n=n+Math.sqrt((q-h)*(q-h)+(r-k)*(r-k));g.push(n);h=q;k=r}d=.5*n;for(var s,h=eb,k=0,n=g.length;k<n;)p=k+n>>1,q=h(d,g[p]),0<q?k=p+1:(n=p,s=!q);s=s?k:~k;0>s?(d=(d-g[-s-2])/(g[-s-1]-g[-s-2]),c+=(-s-2)*e,g=Yb(b[c],b[c+e],d),h=Yb(b[c+1],b[c+e+1],d)):(g=b[c+s*e],h=b[c+s*e+1])}return null!=f?
(f[0]=g,f[1]=h,f):[g,h]}function Lm(b,c,d,e,f,g){if(d==c)return null;if(f<b[c+e-1])return g?(d=b.slice(c,c+e),d[e-1]=f,d):null;if(b[d-1]<f)return g?(d=b.slice(d-e,d),d[e-1]=f,d):null;if(f==b[c+e-1])return b.slice(c,c+e);c/=e;for(d/=e;c<d;)g=c+d>>1,f<b[(g+1)*e-1]?d=g:c=g+1;d=b[c*e-1];if(f==d)return b.slice((c-1)*e,(c-1)*e+e);g=(f-d)/(b[(c+1)*e-1]-d);d=[];var h;for(h=0;h<e-1;++h)d.push(Yb(b[(c-1)*e+h],b[c*e+h],g));d.push(f);return d}
function Mm(b,c,d,e,f,g){var h=0;if(g)return Lm(b,h,c[c.length-1],d,e,f);if(e<b[d-1])return f?(b=b.slice(0,d),b[d-1]=e,b):null;if(b[b.length-1]<e)return f?(b=b.slice(b.length-d),b[d-1]=e,b):null;f=0;for(g=c.length;f<g;++f){var k=c[f];if(h!=k){if(e<b[h+d-1])break;if(e<=b[k-1])return Lm(b,h,k,d,e,!1);h=k}}return null};function K(b,c){mk.call(this);this.b=null;this.o=this.p=this.n=-1;this.V(b,c)}v(K,mk);l=K.prototype;l.ih=function(b){null===this.j?this.j=b.slice():ab(this.j,b);this.l()};l.clone=function(){var b=new K(null);Nm(b,this.a,this.j.slice());return b};l.Ya=function(b,c,d,e){if(e<Zd(this.J(),b,c))return e;this.o!=this.d&&(this.p=Math.sqrt(vk(this.j,0,this.j.length,this.B,0)),this.o=this.d);return xk(this.j,0,this.j.length,this.B,this.p,!1,b,c,d,e)};
l.yh=function(b,c){return Ok(this.j,0,this.j.length,this.B,b,c)};l.Nj=function(b,c){return"XYM"!=this.a&&"XYZM"!=this.a?null:Lm(this.j,0,this.j.length,this.B,b,m(c)?c:!1)};l.Q=function(){return Ck(this.j,0,this.j.length,this.B)};l.Jf=function(){var b=this.j,c=this.B,d=b[0],e=b[1],f=0,g;for(g=0+c;g<this.j.length;g+=c)var h=b[g],k=b[g+1],f=f+Math.sqrt((h-d)*(h-d)+(k-e)*(k-e)),d=h,e=k;return f};function am(b){b.n!=b.d&&(b.b=Km(b.j,0,b.j.length,b.B,b.b),b.n=b.d);return b.b}
l.oc=function(b){var c=[];c.length=Ek(this.j,0,this.j.length,this.B,b,c,0);b=new K(null);Nm(b,"XY",c);return b};l.O=function(){return"LineString"};l.ja=function(b){return Pk(this.j,0,this.j.length,this.B,b)};l.V=function(b,c){null===b?Nm(this,"XY",null):(pk(this,c,b,1),null===this.j&&(this.j=[]),this.j.length=Ak(this.j,0,b,this.B),this.l())};function Nm(b,c,d){ok(b,c,d);b.l()};function Om(b,c){mk.call(this);this.b=[];this.n=this.o=-1;this.V(b,c)}v(Om,mk);l=Om.prototype;l.jh=function(b){null===this.j?this.j=b.j.slice():ab(this.j,b.j.slice());this.b.push(this.j.length);this.l()};l.clone=function(){var b=new Om(null);Pm(b,this.a,this.j.slice(),this.b.slice());return b};l.Ya=function(b,c,d,e){if(e<Zd(this.J(),b,c))return e;this.n!=this.d&&(this.o=Math.sqrt(wk(this.j,0,this.b,this.B,0)),this.n=this.d);return yk(this.j,0,this.b,this.B,this.o,!1,b,c,d,e)};
l.Pj=function(b,c,d){return"XYM"!=this.a&&"XYZM"!=this.a||0===this.j.length?null:Mm(this.j,this.b,this.B,b,m(c)?c:!1,m(d)?d:!1)};l.Q=function(){return Dk(this.j,0,this.b,this.B)};l.Qh=function(b){if(0>b||this.b.length<=b)return null;var c=new K(null);Nm(c,this.a,this.j.slice(0===b?0:this.b[b-1],this.b[b]));return c};l.Lc=function(){var b=this.j,c=this.b,d=this.a,e=[],f=0,g,h;g=0;for(h=c.length;g<h;++g){var k=c[g],n=new K(null);Nm(n,d,b.slice(f,k));e.push(n);f=k}return e};
function bm(b){var c=[],d=b.j,e=0,f=b.b;b=b.B;var g,h;g=0;for(h=f.length;g<h;++g){var k=f[g],e=Km(d,e,k,b);ab(c,e);e=k}return c}l.oc=function(b){var c=[],d=[],e=this.j,f=this.b,g=this.B,h=0,k=0,n,p;n=0;for(p=f.length;n<p;++n){var q=f[n],k=Ek(e,h,q,g,b,c,k);d.push(k);h=q}c.length=k;b=new Om(null);Pm(b,"XY",c,d);return b};l.O=function(){return"MultiLineString"};l.ja=function(b){a:{var c=this.j,d=this.b,e=this.B,f=0,g,h;g=0;for(h=d.length;g<h;++g){if(Pk(c,f,d[g],e,b)){b=!0;break a}f=d[g]}b=!1}return b};
l.V=function(b,c){if(null===b)Pm(this,"XY",null,this.b);else{pk(this,c,b,2);null===this.j&&(this.j=[]);var d=Bk(this.j,0,b,this.B,this.b);this.j.length=0===d.length?0:d[d.length-1];this.l()}};function Pm(b,c,d,e){ok(b,c,d);b.b=e;b.l()}function Qm(b,c){var d="XY",e=[],f=[],g,h;g=0;for(h=c.length;g<h;++g){var k=c[g];0===g&&(d=k.a);ab(e,k.j);f.push(e.length)}Pm(b,d,e,f)};function Rm(b,c){mk.call(this);this.V(b,c)}v(Rm,mk);l=Rm.prototype;l.lh=function(b){null===this.j?this.j=b.j.slice():ab(this.j,b.j);this.l()};l.clone=function(){var b=new Rm(null);ok(b,this.a,this.j.slice());b.l();return b};l.Ya=function(b,c,d,e){if(e<Zd(this.J(),b,c))return e;var f=this.j,g=this.B,h,k,n;h=0;for(k=f.length;h<k;h+=g)if(n=tk(b,c,f[h],f[h+1]),n<e){e=n;for(n=0;n<g;++n)d[n]=f[h+n];d.length=g}return e};l.Q=function(){return Ck(this.j,0,this.j.length,this.B)};
l.$h=function(b){var c=null===this.j?0:this.j.length/this.B;if(0>b||c<=b)return null;c=new Ik(null);Jk(c,this.a,this.j.slice(b*this.B,(b+1)*this.B));return c};l.Gd=function(){var b=this.j,c=this.a,d=this.B,e=[],f,g;f=0;for(g=b.length;f<g;f+=d){var h=new Ik(null);Jk(h,c,b.slice(f,f+d));e.push(h)}return e};l.O=function(){return"MultiPoint"};l.ja=function(b){var c=this.j,d=this.B,e,f,g,h;e=0;for(f=c.length;e<f;e+=d)if(g=c[e],h=c[e+1],ae(b,g,h))return!0;return!1};
l.V=function(b,c){null===b?ok(this,"XY",null):(pk(this,c,b,1),null===this.j&&(this.j=[]),this.j.length=Ak(this.j,0,b,this.B));this.l()};function Sm(b,c){mk.call(this);this.b=[];this.o=-1;this.p=null;this.H=this.r=this.D=-1;this.n=null;this.V(b,c)}v(Sm,mk);l=Sm.prototype;l.mh=function(b){if(null===this.j)this.j=b.j.slice(),b=b.b.slice(),this.b.push();else{var c=this.j.length;ab(this.j,b.j);b=b.b.slice();var d,e;d=0;for(e=b.length;d<e;++d)b[d]+=c}this.b.push(b);this.l()};l.clone=function(){var b=new Sm(null);Tm(b,this.a,this.j.slice(),this.b.slice());return b};
l.Ya=function(b,c,d,e){if(e<Zd(this.J(),b,c))return e;if(this.r!=this.d){var f=this.b,g=0,h=0,k,n;k=0;for(n=f.length;k<n;++k)var p=f[k],h=wk(this.j,g,p,this.B,h),g=p[p.length-1];this.D=Math.sqrt(h);this.r=this.d}f=cm(this);g=this.b;h=this.B;k=this.D;n=0;var p=m(void 0)?void 0:[NaN,NaN],q,r;q=0;for(r=g.length;q<r;++q){var s=g[q];e=yk(f,n,s,h,k,!0,b,c,d,e,p);n=s[s.length-1]}return e};
l.Jb=function(b,c){var d;a:{d=cm(this);var e=this.b,f=0;if(0!==e.length){var g,h;g=0;for(h=e.length;g<h;++g){var k=e[g];if(Mk(d,f,k,this.B,b,c)){d=!0;break a}f=k[k.length-1]}}d=!1}return d};l.Qj=function(){var b=cm(this),c=this.b,d=0,e=0,f,g;f=0;for(g=c.length;f<g;++f)var h=c[f],e=e+rk(b,d,h,this.B),d=h[h.length-1];return e};l.Q=function(){var b=this.j,c=this.b,d=this.B,e=0,f=m(void 0)?void 0:[],g=0,h,k;h=0;for(k=c.length;h<k;++h){var n=c[h];f[g++]=Dk(b,e,n,d,f[g]);e=n[n.length-1]}f.length=g;return f};
function dm(b){if(b.o!=b.d){var c=b.j,d=b.b,e=b.B,f=0,g=[],h,k,n=Td();h=0;for(k=d.length;h<k;++h){var p=d[h],n=fe(Wd(Infinity,Infinity,-Infinity,-Infinity,void 0),c,f,p[0],e);g.push((n[0]+n[2])/2,(n[1]+n[3])/2);f=p[p.length-1]}c=cm(b);d=b.b;e=b.B;f=0;h=[];k=0;for(n=d.length;k<n;++k)p=d[k],h=Nk(c,f,p,e,g,2*k,h),f=p[p.length-1];b.p=h;b.o=b.d}return b.p}l.Nh=function(){var b=new Rm(null),c=dm(this).slice();ok(b,"XY",c);b.l();return b};
function cm(b){if(b.H!=b.d){var c=b.j,d;a:{d=b.b;var e,f;e=0;for(f=d.length;e<f;++e)if(!Sk(c,d[e],b.B)){d=!1;break a}d=!0}if(d)b.n=c;else{b.n=c.slice();d=c=b.n;e=b.b;f=b.B;var g=0,h,k;h=0;for(k=e.length;h<k;++h)g=Tk(d,g,e[h],f);c.length=g}b.H=b.d}return b.n}l.oc=function(b){var c=[],d=[],e=this.j,f=this.b,g=this.B;b=Math.sqrt(b);var h=0,k=0,n,p;n=0;for(p=f.length;n<p;++n){var q=f[n],r=[],k=Fk(e,h,q,g,b,c,k,r);d.push(r);h=q[q.length-1]}c.length=k;e=new Sm(null);Tm(e,"XY",c,d);return e};
l.ai=function(b){if(0>b||this.b.length<=b)return null;var c;0===b?c=0:(c=this.b[b-1],c=c[c.length-1]);b=this.b[b].slice();var d=b[b.length-1];if(0!==c){var e,f;e=0;for(f=b.length;e<f;++e)b[e]-=c}e=new F(null);Uk(e,this.a,this.j.slice(c,d),b);return e};l.qd=function(){var b=this.a,c=this.j,d=this.b,e=[],f=0,g,h,k,n;g=0;for(h=d.length;g<h;++g){var p=d[g].slice(),q=p[p.length-1];if(0!==f)for(k=0,n=p.length;k<n;++k)p[k]-=f;k=new F(null);Uk(k,b,c.slice(f,q),p);e.push(k);f=q}return e};l.O=function(){return"MultiPolygon"};
l.ja=function(b){a:{var c=cm(this),d=this.b,e=this.B,f=0,g,h;g=0;for(h=d.length;g<h;++g){var k=d[g];if(Qk(c,f,k,e,b)){b=!0;break a}f=k[k.length-1]}b=!1}return b};l.V=function(b,c){if(null===b)Tm(this,"XY",null,this.b);else{pk(this,c,b,3);null===this.j&&(this.j=[]);var d=this.j,e=this.B,f=this.b,g=0,f=m(f)?f:[],h=0,k,n;k=0;for(n=b.length;k<n;++k)g=Bk(d,g,b[k],e,f[h]),f[h++]=g,g=g[g.length-1];f.length=h;0===f.length?this.j.length=0:(d=f[f.length-1],this.j.length=0===d.length?0:d[d.length-1]);this.l()}};
function Tm(b,c,d,e){ok(b,c,d);b.b=e;b.l()}function Um(b,c){var d="XY",e=[],f=[],g,h,k;g=0;for(h=c.length;g<h;++g){var n=c[g];0===g&&(d=n.a);var p=e.length;k=n.b;var q,r;q=0;for(r=k.length;q<r;++q)k[q]+=p;ab(e,n.j);f.push(k)}Tm(b,d,e,f)};function Vm(b,c){return ma(b)-ma(c)}function Wm(b,c){var d=.5*b/c;return d*d}function Xm(b,c,d,e,f,g){var h=!1,k,n;k=d.e;null!==k&&(n=k.Pc(),2==n||3==n?k.Oe(f,g):(0==n&&k.load(),k.xe(f,g),h=!0));f=(0,d.c)(c);null!=f&&(e=f.ue(e),(0,Ym[e.O()])(b,e,d,c));return h}
var Ym={Point:function(b,c,d,e){var f=d.e;if(null!==f){if(2!=f.Pc())return;var g=b.a(d.a,"Image");g.ib(f);g.ub(c,e)}f=d.d;null!==f&&(b=b.a(d.a,"Text"),b.Ca(f),b.vb(c.Q(),0,2,2,c,e))},LineString:function(b,c,d,e){var f=d.b;if(null!==f){var g=b.a(d.a,"LineString");g.Ba(null,f);g.Eb(c,e)}f=d.d;null!==f&&(b=b.a(d.a,"Text"),b.Ca(f),b.vb(am(c),0,2,2,c,e))},Polygon:function(b,c,d,e){var f=d.f,g=d.b;if(null!==f||null!==g){var h=b.a(d.a,"Polygon");h.Ba(f,g);h.Rb(c,e)}f=d.d;null!==f&&(b=b.a(d.a,"Text"),b.Ca(f),
b.vb(Wk(c),0,2,2,c,e))},MultiPoint:function(b,c,d,e){var f=d.e;if(null!==f){if(2!=f.Pc())return;var g=b.a(d.a,"Image");g.ib(f);g.tb(c,e)}f=d.d;null!==f&&(b=b.a(d.a,"Text"),b.Ca(f),d=c.j,b.vb(d,0,d.length,c.B,c,e))},MultiLineString:function(b,c,d,e){var f=d.b;if(null!==f){var g=b.a(d.a,"LineString");g.Ba(null,f);g.mc(c,e)}f=d.d;null!==f&&(b=b.a(d.a,"Text"),b.Ca(f),d=bm(c),b.vb(d,0,d.length,2,c,e))},MultiPolygon:function(b,c,d,e){var f=d.f,g=d.b;if(null!==g||null!==f){var h=b.a(d.a,"Polygon");h.Ba(f,
g);h.nc(c,e)}f=d.d;null!==f&&(b=b.a(d.a,"Text"),b.Ca(f),d=dm(c),b.vb(d,0,d.length,2,c,e))},GeometryCollection:function(b,c,d,e){c=c.c;var f,g;f=0;for(g=c.length;f<g;++f)(0,Ym[c[f].O()])(b,c[f],d,e)},Circle:function(b,c,d,e){var f=d.f,g=d.b;if(null!==f||null!==g){var h=b.a(d.a,"Polygon");h.Ba(f,g);h.lc(c,e)}f=d.d;null!==f&&(b=b.a(d.a,"Text"),b.Ca(f),b.vb(c.Oc(),0,2,2,c,e))}};function Zm(b,c,d,e,f){Ni.call(this,b,c,d,2,e);this.d=f}v(Zm,Ni);Zm.prototype.a=function(){return this.d};function $m(b){Ji.call(this,{attributions:b.attributions,extent:b.extent,logo:b.logo,projection:b.projection,state:b.state});this.i=m(b.resolutions)?b.resolutions:null}v($m,Ji);function an(b,c){if(null!==b.i){var d=bc(b.i,c,0);c=b.i[d]}return c}function bn(b,c){b.a().src=c};function cn(b){$m.call(this,{attributions:b.attributions,logo:b.logo,projection:b.projection,resolutions:b.resolutions,state:m(b.state)?b.state:void 0});this.H=b.canvasFunction;this.p=null;this.r=0;this.N=m(b.ratio)?b.ratio:1.5}v(cn,$m);cn.prototype.sc=function(b,c,d,e){c=an(this,c);var f=this.p;if(null!==f&&this.r==this.d&&f.resolution==c&&f.f==d&&$d(f.J(),b))return f;b=b.slice();te(b,this.N);e=this.H(b,c,d,[re(b)/c*d,oe(b)/c*d],e);null===e||(f=new Zm(b,c,d,this.f,e));this.p=f;this.r=this.d;return f};var dn;
(function(){var b={lf:{}};(function(){function c(b,d){if(!(this instanceof c))return new c(b,d);this.ie=Math.max(4,b||9);this.Ze=Math.max(2,Math.ceil(.4*this.ie));d&&this.eh(d);this.clear()}function d(b,c){b.bbox=e(b,0,b.children.length,c)}function e(b,c,d,e){for(var g=[Infinity,Infinity,-Infinity,-Infinity],h;c<d;c++)h=b.children[c],f(g,b.za?e(h):h.bbox);return g}function f(b,c){b[0]=Math.min(b[0],c[0]);b[1]=Math.min(b[1],c[1]);b[2]=Math.max(b[2],c[2]);b[3]=Math.max(b[3],c[3])}function g(b,c){return b.bbox[0]-
c.bbox[0]}function h(b,c){return b.bbox[1]-c.bbox[1]}function k(b){return(b[2]-b[0])*(b[3]-b[1])}function n(b){return b[2]-b[0]+(b[3]-b[1])}function p(b,c){return b[0]<=c[0]&&b[1]<=c[1]&&c[2]<=b[2]&&c[3]<=b[3]}function q(b,c){return c[0]<=b[2]&&c[1]<=b[3]&&c[2]>=b[0]&&c[3]>=b[1]}function r(b,c,d,e,f){for(var g=[c,d],h;g.length;)d=g.pop(),c=g.pop(),d-c<=e||(h=c+Math.ceil((d-c)/e/2)*e,s(b,c,d,h,f),g.push(c,h,h,d))}function s(b,c,d,e,f){for(var g,h,k,n,p;d>c;){600<d-c&&(g=d-c+1,h=e-c+1,k=Math.log(g),
n=.5*Math.exp(2*k/3),p=.5*Math.sqrt(k*n*(g-n)/g)*(0>h-g/2?-1:1),k=Math.max(c,Math.floor(e-h*n/g+p)),h=Math.min(d,Math.floor(e+(g-h)*n/g+p)),s(b,k,h,e,f));g=b[e];h=c;n=d;u(b,c,e);for(0<f(b[d],g)&&u(b,c,d);h<n;){u(b,h,n);h++;for(n--;0>f(b[h],g);)h++;for(;0<f(b[n],g);)n--}0===f(b[c],g)?u(b,c,n):(n++,u(b,n,d));n<=e&&(c=n+1);e<=n&&(d=n-1)}}function u(b,c,d){var e=b[c];b[c]=b[d];b[d]=e}c.prototype={all:function(){return this.Ve(this.data,[])},search:function(b){var c=this.data,d=[],e=this.Ka;if(!q(b,c.bbox))return d;
for(var f=[],g,h,k,n;c;){g=0;for(h=c.children.length;g<h;g++)k=c.children[g],n=c.za?e(k):k.bbox,q(b,n)&&(c.za?d.push(k):p(b,n)?this.Ve(k,d):f.push(k));c=f.pop()}return d},load:function(b){if(!b||!b.length)return this;if(b.length<this.Ze){for(var c=0,d=b.length;c<d;c++)this.sa(b[c]);return this}b=this.Xe(b.slice(),0,b.length-1,0);this.data.children.length?this.data.height===b.height?this.$e(this.data,b):(this.data.height<b.height&&(c=this.data,this.data=b,b=c),this.Ye(b,this.data.height-b.height-1,
!0)):this.data=b;return this},sa:function(b){b&&this.Ye(b,this.data.height-1);return this},clear:function(){this.data={children:[],height:1,bbox:[Infinity,Infinity,-Infinity,-Infinity],za:!0};return this},remove:function(b){if(!b)return this;for(var c=this.data,d=this.Ka(b),e=[],f=[],g,h,k,n;c||e.length;){c||(c=e.pop(),h=e[e.length-1],g=f.pop(),n=!0);if(c.za&&(k=c.children.indexOf(b),-1!==k)){c.children.splice(k,1);e.push(c);this.dh(e);break}n||c.za||!p(c.bbox,d)?h?(g++,c=h.children[g],n=!1):c=null:
(e.push(c),f.push(g),g=0,h=c,c=c.children[0])}return this},Ka:function(b){return b},le:function(b,c){return b[0]-c[0]},me:function(b,c){return b[1]-c[1]},toJSON:function(){return this.data},Ve:function(b,c){for(var d=[];b;)b.za?c.push.apply(c,b.children):d.push.apply(d,b.children),b=d.pop();return c},Xe:function(b,c,e,f){var g=e-c+1,h=this.ie,k;if(g<=h)return k={children:b.slice(c,e+1),height:1,bbox:null,za:!0},d(k,this.Ka),k;f||(f=Math.ceil(Math.log(g)/Math.log(h)),h=Math.ceil(g/Math.pow(h,f-1)));
k={children:[],height:f,bbox:null};var g=Math.ceil(g/h),h=g*Math.ceil(Math.sqrt(h)),n,p,q;for(r(b,c,e,h,this.le);c<=e;c+=h)for(p=Math.min(c+h-1,e),r(b,c,p,g,this.me),n=c;n<=p;n+=g)q=Math.min(n+g-1,p),k.children.push(this.Xe(b,n,q,f-1));d(k,this.Ka);return k},bh:function(b,c,d,e){for(var f,g,h,n,p,q,r,s;;){e.push(c);if(c.za||e.length-1===d)break;r=s=Infinity;f=0;for(g=c.children.length;f<g;f++){h=c.children[f];p=k(h.bbox);q=b;var u=h.bbox;q=(Math.max(u[2],q[2])-Math.min(u[0],q[0]))*(Math.max(u[3],
q[3])-Math.min(u[1],q[1]))-p;q<s?(s=q,r=p<r?p:r,n=h):q===s&&p<r&&(r=p,n=h)}c=n}return c},Ye:function(b,c,d){var e=this.Ka;d=d?b.bbox:e(b);var e=[],g=this.bh(d,this.data,c,e);g.children.push(b);for(f(g.bbox,d);0<=c;)if(e[c].children.length>this.ie)this.fh(e,c),c--;else break;this.Zg(d,e,c)},fh:function(b,c){var e=b[c],f=e.children.length,g=this.Ze;this.$g(e,g,f);f={children:e.children.splice(this.ah(e,g,f)),height:e.height};e.za&&(f.za=!0);d(e,this.Ka);d(f,this.Ka);c?b[c-1].children.push(f):this.$e(e,
f)},$e:function(b,c){this.data={children:[b,c],height:b.height+1};d(this.data,this.Ka)},ah:function(b,c,d){var f,g,h,n,p,q,r;p=q=Infinity;for(f=c;f<=d-c;f++){g=e(b,0,f,this.Ka);h=e(b,f,d,this.Ka);var s=g,u=h;n=Math.max(s[0],u[0]);var mb=Math.max(s[1],u[1]),Pb=Math.min(s[2],u[2]),s=Math.min(s[3],u[3]);n=Math.max(0,Pb-n)*Math.max(0,s-mb);g=k(g)+k(h);n<p?(p=n,r=f,q=g<q?g:q):n===p&&g<q&&(q=g,r=f)}return r},$g:function(b,c,d){var e=b.za?this.le:g,f=b.za?this.me:h,k=this.We(b,c,d,e);c=this.We(b,c,d,f);
k<c&&b.children.sort(e)},We:function(b,c,d,g){b.children.sort(g);g=this.Ka;var h=e(b,0,c,g),k=e(b,d-c,d,g),p=n(h)+n(k),q,r;for(q=c;q<d-c;q++)r=b.children[q],f(h,b.za?g(r):r.bbox),p+=n(h);for(q=d-c-1;q>=c;q--)r=b.children[q],f(k,b.za?g(r):r.bbox),p+=n(k);return p},Zg:function(b,c,d){for(;0<=d;d--)f(c[d].bbox,b)},dh:function(b){for(var c=b.length-1,e;0<=c;c--)0===b[c].children.length?0<c?(e=b[c-1].children,e.splice(e.indexOf(b[c]),1)):this.clear():d(b[c],this.Ka)},eh:function(b){var c=["return a"," - b",
";"];this.le=new Function("a","b",c.join(b[0]));this.me=new Function("a","b",c.join(b[1]));this.Ka=new Function("a","return [a"+b.join(", a")+"];")}};"function"===typeof define&&define.Nm?define("rbush",function(){return c}):"undefined"!==typeof b?b.lf=c:"undefined"!==typeof self?self.a=c:window.a=c})();dn=b.lf})();function en(b){this.d=dn(b);this.a={}}l=en.prototype;l.sa=function(b,c){var d=[b[0],b[1],b[2],b[3],c];this.d.sa(d);this.a[ma(c)]=d};l.load=function(b,c){for(var d=Array(c.length),e=0,f=c.length;e<f;e++){var g=b[e],h=c[e],g=[g[0],g[1],g[2],g[3],h];d[e]=g;this.a[ma(h)]=g}this.d.load(d)};l.remove=function(b){b=ma(b);var c=this.a[b];yb(this.a,b);return null!==this.d.remove(c)};l.update=function(b,c){var d=ma(c);de(this.a[d].slice(0,4),b)||(this.remove(c),this.sa(b,c))};
function fn(b){b=b.d.all();return Sa(b,function(b){return b[4]})}function gn(b,c){var d=b.d.search(c);return Sa(d,function(b){return b[4]})}l.forEach=function(b,c){return hn(fn(this),b,c)};function jn(b,c,d,e){return hn(gn(b,c),d,e)}function hn(b,c,d){for(var e,f=0,g=b.length;f<g&&!(e=c.call(d,b[f]));f++);return e}l.la=function(){return wb(this.a)};l.clear=function(){this.d.clear();this.a={}};l.J=function(){return this.d.data.bbox};function kn(b){b=m(b)?b:{};Ji.call(this,{attributions:b.attributions,logo:b.logo,projection:b.projection,state:m(b.state)?b.state:void 0});this.b=new en;this.c={};this.e={};this.i={};this.k={};m(b.features)&&this.lb(b.features)}v(kn,Ji);l=kn.prototype;l.Va=function(b){var c=ma(b).toString();ln(this,c,b);var d=b.R();null!=d?(d=d.J(),this.b.sa(d,b)):this.c[c]=b;mn(this,c,b);this.dispatchEvent(new nn("addfeature",b));this.l()};
function ln(b,c,d){b.k[c]=[w(d,"change",b.Rf,!1,b),w(d,"propertychange",b.Rf,!1,b)]}function mn(b,c,d){var e=d.aa;m(e)?b.e[e.toString()]=d:b.i[c]=d}l.Ga=function(b){this.lb(b);this.l()};l.lb=function(b){var c,d,e,f,g=[],h=[];d=0;for(e=b.length;d<e;d++){f=b[d];c=ma(f).toString();ln(this,c,f);var k=f.R();null!=k?(c=k.J(),g.push(c),h.push(f)):this.c[c]=f}this.b.load(g,h);d=0;for(e=b.length;d<e;d++)f=b[d],c=ma(f).toString(),mn(this,c,f),this.dispatchEvent(new nn("addfeature",f))};
l.clear=function(b){if(b){for(var c in this.k)Qa(this.k[c],Xc);this.k={};this.e={};this.i={}}else b=this.ng,this.b.forEach(b,this),ob(this.c,b,this);this.b.clear();this.c={};this.dispatchEvent(new nn("clear"));this.l()};l.$a=function(b,c){return this.b.forEach(b,c)};function on(b,c,d){b.wa([c[0],c[1],c[0],c[1]],function(b){if(b.R().Jb(c[0],c[1]))return d.call(void 0,b)})}l.wa=function(b,c,d){return jn(this.b,b,c,d)};l.Fb=function(b,c,d,e){return this.wa(b,d,e)};
l.Ma=function(b,c,d){return this.wa(b,function(e){if(e.R().ja(b)&&(e=c.call(d,e)))return e})};l.Aa=function(){var b=fn(this.b);wb(this.c)||ab(b,rb(this.c));return b};l.Oa=function(b){var c=[];on(this,b,function(b){c.push(b)});return c};l.ab=function(b){var c=b[0],d=b[1],e=null,f=[NaN,NaN],g=Infinity,h=[-Infinity,-Infinity,Infinity,Infinity];jn(this.b,h,function(b){var n=b.R(),p=g;g=n.Ya(c,d,f,g);g<p&&(e=b,b=Math.sqrt(g),h[0]=c-b,h[1]=d-b,h[2]=c+b,h[3]=d+b)});return e};l.J=function(){return this.b.J()};
l.Na=function(b){b=this.e[b.toString()];return m(b)?b:null};l.Rf=function(b){b=b.target;var c=ma(b).toString(),d=b.R();null!=d?(d=d.J(),c in this.c?(delete this.c[c],this.b.sa(d,b)):this.b.update(d,b)):c in this.c||(this.b.remove(b),this.c[c]=b);d=b.aa;m(d)?(d=d.toString(),c in this.i?(delete this.i[c],this.e[d]=b):this.e[d]!==b&&(pn(this,b),this.e[d]=b)):c in this.i||(pn(this,b),this.i[c]=b);this.l();this.dispatchEvent(new nn("changefeature",b))};l.la=function(){return this.b.la()&&wb(this.c)};
l.Hb=ca;l.fb=function(b){var c=ma(b).toString();c in this.c?delete this.c[c]:this.b.remove(b);this.ng(b);this.l()};l.ng=function(b){var c=ma(b).toString();Qa(this.k[c],Xc);delete this.k[c];var d=b.aa;m(d)?delete this.e[d.toString()]:delete this.i[c];this.dispatchEvent(new nn("removefeature",b))};function pn(b,c){for(var d in b.e)if(b.e[d]===c){delete b.e[d];break}}function nn(b,c){rc.call(this,b);this.feature=c}v(nn,rc);function qn(b){this.a=b.source;this.S=Id();this.b=Mf();this.c=[0,0];this.k=null;cn.call(this,{attributions:b.attributions,canvasFunction:ra(this.nh,this),logo:b.logo,projection:b.projection,ratio:b.ratio,resolutions:b.resolutions,state:this.a.q});this.o=null;this.e=void 0;this.Of(b.style);w(this.a,"change",this.gk,void 0,this)}v(qn,cn);l=qn.prototype;
l.nh=function(b,c,d,e,f){var g=new um(.5*c/d,b,c);this.a.Hb(b,c,f);var h=!1;this.a.Fb(b,c,function(b){var e;if(!(e=h)){var f;m(b.a)?f=b.a.call(b,c):m(this.e)&&(f=this.e(b,c));if(null!=f){var q,r=!1;e=0;for(q=f.length;e<q;++e)r=Xm(g,b,f[e],Wm(c,d),this.fk,this)||r;e=r}else e=!1}h=e},this);vm(g);if(h)return null;this.c[0]!=e[0]||this.c[1]!=e[1]?(this.b.canvas.width=e[0],this.b.canvas.height=e[1],this.c[0]=e[0],this.c[1]=e[1]):this.b.clearRect(0,0,e[0],e[1]);b=rn(this,le(b),c,d,e);ym(g,this.b,d,b,0,
{});this.k=g;return this.b.canvas};l.Jd=function(b,c,d,e,f){if(null!==this.k){var g={};return this.k.b(b,c,0,e,function(b){var c=ma(b).toString();if(!(c in g))return g[c]=!0,f(b)})}};l.ck=function(){return this.a};l.dk=function(){return this.o};l.ek=function(){return this.e};function rn(b,c,d,e,f){return gj(b.S,f[0]/2,f[1]/2,e/d,-e/d,0,-c[0],-c[1])}l.fk=function(){this.l()};l.gk=function(){Ki(this,this.a.q)};l.Of=function(b){this.o=m(b)?b:tl;this.e=null===b?void 0:sl(this.o);this.l()};function sn(b){zm.call(this,b);this.f=null;this.e=Id();this.b=this.c=null}v(sn,zm);l=sn.prototype;l.Ua=function(b,c,d,e){var f=this.a;return f.a().Jd(b,c.viewState.resolution,c.viewState.rotation,c.skippedFeatureUids,function(b){return d.call(e,b,f)})};
l.cc=function(b,c,d,e){if(!fa(this.Id()))if(this.a.a()instanceof qn){if(b=b.slice(),ij(c.pixelToCoordinateMatrix,b,b),this.Ua(b,c,cd,this))return d.call(e,this.a)}else if(null===this.c&&(this.c=Id(),Od(this.e,this.c)),c=Cm(b,this.c),null===this.b&&(this.b=Mf(1,1)),this.b.clearRect(0,0,1,1),this.b.drawImage(this.Id(),c[0],c[1],1,1,0,0,1,1),0<this.b.getImageData(0,0,1,1).data[3])return d.call(e,this.a)};l.Id=function(){return null===this.f?null:this.f.a()};l.of=function(){return this.e};
l.Ae=function(b,c){var d=b.pixelRatio,e=b.viewState,f=e.center,g=e.resolution,h=e.rotation,k,n=this.a.a(),p=b.viewHints;k=b.extent;m(c.extent)&&(k=pe(k,c.extent));p[0]||p[1]||se(k)||(e=e.projection,p=n.g,null===p||(e=p),k=n.sc(k,g,d,e),null!==k&&mj(this,k)&&(this.f=k));if(null!==this.f){k=this.f;var e=k.J(),p=k.resolution,q=k.f,g=d*p/(g*q);gj(this.e,d*b.size[0]/2,d*b.size[1]/2,g,g,h,q*(e[0]-f[0])/p,q*(f[1]-e[3])/p);this.c=null;oj(b.attributions,k.e);pj(b,n)}return!0};function tn(b){zm.call(this,b);this.b=this.e=null;this.i=!1;this.g=null;this.k=Id();this.f=null;this.p=this.o=NaN;this.n=this.c=null}v(tn,zm);tn.prototype.Id=function(){return this.e};tn.prototype.of=function(){return this.k};
tn.prototype.Ae=function(b,c){var d=b.pixelRatio,e=b.viewState,f=e.projection,g=this.a,h=g.a(),k=ej(h,f),n=h.jd(),p=bc(k.a,e.resolution,0),q=h.Xb(p,b.pixelRatio,f),r=k.na(p),s=r/(q/k.ua(p)),u=e.center,z;r==e.resolution?(u=rj(u,r,b.size),z=ne(u,r,e.rotation,b.size)):z=b.extent;m(c.extent)&&(z=pe(z,c.extent));if(se(z))return!1;var y=Yi(k,z,r),A=q*(y.c-y.a+1),D=q*(y.d-y.b+1),x,M;null===this.e?(M=Mf(A,D),this.e=M.canvas,this.b=[A,D],this.g=M,this.i=!Dm(this.b)):(x=this.e,M=this.g,this.b[0]<A||this.b[1]<
D||this.p!==q||this.i&&(this.b[0]>A||this.b[1]>D)?(x.width=A,x.height=D,this.b=[A,D],this.i=!Dm(this.b),this.c=null):(A=this.b[0],D=this.b[1],(x=p!=this.o)||(x=this.c,x=!(x.a<=y.a&&y.c<=x.c&&x.b<=y.b&&y.d<=x.d)),x&&(this.c=null)));var Q,O;null===this.c?(A/=q,D/=q,Q=y.a-Math.floor((A-(y.c-y.a+1))/2),O=y.b-Math.floor((D-(y.d-y.b+1))/2),this.o=p,this.p=q,this.c=new lf(Q,Q+A-1,O,O+D-1),this.n=Array(A*D),D=this.c):(D=this.c,A=D.c-D.a+1);x={};x[p]={};var W=[],Ja=this.ed(h,x),lb=g.ea(),Ka=Td(),mb=new lf(0,
0,0,0),Pb,Ya,Ub;for(O=y.a;O<=y.c;++O)for(Ub=y.b;Ub<=y.d;++Ub)Ya=h.Vb(p,O,Ub,d,f),Q=Ya.state,2==Q||4==Q||3==Q&&!lb?x[p][kf(Ya.a)]=Ya:(Pb=k.gd(Ya.a,Ja,null,mb,Ka),Pb||(W.push(Ya),Pb=k.td(Ya.a,mb,Ka),null===Pb||Ja(p+1,Pb)));Ja=0;for(Pb=W.length;Ja<Pb;++Ja)Ya=W[Ja],O=q*(Ya.a[1]-D.a),Ub=q*(D.d-Ya.a[2]),M.clearRect(O,Ub,q,q);W=Sa(sb(x),Number);db(W);var nb=h.H,Mc=ke(Wi(k,[p,D.a,D.d],Ka)),sc,Oe,lj,Vh,Rf,Zl,Ja=0;for(Pb=W.length;Ja<Pb;++Ja)if(sc=W[Ja],q=h.Xb(sc,d,f),Vh=x[sc],sc==p)for(lj in Vh)Ya=Vh[lj],Oe=
(Ya.a[2]-D.b)*A+(Ya.a[1]-D.a),this.n[Oe]!=Ya&&(O=q*(Ya.a[1]-D.a),Ub=q*(D.d-Ya.a[2]),Q=Ya.state,4!=Q&&(3!=Q||lb)&&nb||M.clearRect(O,Ub,q,q),2==Q&&M.drawImage(Ya.Ta(),n,n,q,q,O,Ub,q,q),this.n[Oe]=Ya);else for(lj in sc=k.na(sc)/r,Vh)for(Ya=Vh[lj],Oe=Wi(k,Ya.a,Ka),O=(Oe[0]-Mc[0])/s,Ub=(Mc[1]-Oe[3])/s,Zl=sc*q,Rf=sc*q,Q=Ya.state,4!=Q&&nb||M.clearRect(O,Ub,Zl,Rf),2==Q&&M.drawImage(Ya.Ta(),n,n,q,q,O,Ub,Zl,Rf),Ya=Xi(k,Oe,p,mb),Q=Math.max(Ya.a,D.a),Ub=Math.min(Ya.c,D.c),O=Math.max(Ya.b,D.b),Ya=Math.min(Ya.d,
D.d);Q<=Ub;++Q)for(Rf=O;Rf<=Ya;++Rf)Oe=(Rf-D.b)*A+(Q-D.a),this.n[Oe]=void 0;qj(b.usedTiles,h,p,y);sj(b,h,k,d,f,z,p,g.r());nj(b,h);pj(b,h);gj(this.k,d*b.size[0]/2,d*b.size[1]/2,d*s/e.resolution,d*s/e.resolution,e.rotation,(Mc[0]-u[0])/s,(u[1]-Mc[1])/s);this.f=null;return!0};tn.prototype.cc=function(b,c,d,e){if(null!==this.g&&(null===this.f&&(this.f=Id(),Od(this.k,this.f)),b=Cm(b,this.f),0<this.g.getImageData(b[0],b[1],1,1).data[3]))return d.call(e,this.a)};function un(b){zm.call(this,b);this.c=!1;this.i=-1;this.n=NaN;this.e=Td();this.b=this.g=null;this.f=Mf()}v(un,zm);
un.prototype.q=function(b,c,d){var e=Bm(this,b);Am(this,"precompose",d,b,e);var f=this.b;if(null!==f&&!f.la()){var g;kd(this.a,"render")?(this.f.canvas.width=d.canvas.width,this.f.canvas.height=d.canvas.height,g=this.f):g=d;var h=g.globalAlpha;g.globalAlpha=c.opacity;ym(f,g,b.pixelRatio,e,b.viewState.rotation,b.skippedFeatureUids);g!=d&&(Am(this,"render",g,b,e),d.drawImage(g.canvas,0,0));g.globalAlpha=h}Am(this,"postcompose",d,b,e)};
un.prototype.Ua=function(b,c,d,e){if(null!==this.b){var f=this.a,g={};return this.b.b(b,c.viewState.resolution,c.viewState.rotation,c.skippedFeatureUids,function(b){var c=ma(b).toString();if(!(c in g))return g[c]=!0,d.call(e,b,f)})}};un.prototype.k=function(){kj(this)};
un.prototype.Ae=function(b){function c(b){var c;m(b.a)?c=b.a.call(b,k):m(d.r)&&(c=(0,d.r)(b,k));if(null!=c){if(null!=c){var e,f,g=!1;e=0;for(f=c.length;e<f;++e)g=Xm(q,b,c[e],Wm(k,n),this.k,this)||g;b=g}else b=!1;this.c=this.c||b}}var d=this.a,e=d.a();oj(b.attributions,e.f);pj(b,e);if(!this.c&&(!d.Ac&&b.viewHints[0]||b.viewHints[1]))return!0;var f=b.extent,g=b.viewState,h=g.projection,k=g.resolution,n=b.pixelRatio;b=d.d;var p=d.ea,g=d.get("renderOrder");m(g)||(g=Vm);f=Xd(f,p*k);if(!this.c&&this.n==
k&&this.i==b&&this.g==g&&$d(this.e,f))return!0;qc(this.b);this.b=null;this.c=!1;var q=new um(.5*k/n,f,k,d.ea);e.Hb(f,k,h);if(null===g)e.Fb(f,k,c,this);else{var r=[];e.Fb(f,k,function(b){r.push(b)},this);db(r,g);Qa(r,c,this)}vm(q);this.n=k;this.i=b;this.g=g;this.e=f;this.b=q;return!0};function vn(b,c){yj.call(this,0,c);this.c=Mf();this.a=this.c.canvas;this.a.style.width="100%";this.a.style.height="100%";this.a.className="ol-unselectable";Gf(b,this.a,0);this.d=!0;this.f=Id()}v(vn,yj);vn.prototype.ne=function(b){return b instanceof H?new sn(b):b instanceof I?new tn(b):b instanceof J?new un(b):null};
function wn(b,c,d){var e=b.g,f=b.c;if(kd(e,c)){var g=d.extent,h=d.pixelRatio,k=d.viewState,n=k.resolution,p=k.rotation;gj(b.f,b.a.width/2,b.a.height/2,h/n,-h/n,-p,-k.center[0],-k.center[1]);k=new um(.5*n/h,g,n);g=new Sl(f,h,g,b.f,p);e.dispatchEvent(new Yk(c,e,g,k,d,f,null));vm(k);k.la()||ym(k,f,h,b.f,p,{});em(g);b.b=k}}vn.prototype.O=function(){return"canvas"};
vn.prototype.Yd=function(b){if(null===b)this.d&&(Lg(this.a,!1),this.d=!1);else{var c=this.c,d=b.size[0]*b.pixelRatio,e=b.size[1]*b.pixelRatio;this.a.width!=d||this.a.height!=e?(this.a.width=d,this.a.height=e):c.clearRect(0,0,this.a.width,this.a.height);zj(b);wn(this,"precompose",b);var d=b.layerStatesArray,e=b.viewState.resolution,f,g,h,k;f=0;for(g=d.length;f<g;++f)k=d[f],h=k.layer,h=Bj(this,h),Mi(k,e)&&"ready"==k.yc&&h.Ae(b,k)&&h.q(b,k,c);wn(this,"postcompose",b);this.d||(Lg(this.a,!0),this.d=!0);
Cj(this,b);b.postRenderFunctions.push(Aj)}};function xn(b,c){jj.call(this,b);this.target=c}v(xn,jj);xn.prototype.f=ca;xn.prototype.n=ca;function yn(b){var c=Df("DIV");c.style.position="absolute";xn.call(this,b,c);this.b=null;this.c=Kd()}v(yn,xn);yn.prototype.Ua=function(b,c,d,e){var f=this.a;return f.a().Jd(b,c.viewState.resolution,c.viewState.rotation,c.skippedFeatureUids,function(b){return d.call(e,b,f)})};yn.prototype.f=function(){Ff(this.target);this.b=null};
yn.prototype.e=function(b,c){var d=b.viewState,e=d.center,f=d.resolution,g=d.rotation,h=this.b,k=this.a.a(),n=b.viewHints,p=b.extent;m(c.extent)&&(p=pe(p,c.extent));n[0]||n[1]||se(p)||(d=d.projection,n=k.g,null===n||(d=n),p=k.sc(p,f,b.pixelRatio,d),null===p||mj(this,p)&&(h=p));null!==h&&(d=h.J(),n=h.resolution,p=Id(),gj(p,b.size[0]/2,b.size[1]/2,n/f,n/f,g,(d[0]-e[0])/n,(e[1]-d[3])/n),h!=this.b&&(e=h.a(this),e.style.maxWidth="none",e.style.position="absolute",Ff(this.target),this.target.appendChild(e),
this.b=h),hj(p,this.c)||(Qf(this.target,p),Ld(this.c,p)),oj(b.attributions,h.e),pj(b,k));return!0};function zn(b){var c=Df("DIV");c.style.position="absolute";xn.call(this,b,c);this.c=!0;this.i=1;this.g=0;this.b={}}v(zn,xn);zn.prototype.f=function(){Ff(this.target);this.g=0};
zn.prototype.e=function(b,c){if(!c.visible)return this.c&&(Lg(this.target,!1),this.c=!1),!0;var d=b.pixelRatio,e=b.viewState,f=e.projection,g=this.a,h=g.a(),k=ej(h,f),n=h.jd(),p=bc(k.a,e.resolution,0),q=k.na(p),r=e.center,s;q==e.resolution?(r=rj(r,q,b.size),s=ne(r,q,e.rotation,b.size)):s=b.extent;m(c.extent)&&(s=pe(s,c.extent));var q=Yi(k,s,q),u={};u[p]={};var z=this.ed(h,u),y=g.ea(),A=Td(),D=new lf(0,0,0,0),x,M,Q,O;for(Q=q.a;Q<=q.c;++Q)for(O=q.b;O<=q.d;++O)x=h.Vb(p,Q,O,d,f),M=x.state,2==M?u[p][kf(x.a)]=
x:4==M||3==M&&!y||(M=k.gd(x.a,z,null,D,A),M||(x=k.td(x.a,D,A),null===x||z(p+1,x)));var W;if(this.g!=h.d){for(W in this.b)y=this.b[+W],Hf(y.target);this.b={};this.g=h.d}A=Sa(sb(u),Number);db(A);var z={},Ja;Q=0;for(O=A.length;Q<O;++Q){W=A[Q];W in this.b?y=this.b[W]:(y=k.Nc(r,W),y=new An(k,y),z[W]=!0,this.b[W]=y);W=u[W];for(Ja in W){x=y;M=W[Ja];var lb=n,Ka=M.a,mb=Ka[0],Pb=Ka[1],Ya=Ka[2],Ka=kf(Ka);if(!(Ka in x.d)){var mb=x.c.ua(mb),Ub=M.Ta(x),nb=Ub.style;nb.maxWidth="none";var Mc=void 0,sc=void 0;0<lb?
(Mc=Df("DIV"),sc=Mc.style,sc.overflow="hidden",sc.width=mb+"px",sc.height=mb+"px",nb.position="absolute",nb.left=-lb+"px",nb.top=-lb+"px",nb.width=mb+2*lb+"px",nb.height=mb+2*lb+"px",Mc.appendChild(Ub)):(nb.width=mb+"px",nb.height=mb+"px",Mc=Ub,sc=nb);sc.position="absolute";sc.left=(Pb-x.b[1])*mb+"px";sc.top=(x.b[2]-Ya)*mb+"px";null===x.a&&(x.a=document.createDocumentFragment());x.a.appendChild(Mc);x.d[Ka]=M}}null!==y.a&&(y.target.appendChild(y.a),y.a=null)}n=Sa(sb(this.b),Number);db(n);Q=Id();Ja=
0;for(A=n.length;Ja<A;++Ja)if(W=n[Ja],y=this.b[W],W in u)if(x=y.g,O=y.e,gj(Q,b.size[0]/2,b.size[1]/2,x/e.resolution,x/e.resolution,e.rotation,(O[0]-r[0])/x,(r[1]-O[1])/x),O=y,x=Q,hj(x,O.f)||(Qf(O.target,x),Ld(O.f,x)),W in z){for(--W;0<=W;--W)if(W in this.b){O=this.b[W].target;O.parentNode&&O.parentNode.insertBefore(y.target,O.nextSibling);break}0>W&&Gf(this.target,y.target,0)}else{if(!b.viewHints[0]&&!b.viewHints[1]){M=Xi(y.c,s,y.b[0],D);W=[];x=O=void 0;for(x in y.d)O=y.d[x],M.contains(O.a)||W.push(O);
lb=M=void 0;M=0;for(lb=W.length;M<lb;++M)O=W[M],x=kf(O.a),Hf(O.Ta(y)),delete y.d[x]}}else Hf(y.target),delete this.b[W];c.opacity!=this.i&&(this.i=this.target.style.opacity=c.opacity);c.visible&&!this.c&&(Lg(this.target,!0),this.c=!0);qj(b.usedTiles,h,p,q);sj(b,h,k,d,f,s,p,g.r());nj(b,h);pj(b,h);return!0};
function An(b,c){this.target=Df("DIV");this.target.style.position="absolute";this.target.style.width="100%";this.target.style.height="100%";this.c=b;this.b=c;this.e=ke(Wi(b,c));this.g=b.na(c[0]);this.d={};this.a=null;this.f=Kd()};function Bn(b){this.g=Mf();var c=this.g.canvas;c.style.maxWidth="none";c.style.position="absolute";xn.call(this,b,c);this.c=!1;this.o=-1;this.q=NaN;this.i=Td();this.b=this.k=null;this.r=Id();this.p=Id()}v(Bn,xn);
Bn.prototype.n=function(b,c){var d=b.viewState,e=d.center,f=d.rotation,g=d.resolution,d=b.pixelRatio,h=b.size[0],k=b.size[1],n=h*d,p=k*d,e=gj(this.r,d*h/2,d*k/2,d/g,-d/g,-f,-e[0],-e[1]),g=this.g;g.canvas.width=n;g.canvas.height=p;h=gj(this.p,0,0,1/d,1/d,0,-(n-h)/2*d,-(p-k)/2*d);Qf(g.canvas,h);Cn(this,"precompose",b,e);h=this.b;null===h||h.la()||(g.globalAlpha=c.opacity,ym(h,g,d,e,f,b.skippedFeatureUids),Cn(this,"render",b,e));Cn(this,"postcompose",b,e)};
function Cn(b,c,d,e){var f=b.g;b=b.a;kd(b,c)&&(e=new Sl(f,d.pixelRatio,d.extent,e,d.viewState.rotation),b.dispatchEvent(new Yk(c,b,e,null,d,f,null)),em(e))}Bn.prototype.Ua=function(b,c,d,e){if(null!==this.b){var f=this.a,g={};return this.b.b(b,c.viewState.resolution,c.viewState.rotation,c.skippedFeatureUids,function(b){var c=ma(b).toString();if(!(c in g))return g[c]=!0,d.call(e,b,f)})}};Bn.prototype.D=function(){kj(this)};
Bn.prototype.e=function(b){function c(b){var c;m(b.a)?c=b.a.call(b,k):m(d.r)&&(c=(0,d.r)(b,k));if(null!=c){if(null!=c){var e,f,g=!1;e=0;for(f=c.length;e<f;++e)g=Xm(q,b,c[e],Wm(k,n),this.D,this)||g;b=g}else b=!1;this.c=this.c||b}}var d=this.a,e=d.a();oj(b.attributions,e.f);pj(b,e);if(!this.c&&(!d.Ac&&b.viewHints[0]||b.viewHints[1]))return!0;var f=b.extent,g=b.viewState,h=g.projection,k=g.resolution,n=b.pixelRatio;b=d.d;var p=d.ea,g=d.get("renderOrder");m(g)||(g=Vm);f=Xd(f,p*k);if(!this.c&&this.q==
k&&this.o==b&&this.k==g&&$d(this.i,f))return!0;qc(this.b);this.b=null;this.c=!1;var q=new um(.5*k/n,f,k,d.ea);e.Hb(f,k,h);if(null===g)e.Fb(f,k,c,this);else{var r=[];e.Fb(f,k,function(b){r.push(b)},this);db(r,g);Qa(r,c,this)}vm(q);this.q=k;this.o=b;this.k=g;this.i=f;this.b=q;return!0};function Dn(b,c){yj.call(this,0,c);this.d=null;this.d=Mf();var d=this.d.canvas;d.style.position="absolute";d.style.width="100%";d.style.height="100%";d.className="ol-unselectable";Gf(b,d,0);this.f=Id();this.a=Df("DIV");this.a.className="ol-unselectable";d=this.a.style;d.position="absolute";d.width="100%";d.height="100%";w(this.a,"touchstart",uc);Gf(b,this.a,0);this.c=!0}v(Dn,yj);Dn.prototype.P=function(){Hf(this.a);Dn.T.P.call(this)};
Dn.prototype.ne=function(b){if(b instanceof H)b=new yn(b);else if(b instanceof I)b=new zn(b);else if(b instanceof J)b=new Bn(b);else return null;return b};
function En(b,c,d){var e=b.g;if(kd(e,c)){var f=d.extent,g=d.pixelRatio,h=d.viewState,k=h.resolution,n=h.rotation,p=b.d,q=p.canvas;gj(b.f,q.width/2,q.height/2,g/h.resolution,-g/h.resolution,-h.rotation,-h.center[0],-h.center[1]);h=new Sl(p,g,f,b.f,n);f=new um(.5*k/g,f,k);e.dispatchEvent(new Yk(c,e,h,f,d,p,null));vm(f);f.la()||ym(f,p,g,b.f,n,{});em(h);b.b=f}}Dn.prototype.O=function(){return"dom"};
Dn.prototype.Yd=function(b){if(null===b)this.c&&(Lg(this.a,!1),this.c=!1);else{var c;c=function(b,c){Gf(this.a,b,c)};var d=this.g;if(kd(d,"precompose")||kd(d,"postcompose")){var d=this.d.canvas,e=b.pixelRatio;d.width=b.size[0]*e;d.height=b.size[1]*e}En(this,"precompose",b);var d=b.layerStatesArray,f,g,h,e=0;for(f=d.length;e<f;++e)h=d[e],g=h.layer,g=Bj(this,g),c.call(this,g.target,e),"ready"==h.yc?g.e(b,h)&&g.n(b,h):g.f();c=b.layerStates;for(var k in this.e)k in c||(g=this.e[k],Hf(g.target));this.c||
(Lg(this.a,!0),this.c=!0);zj(b);Cj(this,b);b.postRenderFunctions.push(Aj);En(this,"postcompose",b)}};function Fn(b){this.a=b}function Gn(b){this.a=b}v(Gn,Fn);Gn.prototype.O=function(){return 35632};function Hn(b){this.a=b}v(Hn,Fn);Hn.prototype.O=function(){return 35633};function In(){this.a="precision mediump float;varying vec2 a;varying float b;uniform mat4 k;uniform float l;uniform sampler2D m;void main(void){vec4 texColor=texture2D(m,a);float alpha=texColor.a*b*l;if(alpha==0.0){discard;}gl_FragColor.a=alpha;gl_FragColor.rgb=(k*vec4(texColor.rgb,1.)).rgb;}"}v(In,Gn);da(In);
function Jn(){this.a="varying vec2 a;varying float b;attribute vec2 c;attribute vec2 d;attribute vec2 e;attribute float f;attribute float g;uniform mat4 h;uniform mat4 i;uniform mat4 j;void main(void){mat4 offsetMatrix=i;if(g==1.0){offsetMatrix=i*j;}vec4 offsets=offsetMatrix*vec4(e,0.,0.);gl_Position=h*vec4(c,0.,1.)+offsets;a=d;b=f;}"}v(Jn,Hn);da(Jn);
function Kn(b,c){this.k=b.getUniformLocation(c,"k");this.n=b.getUniformLocation(c,"j");this.i=b.getUniformLocation(c,"i");this.e=b.getUniformLocation(c,"l");this.g=b.getUniformLocation(c,"h");this.a=b.getAttribLocation(c,"e");this.d=b.getAttribLocation(c,"f");this.c=b.getAttribLocation(c,"c");this.b=b.getAttribLocation(c,"g");this.f=b.getAttribLocation(c,"d")};function Ln(){this.a="precision mediump float;varying vec2 a;varying float b;uniform float k;uniform sampler2D l;void main(void){vec4 texColor=texture2D(l,a);gl_FragColor.rgb=texColor.rgb;float alpha=texColor.a*b*k;if(alpha==0.0){discard;}gl_FragColor.a=alpha;}"}v(Ln,Gn);da(Ln);
function Mn(){this.a="varying vec2 a;varying float b;attribute vec2 c;attribute vec2 d;attribute vec2 e;attribute float f;attribute float g;uniform mat4 h;uniform mat4 i;uniform mat4 j;void main(void){mat4 offsetMatrix=i;if(g==1.0){offsetMatrix=i*j;}vec4 offsets=offsetMatrix*vec4(e,0.,0.);gl_Position=h*vec4(c,0.,1.)+offsets;a=d;b=f;}"}v(Mn,Hn);da(Mn);
function Nn(b,c){this.n=b.getUniformLocation(c,"j");this.i=b.getUniformLocation(c,"i");this.e=b.getUniformLocation(c,"k");this.g=b.getUniformLocation(c,"h");this.a=b.getAttribLocation(c,"e");this.d=b.getAttribLocation(c,"f");this.c=b.getAttribLocation(c,"c");this.b=b.getAttribLocation(c,"g");this.f=b.getAttribLocation(c,"d")};function On(b){this.a=m(b)?b:[];this.d=m(void 0)?void 0:35044};function Pn(b,c){this.k=b;this.a=c;this.d={};this.e={};this.f={};this.n=this.i=this.c=this.g=null;(this.b=Wa(va,"OES_element_index_uint"))&&c.getExtension("OES_element_index_uint");w(this.k,"webglcontextlost",this.cl,!1,this);w(this.k,"webglcontextrestored",this.dl,!1,this)}
function Qn(b,c,d){var e=b.a,f=d.a,g=ma(d);if(g in b.d)e.bindBuffer(c,b.d[g].buffer);else{var h=e.createBuffer();e.bindBuffer(c,h);var k;34962==c?k=new Float32Array(f):34963==c&&(k=b.b?new Uint32Array(f):new Uint16Array(f));e.bufferData(c,k,d.d);b.d[g]={b:d,buffer:h}}}function Rn(b,c){var d=b.a,e=ma(c),f=b.d[e];d.isContextLost()||d.deleteBuffer(f.buffer);delete b.d[e]}l=Pn.prototype;
l.P=function(){var b=this.a;b.isContextLost()||(ob(this.d,function(c){b.deleteBuffer(c.buffer)}),ob(this.f,function(c){b.deleteProgram(c)}),ob(this.e,function(c){b.deleteShader(c)}),b.deleteFramebuffer(this.c),b.deleteRenderbuffer(this.n),b.deleteTexture(this.i))};l.bl=function(){return this.a};
l.se=function(){if(null===this.c){var b=this.a,c=b.createFramebuffer();b.bindFramebuffer(b.FRAMEBUFFER,c);var d=Sn(b,1,1),e=b.createRenderbuffer();b.bindRenderbuffer(b.RENDERBUFFER,e);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,1,1);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,d,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,e);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,
null);this.c=c;this.i=d;this.n=e}return this.c};function Tn(b,c){var d=ma(c);if(d in b.e)return b.e[d];var e=b.a,f=e.createShader(c.O());e.shaderSource(f,c.a);e.compileShader(f);return b.e[d]=f}function Un(b,c,d){var e=ma(c)+"/"+ma(d);if(e in b.f)return b.f[e];var f=b.a,g=f.createProgram();f.attachShader(g,Tn(b,c));f.attachShader(g,Tn(b,d));f.linkProgram(g);return b.f[e]=g}l.cl=function(){xb(this.d);xb(this.e);xb(this.f);this.n=this.i=this.c=this.g=null};l.dl=function(){};
l.Rd=function(b){if(b==this.g)return!1;this.a.useProgram(b);this.g=b;return!0};function Vn(b,c,d){var e=b.createTexture();b.bindTexture(b.TEXTURE_2D,e);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);m(c)&&b.texParameteri(3553,10242,c);m(d)&&b.texParameteri(3553,10243,d);return e}function Sn(b,c,d){var e=Vn(b,void 0,void 0);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,c,d,0,b.RGBA,b.UNSIGNED_BYTE,null);return e}
function Wn(b,c){var d=Vn(b,33071,33071);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,c);return d};function Xn(b,c){this.r=this.p=void 0;this.Ea=new tg;this.i=le(c);this.o=[];this.e=[];this.N=void 0;this.f=[];this.c=[];this.W=this.S=void 0;this.d=[];this.H=this.D=this.n=null;this.ca=void 0;this.ka=Kd();this.va=Kd();this.oa=this.da=void 0;this.Fa=Kd();this.Da=this.fa=this.pa=void 0;this.ia=[];this.g=[];this.a=[];this.q=null;this.b=[];this.k=[];this.ea=void 0}
function Yn(b,c){var d=b.q,e=b.n,f=b.ia,g=b.g,h=c.a;return function(){if(!h.isContextLost()){var b,n;b=0;for(n=f.length;b<n;++b)h.deleteTexture(f[b]);b=0;for(n=g.length;b<n;++b)h.deleteTexture(g[b])}Rn(c,d);Rn(c,e)}}
function Zn(b,c,d,e){var f=b.p,g=b.r,h=b.N,k=b.S,n=b.W,p=b.ca,q=b.da,r=b.oa,s=b.pa?1:0,u=b.fa,z=b.Da,y=b.ea,A=Math.cos(u),u=Math.sin(u),D=b.d.length,x=b.a.length,M,Q,O,W,Ja,lb;for(M=0;M<d;M+=e)Ja=c[M]-b.i[0],lb=c[M+1]-b.i[1],Q=x/8,O=-z*f,W=-z*(h-g),b.a[x++]=Ja,b.a[x++]=lb,b.a[x++]=O*A-W*u,b.a[x++]=O*u+W*A,b.a[x++]=q/n,b.a[x++]=(r+h)/k,b.a[x++]=p,b.a[x++]=s,O=z*(y-f),W=-z*(h-g),b.a[x++]=Ja,b.a[x++]=lb,b.a[x++]=O*A-W*u,b.a[x++]=O*u+W*A,b.a[x++]=(q+y)/n,b.a[x++]=(r+h)/k,b.a[x++]=p,b.a[x++]=s,O=z*(y-
f),W=z*g,b.a[x++]=Ja,b.a[x++]=lb,b.a[x++]=O*A-W*u,b.a[x++]=O*u+W*A,b.a[x++]=(q+y)/n,b.a[x++]=r/k,b.a[x++]=p,b.a[x++]=s,O=-z*f,W=z*g,b.a[x++]=Ja,b.a[x++]=lb,b.a[x++]=O*A-W*u,b.a[x++]=O*u+W*A,b.a[x++]=q/n,b.a[x++]=r/k,b.a[x++]=p,b.a[x++]=s,b.d[D++]=Q,b.d[D++]=Q+1,b.d[D++]=Q+2,b.d[D++]=Q,b.d[D++]=Q+2,b.d[D++]=Q+3}l=Xn.prototype;l.tb=function(b,c){this.b.push(this.d.length);this.k.push(c);var d=b.j;Zn(this,d,d.length,b.B)};
l.ub=function(b,c){this.b.push(this.d.length);this.k.push(c);var d=b.j;Zn(this,d,d.length,b.B)};l.Kb=function(b){var c=b.a;this.o.push(this.d.length);this.e.push(this.d.length);this.q=new On(this.a);Qn(b,34962,this.q);this.n=new On(this.d);Qn(b,34963,this.n);b={};$n(this.ia,this.f,b,c);$n(this.g,this.c,b,c);this.N=this.r=this.p=void 0;this.c=this.f=null;this.W=this.S=void 0;this.d=null;this.Da=this.fa=this.pa=this.oa=this.da=this.ca=void 0;this.a=null;this.ea=void 0};
function $n(b,c,d,e){var f,g,h,k=c.length;for(h=0;h<k;++h)f=c[h],g=ma(f).toString(),g in d?f=d[g]:(f=Wn(e,f),d[g]=f),b[h]=f}
l.bc=function(b,c,d,e,f,g,h,k,n,p,q,r,s,u,z){g=b.a;Qn(b,34962,this.q);Qn(b,34963,this.n);var y=k||1!=n||p||1!=q,A,D;y?(A=In.Pa(),D=Jn.Pa()):(A=Ln.Pa(),D=Mn.Pa());D=Un(b,A,D);y?null===this.D?this.D=A=new Kn(g,D):A=this.D:null===this.H?this.H=A=new Nn(g,D):A=this.H;b.Rd(D);g.enableVertexAttribArray(A.c);g.vertexAttribPointer(A.c,2,5126,!1,32,0);g.enableVertexAttribArray(A.a);g.vertexAttribPointer(A.a,2,5126,!1,32,8);g.enableVertexAttribArray(A.f);g.vertexAttribPointer(A.f,2,5126,!1,32,16);g.enableVertexAttribArray(A.d);
g.vertexAttribPointer(A.d,1,5126,!1,32,24);g.enableVertexAttribArray(A.b);g.vertexAttribPointer(A.b,1,5126,!1,32,28);D=this.Fa;gj(D,0,0,2/(d*f[0]),2/(d*f[1]),-e,-(c[0]-this.i[0]),-(c[1]-this.i[1]));c=this.va;d=2/f[0];f=2/f[1];Md(c);c[0]=d;c[5]=f;c[10]=1;c[15]=1;f=this.ka;Md(f);0!==e&&Rd(f,-e);g.uniformMatrix4fv(A.g,!1,D);g.uniformMatrix4fv(A.i,!1,c);g.uniformMatrix4fv(A.n,!1,f);g.uniform1f(A.e,h);y&&g.uniformMatrix4fv(A.k,!1,ug(this.Ea,k,n,p,q));var x;if(m(s)){if(u)a:{e=b.b?5125:5123;b=b.b?4:2;p=
this.b.length-1;for(h=this.g.length-1;0<=h;--h)for(g.bindTexture(3553,this.g[h]),k=0<h?this.e[h-1]:0,q=this.e[h];0<=p&&this.b[p]>=k;){n=this.b[p];u=this.k[p];x=ma(u).toString();if(!m(r[x])&&(!m(z)||qe(z,u.R().J()))&&(g.clear(g.COLOR_BUFFER_BIT|g.DEPTH_BUFFER_BIT),g.drawElements(4,q-n,e,n*b),q=s(u))){r=q;break a}q=n;p--}r=void 0}else g.clear(g.COLOR_BUFFER_BIT|g.DEPTH_BUFFER_BIT),ao(this,g,b,r,this.g,this.e),r=(r=s(null))?r:void 0;x=r}else ao(this,g,b,r,this.ia,this.o);g.disableVertexAttribArray(A.c);
g.disableVertexAttribArray(A.a);g.disableVertexAttribArray(A.f);g.disableVertexAttribArray(A.d);g.disableVertexAttribArray(A.b);return x};
function ao(b,c,d,e,f,g){var h=d.b?5125:5123;d=d.b?4:2;if(wb(e)){var k;b=0;e=f.length;for(k=0;b<e;++b){c.bindTexture(3553,f[b]);var n=g[b];c.drawElements(4,n-k,h,k*d);k=n}}else{k=0;var p,n=0;for(p=f.length;n<p;++n){c.bindTexture(3553,f[n]);for(var q=0<n?g[n-1]:0,r=g[n],s=q;k<b.b.length&&b.b[k]<=r;){var u=ma(b.k[k]).toString();m(e[u])?(s!==q&&c.drawElements(4,q-s,h,s*d),q=s=k===b.b.length-1?r:b.b[k+1]):q=k===b.b.length-1?r:b.b[k+1];k++}s!==q&&c.drawElements(4,q-s,h,s*d)}}}
l.ib=function(b){var c=b.wb(),d=b.Bb(1),e=b.kd(),f=b.Kd(1),g=b.o,h=b.Cb(),k=b.p,n=b.i,p=b.gb();b=b.k;var q;0===this.f.length?this.f.push(d):(q=this.f[this.f.length-1],ma(q)!=ma(d)&&(this.o.push(this.d.length),this.f.push(d)));0===this.c.length?this.c.push(f):(q=this.c[this.c.length-1],ma(q)!=ma(f)&&(this.e.push(this.d.length),this.c.push(f)));this.p=c[0];this.r=c[1];this.N=p[1];this.S=e[1];this.W=e[0];this.ca=g;this.da=h[0];this.oa=h[1];this.fa=n;this.pa=k;this.Da=b;this.ea=p[0]};
function bo(b,c,d){this.f=c;this.e=b;this.c=d;this.d={}}function co(b,c){var d=[],e;for(e in b.d)d.push(Yn(b.d[e],c));return gd.apply(null,d)}function eo(b,c){for(var d in b.d)b.d[d].Kb(c)}bo.prototype.a=function(b,c){var d=this.d[c];m(d)||(d=new fo[c](this.e,this.f),this.d[c]=d);return d};bo.prototype.la=function(){return wb(this.d)};function go(b,c,d,e,f,g,h,k,n,p,q,r,s,u,z){var y=ho,A,D;for(A=fm.length-1;0<=A;--A)if(D=b.d[fm[A]],m(D)&&(D=D.bc(c,d,e,f,y,g,h,k,n,p,q,r,s,u,z)))return D}
bo.prototype.b=function(b,c,d,e,f,g,h,k,n,p,q,r,s,u){var z=c.a;z.bindFramebuffer(z.FRAMEBUFFER,c.se());var y;m(this.c)&&(y=Xd(ce(b),e*this.c));return go(this,c,b,e,f,h,k,n,p,q,r,s,function(b){var c=new Uint8Array(4);z.readPixels(0,0,1,1,z.RGBA,z.UNSIGNED_BYTE,c);if(0<c[3]&&(b=u(b)))return b},!0,y)};
function io(b,c,d,e,f,g,h,k,n,p,q,r){var s=d.a;s.bindFramebuffer(s.FRAMEBUFFER,d.se());b=go(b,d,c,e,f,g,h,k,n,p,q,r,function(){var b=new Uint8Array(4);s.readPixels(0,0,1,1,s.RGBA,s.UNSIGNED_BYTE,b);return 0<b[3]},!1);return m(b)}var fo={Image:Xn},ho=[1,1];function jo(b,c,d,e,f,g,h){this.b=b;this.f=c;this.a=g;this.e=h;this.i=f;this.n=e;this.g=d;this.c=null;this.d={}}l=jo.prototype;l.kc=function(b,c){var d=b.toString(),e=this.d[d];m(e)?e.push(c):this.d[d]=[c]};l.lc=function(){};l.oe=function(b,c){var d=(0,c.c)(b);if(null!=d&&qe(this.a,d.J())){var e=c.a;m(e)||(e=0);this.kc(e,function(b){b.Ba(c.f,c.b);b.ib(c.e);b.Ca(c.d);var e=ko[d.O()];e&&e.call(b,d,null)})}};
l.fd=function(b,c){var d=b.c,e,f;e=0;for(f=d.length;e<f;++e){var g=d[e],h=ko[g.O()];h&&h.call(this,g,c)}};l.ub=function(b,c){var d=this.b,e=(new bo(1,this.a)).a(0,"Image");e.ib(this.c);e.ub(b,c);e.Kb(d);e.bc(this.b,this.f,this.g,this.n,this.i,this.a,this.e,1,0,1,0,1,{});Yn(e,d)()};l.Eb=function(){};l.mc=function(){};l.tb=function(b,c){var d=this.b,e=(new bo(1,this.a)).a(0,"Image");e.ib(this.c);e.tb(b,c);e.Kb(d);e.bc(this.b,this.f,this.g,this.n,this.i,this.a,this.e,1,0,1,0,1,{});Yn(e,d)()};l.nc=function(){};
l.Rb=function(){};l.vb=function(){};l.Ba=function(){};l.ib=function(b){this.c=b};l.Ca=function(){};var ko={Point:jo.prototype.ub,MultiPoint:jo.prototype.tb,GeometryCollection:jo.prototype.fd};function lo(){this.a="precision mediump float;varying vec2 a;uniform mat4 f;uniform float g;uniform sampler2D h;void main(void){vec4 texColor=texture2D(h,a);gl_FragColor.rgb=(f*vec4(texColor.rgb,1.)).rgb;gl_FragColor.a=texColor.a*g;}"}v(lo,Gn);da(lo);function mo(){this.a="varying vec2 a;attribute vec2 b;attribute vec2 c;uniform mat4 d;uniform mat4 e;void main(void){gl_Position=e*vec4(b,0.,1.);a=(d*vec4(c,0.,1.)).st;}"}v(mo,Hn);da(mo);
function no(b,c){this.g=b.getUniformLocation(c,"f");this.b=b.getUniformLocation(c,"g");this.c=b.getUniformLocation(c,"e");this.e=b.getUniformLocation(c,"d");this.f=b.getUniformLocation(c,"h");this.a=b.getAttribLocation(c,"b");this.d=b.getAttribLocation(c,"c")};function oo(){this.a="precision mediump float;varying vec2 a;uniform float f;uniform sampler2D g;void main(void){vec4 texColor=texture2D(g,a);gl_FragColor.rgb=texColor.rgb;gl_FragColor.a=texColor.a*f;}"}v(oo,Gn);da(oo);function po(){this.a="varying vec2 a;attribute vec2 b;attribute vec2 c;uniform mat4 d;uniform mat4 e;void main(void){gl_Position=e*vec4(b,0.,1.);a=(d*vec4(c,0.,1.)).st;}"}v(po,Hn);da(po);
function qo(b,c){this.b=b.getUniformLocation(c,"f");this.c=b.getUniformLocation(c,"e");this.e=b.getUniformLocation(c,"d");this.f=b.getUniformLocation(c,"g");this.a=b.getAttribLocation(c,"b");this.d=b.getAttribLocation(c,"c")};function ro(b,c){jj.call(this,c);this.b=b;this.N=new On([-1,-1,0,0,1,-1,1,0,-1,1,0,1,1,1,1,1]);this.f=this.Wa=null;this.e=void 0;this.i=Id();this.o=Kd();this.S=new tg;this.q=this.k=null}v(ro,jj);
function so(b,c,d){var e=b.b.f;if(m(b.e)&&b.e==d)e.bindFramebuffer(36160,b.f);else{c.postRenderFunctions.push(sa(function(b,c,d){b.isContextLost()||(b.deleteFramebuffer(c),b.deleteTexture(d))},e,b.f,b.Wa));c=Sn(e,d,d);var f=e.createFramebuffer();e.bindFramebuffer(36160,f);e.framebufferTexture2D(36160,36064,3553,c,0);b.Wa=c;b.f=f;b.e=d}}
ro.prototype.Nf=function(b,c,d){to(this,"precompose",d,b);Qn(d,34962,this.N);var e=d.a,f=c.brightness||1!=c.contrast||c.hue||1!=c.saturation,g,h;f?(g=lo.Pa(),h=mo.Pa()):(g=oo.Pa(),h=po.Pa());g=Un(d,g,h);f?null===this.k?this.k=h=new no(e,g):h=this.k:null===this.q?this.q=h=new qo(e,g):h=this.q;d.Rd(g)&&(e.enableVertexAttribArray(h.a),e.vertexAttribPointer(h.a,2,5126,!1,16,0),e.enableVertexAttribArray(h.d),e.vertexAttribPointer(h.d,2,5126,!1,16,8),e.uniform1i(h.f,0));e.uniformMatrix4fv(h.e,!1,this.i);
e.uniformMatrix4fv(h.c,!1,this.o);f&&e.uniformMatrix4fv(h.g,!1,ug(this.S,c.brightness,c.contrast,c.hue,c.saturation));e.uniform1f(h.b,c.opacity);e.bindTexture(3553,this.Wa);e.drawArrays(5,0,4);to(this,"postcompose",d,b)};function to(b,c,d,e){b=b.a;if(kd(b,c)){var f=e.viewState;b.dispatchEvent(new Yk(c,b,new jo(d,f.center,f.resolution,f.rotation,e.size,e.extent,e.pixelRatio),null,e,null,d))}}ro.prototype.Be=function(){this.f=this.Wa=null;this.e=void 0};function uo(b,c){ro.call(this,b,c);this.n=this.g=this.c=null}v(uo,ro);function vo(b,c){var d=c.a();return Wn(b.b.f,d)}uo.prototype.Ua=function(b,c,d,e){var f=this.a;return f.a().Jd(b,c.viewState.resolution,c.viewState.rotation,c.skippedFeatureUids,function(b){return d.call(e,b,f)})};
uo.prototype.Ce=function(b,c){var d=this.b.f,e=b.viewState,f=e.center,g=e.resolution,h=e.rotation,k=this.c,n=this.Wa,p=this.a.a(),q=b.viewHints,r=b.extent;m(c.extent)&&(r=pe(r,c.extent));q[0]||q[1]||se(r)||(e=e.projection,q=p.g,null===q||(e=q),r=p.sc(r,g,b.pixelRatio,e),null!==r&&mj(this,r)&&(k=r,n=vo(this,r),null===this.Wa||b.postRenderFunctions.push(sa(function(b,c){b.isContextLost()||b.deleteTexture(c)},d,this.Wa))));null!==k&&(d=this.b.c.k,wo(this,d.width,d.height,f,g,h,k.J()),this.n=null,f=this.i,
Md(f),Qd(f,1,-1),Pd(f,0,-1),this.c=k,this.Wa=n,oj(b.attributions,k.e),pj(b,p));return!0};function wo(b,c,d,e,f,g,h){c*=f;d*=f;b=b.o;Md(b);Qd(b,2/c,2/d);Rd(b,-g);Pd(b,h[0]-e[0],h[1]-e[1]);Qd(b,(h[2]-h[0])/2,(h[3]-h[1])/2);Pd(b,1,1)}uo.prototype.Hd=function(b,c){var d=this.Ua(b,c,cd,this);return m(d)};
uo.prototype.cc=function(b,c,d,e){if(null!==this.c&&!fa(this.c.a()))if(this.a.a()instanceof qn){if(b=b.slice(),ij(c.pixelToCoordinateMatrix,b,b),this.Ua(b,c,cd,this))return d.call(e,this.a)}else{var f=[this.c.a().width,this.c.a().height];if(null===this.n){var g=c.size;c=Id();Md(c);Pd(c,-1,-1);Qd(c,2/g[0],2/g[1]);Pd(c,0,g[1]);Qd(c,1,-1);g=Id();Od(this.o,g);var h=Id();Md(h);Pd(h,0,f[1]);Qd(h,1,-1);Qd(h,f[0]/2,f[1]/2);Pd(h,1,1);var k=Id();Nd(h,g,k);Nd(k,c,k);this.n=k}c=[0,0];ij(this.n,b,c);if(!(0>c[0]||
c[0]>f[0]||0>c[1]||c[1]>f[1])&&(null===this.g&&(this.g=Mf(1,1)),this.g.clearRect(0,0,1,1),this.g.drawImage(this.c.a(),c[0],c[1],1,1,0,0,1,1),0<this.g.getImageData(0,0,1,1).data[3]))return d.call(e,this.a)}};function xo(){this.a="precision mediump float;varying vec2 a;uniform sampler2D e;void main(void){gl_FragColor=texture2D(e,a);}"}v(xo,Gn);da(xo);function yo(){this.a="varying vec2 a;attribute vec2 b;attribute vec2 c;uniform vec4 d;void main(void){gl_Position=vec4(b*d.xy+d.zw,0.,1.);a=c;}"}v(yo,Hn);da(yo);function zo(b,c){this.b=b.getUniformLocation(c,"e");this.c=b.getUniformLocation(c,"d");this.a=b.getAttribLocation(c,"b");this.d=b.getAttribLocation(c,"c")};function Ao(b,c){ro.call(this,b,c);this.D=xo.Pa();this.H=yo.Pa();this.c=null;this.r=new On([0,0,0,1,1,0,1,1,0,1,0,0,1,1,1,0]);this.p=this.g=null;this.n=-1}v(Ao,ro);l=Ao.prototype;l.P=function(){Rn(this.b.c,this.r);Ao.T.P.call(this)};l.ed=function(b,c){var d=this.b;return function(e,f){return dj(b,e,f,function(b){var f=Ri(d.d,b.qb());f&&(c[e]||(c[e]={}),c[e][b.a.toString()]=b);return f})}};l.Be=function(){Ao.T.Be.call(this);this.c=null};
l.Ce=function(b,c,d){var e=this.b,f=d.a,g=b.viewState,h=g.projection,k=this.a,n=k.a(),p=ej(n,h),q=bc(p.a,g.resolution,0),r=p.na(q),s=n.Xb(q,b.pixelRatio,h),u=s/p.ua(q),z=r/u,y=n.jd(),A=g.center,D;r==g.resolution?(A=rj(A,r,b.size),D=ne(A,r,g.rotation,b.size)):D=b.extent;r=Yi(p,D,r);if(null!==this.g&&of(this.g,r)&&this.n==n.d)z=this.p;else{var x=[r.c-r.a+1,r.d-r.b+1],x=Math.max(x[0]*s,x[1]*s),M=Math.pow(2,Math.ceil(Math.log(x)/Math.LN2)),x=z*M,Q=p.Lb(q),O=Q[0]+r.a*s*z,z=Q[1]+r.b*s*z,z=[O,z,O+x,z+x];
so(this,b,M);f.viewport(0,0,M,M);f.clearColor(0,0,0,0);f.clear(16384);f.disable(3042);M=Un(d,this.D,this.H);d.Rd(M);null===this.c&&(this.c=new zo(f,M));Qn(d,34962,this.r);f.enableVertexAttribArray(this.c.a);f.vertexAttribPointer(this.c.a,2,5126,!1,16,0);f.enableVertexAttribArray(this.c.d);f.vertexAttribPointer(this.c.d,2,5126,!1,16,8);f.uniform1i(this.c.b,0);d={};d[q]={};var W=this.ed(n,d),Ja=k.ea(),M=!0,O=Td(),lb=new lf(0,0,0,0),Ka,mb,Pb;for(mb=r.a;mb<=r.c;++mb)for(Pb=r.b;Pb<=r.d;++Pb){Q=n.Vb(q,
mb,Pb,u,h);if(m(c.extent)&&(Ka=Wi(p,Q.a,O),!qe(Ka,c.extent)))continue;Ka=Q.state;if(2==Ka){if(Ri(e.d,Q.qb())){d[q][kf(Q.a)]=Q;continue}}else if(4==Ka||3==Ka&&!Ja)continue;M=!1;Ka=p.gd(Q.a,W,null,lb,O);Ka||(Q=p.td(Q.a,lb,O),null===Q||W(q+1,Q))}c=Sa(sb(d),Number);db(c);for(var W=new Float32Array(4),Ya,Ub,nb,Ja=0,lb=c.length;Ja<lb;++Ja)for(Ya in Ub=d[c[Ja]],Ub)Q=Ub[Ya],Ka=Wi(p,Q.a,O),mb=2*(Ka[2]-Ka[0])/x,Pb=2*(Ka[3]-Ka[1])/x,nb=2*(Ka[0]-z[0])/x-1,Ka=2*(Ka[1]-z[1])/x-1,Hd(W,mb,Pb,nb,Ka),f.uniform4fv(this.c.c,
W),Bo(e,Q,s,y*u),f.drawArrays(5,0,4);M?(this.g=r,this.p=z,this.n=n.d):(this.p=this.g=null,this.n=-1,b.animate=!0)}qj(b.usedTiles,n,q,r);var Mc=e.i;sj(b,n,p,u,h,D,q,k.r(),function(b){var c;(c=2!=b.state||Ri(e.d,b.qb()))||(c=b.qb()in Mc.b);c||tj(Mc,[b,$i(p,b.a),p.na(b.a[0]),s,y*u])},this);nj(b,n);pj(b,n);f=this.i;Md(f);Pd(f,(A[0]-z[0])/(z[2]-z[0]),(A[1]-z[1])/(z[3]-z[1]));0!==g.rotation&&Rd(f,g.rotation);Qd(f,b.size[0]*g.resolution/(z[2]-z[0]),b.size[1]*g.resolution/(z[3]-z[1]));Pd(f,-.5,-.5);return!0};
l.cc=function(b,c,d,e){if(null!==this.f){var f=[0,0];ij(this.i,[b[0]/c.size[0],(c.size[1]-b[1])/c.size[1]],f);b=[f[0]*this.e,f[1]*this.e];c=this.b.c.a;c.bindFramebuffer(c.FRAMEBUFFER,this.f);f=new Uint8Array(4);c.readPixels(b[0],b[1],1,1,c.RGBA,c.UNSIGNED_BYTE,f);if(0<f[3])return d.call(e,this.a)}};function Co(b,c){ro.call(this,b,c);this.n=!1;this.H=-1;this.D=NaN;this.p=Td();this.g=this.c=this.r=null}v(Co,ro);l=Co.prototype;l.Nf=function(b,c,d){this.g=c;var e=b.viewState,f=this.c;if(null!==f&&!f.la()){var g=e.center,h=e.resolution,e=e.rotation,k=b.size,n=b.pixelRatio,p=c.opacity,q=c.brightness,r=c.contrast,s=c.hue;c=c.saturation;b=b.skippedFeatureUids;var u,z,y;u=0;for(z=fm.length;u<z;++u)y=f.d[fm[u]],m(y)&&y.bc(d,g,h,e,k,n,p,q,r,s,c,b,void 0,!1)}};
l.P=function(){var b=this.c;null!==b&&(co(b,this.b.c)(),this.c=null);Co.T.P.call(this)};l.Ua=function(b,c,d,e){if(null!==this.c&&null!==this.g){var f=c.viewState,g=this.a,h=this.g,k={};return this.c.b(b,this.b.c,f.center,f.resolution,f.rotation,c.size,c.pixelRatio,h.opacity,h.brightness,h.contrast,h.hue,h.saturation,c.skippedFeatureUids,function(b){var c=ma(b).toString();if(!(c in k))return k[c]=!0,d.call(e,b,g)})}};
l.Hd=function(b,c){if(null===this.c||null===this.g)return!1;var d=c.viewState,e=this.g;return io(this.c,b,this.b.c,d.resolution,d.rotation,c.pixelRatio,e.opacity,e.brightness,e.contrast,e.hue,e.saturation,c.skippedFeatureUids)};l.cc=function(b,c,d,e){b=b.slice();ij(c.pixelToCoordinateMatrix,b,b);if(this.Hd(b,c))return d.call(e,this.a)};l.Xj=function(){kj(this)};
l.Ce=function(b,c,d){function e(b){var c;m(b.a)?c=b.a.call(b,n):m(f.r)&&(c=(0,f.r)(b,n));if(null!=c){if(null!=c){var d,e,g=!1;d=0;for(e=c.length;d<e;++d)g=Xm(s,b,c[d],Wm(n,p),this.Xj,this)||g;b=g}else b=!1;this.n=this.n||b}}var f=this.a;c=f.a();oj(b.attributions,c.f);pj(b,c);if(!this.n&&(!f.Ac&&b.viewHints[0]||b.viewHints[1]))return!0;var g=b.extent,h=b.viewState,k=h.projection,n=h.resolution,p=b.pixelRatio,h=f.d,q=f.ea,r=f.get("renderOrder");m(r)||(r=Vm);g=Xd(g,q*n);if(!this.n&&this.D==n&&this.H==
h&&this.r==r&&$d(this.p,g))return!0;null===this.c||b.postRenderFunctions.push(co(this.c,d));this.n=!1;var s=new bo(.5*n/p,g,f.ea);c.Hb(g,n,k);if(null===r)c.Fb(g,n,e,this);else{var u=[];c.Fb(g,n,function(b){u.push(b)},this);db(u,r);Qa(u,e,this)}eo(s,d);this.D=n;this.H=h;this.r=r;this.p=g;this.c=s;return!0};function Do(b,c){yj.call(this,0,c);this.a=Df("CANVAS");this.a.style.width="100%";this.a.style.height="100%";this.a.className="ol-unselectable";Gf(b,this.a,0);this.p=0;this.r=Mf();this.k=!0;this.f=Tf(this.a,{antialias:!0,depth:!1,vh:!0,preserveDrawingBuffer:!1,stencil:!0});this.c=new Pn(this.a,this.f);w(this.a,"webglcontextlost",this.Vj,!1,this);w(this.a,"webglcontextrestored",this.Wj,!1,this);this.d=new Qi;this.o=null;this.i=new Dj(ra(function(b){var c=b[1];b=b[2];var f=c[0]-this.o[0],c=c[1]-this.o[1];
return 65536*Math.log(b)+Math.sqrt(f*f+c*c)/b},this),function(b){return b[0].qb()});this.D=ra(function(){if(!this.i.la()){Hj(this.i);var b=Ej(this.i);Bo(this,b[0],b[3],b[4])}},this);this.n=0;Eo(this)}v(Do,yj);
function Bo(b,c,d,e){var f=b.f,g=c.qb();if(Ri(b.d,g))b=b.d.get(g),f.bindTexture(3553,b.Wa),9729!=b.Af&&(f.texParameteri(3553,10240,9729),b.Af=9729),9729!=b.Bf&&(f.texParameteri(3553,10240,9729),b.Bf=9729);else{var h=f.createTexture();f.bindTexture(3553,h);if(0<e){var k=b.r.canvas,n=b.r;b.p!=d?(k.width=d,k.height=d,b.p=d):n.clearRect(0,0,d,d);n.drawImage(c.Ta(),e,e,d,d,0,0,d,d);f.texImage2D(3553,0,6408,6408,5121,k)}else f.texImage2D(3553,0,6408,6408,5121,c.Ta());f.texParameteri(3553,10240,9729);f.texParameteri(3553,
10241,9729);f.texParameteri(3553,10242,33071);f.texParameteri(3553,10243,33071);b.d.set(g,{Wa:h,Af:9729,Bf:9729})}}l=Do.prototype;l.ne=function(b){return b instanceof H?new uo(this,b):b instanceof I?new Ao(this,b):b instanceof J?new Co(this,b):null};
function Fo(b,c,d){var e=b.g;if(kd(e,c)){var f=b.c,g=d.extent,h=d.size,k=d.viewState,n=d.pixelRatio,p=k.resolution,q=k.center,r=k.rotation,k=new jo(f,q,p,r,h,g,n),g=new bo(.5*p/n,g);e.dispatchEvent(new Yk(c,e,k,g,d,null,f));eo(g,f);if(!g.la()){var s=Go;c=s.opacity;d=s.brightness;var e=s.contrast,u=s.hue,s=s.saturation,z={},y,A,D;y=0;for(A=fm.length;y<A;++y)D=g.d[fm[y]],m(D)&&D.bc(f,q,p,r,h,n,c,d,e,u,s,z,void 0,!1)}co(g,f)();f=Sa(sb(k.d),Number);db(f);h=0;for(n=f.length;h<n;++h)for(p=k.d[f[h].toString()],
q=0,r=p.length;q<r;++q)p[q](k);b.b=g}}l.P=function(){var b=this.f;b.isContextLost()||this.d.forEach(function(c){null===c||b.deleteTexture(c.Wa)});qc(this.c);Do.T.P.call(this)};l.sh=function(b,c){for(var d=this.f,e;1024<this.d.Tb()-this.n;){e=this.d.a.hc;if(null===e)if(+this.d.a.Cd==c.index)break;else--this.n;else d.deleteTexture(e.Wa);this.d.pop()}};l.O=function(){return"webgl"};l.Vj=function(b){b.preventDefault();this.d.clear();this.n=0;ob(this.e,function(b){b.Be()})};l.Wj=function(){Eo(this);this.g.render()};
function Eo(b){b=b.f;b.activeTexture(33984);b.blendFuncSeparate(770,771,1,771);b.disable(2884);b.disable(2929);b.disable(3089);b.disable(2960)}
l.Yd=function(b){var c=this.c,d=this.f;if(d.isContextLost())return!1;if(null===b)return this.k&&(Lg(this.a,!1),this.k=!1),!1;this.o=b.focus;this.d.set((-b.index).toString(),null);++this.n;var e=[],f=b.layerStatesArray,g=b.viewState.resolution,h,k,n,p;h=0;for(k=f.length;h<k;++h)p=f[h],Mi(p,g)&&"ready"==p.yc&&(n=Bj(this,p.layer),n.Ce(b,p,c)&&e.push(p));f=b.size[0]*b.pixelRatio;g=b.size[1]*b.pixelRatio;if(this.a.width!=f||this.a.height!=g)this.a.width=f,this.a.height=g;d.bindFramebuffer(36160,null);
d.clearColor(0,0,0,0);d.clear(16384);d.enable(3042);d.viewport(0,0,this.a.width,this.a.height);Fo(this,"precompose",b);h=0;for(k=e.length;h<k;++h)p=e[h],n=Bj(this,p.layer),n.Nf(b,p,c);this.k||(Lg(this.a,!0),this.k=!0);zj(b);1024<this.d.Tb()-this.n&&b.postRenderFunctions.push(ra(this.sh,this));this.i.la()||(b.postRenderFunctions.push(this.D),b.animate=!0);Fo(this,"postcompose",b);Cj(this,b);b.postRenderFunctions.push(Aj)};
l.ze=function(b,c,d,e,f,g){var h;if(this.f.isContextLost())return!1;var k=this.c,n=c.viewState;if(null!==this.b){var p={},q=Go;if(h=this.b.b(b,k,n.center,n.resolution,n.rotation,c.size,c.pixelRatio,q.opacity,q.brightness,q.contrast,q.hue,q.saturation,{},function(b){var c=ma(b).toString();if(!(c in p))return p[c]=!0,d.call(e,b,null)}))return h}k=c.layerStatesArray;for(q=k.length-1;0<=q;--q){h=k[q];var r=h.layer;if(Mi(h,n.resolution)&&f.call(g,r)&&(h=Bj(this,r).Ua(b,c,d,e)))return h}};
l.Mf=function(b,c,d,e){var f=!1;if(this.f.isContextLost())return!1;var g=this.c,h=c.viewState;if(null!==this.b&&(f=Go,f=io(this.b,b,g,h.resolution,h.rotation,c.pixelRatio,f.opacity,f.brightness,f.contrast,f.hue,f.saturation,{})))return!0;var g=c.layerStatesArray,k;for(k=g.length-1;0<=k;--k){var n=g[k],p=n.layer;if(Mi(n,h.resolution)&&d.call(e,p)&&(f=Bj(this,p).Hd(b,c)))return!0}return f};
l.Lf=function(b,c,d,e,f){if(this.f.isContextLost())return!1;var g=this.c,h=c.viewState,k;if(null!==this.b){var n=Go;k=this.g.ra(b);if(io(this.b,k,g,h.resolution,h.rotation,c.pixelRatio,n.opacity,n.brightness,n.contrast,n.hue,n.saturation,{})&&(k=d.call(e,null)))return k}g=c.layerStatesArray;for(n=g.length-1;0<=n;--n){k=g[n];var p=k.layer;if(Mi(k,h.resolution)&&f.call(e,p)&&(k=Bj(this,p).cc(b,c,d,e)))return k}};var Go={opacity:1,brightness:0,contrast:1,hue:0,saturation:1};var Ho=["canvas","webgl","dom"];
function L(b){rd.call(this);var c=Io(b);this.xc=m(b.loadTilesWhileAnimating)?b.loadTilesWhileAnimating:!1;this.yc=m(b.loadTilesWhileInteracting)?b.loadTilesWhileInteracting:!1;this.Ac=m(b.pixelRatio)?b.pixelRatio:Vf;this.zc=c.logos;this.r=new ih(this.Rl,void 0,this);pc(this,this.r);this.vc=Id();this.ad=Id();this.wc=0;this.c=null;this.Ea=Td();this.o=this.W=null;this.b=Af("DIV","ol-viewport");this.b.style.position="relative";this.b.style.overflow="hidden";this.b.style.width="100%";this.b.style.height=
"100%";this.b.style.msTouchAction="none";ag&&(this.b.className="ol-touch");this.ka=Af("DIV","ol-overlaycontainer");this.b.appendChild(this.ka);this.H=Af("DIV","ol-overlaycontainer-stopevent");w(this.H,["click","dblclick","mousedown","touchstart","MSPointerDown",Fi,Hb?"DOMMouseScroll":"mousewheel"],tc);this.b.appendChild(this.H);b=new xi(this);w(b,rb(Ii),this.uf,!1,this);pc(this,b);this.fa=c.keyboardEventTarget;this.D=new Ch;w(this.D,"key",this.sf,!1,this);pc(this,this.D);b=new Kh(this.b);w(b,"mousewheel",
this.sf,!1,this);pc(this,b);this.i=c.controls;this.g=c.interactions;this.k=c.overlays;this.p=new c.Tl(this.b,this);pc(this,this.p);this.jc=new xh;pc(this,this.jc);w(this.jc,"resize",this.q,!1,this);this.ca=null;this.N=[];this.va=[];this.kb=new Ij(ra(this.fi,this),ra(this.Aj,this));this.da={};w(this,vd("layergroup"),this.yi,!1,this);w(this,vd("view"),this.Bj,!1,this);w(this,vd("size"),this.Oi,!1,this);w(this,vd("target"),this.Pi,!1,this);this.C(c.qm);this.i.forEach(function(b){b.setMap(this)},this);
w(this.i,"add",function(b){b.element.setMap(this)},!1,this);w(this.i,"remove",function(b){b.element.setMap(null)},!1,this);this.g.forEach(function(b){b.setMap(this)},this);w(this.g,"add",function(b){b.element.setMap(this)},!1,this);w(this.g,"remove",function(b){b.element.setMap(null)},!1,this);this.k.forEach(function(b){b.setMap(this)},this);w(this.k,"add",function(b){b.element.setMap(this)},!1,this);w(this.k,"remove",function(b){b.element.setMap(null)},!1,this)}v(L,rd);l=L.prototype;l.gh=function(b){this.i.push(b)};
l.hh=function(b){this.g.push(b)};l.bf=function(b){this.Ub().ac().push(b)};l.cf=function(b){this.k.push(b)};l.La=function(b){this.render();Array.prototype.push.apply(this.N,arguments)};l.P=function(){Hf(this.b);L.T.P.call(this)};l.qe=function(b,c,d,e,f){if(null!==this.c)return b=this.ra(b),this.p.ze(b,this.c,c,m(d)?d:null,m(e)?e:cd,m(f)?f:null)};l.zj=function(b,c,d,e,f){if(null!==this.c)return this.p.Lf(b,this.c,c,m(d)?d:null,m(e)?e:cd,m(f)?f:null)};
l.Ri=function(b,c,d){if(null===this.c)return!1;b=this.ra(b);return this.p.Mf(b,this.c,m(c)?c:cd,m(d)?d:null)};l.Eh=function(b){return this.ra(this.hd(b))};l.hd=function(b){if(m(b.changedTouches)){var c=b.changedTouches[0];b=Ig(this.b);return[c.clientX-b.x,c.clientY-b.y]}c=this.b;b=Ig(b);c=Ig(c);c=new rf(b.x-c.x,b.y-c.y);return[c.x,c.y]};l.Fd=function(){return this.get("target")};L.prototype.getTarget=L.prototype.Fd;l=L.prototype;l.Mc=function(){var b=this.Fd();return m(b)?wf(b):null};
l.ra=function(b){var c=this.c;if(null===c)return null;b=b.slice();return ij(c.pixelToCoordinateMatrix,b,b)};l.Ch=function(){return this.i};l.Yh=function(){return this.k};l.Lh=function(){return this.g};l.Ub=function(){return this.get("layergroup")};L.prototype.getLayerGroup=L.prototype.Ub;L.prototype.ea=function(){return this.Ub().ac()};L.prototype.e=function(b){var c=this.c;if(null===c)return null;b=b.slice(0,2);return ij(c.coordinateToPixelMatrix,b,b)};L.prototype.f=function(){return this.get("size")};
L.prototype.getSize=L.prototype.f;L.prototype.a=function(){return this.get("view")};L.prototype.getView=L.prototype.a;l=L.prototype;l.hi=function(){return this.b};l.fi=function(b,c,d,e){var f=this.c;if(!(null!==f&&c in f.wantedTiles&&f.wantedTiles[c][kf(b.a)]))return Infinity;b=d[0]-f.focus[0];d=d[1]-f.focus[1];return 65536*Math.log(e)+Math.sqrt(b*b+d*d)/e};l.sf=function(b,c){var d=new vi(c||b.type,this,b);this.uf(d)};
l.uf=function(b){if(null!==this.c){this.ca=b.coordinate;b.frameState=this.c;var c=this.g.a,d;if(!1!==this.dispatchEvent(b))for(d=c.length-1;0<=d;d--){var e=c[d];if(e.b()&&!e.handleEvent(b))break}}};
l.Mi=function(){var b=this.c,c=this.kb;if(!c.la()){var d=16,e=d,f=0;null!==b&&(f=b.viewHints,f[0]&&(d=this.xc?8:0,e=2),f[1]&&(d=this.yc?8:0,e=2),f=qb(b.wantedTiles));d*=f;e*=f;if(c.c<d){Hj(c);d=Math.min(d-c.c,e,c.Tb());for(e=0;e<d;++e)f=Ej(c)[0],w(f,"change",c.g,!1,c),f.load();c.c+=d}}c=this.va;d=0;for(e=c.length;d<e;++d)c[d](this,b);c.length=0};l.Oi=function(){this.render()};
l.Pi=function(){var b=this.Mc();Jh(this.D);null===b?Hf(this.b):(b.appendChild(this.b),Dh(this.D,null===this.fa?b:this.fa));this.q()};l.Aj=function(){this.render()};l.Qi=function(){this.render()};l.Bj=function(){null!==this.W&&(Xc(this.W),this.W=null);var b=this.a();null!==b&&(this.W=w(b,"propertychange",this.Qi,!1,this));this.render()};l.zi=function(){this.render()};l.Ai=function(){this.render()};
l.yi=function(){if(null!==this.o){for(var b=this.o.length,c=0;c<b;++c)Xc(this.o[c]);this.o=null}b=this.Ub();null!=b&&(this.o=[w(b,"propertychange",this.Ai,!1,this),w(b,"change",this.zi,!1,this)]);this.render()};l.Sl=function(){var b=this.r;jh(b);b.kf()};l.render=function(){null!=this.r.aa||this.r.start()};l.Ml=function(b){if(m(this.i.remove(b)))return b};l.Nl=function(b){var c;m(this.g.remove(b))&&(c=b);return c};l.Ol=function(b){return this.Ub().ac().remove(b)};l.Pl=function(b){if(m(this.k.remove(b)))return b};
l.Rl=function(b){var c,d,e,f=this.f(),g=this.a(),h=null;if(c=m(f)&&0<f[0]&&0<f[1]&&null!==g)c=null!=g.b()&&m(g.a());if(c){var h=g.q.slice(),k=this.Ub().Xa(),n={};c=0;for(d=k.length;c<d;++c)n[ma(k[c].layer)]=k[c];e=Ye(g);h={animate:!1,attributions:{},coordinateToPixelMatrix:this.vc,extent:null,focus:null===this.ca?e.center:this.ca,index:this.wc++,layerStates:n,layerStatesArray:k,logos:Bb(this.zc),pixelRatio:this.Ac,pixelToCoordinateMatrix:this.ad,postRenderFunctions:[],size:f,skippedFeatureUids:this.da,
tileQueue:this.kb,time:b,usedTiles:{},viewState:e,viewHints:h,wantedTiles:{}}}if(null!==h){b=this.N;c=f=0;for(d=b.length;c<d;++c)g=b[c],g(this,h)&&(b[f++]=g);b.length=f;h.extent=ne(e.center,e.resolution,e.rotation,h.size)}this.c=h;this.p.Yd(h);null!==h&&(h.animate&&this.render(),Array.prototype.push.apply(this.va,h.postRenderFunctions),0!==this.N.length||h.viewHints[0]||h.viewHints[1]||de(h.extent,this.Ea)||(this.dispatchEvent(new Sg("moveend",this,h)),Yd(h.extent,this.Ea)));this.dispatchEvent(new Sg("postrender",
this,h));nh(this.Mi,this)};l.tg=function(b){this.set("layergroup",b)};L.prototype.setLayerGroup=L.prototype.tg;L.prototype.S=function(b){this.set("size",b)};L.prototype.setSize=L.prototype.S;L.prototype.ia=function(b){this.set("target",b)};L.prototype.setTarget=L.prototype.ia;L.prototype.Fa=function(b){this.set("view",b)};L.prototype.setView=L.prototype.Fa;L.prototype.Xa=function(b){b=ma(b).toString();this.da[b]=!0;this.render()};
L.prototype.q=function(){var b=this.Mc();if(null===b)this.S(void 0);else{var c=vf(b),d=Gb&&b.currentStyle;d&&Kf(tf(c))&&"auto"!=d.width&&"auto"!=d.height&&!d.boxSizing?(c=Mg(b,d.width,"width","pixelWidth"),b=Mg(b,d.height,"height","pixelHeight"),b=new sf(c,b)):(d=new sf(b.offsetWidth,b.offsetHeight),c=Og(b,"padding"),b=Rg(b),b=new sf(d.width-b.left-c.left-c.right-b.right,d.height-b.top-c.top-c.bottom-b.bottom));this.S([b.width,b.height])}};
L.prototype.ic=function(b){b=ma(b).toString();delete this.da[b];this.render()};
function Io(b){var c=null;m(b.keyboardEventTarget)&&(c=ia(b.keyboardEventTarget)?document.getElementById(b.keyboardEventTarget):b.keyboardEventTarget);var d={},e={};if(!m(b.logo)||"boolean"==typeof b.logo&&b.logo)e["data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAAHGAAABxgEXwfpGAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAhNQTFRF////AP//AICAgP//AFVVQECA////K1VVSbbbYL/fJ05idsTYJFtbbcjbJllmZszWWMTOIFhoHlNiZszTa9DdUcHNHlNlV8XRIVdiasrUHlZjIVZjaMnVH1RlIFRkH1RkH1ZlasvYasvXVsPQH1VkacnVa8vWIVZjIFRjVMPQa8rXIVVkXsXRsNveIFVkIFZlIVVj3eDeh6GmbMvXH1ZkIFRka8rWbMvXIFVkIFVjIFVkbMvWH1VjbMvWIFVlbcvWIFVla8vVIFVkbMvWbMvVH1VkbMvWIFVlbcvWIFVkbcvVbMvWjNPbIFVkU8LPwMzNIFVkbczWIFVkbsvWbMvXIFVkRnB8bcvW2+TkW8XRIFVkIlZlJVloJlpoKlxrLl9tMmJwOWd0Omh1RXF8TneCT3iDUHiDU8LPVMLPVcLPVcPQVsPPVsPQV8PQWMTQWsTQW8TQXMXSXsXRX4SNX8bSYMfTYcfTYsfTY8jUZcfSZsnUaIqTacrVasrVa8jTa8rWbI2VbMvWbcvWdJObdcvUdszUd8vVeJaee87Yfc3WgJyjhqGnitDYjaarldPZnrK2oNbborW5o9bbo9fbpLa6q9ndrL3ArtndscDDutzfu8fJwN7gwt7gxc/QyuHhy+HizeHi0NfX0+Pj19zb1+Tj2uXk29/e3uLg3+Lh3+bl4uXj4ufl4+fl5Ofl5ufl5ujm5+jmySDnBAAAAFp0Uk5TAAECAgMEBAYHCA0NDg4UGRogIiMmKSssLzU7PkJJT1JTVFliY2hrdHZ3foSFhYeJjY2QkpugqbG1tre5w8zQ09XY3uXn6+zx8vT09vf4+Pj5+fr6/P39/f3+gz7SsAAAAVVJREFUOMtjYKA7EBDnwCPLrObS1BRiLoJLnte6CQy8FLHLCzs2QUG4FjZ5GbcmBDDjxJBXDWxCBrb8aM4zbkIDzpLYnAcE9VXlJSWlZRU13koIeW57mGx5XjoMZEUqwxWYQaQbSzLSkYGfKFSe0QMsX5WbjgY0YS4MBplemI4BdGBW+DQ11eZiymfqQuXZIjqwyadPNoSZ4L+0FVM6e+oGI6g8a9iKNT3o8kVzNkzRg5lgl7p4wyRUL9Yt2jAxVh6mQCogae6GmflI8p0r13VFWTHBQ0rWPW7ahgWVcPm+9cuLoyy4kCJDzCm6d8PSFoh0zvQNC5OjDJhQopPPJqph1doJBUD5tnkbZiUEqaCnB3bTqLTFG1bPn71kw4b+GFdpLElKIzRxxgYgWNYc5SCENVHKeUaltHdXx0dZ8uBI1hJ2UUDgq82CM2MwKeibqAvSO7MCABq0wXEPiqWEAAAAAElFTkSuQmCC"]="http://openlayers.org/";
else{var f=b.logo;ia(f)?e[f]="":la(f)&&(e[f.src]=f.href)}f=b.layers instanceof G?b.layers:new G({layers:b.layers});d.layergroup=f;d.target=b.target;d.view=m(b.view)?b.view:new B;var f=yj,g;m(b.renderer)?ga(b.renderer)?g=b.renderer:ia(b.renderer)&&(g=[b.renderer]):g=Ho;var h,k;h=0;for(k=g.length;h<k;++h){var n=g[h];if("canvas"==n){if(Yf){f=vn;break}}else if("dom"==n){f=Dn;break}else if("webgl"==n&&Uf){f=Do;break}}var p;m(b.controls)?p=ga(b.controls)?new kg(b.controls.slice()):b.controls:p=$g();var q;
m(b.interactions)?q=ga(b.interactions)?new kg(b.interactions.slice()):b.interactions:q=Kl();b=m(b.overlays)?ga(b.overlays)?new kg(b.overlays.slice()):b.overlays:new kg;return{controls:p,interactions:q,keyboardEventTarget:c,logos:e,overlays:b,Tl:f,qm:d}}Rl();function N(b){rd.call(this);this.H=m(b.insertFirst)?b.insertFirst:!0;this.N=m(b.stopEvent)?b.stopEvent:!0;this.ba=Af("DIV",{"class":"ol-overlay-container"});this.ba.style.position="absolute";this.D=m(b.autoPan)?b.autoPan:!1;this.g=m(b.autoPanAnimation)?b.autoPanAnimation:{};this.r=m(b.autoPanMargin)?b.autoPanMargin:20;this.a={bd:"",Dd:"",Zd:"",$d:"",visible:!0};this.f=null;w(this,vd("element"),this.ri,!1,this);w(this,vd("map"),this.Gi,!1,this);w(this,vd("offset"),this.Ii,!1,this);w(this,vd("position"),
this.Ki,!1,this);w(this,vd("positioning"),this.Li,!1,this);m(b.element)&&this.Me(b.element);this.o(m(b.offset)?b.offset:[0,0]);this.p(m(b.positioning)?b.positioning:"top-left");m(b.position)&&this.e(b.position)}v(N,rd);N.prototype.b=function(){return this.get("element")};N.prototype.getElement=N.prototype.b;N.prototype.c=function(){return this.get("map")};N.prototype.getMap=N.prototype.c;N.prototype.i=function(){return this.get("offset")};N.prototype.getOffset=N.prototype.i;N.prototype.q=function(){return this.get("position")};
N.prototype.getPosition=N.prototype.q;N.prototype.k=function(){return this.get("positioning")};N.prototype.getPositioning=N.prototype.k;l=N.prototype;l.ri=function(){Ff(this.ba);var b=this.b();null!=b&&Ef(this.ba,b)};l.Gi=function(){null!==this.f&&(Hf(this.ba),Xc(this.f),this.f=null);var b=this.c();null!=b&&(this.f=w(b,"postrender",this.render,!1,this),Jo(this),b=this.N?b.H:b.ka,this.H?Gf(b,this.ba,0):Ef(b,this.ba))};l.render=function(){Jo(this)};l.Ii=function(){Jo(this)};
l.Ki=function(){Jo(this);if(m(this.get("position"))&&this.D){var b=this.c();if(m(b)&&!fa(b.Mc())){var c=Ko(b.Mc(),b.f()),d=this.b(),e=d.offsetWidth,f=d.currentStyle||window.getComputedStyle(d),e=e+(parseInt(f.marginLeft,10)+parseInt(f.marginRight,10)),f=d.offsetHeight,g=d.currentStyle||window.getComputedStyle(d),f=f+(parseInt(g.marginTop,10)+parseInt(g.marginBottom,10)),h=Ko(d,[e,f]),d=this.r;$d(c,h)||(e=h[0]-c[0],f=c[2]-h[2],g=h[1]-c[1],h=c[3]-h[3],c=[0,0],0>e?c[0]=e-d:0>f&&(c[0]=Math.abs(f)+d),
0>g?c[1]=g-d:0>h&&(c[1]=Math.abs(h)+d),0===c[0]&&0===c[1])||(d=b.a().b(),e=b.e(d),c=[e[0]+c[0],e[1]+c[1]],null!==this.g&&(this.g.source=d,b.La(df(this.g))),b.a().Ha(b.ra(c)))}}};l.Li=function(){Jo(this)};l.Me=function(b){this.set("element",b)};N.prototype.setElement=N.prototype.Me;N.prototype.setMap=function(b){this.set("map",b)};N.prototype.setMap=N.prototype.setMap;N.prototype.o=function(b){this.set("offset",b)};N.prototype.setOffset=N.prototype.o;N.prototype.e=function(b){this.set("position",b)};
N.prototype.setPosition=N.prototype.e;function Ko(b,c){var d=vf(b);Eg(b,"position");var e=new rf(0,0),f;f=d?vf(d):document;f=!Gb||Gb&&9<=Sb||Kf(tf(f))?f.documentElement:f.body;b!=f&&(f=Hg(b),d=Lf(tf(d)),e.x=f.left+d.x,e.y=f.top+d.y);return[e.x,e.y,e.x+c[0],e.y+c[1]]}N.prototype.p=function(b){this.set("positioning",b)};N.prototype.setPositioning=N.prototype.p;
function Jo(b){var c=b.c(),d=b.q();if(m(c)&&null!==c.c&&m(d)){var d=c.e(d),e=c.f(),c=b.ba.style,f=b.i(),g=b.k(),h=f[0],f=f[1];if("bottom-right"==g||"center-right"==g||"top-right"==g)""!==b.a.Dd&&(b.a.Dd=c.left=""),h=Math.round(e[0]-d[0]-h)+"px",b.a.Zd!=h&&(b.a.Zd=c.right=h);else{""!==b.a.Zd&&(b.a.Zd=c.right="");if("bottom-center"==g||"center-center"==g||"top-center"==g)h-=Jg(b.ba).width/2;h=Math.round(d[0]+h)+"px";b.a.Dd!=h&&(b.a.Dd=c.left=h)}if("bottom-left"==g||"bottom-center"==g||"bottom-right"==
g)""!==b.a.$d&&(b.a.$d=c.top=""),d=Math.round(e[1]-d[1]-f)+"px",b.a.bd!=d&&(b.a.bd=c.bottom=d);else{""!==b.a.bd&&(b.a.bd=c.bottom="");if("center-left"==g||"center-center"==g||"center-right"==g)f-=Jg(b.ba).height/2;d=Math.round(d[1]+f)+"px";b.a.$d!=d&&(b.a.$d=c.top=d)}b.a.visible||(Lg(b.ba,!0),b.a.visible=!0)}else b.a.visible&&(Lg(b.ba,!1),b.a.visible=!1)};function Lo(b){b=m(b)?b:{};this.e=m(b.collapsed)?b.collapsed:!0;this.g=m(b.collapsible)?b.collapsible:!0;this.g||(this.e=!1);var c=m(b.className)?b.className:"ol-overviewmap",d=m(b.tipLabel)?b.tipLabel:"Overview map",e=m(b.collapseLabel)?b.collapseLabel:"\u00ab";this.o=ia(e)?Af("SPAN",{},e):e;e=m(b.label)?b.label:"\u00bb";this.p=ia(e)?Af("SPAN",{},e):e;d=Af("BUTTON",{type:"button",title:d},this.g&&!this.e?this.o:this.p);w(d,"click",this.Jj,!1,this);w(d,["mouseout",vc],function(){this.blur()},!1);
var e=Af("DIV","ol-overviewmap-map"),f=this.c=new L({controls:new kg,interactions:new kg,target:e});m(b.layers)&&b.layers.forEach(function(b){f.bf(b)},this);var g=Af("DIV","ol-overviewmap-box");this.k=new N({position:[0,0],positioning:"bottom-left",element:g});this.c.cf(this.k);c=Af("DIV",c+" ol-unselectable ol-control"+(this.e&&this.g?" ol-collapsed":"")+(this.g?"":" ol-uncollapsible"),e,d);Tg.call(this,{element:c,render:m(b.render)?b.render:Mo,target:b.target})}v(Lo,Tg);l=Lo.prototype;
l.setMap=function(b){var c=this.a;null===b&&null!==c&&Wc(c,vd("view"),this.Gf,!1,this);Lo.T.setMap.call(this,b);null!==b&&(0===this.c.ea().Ib()&&this.c.K("layergroup",b),No(this),w(b,vd("view"),this.Gf,!1,this),this.c.q(),Oo(this))};function No(b){var c=b.a.a();null===c||b.c.a().K("rotation",c)}
function Mo(){var b=this.a,c=this.c;if(null!==b.c&&null!==c.c){var d=b.f(),b=b.a().g(d),e=c.f(),d=c.a().g(e),f=c.e(ke(b)),c=c.e(ie(b)),c=new sf(Math.abs(f[0]-c[0]),Math.abs(f[1]-c[1])),f=e[0],e=e[1];c.width<.1*f||c.height<.1*e||c.width>.75*f||c.height>.75*e?Oo(this):$d(d,b)||(b=this.c,d=this.a.a(),b.a().Ha(d.b()))}Po(this)}l.Gf=function(){No(this)};function Oo(b){var c=b.a;b=b.c;var d=c.f(),c=c.a().g(d),d=b.f();b=b.a();var e=Math.log(7.5)/Math.LN2;te(c,1/(.1*Math.pow(2,e/2)));b.pe(c,d)}
function Po(b){var c=b.a,d=b.c;if(null!==c.c&&null!==d.c){var e=c.f(),f=c.a(),g=d.a();d.f();var c=f.c(),h=b.k,d=b.k.b(),f=f.g(e),e=g.a(),g=he(f),f=je(f),k;b=b.a.a().b();m(b)&&(k=[g[0]-b[0],g[1]-b[1]],Bd(k,c),wd(k,b));h.e(k);null!=d&&(k=new sf(Math.abs((g[0]-f[0])/e),Math.abs((f[1]-g[1])/e)),c=Kf(tf(vf(d))),!Gb||Qb("10")||c&&Qb("8")?(d=d.style,Hb?d.MozBoxSizing="border-box":Ib?d.WebkitBoxSizing="border-box":d.boxSizing="border-box",d.width=Math.max(k.width,0)+"px",d.height=Math.max(k.height,0)+"px"):
(b=d.style,c?(c=Og(d,"padding"),d=Rg(d),b.pixelWidth=k.width-d.left-c.left-c.right-d.right,b.pixelHeight=k.height-d.top-c.top-c.bottom-d.bottom):(b.pixelWidth=k.width,b.pixelHeight=k.height)))}}l.Jj=function(b){b.preventDefault();Qo(this)};function Qo(b){zg(b.element,"ol-collapsed");b.e?If(b.o,b.p):If(b.p,b.o);b.e=!b.e;var c=b.c;b.e||null!==c.c||(c.q(),Oo(b),Vc(c,"postrender",function(){Po(this)},!1,b))}l.Ij=function(){return this.g};
l.Lj=function(b){this.g!==b&&(this.g=b,zg(this.element,"ol-uncollapsible"),!b&&this.e&&Qo(this))};l.Kj=function(b){this.g&&this.e!==b&&Qo(this)};l.Hj=function(){return this.e};function Ro(b){b=m(b)?b:{};var c=m(b.className)?b.className:"ol-scale-line";this.g=Af("DIV",c+"-inner");this.ba=Af("DIV",c+" ol-unselectable",this.g);this.r=null;this.k=m(b.minWidth)?b.minWidth:64;this.c=!1;this.H=void 0;this.D="";this.e=null;Tg.call(this,{element:this.ba,render:m(b.render)?b.render:So,target:b.target});w(this,vd("units"),this.N,!1,this);this.p(b.units||"metric")}v(Ro,Tg);var To=[1,2,5];Ro.prototype.o=function(){return this.get("units")};Ro.prototype.getUnits=Ro.prototype.o;
function So(b){b=b.frameState;null===b?this.r=null:this.r=b.viewState;Uo(this)}Ro.prototype.N=function(){Uo(this)};Ro.prototype.p=function(b){this.set("units",b)};Ro.prototype.setUnits=Ro.prototype.p;
function Uo(b){var c=b.r;if(null===c)b.c&&(Lg(b.ba,!1),b.c=!1);else{var d=c.center,e=c.projection,c=e.te(c.resolution,d),f=e.d,g=b.o();"degrees"!=f||"metric"!=g&&"imperial"!=g&&"us"!=g&&"nautical"!=g?"degrees"!=f&&"degrees"==g?(null===b.e&&(b.e=Ae(e,Be("EPSG:4326"))),d=Math.cos(Zb(b.e(d)[1])),e=we.radius,e/=xe[f],c*=180/(Math.PI*d*e)):b.e=null:(b.e=null,d=Math.cos(Zb(d[1])),c*=Math.PI*d*we.radius/180);d=b.k*c;f="";"degrees"==g?d<1/60?(f="\u2033",c*=3600):1>d?(f="\u2032",c*=60):f="\u00b0":"imperial"==
g?.9144>d?(f="in",c/=.0254):1609.344>d?(f="ft",c/=.3048):(f="mi",c/=1609.344):"nautical"==g?(c/=1852,f="nm"):"metric"==g?1>d?(f="mm",c*=1E3):1E3>d?f="m":(f="km",c/=1E3):"us"==g&&(.9144>d?(f="in",c*=39.37):1609.344>d?(f="ft",c/=.30480061):(f="mi",c/=1609.3472));for(d=3*Math.floor(Math.log(b.k*c)/Math.log(10));;){e=To[d%3]*Math.pow(10,Math.floor(d/3));g=Math.round(e/c);if(isNaN(g)){Lg(b.ba,!1);b.c=!1;return}if(g>=b.k)break;++d}c=e+" "+f;b.D!=c&&(b.g.innerHTML=c,b.D=c);b.H!=g&&(b.g.style.width=g+"px",
b.H=g);b.c||(Lg(b.ba,!0),b.c=!0)}};function Vo(b){mc.call(this);this.d=b;this.a={}}v(Vo,mc);var Wo=[];Vo.prototype.Ra=function(b,c,d,e){ga(c)||(c&&(Wo[0]=c.toString()),c=Wo);for(var f=0;f<c.length;f++){var g=w(b,c[f],d||this.handleEvent,e||!1,this.d||this);if(!g)break;this.a[g.key]=g}return this};
Vo.prototype.Ne=function(b,c,d,e,f){if(ga(c))for(var g=0;g<c.length;g++)this.Ne(b,c[g],d,e,f);else d=d||this.handleEvent,f=f||this.d||this,d=Pc(d),e=!!e,c=Cc(b)?Jc(b.mb,String(c),d,e,f):b?(b=Rc(b))?Jc(b,c,d,e,f):null:null,c&&(Xc(c),delete this.a[c.key]);return this};function Xo(b){ob(b.a,Xc);b.a={}}Vo.prototype.P=function(){Vo.T.P.call(this);Xo(this)};Vo.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented");};function Yo(b,c,d){id.call(this);this.target=b;this.handle=c||b;this.a=d||new Bg(NaN,NaN,NaN,NaN);this.b=vf(b);this.d=new Vo(this);pc(this,this.d);w(this.handle,["touchstart","mousedown"],this.rf,!1,this)}v(Yo,id);var Zo=Gb||Hb&&Qb("1.9.3");l=Yo.prototype;l.clientX=0;l.clientY=0;l.screenX=0;l.screenY=0;l.ug=0;l.vg=0;l.pc=0;l.qc=0;l.Zb=!1;l.P=function(){Yo.T.P.call(this);Wc(this.handle,["touchstart","mousedown"],this.rf,!1,this);Xo(this.d);Zo&&this.b.releaseCapture();this.handle=this.target=null};
l.rf=function(b){var c="mousedown"==b.type;if(this.Zb||c&&!Ac(b))this.dispatchEvent("earlycancel");else if($o(b),this.dispatchEvent(new ap("start",this,b.clientX,b.clientY))){this.Zb=!0;b.preventDefault();var c=this.b,d=c.documentElement,e=!Zo;this.d.Ra(c,["touchmove","mousemove"],this.Hi,e);this.d.Ra(c,["touchend","mouseup"],this.wd,e);Zo?(d.setCapture(!1),this.d.Ra(d,"losecapture",this.wd)):this.d.Ra(c?c.parentWindow||c.defaultView:window,"blur",this.wd);this.f&&this.d.Ra(this.f,"scroll",this.jl,
e);this.clientX=this.ug=b.clientX;this.clientY=this.vg=b.clientY;this.screenX=b.screenX;this.screenY=b.screenY;this.pc=this.target.offsetLeft;this.qc=this.target.offsetTop;this.c=Lf(tf(this.b));ta()}};l.wd=function(b){Xo(this.d);Zo&&this.b.releaseCapture();if(this.Zb){$o(b);this.Zb=!1;var c=bp(this,this.pc),d=cp(this,this.qc);this.dispatchEvent(new ap("end",this,b.clientX,b.clientY,0,c,d))}else this.dispatchEvent("earlycancel")};
function $o(b){var c=b.type;"touchstart"==c||"touchmove"==c?yc(b,b.a.targetTouches[0],b.b):"touchend"!=c&&"touchcancel"!=c||yc(b,b.a.changedTouches[0],b.b)}
l.Hi=function(b){$o(b);var c=1*(b.clientX-this.clientX),d=b.clientY-this.clientY;this.clientX=b.clientX;this.clientY=b.clientY;this.screenX=b.screenX;this.screenY=b.screenY;if(!this.Zb){var e=this.ug-this.clientX,f=this.vg-this.clientY;if(0<e*e+f*f)if(this.dispatchEvent(new ap("start",this,b.clientX,b.clientY)))this.Zb=!0;else{this.oa||this.wd(b);return}}d=dp(this,c,d);c=d.x;d=d.y;this.Zb&&this.dispatchEvent(new ap("beforedrag",this,b.clientX,b.clientY,0,c,d))&&(ep(this,b,c,d),b.preventDefault())};
function dp(b,c,d){var e=Lf(tf(b.b));c+=e.x-b.c.x;d+=e.y-b.c.y;b.c=e;b.pc+=c;b.qc+=d;c=bp(b,b.pc);b=cp(b,b.qc);return new rf(c,b)}l.jl=function(b){var c=dp(this,0,0);b.clientX=this.clientX;b.clientY=this.clientY;ep(this,b,c.x,c.y)};function ep(b,c,d,e){b.target.style.left=d+"px";b.target.style.top=e+"px";b.dispatchEvent(new ap("drag",b,c.clientX,c.clientY,0,d,e))}
function bp(b,c){var d=b.a,e=isNaN(d.left)?null:d.left,d=isNaN(d.width)?0:d.width;return Math.min(null!=e?e+d:Infinity,Math.max(null!=e?e:-Infinity,c))}function cp(b,c){var d=b.a,e=isNaN(d.top)?null:d.top,d=isNaN(d.height)?0:d.height;return Math.min(null!=e?e+d:Infinity,Math.max(null!=e?e:-Infinity,c))}function ap(b,c,d,e,f,g,h){rc.call(this,b);this.clientX=d;this.clientY=e;this.left=m(g)?g:c.pc;this.top=m(h)?h:c.qc}v(ap,rc);function fp(b){b=m(b)?b:{};this.e=void 0;this.g=gp;this.k=null;this.o=!1;var c=m(b.className)?b.className:"ol-zoomslider",d=Af("DIV",[c+"-thumb","ol-unselectable"]),c=Af("DIV",[c,"ol-unselectable","ol-control"],d);this.c=new Yo(d);pc(this,this.c);w(this.c,"start",this.qi,!1,this);w(this.c,"drag",this.oi,!1,this);w(this.c,"end",this.pi,!1,this);w(c,"click",this.ni,!1,this);w(d,"click",tc);Tg.call(this,{element:c,render:m(b.render)?b.render:hp})}v(fp,Tg);var gp=0;l=fp.prototype;
l.setMap=function(b){fp.T.setMap.call(this,b);null===b||b.render()};
function hp(b){if(null!==b.frameState){if(!this.o){var c=this.element,d=Jg(c),e=Jf(c),c=Og(e,"margin"),f=new sf(e.offsetWidth,e.offsetHeight),e=f.width+c.right+c.left,c=f.height+c.top+c.bottom;this.k=[e,c];e=d.width-e;c=d.height-c;d.width>d.height?(this.g=1,d=new Bg(0,0,e,0)):(this.g=gp,d=new Bg(0,0,0,c));this.c.a=d||new Bg(NaN,NaN,NaN,NaN);this.o=!0}b=b.frameState.viewState.resolution;b!==this.e&&(this.e=b,b=1-Xe(this.a.a())(b),d=this.c,c=Jf(this.element),1==this.g?Fg(c,d.a.left+d.a.width*b):Fg(c,
d.a.left,d.a.top+d.a.height*b))}}l.ni=function(b){var c=this.a,d=c.a(),e=d.a();c.La(ff({resolution:e,duration:200,easing:$e}));b=ip(this,b.offsetX-this.k[0]/2,b.offsetY-this.k[1]/2);b=jp(this,b);d.f(d.constrainResolution(b))};l.qi=function(){Ze(this.a.a(),1)};l.oi=function(b){b=ip(this,b.left,b.top);this.e=jp(this,b);this.a.a().f(this.e)};l.pi=function(){var b=this.a,c=b.a();Ze(c,-1);b.La(ff({resolution:this.e,duration:200,easing:$e}));b=c.constrainResolution(this.e);c.f(b)};
function ip(b,c,d){var e=b.c.a;return Wb(1===b.g?(c-e.left)/e.width:(d-e.top)/e.height,0,1)}function jp(b,c){return We(b.a.a())(1-c)};function kp(b){b=m(b)?b:{};this.c=m(b.extent)?b.extent:null;var c=m(b.className)?b.className:"ol-zoom-extent",d=Af("BUTTON",{type:"button",title:m(b.tipLabel)?b.tipLabel:"Fit to extent"},m(b.label)?b.label:"E");w(d,"click",this.e,!1,this);w(d,["mouseout",vc],function(){this.blur()},!1);c=Af("DIV",c+" ol-unselectable ol-control",d);Tg.call(this,{element:c,target:b.target})}v(kp,Tg);
kp.prototype.e=function(b){b.preventDefault();var c=this.a;b=c.a();var d=null===this.c?b.p.J():this.c,c=c.f();b.pe(d,c)};function lp(b){rd.call(this);b=m(b)?b:{};this.a=null;w(this,vd("tracking"),this.k,!1,this);this.b(m(b.tracking)?b.tracking:!1)}v(lp,rd);lp.prototype.P=function(){this.b(!1);lp.T.P.call(this)};
lp.prototype.q=function(b){b=b.a;if(null!=b.alpha){var c=Zb(b.alpha);this.set("alpha",c);"boolean"==typeof b.absolute&&b.absolute?this.set("heading",c):null!=b.webkitCompassHeading&&null!=b.webkitCompassAccuracy&&-1!=b.webkitCompassAccuracy&&this.set("heading",Zb(b.webkitCompassHeading))}null!=b.beta&&this.set("beta",Zb(b.beta));null!=b.gamma&&this.set("gamma",Zb(b.gamma));this.l()};lp.prototype.f=function(){return this.get("alpha")};lp.prototype.getAlpha=lp.prototype.f;lp.prototype.e=function(){return this.get("beta")};
lp.prototype.getBeta=lp.prototype.e;lp.prototype.g=function(){return this.get("gamma")};lp.prototype.getGamma=lp.prototype.g;lp.prototype.i=function(){return this.get("heading")};lp.prototype.getHeading=lp.prototype.i;lp.prototype.c=function(){return this.get("tracking")};lp.prototype.getTracking=lp.prototype.c;lp.prototype.k=function(){if(Zf){var b=this.c();b&&null===this.a?this.a=w(ba,"deviceorientation",this.q,!1,this):b||null===this.a||(Xc(this.a),this.a=null)}};
lp.prototype.b=function(b){this.set("tracking",b)};lp.prototype.setTracking=lp.prototype.b;function mp(b){rd.call(this);this.i=b;w(this.i,["change","input"],this.g,!1,this);w(this,vd("value"),this.k,!1,this);w(this,vd("checked"),this.e,!1,this)}v(mp,rd);mp.prototype.a=function(){return this.get("checked")};mp.prototype.getChecked=mp.prototype.a;mp.prototype.b=function(){return this.get("value")};mp.prototype.getValue=mp.prototype.b;mp.prototype.f=function(b){this.set("value",b)};mp.prototype.setValue=mp.prototype.f;mp.prototype.c=function(b){this.set("checked",b)};
mp.prototype.setChecked=mp.prototype.c;mp.prototype.g=function(){var b=this.i;"checkbox"===b.type||"radio"===b.type?this.c(b.checked):this.f(b.value)};mp.prototype.e=function(){this.i.checked=this.a()};mp.prototype.k=function(){this.i.value=this.b()};function P(b){rd.call(this);this.aa=void 0;this.b="geometry";this.g=null;this.a=void 0;this.e=null;w(this,vd(this.b),this.xd,!1,this);m(b)&&(b instanceof kk||null===b?this.Sa(b):this.C(b))}v(P,rd);P.prototype.clone=function(){var b=new P(this.I());b.f(this.b);var c=this.R();null!=c&&b.Sa(c.clone());c=this.g;null===c||b.i(c);return b};P.prototype.R=function(){return this.get(this.b)};P.prototype.getGeometry=P.prototype.R;l=P.prototype;l.Kh=function(){return this.aa};l.Jh=function(){return this.b};
l.rj=function(){return this.g};l.sj=function(){return this.a};l.xi=function(){this.l()};l.xd=function(){null!==this.e&&(Xc(this.e),this.e=null);var b=this.R();null!=b&&(this.e=w(b,"change",this.xi,!1,this),this.l())};l.Sa=function(b){this.set(this.b,b)};P.prototype.setGeometry=P.prototype.Sa;P.prototype.i=function(b){this.g=b;null===b?b=void 0:ka(b)||(b=ga(b)?b:[b],b=ad(b));this.a=b;this.l()};P.prototype.c=function(b){this.aa=b;this.l()};
P.prototype.f=function(b){Wc(this,vd(this.b),this.xd,!1,this);this.b=b;w(this,vd(this.b),this.xd,!1,this);this.xd()};function np(b){b=m(b)?b:{};this.g=this.f=this.c=this.d=this.b=this.a=null;this.e=void 0;this.Ff(m(b.style)?b.style:tl);m(b.features)?ga(b.features)?this.Tc(new kg(b.features.slice())):this.Tc(b.features):this.Tc(new kg);m(b.map)&&this.setMap(b.map)}l=np.prototype;l.Df=function(b){this.a.push(b)};l.lj=function(){return this.a};l.mj=function(){return this.c};l.Ef=function(){op(this)};l.vi=function(b){b=b.element;this.d[ma(b).toString()]=w(b,"change",this.Ef,!1,this);op(this)};
l.wi=function(b){b=ma(b.element).toString();Xc(this.d[b]);delete this.d[b];op(this)};l.pj=function(){op(this)};l.qj=function(b){if(null!==this.a){var c=this.e;m(c)||(c=tl);var d=b.a;b=b.frameState;var e=b.viewState.resolution,f=Wm(e,b.pixelRatio),g,h,k,n;this.a.forEach(function(b){n=b.a;k=m(n)?n.call(b,e):c(b,e);if(null!=k)for(h=k.length,g=0;g<h;++g)Xm(d,b,k[g],f,this.pj,this)},this)}};l.Ed=function(b){this.a.remove(b)};function op(b){null===b.c||b.c.render()}
l.Tc=function(b){null!==this.b&&(Qa(this.b,Xc),this.b=null);null!==this.d&&(Qa(rb(this.d),Xc),this.d=null);this.a=b;null!==b&&(this.b=[w(b,"add",this.vi,!1,this),w(b,"remove",this.wi,!1,this)],this.d={},b.forEach(function(b){this.d[ma(b).toString()]=w(b,"change",this.Ef,!1,this)},this));op(this)};l.setMap=function(b){null!==this.f&&(Xc(this.f),this.f=null);op(this);this.c=b;null!==b&&(this.f=w(b,"postcompose",this.qj,!1,this),b.render())};l.Ff=function(b){this.g=b;this.e=sl(b);op(this)};l.nj=function(){return this.g};
l.oj=function(){return this.e};function pp(){this.defaultDataProjection=null}function qp(b,c,d){var e;m(d)&&(e={dataProjection:m(d.dataProjection)?d.dataProjection:b.Ja(c),featureProjection:d.featureProjection});return rp(b,e)}function rp(b,c){var d;m(c)&&(d={featureProjection:c.featureProjection,dataProjection:null!=c.dataProjection?c.dataProjection:b.defaultDataProjection});return d}
function sp(b,c,d){var e=m(d)?Be(d.featureProjection):null;d=m(d)?Be(d.dataProjection):null;return null===e||null===d||Se(e,d)?b:b instanceof kk?(c?b.clone():b).transform(c?e:d,c?d:e):Ve(c?b.slice():b,c?e:d,c?d:e)};var tp=ba.JSON.parse,up=ba.JSON.stringify;function vp(){this.defaultDataProjection=null}v(vp,pp);function wp(b){return la(b)?b:ia(b)?(b=tp(b),m(b)?b:null):null}l=vp.prototype;l.O=function(){return"json"};l.Nb=function(b,c){return xp(this,wp(b),qp(this,b,c))};l.ma=function(b,c){return this.b(wp(b),qp(this,b,c))};l.Rc=function(b,c){var d=wp(b),e=qp(this,b,c);return yp(d,e)};l.Ja=function(b){b=wp(b).crs;return null!=b?"name"==b.type?Be(b.properties.name):"EPSG"==b.type?Be("EPSG:"+b.properties.code):null:this.defaultDataProjection};
l.be=function(b,c){return up(this.a(b,c))};l.Qb=function(b,c){return up(this.c(b,c))};l.Xc=function(b,c){return up(this.f(b,c))};function zp(b){b=m(b)?b:{};this.defaultDataProjection=null;this.defaultDataProjection=Be(null!=b.defaultDataProjection?b.defaultDataProjection:"EPSG:4326");this.d=b.geometryName}v(zp,vp);function yp(b,c){return null===b?null:sp((0,Ap[b.type])(b),!1,c)}
var Ap={Point:function(b){return new Ik(b.coordinates)},LineString:function(b){return new K(b.coordinates)},Polygon:function(b){return new F(b.coordinates)},MultiPoint:function(b){return new Rm(b.coordinates)},MultiLineString:function(b){return new Om(b.coordinates)},MultiPolygon:function(b){return new Sm(b.coordinates)},GeometryCollection:function(b,c){var d=Sa(b.geometries,function(b){return yp(b,c)});return new Gm(d)}},Bp={Point:function(b){return{type:"Point",coordinates:b.Q()}},LineString:function(b){return{type:"LineString",
coordinates:b.Q()}},Polygon:function(b){return{type:"Polygon",coordinates:b.Q()}},MultiPoint:function(b){return{type:"MultiPoint",coordinates:b.Q()}},MultiLineString:function(b){return{type:"MultiLineString",coordinates:b.Q()}},MultiPolygon:function(b){return{type:"MultiPolygon",coordinates:b.Q()}},GeometryCollection:function(b,c){return{type:"GeometryCollection",geometries:Sa(b.c,function(b){return(0,Bp[b.O()])(sp(b,!0,c))})}},Circle:function(){return{type:"GeometryCollection",geometries:[]}}};
function xp(b,c,d){d=yp(c.geometry,d);var e=new P;m(b.d)&&e.f(b.d);e.Sa(d);m(c.id)&&e.c(c.id);m(c.properties)&&e.C(c.properties);return e}zp.prototype.b=function(b,c){if("Feature"==b.type)return[xp(this,b,c)];if("FeatureCollection"==b.type){var d=[],e=b.features,f,g;f=0;for(g=e.length;f<g;++f)d.push(xp(this,e[f],c));return d}return[]};
zp.prototype.a=function(b,c){c=rp(this,c);var d={type:"Feature"},e=b.aa;null!=e&&(d.id=e);e=b.R();null!=e&&(d.geometry=(0,Bp[e.O()])(sp(e,!0,c)));e=b.I();yb(e,b.b);d.properties=wb(e)?null:e;return d};zp.prototype.c=function(b,c){c=rp(this,c);var d=[],e,f;e=0;for(f=b.length;e<f;++e)d.push(this.a(b[e],c));return{type:"FeatureCollection",features:d}};zp.prototype.f=function(b,c){return(0,Bp[b.O()])(sp(b,!0,rp(this,c)))};function Cp(b){if("undefined"!=typeof XMLSerializer)return(new XMLSerializer).serializeToString(b);if(b=b.xml)return b;throw Error("Your browser does not support serializing XML documents");};var Dp;a:if(document.implementation&&document.implementation.createDocument)Dp=document.implementation.createDocument("","",null);else{if("undefined"!=typeof ActiveXObject){var Ep=new ActiveXObject("MSXML2.DOMDocument");if(Ep){Ep.resolveExternals=!1;Ep.validateOnParse=!1;try{Ep.setProperty("ProhibitDTD",!0),Ep.setProperty("MaxXMLSize",2048),Ep.setProperty("MaxElementDepth",256)}catch(Fp){}}if(Ep){Dp=Ep;break a}}throw Error("Your browser does not support creating new documents");}var Gp=Dp;
function Hp(b,c){return Gp.createElementNS(b,c)}function Ip(b,c){null===b&&(b="");return Gp.createNode(1,c,b)}var Jp=document.implementation&&document.implementation.createDocument?Hp:Ip;function Kp(b,c){return Lp(b,c,[]).join("")}function Lp(b,c,d){if(4==b.nodeType||3==b.nodeType)c?d.push(String(b.nodeValue).replace(/(\r\n|\r|\n)/g,"")):d.push(b.nodeValue);else for(b=b.firstChild;null!==b;b=b.nextSibling)Lp(b,c,d);return d}function Mp(b){return b.localName}
function Np(b){var c=b.localName;return m(c)?c:b.baseName}var Op=Gb?Np:Mp;function Pp(b){return b instanceof Document}function Qp(b){return la(b)&&9==b.nodeType}var Rp=Gb?Qp:Pp;function Sp(b){return b instanceof Node}function Tp(b){return la(b)&&m(b.nodeType)}var Up=Gb?Tp:Sp;function Vp(b,c,d){return b.getAttributeNS(c,d)||""}function Wp(b,c,d){var e="";b=Xp(b,c,d);m(b)&&(e=b.nodeValue);return e}var Yp=document.implementation&&document.implementation.createDocument?Vp:Wp;
function Zp(b,c,d){return b.getAttributeNodeNS(c,d)}function $p(b,c,d){var e=null;b=b.attributes;for(var f,g,h=0,k=b.length;h<k;++h)if(f=b[h],f.namespaceURI==c&&(g=f.prefix?f.prefix+":"+d:d,g==f.nodeName)){e=f;break}return e}var Xp=document.implementation&&document.implementation.createDocument?Zp:$p;function aq(b,c,d,e){b.setAttributeNS(c,d,e)}function bq(b,c,d,e){null===c?b.setAttribute(d,e):(c=b.ownerDocument.createNode(2,d,c),c.nodeValue=e,b.setAttributeNode(c))}
var cq=document.implementation&&document.implementation.createDocument?aq:bq;function dq(b){return(new DOMParser).parseFromString(b,"application/xml")}function eq(b,c){return function(d,e){var f=b.call(c,d,e);m(f)&&ab(e[e.length-1],f)}}function fq(b,c){return function(d,e){var f=b.call(m(c)?c:this,d,e);m(f)&&e[e.length-1].push(f)}}function gq(b,c){return function(d,e){var f=b.call(m(c)?c:this,d,e);m(f)&&(e[e.length-1]=f)}}
function hq(b){return function(c,d){var e=b.call(m(void 0)?void 0:this,c,d);m(e)&&Ab(d[d.length-1],m(void 0)?void 0:c.localName).push(e)}}function R(b,c){return function(d,e){var f=b.call(m(void 0)?void 0:this,d,e);m(f)&&(e[e.length-1][m(c)?c:d.localName]=f)}}function S(b,c,d){return iq(b,c,d)}function T(b,c){return function(d,e,f){b.call(m(c)?c:this,d,e,f);f[f.length-1].node.appendChild(d)}}
function jq(b){var c,d;return function(e,f,g){if(!m(c)){c={};var h={};h[e.localName]=b;c[e.namespaceURI]=h;d=kq(e.localName)}lq(c,d,f,g)}}function kq(b,c){return function(d,e,f){d=e[e.length-1].node;e=b;m(e)||(e=f);f=c;m(c)||(f=d.namespaceURI);return Jp(f,e)}}var mq=kq();function nq(b,c){for(var d=c.length,e=Array(d),f=0;f<d;++f)e[f]=b[c[f]];return e}function iq(b,c,d){d=m(d)?d:{};var e,f;e=0;for(f=b.length;e<f;++e)d[b[e]]=c;return d}
function oq(b,c,d,e){for(c=c.firstElementChild;null!==c;c=c.nextElementSibling){var f=b[c.namespaceURI];m(f)&&(f=f[c.localName],m(f)&&f.call(e,c,d))}}function U(b,c,d,e,f){e.push(b);oq(c,d,e,f);return e.pop()}function lq(b,c,d,e,f,g){for(var h=(m(f)?f:d).length,k,n,p=0;p<h;++p)k=d[p],m(k)&&(n=c.call(g,k,e,m(f)?f[p]:void 0),m(n)&&b[n.namespaceURI][n.localName].call(g,n,k,e))}function pq(b,c,d,e,f,g,h){f.push(b);lq(c,d,e,f,g,h);f.pop()};function qq(){this.defaultDataProjection=null}v(qq,pp);l=qq.prototype;l.O=function(){return"xml"};l.Nb=function(b,c){if(Rp(b))return rq(this,b,c);if(Up(b))return this.fg(b,c);if(ia(b)){var d=dq(b);return rq(this,d,c)}return null};function rq(b,c,d){b=sq(b,c,d);return 0<b.length?b[0]:null}l.ma=function(b,c){if(Rp(b))return sq(this,b,c);if(Up(b))return this.Ob(b,c);if(ia(b)){var d=dq(b);return sq(this,d,c)}return[]};
function sq(b,c,d){var e=[];for(c=c.firstChild;null!==c;c=c.nextSibling)1==c.nodeType&&ab(e,b.Ob(c,d));return e}l.Rc=function(b,c){if(Rp(b))return this.k(b,c);if(Up(b)){var d=this.Ud(b,[qp(this,b,m(c)?c:{})]);return m(d)?d:null}return ia(b)?(d=dq(b),this.k(d,c)):null};l.Ja=function(b){return Rp(b)?this.Ke(b):Up(b)?this.Xd(b):ia(b)?(b=dq(b),this.Ke(b)):null};l.Ke=function(){return this.defaultDataProjection};l.Xd=function(){return this.defaultDataProjection};l.be=function(b,c){var d=this.o(b,c);return Cp(d)};
l.Qb=function(b,c){var d=this.a(b,c);return Cp(d)};l.Xc=function(b,c){var d=this.i(b,c);return Cp(d)};function tq(b){b=m(b)?b:{};this.featureType=b.featureType;this.featureNS=b.featureNS;this.srsName=b.srsName;this.schemaLocation="";this.d={};this.d["http://www.opengis.net/gml"]={featureMember:gq(tq.prototype.Sd),featureMembers:gq(tq.prototype.Sd)};this.defaultDataProjection=null}v(tq,qq);l=tq.prototype;
l.Sd=function(b,c){var d=Op(b),e;if("FeatureCollection"==d)e=U(null,this.d,b,c,this);else if("featureMembers"==d||"featureMember"==d){var f=c[0],g=f.featureType;e=f.featureNS;var h,k;if(!m(g)&&null!=b.childNodes){g=[];e={};h=0;for(k=b.childNodes.length;h<k;++h){var n=b.childNodes[h];if(1===n.nodeType){var p=n.nodeName.split(":").pop();if(-1===Pa(g,p)){var q;ub(e,n.namespaceURI)?q=vb(e,function(b){return b===n.namespaceURI}):(q="p"+qb(e),e[q]=n.namespaceURI);g.push(q+":"+p)}}}f.featureType=g;f.featureNS=
e}ia(e)&&(h=e,e={},e.p0=h);var f={},g=ga(g)?g:[g],r;for(r in e){p={};h=0;for(k=g.length;h<k;++h)(-1===g[h].indexOf(":")?"p0":g[h].split(":")[0])===r&&(p[g[h].split(":").pop()]="featureMembers"==d?fq(this.Ge,this):gq(this.Ge,this));f[e[r]]=p}e=U([],f,b,c)}m(e)||(e=[]);return e};l.Ud=function(b,c){var d=c[0];d.srsName=b.firstElementChild.getAttribute("srsName");var e=U(null,this.Ue,b,c,this);if(null!=e)return sp(e,!1,d)};
l.Ge=function(b,c){var d,e=b.getAttribute("fid")||Yp(b,"http://www.opengis.net/gml","id"),f={},g;for(d=b.firstElementChild;null!==d;d=d.nextElementSibling){var h=Op(d);if(0===d.childNodes.length||1===d.childNodes.length&&3===d.firstChild.nodeType){var k=Kp(d,!1);/^[\s\xa0]*$/.test(k)&&(k=void 0);f[h]=k}else"boundedBy"!==h&&(g=h),f[h]=this.Ud(d,c)}d=new P(f);m(g)&&d.f(g);e&&d.c(e);return d};l.lg=function(b,c){var d=this.Td(b,c);if(null!=d){var e=new Ik(null);Jk(e,"XYZ",d);return e}};
l.jg=function(b,c){var d=U([],this.Pg,b,c,this);if(m(d))return new Rm(d)};l.ig=function(b,c){var d=U([],this.Og,b,c,this);if(m(d)){var e=new Om(null);Qm(e,d);return e}};l.kg=function(b,c){var d=U([],this.Qg,b,c,this);if(m(d)){var e=new Sm(null);Um(e,d);return e}};l.ag=function(b,c){oq(this.Tg,b,c,this)};l.zf=function(b,c){oq(this.Mg,b,c,this)};l.bg=function(b,c){oq(this.Ug,b,c,this)};l.Vd=function(b,c){var d=this.Td(b,c);if(null!=d){var e=new K(null);Nm(e,"XYZ",d);return e}};
l.zl=function(b,c){var d=U(null,this.Zc,b,c,this);if(null!=d)return d};l.hg=function(b,c){var d=this.Td(b,c);if(m(d)){var e=new Gk(null);Hk(e,"XYZ",d);return e}};l.Wd=function(b,c){var d=U([null],this.fe,b,c,this);if(m(d)&&null!==d[0]){var e=new F(null),f=d[0],g=[f.length],h,k;h=1;for(k=d.length;h<k;++h)ab(f,d[h]),g.push(f.length);Uk(e,"XYZ",f,g);return e}};l.Td=function(b,c){return U(null,this.Zc,b,c,this)};l.Pg=Object({"http://www.opengis.net/gml":{pointMember:fq(tq.prototype.ag),pointMembers:fq(tq.prototype.ag)}});
l.Og=Object({"http://www.opengis.net/gml":{lineStringMember:fq(tq.prototype.zf),lineStringMembers:fq(tq.prototype.zf)}});l.Qg=Object({"http://www.opengis.net/gml":{polygonMember:fq(tq.prototype.bg),polygonMembers:fq(tq.prototype.bg)}});l.Tg=Object({"http://www.opengis.net/gml":{Point:fq(tq.prototype.Td)}});l.Mg=Object({"http://www.opengis.net/gml":{LineString:fq(tq.prototype.Vd)}});l.Ug=Object({"http://www.opengis.net/gml":{Polygon:fq(tq.prototype.Wd)}});l.$c=Object({"http://www.opengis.net/gml":{LinearRing:gq(tq.prototype.zl)}});
l.Ob=function(b,c){var d={featureType:this.featureType,featureNS:this.featureNS};m(c)&&Db(d,qp(this,b,c));return this.Sd(b,[d])};l.Xd=function(b){return Be(m(this.q)?this.q:b.firstElementChild.getAttribute("srsName"))};function uq(b){b=Kp(b,!1);return vq(b)}function vq(b){if(b=/^\s*(true|1)|(false|0)\s*$/.exec(b))return m(b[1])||!1}function wq(b){b=Kp(b,!1);if(b=/^\s*(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(Z|(?:([+\-])(\d{2})(?::(\d{2}))?))\s*$/.exec(b)){var c=Date.UTC(parseInt(b[1],10),parseInt(b[2],10)-1,parseInt(b[3],10),parseInt(b[4],10),parseInt(b[5],10),parseInt(b[6],10))/1E3;if("Z"!=b[7]){var d="-"==b[8]?-1:1,c=c+60*d*parseInt(b[9],10);m(b[10])&&(c+=3600*d*parseInt(b[10],10))}return c}}
function xq(b){b=Kp(b,!1);return yq(b)}function yq(b){if(b=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(b))return parseFloat(b[1])}function zq(b){b=Kp(b,!1);return Aq(b)}function Aq(b){if(b=/^\s*(\d+)\s*$/.exec(b))return parseInt(b[1],10)}function V(b){b=Kp(b,!1);return Aa(b)}function Bq(b,c){Cq(b,c?"1":"0")}function Dq(b,c){b.appendChild(Gp.createTextNode(c.toPrecision()))}function Eq(b,c){b.appendChild(Gp.createTextNode(c.toString()))}function Cq(b,c){b.appendChild(Gp.createTextNode(c))};function Fq(b){b=m(b)?b:{};tq.call(this,b);this.n=m(b.surface)?b.surface:!1;this.f=m(b.curve)?b.curve:!1;this.e=m(b.multiCurve)?b.multiCurve:!0;this.g=m(b.multiSurface)?b.multiSurface:!0;this.schemaLocation=m(b.schemaLocation)?b.schemaLocation:"http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd"}v(Fq,tq);l=Fq.prototype;l.Cl=function(b,c){var d=U([],this.Ng,b,c,this);if(m(d)){var e=new Om(null);Qm(e,d);return e}};
l.Dl=function(b,c){var d=U([],this.Rg,b,c,this);if(m(d)){var e=new Sm(null);Um(e,d);return e}};l.hf=function(b,c){oq(this.Jg,b,c,this)};l.wg=function(b,c){oq(this.Xg,b,c,this)};l.Gl=function(b,c){return U([null],this.Sg,b,c,this)};l.Il=function(b,c){return U([null],this.Wg,b,c,this)};l.Hl=function(b,c){return U([null],this.fe,b,c,this)};l.Bl=function(b,c){return U([null],this.Zc,b,c,this)};l.Ui=function(b,c){var d=U(void 0,this.$c,b,c,this);m(d)&&c[c.length-1].push(d)};
l.th=function(b,c){var d=U(void 0,this.$c,b,c,this);m(d)&&(c[c.length-1][0]=d)};l.mg=function(b,c){var d=U([null],this.Yg,b,c,this);if(m(d)&&null!==d[0]){var e=new F(null),f=d[0],g=[f.length],h,k;h=1;for(k=d.length;h<k;++h)ab(f,d[h]),g.push(f.length);Uk(e,"XYZ",f,g);return e}};l.dg=function(b,c){var d=U([null],this.Kg,b,c,this);if(m(d)){var e=new K(null);Nm(e,"XYZ",d);return e}};l.yl=function(b,c){var d=U([null],this.Lg,b,c,this);return Wd(d[1][0],d[1][1],d[2][0],d[2][1])};
l.Al=function(b,c){for(var d=Kp(b,!1),e=/^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/,f=[],g;g=e.exec(d);)f.push(parseFloat(g[1])),d=d.substr(g[0].length);if(""===d){d=c[0].srsName;e="enu";null===d||(e=ze(Be(d)));if("neu"===e)for(d=0,e=f.length;d<e;d+=3)g=f[d],f[d]=f[d+1],f[d+1]=g;d=f.length;2==d&&f.push(0);return 0===d?void 0:f}};
l.Ie=function(b,c){var d=Kp(b,!1).replace(/^\s*|\s*$/g,""),e=c[0].srsName,f=b.parentNode.getAttribute("srsDimension"),g="enu";null===e||(g=ze(Be(e)));d=d.split(/\s+/);e=2;fa(b.getAttribute("srsDimension"))?fa(b.getAttribute("dimension"))?null===f||(e=Aq(f)):e=Aq(b.getAttribute("dimension")):e=Aq(b.getAttribute("srsDimension"));for(var h,k,n=[],p=0,q=d.length;p<q;p+=e)f=parseFloat(d[p]),h=parseFloat(d[p+1]),k=3===e?parseFloat(d[p+2]):0,"en"===g.substr(0,2)?n.push(f,h,k):n.push(h,f,k);return n};
l.Zc=Object({"http://www.opengis.net/gml":{pos:gq(Fq.prototype.Al),posList:gq(Fq.prototype.Ie)}});l.fe=Object({"http://www.opengis.net/gml":{interior:Fq.prototype.Ui,exterior:Fq.prototype.th}});
l.Ue=Object({"http://www.opengis.net/gml":{Point:gq(tq.prototype.lg),MultiPoint:gq(tq.prototype.jg),LineString:gq(tq.prototype.Vd),MultiLineString:gq(tq.prototype.ig),LinearRing:gq(tq.prototype.hg),Polygon:gq(tq.prototype.Wd),MultiPolygon:gq(tq.prototype.kg),Surface:gq(Fq.prototype.mg),MultiSurface:gq(Fq.prototype.Dl),Curve:gq(Fq.prototype.dg),MultiCurve:gq(Fq.prototype.Cl),Envelope:gq(Fq.prototype.yl)}});l.Ng=Object({"http://www.opengis.net/gml":{curveMember:fq(Fq.prototype.hf),curveMembers:fq(Fq.prototype.hf)}});
l.Rg=Object({"http://www.opengis.net/gml":{surfaceMember:fq(Fq.prototype.wg),surfaceMembers:fq(Fq.prototype.wg)}});l.Jg=Object({"http://www.opengis.net/gml":{LineString:fq(tq.prototype.Vd),Curve:fq(Fq.prototype.dg)}});l.Xg=Object({"http://www.opengis.net/gml":{Polygon:fq(tq.prototype.Wd),Surface:fq(Fq.prototype.mg)}});l.Yg=Object({"http://www.opengis.net/gml":{patches:gq(Fq.prototype.Gl)}});l.Kg=Object({"http://www.opengis.net/gml":{segments:gq(Fq.prototype.Il)}});
l.Lg=Object({"http://www.opengis.net/gml":{lowerCorner:fq(Fq.prototype.Ie),upperCorner:fq(Fq.prototype.Ie)}});l.Sg=Object({"http://www.opengis.net/gml":{PolygonPatch:gq(Fq.prototype.Hl)}});l.Wg=Object({"http://www.opengis.net/gml":{LineStringSegment:gq(Fq.prototype.Bl)}});function Gq(b,c,d){d=d[d.length-1].srsName;c=c.Q();for(var e=c.length,f=Array(e),g,h=0;h<e;++h){g=c[h];var k=h,n="enu";null!=d&&(n=ze(Be(d)));f[k]="en"===n.substr(0,2)?g[0]+" "+g[1]:g[1]+" "+g[0]}Cq(b,f.join(" "))}
l.Fg=function(b,c,d){var e=d[d.length-1].srsName;null!=e&&b.setAttribute("srsName",e);e=Jp(b.namespaceURI,"pos");b.appendChild(e);d=d[d.length-1].srsName;b="enu";null!=d&&(b=ze(Be(d)));c=c.Q();Cq(e,"en"===b.substr(0,2)?c[0]+" "+c[1]:c[1]+" "+c[0])};var Hq={"http://www.opengis.net/gml":{lowerCorner:T(Cq),upperCorner:T(Cq)}};l=Fq.prototype;
l.sm=function(b,c,d){var e=d[d.length-1].srsName;m(e)&&b.setAttribute("srsName",e);pq({node:b},Hq,mq,[c[0]+" "+c[1],c[2]+" "+c[3]],d,["lowerCorner","upperCorner"],this)};l.Cg=function(b,c,d){var e=d[d.length-1].srsName;null!=e&&b.setAttribute("srsName",e);e=Jp(b.namespaceURI,"posList");b.appendChild(e);Gq(e,c,d)};l.Vg=function(b,c){var d=c[c.length-1],e=d.node,f=d.exteriorWritten;m(f)||(d.exteriorWritten=!0);return Jp(e.namespaceURI,m(f)?"interior":"exterior")};
l.ee=function(b,c,d){var e=d[d.length-1].srsName;"PolygonPatch"!==b.nodeName&&null!=e&&b.setAttribute("srsName",e);"Polygon"===b.nodeName||"PolygonPatch"===b.nodeName?(c=c.ld(),pq({node:b,srsName:e},Iq,this.Vg,c,d,void 0,this)):"Surface"===b.nodeName&&(e=Jp(b.namespaceURI,"patches"),b.appendChild(e),b=Jp(e.namespaceURI,"PolygonPatch"),e.appendChild(b),this.ee(b,c,d))};
l.ae=function(b,c,d){var e=d[d.length-1].srsName;"LineStringSegment"!==b.nodeName&&null!=e&&b.setAttribute("srsName",e);"LineString"===b.nodeName||"LineStringSegment"===b.nodeName?(e=Jp(b.namespaceURI,"posList"),b.appendChild(e),Gq(e,c,d)):"Curve"===b.nodeName&&(e=Jp(b.namespaceURI,"segments"),b.appendChild(e),b=Jp(e.namespaceURI,"LineStringSegment"),e.appendChild(b),this.ae(b,c,d))};
l.Eg=function(b,c,d){var e=d[d.length-1],f=e.srsName,e=e.surface;null!=f&&b.setAttribute("srsName",f);c=c.qd();pq({node:b,srsName:f,surface:e},Jq,this.c,c,d,void 0,this)};l.wm=function(b,c,d){var e=d[d.length-1].srsName;null!=e&&b.setAttribute("srsName",e);c=c.Gd();pq({node:b,srsName:e},Kq,kq("pointMember"),c,d,void 0,this)};l.Dg=function(b,c,d){var e=d[d.length-1],f=e.srsName,e=e.curve;null!=f&&b.setAttribute("srsName",f);c=c.Lc();pq({node:b,srsName:f,curve:e},Lq,this.c,c,d,void 0,this)};
l.Gg=function(b,c,d){var e=Jp(b.namespaceURI,"LinearRing");b.appendChild(e);this.Cg(e,c,d)};l.Hg=function(b,c,d){var e=this.b(c,d);m(e)&&(b.appendChild(e),this.ee(e,c,d))};l.zm=function(b,c,d){var e=Jp(b.namespaceURI,"Point");b.appendChild(e);this.Fg(e,c,d)};l.Bg=function(b,c,d){var e=this.b(c,d);m(e)&&(b.appendChild(e),this.ae(e,c,d))};
l.de=function(b,c,d){var e=d[d.length-1],f=Bb(e);f.node=b;var g;ga(c)?m(e.dataProjection)?g=Ve(c,e.featureProjection,e.dataProjection):g=c:g=sp(c,!0,e);pq(f,Mq,this.b,[g],d,void 0,this)};
l.yg=function(b,c,d){var e=c.aa;m(e)&&b.setAttribute("fid",e);var e=d[d.length-1],f=e.featureNS,g=c.b;m(e.ec)||(e.ec={},e.ec[f]={});var h=c.I();c=[];var k=[],n;for(n in h){var p=h[n];null!==p&&(c.push(n),k.push(p),n==g?n in e.ec[f]||(e.ec[f][n]=T(this.de,this)):n in e.ec[f]||(e.ec[f][n]=T(Cq)))}n=Bb(e);n.node=b;pq(n,e.ec,kq(void 0,f),k,d,c)};
var Jq={"http://www.opengis.net/gml":{surfaceMember:T(Fq.prototype.Hg),polygonMember:T(Fq.prototype.Hg)}},Kq={"http://www.opengis.net/gml":{pointMember:T(Fq.prototype.zm)}},Lq={"http://www.opengis.net/gml":{lineStringMember:T(Fq.prototype.Bg),curveMember:T(Fq.prototype.Bg)}},Iq={"http://www.opengis.net/gml":{exterior:T(Fq.prototype.Gg),interior:T(Fq.prototype.Gg)}},Mq={"http://www.opengis.net/gml":{Curve:T(Fq.prototype.ae),MultiCurve:T(Fq.prototype.Dg),Point:T(Fq.prototype.Fg),MultiPoint:T(Fq.prototype.wm),
LineString:T(Fq.prototype.ae),MultiLineString:T(Fq.prototype.Dg),LinearRing:T(Fq.prototype.Cg),Polygon:T(Fq.prototype.ee),MultiPolygon:T(Fq.prototype.Eg),Surface:T(Fq.prototype.ee),MultiSurface:T(Fq.prototype.Eg),Envelope:T(Fq.prototype.sm)}},Nq={MultiLineString:"lineStringMember",MultiCurve:"curveMember",MultiPolygon:"polygonMember",MultiSurface:"surfaceMember"};Fq.prototype.c=function(b,c){return Jp("http://www.opengis.net/gml",Nq[c[c.length-1].node.nodeName])};
Fq.prototype.b=function(b,c){var d=c[c.length-1],e=d.multiSurface,f=d.surface,g=d.curve,d=d.multiCurve,h;ga(b)?h="Envelope":(h=b.O(),"MultiPolygon"===h&&!0===e?h="MultiSurface":"Polygon"===h&&!0===f?h="Surface":"LineString"===h&&!0===g?h="Curve":"MultiLineString"===h&&!0===d&&(h="MultiCurve"));return Jp("http://www.opengis.net/gml",h)};
Fq.prototype.i=function(b,c){c=rp(this,c);var d=Jp("http://www.opengis.net/gml","geom"),e={node:d,srsName:this.srsName,curve:this.f,surface:this.n,multiSurface:this.g,multiCurve:this.e};m(c)&&Db(e,c);this.de(d,b,[e]);return d};
Fq.prototype.a=function(b,c){c=rp(this,c);var d=Jp("http://www.opengis.net/gml","featureMembers");cq(d,"http://www.w3.org/2001/XMLSchema-instance","xsi:schemaLocation",this.schemaLocation);var e={srsName:this.srsName,curve:this.f,surface:this.n,multiSurface:this.g,multiCurve:this.e,featureNS:this.featureNS,featureType:this.featureType};m(c)&&Db(e,c);var e=[e],f=e[e.length-1],g=f.featureType,h=f.featureNS,k={};k[h]={};k[h][g]=T(this.yg,this);f=Bb(f);f.node=d;pq(f,k,kq(g,h),b,e);return d};function Oq(b){b=m(b)?b:{};tq.call(this,b);this.schemaLocation=m(b.schemaLocation)?b.schemaLocation:"http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd"}v(Oq,tq);l=Oq.prototype;
l.gg=function(b,c){var d=Kp(b,!1).replace(/^\s*|\s*$/g,""),e=c[0].srsName,f=b.parentNode.getAttribute("srsDimension"),g="enu";null===e||(g=ze(Be(e)));d=d.split(/[\s,]+/);e=2;fa(b.getAttribute("srsDimension"))?fa(b.getAttribute("dimension"))?null===f||(e=Aq(f)):e=Aq(b.getAttribute("dimension")):e=Aq(b.getAttribute("srsDimension"));for(var h,k,n=[],p=0,q=d.length;p<q;p+=e)f=parseFloat(d[p]),h=parseFloat(d[p+1]),k=3===e?parseFloat(d[p+2]):0,"en"===g.substr(0,2)?n.push(f,h,k):n.push(h,f,k);return n};
l.xl=function(b,c){var d=U([null],this.Ig,b,c,this);return Wd(d[1][0],d[1][1],d[1][3],d[1][4])};l.Si=function(b,c){var d=U(void 0,this.$c,b,c,this);m(d)&&c[c.length-1].push(d)};l.kl=function(b,c){var d=U(void 0,this.$c,b,c,this);m(d)&&(c[c.length-1][0]=d)};l.Zc=Object({"http://www.opengis.net/gml":{coordinates:gq(Oq.prototype.gg)}});l.fe=Object({"http://www.opengis.net/gml":{innerBoundaryIs:Oq.prototype.Si,outerBoundaryIs:Oq.prototype.kl}});l.Ig=Object({"http://www.opengis.net/gml":{coordinates:fq(Oq.prototype.gg)}});
l.Ue=Object({"http://www.opengis.net/gml":{Point:gq(tq.prototype.lg),MultiPoint:gq(tq.prototype.jg),LineString:gq(tq.prototype.Vd),MultiLineString:gq(tq.prototype.ig),LinearRing:gq(tq.prototype.hg),Polygon:gq(tq.prototype.Wd),MultiPolygon:gq(tq.prototype.kg),Box:gq(Oq.prototype.xl)}});function Pq(b){b=m(b)?b:{};this.defaultDataProjection=null;this.defaultDataProjection=Be("EPSG:4326");this.d=b.readExtensions}v(Pq,qq);var Qq=[null,"http://www.topografix.com/GPX/1/0","http://www.topografix.com/GPX/1/1"];function Rq(b,c,d){b.push(parseFloat(c.getAttribute("lon")),parseFloat(c.getAttribute("lat")));"ele"in d?(b.push(d.ele),yb(d,"ele")):b.push(0);"time"in d?(b.push(d.time),yb(d,"time")):b.push(0);return b}
function Sq(b,c){var d=c[c.length-1],e=b.getAttribute("href");null===e||(d.link=e);oq(Tq,b,c)}function Uq(b,c){c[c.length-1].extensionsNode_=b}function Vq(b,c){var d=c[0],e=U({flatCoordinates:[]},Wq,b,c);if(m(e)){var f=e.flatCoordinates;yb(e,"flatCoordinates");var g=new K(null);Nm(g,"XYZM",f);sp(g,!1,d);d=new P(g);d.C(e);return d}}
function Xq(b,c){var d=c[0],e=U({flatCoordinates:[],ends:[]},Yq,b,c);if(m(e)){var f=e.flatCoordinates;yb(e,"flatCoordinates");var g=e.ends;yb(e,"ends");var h=new Om(null);Pm(h,"XYZM",f,g);sp(h,!1,d);d=new P(h);d.C(e);return d}}function Zq(b,c){var d=c[0],e=U({},$q,b,c);if(m(e)){var f=Rq([],b,e),f=new Ik(f,"XYZM");sp(f,!1,d);d=new P(f);d.C(e);return d}}
var ar={rte:Vq,trk:Xq,wpt:Zq},br=S(Qq,{rte:fq(Vq),trk:fq(Xq),wpt:fq(Zq)}),Tq=S(Qq,{text:R(V,"linkText"),type:R(V,"linkType")}),Wq=S(Qq,{name:R(V),cmt:R(V),desc:R(V),src:R(V),link:Sq,number:R(zq),extensions:Uq,type:R(V),rtept:function(b,c){var d=U({},cr,b,c);m(d)&&Rq(c[c.length-1].flatCoordinates,b,d)}}),cr=S(Qq,{ele:R(xq),time:R(wq)}),Yq=S(Qq,{name:R(V),cmt:R(V),desc:R(V),src:R(V),link:Sq,number:R(zq),type:R(V),extensions:Uq,trkseg:function(b,c){var d=c[c.length-1];oq(dr,b,c);d.ends.push(d.flatCoordinates.length)}}),
dr=S(Qq,{trkpt:function(b,c){var d=U({},er,b,c);m(d)&&Rq(c[c.length-1].flatCoordinates,b,d)}}),er=S(Qq,{ele:R(xq),time:R(wq)}),$q=S(Qq,{ele:R(xq),time:R(wq),magvar:R(xq),geoidheight:R(xq),name:R(V),cmt:R(V),desc:R(V),src:R(V),link:Sq,sym:R(V),type:R(V),fix:R(V),sat:R(zq),hdop:R(xq),vdop:R(xq),pdop:R(xq),ageofdgpsdata:R(xq),dgpsid:R(zq),extensions:Uq});
function fr(b,c){null===c&&(c=[]);for(var d=0,e=c.length;d<e;++d){var f=c[d];if(m(b.d)){var g=f.get("extensionsNode_")||null;b.d(f,g)}f.set("extensionsNode_",void 0)}}Pq.prototype.fg=function(b,c){if(!Wa(Qq,b.namespaceURI))return null;var d=ar[b.localName];if(!m(d))return null;d=d(b,[qp(this,b,c)]);if(!m(d))return null;fr(this,[d]);return d};Pq.prototype.Ob=function(b,c){if(!Wa(Qq,b.namespaceURI))return[];if("gpx"==b.localName){var d=U([],br,b,[qp(this,b,c)]);if(m(d))return fr(this,d),d}return[]};
function gr(b,c,d){b.setAttribute("href",c);c=d[d.length-1].properties;pq({node:b},hr,mq,[c.linkText,c.linkType],d,ir)}function jr(b,c,d){var e=d[d.length-1],f=e.node.namespaceURI,g=e.properties;cq(b,null,"lat",c[1]);cq(b,null,"lon",c[0]);switch(e.geometryLayout){case "XYZM":0!==c[3]&&(g.time=c[3]);case "XYZ":0!==c[2]&&(g.ele=c[2]);break;case "XYM":0!==c[2]&&(g.time=c[2])}c=kr[f];e=nq(g,c);pq({node:b,properties:g},lr,mq,e,d,c)}
var ir=["text","type"],hr=iq(Qq,{text:T(Cq),type:T(Cq)}),mr=iq(Qq,"name cmt desc src link number type rtept".split(" ")),nr=iq(Qq,{name:T(Cq),cmt:T(Cq),desc:T(Cq),src:T(Cq),link:T(gr),number:T(Eq),type:T(Cq),rtept:jq(T(jr))}),or=iq(Qq,"name cmt desc src link number type trkseg".split(" ")),rr=iq(Qq,{name:T(Cq),cmt:T(Cq),desc:T(Cq),src:T(Cq),link:T(gr),number:T(Eq),type:T(Cq),trkseg:jq(T(function(b,c,d){pq({node:b,geometryLayout:c.a,properties:{}},pr,qr,c.Q(),d)}))}),qr=kq("trkpt"),pr=iq(Qq,{trkpt:T(jr)}),
kr=iq(Qq,"ele time magvar geoidheight name cmt desc src link sym type fix sat hdop vdop pdop ageofdgpsdata dgpsid".split(" ")),lr=iq(Qq,{ele:T(Dq),time:T(function(b,c){var d=new Date(1E3*c),d=d.getUTCFullYear()+"-"+La(d.getUTCMonth()+1)+"-"+La(d.getUTCDate())+"T"+La(d.getUTCHours())+":"+La(d.getUTCMinutes())+":"+La(d.getUTCSeconds())+"Z";b.appendChild(Gp.createTextNode(d))}),magvar:T(Dq),geoidheight:T(Dq),name:T(Cq),cmt:T(Cq),desc:T(Cq),src:T(Cq),link:T(gr),sym:T(Cq),type:T(Cq),fix:T(Cq),sat:T(Eq),
hdop:T(Dq),vdop:T(Dq),pdop:T(Dq),ageofdgpsdata:T(Dq),dgpsid:T(Eq)}),sr={Point:"wpt",LineString:"rte",MultiLineString:"trk"};function tr(b,c){var d=b.R();if(m(d))return Jp(c[c.length-1].node.namespaceURI,sr[d.O()])}
var ur=iq(Qq,{rte:T(function(b,c,d){var e=d[0],f=c.I();b={node:b,properties:f};c=c.R();m(c)&&(c=sp(c,!0,e),b.geometryLayout=c.a,f.rtept=c.Q());e=mr[d[d.length-1].node.namespaceURI];f=nq(f,e);pq(b,nr,mq,f,d,e)}),trk:T(function(b,c,d){var e=d[0],f=c.I();b={node:b,properties:f};c=c.R();m(c)&&(c=sp(c,!0,e),f.trkseg=c.Lc());e=or[d[d.length-1].node.namespaceURI];f=nq(f,e);pq(b,rr,mq,f,d,e)}),wpt:T(function(b,c,d){var e=d[0],f=d[d.length-1];f.properties=c.I();c=c.R();m(c)&&(c=sp(c,!0,e),f.geometryLayout=
c.a,jr(b,c.Q(),d))})});Pq.prototype.a=function(b,c){c=rp(this,c);var d=Jp("http://www.topografix.com/GPX/1/1","gpx");pq({node:d},ur,tr,b,[c]);return d};function vr(b){b=wr(b);return Sa(b,function(b){return b.b.substring(b.d,b.a)})}function xr(b,c,d){this.b=b;this.d=c;this.a=d}function wr(b){for(var c=RegExp("\r\n|\r|\n","g"),d=0,e,f=[];e=c.exec(b);)d=new xr(b,d,e.index),f.push(d),d=c.lastIndex;d<b.length&&(d=new xr(b,d,b.length),f.push(d));return f};function yr(){this.defaultDataProjection=null}v(yr,pp);l=yr.prototype;l.O=function(){return"text"};l.Nb=function(b,c){return this.Qc(ia(b)?b:"",rp(this,c))};l.ma=function(b,c){return this.He(ia(b)?b:"",rp(this,c))};l.Rc=function(b,c){return this.Sc(ia(b)?b:"",rp(this,c))};l.Ja=function(){return this.defaultDataProjection};l.be=function(b,c){return this.ce(b,rp(this,c))};l.Qb=function(b,c){return this.zg(b,rp(this,c))};l.Xc=function(b,c){return this.Yc(b,rp(this,c))};function zr(b){b=m(b)?b:{};this.defaultDataProjection=null;this.defaultDataProjection=Be("EPSG:4326");this.a=m(b.altitudeMode)?b.altitudeMode:"none"}v(zr,yr);var Ar=/^B(\d{2})(\d{2})(\d{2})(\d{2})(\d{5})([NS])(\d{3})(\d{5})([EW])([AV])(\d{5})(\d{5})/,Br=/^H.([A-Z]{3}).*?:(.*)/,Cr=/^HFDTE(\d{2})(\d{2})(\d{2})/;
zr.prototype.Qc=function(b,c){var d=this.a,e=vr(b),f={},g=[],h=2E3,k=0,n=1,p,q;p=0;for(q=e.length;p<q;++p){var r=e[p],s;if("B"==r.charAt(0)){if(s=Ar.exec(r)){var r=parseInt(s[1],10),u=parseInt(s[2],10),z=parseInt(s[3],10),y=parseInt(s[4],10)+parseInt(s[5],10)/6E4;"S"==s[6]&&(y=-y);var A=parseInt(s[7],10)+parseInt(s[8],10)/6E4;"W"==s[9]&&(A=-A);g.push(A,y);"none"!=d&&g.push("gps"==d?parseInt(s[11],10):"barometric"==d?parseInt(s[12],10):0);g.push(Date.UTC(h,k,n,r,u,z)/1E3)}}else if("H"==r.charAt(0))if(s=
Cr.exec(r))n=parseInt(s[1],10),k=parseInt(s[2],10)-1,h=2E3+parseInt(s[3],10);else if(s=Br.exec(r))f[s[1]]=Aa(s[2]),Cr.exec(r)}if(0===g.length)return null;e=new K(null);Nm(e,"none"==d?"XYM":"XYZM",g);d=new P(sp(e,!1,c));d.C(f);return d};zr.prototype.He=function(b,c){var d=this.Qc(b,c);return null===d?[]:[d]};var Dr=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#(.*))?$/;function Er(b){if(Fr){Fr=!1;var c=ba.location;if(c){var d=c.href;if(d&&(d=(d=Er(d)[3]||null)?decodeURI(d):d)&&d!=c.hostname)throw Fr=!0,Error();}}return b.match(Dr)}var Fr=Ib;
function Gr(b,c){for(var d=b.split("&"),e=0;e<d.length;e++){var f=d[e].indexOf("="),g=null,h=null;0<=f?(g=d[e].substring(0,f),h=d[e].substring(f+1)):g=d[e];c(g,h?decodeURIComponent(h.replace(/\+/g," ")):"")}}function Hr(b){if(b[1]){var c=b[0],d=c.indexOf("#");0<=d&&(b.push(c.substr(d)),b[0]=c=c.substr(0,d));d=c.indexOf("?");0>d?b[1]="?":d==c.length-1&&(b[1]=void 0)}return b.join("")}
function Ir(b,c,d){if(ga(c))for(var e=0;e<c.length;e++)Ir(b,String(c[e]),d);else null!=c&&d.push("&",b,""===c?"":"=",encodeURIComponent(String(c)))}function Jr(b,c){for(var d in c)Ir(d,c[d],b);return b};function Kr(b,c){var d;b instanceof Kr?(this.Yb=m(c)?c:b.Yb,Lr(this,b.Pb),this.gc=b.gc,this.sb=b.sb,Mr(this,b.tc),this.rb=b.rb,Nr(this,b.a.clone()),this.Sb=b.Sb):b&&(d=Er(String(b)))?(this.Yb=!!c,Lr(this,d[1]||"",!0),this.gc=Or(d[2]||""),this.sb=Or(d[3]||"",!0),Mr(this,d[4]),this.rb=Or(d[5]||"",!0),Nr(this,d[6]||"",!0),this.Sb=Or(d[7]||"")):(this.Yb=!!c,this.a=new Pr(null,0,this.Yb))}l=Kr.prototype;l.Pb="";l.gc="";l.sb="";l.tc=null;l.rb="";l.Sb="";l.Yb=!1;
l.toString=function(){var b=[],c=this.Pb;c&&b.push(Qr(c,Rr,!0),":");if(c=this.sb){b.push("//");var d=this.gc;d&&b.push(Qr(d,Rr,!0),"@");b.push(encodeURIComponent(String(c)).replace(/%25([0-9a-fA-F]{2})/g,"%$1"));c=this.tc;null!=c&&b.push(":",String(c))}if(c=this.rb)this.sb&&"/"!=c.charAt(0)&&b.push("/"),b.push(Qr(c,"/"==c.charAt(0)?Sr:Tr,!0));(c=this.a.toString())&&b.push("?",c);(c=this.Sb)&&b.push("#",Qr(c,Ur));return b.join("")};l.clone=function(){return new Kr(this)};
function Lr(b,c,d){b.Pb=d?Or(c,!0):c;b.Pb&&(b.Pb=b.Pb.replace(/:$/,""))}function Mr(b,c){if(c){c=Number(c);if(isNaN(c)||0>c)throw Error("Bad port number "+c);b.tc=c}else b.tc=null}function Nr(b,c,d){c instanceof Pr?(b.a=c,Vr(b.a,b.Yb)):(d||(c=Qr(c,Wr)),b.a=new Pr(c,0,b.Yb))}function Xr(b){return b instanceof Kr?b.clone():new Kr(b,void 0)}
function Yr(b,c){b instanceof Kr||(b=Xr(b));c instanceof Kr||(c=Xr(c));var d=b,e=c,f=d.clone(),g=!!e.Pb;g?Lr(f,e.Pb):g=!!e.gc;g?f.gc=e.gc:g=!!e.sb;g?f.sb=e.sb:g=null!=e.tc;var h=e.rb;if(g)Mr(f,e.tc);else if(g=!!e.rb)if("/"!=h.charAt(0)&&(d.sb&&!d.rb?h="/"+h:(d=f.rb.lastIndexOf("/"),-1!=d&&(h=f.rb.substr(0,d+1)+h))),d=h,".."==d||"."==d)h="";else if(-1!=d.indexOf("./")||-1!=d.indexOf("/.")){for(var h=0==d.lastIndexOf("/",0),d=d.split("/"),k=[],n=0;n<d.length;){var p=d[n++];"."==p?h&&n==d.length&&k.push(""):
".."==p?((1<k.length||1==k.length&&""!=k[0])&&k.pop(),h&&n==d.length&&k.push("")):(k.push(p),h=!0)}h=k.join("/")}else h=d;g?f.rb=h:g=""!==e.a.toString();g?Nr(f,Or(e.a.toString())):g=!!e.Sb;g&&(f.Sb=e.Sb);return f}function Or(b,c){return b?c?decodeURI(b):decodeURIComponent(b):""}function Qr(b,c,d){return ia(b)?(b=encodeURI(b).replace(c,Zr),d&&(b=b.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),b):null}function Zr(b){b=b.charCodeAt(0);return"%"+(b>>4&15).toString(16)+(b&15).toString(16)}
var Rr=/[#\/\?@]/g,Tr=/[\#\?:]/g,Sr=/[\#\?]/g,Wr=/[\#\?@]/g,Ur=/#/g;function Pr(b,c,d){this.a=b||null;this.d=!!d}function $r(b){b.ga||(b.ga=new th,b.ya=0,b.a&&Gr(b.a,function(c,d){b.add(decodeURIComponent(c.replace(/\+/g," ")),d)}))}l=Pr.prototype;l.ga=null;l.ya=null;l.Tb=function(){$r(this);return this.ya};l.add=function(b,c){$r(this);this.a=null;b=as(this,b);var d=this.ga.get(b);d||this.ga.set(b,d=[]);d.push(c);this.ya++;return this};
l.remove=function(b){$r(this);b=as(this,b);return vh(this.ga.d,b)?(this.a=null,this.ya-=this.ga.get(b).length,this.ga.remove(b)):!1};l.clear=function(){this.ga=this.a=null;this.ya=0};l.la=function(){$r(this);return 0==this.ya};function bs(b,c){$r(b);c=as(b,c);return vh(b.ga.d,c)}l.G=function(){$r(this);for(var b=this.ga.ob(),c=this.ga.G(),d=[],e=0;e<c.length;e++)for(var f=b[e],g=0;g<f.length;g++)d.push(c[e]);return d};
l.ob=function(b){$r(this);var c=[];if(ia(b))bs(this,b)&&(c=Za(c,this.ga.get(as(this,b))));else{b=this.ga.ob();for(var d=0;d<b.length;d++)c=Za(c,b[d])}return c};l.set=function(b,c){$r(this);this.a=null;b=as(this,b);bs(this,b)&&(this.ya-=this.ga.get(b).length);this.ga.set(b,[c]);this.ya++;return this};l.get=function(b,c){var d=b?this.ob(b):[];return 0<d.length?String(d[0]):c};function cs(b,c,d){b.remove(c);0<d.length&&(b.a=null,b.ga.set(as(b,c),$a(d)),b.ya+=d.length)}
l.toString=function(){if(this.a)return this.a;if(!this.ga)return"";for(var b=[],c=this.ga.G(),d=0;d<c.length;d++)for(var e=c[d],f=encodeURIComponent(String(e)),e=this.ob(e),g=0;g<e.length;g++){var h=f;""!==e[g]&&(h+="="+encodeURIComponent(String(e[g])));b.push(h)}return this.a=b.join("&")};l.clone=function(){var b=new Pr;b.a=this.a;this.ga&&(b.ga=this.ga.clone(),b.ya=this.ya);return b};function as(b,c){var d=String(c);b.d&&(d=d.toLowerCase());return d}
function Vr(b,c){c&&!b.d&&($r(b),b.a=null,b.ga.forEach(function(b,c){var f=c.toLowerCase();c!=f&&(this.remove(c),cs(this,f,b))},b));b.d=c};function ds(b){b=m(b)?b:{};this.c=b.font;this.f=b.rotation;this.d=b.scale;this.b=b.text;this.g=b.textAlign;this.n=b.textBaseline;this.a=m(b.fill)?b.fill:null;this.e=m(b.stroke)?b.stroke:null;this.i=m(b.offsetX)?b.offsetX:0;this.k=m(b.offsetY)?b.offsetY:0}l=ds.prototype;l.Gh=function(){return this.c};l.Wh=function(){return this.i};l.Xh=function(){return this.k};l.Vk=function(){return this.a};l.Wk=function(){return this.f};l.Xk=function(){return this.d};l.Yk=function(){return this.e};l.Zk=function(){return this.b};
l.di=function(){return this.g};l.ei=function(){return this.n};l.Xl=function(b){this.c=b};l.Wl=function(b){this.a=b};l.$k=function(b){this.f=b};l.al=function(b){this.d=b};l.cm=function(b){this.e=b};l.dm=function(b){this.b=b};l.em=function(b){this.g=b};l.fm=function(b){this.n=b};function es(b){function c(b){return ga(b)?b:ia(b)?(!(b in e)&&"#"+b in e&&(b="#"+b),c(e[b])):d}b=m(b)?b:{};this.defaultDataProjection=null;this.defaultDataProjection=Be("EPSG:4326");var d=m(b.defaultStyle)?b.defaultStyle:fs,e={};this.b=m(b.extractStyles)?b.extractStyles:!0;this.d=e;this.c=function(){var b=this.get("Style");if(m(b))return b;b=this.get("styleUrl");return m(b)?c(b):d}}v(es,qq);
var gs=["http://www.google.com/kml/ext/2.2"],hs=[null,"http://earth.google.com/kml/2.0","http://earth.google.com/kml/2.1","http://earth.google.com/kml/2.2","http://www.opengis.net/kml/2.2"],is=[255,255,255,1],js=new nl({color:is}),ks=[20,2],ls=[64,64],ms=new vj({anchor:ks,anchorOrigin:"bottom-left",anchorXUnits:"pixels",anchorYUnits:"pixels",crossOrigin:"anonymous",rotation:0,scale:.5,size:ls,src:"https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png"}),ns=new jl({color:is,width:1}),os=new ds({font:"normal 16px Helvetica",
fill:js,stroke:ns,scale:1}),fs=[new ql({fill:js,image:ms,text:os,stroke:ns,zIndex:0})],ps={fraction:"fraction",pixels:"pixels"};function qs(b){b=Kp(b,!1);if(b=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(b))return b=b[1],[parseInt(b.substr(6,2),16),parseInt(b.substr(4,2),16),parseInt(b.substr(2,2),16),parseInt(b.substr(0,2),16)/255]}
function rs(b){b=Kp(b,!1);for(var c=[],d=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?))?\s*/i,e;e=d.exec(b);)c.push(parseFloat(e[1]),parseFloat(e[2]),e[3]?parseFloat(e[3]):0),b=b.substr(e[0].length);return""!==b?void 0:c}function ss(b){var c=Kp(b,!1);return null!=b.baseURI?Yr(b.baseURI,Aa(c)).toString():Aa(c)}function ts(b){b=xq(b);if(m(b))return Math.sqrt(b)}function us(b,c){return U(null,vs,b,c)}
function ws(b,c){var d=U({j:[],xg:[]},xs,b,c);if(m(d)){var e=d.j,d=d.xg,f,g;f=0;for(g=Math.min(e.length,d.length);f<g;++f)e[4*f+3]=d[f];d=new K(null);Nm(d,"XYZM",e);return d}}function ys(b,c){var d=U(null,zs,b,c);if(m(d)){var e=new K(null);Nm(e,"XYZ",d);return e}}function As(b,c){var d=U(null,zs,b,c);if(m(d)){var e=new F(null);Uk(e,"XYZ",d,[d.length]);return e}}
function Bs(b,c){var d=U([],Cs,b,c);if(!m(d))return null;if(0===d.length)return new Gm(d);var e=!0,f=d[0].O(),g,h,k;h=1;for(k=d.length;h<k;++h)if(g=d[h],g.O()!=f){e=!1;break}if(e){if("Point"==f){g=d[0];e=g.a;f=g.j;h=1;for(k=d.length;h<k;++h)g=d[h],ab(f,g.j);d=new Rm(null);ok(d,e,f);d.l();return d}return"LineString"==f?(g=new Om(null),Qm(g,d),g):"Polygon"==f?(g=new Sm(null),Um(g,d),g):"GeometryCollection"==f?new Gm(d):null}return new Gm(d)}
function Ds(b,c){var d=U(null,zs,b,c);if(null!=d){var e=new Ik(null);Jk(e,"XYZ",d);return e}}function Es(b,c){var d=U([null],Fs,b,c);if(null!=d&&null!==d[0]){var e=new F(null),f=d[0],g=[f.length],h,k;h=1;for(k=d.length;h<k;++h)ab(f,d[h]),g.push(f.length);Uk(e,"XYZ",f,g);return e}}
function Gs(b,c){var d=U({},Hs,b,c);if(!m(d))return null;var e=zb(d,"fillStyle",js),f=d.fill;m(f)&&!f&&(e=null);var f=zb(d,"imageStyle",ms),g=zb(d,"textStyle",os),h=zb(d,"strokeStyle",ns),d=d.outline;m(d)&&!d&&(h=null);return[new ql({fill:e,image:f,stroke:h,text:g,zIndex:void 0})]}function Is(b,c){oq(Js,b,c)}
var Ks=S(hs,{value:gq(V)}),Js=S(hs,{Data:function(b,c){var d=b.getAttribute("name");if(null!==d){var e=U(void 0,Ks,b,c);m(e)&&(c[c.length-1][d]=e)}},SchemaData:function(b,c){oq(Ls,b,c)}}),vs=S(hs,{coordinates:gq(rs)}),Fs=S(hs,{innerBoundaryIs:function(b,c){var d=U(void 0,Ms,b,c);m(d)&&c[c.length-1].push(d)},outerBoundaryIs:function(b,c){var d=U(void 0,Ns,b,c);m(d)&&(c[c.length-1][0]=d)}}),xs=S(hs,{when:function(b,c){var d=c[c.length-1].xg,e=Kp(b,!1);if(e=/^\s*(\d{4})($|-(\d{2})($|-(\d{2})($|T(\d{2}):(\d{2}):(\d{2})(Z|(?:([+\-])(\d{2})(?::(\d{2}))?)))))\s*$/.exec(e)){var f=
Date.UTC(parseInt(e[1],10),m(e[3])?parseInt(e[3],10)-1:0,m(e[5])?parseInt(e[5],10):1,m(e[7])?parseInt(e[7],10):0,m(e[8])?parseInt(e[8],10):0,m(e[9])?parseInt(e[9],10):0);if(m(e[10])&&"Z"!=e[10]){var g="-"==e[11]?-1:1,f=f+60*g*parseInt(e[12],10);m(e[13])&&(f+=3600*g*parseInt(e[13],10))}d.push(f)}else d.push(0)}},S(gs,{coord:function(b,c){var d=c[c.length-1].j,e=Kp(b,!1);(e=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(e))?
d.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]),0):d.push(0,0,0,0)}})),zs=S(hs,{coordinates:gq(rs)}),Os=S(hs,{href:R(ss)},S(gs,{x:R(xq),y:R(xq),w:R(xq),h:R(xq)})),Ps=S(hs,{Icon:R(function(b,c){var d=U({},Os,b,c);return m(d)?d:null}),heading:R(xq),hotSpot:R(function(b){var c=b.getAttribute("xunits"),d=b.getAttribute("yunits");return{x:parseFloat(b.getAttribute("x")),Re:ps[c],y:parseFloat(b.getAttribute("y")),Se:ps[d]}}),scale:R(ts)}),Ms=S(hs,{LinearRing:gq(us)}),Qs=S(hs,{color:R(qs),scale:R(ts)}),
Rs=S(hs,{color:R(qs),width:R(xq)}),Cs=S(hs,{LineString:fq(ys),LinearRing:fq(As),MultiGeometry:fq(Bs),Point:fq(Ds),Polygon:fq(Es)}),Ss=S(gs,{Track:fq(ws)}),Us=S(hs,{ExtendedData:Is,Link:function(b,c){oq(Ts,b,c)},address:R(V),description:R(V),name:R(V),open:R(uq),phoneNumber:R(V),visibility:R(uq)}),Ts=S(hs,{href:R(ss)}),Ns=S(hs,{LinearRing:gq(us)}),Vs=S(hs,{Style:R(Gs),key:R(V),styleUrl:R(function(b){var c=Aa(Kp(b,!1));return null!=b.baseURI?Yr(b.baseURI,c).toString():c})}),Xs=S(hs,{ExtendedData:Is,
MultiGeometry:R(Bs,"geometry"),LineString:R(ys,"geometry"),LinearRing:R(As,"geometry"),Point:R(Ds,"geometry"),Polygon:R(Es,"geometry"),Style:R(Gs),StyleMap:function(b,c){var d=U(void 0,Ws,b,c);if(m(d)){var e=c[c.length-1];ga(d)?e.Style=d:ia(d)&&(e.styleUrl=d)}},address:R(V),description:R(V),name:R(V),open:R(uq),phoneNumber:R(V),styleUrl:R(ss),visibility:R(uq)},S(gs,{MultiTrack:R(function(b,c){var d=U([],Ss,b,c);if(m(d)){var e=new Om(null);Qm(e,d);return e}},"geometry"),Track:R(ws,"geometry")})),Ys=
S(hs,{color:R(qs),fill:R(uq),outline:R(uq)}),Ls=S(hs,{SimpleData:function(b,c){var d=b.getAttribute("name");if(null!==d){var e=V(b);c[c.length-1][d]=e}}}),Hs=S(hs,{IconStyle:function(b,c){var d=U({},Ps,b,c);if(m(d)){var e=c[c.length-1],f=zb(d,"Icon",{}),g;g=f.href;g=m(g)?g:"https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png";var h,k,n,p=d.hotSpot;m(p)?(h=[p.x,p.y],k=p.Re,n=p.Se):"https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png"===g?(h=ks,n=k="pixels"):/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(g)&&
(h=[.5,0],n=k="fraction");var q,p=f.x,r=f.y;m(p)&&m(r)&&(q=[p,r]);var s,p=f.w,f=f.h;m(p)&&m(f)&&(s=[p,f]);var u,f=d.heading;m(f)&&(u=Zb(f));d=d.scale;"https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png"==g&&(s=ls);h=new vj({anchor:h,anchorOrigin:"bottom-left",anchorXUnits:k,anchorYUnits:n,crossOrigin:"anonymous",offset:q,offsetOrigin:"bottom-left",rotation:u,scale:d,size:s,src:g});e.imageStyle=h}},LabelStyle:function(b,c){var d=U({},Qs,b,c);m(d)&&(c[c.length-1].textStyle=new ds({fill:new nl({color:zb(d,
"color",is)}),scale:d.scale}))},LineStyle:function(b,c){var d=U({},Rs,b,c);m(d)&&(c[c.length-1].strokeStyle=new jl({color:zb(d,"color",is),width:zb(d,"width",1)}))},PolyStyle:function(b,c){var d=U({},Ys,b,c);if(m(d)){var e=c[c.length-1];e.fillStyle=new nl({color:zb(d,"color",is)});var f=d.fill;m(f)&&(e.fill=f);d=d.outline;m(d)&&(e.outline=d)}}}),Ws=S(hs,{Pair:function(b,c){var d=U({},Vs,b,c);if(m(d)){var e=d.key;m(e)&&"normal"==e&&(e=d.styleUrl,m(e)&&(c[c.length-1]=e),d=d.Style,m(d)&&(c[c.length-
1]=d))}}});l=es.prototype;l.eg=function(b,c){Op(b);var d=S(hs,{Folder:eq(this.eg,this),Placemark:fq(this.Je,this),Style:ra(this.Kl,this),StyleMap:ra(this.Jl,this)}),d=U([],d,b,c,this);if(m(d))return d};l.Je=function(b,c){var d=U({geometry:null},Xs,b,c);if(m(d)){var e=new P,f=b.getAttribute("id");null===f||e.c(f);f=c[0];null!=d.geometry&&sp(d.geometry,!1,f);e.C(d);this.b&&e.i(this.c);return e}};
l.Kl=function(b,c){var d=b.getAttribute("id");if(null!==d){var e=Gs(b,c);m(e)&&(d=null!=b.baseURI?Yr(b.baseURI,"#"+d).toString():"#"+d,this.d[d]=e)}};l.Jl=function(b,c){var d=b.getAttribute("id");if(null!==d){var e=U(void 0,Ws,b,c);m(e)&&(d=null!=b.baseURI?Yr(b.baseURI,"#"+d).toString():"#"+d,this.d[d]=e)}};l.fg=function(b,c){if(!Wa(hs,b.namespaceURI))return null;var d=this.Je(b,[qp(this,b,c)]);return m(d)?d:null};
l.Ob=function(b,c){if(!Wa(hs,b.namespaceURI))return[];var d;d=Op(b);if("Document"==d||"Folder"==d)return d=this.eg(b,[qp(this,b,c)]),m(d)?d:[];if("Placemark"==d)return d=this.Je(b,[qp(this,b,c)]),m(d)?[d]:[];if("kml"==d){d=[];var e;for(e=b.firstElementChild;null!==e;e=e.nextElementSibling){var f=this.Ob(e,c);m(f)&&ab(d,f)}return d}return[]};l.El=function(b){if(Rp(b))return Zs(this,b);if(Up(b))return $s(this,b);if(ia(b))return b=dq(b),Zs(this,b)};
function Zs(b,c){var d;for(d=c.firstChild;null!==d;d=d.nextSibling)if(1==d.nodeType){var e=$s(b,d);if(m(e))return e}}function $s(b,c){var d;for(d=c.firstElementChild;null!==d;d=d.nextElementSibling)if(Wa(hs,d.namespaceURI)&&"name"==d.localName)return V(d);for(d=c.firstElementChild;null!==d;d=d.nextElementSibling){var e=Op(d);if(Wa(hs,d.namespaceURI)&&("Document"==e||"Folder"==e||"Placemark"==e||"kml"==e)&&(e=$s(b,d),m(e)))return e}}
l.Fl=function(b){var c=[];Rp(b)?ab(c,at(this,b)):Up(b)?ab(c,bt(this,b)):ia(b)&&(b=dq(b),ab(c,at(this,b)));return c};function at(b,c){var d,e=[];for(d=c.firstChild;null!==d;d=d.nextSibling)1==d.nodeType&&ab(e,bt(b,d));return e}
function bt(b,c){var d,e=[];for(d=c.firstElementChild;null!==d;d=d.nextElementSibling)if(Wa(hs,d.namespaceURI)&&"NetworkLink"==d.localName){var f=U({},Us,d,[]);e.push(f)}for(d=c.firstElementChild;null!==d;d=d.nextElementSibling)f=Op(d),!Wa(hs,d.namespaceURI)||"Document"!=f&&"Folder"!=f&&"kml"!=f||ab(e,bt(b,d));return e}function ct(b,c){var d=pg(c),d=[255*(4==d.length?d[3]:1),d[2],d[1],d[0]],e;for(e=0;4>e;++e){var f=parseInt(d[e],10).toString(16);d[e]=1==f.length?"0"+f:f}Cq(b,d.join(""))}
function dt(b,c,d){pq({node:b},et,ft,[c],d)}function gt(b,c,d){var e={node:b};null!=c.aa&&b.setAttribute("id",c.aa);b=c.I();var f=c.a;m(f)&&(f=f.call(c,0),null!==f&&0<f.length&&(b.Style=f[0],f=f[0].d,null===f||(b.name=f.b)));f=ht[d[d.length-1].node.namespaceURI];b=nq(b,f);pq(e,it,mq,b,d,f);b=d[0];c=c.R();null!=c&&(c=sp(c,!0,b));pq(e,it,jt,[c],d)}function kt(b,c,d){var e=c.j;b={node:b};b.layout=c.a;b.stride=c.B;pq(b,lt,mt,[e],d)}
function nt(b,c,d){c=c.ld();var e=c.shift();b={node:b};pq(b,ot,pt,c,d);pq(b,ot,qt,[e],d)}function rt(b,c){Dq(b,c*c)}
var st=iq(hs,["Document","Placemark"]),vt=iq(hs,{Document:T(function(b,c,d){pq({node:b},tt,ut,c,d)}),Placemark:T(gt)}),tt=iq(hs,{Placemark:T(gt)}),wt={Point:"Point",LineString:"LineString",LinearRing:"LinearRing",Polygon:"Polygon",MultiPoint:"MultiGeometry",MultiLineString:"MultiGeometry",MultiPolygon:"MultiGeometry"},xt=iq(hs,["href"],iq(gs,["x","y","w","h"])),yt=iq(hs,{href:T(Cq)},iq(gs,{x:T(Dq),y:T(Dq),w:T(Dq),h:T(Dq)})),zt=iq(hs,["scale","heading","Icon","hotSpot"]),Bt=iq(hs,{Icon:T(function(b,
c,d){b={node:b};var e=xt[d[d.length-1].node.namespaceURI],f=nq(c,e);pq(b,yt,mq,f,d,e);e=xt[gs[0]];f=nq(c,e);pq(b,yt,At,f,d,e)}),heading:T(Dq),hotSpot:T(function(b,c){b.setAttribute("x",c.x);b.setAttribute("y",c.y);b.setAttribute("xunits",c.Re);b.setAttribute("yunits",c.Se)}),scale:T(rt)}),Ct=iq(hs,["color","scale"]),Dt=iq(hs,{color:T(ct),scale:T(rt)}),Et=iq(hs,["color","width"]),Ft=iq(hs,{color:T(ct),width:T(Dq)}),et=iq(hs,{LinearRing:T(kt)}),Gt=iq(hs,{LineString:T(kt),Point:T(kt),Polygon:T(nt)}),
ht=iq(hs,"name open visibility address phoneNumber description styleUrl Style".split(" ")),it=iq(hs,{MultiGeometry:T(function(b,c,d){b={node:b};var e=c.O(),f,g;"MultiPoint"==e?(f=c.Gd(),g=Ht):"MultiLineString"==e?(f=c.Lc(),g=It):"MultiPolygon"==e&&(f=c.qd(),g=Jt);pq(b,Gt,g,f,d)}),LineString:T(kt),LinearRing:T(kt),Point:T(kt),Polygon:T(nt),Style:T(function(b,c,d){b={node:b};var e={},f=c.f,g=c.b,h=c.e;c=c.d;null===h||(e.IconStyle=h);null===c||(e.LabelStyle=c);null===g||(e.LineStyle=g);null===f||(e.PolyStyle=
f);c=Kt[d[d.length-1].node.namespaceURI];e=nq(e,c);pq(b,Lt,mq,e,d,c)}),address:T(Cq),description:T(Cq),name:T(Cq),open:T(Bq),phoneNumber:T(Cq),styleUrl:T(Cq),visibility:T(Bq)}),lt=iq(hs,{coordinates:T(function(b,c,d){d=d[d.length-1];var e=d.layout;d=d.stride;var f;"XY"==e||"XYM"==e?f=2:("XYZ"==e||"XYZM"==e)&&(f=3);var g,h=c.length,k="";if(0<h){k+=c[0];for(e=1;e<f;++e)k+=","+c[e];for(g=d;g<h;g+=d)for(k+=" "+c[g],e=1;e<f;++e)k+=","+c[g+e]}Cq(b,k)})}),ot=iq(hs,{outerBoundaryIs:T(dt),innerBoundaryIs:T(dt)}),
Mt=iq(hs,{color:T(ct)}),Kt=iq(hs,["IconStyle","LabelStyle","LineStyle","PolyStyle"]),Lt=iq(hs,{IconStyle:T(function(b,c,d){b={node:b};var e={},f=c.gb(),g=c.kd(),h={href:c.a.e};if(null!==f){h.w=f[0];h.h=f[1];var k=c.wb(),n=c.Cb();null!==n&&null!==g&&0!==n[0]&&n[1]!==f[1]&&(h.x=n[0],h.y=g[1]-(n[1]+f[1]));null===k||0===k[0]||k[1]===f[1]||(e.hotSpot={x:k[0],Re:"pixels",y:f[1]-k[1],Se:"pixels"})}e.Icon=h;f=c.k;1!==f&&(e.scale=f);c=c.i;0!==c&&(e.heading=c);c=zt[d[d.length-1].node.namespaceURI];e=nq(e,c);
pq(b,Bt,mq,e,d,c)}),LabelStyle:T(function(b,c,d){b={node:b};var e={},f=c.a;null===f||(e.color=f.a);c=c.d;m(c)&&1!==c&&(e.scale=c);c=Ct[d[d.length-1].node.namespaceURI];e=nq(e,c);pq(b,Dt,mq,e,d,c)}),LineStyle:T(function(b,c,d){b={node:b};var e=Et[d[d.length-1].node.namespaceURI];c=nq({color:c.a,width:c.d},e);pq(b,Ft,mq,c,d,e)}),PolyStyle:T(function(b,c,d){pq({node:b},Mt,Nt,[c.a],d)})});function At(b,c,d){return Jp(gs[0],"gx:"+d)}
function ut(b,c){return Jp(c[c.length-1].node.namespaceURI,"Placemark")}function jt(b,c){if(null!=b)return Jp(c[c.length-1].node.namespaceURI,wt[b.O()])}var Nt=kq("color"),mt=kq("coordinates"),pt=kq("innerBoundaryIs"),Ht=kq("Point"),It=kq("LineString"),ft=kq("LinearRing"),Jt=kq("Polygon"),qt=kq("outerBoundaryIs");
es.prototype.a=function(b,c){c=rp(this,c);var d=Jp(hs[4],"kml");cq(d,"http://www.w3.org/2000/xmlns/","xmlns:gx",gs[0]);cq(d,"http://www.w3.org/2000/xmlns/","xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance");cq(d,"http://www.w3.org/2001/XMLSchema-instance","xsi:schemaLocation","http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd");var e={node:d},f={};1<b.length?f.Document=b:1==b.length&&(f.Placemark=b[0]);var g=st[d.namespaceURI],f=nq(f,g);pq(e,vt,mq,f,[c],g);
return d};function Ot(){this.defaultDataProjection=null;this.defaultDataProjection=Be("EPSG:4326")}v(Ot,qq);function Pt(b,c){c[c.length-1].Vc[b.getAttribute("k")]=b.getAttribute("v")}
var Qt=[null],Rt=S(Qt,{nd:function(b,c){c[c.length-1].rc.push(b.getAttribute("ref"))},tag:Pt}),Tt=S(Qt,{node:function(b,c){var d=c[0],e=c[c.length-1],f=b.getAttribute("id"),g=[parseFloat(b.getAttribute("lon")),parseFloat(b.getAttribute("lat"))];e.Cf[f]=g;var h=U({Vc:{}},St,b,c);wb(h.Vc)||(g=new Ik(g),sp(g,!1,d),d=new P(g),d.c(f),d.C(h.Vc),e.features.push(d))},way:function(b,c){for(var d=c[0],e=b.getAttribute("id"),f=U({rc:[],Vc:{}},Rt,b,c),g=c[c.length-1],h=[],k=0,n=f.rc.length;k<n;k++)ab(h,g.Cf[f.rc[k]]);
f.rc[0]==f.rc[f.rc.length-1]?(k=new F(null),Uk(k,"XY",h,[h.length])):(k=new K(null),Nm(k,"XY",h));sp(k,!1,d);d=new P(k);d.c(e);d.C(f.Vc);g.features.push(d)}}),St=S(Qt,{tag:Pt});Ot.prototype.Ob=function(b,c){var d=qp(this,b,c);return"osm"==b.localName&&(d=U({Cf:{},features:[]},Tt,b,[d]),m(d.features))?d.features:[]};function Ut(b){return b.getAttributeNS("http://www.w3.org/1999/xlink","href")};function Vt(){}Vt.prototype.b=function(b){return Rp(b)?this.d(b):Up(b)?this.a(b):ia(b)?(b=dq(b),this.d(b)):null};function Wt(){}v(Wt,Vt);Wt.prototype.d=function(b){for(b=b.firstChild;null!==b;b=b.nextSibling)if(1==b.nodeType)return this.a(b);return null};Wt.prototype.a=function(b){b=U({},Xt,b,[]);return m(b)?b:null};
var Yt=[null,"http://www.opengis.net/ows/1.1"],Xt=S(Yt,{ServiceIdentification:R(function(b,c){return U({},Zt,b,c)}),ServiceProvider:R(function(b,c){return U({},$t,b,c)}),OperationsMetadata:R(function(b,c){return U({},au,b,c)})}),bu=S(Yt,{DeliveryPoint:R(V),City:R(V),AdministrativeArea:R(V),PostalCode:R(V),Country:R(V),ElectronicMailAddress:R(V)}),cu=S(Yt,{Value:hq(function(b){return V(b)})}),du=S(Yt,{AllowedValues:R(function(b,c){return U({},cu,b,c)})}),fu=S(Yt,{Phone:R(function(b,c){return U({},
eu,b,c)}),Address:R(function(b,c){return U({},bu,b,c)})}),hu=S(Yt,{HTTP:R(function(b,c){return U({},gu,b,c)})}),gu=S(Yt,{Get:hq(function(b,c){var d=Ut(b);return m(d)?U({href:d},iu,b,c):void 0}),Post:void 0}),ju=S(Yt,{DCP:R(function(b,c){return U({},hu,b,c)})}),au=S(Yt,{Operation:function(b,c){var d=b.getAttribute("name"),e=U({},ju,b,c);m(e)&&(c[c.length-1][d]=e)}}),eu=S(Yt,{Voice:R(V),Facsimile:R(V)}),iu=S(Yt,{Constraint:hq(function(b,c){var d=b.getAttribute("name");return m(d)?U({name:d},du,b,c):
void 0})}),ku=S(Yt,{IndividualName:R(V),PositionName:R(V),ContactInfo:R(function(b,c){return U({},fu,b,c)})}),Zt=S(Yt,{Title:R(V),ServiceTypeVersion:R(V),ServiceType:R(V)}),$t=S(Yt,{ProviderName:R(V),ProviderSite:R(Ut),ServiceContact:R(function(b,c){return U({},ku,b,c)})});function lu(b,c,d,e){var f;m(e)?f=m(void 0)?void 0:0:(e=[],f=0);var g,h;for(g=0;g<c;)for(h=b[g++],e[f++]=b[g++],e[f++]=h,h=2;h<d;++h)e[f++]=b[g++];e.length=f};function mu(b){b=m(b)?b:{};this.defaultDataProjection=null;this.defaultDataProjection=Be("EPSG:4326");this.a=m(b.factor)?b.factor:1E5}v(mu,yr);function nu(b,c,d){d=m(d)?d:1E5;var e,f=Array(c);for(e=0;e<c;++e)f[e]=0;var g,h;g=0;for(h=b.length;g<h;)for(e=0;e<c;++e,++g){var k=b[g],n=k-f[e];f[e]=k;b[g]=n}return ou(b,d)}function pu(b,c,d){var e=m(d)?d:1E5,f=Array(c);for(d=0;d<c;++d)f[d]=0;b=qu(b,e);var g,e=0;for(g=b.length;e<g;)for(d=0;d<c;++d,++e)f[d]+=b[e],b[e]=f[d];return b}
function ou(b,c){var d=m(c)?c:1E5,e,f;e=0;for(f=b.length;e<f;++e)b[e]=Math.round(b[e]*d);d=0;for(e=b.length;d<e;++d)f=b[d],b[d]=0>f?~(f<<1):f<<1;d="";e=0;for(f=b.length;e<f;++e){for(var g=b[e],h=void 0,k="";32<=g;)h=(32|g&31)+63,k+=String.fromCharCode(h),g>>=5;h=g+63;k+=String.fromCharCode(h);d+=k}return d}
function qu(b,c){var d=m(c)?c:1E5,e=[],f=0,g=0,h,k;h=0;for(k=b.length;h<k;++h){var n=b.charCodeAt(h)-63,f=f|(n&31)<<g;32>n?(e.push(f),g=f=0):g+=5}f=0;for(g=e.length;f<g;++f)h=e[f],e[f]=h&1?~(h>>1):h>>1;f=0;for(g=e.length;f<g;++f)e[f]/=d;return e}l=mu.prototype;l.Qc=function(b,c){var d=this.Sc(b,c);return new P(d)};l.He=function(b,c){return[this.Qc(b,c)]};l.Sc=function(b,c){var d=pu(b,2,this.a);lu(d,d.length,2,d);d=Ck(d,0,d.length,2);return sp(new K(d),!1,rp(this,c))};
l.ce=function(b,c){var d=b.R();return null!=d?this.Yc(d,c):""};l.zg=function(b,c){return this.ce(b[0],c)};l.Yc=function(b,c){b=sp(b,!0,rp(this,c));var d=b.j,e=b.B;lu(d,d.length,e,d);return nu(d,e,this.a)};function ru(b){b=m(b)?b:{};this.defaultDataProjection=null;this.defaultDataProjection=Be(null!=b.defaultDataProjection?b.defaultDataProjection:"EPSG:4326")}v(ru,vp);function su(b,c){var d=[],e,f,g,h;g=0;for(h=b.length;g<h;++g)e=b[g],0<g&&d.pop(),0<=e?f=c[e]:f=c[~e].slice().reverse(),d.push.apply(d,f);e=0;for(f=d.length;e<f;++e)d[e]=d[e].slice();return d}function tu(b,c,d,e,f){b=b.geometries;var g=[],h,k;h=0;for(k=b.length;h<k;++h)g[h]=uu(b[h],c,d,e,f);return g}
function uu(b,c,d,e,f){var g=b.type,h=vu[g];c="Point"===g||"MultiPoint"===g?h(b,d,e):h(b,c);d=new P;d.Sa(sp(c,!1,f));m(b.id)&&d.c(b.id);m(b.properties)&&d.C(b.properties);return d}
ru.prototype.b=function(b,c){if("Topology"==b.type){var d,e=null,f=null;m(b.transform)&&(d=b.transform,e=d.scale,f=d.translate);var g=b.arcs;if(m(d)){d=e;var h=f,k,n;k=0;for(n=g.length;k<n;++k)for(var p=g[k],q=d,r=h,s=0,u=0,z=void 0,y=void 0,A=void 0,y=0,A=p.length;y<A;++y)z=p[y],s+=z[0],u+=z[1],z[0]=s,z[1]=u,wu(z,q,r)}d=[];h=rb(b.objects);k=0;for(n=h.length;k<n;++k)"GeometryCollection"===h[k].type?(p=h[k],d.push.apply(d,tu(p,g,e,f,c))):(p=h[k],d.push(uu(p,g,e,f,c)));return d}return[]};
function wu(b,c,d){b[0]=b[0]*c[0]+d[0];b[1]=b[1]*c[1]+d[1]}ru.prototype.Ja=function(){return this.defaultDataProjection};
var vu={Point:function(b,c,d){b=b.coordinates;null===c||null===d||wu(b,c,d);return new Ik(b)},LineString:function(b,c){var d=su(b.arcs,c);return new K(d)},Polygon:function(b,c){var d=[],e,f;e=0;for(f=b.arcs.length;e<f;++e)d[e]=su(b.arcs[e],c);return new F(d)},MultiPoint:function(b,c,d){b=b.coordinates;var e,f;if(null!==c&&null!==d)for(e=0,f=b.length;e<f;++e)wu(b[e],c,d);return new Rm(b)},MultiLineString:function(b,c){var d=[],e,f;e=0;for(f=b.arcs.length;e<f;++e)d[e]=su(b.arcs[e],c);return new Om(d)},
MultiPolygon:function(b,c){var d=[],e,f,g,h,k,n;k=0;for(n=b.arcs.length;k<n;++k){e=b.arcs[k];f=[];g=0;for(h=e.length;g<h;++g)f[g]=su(e[g],c);d[k]=f}return new Sm(d)}};function xu(b){b=m(b)?b:{};this.f=b.featureType;this.b=b.featureNS;this.d=m(b.gmlFormat)?b.gmlFormat:new Fq;this.c=m(b.schemaLocation)?b.schemaLocation:"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd";this.defaultDataProjection=null}v(xu,qq);xu.prototype.Ob=function(b,c){var d={featureType:this.f,featureNS:this.b};Db(d,qp(this,b,m(c)?c:{}));d=[d];this.d.d["http://www.opengis.net/gml"].featureMember=fq(tq.prototype.Sd);d=U([],this.d.d,b,d,this.d);m(d)||(d=[]);return d};
xu.prototype.g=function(b){if(Rp(b))return yu(b);if(Up(b))return U({},zu,b,[]);if(ia(b))return b=dq(b),yu(b)};xu.prototype.e=function(b){if(Rp(b))return Au(this,b);if(Up(b))return Bu(this,b);if(ia(b))return b=dq(b),Au(this,b)};function Au(b,c){for(var d=c.firstChild;null!==d;d=d.nextSibling)if(1==d.nodeType)return Bu(b,d)}var Cu={"http://www.opengis.net/gml":{boundedBy:R(tq.prototype.Ud,"bounds")}};
function Bu(b,c){var d={},e=Aq(c.getAttribute("numberOfFeatures"));d.numberOfFeatures=e;return U(d,Cu,c,[],b.d)}
var Du={"http://www.opengis.net/wfs":{totalInserted:R(zq),totalUpdated:R(zq),totalDeleted:R(zq)}},Eu={"http://www.opengis.net/ogc":{FeatureId:fq(function(b){return b.getAttribute("fid")})}},Fu={"http://www.opengis.net/wfs":{Feature:function(b,c){oq(Eu,b,c)}}},zu={"http://www.opengis.net/wfs":{TransactionSummary:R(function(b,c){return U({},Du,b,c)},"transactionSummary"),InsertResults:R(function(b,c){return U([],Fu,b,c)},"insertIds")}};
function yu(b){for(b=b.firstChild;null!==b;b=b.nextSibling)if(1==b.nodeType)return U({},zu,b,[])}var Gu={"http://www.opengis.net/wfs":{PropertyName:T(Cq)}};function Hu(b,c){var d=Jp("http://www.opengis.net/ogc","Filter"),e=Jp("http://www.opengis.net/ogc","FeatureId");d.appendChild(e);e.setAttribute("fid",c);b.appendChild(d)}
var Iu={"http://www.opengis.net/wfs":{Insert:T(function(b,c,d){var e=d[d.length-1],e=Jp(e.featureNS,e.featureType);b.appendChild(e);Fq.prototype.yg(e,c,d)}),Update:T(function(b,c,d){var e=d[d.length-1],f=e.featureType,g=e.featurePrefix,g=m(g)?g:"feature",h=e.featureNS;b.setAttribute("typeName",g+":"+f);cq(b,"http://www.w3.org/2000/xmlns/","xmlns:"+g,h);f=c.aa;if(m(f)){for(var g=c.G(),h=[],k=0,n=g.length;k<n;k++){var p=c.get(g[k]);m(p)&&h.push({name:g[k],value:p})}pq({node:b,srsName:e.srsName},Iu,
kq("Property"),h,d);Hu(b,f)}}),Delete:T(function(b,c,d){var e=d[d.length-1];d=e.featureType;var f=e.featurePrefix,f=m(f)?f:"feature",e=e.featureNS;b.setAttribute("typeName",f+":"+d);cq(b,"http://www.w3.org/2000/xmlns/","xmlns:"+f,e);c=c.aa;m(c)&&Hu(b,c)}),Property:T(function(b,c,d){var e=Jp("http://www.opengis.net/wfs","Name");b.appendChild(e);Cq(e,c.name);null!=c.value&&(e=Jp("http://www.opengis.net/wfs","Value"),b.appendChild(e),c.value instanceof kk?Fq.prototype.de(e,c.value,d):Cq(e,c.value))}),
Native:T(function(b,c){m(c.rm)&&b.setAttribute("vendorId",c.rm);m(c.Ul)&&b.setAttribute("safeToIgnore",c.Ul);m(c.value)&&Cq(b,c.value)})}},Ju={"http://www.opengis.net/wfs":{Query:T(function(b,c,d){var e=d[d.length-1],f=e.featurePrefix,g=e.featureNS,h=e.propertyNames,k=e.srsName;b.setAttribute("typeName",(m(f)?f+":":"")+c);m(k)&&b.setAttribute("srsName",k);m(g)&&cq(b,"http://www.w3.org/2000/xmlns/","xmlns:"+f,g);c=Bb(e);c.node=b;pq(c,Gu,kq("PropertyName"),h,d);e=e.bbox;m(e)&&(h=Jp("http://www.opengis.net/ogc",
"Filter"),c=d[d.length-1].geometryName,f=Jp("http://www.opengis.net/ogc","BBOX"),h.appendChild(f),g=Jp("http://www.opengis.net/ogc","PropertyName"),Cq(g,c),f.appendChild(g),Fq.prototype.de(f,e,d),b.appendChild(h))})}};
xu.prototype.n=function(b){var c=Jp("http://www.opengis.net/wfs","GetFeature");c.setAttribute("service","WFS");c.setAttribute("version","1.1.0");m(b)&&(m(b.handle)&&c.setAttribute("handle",b.handle),m(b.outputFormat)&&c.setAttribute("outputFormat",b.outputFormat),m(b.maxFeatures)&&c.setAttribute("maxFeatures",b.maxFeatures),m(b.resultType)&&c.setAttribute("resultType",b.resultType),m(b.jm)&&c.setAttribute("startIndex",b.jm),m(b.count)&&c.setAttribute("count",b.count));cq(c,"http://www.w3.org/2001/XMLSchema-instance",
"xsi:schemaLocation",this.c);var d=b.featureTypes;b=[{node:c,srsName:b.srsName,featureNS:m(b.featureNS)?b.featureNS:this.b,featurePrefix:b.featurePrefix,geometryName:b.geometryName,bbox:b.bbox,cg:m(b.cg)?b.cg:[]}];var e=Bb(b[b.length-1]);e.node=c;pq(e,Ju,kq("Query"),d,b);return c};
xu.prototype.q=function(b,c,d,e){var f=[],g=Jp("http://www.opengis.net/wfs","Transaction");g.setAttribute("service","WFS");g.setAttribute("version","1.1.0");var h,k;m(e)&&(h=m(e.gmlOptions)?e.gmlOptions:{},m(e.handle)&&g.setAttribute("handle",e.handle));cq(g,"http://www.w3.org/2001/XMLSchema-instance","xsi:schemaLocation",this.c);null!=b&&(k={node:g,featureNS:e.featureNS,featureType:e.featureType,featurePrefix:e.featurePrefix},Db(k,h),pq(k,Iu,kq("Insert"),b,f));null!=c&&(k={node:g,featureNS:e.featureNS,
featureType:e.featureType,featurePrefix:e.featurePrefix},Db(k,h),pq(k,Iu,kq("Update"),c,f));null!=d&&pq({node:g,featureNS:e.featureNS,featureType:e.featureType,featurePrefix:e.featurePrefix},Iu,kq("Delete"),d,f);m(e.nativeElements)&&pq({node:g,featureNS:e.featureNS,featureType:e.featureType,featurePrefix:e.featurePrefix},Iu,kq("Native"),e.nativeElements,f);return g};xu.prototype.Ke=function(b){for(b=b.firstChild;null!==b;b=b.nextSibling)if(1==b.nodeType)return this.Xd(b);return null};
xu.prototype.Xd=function(b){if(null!=b.firstElementChild&&null!=b.firstElementChild.firstElementChild)for(b=b.firstElementChild.firstElementChild,b=b.firstElementChild;null!==b;b=b.nextElementSibling)if(0!==b.childNodes.length&&(1!==b.childNodes.length||3!==b.firstChild.nodeType)){var c=[{}];this.d.Ud(b,c);return Be(c.pop().srsName)}return null};function Ku(b){b=m(b)?b:{};this.defaultDataProjection=null;this.a=m(b.splitCollection)?b.splitCollection:!1}v(Ku,yr);function Lu(b){b=b.Q();return 0==b.length?"":b[0]+" "+b[1]}function Mu(b){b=b.Q();for(var c=[],d=0,e=b.length;d<e;++d)c.push(b[d][0]+" "+b[d][1]);return c.join(",")}function Nu(b){var c=[];b=b.ld();for(var d=0,e=b.length;d<e;++d)c.push("("+Mu(b[d])+")");return c.join(",")}function Ou(b){var c=b.O();b=(0,Pu[c])(b);c=c.toUpperCase();return 0===b.length?c+" EMPTY":c+"("+b+")"}
var Pu={Point:Lu,LineString:Mu,Polygon:Nu,MultiPoint:function(b){var c=[];b=b.Gd();for(var d=0,e=b.length;d<e;++d)c.push("("+Lu(b[d])+")");return c.join(",")},MultiLineString:function(b){var c=[];b=b.Lc();for(var d=0,e=b.length;d<e;++d)c.push("("+Mu(b[d])+")");return c.join(",")},MultiPolygon:function(b){var c=[];b=b.qd();for(var d=0,e=b.length;d<e;++d)c.push("("+Nu(b[d])+")");return c.join(",")},GeometryCollection:function(b){var c=[];b=b.nf();for(var d=0,e=b.length;d<e;++d)c.push(Ou(b[d]));return c.join(",")}};
l=Ku.prototype;l.Qc=function(b,c){var d=this.Sc(b,c);if(m(d)){var e=new P;e.Sa(d);return e}return null};l.He=function(b,c){var d=[],e=this.Sc(b,c);this.a&&"GeometryCollection"==e.O()?d=e.c:d=[e];for(var f=[],g=0,h=d.length;g<h;++g)e=new P,e.Sa(d[g]),f.push(e);return f};l.Sc=function(b,c){var d;d=new Qu(new Ru(b));d.a=Su(d.d);d=Tu(d);return m(d)?sp(d,!1,c):null};l.ce=function(b,c){var d=b.R();return m(d)?this.Yc(d,c):""};
l.zg=function(b,c){if(1==b.length)return this.ce(b[0],c);for(var d=[],e=0,f=b.length;e<f;++e)d.push(b[e].R());d=new Gm(d);return this.Yc(d,c)};l.Yc=function(b,c){return Ou(sp(b,!0,c))};function Ru(b){this.d=b;this.a=-1}function Uu(b,c){var d=m(c)?c:!1;return"0"<=b&&"9">=b||"."==b&&!d}
function Su(b){var c=b.d.charAt(++b.a),d={position:b.a,value:c};if("("==c)d.type=2;else if(","==c)d.type=5;else if(")"==c)d.type=3;else if(Uu(c)||"-"==c){d.type=4;var e,c=b.a,f=!1;do"."==e&&(f=!0),e=b.d.charAt(++b.a);while(Uu(e,f));b=parseFloat(b.d.substring(c,b.a--));d.value=b}else if("a"<=c&&"z">=c||"A"<=c&&"Z">=c){d.type=1;c=b.a;do e=b.d.charAt(++b.a);while("a"<=e&&"z">=e||"A"<=e&&"Z">=e);b=b.d.substring(c,b.a--).toUpperCase();d.value=b}else{if(" "==c||"\t"==c||"\r"==c||"\n"==c)return Su(b);if(""===
c)d.type=6;else throw Error("Unexpected character: "+c);}return d}function Qu(b){this.d=b}l=Qu.prototype;l.match=function(b){if(b=this.a.type==b)this.a=Su(this.d);return b};
function Tu(b){var c=b.a;if(b.match(1)){var d=c.value;if("GEOMETRYCOLLECTION"==d){a:{if(b.match(2)){c=[];do c.push(Tu(b));while(b.match(5));if(b.match(3)){b=c;break a}}else if(Vu(b)){b=[];break a}throw Error(Wu(b));}return new Gm(b)}var e=Xu[d],c=Yu[d];if(!m(e)||!m(c))throw Error("Invalid geometry type: "+d);b=e.call(b);return new c(b)}throw Error(Wu(b));}l.Ee=function(){if(this.match(2)){var b=Zu(this);if(this.match(3))return b}else if(Vu(this))return null;throw Error(Wu(this));};
l.De=function(){if(this.match(2)){var b=$u(this);if(this.match(3))return b}else if(Vu(this))return[];throw Error(Wu(this));};l.Fe=function(){if(this.match(2)){var b=av(this);if(this.match(3))return b}else if(Vu(this))return[];throw Error(Wu(this));};l.nl=function(){if(this.match(2)){var b;if(2==this.a.type)for(b=[this.Ee()];this.match(5);)b.push(this.Ee());else b=$u(this);if(this.match(3))return b}else if(Vu(this))return[];throw Error(Wu(this));};
l.ml=function(){if(this.match(2)){var b=av(this);if(this.match(3))return b}else if(Vu(this))return[];throw Error(Wu(this));};l.ol=function(){if(this.match(2)){for(var b=[this.Fe()];this.match(5);)b.push(this.Fe());if(this.match(3))return b}else if(Vu(this))return[];throw Error(Wu(this));};function Zu(b){for(var c=[],d=0;2>d;++d){var e=b.a;if(b.match(4))c.push(e.value);else break}if(2==c.length)return c;throw Error(Wu(b));}function $u(b){for(var c=[Zu(b)];b.match(5);)c.push(Zu(b));return c}
function av(b){for(var c=[b.De()];b.match(5);)c.push(b.De());return c}function Vu(b){var c=1==b.a.type&&"EMPTY"==b.a.value;c&&(b.a=Su(b.d));return c}function Wu(b){return"Unexpected `"+b.a.value+"` at position "+b.a.position+" in `"+b.d.d+"`"}var Yu={POINT:Ik,LINESTRING:K,POLYGON:F,MULTIPOINT:Rm,MULTILINESTRING:Om,MULTIPOLYGON:Sm},Xu={POINT:Qu.prototype.Ee,LINESTRING:Qu.prototype.De,POLYGON:Qu.prototype.Fe,MULTIPOINT:Qu.prototype.nl,MULTILINESTRING:Qu.prototype.ml,MULTIPOLYGON:Qu.prototype.ol};function bv(){this.version=void 0}v(bv,Vt);bv.prototype.d=function(b){for(b=b.firstChild;null!==b;b=b.nextSibling)if(1==b.nodeType)return this.a(b);return null};bv.prototype.a=function(b){this.version=Aa(b.getAttribute("version"));b=U({version:this.version},cv,b,[]);return m(b)?b:null};function dv(b,c){return U({},ev,b,c)}function fv(b,c){return U({},gv,b,c)}function hv(b,c){var d=dv(b,c);if(m(d)){var e=[Aq(b.getAttribute("width")),Aq(b.getAttribute("height"))];d.size=e;return d}}
function iv(b,c){return U([],jv,b,c)}
var kv=[null,"http://www.opengis.net/wms"],cv=S(kv,{Service:R(function(b,c){return U({},lv,b,c)}),Capability:R(function(b,c){return U({},mv,b,c)})}),mv=S(kv,{Request:R(function(b,c){return U({},nv,b,c)}),Exception:R(function(b,c){return U([],ov,b,c)}),Layer:R(function(b,c){return U({},pv,b,c)})}),lv=S(kv,{Name:R(V),Title:R(V),Abstract:R(V),KeywordList:R(iv),OnlineResource:R(Ut),ContactInformation:R(function(b,c){return U({},qv,b,c)}),Fees:R(V),AccessConstraints:R(V),LayerLimit:R(zq),MaxWidth:R(zq),
MaxHeight:R(zq)}),qv=S(kv,{ContactPersonPrimary:R(function(b,c){return U({},rv,b,c)}),ContactPosition:R(V),ContactAddress:R(function(b,c){return U({},sv,b,c)}),ContactVoiceTelephone:R(V),ContactFacsimileTelephone:R(V),ContactElectronicMailAddress:R(V)}),rv=S(kv,{ContactPerson:R(V),ContactOrganization:R(V)}),sv=S(kv,{AddressType:R(V),Address:R(V),City:R(V),StateOrProvince:R(V),PostCode:R(V),Country:R(V)}),ov=S(kv,{Format:fq(V)}),pv=S(kv,{Name:R(V),Title:R(V),Abstract:R(V),KeywordList:R(iv),CRS:hq(V),
EX_GeographicBoundingBox:R(function(b,c){var d=U({},tv,b,c);if(m(d)){var e=d.westBoundLongitude,f=d.southBoundLatitude,g=d.eastBoundLongitude,d=d.northBoundLatitude;return m(e)&&m(f)&&m(g)&&m(d)?[e,f,g,d]:void 0}}),BoundingBox:hq(function(b){var c=[yq(b.getAttribute("minx")),yq(b.getAttribute("miny")),yq(b.getAttribute("maxx")),yq(b.getAttribute("maxy"))],d=[yq(b.getAttribute("resx")),yq(b.getAttribute("resy"))];return{crs:b.getAttribute("CRS"),extent:c,res:d}}),Dimension:hq(function(b){return{name:b.getAttribute("name"),
units:b.getAttribute("units"),unitSymbol:b.getAttribute("unitSymbol"),"default":b.getAttribute("default"),multipleValues:vq(b.getAttribute("multipleValues")),nearestValue:vq(b.getAttribute("nearestValue")),current:vq(b.getAttribute("current")),values:V(b)}}),Attribution:R(function(b,c){return U({},uv,b,c)}),AuthorityURL:hq(function(b,c){var d=dv(b,c);if(m(d))return d.name=b.getAttribute("name"),d}),Identifier:hq(V),MetadataURL:hq(function(b,c){var d=dv(b,c);if(m(d))return d.type=b.getAttribute("type"),
d}),DataURL:hq(dv),FeatureListURL:hq(dv),Style:hq(function(b,c){return U({},vv,b,c)}),MinScaleDenominator:R(xq),MaxScaleDenominator:R(xq),Layer:hq(function(b,c){var d=c[c.length-1],e=U({},pv,b,c);if(m(e)){var f=vq(b.getAttribute("queryable"));m(f)||(f=d.queryable);e.queryable=m(f)?f:!1;f=Aq(b.getAttribute("cascaded"));m(f)||(f=d.cascaded);e.cascaded=f;f=vq(b.getAttribute("opaque"));m(f)||(f=d.opaque);e.opaque=m(f)?f:!1;f=vq(b.getAttribute("noSubsets"));m(f)||(f=d.noSubsets);e.noSubsets=m(f)?f:!1;
f=yq(b.getAttribute("fixedWidth"));m(f)||(f=d.fixedWidth);e.fixedWidth=f;f=yq(b.getAttribute("fixedHeight"));m(f)||(f=d.fixedHeight);e.fixedHeight=f;Qa(["Style","CRS","AuthorityURL"],function(b){var c=d[b];if(m(c)){var f=Ab(e,b),f=f.concat(c);e[b]=f}});Qa("EX_GeographicBoundingBox BoundingBox Dimension Attribution MinScaleDenominator MaxScaleDenominator".split(" "),function(b){m(e[b])||(e[b]=d[b])});return e}})}),uv=S(kv,{Title:R(V),OnlineResource:R(Ut),LogoURL:R(hv)}),tv=S(kv,{westBoundLongitude:R(xq),
eastBoundLongitude:R(xq),southBoundLatitude:R(xq),northBoundLatitude:R(xq)}),nv=S(kv,{GetCapabilities:R(fv),GetMap:R(fv),GetFeatureInfo:R(fv)}),gv=S(kv,{Format:hq(V),DCPType:hq(function(b,c){return U({},wv,b,c)})}),wv=S(kv,{HTTP:R(function(b,c){return U({},xv,b,c)})}),xv=S(kv,{Get:R(dv),Post:R(dv)}),vv=S(kv,{Name:R(V),Title:R(V),Abstract:R(V),LegendURL:hq(hv),StyleSheetURL:R(dv),StyleURL:R(dv)}),ev=S(kv,{Format:R(V),OnlineResource:R(Ut)}),jv=S(kv,{Keyword:fq(V)});function yv(){this.b="http://mapserver.gis.umn.edu/mapserver";this.d=new Oq;this.defaultDataProjection=null}v(yv,qq);
function zv(b,c,d){c.namespaceURI=b.b;var e=Op(c),f=[];if(0===c.childNodes.length)return f;"msGMLOutput"==e&&Qa(c.childNodes,function(b){if(1===b.nodeType){var c=d[0],e=b.localName,n=RegExp,p;p="_layer".replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08");n=new n(p,"");e=e.replace(n,"")+"_feature";c.featureType=e;c.featureNS=this.b;n={};n[e]=fq(this.d.Ge,this.d);c=S([c.featureNS,null],n);b.namespaceURI=this.b;b=U([],c,b,d,this.d);m(b)&&ab(f,b)}},b);"FeatureCollection"==e&&(b=U([],
b.d.d,c,[{}],b.d),m(b)&&(f=b));return f}yv.prototype.Ob=function(b,c){var d={featureType:this.featureType,featureNS:this.featureNS};m(c)&&Db(d,qp(this,b,c));return zv(this,b,[d])};function Av(){this.c=new Wt}v(Av,Vt);Av.prototype.d=function(b){for(b=b.firstChild;null!==b;b=b.nextSibling)if(1==b.nodeType)return this.a(b);return null};Av.prototype.a=function(b){this.version=Aa(b.getAttribute("version"));var c=this.c.a(b);if(!m(c))return null;c.version=this.version;c=U(c,Bv,b,[]);return m(c)?c:null};function Cv(b){var c=V(b).split(" ");if(m(c)&&2==c.length)return b=+c[0],c=+c[1],isNaN(b)||isNaN(c)?void 0:[b,c]}
var Dv=[null,"http://www.opengis.net/wmts/1.0"],Ev=[null,"http://www.opengis.net/ows/1.1"],Bv=S(Dv,{Contents:R(function(b,c){return U({},Fv,b,c)})}),Fv=S(Dv,{Layer:hq(function(b,c){return U({},Gv,b,c)}),TileMatrixSet:hq(function(b,c){return U({},Hv,b,c)})}),Gv=S(Dv,{Style:hq(function(b,c){var d=U({},Iv,b,c);if(m(d)){var e="true"===b.getAttribute("isDefault");d.isDefault=e;return d}}),Format:hq(V),TileMatrixSetLink:hq(function(b,c){return U({},Jv,b,c)}),ResourceURL:hq(function(b){var c=b.getAttribute("format"),
d=b.getAttribute("template");b=b.getAttribute("resourceType");var e={};m(c)&&(e.format=c);m(d)&&(e.template=d);m(b)&&(e.resourceType=b);return e})},S(Ev,{Title:R(V),Abstract:R(V),WGS84BoundingBox:R(function(b,c){var d=U([],Kv,b,c);return 2!=d.length?void 0:Sd(d)}),Identifier:R(V)})),Iv=S(Dv,{LegendURL:hq(function(b){var c={};c.format=b.getAttribute("format");c.href=Ut(b);return c})},S(Ev,{Title:R(V),Identifier:R(V)})),Jv=S(Dv,{TileMatrixSet:R(V)}),Kv=S(Ev,{LowerCorner:fq(Cv),UpperCorner:fq(Cv)}),
Hv=S(Dv,{WellKnownScaleSet:R(V),TileMatrix:hq(function(b,c){return U({},Lv,b,c)})},S(Ev,{SupportedCRS:R(V),Identifier:R(V)})),Lv=S(Dv,{TopLeftCorner:R(Cv),ScaleDenominator:R(xq),TileWidth:R(zq),TileHeight:R(zq),MatrixWidth:R(zq),MatrixHeight:R(zq)},S(Ev,{Identifier:R(V)}));var Mv=new ve(6378137);function X(b){rd.call(this);b=m(b)?b:{};this.a=null;this.f=Ue;this.c=void 0;w(this,vd("projection"),this.tj,!1,this);w(this,vd("tracking"),this.uj,!1,this);m(b.projection)&&this.k(Be(b.projection));m(b.trackingOptions)&&this.q(b.trackingOptions);this.b(m(b.tracking)?b.tracking:!1)}v(X,rd);l=X.prototype;l.P=function(){this.b(!1);X.T.P.call(this)};l.tj=function(){var b=this.g();null!=b&&(this.f=Ae(Be("EPSG:4326"),b),null===this.a||this.set("position",this.f(this.a)))};
l.uj=function(){if($f){var b=this.i();b&&!m(this.c)?this.c=ba.navigator.geolocation.watchPosition(ra(this.vl,this),ra(this.wl,this),this.e()):!b&&m(this.c)&&(ba.navigator.geolocation.clearWatch(this.c),this.c=void 0)}};
l.vl=function(b){b=b.coords;this.set("accuracy",b.accuracy);this.set("altitude",null===b.altitude?void 0:b.altitude);this.set("altitudeAccuracy",null===b.altitudeAccuracy?void 0:b.altitudeAccuracy);this.set("heading",null===b.heading?void 0:Zb(b.heading));null===this.a?this.a=[b.longitude,b.latitude]:(this.a[0]=b.longitude,this.a[1]=b.latitude);var c=this.f(this.a);this.set("position",c);this.set("speed",null===b.speed?void 0:b.speed);b=Xk(Mv,this.a,b.accuracy);b.qa(this.f);this.set("accuracyGeometry",
b);this.l()};l.wl=function(b){b.type="error";this.b(!1);this.dispatchEvent(b)};l.mf=function(){return this.get("accuracy")};X.prototype.getAccuracy=X.prototype.mf;X.prototype.o=function(){return this.get("accuracyGeometry")||null};X.prototype.getAccuracyGeometry=X.prototype.o;X.prototype.p=function(){return this.get("altitude")};X.prototype.getAltitude=X.prototype.p;X.prototype.r=function(){return this.get("altitudeAccuracy")};X.prototype.getAltitudeAccuracy=X.prototype.r;X.prototype.H=function(){return this.get("heading")};
X.prototype.getHeading=X.prototype.H;X.prototype.N=function(){return this.get("position")};X.prototype.getPosition=X.prototype.N;X.prototype.g=function(){return this.get("projection")};X.prototype.getProjection=X.prototype.g;X.prototype.D=function(){return this.get("speed")};X.prototype.getSpeed=X.prototype.D;X.prototype.i=function(){return this.get("tracking")};X.prototype.getTracking=X.prototype.i;X.prototype.e=function(){return this.get("trackingOptions")};X.prototype.getTrackingOptions=X.prototype.e;
X.prototype.k=function(b){this.set("projection",b)};X.prototype.setProjection=X.prototype.k;X.prototype.b=function(b){this.set("tracking",b)};X.prototype.setTracking=X.prototype.b;X.prototype.q=function(b){this.set("trackingOptions",b)};X.prototype.setTrackingOptions=X.prototype.q;function Nv(b,c,d){for(var e=[],f=b(0),g=b(1),h=c(f),k=c(g),n=[g,f],p=[k,h],q=[1,0],r={},s=1E5,u,z,y,A,D;0<--s&&0<q.length;)y=q.pop(),f=n.pop(),h=p.pop(),g=y.toString(),g in r||(e.push(h[0],h[1]),r[g]=!0),A=q.pop(),g=n.pop(),k=p.pop(),D=(y+A)/2,u=b(D),z=c(u),sk(z[0],z[1],h[0],h[1],k[0],k[1])<d?(e.push(k[0],k[1]),g=A.toString(),r[g]=!0):(q.push(A,D,D,y),p.push(k,z,z,h),n.push(g,u,u,f));return e}function Ov(b,c,d,e,f){var g=Be("EPSG:4326");return Nv(function(e){return[b,c+(d-c)*e]},Te(g,e),f)}
function Pv(b,c,d,e,f){var g=Be("EPSG:4326");return Nv(function(e){return[c+(d-c)*e,b]},Te(g,e),f)};function Qv(b){b=m(b)?b:{};this.n=this.g=null;this.c=this.b=Infinity;this.e=this.f=-Infinity;this.r=m(b.targetSize)?b.targetSize:100;this.o=m(b.maxLines)?b.maxLines:100;this.a=[];this.d=[];this.p=m(b.strokeStyle)?b.strokeStyle:Rv;this.q=this.i=void 0;this.k=null;this.setMap(m(b.map)?b.map:null)}var Rv=new jl({color:"rgba(0,0,0,0.2)"}),Sv=[90,45,30,20,10,5,2,1,.5,.2,.1,.05,.01,.005,.002,.001];
function Tv(b,c,d,e,f){var g=f;c=Ov(c,b.f,b.b,b.n,d);g=m(b.a[g])?b.a[g]:new K(null);Nm(g,"XY",c);qe(g.J(),e)&&(b.a[f++]=g);return f}function Uv(b,c,d,e,f){var g=f;c=Pv(c,b.e,b.c,b.n,d);g=m(b.d[g])?b.d[g]:new K(null);Nm(g,"XY",c);qe(g.J(),e)&&(b.d[f++]=g);return f}l=Qv.prototype;l.vj=function(){return this.g};l.Uh=function(){return this.a};l.Zh=function(){return this.d};
l.wf=function(b){var c=b.vectorContext,d=b.frameState;b=d.extent;var e=d.viewState,f=e.center,g=e.projection,e=e.resolution,d=d.pixelRatio,d=e*e/(4*d*d);if(null===this.n||!Se(this.n,g)){var h=g.J(),k=g.c,n=k[2],p=k[1],q=k[0];this.b=k[3];this.c=n;this.f=p;this.e=q;k=Be("EPSG:4326");this.i=Te(k,g);this.q=Te(g,k);this.k=this.q(le(h));this.n=g}for(var g=this.k[0],h=this.k[1],k=-1,r,p=Math.pow(this.r*e,2),q=[],s=[],e=0,n=Sv.length;e<n;++e){r=Sv[e]/2;q[0]=g-r;q[1]=h-r;s[0]=g+r;s[1]=h+r;this.i(q,q);this.i(s,
s);r=Math.pow(s[0]-q[0],2)+Math.pow(s[1]-q[1],2);if(r<=p)break;k=Sv[e]}e=k;if(-1==e)this.a.length=this.d.length=0;else{g=this.q(f);f=g[0];g=g[1];h=this.o;f=Math.floor(f/e)*e;p=Wb(f,this.e,this.c);n=Tv(this,p,d,b,0);for(k=0;p!=this.e&&k++<h;)p=Math.max(p-e,this.e),n=Tv(this,p,d,b,n);p=Wb(f,this.e,this.c);for(k=0;p!=this.c&&k++<h;)p=Math.min(p+e,this.c),n=Tv(this,p,d,b,n);this.a.length=n;g=Math.floor(g/e)*e;f=Wb(g,this.f,this.b);n=Uv(this,f,d,b,0);for(k=0;f!=this.f&&k++<h;)f=Math.max(f-e,this.f),n=
Uv(this,f,d,b,n);f=Wb(g,this.f,this.b);for(k=0;f!=this.b&&k++<h;)f=Math.min(f+e,this.b),n=Uv(this,f,d,b,n);this.d.length=n}c.Ba(null,this.p);b=0;for(d=this.a.length;b<d;++b)f=this.a[b],c.Eb(f,null);b=0;for(d=this.d.length;b<d;++b)f=this.d[b],c.Eb(f,null)};l.setMap=function(b){null!==this.g&&(this.g.t("postcompose",this.wf,this),this.g.render());null!==b&&(b.s("postcompose",this.wf,this),b.render());this.g=b};function Vv(b,c,d,e,f,g,h){Ni.call(this,b,c,d,0,e);this.n=f;this.d=new Image;null!==g&&(this.d.crossOrigin=g);this.c={};this.b=null;this.state=0;this.g=h}v(Vv,Ni);Vv.prototype.a=function(b){if(m(b)){var c=ma(b);if(c in this.c)return this.c[c];b=wb(this.c)?this.d:this.d.cloneNode(!1);return this.c[c]=b}return this.d};Vv.prototype.i=function(){this.state=3;Qa(this.b,Xc);this.b=null;this.dispatchEvent("change")};
Vv.prototype.k=function(){m(this.resolution)||(this.resolution=oe(this.extent)/this.d.height);this.state=2;Qa(this.b,Xc);this.b=null;this.dispatchEvent("change")};Vv.prototype.load=function(){0==this.state&&(this.state=1,this.b=[Vc(this.d,"error",this.i,!1,this),Vc(this.d,"load",this.k,!1,this)],this.g(this,this.n))};function Wv(b,c,d,e,f){Oi.call(this,b,c);this.g=d;this.d=new Image;null!==e&&(this.d.crossOrigin=e);this.b={};this.f=null;this.n=f}v(Wv,Oi);l=Wv.prototype;l.P=function(){Xv(this);Wv.T.P.call(this)};l.Ta=function(b){if(m(b)){var c=ma(b);if(c in this.b)return this.b[c];b=wb(this.b)?this.d:this.d.cloneNode(!1);return this.b[c]=b}return this.d};l.qb=function(){return this.g};l.wj=function(){this.state=3;Xv(this);Pi(this)};
l.xj=function(){this.state=this.d.naturalWidth&&this.d.naturalHeight?2:4;Xv(this);Pi(this)};l.load=function(){0==this.state&&(this.state=1,Pi(this),this.f=[Vc(this.d,"error",this.wj,!1,this),Vc(this.d,"load",this.xj,!1,this)],this.n(this,this.g))};function Xv(b){Qa(b.f,Xc);b.f=null};function Yv(b,c,d){return function(e,f,g){return d(b,c,e,f,g)}}function Zv(){};function $v(b,c){id.call(this);this.a=new Vo(this);var d=b;c&&(d=vf(b));this.a.Ra(d,"dragenter",this.el);d!=b&&this.a.Ra(d,"dragover",this.fl);this.a.Ra(b,"dragover",this.gl);this.a.Ra(b,"drop",this.hl)}v($v,id);l=$v.prototype;l.Kc=!1;l.P=function(){$v.T.P.call(this);this.a.Jc()};l.el=function(b){var c=b.a.dataTransfer;(this.Kc=!(!c||!(c.types&&(Wa(c.types,"Files")||Wa(c.types,"public.file-url"))||c.files&&0<c.files.length)))&&b.preventDefault()};
l.fl=function(b){this.Kc&&(b.preventDefault(),b.a.dataTransfer.dropEffect="none")};l.gl=function(b){this.Kc&&(b.preventDefault(),b.pb(),b=b.a.dataTransfer,b.effectAllowed="all",b.dropEffect="copy")};l.hl=function(b){this.Kc&&(b.preventDefault(),b.pb(),b=new xc(b.a),b.type="drop",this.dispatchEvent(b))};function aw(b){b.prototype.then=b.prototype.then;b.prototype.$goog_Thenable=!0}function bw(b){if(!b)return!1;try{return!!b.$goog_Thenable}catch(c){return!1}};function cw(b,c){dw||ew();fw||(dw(),fw=!0);gw.push(new hw(b,c))}var dw;function ew(){if(ba.Promise&&ba.Promise.resolve){var b=ba.Promise.resolve();dw=function(){b.then(iw)}}else dw=function(){nh(iw)}}var fw=!1,gw=[];function iw(){for(;gw.length;){var b=gw;gw=[];for(var c=0;c<b.length;c++){var d=b[c];try{d.a.call(d.d)}catch(e){mh(e)}}}fw=!1}function hw(b,c){this.a=b;this.d=c};function jw(b,c){this.d=kw;this.e=void 0;this.a=this.b=null;this.c=this.f=!1;try{var d=this;b.call(c,function(b){lw(d,mw,b)},function(b){lw(d,nw,b)})}catch(e){lw(this,nw,e)}}var kw=0,mw=2,nw=3;jw.prototype.then=function(b,c,d){return ow(this,ka(b)?b:null,ka(c)?c:null,d)};aw(jw);jw.prototype.cancel=function(b){this.d==kw&&cw(function(){var c=new pw(b);qw(this,c)},this)};
function qw(b,c){if(b.d==kw)if(b.b){var d=b.b;if(d.a){for(var e=0,f=-1,g=0,h;h=d.a[g];g++)if(h=h.Cc)if(e++,h==b&&(f=g),0<=f&&1<e)break;0<=f&&(d.d==kw&&1==e?qw(d,c):(e=d.a.splice(f,1)[0],rw(d,e,nw,c)))}}else lw(b,nw,c)}function sw(b,c){b.a&&b.a.length||b.d!=mw&&b.d!=nw||tw(b);b.a||(b.a=[]);b.a.push(c)}
function ow(b,c,d,e){var f={Cc:null,Xf:null,Zf:null};f.Cc=new jw(function(b,h){f.Xf=c?function(d){try{var f=c.call(e,d);b(f)}catch(p){h(p)}}:b;f.Zf=d?function(c){try{var f=d.call(e,c);!m(f)&&c instanceof pw?h(c):b(f)}catch(p){h(p)}}:h});f.Cc.b=b;sw(b,f);return f.Cc}jw.prototype.g=function(b){this.d=kw;lw(this,mw,b)};jw.prototype.n=function(b){this.d=kw;lw(this,nw,b)};
function lw(b,c,d){if(b.d==kw){if(b==d)c=nw,d=new TypeError("Promise cannot resolve to itself");else{if(bw(d)){b.d=1;d.then(b.g,b.n,b);return}if(la(d))try{var e=d.then;if(ka(e)){uw(b,d,e);return}}catch(f){c=nw,d=f}}b.e=d;b.d=c;tw(b);c!=nw||d instanceof pw||vw(b,d)}}function uw(b,c,d){function e(c){g||(g=!0,b.n(c))}function f(c){g||(g=!0,b.g(c))}b.d=1;var g=!1;try{d.call(c,f,e)}catch(h){e(h)}}function tw(b){b.f||(b.f=!0,cw(b.i,b))}
jw.prototype.i=function(){for(;this.a&&this.a.length;){var b=this.a;this.a=[];for(var c=0;c<b.length;c++)rw(this,b[c],this.d,this.e)}this.f=!1};function rw(b,c,d,e){if(d==mw)c.Xf(e);else{if(c.Cc)for(;b&&b.c;b=b.b)b.c=!1;c.Zf(e)}}function vw(b,c){b.c=!0;cw(function(){b.c&&ww.call(null,c)})}var ww=mh;function pw(b){wa.call(this,b)}v(pw,wa);pw.prototype.name="cancel";/*
Portions of this code are from MochiKit, received by
The Closure Authors under the MIT license. All other code is Copyright
2005-2009 The Closure Authors. All Rights Reserved.
*/
function xw(b,c){this.f=[];this.o=b;this.q=c||null;this.c=this.a=!1;this.b=void 0;this.i=this.p=this.g=!1;this.e=0;this.d=null;this.n=0}xw.prototype.cancel=function(b){if(this.a)this.b instanceof xw&&this.b.cancel();else{if(this.d){var c=this.d;delete this.d;b?c.cancel(b):(c.n--,0>=c.n&&c.cancel())}this.o?this.o.call(this.q,this):this.i=!0;this.a||(b=new yw,zw(this),Aw(this,!1,b))}};xw.prototype.k=function(b,c){this.g=!1;Aw(this,b,c)};function Aw(b,c,d){b.a=!0;b.b=d;b.c=!c;Bw(b)}
function zw(b){if(b.a){if(!b.i)throw new Cw;b.i=!1}}function Dw(b,c,d,e){b.f.push([c,d,e]);b.a&&Bw(b)}xw.prototype.then=function(b,c,d){var e,f,g=new jw(function(b,c){e=b;f=c});Dw(this,e,function(b){b instanceof yw?g.cancel():f(b)});return g.then(b,c,d)};aw(xw);function Ew(b){return Ta(b.f,function(b){return ka(b[1])})}
function Bw(b){if(b.e&&b.a&&Ew(b)){var c=b.e,d=Fw[c];d&&(ba.clearTimeout(d.aa),delete Fw[c]);b.e=0}b.d&&(b.d.n--,delete b.d);for(var c=b.b,e=d=!1;b.f.length&&!b.g;){var f=b.f.shift(),g=f[0],h=f[1],f=f[2];if(g=b.c?h:g)try{var k=g.call(f||b.q,c);m(k)&&(b.c=b.c&&(k==c||k instanceof Error),b.b=c=k);bw(c)&&(e=!0,b.g=!0)}catch(n){c=n,b.c=!0,Ew(b)||(d=!0)}}b.b=c;e&&(k=ra(b.k,b,!0),e=ra(b.k,b,!1),c instanceof xw?(Dw(c,k,e),c.p=!0):c.then(k,e));d&&(c=new Gw(c),Fw[c.aa]=c,b.e=c.aa)}
function Cw(){wa.call(this)}v(Cw,wa);Cw.prototype.message="Deferred has already fired";Cw.prototype.name="AlreadyCalledError";function yw(){wa.call(this)}v(yw,wa);yw.prototype.message="Deferred was canceled";yw.prototype.name="CanceledError";function Gw(b){this.aa=ba.setTimeout(ra(this.d,this),0);this.a=b}Gw.prototype.d=function(){delete Fw[this.aa];throw this.a;};var Fw={};function Hw(b,c){m(b.name)?(this.name=b.name,this.code=Iw[b.name]):(this.code=b.code,this.name=Jw(b.code));wa.call(this,za("%s %s",this.name,c))}v(Hw,wa);function Jw(b){var c=vb(Iw,function(c){return b==c});if(!m(c))throw Error("Invalid code: "+b);return c}var Iw={AbortError:3,EncodingError:5,InvalidModificationError:9,InvalidStateError:7,NotFoundError:1,NotReadableError:4,NoModificationAllowedError:6,PathExistsError:12,QuotaExceededError:10,SecurityError:2,SyntaxError:8,TypeMismatchError:11};function Kw(b,c){rc.call(this,b.type,c)}v(Kw,rc);function Lw(){id.call(this);this.hb=new FileReader;this.hb.onloadstart=ra(this.a,this);this.hb.onprogress=ra(this.a,this);this.hb.onload=ra(this.a,this);this.hb.onabort=ra(this.a,this);this.hb.onerror=ra(this.a,this);this.hb.onloadend=ra(this.a,this)}v(Lw,id);Lw.prototype.getError=function(){return this.hb.error&&new Hw(this.hb.error,"reading file")};Lw.prototype.a=function(b){this.dispatchEvent(new Kw(b,this))};Lw.prototype.P=function(){Lw.T.P.call(this);delete this.hb};
function Mw(b){var c=new xw;b.Ra("loadend",sa(function(b,c){var f=c.hb.result,g=c.getError();null==f||g?(zw(b),Aw(b,!1,g)):(zw(b),Aw(b,!0,f));c.Jc()},c,b));return c};function Nw(b){b=m(b)?b:{};Mj.call(this,{handleEvent:cd});this.e=m(b.formatConstructors)?b.formatConstructors:[];this.q=m(b.projection)?Be(b.projection):null;this.f=null;this.a=void 0}v(Nw,Mj);Nw.prototype.P=function(){m(this.a)&&Xc(this.a);Nw.T.P.call(this)};Nw.prototype.g=function(b){b=b.a.dataTransfer.files;var c,d,e;c=0;for(d=b.length;c<d;++c){var f=e=b[c],g=new Lw,h=Mw(g);g.hb.readAsText(f,"");Dw(h,sa(this.i,e),null,this)}};
Nw.prototype.i=function(b,c){var d=this.k,e=this.q;null===e&&(e=d.a().p);var d=this.e,f=[],g,h;g=0;for(h=d.length;g<h;++g){var k=new d[g],n;try{n=k.ma(c)}catch(p){n=null}if(null!==n){var k=k.Ja(c),k=Te(k,e),q,r;q=0;for(r=n.length;q<r;++q){var s=n[q],u=s.R();null!=u&&u.qa(k);f.push(s)}}}this.dispatchEvent(new Ow(Pw,this,b,f,e))};
Nw.prototype.setMap=function(b){m(this.a)&&(Xc(this.a),this.a=void 0);null!==this.f&&(qc(this.f),this.f=null);Nw.T.setMap.call(this,b);null!==b&&(this.f=new $v(b.b),this.a=w(this.f,"drop",this.g,!1,this))};var Pw="addfeatures";function Ow(b,c,d,e,f){rc.call(this,b,c);this.features=e;this.file=d;this.projection=f}v(Ow,rc);function Qw(b,c){this.x=b;this.y=c}v(Qw,rf);Qw.prototype.clone=function(){return new Qw(this.x,this.y)};Qw.prototype.scale=rf.prototype.scale;Qw.prototype.add=function(b){this.x+=b.x;this.y+=b.y;return this};Qw.prototype.rotate=function(b){var c=Math.cos(b);b=Math.sin(b);var d=this.y*c+this.x*b;this.x=this.x*c-this.y*b;this.y=d;return this};function Rw(b){b=m(b)?b:{};Zj.call(this,{handleDownEvent:Sw,handleDragEvent:Tw,handleUpEvent:Uw});this.i=m(b.condition)?b.condition:Wj;this.a=this.e=void 0;this.g=0}v(Rw,Zj);function Tw(b){if(Yj(b)){var c=b.map,d=c.f();b=b.pixel;b=new Qw(b[0]-d[0]/2,d[1]/2-b[1]);d=Math.atan2(b.y,b.x);b=Math.sqrt(b.x*b.x+b.y*b.y);var e=c.a(),f=Ye(e);c.render();m(this.e)&&Nj(c,e,f.rotation-(d-this.e));this.e=d;m(this.a)&&Pj(c,e,f.resolution/b*this.a);m(this.a)&&(this.g=this.a/b);this.a=b}}
function Uw(b){if(!Yj(b))return!0;b=b.map;var c=b.a();Ze(c,-1);var d=Ye(c),e=this.g-1,f=d.rotation,f=c.constrainRotation(f,0);Nj(b,c,f,void 0,void 0);d=d.resolution;d=c.constrainResolution(d,0,e);Pj(b,c,d,void 0,400);this.g=0;return!1}function Sw(b){return Yj(b)&&this.i(b)?(Ze(b.map.a(),1),this.a=this.e=void 0,!0):!1};function Vw(b,c){rc.call(this,b);this.feature=c}v(Vw,rc);
function Ww(b){Zj.call(this,{handleDownEvent:Xw,handleEvent:Yw,handleUpEvent:Zw});this.S=null;this.fa=m(b.source)?b.source:null;this.ca=m(b.features)?b.features:null;this.kb=m(b.snapTolerance)?b.snapTolerance:12;this.Fa=m(b.minPointsPerRing)?b.minPointsPerRing:3;var c=this.H=b.type,d;"Point"===c||"MultiPoint"===c?d=$w:"LineString"===c||"MultiLineString"===c?d=ax:"Polygon"===c||"MultiPolygon"===c?d=bx:"Circle"===c&&(d=cx);this.a=d;this.e=this.q=this.o=this.g=this.i=null;this.N=new np({style:m(b.style)?
b.style:dx()});this.da=b.geometryName;this.Xa=m(b.condition)?b.condition:Vj;w(this,vd("active"),this.ea,!1,this)}v(Ww,Zj);function dx(){var b=ul();return function(c){return b[c.R().O()]}}Ww.prototype.setMap=function(b){Ww.T.setMap.call(this,b);this.ea()};function Yw(b){var c=!0;b.type===Gi?c=ex(this,b):b.type===Ai&&(c=!1);return ak.call(this,b)&&c}function Xw(b){return this.Xa(b)?(this.S=b.pixel,!0):!1}
function Zw(b){var c=this.S,d=b.pixel,e=c[0]-d[0],c=c[1]-d[1],d=!0;4>=e*e+c*c&&(ex(this,b),null===this.i?fx(this,b):this.a===$w||this.a===cx&&null!==this.i||gx(this,b)?this.W():(b=b.coordinate,e=this.g.R(),this.a===ax?(this.i=b.slice(),c=e.Q(),c.push(b.slice()),e.V(c)):this.a===bx&&(this.e[0].push(b.slice()),e.V(this.e)),hx(this)),d=!1);return d}
function ex(b,c){if(b.a===$w&&null===b.i)fx(b,c);else if(null===b.i){var d=c.coordinate.slice();null===b.o?(b.o=new P(new Ik(d)),hx(b)):b.o.R().V(d)}else{var d=c.coordinate,e=b.g.R(),f,g;b.a===$w?(g=e.Q(),g[0]=d[0],g[1]=d[1],e.V(g)):(b.a===ax?f=e.Q():b.a===bx?f=b.e[0]:b.a===cx&&(f=e.Oc()),gx(b,c)&&(d=b.i.slice()),b.o.R().V(d),g=f[f.length-1],g[0]=d[0],g[1]=d[1],b.a===ax?e.V(f):b.a===bx?(g=b.q.R(),g.V(f),e.V(b.e)):b.a===cx&&(g=b.q.R(),g.V([e.Oc(),d]),e.If(g.Jf())));hx(b)}return!0}
function gx(b,c){var d=!1;if(null!==b.g){var e=b.g.R(),f=!1,g=[b.i];b.a===ax?f=2<e.Q().length:b.a===bx&&(f=e.Q()[0].length>b.Fa,g=[b.e[0][0],b.e[0][b.e[0].length-2]]);if(f)for(var e=c.map,f=0,h=g.length;f<h;f++){var k=g[f],n=e.e(k),p=c.pixel,d=p[0]-n[0],n=p[1]-n[1];if(d=Math.sqrt(d*d+n*n)<=b.kb){b.i=k;break}}}return d}
function fx(b,c){var d=c.coordinate;b.i=d;var e;b.a===$w?e=new Ik(d.slice()):b.a===ax?e=new K([d.slice(),d.slice()]):b.a===bx?(b.q=new P(new K([d.slice(),d.slice()])),b.e=[[d.slice(),d.slice()]],e=new F(b.e)):b.a===cx&&(e=new Em(d.slice(),0),b.q=new P(new K([d.slice(),d.slice()])));b.g=new P;m(b.da)&&b.g.f(b.da);b.g.Sa(e);hx(b);b.dispatchEvent(new Vw("drawstart",b.g))}
Ww.prototype.W=function(){var b=ix(this),c,d=b.R();this.a===$w?c=d.Q():this.a===ax?(c=d.Q(),c.pop(),d.V(c)):this.a===bx&&(this.e[0].pop(),this.e[0].push(this.e[0][0]),d.V(this.e),c=d.Q());"MultiPoint"===this.H?b.Sa(new Rm([c])):"MultiLineString"===this.H?b.Sa(new Om([c])):"MultiPolygon"===this.H&&b.Sa(new Sm([c]));null===this.ca||this.ca.push(b);null===this.fa||this.fa.Va(b);this.dispatchEvent(new Vw("drawend",b))};
function ix(b){b.i=null;var c=b.g;null!==c&&(b.g=null,b.o=null,b.q=null,b.N.a.clear());return c}Ww.prototype.r=bd;function hx(b){var c=[];null===b.g||c.push(b.g);null===b.q||c.push(b.q);null===b.o||c.push(b.o);b.N.Tc(new kg(c))}Ww.prototype.ea=function(){var b=this.k,c=this.b();null!==b&&c||ix(this);this.N.setMap(c?b:null)};var $w="Point",ax="LineString",bx="Polygon",cx="Circle";function jx(b){Zj.call(this,{handleDownEvent:kx,handleDragEvent:lx,handleEvent:mx,handleUpEvent:nx});this.ca=m(b.deleteCondition)?b.deleteCondition:hd(Vj,Uj);this.W=this.e=null;this.S=[0,0];this.a=new en;this.i=m(b.pixelTolerance)?b.pixelTolerance:10;this.N=!1;this.g=null;this.q=new np({style:m(b.style)?b.style:ox()});this.H={Point:this.ym,LineString:this.Ag,LinearRing:this.Ag,Polygon:this.Am,MultiPoint:this.vm,MultiLineString:this.um,MultiPolygon:this.xm,GeometryCollection:this.tm};this.o=b.features;
this.o.forEach(this.Kf,this);w(this.o,"add",this.ti,!1,this);w(this.o,"remove",this.ui,!1,this)}v(jx,Zj);l=jx.prototype;l.Kf=function(b){var c=b.R();m(this.H[c.O()])&&this.H[c.O()].call(this,b,c);b=this.k;null===b||px(this,this.S,b)};l.setMap=function(b){this.q.setMap(b);jx.T.setMap.call(this,b)};l.ti=function(b){this.Kf(b.element)};
l.ui=function(b){var c=b.element;b=this.a;var d,e=[];jn(b,c.R().J(),function(b){c===b.feature&&e.push(b)});for(d=e.length-1;0<=d;--d)b.remove(e[d]);null!==this.e&&0===this.o.Ib()&&(this.q.Ed(this.e),this.e=null)};l.ym=function(b,c){var d=c.Q(),d={feature:b,geometry:c,ha:[d,d]};this.a.sa(c.J(),d)};l.vm=function(b,c){var d=c.Q(),e,f,g;f=0;for(g=d.length;f<g;++f)e=d[f],e={feature:b,geometry:c,depth:[f],index:f,ha:[e,e]},this.a.sa(c.J(),e)};
l.Ag=function(b,c){var d=c.Q(),e,f,g,h;e=0;for(f=d.length-1;e<f;++e)g=d.slice(e,e+2),h={feature:b,geometry:c,index:e,ha:g},this.a.sa(Sd(g),h)};l.um=function(b,c){var d=c.Q(),e,f,g,h,k,n,p;h=0;for(k=d.length;h<k;++h)for(e=d[h],f=0,g=e.length-1;f<g;++f)n=e.slice(f,f+2),p={feature:b,geometry:c,depth:[h],index:f,ha:n},this.a.sa(Sd(n),p)};
l.Am=function(b,c){var d=c.Q(),e,f,g,h,k,n,p;h=0;for(k=d.length;h<k;++h)for(e=d[h],f=0,g=e.length-1;f<g;++f)n=e.slice(f,f+2),p={feature:b,geometry:c,depth:[h],index:f,ha:n},this.a.sa(Sd(n),p)};l.xm=function(b,c){var d=c.Q(),e,f,g,h,k,n,p,q,r,s;n=0;for(p=d.length;n<p;++n)for(q=d[n],h=0,k=q.length;h<k;++h)for(e=q[h],f=0,g=e.length-1;f<g;++f)r=e.slice(f,f+2),s={feature:b,geometry:c,depth:[h,n],index:f,ha:r},this.a.sa(Sd(r),s)};
l.tm=function(b,c){var d,e=c.c;for(d=0;d<e.length;++d)this.H[e[d].O()].call(this,b,e[d])};function qx(b,c){var d=b.e;null===d?(d=new P(new Ik(c)),b.e=d,b.q.Df(d)):d.R().V(c)}
function kx(b){px(this,b.pixel,b.map);this.g=[];var c=this.e;if(null!==c){b=[];for(var c=c.R().Q(),d=Sd([c]),d=gn(this.a,d),e=0,f=d.length;e<f;++e){var g=d[e],h=g.ha;Ad(h[0],c)?this.g.push([g,0]):Ad(h[1],c)?this.g.push([g,1]):ma(h)in this.W&&b.push([g,c])}for(e=b.length-1;0<=e;--e)this.Ti.apply(this,b[e])}return null!==this.e}
function lx(b){b=b.coordinate;for(var c=0,d=this.g.length;c<d;++c){for(var e=this.g[c],f=e[0],g=f.depth,h=f.geometry,k=h.Q(),n=f.ha,e=e[1];b.length<h.B;)b.push(0);switch(h.O()){case "Point":k=b;n[0]=n[1]=b;break;case "MultiPoint":k[f.index]=b;n[0]=n[1]=b;break;case "LineString":k[f.index+e]=b;n[e]=b;break;case "MultiLineString":k[g[0]][f.index+e]=b;n[e]=b;break;case "Polygon":k[g[0]][f.index+e]=b;n[e]=b;break;case "MultiPolygon":k[g[1]][g[0]][f.index+e]=b,n[e]=b}h.V(k);qx(this,b)}}
function nx(){for(var b,c=this.g.length-1;0<=c;--c)b=this.g[c][0],this.a.update(Sd(b.ha),b);return!1}
function mx(b){var c;b.map.a().q.slice()[1]||b.type!=Gi||(this.S=b.pixel,px(this,b.pixel,b.map));if(null!==this.e&&this.N&&this.ca(b)){this.e.R();c=this.g;var d={},e=!1,f,g,h,k,n,p,q,r,s;for(n=c.length-1;0<=n;--n)if(h=c[n],r=h[0],k=r.geometry,g=k.Q(),s=ma(r.feature),f=q=p=void 0,0===h[1]?(q=r,p=r.index):1==h[1]&&(f=r,p=r.index+1),s in d||(d[s]=[f,q,p]),h=d[s],m(f)&&(h[0]=f),m(q)&&(h[1]=q),m(h[0])&&m(h[1])){f=g;e=!1;q=p-1;switch(k.O()){case "MultiLineString":g[r.depth[0]].splice(p,1);e=!0;break;case "LineString":g.splice(p,
1);e=!0;break;case "MultiPolygon":f=f[r.depth[1]];case "Polygon":f=f[r.depth[0]],4<f.length&&(p==f.length-1&&(p=0),f.splice(p,1),e=!0,0===p&&(f.pop(),f.push(f[0]),q=f.length-1))}e&&(this.a.remove(h[0]),this.a.remove(h[1]),k.V(g),g={depth:r.depth,feature:r.feature,geometry:r.geometry,index:q,ha:[h[0].ha[0],h[1].ha[1]]},this.a.sa(Sd(g.ha),g),rx(this,k,p,r.depth,-1),this.q.Ed(this.e),this.e=null)}c=e}return ak.call(this,b)&&!c}
function px(b,c,d){function e(b,c){return Cd(f,xd(f,b.ha))-Cd(f,xd(f,c.ha))}var f=d.ra(c),g=d.ra([c[0]-b.i,c[1]+b.i]),h=d.ra([c[0]+b.i,c[1]-b.i]),g=Sd([g,h]),g=gn(b.a,g);if(0<g.length){g.sort(e);var h=g[0].ha,k=xd(f,h),n=d.e(k);if(Math.sqrt(Cd(c,n))<=b.i){c=d.e(h[0]);d=d.e(h[1]);c=Cd(n,c);d=Cd(n,d);b.N=Math.sqrt(Math.min(c,d))<=b.i;b.N&&(k=c>d?h[1]:h[0]);qx(b,k);d={};d[ma(h)]=!0;c=1;for(n=g.length;c<n;++c)if(k=g[c].ha,Ad(h[0],k[0])&&Ad(h[1],k[1])||Ad(h[0],k[1])&&Ad(h[1],k[0]))d[ma(k)]=!0;else break;
b.W=d;return}}null!==b.e&&(b.q.Ed(b.e),b.e=null)}
l.Ti=function(b,c){for(var d=b.ha,e=b.feature,f=b.geometry,g=b.depth,h=b.index,k;c.length<f.B;)c.push(0);switch(f.O()){case "MultiLineString":k=f.Q();k[g[0]].splice(h+1,0,c);break;case "Polygon":k=f.Q();k[g[0]].splice(h+1,0,c);break;case "MultiPolygon":k=f.Q();k[g[1]][g[0]].splice(h+1,0,c);break;case "LineString":k=f.Q();k.splice(h+1,0,c);break;default:return}f.V(k);k=this.a;k.remove(b);rx(this,f,h,g,1);var n={ha:[d[0],c],feature:e,geometry:f,depth:g,index:h};k.sa(Sd(n.ha),n);this.g.push([n,1]);d=
{ha:[c,d[1]],feature:e,geometry:f,depth:g,index:h+1};k.sa(Sd(d.ha),d);this.g.push([d,0])};function rx(b,c,d,e,f){jn(b.a,c.J(),function(b){b.geometry===c&&(!m(e)||fb(b.depth,e))&&b.index>d&&(b.index+=f)})}function ox(){var b=ul();return function(){return b.Point}};function sx(b,c,d){rc.call(this,b);this.selected=c;this.deselected=d}v(sx,rc);
function tx(b){Mj.call(this,{handleEvent:ux});b=m(b)?b:{};this.i=m(b.condition)?b.condition:Uj;this.e=m(b.addCondition)?b.addCondition:bd;this.p=m(b.removeCondition)?b.removeCondition:bd;this.D=m(b.toggleCondition)?b.toggleCondition:Wj;this.g=m(b.multi)?b.multi:!1;var c;if(m(b.layers))if(ka(b.layers))c=b.layers;else{var d=b.layers;c=function(b){return Wa(d,b)}}else c=cd;this.f=c;this.a=new np({style:m(b.style)?b.style:vx()});b=this.a.a;w(b,"add",this.q,!1,this);w(b,"remove",this.r,!1,this)}v(tx,Mj);
tx.prototype.o=function(){return this.a.a};
function ux(b){if(!this.i(b))return!0;var c=this.e(b),d=this.p(b),e=this.D(b),f=b.map,g=this.a.a,h=[],k=[],n=!1;if(c||d||e){f.qe(b.pixel,function(b){-1==Pa(g.a,b)?(c||e)&&k.push(b):(d||e)&&h.push(b)},void 0,this.f);for(f=h.length-1;0<=f;--f)g.remove(h[f]);g.ye(k);if(0<k.length||0<h.length)n=!0}else f.qe(b.pixel,function(b){k.push(b);return!this.g},this,this.f),0<k.length&&1==g.Ib()&&g.item(0)==k[0]||(n=!0,0!==g.Ib()&&(h=Array.prototype.concat(g.a),g.clear()),g.ye(k));n&&this.dispatchEvent(new sx("select",
k,h));return Tj(b)}tx.prototype.setMap=function(b){var c=this.k,d=this.a.a;null===c||d.forEach(c.ic,c);tx.T.setMap.call(this,b);this.a.setMap(b);null===b||d.forEach(b.Xa,b)};function vx(){var b=ul();ab(b.Polygon,b.LineString);ab(b.GeometryCollection,b.LineString);return function(c){return b[c.R().O()]}}tx.prototype.q=function(b){b=b.element;var c=this.k;null===c||c.Xa(b)};tx.prototype.r=function(b){b=b.element;var c=this.k;null===c||c.ic(b)};function Y(b){b=m(b)?b:{};var c=Bb(b);delete c.gradient;delete c.radius;delete c.blur;delete c.shadow;delete c.weight;J.call(this,c);this.ia=null;this.ef=m(b.shadow)?b.shadow:250;this.ad=void 0;this.zc=null;w(this,vd("gradient"),this.rh,!1,this);this.xc(m(b.gradient)?b.gradient:wx);this.wc(m(b.blur)?b.blur:15);this.jc(m(b.radius)?b.radius:8);w(this,[vd("blur"),vd("radius")],this.Te,!1,this);this.Te();var d=m(b.weight)?b.weight:"weight",e;ia(d)?e=function(b){return b.get(d)}:e=d;this.ka(ra(function(b){b=
e(b);b=m(b)?Wb(b,0,1):1;var c=255*b|0,d=this.zc[c];m(d)||(d=[new ql({image:new vj({opacity:b,src:this.ad})})],this.zc[c]=d);return d},this));this.set("renderOrder",null);w(this,"render",this.uh,!1,this)}v(Y,J);var wx=["#00f","#0ff","#0f0","#ff0","#f00"];Y.prototype.Ea=function(){return this.get("blur")};Y.prototype.getBlur=Y.prototype.Ea;Y.prototype.Fa=function(){return this.get("gradient")};Y.prototype.getGradient=Y.prototype.Fa;Y.prototype.ic=function(){return this.get("radius")};
Y.prototype.getRadius=Y.prototype.ic;Y.prototype.rh=function(){for(var b=this.Fa(),c=Mf(1,256),d=c.createLinearGradient(0,0,1,256),e=1/(b.length-1),f=0,g=b.length;f<g;++f)d.addColorStop(f*e,b[f]);c.fillStyle=d;c.fillRect(0,0,1,256);this.ia=c.getImageData(0,0,1,256).data};
Y.prototype.Te=function(){var b=this.ic(),c=this.Ea(),d=b+c+1,e=2*d,e=Mf(e,e);e.shadowOffsetX=e.shadowOffsetY=this.ef;e.shadowBlur=c;e.shadowColor="#000";e.beginPath();c=d-this.ef;e.arc(c,c,b,0,2*Math.PI,!0);e.fill();this.ad=e.canvas.toDataURL();this.zc=Array(256);this.l()};Y.prototype.uh=function(b){b=b.context;var c=b.canvas,c=b.getImageData(0,0,c.width,c.height),d=c.data,e,f,g;e=0;for(f=d.length;e<f;e+=4)if(g=4*d[e+3])d[e]=this.ia[g],d[e+1]=this.ia[g+1],d[e+2]=this.ia[g+2];b.putImageData(c,0,0)};
Y.prototype.wc=function(b){this.set("blur",b)};Y.prototype.setBlur=Y.prototype.wc;Y.prototype.xc=function(b){this.set("gradient",b)};Y.prototype.setGradient=Y.prototype.xc;Y.prototype.jc=function(b){this.set("radius",b)};Y.prototype.setRadius=Y.prototype.jc;function xx(b){return[b]};function yx(b,c){var d=c||{},e=d.document||document,f=Df("SCRIPT"),g={qg:f,fc:void 0},h=new xw(zx,g),k=null,n=null!=d.timeout?d.timeout:5E3;0<n&&(k=window.setTimeout(function(){Ax(f,!0);var c=new Bx(Cx,"Timeout reached for loading script "+b);zw(h);Aw(h,!1,c)},n),g.fc=k);f.onload=f.onreadystatechange=function(){f.readyState&&"loaded"!=f.readyState&&"complete"!=f.readyState||(Ax(f,d.ph||!1,k),zw(h),Aw(h,!0,null))};f.onerror=function(){Ax(f,!0,k);var c=new Bx(Dx,"Error while loading script "+b);zw(h);
Aw(h,!1,c)};xf(f,{type:"text/javascript",charset:"UTF-8",src:b});Ex(e).appendChild(f);return h}function Ex(b){var c=b.getElementsByTagName("HEAD");return c&&0!=c.length?c[0]:b.documentElement}function zx(){if(this&&this.qg){var b=this.qg;b&&"SCRIPT"==b.tagName&&Ax(b,!0,this.fc)}}function Ax(b,c,d){null!=d&&ba.clearTimeout(d);b.onload=ca;b.onerror=ca;b.onreadystatechange=ca;c&&window.setTimeout(function(){Hf(b)},0)}var Dx=0,Cx=1;
function Bx(b,c){var d="Jsloader error (code #"+b+")";c&&(d+=": "+c);wa.call(this,d);this.code=b}v(Bx,wa);function Fx(b,c){this.d=new Kr(b);this.a=c?c:"callback";this.fc=5E3}var Gx=0;
Fx.prototype.send=function(b,c,d,e){b=b||null;e=e||"_"+(Gx++).toString(36)+ta().toString(36);ba._callbacks_||(ba._callbacks_={});var f=this.d.clone();if(b)for(var g in b)if(!b.hasOwnProperty||b.hasOwnProperty(g)){var h=f,k=g,n=b[g];ga(n)||(n=[String(n)]);cs(h.a,k,n)}c&&(ba._callbacks_[e]=Hx(e,c),c=this.a,g="_callbacks_."+e,ga(g)||(g=[String(g)]),cs(f.a,c,g));c=yx(f.toString(),{timeout:this.fc,ph:!0});Dw(c,null,Ix(e,b,d),void 0);return{aa:e,jf:c}};
Fx.prototype.cancel=function(b){b&&(b.jf&&b.jf.cancel(),b.aa&&Jx(b.aa,!1))};function Ix(b,c,d){return function(){Jx(b,!1);d&&d(c)}}function Hx(b,c){return function(d){Jx(b,!0);c.apply(void 0,arguments)}}function Jx(b,c){ba._callbacks_[b]&&(c?delete ba._callbacks_[b]:ba._callbacks_[b]=ca)};function Kx(b){var c=/\{z\}/g,d=/\{x\}/g,e=/\{y\}/g,f=/\{-y\}/g;return function(g){return null===g?void 0:b.replace(c,g[0].toString()).replace(d,g[1].toString()).replace(e,g[2].toString()).replace(f,function(){return((1<<g[0])-g[2]-1).toString()})}}function Lx(b){return Mx(Sa(b,Kx))}function Mx(b){return 1===b.length?b[0]:function(c,d,e){return null===c?void 0:b[Xb((c[1]<<c[0])+c[2],b.length)](c,d,e)}}function Nx(){}
function Ox(b,c){var d=[0,0,0];return function(e,f,g){return null===e?void 0:c(b(e,g,d),f,g)}}function Px(b){var c=[],d=/\{(\d)-(\d)\}/.exec(b)||/\{([a-z])-([a-z])\}/.exec(b);if(d){var e=d[2].charCodeAt(0),f;for(f=d[1].charCodeAt(0);f<=e;++f)c.push(b.replace(d[0],String.fromCharCode(f)))}else c.push(b);return c};function Qx(b){cj.call(this,{attributions:b.attributions,extent:b.extent,logo:b.logo,opaque:b.opaque,projection:b.projection,state:m(b.state)?b.state:void 0,tileGrid:b.tileGrid,tilePixelRatio:b.tilePixelRatio});this.tileUrlFunction=m(b.tileUrlFunction)?b.tileUrlFunction:Nx;this.crossOrigin=m(b.crossOrigin)?b.crossOrigin:null;this.tileLoadFunction=m(b.tileLoadFunction)?b.tileLoadFunction:Rx;this.tileClass=m(b.tileClass)?b.tileClass:Wv}v(Qx,cj);function Rx(b,c){b.Ta().src=c}l=Qx.prototype;
l.Vb=function(b,c,d,e,f){var g=this.nb(b,c,d);if(Ri(this.a,g))return this.a.get(g);b=[b,c,d];e=this.tileUrlFunction(b,e,f);e=new this.tileClass(b,m(e)?0:4,m(e)?e:"",this.crossOrigin,this.tileLoadFunction);w(e,"change",this.tk,!1,this);this.a.set(g,e);return e};l.bb=function(){return this.tileLoadFunction};l.cb=function(){return this.tileUrlFunction};
l.tk=function(b){b=b.target;switch(b.state){case 1:this.dispatchEvent(new fj("tileloadstart",b));break;case 2:this.dispatchEvent(new fj("tileloadend",b));break;case 3:this.dispatchEvent(new fj("tileloaderror",b))}};l.jb=function(b){this.a.clear();this.tileLoadFunction=b;this.l()};l.ta=function(b){this.a.clear();this.tileUrlFunction=b;this.l()};l.Pe=function(b,c,d){b=this.nb(b,c,d);Ri(this.a,b)&&this.a.get(b)};function Sx(b){var c=m(b.extent)?b.extent:Ml,d=aj(c,b.maxZoom,b.tileSize);Ui.call(this,{minZoom:b.minZoom,origin:me(c,"top-left"),resolutions:d,tileSize:b.tileSize})}v(Sx,Ui);
Sx.prototype.Db=function(b){b=m(b)?b:{};var c=this.minZoom,d=this.maxZoom,e=m(b.wrapX)?b.wrapX:!0,f=null;if(m(b.extent)){var f=Array(d+1),g;for(g=0;g<=d;++g)f[g]=g<c?null:Xi(this,b.extent,g)}return function(b,g,n){g=b[0];if(g<c||d<g)return null;var p=Math.pow(2,g),q=b[1];if(e)q=Xb(q,p);else if(0>q||p<=q)return null;b=b[2];return b<-p||-1<b||null!==f&&!nf(f[g],q,b)?null:gf(g,q,-b-1,n)}};Sx.prototype.td=function(b,c){if(b[0]<this.maxZoom){var d=2*b[1],e=2*b[2];return mf(d,d+1,e,e+1,c)}return null};
Sx.prototype.gd=function(b,c,d,e){e=mf(0,b[1],0,b[2],e);for(b=b[0]-1;b>=this.minZoom;--b)if(e.a=e.c>>=1,e.b=e.d>>=1,c.call(d,b,e))return!0;return!1};function Tx(b){Qx.call(this,{crossOrigin:"anonymous",opaque:!0,projection:Be("EPSG:3857"),state:"loading",tileLoadFunction:b.tileLoadFunction});this.c=m(b.culture)?b.culture:"en-us";this.b=m(b.maxZoom)?b.maxZoom:-1;this.i=m(b.wrapX)?b.wrapX:!0;var c=new Kr((Tb?"https:":"http:")+"//dev.virtualearth.net/REST/v1/Imagery/Metadata/"+b.imagerySet);(new Fx(c,"jsonp")).send({include:"ImageryProviders",uriScheme:Tb?"https":"http",key:b.key},ra(this.e,this))}v(Tx,Qx);var Ux=new pf({html:'<a class="ol-attribution-bing-tos" href="http://www.microsoft.com/maps/product/terms.html">Terms of Use</a>'});
Tx.prototype.e=function(b){if(200!=b.statusCode||"OK"!=b.statusDescription||"ValidCredentials"!=b.authenticationResultCode||1!=b.resourceSets.length||1!=b.resourceSets[0].resources.length)Ki(this,"error");else{var c=b.brandLogoUri;Tb&&-1==c.indexOf("https")&&(c=c.replace("http","https"));var d=b.resourceSets[0].resources[0],e=-1==this.b?d.zoomMax:this.b,f=new Sx({extent:bj(this.g),minZoom:d.zoomMin,maxZoom:e,tileSize:d.imageWidth});this.tileGrid=f;var g=this.c;this.tileUrlFunction=Ox(f.Db({wrapX:this.i}),
Mx(Sa(d.imageUrlSubdomains,function(b){var c=d.imageUrl.replace("{subdomain}",b).replace("{culture}",g);return function(b){return null===b?void 0:c.replace("{quadkey}",jf(b))}})));if(d.imageryProviders){var h=Ae(Be("EPSG:4326"),this.g);b=Sa(d.imageryProviders,function(b){var c=b.attribution,d={};Qa(b.coverageAreas,function(b){var c=b.zoomMin,g=Math.min(b.zoomMax,e);b=b.bbox;b=ue([b[1],b[0],b[3],b[2]],h);var k,n;for(k=c;k<=g;++k)n=k.toString(),c=Xi(f,b,k),n in d?d[n].push(c):d[n]=[c]});return new pf({html:c,
tileRanges:d})});b.push(Ux);this.f=b}this.D=c;Ki(this,"ready")}};function Vx(b){kn.call(this,{attributions:b.attributions,extent:b.extent,logo:b.logo,projection:b.projection});this.p=void 0;this.r=m(b.distance)?b.distance:20;this.o=[];this.a=b.source;this.a.s("change",Vx.prototype.N,this)}v(Vx,kn);Vx.prototype.H=function(){return this.a};Vx.prototype.Hb=function(b,c,d){c!==this.p&&(this.clear(),this.p=c,this.a.Hb(b,c,d),Wx(this),this.Ga(this.o))};Vx.prototype.N=function(){this.clear();Wx(this);this.Ga(this.o);this.l()};
function Wx(b){if(m(b.p)){b.o.length=0;for(var c=Td(),d=b.r*b.p,e=b.a.Aa(),f={},g=0,h=e.length;g<h;g++){var k=e[g];tb(f,ma(k).toString())||(k=k.R().Q(),ce(k,c),Xd(c,d,c),k=gn(b.a.b,c),k=Ra(k,function(b){b=ma(b).toString();return b in f?!1:f[b]=!0}),b.o.push(Xx(k)))}}}function Xx(b){for(var c=b.length,d=[0,0],e=0;e<c;e++){var f=b[e].R().Q();wd(d,f)}c=1/c;d[0]*=c;d[1]*=c;d=new P(new Ik(d));d.set("features",b);return d};function Yx(b,c,d){if(ka(b))d&&(b=ra(b,d));else if(b&&"function"==typeof b.handleEvent)b=ra(b.handleEvent,b);else throw Error("Invalid listener argument");return 2147483647<c?-1:ba.setTimeout(b,c||0)};function Zx(){}Zx.prototype.a=null;function $x(b){var c;(c=b.a)||(c={},ay(b)&&(c[0]=!0,c[1]=!0),c=b.a=c);return c};var by;function cy(){}v(cy,Zx);function dy(b){return(b=ay(b))?new ActiveXObject(b):new XMLHttpRequest}function ay(b){if(!b.d&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var c=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],d=0;d<c.length;d++){var e=c[d];try{return new ActiveXObject(e),b.d=e}catch(f){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed");}return b.d}by=new cy;function ey(b){id.call(this);this.r=new th;this.i=b||null;this.a=!1;this.n=this.U=null;this.f=this.o="";this.d=this.q=this.c=this.k=!1;this.g=0;this.b=null;this.e=fy;this.p=this.D=!1}v(ey,id);var fy="",gy=/^https?$/i,hy=["POST","PUT"];l=ey.prototype;
l.send=function(b,c,d,e){if(this.U)throw Error("[goog.net.XhrIo] Object is active with another request="+this.o+"; newUri="+b);c=c?c.toUpperCase():"GET";this.o=b;this.f="";this.k=!1;this.a=!0;this.U=this.i?dy(this.i):dy(by);this.n=this.i?$x(this.i):$x(by);this.U.onreadystatechange=ra(this.Yf,this);try{this.q=!0,this.U.open(c,String(b),!0),this.q=!1}catch(f){iy(this,f);return}b=d||"";var g=this.r.clone();e&&sh(e,function(b,c){g.set(c,b)});e=Ua(g.G(),jy);d=ba.FormData&&b instanceof ba.FormData;!Wa(hy,
c)||e||d||g.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");g.forEach(function(b,c){this.U.setRequestHeader(c,b)},this);this.e&&(this.U.responseType=this.e);"withCredentials"in this.U&&(this.U.withCredentials=this.D);try{ky(this),0<this.g&&((this.p=ly(this.U))?(this.U.timeout=this.g,this.U.ontimeout=ra(this.fc,this)):this.b=Yx(this.fc,this.g,this)),this.c=!0,this.U.send(b),this.c=!1}catch(h){iy(this,h)}};function ly(b){return Gb&&Qb(9)&&ja(b.timeout)&&m(b.ontimeout)}
function jy(b){return"content-type"==b.toLowerCase()}l.fc=function(){"undefined"!=typeof aa&&this.U&&(this.f="Timed out after "+this.g+"ms, aborting",this.dispatchEvent("timeout"),this.U&&this.a&&(this.a=!1,this.d=!0,this.U.abort(),this.d=!1,this.dispatchEvent("complete"),this.dispatchEvent("abort"),my(this)))};function iy(b,c){b.a=!1;b.U&&(b.d=!0,b.U.abort(),b.d=!1);b.f=c;ny(b);my(b)}function ny(b){b.k||(b.k=!0,b.dispatchEvent("complete"),b.dispatchEvent("error"))}
l.P=function(){this.U&&(this.a&&(this.a=!1,this.d=!0,this.U.abort(),this.d=!1),my(this,!0));ey.T.P.call(this)};l.Yf=function(){this.oa||(this.q||this.c||this.d?oy(this):this.il())};l.il=function(){oy(this)};
function oy(b){if(b.a&&"undefined"!=typeof aa&&(!b.n[1]||4!=py(b)||2!=qy(b)))if(b.c&&4==py(b))Yx(b.Yf,0,b);else if(b.dispatchEvent("readystatechange"),4==py(b)){b.a=!1;try{if(ry(b))b.dispatchEvent("complete"),b.dispatchEvent("success");else{var c;try{c=2<py(b)?b.U.statusText:""}catch(d){c=""}b.f=c+" ["+qy(b)+"]";ny(b)}}finally{my(b)}}}function my(b,c){if(b.U){ky(b);var d=b.U,e=b.n[0]?ca:null;b.U=null;b.n=null;c||b.dispatchEvent("ready");try{d.onreadystatechange=e}catch(f){}}}
function ky(b){b.U&&b.p&&(b.U.ontimeout=null);ja(b.b)&&(ba.clearTimeout(b.b),b.b=null)}function ry(b){var c=qy(b),d;a:switch(c){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:d=!0;break a;default:d=!1}if(!d){if(c=0===c)b=Er(String(b.o))[1]||null,!b&&self.location&&(b=self.location.protocol,b=b.substr(0,b.length-1)),c=!gy.test(b?b.toLowerCase():"");d=c}return d}function py(b){return b.U?b.U.readyState:0}function qy(b){try{return 2<py(b)?b.U.status:-1}catch(c){return-1}}
function sy(b){try{return b.U?b.U.responseText:""}catch(c){return""}}function ty(b){try{if(!b.U)return null;if("response"in b.U)return b.U.response;switch(b.e){case fy:case "text":return b.U.responseText;case "arraybuffer":if("mozResponseArrayBuffer"in b.U)return b.U.mozResponseArrayBuffer}return null}catch(c){return null}};function Z(b){kn.call(this,{attributions:b.attributions,logo:b.logo,projection:b.projection});this.format=b.format}v(Z,kn);
function uy(b,c,d,e,f){var g=new ey;g.e="binary"==b.format.O()&&Wf?"arraybuffer":"text";w(g,"complete",function(b){b=b.target;if(ry(b)){var c=this.format.O(),g;if("binary"==c&&Wf)g=ty(b);else if("json"==c)g=sy(b);else if("text"==c)g=sy(b);else if("xml"==c){if(!Gb)try{g=b.U?b.U.responseXML:null}catch(p){g=null}null!=g||(g=dq(sy(b)))}null!=g?d.call(f,this.a(g)):Ki(this,"error")}else e.call(f);qc(b)},!1,b);g.send(c)}Z.prototype.a=function(b){return this.format.ma(b,{featureProjection:this.g})};function $(b){Z.call(this,{attributions:b.attributions,format:b.format,logo:b.logo,projection:b.projection});m(b.arrayBuffer)&&this.lb(this.a(b.arrayBuffer));m(b.doc)&&this.lb(this.a(b.doc));m(b.node)&&this.lb(this.a(b.node));m(b.object)&&this.lb(this.a(b.object));m(b.text)&&this.lb(this.a(b.text));if(m(b.url)||m(b.urls))if(Ki(this,"loading"),m(b.url)&&uy(this,b.url,this.p,this.o,this),m(b.urls)){b=b.urls;var c,d;c=0;for(d=b.length;c<d;++c)uy(this,b[c],this.p,this.o,this)}}v($,Z);
$.prototype.o=function(){Ki(this,"error")};$.prototype.p=function(b){this.lb(b);Ki(this,"ready")};function vy(b){b=m(b)?b:{};$.call(this,{attributions:b.attributions,extent:b.extent,format:new zp({defaultDataProjection:b.defaultProjection}),logo:b.logo,object:b.object,projection:b.projection,text:b.text,url:b.url,urls:b.urls})}v(vy,$);function wy(b){b=m(b)?b:{};$.call(this,{attributions:b.attributions,doc:b.doc,extent:b.extent,format:new Pq,logo:b.logo,node:b.node,projection:b.projection,text:b.text,url:b.url,urls:b.urls})}v(wy,$);function xy(b){b=m(b)?b:{};$.call(this,{format:new zr({altitudeMode:b.altitudeMode}),projection:b.projection,text:b.text,url:b.url,urls:b.urls})}v(xy,$);function yy(b){$m.call(this,{projection:b.projection,resolutions:b.resolutions});this.H=m(b.crossOrigin)?b.crossOrigin:null;this.e=m(b.displayDpi)?b.displayDpi:96;this.c=m(b.params)?b.params:{};var c;m(b.url)?c=Yv(b.url,this.c,ra(this.$j,this)):c=Zv;this.p=c;this.a=m(b.imageLoadFunction)?b.imageLoadFunction:bn;this.N=m(b.hidpi)?b.hidpi:!0;this.r=m(b.metersPerUnit)?b.metersPerUnit:1;this.k=m(b.ratio)?b.ratio:1;this.S=m(b.useOverlay)?b.useOverlay:!1;this.b=null;this.o=0}v(yy,$m);l=yy.prototype;
l.Zj=function(){return this.c};l.sc=function(b,c,d,e){c=an(this,c);d=this.N?d:1;var f=this.b;if(null!==f&&this.o==this.d&&f.resolution==c&&f.f==d&&$d(f.J(),b))return f;1!=this.k&&(b=b.slice(),te(b,this.k));e=this.p(b,[re(b)/c*d,oe(b)/c*d],e);m(e)?f=new Vv(b,c,d,this.f,e,this.H,this.a):f=null;this.b=f;this.o=this.d;return f};l.Yj=function(){return this.a};l.bk=function(b){Db(this.c,b);this.l()};
l.$j=function(b,c,d,e){var f;f=this.r;var g=re(d),h=oe(d),k=e[0],n=e[1],p=.0254/this.e;f=n*g>k*h?g*f/(k*p):h*f/(n*p);d=le(d);e={OPERATION:this.S?"GETDYNAMICMAPOVERLAYIMAGE":"GETMAPIMAGE",VERSION:"2.0.0",LOCALE:"en",CLIENTAGENT:"ol.source.ImageMapGuide source",CLIP:"1",SETDISPLAYDPI:this.e,SETDISPLAYWIDTH:Math.round(e[0]),SETDISPLAYHEIGHT:Math.round(e[1]),SETVIEWSCALE:f,SETVIEWCENTERX:d[0],SETVIEWCENTERY:d[1]};Db(e,c);return Hr(Jr([b],e))};l.ak=function(b){this.b=null;this.a=b;this.l()};function zy(b){var c=m(b.attributions)?b.attributions:null,d=b.imageExtent,e,f;m(b.imageSize)&&(e=oe(d)/b.imageSize[1],f=[e]);var g=m(b.crossOrigin)?b.crossOrigin:null,h=m(b.imageLoadFunction)?b.imageLoadFunction:bn;$m.call(this,{attributions:c,logo:b.logo,projection:Be(b.projection),resolutions:f});this.a=new Vv(d,e,1,c,b.url,g,h)}v(zy,$m);zy.prototype.sc=function(b){return qe(b,this.a.J())?this.a:null};function Ay(b){b=m(b)?b:{};$m.call(this,{attributions:b.attributions,logo:b.logo,projection:b.projection,resolutions:b.resolutions});this.N=m(b.crossOrigin)?b.crossOrigin:null;this.c=b.url;this.k=m(b.imageLoadFunction)?b.imageLoadFunction:bn;this.a=b.params;this.e=!0;By(this);this.H=b.serverType;this.S=m(b.hidpi)?b.hidpi:!0;this.b=null;this.o=[0,0];this.r=0;this.p=m(b.ratio)?b.ratio:1.5}v(Ay,$m);var Cy=[101,101];l=Ay.prototype;
l.hk=function(b,c,d,e){if(m(this.c)){var f=ne(b,c,0,Cy),g={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.a.LAYERS};Db(g,this.a,e);e=Math.floor((f[3]-b[1])/c);g[this.e?"I":"X"]=Math.floor((b[0]-f[0])/c);g[this.e?"J":"Y"]=e;return Dy(this,f,Cy,1,Be(d),g)}};l.jk=function(){return this.a};
l.sc=function(b,c,d,e){if(!m(this.c))return null;c=an(this,c);1==d||this.S&&m(this.H)||(d=1);var f=this.b;if(null!==f&&this.r==this.d&&f.resolution==c&&f.f==d&&$d(f.J(),b))return f;f={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};Db(f,this.a);b=b.slice();var g=(b[0]+b[2])/2,h=(b[1]+b[3])/2;if(1!=this.p){var k=this.p*re(b)/2,n=this.p*oe(b)/2;b[0]=g-k;b[1]=h-n;b[2]=g+k;b[3]=h+n}var k=c/d,n=Math.ceil(re(b)/k),p=Math.ceil(oe(b)/k);b[0]=g-k*n/2;b[2]=g+k*n/2;b[1]=h-k*
p/2;b[3]=h+k*p/2;this.o[0]=n;this.o[1]=p;e=Dy(this,b,this.o,d,e,f);this.b=new Vv(b,c,d,this.f,e,this.N,this.k);this.r=this.d;return this.b};l.ik=function(){return this.k};
function Dy(b,c,d,e,f,g){g[b.e?"CRS":"SRS"]=f.a;"STYLES"in b.a||(g.STYLES=new String(""));if(1!=e)switch(b.H){case "geoserver":g.FORMAT_OPTIONS="dpi:"+(90*e+.5|0);break;case "mapserver":g.MAP_RESOLUTION=90*e;break;case "carmentaserver":case "qgis":g.DPI=90*e}g.WIDTH=d[0];g.HEIGHT=d[1];d=f.b;var h;b.e&&"ne"==d.substr(0,2)?h=[c[1],c[0],c[3],c[2]]:h=c;g.BBOX=h.join(",");return Hr(Jr([b.c],g))}l.kk=function(){return this.c};l.lk=function(b){this.b=null;this.k=b;this.l()};
l.mk=function(b){b!=this.c&&(this.c=b,this.b=null,this.l())};l.nk=function(b){Db(this.a,b);By(this);this.b=null;this.l()};function By(b){b.e=0<=Ma(zb(b.a,"VERSION","1.3.0"),"1.3")};function Ey(b){b=m(b)?b:{};$.call(this,{attributions:b.attributions,doc:b.doc,format:new es({extractStyles:b.extractStyles,defaultStyle:b.defaultStyle}),logo:b.logo,node:b.node,projection:b.projection,text:b.text,url:b.url,urls:b.urls})}v(Ey,$);function Fy(b){var c=m(b.projection)?b.projection:"EPSG:3857",d=new Sx({extent:bj(c),maxZoom:b.maxZoom,tileSize:b.tileSize});Qx.call(this,{attributions:b.attributions,crossOrigin:b.crossOrigin,logo:b.logo,projection:c,tileGrid:d,tileLoadFunction:b.tileLoadFunction,tilePixelRatio:b.tilePixelRatio,tileUrlFunction:Nx});this.i=d.Db({wrapX:b.wrapX});m(b.tileUrlFunction)?this.ta(b.tileUrlFunction):m(b.urls)?this.ta(Lx(b.urls)):m(b.url)&&this.b(b.url)}v(Fy,Qx);
Fy.prototype.ta=function(b){Fy.T.ta.call(this,Ox(this.i,b))};Fy.prototype.b=function(b){this.ta(Lx(Px(b)))};function Gy(b){b=m(b)?b:{};var c;m(b.attributions)?c=b.attributions:c=[Hy];var d=Tb?"https:":"http:";Fy.call(this,{attributions:c,crossOrigin:m(b.crossOrigin)?b.crossOrigin:"anonymous",opaque:!0,maxZoom:m(b.maxZoom)?b.maxZoom:19,tileLoadFunction:b.tileLoadFunction,url:m(b.url)?b.url:d+"//{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png",wrapX:b.wrapX})}v(Gy,Fy);var Hy=new pf({html:'&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors.'});function Iy(b){b=m(b)?b:{};var c=Jy[b.layer];this.c=b.layer;var d=Tb?"https:":"http:";Fy.call(this,{attributions:c.attributions,crossOrigin:"anonymous",logo:"//developer.mapquest.com/content/osm/mq_logo.png",maxZoom:c.maxZoom,opaque:!0,tileLoadFunction:b.tileLoadFunction,url:m(b.url)?b.url:d+"//otile{1-4}-s.mqcdn.com/tiles/1.0.0/"+this.c+"/{z}/{x}/{y}.jpg"})}v(Iy,Fy);
var Ky=new pf({html:'Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a>'}),Jy={osm:{maxZoom:19,attributions:[Ky,Hy]},sat:{maxZoom:18,attributions:[Ky,new pf({html:"Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"})]},hyb:{maxZoom:18,attributions:[Ky,Hy]}};Iy.prototype.e=function(){return this.c};function Ly(b){b=m(b)?b:{};$.call(this,{attributions:b.attributions,doc:b.doc,format:new Ot,logo:b.logo,node:b.node,projection:b.projection,text:b.text,url:b.url,urls:b.urls})}v(Ly,$);function My(b){Z.call(this,{attributions:b.attributions,format:b.format,logo:b.logo,projection:b.projection});this.p=new en;this.r=b.loader;this.H=m(b.strategy)?b.strategy:xx;this.o={}}v(My,Z);My.prototype.lb=function(b){var c=[],d,e;d=0;for(e=b.length;d<e;++d){var f=b[d],g=f.aa;m(g)?g in this.o||(c.push(f),this.o[g]=!0):c.push(f)}My.T.lb.call(this,c)};My.prototype.clear=function(b){xb(this.o);this.p.clear();My.T.clear.call(this,b)};
My.prototype.Hb=function(b,c,d){var e=this.p;b=this.H(b,c);var f,g;f=0;for(g=b.length;f<g;++f){var h=b[f];jn(e,h,function(b){return $d(b.extent,h)})||(this.r.call(this,h,c,d),e.sa(h,{extent:h.slice()}))}};var Ny={terrain:{Za:"jpg",opaque:!0},"terrain-background":{Za:"jpg",opaque:!0},"terrain-labels":{Za:"png",opaque:!1},"terrain-lines":{Za:"png",opaque:!1},"toner-background":{Za:"png",opaque:!0},toner:{Za:"png",opaque:!0},"toner-hybrid":{Za:"png",opaque:!1},"toner-labels":{Za:"png",opaque:!1},"toner-lines":{Za:"png",opaque:!1},"toner-lite":{Za:"png",opaque:!0},watercolor:{Za:"jpg",opaque:!0}},Oy={terrain:{minZoom:4,maxZoom:18},toner:{minZoom:0,maxZoom:20},watercolor:{minZoom:3,maxZoom:16}};
function Py(b){var c=b.layer.indexOf("-"),d=Ny[b.layer],e=Tb?"https://stamen-tiles-{a-d}.a.ssl.fastly.net/":"http://{a-d}.tile.stamen.com/";Fy.call(this,{attributions:Qy,crossOrigin:"anonymous",maxZoom:Oy[-1==c?b.layer:b.layer.slice(0,c)].maxZoom,opaque:d.opaque,tileLoadFunction:b.tileLoadFunction,url:m(b.url)?b.url:e+b.layer+"/{z}/{x}/{y}."+d.Za})}v(Py,Fy);
var Qy=[new pf({html:'Map tiles by <a href="http://stamen.com/">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.'}),Hy];function Ry(b){b=m(b)?b:{};var c=m(b.params)?b.params:{};Qx.call(this,{attributions:b.attributions,logo:b.logo,projection:b.projection,tileGrid:b.tileGrid,tileLoadFunction:b.tileLoadFunction,tileUrlFunction:ra(this.rk,this)});var d=b.urls;!m(d)&&m(b.url)&&(d=Px(b.url));this.c=null!=d?d:[];this.b=c;this.e=Td()}v(Ry,Qx);l=Ry.prototype;l.ok=function(){return this.b};l.Xb=function(b,c,d){b=Ry.T.Xb.call(this,b,c,d);return 1==c?b:b*c+.5|0};l.pk=function(){return this.c};
l.qk=function(b){b=m(b)?Px(b):null;this.Pf(b)};l.Pf=function(b){this.c=null!=b?b:[];this.l()};
l.rk=function(b,c,d){var e=this.tileGrid;null===e&&(e=ej(this,d));if(!(e.a.length<=b[0])){var f=Wi(e,b,this.e),g=e.ua(b[0]);1!=c&&(g=g*c+.5|0);e={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};Db(e,this.b);var h=this.c;0==h.length?b=void 0:(d=d.a.split(":").pop(),e.SIZE=g+","+g,e.BBOX=f.join(","),e.BBOXSR=d,e.IMAGESR=d,e.DPI=90*c,b=1==h.length?h[0]:h[Xb((b[1]<<b[0])+b[2],h.length)],ya(b,"/")||(b+="/"),ya(b,"MapServer/")?b+="export":ya(b,"ImageServer/")&&(b+="exportImage"),b=Hr(Jr([b],e)));return b}};
l.sk=function(b){Db(this.b,b);this.l()};function Sy(b,c){Oi.call(this,b,2);this.b=c.ua(b[0]);this.d={}}v(Sy,Oi);Sy.prototype.Ta=function(b){b=m(b)?ma(b):-1;if(b in this.d)return this.d[b];var c=this.b,d=Mf(c,c);d.strokeStyle="black";d.strokeRect(.5,.5,c+.5,c+.5);d.fillStyle="black";d.textAlign="center";d.textBaseline="middle";d.font="24px sans-serif";d.fillText(kf(this.a),c/2,c/2);return this.d[b]=d.canvas};function Ty(b){cj.call(this,{opaque:!1,projection:b.projection,tileGrid:b.tileGrid})}v(Ty,cj);
Ty.prototype.Vb=function(b,c,d){var e=this.nb(b,c,d);if(Ri(this.a,e))return this.a.get(e);b=new Sy([b,c,d],this.tileGrid);this.a.set(e,b);return b};function Uy(b){Qx.call(this,{attributions:b.attributions,crossOrigin:b.crossOrigin,projection:Be("EPSG:3857"),state:"loading",tileLoadFunction:b.tileLoadFunction});this.b=b.wrapX;(new Fx(b.url)).send(void 0,ra(this.c,this))}v(Uy,Qx);
Uy.prototype.c=function(b){var c=Be("EPSG:4326"),d=this.g,e;m(b.bounds)&&(e=ue(b.bounds,Ae(c,d)));var f=b.minzoom||0,g=b.maxzoom||22;this.tileGrid=d=new Sx({extent:bj(d),maxZoom:g,minZoom:f});this.tileUrlFunction=Ox(d.Db({extent:e,wrapX:this.b}),Lx(b.tiles));if(m(b.attribution)&&null===this.f){c=m(e)?e:c.J();e={};for(var h;f<=g;++f)h=f.toString(),e[h]=[Xi(d,c,f)];this.f=[new pf({html:b.attribution,tileRanges:e})]}Ki(this,"ready")};function Vy(b){cj.call(this,{projection:Be("EPSG:3857"),state:"loading"});this.e=m(b.preemptive)?b.preemptive:!0;this.b=Nx;this.c=void 0;(new Fx(b.url)).send(void 0,ra(this.uk,this))}v(Vy,cj);l=Vy.prototype;l.ci=function(){return this.c};l.xh=function(b,c,d,e,f){null===this.tileGrid?!0===f?nh(function(){d.call(e,null)}):d.call(e,null):(c=this.tileGrid.Wb(b,c),Wy(this.Vb(c[0],c[1],c[2],1,this.g),b,d,e,f))};
l.uk=function(b){var c=Be("EPSG:4326"),d=this.g,e;m(b.bounds)&&(e=ue(b.bounds,Ae(c,d)));var f=b.minzoom||0,g=b.maxzoom||22;this.tileGrid=d=new Sx({extent:bj(d),maxZoom:g,minZoom:f});this.c=b.template;var h=b.grids;if(null!=h){this.b=Ox(d.Db({extent:e}),Lx(h));if(m(b.attribution)){c=m(e)?e:c.J();for(e={};f<=g;++f)h=f.toString(),e[h]=[Xi(d,c,f)];this.f=[new pf({html:b.attribution,tileRanges:e})]}Ki(this,"ready")}else Ki(this,"error")};
l.Vb=function(b,c,d,e,f){var g=this.nb(b,c,d);if(Ri(this.a,g))return this.a.get(g);b=[b,c,d];e=this.b(b,e,f);e=new Xy(b,m(e)?0:4,m(e)?e:"",Wi(this.tileGrid,b),this.e);this.a.set(g,e);return e};l.Pe=function(b,c,d){b=this.nb(b,c,d);Ri(this.a,b)&&this.a.get(b)};function Xy(b,c,d,e,f){Oi.call(this,b,c);this.g=d;this.d=e;this.n=f;this.c=this.f=this.b=null}v(Xy,Oi);l=Xy.prototype;l.Ta=function(){return null};
function Yy(b,c){if(null===b.b||null===b.f||null===b.c)return null;var d=b.b[Math.floor((1-(c[1]-b.d[1])/(b.d[3]-b.d[1]))*b.b.length)];if(!ia(d))return null;d=d.charCodeAt(Math.floor((c[0]-b.d[0])/(b.d[2]-b.d[0])*d.length));93<=d&&d--;35<=d&&d--;d=b.f[d-32];return null!=d?b.c[d]:null}function Wy(b,c,d,e,f){0==b.state&&!0===f?(Vc(b,"change",function(){d.call(e,Yy(this,c))},!1,b),Zy(b)):!0===f?nh(function(){d.call(e,Yy(this,c))},b):d.call(e,Yy(b,c))}l.qb=function(){return this.g};
l.si=function(){this.state=3;Pi(this)};l.Fi=function(b){this.b=b.grid;this.f=b.keys;this.c=b.data;this.state=4;Pi(this)};function Zy(b){0==b.state&&(b.state=1,(new Fx(b.g)).send(void 0,ra(b.Fi,b),ra(b.si,b)))}l.load=function(){this.n&&Zy(this)};function $y(b){Z.call(this,{attributions:b.attributions,format:b.format,logo:b.logo,projection:b.projection});this.p=b.tileGrid;this.r=Nx;this.H=this.p.Db();this.o={};m(b.tileUrlFunction)?(this.r=b.tileUrlFunction,this.l()):m(b.urls)?(this.r=Lx(b.urls),this.l()):m(b.url)&&(this.r=Lx(Px(b.url)),this.l())}v($y,Z);l=$y.prototype;l.clear=function(){xb(this.o)};
function az(b,c,d,e){var f=b.o;b=b.p.Wb(c,d);f=f[b[0]+"/"+b[1]+"/"+b[2]];if(m(f))for(b=0,d=f.length;b<d;++b){var g=f[b];if(g.R().Jb(c[0],c[1])&&e.call(void 0,g))break}}l.Fb=function(b,c,d,e){var f=this.p,g=this.o;c=bc(f.a,c,0);b=Xi(f,b,c);for(var h,f=b.a;f<=b.c;++f)for(h=b.b;h<=b.d;++h){var k=g[c+"/"+f+"/"+h];if(m(k)){var n,p;n=0;for(p=k.length;n<p;++n){var q=d.call(e,k[n]);if(q)return q}}}};l.Aa=function(){var b=this.o,c=[],d;for(d in b)ab(c,b[d]);return c};
l.Fh=function(b,c){var d=[];az(this,b,c,function(b){d.push(b)});return d};l.Hb=function(b,c,d){function e(b,c){k[b]=c;Ki(this,"ready")}var f=this.H,g=this.p,h=this.r,k=this.o;c=bc(g.a,c,0);b=Xi(g,b,c);var g=[c,0,0],n,p;for(n=b.a;n<=b.c;++n)for(p=b.b;p<=b.d;++p){var q=c+"/"+n+"/"+p;if(!(q in k)){g[0]=c;g[1]=n;g[2]=p;f(g,d,g);var r=h(g,1,d);m(r)&&(k[q]=[],uy(this,r,sa(e,q),ca,this))}}};function bz(b){b=m(b)?b:{};var c=m(b.params)?b.params:{};Qx.call(this,{attributions:b.attributions,crossOrigin:b.crossOrigin,logo:b.logo,opaque:!zb(c,"TRANSPARENT",!0),projection:b.projection,tileGrid:b.tileGrid,tileLoadFunction:b.tileLoadFunction,tileUrlFunction:ra(this.zk,this)});var d=b.urls;!m(d)&&m(b.url)&&(d=Px(b.url));this.c=null!=d?d:[];this.i=m(b.gutter)?b.gutter:0;this.b=c;this.e=!0;this.k=b.serverType;this.p=m(b.hidpi)?b.hidpi:!0;this.o="";cz(this);this.r=Td();dz(this)}v(bz,Qx);l=bz.prototype;
l.vk=function(b,c,d,e){d=Be(d);var f=this.tileGrid;null===f&&(f=ej(this,d));c=f.Wb(b,c);if(!(f.a.length<=c[0])){var g=f.na(c[0]),h=Wi(f,c,this.r),f=f.ua(c[0]),k=this.i;0!==k&&(f+=2*k,h=Xd(h,g*k,h));k={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.b.LAYERS};Db(k,this.b,e);e=Math.floor((h[3]-b[1])/g);k[this.e?"I":"X"]=Math.floor((b[0]-h[0])/g);k[this.e?"J":"Y"]=e;return ez(this,c,f,h,1,d,k)}};l.jd=function(){return this.i};
l.nb=function(b,c,d){return this.o+bz.T.nb.call(this,b,c,d)};l.wk=function(){return this.b};
function ez(b,c,d,e,f,g,h){var k=b.c;if(0!=k.length){h.WIDTH=d;h.HEIGHT=d;h[b.e?"CRS":"SRS"]=g.a;"STYLES"in b.b||(h.STYLES=new String(""));if(1!=f)switch(b.k){case "geoserver":h.FORMAT_OPTIONS="dpi:"+(90*f+.5|0);break;case "mapserver":h.MAP_RESOLUTION=90*f;break;case "carmentaserver":case "qgis":h.DPI=90*f}d=g.b;b.e&&"ne"==d.substr(0,2)&&(b=e[0],e[0]=e[1],e[1]=b,b=e[2],e[2]=e[3],e[3]=b);h.BBOX=e.join(",");return Hr(Jr([1==k.length?k[0]:k[Xb((c[1]<<c[0])+c[2],k.length)]],h))}}
l.Xb=function(b,c,d){b=bz.T.Xb.call(this,b,c,d);return 1!=c&&this.p&&m(this.k)?b*c+.5|0:b};l.xk=function(){return this.c};function cz(b){var c=0,d=[],e,f;e=0;for(f=b.c.length;e<f;++e)d[c++]=b.c[e];for(var g in b.b)d[c++]=g+"-"+b.b[g];b.o=d.join("#")}l.yk=function(b){b=m(b)?Px(b):null;this.Qf(b)};l.Qf=function(b){this.c=null!=b?b:[];cz(this);this.l()};
l.zk=function(b,c,d){var e=this.tileGrid;null===e&&(e=ej(this,d));if(!(e.a.length<=b[0])){1==c||this.p&&m(this.k)||(c=1);var f=e.na(b[0]),g=Wi(e,b,this.r),e=e.ua(b[0]),h=this.i;0!==h&&(e+=2*h,g=Xd(g,f*h,g));1!=c&&(e=e*c+.5|0);f={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};Db(f,this.b);return ez(this,b,e,g,c,d,f)}};l.Ak=function(b){Db(this.b,b);cz(this);dz(this);this.l()};function dz(b){b.e=0<=Ma(zb(b.b,"VERSION","1.3.0"),"1.3")};function fz(b){b=m(b)?b:{};$.call(this,{attributions:b.attributions,extent:b.extent,format:new ru({defaultDataProjection:b.defaultProjection}),logo:b.logo,object:b.object,projection:b.projection,text:b.text,url:b.url})}v(fz,$);function gz(b){this.b=b.matrixIds;Ui.call(this,{origin:b.origin,origins:b.origins,resolutions:b.resolutions,tileSize:b.tileSize,tileSizes:b.tileSizes})}v(gz,Ui);gz.prototype.g=function(){return this.b};
function hz(b){var c=[],d=[],e=[],f=[],g;g=Be(b.SupportedCRS.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3"));var h=g.od(),k="ne"==g.b.substr(0,2);db(b.TileMatrix,function(b,c){return c.ScaleDenominator-b.ScaleDenominator});Qa(b.TileMatrix,function(b){d.push(b.Identifier);k?e.push([b.TopLeftCorner[1],b.TopLeftCorner[0]]):e.push(b.TopLeftCorner);c.push(2.8E-4*b.ScaleDenominator/h);f.push(b.TileWidth)});return new gz({origins:e,resolutions:c,matrixIds:d,tileSizes:f})};function iz(b){function c(b){b="KVP"==d?Hr(Jr([b],f)):b.replace(/\{(\w+?)\}/g,function(b,c){return c.toLowerCase()in f?f[c.toLowerCase()]:b});return function(c){if(null!==c){var f={TileMatrix:e.b[c[0]],TileCol:c[1],TileRow:c[2]};Db(f,g);c=b;return c="KVP"==d?Hr(Jr([c],f)):c.replace(/\{(\w+?)\}/g,function(b,c){return f[c]})}}}this.p=m(b.version)?b.version:"1.0.0";this.c=m(b.format)?b.format:"image/jpeg";this.b=m(b.dimensions)?b.dimensions:{};this.i="";jz(this);this.k=b.layer;this.e=b.matrixSet;this.o=
b.style;var d=m(b.requestEncoding)?b.requestEncoding:"KVP",e=b.tileGrid,f={layer:this.k,style:this.o,tilematrixset:this.e};"KVP"==d&&Db(f,{Service:"WMTS",Request:"GetTile",Version:this.p,Format:this.c});var g=this.b,h=Nx,k=b.urls;!m(k)&&m(b.url)&&(k=Px(b.url));m(k)&&(h=Mx(Sa(k,c)));var n=Td(),p=[0,0,0],h=Ox(function(b,c,d){if(e.a.length<=b[0])return null;var f=b[1],g=-b[2]-1,h=Wi(e,b,n),k=c.J();null!==k&&c.e&&(c=Math.ceil(re(k)/re(h)),f=Xb(f,c),p[0]=b[0],p[1]=f,p[2]=b[2],h=Wi(e,p,n));return!qe(h,
k)||qe(h,k)&&(h[0]==k[2]||h[2]==k[0]||h[1]==k[3]||h[3]==k[1])?null:gf(b[0],f,g,d)},h);Qx.call(this,{attributions:b.attributions,crossOrigin:b.crossOrigin,logo:b.logo,projection:b.projection,tileClass:b.tileClass,tileGrid:e,tileLoadFunction:b.tileLoadFunction,tilePixelRatio:b.tilePixelRatio,tileUrlFunction:h})}v(iz,Qx);l=iz.prototype;l.Dh=function(){return this.b};l.Hh=function(){return this.c};l.nb=function(b,c,d){return this.i+iz.T.nb.call(this,b,c,d)};l.Bk=function(){return this.k};l.Th=function(){return this.e};
l.Ck=function(){return this.o};l.gi=function(){return this.p};function jz(b){var c=0,d=[],e;for(e in b.b)d[c++]=e+"-"+b.b[e];b.i=d.join("/")}l.pm=function(b){Db(this.b,b);jz(this);this.l()};function kz(b){var c=m(b)?b:c;Ui.call(this,{origin:[0,0],resolutions:c.resolutions})}v(kz,Ui);kz.prototype.Db=function(b){b=m(b)?b:{};var c=this.minZoom,d=this.maxZoom,e=null;if(m(b.extent)){var e=Array(d+1),f;for(f=0;f<=d;++f)e[f]=f<c?null:Xi(this,b.extent,f)}return function(b,f,k){f=b[0];if(f<c||d<f)return null;var n=Math.pow(2,f),p=b[1];if(0>p||n<=p)return null;b=b[2];return b<-n||-1<b||null!==e&&!nf(e[f],p,-b-1)?null:gf(f,p,-b-1,k)}};function lz(b){b=m(b)?b:{};var c=b.size,d=c[0],e=c[1],f=[],g=256;switch(m(b.tierSizeCalculation)?b.tierSizeCalculation:"default"){case "default":for(;d>g||e>g;)f.push([Math.ceil(d/g),Math.ceil(e/g)]),g+=g;break;case "truncated":for(;d>g||e>g;)f.push([Math.ceil(d/g),Math.ceil(e/g)]),d>>=1,e>>=1}f.push([1,1]);f.reverse();for(var g=[1],h=[0],e=1,d=f.length;e<d;e++)g.push(1<<e),h.push(f[e-1][0]*f[e-1][1]+h[e-1]);g.reverse();var g=new kz({resolutions:g}),k=b.url,c=Ox(g.Db({extent:[0,0,c[0],c[1]]}),function(b){if(null!==
b){var c=b[0],d=b[1];b=b[2];return k+"TileGroup"+((d+b*f[c][0]+h[c])/256|0)+"/"+c+"-"+d+"-"+b+".jpg"}});Qx.call(this,{attributions:b.attributions,crossOrigin:b.crossOrigin,logo:b.logo,tileClass:mz,tileGrid:g,tileUrlFunction:c})}v(lz,Qx);function mz(b,c,d,e,f){Wv.call(this,b,c,d,e,f);this.c={}}v(mz,Wv);
mz.prototype.Ta=function(b){var c=m(b)?ma(b).toString():"";if(c in this.c)return this.c[c];b=mz.T.Ta.call(this,b);if(2==this.state){if(256==b.width&&256==b.height)return this.c[c]=b;var d=Mf(256,256);d.drawImage(b,0,0);return this.c[c]=d.canvas}return b};function nz(b){b=m(b)?b:{};this.d=m(b.initialSize)?b.initialSize:256;this.b=m(b.maxSize)?b.maxSize:m(ua)?ua:2048;this.a=m(b.space)?b.space:1;this.f=[new oz(this.d,this.a)];this.c=this.d;this.e=[new oz(this.c,this.a)]}nz.prototype.add=function(b,c,d,e,f,g){if(c+this.a>this.b||d+this.a>this.b)return null;e=pz(this,!1,b,c,d,e,g);if(null===e)return null;b=pz(this,!0,b,c,d,m(f)?f:dd,g);return{offsetX:e.offsetX,offsetY:e.offsetY,image:e.image,xf:b.image}};
function pz(b,c,d,e,f,g,h){var k=c?b.e:b.f,n,p,q;p=0;for(q=k.length;p<q;++p){n=k[p];n=n.add(d,e,f,g,h);if(null!==n)return n;null===n&&p===q-1&&(c?(n=Math.min(2*b.c,b.b),b.c=n):(n=Math.min(2*b.d,b.b),b.d=n),n=new oz(n,b.a),k.push(n),++q)}}function oz(b,c){this.a=c;this.d=[{x:0,y:0,width:b,height:b}];this.c={};this.b=Df("CANVAS");this.b.width=b;this.b.height=b;this.f=this.b.getContext("2d")}oz.prototype.get=function(b){return zb(this.c,b,null)};
oz.prototype.add=function(b,c,d,e,f){var g,h,k;h=0;for(k=this.d.length;h<k;++h)if(g=this.d[h],g.width>=c+this.a&&g.height>=d+this.a)return k={offsetX:g.x+this.a,offsetY:g.y+this.a,image:this.b},this.c[b]=k,e.call(f,this.f,g.x+this.a,g.y+this.a),b=h,c=c+this.a,d=d+this.a,f=e=void 0,g.width-c>g.height-d?(e={x:g.x+c,y:g.y,width:g.width-c,height:g.height},f={x:g.x,y:g.y+d,width:c,height:g.height-d},qz(this,b,e,f)):(e={x:g.x+c,y:g.y,width:g.width-c,height:d},f={x:g.x,y:g.y+d,width:g.width,height:g.height-
d},qz(this,b,e,f)),k;return null};function qz(b,c,d,e){c=[c,1];0<d.width&&0<d.height&&c.push(d);0<e.width&&0<e.height&&c.push(e);b.d.splice.apply(b.d,c)};function rz(b){this.q=this.c=this.f=null;this.n=m(b.fill)?b.fill:null;this.N=[0,0];this.a=b.points;this.b=m(b.radius)?b.radius:b.radius1;this.e=m(b.radius2)?b.radius2:this.b;this.g=m(b.angle)?b.angle:0;this.d=m(b.stroke)?b.stroke:null;this.H=this.S=this.D=null;var c=b.atlasManager,d="",e="",f=0,g=null,h,k=0;null!==this.d&&(h=rg(this.d.a),k=this.d.d,m(k)||(k=1),g=this.d.b,Xf||(g=null),e=this.d.f,m(e)||(e="round"),d=this.d.c,m(d)||(d="round"),f=this.d.e,m(f)||(f=10));var n=2*(this.b+k)+1,d={strokeStyle:h,
Uc:k,size:n,lineCap:d,lineDash:g,lineJoin:e,miterLimit:f};if(m(c)){var n=Math.round(n),e=null===this.n,p;e&&(p=ra(this.Uf,this,d));f=this.xb();p=c.add(f,n,n,ra(this.Vf,this,d),p);this.c=p.image;this.N=[p.offsetX,p.offsetY];c=p.image.width;this.q=e?p.xf:this.c}else this.c=Df("CANVAS"),this.c.height=n,this.c.width=n,c=n=this.c.width,p=this.c.getContext("2d"),this.Vf(d,p,0,0),null===this.n?(p=this.q=Df("CANVAS"),p.height=d.size,p.width=d.size,p=p.getContext("2d"),this.Uf(d,p,0,0)):this.q=this.c;this.D=
[n/2,n/2];this.S=[n,n];this.H=[c,c];uj.call(this,{opacity:1,rotateWithView:!1,rotation:m(b.rotation)?b.rotation:0,scale:1,snapToPixel:m(b.snapToPixel)?b.snapToPixel:!0})}v(rz,uj);l=rz.prototype;l.wb=function(){return this.D};l.Hk=function(){return this.g};l.Ik=function(){return this.n};l.Kd=function(){return this.q};l.Bb=function(){return this.c};l.kd=function(){return this.H};l.Pc=function(){return 2};l.Cb=function(){return this.N};l.Jk=function(){return this.a};l.Kk=function(){return this.b};
l.bi=function(){return this.e};l.gb=function(){return this.S};l.Lk=function(){return this.d};l.xe=ca;l.load=ca;l.Oe=ca;
l.Vf=function(b,c,d,e){var f;c.setTransform(1,0,0,1,0,0);c.translate(d,e);c.beginPath();this.e!==this.b&&(this.a*=2);for(d=0;d<=this.a;d++)e=2*d*Math.PI/this.a-Math.PI/2+this.g,f=0===d%2?this.b:this.e,c.lineTo(b.size/2+f*Math.cos(e),b.size/2+f*Math.sin(e));null!==this.n&&(c.fillStyle=rg(this.n.a),c.fill());null!==this.d&&(c.strokeStyle=b.strokeStyle,c.lineWidth=b.Uc,null===b.lineDash||c.setLineDash(b.lineDash),c.lineCap=b.lineCap,c.lineJoin=b.lineJoin,c.miterLimit=b.miterLimit,c.stroke());c.closePath()};
l.Uf=function(b,c,d,e){c.setTransform(1,0,0,1,0,0);c.translate(d,e);c.beginPath();this.e!==this.b&&(this.a*=2);var f;for(d=0;d<=this.a;d++)f=2*d*Math.PI/this.a-Math.PI/2+this.g,e=0===d%2?this.b:this.e,c.lineTo(b.size/2+e*Math.cos(f),b.size/2+e*Math.sin(f));c.fillStyle=kl;c.fill();null!==this.d&&(c.strokeStyle=b.strokeStyle,c.lineWidth=b.Uc,null===b.lineDash||c.setLineDash(b.lineDash),c.stroke());c.closePath()};
l.xb=function(){var b=null===this.d?"-":this.d.xb(),c=null===this.n?"-":this.n.xb();if(null===this.f||b!=this.f[1]||c!=this.f[2]||this.b!=this.f[3]||this.e!=this.f[4]||this.g!=this.f[5]||this.a!=this.f[6])this.f=["r"+b+c+(m(this.b)?this.b.toString():"-")+(m(this.e)?this.e.toString():"-")+(m(this.g)?this.g.toString():"-")+(m(this.a)?this.a.toString():"-"),b,c,this.b,this.e,this.g,this.a];return this.f[0]};t("ol.animation.bounce",function(b){var c=b.resolution,d=m(b.start)?b.start:ta(),e=m(b.duration)?b.duration:1E3,f=m(b.easing)?b.easing:cf;return function(b,h){if(h.time<d)return h.animate=!0,h.viewHints[0]+=1,!0;if(h.time<d+e){var k=f((h.time-d)/e),n=c-h.viewState.resolution;h.animate=!0;h.viewState.resolution+=k*n;h.viewHints[0]+=1;return!0}return!1}},OPENLAYERS);t("ol.animation.pan",df,OPENLAYERS);t("ol.animation.rotate",ef,OPENLAYERS);t("ol.animation.zoom",ff,OPENLAYERS);
t("ol.Attribution",pf,OPENLAYERS);pf.prototype.getHTML=pf.prototype.b;jg.prototype.element=jg.prototype.element;t("ol.Collection",kg,OPENLAYERS);kg.prototype.clear=kg.prototype.clear;kg.prototype.extend=kg.prototype.ye;kg.prototype.forEach=kg.prototype.forEach;kg.prototype.getArray=kg.prototype.kj;kg.prototype.item=kg.prototype.item;kg.prototype.getLength=kg.prototype.Ib;kg.prototype.insertAt=kg.prototype.zd;kg.prototype.pop=kg.prototype.pop;kg.prototype.push=kg.prototype.push;
kg.prototype.remove=kg.prototype.remove;kg.prototype.removeAt=kg.prototype.Le;kg.prototype.setAt=kg.prototype.Vl;t("ol.coordinate.add",wd,OPENLAYERS);t("ol.coordinate.createStringXY",function(b){return function(c){return Dd(c,b)}},OPENLAYERS);t("ol.coordinate.format",zd,OPENLAYERS);t("ol.coordinate.rotate",Bd,OPENLAYERS);t("ol.coordinate.toStringHDMS",function(b){return m(b)?yd(b[1],"NS")+" "+yd(b[0],"EW"):""},OPENLAYERS);t("ol.coordinate.toStringXY",Dd,OPENLAYERS);t("ol.DeviceOrientation",lp,OPENLAYERS);
lp.prototype.getAlpha=lp.prototype.f;lp.prototype.getBeta=lp.prototype.e;lp.prototype.getGamma=lp.prototype.g;lp.prototype.getHeading=lp.prototype.i;lp.prototype.getTracking=lp.prototype.c;lp.prototype.setTracking=lp.prototype.b;t("ol.easing.easeIn",function(b){return Math.pow(b,3)},OPENLAYERS);t("ol.easing.easeOut",$e,OPENLAYERS);t("ol.easing.inAndOut",af,OPENLAYERS);t("ol.easing.linear",bf,OPENLAYERS);t("ol.easing.upAndDown",cf,OPENLAYERS);t("ol.extent.boundingExtent",Sd,OPENLAYERS);
t("ol.extent.buffer",Xd,OPENLAYERS);t("ol.extent.containsCoordinate",function(b,c){return ae(b,c[0],c[1])},OPENLAYERS);t("ol.extent.containsExtent",$d,OPENLAYERS);t("ol.extent.containsXY",ae,OPENLAYERS);t("ol.extent.createEmpty",Td,OPENLAYERS);t("ol.extent.equals",de,OPENLAYERS);t("ol.extent.extend",ee,OPENLAYERS);t("ol.extent.getBottomLeft",he,OPENLAYERS);t("ol.extent.getBottomRight",ie,OPENLAYERS);t("ol.extent.getCenter",le,OPENLAYERS);t("ol.extent.getHeight",oe,OPENLAYERS);
t("ol.extent.getIntersection",pe,OPENLAYERS);t("ol.extent.getSize",function(b){return[b[2]-b[0],b[3]-b[1]]},OPENLAYERS);t("ol.extent.getTopLeft",ke,OPENLAYERS);t("ol.extent.getTopRight",je,OPENLAYERS);t("ol.extent.getWidth",re,OPENLAYERS);t("ol.extent.intersects",qe,OPENLAYERS);t("ol.extent.isEmpty",se,OPENLAYERS);t("ol.extent.applyTransform",ue,OPENLAYERS);t("ol.Feature",P,OPENLAYERS);P.prototype.clone=P.prototype.clone;P.prototype.getGeometry=P.prototype.R;P.prototype.getId=P.prototype.Kh;
P.prototype.getGeometryName=P.prototype.Jh;P.prototype.getStyle=P.prototype.rj;P.prototype.getStyleFunction=P.prototype.sj;P.prototype.setGeometry=P.prototype.Sa;P.prototype.setStyle=P.prototype.i;P.prototype.setId=P.prototype.c;P.prototype.setGeometryName=P.prototype.f;t("ol.FeatureOverlay",np,OPENLAYERS);np.prototype.addFeature=np.prototype.Df;np.prototype.getFeatures=np.prototype.lj;np.prototype.getMap=np.prototype.mj;np.prototype.removeFeature=np.prototype.Ed;np.prototype.setFeatures=np.prototype.Tc;
np.prototype.setMap=np.prototype.setMap;np.prototype.setStyle=np.prototype.Ff;np.prototype.getStyle=np.prototype.nj;np.prototype.getStyleFunction=np.prototype.oj;t("ol.Geolocation",X,OPENLAYERS);X.prototype.getAccuracy=X.prototype.mf;X.prototype.getAccuracyGeometry=X.prototype.o;X.prototype.getAltitude=X.prototype.p;X.prototype.getAltitudeAccuracy=X.prototype.r;X.prototype.getHeading=X.prototype.H;X.prototype.getPosition=X.prototype.N;X.prototype.getProjection=X.prototype.g;X.prototype.getSpeed=X.prototype.D;
X.prototype.getTracking=X.prototype.i;X.prototype.getTrackingOptions=X.prototype.e;X.prototype.setProjection=X.prototype.k;X.prototype.setTracking=X.prototype.b;X.prototype.setTrackingOptions=X.prototype.q;t("ol.Graticule",Qv,OPENLAYERS);Qv.prototype.getMap=Qv.prototype.vj;Qv.prototype.getMeridians=Qv.prototype.Uh;Qv.prototype.getParallels=Qv.prototype.Zh;Qv.prototype.setMap=Qv.prototype.setMap;t("ol.has.DEVICE_PIXEL_RATIO",Vf,OPENLAYERS);t("ol.has.CANVAS",Yf,OPENLAYERS);
t("ol.has.DEVICE_ORIENTATION",Zf,OPENLAYERS);t("ol.has.GEOLOCATION",$f,OPENLAYERS);t("ol.has.TOUCH",ag,OPENLAYERS);t("ol.has.WEBGL",Uf,OPENLAYERS);Vv.prototype.getImage=Vv.prototype.a;Wv.prototype.getImage=Wv.prototype.Ta;t("ol.Kinetic",Jj,OPENLAYERS);t("ol.loadingstrategy.all",function(){return[[-Infinity,-Infinity,Infinity,Infinity]]},OPENLAYERS);t("ol.loadingstrategy.bbox",xx,OPENLAYERS);
t("ol.loadingstrategy.createTile",function(b){return function(c,d){var e=bc(b.a,d,0),f=Xi(b,c,e),g=[],e=[e,0,0];for(e[1]=f.a;e[1]<=f.c;++e[1])for(e[2]=f.b;e[2]<=f.d;++e[2])g.push(Wi(b,e));return g}},OPENLAYERS);t("ol.Map",L,OPENLAYERS);L.prototype.addControl=L.prototype.gh;L.prototype.addInteraction=L.prototype.hh;L.prototype.addLayer=L.prototype.bf;L.prototype.addOverlay=L.prototype.cf;L.prototype.beforeRender=L.prototype.La;L.prototype.forEachFeatureAtPixel=L.prototype.qe;
L.prototype.forEachLayerAtPixel=L.prototype.zj;L.prototype.hasFeatureAtPixel=L.prototype.Ri;L.prototype.getEventCoordinate=L.prototype.Eh;L.prototype.getEventPixel=L.prototype.hd;L.prototype.getTarget=L.prototype.Fd;L.prototype.getTargetElement=L.prototype.Mc;L.prototype.getCoordinateFromPixel=L.prototype.ra;L.prototype.getControls=L.prototype.Ch;L.prototype.getOverlays=L.prototype.Yh;L.prototype.getInteractions=L.prototype.Lh;L.prototype.getLayerGroup=L.prototype.Ub;L.prototype.getLayers=L.prototype.ea;
L.prototype.getPixelFromCoordinate=L.prototype.e;L.prototype.getSize=L.prototype.f;L.prototype.getView=L.prototype.a;L.prototype.getViewport=L.prototype.hi;L.prototype.renderSync=L.prototype.Sl;L.prototype.render=L.prototype.render;L.prototype.removeControl=L.prototype.Ml;L.prototype.removeInteraction=L.prototype.Nl;L.prototype.removeLayer=L.prototype.Ol;L.prototype.removeOverlay=L.prototype.Pl;L.prototype.setLayerGroup=L.prototype.tg;L.prototype.setSize=L.prototype.S;L.prototype.setTarget=L.prototype.ia;
L.prototype.setView=L.prototype.Fa;L.prototype.updateSize=L.prototype.q;vi.prototype.originalEvent=vi.prototype.originalEvent;vi.prototype.pixel=vi.prototype.pixel;vi.prototype.coordinate=vi.prototype.coordinate;vi.prototype.dragging=vi.prototype.dragging;vi.prototype.preventDefault=vi.prototype.preventDefault;vi.prototype.stopPropagation=vi.prototype.pb;Sg.prototype.map=Sg.prototype.map;Sg.prototype.frameState=Sg.prototype.frameState;nd.prototype.key=nd.prototype.key;nd.prototype.oldValue=nd.prototype.oldValue;
od.prototype.transform=od.prototype.transform;t("ol.Object",rd,OPENLAYERS);rd.prototype.bindTo=rd.prototype.K;rd.prototype.get=rd.prototype.get;rd.prototype.getKeys=rd.prototype.G;rd.prototype.getProperties=rd.prototype.I;rd.prototype.set=rd.prototype.set;rd.prototype.setProperties=rd.prototype.C;rd.prototype.unbind=rd.prototype.L;rd.prototype.unbindAll=rd.prototype.M;t("ol.Observable",ld,OPENLAYERS);t("ol.Observable.unByKey",md,OPENLAYERS);ld.prototype.changed=ld.prototype.l;
ld.prototype.getRevision=ld.prototype.u;ld.prototype.on=ld.prototype.s;ld.prototype.once=ld.prototype.v;ld.prototype.un=ld.prototype.t;ld.prototype.unByKey=ld.prototype.A;t("ol.WEBGL_MAX_TEXTURE_SIZE",ua,OPENLAYERS);t("ol.inherits",v,OPENLAYERS);t("ol.Overlay",N,OPENLAYERS);N.prototype.getElement=N.prototype.b;N.prototype.getMap=N.prototype.c;N.prototype.getOffset=N.prototype.i;N.prototype.getPosition=N.prototype.q;N.prototype.getPositioning=N.prototype.k;N.prototype.setElement=N.prototype.Me;
N.prototype.setMap=N.prototype.setMap;N.prototype.setOffset=N.prototype.o;N.prototype.setPosition=N.prototype.e;N.prototype.setPositioning=N.prototype.p;Oi.prototype.getTileCoord=Oi.prototype.e;t("ol.View",B,OPENLAYERS);B.prototype.constrainCenter=B.prototype.i;B.prototype.constrainResolution=B.prototype.constrainResolution;B.prototype.constrainRotation=B.prototype.constrainRotation;B.prototype.getCenter=B.prototype.b;B.prototype.calculateExtent=B.prototype.g;B.prototype.getProjection=B.prototype.N;
B.prototype.getResolution=B.prototype.a;B.prototype.getResolutionForExtent=B.prototype.k;B.prototype.getRotation=B.prototype.c;B.prototype.getZoom=B.prototype.ki;B.prototype.fitExtent=B.prototype.pe;B.prototype.fitGeometry=B.prototype.wh;B.prototype.centerOn=B.prototype.oh;B.prototype.rotate=B.prototype.rotate;B.prototype.setCenter=B.prototype.Ha;B.prototype.setResolution=B.prototype.f;B.prototype.setRotation=B.prototype.r;B.prototype.setZoom=B.prototype.S;t("ol.xml.getAllTextContent",Kp,OPENLAYERS);
t("ol.xml.parse",dq,OPENLAYERS);t("ol.webgl.Context",Pn,OPENLAYERS);Pn.prototype.getGL=Pn.prototype.bl;Pn.prototype.getHitDetectionFramebuffer=Pn.prototype.se;Pn.prototype.useProgram=Pn.prototype.Rd;t("ol.tilegrid.TileGrid",Ui,OPENLAYERS);Ui.prototype.getMaxZoom=Ui.prototype.md;Ui.prototype.getMinZoom=Ui.prototype.pd;Ui.prototype.getOrigin=Ui.prototype.Lb;Ui.prototype.getResolution=Ui.prototype.na;Ui.prototype.getResolutions=Ui.prototype.Qd;Ui.prototype.getTileCoordForCoordAndResolution=Ui.prototype.Wb;
Ui.prototype.getTileCoordForCoordAndZ=Ui.prototype.Nc;Ui.prototype.getTileSize=Ui.prototype.ua;t("ol.tilegrid.WMTS",gz,OPENLAYERS);gz.prototype.getMatrixIds=gz.prototype.g;t("ol.tilegrid.WMTS.createFromCapabilitiesMatrixSet",hz,OPENLAYERS);t("ol.tilegrid.XYZ",Sx,OPENLAYERS);t("ol.tilegrid.Zoomify",kz,OPENLAYERS);t("ol.style.AtlasManager",nz,OPENLAYERS);t("ol.style.Circle",pl,OPENLAYERS);pl.prototype.getAnchor=pl.prototype.wb;pl.prototype.getFill=pl.prototype.Dk;pl.prototype.getImage=pl.prototype.Bb;
pl.prototype.getOrigin=pl.prototype.Cb;pl.prototype.getRadius=pl.prototype.Ek;pl.prototype.getSize=pl.prototype.gb;pl.prototype.getStroke=pl.prototype.Fk;t("ol.style.Fill",nl,OPENLAYERS);nl.prototype.getColor=nl.prototype.b;nl.prototype.setColor=nl.prototype.c;t("ol.style.Icon",vj,OPENLAYERS);vj.prototype.getAnchor=vj.prototype.wb;vj.prototype.getImage=vj.prototype.Bb;vj.prototype.getOrigin=vj.prototype.Cb;vj.prototype.getSrc=vj.prototype.Gk;vj.prototype.getSize=vj.prototype.gb;
t("ol.style.Image",uj,OPENLAYERS);uj.prototype.getOpacity=uj.prototype.Ld;uj.prototype.getRotateWithView=uj.prototype.rd;uj.prototype.getRotation=uj.prototype.Md;uj.prototype.getScale=uj.prototype.Nd;uj.prototype.getSnapToPixel=uj.prototype.sd;uj.prototype.getImage=uj.prototype.Bb;uj.prototype.setRotation=uj.prototype.Od;uj.prototype.setScale=uj.prototype.Pd;t("ol.style.RegularShape",rz,OPENLAYERS);rz.prototype.getAnchor=rz.prototype.wb;rz.prototype.getAngle=rz.prototype.Hk;rz.prototype.getFill=rz.prototype.Ik;
rz.prototype.getImage=rz.prototype.Bb;rz.prototype.getOrigin=rz.prototype.Cb;rz.prototype.getPoints=rz.prototype.Jk;rz.prototype.getRadius=rz.prototype.Kk;rz.prototype.getRadius2=rz.prototype.bi;rz.prototype.getSize=rz.prototype.gb;rz.prototype.getStroke=rz.prototype.Lk;t("ol.style.Stroke",jl,OPENLAYERS);jl.prototype.getColor=jl.prototype.Mk;jl.prototype.getLineCap=jl.prototype.Oh;jl.prototype.getLineDash=jl.prototype.Nk;jl.prototype.getLineJoin=jl.prototype.Ph;jl.prototype.getMiterLimit=jl.prototype.Vh;
jl.prototype.getWidth=jl.prototype.Ok;jl.prototype.setColor=jl.prototype.Pk;jl.prototype.setLineCap=jl.prototype.Yl;jl.prototype.setLineDash=jl.prototype.Qk;jl.prototype.setLineJoin=jl.prototype.Zl;jl.prototype.setMiterLimit=jl.prototype.$l;jl.prototype.setWidth=jl.prototype.gm;t("ol.style.Style",ql,OPENLAYERS);ql.prototype.getGeometry=ql.prototype.R;ql.prototype.getGeometryFunction=ql.prototype.Ih;ql.prototype.getFill=ql.prototype.Rk;ql.prototype.getImage=ql.prototype.Sk;ql.prototype.getStroke=ql.prototype.Tk;
ql.prototype.getText=ql.prototype.Uk;ql.prototype.getZIndex=ql.prototype.ji;ql.prototype.setGeometry=ql.prototype.Wf;ql.prototype.setZIndex=ql.prototype.im;t("ol.style.Text",ds,OPENLAYERS);ds.prototype.getFont=ds.prototype.Gh;ds.prototype.getOffsetX=ds.prototype.Wh;ds.prototype.getOffsetY=ds.prototype.Xh;ds.prototype.getFill=ds.prototype.Vk;ds.prototype.getRotation=ds.prototype.Wk;ds.prototype.getScale=ds.prototype.Xk;ds.prototype.getStroke=ds.prototype.Yk;ds.prototype.getText=ds.prototype.Zk;
ds.prototype.getTextAlign=ds.prototype.di;ds.prototype.getTextBaseline=ds.prototype.ei;ds.prototype.setFont=ds.prototype.Xl;ds.prototype.setFill=ds.prototype.Wl;ds.prototype.setRotation=ds.prototype.$k;ds.prototype.setScale=ds.prototype.al;ds.prototype.setStroke=ds.prototype.cm;ds.prototype.setText=ds.prototype.dm;ds.prototype.setTextAlign=ds.prototype.em;ds.prototype.setTextBaseline=ds.prototype.fm;t("ol.Sphere",ve,OPENLAYERS);ve.prototype.geodesicArea=ve.prototype.d;
ve.prototype.haversineDistance=ve.prototype.a;t("ol.source.BingMaps",Tx,OPENLAYERS);t("ol.source.BingMaps.TOS_ATTRIBUTION",Ux,OPENLAYERS);t("ol.source.Cluster",Vx,OPENLAYERS);Vx.prototype.getSource=Vx.prototype.H;Z.prototype.readFeatures=Z.prototype.a;t("ol.source.GeoJSON",vy,OPENLAYERS);t("ol.source.GPX",wy,OPENLAYERS);t("ol.source.IGC",xy,OPENLAYERS);t("ol.source.ImageCanvas",cn,OPENLAYERS);t("ol.source.ImageMapGuide",yy,OPENLAYERS);yy.prototype.getParams=yy.prototype.Zj;
yy.prototype.getImageLoadFunction=yy.prototype.Yj;yy.prototype.updateParams=yy.prototype.bk;yy.prototype.setImageLoadFunction=yy.prototype.ak;t("ol.source.Image",$m,OPENLAYERS);t("ol.source.ImageStatic",zy,OPENLAYERS);t("ol.source.ImageVector",qn,OPENLAYERS);qn.prototype.getSource=qn.prototype.ck;qn.prototype.getStyle=qn.prototype.dk;qn.prototype.getStyleFunction=qn.prototype.ek;qn.prototype.setStyle=qn.prototype.Of;t("ol.source.ImageWMS",Ay,OPENLAYERS);Ay.prototype.getGetFeatureInfoUrl=Ay.prototype.hk;
Ay.prototype.getParams=Ay.prototype.jk;Ay.prototype.getImageLoadFunction=Ay.prototype.ik;Ay.prototype.getUrl=Ay.prototype.kk;Ay.prototype.setImageLoadFunction=Ay.prototype.lk;Ay.prototype.setUrl=Ay.prototype.mk;Ay.prototype.updateParams=Ay.prototype.nk;t("ol.source.KML",Ey,OPENLAYERS);t("ol.source.MapQuest",Iy,OPENLAYERS);Iy.prototype.getLayer=Iy.prototype.e;t("ol.source.OSM",Gy,OPENLAYERS);t("ol.source.OSM.ATTRIBUTION",Hy,OPENLAYERS);t("ol.source.OSMXML",Ly,OPENLAYERS);
t("ol.source.ServerVector",My,OPENLAYERS);My.prototype.clear=My.prototype.clear;My.prototype.readFeatures=My.prototype.a;t("ol.source.Source",Ji,OPENLAYERS);Ji.prototype.getAttributions=Ji.prototype.Y;Ji.prototype.getLogo=Ji.prototype.X;Ji.prototype.getProjection=Ji.prototype.Z;Ji.prototype.getState=Ji.prototype.$;t("ol.source.Stamen",Py,OPENLAYERS);t("ol.source.StaticVector",$,OPENLAYERS);t("ol.source.TileArcGISRest",Ry,OPENLAYERS);Ry.prototype.getParams=Ry.prototype.ok;Ry.prototype.getUrls=Ry.prototype.pk;
Ry.prototype.setUrl=Ry.prototype.qk;Ry.prototype.setUrls=Ry.prototype.Pf;Ry.prototype.updateParams=Ry.prototype.sk;t("ol.source.TileDebug",Ty,OPENLAYERS);t("ol.source.TileImage",Qx,OPENLAYERS);Qx.prototype.getTileLoadFunction=Qx.prototype.bb;Qx.prototype.getTileUrlFunction=Qx.prototype.cb;Qx.prototype.setTileLoadFunction=Qx.prototype.jb;Qx.prototype.setTileUrlFunction=Qx.prototype.ta;t("ol.source.TileJSON",Uy,OPENLAYERS);t("ol.source.Tile",cj,OPENLAYERS);cj.prototype.getTileGrid=cj.prototype.xa;
fj.prototype.tile=fj.prototype.tile;t("ol.source.TileUTFGrid",Vy,OPENLAYERS);Vy.prototype.getTemplate=Vy.prototype.ci;Vy.prototype.forDataAtCoordinateAndResolution=Vy.prototype.xh;t("ol.source.TileVector",$y,OPENLAYERS);$y.prototype.getFeatures=$y.prototype.Aa;$y.prototype.getFeaturesAtCoordinateAndResolution=$y.prototype.Fh;t("ol.source.TileWMS",bz,OPENLAYERS);bz.prototype.getGetFeatureInfoUrl=bz.prototype.vk;bz.prototype.getParams=bz.prototype.wk;bz.prototype.getUrls=bz.prototype.xk;
bz.prototype.setUrl=bz.prototype.yk;bz.prototype.setUrls=bz.prototype.Qf;bz.prototype.updateParams=bz.prototype.Ak;t("ol.source.TopoJSON",fz,OPENLAYERS);t("ol.source.Vector",kn,OPENLAYERS);kn.prototype.addFeature=kn.prototype.Va;kn.prototype.addFeatures=kn.prototype.Ga;kn.prototype.clear=kn.prototype.clear;kn.prototype.forEachFeature=kn.prototype.$a;kn.prototype.forEachFeatureInExtent=kn.prototype.wa;kn.prototype.forEachFeatureIntersectingExtent=kn.prototype.Ma;kn.prototype.getFeatures=kn.prototype.Aa;
kn.prototype.getFeaturesAtCoordinate=kn.prototype.Oa;kn.prototype.getClosestFeatureToCoordinate=kn.prototype.ab;kn.prototype.getExtent=kn.prototype.J;kn.prototype.getFeatureById=kn.prototype.Na;kn.prototype.removeFeature=kn.prototype.fb;nn.prototype.feature=nn.prototype.feature;t("ol.source.WMTS",iz,OPENLAYERS);iz.prototype.getDimensions=iz.prototype.Dh;iz.prototype.getFormat=iz.prototype.Hh;iz.prototype.getLayer=iz.prototype.Bk;iz.prototype.getMatrixSet=iz.prototype.Th;iz.prototype.getStyle=iz.prototype.Ck;
iz.prototype.getVersion=iz.prototype.gi;iz.prototype.updateDimensions=iz.prototype.pm;
t("ol.source.WMTS.optionsFromCapabilities",function(b,c){var d=Ua(b.Contents.Layer,function(b){return b.Identifier==c.layer}),e,f;e=1<d.TileMatrixSetLink.length?Va(d.TileMatrixSetLink,function(b){return b.TileMatrixSet==c.matrixSet}):m(c.projection)?Va(d.TileMatrixSetLink,function(b){return b.TileMatrixSet.SupportedCRS.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3")==c.projection}):0;0>e&&(e=0);f=d.TileMatrixSetLink[e].TileMatrixSet;var g=d.Format[0];m(c.format)&&(g=c.format);e=Va(d.Style,function(b){return m(c.style)?
b.Title==c.style:b.isDefault});0>e&&(e=0);e=d.Style[e].Identifier;var h={};m(d.Dimension)&&Qa(d.Dimension,function(b){var c=b.Identifier,d=b["default"];m(d)||(d=b.values[0]);h[c]=d});var k=Ua(b.Contents.TileMatrixSet,function(b){return b.Identifier==f}),n=hz(k),k=m(c.projection)?Be(c.projection):Be(k.SupportedCRS.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/,"$1:$3")),p=[],q=c.requestEncoding,q=m(q)?q:"";if(b.OperationsMetadata.hasOwnProperty("GetTile")&&0!=q.lastIndexOf("REST",0)){var d=b.OperationsMetadata.GetTile.DCP.HTTP.Get,
r=Ua(d[0].Constraint,function(b){return"GetEncoding"==b.name}).AllowedValues.Value;0<r.length&&Wa(r,"KVP")&&(q="KVP",p.push(d[0].href))}else q="REST",Qa(d.ResourceURL,function(b){"tile"==b.resourceType&&(g=b.format,p.push(b.template))});return{urls:p,layer:c.layer,matrixSet:f,format:g,projection:k,requestEncoding:q,tileGrid:n,style:e,dimensions:h}},OPENLAYERS);t("ol.source.XYZ",Fy,OPENLAYERS);Fy.prototype.setTileUrlFunction=Fy.prototype.ta;Fy.prototype.setUrl=Fy.prototype.b;
t("ol.source.Zoomify",lz,OPENLAYERS);Yk.prototype.vectorContext=Yk.prototype.vectorContext;Yk.prototype.frameState=Yk.prototype.frameState;Yk.prototype.context=Yk.prototype.context;Yk.prototype.glContext=Yk.prototype.glContext;jo.prototype.drawAsync=jo.prototype.kc;jo.prototype.drawCircleGeometry=jo.prototype.lc;jo.prototype.drawFeature=jo.prototype.oe;jo.prototype.drawGeometryCollectionGeometry=jo.prototype.fd;jo.prototype.drawPointGeometry=jo.prototype.ub;jo.prototype.drawLineStringGeometry=jo.prototype.Eb;
jo.prototype.drawMultiLineStringGeometry=jo.prototype.mc;jo.prototype.drawMultiPointGeometry=jo.prototype.tb;jo.prototype.drawMultiPolygonGeometry=jo.prototype.nc;jo.prototype.drawPolygonGeometry=jo.prototype.Rb;jo.prototype.drawText=jo.prototype.vb;jo.prototype.setFillStrokeStyle=jo.prototype.Ba;jo.prototype.setImageStyle=jo.prototype.ib;jo.prototype.setTextStyle=jo.prototype.Ca;Sl.prototype.drawAsync=Sl.prototype.kc;Sl.prototype.drawCircleGeometry=Sl.prototype.lc;Sl.prototype.drawFeature=Sl.prototype.oe;
Sl.prototype.drawPointGeometry=Sl.prototype.ub;Sl.prototype.drawMultiPointGeometry=Sl.prototype.tb;Sl.prototype.drawLineStringGeometry=Sl.prototype.Eb;Sl.prototype.drawMultiLineStringGeometry=Sl.prototype.mc;Sl.prototype.drawPolygonGeometry=Sl.prototype.Rb;Sl.prototype.drawMultiPolygonGeometry=Sl.prototype.nc;Sl.prototype.setFillStrokeStyle=Sl.prototype.Ba;Sl.prototype.setImageStyle=Sl.prototype.ib;Sl.prototype.setTextStyle=Sl.prototype.Ca;t("ol.proj.common.add",Rl,OPENLAYERS);
t("ol.proj.METERS_PER_UNIT",xe,OPENLAYERS);t("ol.proj.Projection",ye,OPENLAYERS);ye.prototype.getCode=ye.prototype.Bh;ye.prototype.getExtent=ye.prototype.J;ye.prototype.getUnits=ye.prototype.Sj;ye.prototype.getMetersPerUnit=ye.prototype.od;ye.prototype.getWorldExtent=ye.prototype.ii;ye.prototype.isGlobal=ye.prototype.Vi;ye.prototype.setExtent=ye.prototype.Tj;ye.prototype.setWorldExtent=ye.prototype.hm;t("ol.proj.addEquivalentProjections",Ee,OPENLAYERS);t("ol.proj.addProjection",Ne,OPENLAYERS);
t("ol.proj.addCoordinateTransforms",Qe,OPENLAYERS);t("ol.proj.get",Be,OPENLAYERS);t("ol.proj.getTransform",Te,OPENLAYERS);t("ol.proj.transform",function(b,c,d){return Te(c,d)(b,void 0,b.length)},OPENLAYERS);t("ol.proj.transformExtent",Ve,OPENLAYERS);t("ol.layer.Heatmap",Y,OPENLAYERS);Y.prototype.getBlur=Y.prototype.Ea;Y.prototype.getGradient=Y.prototype.Fa;Y.prototype.getRadius=Y.prototype.ic;Y.prototype.setBlur=Y.prototype.wc;Y.prototype.setGradient=Y.prototype.xc;Y.prototype.setRadius=Y.prototype.jc;
t("ol.layer.Image",H,OPENLAYERS);H.prototype.getSource=H.prototype.a;t("ol.layer.Layer",E,OPENLAYERS);E.prototype.getSource=E.prototype.a;E.prototype.setSource=E.prototype.fa;t("ol.layer.Base",C,OPENLAYERS);C.prototype.getBrightness=C.prototype.c;C.prototype.getContrast=C.prototype.f;C.prototype.getHue=C.prototype.e;C.prototype.getExtent=C.prototype.J;C.prototype.getMaxResolution=C.prototype.g;C.prototype.getMinResolution=C.prototype.i;C.prototype.getOpacity=C.prototype.q;
C.prototype.getSaturation=C.prototype.k;C.prototype.getVisible=C.prototype.b;C.prototype.setBrightness=C.prototype.D;C.prototype.setContrast=C.prototype.H;C.prototype.setHue=C.prototype.N;C.prototype.setExtent=C.prototype.o;C.prototype.setMaxResolution=C.prototype.S;C.prototype.setMinResolution=C.prototype.W;C.prototype.setOpacity=C.prototype.p;C.prototype.setSaturation=C.prototype.ca;C.prototype.setVisible=C.prototype.da;t("ol.layer.Group",G,OPENLAYERS);G.prototype.getLayers=G.prototype.ac;
G.prototype.setLayers=G.prototype.r;t("ol.layer.Tile",I,OPENLAYERS);I.prototype.getPreload=I.prototype.r;I.prototype.getSource=I.prototype.a;I.prototype.setPreload=I.prototype.ia;I.prototype.getUseInterimTilesOnError=I.prototype.ea;I.prototype.setUseInterimTilesOnError=I.prototype.ka;t("ol.layer.Vector",J,OPENLAYERS);J.prototype.getSource=J.prototype.a;J.prototype.getStyle=J.prototype.af;J.prototype.getStyleFunction=J.prototype.df;J.prototype.setStyle=J.prototype.ka;
t("ol.interaction.DoubleClickZoom",Qj,OPENLAYERS);t("ol.interaction.DoubleClickZoom.handleEvent",Rj,OPENLAYERS);t("ol.interaction.DragAndDrop",Nw,OPENLAYERS);t("ol.interaction.DragAndDrop.handleEvent",cd,OPENLAYERS);Ow.prototype.features=Ow.prototype.features;Ow.prototype.file=Ow.prototype.file;Ow.prototype.projection=Ow.prototype.projection;bl.prototype.coordinate=bl.prototype.coordinate;t("ol.interaction.DragBox",cl,OPENLAYERS);cl.prototype.getGeometry=cl.prototype.R;
t("ol.interaction.DragPan",ck,OPENLAYERS);t("ol.interaction.DragRotateAndZoom",Rw,OPENLAYERS);t("ol.interaction.DragRotate",gk,OPENLAYERS);t("ol.interaction.DragZoom",vl,OPENLAYERS);Vw.prototype.feature=Vw.prototype.feature;t("ol.interaction.Draw",Ww,OPENLAYERS);t("ol.interaction.Draw.handleEvent",Yw,OPENLAYERS);Ww.prototype.finishDrawing=Ww.prototype.W;t("ol.interaction.Interaction",Mj,OPENLAYERS);Mj.prototype.getActive=Mj.prototype.b;Mj.prototype.setActive=Mj.prototype.c;
t("ol.interaction.defaults",Kl,OPENLAYERS);t("ol.interaction.KeyboardPan",wl,OPENLAYERS);t("ol.interaction.KeyboardPan.handleEvent",xl,OPENLAYERS);t("ol.interaction.KeyboardZoom",yl,OPENLAYERS);t("ol.interaction.KeyboardZoom.handleEvent",zl,OPENLAYERS);t("ol.interaction.Modify",jx,OPENLAYERS);t("ol.interaction.Modify.handleEvent",mx,OPENLAYERS);t("ol.interaction.MouseWheelZoom",Al,OPENLAYERS);t("ol.interaction.MouseWheelZoom.handleEvent",Bl,OPENLAYERS);t("ol.interaction.PinchRotate",Cl,OPENLAYERS);
t("ol.interaction.PinchZoom",Gl,OPENLAYERS);t("ol.interaction.Pointer",Zj,OPENLAYERS);t("ol.interaction.Pointer.handleEvent",ak,OPENLAYERS);sx.prototype.selected=sx.prototype.selected;sx.prototype.deselected=sx.prototype.deselected;t("ol.interaction.Select",tx,OPENLAYERS);tx.prototype.getFeatures=tx.prototype.o;t("ol.interaction.Select.handleEvent",ux,OPENLAYERS);tx.prototype.setMap=tx.prototype.setMap;t("ol.geom.Circle",Em,OPENLAYERS);Em.prototype.clone=Em.prototype.clone;
Em.prototype.getCenter=Em.prototype.Oc;Em.prototype.getRadius=Em.prototype.Hf;Em.prototype.getType=Em.prototype.O;Em.prototype.setCenter=Em.prototype.Mj;Em.prototype.setCenterAndRadius=Em.prototype.rg;Em.prototype.setRadius=Em.prototype.If;Em.prototype.transform=Em.prototype.transform;t("ol.geom.Geometry",kk,OPENLAYERS);kk.prototype.clone=kk.prototype.clone;kk.prototype.getClosestPoint=kk.prototype.f;kk.prototype.getExtent=kk.prototype.J;kk.prototype.getType=kk.prototype.O;
kk.prototype.applyTransform=kk.prototype.qa;kk.prototype.intersectsExtent=kk.prototype.ja;kk.prototype.translate=kk.prototype.Ia;kk.prototype.transform=kk.prototype.transform;t("ol.geom.GeometryCollection",Gm,OPENLAYERS);Gm.prototype.clone=Gm.prototype.clone;Gm.prototype.getGeometries=Gm.prototype.nf;Gm.prototype.getType=Gm.prototype.O;Gm.prototype.intersectsExtent=Gm.prototype.ja;Gm.prototype.setGeometries=Gm.prototype.sg;Gm.prototype.applyTransform=Gm.prototype.qa;Gm.prototype.translate=Gm.prototype.Ia;
t("ol.geom.LinearRing",Gk,OPENLAYERS);Gk.prototype.clone=Gk.prototype.clone;Gk.prototype.getArea=Gk.prototype.Oj;Gk.prototype.getCoordinates=Gk.prototype.Q;Gk.prototype.getType=Gk.prototype.O;Gk.prototype.setCoordinates=Gk.prototype.V;t("ol.geom.LineString",K,OPENLAYERS);K.prototype.appendCoordinate=K.prototype.ih;K.prototype.clone=K.prototype.clone;K.prototype.forEachSegment=K.prototype.yh;K.prototype.getCoordinateAtM=K.prototype.Nj;K.prototype.getCoordinates=K.prototype.Q;
K.prototype.getLength=K.prototype.Jf;K.prototype.getType=K.prototype.O;K.prototype.intersectsExtent=K.prototype.ja;K.prototype.setCoordinates=K.prototype.V;t("ol.geom.MultiLineString",Om,OPENLAYERS);Om.prototype.appendLineString=Om.prototype.jh;Om.prototype.clone=Om.prototype.clone;Om.prototype.getCoordinateAtM=Om.prototype.Pj;Om.prototype.getCoordinates=Om.prototype.Q;Om.prototype.getLineString=Om.prototype.Qh;Om.prototype.getLineStrings=Om.prototype.Lc;Om.prototype.getType=Om.prototype.O;
Om.prototype.intersectsExtent=Om.prototype.ja;Om.prototype.setCoordinates=Om.prototype.V;t("ol.geom.MultiPoint",Rm,OPENLAYERS);Rm.prototype.appendPoint=Rm.prototype.lh;Rm.prototype.clone=Rm.prototype.clone;Rm.prototype.getCoordinates=Rm.prototype.Q;Rm.prototype.getPoint=Rm.prototype.$h;Rm.prototype.getPoints=Rm.prototype.Gd;Rm.prototype.getType=Rm.prototype.O;Rm.prototype.intersectsExtent=Rm.prototype.ja;Rm.prototype.setCoordinates=Rm.prototype.V;t("ol.geom.MultiPolygon",Sm,OPENLAYERS);
Sm.prototype.appendPolygon=Sm.prototype.mh;Sm.prototype.clone=Sm.prototype.clone;Sm.prototype.getArea=Sm.prototype.Qj;Sm.prototype.getCoordinates=Sm.prototype.Q;Sm.prototype.getInteriorPoints=Sm.prototype.Nh;Sm.prototype.getPolygon=Sm.prototype.ai;Sm.prototype.getPolygons=Sm.prototype.qd;Sm.prototype.getType=Sm.prototype.O;Sm.prototype.intersectsExtent=Sm.prototype.ja;Sm.prototype.setCoordinates=Sm.prototype.V;t("ol.geom.Point",Ik,OPENLAYERS);Ik.prototype.clone=Ik.prototype.clone;
Ik.prototype.getCoordinates=Ik.prototype.Q;Ik.prototype.getType=Ik.prototype.O;Ik.prototype.intersectsExtent=Ik.prototype.ja;Ik.prototype.setCoordinates=Ik.prototype.V;t("ol.geom.Polygon",F,OPENLAYERS);F.prototype.appendLinearRing=F.prototype.kh;F.prototype.clone=F.prototype.clone;F.prototype.getArea=F.prototype.Rj;F.prototype.getCoordinates=F.prototype.Q;F.prototype.getInteriorPoint=F.prototype.Mh;F.prototype.getLinearRingCount=F.prototype.Sh;F.prototype.getLinearRing=F.prototype.Rh;
F.prototype.getLinearRings=F.prototype.ld;F.prototype.getType=F.prototype.O;F.prototype.intersectsExtent=F.prototype.ja;F.prototype.setCoordinates=F.prototype.V;t("ol.geom.Polygon.circular",Xk,OPENLAYERS);t("ol.geom.Polygon.fromExtent",function(b){var c=b[0],d=b[1],e=b[2];b=b[3];c=[c,d,c,b,e,b,e,d,c,d];d=new F(null);Uk(d,"XY",c,[c.length]);return d},OPENLAYERS);t("ol.geom.SimpleGeometry",mk,OPENLAYERS);mk.prototype.getFirstCoordinate=mk.prototype.yb;mk.prototype.getLastCoordinate=mk.prototype.zb;
mk.prototype.getLayout=mk.prototype.Ab;mk.prototype.applyTransform=mk.prototype.qa;mk.prototype.translate=mk.prototype.Ia;t("ol.format.Feature",pp,OPENLAYERS);t("ol.format.GeoJSON",zp,OPENLAYERS);zp.prototype.readFeature=zp.prototype.Nb;zp.prototype.readFeatures=zp.prototype.ma;zp.prototype.readGeometry=zp.prototype.Rc;zp.prototype.readProjection=zp.prototype.Ja;zp.prototype.writeFeature=zp.prototype.be;zp.prototype.writeFeatureObject=zp.prototype.a;zp.prototype.writeFeatures=zp.prototype.Qb;
zp.prototype.writeFeaturesObject=zp.prototype.c;zp.prototype.writeGeometry=zp.prototype.Xc;zp.prototype.writeGeometryObject=zp.prototype.f;t("ol.format.GPX",Pq,OPENLAYERS);Pq.prototype.readFeature=Pq.prototype.Nb;Pq.prototype.readFeatures=Pq.prototype.ma;Pq.prototype.readProjection=Pq.prototype.Ja;Pq.prototype.writeFeatures=Pq.prototype.Qb;Pq.prototype.writeFeaturesNode=Pq.prototype.a;t("ol.format.IGC",zr,OPENLAYERS);zr.prototype.readFeature=zr.prototype.Nb;zr.prototype.readFeatures=zr.prototype.ma;
zr.prototype.readProjection=zr.prototype.Ja;t("ol.format.KML",es,OPENLAYERS);es.prototype.readFeature=es.prototype.Nb;es.prototype.readFeatures=es.prototype.ma;es.prototype.readName=es.prototype.El;es.prototype.readNetworkLinks=es.prototype.Fl;es.prototype.readProjection=es.prototype.Ja;es.prototype.writeFeatures=es.prototype.Qb;es.prototype.writeFeaturesNode=es.prototype.a;t("ol.format.OSMXML",Ot,OPENLAYERS);Ot.prototype.readFeatures=Ot.prototype.ma;Ot.prototype.readProjection=Ot.prototype.Ja;
t("ol.format.Polyline",mu,OPENLAYERS);t("ol.format.Polyline.encodeDeltas",nu,OPENLAYERS);t("ol.format.Polyline.decodeDeltas",pu,OPENLAYERS);t("ol.format.Polyline.encodeFloats",ou,OPENLAYERS);t("ol.format.Polyline.decodeFloats",qu,OPENLAYERS);mu.prototype.readFeature=mu.prototype.Nb;mu.prototype.readFeatures=mu.prototype.ma;mu.prototype.readGeometry=mu.prototype.Rc;mu.prototype.readProjection=mu.prototype.Ja;mu.prototype.writeGeometry=mu.prototype.Xc;t("ol.format.TopoJSON",ru,OPENLAYERS);
ru.prototype.readFeatures=ru.prototype.ma;ru.prototype.readProjection=ru.prototype.Ja;t("ol.format.WFS",xu,OPENLAYERS);xu.prototype.readFeatures=xu.prototype.ma;xu.prototype.readTransactionResponse=xu.prototype.g;xu.prototype.readFeatureCollectionMetadata=xu.prototype.e;xu.prototype.writeGetFeature=xu.prototype.n;xu.prototype.writeTransaction=xu.prototype.q;xu.prototype.readProjection=xu.prototype.Ja;t("ol.format.WKT",Ku,OPENLAYERS);Ku.prototype.readFeature=Ku.prototype.Nb;
Ku.prototype.readFeatures=Ku.prototype.ma;Ku.prototype.readGeometry=Ku.prototype.Rc;Ku.prototype.writeFeature=Ku.prototype.be;Ku.prototype.writeFeatures=Ku.prototype.Qb;Ku.prototype.writeGeometry=Ku.prototype.Xc;t("ol.format.WMSCapabilities",bv,OPENLAYERS);bv.prototype.read=bv.prototype.b;t("ol.format.WMSGetFeatureInfo",yv,OPENLAYERS);yv.prototype.readFeatures=yv.prototype.ma;t("ol.format.WMTSCapabilities",Av,OPENLAYERS);Av.prototype.read=Av.prototype.b;t("ol.format.GML2",Oq,OPENLAYERS);
t("ol.format.GML3",Fq,OPENLAYERS);Fq.prototype.writeGeometryNode=Fq.prototype.i;Fq.prototype.writeFeatures=Fq.prototype.Qb;Fq.prototype.writeFeaturesNode=Fq.prototype.a;t("ol.format.GML",Fq,OPENLAYERS);Fq.prototype.writeFeatures=Fq.prototype.Qb;Fq.prototype.writeFeaturesNode=Fq.prototype.a;t("ol.format.GMLBase",tq,OPENLAYERS);tq.prototype.readFeatures=tq.prototype.ma;t("ol.events.condition.altKeyOnly",function(b){b=b.a;return b.d&&!b.g&&!b.c},OPENLAYERS);
t("ol.events.condition.altShiftKeysOnly",Sj,OPENLAYERS);t("ol.events.condition.always",cd,OPENLAYERS);t("ol.events.condition.click",function(b){return b.type==zi},OPENLAYERS);t("ol.events.condition.never",bd,OPENLAYERS);t("ol.events.condition.pointerMove",Tj,OPENLAYERS);t("ol.events.condition.singleClick",Uj,OPENLAYERS);t("ol.events.condition.noModifierKeys",Vj,OPENLAYERS);t("ol.events.condition.platformModifierKeyOnly",function(b){b=b.a;return!b.d&&b.g&&!b.c},OPENLAYERS);
t("ol.events.condition.shiftKeyOnly",Wj,OPENLAYERS);t("ol.events.condition.targetNotEditable",Xj,OPENLAYERS);t("ol.events.condition.mouseOnly",Yj,OPENLAYERS);t("ol.dom.Input",mp,OPENLAYERS);mp.prototype.getChecked=mp.prototype.a;mp.prototype.getValue=mp.prototype.b;mp.prototype.setValue=mp.prototype.f;mp.prototype.setChecked=mp.prototype.c;t("ol.control.Attribution",Ug,OPENLAYERS);t("ol.control.Attribution.render",Vg,OPENLAYERS);Ug.prototype.getCollapsible=Ug.prototype.Dj;
Ug.prototype.setCollapsible=Ug.prototype.Gj;Ug.prototype.setCollapsed=Ug.prototype.Fj;Ug.prototype.getCollapsed=Ug.prototype.Cj;t("ol.control.Control",Tg,OPENLAYERS);Tg.prototype.getMap=Tg.prototype.f;Tg.prototype.setMap=Tg.prototype.setMap;Tg.prototype.setTarget=Tg.prototype.b;t("ol.control.defaults",$g,OPENLAYERS);t("ol.control.FullScreen",eh,OPENLAYERS);t("ol.control.MousePosition",fh,OPENLAYERS);t("ol.control.MousePosition.render",gh,OPENLAYERS);fh.prototype.getCoordinateFormat=fh.prototype.k;
fh.prototype.getProjection=fh.prototype.p;fh.prototype.setMap=fh.prototype.setMap;fh.prototype.setCoordinateFormat=fh.prototype.D;fh.prototype.setProjection=fh.prototype.r;t("ol.control.OverviewMap",Lo,OPENLAYERS);Lo.prototype.setMap=Lo.prototype.setMap;t("ol.control.OverviewMap.render",Mo,OPENLAYERS);Lo.prototype.getCollapsible=Lo.prototype.Ij;Lo.prototype.setCollapsible=Lo.prototype.Lj;Lo.prototype.setCollapsed=Lo.prototype.Kj;Lo.prototype.getCollapsed=Lo.prototype.Hj;t("ol.control.Rotate",Xg,OPENLAYERS);
t("ol.control.Rotate.render",Yg,OPENLAYERS);t("ol.control.ScaleLine",Ro,OPENLAYERS);Ro.prototype.getUnits=Ro.prototype.o;t("ol.control.ScaleLine.render",So,OPENLAYERS);Ro.prototype.setUnits=Ro.prototype.p;t("ol.control.Zoom",Zg,OPENLAYERS);t("ol.control.ZoomSlider",fp,OPENLAYERS);t("ol.control.ZoomSlider.render",hp,OPENLAYERS);t("ol.control.ZoomToExtent",kp,OPENLAYERS);t("ol.color.asArray",pg,OPENLAYERS);t("ol.color.asString",rg,OPENLAYERS);rd.prototype.changed=rd.prototype.l;
rd.prototype.getRevision=rd.prototype.u;rd.prototype.on=rd.prototype.s;rd.prototype.once=rd.prototype.v;rd.prototype.un=rd.prototype.t;rd.prototype.unByKey=rd.prototype.A;kg.prototype.bindTo=kg.prototype.K;kg.prototype.get=kg.prototype.get;kg.prototype.getKeys=kg.prototype.G;kg.prototype.getProperties=kg.prototype.I;kg.prototype.set=kg.prototype.set;kg.prototype.setProperties=kg.prototype.C;kg.prototype.unbind=kg.prototype.L;kg.prototype.unbindAll=kg.prototype.M;kg.prototype.changed=kg.prototype.l;
kg.prototype.getRevision=kg.prototype.u;kg.prototype.on=kg.prototype.s;kg.prototype.once=kg.prototype.v;kg.prototype.un=kg.prototype.t;kg.prototype.unByKey=kg.prototype.A;lp.prototype.bindTo=lp.prototype.K;lp.prototype.get=lp.prototype.get;lp.prototype.getKeys=lp.prototype.G;lp.prototype.getProperties=lp.prototype.I;lp.prototype.set=lp.prototype.set;lp.prototype.setProperties=lp.prototype.C;lp.prototype.unbind=lp.prototype.L;lp.prototype.unbindAll=lp.prototype.M;lp.prototype.changed=lp.prototype.l;
lp.prototype.getRevision=lp.prototype.u;lp.prototype.on=lp.prototype.s;lp.prototype.once=lp.prototype.v;lp.prototype.un=lp.prototype.t;lp.prototype.unByKey=lp.prototype.A;P.prototype.bindTo=P.prototype.K;P.prototype.get=P.prototype.get;P.prototype.getKeys=P.prototype.G;P.prototype.getProperties=P.prototype.I;P.prototype.set=P.prototype.set;P.prototype.setProperties=P.prototype.C;P.prototype.unbind=P.prototype.L;P.prototype.unbindAll=P.prototype.M;P.prototype.changed=P.prototype.l;
P.prototype.getRevision=P.prototype.u;P.prototype.on=P.prototype.s;P.prototype.once=P.prototype.v;P.prototype.un=P.prototype.t;P.prototype.unByKey=P.prototype.A;X.prototype.bindTo=X.prototype.K;X.prototype.get=X.prototype.get;X.prototype.getKeys=X.prototype.G;X.prototype.getProperties=X.prototype.I;X.prototype.set=X.prototype.set;X.prototype.setProperties=X.prototype.C;X.prototype.unbind=X.prototype.L;X.prototype.unbindAll=X.prototype.M;X.prototype.changed=X.prototype.l;X.prototype.getRevision=X.prototype.u;
X.prototype.on=X.prototype.s;X.prototype.once=X.prototype.v;X.prototype.un=X.prototype.t;X.prototype.unByKey=X.prototype.A;Wv.prototype.getTileCoord=Wv.prototype.e;L.prototype.bindTo=L.prototype.K;L.prototype.get=L.prototype.get;L.prototype.getKeys=L.prototype.G;L.prototype.getProperties=L.prototype.I;L.prototype.set=L.prototype.set;L.prototype.setProperties=L.prototype.C;L.prototype.unbind=L.prototype.L;L.prototype.unbindAll=L.prototype.M;L.prototype.changed=L.prototype.l;
L.prototype.getRevision=L.prototype.u;L.prototype.on=L.prototype.s;L.prototype.once=L.prototype.v;L.prototype.un=L.prototype.t;L.prototype.unByKey=L.prototype.A;vi.prototype.map=vi.prototype.map;vi.prototype.frameState=vi.prototype.frameState;wi.prototype.originalEvent=wi.prototype.originalEvent;wi.prototype.pixel=wi.prototype.pixel;wi.prototype.coordinate=wi.prototype.coordinate;wi.prototype.dragging=wi.prototype.dragging;wi.prototype.preventDefault=wi.prototype.preventDefault;
wi.prototype.stopPropagation=wi.prototype.pb;wi.prototype.map=wi.prototype.map;wi.prototype.frameState=wi.prototype.frameState;N.prototype.bindTo=N.prototype.K;N.prototype.get=N.prototype.get;N.prototype.getKeys=N.prototype.G;N.prototype.getProperties=N.prototype.I;N.prototype.set=N.prototype.set;N.prototype.setProperties=N.prototype.C;N.prototype.unbind=N.prototype.L;N.prototype.unbindAll=N.prototype.M;N.prototype.changed=N.prototype.l;N.prototype.getRevision=N.prototype.u;N.prototype.on=N.prototype.s;
N.prototype.once=N.prototype.v;N.prototype.un=N.prototype.t;N.prototype.unByKey=N.prototype.A;B.prototype.bindTo=B.prototype.K;B.prototype.get=B.prototype.get;B.prototype.getKeys=B.prototype.G;B.prototype.getProperties=B.prototype.I;B.prototype.set=B.prototype.set;B.prototype.setProperties=B.prototype.C;B.prototype.unbind=B.prototype.L;B.prototype.unbindAll=B.prototype.M;B.prototype.changed=B.prototype.l;B.prototype.getRevision=B.prototype.u;B.prototype.on=B.prototype.s;B.prototype.once=B.prototype.v;
B.prototype.un=B.prototype.t;B.prototype.unByKey=B.prototype.A;gz.prototype.getMaxZoom=gz.prototype.md;gz.prototype.getMinZoom=gz.prototype.pd;gz.prototype.getOrigin=gz.prototype.Lb;gz.prototype.getResolution=gz.prototype.na;gz.prototype.getResolutions=gz.prototype.Qd;gz.prototype.getTileCoordForCoordAndResolution=gz.prototype.Wb;gz.prototype.getTileCoordForCoordAndZ=gz.prototype.Nc;gz.prototype.getTileSize=gz.prototype.ua;Sx.prototype.getMaxZoom=Sx.prototype.md;Sx.prototype.getMinZoom=Sx.prototype.pd;
Sx.prototype.getOrigin=Sx.prototype.Lb;Sx.prototype.getResolution=Sx.prototype.na;Sx.prototype.getResolutions=Sx.prototype.Qd;Sx.prototype.getTileCoordForCoordAndResolution=Sx.prototype.Wb;Sx.prototype.getTileCoordForCoordAndZ=Sx.prototype.Nc;Sx.prototype.getTileSize=Sx.prototype.ua;kz.prototype.getMaxZoom=kz.prototype.md;kz.prototype.getMinZoom=kz.prototype.pd;kz.prototype.getOrigin=kz.prototype.Lb;kz.prototype.getResolution=kz.prototype.na;kz.prototype.getResolutions=kz.prototype.Qd;
kz.prototype.getTileCoordForCoordAndResolution=kz.prototype.Wb;kz.prototype.getTileCoordForCoordAndZ=kz.prototype.Nc;kz.prototype.getTileSize=kz.prototype.ua;pl.prototype.getOpacity=pl.prototype.Ld;pl.prototype.getRotateWithView=pl.prototype.rd;pl.prototype.getRotation=pl.prototype.Md;pl.prototype.getScale=pl.prototype.Nd;pl.prototype.getSnapToPixel=pl.prototype.sd;pl.prototype.setRotation=pl.prototype.Od;pl.prototype.setScale=pl.prototype.Pd;vj.prototype.getOpacity=vj.prototype.Ld;
vj.prototype.getRotateWithView=vj.prototype.rd;vj.prototype.getRotation=vj.prototype.Md;vj.prototype.getScale=vj.prototype.Nd;vj.prototype.getSnapToPixel=vj.prototype.sd;vj.prototype.setRotation=vj.prototype.Od;vj.prototype.setScale=vj.prototype.Pd;rz.prototype.getOpacity=rz.prototype.Ld;rz.prototype.getRotateWithView=rz.prototype.rd;rz.prototype.getRotation=rz.prototype.Md;rz.prototype.getScale=rz.prototype.Nd;rz.prototype.getSnapToPixel=rz.prototype.sd;rz.prototype.setRotation=rz.prototype.Od;
rz.prototype.setScale=rz.prototype.Pd;Ji.prototype.bindTo=Ji.prototype.K;Ji.prototype.get=Ji.prototype.get;Ji.prototype.getKeys=Ji.prototype.G;Ji.prototype.getProperties=Ji.prototype.I;Ji.prototype.set=Ji.prototype.set;Ji.prototype.setProperties=Ji.prototype.C;Ji.prototype.unbind=Ji.prototype.L;Ji.prototype.unbindAll=Ji.prototype.M;Ji.prototype.changed=Ji.prototype.l;Ji.prototype.getRevision=Ji.prototype.u;Ji.prototype.on=Ji.prototype.s;Ji.prototype.once=Ji.prototype.v;Ji.prototype.un=Ji.prototype.t;
Ji.prototype.unByKey=Ji.prototype.A;cj.prototype.getAttributions=cj.prototype.Y;cj.prototype.getLogo=cj.prototype.X;cj.prototype.getProjection=cj.prototype.Z;cj.prototype.getState=cj.prototype.$;cj.prototype.bindTo=cj.prototype.K;cj.prototype.get=cj.prototype.get;cj.prototype.getKeys=cj.prototype.G;cj.prototype.getProperties=cj.prototype.I;cj.prototype.set=cj.prototype.set;cj.prototype.setProperties=cj.prototype.C;cj.prototype.unbind=cj.prototype.L;cj.prototype.unbindAll=cj.prototype.M;
cj.prototype.changed=cj.prototype.l;cj.prototype.getRevision=cj.prototype.u;cj.prototype.on=cj.prototype.s;cj.prototype.once=cj.prototype.v;cj.prototype.un=cj.prototype.t;cj.prototype.unByKey=cj.prototype.A;Qx.prototype.getTileGrid=Qx.prototype.xa;Qx.prototype.getAttributions=Qx.prototype.Y;Qx.prototype.getLogo=Qx.prototype.X;Qx.prototype.getProjection=Qx.prototype.Z;Qx.prototype.getState=Qx.prototype.$;Qx.prototype.bindTo=Qx.prototype.K;Qx.prototype.get=Qx.prototype.get;Qx.prototype.getKeys=Qx.prototype.G;
Qx.prototype.getProperties=Qx.prototype.I;Qx.prototype.set=Qx.prototype.set;Qx.prototype.setProperties=Qx.prototype.C;Qx.prototype.unbind=Qx.prototype.L;Qx.prototype.unbindAll=Qx.prototype.M;Qx.prototype.changed=Qx.prototype.l;Qx.prototype.getRevision=Qx.prototype.u;Qx.prototype.on=Qx.prototype.s;Qx.prototype.once=Qx.prototype.v;Qx.prototype.un=Qx.prototype.t;Qx.prototype.unByKey=Qx.prototype.A;Tx.prototype.getTileLoadFunction=Tx.prototype.bb;Tx.prototype.getTileUrlFunction=Tx.prototype.cb;
Tx.prototype.setTileLoadFunction=Tx.prototype.jb;Tx.prototype.setTileUrlFunction=Tx.prototype.ta;Tx.prototype.getTileGrid=Tx.prototype.xa;Tx.prototype.getAttributions=Tx.prototype.Y;Tx.prototype.getLogo=Tx.prototype.X;Tx.prototype.getProjection=Tx.prototype.Z;Tx.prototype.getState=Tx.prototype.$;Tx.prototype.bindTo=Tx.prototype.K;Tx.prototype.get=Tx.prototype.get;Tx.prototype.getKeys=Tx.prototype.G;Tx.prototype.getProperties=Tx.prototype.I;Tx.prototype.set=Tx.prototype.set;
Tx.prototype.setProperties=Tx.prototype.C;Tx.prototype.unbind=Tx.prototype.L;Tx.prototype.unbindAll=Tx.prototype.M;Tx.prototype.changed=Tx.prototype.l;Tx.prototype.getRevision=Tx.prototype.u;Tx.prototype.on=Tx.prototype.s;Tx.prototype.once=Tx.prototype.v;Tx.prototype.un=Tx.prototype.t;Tx.prototype.unByKey=Tx.prototype.A;kn.prototype.getAttributions=kn.prototype.Y;kn.prototype.getLogo=kn.prototype.X;kn.prototype.getProjection=kn.prototype.Z;kn.prototype.getState=kn.prototype.$;
kn.prototype.bindTo=kn.prototype.K;kn.prototype.get=kn.prototype.get;kn.prototype.getKeys=kn.prototype.G;kn.prototype.getProperties=kn.prototype.I;kn.prototype.set=kn.prototype.set;kn.prototype.setProperties=kn.prototype.C;kn.prototype.unbind=kn.prototype.L;kn.prototype.unbindAll=kn.prototype.M;kn.prototype.changed=kn.prototype.l;kn.prototype.getRevision=kn.prototype.u;kn.prototype.on=kn.prototype.s;kn.prototype.once=kn.prototype.v;kn.prototype.un=kn.prototype.t;kn.prototype.unByKey=kn.prototype.A;
Vx.prototype.addFeature=Vx.prototype.Va;Vx.prototype.addFeatures=Vx.prototype.Ga;Vx.prototype.clear=Vx.prototype.clear;Vx.prototype.forEachFeature=Vx.prototype.$a;Vx.prototype.forEachFeatureInExtent=Vx.prototype.wa;Vx.prototype.forEachFeatureIntersectingExtent=Vx.prototype.Ma;Vx.prototype.getFeatures=Vx.prototype.Aa;Vx.prototype.getFeaturesAtCoordinate=Vx.prototype.Oa;Vx.prototype.getClosestFeatureToCoordinate=Vx.prototype.ab;Vx.prototype.getExtent=Vx.prototype.J;Vx.prototype.getFeatureById=Vx.prototype.Na;
Vx.prototype.removeFeature=Vx.prototype.fb;Vx.prototype.getAttributions=Vx.prototype.Y;Vx.prototype.getLogo=Vx.prototype.X;Vx.prototype.getProjection=Vx.prototype.Z;Vx.prototype.getState=Vx.prototype.$;Vx.prototype.bindTo=Vx.prototype.K;Vx.prototype.get=Vx.prototype.get;Vx.prototype.getKeys=Vx.prototype.G;Vx.prototype.getProperties=Vx.prototype.I;Vx.prototype.set=Vx.prototype.set;Vx.prototype.setProperties=Vx.prototype.C;Vx.prototype.unbind=Vx.prototype.L;Vx.prototype.unbindAll=Vx.prototype.M;
Vx.prototype.changed=Vx.prototype.l;Vx.prototype.getRevision=Vx.prototype.u;Vx.prototype.on=Vx.prototype.s;Vx.prototype.once=Vx.prototype.v;Vx.prototype.un=Vx.prototype.t;Vx.prototype.unByKey=Vx.prototype.A;Z.prototype.addFeature=Z.prototype.Va;Z.prototype.addFeatures=Z.prototype.Ga;Z.prototype.clear=Z.prototype.clear;Z.prototype.forEachFeature=Z.prototype.$a;Z.prototype.forEachFeatureInExtent=Z.prototype.wa;Z.prototype.forEachFeatureIntersectingExtent=Z.prototype.Ma;Z.prototype.getFeatures=Z.prototype.Aa;
Z.prototype.getFeaturesAtCoordinate=Z.prototype.Oa;Z.prototype.getClosestFeatureToCoordinate=Z.prototype.ab;Z.prototype.getExtent=Z.prototype.J;Z.prototype.getFeatureById=Z.prototype.Na;Z.prototype.removeFeature=Z.prototype.fb;Z.prototype.getAttributions=Z.prototype.Y;Z.prototype.getLogo=Z.prototype.X;Z.prototype.getProjection=Z.prototype.Z;Z.prototype.getState=Z.prototype.$;Z.prototype.bindTo=Z.prototype.K;Z.prototype.get=Z.prototype.get;Z.prototype.getKeys=Z.prototype.G;
Z.prototype.getProperties=Z.prototype.I;Z.prototype.set=Z.prototype.set;Z.prototype.setProperties=Z.prototype.C;Z.prototype.unbind=Z.prototype.L;Z.prototype.unbindAll=Z.prototype.M;Z.prototype.changed=Z.prototype.l;Z.prototype.getRevision=Z.prototype.u;Z.prototype.on=Z.prototype.s;Z.prototype.once=Z.prototype.v;Z.prototype.un=Z.prototype.t;Z.prototype.unByKey=Z.prototype.A;$.prototype.readFeatures=$.prototype.a;$.prototype.addFeature=$.prototype.Va;$.prototype.addFeatures=$.prototype.Ga;
$.prototype.clear=$.prototype.clear;$.prototype.forEachFeature=$.prototype.$a;$.prototype.forEachFeatureInExtent=$.prototype.wa;$.prototype.forEachFeatureIntersectingExtent=$.prototype.Ma;$.prototype.getFeatures=$.prototype.Aa;$.prototype.getFeaturesAtCoordinate=$.prototype.Oa;$.prototype.getClosestFeatureToCoordinate=$.prototype.ab;$.prototype.getExtent=$.prototype.J;$.prototype.getFeatureById=$.prototype.Na;$.prototype.removeFeature=$.prototype.fb;$.prototype.getAttributions=$.prototype.Y;
$.prototype.getLogo=$.prototype.X;$.prototype.getProjection=$.prototype.Z;$.prototype.getState=$.prototype.$;$.prototype.bindTo=$.prototype.K;$.prototype.get=$.prototype.get;$.prototype.getKeys=$.prototype.G;$.prototype.getProperties=$.prototype.I;$.prototype.set=$.prototype.set;$.prototype.setProperties=$.prototype.C;$.prototype.unbind=$.prototype.L;$.prototype.unbindAll=$.prototype.M;$.prototype.changed=$.prototype.l;$.prototype.getRevision=$.prototype.u;$.prototype.on=$.prototype.s;
$.prototype.once=$.prototype.v;$.prototype.un=$.prototype.t;$.prototype.unByKey=$.prototype.A;vy.prototype.readFeatures=vy.prototype.a;vy.prototype.addFeature=vy.prototype.Va;vy.prototype.addFeatures=vy.prototype.Ga;vy.prototype.clear=vy.prototype.clear;vy.prototype.forEachFeature=vy.prototype.$a;vy.prototype.forEachFeatureInExtent=vy.prototype.wa;vy.prototype.forEachFeatureIntersectingExtent=vy.prototype.Ma;vy.prototype.getFeatures=vy.prototype.Aa;vy.prototype.getFeaturesAtCoordinate=vy.prototype.Oa;
vy.prototype.getClosestFeatureToCoordinate=vy.prototype.ab;vy.prototype.getExtent=vy.prototype.J;vy.prototype.getFeatureById=vy.prototype.Na;vy.prototype.removeFeature=vy.prototype.fb;vy.prototype.getAttributions=vy.prototype.Y;vy.prototype.getLogo=vy.prototype.X;vy.prototype.getProjection=vy.prototype.Z;vy.prototype.getState=vy.prototype.$;vy.prototype.bindTo=vy.prototype.K;vy.prototype.get=vy.prototype.get;vy.prototype.getKeys=vy.prototype.G;vy.prototype.getProperties=vy.prototype.I;
vy.prototype.set=vy.prototype.set;vy.prototype.setProperties=vy.prototype.C;vy.prototype.unbind=vy.prototype.L;vy.prototype.unbindAll=vy.prototype.M;vy.prototype.changed=vy.prototype.l;vy.prototype.getRevision=vy.prototype.u;vy.prototype.on=vy.prototype.s;vy.prototype.once=vy.prototype.v;vy.prototype.un=vy.prototype.t;vy.prototype.unByKey=vy.prototype.A;wy.prototype.readFeatures=wy.prototype.a;wy.prototype.addFeature=wy.prototype.Va;wy.prototype.addFeatures=wy.prototype.Ga;wy.prototype.clear=wy.prototype.clear;
wy.prototype.forEachFeature=wy.prototype.$a;wy.prototype.forEachFeatureInExtent=wy.prototype.wa;wy.prototype.forEachFeatureIntersectingExtent=wy.prototype.Ma;wy.prototype.getFeatures=wy.prototype.Aa;wy.prototype.getFeaturesAtCoordinate=wy.prototype.Oa;wy.prototype.getClosestFeatureToCoordinate=wy.prototype.ab;wy.prototype.getExtent=wy.prototype.J;wy.prototype.getFeatureById=wy.prototype.Na;wy.prototype.removeFeature=wy.prototype.fb;wy.prototype.getAttributions=wy.prototype.Y;
wy.prototype.getLogo=wy.prototype.X;wy.prototype.getProjection=wy.prototype.Z;wy.prototype.getState=wy.prototype.$;wy.prototype.bindTo=wy.prototype.K;wy.prototype.get=wy.prototype.get;wy.prototype.getKeys=wy.prototype.G;wy.prototype.getProperties=wy.prototype.I;wy.prototype.set=wy.prototype.set;wy.prototype.setProperties=wy.prototype.C;wy.prototype.unbind=wy.prototype.L;wy.prototype.unbindAll=wy.prototype.M;wy.prototype.changed=wy.prototype.l;wy.prototype.getRevision=wy.prototype.u;
wy.prototype.on=wy.prototype.s;wy.prototype.once=wy.prototype.v;wy.prototype.un=wy.prototype.t;wy.prototype.unByKey=wy.prototype.A;xy.prototype.readFeatures=xy.prototype.a;xy.prototype.addFeature=xy.prototype.Va;xy.prototype.addFeatures=xy.prototype.Ga;xy.prototype.clear=xy.prototype.clear;xy.prototype.forEachFeature=xy.prototype.$a;xy.prototype.forEachFeatureInExtent=xy.prototype.wa;xy.prototype.forEachFeatureIntersectingExtent=xy.prototype.Ma;xy.prototype.getFeatures=xy.prototype.Aa;
xy.prototype.getFeaturesAtCoordinate=xy.prototype.Oa;xy.prototype.getClosestFeatureToCoordinate=xy.prototype.ab;xy.prototype.getExtent=xy.prototype.J;xy.prototype.getFeatureById=xy.prototype.Na;xy.prototype.removeFeature=xy.prototype.fb;xy.prototype.getAttributions=xy.prototype.Y;xy.prototype.getLogo=xy.prototype.X;xy.prototype.getProjection=xy.prototype.Z;xy.prototype.getState=xy.prototype.$;xy.prototype.bindTo=xy.prototype.K;xy.prototype.get=xy.prototype.get;xy.prototype.getKeys=xy.prototype.G;
xy.prototype.getProperties=xy.prototype.I;xy.prototype.set=xy.prototype.set;xy.prototype.setProperties=xy.prototype.C;xy.prototype.unbind=xy.prototype.L;xy.prototype.unbindAll=xy.prototype.M;xy.prototype.changed=xy.prototype.l;xy.prototype.getRevision=xy.prototype.u;xy.prototype.on=xy.prototype.s;xy.prototype.once=xy.prototype.v;xy.prototype.un=xy.prototype.t;xy.prototype.unByKey=xy.prototype.A;$m.prototype.getAttributions=$m.prototype.Y;$m.prototype.getLogo=$m.prototype.X;
$m.prototype.getProjection=$m.prototype.Z;$m.prototype.getState=$m.prototype.$;$m.prototype.bindTo=$m.prototype.K;$m.prototype.get=$m.prototype.get;$m.prototype.getKeys=$m.prototype.G;$m.prototype.getProperties=$m.prototype.I;$m.prototype.set=$m.prototype.set;$m.prototype.setProperties=$m.prototype.C;$m.prototype.unbind=$m.prototype.L;$m.prototype.unbindAll=$m.prototype.M;$m.prototype.changed=$m.prototype.l;$m.prototype.getRevision=$m.prototype.u;$m.prototype.on=$m.prototype.s;$m.prototype.once=$m.prototype.v;
$m.prototype.un=$m.prototype.t;$m.prototype.unByKey=$m.prototype.A;cn.prototype.getAttributions=cn.prototype.Y;cn.prototype.getLogo=cn.prototype.X;cn.prototype.getProjection=cn.prototype.Z;cn.prototype.getState=cn.prototype.$;cn.prototype.bindTo=cn.prototype.K;cn.prototype.get=cn.prototype.get;cn.prototype.getKeys=cn.prototype.G;cn.prototype.getProperties=cn.prototype.I;cn.prototype.set=cn.prototype.set;cn.prototype.setProperties=cn.prototype.C;cn.prototype.unbind=cn.prototype.L;
cn.prototype.unbindAll=cn.prototype.M;cn.prototype.changed=cn.prototype.l;cn.prototype.getRevision=cn.prototype.u;cn.prototype.on=cn.prototype.s;cn.prototype.once=cn.prototype.v;cn.prototype.un=cn.prototype.t;cn.prototype.unByKey=cn.prototype.A;yy.prototype.getAttributions=yy.prototype.Y;yy.prototype.getLogo=yy.prototype.X;yy.prototype.getProjection=yy.prototype.Z;yy.prototype.getState=yy.prototype.$;yy.prototype.bindTo=yy.prototype.K;yy.prototype.get=yy.prototype.get;yy.prototype.getKeys=yy.prototype.G;
yy.prototype.getProperties=yy.prototype.I;yy.prototype.set=yy.prototype.set;yy.prototype.setProperties=yy.prototype.C;yy.prototype.unbind=yy.prototype.L;yy.prototype.unbindAll=yy.prototype.M;yy.prototype.changed=yy.prototype.l;yy.prototype.getRevision=yy.prototype.u;yy.prototype.on=yy.prototype.s;yy.prototype.once=yy.prototype.v;yy.prototype.un=yy.prototype.t;yy.prototype.unByKey=yy.prototype.A;zy.prototype.getAttributions=zy.prototype.Y;zy.prototype.getLogo=zy.prototype.X;
zy.prototype.getProjection=zy.prototype.Z;zy.prototype.getState=zy.prototype.$;zy.prototype.bindTo=zy.prototype.K;zy.prototype.get=zy.prototype.get;zy.prototype.getKeys=zy.prototype.G;zy.prototype.getProperties=zy.prototype.I;zy.prototype.set=zy.prototype.set;zy.prototype.setProperties=zy.prototype.C;zy.prototype.unbind=zy.prototype.L;zy.prototype.unbindAll=zy.prototype.M;zy.prototype.changed=zy.prototype.l;zy.prototype.getRevision=zy.prototype.u;zy.prototype.on=zy.prototype.s;zy.prototype.once=zy.prototype.v;
zy.prototype.un=zy.prototype.t;zy.prototype.unByKey=zy.prototype.A;qn.prototype.getAttributions=qn.prototype.Y;qn.prototype.getLogo=qn.prototype.X;qn.prototype.getProjection=qn.prototype.Z;qn.prototype.getState=qn.prototype.$;qn.prototype.bindTo=qn.prototype.K;qn.prototype.get=qn.prototype.get;qn.prototype.getKeys=qn.prototype.G;qn.prototype.getProperties=qn.prototype.I;qn.prototype.set=qn.prototype.set;qn.prototype.setProperties=qn.prototype.C;qn.prototype.unbind=qn.prototype.L;
qn.prototype.unbindAll=qn.prototype.M;qn.prototype.changed=qn.prototype.l;qn.prototype.getRevision=qn.prototype.u;qn.prototype.on=qn.prototype.s;qn.prototype.once=qn.prototype.v;qn.prototype.un=qn.prototype.t;qn.prototype.unByKey=qn.prototype.A;Ay.prototype.getAttributions=Ay.prototype.Y;Ay.prototype.getLogo=Ay.prototype.X;Ay.prototype.getProjection=Ay.prototype.Z;Ay.prototype.getState=Ay.prototype.$;Ay.prototype.bindTo=Ay.prototype.K;Ay.prototype.get=Ay.prototype.get;Ay.prototype.getKeys=Ay.prototype.G;
Ay.prototype.getProperties=Ay.prototype.I;Ay.prototype.set=Ay.prototype.set;Ay.prototype.setProperties=Ay.prototype.C;Ay.prototype.unbind=Ay.prototype.L;Ay.prototype.unbindAll=Ay.prototype.M;Ay.prototype.changed=Ay.prototype.l;Ay.prototype.getRevision=Ay.prototype.u;Ay.prototype.on=Ay.prototype.s;Ay.prototype.once=Ay.prototype.v;Ay.prototype.un=Ay.prototype.t;Ay.prototype.unByKey=Ay.prototype.A;Ey.prototype.readFeatures=Ey.prototype.a;Ey.prototype.addFeature=Ey.prototype.Va;
Ey.prototype.addFeatures=Ey.prototype.Ga;Ey.prototype.clear=Ey.prototype.clear;Ey.prototype.forEachFeature=Ey.prototype.$a;Ey.prototype.forEachFeatureInExtent=Ey.prototype.wa;Ey.prototype.forEachFeatureIntersectingExtent=Ey.prototype.Ma;Ey.prototype.getFeatures=Ey.prototype.Aa;Ey.prototype.getFeaturesAtCoordinate=Ey.prototype.Oa;Ey.prototype.getClosestFeatureToCoordinate=Ey.prototype.ab;Ey.prototype.getExtent=Ey.prototype.J;Ey.prototype.getFeatureById=Ey.prototype.Na;Ey.prototype.removeFeature=Ey.prototype.fb;
Ey.prototype.getAttributions=Ey.prototype.Y;Ey.prototype.getLogo=Ey.prototype.X;Ey.prototype.getProjection=Ey.prototype.Z;Ey.prototype.getState=Ey.prototype.$;Ey.prototype.bindTo=Ey.prototype.K;Ey.prototype.get=Ey.prototype.get;Ey.prototype.getKeys=Ey.prototype.G;Ey.prototype.getProperties=Ey.prototype.I;Ey.prototype.set=Ey.prototype.set;Ey.prototype.setProperties=Ey.prototype.C;Ey.prototype.unbind=Ey.prototype.L;Ey.prototype.unbindAll=Ey.prototype.M;Ey.prototype.changed=Ey.prototype.l;
Ey.prototype.getRevision=Ey.prototype.u;Ey.prototype.on=Ey.prototype.s;Ey.prototype.once=Ey.prototype.v;Ey.prototype.un=Ey.prototype.t;Ey.prototype.unByKey=Ey.prototype.A;Fy.prototype.getTileLoadFunction=Fy.prototype.bb;Fy.prototype.getTileUrlFunction=Fy.prototype.cb;Fy.prototype.setTileLoadFunction=Fy.prototype.jb;Fy.prototype.getTileGrid=Fy.prototype.xa;Fy.prototype.getAttributions=Fy.prototype.Y;Fy.prototype.getLogo=Fy.prototype.X;Fy.prototype.getProjection=Fy.prototype.Z;
Fy.prototype.getState=Fy.prototype.$;Fy.prototype.bindTo=Fy.prototype.K;Fy.prototype.get=Fy.prototype.get;Fy.prototype.getKeys=Fy.prototype.G;Fy.prototype.getProperties=Fy.prototype.I;Fy.prototype.set=Fy.prototype.set;Fy.prototype.setProperties=Fy.prototype.C;Fy.prototype.unbind=Fy.prototype.L;Fy.prototype.unbindAll=Fy.prototype.M;Fy.prototype.changed=Fy.prototype.l;Fy.prototype.getRevision=Fy.prototype.u;Fy.prototype.on=Fy.prototype.s;Fy.prototype.once=Fy.prototype.v;Fy.prototype.un=Fy.prototype.t;
Fy.prototype.unByKey=Fy.prototype.A;Iy.prototype.setTileUrlFunction=Iy.prototype.ta;Iy.prototype.setUrl=Iy.prototype.b;Iy.prototype.getTileLoadFunction=Iy.prototype.bb;Iy.prototype.getTileUrlFunction=Iy.prototype.cb;Iy.prototype.setTileLoadFunction=Iy.prototype.jb;Iy.prototype.getTileGrid=Iy.prototype.xa;Iy.prototype.getAttributions=Iy.prototype.Y;Iy.prototype.getLogo=Iy.prototype.X;Iy.prototype.getProjection=Iy.prototype.Z;Iy.prototype.getState=Iy.prototype.$;Iy.prototype.bindTo=Iy.prototype.K;
Iy.prototype.get=Iy.prototype.get;Iy.prototype.getKeys=Iy.prototype.G;Iy.prototype.getProperties=Iy.prototype.I;Iy.prototype.set=Iy.prototype.set;Iy.prototype.setProperties=Iy.prototype.C;Iy.prototype.unbind=Iy.prototype.L;Iy.prototype.unbindAll=Iy.prototype.M;Iy.prototype.changed=Iy.prototype.l;Iy.prototype.getRevision=Iy.prototype.u;Iy.prototype.on=Iy.prototype.s;Iy.prototype.once=Iy.prototype.v;Iy.prototype.un=Iy.prototype.t;Iy.prototype.unByKey=Iy.prototype.A;Gy.prototype.setTileUrlFunction=Gy.prototype.ta;
Gy.prototype.setUrl=Gy.prototype.b;Gy.prototype.getTileLoadFunction=Gy.prototype.bb;Gy.prototype.getTileUrlFunction=Gy.prototype.cb;Gy.prototype.setTileLoadFunction=Gy.prototype.jb;Gy.prototype.getTileGrid=Gy.prototype.xa;Gy.prototype.getAttributions=Gy.prototype.Y;Gy.prototype.getLogo=Gy.prototype.X;Gy.prototype.getProjection=Gy.prototype.Z;Gy.prototype.getState=Gy.prototype.$;Gy.prototype.bindTo=Gy.prototype.K;Gy.prototype.get=Gy.prototype.get;Gy.prototype.getKeys=Gy.prototype.G;
Gy.prototype.getProperties=Gy.prototype.I;Gy.prototype.set=Gy.prototype.set;Gy.prototype.setProperties=Gy.prototype.C;Gy.prototype.unbind=Gy.prototype.L;Gy.prototype.unbindAll=Gy.prototype.M;Gy.prototype.changed=Gy.prototype.l;Gy.prototype.getRevision=Gy.prototype.u;Gy.prototype.on=Gy.prototype.s;Gy.prototype.once=Gy.prototype.v;Gy.prototype.un=Gy.prototype.t;Gy.prototype.unByKey=Gy.prototype.A;Ly.prototype.readFeatures=Ly.prototype.a;Ly.prototype.addFeature=Ly.prototype.Va;
Ly.prototype.addFeatures=Ly.prototype.Ga;Ly.prototype.clear=Ly.prototype.clear;Ly.prototype.forEachFeature=Ly.prototype.$a;Ly.prototype.forEachFeatureInExtent=Ly.prototype.wa;Ly.prototype.forEachFeatureIntersectingExtent=Ly.prototype.Ma;Ly.prototype.getFeatures=Ly.prototype.Aa;Ly.prototype.getFeaturesAtCoordinate=Ly.prototype.Oa;Ly.prototype.getClosestFeatureToCoordinate=Ly.prototype.ab;Ly.prototype.getExtent=Ly.prototype.J;Ly.prototype.getFeatureById=Ly.prototype.Na;Ly.prototype.removeFeature=Ly.prototype.fb;
Ly.prototype.getAttributions=Ly.prototype.Y;Ly.prototype.getLogo=Ly.prototype.X;Ly.prototype.getProjection=Ly.prototype.Z;Ly.prototype.getState=Ly.prototype.$;Ly.prototype.bindTo=Ly.prototype.K;Ly.prototype.get=Ly.prototype.get;Ly.prototype.getKeys=Ly.prototype.G;Ly.prototype.getProperties=Ly.prototype.I;Ly.prototype.set=Ly.prototype.set;Ly.prototype.setProperties=Ly.prototype.C;Ly.prototype.unbind=Ly.prototype.L;Ly.prototype.unbindAll=Ly.prototype.M;Ly.prototype.changed=Ly.prototype.l;
Ly.prototype.getRevision=Ly.prototype.u;Ly.prototype.on=Ly.prototype.s;Ly.prototype.once=Ly.prototype.v;Ly.prototype.un=Ly.prototype.t;Ly.prototype.unByKey=Ly.prototype.A;My.prototype.addFeature=My.prototype.Va;My.prototype.addFeatures=My.prototype.Ga;My.prototype.forEachFeature=My.prototype.$a;My.prototype.forEachFeatureInExtent=My.prototype.wa;My.prototype.forEachFeatureIntersectingExtent=My.prototype.Ma;My.prototype.getFeatures=My.prototype.Aa;My.prototype.getFeaturesAtCoordinate=My.prototype.Oa;
My.prototype.getClosestFeatureToCoordinate=My.prototype.ab;My.prototype.getExtent=My.prototype.J;My.prototype.getFeatureById=My.prototype.Na;My.prototype.removeFeature=My.prototype.fb;My.prototype.getAttributions=My.prototype.Y;My.prototype.getLogo=My.prototype.X;My.prototype.getProjection=My.prototype.Z;My.prototype.getState=My.prototype.$;My.prototype.bindTo=My.prototype.K;My.prototype.get=My.prototype.get;My.prototype.getKeys=My.prototype.G;My.prototype.getProperties=My.prototype.I;
My.prototype.set=My.prototype.set;My.prototype.setProperties=My.prototype.C;My.prototype.unbind=My.prototype.L;My.prototype.unbindAll=My.prototype.M;My.prototype.changed=My.prototype.l;My.prototype.getRevision=My.prototype.u;My.prototype.on=My.prototype.s;My.prototype.once=My.prototype.v;My.prototype.un=My.prototype.t;My.prototype.unByKey=My.prototype.A;Py.prototype.setTileUrlFunction=Py.prototype.ta;Py.prototype.setUrl=Py.prototype.b;Py.prototype.getTileLoadFunction=Py.prototype.bb;
Py.prototype.getTileUrlFunction=Py.prototype.cb;Py.prototype.setTileLoadFunction=Py.prototype.jb;Py.prototype.getTileGrid=Py.prototype.xa;Py.prototype.getAttributions=Py.prototype.Y;Py.prototype.getLogo=Py.prototype.X;Py.prototype.getProjection=Py.prototype.Z;Py.prototype.getState=Py.prototype.$;Py.prototype.bindTo=Py.prototype.K;Py.prototype.get=Py.prototype.get;Py.prototype.getKeys=Py.prototype.G;Py.prototype.getProperties=Py.prototype.I;Py.prototype.set=Py.prototype.set;
Py.prototype.setProperties=Py.prototype.C;Py.prototype.unbind=Py.prototype.L;Py.prototype.unbindAll=Py.prototype.M;Py.prototype.changed=Py.prototype.l;Py.prototype.getRevision=Py.prototype.u;Py.prototype.on=Py.prototype.s;Py.prototype.once=Py.prototype.v;Py.prototype.un=Py.prototype.t;Py.prototype.unByKey=Py.prototype.A;Ry.prototype.getTileLoadFunction=Ry.prototype.bb;Ry.prototype.getTileUrlFunction=Ry.prototype.cb;Ry.prototype.setTileLoadFunction=Ry.prototype.jb;Ry.prototype.setTileUrlFunction=Ry.prototype.ta;
Ry.prototype.getTileGrid=Ry.prototype.xa;Ry.prototype.getAttributions=Ry.prototype.Y;Ry.prototype.getLogo=Ry.prototype.X;Ry.prototype.getProjection=Ry.prototype.Z;Ry.prototype.getState=Ry.prototype.$;Ry.prototype.bindTo=Ry.prototype.K;Ry.prototype.get=Ry.prototype.get;Ry.prototype.getKeys=Ry.prototype.G;Ry.prototype.getProperties=Ry.prototype.I;Ry.prototype.set=Ry.prototype.set;Ry.prototype.setProperties=Ry.prototype.C;Ry.prototype.unbind=Ry.prototype.L;Ry.prototype.unbindAll=Ry.prototype.M;
Ry.prototype.changed=Ry.prototype.l;Ry.prototype.getRevision=Ry.prototype.u;Ry.prototype.on=Ry.prototype.s;Ry.prototype.once=Ry.prototype.v;Ry.prototype.un=Ry.prototype.t;Ry.prototype.unByKey=Ry.prototype.A;Ty.prototype.getTileGrid=Ty.prototype.xa;Ty.prototype.getAttributions=Ty.prototype.Y;Ty.prototype.getLogo=Ty.prototype.X;Ty.prototype.getProjection=Ty.prototype.Z;Ty.prototype.getState=Ty.prototype.$;Ty.prototype.bindTo=Ty.prototype.K;Ty.prototype.get=Ty.prototype.get;Ty.prototype.getKeys=Ty.prototype.G;
Ty.prototype.getProperties=Ty.prototype.I;Ty.prototype.set=Ty.prototype.set;Ty.prototype.setProperties=Ty.prototype.C;Ty.prototype.unbind=Ty.prototype.L;Ty.prototype.unbindAll=Ty.prototype.M;Ty.prototype.changed=Ty.prototype.l;Ty.prototype.getRevision=Ty.prototype.u;Ty.prototype.on=Ty.prototype.s;Ty.prototype.once=Ty.prototype.v;Ty.prototype.un=Ty.prototype.t;Ty.prototype.unByKey=Ty.prototype.A;Uy.prototype.getTileLoadFunction=Uy.prototype.bb;Uy.prototype.getTileUrlFunction=Uy.prototype.cb;
Uy.prototype.setTileLoadFunction=Uy.prototype.jb;Uy.prototype.setTileUrlFunction=Uy.prototype.ta;Uy.prototype.getTileGrid=Uy.prototype.xa;Uy.prototype.getAttributions=Uy.prototype.Y;Uy.prototype.getLogo=Uy.prototype.X;Uy.prototype.getProjection=Uy.prototype.Z;Uy.prototype.getState=Uy.prototype.$;Uy.prototype.bindTo=Uy.prototype.K;Uy.prototype.get=Uy.prototype.get;Uy.prototype.getKeys=Uy.prototype.G;Uy.prototype.getProperties=Uy.prototype.I;Uy.prototype.set=Uy.prototype.set;
Uy.prototype.setProperties=Uy.prototype.C;Uy.prototype.unbind=Uy.prototype.L;Uy.prototype.unbindAll=Uy.prototype.M;Uy.prototype.changed=Uy.prototype.l;Uy.prototype.getRevision=Uy.prototype.u;Uy.prototype.on=Uy.prototype.s;Uy.prototype.once=Uy.prototype.v;Uy.prototype.un=Uy.prototype.t;Uy.prototype.unByKey=Uy.prototype.A;Vy.prototype.getTileGrid=Vy.prototype.xa;Vy.prototype.getAttributions=Vy.prototype.Y;Vy.prototype.getLogo=Vy.prototype.X;Vy.prototype.getProjection=Vy.prototype.Z;
Vy.prototype.getState=Vy.prototype.$;Vy.prototype.bindTo=Vy.prototype.K;Vy.prototype.get=Vy.prototype.get;Vy.prototype.getKeys=Vy.prototype.G;Vy.prototype.getProperties=Vy.prototype.I;Vy.prototype.set=Vy.prototype.set;Vy.prototype.setProperties=Vy.prototype.C;Vy.prototype.unbind=Vy.prototype.L;Vy.prototype.unbindAll=Vy.prototype.M;Vy.prototype.changed=Vy.prototype.l;Vy.prototype.getRevision=Vy.prototype.u;Vy.prototype.on=Vy.prototype.s;Vy.prototype.once=Vy.prototype.v;Vy.prototype.un=Vy.prototype.t;
Vy.prototype.unByKey=Vy.prototype.A;$y.prototype.readFeatures=$y.prototype.a;$y.prototype.forEachFeatureIntersectingExtent=$y.prototype.Ma;$y.prototype.getFeaturesAtCoordinate=$y.prototype.Oa;$y.prototype.getFeatureById=$y.prototype.Na;$y.prototype.getAttributions=$y.prototype.Y;$y.prototype.getLogo=$y.prototype.X;$y.prototype.getProjection=$y.prototype.Z;$y.prototype.getState=$y.prototype.$;$y.prototype.bindTo=$y.prototype.K;$y.prototype.get=$y.prototype.get;$y.prototype.getKeys=$y.prototype.G;
$y.prototype.getProperties=$y.prototype.I;$y.prototype.set=$y.prototype.set;$y.prototype.setProperties=$y.prototype.C;$y.prototype.unbind=$y.prototype.L;$y.prototype.unbindAll=$y.prototype.M;$y.prototype.changed=$y.prototype.l;$y.prototype.getRevision=$y.prototype.u;$y.prototype.on=$y.prototype.s;$y.prototype.once=$y.prototype.v;$y.prototype.un=$y.prototype.t;$y.prototype.unByKey=$y.prototype.A;bz.prototype.getTileLoadFunction=bz.prototype.bb;bz.prototype.getTileUrlFunction=bz.prototype.cb;
bz.prototype.setTileLoadFunction=bz.prototype.jb;bz.prototype.setTileUrlFunction=bz.prototype.ta;bz.prototype.getTileGrid=bz.prototype.xa;bz.prototype.getAttributions=bz.prototype.Y;bz.prototype.getLogo=bz.prototype.X;bz.prototype.getProjection=bz.prototype.Z;bz.prototype.getState=bz.prototype.$;bz.prototype.bindTo=bz.prototype.K;bz.prototype.get=bz.prototype.get;bz.prototype.getKeys=bz.prototype.G;bz.prototype.getProperties=bz.prototype.I;bz.prototype.set=bz.prototype.set;
bz.prototype.setProperties=bz.prototype.C;bz.prototype.unbind=bz.prototype.L;bz.prototype.unbindAll=bz.prototype.M;bz.prototype.changed=bz.prototype.l;bz.prototype.getRevision=bz.prototype.u;bz.prototype.on=bz.prototype.s;bz.prototype.once=bz.prototype.v;bz.prototype.un=bz.prototype.t;bz.prototype.unByKey=bz.prototype.A;fz.prototype.readFeatures=fz.prototype.a;fz.prototype.addFeature=fz.prototype.Va;fz.prototype.addFeatures=fz.prototype.Ga;fz.prototype.clear=fz.prototype.clear;
fz.prototype.forEachFeature=fz.prototype.$a;fz.prototype.forEachFeatureInExtent=fz.prototype.wa;fz.prototype.forEachFeatureIntersectingExtent=fz.prototype.Ma;fz.prototype.getFeatures=fz.prototype.Aa;fz.prototype.getFeaturesAtCoordinate=fz.prototype.Oa;fz.prototype.getClosestFeatureToCoordinate=fz.prototype.ab;fz.prototype.getExtent=fz.prototype.J;fz.prototype.getFeatureById=fz.prototype.Na;fz.prototype.removeFeature=fz.prototype.fb;fz.prototype.getAttributions=fz.prototype.Y;
fz.prototype.getLogo=fz.prototype.X;fz.prototype.getProjection=fz.prototype.Z;fz.prototype.getState=fz.prototype.$;fz.prototype.bindTo=fz.prototype.K;fz.prototype.get=fz.prototype.get;fz.prototype.getKeys=fz.prototype.G;fz.prototype.getProperties=fz.prototype.I;fz.prototype.set=fz.prototype.set;fz.prototype.setProperties=fz.prototype.C;fz.prototype.unbind=fz.prototype.L;fz.prototype.unbindAll=fz.prototype.M;fz.prototype.changed=fz.prototype.l;fz.prototype.getRevision=fz.prototype.u;
fz.prototype.on=fz.prototype.s;fz.prototype.once=fz.prototype.v;fz.prototype.un=fz.prototype.t;fz.prototype.unByKey=fz.prototype.A;iz.prototype.getTileLoadFunction=iz.prototype.bb;iz.prototype.getTileUrlFunction=iz.prototype.cb;iz.prototype.setTileLoadFunction=iz.prototype.jb;iz.prototype.setTileUrlFunction=iz.prototype.ta;iz.prototype.getTileGrid=iz.prototype.xa;iz.prototype.getAttributions=iz.prototype.Y;iz.prototype.getLogo=iz.prototype.X;iz.prototype.getProjection=iz.prototype.Z;
iz.prototype.getState=iz.prototype.$;iz.prototype.bindTo=iz.prototype.K;iz.prototype.get=iz.prototype.get;iz.prototype.getKeys=iz.prototype.G;iz.prototype.getProperties=iz.prototype.I;iz.prototype.set=iz.prototype.set;iz.prototype.setProperties=iz.prototype.C;iz.prototype.unbind=iz.prototype.L;iz.prototype.unbindAll=iz.prototype.M;iz.prototype.changed=iz.prototype.l;iz.prototype.getRevision=iz.prototype.u;iz.prototype.on=iz.prototype.s;iz.prototype.once=iz.prototype.v;iz.prototype.un=iz.prototype.t;
iz.prototype.unByKey=iz.prototype.A;lz.prototype.getTileLoadFunction=lz.prototype.bb;lz.prototype.getTileUrlFunction=lz.prototype.cb;lz.prototype.setTileLoadFunction=lz.prototype.jb;lz.prototype.setTileUrlFunction=lz.prototype.ta;lz.prototype.getTileGrid=lz.prototype.xa;lz.prototype.getAttributions=lz.prototype.Y;lz.prototype.getLogo=lz.prototype.X;lz.prototype.getProjection=lz.prototype.Z;lz.prototype.getState=lz.prototype.$;lz.prototype.bindTo=lz.prototype.K;lz.prototype.get=lz.prototype.get;
lz.prototype.getKeys=lz.prototype.G;lz.prototype.getProperties=lz.prototype.I;lz.prototype.set=lz.prototype.set;lz.prototype.setProperties=lz.prototype.C;lz.prototype.unbind=lz.prototype.L;lz.prototype.unbindAll=lz.prototype.M;lz.prototype.changed=lz.prototype.l;lz.prototype.getRevision=lz.prototype.u;lz.prototype.on=lz.prototype.s;lz.prototype.once=lz.prototype.v;lz.prototype.un=lz.prototype.t;lz.prototype.unByKey=lz.prototype.A;jj.prototype.changed=jj.prototype.l;jj.prototype.getRevision=jj.prototype.u;
jj.prototype.on=jj.prototype.s;jj.prototype.once=jj.prototype.v;jj.prototype.un=jj.prototype.t;jj.prototype.unByKey=jj.prototype.A;ro.prototype.changed=ro.prototype.l;ro.prototype.getRevision=ro.prototype.u;ro.prototype.on=ro.prototype.s;ro.prototype.once=ro.prototype.v;ro.prototype.un=ro.prototype.t;ro.prototype.unByKey=ro.prototype.A;uo.prototype.changed=uo.prototype.l;uo.prototype.getRevision=uo.prototype.u;uo.prototype.on=uo.prototype.s;uo.prototype.once=uo.prototype.v;uo.prototype.un=uo.prototype.t;
uo.prototype.unByKey=uo.prototype.A;Ao.prototype.changed=Ao.prototype.l;Ao.prototype.getRevision=Ao.prototype.u;Ao.prototype.on=Ao.prototype.s;Ao.prototype.once=Ao.prototype.v;Ao.prototype.un=Ao.prototype.t;Ao.prototype.unByKey=Ao.prototype.A;Co.prototype.changed=Co.prototype.l;Co.prototype.getRevision=Co.prototype.u;Co.prototype.on=Co.prototype.s;Co.prototype.once=Co.prototype.v;Co.prototype.un=Co.prototype.t;Co.prototype.unByKey=Co.prototype.A;xn.prototype.changed=xn.prototype.l;
xn.prototype.getRevision=xn.prototype.u;xn.prototype.on=xn.prototype.s;xn.prototype.once=xn.prototype.v;xn.prototype.un=xn.prototype.t;xn.prototype.unByKey=xn.prototype.A;yn.prototype.changed=yn.prototype.l;yn.prototype.getRevision=yn.prototype.u;yn.prototype.on=yn.prototype.s;yn.prototype.once=yn.prototype.v;yn.prototype.un=yn.prototype.t;yn.prototype.unByKey=yn.prototype.A;zn.prototype.changed=zn.prototype.l;zn.prototype.getRevision=zn.prototype.u;zn.prototype.on=zn.prototype.s;
zn.prototype.once=zn.prototype.v;zn.prototype.un=zn.prototype.t;zn.prototype.unByKey=zn.prototype.A;Bn.prototype.changed=Bn.prototype.l;Bn.prototype.getRevision=Bn.prototype.u;Bn.prototype.on=Bn.prototype.s;Bn.prototype.once=Bn.prototype.v;Bn.prototype.un=Bn.prototype.t;Bn.prototype.unByKey=Bn.prototype.A;zm.prototype.changed=zm.prototype.l;zm.prototype.getRevision=zm.prototype.u;zm.prototype.on=zm.prototype.s;zm.prototype.once=zm.prototype.v;zm.prototype.un=zm.prototype.t;zm.prototype.unByKey=zm.prototype.A;
sn.prototype.changed=sn.prototype.l;sn.prototype.getRevision=sn.prototype.u;sn.prototype.on=sn.prototype.s;sn.prototype.once=sn.prototype.v;sn.prototype.un=sn.prototype.t;sn.prototype.unByKey=sn.prototype.A;tn.prototype.changed=tn.prototype.l;tn.prototype.getRevision=tn.prototype.u;tn.prototype.on=tn.prototype.s;tn.prototype.once=tn.prototype.v;tn.prototype.un=tn.prototype.t;tn.prototype.unByKey=tn.prototype.A;un.prototype.changed=un.prototype.l;un.prototype.getRevision=un.prototype.u;
un.prototype.on=un.prototype.s;un.prototype.once=un.prototype.v;un.prototype.un=un.prototype.t;un.prototype.unByKey=un.prototype.A;C.prototype.bindTo=C.prototype.K;C.prototype.get=C.prototype.get;C.prototype.getKeys=C.prototype.G;C.prototype.getProperties=C.prototype.I;C.prototype.set=C.prototype.set;C.prototype.setProperties=C.prototype.C;C.prototype.unbind=C.prototype.L;C.prototype.unbindAll=C.prototype.M;C.prototype.changed=C.prototype.l;C.prototype.getRevision=C.prototype.u;C.prototype.on=C.prototype.s;
C.prototype.once=C.prototype.v;C.prototype.un=C.prototype.t;C.prototype.unByKey=C.prototype.A;E.prototype.getBrightness=E.prototype.c;E.prototype.getContrast=E.prototype.f;E.prototype.getHue=E.prototype.e;E.prototype.getExtent=E.prototype.J;E.prototype.getMaxResolution=E.prototype.g;E.prototype.getMinResolution=E.prototype.i;E.prototype.getOpacity=E.prototype.q;E.prototype.getSaturation=E.prototype.k;E.prototype.getVisible=E.prototype.b;E.prototype.setBrightness=E.prototype.D;
E.prototype.setContrast=E.prototype.H;E.prototype.setHue=E.prototype.N;E.prototype.setExtent=E.prototype.o;E.prototype.setMaxResolution=E.prototype.S;E.prototype.setMinResolution=E.prototype.W;E.prototype.setOpacity=E.prototype.p;E.prototype.setSaturation=E.prototype.ca;E.prototype.setVisible=E.prototype.da;E.prototype.bindTo=E.prototype.K;E.prototype.get=E.prototype.get;E.prototype.getKeys=E.prototype.G;E.prototype.getProperties=E.prototype.I;E.prototype.set=E.prototype.set;
E.prototype.setProperties=E.prototype.C;E.prototype.unbind=E.prototype.L;E.prototype.unbindAll=E.prototype.M;E.prototype.changed=E.prototype.l;E.prototype.getRevision=E.prototype.u;E.prototype.on=E.prototype.s;E.prototype.once=E.prototype.v;E.prototype.un=E.prototype.t;E.prototype.unByKey=E.prototype.A;J.prototype.setSource=J.prototype.fa;J.prototype.getBrightness=J.prototype.c;J.prototype.getContrast=J.prototype.f;J.prototype.getHue=J.prototype.e;J.prototype.getExtent=J.prototype.J;
J.prototype.getMaxResolution=J.prototype.g;J.prototype.getMinResolution=J.prototype.i;J.prototype.getOpacity=J.prototype.q;J.prototype.getSaturation=J.prototype.k;J.prototype.getVisible=J.prototype.b;J.prototype.setBrightness=J.prototype.D;J.prototype.setContrast=J.prototype.H;J.prototype.setHue=J.prototype.N;J.prototype.setExtent=J.prototype.o;J.prototype.setMaxResolution=J.prototype.S;J.prototype.setMinResolution=J.prototype.W;J.prototype.setOpacity=J.prototype.p;J.prototype.setSaturation=J.prototype.ca;
J.prototype.setVisible=J.prototype.da;J.prototype.bindTo=J.prototype.K;J.prototype.get=J.prototype.get;J.prototype.getKeys=J.prototype.G;J.prototype.getProperties=J.prototype.I;J.prototype.set=J.prototype.set;J.prototype.setProperties=J.prototype.C;J.prototype.unbind=J.prototype.L;J.prototype.unbindAll=J.prototype.M;J.prototype.changed=J.prototype.l;J.prototype.getRevision=J.prototype.u;J.prototype.on=J.prototype.s;J.prototype.once=J.prototype.v;J.prototype.un=J.prototype.t;J.prototype.unByKey=J.prototype.A;
Y.prototype.getSource=Y.prototype.a;Y.prototype.getStyle=Y.prototype.af;Y.prototype.getStyleFunction=Y.prototype.df;Y.prototype.setStyle=Y.prototype.ka;Y.prototype.setSource=Y.prototype.fa;Y.prototype.getBrightness=Y.prototype.c;Y.prototype.getContrast=Y.prototype.f;Y.prototype.getHue=Y.prototype.e;Y.prototype.getExtent=Y.prototype.J;Y.prototype.getMaxResolution=Y.prototype.g;Y.prototype.getMinResolution=Y.prototype.i;Y.prototype.getOpacity=Y.prototype.q;Y.prototype.getSaturation=Y.prototype.k;
Y.prototype.getVisible=Y.prototype.b;Y.prototype.setBrightness=Y.prototype.D;Y.prototype.setContrast=Y.prototype.H;Y.prototype.setHue=Y.prototype.N;Y.prototype.setExtent=Y.prototype.o;Y.prototype.setMaxResolution=Y.prototype.S;Y.prototype.setMinResolution=Y.prototype.W;Y.prototype.setOpacity=Y.prototype.p;Y.prototype.setSaturation=Y.prototype.ca;Y.prototype.setVisible=Y.prototype.da;Y.prototype.bindTo=Y.prototype.K;Y.prototype.get=Y.prototype.get;Y.prototype.getKeys=Y.prototype.G;
Y.prototype.getProperties=Y.prototype.I;Y.prototype.set=Y.prototype.set;Y.prototype.setProperties=Y.prototype.C;Y.prototype.unbind=Y.prototype.L;Y.prototype.unbindAll=Y.prototype.M;Y.prototype.changed=Y.prototype.l;Y.prototype.getRevision=Y.prototype.u;Y.prototype.on=Y.prototype.s;Y.prototype.once=Y.prototype.v;Y.prototype.un=Y.prototype.t;Y.prototype.unByKey=Y.prototype.A;H.prototype.setSource=H.prototype.fa;H.prototype.getBrightness=H.prototype.c;H.prototype.getContrast=H.prototype.f;
H.prototype.getHue=H.prototype.e;H.prototype.getExtent=H.prototype.J;H.prototype.getMaxResolution=H.prototype.g;H.prototype.getMinResolution=H.prototype.i;H.prototype.getOpacity=H.prototype.q;H.prototype.getSaturation=H.prototype.k;H.prototype.getVisible=H.prototype.b;H.prototype.setBrightness=H.prototype.D;H.prototype.setContrast=H.prototype.H;H.prototype.setHue=H.prototype.N;H.prototype.setExtent=H.prototype.o;H.prototype.setMaxResolution=H.prototype.S;H.prototype.setMinResolution=H.prototype.W;
H.prototype.setOpacity=H.prototype.p;H.prototype.setSaturation=H.prototype.ca;H.prototype.setVisible=H.prototype.da;H.prototype.bindTo=H.prototype.K;H.prototype.get=H.prototype.get;H.prototype.getKeys=H.prototype.G;H.prototype.getProperties=H.prototype.I;H.prototype.set=H.prototype.set;H.prototype.setProperties=H.prototype.C;H.prototype.unbind=H.prototype.L;H.prototype.unbindAll=H.prototype.M;H.prototype.changed=H.prototype.l;H.prototype.getRevision=H.prototype.u;H.prototype.on=H.prototype.s;
H.prototype.once=H.prototype.v;H.prototype.un=H.prototype.t;H.prototype.unByKey=H.prototype.A;G.prototype.getBrightness=G.prototype.c;G.prototype.getContrast=G.prototype.f;G.prototype.getHue=G.prototype.e;G.prototype.getExtent=G.prototype.J;G.prototype.getMaxResolution=G.prototype.g;G.prototype.getMinResolution=G.prototype.i;G.prototype.getOpacity=G.prototype.q;G.prototype.getSaturation=G.prototype.k;G.prototype.getVisible=G.prototype.b;G.prototype.setBrightness=G.prototype.D;
G.prototype.setContrast=G.prototype.H;G.prototype.setHue=G.prototype.N;G.prototype.setExtent=G.prototype.o;G.prototype.setMaxResolution=G.prototype.S;G.prototype.setMinResolution=G.prototype.W;G.prototype.setOpacity=G.prototype.p;G.prototype.setSaturation=G.prototype.ca;G.prototype.setVisible=G.prototype.da;G.prototype.bindTo=G.prototype.K;G.prototype.get=G.prototype.get;G.prototype.getKeys=G.prototype.G;G.prototype.getProperties=G.prototype.I;G.prototype.set=G.prototype.set;
G.prototype.setProperties=G.prototype.C;G.prototype.unbind=G.prototype.L;G.prototype.unbindAll=G.prototype.M;G.prototype.changed=G.prototype.l;G.prototype.getRevision=G.prototype.u;G.prototype.on=G.prototype.s;G.prototype.once=G.prototype.v;G.prototype.un=G.prototype.t;G.prototype.unByKey=G.prototype.A;I.prototype.setSource=I.prototype.fa;I.prototype.getBrightness=I.prototype.c;I.prototype.getContrast=I.prototype.f;I.prototype.getHue=I.prototype.e;I.prototype.getExtent=I.prototype.J;
I.prototype.getMaxResolution=I.prototype.g;I.prototype.getMinResolution=I.prototype.i;I.prototype.getOpacity=I.prototype.q;I.prototype.getSaturation=I.prototype.k;I.prototype.getVisible=I.prototype.b;I.prototype.setBrightness=I.prototype.D;I.prototype.setContrast=I.prototype.H;I.prototype.setHue=I.prototype.N;I.prototype.setExtent=I.prototype.o;I.prototype.setMaxResolution=I.prototype.S;I.prototype.setMinResolution=I.prototype.W;I.prototype.setOpacity=I.prototype.p;I.prototype.setSaturation=I.prototype.ca;
I.prototype.setVisible=I.prototype.da;I.prototype.bindTo=I.prototype.K;I.prototype.get=I.prototype.get;I.prototype.getKeys=I.prototype.G;I.prototype.getProperties=I.prototype.I;I.prototype.set=I.prototype.set;I.prototype.setProperties=I.prototype.C;I.prototype.unbind=I.prototype.L;I.prototype.unbindAll=I.prototype.M;I.prototype.changed=I.prototype.l;I.prototype.getRevision=I.prototype.u;I.prototype.on=I.prototype.s;I.prototype.once=I.prototype.v;I.prototype.un=I.prototype.t;I.prototype.unByKey=I.prototype.A;
Mj.prototype.bindTo=Mj.prototype.K;Mj.prototype.get=Mj.prototype.get;Mj.prototype.getKeys=Mj.prototype.G;Mj.prototype.getProperties=Mj.prototype.I;Mj.prototype.set=Mj.prototype.set;Mj.prototype.setProperties=Mj.prototype.C;Mj.prototype.unbind=Mj.prototype.L;Mj.prototype.unbindAll=Mj.prototype.M;Mj.prototype.changed=Mj.prototype.l;Mj.prototype.getRevision=Mj.prototype.u;Mj.prototype.on=Mj.prototype.s;Mj.prototype.once=Mj.prototype.v;Mj.prototype.un=Mj.prototype.t;Mj.prototype.unByKey=Mj.prototype.A;
Qj.prototype.getActive=Qj.prototype.b;Qj.prototype.setActive=Qj.prototype.c;Qj.prototype.bindTo=Qj.prototype.K;Qj.prototype.get=Qj.prototype.get;Qj.prototype.getKeys=Qj.prototype.G;Qj.prototype.getProperties=Qj.prototype.I;Qj.prototype.set=Qj.prototype.set;Qj.prototype.setProperties=Qj.prototype.C;Qj.prototype.unbind=Qj.prototype.L;Qj.prototype.unbindAll=Qj.prototype.M;Qj.prototype.changed=Qj.prototype.l;Qj.prototype.getRevision=Qj.prototype.u;Qj.prototype.on=Qj.prototype.s;Qj.prototype.once=Qj.prototype.v;
Qj.prototype.un=Qj.prototype.t;Qj.prototype.unByKey=Qj.prototype.A;Nw.prototype.getActive=Nw.prototype.b;Nw.prototype.setActive=Nw.prototype.c;Nw.prototype.bindTo=Nw.prototype.K;Nw.prototype.get=Nw.prototype.get;Nw.prototype.getKeys=Nw.prototype.G;Nw.prototype.getProperties=Nw.prototype.I;Nw.prototype.set=Nw.prototype.set;Nw.prototype.setProperties=Nw.prototype.C;Nw.prototype.unbind=Nw.prototype.L;Nw.prototype.unbindAll=Nw.prototype.M;Nw.prototype.changed=Nw.prototype.l;Nw.prototype.getRevision=Nw.prototype.u;
Nw.prototype.on=Nw.prototype.s;Nw.prototype.once=Nw.prototype.v;Nw.prototype.un=Nw.prototype.t;Nw.prototype.unByKey=Nw.prototype.A;Zj.prototype.getActive=Zj.prototype.b;Zj.prototype.setActive=Zj.prototype.c;Zj.prototype.bindTo=Zj.prototype.K;Zj.prototype.get=Zj.prototype.get;Zj.prototype.getKeys=Zj.prototype.G;Zj.prototype.getProperties=Zj.prototype.I;Zj.prototype.set=Zj.prototype.set;Zj.prototype.setProperties=Zj.prototype.C;Zj.prototype.unbind=Zj.prototype.L;Zj.prototype.unbindAll=Zj.prototype.M;
Zj.prototype.changed=Zj.prototype.l;Zj.prototype.getRevision=Zj.prototype.u;Zj.prototype.on=Zj.prototype.s;Zj.prototype.once=Zj.prototype.v;Zj.prototype.un=Zj.prototype.t;Zj.prototype.unByKey=Zj.prototype.A;cl.prototype.getActive=cl.prototype.b;cl.prototype.setActive=cl.prototype.c;cl.prototype.bindTo=cl.prototype.K;cl.prototype.get=cl.prototype.get;cl.prototype.getKeys=cl.prototype.G;cl.prototype.getProperties=cl.prototype.I;cl.prototype.set=cl.prototype.set;cl.prototype.setProperties=cl.prototype.C;
cl.prototype.unbind=cl.prototype.L;cl.prototype.unbindAll=cl.prototype.M;cl.prototype.changed=cl.prototype.l;cl.prototype.getRevision=cl.prototype.u;cl.prototype.on=cl.prototype.s;cl.prototype.once=cl.prototype.v;cl.prototype.un=cl.prototype.t;cl.prototype.unByKey=cl.prototype.A;ck.prototype.getActive=ck.prototype.b;ck.prototype.setActive=ck.prototype.c;ck.prototype.bindTo=ck.prototype.K;ck.prototype.get=ck.prototype.get;ck.prototype.getKeys=ck.prototype.G;ck.prototype.getProperties=ck.prototype.I;
ck.prototype.set=ck.prototype.set;ck.prototype.setProperties=ck.prototype.C;ck.prototype.unbind=ck.prototype.L;ck.prototype.unbindAll=ck.prototype.M;ck.prototype.changed=ck.prototype.l;ck.prototype.getRevision=ck.prototype.u;ck.prototype.on=ck.prototype.s;ck.prototype.once=ck.prototype.v;ck.prototype.un=ck.prototype.t;ck.prototype.unByKey=ck.prototype.A;Rw.prototype.getActive=Rw.prototype.b;Rw.prototype.setActive=Rw.prototype.c;Rw.prototype.bindTo=Rw.prototype.K;Rw.prototype.get=Rw.prototype.get;
Rw.prototype.getKeys=Rw.prototype.G;Rw.prototype.getProperties=Rw.prototype.I;Rw.prototype.set=Rw.prototype.set;Rw.prototype.setProperties=Rw.prototype.C;Rw.prototype.unbind=Rw.prototype.L;Rw.prototype.unbindAll=Rw.prototype.M;Rw.prototype.changed=Rw.prototype.l;Rw.prototype.getRevision=Rw.prototype.u;Rw.prototype.on=Rw.prototype.s;Rw.prototype.once=Rw.prototype.v;Rw.prototype.un=Rw.prototype.t;Rw.prototype.unByKey=Rw.prototype.A;gk.prototype.getActive=gk.prototype.b;gk.prototype.setActive=gk.prototype.c;
gk.prototype.bindTo=gk.prototype.K;gk.prototype.get=gk.prototype.get;gk.prototype.getKeys=gk.prototype.G;gk.prototype.getProperties=gk.prototype.I;gk.prototype.set=gk.prototype.set;gk.prototype.setProperties=gk.prototype.C;gk.prototype.unbind=gk.prototype.L;gk.prototype.unbindAll=gk.prototype.M;gk.prototype.changed=gk.prototype.l;gk.prototype.getRevision=gk.prototype.u;gk.prototype.on=gk.prototype.s;gk.prototype.once=gk.prototype.v;gk.prototype.un=gk.prototype.t;gk.prototype.unByKey=gk.prototype.A;
vl.prototype.getGeometry=vl.prototype.R;vl.prototype.getActive=vl.prototype.b;vl.prototype.setActive=vl.prototype.c;vl.prototype.bindTo=vl.prototype.K;vl.prototype.get=vl.prototype.get;vl.prototype.getKeys=vl.prototype.G;vl.prototype.getProperties=vl.prototype.I;vl.prototype.set=vl.prototype.set;vl.prototype.setProperties=vl.prototype.C;vl.prototype.unbind=vl.prototype.L;vl.prototype.unbindAll=vl.prototype.M;vl.prototype.changed=vl.prototype.l;vl.prototype.getRevision=vl.prototype.u;
vl.prototype.on=vl.prototype.s;vl.prototype.once=vl.prototype.v;vl.prototype.un=vl.prototype.t;vl.prototype.unByKey=vl.prototype.A;Ww.prototype.getActive=Ww.prototype.b;Ww.prototype.setActive=Ww.prototype.c;Ww.prototype.bindTo=Ww.prototype.K;Ww.prototype.get=Ww.prototype.get;Ww.prototype.getKeys=Ww.prototype.G;Ww.prototype.getProperties=Ww.prototype.I;Ww.prototype.set=Ww.prototype.set;Ww.prototype.setProperties=Ww.prototype.C;Ww.prototype.unbind=Ww.prototype.L;Ww.prototype.unbindAll=Ww.prototype.M;
Ww.prototype.changed=Ww.prototype.l;Ww.prototype.getRevision=Ww.prototype.u;Ww.prototype.on=Ww.prototype.s;Ww.prototype.once=Ww.prototype.v;Ww.prototype.un=Ww.prototype.t;Ww.prototype.unByKey=Ww.prototype.A;wl.prototype.getActive=wl.prototype.b;wl.prototype.setActive=wl.prototype.c;wl.prototype.bindTo=wl.prototype.K;wl.prototype.get=wl.prototype.get;wl.prototype.getKeys=wl.prototype.G;wl.prototype.getProperties=wl.prototype.I;wl.prototype.set=wl.prototype.set;wl.prototype.setProperties=wl.prototype.C;
wl.prototype.unbind=wl.prototype.L;wl.prototype.unbindAll=wl.prototype.M;wl.prototype.changed=wl.prototype.l;wl.prototype.getRevision=wl.prototype.u;wl.prototype.on=wl.prototype.s;wl.prototype.once=wl.prototype.v;wl.prototype.un=wl.prototype.t;wl.prototype.unByKey=wl.prototype.A;yl.prototype.getActive=yl.prototype.b;yl.prototype.setActive=yl.prototype.c;yl.prototype.bindTo=yl.prototype.K;yl.prototype.get=yl.prototype.get;yl.prototype.getKeys=yl.prototype.G;yl.prototype.getProperties=yl.prototype.I;
yl.prototype.set=yl.prototype.set;yl.prototype.setProperties=yl.prototype.C;yl.prototype.unbind=yl.prototype.L;yl.prototype.unbindAll=yl.prototype.M;yl.prototype.changed=yl.prototype.l;yl.prototype.getRevision=yl.prototype.u;yl.prototype.on=yl.prototype.s;yl.prototype.once=yl.prototype.v;yl.prototype.un=yl.prototype.t;yl.prototype.unByKey=yl.prototype.A;jx.prototype.getActive=jx.prototype.b;jx.prototype.setActive=jx.prototype.c;jx.prototype.bindTo=jx.prototype.K;jx.prototype.get=jx.prototype.get;
jx.prototype.getKeys=jx.prototype.G;jx.prototype.getProperties=jx.prototype.I;jx.prototype.set=jx.prototype.set;jx.prototype.setProperties=jx.prototype.C;jx.prototype.unbind=jx.prototype.L;jx.prototype.unbindAll=jx.prototype.M;jx.prototype.changed=jx.prototype.l;jx.prototype.getRevision=jx.prototype.u;jx.prototype.on=jx.prototype.s;jx.prototype.once=jx.prototype.v;jx.prototype.un=jx.prototype.t;jx.prototype.unByKey=jx.prototype.A;Al.prototype.getActive=Al.prototype.b;Al.prototype.setActive=Al.prototype.c;
Al.prototype.bindTo=Al.prototype.K;Al.prototype.get=Al.prototype.get;Al.prototype.getKeys=Al.prototype.G;Al.prototype.getProperties=Al.prototype.I;Al.prototype.set=Al.prototype.set;Al.prototype.setProperties=Al.prototype.C;Al.prototype.unbind=Al.prototype.L;Al.prototype.unbindAll=Al.prototype.M;Al.prototype.changed=Al.prototype.l;Al.prototype.getRevision=Al.prototype.u;Al.prototype.on=Al.prototype.s;Al.prototype.once=Al.prototype.v;Al.prototype.un=Al.prototype.t;Al.prototype.unByKey=Al.prototype.A;
Cl.prototype.getActive=Cl.prototype.b;Cl.prototype.setActive=Cl.prototype.c;Cl.prototype.bindTo=Cl.prototype.K;Cl.prototype.get=Cl.prototype.get;Cl.prototype.getKeys=Cl.prototype.G;Cl.prototype.getProperties=Cl.prototype.I;Cl.prototype.set=Cl.prototype.set;Cl.prototype.setProperties=Cl.prototype.C;Cl.prototype.unbind=Cl.prototype.L;Cl.prototype.unbindAll=Cl.prototype.M;Cl.prototype.changed=Cl.prototype.l;Cl.prototype.getRevision=Cl.prototype.u;Cl.prototype.on=Cl.prototype.s;Cl.prototype.once=Cl.prototype.v;
Cl.prototype.un=Cl.prototype.t;Cl.prototype.unByKey=Cl.prototype.A;Gl.prototype.getActive=Gl.prototype.b;Gl.prototype.setActive=Gl.prototype.c;Gl.prototype.bindTo=Gl.prototype.K;Gl.prototype.get=Gl.prototype.get;Gl.prototype.getKeys=Gl.prototype.G;Gl.prototype.getProperties=Gl.prototype.I;Gl.prototype.set=Gl.prototype.set;Gl.prototype.setProperties=Gl.prototype.C;Gl.prototype.unbind=Gl.prototype.L;Gl.prototype.unbindAll=Gl.prototype.M;Gl.prototype.changed=Gl.prototype.l;Gl.prototype.getRevision=Gl.prototype.u;
Gl.prototype.on=Gl.prototype.s;Gl.prototype.once=Gl.prototype.v;Gl.prototype.un=Gl.prototype.t;Gl.prototype.unByKey=Gl.prototype.A;tx.prototype.getActive=tx.prototype.b;tx.prototype.setActive=tx.prototype.c;tx.prototype.bindTo=tx.prototype.K;tx.prototype.get=tx.prototype.get;tx.prototype.getKeys=tx.prototype.G;tx.prototype.getProperties=tx.prototype.I;tx.prototype.set=tx.prototype.set;tx.prototype.setProperties=tx.prototype.C;tx.prototype.unbind=tx.prototype.L;tx.prototype.unbindAll=tx.prototype.M;
tx.prototype.changed=tx.prototype.l;tx.prototype.getRevision=tx.prototype.u;tx.prototype.on=tx.prototype.s;tx.prototype.once=tx.prototype.v;tx.prototype.un=tx.prototype.t;tx.prototype.unByKey=tx.prototype.A;kk.prototype.changed=kk.prototype.l;kk.prototype.getRevision=kk.prototype.u;kk.prototype.on=kk.prototype.s;kk.prototype.once=kk.prototype.v;kk.prototype.un=kk.prototype.t;kk.prototype.unByKey=kk.prototype.A;mk.prototype.clone=mk.prototype.clone;mk.prototype.getClosestPoint=mk.prototype.f;
mk.prototype.getExtent=mk.prototype.J;mk.prototype.getType=mk.prototype.O;mk.prototype.intersectsExtent=mk.prototype.ja;mk.prototype.transform=mk.prototype.transform;mk.prototype.changed=mk.prototype.l;mk.prototype.getRevision=mk.prototype.u;mk.prototype.on=mk.prototype.s;mk.prototype.once=mk.prototype.v;mk.prototype.un=mk.prototype.t;mk.prototype.unByKey=mk.prototype.A;Em.prototype.getFirstCoordinate=Em.prototype.yb;Em.prototype.getLastCoordinate=Em.prototype.zb;Em.prototype.getLayout=Em.prototype.Ab;
Em.prototype.applyTransform=Em.prototype.qa;Em.prototype.translate=Em.prototype.Ia;Em.prototype.getClosestPoint=Em.prototype.f;Em.prototype.getExtent=Em.prototype.J;Em.prototype.intersectsExtent=Em.prototype.ja;Em.prototype.changed=Em.prototype.l;Em.prototype.getRevision=Em.prototype.u;Em.prototype.on=Em.prototype.s;Em.prototype.once=Em.prototype.v;Em.prototype.un=Em.prototype.t;Em.prototype.unByKey=Em.prototype.A;Gm.prototype.getClosestPoint=Gm.prototype.f;Gm.prototype.getExtent=Gm.prototype.J;
Gm.prototype.transform=Gm.prototype.transform;Gm.prototype.changed=Gm.prototype.l;Gm.prototype.getRevision=Gm.prototype.u;Gm.prototype.on=Gm.prototype.s;Gm.prototype.once=Gm.prototype.v;Gm.prototype.un=Gm.prototype.t;Gm.prototype.unByKey=Gm.prototype.A;Gk.prototype.getFirstCoordinate=Gk.prototype.yb;Gk.prototype.getLastCoordinate=Gk.prototype.zb;Gk.prototype.getLayout=Gk.prototype.Ab;Gk.prototype.applyTransform=Gk.prototype.qa;Gk.prototype.translate=Gk.prototype.Ia;Gk.prototype.getClosestPoint=Gk.prototype.f;
Gk.prototype.getExtent=Gk.prototype.J;Gk.prototype.intersectsExtent=Gk.prototype.ja;Gk.prototype.transform=Gk.prototype.transform;Gk.prototype.changed=Gk.prototype.l;Gk.prototype.getRevision=Gk.prototype.u;Gk.prototype.on=Gk.prototype.s;Gk.prototype.once=Gk.prototype.v;Gk.prototype.un=Gk.prototype.t;Gk.prototype.unByKey=Gk.prototype.A;K.prototype.getFirstCoordinate=K.prototype.yb;K.prototype.getLastCoordinate=K.prototype.zb;K.prototype.getLayout=K.prototype.Ab;K.prototype.applyTransform=K.prototype.qa;
K.prototype.translate=K.prototype.Ia;K.prototype.getClosestPoint=K.prototype.f;K.prototype.getExtent=K.prototype.J;K.prototype.transform=K.prototype.transform;K.prototype.changed=K.prototype.l;K.prototype.getRevision=K.prototype.u;K.prototype.on=K.prototype.s;K.prototype.once=K.prototype.v;K.prototype.un=K.prototype.t;K.prototype.unByKey=K.prototype.A;Om.prototype.getFirstCoordinate=Om.prototype.yb;Om.prototype.getLastCoordinate=Om.prototype.zb;Om.prototype.getLayout=Om.prototype.Ab;
Om.prototype.applyTransform=Om.prototype.qa;Om.prototype.translate=Om.prototype.Ia;Om.prototype.getClosestPoint=Om.prototype.f;Om.prototype.getExtent=Om.prototype.J;Om.prototype.transform=Om.prototype.transform;Om.prototype.changed=Om.prototype.l;Om.prototype.getRevision=Om.prototype.u;Om.prototype.on=Om.prototype.s;Om.prototype.once=Om.prototype.v;Om.prototype.un=Om.prototype.t;Om.prototype.unByKey=Om.prototype.A;Rm.prototype.getFirstCoordinate=Rm.prototype.yb;Rm.prototype.getLastCoordinate=Rm.prototype.zb;
Rm.prototype.getLayout=Rm.prototype.Ab;Rm.prototype.applyTransform=Rm.prototype.qa;Rm.prototype.translate=Rm.prototype.Ia;Rm.prototype.getClosestPoint=Rm.prototype.f;Rm.prototype.getExtent=Rm.prototype.J;Rm.prototype.transform=Rm.prototype.transform;Rm.prototype.changed=Rm.prototype.l;Rm.prototype.getRevision=Rm.prototype.u;Rm.prototype.on=Rm.prototype.s;Rm.prototype.once=Rm.prototype.v;Rm.prototype.un=Rm.prototype.t;Rm.prototype.unByKey=Rm.prototype.A;Sm.prototype.getFirstCoordinate=Sm.prototype.yb;
Sm.prototype.getLastCoordinate=Sm.prototype.zb;Sm.prototype.getLayout=Sm.prototype.Ab;Sm.prototype.applyTransform=Sm.prototype.qa;Sm.prototype.translate=Sm.prototype.Ia;Sm.prototype.getClosestPoint=Sm.prototype.f;Sm.prototype.getExtent=Sm.prototype.J;Sm.prototype.transform=Sm.prototype.transform;Sm.prototype.changed=Sm.prototype.l;Sm.prototype.getRevision=Sm.prototype.u;Sm.prototype.on=Sm.prototype.s;Sm.prototype.once=Sm.prototype.v;Sm.prototype.un=Sm.prototype.t;Sm.prototype.unByKey=Sm.prototype.A;
Ik.prototype.getFirstCoordinate=Ik.prototype.yb;Ik.prototype.getLastCoordinate=Ik.prototype.zb;Ik.prototype.getLayout=Ik.prototype.Ab;Ik.prototype.applyTransform=Ik.prototype.qa;Ik.prototype.translate=Ik.prototype.Ia;Ik.prototype.getClosestPoint=Ik.prototype.f;Ik.prototype.getExtent=Ik.prototype.J;Ik.prototype.transform=Ik.prototype.transform;Ik.prototype.changed=Ik.prototype.l;Ik.prototype.getRevision=Ik.prototype.u;Ik.prototype.on=Ik.prototype.s;Ik.prototype.once=Ik.prototype.v;
Ik.prototype.un=Ik.prototype.t;Ik.prototype.unByKey=Ik.prototype.A;F.prototype.getFirstCoordinate=F.prototype.yb;F.prototype.getLastCoordinate=F.prototype.zb;F.prototype.getLayout=F.prototype.Ab;F.prototype.applyTransform=F.prototype.qa;F.prototype.translate=F.prototype.Ia;F.prototype.getClosestPoint=F.prototype.f;F.prototype.getExtent=F.prototype.J;F.prototype.transform=F.prototype.transform;F.prototype.changed=F.prototype.l;F.prototype.getRevision=F.prototype.u;F.prototype.on=F.prototype.s;
F.prototype.once=F.prototype.v;F.prototype.un=F.prototype.t;F.prototype.unByKey=F.prototype.A;Oq.prototype.readFeatures=Oq.prototype.ma;Fq.prototype.readFeatures=Fq.prototype.ma;Fq.prototype.readFeatures=Fq.prototype.ma;mp.prototype.bindTo=mp.prototype.K;mp.prototype.get=mp.prototype.get;mp.prototype.getKeys=mp.prototype.G;mp.prototype.getProperties=mp.prototype.I;mp.prototype.set=mp.prototype.set;mp.prototype.setProperties=mp.prototype.C;mp.prototype.unbind=mp.prototype.L;
mp.prototype.unbindAll=mp.prototype.M;mp.prototype.changed=mp.prototype.l;mp.prototype.getRevision=mp.prototype.u;mp.prototype.on=mp.prototype.s;mp.prototype.once=mp.prototype.v;mp.prototype.un=mp.prototype.t;mp.prototype.unByKey=mp.prototype.A;Tg.prototype.bindTo=Tg.prototype.K;Tg.prototype.get=Tg.prototype.get;Tg.prototype.getKeys=Tg.prototype.G;Tg.prototype.getProperties=Tg.prototype.I;Tg.prototype.set=Tg.prototype.set;Tg.prototype.setProperties=Tg.prototype.C;Tg.prototype.unbind=Tg.prototype.L;
Tg.prototype.unbindAll=Tg.prototype.M;Tg.prototype.changed=Tg.prototype.l;Tg.prototype.getRevision=Tg.prototype.u;Tg.prototype.on=Tg.prototype.s;Tg.prototype.once=Tg.prototype.v;Tg.prototype.un=Tg.prototype.t;Tg.prototype.unByKey=Tg.prototype.A;Ug.prototype.getMap=Ug.prototype.f;Ug.prototype.setMap=Ug.prototype.setMap;Ug.prototype.setTarget=Ug.prototype.b;Ug.prototype.bindTo=Ug.prototype.K;Ug.prototype.get=Ug.prototype.get;Ug.prototype.getKeys=Ug.prototype.G;Ug.prototype.getProperties=Ug.prototype.I;
Ug.prototype.set=Ug.prototype.set;Ug.prototype.setProperties=Ug.prototype.C;Ug.prototype.unbind=Ug.prototype.L;Ug.prototype.unbindAll=Ug.prototype.M;Ug.prototype.changed=Ug.prototype.l;Ug.prototype.getRevision=Ug.prototype.u;Ug.prototype.on=Ug.prototype.s;Ug.prototype.once=Ug.prototype.v;Ug.prototype.un=Ug.prototype.t;Ug.prototype.unByKey=Ug.prototype.A;eh.prototype.getMap=eh.prototype.f;eh.prototype.setMap=eh.prototype.setMap;eh.prototype.setTarget=eh.prototype.b;eh.prototype.bindTo=eh.prototype.K;
eh.prototype.get=eh.prototype.get;eh.prototype.getKeys=eh.prototype.G;eh.prototype.getProperties=eh.prototype.I;eh.prototype.set=eh.prototype.set;eh.prototype.setProperties=eh.prototype.C;eh.prototype.unbind=eh.prototype.L;eh.prototype.unbindAll=eh.prototype.M;eh.prototype.changed=eh.prototype.l;eh.prototype.getRevision=eh.prototype.u;eh.prototype.on=eh.prototype.s;eh.prototype.once=eh.prototype.v;eh.prototype.un=eh.prototype.t;eh.prototype.unByKey=eh.prototype.A;fh.prototype.getMap=fh.prototype.f;
fh.prototype.setTarget=fh.prototype.b;fh.prototype.bindTo=fh.prototype.K;fh.prototype.get=fh.prototype.get;fh.prototype.getKeys=fh.prototype.G;fh.prototype.getProperties=fh.prototype.I;fh.prototype.set=fh.prototype.set;fh.prototype.setProperties=fh.prototype.C;fh.prototype.unbind=fh.prototype.L;fh.prototype.unbindAll=fh.prototype.M;fh.prototype.changed=fh.prototype.l;fh.prototype.getRevision=fh.prototype.u;fh.prototype.on=fh.prototype.s;fh.prototype.once=fh.prototype.v;fh.prototype.un=fh.prototype.t;
fh.prototype.unByKey=fh.prototype.A;Lo.prototype.getMap=Lo.prototype.f;Lo.prototype.setTarget=Lo.prototype.b;Lo.prototype.bindTo=Lo.prototype.K;Lo.prototype.get=Lo.prototype.get;Lo.prototype.getKeys=Lo.prototype.G;Lo.prototype.getProperties=Lo.prototype.I;Lo.prototype.set=Lo.prototype.set;Lo.prototype.setProperties=Lo.prototype.C;Lo.prototype.unbind=Lo.prototype.L;Lo.prototype.unbindAll=Lo.prototype.M;Lo.prototype.changed=Lo.prototype.l;Lo.prototype.getRevision=Lo.prototype.u;Lo.prototype.on=Lo.prototype.s;
Lo.prototype.once=Lo.prototype.v;Lo.prototype.un=Lo.prototype.t;Lo.prototype.unByKey=Lo.prototype.A;Xg.prototype.getMap=Xg.prototype.f;Xg.prototype.setMap=Xg.prototype.setMap;Xg.prototype.setTarget=Xg.prototype.b;Xg.prototype.bindTo=Xg.prototype.K;Xg.prototype.get=Xg.prototype.get;Xg.prototype.getKeys=Xg.prototype.G;Xg.prototype.getProperties=Xg.prototype.I;Xg.prototype.set=Xg.prototype.set;Xg.prototype.setProperties=Xg.prototype.C;Xg.prototype.unbind=Xg.prototype.L;Xg.prototype.unbindAll=Xg.prototype.M;
Xg.prototype.changed=Xg.prototype.l;Xg.prototype.getRevision=Xg.prototype.u;Xg.prototype.on=Xg.prototype.s;Xg.prototype.once=Xg.prototype.v;Xg.prototype.un=Xg.prototype.t;Xg.prototype.unByKey=Xg.prototype.A;Ro.prototype.getMap=Ro.prototype.f;Ro.prototype.setMap=Ro.prototype.setMap;Ro.prototype.setTarget=Ro.prototype.b;Ro.prototype.bindTo=Ro.prototype.K;Ro.prototype.get=Ro.prototype.get;Ro.prototype.getKeys=Ro.prototype.G;Ro.prototype.getProperties=Ro.prototype.I;Ro.prototype.set=Ro.prototype.set;
Ro.prototype.setProperties=Ro.prototype.C;Ro.prototype.unbind=Ro.prototype.L;Ro.prototype.unbindAll=Ro.prototype.M;Ro.prototype.changed=Ro.prototype.l;Ro.prototype.getRevision=Ro.prototype.u;Ro.prototype.on=Ro.prototype.s;Ro.prototype.once=Ro.prototype.v;Ro.prototype.un=Ro.prototype.t;Ro.prototype.unByKey=Ro.prototype.A;Zg.prototype.getMap=Zg.prototype.f;Zg.prototype.setMap=Zg.prototype.setMap;Zg.prototype.setTarget=Zg.prototype.b;Zg.prototype.bindTo=Zg.prototype.K;Zg.prototype.get=Zg.prototype.get;
Zg.prototype.getKeys=Zg.prototype.G;Zg.prototype.getProperties=Zg.prototype.I;Zg.prototype.set=Zg.prototype.set;Zg.prototype.setProperties=Zg.prototype.C;Zg.prototype.unbind=Zg.prototype.L;Zg.prototype.unbindAll=Zg.prototype.M;Zg.prototype.changed=Zg.prototype.l;Zg.prototype.getRevision=Zg.prototype.u;Zg.prototype.on=Zg.prototype.s;Zg.prototype.once=Zg.prototype.v;Zg.prototype.un=Zg.prototype.t;Zg.prototype.unByKey=Zg.prototype.A;fp.prototype.getMap=fp.prototype.f;fp.prototype.setTarget=fp.prototype.b;
fp.prototype.bindTo=fp.prototype.K;fp.prototype.get=fp.prototype.get;fp.prototype.getKeys=fp.prototype.G;fp.prototype.getProperties=fp.prototype.I;fp.prototype.set=fp.prototype.set;fp.prototype.setProperties=fp.prototype.C;fp.prototype.unbind=fp.prototype.L;fp.prototype.unbindAll=fp.prototype.M;fp.prototype.changed=fp.prototype.l;fp.prototype.getRevision=fp.prototype.u;fp.prototype.on=fp.prototype.s;fp.prototype.once=fp.prototype.v;fp.prototype.un=fp.prototype.t;fp.prototype.unByKey=fp.prototype.A;
kp.prototype.getMap=kp.prototype.f;kp.prototype.setMap=kp.prototype.setMap;kp.prototype.setTarget=kp.prototype.b;kp.prototype.bindTo=kp.prototype.K;kp.prototype.get=kp.prototype.get;kp.prototype.getKeys=kp.prototype.G;kp.prototype.getProperties=kp.prototype.I;kp.prototype.set=kp.prototype.set;kp.prototype.setProperties=kp.prototype.C;kp.prototype.unbind=kp.prototype.L;kp.prototype.unbindAll=kp.prototype.M;kp.prototype.changed=kp.prototype.l;kp.prototype.getRevision=kp.prototype.u;
kp.prototype.on=kp.prototype.s;kp.prototype.once=kp.prototype.v;kp.prototype.un=kp.prototype.t;kp.prototype.unByKey=kp.prototype.A;
return OPENLAYERS.ol;
}));

12
mapbox-gl/closure-library/.gitignore vendored Normal file
View File

@@ -0,0 +1,12 @@
# Copyright 2013 The Closure Library Authors
# Files to be ignored by git.
# Use of this source code is governed by the Apache License, Version 2.0.
# See the COPYING file for details.
# emacs
*~
\#*#
# python
*.pyc

View File

@@ -0,0 +1,14 @@
# Copyright 2014 The Closure Library Authors. All Rights Reserved.
#
# Use of this source code is governed by the Apache License, Version 2.0.
# See the LICENSE file for details.
install:
- cd ..
- git clone https://github.com/google/closure-compiler.git
- cd closure-compiler
- ant jar
- cd ../closure-library
script:
- java -jar ../closure-compiler/build/compiler.jar -O ADVANCED --js='**.js' --js='!**_test.js' --js='!**_perf.js' --js_output_file=$(mktemp)

View File

@@ -0,0 +1,17 @@
# This is a list of contributors to the Closure Library.
# Names should be added to this file like so:
# Name or Organization <email address>
Google Inc.
Mohamed Mansour <hello@mohamedmansour.com>
Bjorn Tipling <bjorn.tipling@gmail.com>
SameGoal LLC <help@samegoal.com>
Guido Tapia <guido.tapia@gmail.com>
Andrew Mattie <amattie@gmail.com>
Ilia Mirkin <ibmirkin@gmail.com>
Ivan Kozik <ivan.kozik@gmail.com>
Rich Dougherty <rich@rd.gen.nz>
Chad Killingsworth <chadkillingsworth@missouristate.edu>
Dan Pupius <dan.pupius@gmail.com>

View File

@@ -0,0 +1,48 @@
Closure Library welcomes patches/pulls for features and bugfixes.
For contributors inside Google, follow the instructions given here:
http://go/closure-contributors
For contributors external to Google, follow the instructions given here:
Notes on Contributions to Closure Library
Google Individual Contributor License
In all cases, contributors must sign a contributor license agreement,
either for an individual or corporation, before a patch can be
accepted. Please fill out the agreement for an individual or a
corporation, as appropriate.
https://developers.google.com/open-source/cla/individual
https://developers.google.com/open-source/cla/corporate
If you or your organization is not listed there already, you should
add an entry to the AUTHORS file as part of your patch.
If you plan to add a significant component or large chunk of code, it
is recommended to bring it up on the discussion list for a design
discussion before writing code.
If appropriate, write a unit test that demonstrates your patch. Tests are the
best way to ensure that future contributors do not break your code
accidentally.
To change the Closure Library source, you must submit a pull request
in GitHub. See the GitHub documentation here:
https://help.github.com/categories/63/articles
Closure Library developers monitor outstanding pull requests. They may
request changes on the pull request before accepting. They will also
verify that the CLA has been signed.
Oftentimes, the pull request will not be directly merged, but patched to
the internal Google codebase to verify that unit and integration tests
will Closure pass before submitting (and optionally make changes to
the patch to match style, fix text, or to make the code or comments
clearer). In this case, the issue associated with the pull request
will be closed when the patch pushed to the repository via the MOE
(Make Open Easy) system.
https://code.google.com/p/moe-java/

View File

@@ -0,0 +1,176 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

View File

@@ -0,0 +1,9 @@
# Closure Library
Closure Library is a powerful, low-level JavaScript library designed
for building complex and scalable web applications. It is used by many
Google web applications, such as Gmail and Google Docs.
For more information, visit the
[Google Developers](https://developers.google.com/closure/library) or
[GitHub](https://github.com/google/closure-library) sites.

View File

@@ -0,0 +1,111 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2009 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<title>Closure - All JsUnit Tests</title>
<script src="closure/goog/base.js"></script>
<script src="alltests.js"></script>
<script>
goog.require('goog.userAgent.product');
goog.require('goog.testing.MultiTestRunner');
</script>
<link rel="stylesheet" href="closure/goog/css/multitestrunner.css" type="text/css">
<style>
h1 {
font: normal x-large arial, helvetica, sans-serif;
margin: 0;
}
p, form {
font: normal small sans-serif;
margin: 0;
}
#header {
position: absolute;
right: 10px;
top: 13px;
}
#footer {
margin-top: 8px;
}
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.warning {
font-size: 14px;
font-weight: bold;
width: 80%;
}
</style>
</head>
<body>
<script>
if (goog.userAgent.product.CHROME &&
window.location.toString().indexOf('file:') == 0) {
document.write(
'<div class="warning">' +
'WARNING: Due to Chrome\'s security restrictions ' +
'this test will not be able to load files off your local disk ' +
'unless you start Chrome with:<br>' +
'<code>--allow-file-access-from-files</code></div><br>');
}
</script>
<h1>Closure - All JsUnit Tests</h1>
<p id="header"></p>
<div id="runner"></div>
<!-- Use a form so browser persists input values -->
<form id="footer" onsubmit="return false">
Settings:<br>
<input type="checkbox" name="hidepasses" id="hidepasses" checked>
<label for="hidepasses">Hide passes</label><br>
<input type="checkbox" name="parallel" id="parallel" checked>
<label for="parallel">Run in parallel</label>
<small>(timing stats not available if enabled)</small><br>
<input type="text" name="filter" id="filter" value="">
<label for="filter">Run only tests for path</label>
</form>
<script>
var hidePassesInput = document.getElementById('hidepasses');
var parallelInput = document.getElementById('parallel');
var filterInput = document.getElementById('filter');
function setFilterFunction() {
var matchValue = filterInput.value || '';
testRunner.setFilterFunction(function(testPath) {
return testPath.indexOf(matchValue) > -1;
});
}
// Create a test runner and render it.
var testRunner = new goog.testing.MultiTestRunner()
.setName(document.title)
.setBasePath('./')
.setPoolSize(parallelInput.checked ? 8 : 1)
.setStatsBucketSizes(5, 500)
.setHidePasses(hidePassesInput.checked)
//.setVerbosePasses(true)
.addTests(_allTests);
testRunner.render(document.getElementById('runner'));
goog.events.listen(hidePassesInput, 'click', function(e) {
testRunner.setHidePasses(e.target.checked);
});
goog.events.listen(parallelInput, 'click', function(e) {
testRunner.setPoolSize(e.target.checked ? 8 : 1);
});
goog.events.listen(filterInput, 'keyup', setFilterFunction);
setFilterFunction();
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,287 @@
#!/usr/bin/env python
#
# Copyright 2009 The Closure Library Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Utility for Closure Library dependency calculation.
ClosureBuilder scans source files to build dependency info. From the
dependencies, the script can produce a manifest in dependency order,
a concatenated script, or compiled output from the Closure Compiler.
Paths to files can be expressed as individual arguments to the tool (intended
for use with find and xargs). As a convenience, --root can be used to specify
all JS files below a directory.
usage: %prog [options] [file1.js file2.js ...]
"""
__author__ = 'nnaze@google.com (Nathan Naze)'
import logging
import optparse
import os
import sys
import depstree
import jscompiler
import source
import treescan
def _GetOptionsParser():
"""Get the options parser."""
parser = optparse.OptionParser(__doc__)
parser.add_option('-i',
'--input',
dest='inputs',
action='append',
default=[],
help='One or more input files to calculate dependencies '
'for. The namespaces in this file will be combined with '
'those given with the -n flag to form the set of '
'namespaces to find dependencies for.')
parser.add_option('-n',
'--namespace',
dest='namespaces',
action='append',
default=[],
help='One or more namespaces to calculate dependencies '
'for. These namespaces will be combined with those given '
'with the -i flag to form the set of namespaces to find '
'dependencies for. A Closure namespace is a '
'dot-delimited path expression declared with a call to '
'goog.provide() (e.g. "goog.array" or "foo.bar").')
parser.add_option('--root',
dest='roots',
action='append',
default=[],
help='The paths that should be traversed to build the '
'dependencies.')
parser.add_option('-o',
'--output_mode',
dest='output_mode',
type='choice',
action='store',
choices=['list', 'script', 'compiled'],
default='list',
help='The type of output to generate from this script. '
'Options are "list" for a list of filenames, "script" '
'for a single script containing the contents of all the '
'files, or "compiled" to produce compiled output with '
'the Closure Compiler. Default is "list".')
parser.add_option('-c',
'--compiler_jar',
dest='compiler_jar',
action='store',
help='The location of the Closure compiler .jar file.')
parser.add_option('-f',
'--compiler_flags',
dest='compiler_flags',
default=[],
action='append',
help='Additional flags to pass to the Closure compiler. '
'To pass multiple flags, --compiler_flags has to be '
'specified multiple times.')
parser.add_option('-j',
'--jvm_flags',
dest='jvm_flags',
default=[],
action='append',
help='Additional flags to pass to the JVM compiler. '
'To pass multiple flags, --jvm_flags has to be '
'specified multiple times.')
parser.add_option('--output_file',
dest='output_file',
action='store',
help=('If specified, write output to this path instead of '
'writing to standard output.'))
return parser
def _GetInputByPath(path, sources):
"""Get the source identified by a path.
Args:
path: str, A path to a file that identifies a source.
sources: An iterable collection of source objects.
Returns:
The source from sources identified by path, if found. Converts to
absolute paths for comparison.
"""
for js_source in sources:
# Convert both to absolute paths for comparison.
if os.path.abspath(path) == os.path.abspath(js_source.GetPath()):
return js_source
def _GetClosureBaseFile(sources):
"""Given a set of sources, returns the one base.js file.
Note that if zero or two or more base.js files are found, an error message
will be written and the program will be exited.
Args:
sources: An iterable of _PathSource objects.
Returns:
The _PathSource representing the base Closure file.
"""
base_files = [
js_source for js_source in sources if _IsClosureBaseFile(js_source)]
if not base_files:
logging.error('No Closure base.js file found.')
sys.exit(1)
if len(base_files) > 1:
logging.error('More than one Closure base.js files found at these paths:')
for base_file in base_files:
logging.error(base_file.GetPath())
sys.exit(1)
return base_files[0]
def _IsClosureBaseFile(js_source):
"""Returns true if the given _PathSource is the Closure base.js source."""
return (os.path.basename(js_source.GetPath()) == 'base.js' and
js_source.provides == set(['goog']))
class _PathSource(source.Source):
"""Source file subclass that remembers its file path."""
def __init__(self, path):
"""Initialize a source.
Args:
path: str, Path to a JavaScript file. The source string will be read
from this file.
"""
super(_PathSource, self).__init__(source.GetFileContents(path))
self._path = path
def __str__(self):
return 'PathSource %s' % self._path
def GetPath(self):
"""Returns the path."""
return self._path
def _WrapGoogModuleSource(src):
return ('goog.loadModule(function(exports) {'
'"use strict";'
'{0}'
'\n' # terminate any trailing single line comment.
';return exports'
'});\n').format(src)
def main():
logging.basicConfig(format=(sys.argv[0] + ': %(message)s'),
level=logging.INFO)
options, args = _GetOptionsParser().parse_args()
# Make our output pipe.
if options.output_file:
out = open(options.output_file, 'w')
else:
out = sys.stdout
sources = set()
logging.info('Scanning paths...')
for path in options.roots:
for js_path in treescan.ScanTreeForJsFiles(path):
sources.add(_PathSource(js_path))
# Add scripts specified on the command line.
for js_path in args:
sources.add(_PathSource(js_path))
logging.info('%s sources scanned.', len(sources))
# Though deps output doesn't need to query the tree, we still build it
# to validate dependencies.
logging.info('Building dependency tree..')
tree = depstree.DepsTree(sources)
input_namespaces = set()
inputs = options.inputs or []
for input_path in inputs:
js_input = _GetInputByPath(input_path, sources)
if not js_input:
logging.error('No source matched input %s', input_path)
sys.exit(1)
input_namespaces.update(js_input.provides)
input_namespaces.update(options.namespaces)
if not input_namespaces:
logging.error('No namespaces found. At least one namespace must be '
'specified with the --namespace or --input flags.')
sys.exit(2)
# The Closure Library base file must go first.
base = _GetClosureBaseFile(sources)
deps = [base] + tree.GetDependencies(input_namespaces)
output_mode = options.output_mode
if output_mode == 'list':
out.writelines([js_source.GetPath() + '\n' for js_source in deps])
elif output_mode == 'script':
for js_source in deps:
src = js_source.GetSource()
if js_source.is_goog_module:
src = _WrapGoogModuleSource(src)
out.write(src + '\n')
elif output_mode == 'compiled':
logging.warning("""\
Closure Compiler now natively understands and orders Closure dependencies and
is prefererred over using this script for performing JavaScript compilation.
Please migrate your codebase.
See:
https://github.com/google/closure-compiler/wiki/Manage-Closure-Dependencies
""")
# Make sure a .jar is specified.
if not options.compiler_jar:
logging.error('--compiler_jar flag must be specified if --output is '
'"compiled"')
sys.exit(2)
# Will throw an error if the compilation fails.
compiled_source = jscompiler.Compile(
options.compiler_jar,
[js_source.GetPath() for js_source in deps],
jvm_flags=options.jvm_flags,
compiler_flags=options.compiler_flags)
logging.info('JavaScript compilation succeeded.')
out.write(compiled_source)
else:
logging.error('Invalid value for --output flag.')
sys.exit(2)
if __name__ == '__main__':
main()

View File

@@ -0,0 +1,189 @@
# Copyright 2009 The Closure Library Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Class to represent a full Closure Library dependency tree.
Offers a queryable tree of dependencies of a given set of sources. The tree
will also do logical validation to prevent duplicate provides and circular
dependencies.
"""
__author__ = 'nnaze@google.com (Nathan Naze)'
class DepsTree(object):
"""Represents the set of dependencies between source files."""
def __init__(self, sources):
"""Initializes the tree with a set of sources.
Args:
sources: A set of JavaScript sources.
Raises:
MultipleProvideError: A namespace is provided by muplitple sources.
NamespaceNotFoundError: A namespace is required but never provided.
"""
self._sources = sources
self._provides_map = dict()
# Ensure nothing was provided twice.
for source in sources:
for provide in source.provides:
if provide in self._provides_map:
raise MultipleProvideError(
provide, [self._provides_map[provide], source])
self._provides_map[provide] = source
# Check that all required namespaces are provided.
for source in sources:
for require in source.requires:
if require not in self._provides_map:
raise NamespaceNotFoundError(require, source)
def GetDependencies(self, required_namespaces):
"""Get source dependencies, in order, for the given namespaces.
Args:
required_namespaces: A string (for one) or list (for one or more) of
namespaces.
Returns:
A list of source objects that provide those namespaces and all
requirements, in dependency order.
Raises:
NamespaceNotFoundError: A namespace is requested but doesn't exist.
CircularDependencyError: A cycle is detected in the dependency tree.
"""
if isinstance(required_namespaces, str):
required_namespaces = [required_namespaces]
deps_sources = []
for namespace in required_namespaces:
for source in DepsTree._ResolveDependencies(
namespace, [], self._provides_map, []):
if source not in deps_sources:
deps_sources.append(source)
return deps_sources
@staticmethod
def _ResolveDependencies(required_namespace, deps_list, provides_map,
traversal_path):
"""Resolve dependencies for Closure source files.
Follows the dependency tree down and builds a list of sources in dependency
order. This function will recursively call itself to fill all dependencies
below the requested namespaces, and then append its sources at the end of
the list.
Args:
required_namespace: String of required namespace.
deps_list: List of sources in dependency order. This function will append
the required source once all of its dependencies are satisfied.
provides_map: Map from namespace to source that provides it.
traversal_path: List of namespaces of our path from the root down the
dependency/recursion tree. Used to identify cyclical dependencies.
This is a list used as a stack -- when the function is entered, the
current namespace is pushed and popped right before returning.
Each recursive call will check that the current namespace does not
appear in the list, throwing a CircularDependencyError if it does.
Returns:
The given deps_list object filled with sources in dependency order.
Raises:
NamespaceNotFoundError: A namespace is requested but doesn't exist.
CircularDependencyError: A cycle is detected in the dependency tree.
"""
source = provides_map.get(required_namespace)
if not source:
raise NamespaceNotFoundError(required_namespace)
if required_namespace in traversal_path:
traversal_path.append(required_namespace) # do this *after* the test
# This must be a cycle.
raise CircularDependencyError(traversal_path)
# If we don't have the source yet, we'll have to visit this namespace and
# add the required dependencies to deps_list.
if source not in deps_list:
traversal_path.append(required_namespace)
for require in source.requires:
# Append all other dependencies before we append our own.
DepsTree._ResolveDependencies(require, deps_list, provides_map,
traversal_path)
deps_list.append(source)
traversal_path.pop()
return deps_list
class BaseDepsTreeError(Exception):
"""Base DepsTree error."""
def __init__(self):
Exception.__init__(self)
class CircularDependencyError(BaseDepsTreeError):
"""Raised when a dependency cycle is encountered."""
def __init__(self, dependency_list):
BaseDepsTreeError.__init__(self)
self._dependency_list = dependency_list
def __str__(self):
return ('Encountered circular dependency:\n%s\n' %
'\n'.join(self._dependency_list))
class MultipleProvideError(BaseDepsTreeError):
"""Raised when a namespace is provided more than once."""
def __init__(self, namespace, sources):
BaseDepsTreeError.__init__(self)
self._namespace = namespace
self._sources = sources
def __str__(self):
source_strs = map(str, self._sources)
return ('Namespace "%s" provided more than once in sources:\n%s\n' %
(self._namespace, '\n'.join(source_strs)))
class NamespaceNotFoundError(BaseDepsTreeError):
"""Raised when a namespace is requested but not provided."""
def __init__(self, namespace, source=None):
BaseDepsTreeError.__init__(self)
self._namespace = namespace
self._source = source
def __str__(self):
msg = 'Namespace "%s" never provided.' % self._namespace
if self._source:
msg += ' Required in %s' % self._source
return msg

View File

@@ -0,0 +1,127 @@
#!/usr/bin/env python
#
# Copyright 2009 The Closure Library Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Unit test for depstree."""
__author__ = 'nnaze@google.com (Nathan Naze)'
import unittest
import depstree
def _GetProvides(sources):
"""Get all namespaces provided by a collection of sources."""
provides = set()
for source in sources:
provides.update(source.provides)
return provides
class MockSource(object):
"""Mock Source file."""
def __init__(self, provides, requires):
self.provides = set(provides)
self.requires = set(requires)
def __repr__(self):
return 'MockSource %s' % self.provides
class DepsTreeTestCase(unittest.TestCase):
"""Unit test for DepsTree. Tests several common situations and errors."""
def AssertValidDependencies(self, deps_list):
"""Validates a dependency list.
Asserts that a dependency list is valid: For every source in the list,
ensure that every require is provided by a source earlier in the list.
Args:
deps_list: A list of sources that should be in dependency order.
"""
for i in range(len(deps_list)):
source = deps_list[i]
previous_provides = _GetProvides(deps_list[:i])
for require in source.requires:
self.assertTrue(
require in previous_provides,
'Namespace "%s" not provided before required by %s' % (
require, source))
def testSimpleDepsTree(self):
a = MockSource(['A'], ['B', 'C'])
b = MockSource(['B'], [])
c = MockSource(['C'], ['D'])
d = MockSource(['D'], ['E'])
e = MockSource(['E'], [])
tree = depstree.DepsTree([a, b, c, d, e])
self.AssertValidDependencies(tree.GetDependencies('A'))
self.AssertValidDependencies(tree.GetDependencies('B'))
self.AssertValidDependencies(tree.GetDependencies('C'))
self.AssertValidDependencies(tree.GetDependencies('D'))
self.AssertValidDependencies(tree.GetDependencies('E'))
def testCircularDependency(self):
# Circular deps
a = MockSource(['A'], ['B'])
b = MockSource(['B'], ['C'])
c = MockSource(['C'], ['A'])
tree = depstree.DepsTree([a, b, c])
self.assertRaises(depstree.CircularDependencyError,
tree.GetDependencies, 'A')
def testRequiresUndefinedNamespace(self):
a = MockSource(['A'], ['B'])
b = MockSource(['B'], ['C'])
c = MockSource(['C'], ['D']) # But there is no D.
def MakeDepsTree():
return depstree.DepsTree([a, b, c])
self.assertRaises(depstree.NamespaceNotFoundError, MakeDepsTree)
def testDepsForMissingNamespace(self):
a = MockSource(['A'], ['B'])
b = MockSource(['B'], [])
tree = depstree.DepsTree([a, b])
# There is no C.
self.assertRaises(depstree.NamespaceNotFoundError,
tree.GetDependencies, 'C')
def testMultipleRequires(self):
a = MockSource(['A'], ['B'])
b = MockSource(['B'], ['C'])
c = MockSource(['C'], [])
d = MockSource(['D'], ['B'])
tree = depstree.DepsTree([a, b, c, d])
self.AssertValidDependencies(tree.GetDependencies(['D', 'A']))
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,204 @@
#!/usr/bin/env python
#
# Copyright 2009 The Closure Library Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Generates out a Closure deps.js file given a list of JavaScript sources.
Paths can be specified as arguments or (more commonly) specifying trees
with the flags (call with --help for descriptions).
Usage: depswriter.py [path/to/js1.js [path/to/js2.js] ...]
"""
import logging
import optparse
import os
import posixpath
import shlex
import sys
import source
import treescan
__author__ = 'nnaze@google.com (Nathan Naze)'
def MakeDepsFile(source_map):
"""Make a generated deps file.
Args:
source_map: A dict map of the source path to source.Source object.
Returns:
str, A generated deps file source.
"""
# Write in path alphabetical order
paths = sorted(source_map.keys())
lines = []
for path in paths:
js_source = source_map[path]
# We don't need to add entries that don't provide anything.
if js_source.provides:
lines.append(_GetDepsLine(path, js_source))
return ''.join(lines)
def _GetDepsLine(path, js_source):
"""Get a deps.js file string for a source."""
provides = sorted(js_source.provides)
requires = sorted(js_source.requires)
module = 'true' if js_source.is_goog_module else 'false'
return 'goog.addDependency(\'%s\', %s, %s, %s);\n' % (
path, provides, requires, module)
def _GetOptionsParser():
"""Get the options parser."""
parser = optparse.OptionParser(__doc__)
parser.add_option('--output_file',
dest='output_file',
action='store',
help=('If specified, write output to this path instead of '
'writing to standard output.'))
parser.add_option('--root',
dest='roots',
default=[],
action='append',
help='A root directory to scan for JS source files. '
'Paths of JS files in generated deps file will be '
'relative to this path. This flag may be specified '
'multiple times.')
parser.add_option('--root_with_prefix',
dest='roots_with_prefix',
default=[],
action='append',
help='A root directory to scan for JS source files, plus '
'a prefix (if either contains a space, surround with '
'quotes). Paths in generated deps file will be relative '
'to the root, but preceded by the prefix. This flag '
'may be specified multiple times.')
parser.add_option('--path_with_depspath',
dest='paths_with_depspath',
default=[],
action='append',
help='A path to a source file and an alternate path to '
'the file in the generated deps file (if either contains '
'a space, surround with whitespace). This flag may be '
'specified multiple times.')
return parser
def _NormalizePathSeparators(path):
"""Replaces OS-specific path separators with POSIX-style slashes.
Args:
path: str, A file path.
Returns:
str, The path with any OS-specific path separators (such as backslash on
Windows) replaced with URL-compatible forward slashes. A no-op on systems
that use POSIX paths.
"""
return path.replace(os.sep, posixpath.sep)
def _GetRelativePathToSourceDict(root, prefix=''):
"""Scans a top root directory for .js sources.
Args:
root: str, Root directory.
prefix: str, Prefix for returned paths.
Returns:
dict, A map of relative paths (with prefix, if given), to source.Source
objects.
"""
# Remember and restore the cwd when we're done. We work from the root so
# that paths are relative from the root.
start_wd = os.getcwd()
os.chdir(root)
path_to_source = {}
for path in treescan.ScanTreeForJsFiles('.'):
prefixed_path = _NormalizePathSeparators(os.path.join(prefix, path))
path_to_source[prefixed_path] = source.Source(source.GetFileContents(path))
os.chdir(start_wd)
return path_to_source
def _GetPair(s):
"""Return a string as a shell-parsed tuple. Two values expected."""
try:
# shlex uses '\' as an escape character, so they must be escaped.
s = s.replace('\\', '\\\\')
first, second = shlex.split(s)
return (first, second)
except:
raise Exception('Unable to parse input line as a pair: %s' % s)
def main():
"""CLI frontend to MakeDepsFile."""
logging.basicConfig(format=(sys.argv[0] + ': %(message)s'),
level=logging.INFO)
options, args = _GetOptionsParser().parse_args()
path_to_source = {}
# Roots without prefixes
for root in options.roots:
path_to_source.update(_GetRelativePathToSourceDict(root))
# Roots with prefixes
for root_and_prefix in options.roots_with_prefix:
root, prefix = _GetPair(root_and_prefix)
path_to_source.update(_GetRelativePathToSourceDict(root, prefix=prefix))
# Source paths
for path in args:
path_to_source[path] = source.Source(source.GetFileContents(path))
# Source paths with alternate deps paths
for path_with_depspath in options.paths_with_depspath:
srcpath, depspath = _GetPair(path_with_depspath)
path_to_source[depspath] = source.Source(source.GetFileContents(srcpath))
# Make our output pipe.
if options.output_file:
out = open(options.output_file, 'w')
else:
out = sys.stdout
out.write('// This file was autogenerated by %s.\n' % sys.argv[0])
out.write('// Please do not edit.\n')
out.write(MakeDepsFile(path_to_source))
if __name__ == '__main__':
main()

View File

@@ -0,0 +1,135 @@
# Copyright 2010 The Closure Library Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Utility to use the Closure Compiler CLI from Python."""
import logging
import os
import re
import subprocess
# Pulls just the major and minor version numbers from the first line of
# 'java -version'. Versions are in the format of [0-9]+\.[0-9]+\..* See:
# http://www.oracle.com/technetwork/java/javase/versioning-naming-139433.html
_VERSION_REGEX = re.compile(r'"([0-9]+)\.([0-9]+)')
class JsCompilerError(Exception):
"""Raised if there's an error in calling the compiler."""
pass
def _GetJavaVersionString():
"""Get the version string from the Java VM."""
return subprocess.check_output(['java', '-version'], stderr=subprocess.STDOUT)
def _ParseJavaVersion(version_string):
"""Returns a 2-tuple for the current version of Java installed.
Args:
version_string: String of the Java version (e.g. '1.7.2-ea').
Returns:
The major and minor versions, as a 2-tuple (e.g. (1, 7)).
"""
match = _VERSION_REGEX.search(version_string)
if match:
version = tuple(int(x, 10) for x in match.groups())
assert len(version) == 2
return version
def _JavaSupports32BitMode():
"""Determines whether the JVM supports 32-bit mode on the platform."""
# Suppresses process output to stderr and stdout from showing up in the
# console as we're only trying to determine 32-bit JVM support.
supported = False
try:
devnull = open(os.devnull, 'wb')
return subprocess.call(
['java', '-d32', '-version'], stdout=devnull, stderr=devnull) == 0
except IOError:
pass
else:
devnull.close()
return supported
def _GetJsCompilerArgs(compiler_jar_path, java_version, source_paths,
jvm_flags, compiler_flags):
"""Assembles arguments for call to JsCompiler."""
if java_version < (1, 7):
raise JsCompilerError('Closure Compiler requires Java 1.7 or higher. '
'Please visit http://www.java.com/getjava')
args = ['java']
# Add JVM flags we believe will produce the best performance. See
# https://groups.google.com/forum/#!topic/closure-library-discuss/7w_O9-vzlj4
# Attempt 32-bit mode if available (Java 7 on Mac OS X does not support 32-bit
# mode, for example).
if _JavaSupports32BitMode():
args += ['-d32']
# Prefer the "client" VM.
args += ['-client']
# Add JVM flags, if any
if jvm_flags:
args += jvm_flags
# Add the application JAR.
args += ['-jar', compiler_jar_path]
for path in source_paths:
args += ['--js', path]
# Add compiler flags, if any.
if compiler_flags:
args += compiler_flags
return args
def Compile(compiler_jar_path, source_paths,
jvm_flags=None,
compiler_flags=None):
"""Prepares command-line call to Closure Compiler.
Args:
compiler_jar_path: Path to the Closure compiler .jar file.
source_paths: Source paths to build, in order.
jvm_flags: A list of additional flags to pass on to JVM.
compiler_flags: A list of additional flags to pass on to Closure Compiler.
Returns:
The compiled source, as a string, or None if compilation failed.
"""
java_version = _ParseJavaVersion(_GetJavaVersionString())
args = _GetJsCompilerArgs(
compiler_jar_path, java_version, source_paths, jvm_flags, compiler_flags)
logging.info('Compiling with the following command: %s', ' '.join(args))
try:
return subprocess.check_output(args)
except subprocess.CalledProcessError:
raise JsCompilerError('JavaScript compilation failed.')

View File

@@ -0,0 +1,120 @@
#!/usr/bin/env python
#
# Copyright 2013 The Closure Library Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Unit test for depstree."""
__author__ = 'nnaze@google.com (Nathan Naze)'
import unittest
import jscompiler
class JsCompilerTestCase(unittest.TestCase):
"""Unit tests for jscompiler module."""
def testGetJsCompilerArgs(self):
original_check = jscompiler._JavaSupports32BitMode
jscompiler._JavaSupports32BitMode = lambda: False
args = jscompiler._GetJsCompilerArgs(
'path/to/jscompiler.jar',
(1, 7),
['path/to/src1.js', 'path/to/src2.js'],
['--test_jvm_flag'],
['--test_compiler_flag']
)
self.assertEqual(
['java', '-client', '--test_jvm_flag',
'-jar', 'path/to/jscompiler.jar',
'--js', 'path/to/src1.js',
'--js', 'path/to/src2.js', '--test_compiler_flag'],
args)
def CheckJava15RaisesError():
jscompiler._GetJsCompilerArgs(
'path/to/jscompiler.jar',
(1, 5),
['path/to/src1.js', 'path/to/src2.js'],
['--test_jvm_flag'],
['--test_compiler_flag'])
self.assertRaises(jscompiler.JsCompilerError, CheckJava15RaisesError)
jscompiler._JavaSupports32BitMode = original_check
def testGetJsCompilerArgs32BitJava(self):
original_check = jscompiler._JavaSupports32BitMode
# Should include the -d32 flag only if 32-bit Java is supported by the
# system.
jscompiler._JavaSupports32BitMode = lambda: True
args = jscompiler._GetJsCompilerArgs(
'path/to/jscompiler.jar',
(1, 7),
['path/to/src1.js', 'path/to/src2.js'],
['--test_jvm_flag'],
['--test_compiler_flag'])
self.assertEqual(
['java', '-d32', '-client', '--test_jvm_flag',
'-jar', 'path/to/jscompiler.jar',
'--js', 'path/to/src1.js',
'--js', 'path/to/src2.js',
'--test_compiler_flag'],
args)
# Should exclude the -d32 flag if 32-bit Java is not supported by the
# system.
jscompiler._JavaSupports32BitMode = lambda: False
args = jscompiler._GetJsCompilerArgs(
'path/to/jscompiler.jar',
(1, 7),
['path/to/src1.js', 'path/to/src2.js'],
['--test_jvm_flag'],
['--test_compiler_flag'])
self.assertEqual(
['java', '-client', '--test_jvm_flag',
'-jar', 'path/to/jscompiler.jar',
'--js', 'path/to/src1.js',
'--js', 'path/to/src2.js',
'--test_compiler_flag'],
args)
jscompiler._JavaSupports32BitMode = original_check
def testGetJavaVersion(self):
def assertVersion(expected, version_string):
self.assertEquals(expected, jscompiler._ParseJavaVersion(version_string))
assertVersion((1, 7), _TEST_JAVA_VERSION_STRING)
assertVersion((1, 4), 'java version "1.4.0_03-ea"')
_TEST_JAVA_VERSION_STRING = """\
openjdk version "1.7.0-google-v5"
OpenJDK Runtime Environment (build 1.7.0-google-v5-64327-39803485)
OpenJDK Server VM (build 22.0-b10, mixed mode)
"""
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,127 @@
# Copyright 2009 The Closure Library Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Scans a source JS file for its provided and required namespaces.
Simple class to scan a JavaScript file and express its dependencies.
"""
__author__ = 'nnaze@google.com'
import re
_BASE_REGEX_STRING = r'^\s*goog\.%s\(\s*[\'"](.+)[\'"]\s*\)'
_MODULE_REGEX = re.compile(_BASE_REGEX_STRING % 'module')
_PROVIDE_REGEX = re.compile(_BASE_REGEX_STRING % 'provide')
_REQUIRE_REGEX_STRING = (r'^\s*(?:(?:var|let|const)\s+[a-zA-Z_$][a-zA-Z0-9$_]*'
r'\s*=\s*)?goog\.require\(\s*[\'"](.+)[\'"]\s*\)')
_REQUIRES_REGEX = re.compile(_REQUIRE_REGEX_STRING)
class Source(object):
"""Scans a JavaScript source for its provided and required namespaces."""
# Matches a "/* ... */" comment.
# Note: We can't definitively distinguish a "/*" in a string literal without a
# state machine tokenizer. We'll assume that a line starting with whitespace
# and "/*" is a comment.
_COMMENT_REGEX = re.compile(
r"""
^\s* # Start of a new line and whitespace
/\* # Opening "/*"
.*? # Non greedy match of any characters (including newlines)
\*/ # Closing "*/""",
re.MULTILINE | re.DOTALL | re.VERBOSE)
def __init__(self, source):
"""Initialize a source.
Args:
source: str, The JavaScript source.
"""
self.provides = set()
self.requires = set()
self.is_goog_module = False
self._source = source
self._ScanSource()
def GetSource(self):
"""Get the source as a string."""
return self._source
@classmethod
def _StripComments(cls, source):
return cls._COMMENT_REGEX.sub('', source)
@classmethod
def _HasProvideGoogFlag(cls, source):
"""Determines whether the @provideGoog flag is in a comment."""
for comment_content in cls._COMMENT_REGEX.findall(source):
if '@provideGoog' in comment_content:
return True
return False
def _ScanSource(self):
"""Fill in provides and requires by scanning the source."""
stripped_source = self._StripComments(self.GetSource())
source_lines = stripped_source.splitlines()
for line in source_lines:
match = _PROVIDE_REGEX.match(line)
if match:
self.provides.add(match.group(1))
match = _MODULE_REGEX.match(line)
if match:
self.provides.add(match.group(1))
self.is_goog_module = True
match = _REQUIRES_REGEX.match(line)
if match:
self.requires.add(match.group(1))
# Closure's base file implicitly provides 'goog'.
# This is indicated with the @provideGoog flag.
if self._HasProvideGoogFlag(self.GetSource()):
if len(self.provides) or len(self.requires):
raise Exception(
'Base file should not provide or require namespaces.')
self.provides.add('goog')
def GetFileContents(path):
"""Get a file's contents as a string.
Args:
path: str, Path to file.
Returns:
str, Contents of file.
Raises:
IOError: An error occurred opening or reading the file.
"""
fileobj = open(path)
try:
return fileobj.read()
finally:
fileobj.close()

View File

@@ -0,0 +1,152 @@
#!/usr/bin/env python
#
# Copyright 2010 The Closure Library Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Unit test for source."""
__author__ = 'nnaze@google.com (Nathan Naze)'
import unittest
import source
class SourceTestCase(unittest.TestCase):
"""Unit test for source. Tests the parser on a known source input."""
def testSourceScan(self):
test_source = source.Source(_TEST_SOURCE)
self.assertEqual(set(['foo', 'foo.test']),
test_source.provides)
self.assertEqual(set(['goog.dom', 'goog.events.EventType']),
test_source.requires)
self.assertFalse(test_source.is_goog_module)
def testSourceScanBase(self):
test_source = source.Source(_TEST_BASE_SOURCE)
self.assertEqual(set(['goog']),
test_source.provides)
self.assertEqual(test_source.requires, set())
self.assertFalse(test_source.is_goog_module)
def testSourceScanBadBase(self):
def MakeSource():
source.Source(_TEST_BAD_BASE_SOURCE)
self.assertRaises(Exception, MakeSource)
def testSourceScanGoogModule(self):
test_source = source.Source(_TEST_MODULE_SOURCE)
self.assertEqual(set(['foo']),
test_source.provides)
self.assertEqual(set(['bar']),
test_source.requires)
self.assertTrue(test_source.is_goog_module)
def testStripComments(self):
self.assertEquals(
'\nvar foo = function() {}',
source.Source._StripComments((
'/* This is\n'
' a comment split\n'
' over multiple lines\n'
'*/\n'
'var foo = function() {}')))
def testGoogStatementsInComments(self):
test_source = source.Source(_TEST_COMMENT_SOURCE)
self.assertEqual(set(['foo']),
test_source.provides)
self.assertEqual(set(['goog.events.EventType']),
test_source.requires)
self.assertFalse(test_source.is_goog_module)
def testHasProvideGoog(self):
self.assertTrue(source.Source._HasProvideGoogFlag(_TEST_BASE_SOURCE))
self.assertTrue(source.Source._HasProvideGoogFlag(_TEST_BAD_BASE_SOURCE))
self.assertFalse(source.Source._HasProvideGoogFlag(_TEST_COMMENT_SOURCE))
_TEST_MODULE_SOURCE = """
goog.module('foo');
var b = goog.require('bar');
"""
_TEST_SOURCE = """// Fake copyright notice
/** Very important comment. */
goog.provide('foo');
goog.provide('foo.test');
goog.require('goog.dom');
goog.require('goog.events.EventType');
function foo() {
// Set bar to seventeen to increase performance.
this.bar = 17;
}
"""
_TEST_COMMENT_SOURCE = """// Fake copyright notice
goog.provide('foo');
/*
goog.provide('foo.test');
*/
/*
goog.require('goog.dom');
*/
// goog.require('goog.dom');
goog.require('goog.events.EventType');
function bar() {
this.baz = 55;
}
"""
_TEST_BASE_SOURCE = """
/**
* @fileoverview The base file.
* @provideGoog
*/
var goog = goog || {};
"""
_TEST_BAD_BASE_SOURCE = """
/**
* @fileoverview The base file.
* @provideGoog
*/
goog.provide('goog');
"""
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,78 @@
#!/usr/bin/env python
#
# Copyright 2010 The Closure Library Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Shared utility functions for scanning directory trees."""
import os
import re
__author__ = 'nnaze@google.com (Nathan Naze)'
# Matches a .js file path.
_JS_FILE_REGEX = re.compile(r'^.+\.js$')
def ScanTreeForJsFiles(root):
"""Scans a directory tree for JavaScript files.
Args:
root: str, Path to a root directory.
Returns:
An iterable of paths to JS files, relative to cwd.
"""
return ScanTree(root, path_filter=_JS_FILE_REGEX)
def ScanTree(root, path_filter=None, ignore_hidden=True):
"""Scans a directory tree for files.
Args:
root: str, Path to a root directory.
path_filter: A regular expression filter. If set, only paths matching
the path_filter are returned.
ignore_hidden: If True, do not follow or return hidden directories or files
(those starting with a '.' character).
Yields:
A string path to files, relative to cwd.
"""
def OnError(os_error):
raise os_error
for dirpath, dirnames, filenames in os.walk(root, onerror=OnError):
# os.walk allows us to modify dirnames to prevent decent into particular
# directories. Avoid hidden directories.
for dirname in dirnames:
if ignore_hidden and dirname.startswith('.'):
dirnames.remove(dirname)
for filename in filenames:
# nothing that starts with '.'
if ignore_hidden and filename.startswith('.'):
continue
fullpath = os.path.join(dirpath, filename)
if path_filter and not path_filter.match(fullpath):
continue
yield os.path.normpath(fullpath)

View File

@@ -0,0 +1,590 @@
#!/usr/bin/env python
#
# Copyright 2006 The Closure Library Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Calculates JavaScript dependencies without requiring Google's build system.
This tool is deprecated and is provided for legacy users.
See build/closurebuilder.py and build/depswriter.py for the current tools.
It iterates over a number of search paths and builds a dependency tree. With
the inputs provided, it walks the dependency tree and outputs all the files
required for compilation.
"""
try:
import distutils.version
except ImportError:
# distutils is not available in all environments
distutils = None
import logging
import optparse
import os
import re
import subprocess
import sys
_BASE_REGEX_STRING = '^\s*goog\.%s\(\s*[\'"](.+)[\'"]\s*\)'
req_regex = re.compile(_BASE_REGEX_STRING % 'require')
prov_regex = re.compile(_BASE_REGEX_STRING % 'provide')
ns_regex = re.compile('^ns:((\w+\.)*(\w+))$')
version_regex = re.compile('[\.0-9]+')
def IsValidFile(ref):
"""Returns true if the provided reference is a file and exists."""
return os.path.isfile(ref)
def IsJsFile(ref):
"""Returns true if the provided reference is a Javascript file."""
return ref.endswith('.js')
def IsNamespace(ref):
"""Returns true if the provided reference is a namespace."""
return re.match(ns_regex, ref) is not None
def IsDirectory(ref):
"""Returns true if the provided reference is a directory."""
return os.path.isdir(ref)
def ExpandDirectories(refs):
"""Expands any directory references into inputs.
Description:
Looks for any directories in the provided references. Found directories
are recursively searched for .js files, which are then added to the result
list.
Args:
refs: a list of references such as files, directories, and namespaces
Returns:
A list of references with directories removed and replaced by any
.js files that are found in them. Also, the paths will be normalized.
"""
result = []
for ref in refs:
if IsDirectory(ref):
# Disable 'Unused variable' for subdirs
# pylint: disable=unused-variable
for (directory, subdirs, filenames) in os.walk(ref):
for filename in filenames:
if IsJsFile(filename):
result.append(os.path.join(directory, filename))
else:
result.append(ref)
return map(os.path.normpath, result)
class DependencyInfo(object):
"""Represents a dependency that is used to build and walk a tree."""
def __init__(self, filename):
self.filename = filename
self.provides = []
self.requires = []
def __str__(self):
return '%s Provides: %s Requires: %s' % (self.filename,
repr(self.provides),
repr(self.requires))
def BuildDependenciesFromFiles(files):
"""Build a list of dependencies from a list of files.
Description:
Takes a list of files, extracts their provides and requires, and builds
out a list of dependency objects.
Args:
files: a list of files to be parsed for goog.provides and goog.requires.
Returns:
A list of dependency objects, one for each file in the files argument.
"""
result = []
filenames = set()
for filename in files:
if filename in filenames:
continue
# Python 3 requires the file encoding to be specified
if (sys.version_info[0] < 3):
file_handle = open(filename, 'r')
else:
file_handle = open(filename, 'r', encoding='utf8')
try:
dep = CreateDependencyInfo(filename, file_handle)
result.append(dep)
finally:
file_handle.close()
filenames.add(filename)
return result
def CreateDependencyInfo(filename, source):
"""Create dependency info.
Args:
filename: Filename for source.
source: File-like object containing source.
Returns:
A DependencyInfo object with provides and requires filled.
"""
dep = DependencyInfo(filename)
for line in source:
if re.match(req_regex, line):
dep.requires.append(re.search(req_regex, line).group(1))
if re.match(prov_regex, line):
dep.provides.append(re.search(prov_regex, line).group(1))
return dep
def BuildDependencyHashFromDependencies(deps):
"""Builds a hash for searching dependencies by the namespaces they provide.
Description:
Dependency objects can provide multiple namespaces. This method enumerates
the provides of each dependency and adds them to a hash that can be used
to easily resolve a given dependency by a namespace it provides.
Args:
deps: a list of dependency objects used to build the hash.
Raises:
Exception: If a multiple files try to provide the same namepace.
Returns:
A hash table { namespace: dependency } that can be used to resolve a
dependency by a namespace it provides.
"""
dep_hash = {}
for dep in deps:
for provide in dep.provides:
if provide in dep_hash:
raise Exception('Duplicate provide (%s) in (%s, %s)' % (
provide,
dep_hash[provide].filename,
dep.filename))
dep_hash[provide] = dep
return dep_hash
def CalculateDependencies(paths, inputs):
"""Calculates the dependencies for given inputs.
Description:
This method takes a list of paths (files, directories) and builds a
searchable data structure based on the namespaces that each .js file
provides. It then parses through each input, resolving dependencies
against this data structure. The final output is a list of files,
including the inputs, that represent all of the code that is needed to
compile the given inputs.
Args:
paths: the references (files, directories) that are used to build the
dependency hash.
inputs: the inputs (files, directories, namespaces) that have dependencies
that need to be calculated.
Raises:
Exception: if a provided input is invalid.
Returns:
A list of all files, including inputs, that are needed to compile the given
inputs.
"""
deps = BuildDependenciesFromFiles(paths + inputs)
search_hash = BuildDependencyHashFromDependencies(deps)
result_list = []
seen_list = []
for input_file in inputs:
if IsNamespace(input_file):
namespace = re.search(ns_regex, input_file).group(1)
if namespace not in search_hash:
raise Exception('Invalid namespace (%s)' % namespace)
input_file = search_hash[namespace].filename
if not IsValidFile(input_file) or not IsJsFile(input_file):
raise Exception('Invalid file (%s)' % input_file)
seen_list.append(input_file)
file_handle = open(input_file, 'r')
try:
for line in file_handle:
if re.match(req_regex, line):
require = re.search(req_regex, line).group(1)
ResolveDependencies(require, search_hash, result_list, seen_list)
finally:
file_handle.close()
result_list.append(input_file)
# All files depend on base.js, so put it first.
base_js_path = FindClosureBasePath(paths)
if base_js_path:
result_list.insert(0, base_js_path)
else:
logging.warning('Closure Library base.js not found.')
return result_list
def FindClosureBasePath(paths):
"""Given a list of file paths, return Closure base.js path, if any.
Args:
paths: A list of paths.
Returns:
The path to Closure's base.js file including filename, if found.
"""
for path in paths:
pathname, filename = os.path.split(path)
if filename == 'base.js':
f = open(path)
is_base = False
# Sanity check that this is the Closure base file. Check that this
# is where goog is defined. This is determined by the @provideGoog
# flag.
for line in f:
if '@provideGoog' in line:
is_base = True
break
f.close()
if is_base:
return path
def ResolveDependencies(require, search_hash, result_list, seen_list):
"""Takes a given requirement and resolves all of the dependencies for it.
Description:
A given requirement may require other dependencies. This method
recursively resolves all dependencies for the given requirement.
Raises:
Exception: when require does not exist in the search_hash.
Args:
require: the namespace to resolve dependencies for.
search_hash: the data structure used for resolving dependencies.
result_list: a list of filenames that have been calculated as dependencies.
This variable is the output for this function.
seen_list: a list of filenames that have been 'seen'. This is required
for the dependency->dependant ordering.
"""
if require not in search_hash:
raise Exception('Missing provider for (%s)' % require)
dep = search_hash[require]
if not dep.filename in seen_list:
seen_list.append(dep.filename)
for sub_require in dep.requires:
ResolveDependencies(sub_require, search_hash, result_list, seen_list)
result_list.append(dep.filename)
def GetDepsLine(dep, base_path):
"""Returns a JS string for a dependency statement in the deps.js file.
Args:
dep: The dependency that we're printing.
base_path: The path to Closure's base.js including filename.
"""
return 'goog.addDependency("%s", %s, %s);' % (
GetRelpath(dep.filename, base_path), dep.provides, dep.requires)
def GetRelpath(path, start):
"""Return a relative path to |path| from |start|."""
# NOTE: Python 2.6 provides os.path.relpath, which has almost the same
# functionality as this function. Since we want to support 2.4, we have
# to implement it manually. :(
path_list = os.path.abspath(os.path.normpath(path)).split(os.sep)
start_list = os.path.abspath(
os.path.normpath(os.path.dirname(start))).split(os.sep)
common_prefix_count = 0
for i in range(0, min(len(path_list), len(start_list))):
if path_list[i] != start_list[i]:
break
common_prefix_count += 1
# Always use forward slashes, because this will get expanded to a url,
# not a file path.
return '/'.join(['..'] * (len(start_list) - common_prefix_count) +
path_list[common_prefix_count:])
def PrintLine(msg, out):
out.write(msg)
out.write('\n')
def PrintDeps(source_paths, deps, out):
"""Print out a deps.js file from a list of source paths.
Args:
source_paths: Paths that we should generate dependency info for.
deps: Paths that provide dependency info. Their dependency info should
not appear in the deps file.
out: The output file.
Returns:
True on success, false if it was unable to find the base path
to generate deps relative to.
"""
base_path = FindClosureBasePath(source_paths + deps)
if not base_path:
return False
PrintLine('// This file was autogenerated by calcdeps.py', out)
excludesSet = set(deps)
for dep in BuildDependenciesFromFiles(source_paths + deps):
if not dep.filename in excludesSet:
PrintLine(GetDepsLine(dep, base_path), out)
return True
def PrintScript(source_paths, out):
for index, dep in enumerate(source_paths):
PrintLine('// Input %d' % index, out)
f = open(dep, 'r')
PrintLine(f.read(), out)
f.close()
def GetJavaVersion():
"""Returns the string for the current version of Java installed."""
proc = subprocess.Popen(['java', '-version'], stderr=subprocess.PIPE)
proc.wait()
version_line = proc.stderr.read().splitlines()[0]
return version_regex.search(version_line).group()
def FilterByExcludes(options, files):
"""Filters the given files by the exlusions specified at the command line.
Args:
options: The flags to calcdeps.
files: The files to filter.
Returns:
A list of files.
"""
excludes = []
if options.excludes:
excludes = ExpandDirectories(options.excludes)
excludesSet = set(excludes)
return [i for i in files if not i in excludesSet]
def GetPathsFromOptions(options):
"""Generates the path files from flag options.
Args:
options: The flags to calcdeps.
Returns:
A list of files in the specified paths. (strings).
"""
search_paths = options.paths
if not search_paths:
search_paths = ['.'] # Add default folder if no path is specified.
search_paths = ExpandDirectories(search_paths)
return FilterByExcludes(options, search_paths)
def GetInputsFromOptions(options):
"""Generates the inputs from flag options.
Args:
options: The flags to calcdeps.
Returns:
A list of inputs (strings).
"""
inputs = options.inputs
if not inputs: # Parse stdin
logging.info('No inputs specified. Reading from stdin...')
inputs = filter(None, [line.strip('\n') for line in sys.stdin.readlines()])
logging.info('Scanning files...')
inputs = ExpandDirectories(inputs)
return FilterByExcludes(options, inputs)
def Compile(compiler_jar_path, source_paths, out, flags=None):
"""Prepares command-line call to Closure compiler.
Args:
compiler_jar_path: Path to the Closure compiler .jar file.
source_paths: Source paths to build, in order.
flags: A list of additional flags to pass on to Closure compiler.
"""
args = ['java', '-jar', compiler_jar_path]
for path in source_paths:
args += ['--js', path]
if flags:
args += flags
logging.info('Compiling with the following command: %s', ' '.join(args))
proc = subprocess.Popen(args, stdout=subprocess.PIPE)
(stdoutdata, stderrdata) = proc.communicate()
if proc.returncode != 0:
logging.error('JavaScript compilation failed.')
sys.exit(1)
else:
out.write(stdoutdata)
def main():
"""The entrypoint for this script."""
logging.basicConfig(format='calcdeps.py: %(message)s', level=logging.INFO)
usage = 'usage: %prog [options] arg'
parser = optparse.OptionParser(usage)
parser.add_option('-i',
'--input',
dest='inputs',
action='append',
help='The inputs to calculate dependencies for. Valid '
'values can be files, directories, or namespaces '
'(ns:goog.net.XhrIo). Only relevant to "list" and '
'"script" output.')
parser.add_option('-p',
'--path',
dest='paths',
action='append',
help='The paths that should be traversed to build the '
'dependencies.')
parser.add_option('-d',
'--dep',
dest='deps',
action='append',
help='Directories or files that should be traversed to '
'find required dependencies for the deps file. '
'Does not generate dependency information for names '
'provided by these files. Only useful in "deps" mode.')
parser.add_option('-e',
'--exclude',
dest='excludes',
action='append',
help='Files or directories to exclude from the --path '
'and --input flags')
parser.add_option('-o',
'--output_mode',
dest='output_mode',
action='store',
default='list',
help='The type of output to generate from this script. '
'Options are "list" for a list of filenames, "script" '
'for a single script containing the contents of all the '
'file, "deps" to generate a deps.js file for all '
'paths, or "compiled" to produce compiled output with '
'the Closure compiler.')
parser.add_option('-c',
'--compiler_jar',
dest='compiler_jar',
action='store',
help='The location of the Closure compiler .jar file.')
parser.add_option('-f',
'--compiler_flag',
'--compiler_flags', # for backwards compatability
dest='compiler_flags',
action='append',
help='Additional flag to pass to the Closure compiler. '
'May be specified multiple times to pass multiple flags.')
parser.add_option('--output_file',
dest='output_file',
action='store',
help=('If specified, write output to this path instead of '
'writing to standard output.'))
(options, args) = parser.parse_args()
search_paths = GetPathsFromOptions(options)
if options.output_file:
out = open(options.output_file, 'w')
else:
out = sys.stdout
if options.output_mode == 'deps':
result = PrintDeps(search_paths, ExpandDirectories(options.deps or []), out)
if not result:
logging.error('Could not find Closure Library in the specified paths')
sys.exit(1)
return
inputs = GetInputsFromOptions(options)
logging.info('Finding Closure dependencies...')
deps = CalculateDependencies(search_paths, inputs)
output_mode = options.output_mode
if output_mode == 'script':
PrintScript(deps, out)
elif output_mode == 'list':
# Just print out a dep per line
for dep in deps:
PrintLine(dep, out)
elif output_mode == 'compiled':
# Make sure a .jar is specified.
if not options.compiler_jar:
logging.error('--compiler_jar flag must be specified if --output is '
'"compiled"')
sys.exit(1)
# User friendly version check.
if distutils and not (distutils.version.LooseVersion(GetJavaVersion()) >
distutils.version.LooseVersion('1.6')):
logging.error('Closure Compiler requires Java 1.6 or higher.')
logging.error('Please visit http://www.java.com/getjava')
sys.exit(1)
Compile(options.compiler_jar, deps, out, options.compiler_flags)
else:
logging.error('Invalid value for --output flag.')
sys.exit(1)
if __name__ == '__main__':
main()

View File

@@ -0,0 +1,39 @@
;; Copyright 2013 The Closure Library Authors. All Rights Reserved.
;;
;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
;; You may obtain a copy of the License at
;;
;; http://www.apache.org/licenses/LICENSE-2.0
;;
;; Unless required `by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS-IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.
;; Closure JS code editing functions for emacs.
;; Author: nnaze@google.com (Nathan Naze)
;; Remember the path of this file, as we will base our paths on it.
(setq closure-el-path load-file-name)
(defun closure-el-directory ()
"Get the directory the closure.el file lives in."
(file-name-directory closure-el-path))
(defun closure-generate-jsdoc-path()
"The path of the generate_jsdoc.py script."
(concat (closure-el-directory) "generate_jsdoc.py"))
(defun closure-insert-jsdoc ()
"Insert JSDoc for the next function after the cursor."
(interactive)
(save-excursion ; Remembers cursor location
(call-process-region
(point) (point-max)
(closure-generate-jsdoc-path)
t t)))
(provide 'closure)

View File

@@ -0,0 +1,31 @@
;; Copyright 2013 The Closure Library Authors. All Rights Reserved.
;;
;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
;; You may obtain a copy of the License at
;;
;; http://www.apache.org/licenses/LICENSE-2.0
;;
;; Unless required `by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS-IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.
;; Unit tests for closure_test.el
;; Author: nnaze@google.com (Nathan Naze)
(require 'cl)
(setq closure-test-directory (file-name-directory load-file-name))
(load-file (concat closure-test-directory "closure.el"))
(setq closure-el-path "/test/path/closure.el")
(assert (string= "/test/path/" (closure-el-directory)))
(assert (string=
"/test/path/generate_jsdoc.py"
(closure-generate-jsdoc-path)))

View File

@@ -0,0 +1,171 @@
#!/usr/bin/env python
#
# Copyright 2013 The Closure Library Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tool to insert JsDoc before a function.
This script attempts to find the first function passed in to stdin, generate
JSDoc for it (with argument names and possibly return value), and inject
it in the string. This is intended to be used as a subprocess by editors
such as emacs and vi.
"""
import re
import sys
# Matches a typical Closure-style function definition.
_FUNCTION_REGEX = re.compile(r"""
# Start of line
^
# Indentation
(?P<indentation>[ ]*)
# Identifier (handling split across line)
(?P<identifier>\w+(\s*\.\s*\w+)*)
# "= function"
\s* = \s* function \s*
# opening paren
\(
# Function arguments
(?P<arguments>(?:\s|\w+|,)*)
# closing paren
\)
# opening bracket
\s* {
""", re.MULTILINE | re.VERBOSE)
def _MatchFirstFunction(script):
"""Match the first function seen in the script."""
return _FUNCTION_REGEX.search(script)
def _ParseArgString(arg_string):
"""Parse an argument string (inside parens) into parameter names."""
for arg in arg_string.split(','):
arg = arg.strip()
if arg:
yield arg
def _ExtractFunctionBody(script, indentation=0):
"""Attempt to return the function body."""
# Real extraction would require a token parser and state machines.
# We look for first bracket at the same level of indentation.
regex_str = r'{(.*?)^[ ]{%d}}' % indentation
function_regex = re.compile(regex_str, re.MULTILINE | re.DOTALL)
match = function_regex.search(script)
if match:
return match.group(1)
def _ContainsReturnValue(function_body):
"""Attempt to determine if the function body returns a value."""
return_regex = re.compile(r'\breturn\b[^;]')
# If this matches, we assume they're returning something.
return bool(return_regex.search(function_body))
def _InsertString(original_string, inserted_string, index):
"""Insert a string into another string at a given index."""
return original_string[0:index] + inserted_string + original_string[index:]
def _GenerateJsDoc(args, return_val=False):
"""Generate JSDoc for a function.
Args:
args: A list of names of the argument.
return_val: Whether the function has a return value.
Returns:
The JSDoc as a string.
"""
lines = []
lines.append('/**')
lines += [' * @param {} %s' % arg for arg in args]
if return_val:
lines.append(' * @return')
lines.append(' */')
return '\n'.join(lines) + '\n'
def _IndentString(source_string, indentation):
"""Indent string some number of characters."""
lines = [(indentation * ' ') + line
for line in source_string.splitlines(True)]
return ''.join(lines)
def InsertJsDoc(script):
"""Attempt to insert JSDoc for the first seen function in the script.
Args:
script: The script, as a string.
Returns:
Returns the new string if function was found and JSDoc inserted. Otherwise
returns None.
"""
match = _MatchFirstFunction(script)
if not match:
return
# Add argument flags.
args_string = match.group('arguments')
args = _ParseArgString(args_string)
start_index = match.start(0)
function_to_end = script[start_index:]
lvalue_indentation = len(match.group('indentation'))
return_val = False
function_body = _ExtractFunctionBody(function_to_end, lvalue_indentation)
if function_body:
return_val = _ContainsReturnValue(function_body)
jsdoc = _GenerateJsDoc(args, return_val)
if lvalue_indentation:
jsdoc = _IndentString(jsdoc, lvalue_indentation)
return _InsertString(script, jsdoc, start_index)
if __name__ == '__main__':
stdin_script = sys.stdin.read()
result = InsertJsDoc(stdin_script)
if result:
sys.stdout.write(result)
else:
sys.stdout.write(stdin_script)

View File

@@ -0,0 +1,167 @@
#!/usr/bin/env python
#
# Copyright 2013 The Closure Library Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required `by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Unit test for generate_jsdoc."""
__author__ = 'nnaze@google.com (Nathan Naze)'
import re
import unittest
import generate_jsdoc
class InsertJsDocTestCase(unittest.TestCase):
"""Unit test for source. Tests the parser on a known source input."""
def testMatchFirstFunction(self):
match = generate_jsdoc._MatchFirstFunction(_TEST_SOURCE)
self.assertNotEqual(None, match)
self.assertEqual('aaa, bbb, ccc', match.group('arguments'))
match = generate_jsdoc._MatchFirstFunction(_INDENTED_SOURCE)
self.assertNotEqual(None, match)
self.assertEqual('', match.group('arguments'))
match = generate_jsdoc._MatchFirstFunction(_ODD_NEWLINES_SOURCE)
self.assertEquals('goog.\nfoo.\nbar\n.baz.\nqux',
match.group('identifier'))
def testParseArgString(self):
self.assertEquals(
['foo', 'bar', 'baz'],
list(generate_jsdoc._ParseArgString('foo, bar, baz')))
def testExtractFunctionBody(self):
self.assertEquals(
'\n // Function comments.\n return;\n',
generate_jsdoc._ExtractFunctionBody(_TEST_SOURCE))
self.assertEquals(
'\n var bar = 3;\n return true;\n',
generate_jsdoc._ExtractFunctionBody(_INDENTED_SOURCE, 2))
def testContainsValueReturn(self):
self.assertTrue(generate_jsdoc._ContainsReturnValue(_INDENTED_SOURCE))
self.assertFalse(generate_jsdoc._ContainsReturnValue(_TEST_SOURCE))
def testInsertString(self):
self.assertEquals(
'abc123def',
generate_jsdoc._InsertString('abcdef', '123', 3))
def testInsertJsDoc(self):
self.assertEquals(
_EXPECTED_INDENTED_SOURCE,
generate_jsdoc.InsertJsDoc(_INDENTED_SOURCE))
self.assertEquals(
_EXPECTED_TEST_SOURCE,
generate_jsdoc.InsertJsDoc(_TEST_SOURCE))
self.assertEquals(
_EXPECTED_ODD_NEWLINES_SOURCE,
generate_jsdoc.InsertJsDoc(_ODD_NEWLINES_SOURCE))
_INDENTED_SOURCE = """\
boo.foo.woo = function() {
var bar = 3;
return true;
};
"""
_EXPECTED_INDENTED_SOURCE = """\
/**
* @return
*/
boo.foo.woo = function() {
var bar = 3;
return true;
};
"""
_TEST_SOURCE = """\
// Random comment.
goog.foo.bar = function (aaa, bbb, ccc) {
// Function comments.
return;
};
"""
_EXPECTED_TEST_SOURCE = """\
// Random comment.
/**
* @param {} aaa
* @param {} bbb
* @param {} ccc
*/
goog.foo.bar = function (aaa, bbb, ccc) {
// Function comments.
return;
};
"""
_ODD_NEWLINES_SOURCE = """\
goog.
foo.
bar
.baz.
qux
=
function
(aaa,
bbb, ccc) {
// Function comments.
return;
};
"""
_EXPECTED_ODD_NEWLINES_SOURCE = """\
/**
* @param {} aaa
* @param {} bbb
* @param {} ccc
*/
goog.
foo.
bar
.baz.
qux
=
function
(aaa,
bbb, ccc) {
// Function comments.
return;
};
"""
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,31 @@
#!/bin/bash
#
# Copyright 2013 The Closure Library Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Wraps the unit tests not using the Google framework so they may be run
# on the continuous build.
#
# Author: nnaze@google.com (Nathan Naze)
#
# Wraps the unit tests not using the Google framework so they may be run
# run on the continuous build.
set -e
source googletest.sh || exit 1
CLOSURE_SRCDIR=$TEST_SRCDIR/google3/javascript/closure/labs/bin/code/
emacs --script $CLOSURE_SRCDIR/closure_test.el

View File

@@ -0,0 +1,28 @@
#!/bin/bash
#
# Copyright 2013 The Closure Library Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Wraps the unit tests not using the Google framework so they may be run
# on the continuous build.
set -e
source googletest.sh || exit 1
CLOSURE_SRCDIR=$TEST_SRCDIR/google3/javascript/closure/labs/bin/code/
PYTHONPATH=$CLOSURE_SRCDIR
$CLOSURE_SRCDIR/generate_jsdoc_test.py

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!--
Copyright 2013 The Closure Library Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 9 9">
<title>Closure Logo</title>
<path d="M2,2 h2 a2,2 0 1 0 -2,2 z" fill="#0066CF" />
<path d="M7,2 h-2 a2,2 0 1 1 2,2 z" fill="#FD0100" />
<path d="M2,7 h2 a2,2 0 1 1 -2,-2 z" fill="#FEC502" />
<path d="M7,7 h-2 a2,2 0 1 0 2,-2 z" fill="#009338" />
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!--
Copyright 2013 The Closure Library Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 200 250">
<image x="0" y="0" width="200" height="200" xlink:href="logo.svg" />
<text text-anchor="middle" x="100" y="245" font-family="Helvetica"
font-size="53" font-weight="bold">Closure</text>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -0,0 +1,221 @@
#!/usr/bin/python
#
# Copyright 2010 The Closure Library Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Automatically converts codebases over to goog.scope.
Usage:
cd path/to/my/dir;
../../../../javascript/closure/bin/scopify.py
Scans every file in this directory, recursively. Looks for existing
goog.scope calls, and goog.require'd symbols. If it makes sense to
generate a goog.scope call for the file, then we will do so, and
try to auto-generate some aliases based on the goog.require'd symbols.
Known Issues:
When a file is goog.scope'd, the file contents will be indented +2.
This may put some lines over 80 chars. These will need to be fixed manually.
We will only try to create aliases for capitalized names. We do not check
to see if those names will conflict with any existing locals.
This creates merge conflicts for every line of every outstanding change.
If you intend to run this on your codebase, make sure your team members
know. Better yet, send them this script so that they can scopify their
outstanding changes and "accept theirs".
When an alias is "captured", it can no longer be stubbed out for testing.
Run your tests.
"""
__author__ = 'nicksantos@google.com (Nick Santos)'
import os.path
import re
import sys
REQUIRES_RE = re.compile(r"goog.require\('([^']*)'\)")
# Edit this manually if you want something to "always" be aliased.
# TODO(nicksantos): Add a flag for this.
DEFAULT_ALIASES = {}
def Transform(lines):
"""Converts the contents of a file into javascript that uses goog.scope.
Arguments:
lines: A list of strings, corresponding to each line of the file.
Returns:
A new list of strings, or None if the file was not modified.
"""
requires = []
# Do an initial scan to be sure that this file can be processed.
for line in lines:
# Skip this file if it has already been scopified.
if line.find('goog.scope') != -1:
return None
# If there are any global vars or functions, then we also have
# to skip the whole file. We might be able to deal with this
# more elegantly.
if line.find('var ') == 0 or line.find('function ') == 0:
return None
for match in REQUIRES_RE.finditer(line):
requires.append(match.group(1))
if len(requires) == 0:
return None
# Backwards-sort the requires, so that when one is a substring of another,
# we match the longer one first.
for val in DEFAULT_ALIASES.values():
if requires.count(val) == 0:
requires.append(val)
requires.sort()
requires.reverse()
# Generate a map of requires to their aliases
aliases_to_globals = DEFAULT_ALIASES.copy()
for req in requires:
index = req.rfind('.')
if index == -1:
alias = req
else:
alias = req[(index + 1):]
# Don't scopify lowercase namespaces, because they may conflict with
# local variables.
if alias[0].isupper():
aliases_to_globals[alias] = req
aliases_to_matchers = {}
globals_to_aliases = {}
for alias, symbol in aliases_to_globals.items():
globals_to_aliases[symbol] = alias
aliases_to_matchers[alias] = re.compile('\\b%s\\b' % symbol)
# Insert a goog.scope that aliases all required symbols.
result = []
START = 0
SEEN_REQUIRES = 1
IN_SCOPE = 2
mode = START
aliases_used = set()
insertion_index = None
num_blank_lines = 0
for line in lines:
if mode == START:
result.append(line)
if re.search(REQUIRES_RE, line):
mode = SEEN_REQUIRES
elif mode == SEEN_REQUIRES:
if (line and
not re.search(REQUIRES_RE, line) and
not line.isspace()):
# There should be two blank lines before goog.scope
result += ['\n'] * 2
result.append('goog.scope(function() {\n')
insertion_index = len(result)
result += ['\n'] * num_blank_lines
mode = IN_SCOPE
elif line.isspace():
# Keep track of the number of blank lines before each block of code so
# that we can move them after the goog.scope line if necessary.
num_blank_lines += 1
else:
# Print the blank lines we saw before this code block
result += ['\n'] * num_blank_lines
num_blank_lines = 0
result.append(line)
if mode == IN_SCOPE:
for symbol in requires:
if not symbol in globals_to_aliases:
continue
alias = globals_to_aliases[symbol]
matcher = aliases_to_matchers[alias]
for match in matcher.finditer(line):
# Check to make sure we're not in a string.
# We do this by being as conservative as possible:
# if there are any quote or double quote characters
# before the symbol on this line, then bail out.
before_symbol = line[:match.start(0)]
if before_symbol.count('"') > 0 or before_symbol.count("'") > 0:
continue
line = line.replace(match.group(0), alias)
aliases_used.add(alias)
if line.isspace():
# Truncate all-whitespace lines
result.append('\n')
else:
result.append(line)
if len(aliases_used):
aliases_used = [alias for alias in aliases_used]
aliases_used.sort()
aliases_used.reverse()
for alias in aliases_used:
symbol = aliases_to_globals[alias]
result.insert(insertion_index,
'var %s = %s;\n' % (alias, symbol))
result.append('}); // goog.scope\n')
return result
else:
return None
def TransformFileAt(path):
"""Converts a file into javascript that uses goog.scope.
Arguments:
path: A path to a file.
"""
f = open(path)
lines = Transform(f.readlines())
if lines:
f = open(path, 'w')
for l in lines:
f.write(l)
f.close()
if __name__ == '__main__':
args = sys.argv[1:]
if not len(args):
args = '.'
for file_name in args:
if os.path.isdir(file_name):
for root, dirs, files in os.walk(file_name):
for name in files:
if name.endswith('.js') and \
not os.path.islink(os.path.join(root, name)):
TransformFileAt(os.path.join(root, name))
else:
if file_name.endswith('.js') and \
not os.path.islink(file_name):
TransformFileAt(file_name)

View File

@@ -0,0 +1,82 @@
/*
* Copyright 2007 The Closure Library Authors. All Rights Reserved.
*
* Use of this source code is governed by the Apache License, Version 2.0.
* See the COPYING file for details.
*/
/**
* CSS Inlay
* This is the minimum CSS required to use the markup/classname patterns.
* @author elsigh@google.com (Lindsey Simon)
* @author ddiaz@google.com (Dustin Diaz)
*/
/**
* Document container designed for fluid width scaling.
* Alternative g-doc- fixed-width classes are in gui-fixed.css.
*/
.g-doc {
width: 100%;
text-align: left;
}
/**
* g-section fundamentally has to clear floats. There are many ways to do this.
* This technique is nice because it doesn't rely on overflow: hidden, which
* has the potential to hide your content in situations where a fixed size
* node takes up too much space (like a big table, or a text input or image.
* Works in Webkit, IE8, and FF3.
*/
.g-section {
width: 100%;
vertical-align: top;
display: inline-block;
}
/**
* IE7-only hack. Nicely IE7 will clear floats with just block display
* and hasLayout.
*/
*:first-child+html .g-section {
display: block;
}
/**
* IE6 cannot hang with overflow: visible. If we use the IE7 display block
* trick in IE6 we get severe float drop in nested grids.
*/
* html .g-section {
overflow: hidden;
}
/* FF2 can't actually hang with overflow: visible. */
@-moz-document url-prefix() {
.g-section {
overflow: hidden;
}
}
/**
* FF3 now needs to be reset after the previous block which affects it as well.
* We target the tt element in this hack because no one uses it.
*/
@-moz-document url-prefix() {
.g-section,tt:default {
overflow: visible;
}
}
/* Forces "hasLayout" fixing a gamut of bugs in <= IE7. */
.g-section,
.g-unit {
zoom: 1;
}
/* Used for splitting a template's units text-alignment to the outer edges. */
.g-split .g-unit {
text-align: right;
}
.g-split .g-first {
text-align: left;
}

View File

@@ -0,0 +1,173 @@
/*
* Copyright 2007 The Closure Library Authors. All Rights Reserved.
*
* Use of this source code is governed by the Apache License, Version 2.0.
* See the COPYING file for details.
*/
/**
* CSS Inlay
* Fixed templates
* @author ddiaz@google.com (Dustin Diaz)
* @author elsigh@google.com (Lindsey Simon)
* @fileoverview
* The nature of these templates is to have one unit be a fixed width
* and the supplementary unit to take up the rest of the width
* of its parents' container.
*
* Sample Usage:
<div class="g-section g-tpl-180">
<div class="g-unit g-first">
<p>
Lorem Ipsum...
</p>
</div>
<div class="g-unit">
<p>
Lorem Ipsum...
</p>
</div>
</div>
*/
/* Document container designed for 1024x768 */
/* TODO(ux-webdev): convert this to a straight px value - em assumes reset. */
.g-doc-1024 {
width: 73.074em;
min-width: 950px; /* min-width doesn't work in IE6 */
margin: 0 auto;
text-align: left;
}
/* IE 6 */
* html .g-doc-1024 {
width: 71.313em;
}
/* IE 7 */
*+html .g-doc-1024 {
width: 71.313em;
}
/* Document container designed for 800x600 */
/* TODO(ux-webdev): convert this to a straight px value - em assumes reset. */
.g-doc-800 {
width: 57.69em;
min-width: 750px; /* min-width doesn't work in IE6 */
margin: 0 auto;
text-align: left;
}
/* IE 6 */
* html .g-doc-800 {
width: 56.3em;
}
/* IE 7 */
*+html .g-doc-800 {
width: 56.3em;
}
/* 160px */
.g-tpl-160 .g-unit,
.g-unit .g-tpl-160 .g-unit,
.g-unit .g-unit .g-tpl-160 .g-unit,
.g-unit .g-unit .g-unit .g-tpl-160 .g-unit {
margin: 0 0 0 160px;
width: auto;
float: none;
}
.g-unit .g-unit .g-unit .g-tpl-160 .g-first,
.g-unit .g-unit .g-tpl-160 .g-first,
.g-unit .g-tpl-160 .g-first,
.g-tpl-160 .g-first {
margin: 0;
width: 160px;
float: left;
}
/* 160px alt */
.g-tpl-160-alt .g-unit,
.g-unit .g-tpl-160-alt .g-unit,
.g-unit .g-unit .g-tpl-160-alt .g-unit,
.g-unit .g-unit .g-unit .g-tpl-160-alt .g-unit {
margin: 0 160px 0 0;
width: auto;
float: none;
}
.g-unit .g-unit .g-unit .g-tpl-160-alt .g-first,
.g-unit .g-unit .g-tpl-160-alt .g-first,
.g-unit .g-tpl-160-alt .g-first,
.g-tpl-160-alt .g-first {
margin: 0;
width: 160px;
float: right;
}
/* 180px */
.g-tpl-180 .g-unit,
.g-unit .g-tpl-180 .g-unit,
.g-unit .g-unit .g-tpl-180 .g-unit,
.g-unit .g-unit .g-unit .g-tpl-180 .g-unit {
margin: 0 0 0 180px;
width: auto;
float: none;
}
.g-unit .g-unit .g-unit .g-tpl-180 .g-first,
.g-unit .g-unit .g-tpl-180 .g-first,
.g-unit .g-tpl-180 .g-first,
.g-tpl-180 .g-first {
margin: 0;
width: 180px;
float: left;
}
/* 180px alt */
.g-tpl-180-alt .g-unit,
.g-unit .g-tpl-180-alt .g-unit,
.g-unit .g-unit .g-tpl-180-alt .g-unit,
.g-unit .g-unit .g-unit .g-tpl-180-alt .g-unit {
margin: 0 180px 0 0;
width: auto;
float: none;
}
.g-unit .g-unit .g-unit .g-tpl-180-alt .g-first,
.g-unit .g-unit .g-tpl-180-alt .g-first,
.g-unit .g-tpl-180-alt .g-first,
.g-tpl-180-alt .g-first {
margin: 0;
width: 180px;
float: right;
}
/* 300px */
.g-tpl-300 .g-unit,
.g-unit .g-tpl-300 .g-unit,
.g-unit .g-unit .g-tpl-300 .g-unit,
.g-unit .g-unit .g-unit .g-tpl-300 .g-unit {
margin: 0 0 0 300px;
width: auto;
float: none;
}
.g-unit .g-unit .g-unit .g-tpl-300 .g-first,
.g-unit .g-unit .g-tpl-300 .g-first,
.g-unit .g-tpl-300 .g-first,
.g-tpl-300 .g-first {
margin: 0;
width: 300px;
float: left;
}
/* 300px alt */
.g-tpl-300-alt .g-unit,
.g-unit .g-tpl-300-alt .g-unit,
.g-unit .g-unit .g-tpl-300-alt .g-unit,
.g-unit .g-unit .g-unit .g-tpl-300-alt .g-unit {
margin: 0 300px 0 0;
width: auto;
float: none;
}
.g-unit .g-unit .g-unit .g-tpl-300-alt .g-first,
.g-unit .g-unit .g-tpl-300-alt .g-first,
.g-unit .g-tpl-300-alt .g-first,
.g-tpl-300-alt .g-first {
margin: 0;
width: 300px;
float: right;
}

View File

@@ -0,0 +1,253 @@
/*
* Copyright 2007 The Closure Library Authors. All Rights Reserved.
*
* Use of this source code is governed by the Apache License, Version 2.0.
* See the COPYING file for details.
*/
/**
* CSS Inlay
* Percentage based templates
* @author ddiaz@google.com (Dustin Diaz)
* @author elsigh@google.com (Lindsey Simon)
* @fileoverview
* The first ten templates are described using the following convention:
* tpl-LEFT%-RIGHT% and tpl-LEFT%-RIGHT%-alt, where alt switches render order.
*
* The rationale for the percentage values are pretty fascinating.
* Three nine's are needed for a miminal affordance in the gap between units
* for Opera, while two for IE 5.5 and down.
* Straight percentages seem to work fine otherwise, but the values here test
* well cross-browser.
*
* Sample Usage:
<div class="g-section g-tpl-50-50">
<div class="g-unit g-first">
<p>
Lorem Ipsum...
</p>
</div>
<div class="g-unit">
<p>
Lorem Ipsum...
</p>
</div>
</div>
*/
/* 25/75 */
.g-tpl-25-75 .g-unit,
.g-unit .g-tpl-25-75 .g-unit,
.g-unit .g-unit .g-tpl-25-75 .g-unit,
.g-unit .g-unit .g-unit .g-tpl-25-75 .g-unit {
width: 74.999%;
float: right;
margin: 0;
}
.g-unit .g-unit .g-unit .g-tpl-25-75 .g-first,
.g-unit .g-unit .g-tpl-25-75 .g-first,
.g-unit .g-tpl-25-75 .g-first,
.g-tpl-25-75 .g-first {
width: 24.999%;
float: left;
margin: 0;
}
/* 25/75-alt */
.g-tpl-25-75-alt .g-unit,
.g-unit .g-tpl-25-75-alt .g-unit,
.g-unit .g-unit .g-tpl-25-75-alt .g-unit,
.g-unit .g-unit .g-unit .g-tpl-25-75-alt .g-unit {
width: 24.999%;
float: left;
margin: 0;
}
.g-unit .g-unit .g-unit .g-tpl-25-75-alt .g-first,
.g-unit .g-unit .g-tpl-25-75-alt .g-first,
.g-unit .g-tpl-25-75-alt .g-first,
.g-tpl-25-75-alt .g-first {
width: 74.999%;
float: right;
margin: 0;
}
/* 75/25 */
.g-tpl-75-25 .g-unit,
.g-unit .g-tpl-75-25 .g-unit,
.g-unit .g-unit .g-tpl-75-25 .g-unit,
.g-unit .g-unit .g-unit .g-tpl-75-25 .g-unit {
width: 24.999%;
float: right;
margin: 0;
}
.g-unit .g-unit .g-unit .g-tpl-75-25 .g-first,
.g-unit .g-unit .g-tpl-75-25 .g-first,
.g-unit .g-tpl-75-25 .g-first,
.g-tpl-75-25 .g-first {
width: 74.999%;
float: left;
margin: 0;
}
/* 75/25-alt */
.g-tpl-75-25-alt .g-unit,
.g-unit .g-tpl-75-25-alt .g-unit,
.g-unit .g-unit .g-tpl-75-25-alt .g-unit,
.g-unit .g-unit .g-unit .g-tpl-75-25-alt .g-unit {
width: 74.999%;
float: left;
margin: 0;
}
.g-unit .g-unit .g-unit .g-tpl-75-25-alt .g-first,
.g-unit .g-unit .g-tpl-75-25-alt .g-first,
.g-unit .g-tpl-75-25-alt .g-first,
.g-tpl-75-25-alt .g-first {
width: 24.999%;
float: right;
margin: 0;
}
/* 33/67 */
.g-tpl-33-67 .g-unit,
.g-unit .g-tpl-33-67 .g-unit,
.g-unit .g-unit .g-tpl-33-67 .g-unit,
.g-unit .g-unit .g-unit .g-tpl-33-67 .g-unit {
width: 66.999%;
float: right;
margin: 0;
}
.g-unit .g-unit .g-unit .g-tpl-33-67 .g-first,
.g-unit .g-unit .g-tpl-33-67 .g-first,
.g-unit .g-tpl-33-67 .g-first,
.g-tpl-33-67 .g-first {
width: 32.999%;
float: left;
margin: 0;
}
/* 33/67-alt */
.g-tpl-33-67-alt .g-unit,
.g-unit .g-tpl-33-67-alt .g-unit,
.g-unit .g-unit .g-tpl-33-67-alt .g-unit,
.g-unit .g-unit .g-unit .g-tpl-33-67-alt .g-unit {
width: 32.999%;
float: left;
margin: 0;
}
.g-unit .g-unit .g-unit .g-tpl-33-67-alt .g-first,
.g-unit .g-unit .g-tpl-33-67-alt .g-first,
.g-unit .g-tpl-33-67-alt .g-first,
.g-tpl-33-67-alt .g-first {
width: 66.999%;
float: right;
margin: 0;
}
/* 67/33 */
.g-tpl-67-33 .g-unit,
.g-unit .g-tpl-67-33 .g-unit,
.g-unit .g-unit .g-tpl-67-33 .g-unit,
.g-unit .g-unit .g-unit .g-tpl-67-33 .g-unit {
width: 32.999%;
float: right;
margin: 0;
}
.g-unit .g-unit .g-unit .g-tpl-67-33 .g-first,
.g-unit .g-unit .g-tpl-67-33 .g-first,
.g-unit .g-tpl-67-33 .g-first,
.g-tpl-67-33 .g-first {
width: 66.999%;
float: left;
margin: 0;
}
/* 67/33-alt */
.g-tpl-67-33-alt .g-unit,
.g-unit .g-tpl-67-33-alt .g-unit,
.g-unit .g-unit .g-tpl-67-33-alt .g-unit,
.g-unit .g-unit .g-unit .g-tpl-67-33-alt .g-unit {
width: 66.999%;
float: left;
margin: 0;
}
.g-unit .g-unit .g-unit .g-tpl-67-33-alt .g-first,
.g-unit .g-unit .g-tpl-67-33-alt .g-first,
.g-unit .g-tpl-67-33-alt .g-first,
.g-tpl-67-33-alt .g-first {
width: 32.999%;
float: right;
margin: 0;
}
/* 50/50 */
.g-tpl-50-50 .g-unit,
.g-unit .g-tpl-50-50 .g-unit,
.g-unit .g-unit .g-tpl-50-50 .g-unit,
.g-unit .g-unit .g-unit .g-tpl-50-50 .g-unit {
width: 49.999%;
float: right;
margin: 0;
}
.g-unit .g-unit .g-unit .g-tpl-50-50 .g-first,
.g-unit .g-unit .g-tpl-50-50 .g-first,
.g-unit .g-tpl-50-50 .g-first,
.g-tpl-50-50 .g-first {
width: 49.999%;
float: left;
margin: 0;
}
/* 50/50-alt */
.g-tpl-50-50-alt .g-unit,
.g-unit .g-tpl-50-50-alt .g-unit,
.g-unit .g-unit .g-tpl-50-50-alt .g-unit,
.g-unit .g-unit .g-unit .g-tpl-50-50-alt .g-unit {
width: 49.999%;
float: left;
margin: 0;
}
.g-unit .g-unit .g-unit .g-tpl-50-50-alt .g-first,
.g-unit .g-unit .g-tpl-50-50-alt .g-first,
.g-unit .g-tpl-50-50-alt .g-first,
.g-tpl-50-50-alt .g-first {
width: 49.999%;
float: right;
margin: 0;
}
/**
* Nest templates contain floating g-units.
* For these, width needs to be reset from the 100% for inline-block
* to auto. This fixes an issue with horizontal scrollbars.
*/
.g-tpl-nest {
width: auto;
}
/**
* Making any g-sections inside of g-tpl-nests display inline instead
* of display block solves an issue where inner sections add up incrementally
* their widths to set the width of the outer g-unit. This causes all kinds of
* problems with float-drops and display:inline fixes this.
*/
.g-tpl-nest .g-section {
display: inline;
}
/* g-tpl-nest for multi unit nesting (float left), say for a menu. */
.g-tpl-nest .g-unit,
.g-unit .g-tpl-nest .g-unit,
.g-unit .g-unit .g-tpl-nest .g-unit,
.g-unit .g-unit .g-unit .g-tpl-nest .g-unit {
float: left;
width: auto;
margin: 0;
}
/* g-tpl-nest-alt for multi unit nesting (float right), say for a menu. */
.g-tpl-nest-alt .g-unit,
.g-unit .g-tpl-nest-alt .g-unit,
.g-unit .g-unit .g-tpl-nest-alt .g-unit,
.g-unit .g-unit .g-unit .g-tpl-nest-alt .g-unit {
float: right;
width: auto;
margin: 0;
}

View File

@@ -0,0 +1,125 @@
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Announcer that allows messages to be spoken by assistive
* technologies.
*/
goog.provide('goog.a11y.aria.Announcer');
goog.require('goog.Disposable');
goog.require('goog.a11y.aria');
goog.require('goog.a11y.aria.LivePriority');
goog.require('goog.a11y.aria.State');
goog.require('goog.dom');
goog.require('goog.object');
/**
* Class that allows messages to be spoken by assistive technologies that the
* user may have active.
*
* @param {goog.dom.DomHelper=} opt_domHelper DOM helper.
* @constructor
* @extends {goog.Disposable}
* @final
*/
goog.a11y.aria.Announcer = function(opt_domHelper) {
goog.a11y.aria.Announcer.base(this, 'constructor');
/**
* @type {goog.dom.DomHelper}
* @private
*/
this.domHelper_ = opt_domHelper || goog.dom.getDomHelper();
/**
* Map of priority to live region elements to use for communicating updates.
* Elements are created on demand.
* @type {Object<goog.a11y.aria.LivePriority, !Element>}
* @private
*/
this.liveRegions_ = {};
};
goog.inherits(goog.a11y.aria.Announcer, goog.Disposable);
/** @override */
goog.a11y.aria.Announcer.prototype.disposeInternal = function() {
goog.object.forEach(
this.liveRegions_, this.domHelper_.removeNode, this.domHelper_);
this.liveRegions_ = null;
this.domHelper_ = null;
goog.a11y.aria.Announcer.base(this, 'disposeInternal');
};
/**
* Announce a message to be read by any assistive technologies the user may
* have active.
* @param {string} message The message to announce to screen readers.
* @param {goog.a11y.aria.LivePriority=} opt_priority The priority of the
* message. Defaults to POLITE.
*/
goog.a11y.aria.Announcer.prototype.say = function(message, opt_priority) {
var priority = opt_priority || goog.a11y.aria.LivePriority.POLITE;
var liveRegion = this.getLiveRegion_(priority);
goog.dom.setTextContent(liveRegion, message);
};
/**
* Returns an aria-live region that can be used to communicate announcements.
* @param {!goog.a11y.aria.LivePriority} priority The required priority.
* @return {!Element} A live region of the requested priority.
* @private
*/
goog.a11y.aria.Announcer.prototype.getLiveRegion_ = function(priority) {
// Removing the previous live region ensures that the newest message is always
// read without delay, even if the message is an exact duplicate of the prior
// message.
this.removeLiveRegion_(priority);
var liveRegion = this.domHelper_.createElement('div');
// Note that IE has a habit of declaring things that aren't display:none as
// invisible to third-party tools like JAWs, so we can't just use height:0.
liveRegion.style.position = 'absolute';
liveRegion.style.top = '-1000px';
liveRegion.style.height = '1px';
liveRegion.style.overflow = 'hidden';
goog.a11y.aria.setState(liveRegion, goog.a11y.aria.State.LIVE,
priority);
goog.a11y.aria.setState(liveRegion, goog.a11y.aria.State.ATOMIC,
'true');
this.domHelper_.getDocument().body.appendChild(liveRegion);
this.liveRegions_[priority] = liveRegion;
return liveRegion;
};
/**
* Removes any previous live region that was used to communicate announcements.
* @param {!goog.a11y.aria.LivePriority} priority The required priority.
* @private
*/
goog.a11y.aria.Announcer.prototype.removeLiveRegion_ = function(priority) {
var liveRegion = this.liveRegions_[priority];
if (liveRegion) {
this.domHelper_.removeNode(liveRegion);
delete this.liveRegions_[priority];
}
};

View File

@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2008 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<!--
Author: attila@google.com (Attila Bodis)
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
Closure Unit Tests - goog.a11y.aria announcer
</title>
<script src="../../base.js">
</script>
<script>
goog.require('goog.a11y.aria.AnnouncerTest');
</script>
</head>
<body>
<div id="sandbox">
</div>
</body>
</html>

View File

@@ -0,0 +1,129 @@
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
goog.provide('goog.a11y.aria.AnnouncerTest');
goog.setTestOnly('goog.a11y.aria.AnnouncerTest');
goog.require('goog.a11y.aria');
goog.require('goog.a11y.aria.Announcer');
goog.require('goog.a11y.aria.LivePriority');
goog.require('goog.a11y.aria.State');
goog.require('goog.array');
goog.require('goog.dom');
goog.require('goog.dom.iframe');
goog.require('goog.testing.jsunit');
var sandbox;
var someDiv;
var someSpan;
function setUp() {
sandbox = goog.dom.getElement('sandbox');
someDiv = goog.dom.createDom('div', {id: 'someDiv'}, 'DIV');
someSpan = goog.dom.createDom('span', {id: 'someSpan'}, 'SPAN');
sandbox.appendChild(someDiv);
someDiv.appendChild(someSpan);
}
function tearDown() {
sandbox.innerHTML = '';
someDiv = null;
someSpan = null;
}
function testAnnouncerAndDispose() {
var text = 'test content';
var announcer = new goog.a11y.aria.Announcer(goog.dom.getDomHelper());
announcer.say(text);
checkLiveRegionContains(text, 'polite');
goog.dispose(announcer);
}
function testAnnouncerTwice() {
var text = 'test content1';
var text2 = 'test content2';
var announcer = new goog.a11y.aria.Announcer(goog.dom.getDomHelper());
announcer.say(text);
announcer.say(text2);
checkLiveRegionContains(text2, 'polite');
goog.dispose(announcer);
}
function testAnnouncerTwiceSameMessage() {
var text = 'test content';
var announcer = new goog.a11y.aria.Announcer(goog.dom.getDomHelper());
announcer.say(text);
var firstLiveRegion = getLiveRegion('polite');
announcer.say(text);
var secondLiveRegion = getLiveRegion('polite');
assertNotEquals(firstLiveRegion, secondLiveRegion);
checkLiveRegionContains(text, 'polite');
goog.dispose(announcer);
}
function testAnnouncerAssertive() {
var text = 'test content';
var announcer = new goog.a11y.aria.Announcer(goog.dom.getDomHelper());
announcer.say(text, goog.a11y.aria.LivePriority.ASSERTIVE);
checkLiveRegionContains(text, 'assertive');
goog.dispose(announcer);
}
function testAnnouncerInIframe() {
var text = 'test content';
var frame = goog.dom.iframe.createWithContent(sandbox);
var helper = goog.dom.getDomHelper(
goog.dom.getFrameContentDocument(frame).body);
var announcer = new goog.a11y.aria.Announcer(helper);
announcer.say(text, 'polite', helper);
checkLiveRegionContains(text, 'polite', helper);
goog.dispose(announcer);
}
function testAnnouncerWithAriaHidden() {
var text = 'test content1';
var text2 = 'test content2';
var announcer = new goog.a11y.aria.Announcer(goog.dom.getDomHelper());
announcer.say(text);
// Set aria-hidden attribute on the live region (simulates a modal dialog
// being opened).
var liveRegion = getLiveRegion('polite');
goog.a11y.aria.setState(liveRegion, goog.a11y.aria.State.HIDDEN, true);
// Announce a new message and make sure that the aria-hidden was removed.
announcer.say(text2);
checkLiveRegionContains(text2, 'polite');
liveRegion = getLiveRegion('polite');
assertEquals('',
goog.a11y.aria.getState(liveRegion, goog.a11y.aria.State.HIDDEN));
goog.dispose(announcer);
}
function getLiveRegion(priority, opt_domHelper) {
var dom = opt_domHelper || goog.dom.getDomHelper();
var divs = dom.getElementsByTagNameAndClass('div', null);
var liveRegions = [];
goog.array.forEach(divs, function(div) {
if (goog.a11y.aria.getState(div, 'live') == priority) {
liveRegions.push(div);
}
});
assertEquals(1, liveRegions.length);
return liveRegions[0];
}
function checkLiveRegionContains(text, priority, opt_domHelper) {
var liveRegion = getLiveRegion(priority, opt_domHelper);
assertEquals(text, goog.dom.getTextContent(liveRegion));
}

View File

@@ -0,0 +1,386 @@
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Utilities for adding, removing and setting ARIA roles and
* states as defined by W3C ARIA standard: http://www.w3.org/TR/wai-aria/
* All modern browsers have some form of ARIA support, so no browser checks are
* performed when adding ARIA to components.
*
*/
goog.provide('goog.a11y.aria');
goog.require('goog.a11y.aria.Role');
goog.require('goog.a11y.aria.State');
goog.require('goog.a11y.aria.datatables');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('goog.dom');
goog.require('goog.dom.TagName');
goog.require('goog.object');
goog.require('goog.string');
/**
* ARIA states/properties prefix.
* @private
*/
goog.a11y.aria.ARIA_PREFIX_ = 'aria-';
/**
* ARIA role attribute.
* @private
*/
goog.a11y.aria.ROLE_ATTRIBUTE_ = 'role';
/**
* A list of tag names for which we don't need to set ARIA role and states
* because they have well supported semantics for screen readers or because
* they don't contain content to be made accessible.
* @private
*/
goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_ = [
goog.dom.TagName.A,
goog.dom.TagName.AREA,
goog.dom.TagName.BUTTON,
goog.dom.TagName.HEAD,
goog.dom.TagName.INPUT,
goog.dom.TagName.LINK,
goog.dom.TagName.MENU,
goog.dom.TagName.META,
goog.dom.TagName.OPTGROUP,
goog.dom.TagName.OPTION,
goog.dom.TagName.PROGRESS,
goog.dom.TagName.STYLE,
goog.dom.TagName.SELECT,
goog.dom.TagName.SOURCE,
goog.dom.TagName.TEXTAREA,
goog.dom.TagName.TITLE,
goog.dom.TagName.TRACK
];
/**
* Sets the role of an element. If the roleName is
* empty string or null, the role for the element is removed.
* We encourage clients to call the goog.a11y.aria.removeRole
* method instead of setting null and empty string values.
* Special handling for this case is added to ensure
* backword compatibility with existing code.
*
* @param {!Element} element DOM node to set role of.
* @param {!goog.a11y.aria.Role|string} roleName role name(s).
*/
goog.a11y.aria.setRole = function(element, roleName) {
if (!roleName) {
// Setting the ARIA role to empty string is not allowed
// by the ARIA standard.
goog.a11y.aria.removeRole(element);
} else {
if (goog.asserts.ENABLE_ASSERTS) {
goog.asserts.assert(goog.object.containsValue(
goog.a11y.aria.Role, roleName), 'No such ARIA role ' + roleName);
}
element.setAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_, roleName);
}
};
/**
* Gets role of an element.
* @param {!Element} element DOM element to get role of.
* @return {goog.a11y.aria.Role} ARIA Role name.
*/
goog.a11y.aria.getRole = function(element) {
var role = element.getAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_);
return /** @type {goog.a11y.aria.Role} */ (role) || null;
};
/**
* Removes role of an element.
* @param {!Element} element DOM element to remove the role from.
*/
goog.a11y.aria.removeRole = function(element) {
element.removeAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_);
};
/**
* Sets the state or property of an element.
* @param {!Element} element DOM node where we set state.
* @param {!(goog.a11y.aria.State|string)} stateName State attribute being set.
* Automatically adds prefix 'aria-' to the state name if the attribute is
* not an extra attribute.
* @param {string|boolean|number|!Array<string>} value Value
* for the state attribute.
*/
goog.a11y.aria.setState = function(element, stateName, value) {
if (goog.isArray(value)) {
value = value.join(' ');
}
var attrStateName = goog.a11y.aria.getAriaAttributeName_(stateName);
if (value === '' || value == undefined) {
var defaultValueMap = goog.a11y.aria.datatables.getDefaultValuesMap();
// Work around for browsers that don't properly support ARIA.
// According to the ARIA W3C standard, user agents should allow
// setting empty value which results in setting the default value
// for the ARIA state if such exists. The exact text from the ARIA W3C
// standard (http://www.w3.org/TR/wai-aria/states_and_properties):
// "When a value is indicated as the default, the user agent
// MUST follow the behavior prescribed by this value when the state or
// property is empty or undefined."
// The defaultValueMap contains the default values for the ARIA states
// and has as a key the goog.a11y.aria.State constant for the state.
if (stateName in defaultValueMap) {
element.setAttribute(attrStateName, defaultValueMap[stateName]);
} else {
element.removeAttribute(attrStateName);
}
} else {
element.setAttribute(attrStateName, value);
}
};
/**
* Toggles the ARIA attribute of an element.
* Meant for attributes with a true/false value, but works with any attribute.
* If the attribute does not have a true/false value, the following rules apply:
* A not empty attribute will be removed.
* An empty attribute will be set to true.
* @param {!Element} el DOM node for which to set attribute.
* @param {!(goog.a11y.aria.State|string)} attr ARIA attribute being set.
* Automatically adds prefix 'aria-' to the attribute name if the attribute
* is not an extra attribute.
*/
goog.a11y.aria.toggleState = function(el, attr) {
var val = goog.a11y.aria.getState(el, attr);
if (!goog.string.isEmptyOrWhitespace(goog.string.makeSafe(val)) &&
!(val == 'true' || val == 'false')) {
goog.a11y.aria.removeState(el, /** @type {!goog.a11y.aria.State} */ (attr));
return;
}
goog.a11y.aria.setState(el, attr, val == 'true' ? 'false' : 'true');
};
/**
* Remove the state or property for the element.
* @param {!Element} element DOM node where we set state.
* @param {!goog.a11y.aria.State} stateName State name.
*/
goog.a11y.aria.removeState = function(element, stateName) {
element.removeAttribute(goog.a11y.aria.getAriaAttributeName_(stateName));
};
/**
* Gets value of specified state or property.
* @param {!Element} element DOM node to get state from.
* @param {!goog.a11y.aria.State|string} stateName State name.
* @return {string} Value of the state attribute.
*/
goog.a11y.aria.getState = function(element, stateName) {
// TODO(user): return properly typed value result --
// boolean, number, string, null. We should be able to chain
// getState(...) and setState(...) methods.
var attr =
/** @type {string|number|boolean} */ (element.getAttribute(
goog.a11y.aria.getAriaAttributeName_(stateName)));
var isNullOrUndefined = attr == null || attr == undefined;
return isNullOrUndefined ? '' : String(attr);
};
/**
* Returns the activedescendant element for the input element by
* using the activedescendant ARIA property of the given element.
* @param {!Element} element DOM node to get activedescendant
* element for.
* @return {?Element} DOM node of the activedescendant, if found.
*/
goog.a11y.aria.getActiveDescendant = function(element) {
var id = goog.a11y.aria.getState(
element, goog.a11y.aria.State.ACTIVEDESCENDANT);
return goog.dom.getOwnerDocument(element).getElementById(id);
};
/**
* Sets the activedescendant ARIA property value for an element.
* If the activeElement is not null, it should have an id set.
* @param {!Element} element DOM node to set activedescendant ARIA property to.
* @param {?Element} activeElement DOM node being set as activedescendant.
*/
goog.a11y.aria.setActiveDescendant = function(element, activeElement) {
var id = '';
if (activeElement) {
id = activeElement.id;
goog.asserts.assert(id, 'The active element should have an id.');
}
goog.a11y.aria.setState(element, goog.a11y.aria.State.ACTIVEDESCENDANT, id);
};
/**
* Gets the label of the given element.
* @param {!Element} element DOM node to get label from.
* @return {string} label The label.
*/
goog.a11y.aria.getLabel = function(element) {
return goog.a11y.aria.getState(element, goog.a11y.aria.State.LABEL);
};
/**
* Sets the label of the given element.
* @param {!Element} element DOM node to set label to.
* @param {string} label The label to set.
*/
goog.a11y.aria.setLabel = function(element, label) {
goog.a11y.aria.setState(element, goog.a11y.aria.State.LABEL, label);
};
/**
* Asserts that the element has a role set if it's not an HTML element whose
* semantics is well supported by most screen readers.
* Only to be used internally by the ARIA library in goog.a11y.aria.*.
* @param {!Element} element The element to assert an ARIA role set.
* @param {!goog.array.ArrayLike<string>} allowedRoles The child roles of
* the roles.
*/
goog.a11y.aria.assertRoleIsSetInternalUtil = function(element, allowedRoles) {
if (goog.array.contains(goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_,
element.tagName)) {
return;
}
var elementRole = /** @type {string}*/ (goog.a11y.aria.getRole(element));
goog.asserts.assert(elementRole != null,
'The element ARIA role cannot be null.');
goog.asserts.assert(goog.array.contains(allowedRoles, elementRole),
'Non existing or incorrect role set for element.' +
'The role set is "' + elementRole +
'". The role should be any of "' + allowedRoles +
'". Check the ARIA specification for more details ' +
'http://www.w3.org/TR/wai-aria/roles.');
};
/**
* Gets the boolean value of an ARIA state/property.
* @param {!Element} element The element to get the ARIA state for.
* @param {!goog.a11y.aria.State|string} stateName the ARIA state name.
* @return {?boolean} Boolean value for the ARIA state value or null if
* the state value is not 'true', not 'false', or not set.
*/
goog.a11y.aria.getStateBoolean = function(element, stateName) {
var attr =
/** @type {string|boolean} */ (element.getAttribute(
goog.a11y.aria.getAriaAttributeName_(stateName)));
goog.asserts.assert(
goog.isBoolean(attr) || attr == null || attr == 'true' ||
attr == 'false');
if (attr == null) {
return attr;
}
return goog.isBoolean(attr) ? attr : attr == 'true';
};
/**
* Gets the number value of an ARIA state/property.
* @param {!Element} element The element to get the ARIA state for.
* @param {!goog.a11y.aria.State|string} stateName the ARIA state name.
* @return {?number} Number value for the ARIA state value or null if
* the state value is not a number or not set.
*/
goog.a11y.aria.getStateNumber = function(element, stateName) {
var attr =
/** @type {string|number} */ (element.getAttribute(
goog.a11y.aria.getAriaAttributeName_(stateName)));
goog.asserts.assert((attr == null || !isNaN(Number(attr))) &&
!goog.isBoolean(attr));
return attr == null ? null : Number(attr);
};
/**
* Gets the string value of an ARIA state/property.
* @param {!Element} element The element to get the ARIA state for.
* @param {!goog.a11y.aria.State|string} stateName the ARIA state name.
* @return {?string} String value for the ARIA state value or null if
* the state value is empty string or not set.
*/
goog.a11y.aria.getStateString = function(element, stateName) {
var attr = element.getAttribute(
goog.a11y.aria.getAriaAttributeName_(stateName));
goog.asserts.assert((attr == null || goog.isString(attr)) &&
isNaN(Number(attr)) && attr != 'true' && attr != 'false');
return attr == null ? null : attr;
};
/**
* Gets array of strings value of the specified state or
* property for the element.
* Only to be used internally by the ARIA library in goog.a11y.aria.*.
* @param {!Element} element DOM node to get state from.
* @param {!goog.a11y.aria.State} stateName State name.
* @return {!goog.array.ArrayLike<string>} string Array
* value of the state attribute.
*/
goog.a11y.aria.getStringArrayStateInternalUtil = function(element, stateName) {
var attrValue = element.getAttribute(
goog.a11y.aria.getAriaAttributeName_(stateName));
return goog.a11y.aria.splitStringOnWhitespace_(attrValue);
};
/**
* Splits the input stringValue on whitespace.
* @param {string} stringValue The value of the string to split.
* @return {!goog.array.ArrayLike<string>} string Array
* value as result of the split.
* @private
*/
goog.a11y.aria.splitStringOnWhitespace_ = function(stringValue) {
return stringValue ? stringValue.split(/\s+/) : [];
};
/**
* Adds the 'aria-' prefix to ariaName.
* @param {string} ariaName ARIA state/property name.
* @private
* @return {string} The ARIA attribute name with added 'aria-' prefix.
* @throws {Error} If no such attribute exists.
*/
goog.a11y.aria.getAriaAttributeName_ = function(ariaName) {
if (goog.asserts.ENABLE_ASSERTS) {
goog.asserts.assert(ariaName, 'ARIA attribute cannot be empty.');
goog.asserts.assert(goog.object.containsValue(
goog.a11y.aria.State, ariaName),
'No such ARIA attribute ' + ariaName);
}
return goog.a11y.aria.ARIA_PREFIX_ + ariaName;
};

View File

@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2008 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<!--
Author: attila@google.com (Attila Bodis)
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
Closure Unit Tests - goog.a11y.aria
</title>
<script src="../../base.js">
</script>
<script>
goog.require('goog.a11y.ariaTest');
</script>
</head>
<body>
<div id="sandbox">
</div>
</body>
</html>

View File

@@ -0,0 +1,269 @@
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.goog.provide('goog.a11y.ariaTest');
goog.provide('goog.a11y.ariaTest');
goog.setTestOnly('goog.a11y.ariaTest');
goog.require('goog.a11y.aria');
goog.require('goog.a11y.aria.Role');
goog.require('goog.a11y.aria.State');
goog.require('goog.dom');
goog.require('goog.dom.TagName');
goog.require('goog.testing.jsunit');
var aria = goog.a11y.aria;
var Role = goog.a11y.aria.Role;
var State = goog.a11y.aria.State;
var sandbox;
var someDiv;
var someSpan;
var htmlButton;
function setUp() {
sandbox = goog.dom.getElement('sandbox');
someDiv = goog.dom.createDom(
goog.dom.TagName.DIV, {id: 'someDiv'}, 'DIV');
someSpan = goog.dom.createDom(
goog.dom.TagName.SPAN, {id: 'someSpan'}, 'SPAN');
htmlButton = goog.dom.createDom(
goog.dom.TagName.BUTTON, {id: 'someButton'}, 'BUTTON');
goog.dom.appendChild(sandbox, someDiv);
goog.dom.appendChild(someDiv, someSpan);
}
function tearDown() {
goog.dom.removeChildren(sandbox);
someDiv = null;
someSpan = null;
htmlButton = null;
}
function testGetSetRole() {
assertNull('someDiv\'s role should be null', aria.getRole(someDiv));
assertNull('someSpan\'s role should be null', aria.getRole(someSpan));
aria.setRole(someDiv, Role.MENU);
aria.setRole(someSpan, Role.MENU_ITEM);
assertEquals('someDiv\'s role should be MENU',
Role.MENU, aria.getRole(someDiv));
assertEquals('someSpan\'s role should be MENU_ITEM',
Role.MENU_ITEM, aria.getRole(someSpan));
var div = goog.dom.createElement(goog.dom.TagName.DIV);
goog.dom.appendChild(sandbox, div);
goog.dom.appendChild(div, goog.dom.createDom(goog.dom.TagName.SPAN,
{id: 'anotherSpan', role: Role.CHECKBOX}));
assertEquals('anotherSpan\'s role should be CHECKBOX',
Role.CHECKBOX, aria.getRole(goog.dom.getElement('anotherSpan')));
}
function testGetSetToggleState() {
assertThrows('Should throw because no state is specified.',
function() {
aria.getState(someDiv);
});
assertThrows('Should throw because no state is specified.',
function() {
aria.getState(someDiv);
});
aria.setState(someDiv, State.LABELLEDBY, 'someSpan');
assertEquals('someDiv\'s labelledby state should be "someSpan"',
'someSpan', aria.getState(someDiv, State.LABELLEDBY));
// Test setting for aria-activedescendant with empty value.
assertFalse(someDiv.hasAttribute ?
someDiv.hasAttribute('aria-activedescendant') :
!!someDiv.getAttribute('aria-activedescendant'));
aria.setState(someDiv, State.ACTIVEDESCENDANT, 'someSpan');
assertEquals('someSpan', aria.getState(someDiv, State.ACTIVEDESCENDANT));
aria.setState(someDiv, State.ACTIVEDESCENDANT, '');
assertFalse(someDiv.hasAttribute ?
someDiv.hasAttribute('aria-activedescendant') :
!!someDiv.getAttribute('aria-activedescendant'));
// Test setting state that has a default value to empty value.
assertFalse(someDiv.hasAttribute ?
someDiv.hasAttribute('aria-relevant') :
!!someDiv.getAttribute('aria-relevant'));
aria.setState(someDiv, State.RELEVANT, aria.RelevantValues.TEXT);
assertEquals(
aria.RelevantValues.TEXT, aria.getState(someDiv, State.RELEVANT));
aria.setState(someDiv, State.RELEVANT, '');
assertEquals(
aria.RelevantValues.ADDITIONS + ' ' + aria.RelevantValues.TEXT,
aria.getState(someDiv, State.RELEVANT));
// Test toggling an attribute that has a true/false value.
aria.setState(someDiv, State.EXPANDED, false);
assertEquals('false', aria.getState(someDiv, State.EXPANDED));
aria.toggleState(someDiv, State.EXPANDED);
assertEquals('true', aria.getState(someDiv, State.EXPANDED));
aria.setState(someDiv, State.EXPANDED, true);
assertEquals('true', aria.getState(someDiv, State.EXPANDED));
aria.toggleState(someDiv, State.EXPANDED);
assertEquals('false', aria.getState(someDiv, State.EXPANDED));
// Test toggling an attribute that does not have a true/false value.
aria.setState(someDiv, State.RELEVANT, aria.RelevantValues.TEXT);
assertEquals(
aria.RelevantValues.TEXT, aria.getState(someDiv, State.RELEVANT));
aria.toggleState(someDiv, State.RELEVANT);
assertEquals('', aria.getState(someDiv, State.RELEVANT));
aria.removeState(someDiv, State.RELEVANT);
assertEquals('', aria.getState(someDiv, State.RELEVANT));
// This is not a valid value, but this is what happens if toggle is misused.
aria.toggleState(someDiv, State.RELEVANT);
assertEquals('true', aria.getState(someDiv, State.RELEVANT));
}
function testGetStateString() {
aria.setState(someDiv, State.LABEL, 'test_label');
aria.setState(
someSpan, State.LABEL, aria.getStateString(someDiv, State.LABEL));
assertEquals(aria.getState(someDiv, State.LABEL),
aria.getState(someSpan, State.LABEL));
assertEquals('The someDiv\'s enum value should be "test_label".',
'test_label', aria.getState(someDiv, State.LABEL));
assertEquals('The someSpan\'s enum value should be "copy move".',
'test_label', aria.getStateString(someSpan, State.LABEL));
aria.setState(someDiv, State.MULTILINE, true);
var thrown = false;
try {
aria.getStateString(someDiv, State.MULTILINE);
} catch (e) {
thrown = true;
}
assertTrue('invalid use of getStateString on boolean.', thrown);
aria.setState(someDiv, State.LIVE, aria.LivePriority.ASSERTIVE);
thrown = false;
aria.setState(someDiv, State.LEVEL, 1);
try {
aria.getStateString(someDiv, State.LEVEL);
} catch (e) {
thrown = true;
}
assertTrue('invalid use of getStateString on numbers.', thrown);
}
function testGetStateStringArray() {
aria.setState(someDiv, State.LABELLEDBY, ['1', '2']);
aria.setState(someSpan, State.LABELLEDBY,
aria.getStringArrayStateInternalUtil(someDiv, State.LABELLEDBY));
assertEquals(aria.getState(someDiv, State.LABELLEDBY),
aria.getState(someSpan, State.LABELLEDBY));
assertEquals('The someDiv\'s enum value should be "1 2".', '1 2',
aria.getState(someDiv, State.LABELLEDBY));
assertEquals('The someSpan\'s enum value should be "1 2".', '1 2',
aria.getState(someSpan, State.LABELLEDBY));
assertSameElements('The someDiv\'s enum value should be "1 2".',
['1', '2'],
aria.getStringArrayStateInternalUtil(someDiv, State.LABELLEDBY));
assertSameElements('The someSpan\'s enum value should be "1 2".',
['1', '2'],
aria.getStringArrayStateInternalUtil(someSpan, State.LABELLEDBY));
}
function testGetStateNumber() {
aria.setState(someDiv, State.LEVEL, 1);
aria.setState(
someSpan, State.LEVEL, aria.getStateNumber(someDiv, State.LEVEL));
assertEquals(aria.getState(someDiv, State.LEVEL),
aria.getState(someSpan, State.LEVEL));
assertEquals('The someDiv\'s enum value should be "1".', '1',
aria.getState(someDiv, State.LEVEL));
assertEquals('The someSpan\'s enum value should be "1".', '1',
aria.getState(someSpan, State.LEVEL));
assertEquals('The someDiv\'s enum value should be "1".', 1,
aria.getStateNumber(someDiv, State.LEVEL));
assertEquals('The someSpan\'s enum value should be "1".', 1,
aria.getStateNumber(someSpan, State.LEVEL));
aria.setState(someDiv, State.MULTILINE, true);
var thrown = false;
try {
aria.getStateNumber(someDiv, State.MULTILINE);
} catch (e) {
thrown = true;
}
assertTrue('invalid use of getStateNumber on boolean.', thrown);
aria.setState(someDiv, State.LIVE, aria.LivePriority.ASSERTIVE);
thrown = false;
try {
aria.getStateBoolean(someDiv, State.LIVE);
} catch (e) {
thrown = true;
}
assertTrue('invalid use of getStateNumber on strings.', thrown);
}
function testGetStateBoolean() {
assertNull(aria.getStateBoolean(someDiv, State.MULTILINE));
aria.setState(someDiv, State.MULTILINE, false);
assertFalse(aria.getStateBoolean(someDiv, State.MULTILINE));
aria.setState(someDiv, State.MULTILINE, true);
aria.setState(someSpan, State.MULTILINE,
aria.getStateBoolean(someDiv, State.MULTILINE));
assertEquals(aria.getState(someDiv, State.MULTILINE),
aria.getState(someSpan, State.MULTILINE));
assertEquals('The someDiv\'s enum value should be "true".', 'true',
aria.getState(someDiv, State.MULTILINE));
assertEquals('The someSpan\'s enum value should be "true".', 'true',
aria.getState(someSpan, State.MULTILINE));
assertEquals('The someDiv\'s enum value should be "true".', true,
aria.getStateBoolean(someDiv, State.MULTILINE));
assertEquals('The someSpan\'s enum value should be "true".', true,
aria.getStateBoolean(someSpan, State.MULTILINE));
aria.setState(someDiv, State.LEVEL, 1);
var thrown = false;
try {
aria.getStateBoolean(someDiv, State.LEVEL);
} catch (e) {
thrown = true;
}
assertTrue('invalid use of getStateBoolean on numbers.', thrown);
aria.setState(someDiv, State.LIVE, aria.LivePriority.ASSERTIVE);
thrown = false;
try {
aria.getStateBoolean(someDiv, State.LIVE);
} catch (e) {
thrown = true;
}
assertTrue('invalid use of getStateBoolean on strings.', thrown);
}
function testGetSetActiveDescendant() {
aria.setActiveDescendant(someDiv, null);
assertNull('someDiv\'s activedescendant should be null',
aria.getActiveDescendant(someDiv));
aria.setActiveDescendant(someDiv, someSpan);
assertEquals('someDiv\'s active descendant should be "someSpan"',
someSpan, aria.getActiveDescendant(someDiv));
}
function testGetSetLabel() {
assertEquals('someDiv\'s label should be ""', '', aria.getLabel(someDiv));
aria.setLabel(someDiv, 'somelabel');
assertEquals('someDiv\'s label should be "somelabel"', 'somelabel',
aria.getLabel(someDiv));
}

View File

@@ -0,0 +1,389 @@
// Copyright 2013 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview The file contains generated enumerations for ARIA states
* and properties as defined by W3C ARIA standard:
* http://www.w3.org/TR/wai-aria/.
*
* This is auto-generated code. Do not manually edit! For more details
* about how to edit it via the generator check go/closure-ariagen.
*/
goog.provide('goog.a11y.aria.AutoCompleteValues');
goog.provide('goog.a11y.aria.CheckedValues');
goog.provide('goog.a11y.aria.DropEffectValues');
goog.provide('goog.a11y.aria.ExpandedValues');
goog.provide('goog.a11y.aria.GrabbedValues');
goog.provide('goog.a11y.aria.InvalidValues');
goog.provide('goog.a11y.aria.LivePriority');
goog.provide('goog.a11y.aria.OrientationValues');
goog.provide('goog.a11y.aria.PressedValues');
goog.provide('goog.a11y.aria.RelevantValues');
goog.provide('goog.a11y.aria.SelectedValues');
goog.provide('goog.a11y.aria.SortValues');
goog.provide('goog.a11y.aria.State');
/**
* ARIA states and properties.
* @enum {string}
*/
goog.a11y.aria.State = {
// ARIA property for setting the currently active descendant of an element,
// for example the selected item in a list box. Value: ID of an element.
ACTIVEDESCENDANT: 'activedescendant',
// ARIA property that, if true, indicates that all of a changed region should
// be presented, instead of only parts. Value: one of {true, false}.
ATOMIC: 'atomic',
// ARIA property to specify that input completion is provided. Value:
// one of {'inline', 'list', 'both', 'none'}.
AUTOCOMPLETE: 'autocomplete',
// ARIA state to indicate that an element and its subtree are being updated.
// Value: one of {true, false}.
BUSY: 'busy',
// ARIA state for a checked item. Value: one of {'true', 'false', 'mixed',
// undefined}.
CHECKED: 'checked',
// ARIA property that identifies the element or elements whose contents or
// presence are controlled by this element.
// Value: space-separated IDs of other elements.
CONTROLS: 'controls',
// ARIA property that identifies the element or elements that describe
// this element. Value: space-separated IDs of other elements.
DESCRIBEDBY: 'describedby',
// ARIA state for a disabled item. Value: one of {true, false}.
DISABLED: 'disabled',
// ARIA property that indicates what functions can be performed when a
// dragged object is released on the drop target. Value: one of
// {'copy', 'move', 'link', 'execute', 'popup', 'none'}.
DROPEFFECT: 'dropeffect',
// ARIA state for setting whether the element like a tree node is expanded.
// Value: one of {true, false, undefined}.
EXPANDED: 'expanded',
// ARIA property that identifies the next element (or elements) in the
// recommended reading order of content. Value: space-separated ids of
// elements to flow to.
FLOWTO: 'flowto',
// ARIA state that indicates an element's "grabbed" state in drag-and-drop.
// Value: one of {true, false, undefined}.
GRABBED: 'grabbed',
// ARIA property indicating whether the element has a popup.
// Value: one of {true, false}.
HASPOPUP: 'haspopup',
// ARIA state indicating that the element is not visible or perceivable
// to any user. Value: one of {true, false}.
HIDDEN: 'hidden',
// ARIA state indicating that the entered value does not conform. Value:
// one of {false, true, 'grammar', 'spelling'}
INVALID: 'invalid',
// ARIA property that provides a label to override any other text, value, or
// contents used to describe this element. Value: string.
LABEL: 'label',
// ARIA property for setting the element which labels another element.
// Value: space-separated IDs of elements.
LABELLEDBY: 'labelledby',
// ARIA property for setting the level of an element in the hierarchy.
// Value: integer.
LEVEL: 'level',
// ARIA property indicating that an element will be updated, and
// describes the types of updates the user agents, assistive technologies,
// and user can expect from the live region. Value: one of {'off', 'polite',
// 'assertive'}.
LIVE: 'live',
// ARIA property indicating whether a text box can accept multiline input.
// Value: one of {true, false}.
MULTILINE: 'multiline',
// ARIA property indicating if the user may select more than one item.
// Value: one of {true, false}.
MULTISELECTABLE: 'multiselectable',
// ARIA property indicating if the element is horizontal or vertical.
// Value: one of {'vertical', 'horizontal'}.
ORIENTATION: 'orientation',
// ARIA property creating a visual, functional, or contextual parent/child
// relationship when the DOM hierarchy can't be used to represent it.
// Value: Space-separated IDs of elements.
OWNS: 'owns',
// ARIA property that defines an element's number of position in a list.
// Value: integer.
POSINSET: 'posinset',
// ARIA state for a pressed item.
// Value: one of {true, false, undefined, 'mixed'}.
PRESSED: 'pressed',
// ARIA property indicating that an element is not editable.
// Value: one of {true, false}.
READONLY: 'readonly',
// ARIA property indicating that change notifications within this subtree
// of a live region should be announced. Value: one of {'additions',
// 'removals', 'text', 'all', 'additions text'}.
RELEVANT: 'relevant',
// ARIA property indicating that user input is required on this element
// before a form may be submitted. Value: one of {true, false}.
REQUIRED: 'required',
// ARIA state for setting the currently selected item in the list.
// Value: one of {true, false, undefined}.
SELECTED: 'selected',
// ARIA property defining the number of items in a list. Value: integer.
SETSIZE: 'setsize',
// ARIA property indicating if items are sorted. Value: one of {'ascending',
// 'descending', 'none', 'other'}.
SORT: 'sort',
// ARIA property for slider maximum value. Value: number.
VALUEMAX: 'valuemax',
// ARIA property for slider minimum value. Value: number.
VALUEMIN: 'valuemin',
// ARIA property for slider active value. Value: number.
VALUENOW: 'valuenow',
// ARIA property for slider active value represented as text.
// Value: string.
VALUETEXT: 'valuetext'
};
/**
* ARIA state values for AutoCompleteValues.
* @enum {string}
*/
goog.a11y.aria.AutoCompleteValues = {
// The system provides text after the caret as a suggestion
// for how to complete the field.
INLINE: 'inline',
// A list of choices appears from which the user can choose,
// but the edit box retains focus.
LIST: 'list',
// A list of choices appears and the currently selected suggestion
// also appears inline.
BOTH: 'both',
// No input completion suggestions are provided.
NONE: 'none'
};
/**
* ARIA state values for DropEffectValues.
* @enum {string}
*/
goog.a11y.aria.DropEffectValues = {
// A duplicate of the source object will be dropped into the target.
COPY: 'copy',
// The source object will be removed from its current location
// and dropped into the target.
MOVE: 'move',
// A reference or shortcut to the dragged object
// will be created in the target object.
LINK: 'link',
// A function supported by the drop target is
// executed, using the drag source as an input.
EXECUTE: 'execute',
// There is a popup menu or dialog that allows the user to choose
// one of the drag operations (copy, move, link, execute) and any other
// drag functionality, such as cancel.
POPUP: 'popup',
// No operation can be performed; effectively
// cancels the drag operation if an attempt is made to drop on this object.
NONE: 'none'
};
/**
* ARIA state values for LivePriority.
* @enum {string}
*/
goog.a11y.aria.LivePriority = {
// Updates to the region will not be presented to the user
// unless the assitive technology is currently focused on that region.
OFF: 'off',
// (Background change) Assistive technologies SHOULD announce
// updates at the next graceful opportunity, such as at the end of
// speaking the current sentence or when the user pauses typing.
POLITE: 'polite',
// This information has the highest priority and assistive
// technologies SHOULD notify the user immediately.
// Because an interruption may disorient users or cause them to not complete
// their current task, authors SHOULD NOT use the assertive value unless the
// interruption is imperative.
ASSERTIVE: 'assertive'
};
/**
* ARIA state values for OrientationValues.
* @enum {string}
*/
goog.a11y.aria.OrientationValues = {
// The element is oriented vertically.
VERTICAL: 'vertical',
// The element is oriented horizontally.
HORIZONTAL: 'horizontal'
};
/**
* ARIA state values for RelevantValues.
* @enum {string}
*/
goog.a11y.aria.RelevantValues = {
// Element nodes are added to the DOM within the live region.
ADDITIONS: 'additions',
// Text or element nodes within the live region are removed from the DOM.
REMOVALS: 'removals',
// Text is added to any DOM descendant nodes of the live region.
TEXT: 'text',
// Equivalent to the combination of all values, "additions removals text".
ALL: 'all'
};
/**
* ARIA state values for SortValues.
* @enum {string}
*/
goog.a11y.aria.SortValues = {
// Items are sorted in ascending order by this column.
ASCENDING: 'ascending',
// Items are sorted in descending order by this column.
DESCENDING: 'descending',
// There is no defined sort applied to the column.
NONE: 'none',
// A sort algorithm other than ascending or descending has been applied.
OTHER: 'other'
};
/**
* ARIA state values for CheckedValues.
* @enum {string}
*/
goog.a11y.aria.CheckedValues = {
// The selectable element is checked.
TRUE: 'true',
// The selectable element is not checked.
FALSE: 'false',
// Indicates a mixed mode value for a tri-state
// checkbox or menuitemcheckbox.
MIXED: 'mixed',
// The element does not support being checked.
UNDEFINED: 'undefined'
};
/**
* ARIA state values for ExpandedValues.
* @enum {string}
*/
goog.a11y.aria.ExpandedValues = {
// The element, or another grouping element it controls, is expanded.
TRUE: 'true',
// The element, or another grouping element it controls, is collapsed.
FALSE: 'false',
// The element, or another grouping element
// it controls, is neither expandable nor collapsible; all its
// child elements are shown or there are no child elements.
UNDEFINED: 'undefined'
};
/**
* ARIA state values for GrabbedValues.
* @enum {string}
*/
goog.a11y.aria.GrabbedValues = {
// Indicates that the element has been "grabbed" for dragging.
TRUE: 'true',
// Indicates that the element supports being dragged.
FALSE: 'false',
// Indicates that the element does not support being dragged.
UNDEFINED: 'undefined'
};
/**
* ARIA state values for InvalidValues.
* @enum {string}
*/
goog.a11y.aria.InvalidValues = {
// There are no detected errors in the value.
FALSE: 'false',
// The value entered by the user has failed validation.
TRUE: 'true',
// A grammatical error was detected.
GRAMMAR: 'grammar',
// A spelling error was detected.
SPELLING: 'spelling'
};
/**
* ARIA state values for PressedValues.
* @enum {string}
*/
goog.a11y.aria.PressedValues = {
// The element is pressed.
TRUE: 'true',
// The element supports being pressed but is not currently pressed.
FALSE: 'false',
// Indicates a mixed mode value for a tri-state toggle button.
MIXED: 'mixed',
// The element does not support being pressed.
UNDEFINED: 'undefined'
};
/**
* ARIA state values for SelectedValues.
* @enum {string}
*/
goog.a11y.aria.SelectedValues = {
// The selectable element is selected.
TRUE: 'true',
// The selectable element is not selected.
FALSE: 'false',
// The element is not selectable.
UNDEFINED: 'undefined'
};

View File

@@ -0,0 +1,68 @@
// Copyright 2013 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview The file contains data tables generated from the ARIA
* standard schema http://www.w3.org/TR/wai-aria/.
*
* This is auto-generated code. Do not manually edit!
*/
goog.provide('goog.a11y.aria.datatables');
goog.require('goog.a11y.aria.State');
goog.require('goog.object');
/**
* A map that contains mapping between an ARIA state and the default value
* for it. Note that not all ARIA states have default values.
*
* @type {Object<!(goog.a11y.aria.State|string), (string|boolean|number)>}
*/
goog.a11y.aria.DefaultStateValueMap_;
/**
* A method that creates a map that contains mapping between an ARIA state and
* the default value for it. Note that not all ARIA states have default values.
*
* @return {!Object<!(goog.a11y.aria.State|string), (string|boolean|number)>}
* The names for each of the notification methods.
*/
goog.a11y.aria.datatables.getDefaultValuesMap = function() {
if (!goog.a11y.aria.DefaultStateValueMap_) {
goog.a11y.aria.DefaultStateValueMap_ = goog.object.create(
goog.a11y.aria.State.ATOMIC, false,
goog.a11y.aria.State.AUTOCOMPLETE, 'none',
goog.a11y.aria.State.DROPEFFECT, 'none',
goog.a11y.aria.State.HASPOPUP, false,
goog.a11y.aria.State.LIVE, 'off',
goog.a11y.aria.State.MULTILINE, false,
goog.a11y.aria.State.MULTISELECTABLE, false,
goog.a11y.aria.State.ORIENTATION, 'vertical',
goog.a11y.aria.State.READONLY, false,
goog.a11y.aria.State.RELEVANT, 'additions text',
goog.a11y.aria.State.REQUIRED, false,
goog.a11y.aria.State.SORT, 'none',
goog.a11y.aria.State.BUSY, false,
goog.a11y.aria.State.DISABLED, false,
goog.a11y.aria.State.HIDDEN, false,
goog.a11y.aria.State.INVALID, 'false');
}
return goog.a11y.aria.DefaultStateValueMap_;
};

View File

@@ -0,0 +1,216 @@
// Copyright 2013 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview The file contains generated enumerations for ARIA roles
* as defined by W3C ARIA standard: http://www.w3.org/TR/wai-aria/.
*
* This is auto-generated code. Do not manually edit! For more details
* about how to edit it via the generator check go/closure-ariagen.
*/
goog.provide('goog.a11y.aria.Role');
/**
* ARIA role values.
* @enum {string}
*/
goog.a11y.aria.Role = {
// ARIA role for an alert element that doesn't need to be explicitly closed.
ALERT: 'alert',
// ARIA role for an alert dialog element that takes focus and must be closed.
ALERTDIALOG: 'alertdialog',
// ARIA role for an application that implements its own keyboard navigation.
APPLICATION: 'application',
// ARIA role for an article.
ARTICLE: 'article',
// ARIA role for a banner containing mostly site content, not page content.
BANNER: 'banner',
// ARIA role for a button element.
BUTTON: 'button',
// ARIA role for a checkbox button element; use with the CHECKED state.
CHECKBOX: 'checkbox',
// ARIA role for a column header of a table or grid.
COLUMNHEADER: 'columnheader',
// ARIA role for a combo box element.
COMBOBOX: 'combobox',
// ARIA role for a supporting section of the document.
COMPLEMENTARY: 'complementary',
// ARIA role for a large perceivable region that contains information
// about the parent document.
CONTENTINFO: 'contentinfo',
// ARIA role for a definition of a term or concept.
DEFINITION: 'definition',
// ARIA role for a dialog, some descendant must take initial focus.
DIALOG: 'dialog',
// ARIA role for a directory, like a table of contents.
DIRECTORY: 'directory',
// ARIA role for a part of a page that's a document, not a web application.
DOCUMENT: 'document',
// ARIA role for a landmark region logically considered one form.
FORM: 'form',
// ARIA role for an interactive control of tabular data.
GRID: 'grid',
// ARIA role for a cell in a grid.
GRIDCELL: 'gridcell',
// ARIA role for a group of related elements like tree item siblings.
GROUP: 'group',
// ARIA role for a heading element.
HEADING: 'heading',
// ARIA role for a container of elements that together comprise one image.
IMG: 'img',
// ARIA role for a link.
LINK: 'link',
// ARIA role for a list of non-interactive list items.
LIST: 'list',
// ARIA role for a listbox.
LISTBOX: 'listbox',
// ARIA role for a list item.
LISTITEM: 'listitem',
// ARIA role for a live region where new information is added.
LOG: 'log',
// ARIA landmark role for the main content in a document. Use only once.
MAIN: 'main',
// ARIA role for a live region of non-essential information that changes.
MARQUEE: 'marquee',
// ARIA role for a mathematical expression.
MATH: 'math',
// ARIA role for a popup menu.
MENU: 'menu',
// ARIA role for a menubar element containing menu elements.
MENUBAR: 'menubar',
// ARIA role for menu item elements.
MENU_ITEM: 'menuitem',
// ARIA role for a checkbox box element inside a menu.
MENU_ITEM_CHECKBOX: 'menuitemcheckbox',
// ARIA role for a radio button element inside a menu.
MENU_ITEM_RADIO: 'menuitemradio',
// ARIA landmark role for a collection of navigation links.
NAVIGATION: 'navigation',
// ARIA role for a section ancillary to the main content.
NOTE: 'note',
// ARIA role for option items that are children of combobox, listbox, menu,
// radiogroup, or tree elements.
OPTION: 'option',
// ARIA role for ignorable cosmetic elements with no semantic significance.
PRESENTATION: 'presentation',
// ARIA role for a progress bar element.
PROGRESSBAR: 'progressbar',
// ARIA role for a radio button element.
RADIO: 'radio',
// ARIA role for a group of connected radio button elements.
RADIOGROUP: 'radiogroup',
// ARIA role for an important region of the page.
REGION: 'region',
// ARIA role for a row of cells in a grid.
ROW: 'row',
// ARIA role for a group of one or more rows in a grid.
ROWGROUP: 'rowgroup',
// ARIA role for a row header of a table or grid.
ROWHEADER: 'rowheader',
// ARIA role for a scrollbar element.
SCROLLBAR: 'scrollbar',
// ARIA landmark role for a part of the page providing search functionality.
SEARCH: 'search',
// ARIA role for a menu separator.
SEPARATOR: 'separator',
// ARIA role for a slider.
SLIDER: 'slider',
// ARIA role for a spin button.
SPINBUTTON: 'spinbutton',
// ARIA role for a live region with advisory info less severe than an alert.
STATUS: 'status',
// ARIA role for a tab button.
TAB: 'tab',
// ARIA role for a tab bar (i.e. a list of tab buttons).
TAB_LIST: 'tablist',
// ARIA role for a tab page (i.e. the element holding tab contents).
TAB_PANEL: 'tabpanel',
// ARIA role for a textbox element.
TEXTBOX: 'textbox',
// ARIA role for an element displaying elapsed time or time remaining.
TIMER: 'timer',
// ARIA role for a toolbar element.
TOOLBAR: 'toolbar',
// ARIA role for a tooltip element.
TOOLTIP: 'tooltip',
// ARIA role for a tree.
TREE: 'tree',
// ARIA role for a grid whose rows can be expanded and collapsed like a tree.
TREEGRID: 'treegrid',
// ARIA role for a tree item that sometimes may be expanded or collapsed.
TREEITEM: 'treeitem'
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2006 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
Closure Unit Tests - goog.array
</title>
<script src="../base.js">
</script>
<script>
goog.require('goog.arrayTest');
</script>
</head>
<body>
<div class="foo">
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,365 @@
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Utilities to check the preconditions, postconditions and
* invariants runtime.
*
* Methods in this package should be given special treatment by the compiler
* for type-inference. For example, <code>goog.asserts.assert(foo)</code>
* will restrict <code>foo</code> to a truthy value.
*
* The compiler has an option to disable asserts. So code like:
* <code>
* var x = goog.asserts.assert(foo()); goog.asserts.assert(bar());
* </code>
* will be transformed into:
* <code>
* var x = foo();
* </code>
* The compiler will leave in foo() (because its return value is used),
* but it will remove bar() because it assumes it does not have side-effects.
*
* @author agrieve@google.com (Andrew Grieve)
*/
goog.provide('goog.asserts');
goog.provide('goog.asserts.AssertionError');
goog.require('goog.debug.Error');
goog.require('goog.dom.NodeType');
goog.require('goog.string');
/**
* @define {boolean} Whether to strip out asserts or to leave them in.
*/
goog.define('goog.asserts.ENABLE_ASSERTS', goog.DEBUG);
/**
* Error object for failed assertions.
* @param {string} messagePattern The pattern that was used to form message.
* @param {!Array<*>} messageArgs The items to substitute into the pattern.
* @constructor
* @extends {goog.debug.Error}
* @final
*/
goog.asserts.AssertionError = function(messagePattern, messageArgs) {
messageArgs.unshift(messagePattern);
goog.debug.Error.call(this, goog.string.subs.apply(null, messageArgs));
// Remove the messagePattern afterwards to avoid permenantly modifying the
// passed in array.
messageArgs.shift();
/**
* The message pattern used to format the error message. Error handlers can
* use this to uniquely identify the assertion.
* @type {string}
*/
this.messagePattern = messagePattern;
};
goog.inherits(goog.asserts.AssertionError, goog.debug.Error);
/** @override */
goog.asserts.AssertionError.prototype.name = 'AssertionError';
/**
* The default error handler.
* @param {!goog.asserts.AssertionError} e The exception to be handled.
*/
goog.asserts.DEFAULT_ERROR_HANDLER = function(e) { throw e; };
/**
* The handler responsible for throwing or logging assertion errors.
* @private {function(!goog.asserts.AssertionError)}
*/
goog.asserts.errorHandler_ = goog.asserts.DEFAULT_ERROR_HANDLER;
/**
* Throws an exception with the given message and "Assertion failed" prefixed
* onto it.
* @param {string} defaultMessage The message to use if givenMessage is empty.
* @param {Array<*>} defaultArgs The substitution arguments for defaultMessage.
* @param {string|undefined} givenMessage Message supplied by the caller.
* @param {Array<*>} givenArgs The substitution arguments for givenMessage.
* @throws {goog.asserts.AssertionError} When the value is not a number.
* @private
*/
goog.asserts.doAssertFailure_ =
function(defaultMessage, defaultArgs, givenMessage, givenArgs) {
var message = 'Assertion failed';
if (givenMessage) {
message += ': ' + givenMessage;
var args = givenArgs;
} else if (defaultMessage) {
message += ': ' + defaultMessage;
args = defaultArgs;
}
// The '' + works around an Opera 10 bug in the unit tests. Without it,
// a stack trace is added to var message above. With this, a stack trace is
// not added until this line (it causes the extra garbage to be added after
// the assertion message instead of in the middle of it).
var e = new goog.asserts.AssertionError('' + message, args || []);
goog.asserts.errorHandler_(e);
};
/**
* Sets a custom error handler that can be used to customize the behavior of
* assertion failures, for example by turning all assertion failures into log
* messages.
* @param {function(!goog.asserts.AssertionError)} errorHandler
*/
goog.asserts.setErrorHandler = function(errorHandler) {
if (goog.asserts.ENABLE_ASSERTS) {
goog.asserts.errorHandler_ = errorHandler;
}
};
/**
* Checks if the condition evaluates to true if goog.asserts.ENABLE_ASSERTS is
* true.
* @template T
* @param {T} condition The condition to check.
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @return {T} The value of the condition.
* @throws {goog.asserts.AssertionError} When the condition evaluates to false.
*/
goog.asserts.assert = function(condition, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !condition) {
goog.asserts.doAssertFailure_('', null, opt_message,
Array.prototype.slice.call(arguments, 2));
}
return condition;
};
/**
* Fails if goog.asserts.ENABLE_ASSERTS is true. This function is useful in case
* when we want to add a check in the unreachable area like switch-case
* statement:
*
* <pre>
* switch(type) {
* case FOO: doSomething(); break;
* case BAR: doSomethingElse(); break;
* default: goog.assert.fail('Unrecognized type: ' + type);
* // We have only 2 types - "default:" section is unreachable code.
* }
* </pre>
*
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @throws {goog.asserts.AssertionError} Failure.
*/
goog.asserts.fail = function(opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS) {
goog.asserts.errorHandler_(new goog.asserts.AssertionError(
'Failure' + (opt_message ? ': ' + opt_message : ''),
Array.prototype.slice.call(arguments, 1)));
}
};
/**
* Checks if the value is a number if goog.asserts.ENABLE_ASSERTS is true.
* @param {*} value The value to check.
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @return {number} The value, guaranteed to be a number when asserts enabled.
* @throws {goog.asserts.AssertionError} When the value is not a number.
*/
goog.asserts.assertNumber = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !goog.isNumber(value)) {
goog.asserts.doAssertFailure_('Expected number but got %s: %s.',
[goog.typeOf(value), value], opt_message,
Array.prototype.slice.call(arguments, 2));
}
return /** @type {number} */ (value);
};
/**
* Checks if the value is a string if goog.asserts.ENABLE_ASSERTS is true.
* @param {*} value The value to check.
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @return {string} The value, guaranteed to be a string when asserts enabled.
* @throws {goog.asserts.AssertionError} When the value is not a string.
*/
goog.asserts.assertString = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !goog.isString(value)) {
goog.asserts.doAssertFailure_('Expected string but got %s: %s.',
[goog.typeOf(value), value], opt_message,
Array.prototype.slice.call(arguments, 2));
}
return /** @type {string} */ (value);
};
/**
* Checks if the value is a function if goog.asserts.ENABLE_ASSERTS is true.
* @param {*} value The value to check.
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @return {!Function} The value, guaranteed to be a function when asserts
* enabled.
* @throws {goog.asserts.AssertionError} When the value is not a function.
*/
goog.asserts.assertFunction = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !goog.isFunction(value)) {
goog.asserts.doAssertFailure_('Expected function but got %s: %s.',
[goog.typeOf(value), value], opt_message,
Array.prototype.slice.call(arguments, 2));
}
return /** @type {!Function} */ (value);
};
/**
* Checks if the value is an Object if goog.asserts.ENABLE_ASSERTS is true.
* @param {*} value The value to check.
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @return {!Object} The value, guaranteed to be a non-null object.
* @throws {goog.asserts.AssertionError} When the value is not an object.
*/
goog.asserts.assertObject = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !goog.isObject(value)) {
goog.asserts.doAssertFailure_('Expected object but got %s: %s.',
[goog.typeOf(value), value],
opt_message, Array.prototype.slice.call(arguments, 2));
}
return /** @type {!Object} */ (value);
};
/**
* Checks if the value is an Array if goog.asserts.ENABLE_ASSERTS is true.
* @param {*} value The value to check.
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @return {!Array<?>} The value, guaranteed to be a non-null array.
* @throws {goog.asserts.AssertionError} When the value is not an array.
*/
goog.asserts.assertArray = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !goog.isArray(value)) {
goog.asserts.doAssertFailure_('Expected array but got %s: %s.',
[goog.typeOf(value), value], opt_message,
Array.prototype.slice.call(arguments, 2));
}
return /** @type {!Array<?>} */ (value);
};
/**
* Checks if the value is a boolean if goog.asserts.ENABLE_ASSERTS is true.
* @param {*} value The value to check.
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @return {boolean} The value, guaranteed to be a boolean when asserts are
* enabled.
* @throws {goog.asserts.AssertionError} When the value is not a boolean.
*/
goog.asserts.assertBoolean = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !goog.isBoolean(value)) {
goog.asserts.doAssertFailure_('Expected boolean but got %s: %s.',
[goog.typeOf(value), value], opt_message,
Array.prototype.slice.call(arguments, 2));
}
return /** @type {boolean} */ (value);
};
/**
* Checks if the value is a DOM Element if goog.asserts.ENABLE_ASSERTS is true.
* @param {*} value The value to check.
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @return {!Element} The value, likely to be a DOM Element when asserts are
* enabled.
* @throws {goog.asserts.AssertionError} When the value is not a boolean.
*/
goog.asserts.assertElement = function(value, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && (!goog.isObject(value) ||
value.nodeType != goog.dom.NodeType.ELEMENT)) {
goog.asserts.doAssertFailure_('Expected Element but got %s: %s.',
[goog.typeOf(value), value], opt_message,
Array.prototype.slice.call(arguments, 2));
}
return /** @type {!Element} */ (value);
};
/**
* Checks if the value is an instance of the user-defined type if
* goog.asserts.ENABLE_ASSERTS is true.
*
* The compiler may tighten the type returned by this function.
*
* @param {*} value The value to check.
* @param {function(new: T, ...)} type A user-defined constructor.
* @param {string=} opt_message Error message in case of failure.
* @param {...*} var_args The items to substitute into the failure message.
* @throws {goog.asserts.AssertionError} When the value is not an instance of
* type.
* @return {T}
* @template T
*/
goog.asserts.assertInstanceof = function(value, type, opt_message, var_args) {
if (goog.asserts.ENABLE_ASSERTS && !(value instanceof type)) {
goog.asserts.doAssertFailure_('Expected instanceof %s but got %s.',
[goog.asserts.getType_(type), goog.asserts.getType_(value)],
opt_message, Array.prototype.slice.call(arguments, 3));
}
return value;
};
/**
* Checks that no enumerable keys are present in Object.prototype. Such keys
* would break most code that use {@code for (var ... in ...)} loops.
*/
goog.asserts.assertObjectPrototypeIsIntact = function() {
for (var key in Object.prototype) {
goog.asserts.fail(key + ' should not be enumerable in Object.prototype.');
}
};
/**
* Returns the type of a value. If a constructor is passed, and a suitable
* string cannot be found, 'unknown type name' will be returned.
* @param {*} value A constructor, object, or primitive.
* @return {string} The best display name for the value, or 'unknown type name'.
* @private
*/
goog.asserts.getType_ = function(value) {
if (value instanceof Function) {
return value.displayName || value.name || 'unknown type name';
} else if (value instanceof Object) {
return value.constructor.displayName || value.constructor.name ||
Object.prototype.toString.call(value);
} else {
return value === null ? 'null' : typeof value;
}
};

View File

@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2008 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
Closure Unit Tests - goog.asserts.assert
</title>
<script src="../base.js">
</script>
<script>
goog.require('goog.assertsTest');
</script>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,242 @@
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
goog.provide('goog.assertsTest');
goog.setTestOnly('goog.assertsTest');
goog.require('goog.asserts');
goog.require('goog.asserts.AssertionError');
goog.require('goog.dom');
goog.require('goog.string');
goog.require('goog.testing.jsunit');
goog.require('goog.userAgent');
function doTestMessage(failFunc, expectedMsg) {
var error = assertThrows('failFunc should throw.', failFunc);
// Test error message.
// Opera 10 adds cruft to the end of the message, so do a startsWith check.
assertTrue('Message check failed. Expected: ' + expectedMsg + ' Actual: ' +
error.message, goog.string.startsWith(error.message, expectedMsg));
}
function testAssert() {
// None of them may throw exception
goog.asserts.assert(true);
goog.asserts.assert(1);
goog.asserts.assert([]);
goog.asserts.assert({});
assertThrows('assert(false)', goog.partial(goog.asserts.assert, false));
assertThrows('assert(0)', goog.partial(goog.asserts.assert, 0));
assertThrows('assert(null)', goog.partial(goog.asserts.assert, null));
assertThrows('assert(undefined)',
goog.partial(goog.asserts.assert, undefined));
// Test error messages.
doTestMessage(goog.partial(goog.asserts.assert, false), 'Assertion failed');
doTestMessage(goog.partial(goog.asserts.assert, false, 'ouch %s', 1),
'Assertion failed: ouch 1');
}
function testFail() {
assertThrows('fail()', goog.asserts.fail);
// Test error messages.
doTestMessage(goog.partial(goog.asserts.fail, false), 'Failure');
doTestMessage(goog.partial(goog.asserts.fail, 'ouch %s', 1),
'Failure: ouch 1');
}
function testNumber() {
goog.asserts.assertNumber(1);
assertThrows('assertNumber(null)',
goog.partial(goog.asserts.assertNumber, null));
// Test error messages.
doTestMessage(goog.partial(goog.asserts.assertNumber, null),
'Assertion failed: Expected number but got null: null.');
doTestMessage(goog.partial(goog.asserts.assertNumber, '1234'),
'Assertion failed: Expected number but got string: 1234.');
doTestMessage(goog.partial(goog.asserts.assertNumber, null, 'ouch %s', 1),
'Assertion failed: ouch 1');
}
function testString() {
assertEquals('1', goog.asserts.assertString('1'));
assertThrows('assertString(null)',
goog.partial(goog.asserts.assertString, null));
// Test error messages.
doTestMessage(goog.partial(goog.asserts.assertString, null),
'Assertion failed: Expected string but got null: null.');
doTestMessage(goog.partial(goog.asserts.assertString, 1234),
'Assertion failed: Expected string but got number: 1234.');
doTestMessage(goog.partial(goog.asserts.assertString, null, 'ouch %s', 1),
'Assertion failed: ouch 1');
}
function testFunction() {
function f() {};
assertEquals(f, goog.asserts.assertFunction(f));
assertThrows('assertFunction(null)',
goog.partial(goog.asserts.assertFunction, null));
// Test error messages.
doTestMessage(goog.partial(goog.asserts.assertFunction, null),
'Assertion failed: Expected function but got null: null.');
doTestMessage(goog.partial(goog.asserts.assertFunction, 1234),
'Assertion failed: Expected function but got number: 1234.');
doTestMessage(goog.partial(goog.asserts.assertFunction, null, 'ouch %s', 1),
'Assertion failed: ouch 1');
}
function testObject() {
var o = {};
assertEquals(o, goog.asserts.assertObject(o));
assertThrows('assertObject(null)',
goog.partial(goog.asserts.assertObject, null));
// Test error messages.
doTestMessage(goog.partial(goog.asserts.assertObject, null),
'Assertion failed: Expected object but got null: null.');
doTestMessage(goog.partial(goog.asserts.assertObject, 1234),
'Assertion failed: Expected object but got number: 1234.');
doTestMessage(goog.partial(goog.asserts.assertObject, null, 'ouch %s', 1),
'Assertion failed: ouch 1');
}
function testArray() {
var a = [];
assertEquals(a, goog.asserts.assertArray(a));
assertThrows('assertArray({})',
goog.partial(goog.asserts.assertArray, {}));
// Test error messages.
doTestMessage(goog.partial(goog.asserts.assertArray, null),
'Assertion failed: Expected array but got null: null.');
doTestMessage(goog.partial(goog.asserts.assertArray, 1234),
'Assertion failed: Expected array but got number: 1234.');
doTestMessage(goog.partial(goog.asserts.assertArray, null, 'ouch %s', 1),
'Assertion failed: ouch 1');
}
function testBoolean() {
assertEquals(true, goog.asserts.assertBoolean(true));
assertEquals(false, goog.asserts.assertBoolean(false));
assertThrows(goog.partial(goog.asserts.assertBoolean, null));
assertThrows(goog.partial(goog.asserts.assertBoolean, 'foo'));
// Test error messages.
doTestMessage(goog.partial(goog.asserts.assertBoolean, null),
'Assertion failed: Expected boolean but got null: null.');
doTestMessage(goog.partial(goog.asserts.assertBoolean, 1234),
'Assertion failed: Expected boolean but got number: 1234.');
doTestMessage(goog.partial(goog.asserts.assertBoolean, null, 'ouch %s', 1),
'Assertion failed: ouch 1');
}
function testElement() {
assertThrows(goog.partial(goog.asserts.assertElement, null));
assertThrows(goog.partial(goog.asserts.assertElement, 'foo'));
assertThrows(goog.partial(goog.asserts.assertElement,
goog.dom.createTextNode('foo')));
var elem = goog.dom.createElement('div');
assertEquals(elem, goog.asserts.assertElement(elem));
}
function testInstanceof() {
/** @constructor */
var F = function() {};
goog.asserts.assertInstanceof(new F(), F);
assertThrows('assertInstanceof({}, F)',
goog.partial(goog.asserts.assertInstanceof, {}, F));
// IE lacks support for function.name and will fallback to toString().
var object = goog.userAgent.IE ? '[object Object]' : 'Object';
// Test error messages.
doTestMessage(goog.partial(goog.asserts.assertInstanceof, {}, F),
'Assertion failed: Expected instanceof unknown type name but got ' +
object + '.');
doTestMessage(goog.partial(goog.asserts.assertInstanceof, {}, F, 'a %s', 1),
'Assertion failed: a 1');
doTestMessage(goog.partial(goog.asserts.assertInstanceof, null, F),
'Assertion failed: Expected instanceof unknown type name but got null.');
doTestMessage(goog.partial(goog.asserts.assertInstanceof, 5, F),
'Assertion failed: ' +
'Expected instanceof unknown type name but got number.');
// Test a constructor a with a name (IE does not support function.name).
if (!goog.userAgent.IE) {
F = function foo() {};
doTestMessage(goog.partial(goog.asserts.assertInstanceof, {}, F),
'Assertion failed: Expected instanceof foo but got ' + object + '.');
}
// Test a constructor with a displayName.
F.displayName = 'bar';
doTestMessage(goog.partial(goog.asserts.assertInstanceof, {}, F),
'Assertion failed: Expected instanceof bar but got ' + object + '.');
}
function testObjectPrototypeIsIntact() {
goog.asserts.assertObjectPrototypeIsIntact();
var originalToString = Object.prototype.toString;
Object.prototype.toString = goog.nullFunction;
try {
goog.asserts.assertObjectPrototypeIsIntact();
Object.prototype.foo = 1;
doTestMessage(goog.asserts.assertObjectPrototypeIsIntact,
'Failure: foo should not be enumerable in Object.prototype.');
} finally {
Object.prototype.toString = originalToString;
delete Object.prototype.foo;
}
}
function testAssertionError() {
var error = new goog.asserts.AssertionError('foo %s %s', [1, 'two']);
assertEquals('Wrong message', 'foo 1 two', error.message);
assertEquals('Wrong messagePattern', 'foo %s %s', error.messagePattern);
}
function testFailWithCustomErrorHandler() {
try {
var handledException;
goog.asserts.setErrorHandler(
function(e) { handledException = e; });
var expectedMessage = 'Failure: Gevalt!';
goog.asserts.fail('Gevalt!');
assertTrue('handledException is null.', handledException != null);
assertTrue('Message check failed. Expected: ' + expectedMessage +
' Actual: ' + handledException.message,
goog.string.startsWith(expectedMessage, handledException.message));
} finally {
goog.asserts.setErrorHandler(goog.asserts.DEFAULT_ERROR_HANDLER);
}
}
function testAssertWithCustomErrorHandler() {
try {
var handledException;
goog.asserts.setErrorHandler(
function(e) { handledException = e; });
var expectedMessage = 'Assertion failed: Gevalt!';
goog.asserts.assert(false, 'Gevalt!');
assertTrue('handledException is null.', handledException != null);
assertTrue('Message check failed. Expected: ' + expectedMessage +
' Actual: ' + handledException.message,
goog.string.startsWith(expectedMessage, handledException.message));
} finally {
goog.asserts.setErrorHandler(goog.asserts.DEFAULT_ERROR_HANDLER);
}
}

View File

@@ -0,0 +1,273 @@
// Copyright 2012 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview A delayed callback that pegs to the next animation frame
* instead of a user-configurable timeout.
*
* @author nicksantos@google.com (Nick Santos)
*/
goog.provide('goog.async.AnimationDelay');
goog.require('goog.Disposable');
goog.require('goog.events');
goog.require('goog.functions');
// TODO(nicksantos): Should we factor out the common code between this and
// goog.async.Delay? I'm not sure if there's enough code for this to really
// make sense. Subclassing seems like the wrong approach for a variety of
// reasons. Maybe there should be a common interface?
/**
* A delayed callback that pegs to the next animation frame
* instead of a user configurable timeout. By design, this should have
* the same interface as goog.async.Delay.
*
* Uses requestAnimationFrame and friends when available, but falls
* back to a timeout of goog.async.AnimationDelay.TIMEOUT.
*
* For more on requestAnimationFrame and how you can use it to create smoother
* animations, see:
* @see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
*
* @param {function(number)} listener Function to call when the delay completes.
* Will be passed the timestamp when it's called, in unix ms.
* @param {Window=} opt_window The window object to execute the delay in.
* Defaults to the global object.
* @param {Object=} opt_handler The object scope to invoke the function in.
* @constructor
* @extends {goog.Disposable}
* @final
*/
goog.async.AnimationDelay = function(listener, opt_window, opt_handler) {
goog.async.AnimationDelay.base(this, 'constructor');
/**
* The function that will be invoked after a delay.
* @type {function(number)}
* @private
*/
this.listener_ = listener;
/**
* The object context to invoke the callback in.
* @type {Object|undefined}
* @private
*/
this.handler_ = opt_handler;
/**
* @type {Window}
* @private
*/
this.win_ = opt_window || window;
/**
* Cached callback function invoked when the delay finishes.
* @type {function()}
* @private
*/
this.callback_ = goog.bind(this.doAction_, this);
};
goog.inherits(goog.async.AnimationDelay, goog.Disposable);
/**
* Identifier of the active delay timeout, or event listener,
* or null when inactive.
* @type {goog.events.Key|number|null}
* @private
*/
goog.async.AnimationDelay.prototype.id_ = null;
/**
* If we're using dom listeners.
* @type {?boolean}
* @private
*/
goog.async.AnimationDelay.prototype.usingListeners_ = false;
/**
* Default wait timeout for animations (in milliseconds). Only used for timed
* animation, which uses a timer (setTimeout) to schedule animation.
*
* @type {number}
* @const
*/
goog.async.AnimationDelay.TIMEOUT = 20;
/**
* Name of event received from the requestAnimationFrame in Firefox.
*
* @type {string}
* @const
* @private
*/
goog.async.AnimationDelay.MOZ_BEFORE_PAINT_EVENT_ = 'MozBeforePaint';
/**
* Starts the delay timer. The provided listener function will be called
* before the next animation frame.
*/
goog.async.AnimationDelay.prototype.start = function() {
this.stop();
this.usingListeners_ = false;
var raf = this.getRaf_();
var cancelRaf = this.getCancelRaf_();
if (raf && !cancelRaf && this.win_.mozRequestAnimationFrame) {
// Because Firefox (Gecko) runs animation in separate threads, it also saves
// time by running the requestAnimationFrame callbacks in that same thread.
// Sadly this breaks the assumption of implicit thread-safety in JS, and can
// thus create thread-based inconsistencies on counters etc.
//
// Calling cycleAnimations_ using the MozBeforePaint event instead of as
// callback fixes this.
//
// Trigger this condition only if the mozRequestAnimationFrame is available,
// but not the W3C requestAnimationFrame function (as in draft) or the
// equivalent cancel functions.
this.id_ = goog.events.listen(
this.win_,
goog.async.AnimationDelay.MOZ_BEFORE_PAINT_EVENT_,
this.callback_);
this.win_.mozRequestAnimationFrame(null);
this.usingListeners_ = true;
} else if (raf && cancelRaf) {
this.id_ = raf.call(this.win_, this.callback_);
} else {
this.id_ = this.win_.setTimeout(
// Prior to Firefox 13, Gecko passed a non-standard parameter
// to the callback that we want to ignore.
goog.functions.lock(this.callback_),
goog.async.AnimationDelay.TIMEOUT);
}
};
/**
* Stops the delay timer if it is active. No action is taken if the timer is not
* in use.
*/
goog.async.AnimationDelay.prototype.stop = function() {
if (this.isActive()) {
var raf = this.getRaf_();
var cancelRaf = this.getCancelRaf_();
if (raf && !cancelRaf && this.win_.mozRequestAnimationFrame) {
goog.events.unlistenByKey(this.id_);
} else if (raf && cancelRaf) {
cancelRaf.call(this.win_, /** @type {number} */ (this.id_));
} else {
this.win_.clearTimeout(/** @type {number} */ (this.id_));
}
}
this.id_ = null;
};
/**
* Fires delay's action even if timer has already gone off or has not been
* started yet; guarantees action firing. Stops the delay timer.
*/
goog.async.AnimationDelay.prototype.fire = function() {
this.stop();
this.doAction_();
};
/**
* Fires delay's action only if timer is currently active. Stops the delay
* timer.
*/
goog.async.AnimationDelay.prototype.fireIfActive = function() {
if (this.isActive()) {
this.fire();
}
};
/**
* @return {boolean} True if the delay is currently active, false otherwise.
*/
goog.async.AnimationDelay.prototype.isActive = function() {
return this.id_ != null;
};
/**
* Invokes the callback function after the delay successfully completes.
* @private
*/
goog.async.AnimationDelay.prototype.doAction_ = function() {
if (this.usingListeners_ && this.id_) {
goog.events.unlistenByKey(this.id_);
}
this.id_ = null;
// We are not using the timestamp returned by requestAnimationFrame
// because it may be either a Date.now-style time or a
// high-resolution time (depending on browser implementation). Using
// goog.now() will ensure that the timestamp used is consistent and
// compatible with goog.fx.Animation.
this.listener_.call(this.handler_, goog.now());
};
/** @override */
goog.async.AnimationDelay.prototype.disposeInternal = function() {
this.stop();
goog.async.AnimationDelay.base(this, 'disposeInternal');
};
/**
* @return {?function(function(number)): number} The requestAnimationFrame
* function, or null if not available on this browser.
* @private
*/
goog.async.AnimationDelay.prototype.getRaf_ = function() {
var win = this.win_;
return win.requestAnimationFrame ||
win.webkitRequestAnimationFrame ||
win.mozRequestAnimationFrame ||
win.oRequestAnimationFrame ||
win.msRequestAnimationFrame ||
null;
};
/**
* @return {?function(number): number} The cancelAnimationFrame function,
* or null if not available on this browser.
* @private
*/
goog.async.AnimationDelay.prototype.getCancelRaf_ = function() {
var win = this.win_;
return win.cancelAnimationFrame ||
win.cancelRequestAnimationFrame ||
win.webkitCancelRequestAnimationFrame ||
win.mozCancelRequestAnimationFrame ||
win.oCancelRequestAnimationFrame ||
win.msCancelRequestAnimationFrame ||
null;
};

View File

@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2012 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
Author: nicksantos@google.com (Nick Santos)
-->
<head>
<title>
JsUnit tests for goog.async.AnimationDelay
</title>
<script src="../base.js">
</script>
<script>
goog.require('goog.async.AnimationDelayTest');
</script>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,81 @@
// Copyright 2012 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
goog.provide('goog.async.AnimationDelayTest');
goog.setTestOnly('goog.async.AnimationDelayTest');
goog.require('goog.async.AnimationDelay');
goog.require('goog.testing.AsyncTestCase');
goog.require('goog.testing.PropertyReplacer');
goog.require('goog.testing.jsunit');
goog.require('goog.testing.recordFunction');
var testCase = goog.testing.AsyncTestCase.createAndInstall();
var stubs = new goog.testing.PropertyReplacer();
function tearDown() {
stubs.reset();
}
function testStart() {
var callCount = 0;
var start = goog.now();
var delay = new goog.async.AnimationDelay(function(end) {
callCount++;
});
delay.start();
testCase.waitForAsync('waiting for delay');
window.setTimeout(function() {
testCase.continueTesting();
assertEquals(1, callCount);
}, 500);
}
function testStop() {
var callCount = 0;
var start = goog.now();
var delay = new goog.async.AnimationDelay(function(end) {
callCount++;
});
delay.start();
testCase.waitForAsync('waiting for delay');
delay.stop();
window.setTimeout(function() {
testCase.continueTesting();
assertEquals(0, callCount);
}, 500);
}
function testAlwaysUseGoogNowForHandlerTimestamp() {
var expectedValue = 12345.1;
stubs.set(goog, 'now', function() {
return expectedValue;
});
var handler = goog.testing.recordFunction(function(timestamp) {
assertEquals(expectedValue, timestamp);
});
var delay = new goog.async.AnimationDelay(handler);
delay.start();
testCase.waitForAsync('waiting for delay');
window.setTimeout(function() {
testCase.continueTesting();
assertEquals(1, handler.getCallCount());
}, 500);
}

View File

@@ -0,0 +1,235 @@
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Defines a class useful for handling functions that must be
* invoked later when some condition holds. Examples include deferred function
* calls that return a boolean flag whether it succedeed or not.
*
* Example:
*
* function deferred() {
* var succeeded = false;
* // ... custom code
* return succeeded;
* }
*
* var deferredCall = new goog.async.ConditionalDelay(deferred);
* deferredCall.onSuccess = function() {
* alert('Success: The deferred function has been successfully executed.');
* }
* deferredCall.onFailure = function() {
* alert('Failure: Time limit exceeded.');
* }
*
* // Call the deferred() every 100 msec until it returns true,
* // or 5 seconds pass.
* deferredCall.start(100, 5000);
*
* // Stop the deferred function call (does nothing if it's not active).
* deferredCall.stop();
*
*/
goog.provide('goog.async.ConditionalDelay');
goog.require('goog.Disposable');
goog.require('goog.async.Delay');
/**
* A ConditionalDelay object invokes the associated function after a specified
* interval delay and checks its return value. If the function returns
* {@code true} the conditional delay is cancelled and {@see #onSuccess}
* is called. Otherwise this object keeps to invoke the deferred function until
* either it returns {@code true} or the timeout is exceeded. In the latter case
* the {@see #onFailure} method will be called.
*
* The interval duration and timeout can be specified each time the delay is
* started. Calling start on an active delay will reset the timer.
*
* @param {function():boolean} listener Function to call when the delay
* completes. Should return a value that type-converts to {@code true} if
* the call succeeded and this delay should be stopped.
* @param {Object=} opt_handler The object scope to invoke the function in.
* @constructor
* @extends {goog.Disposable}
*/
goog.async.ConditionalDelay = function(listener, opt_handler) {
goog.Disposable.call(this);
/**
* The function that will be invoked after a delay.
* @type {function():boolean}
* @private
*/
this.listener_ = listener;
/**
* The object context to invoke the callback in.
* @type {Object|undefined}
* @private
*/
this.handler_ = opt_handler;
/**
* The underlying goog.async.Delay delegate object.
* @type {goog.async.Delay}
* @private
*/
this.delay_ = new goog.async.Delay(
goog.bind(this.onTick_, this), 0 /*interval*/, this /*scope*/);
};
goog.inherits(goog.async.ConditionalDelay, goog.Disposable);
/**
* The delay interval in milliseconds to between the calls to the callback.
* Note, that the callback may be invoked earlier than this interval if the
* timeout is exceeded.
* @type {number}
* @private
*/
goog.async.ConditionalDelay.prototype.interval_ = 0;
/**
* The timeout timestamp until which the delay is to be executed.
* A negative value means no timeout.
* @type {number}
* @private
*/
goog.async.ConditionalDelay.prototype.runUntil_ = 0;
/**
* True if the listener has been executed, and it returned {@code true}.
* @type {boolean}
* @private
*/
goog.async.ConditionalDelay.prototype.isDone_ = false;
/** @override */
goog.async.ConditionalDelay.prototype.disposeInternal = function() {
this.delay_.dispose();
delete this.listener_;
delete this.handler_;
goog.async.ConditionalDelay.superClass_.disposeInternal.call(this);
};
/**
* Starts the delay timer. The provided listener function will be called
* repeatedly after the specified interval until the function returns
* {@code true} or the timeout is exceeded. Calling start on an active timer
* will stop the timer first.
* @param {number=} opt_interval The time interval between the function
* invocations (in milliseconds). Default is 0.
* @param {number=} opt_timeout The timeout interval (in milliseconds). Takes
* precedence over the {@code opt_interval}, i.e. if the timeout is less
* than the invocation interval, the function will be called when the
* timeout is exceeded. A negative value means no timeout. Default is 0.
*/
goog.async.ConditionalDelay.prototype.start = function(opt_interval,
opt_timeout) {
this.stop();
this.isDone_ = false;
var timeout = opt_timeout || 0;
this.interval_ = Math.max(opt_interval || 0, 0);
this.runUntil_ = timeout < 0 ? -1 : (goog.now() + timeout);
this.delay_.start(
timeout < 0 ? this.interval_ : Math.min(this.interval_, timeout));
};
/**
* Stops the delay timer if it is active. No action is taken if the timer is not
* in use.
*/
goog.async.ConditionalDelay.prototype.stop = function() {
this.delay_.stop();
};
/**
* @return {boolean} True if the delay is currently active, false otherwise.
*/
goog.async.ConditionalDelay.prototype.isActive = function() {
return this.delay_.isActive();
};
/**
* @return {boolean} True if the listener has been executed and returned
* {@code true} since the last call to {@see #start}.
*/
goog.async.ConditionalDelay.prototype.isDone = function() {
return this.isDone_;
};
/**
* Called when the listener has been successfully executed and returned
* {@code true}. The {@see #isDone} method should return {@code true} by now.
* Designed for inheritance, should be overridden by subclasses or on the
* instances if they care.
*/
goog.async.ConditionalDelay.prototype.onSuccess = function() {
// Do nothing by default.
};
/**
* Called when this delayed call is cancelled because the timeout has been
* exceeded, and the listener has never returned {@code true}.
* Designed for inheritance, should be overridden by subclasses or on the
* instances if they care.
*/
goog.async.ConditionalDelay.prototype.onFailure = function() {
// Do nothing by default.
};
/**
* A callback function for the underlying {@code goog.async.Delay} object. When
* executed the listener function is called, and if it returns {@code true}
* the delay is stopped and the {@see #onSuccess} method is invoked.
* If the timeout is exceeded the delay is stopped and the
* {@see #onFailure} method is called.
* @private
*/
goog.async.ConditionalDelay.prototype.onTick_ = function() {
var successful = this.listener_.call(this.handler_);
if (successful) {
this.isDone_ = true;
this.onSuccess();
} else {
// Try to reschedule the task.
if (this.runUntil_ < 0) {
// No timeout.
this.delay_.start(this.interval_);
} else {
var timeLeft = this.runUntil_ - goog.now();
if (timeLeft <= 0) {
this.onFailure();
} else {
this.delay_.start(Math.min(this.interval_, timeLeft));
}
}
}
};

View File

@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2008 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
Closure Unit Tests - goog.async.ConditionalDelay
</title>
<script src="../base.js">
</script>
<script>
goog.require('goog.async.ConditionalDelayTest');
</script>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,222 @@
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
goog.provide('goog.async.ConditionalDelayTest');
goog.setTestOnly('goog.async.ConditionalDelayTest');
goog.require('goog.async.ConditionalDelay');
goog.require('goog.testing.MockClock');
goog.require('goog.testing.jsunit');
var invoked = false;
var delay = null;
var clock = null;
var returnValue = true;
var onSuccessCalled = false;
var onFailureCalled = false;
function callback() {
invoked = true;
return returnValue;
}
function setUp() {
clock = new goog.testing.MockClock(true);
invoked = false;
returnValue = true;
onSuccessCalled = false;
onFailureCalled = false;
delay = new goog.async.ConditionalDelay(callback);
delay.onSuccess = function() {
onSuccessCalled = true;
};
delay.onFailure = function() {
onFailureCalled = true;
};
}
function tearDown() {
clock.dispose();
delay.dispose();
}
function testDelay() {
delay.start(200, 200);
assertFalse(invoked);
clock.tick(100);
assertFalse(invoked);
clock.tick(100);
assertTrue(invoked);
}
function testStop() {
delay.start(200, 500);
assertTrue(delay.isActive());
clock.tick(100);
assertFalse(invoked);
delay.stop();
clock.tick(100);
assertFalse(invoked);
assertFalse(delay.isActive());
}
function testIsActive() {
assertFalse(delay.isActive());
delay.start(200, 200);
assertTrue(delay.isActive());
clock.tick(200);
assertFalse(delay.isActive());
}
function testRestart() {
delay.start(200, 50000);
clock.tick(100);
delay.stop();
assertFalse(invoked);
delay.start(200, 50000);
clock.tick(199);
assertFalse(invoked);
clock.tick(1);
assertTrue(invoked);
invoked = false;
delay.start(200, 200);
clock.tick(200);
assertTrue(invoked);
assertFalse(delay.isActive());
}
function testDispose() {
delay.start(200, 200);
delay.dispose();
assertTrue(delay.isDisposed());
clock.tick(500);
assertFalse(invoked);
}
function testConditionalDelay_Success() {
returnValue = false;
delay.start(100, 300);
clock.tick(99);
assertFalse(invoked);
clock.tick(1);
assertTrue(invoked);
assertTrue(delay.isActive());
assertFalse(delay.isDone());
assertFalse(onSuccessCalled);
assertFalse(onFailureCalled);
returnValue = true;
invoked = false;
clock.tick(100);
assertTrue(invoked);
assertFalse(delay.isActive());
assertTrue(delay.isDone());
assertTrue(onSuccessCalled);
assertFalse(onFailureCalled);
invoked = false;
clock.tick(200);
assertFalse(invoked);
}
function testConditionalDelay_Failure() {
returnValue = false;
delay.start(100, 300);
clock.tick(99);
assertFalse(invoked);
clock.tick(1);
assertTrue(invoked);
assertTrue(delay.isActive());
assertFalse(delay.isDone());
assertFalse(onSuccessCalled);
assertFalse(onFailureCalled);
invoked = false;
clock.tick(100);
assertTrue(invoked);
assertFalse(onSuccessCalled);
assertFalse(onFailureCalled);
invoked = false;
clock.tick(90);
assertFalse(invoked);
clock.tick(10);
assertTrue(invoked);
assertFalse(delay.isActive());
assertFalse(delay.isDone());
assertFalse(onSuccessCalled);
assertTrue(onFailureCalled);
}
function testInfiniteDelay() {
returnValue = false;
delay.start(100, -1);
// Test in a big enough loop.
for (var i = 0; i < 1000; ++i) {
clock.tick(80);
assertTrue(delay.isActive());
assertFalse(delay.isDone());
assertFalse(onSuccessCalled);
assertFalse(onFailureCalled);
}
delay.stop();
assertFalse(delay.isActive());
assertFalse(delay.isDone());
assertFalse(onSuccessCalled);
assertFalse(onFailureCalled);
}
function testCallbackScope() {
var callbackCalled = false;
var scopeObject = {};
function internalCallback() {
assertEquals(this, scopeObject);
callbackCalled = true;
return true;
}
delay = new goog.async.ConditionalDelay(internalCallback, scopeObject);
delay.start(200, 200);
clock.tick(201);
assertTrue(callbackCalled);
}

View File

@@ -0,0 +1,179 @@
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Defines a class useful for handling functions that must be
* invoked after a delay, especially when that delay is frequently restarted.
* Examples include delaying before displaying a tooltip, menu hysteresis,
* idle timers, etc.
* @author brenneman@google.com (Shawn Brenneman)
* @see ../demos/timers.html
*/
goog.provide('goog.Delay');
goog.provide('goog.async.Delay');
goog.require('goog.Disposable');
goog.require('goog.Timer');
/**
* A Delay object invokes the associated function after a specified delay. The
* interval duration can be specified once in the constructor, or can be defined
* each time the delay is started. Calling start on an active delay will reset
* the timer.
*
* @param {Function} listener Function to call when the delay completes.
* @param {number=} opt_interval The default length of the invocation delay (in
* milliseconds).
* @param {Object=} opt_handler The object scope to invoke the function in.
* @constructor
* @extends {goog.Disposable}
* @final
*/
goog.async.Delay = function(listener, opt_interval, opt_handler) {
goog.Disposable.call(this);
/**
* The function that will be invoked after a delay.
* @type {Function}
* @private
*/
this.listener_ = listener;
/**
* The default amount of time to delay before invoking the callback.
* @type {number}
* @private
*/
this.interval_ = opt_interval || 0;
/**
* The object context to invoke the callback in.
* @type {Object|undefined}
* @private
*/
this.handler_ = opt_handler;
/**
* Cached callback function invoked when the delay finishes.
* @type {Function}
* @private
*/
this.callback_ = goog.bind(this.doAction_, this);
};
goog.inherits(goog.async.Delay, goog.Disposable);
/**
* A deprecated alias.
* @deprecated Use goog.async.Delay instead.
* @constructor
* @final
*/
goog.Delay = goog.async.Delay;
/**
* Identifier of the active delay timeout, or 0 when inactive.
* @type {number}
* @private
*/
goog.async.Delay.prototype.id_ = 0;
/**
* Disposes of the object, cancelling the timeout if it is still outstanding and
* removing all object references.
* @override
* @protected
*/
goog.async.Delay.prototype.disposeInternal = function() {
goog.async.Delay.superClass_.disposeInternal.call(this);
this.stop();
delete this.listener_;
delete this.handler_;
};
/**
* Starts the delay timer. The provided listener function will be called after
* the specified interval. Calling start on an active timer will reset the
* delay interval.
* @param {number=} opt_interval If specified, overrides the object's default
* interval with this one (in milliseconds).
*/
goog.async.Delay.prototype.start = function(opt_interval) {
this.stop();
this.id_ = goog.Timer.callOnce(
this.callback_,
goog.isDef(opt_interval) ? opt_interval : this.interval_);
};
/**
* Stops the delay timer if it is active. No action is taken if the timer is not
* in use.
*/
goog.async.Delay.prototype.stop = function() {
if (this.isActive()) {
goog.Timer.clear(this.id_);
}
this.id_ = 0;
};
/**
* Fires delay's action even if timer has already gone off or has not been
* started yet; guarantees action firing. Stops the delay timer.
*/
goog.async.Delay.prototype.fire = function() {
this.stop();
this.doAction_();
};
/**
* Fires delay's action only if timer is currently active. Stops the delay
* timer.
*/
goog.async.Delay.prototype.fireIfActive = function() {
if (this.isActive()) {
this.fire();
}
};
/**
* @return {boolean} True if the delay is currently active, false otherwise.
*/
goog.async.Delay.prototype.isActive = function() {
return this.id_ != 0;
};
/**
* Invokes the callback function after the delay successfully completes.
* @private
*/
goog.async.Delay.prototype.doAction_ = function() {
this.id_ = 0;
if (this.listener_) {
this.listener_.call(this.handler_);
}
};

View File

@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2007 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
Closure Unit Tests - goog.async.Delay
</title>
<script src="../base.js">
</script>
<script>
goog.require('goog.async.DelayTest');
</script>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,142 @@
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
goog.provide('goog.async.DelayTest');
goog.setTestOnly('goog.async.DelayTest');
goog.require('goog.async.Delay');
goog.require('goog.testing.MockClock');
goog.require('goog.testing.jsunit');
var invoked = false;
var delay = null;
var clock = null;
function callback() {
invoked = true;
}
function setUp() {
clock = new goog.testing.MockClock(true);
invoked = false;
delay = new goog.async.Delay(callback, 200);
}
function tearDown() {
clock.dispose();
delay.dispose();
}
function testDelay() {
delay.start();
assertFalse(invoked);
clock.tick(100);
assertFalse(invoked);
clock.tick(100);
assertTrue(invoked);
}
function testStop() {
delay.start();
clock.tick(100);
assertFalse(invoked);
delay.stop();
clock.tick(100);
assertFalse(invoked);
}
function testIsActive() {
assertFalse(delay.isActive());
delay.start();
assertTrue(delay.isActive());
clock.tick(200);
assertFalse(delay.isActive());
}
function testRestart() {
delay.start();
clock.tick(100);
delay.stop();
assertFalse(invoked);
delay.start();
clock.tick(199);
assertFalse(invoked);
clock.tick(1);
assertTrue(invoked);
invoked = false;
delay.start();
clock.tick(200);
assertTrue(invoked);
}
function testOverride() {
delay.start(50);
clock.tick(49);
assertFalse(invoked);
clock.tick(1);
assertTrue(invoked);
}
function testDispose() {
delay.start();
delay.dispose();
assertTrue(delay.isDisposed());
clock.tick(500);
assertFalse(invoked);
}
function testFire() {
delay.start();
clock.tick(50);
delay.fire();
assertTrue(invoked);
assertFalse(delay.isActive());
invoked = false;
clock.tick(200);
assertFalse('Delay fired early with fire call, timeout should have been ' +
'cleared', invoked);
}
function testFireIfActive() {
delay.fireIfActive();
assertFalse(invoked);
delay.start();
delay.fireIfActive();
assertTrue(invoked);
invoked = false;
clock.tick(300);
assertFalse('Delay fired early with fireIfActive, timeout should have been ' +
'cleared', invoked);
}

View File

@@ -0,0 +1,231 @@
// Copyright 2013 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Provides a function to schedule running a function as soon
* as possible after the current JS execution stops and yields to the event
* loop.
*
*/
goog.provide('goog.async.nextTick');
goog.provide('goog.async.throwException');
goog.require('goog.debug.entryPointRegistry');
goog.require('goog.functions');
goog.require('goog.labs.userAgent.browser');
/**
* Throw an item without interrupting the current execution context. For
* example, if processing a group of items in a loop, sometimes it is useful
* to report an error while still allowing the rest of the batch to be
* processed.
* @param {*} exception
*/
goog.async.throwException = function(exception) {
// Each throw needs to be in its own context.
goog.global.setTimeout(function() { throw exception; }, 0);
};
/**
* Fires the provided callbacks as soon as possible after the current JS
* execution context. setTimeout(…, 0) takes at least 4ms when called from
* within another setTimeout(…, 0) for legacy reasons.
*
* This will not schedule the callback as a microtask (i.e. a task that can
* preempt user input or networking callbacks). It is meant to emulate what
* setTimeout(_, 0) would do if it were not throttled. If you desire microtask
* behavior, use {@see goog.Promise} instead.
*
* @param {function(this:SCOPE)} callback Callback function to fire as soon as
* possible.
* @param {SCOPE=} opt_context Object in whose scope to call the listener.
* @param {boolean=} opt_useSetImmediate Avoid the IE workaround that
* ensures correctness at the cost of speed. See comments for details.
* @template SCOPE
*/
goog.async.nextTick = function(callback, opt_context, opt_useSetImmediate) {
var cb = callback;
if (opt_context) {
cb = goog.bind(callback, opt_context);
}
cb = goog.async.nextTick.wrapCallback_(cb);
// window.setImmediate was introduced and currently only supported by IE10+,
// but due to a bug in the implementation it is not guaranteed that
// setImmediate is faster than setTimeout nor that setImmediate N is before
// setImmediate N+1. That is why we do not use the native version if
// available. We do, however, call setImmediate if it is a normal function
// because that indicates that it has been replaced by goog.testing.MockClock
// which we do want to support.
// See
// http://connect.microsoft.com/IE/feedback/details/801823/setimmediate-and-messagechannel-are-broken-in-ie10
//
// Note we do allow callers to also request setImmediate if they are willing
// to accept the possible tradeoffs of incorrectness in exchange for speed.
// The IE fallback of readystate change is much slower.
if (goog.isFunction(goog.global.setImmediate) &&
(opt_useSetImmediate || !goog.global.Window ||
goog.global.Window.prototype.setImmediate != goog.global.setImmediate)) {
goog.global.setImmediate(cb);
return;
}
// Look for and cache the custom fallback version of setImmediate.
if (!goog.async.nextTick.setImmediate_) {
goog.async.nextTick.setImmediate_ =
goog.async.nextTick.getSetImmediateEmulator_();
}
goog.async.nextTick.setImmediate_(cb);
};
/**
* Cache for the setImmediate implementation.
* @type {function(function())}
* @private
*/
goog.async.nextTick.setImmediate_;
/**
* Determines the best possible implementation to run a function as soon as
* the JS event loop is idle.
* @return {function(function())} The "setImmediate" implementation.
* @private
*/
goog.async.nextTick.getSetImmediateEmulator_ = function() {
// Create a private message channel and use it to postMessage empty messages
// to ourselves.
var Channel = goog.global['MessageChannel'];
// If MessageChannel is not available and we are in a browser, implement
// an iframe based polyfill in browsers that have postMessage and
// document.addEventListener. The latter excludes IE8 because it has a
// synchronous postMessage implementation.
if (typeof Channel === 'undefined' && typeof window !== 'undefined' &&
window.postMessage && window.addEventListener) {
/** @constructor */
Channel = function() {
// Make an empty, invisible iframe.
var iframe = document.createElement('iframe');
iframe.style.display = 'none';
iframe.src = '';
document.documentElement.appendChild(iframe);
var win = iframe.contentWindow;
var doc = win.document;
doc.open();
doc.write('');
doc.close();
// Do not post anything sensitive over this channel, as the workaround for
// pages with file: origin could allow that information to be modified or
// intercepted.
var message = 'callImmediate' + Math.random();
// The same origin policy rejects attempts to postMessage from file: urls
// unless the origin is '*'.
// TODO(b/16335441): Use '*' origin for data: and other similar protocols.
var origin = win.location.protocol == 'file:' ?
'*' : win.location.protocol + '//' + win.location.host;
var onmessage = goog.bind(function(e) {
// Validate origin and message to make sure that this message was
// intended for us. If the origin is set to '*' (see above) only the
// message needs to match since, for example, '*' != 'file://'. Allowing
// the wildcard is ok, as we are not concerned with security here.
if ((origin != '*' && e.origin != origin) || e.data != message) {
return;
}
this['port1'].onmessage();
}, this);
win.addEventListener('message', onmessage, false);
this['port1'] = {};
this['port2'] = {
postMessage: function() {
win.postMessage(message, origin);
}
};
};
}
if (typeof Channel !== 'undefined' &&
(!goog.labs.userAgent.browser.isIE())) {
// Exclude all of IE due to
// http://codeforhire.com/2013/09/21/setimmediate-and-messagechannel-broken-on-internet-explorer-10/
// which allows starving postMessage with a busy setTimeout loop.
// This currently affects IE10 and IE11 which would otherwise be able
// to use the postMessage based fallbacks.
var channel = new Channel();
// Use a fifo linked list to call callbacks in the right order.
var head = {};
var tail = head;
channel['port1'].onmessage = function() {
if (goog.isDef(head.next)) {
head = head.next;
var cb = head.cb;
head.cb = null;
cb();
}
};
return function(cb) {
tail.next = {
cb: cb
};
tail = tail.next;
channel['port2'].postMessage(0);
};
}
// Implementation for IE6+: Script elements fire an asynchronous
// onreadystatechange event when inserted into the DOM.
if (typeof document !== 'undefined' && 'onreadystatechange' in
document.createElement('script')) {
return function(cb) {
var script = document.createElement('script');
script.onreadystatechange = function() {
// Clean up and call the callback.
script.onreadystatechange = null;
script.parentNode.removeChild(script);
script = null;
cb();
cb = null;
};
document.documentElement.appendChild(script);
};
}
// Fall back to setTimeout with 0. In browsers this creates a delay of 5ms
// or more.
return function(cb) {
goog.global.setTimeout(cb, 0);
};
};
/**
* Helper function that is overrided to protect callbacks with entry point
* monitor if the application monitors entry points.
* @param {function()} callback Callback function to fire as soon as possible.
* @return {function()} The wrapped callback.
* @private
*/
goog.async.nextTick.wrapCallback_ = goog.functions.identity;
// Register the callback function as an entry point, so that it can be
// monitored for exception handling, etc. This has to be done in this file
// since it requires special code to handle all browsers.
goog.debug.entryPointRegistry.register(
/**
* @param {function(!Function): !Function} transformer The transforming
* function.
*/
function(transformer) {
goog.async.nextTick.wrapCallback_ = transformer;
});

View File

@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2013 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
Closure Unit Tests - goog.async.nextTick
</title>
<script src="../base.js">
</script>
<script>
goog.require('goog.async.nextTickTest');
</script>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,243 @@
// Copyright 2013 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
goog.provide('goog.async.nextTickTest');
goog.setTestOnly('goog.async.nextTickTest');
goog.require('goog.async.nextTick');
goog.require('goog.debug.ErrorHandler');
goog.require('goog.debug.entryPointRegistry');
goog.require('goog.dom');
goog.require('goog.labs.userAgent.browser');
goog.require('goog.testing.AsyncTestCase');
goog.require('goog.testing.MockClock');
goog.require('goog.testing.PropertyReplacer');
goog.require('goog.testing.jsunit');
var asyncTestCase = goog.testing.AsyncTestCase.createAndInstall(
'asyncNextTickTest');
var clock;
var propertyReplacer = new goog.testing.PropertyReplacer();
function setUp() {
clock = null;
}
function tearDown() {
if (clock) {
clock.uninstall();
}
goog.async.nextTick.setImmediate_ = undefined;
propertyReplacer.reset();
}
function testNextTick() {
var c = 0;
var max = 100;
var async = true;
var counterStep = function(i) {
async = false;
assertEquals('Order correct', i, c);
c++;
if (c === max) {
asyncTestCase.continueTesting();
}
};
for (var i = 0; i < max; i++) {
goog.async.nextTick(goog.partial(counterStep, i));
}
assertTrue(async);
asyncTestCase.waitForAsync('Wait for callback');
}
function testNextTickSetImmediate() {
var c = 0;
var max = 100;
var async = true;
var counterStep = function(i) {
async = false;
assertEquals('Order correct', i, c);
c++;
if (c === max) {
asyncTestCase.continueTesting();
}
};
for (var i = 0; i < max; i++) {
goog.async.nextTick(goog.partial(counterStep, i), undefined,
/* opt_useSetImmediate */ true);
}
assertTrue(async);
asyncTestCase.waitForAsync('Wait for callback');
}
function testNextTickContext() {
var context = {};
var c = 0;
var max = 10;
var async = true;
var counterStep = function(i) {
async = false;
assertEquals('Order correct', i, c);
assertEquals(context, this);
c++;
if (c === max) {
asyncTestCase.continueTesting();
}
};
for (var i = 0; i < max; i++) {
goog.async.nextTick(goog.partial(counterStep, i), context);
}
assertTrue(async);
asyncTestCase.waitForAsync('Wait for callback');
}
function testNextTickMockClock() {
clock = new goog.testing.MockClock(true);
var result = '';
goog.async.nextTick(function() {
result += 'a';
});
goog.async.nextTick(function() {
result += 'b';
});
goog.async.nextTick(function() {
result += 'c';
});
assertEquals('', result);
clock.tick(0);
assertEquals('abc', result);
}
function testNextTickDoesntSwallowError() {
var before = window.onerror;
var sentinel = 'sentinel';
window.onerror = function(e) {
e = '' + e;
// Don't test for contents in IE7, which does not preserve the exception
// message.
if (e.indexOf('Exception thrown and not caught') == -1) {
assertContains(sentinel, e);
}
window.onerror = before;
asyncTestCase.continueTesting();
return false;
};
goog.async.nextTick(function() {
throw sentinel;
});
asyncTestCase.waitForAsync('Wait for error');
}
function testNextTickProtectEntryPoint() {
var errorHandlerCallbackCalled = false;
var errorHandler = new goog.debug.ErrorHandler(function() {
errorHandlerCallbackCalled = true;
});
// This is only testing wrapping the callback with the protected entry point,
// so it's okay to replace this function with a fake.
goog.async.nextTick.setImmediate_ = function(cb) {
try {
cb();
fail('The callback should have thrown an error.');
} catch (e) {
assertTrue(
e instanceof goog.debug.ErrorHandler.ProtectedFunctionError);
}
asyncTestCase.continueTesting();
};
var origSetImmediate;
if (window.setImmediate) {
origSetImmediate = window.setImmediate;
window.setImmediate = goog.async.nextTick.setImmediate_;
}
goog.debug.entryPointRegistry.monitorAll(errorHandler);
function thrower() {
throw Error('This should be caught by the protected function.');
}
asyncTestCase.waitForAsync('Wait for callback');
goog.async.nextTick(thrower);
window.setImmediate = origSetImmediate;
}
function testNextTick_notStarvedBySetTimeout() {
// This test will timeout when affected by
// http://codeforhire.com/2013/09/21/setimmediate-and-messagechannel-broken-on-internet-explorer-10/
// This test would fail without the fix introduced in cl/72472221
// It keeps scheduling 0 timeouts and a single nextTick. If the nextTick
// ever fires, the IE specific problem does not occur.
var timeout;
function busy() {
timeout = setTimeout(function() {
busy();
}, 0);
}
busy();
goog.async.nextTick(function() {
if (timeout) {
clearTimeout(timeout);
}
asyncTestCase.continueTesting();
});
asyncTestCase.waitForAsync('Waiting not to starve');
}
/**
* Test a scenario in which the iframe used by the postMessage polyfill gets a
* message that does not have match what is expected. In this case, the polyfill
* should not try to invoke a callback (which would result in an error because
* there would be no callbacks in the linked list).
*/
function testPostMessagePolyfillDoesNotPumpCallbackQueueIfMessageIsIncorrect() {
// IE does not use the postMessage polyfill.
if (goog.labs.userAgent.browser.isIE()) {
return;
}
// Force postMessage pollyfill for setImmediate.
propertyReplacer.set(window, 'setImmediate', undefined);
propertyReplacer.set(window, 'MessageChannel', undefined);
var callbackCalled = false;
goog.async.nextTick(function() {
callbackCalled = true;
});
var frame = document.getElementsByTagName('iframe')[0];
frame.contentWindow.postMessage('bogus message',
window.location.protocol + '//' + window.location.host);
var error = null;
frame.contentWindow.onerror = function(e) {
error = e;
};
setTimeout(function() {
assert('Callback should have been called.', callbackCalled);
assertNull('An unexpected error was thrown.', error);
goog.dom.removeNode(frame);
asyncTestCase.continueTesting();
}, 0);
asyncTestCase.waitForAsync('Waiting for callbacks to be invoked.');
}

View File

@@ -0,0 +1,150 @@
// Copyright 2013 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
goog.provide('goog.async.run');
goog.require('goog.async.nextTick');
goog.require('goog.async.throwException');
goog.require('goog.testing.watchers');
/**
* Fires the provided callback just before the current callstack unwinds, or as
* soon as possible after the current JS execution context.
* @param {function(this:THIS)} callback
* @param {THIS=} opt_context Object to use as the "this value" when calling
* the provided function.
* @template THIS
*/
goog.async.run = function(callback, opt_context) {
if (!goog.async.run.schedule_) {
goog.async.run.initializeRunner_();
}
if (!goog.async.run.workQueueScheduled_) {
// Nothing is currently scheduled, schedule it now.
goog.async.run.schedule_();
goog.async.run.workQueueScheduled_ = true;
}
goog.async.run.workQueue_.push(
new goog.async.run.WorkItem_(callback, opt_context));
};
/**
* Initializes the function to use to process the work queue.
* @private
*/
goog.async.run.initializeRunner_ = function() {
// If native Promises are available in the browser, just schedule the callback
// on a fulfilled promise, which is specified to be async, but as fast as
// possible.
if (goog.global.Promise && goog.global.Promise.resolve) {
var promise = goog.global.Promise.resolve();
goog.async.run.schedule_ = function() {
promise.then(goog.async.run.processWorkQueue);
};
} else {
goog.async.run.schedule_ = function() {
goog.async.nextTick(goog.async.run.processWorkQueue);
};
}
};
/**
* Forces goog.async.run to use nextTick instead of Promise.
*
* This should only be done in unit tests. It's useful because MockClock
* replaces nextTick, but not the browser Promise implementation, so it allows
* Promise-based code to be tested with MockClock.
*/
goog.async.run.forceNextTick = function() {
goog.async.run.schedule_ = function() {
goog.async.nextTick(goog.async.run.processWorkQueue);
};
};
/**
* The function used to schedule work asynchronousely.
* @private {function()}
*/
goog.async.run.schedule_;
/** @private {boolean} */
goog.async.run.workQueueScheduled_ = false;
/** @private {!Array<!goog.async.run.WorkItem_>} */
goog.async.run.workQueue_ = [];
if (goog.DEBUG) {
/**
* Reset the event queue.
* @private
*/
goog.async.run.resetQueue_ = function() {
goog.async.run.workQueueScheduled_ = false;
goog.async.run.workQueue_ = [];
};
// If there is a clock implemenation in use for testing
// and it is reset, reset the queue.
goog.testing.watchers.watchClockReset(goog.async.run.resetQueue_);
}
/**
* Run any pending goog.async.run work items. This function is not intended
* for general use, but for use by entry point handlers to run items ahead of
* goog.async.nextTick.
*/
goog.async.run.processWorkQueue = function() {
// NOTE: additional work queue items may be pushed while processing.
while (goog.async.run.workQueue_.length) {
// Don't let the work queue grow indefinitely.
var workItems = goog.async.run.workQueue_;
goog.async.run.workQueue_ = [];
for (var i = 0; i < workItems.length; i++) {
var workItem = workItems[i];
try {
workItem.fn.call(workItem.scope);
} catch (e) {
goog.async.throwException(e);
}
}
}
// There are no more work items, reset the work queue.
goog.async.run.workQueueScheduled_ = false;
};
/**
* @constructor
* @final
* @struct
* @private
*
* @param {function()} fn
* @param {Object|null|undefined} scope
*/
goog.async.run.WorkItem_ = function(fn, scope) {
/** @const */ this.fn = fn;
/** @const */ this.scope = scope;
};

View File

@@ -0,0 +1,147 @@
// Copyright 2013 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
goog.provide('goog.async.runTest');
goog.require('goog.async.run');
goog.require('goog.testing.MockClock');
goog.require('goog.testing.jsunit');
goog.require('goog.testing.recordFunction');
goog.setTestOnly('goog.async.runTest');
var mockClock;
var futureCallback1, futureCallback2;
function setUpPage() {
mockClock = new goog.testing.MockClock();
mockClock.install();
}
function setUp() {
mockClock.reset();
futureCallback1 = new goog.testing.recordFunction();
futureCallback2 = new goog.testing.recordFunction();
}
function tearDown() {
futureCallback1 = null;
futureCallback2 = null;
}
function tearDownPage() {
mockClock.uninstall();
goog.dispose(mockClock);
}
function testCalledAsync() {
goog.async.run(futureCallback1);
goog.async.run(futureCallback2);
assertEquals(0, futureCallback1.getCallCount());
assertEquals(0, futureCallback2.getCallCount());
// but the callbacks are scheduled...
mockClock.tick();
// and called.
assertEquals(1, futureCallback1.getCallCount());
assertEquals(1, futureCallback2.getCallCount());
// and aren't called a second time.
assertEquals(1, futureCallback1.getCallCount());
assertEquals(1, futureCallback2.getCallCount());
}
function testSequenceCalledInOrder() {
futureCallback1 = new goog.testing.recordFunction(
function() {
// called before futureCallback2
assertEquals(0, futureCallback2.getCallCount());
});
futureCallback2 = new goog.testing.recordFunction(
function() {
// called after futureCallback1
assertEquals(1, futureCallback1.getCallCount());
});
goog.async.run(futureCallback1);
goog.async.run(futureCallback2);
// goog.async.run doesn't call the top callback immediately.
assertEquals(0, futureCallback1.getCallCount());
// but the callbacks are scheduled...
mockClock.tick();
// and called during the same "tick".
assertEquals(1, futureCallback1.getCallCount());
assertEquals(1, futureCallback2.getCallCount());
}
function testSequenceScheduledTwice() {
goog.async.run(futureCallback1);
goog.async.run(futureCallback1);
// goog.async.run doesn't call the top callback immediately.
assertEquals(0, futureCallback1.getCallCount());
// but the callbacks are scheduled...
mockClock.tick();
// and called twice during the same "tick".
assertEquals(2, futureCallback1.getCallCount());
}
function testSequenceCalledSync() {
futureCallback1 = new goog.testing.recordFunction(
function() {
goog.async.run(futureCallback2);
// goog.async.run doesn't call the inner callback immediately.
assertEquals(0, futureCallback2.getCallCount());
});
goog.async.run(futureCallback1);
// goog.async.run doesn't call the top callback immediately.
assertEquals(0, futureCallback1.getCallCount());
// but the callbacks are scheduled...
mockClock.tick();
// and called during the same "tick".
assertEquals(1, futureCallback1.getCallCount());
assertEquals(1, futureCallback2.getCallCount());
}
function testScope() {
var aScope = {};
goog.async.run(futureCallback1);
goog.async.run(futureCallback2, aScope);
// the callbacks are scheduled...
mockClock.tick();
// and called.
assertEquals(1, futureCallback1.getCallCount());
assertEquals(1, futureCallback2.getCallCount());
// and get the correct scope.
var last1 = futureCallback1.popLastCall();
assertEquals(0, last1.getArguments().length);
assertEquals(goog.global, last1.getThis());
var last2 = futureCallback2.popLastCall();
assertEquals(0, last2.getArguments().length);
assertEquals(aScope, last2.getThis());
}

View File

@@ -0,0 +1,193 @@
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Definition of the goog.async.Throttle class.
*
* @see ../demos/timers.html
*/
goog.provide('goog.Throttle');
goog.provide('goog.async.Throttle');
goog.require('goog.Disposable');
goog.require('goog.Timer');
/**
* Throttle will perform an action that is passed in no more than once
* per interval (specified in milliseconds). If it gets multiple signals
* to perform the action while it is waiting, it will only perform the action
* once at the end of the interval.
* @param {function(this: T)} listener Function to callback when the action is
* triggered.
* @param {number} interval Interval over which to throttle. The listener can
* only be called once per interval.
* @param {T=} opt_handler Object in whose scope to call the listener.
* @constructor
* @extends {goog.Disposable}
* @final
* @template T
*/
goog.async.Throttle = function(listener, interval, opt_handler) {
goog.Disposable.call(this);
/**
* Function to callback
* @type {function(this: T)}
* @private
*/
this.listener_ = listener;
/**
* Interval for the throttle time
* @type {number}
* @private
*/
this.interval_ = interval;
/**
* "this" context for the listener
* @type {Object|undefined}
* @private
*/
this.handler_ = opt_handler;
/**
* Cached callback function invoked after the throttle timeout completes
* @type {Function}
* @private
*/
this.callback_ = goog.bind(this.onTimer_, this);
};
goog.inherits(goog.async.Throttle, goog.Disposable);
/**
* A deprecated alias.
* @deprecated Use goog.async.Throttle instead.
* @constructor
* @final
*/
goog.Throttle = goog.async.Throttle;
/**
* Indicates that the action is pending and needs to be fired.
* @type {boolean}
* @private
*/
goog.async.Throttle.prototype.shouldFire_ = false;
/**
* Indicates the count of nested pauses currently in effect on the throttle.
* When this count is not zero, fired actions will be postponed until the
* throttle is resumed enough times to drop the pause count to zero.
* @type {number}
* @private
*/
goog.async.Throttle.prototype.pauseCount_ = 0;
/**
* Timer for scheduling the next callback
* @type {?number}
* @private
*/
goog.async.Throttle.prototype.timer_ = null;
/**
* Notifies the throttle that the action has happened. It will throttle the call
* so that the callback is not called too often according to the interval
* parameter passed to the constructor.
*/
goog.async.Throttle.prototype.fire = function() {
if (!this.timer_ && !this.pauseCount_) {
this.doAction_();
} else {
this.shouldFire_ = true;
}
};
/**
* Cancels any pending action callback. The throttle can be restarted by
* calling {@link #fire}.
*/
goog.async.Throttle.prototype.stop = function() {
if (this.timer_) {
goog.Timer.clear(this.timer_);
this.timer_ = null;
this.shouldFire_ = false;
}
};
/**
* Pauses the throttle. All pending and future action callbacks will be
* delayed until the throttle is resumed. Pauses can be nested.
*/
goog.async.Throttle.prototype.pause = function() {
this.pauseCount_++;
};
/**
* Resumes the throttle. If doing so drops the pausing count to zero, pending
* action callbacks will be executed as soon as possible, but still no sooner
* than an interval's delay after the previous call. Future action callbacks
* will be executed as normal.
*/
goog.async.Throttle.prototype.resume = function() {
this.pauseCount_--;
if (!this.pauseCount_ && this.shouldFire_ && !this.timer_) {
this.shouldFire_ = false;
this.doAction_();
}
};
/** @override */
goog.async.Throttle.prototype.disposeInternal = function() {
goog.async.Throttle.superClass_.disposeInternal.call(this);
this.stop();
};
/**
* Handler for the timer to fire the throttle
* @private
*/
goog.async.Throttle.prototype.onTimer_ = function() {
this.timer_ = null;
if (this.shouldFire_ && !this.pauseCount_) {
this.shouldFire_ = false;
this.doAction_();
}
};
/**
* Calls the callback
* @private
*/
goog.async.Throttle.prototype.doAction_ = function() {
this.timer_ = goog.Timer.callOnce(this.callback_, this.interval_);
this.listener_.call(this.handler_);
};

View File

@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2006 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
Closure Unit Tests - goog.async.Throttle
</title>
<script src="../base.js">
</script>
<script>
goog.require('goog.async.ThrottleTest');
</script>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,95 @@
// Copyright 2006 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
goog.provide('goog.async.ThrottleTest');
goog.setTestOnly('goog.async.ThrottleTest');
goog.require('goog.async.Throttle');
goog.require('goog.testing.MockClock');
goog.require('goog.testing.jsunit');
function testThrottle() {
var clock = new goog.testing.MockClock(true);
var callBackCount = 0;
var callBackFunction = function() {
callBackCount++;
};
var throttle = new goog.async.Throttle(callBackFunction, 100);
assertEquals(0, callBackCount);
throttle.fire();
assertEquals(1, callBackCount);
throttle.fire();
assertEquals(1, callBackCount);
throttle.fire();
throttle.fire();
assertEquals(1, callBackCount);
clock.tick(101);
assertEquals(2, callBackCount);
clock.tick(101);
assertEquals(2, callBackCount);
throttle.fire();
assertEquals(3, callBackCount);
throttle.fire();
assertEquals(3, callBackCount);
throttle.stop();
clock.tick(101);
assertEquals(3, callBackCount);
throttle.fire();
assertEquals(4, callBackCount);
clock.tick(101);
assertEquals(4, callBackCount);
throttle.fire();
throttle.fire();
assertEquals(5, callBackCount);
throttle.pause();
throttle.resume();
assertEquals(5, callBackCount);
throttle.pause();
clock.tick(101);
assertEquals(5, callBackCount);
throttle.resume();
assertEquals(6, callBackCount);
clock.tick(101);
assertEquals(6, callBackCount);
throttle.pause();
throttle.fire();
assertEquals(6, callBackCount);
clock.tick(101);
assertEquals(6, callBackCount);
throttle.resume();
assertEquals(7, callBackCount);
throttle.pause();
throttle.pause();
clock.tick(101);
throttle.fire();
throttle.resume();
assertEquals(7, callBackCount);
throttle.resume();
assertEquals(8, callBackCount);
throttle.pause();
throttle.pause();
throttle.fire();
throttle.resume();
clock.tick(101);
assertEquals(8, callBackCount);
throttle.resume();
assertEquals(9, callBackCount);
clock.uninstall();
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2006 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Closure Unit Tests - goog.module</title>
<script src="base.js"></script>
</head>
<body>
<script>
goog.require('goog.baseModuleTest');
</script>
</body>
</html>

View File

@@ -0,0 +1,113 @@
// Copyright 2006 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Unit tests for Closure's base.js's goog.module support.
*/
goog.module('goog.baseModuleTest');
goog.module.declareTestMethods();
goog.setTestOnly('goog.baseModuleTest');
// Used to test dynamic loading works, see testRequire*
var Timer = goog.require('goog.Timer');
var Replacer = goog.require('goog.testing.PropertyReplacer');
var jsunit = goog.require('goog.testing.jsunit');
var testModule = goog.require('goog.test_module');
var stubs = new Replacer();
function assertProvideFails(namespace) {
assertThrows('goog.provide(' + namespace + ') should have failed',
goog.partial(goog.provide, namespace));
}
function assertModuleFails(namespace) {
assertThrows('goog.module(' + namespace + ') should have failed',
goog.partial(goog.module, namespace));
}
exports = {
teardown: function() {
stubs.reset();
},
testModuleDecl: function() {
// assert that goog.module doesn't modify the global namespace
assertUndefined('module failed to protect global namespace: ' +
'goog.baseModuleTest', goog.baseModuleTest);
},
testModuleScoping: function() {
// assert test functions are exported to the global namespace
assertNotUndefined('module failed: testModule', testModule);
assertTrue('module failed: testModule',
goog.isFunction(goog.global.testModuleScoping));
},
testProvideStrictness1: function() {
assertModuleFails('goog.xy'); // not in goog.loadModule
assertProvideFails('goog.baseModuleTest'); // this file.
},
testProvideStrictness2: function() {
// goog.module "provides" a namespace
assertTrue(goog.isProvided_('goog.baseModuleTest'));
},
testExportSymbol: function() {
// Assert that export symbol works from within a goog.module.
var date = new Date();
assertTrue(typeof nodots == 'undefined');
goog.exportSymbol('nodots', date);
assertEquals(date, nodots); // globals are accessible from within a module.
nodots = undefined;
},
//=== tests for Require logic ===
testLegacyRequire: function() {
// goog.Timer is a legacy module loaded above
assertNotUndefined('goog.Timer should be available', goog.Timer);
// Verify that a legacy module can be aliases with goog.require
assertTrue('Timer should be the goog.Timer namespace object',
goog.Timer === Timer);
// and its dependencies
assertNotUndefined(
'goog.events.EventTarget should be available',
/** @suppress {missingRequire} */ goog.events.EventTarget);
},
testRequireModule: function() {
assertEquals('module failed to export legacy namespace: ' +
'goog.test_module', testModule, goog.test_module);
assertUndefined('module failed to protect global namespace: ' +
'goog.test_module_dep', goog.test_module_dep);
// The test module is available under its alias
assertNotUndefined('testModule is loaded', testModule);
assertTrue('module failed: testModule', goog.isFunction(testModule));
}
};
exports.testThisInModule = (function() {
assertEquals(this, goog.global);
}).bind(this);

View File

@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2006 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Closure Unit Tests - goog.*</title>
<script>
var CLOSURE_DEFINES = {
'SOME_DEFINE': 456,
'ns.SOME_DEFINE': 456
};
</script>
<script src="base.js"></script>
</head>
<body>
<div id="elem">
<span>One</span>
<span id="text">Two</span>
<span>Three</span>
</div>
<iframe name="f1" id="f1" src=""></iframe>
<iframe name="f2" id="f2" src=""></iframe>
<script>
goog.require('goog.baseTest');
</script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,92 @@
// Copyright 2013 The Closure Library Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview A nodejs script for dynamically requiring Closure within
* nodejs.
*
* Example of usage:
* <code>
* require('./bootstrap/nodejs')
* goog.require('goog.ui.Component')
* </code>
*
* This loads goog.ui.Component in the global scope.
*
* If you want to load custom libraries, you can require the custom deps file
* directly. If your custom libraries introduce new globals, you may
* need to run goog.nodeGlobalRequire to get them to load correctly.
*
* <code>
* require('./path/to/my/deps.js')
* goog.bootstrap.nodeJs.nodeGlobalRequire('./path/to/my/base.js')
* goog.require('my.Class')
* </code>
*
* @author nick@medium.com (Nick Santos)
*
* @nocompile
*/
var fs = require('fs');
var path = require('path');
var vm = require('vm');
/**
* The goog namespace in the global scope.
*/
global.goog = {};
/**
* Imports a script using Node's require() API.
*
* @param {string} src The script source.
* @return {boolean} True if the script was imported, false otherwise.
*/
global.CLOSURE_IMPORT_SCRIPT = function(src) {
// Sources are always expressed relative to closure's base.js, but
// require() is always relative to the current source.
require('./../' + src);
return true;
};
// Declared here so it can be used to require base.js
function nodeGlobalRequire(file) {
vm.Script.runInThisContext.call(
global, fs.readFileSync(file), file);
}
// Load Closure's base.js into memory. It is assumed base.js is in the
// directory above this directory given this script's location in
// bootstrap/nodejs.js.
nodeGlobalRequire(path.resolve(__dirname, '..', 'base.js'));
/**
* Bootstraps a file into the global scope.
*
* This is strictly for cases where normal require() won't work,
* because the file declares global symbols with 'var' that need to
* be added to the global scope.
* @suppress {missingProvide}
*
* @param {string} file The path to the file.
*/
goog.nodeGlobalRequire = nodeGlobalRequire;

View File

@@ -0,0 +1,37 @@
// Copyright 2010 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview A bootstrap for dynamically requiring Closure within an HTML5
* Web Worker context. To use this, first set CLOSURE_BASE_PATH to the directory
* containing base.js (relative to the main script), then use importScripts to
* load this file and base.js (in that order). After this you can use
* goog.require for further imports.
*
* @nocompile
*/
/**
* Imports a script using the Web Worker importScript API.
*
* @param {string} src The script source.
* @return {boolean} True if the script was imported, false otherwise.
*/
this.CLOSURE_IMPORT_SCRIPT = (function(global) {
return function(src) {
global['importScripts'](src);
return true;
};
})(this);

View File

@@ -0,0 +1,472 @@
// Copyright 2006 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Utilities related to alpha/transparent colors and alpha color
* conversion.
*/
goog.provide('goog.color.alpha');
goog.require('goog.color');
/**
* Parses an alpha color out of a string.
* @param {string} str Color in some format.
* @return {{hex: string, type: string}} 'hex' is a string containing
* a hex representation of the color, and 'type' is a string
* containing the type of color format passed in ('hex', 'rgb', 'named').
*/
goog.color.alpha.parse = function(str) {
var result = {};
str = String(str);
var maybeHex = goog.color.prependHashIfNecessaryHelper(str);
if (goog.color.alpha.isValidAlphaHexColor_(maybeHex)) {
result.hex = goog.color.alpha.normalizeAlphaHex_(maybeHex);
result.type = 'hex';
return result;
} else {
var rgba = goog.color.alpha.isValidRgbaColor_(str);
if (rgba.length) {
result.hex = goog.color.alpha.rgbaArrayToHex(rgba);
result.type = 'rgba';
return result;
} else {
var hsla = goog.color.alpha.isValidHslaColor_(str);
if (hsla.length) {
result.hex = goog.color.alpha.hslaArrayToHex(hsla);
result.type = 'hsla';
return result;
}
}
}
throw Error(str + ' is not a valid color string');
};
/**
* Converts a hex representation of a color to RGBA.
* @param {string} hexColor Color to convert.
* @return {string} string of the form 'rgba(R,G,B,A)' which can be used in
* styles.
*/
goog.color.alpha.hexToRgbaStyle = function(hexColor) {
return goog.color.alpha.rgbaStyle_(goog.color.alpha.hexToRgba(hexColor));
};
/**
* Gets the hex color part of an alpha hex color. For example, from '#abcdef55'
* return '#abcdef'.
* @param {string} colorWithAlpha The alpha hex color to get the hex color from.
* @return {string} The hex color where the alpha part has been stripped off.
*/
goog.color.alpha.extractHexColor = function(colorWithAlpha) {
if (goog.color.alpha.isValidAlphaHexColor_(colorWithAlpha)) {
var fullColor = goog.color.prependHashIfNecessaryHelper(colorWithAlpha);
var normalizedColor = goog.color.alpha.normalizeAlphaHex_(fullColor);
return normalizedColor.substring(0, 7);
} else {
throw Error(colorWithAlpha + ' is not a valid 8-hex color string');
}
};
/**
* Gets the alpha color part of an alpha hex color. For example, from
* '#abcdef55' return '55'. The result is guaranteed to be two characters long.
* @param {string} colorWithAlpha The alpha hex color to get the hex color from.
* @return {string} The hex color where the alpha part has been stripped off.
*/
goog.color.alpha.extractAlpha = function(colorWithAlpha) {
if (goog.color.alpha.isValidAlphaHexColor_(colorWithAlpha)) {
var fullColor = goog.color.prependHashIfNecessaryHelper(colorWithAlpha);
var normalizedColor = goog.color.alpha.normalizeAlphaHex_(fullColor);
return normalizedColor.substring(7, 9);
} else {
throw Error(colorWithAlpha + ' is not a valid 8-hex color string');
}
};
/**
* Regular expression for extracting the digits in a hex color quadruplet.
* @type {RegExp}
* @private
*/
goog.color.alpha.hexQuadrupletRe_ = /#(.)(.)(.)(.)/;
/**
* Normalize a hex representation of an alpha color.
* @param {string} hexColor an alpha hex color string.
* @return {string} hex color in the format '#rrggbbaa' with all lowercase
* literals.
* @private
*/
goog.color.alpha.normalizeAlphaHex_ = function(hexColor) {
if (!goog.color.alpha.isValidAlphaHexColor_(hexColor)) {
throw Error("'" + hexColor + "' is not a valid alpha hex color");
}
if (hexColor.length == 5) { // of the form #RGBA
hexColor = hexColor.replace(goog.color.alpha.hexQuadrupletRe_,
'#$1$1$2$2$3$3$4$4');
}
return hexColor.toLowerCase();
};
/**
* Converts an 8-hex representation of a color to RGBA.
* @param {string} hexColor Color to convert.
* @return {!Array<number>} array containing [r, g, b, a].
* r, g, b are ints between 0
* and 255, and a is a value between 0 and 1.
*/
goog.color.alpha.hexToRgba = function(hexColor) {
// TODO(user): Enhance code sharing with goog.color, for example by
// adding a goog.color.genericHexToRgb method.
hexColor = goog.color.alpha.normalizeAlphaHex_(hexColor);
var r = parseInt(hexColor.substr(1, 2), 16);
var g = parseInt(hexColor.substr(3, 2), 16);
var b = parseInt(hexColor.substr(5, 2), 16);
var a = parseInt(hexColor.substr(7, 2), 16);
return [r, g, b, a / 255];
};
/**
* Converts a color from RGBA to hex representation.
* @param {number} r Amount of red, int between 0 and 255.
* @param {number} g Amount of green, int between 0 and 255.
* @param {number} b Amount of blue, int between 0 and 255.
* @param {number} a Amount of alpha, float between 0 and 1.
* @return {string} hex representation of the color.
*/
goog.color.alpha.rgbaToHex = function(r, g, b, a) {
var intAlpha = Math.floor(a * 255);
if (isNaN(intAlpha) || intAlpha < 0 || intAlpha > 255) {
// TODO(user): The CSS spec says the value should be clamped.
throw Error('"(' + r + ',' + g + ',' + b + ',' + a +
'") is not a valid RGBA color');
}
var hexA = goog.color.prependZeroIfNecessaryHelper(intAlpha.toString(16));
return goog.color.rgbToHex(r, g, b) + hexA;
};
/**
* Converts a color from HSLA to hex representation.
* @param {number} h Amount of hue, int between 0 and 360.
* @param {number} s Amount of saturation, int between 0 and 100.
* @param {number} l Amount of lightness, int between 0 and 100.
* @param {number} a Amount of alpha, float between 0 and 1.
* @return {string} hex representation of the color.
*/
goog.color.alpha.hslaToHex = function(h, s, l, a) {
var intAlpha = Math.floor(a * 255);
if (isNaN(intAlpha) || intAlpha < 0 || intAlpha > 255) {
// TODO(user): The CSS spec says the value should be clamped.
throw Error('"(' + h + ',' + s + ',' + l + ',' + a +
'") is not a valid HSLA color');
}
var hexA = goog.color.prependZeroIfNecessaryHelper(intAlpha.toString(16));
return goog.color.hslToHex(h, s / 100, l / 100) + hexA;
};
/**
* Converts a color from RGBA to hex representation.
* @param {Array<number>} rgba Array of [r, g, b, a], with r, g, b in [0, 255]
* and a in [0, 1].
* @return {string} hex representation of the color.
*/
goog.color.alpha.rgbaArrayToHex = function(rgba) {
return goog.color.alpha.rgbaToHex(rgba[0], rgba[1], rgba[2], rgba[3]);
};
/**
* Converts a color from RGBA to an RGBA style string.
* @param {number} r Value of red, in [0, 255].
* @param {number} g Value of green, in [0, 255].
* @param {number} b Value of blue, in [0, 255].
* @param {number} a Value of alpha, in [0, 1].
* @return {string} An 'rgba(r,g,b,a)' string ready for use in a CSS rule.
*/
goog.color.alpha.rgbaToRgbaStyle = function(r, g, b, a) {
if (isNaN(r) || r < 0 || r > 255 ||
isNaN(g) || g < 0 || g > 255 ||
isNaN(b) || b < 0 || b > 255 ||
isNaN(a) || a < 0 || a > 1) {
throw Error('"(' + r + ',' + g + ',' + b + ',' + a +
')" is not a valid RGBA color');
}
return goog.color.alpha.rgbaStyle_([r, g, b, a]);
};
/**
* Converts a color from RGBA to an RGBA style string.
* @param {(Array<number>|Float32Array)} rgba Array of [r, g, b, a],
* with r, g, b in [0, 255] and a in [0, 1].
* @return {string} An 'rgba(r,g,b,a)' string ready for use in a CSS rule.
*/
goog.color.alpha.rgbaArrayToRgbaStyle = function(rgba) {
return goog.color.alpha.rgbaToRgbaStyle(rgba[0], rgba[1], rgba[2], rgba[3]);
};
/**
* Converts a color from HSLA to hex representation.
* @param {Array<number>} hsla Array of [h, s, l, a], where h is an integer in
* [0, 360], s and l are integers in [0, 100], and a is in [0, 1].
* @return {string} hex representation of the color, such as '#af457eff'.
*/
goog.color.alpha.hslaArrayToHex = function(hsla) {
return goog.color.alpha.hslaToHex(hsla[0], hsla[1], hsla[2], hsla[3]);
};
/**
* Converts a color from HSLA to an RGBA style string.
* @param {Array<number>} hsla Array of [h, s, l, a], where h is and integer in
* [0, 360], s and l are integers in [0, 100], and a is in [0, 1].
* @return {string} An 'rgba(r,g,b,a)' string ready for use in a CSS rule.
*/
goog.color.alpha.hslaArrayToRgbaStyle = function(hsla) {
return goog.color.alpha.hslaToRgbaStyle(hsla[0], hsla[1], hsla[2], hsla[3]);
};
/**
* Converts a color from HSLA to an RGBA style string.
* @param {number} h Amount of hue, int between 0 and 360.
* @param {number} s Amount of saturation, int between 0 and 100.
* @param {number} l Amount of lightness, int between 0 and 100.
* @param {number} a Amount of alpha, float between 0 and 1.
* @return {string} An 'rgba(r,g,b,a)' string ready for use in a CSS rule.
* styles.
*/
goog.color.alpha.hslaToRgbaStyle = function(h, s, l, a) {
return goog.color.alpha.rgbaStyle_(goog.color.alpha.hslaToRgba(h, s, l, a));
};
/**
* Converts a color from HSLA color space to RGBA color space.
* @param {number} h Amount of hue, int between 0 and 360.
* @param {number} s Amount of saturation, int between 0 and 100.
* @param {number} l Amount of lightness, int between 0 and 100.
* @param {number} a Amount of alpha, float between 0 and 1.
* @return {!Array<number>} [r, g, b, a] values for the color, where r, g, b
* are integers in [0, 255] and a is a float in [0, 1].
*/
goog.color.alpha.hslaToRgba = function(h, s, l, a) {
return goog.color.hslToRgb(h, s / 100, l / 100).concat(a);
};
/**
* Converts a color from RGBA color space to HSLA color space.
* Modified from {@link http://en.wikipedia.org/wiki/HLS_color_space}.
* @param {number} r Value of red, in [0, 255].
* @param {number} g Value of green, in [0, 255].
* @param {number} b Value of blue, in [0, 255].
* @param {number} a Value of alpha, in [0, 255].
* @return {!Array<number>} [h, s, l, a] values for the color, with h an int in
* [0, 360] and s, l and a in [0, 1].
*/
goog.color.alpha.rgbaToHsla = function(r, g, b, a) {
return goog.color.rgbToHsl(r, g, b).concat(a);
};
/**
* Converts a color from RGBA color space to HSLA color space.
* @param {Array<number>} rgba [r, g, b, a] values for the color, each in
* [0, 255].
* @return {!Array<number>} [h, s, l, a] values for the color, with h in
* [0, 360] and s, l and a in [0, 1].
*/
goog.color.alpha.rgbaArrayToHsla = function(rgba) {
return goog.color.alpha.rgbaToHsla(rgba[0], rgba[1], rgba[2], rgba[3]);
};
/**
* Helper for isValidAlphaHexColor_.
* @type {RegExp}
* @private
*/
goog.color.alpha.validAlphaHexColorRe_ = /^#(?:[0-9a-f]{4}){1,2}$/i;
/**
* Checks if a string is a valid alpha hex color. We expect strings of the
* format #RRGGBBAA (ex: #1b3d5f5b) or #RGBA (ex: #3CAF == #33CCAAFF).
* @param {string} str String to check.
* @return {boolean} Whether the string is a valid alpha hex color.
* @private
*/
// TODO(user): Support percentages when goog.color also supports them.
goog.color.alpha.isValidAlphaHexColor_ = function(str) {
return goog.color.alpha.validAlphaHexColorRe_.test(str);
};
/**
* Helper for isNormalizedAlphaHexColor_.
* @type {RegExp}
* @private
*/
goog.color.alpha.normalizedAlphaHexColorRe_ = /^#[0-9a-f]{8}$/;
/**
* Checks if a string is a normalized alpha hex color.
* We expect strings of the format #RRGGBBAA (ex: #1b3d5f5b)
* using only lowercase letters.
* @param {string} str String to check.
* @return {boolean} Whether the string is a normalized hex color.
* @private
*/
goog.color.alpha.isNormalizedAlphaHexColor_ = function(str) {
return goog.color.alpha.normalizedAlphaHexColorRe_.test(str);
};
/**
* Regular expression for matching and capturing RGBA style strings. Helper for
* isValidRgbaColor_.
* @type {RegExp}
* @private
*/
goog.color.alpha.rgbaColorRe_ =
/^(?:rgba)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|1|0\.\d{0,10})\)$/i;
/**
* Regular expression for matching and capturing HSLA style strings. Helper for
* isValidHslaColor_.
* @type {RegExp}
* @private
*/
goog.color.alpha.hslaColorRe_ =
/^(?:hsla)\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2})\%,\s?(0|[1-9]\d{0,2})\%,\s?(0|1|0\.\d{0,10})\)$/i;
/**
* Checks if a string is a valid rgba color. We expect strings of the format
* '(r, g, b, a)', or 'rgba(r, g, b, a)', where r, g, b are ints in [0, 255]
* and a is a float in [0, 1].
* @param {string} str String to check.
* @return {!Array<number>} the integers [r, g, b, a] for valid colors or the
* empty array for invalid colors.
* @private
*/
goog.color.alpha.isValidRgbaColor_ = function(str) {
// Each component is separate (rather than using a repeater) so we can
// capture the match. Also, we explicitly set each component to be either 0,
// or start with a non-zero, to prevent octal numbers from slipping through.
var regExpResultArray = str.match(goog.color.alpha.rgbaColorRe_);
if (regExpResultArray) {
var r = Number(regExpResultArray[1]);
var g = Number(regExpResultArray[2]);
var b = Number(regExpResultArray[3]);
var a = Number(regExpResultArray[4]);
if (r >= 0 && r <= 255 &&
g >= 0 && g <= 255 &&
b >= 0 && b <= 255 &&
a >= 0 && a <= 1) {
return [r, g, b, a];
}
}
return [];
};
/**
* Checks if a string is a valid hsla color. We expect strings of the format
* 'hsla(h, s, l, a)', where s in an int in [0, 360], s and l are percentages
* between 0 and 100 such as '50%' or '70%', and a is a float in [0, 1].
* @param {string} str String to check.
* @return {!Array<number>} the integers [h, s, l, a] for valid colors or the
* empty array for invalid colors.
* @private
*/
goog.color.alpha.isValidHslaColor_ = function(str) {
// Each component is separate (rather than using a repeater) so we can
// capture the match. Also, we explicitly set each component to be either 0,
// or start with a non-zero, to prevent octal numbers from slipping through.
var regExpResultArray = str.match(goog.color.alpha.hslaColorRe_);
if (regExpResultArray) {
var h = Number(regExpResultArray[1]);
var s = Number(regExpResultArray[2]);
var l = Number(regExpResultArray[3]);
var a = Number(regExpResultArray[4]);
if (h >= 0 && h <= 360 &&
s >= 0 && s <= 100 &&
l >= 0 && l <= 100 &&
a >= 0 && a <= 1) {
return [h, s, l, a];
}
}
return [];
};
/**
* Takes an array of [r, g, b, a] and converts it into a string appropriate for
* CSS styles. The alpha channel value is rounded to 3 decimal places to make
* sure the produced string is not too long.
* @param {Array<number>} rgba [r, g, b, a] with r, g, b in [0, 255] and a
* in [0, 1].
* @return {string} string of the form 'rgba(r,g,b,a)'.
* @private
*/
goog.color.alpha.rgbaStyle_ = function(rgba) {
var roundedRgba = rgba.slice(0);
roundedRgba[3] = Math.round(rgba[3] * 1000) / 1000;
return 'rgba(' + roundedRgba.join(',') + ')';
};
/**
* Converts from h,s,v,a values to a hex string
* @param {number} h Hue, in [0, 1].
* @param {number} s Saturation, in [0, 1].
* @param {number} v Value, in [0, 255].
* @param {number} a Alpha, in [0, 1].
* @return {string} hex representation of the color.
*/
goog.color.alpha.hsvaToHex = function(h, s, v, a) {
var alpha = Math.floor(a * 255);
return goog.color.hsvArrayToHex([h, s, v]) +
goog.color.prependZeroIfNecessaryHelper(alpha.toString(16));
};
/**
* Converts from an HSVA array to a hex string
* @param {Array<number>} hsva Array of [h, s, v, a] in
* [[0, 1], [0, 1], [0, 255], [0, 1]].
* @return {string} hex representation of the color.
*/
goog.color.alpha.hsvaArrayToHex = function(hsva) {
return goog.color.alpha.hsvaToHex(hsva[0], hsva[1], hsva[2], hsva[3]);
};

View File

@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2006 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
Closure Unit Tests - goog.color.alpha
</title>
<script src="../base.js">
</script>
<script>
goog.require('goog.color.alphaTest');
</script>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,321 @@
// Copyright 2006 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
goog.provide('goog.color.alphaTest');
goog.setTestOnly('goog.color.alphaTest');
goog.require('goog.array');
goog.require('goog.color');
goog.require('goog.color.alpha');
goog.require('goog.testing.jsunit');
function testIsValidAlphaHexColor() {
var goodAlphaHexColors = ['#ffffffff', '#ff781259', '#01234567', '#Ff003DaB',
'#3CAF', '#abcdefab', '#3CAB'];
var badAlphaHexColors = ['#xxxxxxxx', '88990077', 'not_color', '#123456789',
'fffffgfg'];
for (var i = 0; i < goodAlphaHexColors.length; i++) {
assertTrue(goodAlphaHexColors[i],
goog.color.alpha.isValidAlphaHexColor_(goodAlphaHexColors[i]));
}
for (var i = 0; i < badAlphaHexColors.length; i++) {
assertFalse(badAlphaHexColors[i],
goog.color.alpha.isValidAlphaHexColor_(badAlphaHexColors[i]));
}
}
function testIsValidRgbaColor() {
var goodRgbaColors = ['rgba(255, 0, 0, 1)', 'rgba(255,127,0,1)',
'rgba(0,0,255,0.5)', '(255, 26, 75, 0.2)',
'RGBA(0, 55, 0, 0.6)', 'rgba(0, 200, 0, 0.123456789)'];
var badRgbaColors = ['(255, 0, 0)', '(2555,0,0, 0)', '(1,2,3,4,5)',
'rgba(1,20,)', 'RGBA(20,20,20,)', 'RGBA',
'rgba(255, 0, 0, 1.1)'];
for (var i = 0; i < goodRgbaColors.length; i++) {
assertEquals(goodRgbaColors[i], 4,
goog.color.alpha.isValidRgbaColor_(goodRgbaColors[i]).length);
}
for (var i = 0; i < badRgbaColors.length; i++) {
assertEquals(badRgbaColors[i], 0,
goog.color.alpha.isValidRgbaColor_(badRgbaColors[i]).length);
}
}
function testIsValidHslaColor() {
var goodHslaColors = ['hsla(120, 0%, 0%, 1)', 'hsla(360,20%,0%,1)',
'hsla(0,0%,50%,0.5)', 'HSLA(0, 55%, 0%, 0.6)',
'hsla(0, 85%, 0%, 0.123456789)'];
var badHslaColors = ['(255, 0, 0, 0)', 'hsla(2555,0,0, 0)', 'hsla(1,2,3,4,5)',
'hsla(1,20,)', 'HSLA(20,20,20,)',
'hsla(255, 0, 0, 1.1)', 'HSLA'];
for (var i = 0; i < goodHslaColors.length; i++) {
assertEquals(goodHslaColors[i], 4,
goog.color.alpha.isValidHslaColor_(goodHslaColors[i]).length);
}
for (var i = 0; i < badHslaColors.length; i++) {
assertEquals(badHslaColors[i], 0,
goog.color.alpha.isValidHslaColor_(badHslaColors[i]).length);
}
}
function testParse() {
var colors = ['rgba(15, 250, 77, 0.5)', '(127, 127, 127, 0.8)', '#ffeeddaa',
'12345678', 'hsla(160, 50%, 90%, 0.2)'];
var parsed = goog.array.map(colors, goog.color.alpha.parse);
assertEquals('rgba', parsed[0].type);
assertEquals(goog.color.alpha.rgbaToHex(15, 250, 77, 0.5), parsed[0].hex);
assertEquals('rgba', parsed[1].type);
assertEquals(goog.color.alpha.rgbaToHex(127, 127, 127, 0.8), parsed[1].hex);
assertEquals('hex', parsed[2].type);
assertEquals('#ffeeddaa', parsed[2].hex);
assertEquals('hex', parsed[3].type);
assertEquals('#12345678', parsed[3].hex);
assertEquals('hsla', parsed[4].type);
assertEquals('#d9f2ea33', parsed[4].hex);
var badColors = ['rgb(01, 1, 23)', '(256, 256, 256)', '#ffeeddaa'];
for (var i = 0; i < badColors.length; i++) {
var e = assertThrows(badColors[i] + ' is not a valid color string',
goog.partial(goog.color.parse, badColors[i]));
assertContains('Error processing ' + badColors[i],
'is not a valid color string', e.message);
}
}
function testHexToRgba() {
var testColors = [['#B0FF2D66', [176, 255, 45, 0.4]],
['#b26e5fcc', [178, 110, 95, 0.8]],
['#66f3', [102, 102, 255, 0.2]]];
for (var i = 0; i < testColors.length; i++) {
var r = goog.color.alpha.hexToRgba(testColors[i][0]);
var t = testColors[i][1];
assertEquals('Red channel should match.', t[0], r[0]);
assertEquals('Green channel should match.', t[1], r[1]);
assertEquals('Blue channel should match.', t[2], r[2]);
assertEquals('Alpha channel should match.', t[3], r[3]);
}
var badColors = ['', '#g00', 'some words'];
for (var i = 0; i < badColors.length; i++) {
var e = assertThrows(
goog.partial(goog.color.alpha.hexToRgba, badColors[i]));
assertEquals("'" + badColors[i] + "' is not a valid alpha hex color",
e.message);
}
}
function testHexToRgbaStyle() {
assertEquals('rgba(255,0,0,1)',
goog.color.alpha.hexToRgbaStyle('#ff0000ff'));
assertEquals('rgba(206,206,206,0.8)',
goog.color.alpha.hexToRgbaStyle('#cecececc'));
assertEquals('rgba(51,204,170,0.2)',
goog.color.alpha.hexToRgbaStyle('#3CA3'));
assertEquals('rgba(1,2,3,0.016)',
goog.color.alpha.hexToRgbaStyle('#01020304'));
assertEquals('rgba(255,255,0,0.333)',
goog.color.alpha.hexToRgbaStyle('#FFFF0055'));
var badHexColors = ['#12345', null, undefined, '#.1234567890'];
for (var i = 0; i < badHexColors.length; ++i) {
var e = assertThrows(badHexColors[i] + ' is an invalid hex color',
goog.partial(goog.color.alpha.hexToRgbaStyle, badHexColors[i]));
assertEquals("'" + badHexColors[i] + "' is not a valid alpha hex color",
e.message);
}
}
function testRgbaToHex() {
assertEquals('#af13ffff', goog.color.alpha.rgbaToHex(175, 19, 255, 1));
assertEquals('#357cf099', goog.color.alpha.rgbaToHex(53, 124, 240, 0.6));
var badRgba = [[-1, -1, -1, -1], [0, 0, 0, 2], ['a', 'b', 'c', 'd'],
[undefined, 5, 5, 5]];
for (var i = 0; i < badRgba.length; ++i) {
var e = assertThrows(badRgba[i] + ' is not a valid rgba color',
goog.partial(goog.color.alpha.rgbaArrayToHex, badRgba[i]));
assertContains('is not a valid RGBA color', e.message);
}
}
function testRgbaToRgbaStyle() {
var testColors = [[[175, 19, 255, 1], 'rgba(175,19,255,1)'],
[[53, 124, 240, .6], 'rgba(53,124,240,0.6)'],
[[10, 20, 30, .1234567], 'rgba(10,20,30,0.123)'],
[[20, 30, 40, 1 / 3], 'rgba(20,30,40,0.333)']];
for (var i = 0; i < testColors.length; ++i) {
var r = goog.color.alpha.rgbaToRgbaStyle(testColors[i][0][0],
testColors[i][0][1],
testColors[i][0][2],
testColors[i][0][3]);
assertEquals(testColors[i][1], r);
}
var badColors = [[0, 0, 0, 2]];
for (var i = 0; i < badColors.length; ++i) {
var e = assertThrows(goog.partial(goog.color.alpha.rgbaToRgbaStyle,
badColors[i][0], badColors[i][1], badColors[i][2], badColors[i][3]));
assertContains('is not a valid RGBA color', e.message);
}
// Loop through all bad color values and ensure they fail in each channel.
var badValues = [-1, 300, 'a', undefined, null, NaN];
var color = [0, 0, 0, 0];
for (var i = 0; i < badValues.length; ++i) {
for (var channel = 0; channel < color.length; ++channel) {
color[channel] = badValues[i];
var e = assertThrows(color + ' is not a valid rgba color',
goog.partial(goog.color.alpha.rgbaToRgbaStyle, color));
assertContains('is not a valid RGBA color', e.message);
color[channel] = 0;
}
}
}
function testRgbaArrayToRgbaStyle() {
var testColors = [[[175, 19, 255, 1], 'rgba(175,19,255,1)'],
[[53, 124, 240, .6], 'rgba(53,124,240,0.6)']];
for (var i = 0; i < testColors.length; ++i) {
var r = goog.color.alpha.rgbaArrayToRgbaStyle(testColors[i][0]);
assertEquals(testColors[i][1], r);
}
var badColors = [[0, 0, 0, 2]];
for (var i = 0; i < badColors.length; ++i) {
var e = assertThrows(goog.partial(goog.color.alpha.rgbaArrayToRgbaStyle,
badColors[i]));
assertContains('is not a valid RGBA color', e.message);
}
// Loop through all bad color values and ensure they fail in each channel.
var badValues = [-1, 300, 'a', undefined, null, NaN];
var color = [0, 0, 0, 0];
for (var i = 0; i < badValues.length; ++i) {
for (var channel = 0; channel < color.length; ++channel) {
color[channel] = badValues[i];
var e = assertThrows(color + ' is not a valid rgba color',
goog.partial(goog.color.alpha.rgbaToRgbaStyle, color));
assertContains('is not a valid RGBA color', e.message);
color[channel] = 0;
}
}
}
function testRgbaArrayToHsla() {
var opaqueBlueRgb = [0, 0, 255, 1];
var opaqueBlueHsl = goog.color.alpha.rgbaArrayToHsla(opaqueBlueRgb);
assertArrayEquals('Conversion from RGBA to HSLA should be as expected',
[240, 1, 0.5, 1], opaqueBlueHsl);
var nearlyOpaqueYellowRgb = [255, 190, 0, 0.7];
var nearlyOpaqueYellowHsl =
goog.color.alpha.rgbaArrayToHsla(nearlyOpaqueYellowRgb);
assertArrayEquals('Conversion from RGBA to HSLA should be as expected',
[45, 1, 0.5, 0.7], nearlyOpaqueYellowHsl);
var transparentPurpleRgb = [180, 0, 255, 0];
var transparentPurpleHsl =
goog.color.alpha.rgbaArrayToHsla(transparentPurpleRgb);
assertArrayEquals('Conversion from RGBA to HSLA should be as expected',
[282, 1, 0.5, 0], transparentPurpleHsl);
}
function testNormalizeAlphaHex() {
var compactColor = '#abcd';
var normalizedCompactColor =
goog.color.alpha.normalizeAlphaHex_(compactColor);
assertEquals('The color should have been normalized to the right length',
'#aabbccdd', normalizedCompactColor);
var uppercaseColor = '#ABCDEF01';
var normalizedUppercaseColor =
goog.color.alpha.normalizeAlphaHex_(uppercaseColor);
assertEquals('The color should have been normalized to lowercase',
'#abcdef01', normalizedUppercaseColor);
}
function testHsvaArrayToHex() {
var opaqueSkyBlueHsv = [190, 1, 255, 1];
var opaqueSkyBlueHex = goog.color.alpha.hsvaArrayToHex(opaqueSkyBlueHsv);
assertEquals('The HSVA array should have been properly converted to hex',
'#00d4ffff', opaqueSkyBlueHex);
var halfTransparentPinkHsv = [300, 1, 255, 0.5];
var halfTransparentPinkHex =
goog.color.alpha.hsvaArrayToHex(halfTransparentPinkHsv);
assertEquals('The HSVA array should have been properly converted to hex',
'#ff00ff7f', halfTransparentPinkHex);
var transparentDarkTurquoiseHsv = [175, 1, 127, 0.5];
var transparentDarkTurquoiseHex =
goog.color.alpha.hsvaArrayToHex(transparentDarkTurquoiseHsv);
assertEquals('The HSVA array should have been properly converted to hex',
'#007f747f', transparentDarkTurquoiseHex);
}
function testExtractHexColor() {
var opaqueRed = '#ff0000ff';
var red = goog.color.alpha.extractHexColor(opaqueRed);
assertEquals('The hex part of the color should have been extracted correctly',
'#ff0000', red);
var halfOpaqueDarkGreenCompact = '#0507';
var darkGreen =
goog.color.alpha.extractHexColor(halfOpaqueDarkGreenCompact);
assertEquals('The hex part of the color should have been extracted correctly',
'#005500', darkGreen);
}
function testExtractAlpha() {
var colors = ['#ff0000ff', '#0507', '#ff000005'];
var expectedOpacities = ['ff', '77', '05'];
for (var i = 0; i < colors.length; i++) {
var opacity = goog.color.alpha.extractAlpha(colors[i]);
assertEquals('The alpha transparency should have been extracted correctly',
expectedOpacities[i], opacity);
}
}
function testHslaArrayToRgbaStyle() {
assertEquals('rgba(102,255,102,0.5)',
goog.color.alpha.hslaArrayToRgbaStyle([120, 100, 70, 0.5]));
assertEquals('rgba(28,23,23,0.9)',
goog.color.alpha.hslaArrayToRgbaStyle([0, 10, 10, 0.9]));
}
function testRgbaStyleParsableResult() {
var testColors = [[175, 19, 255, 1],
[53, 124, 240, .6],
[20, 30, 40, 0.3333333],
[255, 255, 255, 0.7071067811865476]];
for (var i = 0, testColor; testColor = testColors[i]; i++) {
var rgbaStyle = goog.color.alpha.rgbaStyle_(testColor);
var parsedColor = goog.color.alpha.hexToRgba(
goog.color.alpha.parse(rgbaStyle).hex);
assertEquals(testColor[0], parsedColor[0]);
assertEquals(testColor[1], parsedColor[1]);
assertEquals(testColor[2], parsedColor[2]);
// Parsing keeps a 1/255 accuracy on the alpha channel.
assertRoughlyEquals(testColor[3], parsedColor[3], 0.005);
}
}

View File

@@ -0,0 +1,776 @@
// Copyright 2006 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Utilities related to color and color conversion.
*/
goog.provide('goog.color');
goog.provide('goog.color.Hsl');
goog.provide('goog.color.Hsv');
goog.provide('goog.color.Rgb');
goog.require('goog.color.names');
goog.require('goog.math');
/**
* RGB color representation. An array containing three elements [r, g, b],
* each an integer in [0, 255], representing the red, green, and blue components
* of the color respectively.
* @typedef {Array<number>}
*/
goog.color.Rgb;
/**
* HSV color representation. An array containing three elements [h, s, v]:
* h (hue) must be an integer in [0, 360], cyclic.
* s (saturation) must be a number in [0, 1].
* v (value/brightness) must be an integer in [0, 255].
* @typedef {Array<number>}
*/
goog.color.Hsv;
/**
* HSL color representation. An array containing three elements [h, s, l]:
* h (hue) must be an integer in [0, 360], cyclic.
* s (saturation) must be a number in [0, 1].
* l (lightness) must be a number in [0, 1].
* @typedef {Array<number>}
*/
goog.color.Hsl;
/**
* Parses a color out of a string.
* @param {string} str Color in some format.
* @return {{hex: string, type: string}} 'hex' is a string containing a hex
* representation of the color, 'type' is a string containing the type
* of color format passed in ('hex', 'rgb', 'named').
*/
goog.color.parse = function(str) {
var result = {};
str = String(str);
var maybeHex = goog.color.prependHashIfNecessaryHelper(str);
if (goog.color.isValidHexColor_(maybeHex)) {
result.hex = goog.color.normalizeHex(maybeHex);
result.type = 'hex';
return result;
} else {
var rgb = goog.color.isValidRgbColor_(str);
if (rgb.length) {
result.hex = goog.color.rgbArrayToHex(rgb);
result.type = 'rgb';
return result;
} else if (goog.color.names) {
var hex = goog.color.names[str.toLowerCase()];
if (hex) {
result.hex = hex;
result.type = 'named';
return result;
}
}
}
throw Error(str + ' is not a valid color string');
};
/**
* Determines if the given string can be parsed as a color.
* {@see goog.color.parse}.
* @param {string} str Potential color string.
* @return {boolean} True if str is in a format that can be parsed to a color.
*/
goog.color.isValidColor = function(str) {
var maybeHex = goog.color.prependHashIfNecessaryHelper(str);
return !!(goog.color.isValidHexColor_(maybeHex) ||
goog.color.isValidRgbColor_(str).length ||
goog.color.names && goog.color.names[str.toLowerCase()]);
};
/**
* Parses red, green, blue components out of a valid rgb color string.
* Throws Error if the color string is invalid.
* @param {string} str RGB representation of a color.
* {@see goog.color.isValidRgbColor_}.
* @return {!goog.color.Rgb} rgb representation of the color.
*/
goog.color.parseRgb = function(str) {
var rgb = goog.color.isValidRgbColor_(str);
if (!rgb.length) {
throw Error(str + ' is not a valid RGB color');
}
return rgb;
};
/**
* Converts a hex representation of a color to RGB.
* @param {string} hexColor Color to convert.
* @return {string} string of the form 'rgb(R,G,B)' which can be used in
* styles.
*/
goog.color.hexToRgbStyle = function(hexColor) {
return goog.color.rgbStyle_(goog.color.hexToRgb(hexColor));
};
/**
* Regular expression for extracting the digits in a hex color triplet.
* @type {RegExp}
* @private
*/
goog.color.hexTripletRe_ = /#(.)(.)(.)/;
/**
* Normalize an hex representation of a color
* @param {string} hexColor an hex color string.
* @return {string} hex color in the format '#rrggbb' with all lowercase
* literals.
*/
goog.color.normalizeHex = function(hexColor) {
if (!goog.color.isValidHexColor_(hexColor)) {
throw Error("'" + hexColor + "' is not a valid hex color");
}
if (hexColor.length == 4) { // of the form #RGB
hexColor = hexColor.replace(goog.color.hexTripletRe_, '#$1$1$2$2$3$3');
}
return hexColor.toLowerCase();
};
/**
* Converts a hex representation of a color to RGB.
* @param {string} hexColor Color to convert.
* @return {!goog.color.Rgb} rgb representation of the color.
*/
goog.color.hexToRgb = function(hexColor) {
hexColor = goog.color.normalizeHex(hexColor);
var r = parseInt(hexColor.substr(1, 2), 16);
var g = parseInt(hexColor.substr(3, 2), 16);
var b = parseInt(hexColor.substr(5, 2), 16);
return [r, g, b];
};
/**
* Converts a color from RGB to hex representation.
* @param {number} r Amount of red, int between 0 and 255.
* @param {number} g Amount of green, int between 0 and 255.
* @param {number} b Amount of blue, int between 0 and 255.
* @return {string} hex representation of the color.
*/
goog.color.rgbToHex = function(r, g, b) {
r = Number(r);
g = Number(g);
b = Number(b);
if (isNaN(r) || r < 0 || r > 255 ||
isNaN(g) || g < 0 || g > 255 ||
isNaN(b) || b < 0 || b > 255) {
throw Error('"(' + r + ',' + g + ',' + b + '") is not a valid RGB color');
}
var hexR = goog.color.prependZeroIfNecessaryHelper(r.toString(16));
var hexG = goog.color.prependZeroIfNecessaryHelper(g.toString(16));
var hexB = goog.color.prependZeroIfNecessaryHelper(b.toString(16));
return '#' + hexR + hexG + hexB;
};
/**
* Converts a color from RGB to hex representation.
* @param {goog.color.Rgb} rgb rgb representation of the color.
* @return {string} hex representation of the color.
*/
goog.color.rgbArrayToHex = function(rgb) {
return goog.color.rgbToHex(rgb[0], rgb[1], rgb[2]);
};
/**
* Converts a color from RGB color space to HSL color space.
* Modified from {@link http://en.wikipedia.org/wiki/HLS_color_space}.
* @param {number} r Value of red, in [0, 255].
* @param {number} g Value of green, in [0, 255].
* @param {number} b Value of blue, in [0, 255].
* @return {!goog.color.Hsl} hsl representation of the color.
*/
goog.color.rgbToHsl = function(r, g, b) {
// First must normalize r, g, b to be between 0 and 1.
var normR = r / 255;
var normG = g / 255;
var normB = b / 255;
var max = Math.max(normR, normG, normB);
var min = Math.min(normR, normG, normB);
var h = 0;
var s = 0;
// Luminosity is the average of the max and min rgb color intensities.
var l = 0.5 * (max + min);
// The hue and saturation are dependent on which color intensity is the max.
// If max and min are equal, the color is gray and h and s should be 0.
if (max != min) {
if (max == normR) {
h = 60 * (normG - normB) / (max - min);
} else if (max == normG) {
h = 60 * (normB - normR) / (max - min) + 120;
} else if (max == normB) {
h = 60 * (normR - normG) / (max - min) + 240;
}
if (0 < l && l <= 0.5) {
s = (max - min) / (2 * l);
} else {
s = (max - min) / (2 - 2 * l);
}
}
// Make sure the hue falls between 0 and 360.
return [Math.round(h + 360) % 360, s, l];
};
/**
* Converts a color from RGB color space to HSL color space.
* @param {goog.color.Rgb} rgb rgb representation of the color.
* @return {!goog.color.Hsl} hsl representation of the color.
*/
goog.color.rgbArrayToHsl = function(rgb) {
return goog.color.rgbToHsl(rgb[0], rgb[1], rgb[2]);
};
/**
* Helper for hslToRgb.
* @param {number} v1 Helper variable 1.
* @param {number} v2 Helper variable 2.
* @param {number} vH Helper variable 3.
* @return {number} Appropriate RGB value, given the above.
* @private
*/
goog.color.hueToRgb_ = function(v1, v2, vH) {
if (vH < 0) {
vH += 1;
} else if (vH > 1) {
vH -= 1;
}
if ((6 * vH) < 1) {
return (v1 + (v2 - v1) * 6 * vH);
} else if (2 * vH < 1) {
return v2;
} else if (3 * vH < 2) {
return (v1 + (v2 - v1) * ((2 / 3) - vH) * 6);
}
return v1;
};
/**
* Converts a color from HSL color space to RGB color space.
* Modified from {@link http://www.easyrgb.com/math.html}
* @param {number} h Hue, in [0, 360].
* @param {number} s Saturation, in [0, 1].
* @param {number} l Luminosity, in [0, 1].
* @return {!goog.color.Rgb} rgb representation of the color.
*/
goog.color.hslToRgb = function(h, s, l) {
var r = 0;
var g = 0;
var b = 0;
var normH = h / 360; // normalize h to fall in [0, 1]
if (s == 0) {
r = g = b = l * 255;
} else {
var temp1 = 0;
var temp2 = 0;
if (l < 0.5) {
temp2 = l * (1 + s);
} else {
temp2 = l + s - (s * l);
}
temp1 = 2 * l - temp2;
r = 255 * goog.color.hueToRgb_(temp1, temp2, normH + (1 / 3));
g = 255 * goog.color.hueToRgb_(temp1, temp2, normH);
b = 255 * goog.color.hueToRgb_(temp1, temp2, normH - (1 / 3));
}
return [Math.round(r), Math.round(g), Math.round(b)];
};
/**
* Converts a color from HSL color space to RGB color space.
* @param {goog.color.Hsl} hsl hsl representation of the color.
* @return {!goog.color.Rgb} rgb representation of the color.
*/
goog.color.hslArrayToRgb = function(hsl) {
return goog.color.hslToRgb(hsl[0], hsl[1], hsl[2]);
};
/**
* Helper for isValidHexColor_.
* @type {RegExp}
* @private
*/
goog.color.validHexColorRe_ = /^#(?:[0-9a-f]{3}){1,2}$/i;
/**
* Checks if a string is a valid hex color. We expect strings of the format
* #RRGGBB (ex: #1b3d5f) or #RGB (ex: #3CA == #33CCAA).
* @param {string} str String to check.
* @return {boolean} Whether the string is a valid hex color.
* @private
*/
goog.color.isValidHexColor_ = function(str) {
return goog.color.validHexColorRe_.test(str);
};
/**
* Helper for isNormalizedHexColor_.
* @type {RegExp}
* @private
*/
goog.color.normalizedHexColorRe_ = /^#[0-9a-f]{6}$/;
/**
* Checks if a string is a normalized hex color.
* We expect strings of the format #RRGGBB (ex: #1b3d5f)
* using only lowercase letters.
* @param {string} str String to check.
* @return {boolean} Whether the string is a normalized hex color.
* @private
*/
goog.color.isNormalizedHexColor_ = function(str) {
return goog.color.normalizedHexColorRe_.test(str);
};
/**
* Regular expression for matching and capturing RGB style strings. Helper for
* isValidRgbColor_.
* @type {RegExp}
* @private
*/
goog.color.rgbColorRe_ =
/^(?:rgb)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2})\)$/i;
/**
* Checks if a string is a valid rgb color. We expect strings of the format
* '(r, g, b)', or 'rgb(r, g, b)', where each color component is an int in
* [0, 255].
* @param {string} str String to check.
* @return {!goog.color.Rgb} the rgb representation of the color if it is
* a valid color, or the empty array otherwise.
* @private
*/
goog.color.isValidRgbColor_ = function(str) {
// Each component is separate (rather than using a repeater) so we can
// capture the match. Also, we explicitly set each component to be either 0,
// or start with a non-zero, to prevent octal numbers from slipping through.
var regExpResultArray = str.match(goog.color.rgbColorRe_);
if (regExpResultArray) {
var r = Number(regExpResultArray[1]);
var g = Number(regExpResultArray[2]);
var b = Number(regExpResultArray[3]);
if (r >= 0 && r <= 255 &&
g >= 0 && g <= 255 &&
b >= 0 && b <= 255) {
return [r, g, b];
}
}
return [];
};
/**
* Takes a hex value and prepends a zero if it's a single digit.
* Small helper method for use by goog.color and friends.
* @param {string} hex Hex value to prepend if single digit.
* @return {string} hex value prepended with zero if it was single digit,
* otherwise the same value that was passed in.
*/
goog.color.prependZeroIfNecessaryHelper = function(hex) {
return hex.length == 1 ? '0' + hex : hex;
};
/**
* Takes a string a prepends a '#' sign if one doesn't exist.
* Small helper method for use by goog.color and friends.
* @param {string} str String to check.
* @return {string} The value passed in, prepended with a '#' if it didn't
* already have one.
*/
goog.color.prependHashIfNecessaryHelper = function(str) {
return str.charAt(0) == '#' ? str : '#' + str;
};
/**
* Takes an array of [r, g, b] and converts it into a string appropriate for
* CSS styles.
* @param {goog.color.Rgb} rgb rgb representation of the color.
* @return {string} string of the form 'rgb(r,g,b)'.
* @private
*/
goog.color.rgbStyle_ = function(rgb) {
return 'rgb(' + rgb.join(',') + ')';
};
/**
* Converts an HSV triplet to an RGB array. V is brightness because b is
* reserved for blue in RGB.
* @param {number} h Hue value in [0, 360].
* @param {number} s Saturation value in [0, 1].
* @param {number} brightness brightness in [0, 255].
* @return {!goog.color.Rgb} rgb representation of the color.
*/
goog.color.hsvToRgb = function(h, s, brightness) {
var red = 0;
var green = 0;
var blue = 0;
if (s == 0) {
red = brightness;
green = brightness;
blue = brightness;
} else {
var sextant = Math.floor(h / 60);
var remainder = (h / 60) - sextant;
var val1 = brightness * (1 - s);
var val2 = brightness * (1 - (s * remainder));
var val3 = brightness * (1 - (s * (1 - remainder)));
switch (sextant) {
case 1:
red = val2;
green = brightness;
blue = val1;
break;
case 2:
red = val1;
green = brightness;
blue = val3;
break;
case 3:
red = val1;
green = val2;
blue = brightness;
break;
case 4:
red = val3;
green = val1;
blue = brightness;
break;
case 5:
red = brightness;
green = val1;
blue = val2;
break;
case 6:
case 0:
red = brightness;
green = val3;
blue = val1;
break;
}
}
return [Math.floor(red), Math.floor(green), Math.floor(blue)];
};
/**
* Converts from RGB values to an array of HSV values.
* @param {number} red Red value in [0, 255].
* @param {number} green Green value in [0, 255].
* @param {number} blue Blue value in [0, 255].
* @return {!goog.color.Hsv} hsv representation of the color.
*/
goog.color.rgbToHsv = function(red, green, blue) {
var max = Math.max(Math.max(red, green), blue);
var min = Math.min(Math.min(red, green), blue);
var hue;
var saturation;
var value = max;
if (min == max) {
hue = 0;
saturation = 0;
} else {
var delta = (max - min);
saturation = delta / max;
if (red == max) {
hue = (green - blue) / delta;
} else if (green == max) {
hue = 2 + ((blue - red) / delta);
} else {
hue = 4 + ((red - green) / delta);
}
hue *= 60;
if (hue < 0) {
hue += 360;
}
if (hue > 360) {
hue -= 360;
}
}
return [hue, saturation, value];
};
/**
* Converts from an array of RGB values to an array of HSV values.
* @param {goog.color.Rgb} rgb rgb representation of the color.
* @return {!goog.color.Hsv} hsv representation of the color.
*/
goog.color.rgbArrayToHsv = function(rgb) {
return goog.color.rgbToHsv(rgb[0], rgb[1], rgb[2]);
};
/**
* Converts an HSV triplet to an RGB array.
* @param {goog.color.Hsv} hsv hsv representation of the color.
* @return {!goog.color.Rgb} rgb representation of the color.
*/
goog.color.hsvArrayToRgb = function(hsv) {
return goog.color.hsvToRgb(hsv[0], hsv[1], hsv[2]);
};
/**
* Converts a hex representation of a color to HSL.
* @param {string} hex Color to convert.
* @return {!goog.color.Hsv} hsv representation of the color.
*/
goog.color.hexToHsl = function(hex) {
var rgb = goog.color.hexToRgb(hex);
return goog.color.rgbToHsl(rgb[0], rgb[1], rgb[2]);
};
/**
* Converts from h,s,l values to a hex string
* @param {number} h Hue, in [0, 360].
* @param {number} s Saturation, in [0, 1].
* @param {number} l Luminosity, in [0, 1].
* @return {string} hex representation of the color.
*/
goog.color.hslToHex = function(h, s, l) {
return goog.color.rgbArrayToHex(goog.color.hslToRgb(h, s, l));
};
/**
* Converts from an hsl array to a hex string
* @param {goog.color.Hsl} hsl hsl representation of the color.
* @return {string} hex representation of the color.
*/
goog.color.hslArrayToHex = function(hsl) {
return goog.color.rgbArrayToHex(goog.color.hslToRgb(hsl[0], hsl[1], hsl[2]));
};
/**
* Converts a hex representation of a color to HSV
* @param {string} hex Color to convert.
* @return {!goog.color.Hsv} hsv representation of the color.
*/
goog.color.hexToHsv = function(hex) {
return goog.color.rgbArrayToHsv(goog.color.hexToRgb(hex));
};
/**
* Converts from h,s,v values to a hex string
* @param {number} h Hue, in [0, 360].
* @param {number} s Saturation, in [0, 1].
* @param {number} v Value, in [0, 255].
* @return {string} hex representation of the color.
*/
goog.color.hsvToHex = function(h, s, v) {
return goog.color.rgbArrayToHex(goog.color.hsvToRgb(h, s, v));
};
/**
* Converts from an HSV array to a hex string
* @param {goog.color.Hsv} hsv hsv representation of the color.
* @return {string} hex representation of the color.
*/
goog.color.hsvArrayToHex = function(hsv) {
return goog.color.hsvToHex(hsv[0], hsv[1], hsv[2]);
};
/**
* Calculates the Euclidean distance between two color vectors on an HSL sphere.
* A demo of the sphere can be found at:
* http://en.wikipedia.org/wiki/HSL_color_space
* In short, a vector for color (H, S, L) in this system can be expressed as
* (S*L'*cos(2*PI*H), S*L'*sin(2*PI*H), L), where L' = abs(L - 0.5), and we
* simply calculate the 1-2 distance using these coordinates
* @param {goog.color.Hsl} hsl1 First color in hsl representation.
* @param {goog.color.Hsl} hsl2 Second color in hsl representation.
* @return {number} Distance between the two colors, in the range [0, 1].
*/
goog.color.hslDistance = function(hsl1, hsl2) {
var sl1, sl2;
if (hsl1[2] <= 0.5) {
sl1 = hsl1[1] * hsl1[2];
} else {
sl1 = hsl1[1] * (1.0 - hsl1[2]);
}
if (hsl2[2] <= 0.5) {
sl2 = hsl2[1] * hsl2[2];
} else {
sl2 = hsl2[1] * (1.0 - hsl2[2]);
}
var h1 = hsl1[0] / 360.0;
var h2 = hsl2[0] / 360.0;
var dh = (h1 - h2) * 2.0 * Math.PI;
return (hsl1[2] - hsl2[2]) * (hsl1[2] - hsl2[2]) +
sl1 * sl1 + sl2 * sl2 - 2 * sl1 * sl2 * Math.cos(dh);
};
/**
* Blend two colors together, using the specified factor to indicate the weight
* given to the first color
* @param {goog.color.Rgb} rgb1 First color represented in rgb.
* @param {goog.color.Rgb} rgb2 Second color represented in rgb.
* @param {number} factor The weight to be given to rgb1 over rgb2. Values
* should be in the range [0, 1]. If less than 0, factor will be set to 0.
* If greater than 1, factor will be set to 1.
* @return {!goog.color.Rgb} Combined color represented in rgb.
*/
goog.color.blend = function(rgb1, rgb2, factor) {
factor = goog.math.clamp(factor, 0, 1);
return [
Math.round(factor * rgb1[0] + (1.0 - factor) * rgb2[0]),
Math.round(factor * rgb1[1] + (1.0 - factor) * rgb2[1]),
Math.round(factor * rgb1[2] + (1.0 - factor) * rgb2[2])
];
};
/**
* Adds black to the specified color, darkening it
* @param {goog.color.Rgb} rgb rgb representation of the color.
* @param {number} factor Number in the range [0, 1]. 0 will do nothing, while
* 1 will return black. If less than 0, factor will be set to 0. If greater
* than 1, factor will be set to 1.
* @return {!goog.color.Rgb} Combined rgb color.
*/
goog.color.darken = function(rgb, factor) {
var black = [0, 0, 0];
return goog.color.blend(black, rgb, factor);
};
/**
* Adds white to the specified color, lightening it
* @param {goog.color.Rgb} rgb rgb representation of the color.
* @param {number} factor Number in the range [0, 1]. 0 will do nothing, while
* 1 will return white. If less than 0, factor will be set to 0. If greater
* than 1, factor will be set to 1.
* @return {!goog.color.Rgb} Combined rgb color.
*/
goog.color.lighten = function(rgb, factor) {
var white = [255, 255, 255];
return goog.color.blend(white, rgb, factor);
};
/**
* Find the "best" (highest-contrast) of the suggested colors for the prime
* color. Uses W3C formula for judging readability and visual accessibility:
* http://www.w3.org/TR/AERT#color-contrast
* @param {goog.color.Rgb} prime Color represented as a rgb array.
* @param {Array<goog.color.Rgb>} suggestions Array of colors,
* each representing a rgb array.
* @return {!goog.color.Rgb} Highest-contrast color represented by an array..
*/
goog.color.highContrast = function(prime, suggestions) {
var suggestionsWithDiff = [];
for (var i = 0; i < suggestions.length; i++) {
suggestionsWithDiff.push({
color: suggestions[i],
diff: goog.color.yiqBrightnessDiff_(suggestions[i], prime) +
goog.color.colorDiff_(suggestions[i], prime)
});
}
suggestionsWithDiff.sort(function(a, b) {
return b.diff - a.diff;
});
return suggestionsWithDiff[0].color;
};
/**
* Calculate brightness of a color according to YIQ formula (brightness is Y).
* More info on YIQ here: http://en.wikipedia.org/wiki/YIQ. Helper method for
* goog.color.highContrast()
* @param {goog.color.Rgb} rgb Color represented by a rgb array.
* @return {number} brightness (Y).
* @private
*/
goog.color.yiqBrightness_ = function(rgb) {
return Math.round((rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000);
};
/**
* Calculate difference in brightness of two colors. Helper method for
* goog.color.highContrast()
* @param {goog.color.Rgb} rgb1 Color represented by a rgb array.
* @param {goog.color.Rgb} rgb2 Color represented by a rgb array.
* @return {number} Brightness difference.
* @private
*/
goog.color.yiqBrightnessDiff_ = function(rgb1, rgb2) {
return Math.abs(goog.color.yiqBrightness_(rgb1) -
goog.color.yiqBrightness_(rgb2));
};
/**
* Calculate color difference between two colors. Helper method for
* goog.color.highContrast()
* @param {goog.color.Rgb} rgb1 Color represented by a rgb array.
* @param {goog.color.Rgb} rgb2 Color represented by a rgb array.
* @return {number} Color difference.
* @private
*/
goog.color.colorDiff_ = function(rgb1, rgb2) {
return Math.abs(rgb1[0] - rgb2[0]) + Math.abs(rgb1[1] - rgb2[1]) +
Math.abs(rgb1[2] - rgb2[2]);
};

View File

@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2006 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
Closure Unit Tests - goog.color
</title>
<script src="../base.js">
</script>
<script>
goog.require('goog.colorTest');
</script>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,667 @@
// Copyright 2006 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
goog.provide('goog.colorTest');
goog.setTestOnly('goog.colorTest');
goog.require('goog.array');
goog.require('goog.color');
goog.require('goog.color.names');
goog.require('goog.testing.jsunit');
function testIsValidColor() {
var goodColors = ['#ffffff', '#ff7812', '#012345', '#Ff003D', '#3CA',
'(255, 26, 75)', 'RGB(2, 3, 4)', '(0,0,0)', 'white',
'blue'];
var badColors = ['#xxxxxx', '8899000', 'not_color', '#1234567', 'fffffg',
'(2555,0,0)', '(1,2,3,4)', 'rgb(1,20,)', 'RGB(20,20,20,)',
'omgwtfbbq'];
for (var i = 0; i < goodColors.length; i++) {
assertTrue(goodColors[i], goog.color.isValidColor(goodColors[i]));
}
for (var i = 0; i < badColors.length; i++) {
assertFalse(badColors[i], goog.color.isValidColor(badColors[i]));
}
}
function testIsValidHexColor() {
var goodHexColors = ['#ffffff', '#ff7812', '#012345', '#Ff003D', '#3CA'];
var badHexColors = ['#xxxxxx', '889900', 'not_color', '#1234567', 'fffffg'];
for (var i = 0; i < goodHexColors.length; i++) {
assertTrue(goodHexColors[i], goog.color.isValidHexColor_(goodHexColors[i]));
}
for (var i = 0; i < badHexColors.length; i++) {
assertFalse(badHexColors[i], goog.color.isValidHexColor_(badHexColors[i]));
}
}
function testIsValidRgbColor() {
var goodRgbColors = ['(255, 26, 75)', 'RGB(2, 3, 4)', '(0,0,0)',
'rgb(255,255,255)'];
var badRgbColors = ['(2555,0,0)', '(1,2,3,4)', 'rgb(1,20,)',
'RGB(20,20,20,)'];
for (var i = 0; i < goodRgbColors.length; i++) {
assertEquals(goodRgbColors[i],
goog.color.isValidRgbColor_(goodRgbColors[i]).length, 3);
}
for (var i = 0; i < badRgbColors.length; i++) {
assertEquals(badRgbColors[i],
goog.color.isValidRgbColor_(badRgbColors[i]).length, 0);
}
}
function testParse() {
var colors = ['rgb(15, 250, 77)', '(127, 127, 127)', '#ffeedd', '123456',
'magenta'];
var parsed = goog.array.map(colors, goog.color.parse);
assertEquals('rgb', parsed[0].type);
assertEquals(goog.color.rgbToHex(15, 250, 77), parsed[0].hex);
assertEquals('rgb', parsed[1].type);
assertEquals(goog.color.rgbToHex(127, 127, 127), parsed[1].hex);
assertEquals('hex', parsed[2].type);
assertEquals('#ffeedd', parsed[2].hex);
assertEquals('hex', parsed[3].type);
assertEquals('#123456', parsed[3].hex);
assertEquals('named', parsed[4].type);
assertEquals('#ff00ff', parsed[4].hex);
var badColors = ['rgb(01, 1, 23)', '(256, 256, 256)', '#ffeeddaa'];
for (var i = 0; i < badColors.length; i++) {
var e = assertThrows(goog.partial(goog.color.parse, badColors[i]));
assertContains('is not a valid color string', e.message);
}
}
function testHexToRgb() {
var testColors = [['#B0FF2D', [176, 255, 45]],
['#b26e5f', [178, 110, 95]],
['#66f', [102, 102, 255]]];
for (var i = 0; i < testColors.length; i++) {
var r = goog.color.hexToRgb(testColors[i][0]);
var t = testColors[i][1];
assertEquals('Red channel should match.', t[0], r[0]);
assertEquals('Green channel should match.', t[1], r[1]);
assertEquals('Blue channel should match.', t[2], r[2]);
}
var badColors = ['', '#g00', 'some words'];
for (var i = 0; i < badColors.length; i++) {
var e = assertThrows(goog.partial(goog.color.hexToRgb, badColors[i]));
assertEquals("'" + badColors[i] + "' is not a valid hex color", e.message);
}
}
function testHexToRgbStyle() {
assertEquals('rgb(255,0,0)', goog.color.hexToRgbStyle(goog.color.names.red));
assertEquals('rgb(206,206,206)', goog.color.hexToRgbStyle('#cecece'));
assertEquals('rgb(51,204,170)', goog.color.hexToRgbStyle('#3CA'));
var badHexColors = ['#1234', null, undefined, '#.1234567890'];
for (var i = 0; i < badHexColors.length; ++i) {
var badHexColor = badHexColors[i];
var e = assertThrows(goog.partial(goog.color.hexToRgbStyle, badHexColor));
assertEquals("'" + badHexColor + "' is not a valid hex color", e.message);
}
}
function testRgbToHex() {
assertEquals(goog.color.names.red, goog.color.rgbToHex(255, 0, 0));
assertEquals('#af13ff', goog.color.rgbToHex(175, 19, 255));
var badRgb = [[-1, -1, -1], [256, 0, 0], ['a', 'b', 'c'], [undefined, 5, 5]];
for (var i = 0; i < badRgb.length; ++i) {
var e = assertThrows(goog.partial(goog.color.rgbArrayToHex, badRgb[i]));
assertContains('is not a valid RGB color', e.message);
}
}
function testRgbToHsl() {
var rgb = [255, 171, 32];
var hsl = goog.color.rgbArrayToHsl(rgb);
assertEquals(37, hsl[0]);
assertTrue(1.0 - hsl[1] < 0.01);
assertTrue(hsl[2] - .5625 < 0.01);
}
function testHslToRgb() {
var hsl = [60, 0.5, 0.1];
var rgb = goog.color.hslArrayToRgb(hsl);
assertEquals(38, rgb[0]);
assertEquals(38, rgb[1]);
assertEquals(13, rgb[2]);
}
// Tests accuracy of HSL to RGB conversion
function testHSLBidiToRGB() {
var DELTA = 1;
var color = [[100, 56, 200],
[255, 0, 0],
[0, 0, 255],
[0, 255, 0],
[255, 255, 255],
[0, 0, 0]];
for (var i = 0; i < color.length; i++) {
colorConversionTestHelper(
function(color) {
return goog.color.rgbToHsl(color[0], color[1], color[2]);
},
function(color) {
return goog.color.hslToRgb(color[0], color[1], color[2]);
},
color[i], DELTA);
colorConversionTestHelper(
function(color) { return goog.color.rgbArrayToHsl(color); },
function(color) { return goog.color.hslArrayToRgb(color); },
color[i], DELTA);
}
}
// Tests HSV to RGB conversion
function testHSVToRGB() {
var DELTA = 1;
var color = [[100, 56, 200],
[255, 0, 0],
[0, 0, 255],
[0, 255, 0],
[255, 255, 255],
[0, 0, 0]];
for (var i = 0; i < color.length; i++) {
colorConversionTestHelper(
function(color) {
return goog.color.rgbToHsv(color[0], color[1], color[2]);
},
function(color) {
return goog.color.hsvToRgb(color[0], color[1], color[2]);
},
color[i], DELTA);
colorConversionTestHelper(
function(color) { return goog.color.rgbArrayToHsv(color); },
function(color) { return goog.color.hsvArrayToRgb(color); },
color[i], DELTA);
}
}
// Tests that HSV space is (0-360) for hue
function testHSVSpecRangeIsCorrect() {
var color = [0, 0, 255]; // Blue is in the middle of hue range
var hsv = goog.color.rgbToHsv(color[0], color[1], color[2]);
assertTrue("H in HSV space looks like it's not 0-360", hsv[0] > 1);
}
// Tests conversion between HSL and Hex
function testHslToHex() {
var DELTA = 1;
var color = [[0, 0, 0],
[20, 0.5, 0.5],
[0, 0, 1],
[255, .45, .76]];
for (var i = 0; i < color.length; i++) {
colorConversionTestHelper(
function(hsl) { return goog.color.hslToHex(hsl[0], hsl[1], hsl[2]); },
function(hex) { return goog.color.hexToHsl(hex); },
color[i], DELTA);
colorConversionTestHelper(
function(hsl) { return goog.color.hslArrayToHex(hsl); },
function(hex) { return goog.color.hexToHsl(hex); },
color[i], DELTA);
}
}
// Tests conversion between HSV and Hex
function testHsvToHex() {
var DELTA = 1;
var color = [[0, 0, 0],
[.5, 0.5, 155],
[0, 0, 255],
[.7, .45, 21]];
for (var i = 0; i < color.length; i++) {
colorConversionTestHelper(
function(hsl) { return goog.color.hsvToHex(hsl[0], hsl[1], hsl[2]); },
function(hex) { return goog.color.hexToHsv(hex); },
color[i], DELTA);
colorConversionTestHelper(
function(hsl) { return goog.color.hsvArrayToHex(hsl); },
function(hex) { return goog.color.hexToHsv(hex); },
color[i], DELTA);
}
}
/**
* This helper method compares two RGB colors, checking that each color
* component is the same.
* @param {Array<number>} rgb1 Color represented by a 3-element array with
* red, green, and blue values respectively, in the range [0, 255].
* @param {Array<number>} rgb2 Color represented by a 3-element array with
* red, green, and blue values respectively, in the range [0, 255].
* @return {boolean} True if the colors are the same, false otherwise.
*/
function rgbColorsAreEqual(rgb1, rgb2) {
return (rgb1[0] == rgb2[0] &&
rgb1[1] == rgb2[1] &&
rgb1[2] == rgb2[2]);
}
/**
* This method runs unit tests against goog.color.blend(). Test cases include:
* blending arbitrary colors with factors of 0 and 1, blending the same colors
* using arbitrary factors, blending different colors of varying factors,
* and blending colors using factors outside the expected range.
*/
function testColorBlend() {
// Define some RGB colors for our tests.
var black = [0, 0, 0];
var blue = [0, 0, 255];
var gray = [128, 128, 128];
var green = [0, 255, 0];
var purple = [128, 0, 128];
var red = [255, 0, 0];
var yellow = [255, 255, 0];
var white = [255, 255, 255];
// Blend arbitrary colors, using 0 and 1 for factors. Using 0 should return
// the first color, while using 1 should return the second color.
var redWithNoGreen = goog.color.blend(red, green, 1);
assertTrue('red + 0 * green = red',
rgbColorsAreEqual(red, redWithNoGreen));
var whiteWithAllBlue = goog.color.blend(white, blue, 0);
assertTrue('white + 1 * blue = blue',
rgbColorsAreEqual(blue, whiteWithAllBlue));
// Blend the same colors using arbitrary factors. This should return the
// same colors.
var greenWithGreen = goog.color.blend(green, green, .25);
assertTrue('green + .25 * green = green',
rgbColorsAreEqual(green, greenWithGreen));
// Blend different colors using varying factors.
var blackWithWhite = goog.color.blend(black, white, .5);
assertTrue('black + .5 * white = gray',
rgbColorsAreEqual(gray, blackWithWhite));
var redAndBlue = goog.color.blend(red, blue, .5);
assertTrue('red + .5 * blue = purple',
rgbColorsAreEqual(purple, redAndBlue));
var lightGreen = goog.color.blend(green, white, .75);
assertTrue('green + .25 * white = a lighter shade of white',
lightGreen[0] > 0 &&
lightGreen[1] == 255 &&
lightGreen[2] > 0);
// Blend arbitrary colors using factors outside the expected range.
var noGreenAllPurple = goog.color.blend(green, purple, -0.5);
assertTrue('green * -0.5 + purple = purple.',
rgbColorsAreEqual(purple, noGreenAllPurple));
var allBlueNoYellow = goog.color.blend(blue, yellow, 1.37);
assertTrue('blue * 1.37 + yellow = blue.',
rgbColorsAreEqual(blue, allBlueNoYellow));
}
/**
* This method runs unit tests against goog.color.darken(). Test cases
* include darkening black with arbitrary factors, edge cases (using 0 and 1),
* darkening colors using various factors, and darkening colors using factors
* outside the expected range.
*/
function testColorDarken() {
// Define some RGB colors
var black = [0, 0, 0];
var green = [0, 255, 0];
var darkGray = [68, 68, 68];
var olive = [128, 128, 0];
var purple = [128, 0, 128];
var white = [255, 255, 255];
// Darken black by an arbitrary factor, which should still return black.
var darkBlack = goog.color.darken(black, .63);
assertTrue('black darkened by .63 is still black.',
rgbColorsAreEqual(black, darkBlack));
// Call darken() with edge-case factors (0 and 1).
var greenNotDarkened = goog.color.darken(green, 0);
assertTrue('green darkened by 0 is still green.',
rgbColorsAreEqual(green, greenNotDarkened));
var whiteFullyDarkened = goog.color.darken(white, 1);
assertTrue('white darkened by 1 is black.',
rgbColorsAreEqual(black, whiteFullyDarkened));
// Call darken() with various colors and factors. The result should be
// a color with less luminance.
var whiteHsl = goog.color.rgbToHsl(white[0],
white[1],
white[2]);
var whiteDarkened = goog.color.darken(white, .43);
var whiteDarkenedHsl = goog.color.rgbToHsl(whiteDarkened[0],
whiteDarkened[1],
whiteDarkened[2]);
assertTrue('White that\'s darkened has less luminance than white.',
whiteDarkenedHsl[2] < whiteHsl[2]);
var purpleHsl = goog.color.rgbToHsl(purple[0],
purple[1],
purple[2]);
var purpleDarkened = goog.color.darken(purple, .1);
var purpleDarkenedHsl = goog.color.rgbToHsl(purpleDarkened[0],
purpleDarkened[1],
purpleDarkened[2]);
assertTrue('Purple that\'s darkened has less luminance than purple.',
purpleDarkenedHsl[2] < purpleHsl[2]);
// Call darken() with factors outside the expected range.
var darkGrayTurnedBlack = goog.color.darken(darkGray, 2.1);
assertTrue('Darkening dark gray by 2.1 returns black.',
rgbColorsAreEqual(black, darkGrayTurnedBlack));
var whiteNotDarkened = goog.color.darken(white, -0.62);
assertTrue('Darkening white by -0.62 returns white.',
rgbColorsAreEqual(white, whiteNotDarkened));
}
/**
* This method runs unit tests against goog.color.lighten(). Test cases
* include lightening white with arbitrary factors, edge cases (using 0 and 1),
* lightening colors using various factors, and lightening colors using factors
* outside the expected range.
*/
function testColorLighten() {
// Define some RGB colors
var black = [0, 0, 0];
var brown = [165, 42, 42];
var navy = [0, 0, 128];
var orange = [255, 165, 0];
var white = [255, 255, 255];
// Lighten white by an arbitrary factor, which should still return white.
var lightWhite = goog.color.lighten(white, .41);
assertTrue('white lightened by .41 is still white.',
rgbColorsAreEqual(white, lightWhite));
// Call lighten() with edge-case factors(0 and 1).
var navyNotLightened = goog.color.lighten(navy, 0);
assertTrue('navy lightened by 0 is still navy.',
rgbColorsAreEqual(navy, navyNotLightened));
var orangeFullyLightened = goog.color.lighten(orange, 1);
assertTrue('orange lightened by 1 is white.',
rgbColorsAreEqual(white, orangeFullyLightened));
// Call lighten() with various colors and factors. The result should be
// a color with greater luminance.
var blackHsl = goog.color.rgbToHsl(black[0],
black[1],
black[2]);
var blackLightened = goog.color.lighten(black, .33);
var blackLightenedHsl = goog.color.rgbToHsl(blackLightened[0],
blackLightened[1],
blackLightened[2]);
assertTrue('Black that\'s lightened has more luminance than black.',
blackLightenedHsl[2] >= blackHsl[2]);
var orangeHsl = goog.color.rgbToHsl(orange[0],
orange[1],
orange[2]);
var orangeLightened = goog.color.lighten(orange, .91);
var orangeLightenedHsl = goog.color.rgbToHsl(orangeLightened[0],
orangeLightened[1],
orangeLightened[2]);
assertTrue('Orange that\'s lightened has more luminance than orange.',
orangeLightenedHsl[2] >= orangeHsl[2]);
// Call lighten() with factors outside the expected range.
var navyTurnedWhite = goog.color.lighten(navy, 1.01);
assertTrue('Lightening navy by 1.01 returns white.',
rgbColorsAreEqual(white, navyTurnedWhite));
var brownNotLightened = goog.color.lighten(brown, -0.0000001);
assertTrue('Lightening brown by -0.0000001 returns brown.',
rgbColorsAreEqual(brown, brownNotLightened));
}
/**
* This method runs unit tests against goog.color.hslDistance().
*/
function testHslDistance() {
// Define some HSL colors
var aliceBlueHsl = goog.color.rgbToHsl(240, 248, 255);
var blackHsl = goog.color.rgbToHsl(0, 0, 0);
var ghostWhiteHsl = goog.color.rgbToHsl(248, 248, 255);
var navyHsl = goog.color.rgbToHsl(0, 0, 128);
var redHsl = goog.color.rgbToHsl(255, 0, 0);
var whiteHsl = goog.color.rgbToHsl(255, 255, 255);
// The distance between the same colors should be 0.
assertTrue('There is no HSL distance between white and white.',
goog.color.hslDistance(whiteHsl, whiteHsl) == 0);
assertTrue('There is no HSL distance between red and red.',
goog.color.hslDistance(redHsl, redHsl) == 0);
// The distance between various colors should be within certain thresholds.
var hslDistance = goog.color.hslDistance(whiteHsl, ghostWhiteHsl);
assertTrue('The HSL distance between white and ghost white is > 0.',
hslDistance > 0);
assertTrue('The HSL distance between white and ghost white is <= 0.02.',
hslDistance <= 0.02);
hslDistance = goog.color.hslDistance(whiteHsl, redHsl);
assertTrue('The HSL distance betwen white and red is > 0.02.',
hslDistance > 0.02);
hslDistance = goog.color.hslDistance(navyHsl, aliceBlueHsl);
assertTrue('The HSL distance between navy and alice blue is > 0.02.',
hslDistance > 0.02);
hslDistance = goog.color.hslDistance(blackHsl, whiteHsl);
assertTrue('The HSL distance between white and black is 1.',
hslDistance == 1);
}
/**
* This method runs unit tests against goog.color.yiqBrightness_().
*/
function testYiqBrightness() {
var white = [255, 255, 255];
var black = [0, 0, 0];
var coral = [255, 127, 80];
var lightgreen = [144, 238, 144];
var whiteBrightness = goog.color.yiqBrightness_(white);
var blackBrightness = goog.color.yiqBrightness_(black);
var coralBrightness = goog.color.yiqBrightness_(coral);
var lightgreenBrightness = goog.color.yiqBrightness_(lightgreen);
// brightness should be a number
assertTrue('White brightness is a number.',
typeof whiteBrightness == 'number');
assertTrue('Coral brightness is a number.',
typeof coralBrightness == 'number');
// brightness for known colors should match known values
assertEquals('White brightness is 255', whiteBrightness, 255);
assertEquals('Black brightness is 0', blackBrightness, 0);
assertEquals('Coral brightness is 160', coralBrightness, 160);
assertEquals('Lightgreen brightness is 199', lightgreenBrightness, 199);
}
/**
* This method runs unit tests against goog.color.yiqBrightnessDiff_().
*/
function testYiqBrightnessDiff() {
var colors = {
'deeppink': [255, 20, 147],
'indigo': [75, 0, 130],
'saddlebrown': [139, 69, 19]
};
var diffs = new Object();
for (name1 in colors) {
for (name2 in colors) {
diffs[name1 + '-' + name2] =
goog.color.yiqBrightnessDiff_(colors[name1], colors[name2]);
}
}
for (pair in diffs) {
// each brightness diff should be a number
assertTrue(pair + ' diff is a number.', typeof diffs[pair] == 'number');
// each brightness diff should be greater than or equal to 0
assertTrue(pair + ' diff is greater than or equal to 0.', diffs[pair] >= 0);
}
// brightness diff for same-color pairs should be 0
assertEquals('deeppink-deeppink is 0.', diffs['deeppink-deeppink'], 0);
assertEquals('indigo-indigo is 0.', diffs['indigo-indigo'], 0);
// brightness diff for known pairs should match known values
assertEquals('deeppink-indigo is 68.', diffs['deeppink-indigo'], 68);
assertEquals('saddlebrown-deeppink is 21.',
diffs['saddlebrown-deeppink'], 21);
// reversed pairs should have equal values
assertEquals('indigo-saddlebrown is 47.', diffs['indigo-saddlebrown'], 47);
assertEquals('saddlebrown-indigo is also 47.',
diffs['saddlebrown-indigo'], 47);
}
/**
* This method runs unit tests against goog.color.colorDiff_().
*/
function testColorDiff() {
var colors = {
'mediumblue': [0, 0, 205],
'oldlace': [253, 245, 230],
'orchid': [218, 112, 214]
};
var diffs = new Object();
for (name1 in colors) {
for (name2 in colors) {
diffs[name1 + '-' + name2] =
goog.color.colorDiff_(colors[name1], colors[name2]);
}
}
for (pair in diffs) {
// each color diff should be a number
assertTrue(pair + ' diff is a number.', typeof diffs[pair] == 'number');
// each color diff should be greater than or equal to 0
assertTrue(pair + ' diff is greater than or equal to 0.', diffs[pair] >= 0);
}
// color diff for same-color pairs should be 0
assertEquals('mediumblue-mediumblue is 0.',
diffs['mediumblue-mediumblue'], 0);
assertEquals('oldlace-oldlace is 0.', diffs['oldlace-oldlace'], 0);
// color diff for known pairs should match known values
assertEquals('mediumblue-oldlace is 523.', diffs['mediumblue-oldlace'], 523);
assertEquals('oldlace-orchid is 184.', diffs['oldlace-orchid'], 184);
// reversed pairs should have equal values
assertEquals('orchid-mediumblue is 339.', diffs['orchid-mediumblue'], 339);
assertEquals('mediumblue-orchid is also 339.',
diffs['mediumblue-orchid'], 339);
}
/**
* This method runs unit tests against goog.color.highContrast().
*/
function testHighContrast() {
white = [255, 255, 255];
black = [0, 0, 0];
lemonchiffron = [255, 250, 205];
sienna = [160, 82, 45];
var suggestion = goog.color.highContrast(
black, [white, black, sienna, lemonchiffron]);
// should return an array of three numbers
assertTrue('Return value is an array.', typeof suggestion == 'object');
assertTrue('Return value is 3 long.', suggestion.length == 3);
// known color combos should return a known (i.e. human-verified) suggestion
assertArrayEquals('White is best on sienna.',
goog.color.highContrast(
sienna, [white, black, sienna, lemonchiffron]), white);
assertArrayEquals('Black is best on lemonchiffron.',
goog.color.highContrast(
white, [white, black, sienna, lemonchiffron]), black);
}
/**
* Helper function for color conversion functions between two colorspaces.
* @param {Function} funcOne Function that converts from 1st colorspace to 2nd
* @param {Function} funcTwo Function that converts from 2nd colorspace to 2nd
* @param {Array<number>} color The color array passed to funcOne
* @param {number} DELTA Margin of error for each element in color
*/
function colorConversionTestHelper(funcOne, funcTwo, color, DELTA) {
var temp = funcOne(color);
if (!goog.color.isValidHexColor_(temp)) {
assertTrue('First conversion had a NaN: ' + temp, !isNaN(temp[0]));
assertTrue('First conversion had a NaN: ' + temp, !isNaN(temp[1]));
assertTrue('First conversion had a NaN: ' + temp, !isNaN(temp[2]));
}
var back = funcTwo(temp);
if (!goog.color.isValidHexColor_(temp)) {
assertTrue('Second conversion had a NaN: ' + back, !isNaN(back[0]));
assertTrue('Second conversion had a NaN: ' + back, !isNaN(back[1]));
assertTrue('Second conversion had a NaN: ' + back, !isNaN(back[2]));
}
assertColorFuzzyEquals('Color was off', color, back, DELTA);
}
/**
* Checks equivalence between two colors' respective values. Accepts +- delta
* for each pair of values
* @param {string} Str
* @param {Array<number>} expected
* @param {Array<number>} actual
* @param {number} delta Margin of error for each element in color array
*/
function assertColorFuzzyEquals(str, expected, actual, delta) {
assertTrue(str + ' Expected: ' + expected + ' and got: ' + actual +
' w/ delta: ' + delta,
(Math.abs(expected[0] - actual[0]) <= delta) &&
(Math.abs(expected[1] - actual[1]) <= delta) &&
(Math.abs(expected[2] - actual[2]) <= delta));
}

View File

@@ -0,0 +1,176 @@
// Copyright 2006 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Names of standard colors with their associated hex values.
*/
goog.provide('goog.color.names');
/**
* A map that contains a lot of colors that are recognised by various browsers.
* This list is way larger than the minimal one dictated by W3C.
* The keys of this map are the lowercase "readable" names of the colors, while
* the values are the "hex" values.
*/
goog.color.names = {
'aliceblue': '#f0f8ff',
'antiquewhite': '#faebd7',
'aqua': '#00ffff',
'aquamarine': '#7fffd4',
'azure': '#f0ffff',
'beige': '#f5f5dc',
'bisque': '#ffe4c4',
'black': '#000000',
'blanchedalmond': '#ffebcd',
'blue': '#0000ff',
'blueviolet': '#8a2be2',
'brown': '#a52a2a',
'burlywood': '#deb887',
'cadetblue': '#5f9ea0',
'chartreuse': '#7fff00',
'chocolate': '#d2691e',
'coral': '#ff7f50',
'cornflowerblue': '#6495ed',
'cornsilk': '#fff8dc',
'crimson': '#dc143c',
'cyan': '#00ffff',
'darkblue': '#00008b',
'darkcyan': '#008b8b',
'darkgoldenrod': '#b8860b',
'darkgray': '#a9a9a9',
'darkgreen': '#006400',
'darkgrey': '#a9a9a9',
'darkkhaki': '#bdb76b',
'darkmagenta': '#8b008b',
'darkolivegreen': '#556b2f',
'darkorange': '#ff8c00',
'darkorchid': '#9932cc',
'darkred': '#8b0000',
'darksalmon': '#e9967a',
'darkseagreen': '#8fbc8f',
'darkslateblue': '#483d8b',
'darkslategray': '#2f4f4f',
'darkslategrey': '#2f4f4f',
'darkturquoise': '#00ced1',
'darkviolet': '#9400d3',
'deeppink': '#ff1493',
'deepskyblue': '#00bfff',
'dimgray': '#696969',
'dimgrey': '#696969',
'dodgerblue': '#1e90ff',
'firebrick': '#b22222',
'floralwhite': '#fffaf0',
'forestgreen': '#228b22',
'fuchsia': '#ff00ff',
'gainsboro': '#dcdcdc',
'ghostwhite': '#f8f8ff',
'gold': '#ffd700',
'goldenrod': '#daa520',
'gray': '#808080',
'green': '#008000',
'greenyellow': '#adff2f',
'grey': '#808080',
'honeydew': '#f0fff0',
'hotpink': '#ff69b4',
'indianred': '#cd5c5c',
'indigo': '#4b0082',
'ivory': '#fffff0',
'khaki': '#f0e68c',
'lavender': '#e6e6fa',
'lavenderblush': '#fff0f5',
'lawngreen': '#7cfc00',
'lemonchiffon': '#fffacd',
'lightblue': '#add8e6',
'lightcoral': '#f08080',
'lightcyan': '#e0ffff',
'lightgoldenrodyellow': '#fafad2',
'lightgray': '#d3d3d3',
'lightgreen': '#90ee90',
'lightgrey': '#d3d3d3',
'lightpink': '#ffb6c1',
'lightsalmon': '#ffa07a',
'lightseagreen': '#20b2aa',
'lightskyblue': '#87cefa',
'lightslategray': '#778899',
'lightslategrey': '#778899',
'lightsteelblue': '#b0c4de',
'lightyellow': '#ffffe0',
'lime': '#00ff00',
'limegreen': '#32cd32',
'linen': '#faf0e6',
'magenta': '#ff00ff',
'maroon': '#800000',
'mediumaquamarine': '#66cdaa',
'mediumblue': '#0000cd',
'mediumorchid': '#ba55d3',
'mediumpurple': '#9370db',
'mediumseagreen': '#3cb371',
'mediumslateblue': '#7b68ee',
'mediumspringgreen': '#00fa9a',
'mediumturquoise': '#48d1cc',
'mediumvioletred': '#c71585',
'midnightblue': '#191970',
'mintcream': '#f5fffa',
'mistyrose': '#ffe4e1',
'moccasin': '#ffe4b5',
'navajowhite': '#ffdead',
'navy': '#000080',
'oldlace': '#fdf5e6',
'olive': '#808000',
'olivedrab': '#6b8e23',
'orange': '#ffa500',
'orangered': '#ff4500',
'orchid': '#da70d6',
'palegoldenrod': '#eee8aa',
'palegreen': '#98fb98',
'paleturquoise': '#afeeee',
'palevioletred': '#db7093',
'papayawhip': '#ffefd5',
'peachpuff': '#ffdab9',
'peru': '#cd853f',
'pink': '#ffc0cb',
'plum': '#dda0dd',
'powderblue': '#b0e0e6',
'purple': '#800080',
'red': '#ff0000',
'rosybrown': '#bc8f8f',
'royalblue': '#4169e1',
'saddlebrown': '#8b4513',
'salmon': '#fa8072',
'sandybrown': '#f4a460',
'seagreen': '#2e8b57',
'seashell': '#fff5ee',
'sienna': '#a0522d',
'silver': '#c0c0c0',
'skyblue': '#87ceeb',
'slateblue': '#6a5acd',
'slategray': '#708090',
'slategrey': '#708090',
'snow': '#fffafa',
'springgreen': '#00ff7f',
'steelblue': '#4682b4',
'tan': '#d2b48c',
'teal': '#008080',
'thistle': '#d8bfd8',
'tomato': '#ff6347',
'turquoise': '#40e0d0',
'violet': '#ee82ee',
'wheat': '#f5deb3',
'white': '#ffffff',
'whitesmoke': '#f5f5f5',
'yellow': '#ffff00',
'yellowgreen': '#9acd32'
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,24 @@
<!doctype html>
<html>
<!--
Copyright 2012 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<!--
Unit test for goog.crypt.Aes
-->
<head>
<title>
goog.crypt.Aes unit test
</title>
<script src="../base.js">
</script>
<script>
goog.require('goog.crypt.AesTest');
</script>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,586 @@
// Copyright 2012 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
goog.provide('goog.crypt.AesTest');
goog.setTestOnly('goog.crypt.AesTest');
goog.require('goog.crypt');
goog.require('goog.crypt.Aes');
goog.require('goog.testing.jsunit');
goog.crypt.Aes.ENABLE_TEST_MODE = true;
/*
* Unit test for goog.crypt.Aes using the test vectors from the spec:
* http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
*/
var testData = null;
function test128() {
doTest('000102030405060708090a0b0c0d0e0f',
'00112233445566778899aabbccddeeff',
v128,
true /* encrypt */);
}
function test192() {
doTest('000102030405060708090a0b0c0d0e0f1011121314151617',
'00112233445566778899aabbccddeeff',
v192,
true /* encrypt */);
}
function test256() {
doTest('000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f',
'00112233445566778899aabbccddeeff',
v256,
true /* encrypt */);
}
function test128d() {
doTest('000102030405060708090a0b0c0d0e0f',
'69c4e0d86a7b0430d8cdb78070b4c55a',
v128d,
false /* decrypt */);
}
function test192d() {
doTest('000102030405060708090a0b0c0d0e0f1011121314151617',
'dda97ca4864cdfe06eaf70a0ec0d7191',
v192d,
false /* decrypt */);
}
function test256d() {
doTest('000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f',
'8ea2b7ca516745bfeafc49904b496089',
v256d,
false /* decrypt */);
}
function doTest(key, input, values, dir) {
testData = values;
var keyArray = goog.crypt.hexToByteArray(key);
var aes = new goog.crypt.Aes(keyArray);
aes.testKeySchedule_ = onTestKeySchedule;
aes.testStartRound_ = onTestStartRound;
aes.testAfterSubBytes_ = onTestAfterSubBytes;
aes.testAfterShiftRows_ = onTestAfterShiftRows;
aes.testAfterMixColumns_ = onTestAfterMixColumns;
aes.testAfterAddRoundKey_ = onTestAfterAddRoundKey;
var inputArr = goog.crypt.hexToByteArray(input);
var keyArr = goog.crypt.hexToByteArray(key);
var outputArr = [];
var outputArr;
if (dir) {
outputArr = aes.encrypt(inputArr);
} else {
outputArr = aes.decrypt(inputArr);
}
assertEquals('Incorrect output for test ' + testData.name,
testData[testData.length - 1].output,
encodeHex(outputArr));
}
function onTestKeySchedule(roundNum, keySchedule, keyScheduleIndex) {
assertEquals(
'Incorrect key for round ' + roundNum,
testData[roundNum].k_sch, encodeKey(keySchedule, keyScheduleIndex));
}
function onTestStartRound(roundNum, state) {
assertEquals('Incorrect state for test ' + testData.name +
' at start round ' + roundNum,
testData[roundNum].start, encodeState(state));
}
function onTestAfterSubBytes(roundNum, state) {
assertEquals('Incorrect state for test ' + testData.name +
' after sub bytes in round ' + roundNum,
testData[roundNum].s_box, encodeState(state));
}
function onTestAfterShiftRows(roundNum, state) {
assertEquals('Incorrect state for test ' + testData.name +
' after shift rows in round ' + roundNum,
testData[roundNum].s_row, encodeState(state));
}
function onTestAfterMixColumns(roundNum, state) {
assertEquals('Incorrect state for test ' + testData.name +
' after mix columns in round ' + roundNum,
testData[roundNum].m_col, encodeState(state));
}
function onTestAfterAddRoundKey(roundNum, state) {
assertEquals('Incorrect state for test ' + testData.name +
' after adding round key in round ' + roundNum,
testData[roundNum].k_add, encodeState(state));
}
function encodeHex(arr) {
var str = [];
for (var i = 0; i < arr.length; i++) {
str.push(encodeByte(arr[i]));
}
return str.join('');
}
function encodeState(state) {
var s = [];
for (var c = 0; c < 4; c++) {
for (var r = 0; r < 4; r++) {
s.push(encodeByte(state[r][c]));
}
}
return s.join('');
}
function encodeKey(key, round) {
var s = [];
for (var r = round * 4; r < (round * 4 + 4); r++) {
for (var c = 0; c < 4; c++) {
s.push(encodeByte(key[r][c]));
}
}
return s.join('');
}
function encodeByte(val) {
val = Number(val).toString(16);
if (val.length == 1) {
val = '0' + val;
}
return val;
}
var v128 = [];
(function v128_init() {
for (var i = 0; i <= 10; i++) v128[i] = {};
v128.name = '128';
v128[0].input = '00112233445566778899aabbccddeeff';
v128[0].k_sch = '000102030405060708090a0b0c0d0e0f';
v128[1].start = '00102030405060708090a0b0c0d0e0f0';
v128[1].s_box = '63cab7040953d051cd60e0e7ba70e18c';
v128[1].s_row = '6353e08c0960e104cd70b751bacad0e7';
v128[1].m_col = '5f72641557f5bc92f7be3b291db9f91a';
v128[1].k_sch = 'd6aa74fdd2af72fadaa678f1d6ab76fe';
v128[2].start = '89d810e8855ace682d1843d8cb128fe4';
v128[2].s_box = 'a761ca9b97be8b45d8ad1a611fc97369';
v128[2].s_row = 'a7be1a6997ad739bd8c9ca451f618b61';
v128[2].m_col = 'ff87968431d86a51645151fa773ad009';
v128[2].k_sch = 'b692cf0b643dbdf1be9bc5006830b3fe';
v128[3].start = '4915598f55e5d7a0daca94fa1f0a63f7';
v128[3].s_box = '3b59cb73fcd90ee05774222dc067fb68';
v128[3].s_row = '3bd92268fc74fb735767cbe0c0590e2d';
v128[3].m_col = '4c9c1e66f771f0762c3f868e534df256';
v128[3].k_sch = 'b6ff744ed2c2c9bf6c590cbf0469bf41';
v128[4].start = 'fa636a2825b339c940668a3157244d17';
v128[4].s_box = '2dfb02343f6d12dd09337ec75b36e3f0';
v128[4].s_row = '2d6d7ef03f33e334093602dd5bfb12c7';
v128[4].m_col = '6385b79ffc538df997be478e7547d691';
v128[4].k_sch = '47f7f7bc95353e03f96c32bcfd058dfd';
v128[5].start = '247240236966b3fa6ed2753288425b6c';
v128[5].s_box = '36400926f9336d2d9fb59d23c42c3950';
v128[5].s_row = '36339d50f9b539269f2c092dc4406d23';
v128[5].m_col = 'f4bcd45432e554d075f1d6c51dd03b3c';
v128[5].k_sch = '3caaa3e8a99f9deb50f3af57adf622aa';
v128[6].start = 'c81677bc9b7ac93b25027992b0261996';
v128[6].s_box = 'e847f56514dadde23f77b64fe7f7d490';
v128[6].s_row = 'e8dab6901477d4653ff7f5e2e747dd4f';
v128[6].m_col = '9816ee7400f87f556b2c049c8e5ad036';
v128[6].k_sch = '5e390f7df7a69296a7553dc10aa31f6b';
v128[7].start = 'c62fe109f75eedc3cc79395d84f9cf5d';
v128[7].s_box = 'b415f8016858552e4bb6124c5f998a4c';
v128[7].s_row = 'b458124c68b68a014b99f82e5f15554c';
v128[7].m_col = 'c57e1c159a9bd286f05f4be098c63439';
v128[7].k_sch = '14f9701ae35fe28c440adf4d4ea9c026';
v128[8].start = 'd1876c0f79c4300ab45594add66ff41f';
v128[8].s_box = '3e175076b61c04678dfc2295f6a8bfc0';
v128[8].s_row = '3e1c22c0b6fcbf768da85067f6170495';
v128[8].m_col = 'baa03de7a1f9b56ed5512cba5f414d23';
v128[8].k_sch = '47438735a41c65b9e016baf4aebf7ad2';
v128[9].start = 'fde3bad205e5d0d73547964ef1fe37f1';
v128[9].s_box = '5411f4b56bd9700e96a0902fa1bb9aa1';
v128[9].s_row = '54d990a16ba09ab596bbf40ea111702f';
v128[9].m_col = 'e9f74eec023020f61bf2ccf2353c21c7';
v128[9].k_sch = '549932d1f08557681093ed9cbe2c974e';
v128[10].start = 'bd6e7c3df2b5779e0b61216e8b10b689';
v128[10].s_box = '7a9f102789d5f50b2beffd9f3dca4ea7';
v128[10].s_row = '7ad5fda789ef4e272bca100b3d9ff59f';
v128[10].k_sch = '13111d7fe3944a17f307a78b4d2b30c5';
v128[10].output = '69c4e0d86a7b0430d8cdb78070b4c55a';
})();
var v128d = [];
(function v128d_init() {
for (var i = 0; i <= 10; i++) v128d[i] = {};
v128d.name = '128d';
v128d[0].input = '69c4e0d86a7b0430d8cdb78070b4c55a';
v128d[0].k_sch = '13111d7fe3944a17f307a78b4d2b30c5';
v128d[1].start = '7ad5fda789ef4e272bca100b3d9ff59f';
v128d[1].s_row = '7a9f102789d5f50b2beffd9f3dca4ea7';
v128d[1].s_box = 'bd6e7c3df2b5779e0b61216e8b10b689';
v128d[1].k_sch = '549932d1f08557681093ed9cbe2c974e';
v128d[1].k_add = 'e9f74eec023020f61bf2ccf2353c21c7';
v128d[2].start = '54d990a16ba09ab596bbf40ea111702f';
v128d[2].s_row = '5411f4b56bd9700e96a0902fa1bb9aa1';
v128d[2].s_box = 'fde3bad205e5d0d73547964ef1fe37f1';
v128d[2].k_sch = '47438735a41c65b9e016baf4aebf7ad2';
v128d[2].k_add = 'baa03de7a1f9b56ed5512cba5f414d23';
v128d[3].start = '3e1c22c0b6fcbf768da85067f6170495';
v128d[3].s_row = '3e175076b61c04678dfc2295f6a8bfc0';
v128d[3].s_box = 'd1876c0f79c4300ab45594add66ff41f';
v128d[3].k_sch = '14f9701ae35fe28c440adf4d4ea9c026';
v128d[3].k_add = 'c57e1c159a9bd286f05f4be098c63439';
v128d[4].start = 'b458124c68b68a014b99f82e5f15554c';
v128d[4].s_row = 'b415f8016858552e4bb6124c5f998a4c';
v128d[4].s_box = 'c62fe109f75eedc3cc79395d84f9cf5d';
v128d[4].k_sch = '5e390f7df7a69296a7553dc10aa31f6b';
v128d[4].k_add = '9816ee7400f87f556b2c049c8e5ad036';
v128d[5].start = 'e8dab6901477d4653ff7f5e2e747dd4f';
v128d[5].s_row = 'e847f56514dadde23f77b64fe7f7d490';
v128d[5].s_box = 'c81677bc9b7ac93b25027992b0261996';
v128d[5].k_sch = '3caaa3e8a99f9deb50f3af57adf622aa';
v128d[5].k_add = 'f4bcd45432e554d075f1d6c51dd03b3c';
v128d[6].start = '36339d50f9b539269f2c092dc4406d23';
v128d[6].s_row = '36400926f9336d2d9fb59d23c42c3950';
v128d[6].s_box = '247240236966b3fa6ed2753288425b6c';
v128d[6].k_sch = '47f7f7bc95353e03f96c32bcfd058dfd';
v128d[6].k_add = '6385b79ffc538df997be478e7547d691';
v128d[7].start = '2d6d7ef03f33e334093602dd5bfb12c7';
v128d[7].s_row = '2dfb02343f6d12dd09337ec75b36e3f0';
v128d[7].s_box = 'fa636a2825b339c940668a3157244d17';
v128d[7].k_sch = 'b6ff744ed2c2c9bf6c590cbf0469bf41';
v128d[7].k_add = '4c9c1e66f771f0762c3f868e534df256';
v128d[8].start = '3bd92268fc74fb735767cbe0c0590e2d';
v128d[8].s_row = '3b59cb73fcd90ee05774222dc067fb68';
v128d[8].s_box = '4915598f55e5d7a0daca94fa1f0a63f7';
v128d[8].k_sch = 'b692cf0b643dbdf1be9bc5006830b3fe';
v128d[8].k_add = 'ff87968431d86a51645151fa773ad009';
v128d[9].start = 'a7be1a6997ad739bd8c9ca451f618b61';
v128d[9].s_row = 'a761ca9b97be8b45d8ad1a611fc97369';
v128d[9].s_box = '89d810e8855ace682d1843d8cb128fe4';
v128d[9].k_sch = 'd6aa74fdd2af72fadaa678f1d6ab76fe';
v128d[9].k_add = '5f72641557f5bc92f7be3b291db9f91a';
v128d[10].start = '6353e08c0960e104cd70b751bacad0e7';
v128d[10].s_row = '63cab7040953d051cd60e0e7ba70e18c';
v128d[10].s_box = '00102030405060708090a0b0c0d0e0f0';
v128d[10].k_sch = '000102030405060708090a0b0c0d0e0f';
v128d[10].output = '00112233445566778899aabbccddeeff';
})();
var v192 = [];
(function v192_init() {
for (var i = 0; i <= 12; i++) v192[i] = {};
v192.name = '192';
v192[0].input = '00112233445566778899aabbccddeeff';
v192[0].k_sch = '000102030405060708090a0b0c0d0e0f';
v192[1].start = '00102030405060708090a0b0c0d0e0f0';
v192[1].s_box = '63cab7040953d051cd60e0e7ba70e18c';
v192[1].s_row = '6353e08c0960e104cd70b751bacad0e7';
v192[1].m_col = '5f72641557f5bc92f7be3b291db9f91a';
v192[1].k_sch = '10111213141516175846f2f95c43f4fe';
v192[2].start = '4f63760643e0aa85aff8c9d041fa0de4';
v192[2].s_box = '84fb386f1ae1ac977941dd70832dd769';
v192[2].s_row = '84e1dd691a41d76f792d389783fbac70';
v192[2].m_col = '9f487f794f955f662afc86abd7f1ab29';
v192[2].k_sch = '544afef55847f0fa4856e2e95c43f4fe';
v192[3].start = 'cb02818c17d2af9c62aa64428bb25fd7';
v192[3].s_box = '1f770c64f0b579deaaac432c3d37cf0e';
v192[3].s_row = '1fb5430ef0accf64aa370cde3d77792c';
v192[3].m_col = 'b7a53ecbbf9d75a0c40efc79b674cc11';
v192[3].k_sch = '40f949b31cbabd4d48f043b810b7b342';
v192[4].start = 'f75c7778a327c8ed8cfebfc1a6c37f53';
v192[4].s_box = '684af5bc0acce85564bb0878242ed2ed';
v192[4].s_row = '68cc08ed0abbd2bc642ef555244ae878';
v192[4].m_col = '7a1e98bdacb6d1141a6944dd06eb2d3e';
v192[4].k_sch = '58e151ab04a2a5557effb5416245080c';
v192[5].start = '22ffc916a81474416496f19c64ae2532';
v192[5].s_box = '9316dd47c2fa92834390a1de43e43f23';
v192[5].s_row = '93faa123c2903f4743e4dd83431692de';
v192[5].m_col = 'aaa755b34cffe57cef6f98e1f01c13e6';
v192[5].k_sch = '2ab54bb43a02f8f662e3a95d66410c08';
v192[6].start = '80121e0776fd1d8a8d8c31bc965d1fee';
v192[6].s_box = 'cdc972c53854a47e5d64c765904cc028';
v192[6].s_row = 'cd54c7283864c0c55d4c727e90c9a465';
v192[6].m_col = '921f748fd96e937d622d7725ba8ba50c';
v192[6].k_sch = 'f501857297448d7ebdf1c6ca87f33e3c';
v192[7].start = '671ef1fd4e2a1e03dfdcb1ef3d789b30';
v192[7].s_box = '8572a1542fe5727b9e86c8df27bc1404';
v192[7].s_row = '85e5c8042f8614549ebca17b277272df';
v192[7].m_col = 'e913e7b18f507d4b227ef652758acbcc';
v192[7].k_sch = 'e510976183519b6934157c9ea351f1e0';
v192[8].start = '0c0370d00c01e622166b8accd6db3a2c';
v192[8].s_box = 'fe7b5170fe7c8e93477f7e4bf6b98071';
v192[8].s_row = 'fe7c7e71fe7f807047b95193f67b8e4b';
v192[8].m_col = '6cf5edf996eb0a069c4ef21cbfc25762';
v192[8].k_sch = '1ea0372a995309167c439e77ff12051e';
v192[9].start = '7255dad30fb80310e00d6c6b40d0527c';
v192[9].s_box = '40fc5766766c7bcae1d7507f09700010';
v192[9].s_row = '406c501076d70066e17057ca09fc7b7f';
v192[9].m_col = '7478bcdce8a50b81d4327a9009188262';
v192[9].k_sch = 'dd7e0e887e2fff68608fc842f9dcc154';
v192[10].start = 'a906b254968af4e9b4bdb2d2f0c44336';
v192[10].s_box = 'd36f3720907ebf1e8d7a37b58c1c1a05';
v192[10].s_row = 'd37e3705907a1a208d1c371e8c6fbfb5';
v192[10].m_col = '0d73cc2d8f6abe8b0cf2dd9bb83d422e';
v192[10].k_sch = '859f5f237a8d5a3dc0c02952beefd63a';
v192[11].start = '88ec930ef5e7e4b6cc32f4c906d29414';
v192[11].s_box = 'c4cedcabe694694e4b23bfdd6fb522fa';
v192[11].s_row = 'c494bffae62322ab4bb5dc4e6fce69dd';
v192[11].m_col = '71d720933b6d677dc00b8f28238e0fb7';
v192[11].k_sch = 'de601e7827bcdf2ca223800fd8aeda32';
v192[12].start = 'afb73eeb1cd1b85162280f27fb20d585';
v192[12].s_box = '79a9b2e99c3e6cd1aa3476cc0fb70397';
v192[12].s_row = '793e76979c3403e9aab7b2d10fa96ccc';
v192[12].k_sch = 'a4970a331a78dc09c418c271e3a41d5d';
v192[12].output = 'dda97ca4864cdfe06eaf70a0ec0d7191';
})();
var v192d = [];
(function v192d_init() {
for (var i = 0; i <= 12; i++) v192d[i] = {};
v192d.name = '192d';
v192d[0].input = 'dda97ca4864cdfe06eaf70a0ec0d7191';
v192d[0].k_sch = 'a4970a331a78dc09c418c271e3a41d5d';
v192d[1].start = '793e76979c3403e9aab7b2d10fa96ccc';
v192d[1].s_row = '79a9b2e99c3e6cd1aa3476cc0fb70397';
v192d[1].s_box = 'afb73eeb1cd1b85162280f27fb20d585';
v192d[1].k_sch = 'de601e7827bcdf2ca223800fd8aeda32';
v192d[1].k_add = '71d720933b6d677dc00b8f28238e0fb7';
v192d[2].start = 'c494bffae62322ab4bb5dc4e6fce69dd';
v192d[2].s_row = 'c4cedcabe694694e4b23bfdd6fb522fa';
v192d[2].s_box = '88ec930ef5e7e4b6cc32f4c906d29414';
v192d[2].k_sch = '859f5f237a8d5a3dc0c02952beefd63a';
v192d[2].k_add = '0d73cc2d8f6abe8b0cf2dd9bb83d422e';
v192d[3].start = 'd37e3705907a1a208d1c371e8c6fbfb5';
v192d[3].s_row = 'd36f3720907ebf1e8d7a37b58c1c1a05';
v192d[3].s_box = 'a906b254968af4e9b4bdb2d2f0c44336';
v192d[3].k_sch = 'dd7e0e887e2fff68608fc842f9dcc154';
v192d[3].k_add = '7478bcdce8a50b81d4327a9009188262';
v192d[4].start = '406c501076d70066e17057ca09fc7b7f';
v192d[4].s_row = '40fc5766766c7bcae1d7507f09700010';
v192d[4].s_box = '7255dad30fb80310e00d6c6b40d0527c';
v192d[4].k_sch = '1ea0372a995309167c439e77ff12051e';
v192d[4].k_add = '6cf5edf996eb0a069c4ef21cbfc25762';
v192d[5].start = 'fe7c7e71fe7f807047b95193f67b8e4b';
v192d[5].s_row = 'fe7b5170fe7c8e93477f7e4bf6b98071';
v192d[5].s_box = '0c0370d00c01e622166b8accd6db3a2c';
v192d[5].k_sch = 'e510976183519b6934157c9ea351f1e0';
v192d[5].k_add = 'e913e7b18f507d4b227ef652758acbcc';
v192d[6].start = '85e5c8042f8614549ebca17b277272df';
v192d[6].s_row = '8572a1542fe5727b9e86c8df27bc1404';
v192d[6].s_box = '671ef1fd4e2a1e03dfdcb1ef3d789b30';
v192d[6].k_sch = 'f501857297448d7ebdf1c6ca87f33e3c';
v192d[6].k_add = '921f748fd96e937d622d7725ba8ba50c';
v192d[7].start = 'cd54c7283864c0c55d4c727e90c9a465';
v192d[7].s_row = 'cdc972c53854a47e5d64c765904cc028';
v192d[7].s_box = '80121e0776fd1d8a8d8c31bc965d1fee';
v192d[7].k_sch = '2ab54bb43a02f8f662e3a95d66410c08';
v192d[7].k_add = 'aaa755b34cffe57cef6f98e1f01c13e6';
v192d[8].start = '93faa123c2903f4743e4dd83431692de';
v192d[8].s_row = '9316dd47c2fa92834390a1de43e43f23';
v192d[8].s_box = '22ffc916a81474416496f19c64ae2532';
v192d[8].k_sch = '58e151ab04a2a5557effb5416245080c';
v192d[8].k_add = '7a1e98bdacb6d1141a6944dd06eb2d3e';
v192d[9].start = '68cc08ed0abbd2bc642ef555244ae878';
v192d[9].s_row = '684af5bc0acce85564bb0878242ed2ed';
v192d[9].s_box = 'f75c7778a327c8ed8cfebfc1a6c37f53';
v192d[9].k_sch = '40f949b31cbabd4d48f043b810b7b342';
v192d[9].k_add = 'b7a53ecbbf9d75a0c40efc79b674cc11';
v192d[10].start = '1fb5430ef0accf64aa370cde3d77792c';
v192d[10].s_row = '1f770c64f0b579deaaac432c3d37cf0e';
v192d[10].s_box = 'cb02818c17d2af9c62aa64428bb25fd7';
v192d[10].k_sch = '544afef55847f0fa4856e2e95c43f4fe';
v192d[10].k_add = '9f487f794f955f662afc86abd7f1ab29';
v192d[11].start = '84e1dd691a41d76f792d389783fbac70';
v192d[11].s_row = '84fb386f1ae1ac977941dd70832dd769';
v192d[11].s_box = '4f63760643e0aa85aff8c9d041fa0de4';
v192d[11].k_sch = '10111213141516175846f2f95c43f4fe';
v192d[11].k_add = '5f72641557f5bc92f7be3b291db9f91a';
v192d[12].start = '6353e08c0960e104cd70b751bacad0e7';
v192d[12].s_row = '63cab7040953d051cd60e0e7ba70e18c';
v192d[12].s_box = '00102030405060708090a0b0c0d0e0f0';
v192d[12].k_sch = '000102030405060708090a0b0c0d0e0f';
v192d[12].output = '00112233445566778899aabbccddeeff';
})();
var v256 = [];
(function v256_init() {
for (var i = 0; i <= 14; i++) v256[i] = {};
v256.name = '256';
v256[0].input = '00112233445566778899aabbccddeeff';
v256[0].k_sch = '000102030405060708090a0b0c0d0e0f';
v256[1].start = '00102030405060708090a0b0c0d0e0f0';
v256[1].s_box = '63cab7040953d051cd60e0e7ba70e18c';
v256[1].s_row = '6353e08c0960e104cd70b751bacad0e7';
v256[1].m_col = '5f72641557f5bc92f7be3b291db9f91a';
v256[1].k_sch = '101112131415161718191a1b1c1d1e1f';
v256[2].start = '4f63760643e0aa85efa7213201a4e705';
v256[2].s_box = '84fb386f1ae1ac97df5cfd237c49946b';
v256[2].s_row = '84e1fd6b1a5c946fdf4938977cfbac23';
v256[2].m_col = 'bd2a395d2b6ac438d192443e615da195';
v256[2].k_sch = 'a573c29fa176c498a97fce93a572c09c';
v256[3].start = '1859fbc28a1c00a078ed8aadc42f6109';
v256[3].s_box = 'adcb0f257e9c63e0bc557e951c15ef01';
v256[3].s_row = 'ad9c7e017e55ef25bc150fe01ccb6395';
v256[3].m_col = '810dce0cc9db8172b3678c1e88a1b5bd';
v256[3].k_sch = '1651a8cd0244beda1a5da4c10640bade';
v256[4].start = '975c66c1cb9f3fa8a93a28df8ee10f63';
v256[4].s_box = '884a33781fdb75c2d380349e19f876fb';
v256[4].s_row = '88db34fb1f807678d3f833c2194a759e';
v256[4].m_col = 'b2822d81abe6fb275faf103a078c0033';
v256[4].k_sch = 'ae87dff00ff11b68a68ed5fb03fc1567';
v256[5].start = '1c05f271a417e04ff921c5c104701554';
v256[5].s_box = '9c6b89a349f0e18499fda678f2515920';
v256[5].s_row = '9cf0a62049fd59a399518984f26be178';
v256[5].m_col = 'aeb65ba974e0f822d73f567bdb64c877';
v256[5].k_sch = '6de1f1486fa54f9275f8eb5373b8518d';
v256[6].start = 'c357aae11b45b7b0a2c7bd28a8dc99fa';
v256[6].s_box = '2e5bacf8af6ea9e73ac67a34c286ee2d';
v256[6].s_row = '2e6e7a2dafc6eef83a86ace7c25ba934';
v256[6].m_col = 'b951c33c02e9bd29ae25cdb1efa08cc7';
v256[6].k_sch = 'c656827fc9a799176f294cec6cd5598b';
v256[7].start = '7f074143cb4e243ec10c815d8375d54c';
v256[7].s_box = 'd2c5831a1f2f36b278fe0c4cec9d0329';
v256[7].s_row = 'd22f0c291ffe031a789d83b2ecc5364c';
v256[7].m_col = 'ebb19e1c3ee7c9e87d7535e9ed6b9144';
v256[7].k_sch = '3de23a75524775e727bf9eb45407cf39';
v256[8].start = 'd653a4696ca0bc0f5acaab5db96c5e7d';
v256[8].s_box = 'f6ed49f950e06576be74624c565058ff';
v256[8].s_row = 'f6e062ff507458f9be50497656ed654c';
v256[8].m_col = '5174c8669da98435a8b3e62ca974a5ea';
v256[8].k_sch = '0bdc905fc27b0948ad5245a4c1871c2f';
v256[9].start = '5aa858395fd28d7d05e1a38868f3b9c5';
v256[9].s_box = 'bec26a12cfb55dff6bf80ac4450d56a6';
v256[9].s_row = 'beb50aa6cff856126b0d6aff45c25dc4';
v256[9].m_col = '0f77ee31d2ccadc05430a83f4ef96ac3';
v256[9].k_sch = '45f5a66017b2d387300d4d33640a820a';
v256[10].start = '4a824851c57e7e47643de50c2af3e8c9';
v256[10].s_box = 'd61352d1a6f3f3a04327d9fee50d9bdd';
v256[10].s_row = 'd6f3d9dda6279bd1430d52a0e513f3fe';
v256[10].m_col = 'bd86f0ea748fc4f4630f11c1e9331233';
v256[10].k_sch = '7ccff71cbeb4fe5413e6bbf0d261a7df';
v256[11].start = 'c14907f6ca3b3aa070e9aa313b52b5ec';
v256[11].s_box = '783bc54274e280e0511eacc7e200d5ce';
v256[11].s_row = '78e2acce741ed5425100c5e0e23b80c7';
v256[11].m_col = 'af8690415d6e1dd387e5fbedd5c89013';
v256[11].k_sch = 'f01afafee7a82979d7a5644ab3afe640';
v256[12].start = '5f9c6abfbac634aa50409fa766677653';
v256[12].s_box = 'cfde0208f4b418ac5309db5c338538ed';
v256[12].s_row = 'cfb4dbedf4093808538502ac33de185c';
v256[12].m_col = '7427fae4d8a695269ce83d315be0392b';
v256[12].k_sch = '2541fe719bf500258813bbd55a721c0a';
v256[13].start = '516604954353950314fb86e401922521';
v256[13].s_box = 'd133f22a1aed2a7bfa0f44697c4f3ffd';
v256[13].s_row = 'd1ed44fd1a0f3f2afa4ff27b7c332a69';
v256[13].m_col = '2c21a820306f154ab712c75eee0da04f';
v256[13].k_sch = '4e5a6699a9f24fe07e572baacdf8cdea';
v256[14].start = '627bceb9999d5aaac945ecf423f56da5';
v256[14].s_box = 'aa218b56ee5ebeacdd6ecebf26e63c06';
v256[14].s_row = 'aa5ece06ee6e3c56dde68bac2621bebf';
v256[14].k_sch = '24fc79ccbf0979e9371ac23c6d68de36';
v256[14].output = '8ea2b7ca516745bfeafc49904b496089';
})();
var v256d = [];
(function v256d_init() {
for (var i = 0; i <= 14; i++) v256d[i] = {};
v256d.name = '256d';
v256d[0].input = '8ea2b7ca516745bfeafc49904b496089';
v256d[0].k_sch = '24fc79ccbf0979e9371ac23c6d68de36';
v256d[1].start = 'aa5ece06ee6e3c56dde68bac2621bebf';
v256d[1].s_row = 'aa218b56ee5ebeacdd6ecebf26e63c06';
v256d[1].s_box = '627bceb9999d5aaac945ecf423f56da5';
v256d[1].k_sch = '4e5a6699a9f24fe07e572baacdf8cdea';
v256d[1].k_add = '2c21a820306f154ab712c75eee0da04f';
v256d[2].start = 'd1ed44fd1a0f3f2afa4ff27b7c332a69';
v256d[2].s_row = 'd133f22a1aed2a7bfa0f44697c4f3ffd';
v256d[2].s_box = '516604954353950314fb86e401922521';
v256d[2].k_sch = '2541fe719bf500258813bbd55a721c0a';
v256d[2].k_add = '7427fae4d8a695269ce83d315be0392b';
v256d[3].start = 'cfb4dbedf4093808538502ac33de185c';
v256d[3].s_row = 'cfde0208f4b418ac5309db5c338538ed';
v256d[3].s_box = '5f9c6abfbac634aa50409fa766677653';
v256d[3].k_sch = 'f01afafee7a82979d7a5644ab3afe640';
v256d[3].k_add = 'af8690415d6e1dd387e5fbedd5c89013';
v256d[4].start = '78e2acce741ed5425100c5e0e23b80c7';
v256d[4].s_row = '783bc54274e280e0511eacc7e200d5ce';
v256d[4].s_box = 'c14907f6ca3b3aa070e9aa313b52b5ec';
v256d[4].k_sch = '7ccff71cbeb4fe5413e6bbf0d261a7df';
v256d[4].k_add = 'bd86f0ea748fc4f4630f11c1e9331233';
v256d[5].start = 'd6f3d9dda6279bd1430d52a0e513f3fe';
v256d[5].s_row = 'd61352d1a6f3f3a04327d9fee50d9bdd';
v256d[5].s_box = '4a824851c57e7e47643de50c2af3e8c9';
v256d[5].k_sch = '45f5a66017b2d387300d4d33640a820a';
v256d[5].k_add = '0f77ee31d2ccadc05430a83f4ef96ac3';
v256d[6].start = 'beb50aa6cff856126b0d6aff45c25dc4';
v256d[6].s_row = 'bec26a12cfb55dff6bf80ac4450d56a6';
v256d[6].s_box = '5aa858395fd28d7d05e1a38868f3b9c5';
v256d[6].k_sch = '0bdc905fc27b0948ad5245a4c1871c2f';
v256d[6].k_add = '5174c8669da98435a8b3e62ca974a5ea';
v256d[7].start = 'f6e062ff507458f9be50497656ed654c';
v256d[7].s_row = 'f6ed49f950e06576be74624c565058ff';
v256d[7].s_box = 'd653a4696ca0bc0f5acaab5db96c5e7d';
v256d[7].k_sch = '3de23a75524775e727bf9eb45407cf39';
v256d[7].k_add = 'ebb19e1c3ee7c9e87d7535e9ed6b9144';
v256d[8].start = 'd22f0c291ffe031a789d83b2ecc5364c';
v256d[8].s_row = 'd2c5831a1f2f36b278fe0c4cec9d0329';
v256d[8].s_box = '7f074143cb4e243ec10c815d8375d54c';
v256d[8].k_sch = 'c656827fc9a799176f294cec6cd5598b';
v256d[8].k_add = 'b951c33c02e9bd29ae25cdb1efa08cc7';
v256d[9].start = '2e6e7a2dafc6eef83a86ace7c25ba934';
v256d[9].s_row = '2e5bacf8af6ea9e73ac67a34c286ee2d';
v256d[9].s_box = 'c357aae11b45b7b0a2c7bd28a8dc99fa';
v256d[9].k_sch = '6de1f1486fa54f9275f8eb5373b8518d';
v256d[9].k_add = 'aeb65ba974e0f822d73f567bdb64c877';
v256d[10].start = '9cf0a62049fd59a399518984f26be178';
v256d[10].s_row = '9c6b89a349f0e18499fda678f2515920';
v256d[10].s_box = '1c05f271a417e04ff921c5c104701554';
v256d[10].k_sch = 'ae87dff00ff11b68a68ed5fb03fc1567';
v256d[10].k_add = 'b2822d81abe6fb275faf103a078c0033';
v256d[11].start = '88db34fb1f807678d3f833c2194a759e';
v256d[11].s_row = '884a33781fdb75c2d380349e19f876fb';
v256d[11].s_box = '975c66c1cb9f3fa8a93a28df8ee10f63';
v256d[11].k_sch = '1651a8cd0244beda1a5da4c10640bade';
v256d[11].k_add = '810dce0cc9db8172b3678c1e88a1b5bd';
v256d[12].start = 'ad9c7e017e55ef25bc150fe01ccb6395';
v256d[12].s_row = 'adcb0f257e9c63e0bc557e951c15ef01';
v256d[12].s_box = '1859fbc28a1c00a078ed8aadc42f6109';
v256d[12].k_sch = 'a573c29fa176c498a97fce93a572c09c';
v256d[12].k_add = 'bd2a395d2b6ac438d192443e615da195';
v256d[13].start = '84e1fd6b1a5c946fdf4938977cfbac23';
v256d[13].s_row = '84fb386f1ae1ac97df5cfd237c49946b';
v256d[13].s_box = '4f63760643e0aa85efa7213201a4e705';
v256d[13].k_sch = '101112131415161718191a1b1c1d1e1f';
v256d[13].k_add = '5f72641557f5bc92f7be3b291db9f91a';
v256d[14].start = '6353e08c0960e104cd70b751bacad0e7';
v256d[14].s_row = '63cab7040953d051cd60e0e7ba70e18c';
v256d[14].s_box = '00102030405060708090a0b0c0d0e0f0';
v256d[14].k_sch = '000102030405060708090a0b0c0d0e0f';
v256d[14].output = '00112233445566778899aabbccddeeff';
})();

View File

@@ -0,0 +1,164 @@
// Copyright 2005 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview ARC4 streamcipher implementation. A description of the
* algorithm can be found at:
* http://www.mozilla.org/projects/security/pki/nss/draft-kaukonen-cipher-arcfour-03.txt.
*
* Usage:
* <code>
* var arc4 = new goog.crypt.Arc4();
* arc4.setKey(key);
* arc4.discard(1536);
* arc4.crypt(bytes);
* </code>
*
* Note: For converting between strings and byte arrays, goog.crypt.base64 may
* be useful.
*
*/
goog.provide('goog.crypt.Arc4');
goog.require('goog.asserts');
/**
* ARC4 streamcipher implementation.
* @constructor
* @final
* @struct
*/
goog.crypt.Arc4 = function() {
/**
* A permutation of all 256 possible bytes.
* @type {Array<number>}
* @private
*/
this.state_ = [];
/**
* 8 bit index pointer into this.state_.
* @type {number}
* @private
*/
this.index1_ = 0;
/**
* 8 bit index pointer into this.state_.
* @type {number}
* @private
*/
this.index2_ = 0;
};
/**
* Initialize the cipher for use with new key.
* @param {Array<number>} key A byte array containing the key.
* @param {number=} opt_length Indicates # of bytes to take from the key.
*/
goog.crypt.Arc4.prototype.setKey = function(key, opt_length) {
goog.asserts.assertArray(key, 'Key parameter must be a byte array');
if (!opt_length) {
opt_length = key.length;
}
var state = this.state_;
for (var i = 0; i < 256; ++i) {
state[i] = i;
}
var j = 0;
for (var i = 0; i < 256; ++i) {
j = (j + state[i] + key[i % opt_length]) & 255;
var tmp = state[i];
state[i] = state[j];
state[j] = tmp;
}
this.index1_ = 0;
this.index2_ = 0;
};
/**
* Discards n bytes of the keystream.
* These days 1536 is considered a decent amount to drop to get the key state
* warmed-up enough for secure usage. This is not done in the constructor to
* preserve efficiency for use cases that do not need this.
* NOTE: Discard is identical to crypt without actually xoring any data. It's
* unfortunate to have this code duplicated, but this was done for performance
* reasons. Alternatives which were attempted:
* 1. Create a temp array of the correct length and pass it to crypt. This
* works but needlessly allocates an array. But more importantly this
* requires choosing an array type (Array or Uint8Array) in discard, and
* choosing a different type than will be passed to crypt by the client
* code hurts the javascript engines ability to optimize crypt (7x hit in
* v8).
* 2. Make data option in crypt so discard can pass null, this has a huge
* perf hit for crypt.
* @param {number} length Number of bytes to disregard from the stream.
*/
goog.crypt.Arc4.prototype.discard = function(length) {
var i = this.index1_;
var j = this.index2_;
var state = this.state_;
for (var n = 0; n < length; ++n) {
i = (i + 1) & 255;
j = (j + state[i]) & 255;
var tmp = state[i];
state[i] = state[j];
state[j] = tmp;
}
this.index1_ = i;
this.index2_ = j;
};
/**
* En- or decrypt (same operation for streamciphers like ARC4)
* @param {Array<number>|Uint8Array} data The data to be xor-ed in place.
* @param {number=} opt_length The number of bytes to crypt.
*/
goog.crypt.Arc4.prototype.crypt = function(data, opt_length) {
if (!opt_length) {
opt_length = data.length;
}
var i = this.index1_;
var j = this.index2_;
var state = this.state_;
for (var n = 0; n < opt_length; ++n) {
i = (i + 1) & 255;
j = (j + state[i]) & 255;
var tmp = state[i];
state[i] = state[j];
state[j] = tmp;
data[n] ^= state[(state[i] + state[j]) & 255];
}
this.index1_ = i;
this.index2_ = j;
};

View File

@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2010 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
Closure Unit Tests - goog.crypt.arc4
</title>
<script src="../base.js">
</script>
<script>
goog.require('goog.crypt.Arc4Test');
</script>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,59 @@
// Copyright 2010 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
goog.provide('goog.crypt.Arc4Test');
goog.setTestOnly('goog.crypt.Arc4Test');
goog.require('goog.array');
goog.require('goog.crypt.Arc4');
goog.require('goog.testing.jsunit');
function testEncryptionDecryption() {
var key = [0x25, 0x26, 0x27, 0x28];
var startArray = [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67];
var byteArray = [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67];
var arc4 = new goog.crypt.Arc4();
arc4.setKey(key);
arc4.crypt(byteArray);
assertArrayEquals(byteArray, [0x51, 0xBB, 0xDD, 0x95, 0x9B, 0x42, 0x34]);
// The same key and crypt call should unencrypt the data back to its original
// state
arc4 = new goog.crypt.Arc4();
arc4.setKey(key);
arc4.crypt(byteArray);
assertArrayEquals(byteArray, startArray);
}
function testDiscard() {
var key = [0x25, 0x26, 0x27, 0x28];
var data = [0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67];
var arc4 = new goog.crypt.Arc4();
arc4.setKey(key);
arc4.discard(256);
var withDiscard = goog.array.clone(data);
arc4.crypt(withDiscard);
// First encrypting a dummy array should give the same result as
// discarding.
arc4 = new goog.crypt.Arc4();
arc4.setKey(key);
var withCrypt = goog.array.clone(data);
arc4.crypt(new Array(256));
arc4.crypt(withCrypt);
assertArrayEquals(withDiscard, withCrypt);
}

View File

@@ -0,0 +1,286 @@
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Base64 en/decoding. Not much to say here except that we
* work with decoded values in arrays of bytes. By "byte" I mean a number
* in [0, 255].
*
* @author doughtie@google.com (Gavin Doughtie)
*/
goog.provide('goog.crypt.base64');
goog.require('goog.crypt');
goog.require('goog.userAgent');
// Static lookup maps, lazily populated by init_()
/**
* Maps bytes to characters.
* @type {Object}
* @private
*/
goog.crypt.base64.byteToCharMap_ = null;
/**
* Maps characters to bytes.
* @type {Object}
* @private
*/
goog.crypt.base64.charToByteMap_ = null;
/**
* Maps bytes to websafe characters.
* @type {Object}
* @private
*/
goog.crypt.base64.byteToCharMapWebSafe_ = null;
/**
* Maps websafe characters to bytes.
* @type {Object}
* @private
*/
goog.crypt.base64.charToByteMapWebSafe_ = null;
/**
* Our default alphabet, shared between
* ENCODED_VALS and ENCODED_VALS_WEBSAFE
* @type {string}
*/
goog.crypt.base64.ENCODED_VALS_BASE =
'ABCDEFGHIJKLMNOPQRSTUVWXYZ' +
'abcdefghijklmnopqrstuvwxyz' +
'0123456789';
/**
* Our default alphabet. Value 64 (=) is special; it means "nothing."
* @type {string}
*/
goog.crypt.base64.ENCODED_VALS =
goog.crypt.base64.ENCODED_VALS_BASE + '+/=';
/**
* Our websafe alphabet.
* @type {string}
*/
goog.crypt.base64.ENCODED_VALS_WEBSAFE =
goog.crypt.base64.ENCODED_VALS_BASE + '-_.';
/**
* Whether this browser supports the atob and btoa functions. This extension
* started at Mozilla but is now implemented by many browsers. We use the
* ASSUME_* variables to avoid pulling in the full useragent detection library
* but still allowing the standard per-browser compilations.
*
* @type {boolean}
*/
goog.crypt.base64.HAS_NATIVE_SUPPORT = goog.userAgent.GECKO ||
goog.userAgent.WEBKIT ||
goog.userAgent.OPERA ||
typeof(goog.global.atob) == 'function';
/**
* Base64-encode an array of bytes.
*
* @param {Array<number>|Uint8Array} input An array of bytes (numbers with
* value in [0, 255]) to encode.
* @param {boolean=} opt_webSafe Boolean indicating we should use the
* alternative alphabet.
* @return {string} The base64 encoded string.
*/
goog.crypt.base64.encodeByteArray = function(input, opt_webSafe) {
if (!goog.isArrayLike(input)) {
throw Error('encodeByteArray takes an array as a parameter');
}
goog.crypt.base64.init_();
var byteToCharMap = opt_webSafe ?
goog.crypt.base64.byteToCharMapWebSafe_ :
goog.crypt.base64.byteToCharMap_;
var output = [];
for (var i = 0; i < input.length; i += 3) {
var byte1 = input[i];
var haveByte2 = i + 1 < input.length;
var byte2 = haveByte2 ? input[i + 1] : 0;
var haveByte3 = i + 2 < input.length;
var byte3 = haveByte3 ? input[i + 2] : 0;
var outByte1 = byte1 >> 2;
var outByte2 = ((byte1 & 0x03) << 4) | (byte2 >> 4);
var outByte3 = ((byte2 & 0x0F) << 2) | (byte3 >> 6);
var outByte4 = byte3 & 0x3F;
if (!haveByte3) {
outByte4 = 64;
if (!haveByte2) {
outByte3 = 64;
}
}
output.push(byteToCharMap[outByte1],
byteToCharMap[outByte2],
byteToCharMap[outByte3],
byteToCharMap[outByte4]);
}
return output.join('');
};
/**
* Base64-encode a string.
*
* @param {string} input A string to encode.
* @param {boolean=} opt_webSafe If true, we should use the
* alternative alphabet.
* @return {string} The base64 encoded string.
*/
goog.crypt.base64.encodeString = function(input, opt_webSafe) {
// Shortcut for Mozilla browsers that implement
// a native base64 encoder in the form of "btoa/atob"
if (goog.crypt.base64.HAS_NATIVE_SUPPORT && !opt_webSafe) {
return goog.global.btoa(input);
}
return goog.crypt.base64.encodeByteArray(
goog.crypt.stringToByteArray(input), opt_webSafe);
};
/**
* Base64-decode a string.
*
* @param {string} input to decode.
* @param {boolean=} opt_webSafe True if we should use the
* alternative alphabet.
* @return {string} string representing the decoded value.
*/
goog.crypt.base64.decodeString = function(input, opt_webSafe) {
// Shortcut for Mozilla browsers that implement
// a native base64 encoder in the form of "btoa/atob"
if (goog.crypt.base64.HAS_NATIVE_SUPPORT && !opt_webSafe) {
return goog.global.atob(input);
}
return goog.crypt.byteArrayToString(
goog.crypt.base64.decodeStringToByteArray(input, opt_webSafe));
};
/**
* Base64-decode a string.
*
* In base-64 decoding, groups of four characters are converted into three
* bytes. If the encoder did not apply padding, the input length may not
* be a multiple of 4.
*
* In this case, the last group will have fewer than 4 characters, and
* padding will be inferred. If the group has one or two characters, it decodes
* to one byte. If the group has three characters, it decodes to two bytes.
*
* @param {string} input Input to decode.
* @param {boolean=} opt_webSafe True if we should use the web-safe alphabet.
* @return {!Array<number>} bytes representing the decoded value.
*/
goog.crypt.base64.decodeStringToByteArray = function(input, opt_webSafe) {
goog.crypt.base64.init_();
var charToByteMap = opt_webSafe ?
goog.crypt.base64.charToByteMapWebSafe_ :
goog.crypt.base64.charToByteMap_;
var output = [];
for (var i = 0; i < input.length; ) {
var byte1 = charToByteMap[input.charAt(i++)];
var haveByte2 = i < input.length;
var byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0;
++i;
var haveByte3 = i < input.length;
var byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64;
++i;
var haveByte4 = i < input.length;
var byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64;
++i;
if (byte1 == null || byte2 == null ||
byte3 == null || byte4 == null) {
throw Error();
}
var outByte1 = (byte1 << 2) | (byte2 >> 4);
output.push(outByte1);
if (byte3 != 64) {
var outByte2 = ((byte2 << 4) & 0xF0) | (byte3 >> 2);
output.push(outByte2);
if (byte4 != 64) {
var outByte3 = ((byte3 << 6) & 0xC0) | byte4;
output.push(outByte3);
}
}
}
return output;
};
/**
* Lazy static initialization function. Called before
* accessing any of the static map variables.
* @private
*/
goog.crypt.base64.init_ = function() {
if (!goog.crypt.base64.byteToCharMap_) {
goog.crypt.base64.byteToCharMap_ = {};
goog.crypt.base64.charToByteMap_ = {};
goog.crypt.base64.byteToCharMapWebSafe_ = {};
goog.crypt.base64.charToByteMapWebSafe_ = {};
// We want quick mappings back and forth, so we precompute two maps.
for (var i = 0; i < goog.crypt.base64.ENCODED_VALS.length; i++) {
goog.crypt.base64.byteToCharMap_[i] =
goog.crypt.base64.ENCODED_VALS.charAt(i);
goog.crypt.base64.charToByteMap_[goog.crypt.base64.byteToCharMap_[i]] = i;
goog.crypt.base64.byteToCharMapWebSafe_[i] =
goog.crypt.base64.ENCODED_VALS_WEBSAFE.charAt(i);
goog.crypt.base64.charToByteMapWebSafe_[
goog.crypt.base64.byteToCharMapWebSafe_[i]] = i;
// Be forgiving when decoding and correctly decode both encodings.
if (i >= goog.crypt.base64.ENCODED_VALS_BASE.length) {
goog.crypt.base64.charToByteMap_[
goog.crypt.base64.ENCODED_VALS_WEBSAFE.charAt(i)] = i;
goog.crypt.base64.charToByteMapWebSafe_[
goog.crypt.base64.ENCODED_VALS.charAt(i)] = i;
}
}
}
};

View File

@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2007 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
Closure Unit Tests - goog.crypt.base64
</title>
<script src="../base.js">
</script>
<script>
goog.require('goog.crypt.base64Test');
</script>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,156 @@
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
goog.provide('goog.crypt.base64Test');
goog.setTestOnly('goog.crypt.base64Test');
goog.require('goog.crypt');
goog.require('goog.crypt.base64');
goog.require('goog.testing.jsunit');
// Static test data
var tests = [
'', '',
'f', 'Zg==',
'fo', 'Zm8=',
'foo', 'Zm9v',
'foob', 'Zm9vYg==',
'fooba', 'Zm9vYmE=',
'foobar', 'Zm9vYmFy',
// Testing non-ascii characters (1-10 in chinese)
'\xe4\xb8\x80\xe4\xba\x8c\xe4\xb8\x89\xe5\x9b\x9b\xe4\xba\x94\xe5' +
'\x85\xad\xe4\xb8\x83\xe5\x85\xab\xe4\xb9\x9d\xe5\x8d\x81',
'5LiA5LqM5LiJ5Zub5LqU5YWt5LiD5YWr5Lmd5Y2B'];
function testByteArrayEncoding() {
// Let's see if it's sane by feeding it some well-known values. Index i
// has the input and index i+1 has the expected value.
for (var i = 0; i < tests.length; i += 2) {
var enc = goog.crypt.base64.encodeByteArray(
goog.crypt.stringToByteArray(tests[i]));
assertEquals(tests[i + 1], enc);
var dec = goog.crypt.byteArrayToString(
goog.crypt.base64.decodeStringToByteArray(enc));
assertEquals(tests[i], dec);
// Check that websafe decoding accepts non-websafe codes.
dec = goog.crypt.byteArrayToString(
goog.crypt.base64.decodeStringToByteArray(enc, true /* websafe */));
assertEquals(tests[i], dec);
// Re-encode as websafe.
enc = goog.crypt.base64.encodeByteArray(
goog.crypt.stringToByteArray(tests[i], true /* websafe */));
// Check that non-websafe decoding accepts websafe codes.
dec = goog.crypt.byteArrayToString(
goog.crypt.base64.decodeStringToByteArray(enc));
assertEquals(tests[i], dec);
// Check that websafe decoding accepts websafe codes.
dec = goog.crypt.byteArrayToString(
goog.crypt.base64.decodeStringToByteArray(enc, true /* websafe */));
assertEquals(tests[i], dec);
}
}
function testOddLengthByteArrayEncoding() {
var buffer = [0, 0, 0];
var encodedBuffer = goog.crypt.base64.encodeByteArray(buffer);
assertEquals('AAAA', encodedBuffer);
var decodedBuffer = goog.crypt.base64.decodeStringToByteArray(encodedBuffer);
assertEquals(decodedBuffer.length, buffer.length);
for (i = 0; i < buffer.length; i++) {
assertEquals(buffer[i], decodedBuffer[i]);
}
}
// Tests that decoding a string where the length is not a multiple of 4 does
// not produce spurious trailing zeroes. This is a regression test for
// cl/65120705, which fixes a bug that was introduced when support for
// non-padded base64 encoding was added in cl/20209336.
function testOddLengthByteArrayDecoding() {
// The base-64 encoding of the bytes [97, 98, 99, 100], with no padding.
// The padded version would be "YWJjZA==" (length 8), or "YWJjZA.." if
// web-safe.
var encodedBuffer = 'YWJjZA';
var decodedBuffer1 = goog.crypt.base64.decodeStringToByteArray(encodedBuffer);
assertEquals(4, decodedBuffer1.length);
// Note that byteArrayToString ignores any trailing zeroes because
// String.fromCharCode(0) is ''.
assertEquals('abcd', goog.crypt.byteArrayToString(decodedBuffer1));
// Repeat the test in web-safe decoding mode.
var decodedBuffer2 = goog.crypt.base64.decodeStringToByteArray(encodedBuffer,
true /* web-safe */);
assertEquals(4, decodedBuffer2.length);
assertEquals('abcd', goog.crypt.byteArrayToString(decodedBuffer2));
}
function testShortcutPathEncoding() {
// Test the higher-level API (tests the btoa/atob shortcut path)
for (var i = 0; i < tests.length; i += 2) {
var enc = goog.crypt.base64.encodeString(tests[i]);
assertEquals(tests[i + 1], enc);
var dec = goog.crypt.base64.decodeString(enc);
assertEquals(tests[i], dec);
}
}
function testMultipleIterations() {
// Now run it through its paces
var numIterations = 100;
for (var i = 0; i < numIterations; i++) {
var input = [];
for (var j = 0; j < i; j++)
input[j] = j % 256;
var encoded = goog.crypt.base64.encodeByteArray(input);
var decoded = goog.crypt.base64.decodeStringToByteArray(encoded);
assertEquals('Decoded length not equal to input length?',
input.length, decoded.length);
for (var j = 0; j < i; j++)
assertEquals('Values differ at position ' + j, input[j], decoded[j]);
}
}
function testWebSafeEncoding() {
// Test non-websafe / websafe difference
var test = '>>>???>>>???=/+';
var enc = goog.crypt.base64.encodeByteArray(
goog.crypt.stringToByteArray(test));
assertEquals('Non-websafe broken?', 'Pj4+Pz8/Pj4+Pz8/PS8r', enc);
enc = goog.crypt.base64.encodeString(test);
assertEquals('Non-websafe broken?', 'Pj4+Pz8/Pj4+Pz8/PS8r', enc);
enc = goog.crypt.base64.encodeByteArray(
goog.crypt.stringToByteArray(test), true /* websafe */);
assertEquals('Websafe encoding broken', 'Pj4-Pz8_Pj4-Pz8_PS8r', enc);
enc = goog.crypt.base64.encodeString(test, true);
assertEquals('Non-websafe broken?', 'Pj4-Pz8_Pj4-Pz8_PS8r', enc);
var dec = goog.crypt.byteArrayToString(
goog.crypt.base64.decodeStringToByteArray(enc, true /* websafe */));
assertEquals('Websafe decoding broken', test, dec);
dec = goog.crypt.base64.decodeString(enc, true /* websafe */);
assertEquals('Websafe decoding broken', test, dec);
// Test parsing malformed characters
assertThrows('Didn\'t throw on malformed input', function() {
goog.crypt.base64.decodeStringToByteArray('foooooo)oooo', true /*websafe*/);
});
}

View File

@@ -0,0 +1,242 @@
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Numeric base conversion library. Works for arbitrary bases and
* arbitrary length numbers.
*
* For base-64 conversion use base64.js because it is optimized for the specific
* conversion to base-64 while this module is generic. Base-64 is defined here
* mostly for demonstration purpose.
*
* TODO: Make base64 and baseN classes that have common interface. (Perhaps...)
*
*/
goog.provide('goog.crypt.baseN');
/**
* Base-2, i.e. '01'.
* @type {string}
*/
goog.crypt.baseN.BASE_BINARY = '01';
/**
* Base-8, i.e. '01234567'.
* @type {string}
*/
goog.crypt.baseN.BASE_OCTAL = '01234567';
/**
* Base-10, i.e. '0123456789'.
* @type {string}
*/
goog.crypt.baseN.BASE_DECIMAL = '0123456789';
/**
* Base-16 using lower case, i.e. '0123456789abcdef'.
* @type {string}
*/
goog.crypt.baseN.BASE_LOWERCASE_HEXADECIMAL = '0123456789abcdef';
/**
* Base-16 using upper case, i.e. '0123456789ABCDEF'.
* @type {string}
*/
goog.crypt.baseN.BASE_UPPERCASE_HEXADECIMAL = '0123456789ABCDEF';
/**
* The more-known version of the BASE-64 encoding. Uses + and / characters.
* @type {string}
*/
goog.crypt.baseN.BASE_64 =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
/**
* URL-safe version of the BASE-64 encoding.
* @type {string}
*/
goog.crypt.baseN.BASE_64_URL_SAFE =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
/**
* Converts a number from one numeric base to another.
*
* The bases are represented as strings, which list allowed digits. Each digit
* should be unique. The bases can either be user defined, or any of
* goog.crypt.baseN.BASE_xxx.
*
* The number is in human-readable format, most significant digit first, and is
* a non-negative integer. Base designators such as $, 0x, d, b or h (at end)
* will be interpreted as digits, so avoid them. Leading zeros will be trimmed.
*
* Note: for huge bases the result may be inaccurate because of overflowing
* 64-bit doubles used by JavaScript for integer calculus. This may happen
* if the product of the number of digits in the input and output bases comes
* close to 10^16, which is VERY unlikely (100M digits in each base), but
* may be possible in the future unicode world. (Unicode 3.2 has less than 100K
* characters. However, it reserves some more, close to 1M.)
*
* @param {string} number The number to convert.
* @param {string} inputBase The numeric base the number is in (all digits).
* @param {string} outputBase Requested numeric base.
* @return {string} The converted number.
*/
goog.crypt.baseN.recodeString = function(number, inputBase, outputBase) {
if (outputBase == '') {
throw Error('Empty output base');
}
// Check if number is 0 (special case when we don't want to return '').
var isZero = true;
for (var i = 0, n = number.length; i < n; i++) {
if (number.charAt(i) != inputBase.charAt(0)) {
isZero = false;
break;
}
}
if (isZero) {
return outputBase.charAt(0);
}
var numberDigits = goog.crypt.baseN.stringToArray_(number, inputBase);
var inputBaseSize = inputBase.length;
var outputBaseSize = outputBase.length;
// result = 0.
var result = [];
// For all digits of number, starting with the most significant ...
for (var i = numberDigits.length - 1; i >= 0; i--) {
// result *= number.base.
var carry = 0;
for (var j = 0, n = result.length; j < n; j++) {
var digit = result[j];
// This may overflow for huge bases. See function comment.
digit = digit * inputBaseSize + carry;
if (digit >= outputBaseSize) {
var remainder = digit % outputBaseSize;
carry = (digit - remainder) / outputBaseSize;
digit = remainder;
} else {
carry = 0;
}
result[j] = digit;
}
while (carry) {
var remainder = carry % outputBaseSize;
result.push(remainder);
carry = (carry - remainder) / outputBaseSize;
}
// result += number[i].
carry = numberDigits[i];
var j = 0;
while (carry) {
if (j >= result.length) {
// Extend result with a leading zero which will be overwritten below.
result.push(0);
}
var digit = result[j];
digit += carry;
if (digit >= outputBaseSize) {
var remainder = digit % outputBaseSize;
carry = (digit - remainder) / outputBaseSize;
digit = remainder;
} else {
carry = 0;
}
result[j] = digit;
j++;
}
}
return goog.crypt.baseN.arrayToString_(result, outputBase);
};
/**
* Converts a string representation of a number to an array of digit values.
*
* More precisely, the digit values are indices into the number base, which
* is represented as a string, which can either be user defined or one of the
* BASE_xxx constants.
*
* Throws an Error if the number contains a digit not found in the base.
*
* @param {string} number The string to convert, most significant digit first.
* @param {string} base Digits in the base.
* @return {!Array<number>} Array of digit values, least significant digit
* first.
* @private
*/
goog.crypt.baseN.stringToArray_ = function(number, base) {
var index = {};
for (var i = 0, n = base.length; i < n; i++) {
index[base.charAt(i)] = i;
}
var result = [];
for (var i = number.length - 1; i >= 0; i--) {
var character = number.charAt(i);
var digit = index[character];
if (typeof digit == 'undefined') {
throw Error('Number ' + number +
' contains a character not found in base ' +
base + ', which is ' + character);
}
result.push(digit);
}
return result;
};
/**
* Converts an array representation of a number to a string.
*
* More precisely, the elements of the input array are indices into the base,
* which is represented as a string, which can either be user defined or one of
* the BASE_xxx constants.
*
* Throws an Error if the number contains a digit which is outside the range
* 0 ... base.length - 1.
*
* @param {Array<number>} number Array of digit values, least significant
* first.
* @param {string} base Digits in the base.
* @return {string} Number as a string, most significant digit first.
* @private
*/
goog.crypt.baseN.arrayToString_ = function(number, base) {
var n = number.length;
var chars = [];
var baseSize = base.length;
for (var i = n - 1; i >= 0; i--) {
var digit = number[i];
if (digit >= baseSize || digit < 0) {
throw Error('Number ' + number + ' contains an invalid digit: ' + digit);
}
chars.push(base.charAt(digit));
}
return chars.join('');
};

View File

@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2007 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
Closure Unit Tests - goog.crypt.baseN
</title>
<script src="../base.js">
</script>
<script>
goog.require('goog.crypt.baseNTest');
</script>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,165 @@
// Copyright 2007 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Tests for arbitrary base conversion library baseconversion.js.
*/
goog.provide('goog.crypt.baseNTest');
goog.setTestOnly('goog.crypt.baseNTest');
goog.require('goog.crypt.baseN');
goog.require('goog.testing.jsunit');
function testDecToHex() {
verifyConversion(goog.crypt.baseN.BASE_DECIMAL, '0',
goog.crypt.baseN.BASE_LOWERCASE_HEXADECIMAL, '0');
verifyConversion(goog.crypt.baseN.BASE_DECIMAL, '9',
goog.crypt.baseN.BASE_UPPERCASE_HEXADECIMAL, '9');
verifyConversion(goog.crypt.baseN.BASE_DECIMAL, '13',
goog.crypt.baseN.BASE_LOWERCASE_HEXADECIMAL, 'd');
verifyConversion(goog.crypt.baseN.BASE_DECIMAL, '255',
goog.crypt.baseN.BASE_UPPERCASE_HEXADECIMAL, 'FF');
verifyConversion(goog.crypt.baseN.BASE_DECIMAL,
'53425987345897',
goog.crypt.baseN.BASE_LOWERCASE_HEXADECIMAL,
'309734ff5de9');
verifyConversion(goog.crypt.baseN.BASE_DECIMAL,
'987080888',
goog.crypt.baseN.BASE_UPPERCASE_HEXADECIMAL,
'3AD5A8B8');
verifyConversion(goog.crypt.baseN.BASE_DECIMAL,
'009341587237',
goog.crypt.baseN.BASE_LOWERCASE_HEXADECIMAL,
'22ccd4f25');
}
function testBinToDec() {
verifyConversion(
goog.crypt.baseN.BASE_BINARY,
'11101010101000100010010000010010010000111101000100110111000000100001' +
'01100100111110110010000010110100111101000010010100001011111011111100' +
'00000010000010000101010101000000000101100000000100011111011101111001' +
'10000001000000000100101110001001001101101001101111010101111100010001' +
'11011100000110111000000100111011100100010010011001111011001111001011' +
'10001000101111001010011101101100110110011110010000011100101011110010' +
'11010001001111110011000000001001011011111011010000110011010000010111' +
'10111100000001100010111100000100000000110001011101011110100000011010' +
'0110000100011111',
goog.crypt.baseN.BASE_DECIMAL,
'34589745906769047354795784390596748934723904739085568907689045723489' +
'05745789789078907890789023447892365623589745678902348976234598723459' +
'087523496723486089723459078349087');
}
function testDecToBin() {
verifyConversion(
goog.crypt.baseN.BASE_DECIMAL,
'00342589674590347859734908573490568347534805468907960579056785605496' +
'83475873465859072390486756098742380573908572390463805745656623475234' +
'82345670247851902784123897349486238502378940637925807378946358964328' +
'57906148572346857346409823758034763928401296023947234784623765456367' +
'764623627623574',
goog.crypt.baseN.BASE_BINARY,
'10010011011100101010001111100111001100110000110111111110010110101000' +
'01010110110010000111000001100110100101010000101001100001011000101111' +
'01011101111100101101010010000111011110011110010101111001110010100100' +
'10111110000101111011010000000111111011110010011110101011100101000001' +
'00011000101010011001101000011101001010001101011110101001011011100101' +
'11100000101000010010101001011001100100101110111101010000011010001010' +
'01011100100111110001100111100100011001001001100011011100100111011111' +
'01000100101001000100110001011010010000011010111101111111111111110100' +
'01100101001111001111100110101000001100100000111111100101110010111011' +
'10110110001100100011101010110110100001001000101011001001100011010110' +
'10110100000110000110010111110100000100110110010010010101111001001111' +
'11100100000010101111110100011010011101011010001101110011100110111111' +
'11000100001111010000000101011011000010010000000100111111010110111100' +
'00101111010011011010011010010001000101100001111001110010010110');
}
function test7To9() {
verifyConversion(
'0123456', // Base 7.
'60625646056660665666066534602566346056634560665606666656465634265434' +
'66563465664566346406366534664656650660665623456663456654360665',
'012345678', // Base 9.
'11451222686557606458341381287142358175337801548087003804852781764284' +
'273762357630423116743334671762638240652740158536');
}
function testZeros() {
verifyConversion(goog.crypt.baseN.BASE_DECIMAL, '0',
goog.crypt.baseN.BASE_LOWERCASE_HEXADECIMAL, '0');
verifyConversion(goog.crypt.baseN.BASE_DECIMAL, '000',
goog.crypt.baseN.BASE_LOWERCASE_HEXADECIMAL, '0');
verifyConversion(goog.crypt.baseN.BASE_DECIMAL, '0000007',
goog.crypt.baseN.BASE_LOWERCASE_HEXADECIMAL, '7');
}
function testArbitraryBases() {
verifyConversion('X9(', // Base 3.
'9(XX((9X(XX9(9X9(X9(',
'a:*o9', // Base 5.
':oa**:9o9**9oo');
}
function testEmptyBases() {
var e = assertThrows(function() {
goog.crypt.baseN.recodeString('1230', '', '0123');
});
assertEquals('Exception message', 'Number 1230 contains a character ' +
'not found in base , which is 0', e.message);
e = assertThrows(function() {
goog.crypt.baseN.recodeString('1230', '0123', '');
});
assertEquals('Exception message', 'Empty output base', e.message);
}
function testInvalidDigits() {
var e = assertThrows(function() {
goog.crypt.baseN.recodeString('123x456', '01234567', '01234567');
});
assertEquals('Exception message', 'Number 123x456 contains a character ' +
'not found in base 01234567, which is x', e.message);
}
function makeHugeBase() {
// Number of digits in the base.
// Tests break if this is set to 200'000. The reason for that is
// String.fromCharCode(196609) == String.fromCharCode(1).
var baseSize = 20000;
var tab = [];
for (var i = 0; i < baseSize; i++) {
tab.push(String.fromCharCode(i));
}
return tab.join('');
}
function testHugeInputBase() {
verifyConversion(makeHugeBase(), String.fromCharCode(12345),
goog.crypt.baseN.BASE_DECIMAL, '12345');
}
function testHugeOutputBase() {
verifyConversion(goog.crypt.baseN.BASE_DECIMAL, '12345',
makeHugeBase(), String.fromCharCode(12345));
}
function verifyConversion(inputBase, inputNumber, outputBase, outputNumber) {
assertEquals(outputNumber,
goog.crypt.baseN.recodeString(inputNumber,
inputBase,
outputBase));
}

View File

@@ -0,0 +1,283 @@
// Copyright 2011 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Asynchronous hash computer for the Blob interface.
*
* The Blob interface, part of the HTML5 File API, is supported on Chrome 7+,
* Firefox 4.0 and Opera 11. No Blob interface implementation is expected on
* Internet Explorer 10. Chrome 11, Firefox 5.0 and the subsequent release of
* Opera are supposed to use vendor prefixes due to evolving API, see
* http://dev.w3.org/2006/webapi/FileAPI/ for details.
*
* This implementation currently uses upcoming Chrome and Firefox prefixes,
* plus the original Blob.slice specification, as implemented on Chrome 10
* and Firefox 4.0.
*
*/
goog.provide('goog.crypt.BlobHasher');
goog.provide('goog.crypt.BlobHasher.EventType');
goog.require('goog.asserts');
goog.require('goog.events.EventTarget');
goog.require('goog.fs');
goog.require('goog.log');
/**
* Construct the hash computer.
*
* @param {!goog.crypt.Hash} hashFn The hash function to use.
* @param {number=} opt_blockSize Processing block size.
* @constructor
* @extends {goog.events.EventTarget}
* @final
*/
goog.crypt.BlobHasher = function(hashFn, opt_blockSize) {
goog.crypt.BlobHasher.base(this, 'constructor');
/**
* The actual hash function.
* @type {!goog.crypt.Hash}
* @private
*/
this.hashFn_ = hashFn;
/**
* The blob being processed or null if no blob is being processed.
* @type {Blob}
* @private
*/
this.blob_ = null;
/**
* Computed hash value.
* @type {Array<number>}
* @private
*/
this.hashVal_ = null;
/**
* Number of bytes already processed.
* @type {number}
* @private
*/
this.bytesProcessed_ = 0;
/**
* The number of bytes to hash or Infinity for no limit.
* @type {number}
* @private
*/
this.hashingLimit_ = Infinity;
/**
* Processing block size.
* @type {number}
* @private
*/
this.blockSize_ = opt_blockSize || 5000000;
/**
* File reader object. Will be null if no chunk is currently being read.
* @type {FileReader}
* @private
*/
this.fileReader_ = null;
/**
* The logger used by this object.
* @type {goog.log.Logger}
* @private
*/
this.logger_ = goog.log.getLogger('goog.crypt.BlobHasher');
};
goog.inherits(goog.crypt.BlobHasher, goog.events.EventTarget);
/**
* Event names for hash computation events
* @enum {string}
*/
goog.crypt.BlobHasher.EventType = {
STARTED: 'started',
PROGRESS: 'progress',
THROTTLED: 'throttled',
COMPLETE: 'complete',
ABORT: 'abort',
ERROR: 'error'
};
/**
* Start the hash computation.
* @param {!Blob} blob The blob of data to compute the hash for.
*/
goog.crypt.BlobHasher.prototype.hash = function(blob) {
this.abort();
this.hashFn_.reset();
this.blob_ = blob;
this.hashVal_ = null;
this.bytesProcessed_ = 0;
this.dispatchEvent(goog.crypt.BlobHasher.EventType.STARTED);
this.processNextBlock_();
};
/**
* Sets the maximum number of bytes to hash or Infinity for no limit. Can be
* called before hash() to throttle the hash computation. The hash computation
* can then be continued by repeatedly calling setHashingLimit() with greater
* byte offsets. This is useful if you don't need the hash until some time in
* the future, for example when uploading a file and you don't need the hash
* until the transfer is complete.
* @param {number} byteOffset The byte offset to compute the hash up to.
* Should be a non-negative integer or Infinity for no limit. Negative
* values are not allowed.
*/
goog.crypt.BlobHasher.prototype.setHashingLimit = function(byteOffset) {
goog.asserts.assert(byteOffset >= 0, 'Hashing limit must be non-negative.');
this.hashingLimit_ = byteOffset;
// Resume processing if a blob is currently being hashed, but no block read
// is currently in progress.
if (this.blob_ && !this.fileReader_) {
this.processNextBlock_();
}
};
/**
* Abort hash computation.
*/
goog.crypt.BlobHasher.prototype.abort = function() {
if (this.fileReader_) {
this.fileReader_.abort();
this.fileReader_ = null;
}
if (this.blob_) {
this.blob_ = null;
this.dispatchEvent(goog.crypt.BlobHasher.EventType.ABORT);
}
};
/**
* @return {number} Number of bytes processed so far.
*/
goog.crypt.BlobHasher.prototype.getBytesProcessed = function() {
return this.bytesProcessed_;
};
/**
* @return {Array<number>} The computed hash value or null if not ready.
*/
goog.crypt.BlobHasher.prototype.getHash = function() {
return this.hashVal_;
};
/**
* Helper function setting up the processing for the next block, or finalizing
* the computation if all blocks were processed.
* @private
*/
goog.crypt.BlobHasher.prototype.processNextBlock_ = function() {
goog.asserts.assert(this.blob_, 'A hash computation must be in progress.');
if (this.bytesProcessed_ < this.blob_.size) {
if (this.hashingLimit_ <= this.bytesProcessed_) {
// Throttle limit reached. Wait until we are allowed to hash more bytes.
this.dispatchEvent(goog.crypt.BlobHasher.EventType.THROTTLED);
return;
}
// We have to reset the FileReader every time, otherwise it fails on
// Chrome, including the latest Chrome 12 beta.
// http://code.google.com/p/chromium/issues/detail?id=82346
this.fileReader_ = new FileReader();
this.fileReader_.onload = goog.bind(this.onLoad_, this);
this.fileReader_.onerror = goog.bind(this.onError_, this);
var endOffset = Math.min(this.hashingLimit_, this.blob_.size);
var size = Math.min(endOffset - this.bytesProcessed_, this.blockSize_);
var chunk = goog.fs.sliceBlob(this.blob_, this.bytesProcessed_,
this.bytesProcessed_ + size);
if (!chunk || chunk.size != size) {
goog.log.error(this.logger_, 'Failed slicing the blob');
this.onError_();
return;
}
if (this.fileReader_.readAsArrayBuffer) {
this.fileReader_.readAsArrayBuffer(chunk);
} else if (this.fileReader_.readAsBinaryString) {
this.fileReader_.readAsBinaryString(chunk);
} else {
goog.log.error(this.logger_, 'Failed calling the chunk reader');
this.onError_();
}
} else {
this.hashVal_ = this.hashFn_.digest();
this.blob_ = null;
this.dispatchEvent(goog.crypt.BlobHasher.EventType.COMPLETE);
}
};
/**
* Handle processing block loaded.
* @private
*/
goog.crypt.BlobHasher.prototype.onLoad_ = function() {
goog.log.info(this.logger_, 'Successfully loaded a chunk');
var array = null;
if (this.fileReader_.result instanceof Array ||
goog.isString(this.fileReader_.result)) {
array = this.fileReader_.result;
} else if (goog.global['ArrayBuffer'] && goog.global['Uint8Array'] &&
this.fileReader_.result instanceof ArrayBuffer) {
array = new Uint8Array(this.fileReader_.result);
}
if (!array) {
goog.log.error(this.logger_, 'Failed reading the chunk');
this.onError_();
return;
}
this.hashFn_.update(array);
this.bytesProcessed_ += array.length;
this.fileReader_ = null;
this.dispatchEvent(goog.crypt.BlobHasher.EventType.PROGRESS);
this.processNextBlock_();
};
/**
* Handles error.
* @private
*/
goog.crypt.BlobHasher.prototype.onError_ = function() {
this.fileReader_ = null;
this.blob_ = null;
this.dispatchEvent(goog.crypt.BlobHasher.EventType.ERROR);
};

View File

@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2011 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>
Closure Unit Tests - goog.crypt.BlobHasher
</title>
<script src="../base.js">
</script>
<script>
goog.require('goog.crypt.BlobHasherTest');
</script>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,382 @@
// Copyright 2011 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
goog.provide('goog.crypt.BlobHasherTest');
goog.setTestOnly('goog.crypt.BlobHasherTest');
goog.require('goog.crypt');
goog.require('goog.crypt.BlobHasher');
goog.require('goog.crypt.Md5');
goog.require('goog.events');
goog.require('goog.testing.PropertyReplacer');
goog.require('goog.testing.jsunit');
// A browser-independent mock of goog.fs.sliceBlob. The actual implementation
// calls the underlying slice method differently based on browser version.
// This mock does not support negative opt_end.
var fsSliceBlobMock = function(blob, start, opt_end) {
if (!goog.isNumber(opt_end)) {
opt_end = blob.size;
}
return blob.slice(start, opt_end);
};
// Mock out the Blob using a string.
BlobMock = function(string) {
this.data = string;
this.size = this.data.length;
};
BlobMock.prototype.slice = function(start, end) {
return new BlobMock(this.data.substr(start, end - start));
};
// Mock out the FileReader to have control over the flow.
FileReaderMock = function() {
this.array_ = [];
this.result = null;
this.readyState = this.EMPTY;
this.onload = null;
this.onabort = null;
this.onerror = null;
};
FileReaderMock.prototype.EMPTY = 0;
FileReaderMock.prototype.LOADING = 1;
FileReaderMock.prototype.DONE = 2;
FileReaderMock.prototype.mockLoad = function() {
this.readyState = this.DONE;
this.result = this.array_;
if (this.onload) {
this.onload.call();
}
};
FileReaderMock.prototype.abort = function() {
this.readyState = this.DONE;
if (this.onabort) {
this.onabort.call();
}
};
FileReaderMock.prototype.mockError = function() {
this.readyState = this.DONE;
if (this.onerror) {
this.onerror.call();
}
};
FileReaderMock.prototype.readAsArrayBuffer = function(blobMock) {
this.readyState = this.LOADING;
this.array_ = [];
for (var i = 0; i < blobMock.size; ++i) {
this.array_[i] = blobMock.data.charCodeAt(i);
}
};
FileReaderMock.prototype.isLoading = function() {
return this.readyState == this.LOADING;
};
var stubs = new goog.testing.PropertyReplacer();
function setUp() {
stubs.set(goog.global, 'FileReader', FileReaderMock);
stubs.set(goog.fs, 'sliceBlob', fsSliceBlobMock);
}
function tearDown() {
stubs.reset();
}
/**
* Makes the blobHasher read chunks from the blob and hash it. The number of
* reads shall not exceed a pre-determined number (typically blob size / chunk
* size) for computing hash. This function fails fast (after maxReads is
* reached), assuming that the hasher failed to generate hashes. This prevents
* the test suite from going into infinite loop.
* @param {!goog.crypt.BlobHasher} blobHasher Hasher in action.
* @param {number} maxReads Max number of read attempts.
*/
function readFromBlob(blobHasher, maxReads) {
var counter = 0;
while (blobHasher.fileReader_ && blobHasher.fileReader_.isLoading() &&
counter <= maxReads) {
blobHasher.fileReader_.mockLoad();
counter++;
}
assertTrue(counter <= maxReads);
return counter;
}
function testBasicOperations() {
if (!window.Blob) {
return;
}
// Test hashing with one chunk.
var hashFn = new goog.crypt.Md5();
var blobHasher = new goog.crypt.BlobHasher(hashFn);
var blob = new BlobMock('The quick brown fox jumps over the lazy dog');
blobHasher.hash(blob);
readFromBlob(blobHasher, 1);
assertEquals('9e107d9d372bb6826bd81d3542a419d6',
goog.crypt.byteArrayToHex(blobHasher.getHash()));
// Test hashing with multiple chunks.
blobHasher = new goog.crypt.BlobHasher(hashFn, 7);
blobHasher.hash(blob);
readFromBlob(blobHasher, Math.ceil(blob.size / 7));
assertEquals('9e107d9d372bb6826bd81d3542a419d6',
goog.crypt.byteArrayToHex(blobHasher.getHash()));
// Test hashing with no chunks.
blob = new BlobMock('');
blobHasher.hash(blob);
readFromBlob(blobHasher, 1);
assertEquals('d41d8cd98f00b204e9800998ecf8427e',
goog.crypt.byteArrayToHex(blobHasher.getHash()));
}
function testNormalFlow() {
if (!window.Blob) {
return;
}
// Test the flow with one chunk.
var hashFn = new goog.crypt.Md5();
var blobHasher = new goog.crypt.BlobHasher(hashFn, 13);
var blob = new BlobMock('short');
var startedEvents = 0;
var progressEvents = 0;
var completeEvents = 0;
goog.events.listen(blobHasher, goog.crypt.BlobHasher.EventType.STARTED,
function() { ++startedEvents; });
goog.events.listen(blobHasher, goog.crypt.BlobHasher.EventType.PROGRESS,
function() { ++progressEvents; });
goog.events.listen(blobHasher, goog.crypt.BlobHasher.EventType.COMPLETE,
function() { ++completeEvents; });
blobHasher.hash(blob);
assertEquals(1, startedEvents);
assertEquals(0, progressEvents);
assertEquals(0, completeEvents);
readFromBlob(blobHasher, 1);
assertEquals(1, startedEvents);
assertEquals(1, progressEvents);
assertEquals(1, completeEvents);
// Test the flow with multiple chunks.
blob = new BlobMock('The quick brown fox jumps over the lazy dog');
startedEvents = 0;
progressEvents = 0;
completeEvents = 0;
var progressLoops = 0;
blobHasher.hash(blob);
assertEquals(1, startedEvents);
assertEquals(0, progressEvents);
assertEquals(0, completeEvents);
progressLoops = readFromBlob(blobHasher, Math.ceil(blob.size / 13));
assertEquals(1, startedEvents);
assertEquals(progressLoops, progressEvents);
assertEquals(1, completeEvents);
}
function testAbortsAndErrors() {
if (!window.Blob) {
return;
}
var hashFn = new goog.crypt.Md5();
var blobHasher = new goog.crypt.BlobHasher(hashFn, 13);
var blob = new BlobMock('The quick brown fox jumps over the lazy dog');
var abortEvents = 0;
var errorEvents = 0;
var completeEvents = 0;
goog.events.listen(blobHasher, goog.crypt.BlobHasher.EventType.ABORT,
function() { ++abortEvents; });
goog.events.listen(blobHasher, goog.crypt.BlobHasher.EventType.ERROR,
function() { ++errorEvents; });
goog.events.listen(blobHasher, goog.crypt.BlobHasher.EventType.COMPLETE,
function() { ++completeEvents; });
// Immediate abort.
blobHasher.hash(blob);
assertEquals(0, abortEvents);
assertEquals(0, errorEvents);
assertEquals(0, completeEvents);
blobHasher.abort();
blobHasher.abort();
assertEquals(1, abortEvents);
assertEquals(0, errorEvents);
assertEquals(0, completeEvents);
abortEvents = 0;
// Delayed abort.
blobHasher.hash(blob);
blobHasher.fileReader_.mockLoad();
assertEquals(0, abortEvents);
assertEquals(0, errorEvents);
assertEquals(0, completeEvents);
blobHasher.abort();
blobHasher.abort();
assertEquals(1, abortEvents);
assertEquals(0, errorEvents);
assertEquals(0, completeEvents);
abortEvents = 0;
// Immediate error.
blobHasher.hash(blob);
blobHasher.fileReader_.mockError();
assertEquals(0, abortEvents);
assertEquals(1, errorEvents);
assertEquals(0, completeEvents);
errorEvents = 0;
// Delayed error.
blobHasher.hash(blob);
blobHasher.fileReader_.mockLoad();
blobHasher.fileReader_.mockError();
assertEquals(0, abortEvents);
assertEquals(1, errorEvents);
assertEquals(0, completeEvents);
abortEvents = 0;
}
function testBasicThrottling() {
if (!window.Blob) {
return;
}
var hashFn = new goog.crypt.Md5();
var blobHasher = new goog.crypt.BlobHasher(hashFn, 5);
var blob = new BlobMock('The quick brown fox jumps over the lazy dog');
var throttledEvents = 0;
var completeEvents = 0;
goog.events.listen(blobHasher, goog.crypt.BlobHasher.EventType.THROTTLED,
function() { ++throttledEvents; });
goog.events.listen(blobHasher, goog.crypt.BlobHasher.EventType.COMPLETE,
function() { ++completeEvents; });
// Start a throttled hash. No chunks should be processed yet.
blobHasher.setHashingLimit(0);
assertEquals(0, throttledEvents);
blobHasher.hash(blob);
assertEquals(1, throttledEvents);
assertEquals(0, blobHasher.getBytesProcessed());
assertNull(blobHasher.fileReader_);
// One chunk should be processed.
blobHasher.setHashingLimit(4);
assertEquals(1, throttledEvents);
assertEquals(1, readFromBlob(blobHasher, 1));
assertEquals(2, throttledEvents);
assertEquals(4, blobHasher.getBytesProcessed());
// One more chunk should be processed.
blobHasher.setHashingLimit(5);
assertEquals(2, throttledEvents);
assertEquals(1, readFromBlob(blobHasher, 1));
assertEquals(3, throttledEvents);
assertEquals(5, blobHasher.getBytesProcessed());
// Two more chunks should be processed.
blobHasher.setHashingLimit(15);
assertEquals(3, throttledEvents);
assertEquals(2, readFromBlob(blobHasher, 2));
assertEquals(4, throttledEvents);
assertEquals(15, blobHasher.getBytesProcessed());
// The entire blob should be processed.
blobHasher.setHashingLimit(Infinity);
var expectedChunks = Math.ceil(blob.size / 5) - 3;
assertEquals(expectedChunks, readFromBlob(blobHasher, expectedChunks));
assertEquals(4, throttledEvents);
assertEquals(1, completeEvents);
assertEquals('9e107d9d372bb6826bd81d3542a419d6',
goog.crypt.byteArrayToHex(blobHasher.getHash()));
}
function testLengthZeroThrottling() {
if (!window.Blob) {
return;
}
var hashFn = new goog.crypt.Md5();
var blobHasher = new goog.crypt.BlobHasher(hashFn);
var throttledEvents = 0;
var completeEvents = 0;
goog.events.listen(blobHasher, goog.crypt.BlobHasher.EventType.THROTTLED,
function() { ++throttledEvents; });
goog.events.listen(blobHasher, goog.crypt.BlobHasher.EventType.COMPLETE,
function() { ++completeEvents; });
// Test throttling with length 0 blob.
var blob = new BlobMock('');
blobHasher.setHashingLimit(0);
blobHasher.hash(blob);
assertEquals(0, throttledEvents);
assertEquals(1, completeEvents);
assertEquals('d41d8cd98f00b204e9800998ecf8427e',
goog.crypt.byteArrayToHex(blobHasher.getHash()));
}
function testAbortsAndErrorsWhileThrottling() {
if (!window.Blob) {
return;
}
var hashFn = new goog.crypt.Md5();
var blobHasher = new goog.crypt.BlobHasher(hashFn, 5);
var blob = new BlobMock('The quick brown fox jumps over the lazy dog');
var abortEvents = 0;
var errorEvents = 0;
var throttledEvents = 0;
var completeEvents = 0;
goog.events.listen(blobHasher, goog.crypt.BlobHasher.EventType.ABORT,
function() { ++abortEvents; });
goog.events.listen(blobHasher, goog.crypt.BlobHasher.EventType.ERROR,
function() { ++errorEvents; });
goog.events.listen(blobHasher, goog.crypt.BlobHasher.EventType.THROTTLED,
function() { ++throttledEvents; });
goog.events.listen(blobHasher, goog.crypt.BlobHasher.EventType.COMPLETE,
function() { ++completeEvents; });
// Test that processing cannot be continued after abort.
blobHasher.setHashingLimit(0);
blobHasher.hash(blob);
assertEquals(1, throttledEvents);
blobHasher.abort();
assertEquals(1, abortEvents);
blobHasher.setHashingLimit(10);
assertNull(blobHasher.fileReader_);
assertEquals(1, throttledEvents);
assertEquals(0, completeEvents);
assertNull(blobHasher.getHash());
// Test that processing cannot be continued after error.
blobHasher.hash(blob);
assertEquals(1, throttledEvents);
blobHasher.fileReader_.mockError();
assertEquals(1, errorEvents);
blobHasher.setHashingLimit(100);
assertNull(blobHasher.fileReader_);
assertEquals(1, throttledEvents);
assertEquals(0, completeEvents);
assertNull(blobHasher.getHash());
}

View File

@@ -0,0 +1,52 @@
// Copyright 2012 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Interface definition of a block cipher. A block cipher is a
* pair of algorithms that implement encryption and decryption of input bytes.
*
* @see http://en.wikipedia.org/wiki/Block_cipher
*
* @author nnaze@google.com (Nathan Naze)
*/
goog.provide('goog.crypt.BlockCipher');
/**
* Interface definition for a block cipher.
* @interface
*/
goog.crypt.BlockCipher = function() {};
/**
* Encrypt a plaintext block. The implementation may expect (and assert)
* a particular block length.
* @param {!Array<number>} input Plaintext array of input bytes.
* @return {!Array<number>} Encrypted ciphertext array of bytes. Should be the
* same length as input.
*/
goog.crypt.BlockCipher.prototype.encrypt;
/**
* Decrypt a plaintext block. The implementation may expect (and assert)
* a particular block length.
* @param {!Array<number>} input Ciphertext. Array of input bytes.
* @return {!Array<number>} Decrypted plaintext array of bytes. Should be the
* same length as input.
*/
goog.crypt.BlockCipher.prototype.decrypt;

View File

@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2014 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Closure Performance Tests - byteArrayToString</title>
<link rel="stylesheet" type="text/css"
href="../testing/performancetable.css"/>
<script src="../base.js"></script>
</head>
<body>
<h1>Closure Performance Tests - byteArrayToString</h1>
<div id="perfTable"></div>
<hr>
<script>
goog.require('goog.crypt.byteArrayToStringPerf');
</script>
</body>
</html>

View File

@@ -0,0 +1,124 @@
// Copyright 2014 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Performance test for different implementations of
* byteArrayToString.
*/
goog.provide('goog.crypt.byteArrayToStringPerf');
goog.require('goog.array');
goog.require('goog.dom');
goog.require('goog.testing.PerformanceTable');
goog.setTestOnly('goog.crypt.byteArrayToStringPerf');
var table = new goog.testing.PerformanceTable(
goog.dom.getElement('perfTable'));
var BYTES_LENGTH = Math.pow(2, 20);
var CHUNK_SIZE = 8192;
function getBytes() {
var bytes = [];
for (var i = 0; i < BYTES_LENGTH; i++) {
bytes.push('A'.charCodeAt(0));
}
return bytes;
}
function copyAndSpliceByteArray(bytes) {
// Copy the passed byte array since we're going to destroy it.
var remainingBytes = goog.array.clone(bytes);
var strings = [];
// Convert each chunk to a string.
while (remainingBytes.length) {
var chunk = goog.array.splice(remainingBytes, 0, CHUNK_SIZE);
strings.push(String.fromCharCode.apply(null, chunk));
}
return strings.join('');
}
function sliceByteArrayConcat(bytes) {
var str = '';
for (var i = 0; i < bytes.length; i += CHUNK_SIZE) {
var chunk = goog.array.slice(bytes, i, i + CHUNK_SIZE);
str += String.fromCharCode.apply(null, chunk);
}
return str;
}
function sliceByteArrayJoin(bytes) {
var strings = [];
for (var i = 0; i < bytes.length; i += CHUNK_SIZE) {
var chunk = goog.array.slice(bytes, i, i + CHUNK_SIZE);
strings.push(String.fromCharCode.apply(null, chunk));
}
return strings.join('');
}
function mapByteArray(bytes) {
var strings = goog.array.map(bytes, String.fromCharCode);
return strings.join('');
}
function forLoopByteArrayConcat(bytes) {
var str = '';
for (var i = 0; i < bytes.length; i++) {
str += String.fromCharCode(bytes[i]);
}
return str;
}
function forLoopByteArrayJoin(bytes) {
var strs = [];
for (var i = 0; i < bytes.length; i++) {
strs.push(String.fromCharCode(bytes[i]));
}
return strs.join('');
}
function run() {
var bytes = getBytes();
table.run(goog.partial(copyAndSpliceByteArray, getBytes()),
'Copy array and splice out chunks.');
table.run(goog.partial(sliceByteArrayConcat, getBytes()),
'Slice out copies of the byte array, concatenating results');
table.run(goog.partial(sliceByteArrayJoin, getBytes()),
'Slice out copies of the byte array, joining results');
table.run(goog.partial(forLoopByteArrayConcat, getBytes()),
'Use for loop with concat.');
table.run(goog.partial(forLoopByteArrayJoin, getBytes()),
'Use for loop with join.');
// Purposefully commented out. This ends up being tremendously expensive.
// table.run(goog.partial(mapByteArray, getBytes()),
// 'Use goog.array.map and fromCharCode.');
}
run();

View File

@@ -0,0 +1,153 @@
// Copyright 2012 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Implementation of CBC mode for block ciphers. See
* http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation
* #Cipher-block_chaining_.28CBC.29. for description.
*
* @author nnaze@google.com (Nathan Naze)
*/
goog.provide('goog.crypt.Cbc');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('goog.crypt');
/**
* Implements the CBC mode for block ciphers. See
* http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation
* #Cipher-block_chaining_.28CBC.29
*
* @param {!goog.crypt.BlockCipher} cipher The block cipher to use.
* @param {number=} opt_blockSize The block size of the cipher in bytes.
* Defaults to 16 bytes.
* @constructor
* @final
* @struct
*/
goog.crypt.Cbc = function(cipher, opt_blockSize) {
/**
* Block cipher.
* @type {!goog.crypt.BlockCipher}
* @private
*/
this.cipher_ = cipher;
/**
* Block size in bytes.
* @type {number}
* @private
*/
this.blockSize_ = opt_blockSize || 16;
};
/**
* Encrypt a message.
*
* @param {!Array<number>} plainText Message to encrypt. An array of bytes.
* The length should be a multiple of the block size.
* @param {!Array<number>} initialVector Initial vector for the CBC mode.
* An array of bytes with the same length as the block size.
* @return {!Array<number>} Encrypted message.
*/
goog.crypt.Cbc.prototype.encrypt = function(plainText, initialVector) {
goog.asserts.assert(
plainText.length % this.blockSize_ == 0,
'Data\'s length must be multiple of block size.');
goog.asserts.assert(
initialVector.length == this.blockSize_,
'Initial vector must be size of one block.');
// Implementation of
// http://en.wikipedia.org/wiki/File:Cbc_encryption.png
var cipherText = [];
var vector = initialVector;
// Generate each block of the encrypted cypher text.
for (var blockStartIndex = 0;
blockStartIndex < plainText.length;
blockStartIndex += this.blockSize_) {
// Takes one block from the input message.
var plainTextBlock = goog.array.slice(
plainText,
blockStartIndex,
blockStartIndex + this.blockSize_);
var input = goog.crypt.xorByteArray(plainTextBlock, vector);
var resultBlock = this.cipher_.encrypt(input);
goog.array.extend(cipherText, resultBlock);
vector = resultBlock;
}
return cipherText;
};
/**
* Decrypt a message.
*
* @param {!Array<number>} cipherText Message to decrypt. An array of bytes.
* The length should be a multiple of the block size.
* @param {!Array<number>} initialVector Initial vector for the CBC mode.
* An array of bytes with the same length as the block size.
* @return {!Array<number>} Decrypted message.
*/
goog.crypt.Cbc.prototype.decrypt = function(cipherText, initialVector) {
goog.asserts.assert(
cipherText.length % this.blockSize_ == 0,
'Data\'s length must be multiple of block size.');
goog.asserts.assert(
initialVector.length == this.blockSize_,
'Initial vector must be size of one block.');
// Implementation of
// http://en.wikipedia.org/wiki/File:Cbc_decryption.png
var plainText = [];
var blockStartIndex = 0;
var vector = initialVector;
// Generate each block of the decrypted plain text.
while (blockStartIndex < cipherText.length) {
// Takes one block.
var cipherTextBlock = goog.array.slice(
cipherText,
blockStartIndex,
blockStartIndex + this.blockSize_);
var resultBlock = this.cipher_.decrypt(cipherTextBlock);
var plainTextBlock = goog.crypt.xorByteArray(vector, resultBlock);
goog.array.extend(plainText, plainTextBlock);
vector = cipherTextBlock;
blockStartIndex += this.blockSize_;
}
return plainText;
};

View File

@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<!--
Copyright 2012 The Closure Library Authors. All Rights Reserved.
Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<head>
<title>Closure Unit Tests - goog.crypt.Cbc</title>
<script src="../base.js"></script>
<script>
goog.require('goog.crypt.CbcTest');
</script>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,100 @@
// Copyright 2012 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Unit tests for CBC mode for block ciphers.
*
* @author nnaze@google.com (Nathan Naze)
*/
/** @suppress {extraProvide} */
goog.provide('goog.crypt.CbcTest');
goog.require('goog.crypt');
goog.require('goog.crypt.Aes');
goog.require('goog.crypt.Cbc');
goog.require('goog.testing.jsunit');
goog.setTestOnly('goog.crypt.CbcTest');
function stringToBytes(s) {
var bytes = new Array(s.length);
for (var i = 0; i < s.length; ++i)
bytes[i] = s.charCodeAt(i) & 255;
return bytes;
}
function runCbcAesTest(keyBytes, initialVectorBytes, plainTextBytes,
cipherTextBytes) {
var aes = new goog.crypt.Aes(keyBytes);
var cbc = new goog.crypt.Cbc(aes);
var encryptedBytes = cbc.encrypt(plainTextBytes, initialVectorBytes);
assertEquals('Encrypted bytes should match cipher text.',
goog.crypt.byteArrayToHex(cipherTextBytes),
goog.crypt.byteArrayToHex(encryptedBytes));
var decryptedBytes = cbc.decrypt(cipherTextBytes, initialVectorBytes);
assertEquals('Decrypted bytes should match plain text.',
goog.crypt.byteArrayToHex(plainTextBytes),
goog.crypt.byteArrayToHex(decryptedBytes));
}
function testAesCbcCipherAlgorithm() {
// Test values from http://www.ietf.org/rfc/rfc3602.txt
// Case #1
runCbcAesTest(
goog.crypt.hexToByteArray('06a9214036b8a15b512e03d534120006'),
goog.crypt.hexToByteArray('3dafba429d9eb430b422da802c9fac41'),
stringToBytes('Single block msg'),
goog.crypt.hexToByteArray('e353779c1079aeb82708942dbe77181a'));
// Case #2
runCbcAesTest(
goog.crypt.hexToByteArray('c286696d887c9aa0611bbb3e2025a45a'),
goog.crypt.hexToByteArray('562e17996d093d28ddb3ba695a2e6f58'),
goog.crypt.hexToByteArray(
'000102030405060708090a0b0c0d0e0f' +
'101112131415161718191a1b1c1d1e1f'),
goog.crypt.hexToByteArray(
'd296cd94c2cccf8a3a863028b5e1dc0a' +
'7586602d253cfff91b8266bea6d61ab1'));
// Case #3
runCbcAesTest(
goog.crypt.hexToByteArray('6c3ea0477630ce21a2ce334aa746c2cd'),
goog.crypt.hexToByteArray('c782dc4c098c66cbd9cd27d825682c81'),
stringToBytes('This is a 48-byte message (exactly 3 AES blocks)'),
goog.crypt.hexToByteArray(
'd0a02b3836451753d493665d33f0e886' +
'2dea54cdb293abc7506939276772f8d5' +
'021c19216bad525c8579695d83ba2684'));
// Case #4
runCbcAesTest(
goog.crypt.hexToByteArray('56e47a38c5598974bc46903dba290349'),
goog.crypt.hexToByteArray('8ce82eefbea0da3c44699ed7db51b7d9'),
goog.crypt.hexToByteArray(
'a0a1a2a3a4a5a6a7a8a9aaabacadaeaf' +
'b0b1b2b3b4b5b6b7b8b9babbbcbdbebf' +
'c0c1c2c3c4c5c6c7c8c9cacbcccdcecf' +
'd0d1d2d3d4d5d6d7d8d9dadbdcdddedf'),
goog.crypt.hexToByteArray(
'c30e32ffedc0774e6aff6af0869f71aa' +
'0f3af07a9a31a9c684db207eb0ef8e4e' +
'35907aa632c3ffdf868bb7b29d3d46ad' +
'83ce9f9a102ee99d49a53e87f4c3da55'));
}

Some files were not shown because too many files have changed in this diff Show More