This file is indexed.

/usr/share/javascript/wax/wax.mm.min.js is in libjs-wax 5.0.1+ds2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
/* wax.js - 5.0.1 */// Copyright (C) 2008 Google Inc.
//
// 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
 * Whitelists of HTML elements and attributes.
 * 
 * @author mikesamuel@gmail.com
 *//** @namespace */var html4={};html4.eflags={OPTIONAL_ENDTAG:1,BREAKS_FLOW:2,EMPTY:4,NAVIGATES:8,CDATA:16,RCDATA:32,UNSAFE:64,FOLDABLE:128},html4.atype={SCRIPT:1,STYLE:2,IDREF:3,NAME:4,NMTOKENS:5,URI:6,FRAME:7},html4.ELEMENTS={a:html4.eflags.NAVIGATES,abbr:0,acronym:0,address:0,applet:html4.eflags.UNSAFE,area:html4.eflags.EMPTY|html4.eflags.NAVIGATES,b:0,base:html4.eflags.UNSAFE|html4.eflags.EMPTY,basefont:html4.eflags.UNSAFE|html4.eflags.EMPTY,bdo:0,big:0,blockquote:html4.eflags.BREAKS_FLOW,body:html4.eflags.FOLDABLE|html4.eflags.OPTIONAL_ENDTAG|html4.eflags.UNSAFE,br:html4.eflags.EMPTY|html4.eflags.BREAKS_FLOW,button:0,caption:0,center:html4.eflags.BREAKS_FLOW,cite:0,code:0,col:html4.eflags.EMPTY,colgroup:html4.eflags.OPTIONAL_ENDTAG,dd:html4.eflags.OPTIONAL_ENDTAG|html4.eflags.BREAKS_FLOW,del:0,dfn:0,dir:html4.eflags.BREAKS_FLOW,div:html4.eflags.BREAKS_FLOW,dl:html4.eflags.BREAKS_FLOW,dt:html4.eflags.OPTIONAL_ENDTAG|html4.eflags.BREAKS_FLOW,em:0,fieldset:0,font:0,form:html4.eflags.BREAKS_FLOW|html4.eflags.NAVIGATES,frame:html4.eflags.UNSAFE|html4.eflags.EMPTY,frameset:html4.eflags.UNSAFE,h1:html4.eflags.BREAKS_FLOW,h2:html4.eflags.BREAKS_FLOW,h3:html4.eflags.BREAKS_FLOW,h4:html4.eflags.BREAKS_FLOW,h5:html4.eflags.BREAKS_FLOW,h6:html4.eflags.BREAKS_FLOW,head:html4.eflags.FOLDABLE|html4.eflags.OPTIONAL_ENDTAG|html4.eflags.BREAKS_FLOW|html4.eflags.UNSAFE,hr:html4.eflags.EMPTY|html4.eflags.BREAKS_FLOW,html:html4.eflags.FOLDABLE|html4.eflags.OPTIONAL_ENDTAG|html4.eflags.BREAKS_FLOW|html4.eflags.UNSAFE,i:0,iframe:html4.eflags.UNSAFE,img:html4.eflags.EMPTY,input:html4.eflags.EMPTY,ins:0,isindex:html4.eflags.UNSAFE|html4.eflags.EMPTY|html4.eflags.BREAKS_FLOW|html4.eflags.NAVIGATES,kbd:0,label:0,legend:0,li:html4.eflags.OPTIONAL_ENDTAG|html4.eflags.BREAKS_FLOW,link:html4.eflags.UNSAFE|html4.eflags.EMPTY,map:0,menu:html4.eflags.BREAKS_FLOW,meta:html4.eflags.UNSAFE|html4.eflags.EMPTY,noframes:html4.eflags.UNSAFE|html4.eflags.BREAKS_FLOW,noscript:html4.eflags.UNSAFE,object:html4.eflags.UNSAFE,ol:html4.eflags.BREAKS_FLOW,optgroup:0,option:html4.eflags.OPTIONAL_ENDTAG,p:html4.eflags.OPTIONAL_ENDTAG|html4.eflags.BREAKS_FLOW,param:html4.eflags.UNSAFE|html4.eflags.EMPTY,plaintext:html4.eflags.OPTIONAL_ENDTAG|html4.eflags.UNSAFE|html4.eflags.CDATA,pre:html4.eflags.BREAKS_FLOW,q:0,s:0,samp:0,script:html4.eflags.UNSAFE|html4.eflags.CDATA,select:0,small:0,span:0,strike:0,strong:0,style:html4.eflags.UNSAFE|html4.eflags.CDATA,sub:0,sup:0,table:html4.eflags.BREAKS_FLOW,tbody:html4.eflags.OPTIONAL_ENDTAG,td:html4.eflags.OPTIONAL_ENDTAG|html4.eflags.BREAKS_FLOW,textarea:html4.eflags.RCDATA,tfoot:html4.eflags.OPTIONAL_ENDTAG,th:html4.eflags.OPTIONAL_ENDTAG|html4.eflags.BREAKS_FLOW,thead:html4.eflags.OPTIONAL_ENDTAG,title:html4.eflags.UNSAFE|html4.eflags.BREAKS_FLOW|html4.eflags.RCDATA,tr:html4.eflags.OPTIONAL_ENDTAG|html4.eflags.BREAKS_FLOW,tt:0,u:0,ul:html4.eflags.BREAKS_FLOW,"var":0,xmp:html4.eflags.CDATA},html4.ATTRIBS={abbr:0,accept:0,"accept-charset":0,action:html4.atype.URI,align:0,alink:0,alt:0,archive:html4.atype.URI,axis:0,background:html4.atype.URI,bgcolor:0,border:0,cellpadding:0,cellspacing:0,"char":0,charoff:0,charset:0,checked:0,cite:html4.atype.URI,"class":html4.atype.NMTOKENS,classid:html4.atype.URI,clear:0,code:0,codebase:html4.atype.URI,codetype:0,color:0,cols:0,colspan:0,compact:0,content:0,coords:0,data:html4.atype.URI,datetime:0,declare:0,defer:0,dir:0,disabled:0,enctype:0,face:0,"for":html4.atype.IDREF,frame:0,frameborder:0,headers:0,height:0,href:html4.atype.URI,hreflang:0,hspace:0,id:html4.atype.IDREF,ismap:0,label:0,lang:0,language:0,link:0,longdesc:html4.atype.URI,marginheight:0,marginwidth:0,maxlength:0,media:0,method:0,multiple:0,name:html4.atype.NAME,nohref:0,noresize:0,noshade:0,nowrap:0,object:0,onblur:html4.atype.SCRIPT,onchange:html4.atype.SCRIPT,onclick:html4.atype.SCRIPT,ondblclick:html4.atype.SCRIPT,onfocus:html4.atype.SCRIPT,onkeydown:html4.atype.SCRIPT,onkeypress:html4.atype.SCRIPT,onkeyup:html4.atype.SCRIPT,onload:html4.atype.SCRIPT,onmousedown:html4.atype.SCRIPT,onmousemove:html4.atype.SCRIPT,onmouseout:html4.atype.SCRIPT,onmouseover:html4.atype.SCRIPT,onmouseup:html4.atype.SCRIPT,onreset:html4.atype.SCRIPT,onselect:html4.atype.SCRIPT,onsubmit:html4.atype.SCRIPT,onunload:html4.atype.SCRIPT,profile:html4.atype.URI,prompt:0,readonly:0,rel:0,rev:0,rows:0,rowspan:0,rules:0,scheme:0,scope:0,scrolling:0,selected:0,shape:0,size:0,span:0,src:html4.atype.URI,standby:0,start:0,style:html4.atype.STYLE,summary:0,tabindex:0,target:html4.atype.FRAME,text:0,title:0,type:0,usemap:html4.atype.URI,valign:0,value:0,valuetype:0,version:0,vlink:0,vspace:0,width:0};if("I".toLowerCase()!=="i")throw"I/i problem";var html=function(a){function h(a){a=a.toLowerCase();if(e.hasOwnProperty(a))return e[a];var b=a.match(f);return b?String.fromCharCode(parseInt(b[1],10)):(b=a.match(g))?String.fromCharCode(parseInt(b[1],16)):""}function i(a,b){return h(b)}function k(a){return a.replace(j,"")}function n(a){return a.replace(l,i)}function t(a){return(""+a).replace(o,"&amp;").replace(q,"&lt;").replace(r,"&gt;").replace(s,"&#34;")}function u(a){return a.replace(p,"&amp;$1").replace(q,"&lt;").replace(r,"&gt;")}function y(a){var b={cdata:a.cdata||a.cdata,comment:a.comment||a.comment,endDoc:a.endDoc||a.endDoc,endTag:a.endTag||a.endTag,pcdata:a.pcdata||a.pcdata,rcdata:a.rcdata||a.rcdata,startDoc:a.startDoc||a.startDoc,startTag:a.startTag||a.startTag};return function(a,c){return A(a,b,c)}}function A(a,b,c){var d,e,f,g=D(a),h={noMoreGT:!1,noMoreEndComments:!1};C(b,g,0,h,c)}function B(a,b,c,d,e){return function(){C(a,b,c,d,e)}}function C(b,c,d,e,f){try{b.startDoc&&d==0&&b.startDoc(f);var g,h,i;for(var j=d,k=c.length;j<k;){var l=c[j++],n=c[j];switch(l){case"&":m.test(n)?(b.pcdata&&b.pcdata("&"+n,f,z,B(b,c,j,e,f)),j++):b.pcdata&&b.pcdata("&amp;",f,z,B(b,c,j,e,f));break;case"</":(g=/^([\w:]+)[^\'\"]*/.exec(n))?g[0].length===n.length&&c[j+1]===">"?(j+=2,i=g[1].toLowerCase(),b.endTag&&b.endTag(i,f,z,B(b,c,j,e,f))):j=E(c,j,b,f,z,e):b.pcdata&&b.pcdata("&lt;/",f,z,B(b,c,j,e,f));break;case"<":if(g=/^([\w:]+)\s*\/?/.exec(n))if(g[0].length===n.length&&c[j+1]===">"){j+=2,i=g[1].toLowerCase(),b.startTag&&b.startTag(i,[],f,z,B(b,c,j,e,f));var o=a.ELEMENTS[i];if(o&x){var p={name:i,next:j,eflags:o};j=H(c,p,b,f,z,e)}}else j=F(c,j,b,f,z,e);else b.pcdata&&b.pcdata("&lt;",f,z,B(b,c,j,e,f));break;case"<!--":if(!e.noMoreEndComments){for(h=j+1;h<k;h++)if(c[h]===">"&&/--$/.test(c[h-1]))break;if(h<k){if(b.comment){var q=c.slice(j,h).join("");b.comment(q.substr(0,q.length-2),f,z,B(b,c,h+1,e,f))}j=h+1}else e.noMoreEndComments=!0}e.noMoreEndComments&&b.pcdata&&b.pcdata("&lt;!--",f,z,B(b,c,j,e,f));break;case"<!":if(!/^\w/.test(n))b.pcdata&&b.pcdata("&lt;!",f,z,B(b,c,j,e,f));else{if(!e.noMoreGT){for(h=j+1;h<k;h++)if(c[h]===">")break;h<k?j=h+1:e.noMoreGT=!0}e.noMoreGT&&b.pcdata&&b.pcdata("&lt;!",f,z,B(b,c,j,e,f))}break;case"<?":if(!e.noMoreGT){for(h=j+1;h<k;h++)if(c[h]===">")break;h<k?j=h+1:e.noMoreGT=!0}e.noMoreGT&&b.pcdata&&b.pcdata("&lt;?",f,z,B(b,c,j,e,f));break;case">":b.pcdata&&b.pcdata("&gt;",f,z,B(b,c,j,e,f));break;case"":break;default:b.pcdata&&b.pcdata(l,f,z,B(b,c,j,e,f))}}b.endDoc&&b.endDoc(f)}catch(r){if(r!==z)throw r}}function D(a){var b=/(<\/|<\!--|<[!?]|[&<>])/g;a+="";if(w)return a.split(b);var c=[],d=0,e;while((e=b.exec(a))!==null)c.push(a.substring(d,e.index)),c.push(e[0]),d=e.index+e[0].length;return c.push(a.substring(d)),c}function E(a,b,c,d,e,f){var g=I(a,b);return g?(c.endTag&&c.endTag(g.name,d,e,B(c,a,b,f,d)),g.next):a.length}function F(a,b,c,d,e,f){var g=I(a,b);return g?(c.startTag&&c.startTag(g.name,g.attrs,d,e,B(c,a,g.next,f,d)),g.eflags&x?H(a,g,c,d,e,f):g.next):a.length}function H(b,c,d,e,f,g){var h=b.length;G.hasOwnProperty(c.name)||(G[c.name]=new RegExp("^"+c.name+"(?:[\\s\\/]|$)","i"));var i=G[c.name],j=c.next,k=c.next+1;for(;k<h;k++)if(b[k-1]==="</"&&i.test(b[k]))break;k<h&&(k-=1);var l=b.slice(j,k).join("");if(c.eflags&a.eflags.CDATA)d.cdata&&d.cdata(l,e,f,B(d,b,k,g,e));else{if(!(c.eflags&a.eflags.RCDATA))throw new Error("bug");d.rcdata&&d.rcdata(u(l),e,f,B(d,b,k,g,e))}return k}function I(b,c){var d=/^([\w:]+)/.exec(b[c]),e={};e.name=d[1].toLowerCase(),e.eflags=a.ELEMENTS[e.name];var f=b[c].substr(d[0].length),g=c+1,h=b.length;for(;g<h;g++){if(b[g]===">")break;f+=b[g]}if(h<=g)return void 0;var i=[];while(f!==""){d=v.exec(f);if(!d)f=f.replace(/^[\s\S][^a-z\s]*/,"");else{if(d[4]&&!d[5]||d[6]&&!d[7]){var j=d[4]||d[6],k=!1,l=[f,b[g++]];for(;g<h;g++){if(k){if(b[g]===">")break}else 0<=b[g].indexOf(j)&&(k=!0);l.push(b[g])}if(h<=g)break;f=l.join("");continue}var m=d[1].toLowerCase(),n=d[2]?J(d[3]):m;i.push(m,n),f=f.substr(d[0].length)}}return e.attrs=i,e.next=g+1,e}function J(a){var b=a.charCodeAt(0);if(b===34||b===39)a=a.substr(1,a.length-2);return n(k(a))}function K(b){var c,d,e=function(a,b){d||b.push(a)};return y({startDoc:function(a){c=[],d=!1},startTag:function(e,f,g){if(d)return;if(!a.ELEMENTS.hasOwnProperty(e))return;var h=a.ELEMENTS[e];if(h&a.eflags.FOLDABLE)return;f=b(e,f);if(!f){d=!(h&a.eflags.EMPTY);return}h&a.eflags.EMPTY||c.push(e),g.push("<",e);for(var i=0,j=f.length;i<j;i+=2){var k=f[i],l=f[i+1];l!==null&&l!==void 0&&g.push(" ",k,'="',t(l),'"')}g.push(">")},endTag:function(b,e){if(d){d=!1;return}if(!a.ELEMENTS.hasOwnProperty(b))return;var f=a.ELEMENTS[b];if(!(f&(a.eflags.EMPTY|a.eflags.FOLDABLE))){var g;if(f&a.eflags.OPTIONAL_ENDTAG)for(g=c.length;--g>=0;){var h=c[g];if(h===b)break;if(!(a.ELEMENTS[h]&a.eflags.OPTIONAL_ENDTAG))return}else for(g=c.length;--g>=0;)if(c[g]===b)break;if(g<0)return;for(var i=c.length;--i>g;){var h=c[i];a.ELEMENTS[h]&a.eflags.OPTIONAL_ENDTAG||e.push("</",h,">")}c.length=g,e.push("</",b,">")}},pcdata:e,rcdata:e,cdata:e,endDoc:function(a){for(;c.length;c.length--)a.push("</",c[c.length-1],">")}})}function N(a,b,c,d,e){if(!e)return null;var f=(""+a).match(L);return f&&(!f[1]||M.test(f[1]))?e(a,b,c,d):null}function O(a,b,c,d,e){c||a(b+" removed",{change:"removed",tagName:b});if(d!==e){var f="changed";d&&!e?f="removed":!d&&e&&(f="added"),a(b+"."+c+" "+f,{change:f,tagName:b,attribName:c,oldValue:d,newValue:e})}}function P(a,b,c){var d;return d=b+"::"+c,a.hasOwnProperty(d)?a[d]:(d="*::"+c,a.hasOwnProperty(d)?a[d]:void 0)}function Q(b,c){return P(a.ATTRIBS,b,c)}function R(b,c){return P(a.LOADERTYPES,b,c)}function S(b,c){return P(a.URIEFFECTS,b,c)}function T(e,f,g,h,i){for(var j=0;j<f.length;j+=2){var k=f[j],l=f[j+1],m=l,n=null,o;if((o=e+"::"+k,a.ATTRIBS.hasOwnProperty(o))||(o="*::"+k,a.ATTRIBS.hasOwnProperty(o)))n=a.ATTRIBS[o];if(n!==null)switch(n){case a.atype.NONE:break;case a.atype.SCRIPT:l=null,i&&O(i,e,k,m,l);break;case a.atype.STYLE:if("undefined"==typeof b){l=null,i&&O(i,e,k,m,l);break}var p=[];b(l,{declaration:function(b,e){var f=b.toLowerCase(),h=d[f];if(!h)return;c(f,h,e,g?function(b){return N(b,a.ueffects.SAME_DOCUMENT,a.ltypes.SANDBOXED,{TYPE:"CSS",CSS_PROP:f},g)}:null),p.push(b+": "+e.join(" "))}}),l=p.length>0?p.join(" ; "):null,i&&O(i,e,k,m,l);break;case a.atype.ID:case a.atype.IDREF:case a.atype.IDREFS:case a.atype.GLOBAL_NAME:case a.atype.LOCAL_NAME:case a.atype.CLASSES:l=h?h(l):l,i&&O(i,e,k,m,l);break;case a.atype.URI:l=N(l,S(e,k),R(e,k),{TYPE:"MARKUP",XML_ATTR:k,XML_TAG:e},g),i&&O(i,e,k,m,l);break;case a.atype.URI_FRAGMENT:l&&"#"===l.charAt(0)?(l=l.substring(1),l=h?h(l):l,l!==null&&l!==void 0&&(l="#"+l)):l=null,i&&O(i,e,k,m,l);break;default:l=null,i&&O(i,e,k,m,l)}else l=null,i&&O(i,e,k,m,l);f[j+1]=l}return f}function U(b,c,d){return function(e,f){if(!(a.ELEMENTS[e]&a.eflags.UNSAFE))return T(e,f,b,c,d);d&&O(d,e,undefined,undefined,undefined)}}function V(a,b){var c=[];return K(b)(a,c),c.join("")}function W(a,b,c,d){var e=U(b,c,d);return V(a,e)}var b,c,d;"undefined"!=typeof window&&(b=window.parseCssDeclarations,c=window.sanitizeCssProperty,d=window.cssSchema);var e={lt:"<",gt:">",amp:"&",nbsp:" ",quot:'"',apos:"'"},f=/^#(\d+)$/,g=/^#x([0-9A-Fa-f]+)$/,j=/\0/g,l=/&(#[0-9]+|#[xX][0-9A-Fa-f]+|\w+);/g,m=/^(#[0-9]+|#[xX][0-9A-Fa-f]+|\w+);/,o=/&/g,p=/&([^a-z#]|#(?:[^0-9x]|x(?:[^0-9a-f]|$)|$)|$)/gi,q=/[<]/g,r=/>/g,s=/\"/g,v=new RegExp("^\\s*([-.:\\w]+)(?:\\s*(=)\\s*((\")[^\"]*(\"|$)|(')[^']*('|$)|(?=[a-z][-\\w]*\\s*=)|[^\"'\\s]*))?","i"),w="a,b".split(/(,)/).length===3,x=a.eflags.CDATA|a.eflags.RCDATA,z={},G={},L=new RegExp("^(?:([^:/?# ]+):)?"),M=/^(?:https?|mailto)$/i,X={};return X.escapeAttrib=X.escapeAttrib=t,X.makeHtmlSanitizer=X.makeHtmlSanitizer=K,X.makeSaxParser=X.makeSaxParser=y,X.makeTagPolicy=X.makeTagPolicy=U,X.normalizeRCData=X.normalizeRCData=u,X.sanitize=X.sanitize=W,X.sanitizeAttribs=X.sanitizeAttribs=T,X.sanitizeWithPolicy=X.sanitizeWithPolicy=V,X.unescapeEntities=X.unescapeEntities=n,X}(html4),html_sanitize=html.sanitize;typeof window!="undefined"&&(window.html=html,window.html_sanitize=html_sanitize),html4.ATTRIBS["*::style"]=0,html4.ELEMENTS.style=0,wax=wax||{},wax.attribution=function(){function c(a){if(/^(https?:\/\/|data:image)/.test(a))return a}function d(a){return a}var a,b={};return b.set=function(b){if(typeof b=="undefined")return;return a.innerHTML=html_sanitize(b,c,d),this},b.element=function(){return a},b.init=function(){return a=document.createElement("div"),a.className="wax-attribution",this},b.init()},wax=wax||{},wax.bwdetect=function(a,b){function h(){wax.bw=-1;var a=new Image;a.src=e;var b=!0,f=setTimeout(function(){b&&wax.bw==-1&&(c.bw(0),b=!1)},d);a.onload=function(){b&&wax.bw==-1&&(clearTimeout(f),c.bw(1),b=!1)}}var c={},d=a.threshold||400,e="http://a.tiles.mapbox.com/mapbox/1.0.0/blue-marble-topo-bathy-jul/0/0/0.png?preventcache="+ +(new Date),f=1,g=a.auto===undefined?!0:a.auto;return c.bw=function(a){if(!arguments.length)return f;var c=f;wax.bwlisteners&&wax.bwlisteners.length&&function(){listeners=wax.bwlisteners,wax.bwlisteners=[];for(i=0;i<listeners;i++)listeners[i](a)}(),wax.bw=a,f!=(f=a)&&b(a)},c.add=function(){return g&&h(),this},wax.bw==-1?(wax.bwlisteners=wax.bwlisteners||[],wax.bwlisteners.push(c.bw)):wax.bw!==undefined?c.bw(wax.bw):c.add(),c},wax.formatter=function(x){function urlX(a){if(/^(https?:\/\/|data:image)/.test(a))return a}function idX(a){return a}var formatter={},f;if(x&&typeof x=="string")try{eval("f = "+x)}catch(e){console&&console.log(e)}else x&&typeof x=="function"?f=x:f=function(){};return formatter.format=function(a,b){try{return html_sanitize(f(a,b),urlX,idX)}catch(c){console&&console.log(c)}},formatter},wax.GridInstance=function(a,b,c){function g(a){return a>=93&&a--,a>=35&&a--,a-=32,a}c=c||{};var d={},e=c.resolution||4,f=c.tileSize||256;return d.grid_tile=function(){return a},d.getKey=function(b,c){if(!a||!a.grid)return;if(c<0||b<0)return;if(Math.floor(c)>=f||Math.floor(b)>=f)return;return g(a.grid[Math.floor(c/e)].charCodeAt(Math.floor(b/e)))},d.gridFeature=function(b,c){var d=this.getKey(b,c),e=a.keys;if(e&&e[d]&&a.data[e[d]])return a.data[e[d]]},d.tileFeature=function(c,d,e,f){if(!a)return;var g=wax.util.offset(e);feature=this.gridFeature(c-g.left,d-g.top);if(feature)return b.format(f,feature)},d},wax.GridManager=function(a){function h(a){return typeof a=="string"&&(a=[a]),function(c){if(!c)return;var d=/(\d+)\/(\d+)\/(\d+)\.[\w\._]+/g.exec(c);if(!d)return;return a[parseInt(d[2],10)%a.length].replace("{z}",d[1]).replace("{x}",d[2]).replace("{y}",d[3])}}a=a||{};var b=a.resolution||4,c=a.version||"1.1",d={},e={},f,g=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")};return e.formatter=function(a){return arguments.length?(f=wax.formatter(a),e):f},e.template=function(a){return arguments.length?(f=wax.template(a),e):f},e.gridUrl=function(a){return arguments.length?(g=typeof a=="function"?a:h(a),e):g},e.getGrid=function(a,c){var d=g(a);return!f||!d?c(null,null):(wax.request.get(d,function(a,d){if(a)return c(a,null);c(null,wax.GridInstance(d,f,{resolution:b||4}))}),e)},e.add=function(a){return a.template?e.template(a.template):a.formatter&&e.formatter(a.formatter),a.grids&&e.gridUrl(a.grids),this},e.add(a)},wax=wax||{},wax.hash=function(a){function b(){return location.hash.substring(1)}function c(a){location.hash="#"+a}function g(b){var c=b.split("/");for(var d=0;d<c.length;d++){c[d]=Number(c[d]);if(isNaN(c[d]))return!0}if(c.length<3)return!0;c.length==3&&a.setCenterZoom(c)}function h(){var b=a.getCenterZoom();d!==b&&(d=b,c(d))}function i(a){if(a===d)return;g(d=a)&&h()}a=a||{};var d,e={},f=90-1e-8,j=wax.util.throttle(h,500);return e.add=function(){return i(b()),a.bindChange(j),this},e.remove=function(){return a.unbindChange(j),this},e.add()};var wax=wax||{};wax.legend=function(){function d(a){if(/^(https?:\/\/|data:image)/.test(a))return a}function e(a){return a}var a,b={},c;return b.element=function(){return c},b.content=function(b){return arguments.length?(b?(a.innerHTML=html_sanitize(b,d,e),a.style.display="block"):(a.innerHTML="",a.style.display="none"),this):a.innerHTML},b.add=function(){return c=document.createElement("div"),c.className="wax-legends",a=document.createElement("div"),a.className="wax-legend",a.style.display="none",c.appendChild(a),this},b.add()};var w=function(a){return a.melt=function(b,c){return b.apply(c,[a,c])},a},wax=wax||{};wax.movetip={},wax.movetip=function(a){function g(a){return a&&a.className.indexOf("wax-popup")!==-1}function h(a,b){var c=document.createElement("div");return c.className="wax-movetip",c.style.cssText="position:absolute;",c.innerHTML=a,b.appendChild(c),d=b,_tooltipOffset=wax.util.offset(c),_contextOffset=wax.util.offset(d),c}function i(a){if(!c)return;var b=wax.util.eventoffset(a);c.className="wax-movetip",_tooltipOffset.height+b.y>_contextOffset.top+_contextOffset.height&&_contextOffset.height>_tooltipOffset.height&&(b.y-=_tooltipOffset.height,c.className+=" flip-y"),_tooltipOffset.width+b.x>_contextOffset.left+_contextOffset.width&&(b.x-=_tooltipOffset.width,c.className+=" flip-x"),c.style.left=b.x+"px",c.style.top=b.y+"px"}function j(a){if(!a)return;var b,c=function(){this.parentNode&&this.parentNode.removeChild(this)};a.style["-webkit-transition"]!==undefined&&e?b="webkitTransitionEnd":a.style.MozTransition!==undefined&&e&&(b="transitionend"),b?(a.addEventListener(b,c,!1),a.addEventListener("transitionend",c,!1),a.className+=" "+e):a.parentNode&&a.parentNode.removeChild(a)}function k(a,b){c&&(j(c),c=undefined);var d=h(a,b);d.className+=" wax-popup",d.innerHTML=a;var e=document.createElement("a");e.href="#close",e.className="close",e.innerHTML="Close",d.appendChild(e);var f=function(a){return j(d),c=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(),!1};e.addEventListener?e.addEventListener("click",f,!1):e.attachEvent&&e.attachEvent("onclick",f),c=d}a=a||{};var b={},c=undefined,d=undefined,e=a.animationOut,f=a.animationIn;return b.over=function(a,b,d){if(!a)return;b.style.cursor="pointer";if(g(c))return;c=h(a,b),i(d),b.addEventListener&&b.addEventListener("mousemove",i)},b.out=function(a){a.style.cursor="default";if(g(c))return;c&&(j(c),a.removeEventListener&&a.removeEventListener("mousemove",i),c=undefined)},b};var wax=wax||{};wax.request={cache:{},locks:{},promises:{},get:function(a,b){if(this.cache[a])return b(this.cache[a][0],this.cache[a][1]);this.promises[a]=this.promises[a]||[],this.promises[a].push(b);if(this.locks[a])return;var c=this;this.locks[a]=!0,reqwest({url:a+(~a.indexOf("?")?"&":"?")+"callback=grid",type:"jsonp",jsonpCallback:"callback",success:function(b){c.locks[a]=!1,c.cache[a]=[null,b];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])},error:function(b){c.locks[a]=!1,c.cache[a]=[b,null];for(var d=0;d<c.promises[a].length;d++)c.promises[a][d](c.cache[a][0],c.cache[a][1])}})}},wax.template=function(a){function c(a){if(/^(https?:\/\/|data:image)/.test(a))return a}function d(a){return a}var b={};return b.format=function(b,e){var f={};for(var g in e)f[g]=e[g];return b.format&&(f["__"+b.format+"__"]=!0),html_sanitize(Mustache.to_html(a,f),c,d)},b};if(!wax)var wax={};wax.tilejson=function(a,b){reqwest({url:a+(~a.indexOf("?")?"&":"?")+"callback=grid",type:"jsonp",jsonpCallback:"callback",success:b,error:b})};var wax=wax||{};wax.tooltip={},wax.tooltip=function(a){this._currentTooltip=undefined,a=a||{},a.animationOut&&(this.animationOut=a.animationOut),a.animationIn&&(this.animationIn=a.animationIn)},wax.tooltip.prototype.isPopup=function(a){return a&&a.className.indexOf("wax-popup")!==-1},wax.tooltip.prototype.getTooltip=function(a,b){var c=document.createElement("div");return c.className="wax-tooltip wax-tooltip-0",c.innerHTML=a,b.appendChild(c),c},wax.tooltip.prototype.hideTooltip=function(a){if(!a)return;var b,c=function(){this.parentNode&&this.parentNode.removeChild(this)};a.style["-webkit-transition"]!==undefined&&this.animationOut?b="webkitTransitionEnd":a.style.MozTransition!==undefined&&this.animationOut&&(b="transitionend"),b?(a.addEventListener(b,c,!1),a.addEventListener("transitionend",c,!1),a.className+=" "+this.animationOut):a.parentNode&&a.parentNode.removeChild(a)},wax.tooltip.prototype.click=function(a,b){this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined);var c=this.getTooltip(a,b);c.className+=" wax-popup",c.innerHTML=a;var d=document.createElement("a");d.href="#close",d.className="close",d.innerHTML="Close",c.appendChild(d);var e=wax.util.bind(function(a){return this.hideTooltip(c),this._currentTooltip=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(),!1},this);d.addEventListener?(d.addEventListener("click",e,!1),d.addEventListener("touchend",e,!1)):d.attachEvent&&d.attachEvent("onclick",e),this._currentTooltip=c},wax.tooltip.prototype.over=function(a,b){if(!a)return;b.style.cursor="pointer";if(this.isPopup(this._currentTooltip))return;this._currentTooltip=this.getTooltip(a,b)},wax.tooltip.prototype.out=function(a){a.style.cursor="default";if(this.isPopup(this._currentTooltip))return;this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined)};var wax=wax||{};wax.util=wax.util||{},wax.util={offset:function(a){var b=a.offsetWidth||parseInt(a.style.width,10),c=a.offsetHeight||parseInt(a.style.height,10),d=document.body,e=0,f=0,g=function(a){if(a===d||a===document.documentElement)return;e+=a.offsetTop,f+=a.offsetLeft;var b=a.style.transform||a.style.WebkitTransform||a.style.OTransform||a.style.MozTransform||a.style.msTransform;if(b)if(match=b.match(/translate\((.+)px, (.+)px\)/))e+=parseInt(match[2],10),f+=parseInt(match[1],10);else if(match=b.match(/translate3d\((.+)px, (.+)px, (.+)px\)/))e+=parseInt(match[2],10),f+=parseInt(match[1],10);else if(match=b.match(/matrix3d\(([\-\d,\s]+)\)/)){var c=match[1].split(",");e+=parseInt(c[13],10),f+=parseInt(c[12],10)}else if(match=b.match(/matrix\(.+, .+, .+, .+, (.+), (.+)\)/))e+=parseInt(match[2],10),f+=parseInt(match[1],10)};g(a);try{while(a=a.offsetParent)g(a)}catch(h){}e+=d.offsetTop,f+=d.offsetLeft,e+=d.parentNode.offsetTop,f+=d.parentNode.offsetLeft;var i=document.defaultView?window.getComputedStyle(d.parentNode,null):d.parentNode.currentStyle;return d.parentNode.offsetTop!==parseInt(i.marginTop,10)&&!isNaN(parseInt(i.marginTop,10))&&(e+=parseInt(i.marginTop,10),f+=parseInt(i.marginLeft,10)),{top:e,left:f,height:c,width:b}},$:function(a){return typeof a=="string"?document.getElementById(a):a},bind:function(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){return a.apply(b,c.concat(Array.prototype.slice.call(arguments)))}},isString:function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},indexOf:function(a,b){var c=Array.prototype.indexOf;if(a===null)return-1;var d,e;if(c&&a.indexOf===c)return a.indexOf(b);for(d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},isArray:Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"},keys:Object.keys||function(a){var b=Object.prototype.hasOwnProperty;if(a!==Object(a))throw new TypeError("Invalid object");var c=[];for(var d in a)b.call(a,d)&&(c[c.length]=d);return c},eventoffset:function(a){var b=0,c=0;if(!a)var a=window.event;if(a.pageX||a.pageY)return{x:a.pageX,y:a.pageY};if(a.clientX||a.clientY){var d=document.documentElement,e=document.body,f=document.body.parentNode.currentStyle,g=parseInt(f.marginTop,10)||0,h=parseInt(f.marginLeft,10)||0;return{x:a.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0)+h,y:a.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)+g}}if(a.touches&&a.touches.length===1)return{x:a.touches[0].pageX,y:a.touches[0].pageY}},limit:function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,a.apply(e,f)};c&&clearTimeout(d);if(c||!d)d=setTimeout(g,b)}},throttle:function(a,b){return this.limit(a,b,!1)}},wax=wax||{},wax.mm=wax.mm||{},wax.mm.attribution=function(a,b){b=b||{};var c,d={};return d.element=function(){return c.element()},d.appendTo=function(a){return wax.util.$(a).appendChild(c.element()),this},d.init=function(){return c=wax.attribution(),c.set(b.attribution),c.element().className="wax-attribution wax-mm",this},d.init()},wax=wax||{},wax.mm=wax.mm||{},wax.mm.boxselector=function(a,b,c){function k(b){var c=new MM.Point(b.clientX,b.clientY);c.x+=document.body.scrollLeft+document.documentElement.scrollLeft,c.y+=document.body.scrollTop+document.documentElement.scrollTop;for(var d=a.parent;d;d=d.offsetParent)c.x-=d.offsetLeft,c.y-=d.offsetTop;return c}function l(b){if(!b.shiftKey)return;return d=k(b),f.style.left=d.x+"px",f.style.top=d.y+"px",g(a.parent,"mousemove",m),g(a.parent,"mouseup",n),a.parent.style.cursor="crosshair",MM.cancelEvent(b)}function m(a){var b=k(a),c=f.style;return c.display="block",b.x<d.x?c.left=b.x+"px":c.left=d.x+"px",b.y<d.y?c.top=b.y+"px":c.top=d.y+"px",c.width=Math.abs(b.x-d.x)+"px",c.height=Math.abs(b.y-d.y)+"px",MM.cancelEvent(a)}function n(b){var c=k(b),e=a.pointLocation(c),f=a.pointLocation(d);j.extent([new MM.Location(Math.max(e.lat,f.lat),Math.min(e.lon,f.lon)),new MM.Location(Math.min(e.lat,f.lat),Math.max(e.lon,f.lon))]),h(a.parent,"mousemove",m),h(a.parent,"mouseup",n),a.parent.style.cursor="auto"}function o(a,b){if(!f||!i)return;var c=a.locationPoint(i[1]),d=a.locationPoint(i[0]),e=f.style;e.display="block",e.height="auto",e.width="auto",e.left=Math.max(0,d.x)+"px",e.top=Math.max(0,d.y)+"px",e.right=Math.max(0,a.dimensions.x-c.x)+"px",e.bottom=Math.max(0,a.dimensions.y-c.y)+"px"}var d=null,e=typeof c=="function"?c:c.callback,f,g=MM.addEvent,h=MM.removeEvent,i,j={};return j.extent=function(b,c){if(!b)return i;i=[new MM.Location(Math.max(b[0].lat,b[1].lat),Math.min(b[0].lon,b[1].lon)),new MM.Location(Math.min(b[0].lat,b[1].lat),Math.max(b[0].lon,b[1].lon))],o(a),c||e(i)},j.add=function(a){return f=f||document.createElement("div"),f.id=a.parent.id+"-boxselector-box",f.className="boxselector-box",a.parent.appendChild(f),g(a.parent,"mousedown",l),a.addCallback("drawn",o),this},j.remove=function(){a.parent.removeChild(f),h(a.parent,"mousedown",l),a.removeCallback("drawn",o)},j.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax._={},wax.mm.bwdetect=function(a,b){b=b||{};var c=b.png||".png128",d=b.jpg||".jpg70",e=!1;return wax._.bw_png=c,wax._.bw_jpg=d,wax.bwdetect(b,function(b){wax._.bw=!b;for(var c=0;c<a.layers.length;c++)a.getLayerAt(c).provider instanceof wax.mm.connector&&a.getLayerAt(c).setProvider(a.getLayerAt(c).provider)})},wax=wax||{},wax.mm=wax.mm||{},wax.mm.fullscreen=function(a){function g(a){a&&MM.cancelEvent(a),b?c.original():c.full()}function h(b,c){a.dimensions=new MM.Point(b,c),a.parent.style.width=Math.round(a.dimensions.x)+"px",a.parent.style.height=Math.round(a.dimensions.y)+"px",a.dispatchCallback("resized",a.dimensions)}var b=!1,c={},d,e=document.body,f;return c.add=function(a){return d=document.createElement("a"),d.className="wax-fullscreen",d.href="#fullscreen",d.innerHTML="fullscreen",MM.addEvent(d,"click",g),this},c.full=function(){if(b)return;b=!0,f=[a.parent.offsetWidth,a.parent.offsetHeight],a.parent.className+=" wax-fullscreen-map",e.className+=" wax-fullscreen-view",h(a.parent.offsetWidth,a.parent.offsetHeight)},c.original=function(){if(!b)return;b=!1,a.parent.className=a.parent.className.replace(" wax-fullscreen-map",""),e.className=e.className.replace(" wax-fullscreen-view",""),h(f[0],f[1])},c.appendTo=function(a){return wax.util.$(a).appendChild(d),this},c.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.hash=function(a){return wax.hash({getCenterZoom:function(){var b=a.getCenter(),c=a.getZoom(),d=Math.max(0,Math.ceil(Math.log(c)/Math.LN2));return[c.toFixed(2),b.lat.toFixed(d),b.lon.toFixed(d)].join("/")},setCenterZoom:function(c){a.setCenterZoom(new MM.Location(c[1],c[2]),c[0])},bindChange:function(b){a.addCallback("drawn",b)},unbindChange:function(b){a.removeCallback("drawn",b)}})},wax=wax||{},wax.mm=wax.mm||{},wax.mm.interaction=function(a,b,c){function t(){var b=a.getLayerAt(0).levels[Math.round(a.getZoom())];return r||(r=function(a){var c=[];for(var d in a)if(a[d].parentNode===b){var e=wax.util.offset(a[d]);c.push([e.top,e.left,a[d]])}return c}(a.getLayerAt(0).tiles))}function u(a,b){r=null}function v(a){for(var b=0,c=t();b<c.length;b++)if(c[b][0]<a.y&&c[b][0]+256>a.y&&c[b][1]<a.x&&c[b][1]+256>a.x)return c[b][2];return!1}function w(){return m?(window.clearTimeout(m),m=null,!0):!1}function x(b){if(l)return;var c=b.target||b.srcElement;if(c.className!=="map-tile-loaded")return;var f=h(b),g=v(f),i;g&&d.getGrid(g.src,function(c,d){if(c||!d)return;i=d.tileFeature(f.x,f.y,g,{format:"teaser"}),i?i&&o!==i?(o=i,e.out(a.parent),e.over(i,a.parent,b)):i||(o=null,e.out(a.parent)):(o=null,e.out(a.parent))})}function y(b){if(b.target.className!=="map-tile-loaded")return;if(w())return;l=!0,p=h(b),b.type==="mousedown"?i(document.body,"mouseup",A):b.type==="touchstart"&&b.touches.length===1&&(f=["full","teaser"],e._currentTooltip&&e.hideTooltip(e._currentTooltip),i(a.parent,"touchend",A),i(a.parent,"touchmove",z),i(a.parent,"touchcancel",z))}function z(){j(a.parent,"touchend",A),j(a.parent,"touchmove",A),j(a.parent,"touchcancel",z),l=!1}function A(b){var c={},d=h(b);l=!1;for(var e in b)c[e]=b[e];return j(document.body,"mouseup",A),n&&(j(a.parent,"touchend",A),j(a.parent,"touchmove",z),j(a.parent,"touchcancel",z)),b.type==="touchend"?B(b,p):Math.round(d.y/q)===Math.round(p.y/q)&&Math.round(d.x/q)===Math.round(p.x/q)&&(m=window.setTimeout(function(){m=null,B(c,d)},300)),A}function B(b,c){var h=v(c),i;h&&d.getGrid(h.src,function(d,j){for(var k=0;j&&k<f.length;k++){i=j.tileFeature(c.x,c.y,h,{format:f[k]});if(i)switch(f[k]){case"full":case"teaser":return e.click(i,a.parent,b);case"location":return g(i)}}})}c=c||{},b=b||{};var d=wax.GridManager(b),e=c.callbacks||new wax.tooltip(c),f=c.clickAction||["full","location"],g=c.clickHandler||function(a){window.top.location=a},h=wax.util.eventoffset,i=MM.addEvent,j=MM.removeEvent,k={},l=!1,m=!1,n="ontouchstart"in document.documentElement,o,p,q=4,r,s=["zoomed","panned","centered","extentset","resized","drawn"];return k.add=function(){for(var b=0;b<s.length;b++)a.addCallback(s[b],u);return i(a.parent,"mousemove",x),i(a.parent,"mousedown",y),n&&i(a.parent,"touchstart",y),this},k.remove=function(){for(var b=0;b<s.length;b++)a.removeCallback(s[b],u);return j(a.parent,"mousemove",x),j(a.parent,"mousedown",y),n&&j(a.parent,"touchstart",y),e._currentTooltip&&e.hideTooltip(e._currentTooltip),this},k.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.latlngtooltip=function(a){function e(b){var c=new MM.Point(b.clientX,b.clientY);c.x+=document.body.scrollLeft+document.documentElement.scrollLeft,c.y+=document.body.scrollTop+document.documentElement.scrollTop;for(var d=a.parent;d;d=d.offsetParent)c.x-=d.offsetLeft,c.y-=d.offsetTop;return c}function f(a){console.log("here"),c=!0}function g(a){c=!1}function h(d){if(!d.shiftKey||c){b.parentNode===a.parent&&a.parent.removeChild(b);return}var f=e(d),g=a.pointLocation(f),h=g.lat.toFixed(2)+", "+g.lon.toFixed(2);b.innerHTML=h,f.scale=f.width=f.height=1,f.x+=10,MM.moveElement(b,f),a.parent.appendChild(b)}var b,c=!1,d={};return d.add=function(){return MM.addEvent(a.parent,"mousemove",h),MM.addEvent(a.parent,"mousedown"
,f),MM.addEvent(a.parent,"mouseup",g),b=document.createElement("div"),b.className="wax-latlngtooltip",this},d.remove=function(){return MM.removeEvent(a.parent,"mousemove",h),MM.removeEvent(a.parent,"mousedown",f),MM.removeEvent(a.parent,"mouseup",g),this},d.add()},wax=wax||{},wax.mm=wax.mm||{},wax.mm.legend=function(a,b){b=b||{};var c,d={};return d.add=function(){return c=wax.legend().content(b.legend||""),this},d.content=function(a){a&&c.content(a.legend||"")},d.element=function(){return c.element()},d.appendTo=function(a){return wax.util.$(a).appendChild(c.element()),this},d.add()},wax=wax||{},wax.mm=wax.mm||{},wax.mm.mobile=function(a,b,c){function i(){return(Math.abs(window.orientation)==90?Math.max(480,screen.height):screen.width)/window.innerWidth}c=c||{};var d=navigator.userAgent.toLowerCase(),e=d.indexOf("webkit")!=-1,f=d.indexOf("mobile")!=-1,g=f&&e,h=function(a){var b=document.createElement("canvas"),c=parseInt(a.style.width,10),d=parseInt(a.style.height,10),e=c/2,f=d/2,g=Math.min(c,d)/4,h=b.getContext("2d");b.setAttribute("width",c),b.setAttribute("height",d),h.globalAlpha=.7;var i=h.createLinearGradient(0,0,300,225);i.addColorStop(0,"black"),i.addColorStop(1,"rgb(144, 144, 144)"),h.fillStyle=i,h.fillRect(0,0,c,d),h.beginPath(),h.arc(e-g*.3,f,g*1.3,g*1.3,Math.PI*2,!0),h.closePath(),h.fillStyle="rgb(100, 100, 100)",h.fill(),h.fillStyle="rgb(255, 255, 255)",h.lineWidth=5,h.beginPath(),h.moveTo(e-g*.8,f-g),h.lineTo(e-g*.8,f+g),h.lineTo(e+g*.8,f),h.fill(),a.appendChild(b)},j=function(a){a.style.position="absolute",a.style.height="50px",a.style.left=a.style.right="0";var b=document.createElement("canvas");b.setAttribute("width",a.offsetWidth),b.setAttribute("height",a.offsetHeight);var c=b.getContext("2d");c.globalAlpha=1,c.fillStyle="rgba(255, 255, 255, 0.5)",c.fillRect(0,0,a.offsetWidth,a.offsetHeight),c.fillStyle="rgb(0, 0, 0)",c.font="bold 20px sans-serif",c.fillText("back",20,30),a.appendChild(b)},k=function(a){a.style.position="absolute",a.style.width=a.style.height="auto",a.style.top=window.pageYOffset+"px",a.style.left=a.style.right="0px"},l=function(a){a.style.position="relative",a.style.width=a.style.height=a.style.top=a.style.left=a.style.right="auto"},m,n,o,p,q,r=c.overlayDraw||h,s=c.backDraw||j;bodyDraw=c.bodyDraw||function(){};var t={add:function(a){return g&&(p=document.createElement("meta"),p.id="wax-touch",p.setAttribute("name","viewport"),m=document.createElement("div"),m.id=a.parent.id+"-mobileoverlay",m.className="wax-mobileoverlay",m.style.position="absolute",m.style.width=a.dimensions.x+"px",m.style.height=a.dimensions.y+"px",a.parent.appendChild(m),r(m),o=document.createElement("div"),backDiv=document.createElement("div"),n=document.body,newBody=document.createElement("body"),newBody.className="wax-mobile-body",newBody.appendChild(backDiv),MM.addEvent(m,"touchstart",this.toTouch),MM.addEvent(backDiv,"touchstart",this.toPage)),this},toTouch:function(){a.parent.parentNode.replaceChild(o,a.parent),newBody.insertBefore(a.parent,backDiv),document.body=newBody,q=i(),document.head.appendChild(p),bodyDraw(newBody),s(backDiv),p.setAttribute("content","initial-scale=1.0,minimum-scale=0, maximum-scale=10"),a._smallSize=[a.parent.clientWidth,a.parent.clientHeight],k(a.parent),a.setSize(a.parent.offsetWidth,window.innerHeight),backDiv.style.display="block",m.style.display="none"},toPage:function(){document.body=n,p.setAttribute("content","user-scalable=yes, width=device-width,initial-scale="+q),o.parentNode.replaceChild(a.parent,o),l(a.parent),a.setSize(a._smallSize[0],a._smallSize[1]),backDiv.style.display="none",m.style.display="block"}};return t.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.pointselector=function(a,b,c){function k(b){var c=wax.util.eventoffset(b),d=new MM.Point(c.x,c.y),e={x:parseFloat(MM.getStyle(document.documentElement,"margin-left")),y:parseFloat(MM.getStyle(document.documentElement,"margin-top"))};isNaN(e.x)||(d.x-=e.x),isNaN(e.y)||(d.y-=e.y);for(var f=a.parent;f;f=f.offsetParent)d.x-=f.offsetLeft,d.y-=f.offsetTop;return d}function l(a){var b=[];for(var c=0;c<a.length;c++)b.push(new MM.Location(a[c].lat,a[c].lon));return b}function m(){var b=new MM.Point(0,0);for(var c=0;c<i.length;c++){var d=a.locationPoint(i[c]);i[c].pointDiv||(i[c].pointDiv=document.createElement("div"),i[c].pointDiv.className="wax-point-div",i[c].pointDiv.style.position="absolute",i[c].pointDiv.style.display="block",i[c].pointDiv.location=i[c],MM.addEvent(i[c].pointDiv,"mouseup",function(d){var e=i[c];return function(b){MM.removeEvent(a.parent,"mouseup",o),h.deleteLocation(e,b)}}()),a.parent.appendChild(i[c].pointDiv)),i[c].pointDiv.style.left=d.x+"px",i[c].pointDiv.style.top=d.y+"px"}}function n(b){d=k(b),MM.addEvent(a.parent,"mouseup",o)}function o(b){if(!d)return;e=k(b),MM.Point.distance(d,e)<f&&(h.addLocation(a.pointLocation(d)),j(l(i))),d=null}var d=null,e=null,f=5,g,h={},i=[],j=typeof c=="function"?c:c.callback;return h.addLocation=function(a){i.push(a),m(),j(l(i))},h.locations=function(a){return i},h.add=function(a){return MM.addEvent(a.parent,"mousedown",n),a.addCallback("drawn",m),this},h.remove=function(a){MM.removeEvent(a.parent,"mousedown",n),a.removeCallback("drawn",m);for(var b=i.length-1;b>-1;b--)h.deleteLocation(i[b]);return this},h.deleteLocation=function(a,b){if(!b||confirm("Delete this point?"))a.pointDiv.parentNode.removeChild(a.pointDiv),i.splice(wax.util.indexOf(i,a),1),j(l(i))},h.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.zoombox=function(a){function f(b){var c=new MM.Point(b.clientX,b.clientY);c.x+=document.body.scrollLeft+document.documentElement.scrollLeft,c.y+=document.body.scrollTop+document.documentElement.scrollTop;for(var d=a.parent;d;d=d.offsetParent)c.x-=d.offsetLeft,c.y-=d.offsetTop;return c}function g(b){if(!c)return;c=!1;var h=f(b),j=a.pointLocation(h),k=a.pointLocation(e);a.setExtent([j,k]),d.style.display="none",MM.removeEvent(a.parent,"mousemove",i),MM.removeEvent(a.parent,"mouseup",g),a.parent.style.cursor="auto"}function h(b){if(!b.shiftKey||!!this.drawing)return;return c=!0,e=f(b),d.style.left=e.x+"px",d.style.top=e.y+"px",MM.addEvent(a.parent,"mousemove",i),MM.addEvent(a.parent,"mouseup",g),a.parent.style.cursor="crosshair",MM.cancelEvent(b)}function i(a){if(!c)return;var b=f(a);return d.style.display="block",b.x<e.x?d.style.left=b.x+"px":d.style.left=e.x+"px",d.style.width=Math.abs(b.x-e.x)+"px",b.y<e.y?d.style.top=b.y+"px":d.style.top=e.y+"px",d.style.height=Math.abs(b.y-e.y)+"px",MM.cancelEvent(a)}var b={},c=!1,d,e=null;return b.add=function(a){return d=d||document.createElement("div"),d.id=a.parent.id+"-zoombox-box",d.className="zoombox-box",a.parent.appendChild(d),MM.addEvent(a.parent,"mousedown",h),this},b.remove=function(){a.parent.removeChild(d),MM.removeEvent(a.parent,"mousedown",h)},b.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.zoomer=function(a){var b=com.modestmaps,c=document.createElement("a");c.innerHTML="+",c.href="#",c.className="zoomer zoomin",b.addEvent(c,"mousedown",function(a){b.cancelEvent(a)}),b.addEvent(c,"dblclick",function(a){b.cancelEvent(a)}),b.addEvent(c,"click",function(c){b.cancelEvent(c),a.zoomIn()},!1);var d=document.createElement("a");d.innerHTML="-",d.href="#",d.className="zoomer zoomout",b.addEvent(d,"mousedown",function(a){b.cancelEvent(a)}),b.addEvent(d,"dblclick",function(a){b.cancelEvent(a)}),b.addEvent(d,"click",function(c){b.cancelEvent(c),a.zoomOut()},!1);var e={add:function(a){return a.addCallback("drawn",function(a,b){a.coordinate.zoom===a.coordLimits[0].zoom?d.className="zoomer zoomout zoomdisabled":a.coordinate.zoom===a.coordLimits[1].zoom?c.className="zoomer zoomin zoomdisabled":(c.className="zoomer zoomin",d.className="zoomer zoomout")}),this},appendTo:function(a){return wax.util.$(a).appendChild(c),wax.util.$(a).appendChild(d),this}};return e.add(a)};var wax=wax||{};wax.mm=wax.mm||{},wax.mm._provider=function(a){this.options={tiles:a.tiles,scheme:a.scheme||"xyz",minzoom:a.minzoom||0,maxzoom:a.maxzoom||22,bounds:a.bounds||[-180,-90,180,90]}},wax.mm._provider.prototype={outerLimits:function(){return[this.locationCoordinate(new MM.Location(this.options.bounds[0],this.options.bounds[1])).zoomTo(this.options.minzoom),this.locationCoordinate(new MM.Location(this.options.bounds[2],this.options.bounds[3])).zoomTo(this.options.maxzoom)]},getTile:function(a){if(!(coord=this.sourceCoordinate(a)))return null;if(coord.zoom<this.options.minzoom||coord.zoom>this.options.maxzoom)return null;coord.row=this.options.scheme==="tms"?Math.pow(2,coord.zoom)-coord.row-1:coord.row;var b=this.options.tiles[parseInt(Math.pow(2,coord.zoom)*coord.row+coord.column,10)%this.options.tiles.length].replace("{z}",coord.zoom.toFixed(0)).replace("{x}",coord.column.toFixed(0)).replace("{y}",coord.row.toFixed(0));return wax._&&wax._.bw&&(b=b.replace(".png",wax._.bw_png).replace(".jpg",wax._.bw_jpg)),b}},MM&&MM.extend(wax.mm._provider,MM.MapProvider),wax.mm.connector=function(a){var b=new wax.mm._provider(a);return new MM.Layer(b)};