Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wax

Package Overview
Dependencies
Maintainers
0
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wax - npm Package Compare versions

Comparing version 2.1.4 to 3.0.0

connectors/g/connector.js

44

CHANGELOG.md
## Changelog
### 3.0.0
* TileJSON support in new map connectors: `wax.mm.connector`,
`wax.leaf.connector` and `wax.g.connector`. The old `wax.g.maptype` and
`wax.mm.provider` have been removed.
* All `g`, `leaf` and `mm` controls now use the signature
`function (map, tilejson, options) {}` where relevant TileJSON keys in
`tilejson` are used if present and `options` contains settings specific to
the control.
* Fullscreen, zoomer, attribution and legend controls no longer automatically
append themselves to the map div. Use the `.appendTo` method to add the DOM
element to the map or to another element on the page.
* `w.melt(func)` now has the same return value as `func`.
_2.x.x_
```javascript
var provider = new wax.mm.provider({
baseUrl: 'http://a.tiles.mapbox.com/mapbox/',
layerName: 'natural-earth-2'});
var map = ...;
wax.mm.legend(map);
```
_3.x.x_
```javascript
var connector = new wax.mm.connector({
tiles: 'http://a.tiles.mapbox.com/mapbox/1.0.0/natural-earth-2/{z}/{x}/{y}.png',
scheme: 'tms'
});
var map = ...;
wax.mm.legend(map, { legend: 'Content' }).appendTo(map.parent);
```
### 2.1.6
* Fix for window margin offset calculation.
* Fix zoombox control in IE.
### 2.1.5
* Fixed Hash in FF 4.x
### 2.1.4

@@ -4,0 +48,0 @@

16

control/g/interaction.js

@@ -12,3 +12,4 @@ wax = wax || {};

// **full**.
wax.g.interaction = function(map, options) {
wax.g.interaction = function(map, tilejson, options) {
tilejson = tilejson || {};
options = options || {};

@@ -22,3 +23,3 @@ // Our GridManager (from `gridutil.js`). This will keep the

waxGM: new wax.GridManager(),
waxGM: new wax.GridManager(tilejson),

@@ -56,6 +57,4 @@ // This requires wax.Tooltip or similar

var mapOffset = wax.util.offset(map.getDiv());
for (var i in map.mapTypes) {
if (!map.mapTypes[i].interactive) continue;
var mapType = map.mapTypes[i];
var get = wax.util.bind(function(mapType) {
if (!mapType.interactive) return;
for (var key in mapType.cache) {

@@ -70,3 +69,6 @@ if (key.split('/')[0] != zoom) continue;

}
}
}, this);
// Iterate over base mapTypes and overlayMapTypes.
for (var i in map.mapTypes) get(map.mapTypes[i]);
map.overlayMapTypes.forEach(get);
}

@@ -73,0 +75,0 @@ return this._getTileGrid;

wax = wax || {};
wax.g = wax.g || {};
// Legend Control
// --------------
// Adds legends to a google Map object.
wax.g.legend = function(map, options) {
options = options || {};
var legend = {
add: function() {
var url;
this.legend = new wax.Legend(map.getDiv(), options.container);
// Ideally we would use the 'tilesloaded' event here. This doesn't seem to
// work so we use the much less appropriate 'idle' event.
google.maps.event.addListener(map, 'idle', wax.util.bind(function() {
if (url) return;
wax.g.legend = function(map, tilejson) {
tilejson = tilejson || {};
var l, // parent legend
legend = {};
// Get a tile URL for each relevant layer, from which legend URLs
// are derived.
url = [];
for (var i in map.mapTypes) {
if (!map.mapTypes[i].interactive) continue;
var mapType = map.mapTypes[i];
for (var key in mapType.cache) {
url.push(mapType.cache[key].src);
break;
}
};
url.length && this.legend.render(url);
}, this));
return this;
}
legend.add = function() {
l = wax.legend()
.content(tilejson.legend || '');
return this;
};
return legend.add(map);
legend.element = function() {
return l.element();
};
legend.appendTo = function(elem) {
wax.util.$(elem).appendChild(l.element());
return this;
};
return legend.add();
};

@@ -13,3 +13,4 @@ wax = wax || {};

// **full**.
wax.leaf.interaction = function(map, options) {
wax.leaf.interaction = function(map, tilejson, options) {
tilejson = tilejson || {};
options = options || {};

@@ -22,3 +23,3 @@ // Our GridManager (from `gridutil.js`). This will keep the

waxGM: new wax.GridManager(),
waxGM: new wax.GridManager(tilejson),

@@ -25,0 +26,0 @@ // This requires wax.Tooltip or similar

@@ -7,41 +7,36 @@ // Wax Legend

wax.Legend = function(context, container) {
this.legends = {};
this.context = context;
this.container = container;
if (!this.container) {
this.container = document.createElement('div');
this.container.className = 'wax-legends';
}
this.context.appendChild(this.container);
};
wax.legend = function() {
var element,
legend = {},
container;
wax.Legend.prototype.render = function(urls) {
var url;
for (url in this.legends) {
this.legends[url].style.display = 'none';
}
var render = wax.util.bind(function(url, content) {
if (!content) {
this.legends[url] = false;
} else if (this.legends[url]) {
this.legends[url].style.display = 'block';
legend.element = function() {
return container;
};
legend.content = function(content) {
if (!arguments.length) return element.innerHTML;
if (content) {
element.innerHTML = content;
element.style.display = 'block';
} else {
this.legends[url] = document.createElement('div');
this.legends[url].className = 'wax-legend';
this.legends[url].innerHTML = content;
this.container.appendChild(this.legends[url]);
element.innerHTML = '';
element.style.display = 'none';
}
}, this);
for (var i = 0; i < urls.length; i++) {
url = this.legendUrl(urls[i]);
wax.request.get(url, function(err, data) {
if (data && data.legend) render(url, data.legend);
});
}
};
return this;
};
wax.Legend.prototype.legendUrl = function(url) {
return url.replace(/\d+\/\d+\/\d+\.\w+/, 'layer.json');
legend.add = function() {
container = document.createElement('div');
container.className = 'wax-legends';
element = document.createElement('div');
element.className = 'wax-legend';
element.style.display = 'none';
container.appendChild(element);
return this;
};
return legend.add();
};

@@ -14,6 +14,5 @@ // Like underscore's bind, except it runs a function

self.melt = function(func, obj) {
func.apply(obj, [self, obj]);
return self;
return func.apply(obj, [self, obj]);
};
return self;
};

@@ -8,5 +8,8 @@ wax.util = wax.util || {};

offset: function(el) {
// TODO: window margin offset
var width = el.offsetWidth,
height = el.offsetHeight,
// TODO: window margins
//
// Okay, so fall back to styles if offsetWidth and height are botched
// by Firefox.
var width = el.offsetWidth || parseInt(el.style.width, 10),
height = el.offsetHeight || parseInt(el.style.height, 10),
top = 0,

@@ -54,4 +57,4 @@ left = 0;

var htmlComputed = document.defaultView ?
window.getComputedStyle(document.body.parentNode, null) :
document.body.parentNode.currentStyle;
window.getComputedStyle(document.body.parentNode, null) :
document.body.parentNode.currentStyle;
if (document.body.parentNode.offsetTop !==

@@ -61,3 +64,3 @@ parseInt(htmlComputed.marginTop, 10) &&

top += parseInt(htmlComputed.marginTop, 10);
left += parseInt(htmlComputed.marginLeft, 10);
left += parseInt(htmlComputed.marginLeft, 10);
}

@@ -72,2 +75,9 @@

},
'$': function(x) {
return (typeof x === 'string') ?
document.getElementById(x) :
x;
},
// From underscore, minus funcbind for now.

@@ -88,20 +98,20 @@ // Returns a version of a function that always has the second parameter,

indexOf: function(array, item) {
var nativeIndexOf = Array.prototype.indexOf;
if (array === null) return -1;
var i, l;
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);
for (i = 0, l = array.length; i < l; i++) if (array[i] === item) return i;
return -1;
var nativeIndexOf = Array.prototype.indexOf;
if (array === null) return -1;
var i, l;
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);
for (i = 0, l = array.length; i < l; i++) if (array[i] === item) return i;
return -1;
},
// is this object an array?
isArray: Array.isArray || function(obj) {
return Object.prototype.toString.call(obj) === '[object Array]';
return Object.prototype.toString.call(obj) === '[object Array]';
},
// From underscore: reimplement the ECMA5 `Object.keys()` methodb
keys: Object.keys || function(obj) {
var hasOwnProperty = Object.prototype.hasOwnProperty;
if (obj !== Object(obj)) throw new TypeError('Invalid object');
var keys = [];
for (var key in obj) if (hasOwnProperty.call(obj, key)) keys[keys.length] = key;
return keys;
var hasOwnProperty = Object.prototype.hasOwnProperty;
if (obj !== Object(obj)) throw new TypeError('Invalid object');
var keys = [];
for (var key in obj) if (hasOwnProperty.call(obj, key)) keys[keys.length] = key;
return keys;
},

@@ -108,0 +118,0 @@ // From quirksmode: normalize the offset of an event from the top-left

@@ -6,120 +6,115 @@ wax = wax || {};

// ------------
wax.mm.boxselector = function(map, opts) {
var mouseDownPoint = null;
wax.mm.boxselector = function(map, tilejson, opts) {
var mouseDownPoint = null,
MM = com.modestmaps,
callback = ((typeof opts === 'function') ?
opts :
opts.callback),
boxDiv,
box,
boxselector = {};
var callback = (typeof opts === 'function') ?
opts :
opts.callback;
function getMousePoint(e) {
// start with just the mouse (x, y)
var point = new MM.Point(e.clientX, e.clientY);
// correct for scrolled document
point.x += document.body.scrollLeft + document.documentElement.scrollLeft;
point.y += document.body.scrollTop + document.documentElement.scrollTop;
var boxselector = {
add: function(map) {
this.boxDiv = document.createElement('div');
this.boxDiv.id = map.parent.id + '-boxselector-box';
this.boxDiv.className = 'boxselector-box';
map.parent.appendChild(this.boxDiv);
// correct for nested offsets in DOM
for (var node = map.parent; node; node = node.offsetParent) {
point.x -= node.offsetLeft;
point.y -= node.offsetTop;
}
return point;
}
com.modestmaps.addEvent(map.parent, 'mousedown', this.mouseDown());
map.addCallback('drawn', this.drawbox());
},
remove: function() {
map.parent.removeChild(this.boxDiv);
map.removeCallback('mousedown', this.drawbox());
},
getMousePoint: function(e) {
// start with just the mouse (x, y)
var point = new com.modestmaps.Point(e.clientX, e.clientY);
// correct for scrolled document
point.x += document.body.scrollLeft + document.documentElement.scrollLeft;
point.y += document.body.scrollTop + document.documentElement.scrollTop;
function mouseDown(e) {
if (!e.shiftKey) return;
// correct for nested offsets in DOM
for (var node = map.parent; node; node = node.offsetParent) {
point.x -= node.offsetLeft;
point.y -= node.offsetTop;
}
return point;
},
mouseDown: function() {
if (!this._mouseDown) this._mouseDown = wax.util.bind(function(e) {
if (e.shiftKey) {
mouseDownPoint = this.getMousePoint(e);
mouseDownPoint = getMousePoint(e);
this.boxDiv.style.left = mouseDownPoint.x + 'px';
this.boxDiv.style.top = mouseDownPoint.y + 'px';
boxDiv.style.left = mouseDownPoint.x + 'px';
boxDiv.style.top = mouseDownPoint.y + 'px';
com.modestmaps.addEvent(map.parent, 'mousemove', this.mouseMove());
com.modestmaps.addEvent(map.parent, 'mouseup', this.mouseUp());
MM.addEvent(map.parent, 'mousemove', mouseMove);
MM.addEvent(map.parent, 'mouseup', mouseUp);
map.parent.style.cursor = 'crosshair';
return com.modestmaps.cancelEvent(e);
}
}, this);
return this._mouseDown;
},
mouseMove: function(e) {
if (!this._mouseMove) this._mouseMove = wax.util.bind(function(e) {
var point = this.getMousePoint(e);
this.boxDiv.style.display = 'block';
if (point.x < mouseDownPoint.x) {
this.boxDiv.style.left = point.x + 'px';
} else {
this.boxDiv.style.left = mouseDownPoint.x + 'px';
}
this.boxDiv.style.width = Math.abs(point.x - mouseDownPoint.x) + 'px';
if (point.y < mouseDownPoint.y) {
this.boxDiv.style.top = point.y + 'px';
} else {
this.boxDiv.style.top = mouseDownPoint.y + 'px';
}
this.boxDiv.style.height = Math.abs(point.y - mouseDownPoint.y) + 'px';
return com.modestmaps.cancelEvent(e);
}, this);
return this._mouseMove;
},
mouseUp: function() {
if (!this._mouseUp) this._mouseUp = wax.util.bind(function(e) {
var point = boxselector.getMousePoint(e);
map.parent.style.cursor = 'crosshair';
return MM.cancelEvent(e);
}
var l1 = map.pointLocation(point),
l2 = map.pointLocation(mouseDownPoint);
// Format coordinates like mm.map.getExtent().
var extent = [
new com.modestmaps.Location(
Math.max(l1.lat, l2.lat),
Math.min(l1.lon, l2.lon)),
new com.modestmaps.Location(
Math.min(l1.lat, l2.lat),
Math.max(l1.lon, l2.lon))
];
function mouseMove(e) {
var point = getMousePoint(e);
boxDiv.style.display = 'block';
if (point.x < mouseDownPoint.x) {
boxDiv.style.left = point.x + 'px';
} else {
boxDiv.style.left = mouseDownPoint.x + 'px';
}
if (point.y < mouseDownPoint.y) {
boxDiv.style.top = point.y + 'px';
} else {
boxDiv.style.top = mouseDownPoint.y + 'px';
}
boxDiv.style.width = Math.abs(point.x - mouseDownPoint.x) + 'px';
boxDiv.style.height = Math.abs(point.y - mouseDownPoint.y) + 'px';
return MM.cancelEvent(e);
}
this.box = [l1, l2];
callback(extent);
function mouseUp(e) {
var point = getMousePoint(e),
l1 = map.pointLocation(point),
l2 = map.pointLocation(mouseDownPoint),
// Format coordinates like mm.map.getExtent().
extent = [
new MM.Location(
Math.max(l1.lat, l2.lat),
Math.min(l1.lon, l2.lon)),
new MM.Location(
Math.min(l1.lat, l2.lat),
Math.max(l1.lon, l2.lon))
];
com.modestmaps.removeEvent(map.parent, 'mousemove', this.mouseMove());
com.modestmaps.removeEvent(map.parent, 'mouseup', this.mouseUp());
box = [l1, l2];
callback(extent);
map.parent.style.cursor = 'auto';
}, this);
return this._mouseUp;
},
drawbox: function() {
if (!this._drawbox) this._drawbox = wax.util.bind(function(map, e) {
if (this.boxDiv) {
this.boxDiv.style.display = 'block';
this.boxDiv.style.height = 'auto';
this.boxDiv.style.width = 'auto';
var br = map.locationPoint(this.box[0]);
var tl = map.locationPoint(this.box[1]);
this.boxDiv.style.left = Math.max(0, tl.x) + 'px';
this.boxDiv.style.top = Math.max(0, tl.y) + 'px';
this.boxDiv.style.right = Math.max(0, map.dimensions.x - br.x) + 'px';
this.boxDiv.style.bottom = Math.max(0, map.dimensions.y - br.y) + 'px';
}
}, this);
return this._drawbox;
}
MM.removeEvent(map.parent, 'mousemove', mouseMove);
MM.removeEvent(map.parent, 'mouseup', mouseUp);
map.parent.style.cursor = 'auto';
}
function drawbox(map, e) {
if (!boxDiv || !box) return;
var br = map.locationPoint(box[0]),
tl = map.locationPoint(box[1]);
boxDiv.style.display = 'block';
boxDiv.style.height = 'auto';
boxDiv.style.width = 'auto';
boxDiv.style.left = Math.max(0, tl.x) + 'px';
boxDiv.style.top = Math.max(0, tl.y) + 'px';
boxDiv.style.right = Math.max(0, map.dimensions.x - br.x) + 'px';
boxDiv.style.bottom = Math.max(0, map.dimensions.y - br.y) + 'px';
}
boxselector.add = function(map) {
boxDiv = document.createElement('div');
boxDiv.id = map.parent.id + '-boxselector-box';
boxDiv.className = 'boxselector-box';
map.parent.appendChild(boxDiv);
MM.addEvent(map.parent, 'mousedown', mouseDown);
map.addCallback('drawn', drawbox);
return this;
};
boxselector.remove = function() {
map.parent.removeChild(boxDiv);
map.removeCallback('mousedown', drawbox);
};
return boxselector.add(map);
};

@@ -11,44 +11,41 @@ wax = wax || {};

// chaining-style controls.
wax.mm.fullscreen = function(map, opts) {
wax.mm.fullscreen = function(map) {
var state = 1,
fullscreen = {},
a,
smallSize;
var fullscreen = {
state: 1, // minimized
function click(e) {
if (e) com.modestmaps.cancelEvent(e);
if (state = !state) {
map.parent.className = map.parent.className.replace('wax-fullscreen-map', '');
map.setSize(
smallSize[0],
smallSize[1]);
} else {
smallSize = [map.parent.offsetWidth, map.parent.offsetHeight];
map.parent.className += ' wax-fullscreen-map';
map.setSize(
map.parent.offsetWidth,
map.parent.offsetHeight);
}
}
// Modest Maps demands an absolute height & width, and doesn't auto-correct
// for changes, so here we save the original size of the element and
// restore to that size on exit from fullscreen.
add: function(map) {
this.a = document.createElement('a');
this.a.className = 'wax-fullscreen';
this.a.href = '#fullscreen';
this.a.innerHTML = 'fullscreen';
map.parent.appendChild(this.a);
com.modestmaps.addEvent(this.a, 'click', this.click(map));
return this;
},
click: function(map) {
if (this._click) return this._click;
else this._click = wax.util.bind(function(e) {
if (e) com.modestmaps.cancelEvent(e);
if (this.state) {
this.smallSize = [map.parent.offsetWidth, map.parent.offsetHeight];
map.parent.className += ' wax-fullscreen-map';
map.setSize(
map.parent.offsetWidth,
map.parent.offsetHeight);
} else {
map.parent.className = map.parent.className.replace('wax-fullscreen-map', '');
map.setSize(
this.smallSize[0],
this.smallSize[1]);
}
this.state = !this.state;
}, this);
return this._click;
}
// Modest Maps demands an absolute height & width, and doesn't auto-correct
// for changes, so here we save the original size of the element and
// restore to that size on exit from fullscreen.
fullscreen.add = function(map) {
a = document.createElement('a');
a.className = 'wax-fullscreen';
a.href = '#fullscreen';
a.innerHTML = 'fullscreen';
com.modestmaps.addEvent(a, 'click', click);
return this;
};
fullscreen.appendTo = function(elem) {
wax.util.$(elem).appendChild(a);
return this;
};
return fullscreen.add(map);
};

@@ -26,19 +26,19 @@ wax = wax || {};

wax.mm.pushState = {
stateChange: function(callback) {
com.modestmaps.addEvent(window, 'popstate', function(e) {
if (e.state && e.state.map_location) {
callback(e.state.map_location);
}
}, false);
},
getState: function() {
if (!(window.history && window.history.state)) return;
return history.state && history.state.map_location;
},
// Push states - so each substantial movement of the map
// is a history object.
pushState: function(state) {
if (!(window.history && window.history.pushState)) return;
window.history.pushState({ map_location: state });
}
stateChange: function(callback) {
com.modestmaps.addEvent(window, 'popstate', function(e) {
if (e.state && e.state.map_location) {
callback(e.state.map_location);
}
}, false);
},
getState: function() {
if (!(window.history && window.history.state)) return;
return history.state && history.state.map_location;
},
// Push states - so each substantial movement of the map
// is a history object.
pushState: function(state) {
if (!(window.history && window.history.pushState)) return;
window.history.pushState({ map_location: state }, document.title, window.location.href);
}
};

@@ -48,11 +48,15 @@

// ----
wax.mm.hash = function(map, options) {
// cached location.hash
wax.mm.hash = function(map, tilejson, options) {
options = options || {};
var s0,
hash = {},
// allowable latitude range
lat = 90 - 1e-8;
options.manager = options.manager || wax.mm.pushState;
// Ripped from underscore.js
// Internal function used to implement `_.throttle` and `_.debounce`.
var limit = function(func, wait, debounce) {
function limit(func, wait, debounce) {
var timeout;

@@ -68,69 +72,69 @@ return function() {

};
};
}
// Returns a function, that, when invoked, will only be triggered at most once
// during a given window of time.
var throttle = function(func, wait) {
function throttle(func, wait) {
return limit(func, wait, false);
}
var parser = function(s) {
var args = s.split('/');
for (var i = 0; i < args.length; i++) {
args[i] = Number(args[i]);
if (isNaN(args[i])) return true;
}
if (args.length < 3) {
// replace bogus hash
return true;
} else if (args.length == 3) {
map.setCenterZoom(new com.modestmaps.Location(args[1], args[2]), args[0]);
}
};
var hash = {
map: this,
parser: function(s) {
var args = s.split('/');
for (var i = 0; i < args.length; i++) {
args[i] = Number(args[i]);
if (isNaN(args[i])) return true;
}
if (args.length < 3) {
// replace bogus hash
return true;
} else if (args.length == 3) {
map.setCenterZoom(new com.modestmaps.Location(args[1], args[2]), args[0]);
}
},
add: function(map) {
if (options.manager.getState()) {
hash.stateChange(options.manager.getState());
} else {
hash.initialize();
hash.move();
}
map.addCallback('drawn', throttle(hash.move, 500));
options.manager.stateChange(hash.stateChange);
},
// Currently misnamed. Get the hash string that will go in the URL,
// pulling from the map object
formatter: function() {
var center = map.getCenter(),
zoom = map.getZoom(),
precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
return [zoom.toFixed(2),
center.lat.toFixed(precision),
center.lon.toFixed(precision)].join('/');
},
move: function() {
var s1 = hash.formatter();
if (s0 !== s1) {
s0 = s1;
// don't recenter the map!
options.manager.pushState(s0);
}
},
stateChange: function(state) {
// ignore spurious hashchange events
if (state === s0) return;
if (hash.parser(s0 = state)) {
// replace bogus hash
hash.move();
}
},
// If a state isn't present when you initially load the map, the map should
// still get a center and zoom level.
initialize: function() {
if (options.defaultCenter) map.setCenter(options.defaultCenter);
if (options.defaultZoom) map.setZoom(options.defaultZoom);
var formatter = function() {
var center = map.getCenter(),
zoom = map.getZoom(),
precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
return [zoom.toFixed(2),
center.lat.toFixed(precision),
center.lon.toFixed(precision)].join('/');
};
function move() {
var s1 = formatter();
if (s0 !== s1) {
s0 = s1;
// don't recenter the map!
options.manager.pushState(s0);
}
}
function stateChange(state) {
// ignore spurious hashchange events
if (state === s0) return;
if (parser(s0 = state)) {
// replace bogus hash
hash.move();
}
}
var initialize = function() {
if (options.defaultCenter) map.setCenter(options.defaultCenter);
if (options.defaultZoom) map.setZoom(options.defaultZoom);
};
hash.add = function(map) {
if (options.manager.getState()) {
hash.stateChange(options.manager.getState());
} else {
initialize();
move();
}
map.addCallback('drawn', throttle(move, 500));
options.manager.stateChange(stateChange);
return this;
};
return hash.add(map);
};

@@ -20,246 +20,204 @@ wax = wax || {};

// `clickHandler: function(url) { ... go to url ... }`
wax.mm.interaction = function(map, options) {
var MM = com.modestmaps;
wax.mm.interaction = function(map, tilejson, options) {
options = options || {};
tilejson = tilejson || {};
var interaction = {
modifyingEvents: ['zoomed', 'panned', 'centered',
'extentset', 'resized', 'drawn'],
var MM = com.modestmaps,
waxGM = wax.GridManager(tilejson),
callbacks = options.callbacks || new wax.tooltip(),
clickAction = options.clickAction || ['full'],
clickHandler = options.clickHandler || function(url) {
window.location = url;
},
interaction = {},
_downLock = false,
_clickTimeout = false,
touchable = ('ontouchstart' in document.documentElement),
// Active feature
_af,
// Down event
_d,
// Touch tolerance
tol = 4,
tileGrid;
// Our GridManager (from `gridutil.js`). This will keep the
// cache of grid information and provide friendly utility methods
// that return `GridTile` objects instead of raw data.
waxGM: new wax.GridManager(),
// Search through `.tiles` and determine the position,
// from the top-left of the **document**, and cache that data
// so that `mousemove` events don't always recalculate.
function getTileGrid() {
// TODO: don't build for tiles outside of viewport
// Touch interaction leads to intermediate
var zoomLayer = map.createOrGetLayer(Math.round(map.getZoom()));
// Calculate a tile grid and cache it, by using the `.tiles`
// element on this map.
return tileGrid || (tileGrid =
(function(t) {
var o = [];
for (var key in t) {
if (t[key].parentNode === zoomLayer) {
var offset = wax.util.offset(t[key]);
o.push([offset.top, offset.left, t[key]]);
}
}
return o;
})(map.tiles));
}
// A lock on recalculating the grid while the user is dragging
_downLock: false,
// When the map moves, the tile grid is no longer valid.
function clearTileGrid(map, e) {
tileGrid = null;
}
// This requires wax.Tooltip or similar
callbacks: options.callbacks || new wax.tooltip(),
function getTile(e) {
for (var i = 0, grid = getTileGrid(); i < grid.length; i++) {
if ((grid[i][0] < e.y) &&
((grid[i][0] + 256) > e.y) &&
(grid[i][1] < e.x) &&
((grid[i][1] + 256) > e.x)) return grid[i][2];
}
return false;
}
clickAction: options.clickAction || ['full'],
// Clear the double-click timeout to prevent double-clicks from
// triggering popups.
function killTimeout() {
if (_clickTimeout) {
window.clearTimeout(_clickTimeout);
_clickTimeout = null;
return true;
} else {
return false;
}
}
clickHandler: options.clickHandler || function(url) {
window.location = url;
},
function onMove(e) {
// If the user is actually dragging the map, exit early
// to avoid performance hits.
if (_downLock) return;
// Attach listeners to the map
add: function() {
for (var i = 0; i < this.modifyingEvents.length; i++) {
map.addCallback(
this.modifyingEvents[i],
wax.util.bind(this.clearTileGrid, this)
);
}
if (!wax.util.isArray(this.clickAction)) this.clickAction = [this.clickAction];
MM.addEvent(map.parent, 'mousemove', this.onMove());
MM.addEvent(map.parent, 'mousedown', this.onDown());
this.touchable = ('ontouchstart' in document.documentElement);
if (this.touchable) {
MM.addEvent(map.parent, 'touchstart', this.onDown());
}
return this;
},
var pos = wax.util.eventoffset(e),
tile = getTile(pos),
feature;
// Search through `.tiles` and determine the position,
// from the top-left of the **document**, and cache that data
// so that `mousemove` events don't always recalculate.
getTileGrid: function() {
// TODO: don't build for tiles outside of viewport
// Touch interaction leads to intermediate
var zoom = Math.round(map.getZoom());
// Calculate a tile grid and cache it, by using the `.tiles`
// element on this map.
return this._getTileGrid || (this._getTileGrid =
(function(t) {
var o = [];
for (var key in t) {
if (key.split(',')[0] == zoom) {
var offset = wax.util.offset(t[key]);
o.push([offset.top, offset.left, t[key]]);
}
}
return o;
})(map.tiles));
},
// When the map moves, the tile grid is no longer valid.
clearTileGrid: function(map, e) {
this._getTileGrid = null;
},
getTile: function(evt) {
var tile;
var grid = this.getTileGrid();
for (var i = 0; i < grid.length; i++) {
if ((grid[i][0] < evt.y) &&
((grid[i][0] + 256) > evt.y) &&
(grid[i][1] < evt.x) &&
((grid[i][1] + 256) > evt.x)) {
tile = grid[i][2];
break;
tile && waxGM.getGrid(tile.src, function(err, g) {
if (err || !g) return;
if (feature = g.getFeature(pos.x, pos.y, tile, {
format: 'teaser'
})) {
if (feature && _af !== feature) {
_af = feature;
callbacks.out(map.parent);
callbacks.over(feature, map.parent, 0, e);
} else if (!feature) {
_af = null;
callbacks.out(map.parent);
}
}
return tile || false;
},
// Clear the double-click timeout to prevent double-clicks from
// triggering popups.
clearTimeout: function() {
if (this.clickTimeout) {
window.clearTimeout(this.clickTimeout);
this.clickTimeout = null;
return true;
} else {
return false;
_af = null;
callbacks.out(map.parent);
}
},
});
}
onMove: function(evt) {
if (!this._onMove) this._onMove = wax.util.bind(function(evt) {
// If the user is actually dragging the map, exit early
// to avoid performance hits.
if (this._downLock) return;
// A handler for 'down' events - which means `mousedown` and `touchstart`
function onDown(e) {
// Ignore double-clicks by ignoring clicks within 300ms of
// each other.
if (killTimeout()) { return; }
var pos = wax.util.eventoffset(evt);
var tile = this.getTile(pos);
if (tile) {
this.waxGM.getGrid(tile.src, wax.util.bind(function(err, g) {
if (err) return;
if (g) {
var feature = g.getFeature(pos.x, pos.y, tile, {
format: 'teaser'
});
// This and other Modest Maps controls only support a single layer.
// Thus a layer index of **0** is given to the tooltip library
if (feature) {
if (feature && this.feature !== feature) {
this.feature = feature;
this.callbacks.out(map.parent);
this.callbacks.over(feature, map.parent, 0, evt);
} else if (!feature) {
this.feature = null;
this.callbacks.out(map.parent);
}
} else {
this.feature = null;
this.callbacks.out(map.parent);
}
}
}, this));
}
}, this);
return this._onMove;
},
// Prevent interaction offset calculations happening while
// the user is dragging the map.
//
// Store this event so that we can compare it to the
// up event
_downLock = true;
_d = wax.util.eventoffset(e);
if (e.type === 'mousedown') {
MM.addEvent(map.parent, 'mouseup', onUp);
// A handler for 'down' events - which means `mousedown` and `touchstart`
onDown: function(evt) {
if (!this._onDown) this._onDown = wax.util.bind(function(evt) {
// Only track single-touches. Double-touches will not affect this
// control
} else if (e.type === 'touchstart' && e.touches.length === 1) {
// Ignore double-clicks by ignoring clicks within 300ms of
// each other.
if (this.clearTimeout()) { return; }
// turn this into touch-mode. Fallback to teaser and full.
this.clickAction = ['full', 'teaser'];
// Prevent interaction offset calculations happening while
// the user is dragging the map.
this._downLock = true;
// Don't make the user click close if they hit another tooltip
if (callbacks._currentTooltip) {
callbacks.hideTooltip(callbacks._currentTooltip);
}
// Store this event so that we can compare it to the
// up event
this.downEvent = wax.util.eventoffset(evt);
if (evt.type === 'mousedown') {
MM.addEvent(map.parent, 'mouseup', this.onUp());
// Touch moves invalidate touches
MM.addEvent(map.parent, 'touchend', onUp);
MM.addEvent(map.parent, 'touchmove', touchCancel);
}
}
// Only track single-touches. Double-touches will not affect this
// control
} else if (evt.type === 'touchstart' && evt.touches.length === 1) {
function touchCancel() {
MM.removeEvent(map.parent, 'touchend', onUp);
MM.removeEvent(map.parent, 'touchmove', onUp);
_downLock = false;
}
// turn this into touch-mode. Fallback to teaser and full.
this.clickAction = ['full', 'teaser'];
function onUp(e) {
var pos = wax.util.eventoffset(e);
// Don't make the user click close if they hit another tooltip
if (this.callbacks._currentTooltip) {
this.callbacks.hideTooltip(this.callbacks._currentTooltip);
}
MM.removeEvent(map.parent, 'mouseup', onUp);
if (map.parent.ontouchend) {
MM.removeEvent(map.parent, 'touchend', onUp);
MM.removeEvent(map.parent, 'touchmove', _touchCancel);
}
// Touch moves invalidate touches
MM.addEvent(map.parent, 'touchend', this.onUp());
MM.addEvent(map.parent, 'touchmove', this.touchCancel());
}
}, this);
return this._onDown;
},
_downLock = false;
if (e.type === 'touchend') {
// If this was a touch and it survived, there's no need to avoid a double-tap
click(_d);
} else if (Math.round(pos.y / tol) === Math.round(_d.y / tol) &&
Math.round(pos.x / tol) === Math.round(_d.x / tol)) {
// Contain the event data in a closure.
_clickTimeout = window.setTimeout((function(pos) {
return function(e) {
click(e, pos);
};
})(pos));
}
return onUp;
}
// If we get a touchMove event, it isn't a tap.
touchCancel: function() {
if (!this._touchCancel) this._touchCancel = wax.util.bind(function(evt) {
MM.removeEvent(map.parent, 'touchend', this.onUp());
MM.removeEvent(map.parent, 'touchmove', this.onUp());
// Handle a click event. Takes a second
function click(e, pos) {
var tile = getTile(pos),
feature;
// Release the _downLock lock
this._downLock = false;
}, this);
return this._touchCancel;
},
onUp: function() {
if (!this._onUp) this._onUp = wax.util.bind(function(evt) {
MM.removeEvent(map.parent, 'mouseup', this.onUp());
if (map.parent.ontouchend) {
MM.removeEvent(map.parent, 'touchend', this.onUp());
MM.removeEvent(map.parent, 'touchmove', this.touchCancel());
tile && waxGM.getGrid(tile.src, function(err, g) {
for (var i = 0; g && i < clickAction.length; i++) {
if (feature = g.getFeature(pos.x, pos.y, tile, {
format: clickAction[i]
})) {
switch (clickAction[i]) {
case 'full':
// clickAction can be teaser in touch interaction
case 'teaser':
return callbacks.click(feature, map.parent, 0, e);
case 'location':
return clickHandler(feature);
}
}
}
});
}
// Release the _downLock lock
this._downLock = false;
// Don't register clicks that are likely the boundaries
// of dragging the map
// The tolerance between the place where the mouse goes down
// and where where it comes up is set at 4px.
var tol = 4;
var pos = wax.util.eventoffset(evt);
if (evt.type === 'touchend') {
// If this was a touch and it survived, there's no need to avoid a double-tap
this.click()(this.downEvent);
} else if (Math.round(pos.y / tol) === Math.round(this.downEvent.y / tol) &&
Math.round(pos.x / tol) === Math.round(this.downEvent.x / tol)) {
// Contain the event data in a closure.
this.clickTimeout = window.setTimeout(
wax.util.bind(function() { this.click()(pos); }, this), 300);
}
}, this);
return this._onUp;
},
// Handle a click event. Takes a second
click: function(evt) {
if (!this._onClick) this._onClick = wax.util.bind(function(pos) {
var tile = this.getTile(pos);
if (tile) {
this.waxGM.getGrid(tile.src, wax.util.bind(function(err, g) {
if (g) {
for (var i = 0; i < this.clickAction.length; i++) {
var feature = g.getFeature(pos.x, pos.y, tile, {
format: this.clickAction[i]
});
if (feature) {
switch (this.clickAction[i]) {
case 'full':
// clickAction can be teaser in touch interaction
case 'teaser':
return this.callbacks.click(feature, map.parent, 0, evt);
break;
case 'location':
return this.clickHandler(feature);
break;
}
}
}
}
}, this));
}
}, this);
return this._onClick;
// Attach listeners to the map
interaction.add = function() {
var l = ['zoomed', 'panned', 'centered',
'extentset', 'resized', 'drawn'];
for (var i = 0; i < l.length; i++) {
map.addCallback(l[i], clearTileGrid);
}
MM.addEvent(map.parent, 'mousemove', onMove);
MM.addEvent(map.parent, 'mousedown', onDown);
if (touchable) {
MM.addEvent(map.parent, 'touchstart', onDown);
}
return this;
};

@@ -266,0 +224,0 @@

@@ -8,17 +8,23 @@ wax = wax || {};

// light wrapper around the `/lib` code for legends.
wax.mm.legend = function(map, options) {
options = options || {};
var legend = {
add: function() {
this.legend = new wax.Legend(map.parent, options.container);
this.legend.render([
map.provider.getTileUrl({
zoom: 0,
column: 0,
row: 0
})
]);
}
wax.mm.legend = function(map, tilejson) {
tilejson = tilejson || {};
var l, // parent legend
legend = {};
legend.add = function() {
l = wax.legend()
.content(tilejson.legend || '');
return this;
};
return legend.add(map);
legend.element = function() {
return l.element();
};
legend.appendTo = function(elem) {
wax.util.$(elem).appendChild(l.element());
return this;
};
return legend.add();
};

@@ -7,3 +7,3 @@ wax = wax || {};

// For making maps on normal websites nicely mobile-ized
wax.mm.mobile = function(map, opts) {
wax.mm.mobile = function(map, tilejson, opts) {
opts = opts || {};

@@ -10,0 +10,0 @@ // Inspired by Leaflet

@@ -14,3 +14,3 @@ wax = wax || {};

// to the map as if added by the user.
wax.mm.pointselector = function(map, opts) {
wax.mm.pointselector = function(map, tilejson, opts) {
var mouseDownPoint = null,

@@ -21,2 +21,3 @@ mouseUpPoint = null,

MM = com.modestmaps,
pointselector = {},
locations = [];

@@ -29,3 +30,3 @@

// Create a `com.modestmaps.Point` from a screen event, like a click.
var makePoint = function(e) {
function makePoint(e) {
var coords = wax.util.eventoffset(e);

@@ -51,3 +52,3 @@ var point = new MM.Point(coords.x, coords.y);

return point;
};
}

@@ -65,80 +66,75 @@ // Currently locations in this control contain circular references to elements.

var pointselector = {
// Attach this control to a map by registering callbacks
// and adding the overlay
add: function(map) {
MM.addEvent(map.parent, 'mousedown', this.mouseDown());
map.addCallback('drawn', pointselector.drawPoints());
return this;
},
deletePoint: function(location, e) {
if (confirm('Delete this point?')) {
location.pointDiv.parentNode.removeChild(location.pointDiv);
locations.splice(wax.util.indexOf(locations, location), 1);
callback(cleanLocations(locations));
// Attach this control to a map by registering callbacks
// and adding the overlay
// Redraw the points when the map is moved, so that they stay in the
// correct geographic locations.
function drawPoints() {
var offset = new MM.Point(0, 0);
for (var i = 0; i < locations.length; i++) {
var point = map.locationPoint(locations[i]);
if (!locations[i].pointDiv) {
locations[i].pointDiv = document.createElement('div');
locations[i].pointDiv.className = 'wax-point-div';
locations[i].pointDiv.style.position = 'absolute';
locations[i].pointDiv.style.display = 'block';
// TODO: avoid circular reference
locations[i].pointDiv.location = locations[i];
// Create this closure once per point
MM.addEvent(locations[i].pointDiv, 'mouseup',
(function selectPointWrap(e) {
var l = locations[i];
return function(e) {
MM.removeEvent(map.parent, 'mouseup', mouseUp);
pointselector.deletePoint(l, e);
};
})());
map.parent.appendChild(locations[i].pointDiv);
}
},
// Redraw the points when the map is moved, so that they stay in the
// correct geographic locations.
drawPoints: function() {
if (!this._drawPoints) this._drawPoints = wax.util.bind(function() {
var offset = new MM.Point(0, 0);
for (var i = 0; i < locations.length; i++) {
var point = map.locationPoint(locations[i]);
if (!locations[i].pointDiv) {
locations[i].pointDiv = document.createElement('div');
locations[i].pointDiv.className = 'wax-point-div';
locations[i].pointDiv.style.position = 'absolute';
locations[i].pointDiv.style.display = 'block';
// TODO: avoid circular reference
locations[i].pointDiv.location = locations[i];
// Create this closure once per point
MM.addEvent(locations[i].pointDiv, 'mouseup',
(function selectPointWrap(e) {
var l = locations[i];
return function(e) {
MM.removeEvent(map.parent, 'mouseup', pointselector.mouseUp());
pointselector.deletePoint(l, e);
};
})());
map.parent.appendChild(locations[i].pointDiv);
}
locations[i].pointDiv.style.left = point.x + 'px';
locations[i].pointDiv.style.top = point.y + 'px';
}
}, this);
return this._drawPoints;
},
mouseDown: function() {
if (!this._mouseDown) this._mouseDown = wax.util.bind(function(e) {
mouseDownPoint = makePoint(e);
MM.addEvent(map.parent, 'mouseup', this.mouseUp());
}, this);
return this._mouseDown;
},
// API for programmatically adding points to the map - this
// calls the callback for ever point added, so it can be symmetrical.
// Useful for initializing the map when it's a part of a form.
addLocation: function(location) {
locations.push(location);
pointselector.drawPoints()();
locations[i].pointDiv.style.left = point.x + 'px';
locations[i].pointDiv.style.top = point.y + 'px';
}
}
function mouseDown(e) {
mouseDownPoint = makePoint(e);
MM.addEvent(map.parent, 'mouseup', mouseUp);
}
// Remove the awful circular reference from locations.
// TODO: This function should be made unnecessary by not having it.
function mouseUp(e) {
if (!mouseDownPoint) return;
mouseUpPoint = makePoint(e);
if (MM.Point.distance(mouseDownPoint, mouseUpPoint) < tolerance) {
pointselector.addLocation(map.pointLocation(mouseDownPoint));
callback(cleanLocations(locations));
},
// Remove the awful circular reference from locations.
// TODO: This function should be made unnecessary by not having it.
mouseUp: function() {
if (!this._mouseUp) this._mouseUp = wax.util.bind(function(e) {
if (!mouseDownPoint) return;
mouseUpPoint = makePoint(e);
if (MM.Point.distance(mouseDownPoint, mouseUpPoint) < tolerance) {
this.addLocation(map.pointLocation(mouseDownPoint));
callback(cleanLocations(locations));
}
mouseDownPoint = null;
}, this);
return this._mouseUp;
}
mouseDownPoint = null;
}
// API for programmatically adding points to the map - this
// calls the callback for ever point added, so it can be symmetrical.
// Useful for initializing the map when it's a part of a form.
pointselector.addLocation = function(location) {
locations.push(location);
drawPoints();
callback(cleanLocations(locations));
};
pointselector.add = function(map) {
MM.addEvent(map.parent, 'mousedown', mouseDown);
map.addCallback('drawn', drawPoints());
return this;
};
pointselector.deletePoint = function(location, e) {
if (confirm('Delete this point?')) {
location.pointDiv.parentNode.removeChild(location.pointDiv);
locations.splice(wax.util.indexOf(locations, location), 1);
callback(cleanLocations(locations));
}
};
return pointselector.add(map);
};

@@ -7,89 +7,96 @@ wax = wax || {};

// An OL-style ZoomBox control, from the Modest Maps example.
wax.mm.zoombox = function(map, opts) {
wax.mm.zoombox = function(map) {
// TODO: respond to resize
var mouseDownPoint = null;
var zoombox = {},
mm = com.modestmaps,
drawing = false,
box,
mouseDownPoint = null;
var zoombox = {
add: function(map) {
this.box = document.createElement('div');
this.box.id = map.parent.id + '-zoombox-box';
this.box.className = 'zoombox-box';
map.parent.appendChild(this.box);
com.modestmaps.addEvent(map.parent, 'mousedown', this.mouseDown());
},
remove: function() {
map.parent.removeChild(this.box);
map.removeCallback('mousedown', this.mouseDown);
},
getMousePoint: function(e) {
// start with just the mouse (x, y)
var point = new com.modestmaps.Point(e.clientX, e.clientY);
// correct for scrolled document
point.x += document.body.scrollLeft + document.documentElement.scrollLeft;
point.y += document.body.scrollTop + document.documentElement.scrollTop;
function getMousePoint(e) {
// start with just the mouse (x, y)
var point = new mm.Point(e.clientX, e.clientY);
// correct for scrolled document
point.x += document.body.scrollLeft + document.documentElement.scrollLeft;
point.y += document.body.scrollTop + document.documentElement.scrollTop;
// correct for nested offsets in DOM
for (var node = map.parent; node; node = node.offsetParent) {
point.x -= node.offsetLeft;
point.y -= node.offsetTop;
}
return point;
},
mouseDown: function() {
if (!this._mouseDown) this._mouseDown = wax.util.bind(function(e) {
if (e.shiftKey) {
mouseDownPoint = this.getMousePoint(e);
// correct for nested offsets in DOM
for (var node = map.parent; node; node = node.offsetParent) {
point.x -= node.offsetLeft;
point.y -= node.offsetTop;
}
return point;
}
this.box.style.left = mouseDownPoint.x + 'px';
this.box.style.top = mouseDownPoint.y + 'px';
function mouseUp(e) {
if (!drawing) return;
com.modestmaps.addEvent(map.parent, 'mousemove', this.mouseMove());
com.modestmaps.addEvent(map.parent, 'mouseup', this.mouseUp());
drawing = false;
var point = getMousePoint(e);
map.parent.style.cursor = 'crosshair';
return com.modestmaps.cancelEvent(e);
}
}, this);
return this._mouseDown;
},
mouseMove: function(e) {
if (!this._mouseMove) this._mouseMove = wax.util.bind(function(e) {
var point = this.getMousePoint(e);
this.box.style.display = 'block';
if (point.x < mouseDownPoint.x) {
this.box.style.left = point.x + 'px';
} else {
this.box.style.left = mouseDownPoint.x + 'px';
}
this.box.style.width = Math.abs(point.x - mouseDownPoint.x) + 'px';
if (point.y < mouseDownPoint.y) {
this.box.style.top = point.y + 'px';
} else {
this.box.style.top = mouseDownPoint.y + 'px';
}
this.box.style.height = Math.abs(point.y - mouseDownPoint.y) + 'px';
return com.modestmaps.cancelEvent(e);
}, this);
return this._mouseMove;
},
mouseUp: function(e) {
if (!this._mouseUp) this._mouseUp = wax.util.bind(function(e) {
var point = this.getMousePoint(e);
var l1 = map.pointLocation(point),
l2 = map.pointLocation(mouseDownPoint);
var l1 = map.pointLocation(point),
l2 = map.pointLocation(mouseDownPoint);
map.setExtent([l1, l2]);
map.setExtent([l1, l2]);
box.style.display = 'none';
mm.removeEvent(map.parent, 'mousemove', mouseMove);
mm.removeEvent(map.parent, 'mouseup', mouseUp);
this.box.style.display = 'none';
com.modestmaps.removeEvent(map.parent, 'mousemove', this.mouseMove());
com.modestmaps.removeEvent(map.parent, 'mouseup', this.mouseUp());
map.parent.style.cursor = 'auto';
}
map.parent.style.cursor = 'auto';
}, this);
return this._mouseUp;
function mouseDown(e) {
if (!(e.shiftKey && !this.drawing)) return;
drawing = true;
mouseDownPoint = getMousePoint(e);
box.style.left = mouseDownPoint.x + 'px';
box.style.top = mouseDownPoint.y + 'px';
mm.addEvent(map.parent, 'mousemove', mouseMove);
mm.addEvent(map.parent, 'mouseup', mouseUp);
map.parent.style.cursor = 'crosshair';
return mm.cancelEvent(e);
}
function mouseMove(e) {
if (!drawing) return;
var point = getMousePoint(e);
box.style.display = 'block';
if (point.x < mouseDownPoint.x) {
box.style.left = point.x + 'px';
} else {
box.style.left = mouseDownPoint.x + 'px';
}
box.style.width = Math.abs(point.x - mouseDownPoint.x) + 'px';
if (point.y < mouseDownPoint.y) {
box.style.top = point.y + 'px';
} else {
box.style.top = mouseDownPoint.y + 'px';
}
box.style.height = Math.abs(point.y - mouseDownPoint.y) + 'px';
return mm.cancelEvent(e);
}
zoombox.add = function(map) {
// Use a flag to determine whether the zoombox is currently being
// drawn. Necessary only for IE because `mousedown` is triggered
// twice.
box = document.createElement('div');
box.id = map.parent.id + '-zoombox-box';
box.className = 'zoombox-box';
map.parent.appendChild(box);
mm.addEvent(map.parent, 'mousedown', mouseDown);
};
zoombox.remove = function() {
map.parent.removeChild(box);
map.removeCallback('mousedown', mouseDown);
};
return zoombox.add(map);
};

@@ -10,2 +10,4 @@ wax = wax || {};

wax.mm.zoomer = function(map) {
var mm = com.modestmaps;
var zoomin = document.createElement('a');

@@ -15,10 +17,12 @@ zoomin.innerHTML = '+';

zoomin.className = 'zoomer zoomin';
com.modestmaps.addEvent(zoomin, 'mousedown', function(e) {
com.modestmaps.cancelEvent(e);
mm.addEvent(zoomin, 'mousedown', function(e) {
mm.cancelEvent(e);
});
com.modestmaps.addEvent(zoomin, 'click', function(e) {
com.modestmaps.cancelEvent(e);
mm.addEvent(zoomin, 'dblclick', function(e) {
mm.cancelEvent(e);
});
mm.addEvent(zoomin, 'click', function(e) {
mm.cancelEvent(e);
map.zoomIn();
}, false);
map.parent.appendChild(zoomin);

@@ -29,10 +33,12 @@ var zoomout = document.createElement('a');

zoomout.className = 'zoomer zoomout';
com.modestmaps.addEvent(zoomout, 'mousedown', function(e) {
com.modestmaps.cancelEvent(e);
mm.addEvent(zoomout, 'mousedown', function(e) {
mm.cancelEvent(e);
});
com.modestmaps.addEvent(zoomout, 'click', function(e) {
com.modestmaps.cancelEvent(e);
mm.addEvent(zoomout, 'dblclick', function(e) {
mm.cancelEvent(e);
});
mm.addEvent(zoomout, 'click', function(e) {
mm.cancelEvent(e);
map.zoomOut();
}, false);
map.parent.appendChild(zoomout);

@@ -52,2 +58,7 @@ var zoomer = {

return this;
},
appendTo: function(elem) {
wax.util.$(elem).appendChild(zoomin);
wax.util.$(elem).appendChild(zoomout);
return this;
}

@@ -54,0 +65,0 @@ };

@@ -23,6 +23,6 @@ // Wax header

initialize: function(options) {
initialize: function(tilejson, options) {
this.options = options || {};
this.clickAction = this.options.clickAction || 'full';
this.gm = new wax.GridManager(this.options);
this.gm = new wax.GridManager(tilejson);

@@ -29,0 +29,0 @@ OpenLayers.Control.prototype.initialize.apply(this, [this.options || {}]);

@@ -0,4 +1,5 @@

/* wax - 3.0.0 - 1.0.4-320-g97e618c */
/*!
* 0.1.6 with IE readyState fix in https://github.com/ded/reqwest/issues/18
*
* Reqwest! A x-browser general purpose XHR connection manager

@@ -9,4 +10,3 @@ * copyright Dustin Diaz 2011

*/
!function(window){function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):!0)+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}function enc(a){return encodeURIComponent(a)}function reqwest(a,b){return new Reqwest(a,b)}function init(o,fn){function error(a){o.error&&o.error(a),complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText;switch(type){case"json":resp=eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function complete(a){o.complete&&o.complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function setType(a){if(/\.json$/.test(a))return"json";if(/\.jsonp$/.test(a))return"jsonp";if(/\.js$/.test(a))return"js";if(/\.html?$/.test(a))return"html";if(/\.xml$/.test(a))return"xml";return"js"}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function getRequest(a,b,c){if(a.type!="jsonp"){var f=xhr();f.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(f,a),f.onreadystatechange=readyState(f,b,c),a.before&&a.before(f),f.send(a.data||null);return f}var d=doc.createElement("script");window[getCallbackName(a)]=generalCallback,d.type="text/javascript",d.src=a.url,d.async=!0;var e=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(d)};d.onload=e,d.onreadystatechange=function(){d.readyState=="loaded"||d.readyState=="complete"&&e()},head.appendChild(d)}function generalCallback(a){lastValue=a}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function setHeaders(a,b){var c=b.headers||{};c.Accept="text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]="application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this)
// Instantiate objects based on a JSON "record". The record must be a statement
!function(window){function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):"")+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}function enc(a){return encodeURIComponent(a)}function reqwest(a,b){return new Reqwest(a,b)}function init(o,fn){function error(a){o.error&&o.error(a),complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText,JSON;switch(type){case"json":resp=JSON?JSON.parse(r):eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function complete(a){o.complete&&o.complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function setType(a){if(/\.json$/.test(a))return"json";if(/\.jsonp$/.test(a))return"jsonp";if(/\.js$/.test(a))return"js";if(/\.html?$/.test(a))return"html";if(/\.xml$/.test(a))return"xml";return"js"}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function getRequest(a,b,c){if(a.type!="jsonp"){var f=xhr();f.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(f,a),f.onreadystatechange=readyState(f,b,c),a.before&&a.before(f),f.send(a.data||null);return f}var d=doc.createElement("script");window[getCallbackName(a)]=generalCallback,d.type="text/javascript",d.src=a.url,d.async=!0;var e=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(d)};d.onload=e,d.onreadystatechange=function(){/^loaded|complete$/.test(d.readyState)&&e()},head.appendChild(d)}function generalCallback(a){lastValue=a}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function setHeaders(a,b){var c=b.headers||{};c.Accept=c.Accept||"text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]=c["Content-type"]||"application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this)// Instantiate objects based on a JSON "record". The record must be a statement
// array in the following form:

@@ -208,51 +208,60 @@ //

};
// Wax GridUtil
// ------------
wax = wax || {};
// Wax header
var wax = wax || {};
// Attribution
// -----------
wax.attribution = function() {
var container,
a = {};
// Request
// -------
// Request data cache. `callback(data)` where `data` is the response data.
wax.request = {
cache: {},
locks: {},
promises: {},
get: function(url, callback) {
// Cache hit.
if (this.cache[url]) {
return callback(this.cache[url][0], this.cache[url][1]);
// Cache miss.
} else {
this.promises[url] = this.promises[url] || [];
this.promises[url].push(callback);
// Lock hit.
if (this.locks[url]) return;
// Request.
var that = this;
this.locks[url] = true;
reqwest({
url: url + '?callback=grid',
type: 'jsonp',
jsonpCallback: 'callback',
success: function(data) {
that.locks[url] = false;
that.cache[url] = [null, data];
for (var i = 0; i < that.promises[url].length; i++) {
that.promises[url][i](that.cache[url][0], that.cache[url][1]);
}
},
error: function(err) {
that.locks[url] = false;
that.cache[url] = [err, null];
for (var i = 0; i < that.promises[url].length; i++) {
that.promises[url][i](that.cache[url][0], that.cache[url][1]);
}
}
});
a.set = function(content) {
if (typeof content === 'undefined') return;
container.innerHTML = content;
return this;
};
a.element = function() {
return container;
};
a.init = function() {
container = document.createElement('div');
container.className = 'wax-attribution';
return this;
};
return a.init();
};
// Formatter
// ---------
wax.formatter = function(x) {
var formatter = {},
f;
// Prevent against just any input being used.
if (x && typeof x === 'string') {
try {
// Ugly, dangerous use of eval.
eval('f = ' + x);
} catch (e) {
if (console) console.log(e);
}
} else if (x && typeof x === 'function') {
f = x;
} else {
f = function() {};
}
// Wrap the given formatter function in order to
// catch exceptions that it may throw.
formatter.format = function(options, data) {
try {
return f(options, data);
} catch (e) {
if (console) console.log(e);
}
};
return formatter;
};
// GridInstance

@@ -264,60 +273,57 @@ // ------------

options = options || {};
this.grid_tile = grid_tile;
this.formatter = formatter;
// resolution is the grid-elements-per-pixel ratio of gridded data.
this.resolution = options.resolution || 4;
// The size of a tile element. For now we expect tiles to be squares.
this.tileSize = options.tileSize || 256;
};
var instance = {},
resolution = options.resolution || 4;
tileSize = options.tileSize || 256;
// Resolve the UTF-8 encoding stored in grids to simple
// number values.
// See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
// for details.
wax.GridInstance.prototype.resolveCode = function(key) {
if (key >= 93) key--;
if (key >= 35) key--;
key -= 32;
return key;
};
// Resolve the UTF-8 encoding stored in grids to simple
// number values.
// See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
// for details.
function resolveCode(key) {
if (key >= 93) key--;
if (key >= 35) key--;
key -= 32;
return key;
}
// Get a feature:
//
// * `x` and `y`: the screen coordinates of an event
// * `tile_element`: a DOM element of a tile, from which we can get an offset.
// * `options` options to give to the formatter: minimally having a `format`
// member, being `full`, `teaser`, or something else.
wax.GridInstance.prototype.getFeature = function(x, y, tile_element, options) {
if (!(this.grid_tile && this.grid_tile.grid)) return;
// Get a feature:
//
// * `x` and `y`: the screen coordinates of an event
// * `tile_element`: a DOM element of a tile, from which we can get an offset.
// * `options` options to give to the formatter: minimally having a `format`
// member, being `full`, `teaser`, or something else.
instance.getFeature = function(x, y, tile_element, options) {
if (!(grid_tile && grid_tile.grid)) return;
// IE problem here - though recoverable, for whatever reason
var offset = wax.util.offset(tile_element);
var tileX = offset.left;
var tileY = offset.top;
// IE problem here - though recoverable, for whatever reason
var offset = wax.util.offset(tile_element),
tileX = offset.left,
tileY = offset.top,
res = (offset.width / tileSize) * resolution;
// This tile's resolution. larger tiles will have lower, aka coarser, resolutions
var res = (offset.width / this.tileSize) * this.resolution;
// This tile's resolution. larger tiles will have lower, aka coarser, resolutions
if ((y - tileY < 0) || (x - tileX < 0)) return;
if ((Math.floor(y - tileY) > tileSize) ||
(Math.floor(x - tileX) > tileSize)) return;
// Find the key in the grid. The above calls should ensure that
// the grid's array is large enough to make this work.
var key = grid_tile.grid[
Math.floor((y - tileY) / res)
].charCodeAt(
Math.floor((x - tileX) / res)
);
if (y - tileY < 0) return;
if (x - tileX < 0) return;
if (Math.floor(y - tileY) > this.tileSize) return;
if (Math.floor(x - tileX) > this.tileSize) return;
key = resolveCode(key);
// Find the key in the grid. The above calls should ensure that
// the grid's array is large enough to make this work.
var key = this.grid_tile.grid[
Math.floor((y - tileY) / res)
].charCodeAt(
Math.floor((x - tileX) / res)
);
// If this layers formatter hasn't been loaded yet,
// download and load it now.
if (grid_tile.keys[key] && grid_tile.data[grid_tile.keys[key]]) {
return formatter.format(options, grid_tile.data[grid_tile.keys[key]]);
}
};
key = this.resolveCode(key);
// If this layers formatter hasn't been loaded yet,
// download and load it now.
if (this.grid_tile.keys[key] && this.grid_tile.data[this.grid_tile.keys[key]]) {
return this.formatter.format(options, this.grid_tile.data[this.grid_tile.keys[key]]);
}
return instance;
};
// GridManager

@@ -332,80 +338,84 @@ // -----------

options = options || {};
this.resolution = options.resolution || 4;
this.grid_tiles = {};
this.key_maps = {};
this.formatters = {};
this.locks = {};
};
// Get a grid - calls `callback` with either a `GridInstance`
// object or false. Behind the scenes, this calls `getFormatter`
// and gets grid data, and tries to avoid re-downloading either.
wax.GridManager.prototype.getGrid = function(url, callback) {
var that = this;
that.getFormatter(that.formatterUrl(url), function(err, f) {
if (err || !f) return callback(err, null);
var resolution = options.resolution || 4,
grid_tiles = {},
manager = {},
xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),
formatter;
wax.request.get(that.tileDataUrl(url), function(err, t) {
if (err) return callback(err, null);
callback(null, new wax.GridInstance(t, f, {
resolution: that.resolution || 4
}));
});
});
};
var formatterUrl = function(url) {
return url.replace(/\d+\/\d+\/\d+\.\w+/, 'layer.json');
};
// Simplistically derive the URL of the grid data endpoint from a tile URL
wax.GridManager.prototype.tileDataUrl = function(url) {
return url.replace(/(\.png|\.jpg|\.jpeg)(\d*)/, '.grid.json');
};
var gridUrl = function(url) {
return url.replace(/(\.png|\.jpg|\.jpeg)(\d*)/, '.grid.json');
};
// Simplistically derive the URL of the formatter function from a tile URL
wax.GridManager.prototype.formatterUrl = function(url) {
return url.replace(/\d+\/\d+\/\d+\.\w+/, 'layer.json');
};
// Request and save a formatter, passed to `callback()` when finished.
wax.GridManager.prototype.getFormatter = function(url, callback) {
var that = this;
// Formatter is cached.
if (typeof this.formatters[url] !== 'undefined') {
callback(null, this.formatters[url]);
return;
} else {
wax.request.get(url, function(err, data) {
if (data && data.formatter) {
that.formatters[url] = new wax.Formatter(data);
} else {
that.formatters[url] = false;
}
callback(err, that.formatters[url]);
});
function getFormatter(url, callback) {
if (typeof formatter !== 'undefined') {
return callback(null, formatter);
} else {
wax.request.get(formatterUrl(url), function(err, data) {
if (data && data.formatter) {
formatter = wax.formatter(data.formatter);
} else {
formatter = false;
}
return callback(err, formatter);
});
}
}
};
// Formatter
// ---------
wax.Formatter = function(obj) {
// Prevent against just any input being used.
if (obj.formatter && typeof obj.formatter === 'string') {
try {
// Ugly, dangerous use of eval.
eval('this.f = ' + obj.formatter);
} catch (e) {
// Syntax errors in formatter
if (console) console.log(e);
}
} else {
this.f = function() {};
function templatedGridUrl(template) {
if (typeof template === 'string') template = [template];
return function templatedGridFinder(url) {
if (!url) return;
var xyz = xyzFinder.exec(url);
if (!xyz) return;
return template[parseInt(xyz[2], 10) % template.length]
.replace('{z}', xyz[1])
.replace('{x}', xyz[2])
.replace('{y}', xyz[3]);
};
}
};
// Wrap the given formatter function in order to
// catch exceptions that it may throw.
wax.Formatter.prototype.format = function(options, data) {
try {
return this.f(options, data);
} catch (e) {
if (console) console.log(e);
}
manager.formatter = function(x) {
if (!arguments.length) return formatter;
formatter = wax.formatter(x);
return manager;
};
manager.formatterUrl = function(x) {
if (!arguments.length) return formatterUrl;
formatterUrl = typeof x === 'string' ?
function() { return x; } : x;
return manager;
};
manager.gridUrl = function(x) {
if (!arguments.length) return gridUrl;
gridUrl = typeof x === 'function' ?
x : templatedGridUrl(x);
return manager;
};
manager.getGrid = function(url, callback) {
getFormatter(url, function(err, f) {
var gurl = gridUrl(url);
if (err || !f || !gurl) return callback(err, null);
wax.request.get(gurl, function(err, t) {
if (err) return callback(err, null);
callback(null, wax.GridInstance(t, f, {
resolution: resolution || 4
}));
});
});
return manager;
};
if (options.formatter) manager.formatter(options.formatter);
if (options.grids) manager.gridUrl(options.grids);
return manager;
};

@@ -418,42 +428,37 @@ // Wax Legend

wax.Legend = function(context, container) {
this.legends = {};
this.context = context;
this.container = container;
if (!this.container) {
this.container = document.createElement('div');
this.container.className = 'wax-legends';
}
this.context.appendChild(this.container);
};
wax.legend = function() {
var element,
legend = {},
container;
wax.Legend.prototype.render = function(urls) {
var url;
for (url in this.legends) {
this.legends[url].style.display = 'none';
}
var render = wax.util.bind(function(url, content) {
if (!content) {
this.legends[url] = false;
} else if (this.legends[url]) {
this.legends[url].style.display = 'block';
legend.element = function() {
return container;
};
legend.content = function(content) {
if (!arguments.length) return element.innerHTML;
if (content) {
element.innerHTML = content;
element.style.display = 'block';
} else {
this.legends[url] = document.createElement('div');
this.legends[url].className = 'wax-legend';
this.legends[url].innerHTML = content;
this.container.appendChild(this.legends[url]);
element.innerHTML = '';
element.style.display = 'none';
}
}, this);
for (var i = 0; i < urls.length; i++) {
url = this.legendUrl(urls[i]);
wax.request.get(url, function(err, data) {
if (data && data.legend) render(url, data.legend);
});
}
};
return this;
};
wax.Legend.prototype.legendUrl = function(url) {
return url.replace(/\d+\/\d+\/\d+\.\w+/, 'layer.json');
legend.add = function() {
container = document.createElement('div');
container.className = 'wax-legends';
element = document.createElement('div');
element.className = 'wax-legend';
element.style.display = 'none';
container.appendChild(element);
return this;
};
return legend.add();
};
// Like underscore's bind, except it runs a function

@@ -472,8 +477,67 @@ // with no arguments off of an object.

self.melt = function(func, obj) {
func.apply(obj, [self, obj]);
return self;
return func.apply(obj, [self, obj]);
};
return self;
};
// Wax GridUtil
// ------------
// Wax header
var wax = wax || {};
// Request
// -------
// Request data cache. `callback(data)` where `data` is the response data.
wax.request = {
cache: {},
locks: {},
promises: {},
get: function(url, callback) {
// Cache hit.
if (this.cache[url]) {
return callback(this.cache[url][0], this.cache[url][1]);
// Cache miss.
} else {
this.promises[url] = this.promises[url] || [];
this.promises[url].push(callback);
// Lock hit.
if (this.locks[url]) return;
// Request.
var that = this;
this.locks[url] = true;
reqwest({
url: url + '?callback=grid',
type: 'jsonp',
jsonpCallback: 'callback',
success: function(data) {
that.locks[url] = false;
that.cache[url] = [null, data];
for (var i = 0; i < that.promises[url].length; i++) {
that.promises[url][i](that.cache[url][0], that.cache[url][1]);
}
},
error: function(err) {
that.locks[url] = false;
that.cache[url] = [err, null];
for (var i = 0; i < that.promises[url].length; i++) {
that.promises[url][i](that.cache[url][0], that.cache[url][1]);
}
}
});
}
}
};
wax = wax || {};
// A wrapper for reqwest jsonp to easily load TileJSON from a URL.
wax.tilejson = function(url, callback) {
reqwest({
url: url + '?callback=grid',
type: 'jsonp',
jsonpCallback: 'callback',
success: callback,
error: callback
});
};
var wax = wax || {};
wax.tooltip = {};

@@ -589,5 +653,8 @@

offset: function(el) {
// TODO: window margin offset
var width = el.offsetWidth,
height = el.offsetHeight,
// TODO: window margins
//
// Okay, so fall back to styles if offsetWidth and height are botched
// by Firefox.
var width = el.offsetWidth || parseInt(el.style.width, 10),
height = el.offsetHeight || parseInt(el.style.height, 10),
top = 0,

@@ -635,4 +702,4 @@ left = 0;

var htmlComputed = document.defaultView ?
window.getComputedStyle(document.body.parentNode, null) :
document.body.parentNode.currentStyle;
window.getComputedStyle(document.body.parentNode, null) :
document.body.parentNode.currentStyle;
if (document.body.parentNode.offsetTop !==

@@ -642,3 +709,3 @@ parseInt(htmlComputed.marginTop, 10) &&

top += parseInt(htmlComputed.marginTop, 10);
left += parseInt(htmlComputed.marginLeft, 10);
left += parseInt(htmlComputed.marginLeft, 10);
}

@@ -653,2 +720,9 @@

},
'$': function(x) {
return (typeof x === 'string') ?
document.getElementById(x) :
x;
},
// From underscore, minus funcbind for now.

@@ -669,20 +743,20 @@ // Returns a version of a function that always has the second parameter,

indexOf: function(array, item) {
var nativeIndexOf = Array.prototype.indexOf;
if (array === null) return -1;
var i, l;
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);
for (i = 0, l = array.length; i < l; i++) if (array[i] === item) return i;
return -1;
var nativeIndexOf = Array.prototype.indexOf;
if (array === null) return -1;
var i, l;
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);
for (i = 0, l = array.length; i < l; i++) if (array[i] === item) return i;
return -1;
},
// is this object an array?
isArray: Array.isArray || function(obj) {
return Object.prototype.toString.call(obj) === '[object Array]';
return Object.prototype.toString.call(obj) === '[object Array]';
},
// From underscore: reimplement the ECMA5 `Object.keys()` methodb
keys: Object.keys || function(obj) {
var hasOwnProperty = Object.prototype.hasOwnProperty;
if (obj !== Object(obj)) throw new TypeError('Invalid object');
var keys = [];
for (var key in obj) if (hasOwnProperty.call(obj, key)) keys[keys.length] = key;
return keys;
var hasOwnProperty = Object.prototype.hasOwnProperty;
if (obj !== Object(obj)) throw new TypeError('Invalid object');
var keys = [];
for (var key in obj) if (hasOwnProperty.call(obj, key)) keys[keys.length] = key;
return keys;
},

@@ -725,2 +799,31 @@ // From quirksmode: normalize the offset of an event from the top-left

// Attribution
// -----------
// Attribution wrapper for Google Maps.
wax.g.attribution = function(map, tilejson) {
tilejson = tilejson || {};
var a, // internal attribution control
attribution = {};
attribution.element = function() {
return a.element();
};
attribution.appendTo = function(elem) {
wax.util.$(elem).appendChild(a.element());
return this;
};
attribution.init = function() {
a = wax.attribution();
a.set(tilejson.attribution);
a.element().className = 'wax-attribution wax-g';
return this;
};
return attribution.init();
};
wax = wax || {};
wax.g = wax.g || {};
// A control that adds interaction to a google Map object.

@@ -734,3 +837,4 @@ //

// **full**.
wax.g.interaction = function(map, options) {
wax.g.interaction = function(map, tilejson, options) {
tilejson = tilejson || {};
options = options || {};

@@ -744,3 +848,3 @@ // Our GridManager (from `gridutil.js`). This will keep the

waxGM: new wax.GridManager(),
waxGM: new wax.GridManager(tilejson),

@@ -778,6 +882,4 @@ // This requires wax.Tooltip or similar

var mapOffset = wax.util.offset(map.getDiv());
for (var i in map.mapTypes) {
if (!map.mapTypes[i].interactive) continue;
var mapType = map.mapTypes[i];
var get = wax.util.bind(function(mapType) {
if (!mapType.interactive) return;
for (var key in mapType.cache) {

@@ -792,3 +894,6 @@ if (key.split('/')[0] != zoom) continue;

}
}
}, this);
// Iterate over base mapTypes and overlayMapTypes.
for (var i in map.mapTypes) get(map.mapTypes[i]);
map.overlayMapTypes.forEach(get);
}

@@ -882,33 +987,27 @@ return this._getTileGrid;

// Legend Control
// --------------
// Adds legends to a google Map object.
wax.g.legend = function(map, options) {
options = options || {};
var legend = {
add: function() {
var url;
this.legend = new wax.Legend(map.getDiv(), options.container);
// Ideally we would use the 'tilesloaded' event here. This doesn't seem to
// work so we use the much less appropriate 'idle' event.
google.maps.event.addListener(map, 'idle', wax.util.bind(function() {
if (url) return;
wax.g.legend = function(map, tilejson) {
tilejson = tilejson || {};
var l, // parent legend
legend = {};
// Get a tile URL for each relevant layer, from which legend URLs
// are derived.
url = [];
for (var i in map.mapTypes) {
if (!map.mapTypes[i].interactive) continue;
var mapType = map.mapTypes[i];
for (var key in mapType.cache) {
url.push(mapType.cache[key].src);
break;
}
};
url.length && this.legend.render(url);
}, this));
return this;
}
legend.add = function() {
l = wax.legend()
.content(tilejson.legend || '');
return this;
};
return legend.add(map);
legend.element = function() {
return l.element();
};
legend.appendTo = function(elem) {
wax.util.$(elem).appendChild(l.element());
return this;
};
return legend.add();
};
// Wax for Google Maps API v3

@@ -931,18 +1030,16 @@ // --------------------------

// }
wax.g.MapType = function(options) {
wax.g.connector = function(options) {
options = options || {};
this.options = {
tiles: options.tiles,
scheme: options.scheme || 'xyz',
blankImage: options.blankImage
};
this.minZoom = options.minzoom || 0;
this.maxZoom = options.maxzoom || 22;
this.name = options.name || '';
this.alt = options.alt || '';
this.filetype = options.filetype || '.png';
this.layerName = options.layerName || 'world-light';
if (options.zoomRange) {
this.minZoom = options.zoomRange[0];
this.maxZoom = options.zoomRange[1];
} else {
this.minZoom = 0;
this.maxZoom = 18;
}
this.baseUrl = options.baseUrl ||
'http://a.tile.mapbox.com/';
this.blankImage = options.blankImage || '';
this.description = options.description || '';

@@ -958,3 +1055,3 @@ // non-configurable options

// Get a tile element from a coordinate, zoom level, and an ownerDocument.
wax.g.MapType.prototype.getTile = function(coord, zoom, ownerDocument) {
wax.g.connector.prototype.getTile = function(coord, zoom, ownerDocument) {
var key = zoom + '/' + coord.x + '/' + coord.y;

@@ -973,3 +1070,3 @@ if (!this.cache[key]) {

// TODO: expire cache data in the gridmanager.
wax.g.MapType.prototype.releaseTile = function(tile) {
wax.g.connector.prototype.releaseTile = function(tile) {
var key = tile.getAttribute('gTileKey');

@@ -981,13 +1078,20 @@ this.cache[key] && delete this.cache[key];

// Get a tile url, based on x, y coordinates and a z value.
wax.g.MapType.prototype.getTileUrl = function(coord, z) {
wax.g.connector.prototype.getTileUrl = function(coord, z) {
// Y coordinate is flipped in Mapbox, compared to Google
var mod = Math.pow(2, z),
y = (mod - 1) - coord.y,
y = (this.options.scheme === 'tms') ?
(mod - 1) - coord.y :
y,
x = (coord.x % mod);
x = (x < 0) ? (coord.x % mod) + mod : x;
return (y >= 0)
? (this.baseUrl + '1.0.0/' + this.layerName + '/' + z + '/' +
x + '/' + y + this.filetype)
: this.blankImage;
x = (x < 0) ? (coord.x % mod) + mod : x;
if (y < 0) return this.options.blankImage;
return this.options.tiles
[parseInt(x + y, 10) %
this.options.tiles.length]
.replace('{z}', z)
.replace('{x}', x)
.replace('{y}', y);
};

@@ -1,4 +0,2 @@

/*!
* 0.1.6 with IE readyState fix in https://github.com/ded/reqwest/issues/18
*
/* wax - 3.0.0 - 1.0.4-320-g97e618c *//*!
* Reqwest! A x-browser general purpose XHR connection manager

@@ -8,2 +6,2 @@ * copyright Dustin Diaz 2011

* license MIT
*/!function(window){function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}function setHeaders(a,b){var c=b.headers||{};c.Accept="text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]="application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function generalCallback(a){lastValue=a}function getRequest(a,b,c){if(a.type!="jsonp"){var d=xhr();d.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(d,a),d.onreadystatechange=readyState(d,b,c),a.before&&a.before(d),d.send(a.data||null);return d}var e=doc.createElement("script");window[getCallbackName(a)]=generalCallback,e.type="text/javascript",e.src=a.url,e.async=!0;var f=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(e)};e.onload=f,e.onreadystatechange=function(){e.readyState=="loaded"||e.readyState=="complete"&&f()},head.appendChild(e)}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function setType(a){if(/\.json$/.test(a))return"json";if(/\.jsonp$/.test(a))return"jsonp";if(/\.js$/.test(a))return"js";if(/\.html?$/.test(a))return"html";if(/\.xml$/.test(a))return"xml";return"js"}function init(o,fn){function complete(a){o.complete&&o.complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText;switch(type){case"json":resp=eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function error(a){o.error&&o.error(a),complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function reqwest(a,b){return new Reqwest(a,b)}function enc(a){return encodeURIComponent(a)}function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):!0)+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this);var wax=wax||{};Array.prototype.reduce||(Array.prototype.reduce=function(a){"use strict";if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;var d=0,e;if(arguments.length>=2)e=arguments[1];else do{if(d in b){e=b[d++];break}if(++d>=c)throw new TypeError}while(!0);while(d<c)d in b&&(e=a.call(undefined,e,b[d],d,b)),d++;return e}),wax.Record=function(a,b){var c=function(a,b){var c=a.split(".").reduce(function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){if(wax.util.isArray(a)&&a[0]&&f(a[0]))return{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)};return!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=wax.util.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}};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]){var c=this;this.locks[a]=!0,reqwest({url:a+"?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.GridInstance=function(a,b,c){c=c||{},this.grid_tile=a,this.formatter=b,this.resolution=c.resolution||4,this.tileSize=c.tileSize||256},wax.GridInstance.prototype.resolveCode=function(a){a>=93&&a--,a>=35&&a--,a-=32;return a},wax.GridInstance.prototype.getFeature=function(a,b,c,d){if(!!this.grid_tile&&!!this.grid_tile.grid){var e=wax.util.offset(c),f=e.left,g=e.top,h=e.width/this.tileSize*this.resolution;if(b-g<0)return;if(a-f<0)return;if(Math.floor(b-g)>this.tileSize)return;if(Math.floor(a-f)>this.tileSize)return;var i=this.grid_tile.grid[Math.floor((b-g)/h)].charCodeAt(Math.floor((a-f)/h));i=this.resolveCode(i);if(this.grid_tile.keys[i]&&this.grid_tile.data[this.grid_tile.keys[i]])return this.formatter.format(d,this.grid_tile.data[this.grid_tile.keys[i]])}},wax.GridManager=function(a){a=a||{},this.resolution=a.resolution||4,this.grid_tiles={},this.key_maps={},this.formatters={},this.locks={}},wax.GridManager.prototype.getGrid=function(a,b){var c=this;c.getFormatter(c.formatterUrl(a),function(d,e){if(d||!e)return b(d,null);wax.request.get(c.tileDataUrl(a),function(a,d){if(a)return b(a,null);b(null,new wax.GridInstance(d,e,{resolution:c.resolution||4}))})})},wax.GridManager.prototype.tileDataUrl=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")},wax.GridManager.prototype.formatterUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},wax.GridManager.prototype.getFormatter=function(a,b){var c=this;typeof this.formatters[a]!="undefined"?b(null,this.formatters[a]):wax.request.get(a,function(d,e){e&&e.formatter?c.formatters[a]=new wax.Formatter(e):c.formatters[a]=!1,b(d,c.formatters[a])})},wax.Formatter=function(obj){if(obj.formatter&&typeof obj.formatter=="string")try{eval("this.f = "+obj.formatter)}catch(e){console&&console.log(e)}else this.f=function(){}},wax.Formatter.prototype.format=function(a,b){try{return this.f(a,b)}catch(c){console&&console.log(c)}};var wax=wax||{};wax.Legend=function(a,b){this.legends={},this.context=a,this.container=b,this.container||(this.container=document.createElement("div"),this.container.className="wax-legends"),this.context.appendChild(this.container)},wax.Legend.prototype.render=function(a){var b;for(b in this.legends)this.legends[b].style.display="none";var c=wax.util.bind(function(a,b){b?this.legends[a]?this.legends[a].style.display="block":(this.legends[a]=document.createElement("div"),this.legends[a].className="wax-legend",this.legends[a].innerHTML=b,this.container.appendChild(this.legends[a])):this.legends[a]=!1},this);for(var d=0;d<a.length;d++)b=this.legendUrl(a[d]),wax.request.get(b,function(a,d){d&&d.legend&&c(b,d.legend)})},wax.Legend.prototype.legendUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")};var w=function(a){a.melt=function(b,c){b.apply(c,[a,c]);return a};return a},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,c,d){tooltip=document.createElement("div"),tooltip.className="wax-tooltip wax-tooltip-"+c,tooltip.innerHTML=a,b.appendChild(tooltip);return tooltip},wax.tooltip.prototype.hideTooltip=function(a){if(!!a){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,c){this.unselect(b);var d=this.getTooltip(a,b,c),e=document.createElement("a");e.href="#close",e.className="close",e.innerHTML="Close";var f=wax.util.bind(function(a){this.hideTooltip(d),this._currentTooltip=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault();return!1},this);e.addEventListener?e.addEventListener("click",f,!1):e.attachEvent&&e.attachEvent("onclick",f),d.className+=" wax-popup",d.innerHTML=a,d.appendChild(e),this._currentTooltip=d},wax.tooltip.prototype.select=function(a,b,c,d){if(!!a){if(this.isPopup(this._currentTooltip))return;this._currentTooltip=this.getTooltip(a,b,c,d),b.style.cursor="pointer"}},wax.tooltip.prototype.unselect=function(a){this.isPopup(this._currentTooltip)||(a.style.cursor="default",this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined))},wax.tooltip.prototype.out=wax.tooltip.prototype.unselect,wax.tooltip.prototype.over=wax.tooltip.prototype.select,wax.tooltip.prototype.click=wax.tooltip.prototype.click,wax.util=wax.util||{},wax.util={offset:function(a){var b=a.offsetWidth,c=a.offsetHeight,d=0,e=0,f=function(a){if(a!==document.body&&a!==document.documentElement){d+=a.offsetTop,e+=a.offsetLeft;var b=a.style.transform||a.style["-webkit-transform"]||a.style.MozTransform;if(b)if(match=b.match(/translate\((.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10);else if(match=b.match(/translate3d\((.+)px, (.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10)}};f(a);try{while(a=a.offsetParent)f(a)}catch(g){}d+=document.body.offsetTop,e+=document.body.offsetLeft,d+=document.body.parentNode.offsetTop,e+=document.body.parentNode.offsetLeft;var h=document.defaultView?window.getComputedStyle(document.body.parentNode,null):document.body.parentNode.currentStyle;document.body.parentNode.offsetTop!==parseInt(h.marginTop,10)&&!isNaN(parseInt(h.marginTop,10))&&(d+=parseInt(h.marginTop,10),e+=parseInt(h.marginLeft,10));return{top:d,left:e,height:c,width:b}},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}}},wax=wax||{},wax.g=wax.g||{},wax.g.interaction=function(a,b){b=b||{};var c={modifyingEvents:["dragstart","dragend","drag","zoom_changed","resize","center_changed","bounds_changed"],waxGM:new wax.GridManager,callbacks:b.callbacks||new wax.tooltip,clickAction:b.clickAction||"full",add:function(){for(var b=0;b<this.modifyingEvents.length;b++)google.maps.event.addListener(a,this.modifyingEvents[b],wax.util.bind(this.clearTileGrid,this));google.maps.event.addListener(a,"mousemove",this.onMove()),google.maps.event.addListener(a,"click",this.click());return this},getTileGrid:function(){if(!this._getTileGrid){this._getTileGrid=[];var b=a.getZoom(),c=wax.util.offset(a.getDiv());for(var d in a.mapTypes){if(!a.mapTypes[d].interactive)continue;var e=a.mapTypes[d];for(var f in e.cache){if(f.split("/")[0]!=b)continue;var g=wax.util.offset(e.cache[f]);this._getTileGrid.push([g.top-c.top,g.left-c.left,e.cache[f]])}}}return this._getTileGrid},clearTileGrid:function(a,b){this._getTileGrid=null},getTile:function(a){var b,c=this.getTileGrid();for(var d=0;d<c.length;d++)if(c[d][0]<a.pixel.y&&c[d][0]+256>a.pixel.y&&c[d][1]<a.pixel.x&&c[d][1]+256>a.pixel.x){b=c[d][2];break}return b||!1},onMove:function(b){this._onMove||(this._onMove=wax.util.bind(function(b){var c=this.getTile(b);c&&this.waxGM.getGrid(c.src,wax.util.bind(function(d,e){if(!d&&!!e){var f=e.getFeature(b.pixel.x+wax.util.offset(a.getDiv()).left,b.pixel.y+wax.util.offset(a.getDiv()).top,c,{format:"teaser"});f&&this.feature!==f?(this.feature=f,this.callbacks.out(a.getDiv()),this.callbacks.over(f,a.getDiv(),0,b)):f||(this.feature=null,this.callbacks.out(a.getDiv()))}},this))},this));return this._onMove},click:function(b){this._onClick||(this._onClick=wax.util.bind(function(b){var c=this.getTile(b);c&&this.waxGM.getGrid(c.src,wax.util.bind(function(d,e){if(!d&&!!e){var f=e.getFeature(b.pixel.x+wax.util.offset(a.getDiv()).left,b.pixel.y+wax.util.offset(a.getDiv()).top,c,{format:this.clickAction});if(f)switch(this.clickAction){case"full":this.callbacks.click(f,a.getDiv(),0,b);break;case"location":window.location=f}}},this))},this));return this._onClick}};return c.add(a)},wax=wax||{},wax.g=wax.g||{},wax.g.legend=function(a,b){b=b||{};var c={add:function(){var c;this.legend=new wax.Legend(a.getDiv(),b.container),google.maps.event.addListener(a,"idle",wax.util.bind(function(){if(!c){c=[];for(var b in a.mapTypes){if(!a.mapTypes[b].interactive)continue;var d=a.mapTypes[b];for(var e in d.cache){c.push(d.cache[e].src);break}}c.length&&this.legend.render(c)}},this));return this}};return c.add(a)};var wax=wax||{};wax.g=wax.g||{},wax.g.MapType=function(a){a=a||{},this.name=a.name||"",this.alt=a.alt||"",this.filetype=a.filetype||".png",this.layerName=a.layerName||"world-light",a.zoomRange?(this.minZoom=a.zoomRange[0],this.maxZoom=a.zoomRange[1]):(this.minZoom=0,this.maxZoom=18),this.baseUrl=a.baseUrl||"http://a.tile.mapbox.com/",this.blankImage=a.blankImage||"",this.interactive=!0,this.tileSize=new google.maps.Size(256,256),this.cache={}},wax.g.MapType.prototype.getTile=function(a,b,c){var d=b+"/"+a.x+"/"+a.y;if(!this.cache[d]){var e=this.cache[d]=new Image(256,256);this.cache[d].src=this.getTileUrl(a,b),this.cache[d].setAttribute("gTileKey",d),this.cache[d].onerror=function(){e.style.display="none"}}return this.cache[d]},wax.g.MapType.prototype.releaseTile=function(a){var b=a.getAttribute("gTileKey");this.cache[b]&&delete this.cache[b],a.parentNode&&a.parentNode.removeChild(a)},wax.g.MapType.prototype.getTileUrl=function(a,b){var c=Math.pow(2,b),d=c-1-a.y,e=a.x%c;e=e<0?a.x%c+c:e;return d>=0?this.baseUrl+"1.0.0/"+this.layerName+"/"+b+"/"+e+"/"+d+this.filetype:this.blankImage}
*/!function(window){function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}function setHeaders(a,b){var c=b.headers||{};c.Accept=c.Accept||"text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]=c["Content-type"]||"application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function generalCallback(a){lastValue=a}function getRequest(a,b,c){if(a.type!="jsonp"){var d=xhr();d.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(d,a),d.onreadystatechange=readyState(d,b,c),a.before&&a.before(d),d.send(a.data||null);return d}var e=doc.createElement("script");window[getCallbackName(a)]=generalCallback,e.type="text/javascript",e.src=a.url,e.async=!0;var f=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(e)};e.onload=f,e.onreadystatechange=function(){/^loaded|complete$/.test(e.readyState)&&f()},head.appendChild(e)}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function setType(a){return/\.json$/.test(a)?"json":/\.jsonp$/.test(a)?"jsonp":/\.js$/.test(a)?"js":/\.html?$/.test(a)?"html":/\.xml$/.test(a)?"xml":"js"}function init(o,fn){function complete(a){o.complete&&o.complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText,JSON;switch(type){case"json":resp=JSON?JSON.parse(r):eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function error(a){o.error&&o.error(a),complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function reqwest(a,b){return new Reqwest(a,b)}function enc(a){return encodeURIComponent(a)}function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):"")+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this);var wax=wax||{};Array.prototype.reduce||(Array.prototype.reduce=function(a){"use strict";if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;var d=0,e;if(arguments.length>=2)e=arguments[1];else do{if(d in b){e=b[d++];break}if(++d>=c)throw new TypeError}while(!0);while(d<c)d in b&&(e=a.call(undefined,e,b[d],d,b)),d++;return e}),wax.Record=function(a,b){var c=function(a,b){var c=a.split(".").reduce(function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){return wax.util.isArray(a)&&a[0]&&f(a[0])?{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)}:!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=wax.util.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}},wax=wax||{},wax.attribution=function(){var a,b={};b.set=function(b){if(typeof b!="undefined"){a.innerHTML=b;return this}},b.element=function(){return a},b.init=function(){a=document.createElement("div"),a.className="wax-attribution";return this};return b.init()},wax.formatter=function(x){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(){};formatter.format=function(a,b){try{return f(a,b)}catch(c){console&&console.log(c)}};return formatter},wax.GridInstance=function(a,b,c){function f(a){a>=93&&a--,a>=35&&a--,a-=32;return a}c=c||{};var d={},e=c.resolution||4;tileSize=c.tileSize||256,d.getFeature=function(c,d,g,h){if(!!a&&!!a.grid){var i=wax.util.offset(g),j=i.left,k=i.top,l=i.width/tileSize*e;if(d-k<0||c-j<0)return;if(Math.floor(d-k)>tileSize||Math.floor(c-j)>tileSize)return;var m=a.grid[Math.floor((d-k)/l)].charCodeAt(Math.floor((c-j)/l));m=f(m);if(a.keys[m]&&a.data[a.keys[m]])return b.format(h,a.data[a.keys[m]])}};return d},wax.GridManager=function(a){function j(a){typeof a=="string"&&(a=[a]);return function b(b){if(!!b){var c=e.exec(b);if(!c)return;return a[parseInt(c[2],10)%a.length].replace("{z}",c[1]).replace("{x}",c[2]).replace("{y}",c[3])}}}function i(a,b){if(typeof f!="undefined")return b(null,f);wax.request.get(g(a),function(a,c){c&&c.formatter?f=wax.formatter(c.formatter):f=!1;return b(a,f)})}a=a||{};var b=a.resolution||4,c={},d={},e=new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),f,g=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},h=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")};d.formatter=function(a){if(!arguments.length)return f;f=wax.formatter(a);return d},d.formatterUrl=function(a){if(!arguments.length)return g;g=typeof a=="string"?function(){return a}:a;return d},d.gridUrl=function(a){if(!arguments.length)return h;h=typeof a=="function"?a:j(a);return d},d.getGrid=function(a,c){i(a,function(d,e){var f=h(a);if(d||!e||!f)return c(d,null);wax.request.get(f,function(a,d){if(a)return c(a,null);c(null,wax.GridInstance(d,e,{resolution:b||4}))})});return d},a.formatter&&d.formatter(a.formatter),a.grids&&d.gridUrl(a.grids);return d};var wax=wax||{};wax.legend=function(){var a,b={},c;b.element=function(){return c},b.content=function(b){if(!arguments.length)return a.innerHTML;b?(a.innerHTML=b,a.style.display="block"):(a.innerHTML="",a.style.display="none");return this},b.add=function(){c=document.createElement("div"),c.className="wax-legends",a=document.createElement("div"),a.className="wax-legend",a.style.display="none",c.appendChild(a);return this};return b.add()};var w=function(a){a.melt=function(b,c){return b.apply(c,[a,c])};return a},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]){var c=this;this.locks[a]=!0,reqwest({url:a+"?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=wax||{},wax.tilejson=function(a,b){reqwest({url:a+"?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,c,d){tooltip=document.createElement("div"),tooltip.className="wax-tooltip wax-tooltip-"+c,tooltip.innerHTML=a,b.appendChild(tooltip);return tooltip},wax.tooltip.prototype.hideTooltip=function(a){if(!!a){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,c){this.unselect(b);var d=this.getTooltip(a,b,c),e=document.createElement("a");e.href="#close",e.className="close",e.innerHTML="Close";var f=wax.util.bind(function(a){this.hideTooltip(d),this._currentTooltip=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault();return!1},this);e.addEventListener?e.addEventListener("click",f,!1):e.attachEvent&&e.attachEvent("onclick",f),d.className+=" wax-popup",d.innerHTML=a,d.appendChild(e),this._currentTooltip=d},wax.tooltip.prototype.select=function(a,b,c,d){if(!!a){if(this.isPopup(this._currentTooltip))return;this._currentTooltip=this.getTooltip(a,b,c,d),b.style.cursor="pointer"}},wax.tooltip.prototype.unselect=function(a){this.isPopup(this._currentTooltip)||(a.style.cursor="default",this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined))},wax.tooltip.prototype.out=wax.tooltip.prototype.unselect,wax.tooltip.prototype.over=wax.tooltip.prototype.select,wax.tooltip.prototype.click=wax.tooltip.prototype.click,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=0,e=0,f=function(a){if(a!==document.body&&a!==document.documentElement){d+=a.offsetTop,e+=a.offsetLeft;var b=a.style.transform||a.style["-webkit-transform"]||a.style.MozTransform;if(b)if(match=b.match(/translate\((.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10);else if(match=b.match(/translate3d\((.+)px, (.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10)}};f(a);try{while(a=a.offsetParent)f(a)}catch(g){}d+=document.body.offsetTop,e+=document.body.offsetLeft,d+=document.body.parentNode.offsetTop,e+=document.body.parentNode.offsetLeft;var h=document.defaultView?window.getComputedStyle(document.body.parentNode,null):document.body.parentNode.currentStyle;document.body.parentNode.offsetTop!==parseInt(h.marginTop,10)&&!isNaN(parseInt(h.marginTop,10))&&(d+=parseInt(h.marginTop,10),e+=parseInt(h.marginLeft,10));return{top:d,left:e,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}}},wax=wax||{},wax.g=wax.g||{},wax.g.attribution=function(a,b){b=b||{};var c,d={};d.element=function(){return c.element()},d.appendTo=function(a){wax.util.$(a).appendChild(c.element());return this},d.init=function(){c=wax.attribution(),c.set(b.attribution),c.element().className="wax-attribution wax-g";return this};return d.init()},wax=wax||{},wax.g=wax.g||{},wax.g.interaction=function(a,b,c){b=b||{},c=c||{};var d={modifyingEvents:["dragstart","dragend","drag","zoom_changed","resize","center_changed","bounds_changed"],waxGM:new wax.GridManager(b),callbacks:c.callbacks||new wax.tooltip,clickAction:c.clickAction||"full",add:function(){for(var b=0;b<this.modifyingEvents.length;b++)google.maps.event.addListener(a,this.modifyingEvents[b],wax.util.bind(this.clearTileGrid,this));google.maps.event.addListener(a,"mousemove",this.onMove()),google.maps.event.addListener(a,"click",this.click());return this},getTileGrid:function(){if(!this._getTileGrid){this._getTileGrid=[];var b=a.getZoom(),c=wax.util.offset(a.getDiv()),d=wax.util.bind(function(a){if(!!a.interactive)for(var d in a.cache){if(d.split("/")[0]!=b)continue;var e=wax.util.offset(a.cache[d]);this._getTileGrid.push([e.top-c.top,e.left-c.left,a.cache[d]])}},this);for(var e in a.mapTypes)d(a.mapTypes[e]);a.overlayMapTypes.forEach(d)}return this._getTileGrid},clearTileGrid:function(a,b){this._getTileGrid=null},getTile:function(a){var b,c=this.getTileGrid();for(var d=0;d<c.length;d++)if(c[d][0]<a.pixel.y&&c[d][0]+256>a.pixel.y&&c[d][1]<a.pixel.x&&c[d][1]+256>a.pixel.x){b=c[d][2];break}return b||!1},onMove:function(b){this._onMove||(this._onMove=wax.util.bind(function(b){var c=this.getTile(b);c&&this.waxGM.getGrid(c.src,wax.util.bind(function(d,e){if(!d&&!!e){var f=e.getFeature(b.pixel.x+wax.util.offset(a.getDiv()).left,b.pixel.y+wax.util.offset(a.getDiv()).top,c,{format:"teaser"});f&&this.feature!==f?(this.feature=f,this.callbacks.out(a.getDiv()),this.callbacks.over(f,a.getDiv(),0,b)):f||(this.feature=null,this.callbacks.out(a.getDiv()))}},this))},this));return this._onMove},click:function(b){this._onClick||(this._onClick=wax.util.bind(function(b){var c=this.getTile(b);c&&this.waxGM.getGrid(c.src,wax.util.bind(function(d,e){if(!d&&!!e){var f=e.getFeature(b.pixel.x+wax.util.offset(a.getDiv()).left,b.pixel.y+wax.util.offset(a.getDiv()).top,c,{format:this.clickAction});if(f)switch(this.clickAction){case"full":this.callbacks.click(f,a.getDiv(),0,b);break;case"location":window.location=f}}},this))},this));return this._onClick}};return d.add(a)},wax=wax||{},wax.g=wax.g||{},wax.g.legend=function(a,b){b=b||{};var c,d={};d.add=function(){c=wax.legend().content(b.legend||"");return this},d.element=function(){return c.element()},d.appendTo=function(a){wax.util.$(a).appendChild(c.element());return this};return d.add()};var wax=wax||{};wax.g=wax.g||{},wax.g.connector=function(a){a=a||{},this.options={tiles:a.tiles,scheme:a.scheme||"xyz",blankImage:a.blankImage},this.minZoom=a.minzoom||0,this.maxZoom=a.maxzoom||22,this.name=a.name||"",this.description=a.description||"",this.interactive=!0,this.tileSize=new google.maps.Size(256,256),this.cache={}},wax.g.connector.prototype.getTile=function(a,b,c){var d=b+"/"+a.x+"/"+a.y;if(!this.cache[d]){var e=this.cache[d]=new Image(256,256);this.cache[d].src=this.getTileUrl(a,b),this.cache[d].setAttribute("gTileKey",d),this.cache[d].onerror=function(){e.style.display="none"}}return this.cache[d]},wax.g.connector.prototype.releaseTile=function(a){var b=a.getAttribute("gTileKey");this.cache[b]&&delete this.cache[b],a.parentNode&&a.parentNode.removeChild(a)},wax.g.connector.prototype.getTileUrl=function(a,b){var c=Math.pow(2,b),d=this.options.scheme==="tms"?c-1-a.y:d,e=a.x%c;e=e<0?a.x%c+c:e;return d<0?this.options.blankImage:this.options.tiles[parseInt(e+d,10)%this.options.tiles.length].replace("{z}",b).replace("{x}",e).replace("{y}",d)}

@@ -0,4 +1,5 @@

/* wax - 3.0.0 - 1.0.4-320-g97e618c */
/*!
* 0.1.6 with IE readyState fix in https://github.com/ded/reqwest/issues/18
*
* Reqwest! A x-browser general purpose XHR connection manager

@@ -9,4 +10,3 @@ * copyright Dustin Diaz 2011

*/
!function(window){function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):!0)+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}function enc(a){return encodeURIComponent(a)}function reqwest(a,b){return new Reqwest(a,b)}function init(o,fn){function error(a){o.error&&o.error(a),complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText;switch(type){case"json":resp=eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function complete(a){o.complete&&o.complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function setType(a){if(/\.json$/.test(a))return"json";if(/\.jsonp$/.test(a))return"jsonp";if(/\.js$/.test(a))return"js";if(/\.html?$/.test(a))return"html";if(/\.xml$/.test(a))return"xml";return"js"}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function getRequest(a,b,c){if(a.type!="jsonp"){var f=xhr();f.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(f,a),f.onreadystatechange=readyState(f,b,c),a.before&&a.before(f),f.send(a.data||null);return f}var d=doc.createElement("script");window[getCallbackName(a)]=generalCallback,d.type="text/javascript",d.src=a.url,d.async=!0;var e=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(d)};d.onload=e,d.onreadystatechange=function(){d.readyState=="loaded"||d.readyState=="complete"&&e()},head.appendChild(d)}function generalCallback(a){lastValue=a}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function setHeaders(a,b){var c=b.headers||{};c.Accept="text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]="application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this)
// Instantiate objects based on a JSON "record". The record must be a statement
!function(window){function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):"")+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}function enc(a){return encodeURIComponent(a)}function reqwest(a,b){return new Reqwest(a,b)}function init(o,fn){function error(a){o.error&&o.error(a),complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText,JSON;switch(type){case"json":resp=JSON?JSON.parse(r):eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function complete(a){o.complete&&o.complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function setType(a){if(/\.json$/.test(a))return"json";if(/\.jsonp$/.test(a))return"jsonp";if(/\.js$/.test(a))return"js";if(/\.html?$/.test(a))return"html";if(/\.xml$/.test(a))return"xml";return"js"}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function getRequest(a,b,c){if(a.type!="jsonp"){var f=xhr();f.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(f,a),f.onreadystatechange=readyState(f,b,c),a.before&&a.before(f),f.send(a.data||null);return f}var d=doc.createElement("script");window[getCallbackName(a)]=generalCallback,d.type="text/javascript",d.src=a.url,d.async=!0;var e=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(d)};d.onload=e,d.onreadystatechange=function(){/^loaded|complete$/.test(d.readyState)&&e()},head.appendChild(d)}function generalCallback(a){lastValue=a}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function setHeaders(a,b){var c=b.headers||{};c.Accept=c.Accept||"text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]=c["Content-type"]||"application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this)// Instantiate objects based on a JSON "record". The record must be a statement
// array in the following form:

@@ -208,51 +208,60 @@ //

};
// Wax GridUtil
// ------------
wax = wax || {};
// Wax header
var wax = wax || {};
// Attribution
// -----------
wax.attribution = function() {
var container,
a = {};
// Request
// -------
// Request data cache. `callback(data)` where `data` is the response data.
wax.request = {
cache: {},
locks: {},
promises: {},
get: function(url, callback) {
// Cache hit.
if (this.cache[url]) {
return callback(this.cache[url][0], this.cache[url][1]);
// Cache miss.
} else {
this.promises[url] = this.promises[url] || [];
this.promises[url].push(callback);
// Lock hit.
if (this.locks[url]) return;
// Request.
var that = this;
this.locks[url] = true;
reqwest({
url: url + '?callback=grid',
type: 'jsonp',
jsonpCallback: 'callback',
success: function(data) {
that.locks[url] = false;
that.cache[url] = [null, data];
for (var i = 0; i < that.promises[url].length; i++) {
that.promises[url][i](that.cache[url][0], that.cache[url][1]);
}
},
error: function(err) {
that.locks[url] = false;
that.cache[url] = [err, null];
for (var i = 0; i < that.promises[url].length; i++) {
that.promises[url][i](that.cache[url][0], that.cache[url][1]);
}
}
});
a.set = function(content) {
if (typeof content === 'undefined') return;
container.innerHTML = content;
return this;
};
a.element = function() {
return container;
};
a.init = function() {
container = document.createElement('div');
container.className = 'wax-attribution';
return this;
};
return a.init();
};
// Formatter
// ---------
wax.formatter = function(x) {
var formatter = {},
f;
// Prevent against just any input being used.
if (x && typeof x === 'string') {
try {
// Ugly, dangerous use of eval.
eval('f = ' + x);
} catch (e) {
if (console) console.log(e);
}
} else if (x && typeof x === 'function') {
f = x;
} else {
f = function() {};
}
// Wrap the given formatter function in order to
// catch exceptions that it may throw.
formatter.format = function(options, data) {
try {
return f(options, data);
} catch (e) {
if (console) console.log(e);
}
};
return formatter;
};
// GridInstance

@@ -264,60 +273,57 @@ // ------------

options = options || {};
this.grid_tile = grid_tile;
this.formatter = formatter;
// resolution is the grid-elements-per-pixel ratio of gridded data.
this.resolution = options.resolution || 4;
// The size of a tile element. For now we expect tiles to be squares.
this.tileSize = options.tileSize || 256;
};
var instance = {},
resolution = options.resolution || 4;
tileSize = options.tileSize || 256;
// Resolve the UTF-8 encoding stored in grids to simple
// number values.
// See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
// for details.
wax.GridInstance.prototype.resolveCode = function(key) {
if (key >= 93) key--;
if (key >= 35) key--;
key -= 32;
return key;
};
// Resolve the UTF-8 encoding stored in grids to simple
// number values.
// See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
// for details.
function resolveCode(key) {
if (key >= 93) key--;
if (key >= 35) key--;
key -= 32;
return key;
}
// Get a feature:
//
// * `x` and `y`: the screen coordinates of an event
// * `tile_element`: a DOM element of a tile, from which we can get an offset.
// * `options` options to give to the formatter: minimally having a `format`
// member, being `full`, `teaser`, or something else.
wax.GridInstance.prototype.getFeature = function(x, y, tile_element, options) {
if (!(this.grid_tile && this.grid_tile.grid)) return;
// Get a feature:
//
// * `x` and `y`: the screen coordinates of an event
// * `tile_element`: a DOM element of a tile, from which we can get an offset.
// * `options` options to give to the formatter: minimally having a `format`
// member, being `full`, `teaser`, or something else.
instance.getFeature = function(x, y, tile_element, options) {
if (!(grid_tile && grid_tile.grid)) return;
// IE problem here - though recoverable, for whatever reason
var offset = wax.util.offset(tile_element);
var tileX = offset.left;
var tileY = offset.top;
// IE problem here - though recoverable, for whatever reason
var offset = wax.util.offset(tile_element),
tileX = offset.left,
tileY = offset.top,
res = (offset.width / tileSize) * resolution;
// This tile's resolution. larger tiles will have lower, aka coarser, resolutions
var res = (offset.width / this.tileSize) * this.resolution;
// This tile's resolution. larger tiles will have lower, aka coarser, resolutions
if ((y - tileY < 0) || (x - tileX < 0)) return;
if ((Math.floor(y - tileY) > tileSize) ||
(Math.floor(x - tileX) > tileSize)) return;
// Find the key in the grid. The above calls should ensure that
// the grid's array is large enough to make this work.
var key = grid_tile.grid[
Math.floor((y - tileY) / res)
].charCodeAt(
Math.floor((x - tileX) / res)
);
if (y - tileY < 0) return;
if (x - tileX < 0) return;
if (Math.floor(y - tileY) > this.tileSize) return;
if (Math.floor(x - tileX) > this.tileSize) return;
key = resolveCode(key);
// Find the key in the grid. The above calls should ensure that
// the grid's array is large enough to make this work.
var key = this.grid_tile.grid[
Math.floor((y - tileY) / res)
].charCodeAt(
Math.floor((x - tileX) / res)
);
// If this layers formatter hasn't been loaded yet,
// download and load it now.
if (grid_tile.keys[key] && grid_tile.data[grid_tile.keys[key]]) {
return formatter.format(options, grid_tile.data[grid_tile.keys[key]]);
}
};
key = this.resolveCode(key);
// If this layers formatter hasn't been loaded yet,
// download and load it now.
if (this.grid_tile.keys[key] && this.grid_tile.data[this.grid_tile.keys[key]]) {
return this.formatter.format(options, this.grid_tile.data[this.grid_tile.keys[key]]);
}
return instance;
};
// GridManager

@@ -332,80 +338,84 @@ // -----------

options = options || {};
this.resolution = options.resolution || 4;
this.grid_tiles = {};
this.key_maps = {};
this.formatters = {};
this.locks = {};
};
// Get a grid - calls `callback` with either a `GridInstance`
// object or false. Behind the scenes, this calls `getFormatter`
// and gets grid data, and tries to avoid re-downloading either.
wax.GridManager.prototype.getGrid = function(url, callback) {
var that = this;
that.getFormatter(that.formatterUrl(url), function(err, f) {
if (err || !f) return callback(err, null);
var resolution = options.resolution || 4,
grid_tiles = {},
manager = {},
xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),
formatter;
wax.request.get(that.tileDataUrl(url), function(err, t) {
if (err) return callback(err, null);
callback(null, new wax.GridInstance(t, f, {
resolution: that.resolution || 4
}));
});
});
};
var formatterUrl = function(url) {
return url.replace(/\d+\/\d+\/\d+\.\w+/, 'layer.json');
};
// Simplistically derive the URL of the grid data endpoint from a tile URL
wax.GridManager.prototype.tileDataUrl = function(url) {
return url.replace(/(\.png|\.jpg|\.jpeg)(\d*)/, '.grid.json');
};
var gridUrl = function(url) {
return url.replace(/(\.png|\.jpg|\.jpeg)(\d*)/, '.grid.json');
};
// Simplistically derive the URL of the formatter function from a tile URL
wax.GridManager.prototype.formatterUrl = function(url) {
return url.replace(/\d+\/\d+\/\d+\.\w+/, 'layer.json');
};
// Request and save a formatter, passed to `callback()` when finished.
wax.GridManager.prototype.getFormatter = function(url, callback) {
var that = this;
// Formatter is cached.
if (typeof this.formatters[url] !== 'undefined') {
callback(null, this.formatters[url]);
return;
} else {
wax.request.get(url, function(err, data) {
if (data && data.formatter) {
that.formatters[url] = new wax.Formatter(data);
} else {
that.formatters[url] = false;
}
callback(err, that.formatters[url]);
});
function getFormatter(url, callback) {
if (typeof formatter !== 'undefined') {
return callback(null, formatter);
} else {
wax.request.get(formatterUrl(url), function(err, data) {
if (data && data.formatter) {
formatter = wax.formatter(data.formatter);
} else {
formatter = false;
}
return callback(err, formatter);
});
}
}
};
// Formatter
// ---------
wax.Formatter = function(obj) {
// Prevent against just any input being used.
if (obj.formatter && typeof obj.formatter === 'string') {
try {
// Ugly, dangerous use of eval.
eval('this.f = ' + obj.formatter);
} catch (e) {
// Syntax errors in formatter
if (console) console.log(e);
}
} else {
this.f = function() {};
function templatedGridUrl(template) {
if (typeof template === 'string') template = [template];
return function templatedGridFinder(url) {
if (!url) return;
var xyz = xyzFinder.exec(url);
if (!xyz) return;
return template[parseInt(xyz[2], 10) % template.length]
.replace('{z}', xyz[1])
.replace('{x}', xyz[2])
.replace('{y}', xyz[3]);
};
}
};
// Wrap the given formatter function in order to
// catch exceptions that it may throw.
wax.Formatter.prototype.format = function(options, data) {
try {
return this.f(options, data);
} catch (e) {
if (console) console.log(e);
}
manager.formatter = function(x) {
if (!arguments.length) return formatter;
formatter = wax.formatter(x);
return manager;
};
manager.formatterUrl = function(x) {
if (!arguments.length) return formatterUrl;
formatterUrl = typeof x === 'string' ?
function() { return x; } : x;
return manager;
};
manager.gridUrl = function(x) {
if (!arguments.length) return gridUrl;
gridUrl = typeof x === 'function' ?
x : templatedGridUrl(x);
return manager;
};
manager.getGrid = function(url, callback) {
getFormatter(url, function(err, f) {
var gurl = gridUrl(url);
if (err || !f || !gurl) return callback(err, null);
wax.request.get(gurl, function(err, t) {
if (err) return callback(err, null);
callback(null, wax.GridInstance(t, f, {
resolution: resolution || 4
}));
});
});
return manager;
};
if (options.formatter) manager.formatter(options.formatter);
if (options.grids) manager.gridUrl(options.grids);
return manager;
};

@@ -418,42 +428,37 @@ // Wax Legend

wax.Legend = function(context, container) {
this.legends = {};
this.context = context;
this.container = container;
if (!this.container) {
this.container = document.createElement('div');
this.container.className = 'wax-legends';
}
this.context.appendChild(this.container);
};
wax.legend = function() {
var element,
legend = {},
container;
wax.Legend.prototype.render = function(urls) {
var url;
for (url in this.legends) {
this.legends[url].style.display = 'none';
}
var render = wax.util.bind(function(url, content) {
if (!content) {
this.legends[url] = false;
} else if (this.legends[url]) {
this.legends[url].style.display = 'block';
legend.element = function() {
return container;
};
legend.content = function(content) {
if (!arguments.length) return element.innerHTML;
if (content) {
element.innerHTML = content;
element.style.display = 'block';
} else {
this.legends[url] = document.createElement('div');
this.legends[url].className = 'wax-legend';
this.legends[url].innerHTML = content;
this.container.appendChild(this.legends[url]);
element.innerHTML = '';
element.style.display = 'none';
}
}, this);
for (var i = 0; i < urls.length; i++) {
url = this.legendUrl(urls[i]);
wax.request.get(url, function(err, data) {
if (data && data.legend) render(url, data.legend);
});
}
};
return this;
};
wax.Legend.prototype.legendUrl = function(url) {
return url.replace(/\d+\/\d+\/\d+\.\w+/, 'layer.json');
legend.add = function() {
container = document.createElement('div');
container.className = 'wax-legends';
element = document.createElement('div');
element.className = 'wax-legend';
element.style.display = 'none';
container.appendChild(element);
return this;
};
return legend.add();
};
// Like underscore's bind, except it runs a function

@@ -472,8 +477,67 @@ // with no arguments off of an object.

self.melt = function(func, obj) {
func.apply(obj, [self, obj]);
return self;
return func.apply(obj, [self, obj]);
};
return self;
};
// Wax GridUtil
// ------------
// Wax header
var wax = wax || {};
// Request
// -------
// Request data cache. `callback(data)` where `data` is the response data.
wax.request = {
cache: {},
locks: {},
promises: {},
get: function(url, callback) {
// Cache hit.
if (this.cache[url]) {
return callback(this.cache[url][0], this.cache[url][1]);
// Cache miss.
} else {
this.promises[url] = this.promises[url] || [];
this.promises[url].push(callback);
// Lock hit.
if (this.locks[url]) return;
// Request.
var that = this;
this.locks[url] = true;
reqwest({
url: url + '?callback=grid',
type: 'jsonp',
jsonpCallback: 'callback',
success: function(data) {
that.locks[url] = false;
that.cache[url] = [null, data];
for (var i = 0; i < that.promises[url].length; i++) {
that.promises[url][i](that.cache[url][0], that.cache[url][1]);
}
},
error: function(err) {
that.locks[url] = false;
that.cache[url] = [err, null];
for (var i = 0; i < that.promises[url].length; i++) {
that.promises[url][i](that.cache[url][0], that.cache[url][1]);
}
}
});
}
}
};
wax = wax || {};
// A wrapper for reqwest jsonp to easily load TileJSON from a URL.
wax.tilejson = function(url, callback) {
reqwest({
url: url + '?callback=grid',
type: 'jsonp',
jsonpCallback: 'callback',
success: callback,
error: callback
});
};
var wax = wax || {};
wax.tooltip = {};

@@ -589,5 +653,8 @@

offset: function(el) {
// TODO: window margin offset
var width = el.offsetWidth,
height = el.offsetHeight,
// TODO: window margins
//
// Okay, so fall back to styles if offsetWidth and height are botched
// by Firefox.
var width = el.offsetWidth || parseInt(el.style.width, 10),
height = el.offsetHeight || parseInt(el.style.height, 10),
top = 0,

@@ -635,4 +702,4 @@ left = 0;

var htmlComputed = document.defaultView ?
window.getComputedStyle(document.body.parentNode, null) :
document.body.parentNode.currentStyle;
window.getComputedStyle(document.body.parentNode, null) :
document.body.parentNode.currentStyle;
if (document.body.parentNode.offsetTop !==

@@ -642,3 +709,3 @@ parseInt(htmlComputed.marginTop, 10) &&

top += parseInt(htmlComputed.marginTop, 10);
left += parseInt(htmlComputed.marginLeft, 10);
left += parseInt(htmlComputed.marginLeft, 10);
}

@@ -653,2 +720,9 @@

},
'$': function(x) {
return (typeof x === 'string') ?
document.getElementById(x) :
x;
},
// From underscore, minus funcbind for now.

@@ -669,20 +743,20 @@ // Returns a version of a function that always has the second parameter,

indexOf: function(array, item) {
var nativeIndexOf = Array.prototype.indexOf;
if (array === null) return -1;
var i, l;
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);
for (i = 0, l = array.length; i < l; i++) if (array[i] === item) return i;
return -1;
var nativeIndexOf = Array.prototype.indexOf;
if (array === null) return -1;
var i, l;
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);
for (i = 0, l = array.length; i < l; i++) if (array[i] === item) return i;
return -1;
},
// is this object an array?
isArray: Array.isArray || function(obj) {
return Object.prototype.toString.call(obj) === '[object Array]';
return Object.prototype.toString.call(obj) === '[object Array]';
},
// From underscore: reimplement the ECMA5 `Object.keys()` methodb
keys: Object.keys || function(obj) {
var hasOwnProperty = Object.prototype.hasOwnProperty;
if (obj !== Object(obj)) throw new TypeError('Invalid object');
var keys = [];
for (var key in obj) if (hasOwnProperty.call(obj, key)) keys[keys.length] = key;
return keys;
var hasOwnProperty = Object.prototype.hasOwnProperty;
if (obj !== Object(obj)) throw new TypeError('Invalid object');
var keys = [];
for (var key in obj) if (hasOwnProperty.call(obj, key)) keys[keys.length] = key;
return keys;
},

@@ -734,3 +808,4 @@ // From quirksmode: normalize the offset of an event from the top-left

// **full**.
wax.leaf.interaction = function(map, options) {
wax.leaf.interaction = function(map, tilejson, options) {
tilejson = tilejson || {};
options = options || {};

@@ -743,3 +818,3 @@ // Our GridManager (from `gridutil.js`). This will keep the

waxGM: new wax.GridManager(),
waxGM: new wax.GridManager(tilejson),

@@ -915,1 +990,12 @@ // This requires wax.Tooltip or similar

};
wax = wax || {};
wax.leaf = wax.leaf || {};
wax.leaf.connector = L.TileLayer.extend({
initialize: function(options) {
options = options || {};
options.minZoom = options.minzoom || 0;
options.maxZoom = options.maxzoom || 22;
L.TileLayer.prototype.initialize.call(this, options.tiles[0], options);
}
});

@@ -1,4 +0,2 @@

/*!
* 0.1.6 with IE readyState fix in https://github.com/ded/reqwest/issues/18
*
/* wax - 3.0.0 - 1.0.4-320-g97e618c *//*!
* Reqwest! A x-browser general purpose XHR connection manager

@@ -8,2 +6,2 @@ * copyright Dustin Diaz 2011

* license MIT
*/!function(window){function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}function setHeaders(a,b){var c=b.headers||{};c.Accept="text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]="application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function generalCallback(a){lastValue=a}function getRequest(a,b,c){if(a.type!="jsonp"){var d=xhr();d.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(d,a),d.onreadystatechange=readyState(d,b,c),a.before&&a.before(d),d.send(a.data||null);return d}var e=doc.createElement("script");window[getCallbackName(a)]=generalCallback,e.type="text/javascript",e.src=a.url,e.async=!0;var f=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(e)};e.onload=f,e.onreadystatechange=function(){e.readyState=="loaded"||e.readyState=="complete"&&f()},head.appendChild(e)}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function setType(a){if(/\.json$/.test(a))return"json";if(/\.jsonp$/.test(a))return"jsonp";if(/\.js$/.test(a))return"js";if(/\.html?$/.test(a))return"html";if(/\.xml$/.test(a))return"xml";return"js"}function init(o,fn){function complete(a){o.complete&&o.complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText;switch(type){case"json":resp=eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function error(a){o.error&&o.error(a),complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function reqwest(a,b){return new Reqwest(a,b)}function enc(a){return encodeURIComponent(a)}function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):!0)+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this);var wax=wax||{};Array.prototype.reduce||(Array.prototype.reduce=function(a){"use strict";if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;var d=0,e;if(arguments.length>=2)e=arguments[1];else do{if(d in b){e=b[d++];break}if(++d>=c)throw new TypeError}while(!0);while(d<c)d in b&&(e=a.call(undefined,e,b[d],d,b)),d++;return e}),wax.Record=function(a,b){var c=function(a,b){var c=a.split(".").reduce(function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){if(wax.util.isArray(a)&&a[0]&&f(a[0]))return{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)};return!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=wax.util.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}};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]){var c=this;this.locks[a]=!0,reqwest({url:a+"?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.GridInstance=function(a,b,c){c=c||{},this.grid_tile=a,this.formatter=b,this.resolution=c.resolution||4,this.tileSize=c.tileSize||256},wax.GridInstance.prototype.resolveCode=function(a){a>=93&&a--,a>=35&&a--,a-=32;return a},wax.GridInstance.prototype.getFeature=function(a,b,c,d){if(!!this.grid_tile&&!!this.grid_tile.grid){var e=wax.util.offset(c),f=e.left,g=e.top,h=e.width/this.tileSize*this.resolution;if(b-g<0)return;if(a-f<0)return;if(Math.floor(b-g)>this.tileSize)return;if(Math.floor(a-f)>this.tileSize)return;var i=this.grid_tile.grid[Math.floor((b-g)/h)].charCodeAt(Math.floor((a-f)/h));i=this.resolveCode(i);if(this.grid_tile.keys[i]&&this.grid_tile.data[this.grid_tile.keys[i]])return this.formatter.format(d,this.grid_tile.data[this.grid_tile.keys[i]])}},wax.GridManager=function(a){a=a||{},this.resolution=a.resolution||4,this.grid_tiles={},this.key_maps={},this.formatters={},this.locks={}},wax.GridManager.prototype.getGrid=function(a,b){var c=this;c.getFormatter(c.formatterUrl(a),function(d,e){if(d||!e)return b(d,null);wax.request.get(c.tileDataUrl(a),function(a,d){if(a)return b(a,null);b(null,new wax.GridInstance(d,e,{resolution:c.resolution||4}))})})},wax.GridManager.prototype.tileDataUrl=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")},wax.GridManager.prototype.formatterUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},wax.GridManager.prototype.getFormatter=function(a,b){var c=this;typeof this.formatters[a]!="undefined"?b(null,this.formatters[a]):wax.request.get(a,function(d,e){e&&e.formatter?c.formatters[a]=new wax.Formatter(e):c.formatters[a]=!1,b(d,c.formatters[a])})},wax.Formatter=function(obj){if(obj.formatter&&typeof obj.formatter=="string")try{eval("this.f = "+obj.formatter)}catch(e){console&&console.log(e)}else this.f=function(){}},wax.Formatter.prototype.format=function(a,b){try{return this.f(a,b)}catch(c){console&&console.log(c)}};var wax=wax||{};wax.Legend=function(a,b){this.legends={},this.context=a,this.container=b,this.container||(this.container=document.createElement("div"),this.container.className="wax-legends"),this.context.appendChild(this.container)},wax.Legend.prototype.render=function(a){var b;for(b in this.legends)this.legends[b].style.display="none";var c=wax.util.bind(function(a,b){b?this.legends[a]?this.legends[a].style.display="block":(this.legends[a]=document.createElement("div"),this.legends[a].className="wax-legend",this.legends[a].innerHTML=b,this.container.appendChild(this.legends[a])):this.legends[a]=!1},this);for(var d=0;d<a.length;d++)b=this.legendUrl(a[d]),wax.request.get(b,function(a,d){d&&d.legend&&c(b,d.legend)})},wax.Legend.prototype.legendUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")};var w=function(a){a.melt=function(b,c){b.apply(c,[a,c]);return a};return a},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,c,d){tooltip=document.createElement("div"),tooltip.className="wax-tooltip wax-tooltip-"+c,tooltip.innerHTML=a,b.appendChild(tooltip);return tooltip},wax.tooltip.prototype.hideTooltip=function(a){if(!!a){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,c){this.unselect(b);var d=this.getTooltip(a,b,c),e=document.createElement("a");e.href="#close",e.className="close",e.innerHTML="Close";var f=wax.util.bind(function(a){this.hideTooltip(d),this._currentTooltip=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault();return!1},this);e.addEventListener?e.addEventListener("click",f,!1):e.attachEvent&&e.attachEvent("onclick",f),d.className+=" wax-popup",d.innerHTML=a,d.appendChild(e),this._currentTooltip=d},wax.tooltip.prototype.select=function(a,b,c,d){if(!!a){if(this.isPopup(this._currentTooltip))return;this._currentTooltip=this.getTooltip(a,b,c,d),b.style.cursor="pointer"}},wax.tooltip.prototype.unselect=function(a){this.isPopup(this._currentTooltip)||(a.style.cursor="default",this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined))},wax.tooltip.prototype.out=wax.tooltip.prototype.unselect,wax.tooltip.prototype.over=wax.tooltip.prototype.select,wax.tooltip.prototype.click=wax.tooltip.prototype.click,wax.util=wax.util||{},wax.util={offset:function(a){var b=a.offsetWidth,c=a.offsetHeight,d=0,e=0,f=function(a){if(a!==document.body&&a!==document.documentElement){d+=a.offsetTop,e+=a.offsetLeft;var b=a.style.transform||a.style["-webkit-transform"]||a.style.MozTransform;if(b)if(match=b.match(/translate\((.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10);else if(match=b.match(/translate3d\((.+)px, (.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10)}};f(a);try{while(a=a.offsetParent)f(a)}catch(g){}d+=document.body.offsetTop,e+=document.body.offsetLeft,d+=document.body.parentNode.offsetTop,e+=document.body.parentNode.offsetLeft;var h=document.defaultView?window.getComputedStyle(document.body.parentNode,null):document.body.parentNode.currentStyle;document.body.parentNode.offsetTop!==parseInt(h.marginTop,10)&&!isNaN(parseInt(h.marginTop,10))&&(d+=parseInt(h.marginTop,10),e+=parseInt(h.marginLeft,10));return{top:d,left:e,height:c,width:b}},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}}},wax=wax||{},wax.leaf=wax.leaf||{},wax.leaf.interaction=function(a,b){b=b||{};var c={modifyingEvents:["move"],waxGM:new wax.GridManager,callbacks:b.callbacks||new wax.tooltip,clickAction:b.clickAction||"full",add:function(){for(var b=0;b<this.modifyingEvents.length;b++)a.on(this.modifyingEvents[b],wax.util.bind(this.clearTileGrid,this));L.DomEvent.addListener(a._container,"mousemove",this.onMove(),this),L.DomEvent.addListener(a._container,"mousemove",this.mouseDown(),this);return this},getTileGrid:function(){return this._getTileGrid||(this._getTileGrid=function(a){var b=[];for(var c in a)if(a[c]._tiles)for(var d in a[c]._tiles){var e=wax.util.offset(a[c]._tiles[d]);b.push([e.top,e.left,a[c]._tiles[d]])}return b}(a._layers))},clearTileGrid:function(a,b){this._getTileGrid=null},getTile:function(a){var b,c=this.getTileGrid();for(var d=0;d<c.length;d++)if(c[d][0]<a.y&&c[d][0]+256>a.y&&c[d][1]<a.x&&c[d][1]+256>a.x){b=c[d][2];break}return b||!1},clearTimeout:function(){if(this.clickTimeout){window.clearTimeout(this.clickTimeout),this.clickTimeout=null;return!0}return!1},onMove:function(b){this._onMove||(this._onMove=wax.util.bind(function(b){var c=wax.util.eventoffset(b),d=this.getTile(c);d&&this.waxGM.getGrid(d.src,wax.util.bind(function(e,f){if(!e&&f){var g=f.getFeature(c.x,c.y,d,{format:"teaser"});g?g&&this.feature!==g?(this.feature=g,this.callbacks.out(a._container),this.callbacks.over(g,a._container,0,b)):g||(this.feature=null,this.callbacks.out(a._container)):(this.feature=null,this.callbacks.out(a._container))}},this))},this));return this._onMove},mouseDown:function(b){this._mouseDown||(this._mouseDown=wax.util.bind(function(b){this.clearTimeout()||(this.downEvent=b,L.DomEvent.addListener(a._container,"mouseup",this.mouseUp(),this))},this));return this._mouseDown},mouseUp:function(){this._mouseUp||(this._mouseUp=wax.util.bind(function(b){L.DomEvent.removeListener(a._container,"mouseup",this.mouseUp(),this);var c=4;Math.round(b.pageY/c)===Math.round(this.downEvent.pageY/c)&&Math.round(b.pageX/c)===Math.round(this.downEvent.pageX/c)&&(this.clickTimeout=window.setTimeout(wax.util.bind(function(){this.click()(b)},this),300))},this));return this._mouseUp},click:function(a){this._onClick||(this._onClick=wax.util.bind(function(a){var b=this.getTile(a);b&&this.waxGM.getGrid(b.src,wax.util.bind(function(c,d){if(d){var e=d.getFeature(a.pageX,a.pageY,b,{format:this.clickAction});if(e)switch(this.clickAction){case"full":this.callbacks.click(e,this.parent,0,a);break;case"location":window.location=e}}},this))},this));return this._onClick}};return c.add(a)}
*/!function(window){function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}function setHeaders(a,b){var c=b.headers||{};c.Accept=c.Accept||"text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]=c["Content-type"]||"application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function generalCallback(a){lastValue=a}function getRequest(a,b,c){if(a.type!="jsonp"){var d=xhr();d.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(d,a),d.onreadystatechange=readyState(d,b,c),a.before&&a.before(d),d.send(a.data||null);return d}var e=doc.createElement("script");window[getCallbackName(a)]=generalCallback,e.type="text/javascript",e.src=a.url,e.async=!0;var f=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(e)};e.onload=f,e.onreadystatechange=function(){/^loaded|complete$/.test(e.readyState)&&f()},head.appendChild(e)}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function setType(a){return/\.json$/.test(a)?"json":/\.jsonp$/.test(a)?"jsonp":/\.js$/.test(a)?"js":/\.html?$/.test(a)?"html":/\.xml$/.test(a)?"xml":"js"}function init(o,fn){function complete(a){o.complete&&o.complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText,JSON;switch(type){case"json":resp=JSON?JSON.parse(r):eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function error(a){o.error&&o.error(a),complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function reqwest(a,b){return new Reqwest(a,b)}function enc(a){return encodeURIComponent(a)}function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):"")+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this);var wax=wax||{};Array.prototype.reduce||(Array.prototype.reduce=function(a){"use strict";if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;var d=0,e;if(arguments.length>=2)e=arguments[1];else do{if(d in b){e=b[d++];break}if(++d>=c)throw new TypeError}while(!0);while(d<c)d in b&&(e=a.call(undefined,e,b[d],d,b)),d++;return e}),wax.Record=function(a,b){var c=function(a,b){var c=a.split(".").reduce(function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){return wax.util.isArray(a)&&a[0]&&f(a[0])?{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)}:!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=wax.util.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}},wax=wax||{},wax.attribution=function(){var a,b={};b.set=function(b){if(typeof b!="undefined"){a.innerHTML=b;return this}},b.element=function(){return a},b.init=function(){a=document.createElement("div"),a.className="wax-attribution";return this};return b.init()},wax.formatter=function(x){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(){};formatter.format=function(a,b){try{return f(a,b)}catch(c){console&&console.log(c)}};return formatter},wax.GridInstance=function(a,b,c){function f(a){a>=93&&a--,a>=35&&a--,a-=32;return a}c=c||{};var d={},e=c.resolution||4;tileSize=c.tileSize||256,d.getFeature=function(c,d,g,h){if(!!a&&!!a.grid){var i=wax.util.offset(g),j=i.left,k=i.top,l=i.width/tileSize*e;if(d-k<0||c-j<0)return;if(Math.floor(d-k)>tileSize||Math.floor(c-j)>tileSize)return;var m=a.grid[Math.floor((d-k)/l)].charCodeAt(Math.floor((c-j)/l));m=f(m);if(a.keys[m]&&a.data[a.keys[m]])return b.format(h,a.data[a.keys[m]])}};return d},wax.GridManager=function(a){function j(a){typeof a=="string"&&(a=[a]);return function b(b){if(!!b){var c=e.exec(b);if(!c)return;return a[parseInt(c[2],10)%a.length].replace("{z}",c[1]).replace("{x}",c[2]).replace("{y}",c[3])}}}function i(a,b){if(typeof f!="undefined")return b(null,f);wax.request.get(g(a),function(a,c){c&&c.formatter?f=wax.formatter(c.formatter):f=!1;return b(a,f)})}a=a||{};var b=a.resolution||4,c={},d={},e=new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),f,g=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},h=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")};d.formatter=function(a){if(!arguments.length)return f;f=wax.formatter(a);return d},d.formatterUrl=function(a){if(!arguments.length)return g;g=typeof a=="string"?function(){return a}:a;return d},d.gridUrl=function(a){if(!arguments.length)return h;h=typeof a=="function"?a:j(a);return d},d.getGrid=function(a,c){i(a,function(d,e){var f=h(a);if(d||!e||!f)return c(d,null);wax.request.get(f,function(a,d){if(a)return c(a,null);c(null,wax.GridInstance(d,e,{resolution:b||4}))})});return d},a.formatter&&d.formatter(a.formatter),a.grids&&d.gridUrl(a.grids);return d};var wax=wax||{};wax.legend=function(){var a,b={},c;b.element=function(){return c},b.content=function(b){if(!arguments.length)return a.innerHTML;b?(a.innerHTML=b,a.style.display="block"):(a.innerHTML="",a.style.display="none");return this},b.add=function(){c=document.createElement("div"),c.className="wax-legends",a=document.createElement("div"),a.className="wax-legend",a.style.display="none",c.appendChild(a);return this};return b.add()};var w=function(a){a.melt=function(b,c){return b.apply(c,[a,c])};return a},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]){var c=this;this.locks[a]=!0,reqwest({url:a+"?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=wax||{},wax.tilejson=function(a,b){reqwest({url:a+"?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,c,d){tooltip=document.createElement("div"),tooltip.className="wax-tooltip wax-tooltip-"+c,tooltip.innerHTML=a,b.appendChild(tooltip);return tooltip},wax.tooltip.prototype.hideTooltip=function(a){if(!!a){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,c){this.unselect(b);var d=this.getTooltip(a,b,c),e=document.createElement("a");e.href="#close",e.className="close",e.innerHTML="Close";var f=wax.util.bind(function(a){this.hideTooltip(d),this._currentTooltip=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault();return!1},this);e.addEventListener?e.addEventListener("click",f,!1):e.attachEvent&&e.attachEvent("onclick",f),d.className+=" wax-popup",d.innerHTML=a,d.appendChild(e),this._currentTooltip=d},wax.tooltip.prototype.select=function(a,b,c,d){if(!!a){if(this.isPopup(this._currentTooltip))return;this._currentTooltip=this.getTooltip(a,b,c,d),b.style.cursor="pointer"}},wax.tooltip.prototype.unselect=function(a){this.isPopup(this._currentTooltip)||(a.style.cursor="default",this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined))},wax.tooltip.prototype.out=wax.tooltip.prototype.unselect,wax.tooltip.prototype.over=wax.tooltip.prototype.select,wax.tooltip.prototype.click=wax.tooltip.prototype.click,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=0,e=0,f=function(a){if(a!==document.body&&a!==document.documentElement){d+=a.offsetTop,e+=a.offsetLeft;var b=a.style.transform||a.style["-webkit-transform"]||a.style.MozTransform;if(b)if(match=b.match(/translate\((.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10);else if(match=b.match(/translate3d\((.+)px, (.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10)}};f(a);try{while(a=a.offsetParent)f(a)}catch(g){}d+=document.body.offsetTop,e+=document.body.offsetLeft,d+=document.body.parentNode.offsetTop,e+=document.body.parentNode.offsetLeft;var h=document.defaultView?window.getComputedStyle(document.body.parentNode,null):document.body.parentNode.currentStyle;document.body.parentNode.offsetTop!==parseInt(h.marginTop,10)&&!isNaN(parseInt(h.marginTop,10))&&(d+=parseInt(h.marginTop,10),e+=parseInt(h.marginLeft,10));return{top:d,left:e,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}}},wax=wax||{},wax.leaf=wax.leaf||{},wax.leaf.interaction=function(a,b,c){b=b||{},c=c||{};var d={modifyingEvents:["move"],waxGM:new wax.GridManager(b),callbacks:c.callbacks||new wax.tooltip,clickAction:c.clickAction||"full",add:function(){for(var b=0;b<this.modifyingEvents.length;b++)a.on(this.modifyingEvents[b],wax.util.bind(this.clearTileGrid,this));L.DomEvent.addListener(a._container,"mousemove",this.onMove(),this),L.DomEvent.addListener(a._container,"mousemove",this.mouseDown(),this);return this},getTileGrid:function(){return this._getTileGrid||(this._getTileGrid=function(a){var b=[];for(var c in a)if(a[c]._tiles)for(var d in a[c]._tiles){var e=wax.util.offset(a[c]._tiles[d]);b.push([e.top,e.left,a[c]._tiles[d]])}return b}(a._layers))},clearTileGrid:function(a,b){this._getTileGrid=null},getTile:function(a){var b,c=this.getTileGrid();for(var d=0;d<c.length;d++)if(c[d][0]<a.y&&c[d][0]+256>a.y&&c[d][1]<a.x&&c[d][1]+256>a.x){b=c[d][2];break}return b||!1},clearTimeout:function(){if(this.clickTimeout){window.clearTimeout(this.clickTimeout),this.clickTimeout=null;return!0}return!1},onMove:function(b){this._onMove||(this._onMove=wax.util.bind(function(b){var c=wax.util.eventoffset(b),d=this.getTile(c);d&&this.waxGM.getGrid(d.src,wax.util.bind(function(e,f){if(!e&&f){var g=f.getFeature(c.x,c.y,d,{format:"teaser"});g?g&&this.feature!==g?(this.feature=g,this.callbacks.out(a._container),this.callbacks.over(g,a._container,0,b)):g||(this.feature=null,this.callbacks.out(a._container)):(this.feature=null,this.callbacks.out(a._container))}},this))},this));return this._onMove},mouseDown:function(b){this._mouseDown||(this._mouseDown=wax.util.bind(function(b){this.clearTimeout()||(this.downEvent=b,L.DomEvent.addListener(a._container,"mouseup",this.mouseUp(),this))},this));return this._mouseDown},mouseUp:function(){this._mouseUp||(this._mouseUp=wax.util.bind(function(b){L.DomEvent.removeListener(a._container,"mouseup",this.mouseUp(),this);var c=4;Math.round(b.pageY/c)===Math.round(this.downEvent.pageY/c)&&Math.round(b.pageX/c)===Math.round(this.downEvent.pageX/c)&&(this.clickTimeout=window.setTimeout(wax.util.bind(function(){this.click()(b)},this),300))},this));return this._mouseUp},click:function(a){this._onClick||(this._onClick=wax.util.bind(function(a){var b=this.getTile(a);b&&this.waxGM.getGrid(b.src,wax.util.bind(function(c,d){if(d){var e=d.getFeature(a.pageX,a.pageY,b,{format:this.clickAction});if(e)switch(this.clickAction){case"full":this.callbacks.click(e,this.parent,0,a);break;case"location":window.location=e}}},this))},this));return this._onClick}};return d.add(a)},wax=wax||{},wax.leaf=wax.leaf||{},wax.leaf.connector=L.TileLayer.extend({initialize:function(a){a=a||{},a.minZoom=a.minzoom||0,a.maxZoom=a.maxzoom||22,L.TileLayer.prototype.initialize.call(this,a.tiles[0],a)}})

@@ -1,4 +0,2 @@

/*!
* 0.1.6 with IE readyState fix in https://github.com/ded/reqwest/issues/18
*
/* wax - 3.0.0 - 1.0.4-320-g97e618c *//*!
* Reqwest! A x-browser general purpose XHR connection manager

@@ -8,2 +6,2 @@ * copyright Dustin Diaz 2011

* license MIT
*/!function(window){function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}function setHeaders(a,b){var c=b.headers||{};c.Accept="text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]="application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function generalCallback(a){lastValue=a}function getRequest(a,b,c){if(a.type!="jsonp"){var d=xhr();d.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(d,a),d.onreadystatechange=readyState(d,b,c),a.before&&a.before(d),d.send(a.data||null);return d}var e=doc.createElement("script");window[getCallbackName(a)]=generalCallback,e.type="text/javascript",e.src=a.url,e.async=!0;var f=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(e)};e.onload=f,e.onreadystatechange=function(){e.readyState=="loaded"||e.readyState=="complete"&&f()},head.appendChild(e)}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function setType(a){if(/\.json$/.test(a))return"json";if(/\.jsonp$/.test(a))return"jsonp";if(/\.js$/.test(a))return"js";if(/\.html?$/.test(a))return"html";if(/\.xml$/.test(a))return"xml";return"js"}function init(o,fn){function complete(a){o.complete&&o.complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText;switch(type){case"json":resp=eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function error(a){o.error&&o.error(a),complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function reqwest(a,b){return new Reqwest(a,b)}function enc(a){return encodeURIComponent(a)}function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):!0)+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this);var wax=wax||{};Array.prototype.reduce||(Array.prototype.reduce=function(a){"use strict";if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;var d=0,e;if(arguments.length>=2)e=arguments[1];else do{if(d in b){e=b[d++];break}if(++d>=c)throw new TypeError}while(!0);while(d<c)d in b&&(e=a.call(undefined,e,b[d],d,b)),d++;return e}),wax.Record=function(a,b){var c=function(a,b){var c=a.split(".").reduce(function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){if(wax.util.isArray(a)&&a[0]&&f(a[0]))return{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)};return!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=wax.util.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}};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]){var c=this;this.locks[a]=!0,reqwest({url:a+"?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.GridInstance=function(a,b,c){c=c||{},this.grid_tile=a,this.formatter=b,this.resolution=c.resolution||4,this.tileSize=c.tileSize||256},wax.GridInstance.prototype.resolveCode=function(a){a>=93&&a--,a>=35&&a--,a-=32;return a},wax.GridInstance.prototype.getFeature=function(a,b,c,d){if(!!this.grid_tile&&!!this.grid_tile.grid){var e=wax.util.offset(c),f=e.left,g=e.top,h=e.width/this.tileSize*this.resolution;if(b-g<0)return;if(a-f<0)return;if(Math.floor(b-g)>this.tileSize)return;if(Math.floor(a-f)>this.tileSize)return;var i=this.grid_tile.grid[Math.floor((b-g)/h)].charCodeAt(Math.floor((a-f)/h));i=this.resolveCode(i);if(this.grid_tile.keys[i]&&this.grid_tile.data[this.grid_tile.keys[i]])return this.formatter.format(d,this.grid_tile.data[this.grid_tile.keys[i]])}},wax.GridManager=function(a){a=a||{},this.resolution=a.resolution||4,this.grid_tiles={},this.key_maps={},this.formatters={},this.locks={}},wax.GridManager.prototype.getGrid=function(a,b){var c=this;c.getFormatter(c.formatterUrl(a),function(d,e){if(d||!e)return b(d,null);wax.request.get(c.tileDataUrl(a),function(a,d){if(a)return b(a,null);b(null,new wax.GridInstance(d,e,{resolution:c.resolution||4}))})})},wax.GridManager.prototype.tileDataUrl=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")},wax.GridManager.prototype.formatterUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},wax.GridManager.prototype.getFormatter=function(a,b){var c=this;typeof this.formatters[a]!="undefined"?b(null,this.formatters[a]):wax.request.get(a,function(d,e){e&&e.formatter?c.formatters[a]=new wax.Formatter(e):c.formatters[a]=!1,b(d,c.formatters[a])})},wax.Formatter=function(obj){if(obj.formatter&&typeof obj.formatter=="string")try{eval("this.f = "+obj.formatter)}catch(e){console&&console.log(e)}else this.f=function(){}},wax.Formatter.prototype.format=function(a,b){try{return this.f(a,b)}catch(c){console&&console.log(c)}};var wax=wax||{};wax.Legend=function(a,b){this.legends={},this.context=a,this.container=b,this.container||(this.container=document.createElement("div"),this.container.className="wax-legends"),this.context.appendChild(this.container)},wax.Legend.prototype.render=function(a){var b;for(b in this.legends)this.legends[b].style.display="none";var c=wax.util.bind(function(a,b){b?this.legends[a]?this.legends[a].style.display="block":(this.legends[a]=document.createElement("div"),this.legends[a].className="wax-legend",this.legends[a].innerHTML=b,this.container.appendChild(this.legends[a])):this.legends[a]=!1},this);for(var d=0;d<a.length;d++)b=this.legendUrl(a[d]),wax.request.get(b,function(a,d){d&&d.legend&&c(b,d.legend)})},wax.Legend.prototype.legendUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")};var w=function(a){a.melt=function(b,c){b.apply(c,[a,c]);return a};return a},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,c,d){tooltip=document.createElement("div"),tooltip.className="wax-tooltip wax-tooltip-"+c,tooltip.innerHTML=a,b.appendChild(tooltip);return tooltip},wax.tooltip.prototype.hideTooltip=function(a){if(!!a){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,c){this.unselect(b);var d=this.getTooltip(a,b,c),e=document.createElement("a");e.href="#close",e.className="close",e.innerHTML="Close";var f=wax.util.bind(function(a){this.hideTooltip(d),this._currentTooltip=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault();return!1},this);e.addEventListener?e.addEventListener("click",f,!1):e.attachEvent&&e.attachEvent("onclick",f),d.className+=" wax-popup",d.innerHTML=a,d.appendChild(e),this._currentTooltip=d},wax.tooltip.prototype.select=function(a,b,c,d){if(!!a){if(this.isPopup(this._currentTooltip))return;this._currentTooltip=this.getTooltip(a,b,c,d),b.style.cursor="pointer"}},wax.tooltip.prototype.unselect=function(a){this.isPopup(this._currentTooltip)||(a.style.cursor="default",this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined))},wax.tooltip.prototype.out=wax.tooltip.prototype.unselect,wax.tooltip.prototype.over=wax.tooltip.prototype.select,wax.tooltip.prototype.click=wax.tooltip.prototype.click,wax.util=wax.util||{},wax.util={offset:function(a){var b=a.offsetWidth,c=a.offsetHeight,d=0,e=0,f=function(a){if(a!==document.body&&a!==document.documentElement){d+=a.offsetTop,e+=a.offsetLeft;var b=a.style.transform||a.style["-webkit-transform"]||a.style.MozTransform;if(b)if(match=b.match(/translate\((.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10);else if(match=b.match(/translate3d\((.+)px, (.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10)}};f(a);try{while(a=a.offsetParent)f(a)}catch(g){}d+=document.body.offsetTop,e+=document.body.offsetLeft,d+=document.body.parentNode.offsetTop,e+=document.body.parentNode.offsetLeft;var h=document.defaultView?window.getComputedStyle(document.body.parentNode,null):document.body.parentNode.currentStyle;document.body.parentNode.offsetTop!==parseInt(h.marginTop,10)&&!isNaN(parseInt(h.marginTop,10))&&(d+=parseInt(h.marginTop,10),e+=parseInt(h.marginLeft,10));return{top:d,left:e,height:c,width:b}},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}}},wax=wax||{},wax.mm=wax.mm||{},wax.mm.boxselector=function(a,b){var c=null,d=typeof b=="function"?b:b.callback,e={add:function(a){this.boxDiv=document.createElement("div"),this.boxDiv.id=a.parent.id+"-boxselector-box",this.boxDiv.className="boxselector-box",a.parent.appendChild(this.boxDiv),com.modestmaps.addEvent(a.parent,"mousedown",this.mouseDown()),a.addCallback("drawn",this.drawbox())},remove:function(){a.parent.removeChild(this.boxDiv),a.removeCallback("mousedown",this.drawbox())},getMousePoint:function(b){var c=new com.modestmaps.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},mouseDown:function(){this._mouseDown||(this._mouseDown=wax.util.bind(function(b){if(b.shiftKey){c=this.getMousePoint(b),this.boxDiv.style.left=c.x+"px",this.boxDiv.style.top=c.y+"px",com.modestmaps.addEvent(a.parent,"mousemove",this.mouseMove()),com.modestmaps.addEvent(a.parent,"mouseup",this.mouseUp()),a.parent.style.cursor="crosshair";return com.modestmaps.cancelEvent(b)}},this));return this._mouseDown},mouseMove:function(a){this._mouseMove||(this._mouseMove=wax.util.bind(function(a){var b=this.getMousePoint(a);this.boxDiv.style.display="block",b.x<c.x?this.boxDiv.style.left=b.x+"px":this.boxDiv.style.left=c.x+"px",this.boxDiv.style.width=Math.abs(b.x-c.x)+"px",b.y<c.y?this.boxDiv.style.top=b.y+"px":this.boxDiv.style.top=c.y+"px",this.boxDiv.style.height=Math.abs(b.y-c.y)+"px";return com.modestmaps.cancelEvent(a)},this));return this._mouseMove},mouseUp:function(){this._mouseUp||(this._mouseUp=wax.util.bind(function(b){var f=e.getMousePoint(b),g=a.pointLocation(f),h=a.pointLocation(c),i=[new com.modestmaps.Location(Math.max(g.lat,h.lat),Math.min(g.lon,h.lon)),new com.modestmaps.Location(Math.min(g.lat,h.lat),Math.max(g.lon,h.lon))];this.box=[g,h],d(i),com.modestmaps.removeEvent(a.parent,"mousemove",this.mouseMove()),com.modestmaps.removeEvent(a.parent,"mouseup",this.mouseUp()),a.parent.style.cursor="auto"},this));return this._mouseUp},drawbox:function(){this._drawbox||(this._drawbox=wax.util.bind(function(a,b){if(this.boxDiv){this.boxDiv.style.display="block",this.boxDiv.style.height="auto",this.boxDiv.style.width="auto";var c=a.locationPoint(this.box[0]),d=a.locationPoint(this.box[1]);this.boxDiv.style.left=Math.max(0,d.x)+"px",this.boxDiv.style.top=Math.max(0,d.y)+"px",this.boxDiv.style.right=Math.max(0,a.dimensions.x-c.x)+"px",this.boxDiv.style.bottom=Math.max(0,a.dimensions.y-c.y)+"px"}},this));return this._drawbox}};return e.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.fullscreen=function(a,b){var c={state:1,add:function(a){this.a=document.createElement("a"),this.a.className="wax-fullscreen",this.a.href="#fullscreen",this.a.innerHTML="fullscreen",a.parent.appendChild(this.a),com.modestmaps.addEvent(this.a,"click",this.click(a));return this},click:function(a){if(this._click)return this._click;this._click=wax.util.bind(function(b){b&&com.modestmaps.cancelEvent(b),this.state?(this.smallSize=[a.parent.offsetWidth,a.parent.offsetHeight],a.parent.className+=" wax-fullscreen-map",a.setSize(a.parent.offsetWidth,a.parent.offsetHeight)):(a.parent.className=a.parent.className.replace("wax-fullscreen-map",""),a.setSize(this.smallSize[0],this.smallSize[1])),this.state=!this.state},this);return this._click}};return c.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.locationHash={stateChange:function(a){com.modestmaps.addEvent(window,"hashchange",function(){a(location.hash)},!1)},getState:function(){return location.hash.substring(1)},pushState:function(a){location.hash="#"+a}},wax.mm.pushState={stateChange:function(a){com.modestmaps.addEvent(window,"popstate",function(b){b.state&&b.state.map_location&&a(b.state.map_location)},!1)},getState:function(){if(!!window.history&&!!window.history.state)return history.state&&history.state.map_location},pushState:function(a){!!window.history&&!!window.history.pushState&&window.history.pushState({map_location:a})}},wax.mm.hash=function(a,b){var c,d=90-1e-8,e=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)}},f=function(a,b){return e(a,b,!1)},g={map:this,parser:function(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(new com.modestmaps.Location(c[1],c[2]),c[0])},add:function(a){b.manager.getState()?g.stateChange(b.manager.getState()):(g.initialize(),g.move()),a.addCallback("drawn",f(g.move,500)),b.manager.stateChange(g.stateChange)},formatter: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("/")},move:function(){var a=g.formatter();c!==a&&(c=a,b.manager.pushState(c))},stateChange:function(a){a!==c&&g.parser(c=a)&&g.move()},initialize:function(){b.defaultCenter&&a.setCenter(b.defaultCenter),b.defaultZoom&&a.setZoom(b.defaultZoom)}};return g.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.interaction=function(a,b){var c=com.modestmaps;b=b||{};var d={modifyingEvents:["zoomed","panned","centered","extentset","resized","drawn"],waxGM:new wax.GridManager,_downLock:!1,callbacks:b.callbacks||new wax.tooltip,clickAction:b.clickAction||["full"],clickHandler:b.clickHandler||function(a){window.location=a},add:function(){for(var b=0;b<this.modifyingEvents.length;b++)a.addCallback(this.modifyingEvents[b],wax.util.bind(this.clearTileGrid,this));wax.util.isArray(this.clickAction)||(this.clickAction=[this.clickAction]),c.addEvent(a.parent,"mousemove",this.onMove()),c.addEvent(a.parent,"mousedown",this.onDown()),this.touchable="ontouchstart"in document.documentElement,this.touchable&&c.addEvent(a.parent,"touchstart",this.onDown());return this},getTileGrid:function(){var b=Math.round(a.getZoom());return this._getTileGrid||(this._getTileGrid=function(a){var c=[];for(var d in a)if(d.split(",")[0]==b){var e=wax.util.offset(a[d]);c.push([e.top,e.left,a[d]])}return c}(a.tiles))},clearTileGrid:function(a,b){this._getTileGrid=null},getTile:function(a){var b,c=this.getTileGrid();for(var d=0;d<c.length;d++)if(c[d][0]<a.y&&c[d][0]+256>a.y&&c[d][1]<a.x&&c[d][1]+256>a.x){b=c[d][2];break}return b||!1},clearTimeout:function(){if(this.clickTimeout){window.clearTimeout(this.clickTimeout),this.clickTimeout=null;return!0}return!1},onMove:function(b){this._onMove||(this._onMove=wax.util.bind(function(b){if(!this._downLock){var c=wax.util.eventoffset(b),d=this.getTile(c);d&&this.waxGM.getGrid(d.src,wax.util.bind(function(e,f){if(!e&&f){var g=f.getFeature(c.x,c.y,d,{format:"teaser"});g?g&&this.feature!==g?(this.feature=g,this.callbacks.out(a.parent),this.callbacks.over(g,a.parent,0,b)):g||(this.feature=null,this.callbacks.out(a.parent)):(this.feature=null,this.callbacks.out(a.parent))}},this))}},this));return this._onMove},onDown:function(b){this._onDown||(this._onDown=wax.util.bind(function(b){this.clearTimeout()||(this._downLock=!0,this.downEvent=wax.util.eventoffset(b),b.type==="mousedown"?c.addEvent(a.parent,"mouseup",this.onUp()):b.type==="touchstart"&&b.touches.length===1&&(this.clickAction=["full","teaser"],this.callbacks._currentTooltip&&this.callbacks.hideTooltip(this.callbacks._currentTooltip),c.addEvent(a.parent,"touchend",this.onUp()),c.addEvent(a.parent,"touchmove",this.touchCancel())))},this));return this._onDown},touchCancel:function(){this._touchCancel||(this._touchCancel=wax.util.bind(function(b){c.removeEvent(a.parent,"touchend",this.onUp()),c.removeEvent(a.parent,"touchmove",this.onUp()),this._downLock=!1},this));return this._touchCancel},onUp:function(){this._onUp||(this._onUp=wax.util.bind(function(b){c.removeEvent(a.parent,"mouseup",this.onUp()),a.parent.ontouchend&&(c.removeEvent(a.parent,"touchend",this.onUp()),c.removeEvent(a.parent,"touchmove",this.touchCancel())),this._downLock=!1;var d=4,e=wax.util.eventoffset(b);b.type==="touchend"?this.click()(this.downEvent):Math.round(e.y/d)===Math.round(this.downEvent.y/d)&&Math.round(e.x/d)===Math.round(this.downEvent.x/d)&&(this.clickTimeout=window.setTimeout(wax.util.bind(function(){this.click()(e)},this),300))},this));return this._onUp},click:function(b){this._onClick||(this._onClick=wax.util.bind(function(c){var d=this.getTile(c);d&&this.waxGM.getGrid(d.src,wax.util.bind(function(e,f){if(f)for(var g=0;g<this.clickAction.length;g++){var h=f.getFeature(c.x,c.y,d,{format:this.clickAction[g]});if(h)switch(this.clickAction[g]){case"full":case"teaser":return this.callbacks.click(h,a.parent,0,b);case"location":return this.clickHandler(h)}}},this))},this));return this._onClick}};return d.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.legend=function(a,b){b=b||{};var c={add:function(){this.legend=new wax.Legend(a.parent,b.container),this.legend.render([a.provider.getTileUrl({zoom:0,column:0,row:0})])}};return c.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.mobile=function(a,b){b=b||{};var c=com.modestmaps,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=.5;var i=h.createLinearGradient(0,0,300,225);i.addColorStop(0,"black"),i.addColorStop(1,"rgb(200, 200, 200)"),h.fillStyle=i,h.fillRect(0,0,c,d),h.fillStyle="rgb(255, 255, 255)",h.beginPath(),h.moveTo(e-g*.6,f-g),h.lineTo(e-g*.6,f+g),h.lineTo(e+g*.6,f),h.fill(),a.appendChild(b)},i=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)},j=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"},k=function(a){a.style.position="relative",a.style.width=a.style.height=a.style.top=a.style.left=a.style.right="auto"},l,m,n,o,p=b.overlayDraw||h,q=b.backDraw||i;bodyDraw=b.bodyDraw||function(){};var r={add:function(a){g&&(o=document.createElement("meta"),o.id="wax-touch",o.setAttribute("name","viewport"),l=document.createElement("div"),l.id=a.parent.id+"-mobileoverlay",l.className="wax-mobileoverlay",l.style.position="absolute",l.style.width=a.dimensions.x+"px",l.style.height=a.dimensions.y+"px",a.parent.appendChild(l),p(l),n=document.createElement("div"),backDiv=document.createElement("div"),m=document.body,newBody=document.createElement("body"),newBody.className="wax-mobile-body",newBody.appendChild(backDiv),c.addEvent(l,"touchstart",this.toTouch),c.addEvent(backDiv,"touchstart",this.toPage));return this},toTouch:function(){a.parent.parentNode.replaceChild(n,a.parent),newBody.insertBefore(a.parent,backDiv),document.body=newBody,bodyDraw(newBody),q(backDiv),o.setAttribute("content","initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0"),document.head.appendChild(o),a._smallSize=[a.parent.clientWidth,a.parent.clientHeight],j(a.parent),a.setSize(a.parent.offsetWidth,window.innerHeight),backDiv.style.display="block",l.style.display="none"},toPage:function(){document.body=m,n.parentNode.replaceChild(a.parent,n),k(a.parent),a.setSize(a._smallSize[0],a._smallSize[1]),backDiv.style.display="none",l.style.display="block"}};return r.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.pointselector=function(a,b){function k(a){var b=[];for(var c=0;c<a.length;c++)b.push(new g.Location(a[c].lat,a[c].lon));return b}var c=null,d=null,e=5,f,g=com.modestmaps,h=[],i=typeof b=="function"?b:b.callback,j=function(b){var c=wax.util.eventoffset(b),d=new g.Point(c.x,c.y),e={x:parseFloat(g.getStyle(document.documentElement,"margin-left")),y:parseFloat(g.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},l={add:function(a){g.addEvent(a.parent,"mousedown",this.mouseDown()),a.addCallback("drawn",l.drawPoints());return this},deletePoint:function(a,b){confirm("Delete this point?")&&(a.pointDiv.parentNode.removeChild(a.pointDiv),h.splice(wax.util.indexOf(h,a),1),i(k(h)))},drawPoints:function(){this._drawPoints||(this._drawPoints=wax.util.bind(function(){var b=new g.Point(0,0);for(var c=0;c<h.length;c++){var d=a.locationPoint(h[c]);h[c].pointDiv||(h[c].pointDiv=document.createElement("div"),h[c].pointDiv.className="wax-point-div",h[c].pointDiv.style.position="absolute",h[c].pointDiv.style.display="block",h[c].pointDiv.location=h[c],g.addEvent(h[c].pointDiv,"mouseup",function(d){var e=h[c];return function(b){g.removeEvent(a.parent,"mouseup",l.mouseUp()),l.deletePoint(e,b)}}()),a.parent.appendChild(h[c].pointDiv)),h[c].pointDiv.style.left=d.x+"px",h[c].pointDiv.style.top=d.y+"px"}},this));return this._drawPoints},mouseDown:function(){this._mouseDown||(this._mouseDown=wax.util.bind(function(b){c=j(b),g.addEvent(a.parent,"mouseup",this.mouseUp())},this));return this._mouseDown},addLocation:function(a){h.push(a),l.drawPoints()(),i(k(h))},mouseUp:function(){this._mouseUp||(this._mouseUp=wax.util.bind(function(b){!c||(d=j(b),g.Point.distance(c,d)<e&&(this.addLocation(a.pointLocation(c)),i(k(h))),c=null)},this));return this._mouseUp}};return l.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.zoombox=function(a,b){var c=null,d={add:function(a){this.box=document.createElement("div"),this.box.id=a.parent.id+"-zoombox-box",this.box.className="zoombox-box",a.parent.appendChild(this.box),com.modestmaps.addEvent(a.parent,"mousedown",this.mouseDown())},remove:function(){a.parent.removeChild(this.box),a.removeCallback("mousedown",this.mouseDown)},getMousePoint:function(b){var c=new com.modestmaps.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},mouseDown:function(){this._mouseDown||(this._mouseDown=wax.util.bind(function(b){if(b.shiftKey){c=this.getMousePoint(b),this.box.style.left=c.x+"px",this.box.style.top=c.y+"px",com.modestmaps.addEvent(a.parent,"mousemove",this.mouseMove()),com.modestmaps.addEvent(a.parent,"mouseup",this.mouseUp()),a.parent.style.cursor="crosshair";return com.modestmaps.cancelEvent(b)}},this));return this._mouseDown},mouseMove:function(a){this._mouseMove||(this._mouseMove=wax.util.bind(function(a){var b=this.getMousePoint(a);this.box.style.display="block",b.x<c.x?this.box.style.left=b.x+"px":this.box.style.left=c.x+"px",this.box.style.width=Math.abs(b.x-c.x)+"px",b.y<c.y?this.box.style.top=b.y+"px":this.box.style.top=c.y+"px",this.box.style.height=Math.abs(b.y-c.y)+"px";return com.modestmaps.cancelEvent(a)},this));return this._mouseMove},mouseUp:function(b){this._mouseUp||(this._mouseUp=wax.util.bind(function(b){var d=this.getMousePoint(b),e=a.pointLocation(d),f=a.pointLocation(c);a.setExtent([e,f]),this.box.style.display="none",com.modestmaps.removeEvent(a.parent,"mousemove",this.mouseMove()),com.modestmaps.removeEvent(a.parent,"mouseup",this.mouseUp()),a.parent.style.cursor="auto"},this));return this._mouseUp}};return d.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.zoomer=function(a){var b=document.createElement("a");b.innerHTML="+",b.href="#",b.className="zoomer zoomin",com.modestmaps.addEvent(b,"mousedown",function(a){com.modestmaps.cancelEvent(a)}),com.modestmaps.addEvent(b,"click",function(b){com.modestmaps.cancelEvent(b),a.zoomIn()},!1),a.parent.appendChild(b);var c=document.createElement("a");c.innerHTML="-",c.href="#",c.className="zoomer zoomout",com.modestmaps.addEvent(c,"mousedown",function(a){com.modestmaps.cancelEvent(a)}),com.modestmaps.addEvent(c,"click",function(b){com.modestmaps.cancelEvent(b),a.zoomOut()},!1),a.parent.appendChild(c);var d={add:function(a){a.addCallback("drawn",function(a,d){a.coordinate.zoom===a.provider.outerLimits()[0].zoom?c.className="zoomer zoomout zoomdisabled":a.coordinate.zoom===a.provider.outerLimits()[1].zoom?b.className="zoomer zoomin zoomdisabled":(b.className="zoomer zoomin",c.className="zoomer zoomout")});return this}};return d.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.provider=function(a){this.layerName=a.layerName,this.baseUrls=typeof a.baseUrl=="string"?[a.baseUrl]:a.baseUrl,this.n_urls=this.baseUrls.length,this.filetype=a.filetype||".png",this.zoomRange=a.zoomRange||[0,18]},wax.mm.provider.prototype={outerLimits:function(){return[(new com.modestmaps.Coordinate(0,0,0)).zoomTo(this.zoomRange[0]),(new com.modestmaps.Coordinate(1,1,0)).zoomTo(this.zoomRange[1])]},getTileUrl:function(a){var b;a=this.sourceCoordinate(a);if(!a)return null;var c=Math.pow(2,a.zoom);a.row=Math.pow(2,a.zoom)-a.row-1,this.n_urls===1?b=this.baseUrls[0]:b=this.baseUrls[parseInt(c*a.row+a.column,10)%this.n_urls];var d=["1.0.0",this.layerName,a.zoom,a.column,a.row].join("/");return b+d+this.filetype}},com&&com.modestmaps&&com.modestmaps.extend(wax.mm.provider,com.modestmaps.MapProvider)
*/!function(window){function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}function setHeaders(a,b){var c=b.headers||{};c.Accept=c.Accept||"text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]=c["Content-type"]||"application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function generalCallback(a){lastValue=a}function getRequest(a,b,c){if(a.type!="jsonp"){var d=xhr();d.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(d,a),d.onreadystatechange=readyState(d,b,c),a.before&&a.before(d),d.send(a.data||null);return d}var e=doc.createElement("script");window[getCallbackName(a)]=generalCallback,e.type="text/javascript",e.src=a.url,e.async=!0;var f=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(e)};e.onload=f,e.onreadystatechange=function(){/^loaded|complete$/.test(e.readyState)&&f()},head.appendChild(e)}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function setType(a){return/\.json$/.test(a)?"json":/\.jsonp$/.test(a)?"jsonp":/\.js$/.test(a)?"js":/\.html?$/.test(a)?"html":/\.xml$/.test(a)?"xml":"js"}function init(o,fn){function complete(a){o.complete&&o.complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText,JSON;switch(type){case"json":resp=JSON?JSON.parse(r):eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function error(a){o.error&&o.error(a),complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function reqwest(a,b){return new Reqwest(a,b)}function enc(a){return encodeURIComponent(a)}function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):"")+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this);var wax=wax||{};Array.prototype.reduce||(Array.prototype.reduce=function(a){"use strict";if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;var d=0,e;if(arguments.length>=2)e=arguments[1];else do{if(d in b){e=b[d++];break}if(++d>=c)throw new TypeError}while(!0);while(d<c)d in b&&(e=a.call(undefined,e,b[d],d,b)),d++;return e}),wax.Record=function(a,b){var c=function(a,b){var c=a.split(".").reduce(function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){return wax.util.isArray(a)&&a[0]&&f(a[0])?{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)}:!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=wax.util.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}},wax=wax||{},wax.attribution=function(){var a,b={};b.set=function(b){if(typeof b!="undefined"){a.innerHTML=b;return this}},b.element=function(){return a},b.init=function(){a=document.createElement("div"),a.className="wax-attribution";return this};return b.init()},wax.formatter=function(x){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(){};formatter.format=function(a,b){try{return f(a,b)}catch(c){console&&console.log(c)}};return formatter},wax.GridInstance=function(a,b,c){function f(a){a>=93&&a--,a>=35&&a--,a-=32;return a}c=c||{};var d={},e=c.resolution||4;tileSize=c.tileSize||256,d.getFeature=function(c,d,g,h){if(!!a&&!!a.grid){var i=wax.util.offset(g),j=i.left,k=i.top,l=i.width/tileSize*e;if(d-k<0||c-j<0)return;if(Math.floor(d-k)>tileSize||Math.floor(c-j)>tileSize)return;var m=a.grid[Math.floor((d-k)/l)].charCodeAt(Math.floor((c-j)/l));m=f(m);if(a.keys[m]&&a.data[a.keys[m]])return b.format(h,a.data[a.keys[m]])}};return d},wax.GridManager=function(a){function j(a){typeof a=="string"&&(a=[a]);return function b(b){if(!!b){var c=e.exec(b);if(!c)return;return a[parseInt(c[2],10)%a.length].replace("{z}",c[1]).replace("{x}",c[2]).replace("{y}",c[3])}}}function i(a,b){if(typeof f!="undefined")return b(null,f);wax.request.get(g(a),function(a,c){c&&c.formatter?f=wax.formatter(c.formatter):f=!1;return b(a,f)})}a=a||{};var b=a.resolution||4,c={},d={},e=new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),f,g=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},h=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")};d.formatter=function(a){if(!arguments.length)return f;f=wax.formatter(a);return d},d.formatterUrl=function(a){if(!arguments.length)return g;g=typeof a=="string"?function(){return a}:a;return d},d.gridUrl=function(a){if(!arguments.length)return h;h=typeof a=="function"?a:j(a);return d},d.getGrid=function(a,c){i(a,function(d,e){var f=h(a);if(d||!e||!f)return c(d,null);wax.request.get(f,function(a,d){if(a)return c(a,null);c(null,wax.GridInstance(d,e,{resolution:b||4}))})});return d},a.formatter&&d.formatter(a.formatter),a.grids&&d.gridUrl(a.grids);return d};var wax=wax||{};wax.legend=function(){var a,b={},c;b.element=function(){return c},b.content=function(b){if(!arguments.length)return a.innerHTML;b?(a.innerHTML=b,a.style.display="block"):(a.innerHTML="",a.style.display="none");return this},b.add=function(){c=document.createElement("div"),c.className="wax-legends",a=document.createElement("div"),a.className="wax-legend",a.style.display="none",c.appendChild(a);return this};return b.add()};var w=function(a){a.melt=function(b,c){return b.apply(c,[a,c])};return a},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]){var c=this;this.locks[a]=!0,reqwest({url:a+"?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=wax||{},wax.tilejson=function(a,b){reqwest({url:a+"?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,c,d){tooltip=document.createElement("div"),tooltip.className="wax-tooltip wax-tooltip-"+c,tooltip.innerHTML=a,b.appendChild(tooltip);return tooltip},wax.tooltip.prototype.hideTooltip=function(a){if(!!a){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,c){this.unselect(b);var d=this.getTooltip(a,b,c),e=document.createElement("a");e.href="#close",e.className="close",e.innerHTML="Close";var f=wax.util.bind(function(a){this.hideTooltip(d),this._currentTooltip=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault();return!1},this);e.addEventListener?e.addEventListener("click",f,!1):e.attachEvent&&e.attachEvent("onclick",f),d.className+=" wax-popup",d.innerHTML=a,d.appendChild(e),this._currentTooltip=d},wax.tooltip.prototype.select=function(a,b,c,d){if(!!a){if(this.isPopup(this._currentTooltip))return;this._currentTooltip=this.getTooltip(a,b,c,d),b.style.cursor="pointer"}},wax.tooltip.prototype.unselect=function(a){this.isPopup(this._currentTooltip)||(a.style.cursor="default",this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined))},wax.tooltip.prototype.out=wax.tooltip.prototype.unselect,wax.tooltip.prototype.over=wax.tooltip.prototype.select,wax.tooltip.prototype.click=wax.tooltip.prototype.click,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=0,e=0,f=function(a){if(a!==document.body&&a!==document.documentElement){d+=a.offsetTop,e+=a.offsetLeft;var b=a.style.transform||a.style["-webkit-transform"]||a.style.MozTransform;if(b)if(match=b.match(/translate\((.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10);else if(match=b.match(/translate3d\((.+)px, (.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10)}};f(a);try{while(a=a.offsetParent)f(a)}catch(g){}d+=document.body.offsetTop,e+=document.body.offsetLeft,d+=document.body.parentNode.offsetTop,e+=document.body.parentNode.offsetLeft;var h=document.defaultView?window.getComputedStyle(document.body.parentNode,null):document.body.parentNode.currentStyle;document.body.parentNode.offsetTop!==parseInt(h.marginTop,10)&&!isNaN(parseInt(h.marginTop,10))&&(d+=parseInt(h.marginTop,10),e+=parseInt(h.marginLeft,10));return{top:d,left:e,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}}},wax=wax||{},wax.mm=wax.mm||{},wax.mm.attribution=function(a,b){b=b||{};var c,d={};d.element=function(){return c.element()},d.appendTo=function(a){wax.util.$(a).appendChild(c.element());return this},d.init=function(){c=wax.attribution(),c.set(b.attribution),c.element().className="wax-attribution wax-mm";return this};return d.init()},wax=wax||{},wax.mm=wax.mm||{},wax.mm.boxselector=function(a,b,c){function n(a,b){if(!!g&&!!h){var c=a.locationPoint(h[0]),d=a.locationPoint(h[1]);g.style.display="block",g.style.height="auto",g.style.width="auto",g.style.left=Math.max(0,d.x)+"px",g.style.top=Math.max(0,d.y)+"px",g.style.right=Math.max(0,a.dimensions.x-c.x)+"px",g.style.bottom=Math.max(0,a.dimensions.y-c.y)+"px"}}function m(b){var c=j(b),g=a.pointLocation(c),i=a.pointLocation(d),k=[new e.Location(Math.max(g.lat,i.lat),Math.min(g.lon,i.lon)),new e.Location(Math.min(g.lat,i.lat),Math.max(g.lon,i.lon))];h=[g,i],f(k),e.removeEvent(a.parent,"mousemove",l),e.removeEvent(a.parent,"mouseup",m),a.parent.style.cursor="auto"}function l(a){var b=j(a);g.style.display="block",b.x<d.x?g.style.left=b.x+"px":g.style.left=d.x+"px",b.y<d.y?g.style.top=b.y+"px":g.style.top=d.y+"px",g.style.width=Math.abs(b.x-d.x)+"px",g.style.height=Math.abs(b.y-d.y)+"px";return e.cancelEvent(a)}function k(b){if(!!b.shiftKey){d=j(b),g.style.left=d.x+"px",g.style.top=d.y+"px",e.addEvent(a.parent,"mousemove",l),e.addEvent(a.parent,"mouseup",m),a.parent.style.cursor="crosshair";return e.cancelEvent(b)}}function j(b){var c=new e.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}var d=null,e=com.modestmaps,f=typeof c=="function"?c:c.callback,g,h,i={};i.add=function(a){g=document.createElement("div"),g.id=a.parent.id+"-boxselector-box",g.className="boxselector-box",a.parent.appendChild(g),e.addEvent(a.parent,"mousedown",k),a.addCallback("drawn",n);return this},i.remove=function(){a.parent.removeChild(g),a.removeCallback("mousedown",n)};return i.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.fullscreen=function(a){function f(c){c&&com.modestmaps.cancelEvent(c),(b=!b)?(a.parent.className=a.parent.className.replace("wax-fullscreen-map",""),a.setSize(e[0],e[1])):(e=[a.parent.offsetWidth,a.parent.offsetHeight],a.parent.className+=" wax-fullscreen-map",a.setSize(a.parent.offsetWidth,a.parent.offsetHeight))}var b=1,c={},d,e;c.add=function(a){d=document.createElement("a"),d.className="wax-fullscreen",d.href="#fullscreen",d.innerHTML="fullscreen",com.modestmaps.addEvent(d,"click",f);return this},c.appendTo=function(a){wax.util.$(a).appendChild(d);return this};return c.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.locationHash={stateChange:function(a){com.modestmaps.addEvent(window,"hashchange",function(){a(location.hash)},!1)},getState:function(){return location.hash.substring(1)},pushState:function(a){location.hash="#"+a}},wax.mm.pushState={stateChange:function(a){com.modestmaps.addEvent(window,"popstate",function(b){b.state&&b.state.map_location&&a(b.state.map_location)},!1)},getState:function(){if(!!window.history&&!!window.history.state)return history.state&&history.state.map_location},pushState:function(a){!!window.history&&!!window.history.pushState&&window.history.pushState({map_location:a},document.title,window.location.href)}},wax.mm.hash=function(a,b,c){function l(a){a!==d&&i(d=a)&&e.move()}function k(){var a=j();d!==a&&(d=a,c.manager.pushState(d))}function h(a,b){return g(a,b,!1)}function g(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)}}c=c||{};var d,e={},f=90-1e-8;c.manager=c.manager||wax.mm.pushState;var i=function(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(new com.modestmaps.Location(c[1],c[2]),c[0])},j=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("/")},m=function(){c.defaultCenter&&a.setCenter(c.defaultCenter),c.defaultZoom&&a.setZoom(c.defaultZoom)};e.add=function(a){c.manager.getState()?e.stateChange(c.manager.getState()):(m(),k()),a.addCallback("drawn",h(k,500)),c.manager.stateChange(l);return this};return e.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.interaction=function(a,b,c){function y(b,c){var d=s(c),i;d&&e.getGrid(d.src,function(e,j){for(var k=0;j&&k<g.length;k++)if(i=j.getFeature(c.x,c.y,d,{format:g[k]}))switch(g[k]){case"full":case"teaser":return f.click(i,a.parent,0,b);case"location":return h(i)}})}function x(b){var c=wax.util.eventoffset(b);d.removeEvent(a.parent,"mouseup",x),a.parent.ontouchend&&(d.removeEvent(a.parent,"touchend",x),d.removeEvent(a.parent,"touchmove",_touchCancel)),j=!1,b.type==="touchend"?y(n):Math.round(c.y/o)===Math.round(n.y/o)&&Math.round(c.x/o)===Math.round(n.x/o)&&(k=window.setTimeout(function(a){return function(b){y(b,a)}}(c)));return x}function w(){d.removeEvent(a.parent,"touchend",x),d.removeEvent(a.parent,"touchmove",x),j=!1}function v(b){t()||(j=!0,n=wax.util.eventoffset(b),b.type==="mousedown"?d.addEvent(a.parent,"mouseup",x):b.type==="touchstart"&&b.touches.length===1&&(this.clickAction=["full","teaser"],f._currentTooltip&&f.hideTooltip(f._currentTooltip),d.addEvent(a.parent,"touchend",x),d.addEvent(a.parent,"touchmove",w)))}function u(b){if(!j){var c=wax.util.eventoffset(b),d=s(c),g;d&&e.getGrid(d.src,function(e,h){!e&&!!h&&((g=h.getFeature(c.x,c.y,d,{format:"teaser"}))?g&&m!==g?(m=g,f.out(a.parent),f.over(g,a.parent,0,b)):g||(m=null,f.out(a.parent)):(m=null,f.out(a.parent)))})}}function t(){if(k){window.clearTimeout(k),k=null;return!0}return!1}function s(a){for(var b=0,c=q();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 r(a,b){p=null}function q(){var b=a.createOrGetLayer(Math.round(a.getZoom()));return p||(p=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.tiles))}c=c||{},b=b||{};var d=com.modestmaps,e=wax.GridManager(b),f=c.callbacks||new wax.tooltip,g=c.clickAction||["full"],h=c.clickHandler||function(a){window.location=a},i={},j=!1,k=!1,l="ontouchstart"in document.documentElement,m,n,o=4,p;i.add=function(){var b=["zoomed","panned","centered","extentset","resized","drawn"];for(var c=0;c<b.length;c++)a.addCallback(b[c],r);d.addEvent(a.parent,"mousemove",u),d.addEvent(a.parent,"mousedown",v),l&&d.addEvent(a.parent,"touchstart",v);return this};return i.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.legend=function(a,b){b=b||{};var c,d={};d.add=function(){c=wax.legend().content(b.legend||"");return this},d.element=function(){return c.element()},d.appendTo=function(a){wax.util.$(a).appendChild(c.element());return this};return d.add()},wax=wax||{},wax.mm=wax.mm||{},wax.mm.mobile=function(a,b,c){c=c||{};var d=com.modestmaps,e=navigator.userAgent.toLowerCase(),f=e.indexOf("webkit")!=-1,g=e.indexOf("mobile")!=-1,h=g&&f,i=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=.5;var i=h.createLinearGradient(0,0,300,225);i.addColorStop(0,"black"),i.addColorStop(1,"rgb(200, 200, 200)"),h.fillStyle=i,h.fillRect(0,0,c,d),h.fillStyle="rgb(255, 255, 255)",h.beginPath(),h.moveTo(e-g*.6,f-g),h.lineTo(e-g*.6,f+g),h.lineTo(e+g*.6,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=c.overlayDraw||i,r=c.backDraw||j;bodyDraw=c.bodyDraw||function(){};var s={add:function(a){h&&(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),q(m),o=document.createElement("div"),backDiv=document.createElement("div"),n=document.body,newBody=document.createElement("body"),newBody.className="wax-mobile-body",newBody.appendChild(backDiv),d.addEvent(m,"touchstart",this.toTouch),d.addEvent(backDiv,"touchstart",this.toPage));return this},toTouch:function(){a.parent.parentNode.replaceChild(o,a.parent),newBody.insertBefore(a.parent,backDiv),document.body=newBody,bodyDraw(newBody),r(backDiv),p.setAttribute("content","initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0"),document.head.appendChild(p),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,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 s.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.pointselector=function(a,b,c){function p(b){!d||(e=l(b),h.Point.distance(d,e)<f&&(i.addLocation(a.pointLocation(d)),k(m(j))),d=null)}function o(b){d=l(b),h.addEvent(a.parent,"mouseup",p)}function n(){var b=new h.Point(0,0);for(var c=0;c<j.length;c++){var d=a.locationPoint(j[c]);j[c].pointDiv||(j[c].pointDiv=document.createElement("div"),j[c].pointDiv.className="wax-point-div",j[c].pointDiv.style.position="absolute",j[c].pointDiv.style.display="block",j[c].pointDiv.location=j[c],h.addEvent(j[c].pointDiv,"mouseup",function(b){var d=j[c];return function(b){h.removeEvent(a.parent,"mouseup",p),i.deletePoint(d,b)}}()),a.parent.appendChild(j[c].pointDiv)),j[c].pointDiv.style.left=d.x+"px",j[c].pointDiv.style.top=d.y+"px"}}function m(a){var b=[];for(var c=0;c<a.length;c++)b.push(new h.Location(a[c].lat,a[c].lon));return b}function l(b){var c=wax.util.eventoffset(b),d=new h.Point(c.x,c.y),e={x:parseFloat(h.getStyle(document.documentElement,"margin-left")),y:parseFloat(h.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}var d=null,e=null,f=5,g,h=com.modestmaps,i={},j=[],k=typeof c=="function"?c:c.callback;i.addLocation=function(a){j.push(a),n(),k(m(j))},i.add=function(a){h.addEvent(a.parent,"mousedown",o),a.addCallback("drawn",n());return this},i.deletePoint=function(a,b){confirm("Delete this point?")&&(a.pointDiv.parentNode.removeChild(a.pointDiv),j.splice(wax.util.indexOf(j,a),1),k(m(j)))};return i.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.zoombox=function(a){function j(a){if(!!d){var b=g(a);e.style.display="block",b.x<f.x?e.style.left=b.x+"px":e.style.left=f.x+"px",e.style.width=Math.abs(b.x-f.x)+"px",b.y<f.y?e.style.top=b.y+"px":e.style.top=f.y+"px",e.style.height=Math.abs(b.y-f.y)+"px";return c.cancelEvent(a)}}function i(b){if(!!b.shiftKey&&!this.drawing){d=!0,f=g(b),e.style.left=f.x+"px",e.style.top=f.y+"px",c.addEvent(a.parent,"mousemove",j),c.addEvent(a.parent,"mouseup",h),a.parent.style.cursor="crosshair";return c.cancelEvent(b)}}function h(b){if(!!d){d=!1;var i=g(b),k=a.pointLocation(i),l=a.pointLocation(f);a.setExtent([k,l]),e.style.display="none",c.removeEvent(a.parent,"mousemove",j),c.removeEvent(a.parent,"mouseup",h),a.parent.style.cursor="auto"}}function g(b){var d=new c.Point(b.clientX,b.clientY);d.x+=document.body.scrollLeft+document.documentElement.scrollLeft,d.y+=document.body.scrollTop+document.documentElement.scrollTop;for(var e=a.parent;e;e=e.offsetParent)d.x-=e.offsetLeft,d.y-=e.offsetTop;return d}var b={},c=com.modestmaps,d=!1,e,f=null;b.add=function(a){e=document.createElement("div"),e.id=a.parent.id+"-zoombox-box",e.className="zoombox-box",a.parent.appendChild(e),c.addEvent(a.parent,"mousedown",i)},b.remove=function(){a.parent.removeChild(e),a.removeCallback("mousedown",i)};return 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){a.addCallback("drawn",function(a,b){a.coordinate.zoom===a.provider.outerLimits()[0].zoom?d.className="zoomer zoomout zoomdisabled":a.coordinate.zoom===a.provider.outerLimits()[1].zoom?c.className="zoomer zoomin zoomdisabled":(c.className="zoomer zoomin",d.className="zoomer zoomout")});return this},appendTo:function(a){wax.util.$(a).appendChild(c),wax.util.$(a).appendChild(d);return this}};return e.add(a)},wax=wax||{},wax.mm=wax.mm||{},wax.mm.connector=function(a){this.options={tiles:a.tiles,scheme:a.scheme||"xyz",minzoom:a.minzoom||0,maxzoom:a.maxzoom||22}},wax.mm.connector.prototype={outerLimits:function(){return[(new com.modestmaps.Coordinate(0,0,0)).zoomTo(this.options.minzoom),(new com.modestmaps.Coordinate(1,1,0)).zoomTo(this.options.maxzoom)]},getTileUrl:function(a){if(!(coord=this.sourceCoordinate(a)))return null;coord.row=this.options.scheme==="tms"?Math.pow(2,coord.zoom)-coord.row-1:coord.row;return 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))}},com&&com.modestmaps&&com.modestmaps.extend(wax.mm.connector,com.modestmaps.MapProvider)

@@ -0,4 +1,5 @@

/* wax - 3.0.0 - 1.0.4-320-g97e618c */
/*!
* 0.1.6 with IE readyState fix in https://github.com/ded/reqwest/issues/18
*
* Reqwest! A x-browser general purpose XHR connection manager

@@ -9,4 +10,3 @@ * copyright Dustin Diaz 2011

*/
!function(window){function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):!0)+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}function enc(a){return encodeURIComponent(a)}function reqwest(a,b){return new Reqwest(a,b)}function init(o,fn){function error(a){o.error&&o.error(a),complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText;switch(type){case"json":resp=eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function complete(a){o.complete&&o.complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function setType(a){if(/\.json$/.test(a))return"json";if(/\.jsonp$/.test(a))return"jsonp";if(/\.js$/.test(a))return"js";if(/\.html?$/.test(a))return"html";if(/\.xml$/.test(a))return"xml";return"js"}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function getRequest(a,b,c){if(a.type!="jsonp"){var f=xhr();f.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(f,a),f.onreadystatechange=readyState(f,b,c),a.before&&a.before(f),f.send(a.data||null);return f}var d=doc.createElement("script");window[getCallbackName(a)]=generalCallback,d.type="text/javascript",d.src=a.url,d.async=!0;var e=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(d)};d.onload=e,d.onreadystatechange=function(){d.readyState=="loaded"||d.readyState=="complete"&&e()},head.appendChild(d)}function generalCallback(a){lastValue=a}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function setHeaders(a,b){var c=b.headers||{};c.Accept="text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]="application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this)
// Instantiate objects based on a JSON "record". The record must be a statement
!function(window){function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):"")+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}function enc(a){return encodeURIComponent(a)}function reqwest(a,b){return new Reqwest(a,b)}function init(o,fn){function error(a){o.error&&o.error(a),complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText,JSON;switch(type){case"json":resp=JSON?JSON.parse(r):eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function complete(a){o.complete&&o.complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function setType(a){if(/\.json$/.test(a))return"json";if(/\.jsonp$/.test(a))return"jsonp";if(/\.js$/.test(a))return"js";if(/\.html?$/.test(a))return"html";if(/\.xml$/.test(a))return"xml";return"js"}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function getRequest(a,b,c){if(a.type!="jsonp"){var f=xhr();f.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(f,a),f.onreadystatechange=readyState(f,b,c),a.before&&a.before(f),f.send(a.data||null);return f}var d=doc.createElement("script");window[getCallbackName(a)]=generalCallback,d.type="text/javascript",d.src=a.url,d.async=!0;var e=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(d)};d.onload=e,d.onreadystatechange=function(){/^loaded|complete$/.test(d.readyState)&&e()},head.appendChild(d)}function generalCallback(a){lastValue=a}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function setHeaders(a,b){var c=b.headers||{};c.Accept=c.Accept||"text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]=c["Content-type"]||"application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this)// Instantiate objects based on a JSON "record". The record must be a statement
// array in the following form:

@@ -208,51 +208,60 @@ //

};
// Wax GridUtil
// ------------
wax = wax || {};
// Wax header
var wax = wax || {};
// Attribution
// -----------
wax.attribution = function() {
var container,
a = {};
// Request
// -------
// Request data cache. `callback(data)` where `data` is the response data.
wax.request = {
cache: {},
locks: {},
promises: {},
get: function(url, callback) {
// Cache hit.
if (this.cache[url]) {
return callback(this.cache[url][0], this.cache[url][1]);
// Cache miss.
} else {
this.promises[url] = this.promises[url] || [];
this.promises[url].push(callback);
// Lock hit.
if (this.locks[url]) return;
// Request.
var that = this;
this.locks[url] = true;
reqwest({
url: url + '?callback=grid',
type: 'jsonp',
jsonpCallback: 'callback',
success: function(data) {
that.locks[url] = false;
that.cache[url] = [null, data];
for (var i = 0; i < that.promises[url].length; i++) {
that.promises[url][i](that.cache[url][0], that.cache[url][1]);
}
},
error: function(err) {
that.locks[url] = false;
that.cache[url] = [err, null];
for (var i = 0; i < that.promises[url].length; i++) {
that.promises[url][i](that.cache[url][0], that.cache[url][1]);
}
}
});
a.set = function(content) {
if (typeof content === 'undefined') return;
container.innerHTML = content;
return this;
};
a.element = function() {
return container;
};
a.init = function() {
container = document.createElement('div');
container.className = 'wax-attribution';
return this;
};
return a.init();
};
// Formatter
// ---------
wax.formatter = function(x) {
var formatter = {},
f;
// Prevent against just any input being used.
if (x && typeof x === 'string') {
try {
// Ugly, dangerous use of eval.
eval('f = ' + x);
} catch (e) {
if (console) console.log(e);
}
} else if (x && typeof x === 'function') {
f = x;
} else {
f = function() {};
}
// Wrap the given formatter function in order to
// catch exceptions that it may throw.
formatter.format = function(options, data) {
try {
return f(options, data);
} catch (e) {
if (console) console.log(e);
}
};
return formatter;
};
// GridInstance

@@ -264,60 +273,57 @@ // ------------

options = options || {};
this.grid_tile = grid_tile;
this.formatter = formatter;
// resolution is the grid-elements-per-pixel ratio of gridded data.
this.resolution = options.resolution || 4;
// The size of a tile element. For now we expect tiles to be squares.
this.tileSize = options.tileSize || 256;
};
var instance = {},
resolution = options.resolution || 4;
tileSize = options.tileSize || 256;
// Resolve the UTF-8 encoding stored in grids to simple
// number values.
// See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
// for details.
wax.GridInstance.prototype.resolveCode = function(key) {
if (key >= 93) key--;
if (key >= 35) key--;
key -= 32;
return key;
};
// Resolve the UTF-8 encoding stored in grids to simple
// number values.
// See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
// for details.
function resolveCode(key) {
if (key >= 93) key--;
if (key >= 35) key--;
key -= 32;
return key;
}
// Get a feature:
//
// * `x` and `y`: the screen coordinates of an event
// * `tile_element`: a DOM element of a tile, from which we can get an offset.
// * `options` options to give to the formatter: minimally having a `format`
// member, being `full`, `teaser`, or something else.
wax.GridInstance.prototype.getFeature = function(x, y, tile_element, options) {
if (!(this.grid_tile && this.grid_tile.grid)) return;
// Get a feature:
//
// * `x` and `y`: the screen coordinates of an event
// * `tile_element`: a DOM element of a tile, from which we can get an offset.
// * `options` options to give to the formatter: minimally having a `format`
// member, being `full`, `teaser`, or something else.
instance.getFeature = function(x, y, tile_element, options) {
if (!(grid_tile && grid_tile.grid)) return;
// IE problem here - though recoverable, for whatever reason
var offset = wax.util.offset(tile_element);
var tileX = offset.left;
var tileY = offset.top;
// IE problem here - though recoverable, for whatever reason
var offset = wax.util.offset(tile_element),
tileX = offset.left,
tileY = offset.top,
res = (offset.width / tileSize) * resolution;
// This tile's resolution. larger tiles will have lower, aka coarser, resolutions
var res = (offset.width / this.tileSize) * this.resolution;
// This tile's resolution. larger tiles will have lower, aka coarser, resolutions
if ((y - tileY < 0) || (x - tileX < 0)) return;
if ((Math.floor(y - tileY) > tileSize) ||
(Math.floor(x - tileX) > tileSize)) return;
// Find the key in the grid. The above calls should ensure that
// the grid's array is large enough to make this work.
var key = grid_tile.grid[
Math.floor((y - tileY) / res)
].charCodeAt(
Math.floor((x - tileX) / res)
);
if (y - tileY < 0) return;
if (x - tileX < 0) return;
if (Math.floor(y - tileY) > this.tileSize) return;
if (Math.floor(x - tileX) > this.tileSize) return;
key = resolveCode(key);
// Find the key in the grid. The above calls should ensure that
// the grid's array is large enough to make this work.
var key = this.grid_tile.grid[
Math.floor((y - tileY) / res)
].charCodeAt(
Math.floor((x - tileX) / res)
);
// If this layers formatter hasn't been loaded yet,
// download and load it now.
if (grid_tile.keys[key] && grid_tile.data[grid_tile.keys[key]]) {
return formatter.format(options, grid_tile.data[grid_tile.keys[key]]);
}
};
key = this.resolveCode(key);
// If this layers formatter hasn't been loaded yet,
// download and load it now.
if (this.grid_tile.keys[key] && this.grid_tile.data[this.grid_tile.keys[key]]) {
return this.formatter.format(options, this.grid_tile.data[this.grid_tile.keys[key]]);
}
return instance;
};
// GridManager

@@ -332,80 +338,84 @@ // -----------

options = options || {};
this.resolution = options.resolution || 4;
this.grid_tiles = {};
this.key_maps = {};
this.formatters = {};
this.locks = {};
};
// Get a grid - calls `callback` with either a `GridInstance`
// object or false. Behind the scenes, this calls `getFormatter`
// and gets grid data, and tries to avoid re-downloading either.
wax.GridManager.prototype.getGrid = function(url, callback) {
var that = this;
that.getFormatter(that.formatterUrl(url), function(err, f) {
if (err || !f) return callback(err, null);
var resolution = options.resolution || 4,
grid_tiles = {},
manager = {},
xyzFinder = new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),
formatter;
wax.request.get(that.tileDataUrl(url), function(err, t) {
if (err) return callback(err, null);
callback(null, new wax.GridInstance(t, f, {
resolution: that.resolution || 4
}));
});
});
};
var formatterUrl = function(url) {
return url.replace(/\d+\/\d+\/\d+\.\w+/, 'layer.json');
};
// Simplistically derive the URL of the grid data endpoint from a tile URL
wax.GridManager.prototype.tileDataUrl = function(url) {
return url.replace(/(\.png|\.jpg|\.jpeg)(\d*)/, '.grid.json');
};
var gridUrl = function(url) {
return url.replace(/(\.png|\.jpg|\.jpeg)(\d*)/, '.grid.json');
};
// Simplistically derive the URL of the formatter function from a tile URL
wax.GridManager.prototype.formatterUrl = function(url) {
return url.replace(/\d+\/\d+\/\d+\.\w+/, 'layer.json');
};
// Request and save a formatter, passed to `callback()` when finished.
wax.GridManager.prototype.getFormatter = function(url, callback) {
var that = this;
// Formatter is cached.
if (typeof this.formatters[url] !== 'undefined') {
callback(null, this.formatters[url]);
return;
} else {
wax.request.get(url, function(err, data) {
if (data && data.formatter) {
that.formatters[url] = new wax.Formatter(data);
} else {
that.formatters[url] = false;
}
callback(err, that.formatters[url]);
});
function getFormatter(url, callback) {
if (typeof formatter !== 'undefined') {
return callback(null, formatter);
} else {
wax.request.get(formatterUrl(url), function(err, data) {
if (data && data.formatter) {
formatter = wax.formatter(data.formatter);
} else {
formatter = false;
}
return callback(err, formatter);
});
}
}
};
// Formatter
// ---------
wax.Formatter = function(obj) {
// Prevent against just any input being used.
if (obj.formatter && typeof obj.formatter === 'string') {
try {
// Ugly, dangerous use of eval.
eval('this.f = ' + obj.formatter);
} catch (e) {
// Syntax errors in formatter
if (console) console.log(e);
}
} else {
this.f = function() {};
function templatedGridUrl(template) {
if (typeof template === 'string') template = [template];
return function templatedGridFinder(url) {
if (!url) return;
var xyz = xyzFinder.exec(url);
if (!xyz) return;
return template[parseInt(xyz[2], 10) % template.length]
.replace('{z}', xyz[1])
.replace('{x}', xyz[2])
.replace('{y}', xyz[3]);
};
}
};
// Wrap the given formatter function in order to
// catch exceptions that it may throw.
wax.Formatter.prototype.format = function(options, data) {
try {
return this.f(options, data);
} catch (e) {
if (console) console.log(e);
}
manager.formatter = function(x) {
if (!arguments.length) return formatter;
formatter = wax.formatter(x);
return manager;
};
manager.formatterUrl = function(x) {
if (!arguments.length) return formatterUrl;
formatterUrl = typeof x === 'string' ?
function() { return x; } : x;
return manager;
};
manager.gridUrl = function(x) {
if (!arguments.length) return gridUrl;
gridUrl = typeof x === 'function' ?
x : templatedGridUrl(x);
return manager;
};
manager.getGrid = function(url, callback) {
getFormatter(url, function(err, f) {
var gurl = gridUrl(url);
if (err || !f || !gurl) return callback(err, null);
wax.request.get(gurl, function(err, t) {
if (err) return callback(err, null);
callback(null, wax.GridInstance(t, f, {
resolution: resolution || 4
}));
});
});
return manager;
};
if (options.formatter) manager.formatter(options.formatter);
if (options.grids) manager.gridUrl(options.grids);
return manager;
};

@@ -418,42 +428,37 @@ // Wax Legend

wax.Legend = function(context, container) {
this.legends = {};
this.context = context;
this.container = container;
if (!this.container) {
this.container = document.createElement('div');
this.container.className = 'wax-legends';
}
this.context.appendChild(this.container);
};
wax.legend = function() {
var element,
legend = {},
container;
wax.Legend.prototype.render = function(urls) {
var url;
for (url in this.legends) {
this.legends[url].style.display = 'none';
}
var render = wax.util.bind(function(url, content) {
if (!content) {
this.legends[url] = false;
} else if (this.legends[url]) {
this.legends[url].style.display = 'block';
legend.element = function() {
return container;
};
legend.content = function(content) {
if (!arguments.length) return element.innerHTML;
if (content) {
element.innerHTML = content;
element.style.display = 'block';
} else {
this.legends[url] = document.createElement('div');
this.legends[url].className = 'wax-legend';
this.legends[url].innerHTML = content;
this.container.appendChild(this.legends[url]);
element.innerHTML = '';
element.style.display = 'none';
}
}, this);
for (var i = 0; i < urls.length; i++) {
url = this.legendUrl(urls[i]);
wax.request.get(url, function(err, data) {
if (data && data.legend) render(url, data.legend);
});
}
};
return this;
};
wax.Legend.prototype.legendUrl = function(url) {
return url.replace(/\d+\/\d+\/\d+\.\w+/, 'layer.json');
legend.add = function() {
container = document.createElement('div');
container.className = 'wax-legends';
element = document.createElement('div');
element.className = 'wax-legend';
element.style.display = 'none';
container.appendChild(element);
return this;
};
return legend.add();
};
// Like underscore's bind, except it runs a function

@@ -472,8 +477,67 @@ // with no arguments off of an object.

self.melt = function(func, obj) {
func.apply(obj, [self, obj]);
return self;
return func.apply(obj, [self, obj]);
};
return self;
};
// Wax GridUtil
// ------------
// Wax header
var wax = wax || {};
// Request
// -------
// Request data cache. `callback(data)` where `data` is the response data.
wax.request = {
cache: {},
locks: {},
promises: {},
get: function(url, callback) {
// Cache hit.
if (this.cache[url]) {
return callback(this.cache[url][0], this.cache[url][1]);
// Cache miss.
} else {
this.promises[url] = this.promises[url] || [];
this.promises[url].push(callback);
// Lock hit.
if (this.locks[url]) return;
// Request.
var that = this;
this.locks[url] = true;
reqwest({
url: url + '?callback=grid',
type: 'jsonp',
jsonpCallback: 'callback',
success: function(data) {
that.locks[url] = false;
that.cache[url] = [null, data];
for (var i = 0; i < that.promises[url].length; i++) {
that.promises[url][i](that.cache[url][0], that.cache[url][1]);
}
},
error: function(err) {
that.locks[url] = false;
that.cache[url] = [err, null];
for (var i = 0; i < that.promises[url].length; i++) {
that.promises[url][i](that.cache[url][0], that.cache[url][1]);
}
}
});
}
}
};
wax = wax || {};
// A wrapper for reqwest jsonp to easily load TileJSON from a URL.
wax.tilejson = function(url, callback) {
reqwest({
url: url + '?callback=grid',
type: 'jsonp',
jsonpCallback: 'callback',
success: callback,
error: callback
});
};
var wax = wax || {};
wax.tooltip = {};

@@ -589,5 +653,8 @@

offset: function(el) {
// TODO: window margin offset
var width = el.offsetWidth,
height = el.offsetHeight,
// TODO: window margins
//
// Okay, so fall back to styles if offsetWidth and height are botched
// by Firefox.
var width = el.offsetWidth || parseInt(el.style.width, 10),
height = el.offsetHeight || parseInt(el.style.height, 10),
top = 0,

@@ -635,4 +702,4 @@ left = 0;

var htmlComputed = document.defaultView ?
window.getComputedStyle(document.body.parentNode, null) :
document.body.parentNode.currentStyle;
window.getComputedStyle(document.body.parentNode, null) :
document.body.parentNode.currentStyle;
if (document.body.parentNode.offsetTop !==

@@ -642,3 +709,3 @@ parseInt(htmlComputed.marginTop, 10) &&

top += parseInt(htmlComputed.marginTop, 10);
left += parseInt(htmlComputed.marginLeft, 10);
left += parseInt(htmlComputed.marginLeft, 10);
}

@@ -653,2 +720,9 @@

},
'$': function(x) {
return (typeof x === 'string') ?
document.getElementById(x) :
x;
},
// From underscore, minus funcbind for now.

@@ -669,20 +743,20 @@ // Returns a version of a function that always has the second parameter,

indexOf: function(array, item) {
var nativeIndexOf = Array.prototype.indexOf;
if (array === null) return -1;
var i, l;
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);
for (i = 0, l = array.length; i < l; i++) if (array[i] === item) return i;
return -1;
var nativeIndexOf = Array.prototype.indexOf;
if (array === null) return -1;
var i, l;
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);
for (i = 0, l = array.length; i < l; i++) if (array[i] === item) return i;
return -1;
},
// is this object an array?
isArray: Array.isArray || function(obj) {
return Object.prototype.toString.call(obj) === '[object Array]';
return Object.prototype.toString.call(obj) === '[object Array]';
},
// From underscore: reimplement the ECMA5 `Object.keys()` methodb
keys: Object.keys || function(obj) {
var hasOwnProperty = Object.prototype.hasOwnProperty;
if (obj !== Object(obj)) throw new TypeError('Invalid object');
var keys = [];
for (var key in obj) if (hasOwnProperty.call(obj, key)) keys[keys.length] = key;
return keys;
var hasOwnProperty = Object.prototype.hasOwnProperty;
if (obj !== Object(obj)) throw new TypeError('Invalid object');
var keys = [];
for (var key in obj) if (hasOwnProperty.call(obj, key)) keys[keys.length] = key;
return keys;
},

@@ -773,6 +847,6 @@ // From quirksmode: normalize the offset of an event from the top-left

initialize: function(options) {
initialize: function(tilejson, options) {
this.options = options || {};
this.clickAction = this.options.clickAction || 'full';
this.gm = new wax.GridManager(this.options);
this.gm = new wax.GridManager(tilejson);

@@ -779,0 +853,0 @@ OpenLayers.Control.prototype.initialize.apply(this, [this.options || {}]);

@@ -1,4 +0,2 @@

/*!
* 0.1.6 with IE readyState fix in https://github.com/ded/reqwest/issues/18
*
/* wax - 3.0.0 - 1.0.4-320-g97e618c *//*!
* Reqwest! A x-browser general purpose XHR connection manager

@@ -8,2 +6,2 @@ * copyright Dustin Diaz 2011

* license MIT
*/!function(window){function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}function setHeaders(a,b){var c=b.headers||{};c.Accept="text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]="application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function generalCallback(a){lastValue=a}function getRequest(a,b,c){if(a.type!="jsonp"){var d=xhr();d.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(d,a),d.onreadystatechange=readyState(d,b,c),a.before&&a.before(d),d.send(a.data||null);return d}var e=doc.createElement("script");window[getCallbackName(a)]=generalCallback,e.type="text/javascript",e.src=a.url,e.async=!0;var f=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(e)};e.onload=f,e.onreadystatechange=function(){e.readyState=="loaded"||e.readyState=="complete"&&f()},head.appendChild(e)}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function setType(a){if(/\.json$/.test(a))return"json";if(/\.jsonp$/.test(a))return"jsonp";if(/\.js$/.test(a))return"js";if(/\.html?$/.test(a))return"html";if(/\.xml$/.test(a))return"xml";return"js"}function init(o,fn){function complete(a){o.complete&&o.complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText;switch(type){case"json":resp=eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function error(a){o.error&&o.error(a),complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function reqwest(a,b){return new Reqwest(a,b)}function enc(a){return encodeURIComponent(a)}function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):!0)+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this);var wax=wax||{};Array.prototype.reduce||(Array.prototype.reduce=function(a){"use strict";if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;var d=0,e;if(arguments.length>=2)e=arguments[1];else do{if(d in b){e=b[d++];break}if(++d>=c)throw new TypeError}while(!0);while(d<c)d in b&&(e=a.call(undefined,e,b[d],d,b)),d++;return e}),wax.Record=function(a,b){var c=function(a,b){var c=a.split(".").reduce(function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){if(wax.util.isArray(a)&&a[0]&&f(a[0]))return{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)};return!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=wax.util.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}};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]){var c=this;this.locks[a]=!0,reqwest({url:a+"?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.GridInstance=function(a,b,c){c=c||{},this.grid_tile=a,this.formatter=b,this.resolution=c.resolution||4,this.tileSize=c.tileSize||256},wax.GridInstance.prototype.resolveCode=function(a){a>=93&&a--,a>=35&&a--,a-=32;return a},wax.GridInstance.prototype.getFeature=function(a,b,c,d){if(!!this.grid_tile&&!!this.grid_tile.grid){var e=wax.util.offset(c),f=e.left,g=e.top,h=e.width/this.tileSize*this.resolution;if(b-g<0)return;if(a-f<0)return;if(Math.floor(b-g)>this.tileSize)return;if(Math.floor(a-f)>this.tileSize)return;var i=this.grid_tile.grid[Math.floor((b-g)/h)].charCodeAt(Math.floor((a-f)/h));i=this.resolveCode(i);if(this.grid_tile.keys[i]&&this.grid_tile.data[this.grid_tile.keys[i]])return this.formatter.format(d,this.grid_tile.data[this.grid_tile.keys[i]])}},wax.GridManager=function(a){a=a||{},this.resolution=a.resolution||4,this.grid_tiles={},this.key_maps={},this.formatters={},this.locks={}},wax.GridManager.prototype.getGrid=function(a,b){var c=this;c.getFormatter(c.formatterUrl(a),function(d,e){if(d||!e)return b(d,null);wax.request.get(c.tileDataUrl(a),function(a,d){if(a)return b(a,null);b(null,new wax.GridInstance(d,e,{resolution:c.resolution||4}))})})},wax.GridManager.prototype.tileDataUrl=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")},wax.GridManager.prototype.formatterUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},wax.GridManager.prototype.getFormatter=function(a,b){var c=this;typeof this.formatters[a]!="undefined"?b(null,this.formatters[a]):wax.request.get(a,function(d,e){e&&e.formatter?c.formatters[a]=new wax.Formatter(e):c.formatters[a]=!1,b(d,c.formatters[a])})},wax.Formatter=function(obj){if(obj.formatter&&typeof obj.formatter=="string")try{eval("this.f = "+obj.formatter)}catch(e){console&&console.log(e)}else this.f=function(){}},wax.Formatter.prototype.format=function(a,b){try{return this.f(a,b)}catch(c){console&&console.log(c)}};var wax=wax||{};wax.Legend=function(a,b){this.legends={},this.context=a,this.container=b,this.container||(this.container=document.createElement("div"),this.container.className="wax-legends"),this.context.appendChild(this.container)},wax.Legend.prototype.render=function(a){var b;for(b in this.legends)this.legends[b].style.display="none";var c=wax.util.bind(function(a,b){b?this.legends[a]?this.legends[a].style.display="block":(this.legends[a]=document.createElement("div"),this.legends[a].className="wax-legend",this.legends[a].innerHTML=b,this.container.appendChild(this.legends[a])):this.legends[a]=!1},this);for(var d=0;d<a.length;d++)b=this.legendUrl(a[d]),wax.request.get(b,function(a,d){d&&d.legend&&c(b,d.legend)})},wax.Legend.prototype.legendUrl=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")};var w=function(a){a.melt=function(b,c){b.apply(c,[a,c]);return a};return a},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,c,d){tooltip=document.createElement("div"),tooltip.className="wax-tooltip wax-tooltip-"+c,tooltip.innerHTML=a,b.appendChild(tooltip);return tooltip},wax.tooltip.prototype.hideTooltip=function(a){if(!!a){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,c){this.unselect(b);var d=this.getTooltip(a,b,c),e=document.createElement("a");e.href="#close",e.className="close",e.innerHTML="Close";var f=wax.util.bind(function(a){this.hideTooltip(d),this._currentTooltip=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault();return!1},this);e.addEventListener?e.addEventListener("click",f,!1):e.attachEvent&&e.attachEvent("onclick",f),d.className+=" wax-popup",d.innerHTML=a,d.appendChild(e),this._currentTooltip=d},wax.tooltip.prototype.select=function(a,b,c,d){if(!!a){if(this.isPopup(this._currentTooltip))return;this._currentTooltip=this.getTooltip(a,b,c,d),b.style.cursor="pointer"}},wax.tooltip.prototype.unselect=function(a){this.isPopup(this._currentTooltip)||(a.style.cursor="default",this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined))},wax.tooltip.prototype.out=wax.tooltip.prototype.unselect,wax.tooltip.prototype.over=wax.tooltip.prototype.select,wax.tooltip.prototype.click=wax.tooltip.prototype.click,wax.util=wax.util||{},wax.util={offset:function(a){var b=a.offsetWidth,c=a.offsetHeight,d=0,e=0,f=function(a){if(a!==document.body&&a!==document.documentElement){d+=a.offsetTop,e+=a.offsetLeft;var b=a.style.transform||a.style["-webkit-transform"]||a.style.MozTransform;if(b)if(match=b.match(/translate\((.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10);else if(match=b.match(/translate3d\((.+)px, (.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10)}};f(a);try{while(a=a.offsetParent)f(a)}catch(g){}d+=document.body.offsetTop,e+=document.body.offsetLeft,d+=document.body.parentNode.offsetTop,e+=document.body.parentNode.offsetLeft;var h=document.defaultView?window.getComputedStyle(document.body.parentNode,null):document.body.parentNode.currentStyle;document.body.parentNode.offsetTop!==parseInt(h.marginTop,10)&&!isNaN(parseInt(h.marginTop,10))&&(d+=parseInt(h.marginTop,10),e+=parseInt(h.marginLeft,10));return{top:d,left:e,height:c,width:b}},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}}};var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Embedder=OpenLayers.Class(OpenLayers.Control,{initialize:function(a){a=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},setMap:function(a){$("#"+this.el+"-script").length&&(OpenLayers.Control.prototype.setMap.apply(this,arguments),$(a.div).prepend($('<input type="text" class="embed-src" />').css({"z-index":"9999999999",position:"relative"}).val("<div id='"+this.el+"-script'>"+$("#"+this.el+"-script").html()+"</div>"))),this.activate()},CLASS_NAME:"wax.ol.Embedder"});var wax=wax||{};wax.ol=wax.ol||{};var addEv=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)};wax.ol.Interaction=OpenLayers.Class(OpenLayers.Control,{feature:{},handlerOptions:null,handlers:null,gm:new wax.GridManager,initialize:function(a){this.options=a||{},this.clickAction=this.options.clickAction||"full",this.gm=new wax.GridManager(this.options),OpenLayers.Control.prototype.initialize.apply(this,[this.options||{}]),this.callbacks=this.options.callbacks||new wax.tooltip},setMap:function(a){addEv(a.viewPortDiv,"mousemove",wax.util.bind(this.getInfoForHover,this)),addEv(a.viewPortDiv,"mouseout",wax.util.bind(this.resetLayers,this)),this.clickHandler=new OpenLayers.Handler.Click(this,{click:this.getInfoForClick}),this.clickHandler.setMap(a),this.clickHandler.activate(),a.events.on({addlayer:this.resetLayers,changelayer:this.resetLayers,removelayer:this.resetLayers,changebaselayer:this.resetLayers,scope:this}),OpenLayers.Control.prototype.setMap.apply(this,arguments)},getTileStack:function(a,b){if(!a||!b)return[];var c=[];layerfound:for(var d=0;d<a.length;d++)for(var e=0;e<a[d].grid.length;e++)for(var f=0;f<a[d].grid[e].length;f++){if(a[d].grid[e][f].imgDiv)var g=wax.util.offset(a[d].grid[e][f].imgDiv);else var g=wax.util.offset(a[d].grid[e][f].frame);if(g&&g.top<b.y&&g.top+256>b.y&&g.left<b.x&&g.left+256>b.x){c.push(a[d].grid[e][f]);continue layerfound}}return c},viableLayers:function(){if(this._viableLayers)return this._viableLayers;this._viableLayers=[];for(var a in this.map.layers)this.map.layers[a].visibility===!0&&this.map.layers[a].CLASS_NAME==="OpenLayers.Layer.TMS"&&this._viableLayers.push(this.map.layers[a]);return this._viableLayers},resetLayers:function(a){this._viableLayers=null;var b=a.relatedTarget||a.toElement;b&&b.className!=="olTileImage"&&this.callbacks.out(this.map.viewPortDiv)},getInfoForClick:function(a){if(!!a){var b=this.viableLayers(),c=wax.util.eventoffset(a),d=this.getTileStack(this.viableLayers(),c),e=null,f=null,g=this;for(var h=0;h<d.length;h++){if(!d[h].url)continue;this.gm.getGrid(d[h].url,function(a,b){if(!!b){var e=b.getFeature(c.x,c.y,d[h].frame,{format:g.clickAction});if(e)switch(g.clickAction){case"full":g.callbacks.click(e,d[h].layer.map.viewPortDiv,h);break;case"location":window.location=e}}})}}},getInfoForHover:function(a){if(!!a){var b={format:"teaser"},c=this.viableLayers(),d=wax.util.eventoffset(a),e=this.getTileStack(this.viableLayers(),d),f=null,g=null,h=this;for(var i=0;i<e.length;i++){if(!e[i].url)continue;this.gm.getGrid(e[i].url,function(c,f){if(f&&e[i]){var g=f.getFeature(d.x,d.y,e[i].frame,b);if(g){if(!e[i])return;g&&h.feature[i]!==g?(h.feature[i]=g,h.callbacks.out(e[i].layer.map.div),h.callbacks.over(g,e[i].layer.map.div,i,a)):g||(h.feature[i]=null,h.callbacks.out(e[i].layer.map.div))}else h.feature[i]&&h.callbacks.out(e[i].layer.map.div),h.feature[i]=null}})}}},CLASS_NAME:"wax.ol.Interaction"});var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Legend=OpenLayers.Class(OpenLayers.Control,{CLASS_NAME:"wax.ol.Legend",legend:null,options:null,initialize:function(a){this.options=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},activate:function(){this.legend=new wax.Legend(this.map.viewPortDiv,this.options.container);return OpenLayers.Control.prototype.activate.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments),this.activate(),this.map.events.on({addlayer:this.setLegend,changelayer:this.setLegend,removelayer:this.setLegend,changebaselayer:this.setLegend,scope:this})},setLegend:function(){var a=[];for(var b=0;b<this.map.layers.length;b++){var c=this.map.layers[b];c&&c.getURL&&c.visibility&&a.push(c.getURL(new OpenLayers.Bounds))}this.legend.render(a)}});var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Switcher=OpenLayers.Class(OpenLayers.Control,{CLASS_NAME:"wax.ol.Switcher",initialize:function(a){this.$element=$(a.e),this.options=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments),this.map.events.on({addlayer:this.redraw,changelayer:this.redraw,removelayer:this.redraw,changebaselayer:this.redraw,scope:this}),this.redraw()},layerClick:function(a){var b=a.currentTarget,c=$(b).data("layer");$("a.active",this.$element).removeClass("active"),$.each(this.map.getLayersBy("isBaseLayer",!1),function(){this.CLASS_NAME!=="OpenLayers.Layer.Vector.RootContainer"&&this.displayInLayerSwitcher&&this.setVisibility(!1)}),c.setVisibility(!0),$(b).addClass("active")},needsRedraw:function(){if(!this.layerStates||this.layerStates.length||this.map.layers.length!=this.layerStates.length)return!0;for(var a=0,b=this.layerStates.length;a<b;a++){var c=this.layerStates[a],d=this.map.layers[a];if(c.name!=d.name||c.inRange!=d.inRange||c.id!=d.id||c.visibility!=d.visibility)return!0}return!1},redraw:function(){if(this.needsRedraw()){this.$element.html("");var a=this.map.layers.length;this.layerStates=[];for(var b=0;b<a;b++){var c=this.map.layers[b];this.layerStates[b]={name:c.name,visibility:c.visibility,inRange:c.inRange,id:c.id}}var d=this.map.layers.slice();for(b=0,a=d.length;b<a;b++){var e=d[b];if(e.displayInLayerSwitcher){var f=e.isBaseLayer?e===this.map.baseLayer:e.getVisibility(),g=$.proxy(function(a){this.layerClick(a);return!1},this),h=$("<a></a>");h.click(g).attr("href","#").text(e.name).addClass("layer-toggle").data("layer",e).attr("disabled",!e.inRange),f&&h.addClass("active")}this.$element.append(h),this.$element.trigger("layeradded",h)}}}})
*/!function(window){function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}function setHeaders(a,b){var c=b.headers||{};c.Accept=c.Accept||"text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]=c["Content-type"]||"application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function generalCallback(a){lastValue=a}function getRequest(a,b,c){if(a.type!="jsonp"){var d=xhr();d.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(d,a),d.onreadystatechange=readyState(d,b,c),a.before&&a.before(d),d.send(a.data||null);return d}var e=doc.createElement("script");window[getCallbackName(a)]=generalCallback,e.type="text/javascript",e.src=a.url,e.async=!0;var f=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(e)};e.onload=f,e.onreadystatechange=function(){/^loaded|complete$/.test(e.readyState)&&f()},head.appendChild(e)}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function setType(a){return/\.json$/.test(a)?"json":/\.jsonp$/.test(a)?"jsonp":/\.js$/.test(a)?"js":/\.html?$/.test(a)?"html":/\.xml$/.test(a)?"xml":"js"}function init(o,fn){function complete(a){o.complete&&o.complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText,JSON;switch(type){case"json":resp=JSON?JSON.parse(r):eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function error(a){o.error&&o.error(a),complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function reqwest(a,b){return new Reqwest(a,b)}function enc(a){return encodeURIComponent(a)}function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):"")+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this);var wax=wax||{};Array.prototype.reduce||(Array.prototype.reduce=function(a){"use strict";if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(typeof a!="function")throw new TypeError;if(c==0&&arguments.length==1)throw new TypeError;var d=0,e;if(arguments.length>=2)e=arguments[1];else do{if(d in b){e=b[d++];break}if(++d>=c)throw new TypeError}while(!0);while(d<c)d in b&&(e=a.call(undefined,e,b[d],d,b)),d++;return e}),wax.Record=function(a,b){var c=function(a,b){var c=a.split(".").reduce(function(a,b){return[a[1]||a[0],a[1]?a[1][b]:a[0][b]]},[b||window,null]);if(c[0]&&c[1])return c;throw a+" not found."},d=function(a,b){var d=c(a),e;b=b.length?wax.Record(b):[];if(Object.create)e=Object.create(d[1].prototype),d[1].apply(e,b);else switch(b.length){case 0:e=new d[1];break;case 1:e=new d[1](b[0]);break;case 2:e=new d[1](b[0],b[1]);break;case 3:e=new d[1](b[0],b[1],b[2]);break;case 4:e=new d[1](b[0],b[1],b[2],b[3]);break;case 5:e=new d[1](b[0],b[1],b[2],b[3],b[4]);break;default:}return e},e=function(a,b,d){var e=c(a,d),f=b.length?wax.Record(b):[];return d&&a.indexOf(".")===-1?e[1].apply(d,f):e[1].apply(e[0],f)},f=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@literal","@chain","@inject","@group"],a.split(" ")[0])!==-1},g=function(a){return wax.util.isString(a)&&wax.util.indexOf(["@new","@call","@chain"],a.split(" ")[0])!==-1},h=function(a){return wax.util.isArray(a)&&a[0]&&f(a[0])?{verb:a[0].split(" ")[0],subject:a[0].split(" ")[1],object:a.slice(1)}:!1},i,j=!1,k=null,l=null,m=h(a);if(!m){if(a!==null&&typeof a=="object"){var n=wax.util.keys(a);for(i=0;i<n.length;i++){var o=n[i];a[o]=wax.Record(a[o],b)}return a}return a}switch(m.verb){case"@group":for(i=0;i<m.object.length;i++)k=wax.Record(m.object[i],b),l=h(m.object[i]),l&&g(l.verb)&&(b=k);return b;case"@new":return d(m.subject,m.object);case"@literal":j=c(m.subject);return j?j[1]:null;case"@inject":return e(m.subject,m.object,b);case"@chain":return e(m.subject,m.object,b);case"@call":return e(m.subject,m.object,null)}},wax=wax||{},wax.attribution=function(){var a,b={};b.set=function(b){if(typeof b!="undefined"){a.innerHTML=b;return this}},b.element=function(){return a},b.init=function(){a=document.createElement("div"),a.className="wax-attribution";return this};return b.init()},wax.formatter=function(x){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(){};formatter.format=function(a,b){try{return f(a,b)}catch(c){console&&console.log(c)}};return formatter},wax.GridInstance=function(a,b,c){function f(a){a>=93&&a--,a>=35&&a--,a-=32;return a}c=c||{};var d={},e=c.resolution||4;tileSize=c.tileSize||256,d.getFeature=function(c,d,g,h){if(!!a&&!!a.grid){var i=wax.util.offset(g),j=i.left,k=i.top,l=i.width/tileSize*e;if(d-k<0||c-j<0)return;if(Math.floor(d-k)>tileSize||Math.floor(c-j)>tileSize)return;var m=a.grid[Math.floor((d-k)/l)].charCodeAt(Math.floor((c-j)/l));m=f(m);if(a.keys[m]&&a.data[a.keys[m]])return b.format(h,a.data[a.keys[m]])}};return d},wax.GridManager=function(a){function j(a){typeof a=="string"&&(a=[a]);return function b(b){if(!!b){var c=e.exec(b);if(!c)return;return a[parseInt(c[2],10)%a.length].replace("{z}",c[1]).replace("{x}",c[2]).replace("{y}",c[3])}}}function i(a,b){if(typeof f!="undefined")return b(null,f);wax.request.get(g(a),function(a,c){c&&c.formatter?f=wax.formatter(c.formatter):f=!1;return b(a,f)})}a=a||{};var b=a.resolution||4,c={},d={},e=new RegExp(/(\d+)\/(\d+)\/(\d+)\.[\w\._]+$/g),f,g=function(a){return a.replace(/\d+\/\d+\/\d+\.\w+/,"layer.json")},h=function(a){return a.replace(/(\.png|\.jpg|\.jpeg)(\d*)/,".grid.json")};d.formatter=function(a){if(!arguments.length)return f;f=wax.formatter(a);return d},d.formatterUrl=function(a){if(!arguments.length)return g;g=typeof a=="string"?function(){return a}:a;return d},d.gridUrl=function(a){if(!arguments.length)return h;h=typeof a=="function"?a:j(a);return d},d.getGrid=function(a,c){i(a,function(d,e){var f=h(a);if(d||!e||!f)return c(d,null);wax.request.get(f,function(a,d){if(a)return c(a,null);c(null,wax.GridInstance(d,e,{resolution:b||4}))})});return d},a.formatter&&d.formatter(a.formatter),a.grids&&d.gridUrl(a.grids);return d};var wax=wax||{};wax.legend=function(){var a,b={},c;b.element=function(){return c},b.content=function(b){if(!arguments.length)return a.innerHTML;b?(a.innerHTML=b,a.style.display="block"):(a.innerHTML="",a.style.display="none");return this},b.add=function(){c=document.createElement("div"),c.className="wax-legends",a=document.createElement("div"),a.className="wax-legend",a.style.display="none",c.appendChild(a);return this};return b.add()};var w=function(a){a.melt=function(b,c){return b.apply(c,[a,c])};return a},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]){var c=this;this.locks[a]=!0,reqwest({url:a+"?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=wax||{},wax.tilejson=function(a,b){reqwest({url:a+"?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,c,d){tooltip=document.createElement("div"),tooltip.className="wax-tooltip wax-tooltip-"+c,tooltip.innerHTML=a,b.appendChild(tooltip);return tooltip},wax.tooltip.prototype.hideTooltip=function(a){if(!!a){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,c){this.unselect(b);var d=this.getTooltip(a,b,c),e=document.createElement("a");e.href="#close",e.className="close",e.innerHTML="Close";var f=wax.util.bind(function(a){this.hideTooltip(d),this._currentTooltip=undefined,a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault();return!1},this);e.addEventListener?e.addEventListener("click",f,!1):e.attachEvent&&e.attachEvent("onclick",f),d.className+=" wax-popup",d.innerHTML=a,d.appendChild(e),this._currentTooltip=d},wax.tooltip.prototype.select=function(a,b,c,d){if(!!a){if(this.isPopup(this._currentTooltip))return;this._currentTooltip=this.getTooltip(a,b,c,d),b.style.cursor="pointer"}},wax.tooltip.prototype.unselect=function(a){this.isPopup(this._currentTooltip)||(a.style.cursor="default",this._currentTooltip&&(this.hideTooltip(this._currentTooltip),this._currentTooltip=undefined))},wax.tooltip.prototype.out=wax.tooltip.prototype.unselect,wax.tooltip.prototype.over=wax.tooltip.prototype.select,wax.tooltip.prototype.click=wax.tooltip.prototype.click,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=0,e=0,f=function(a){if(a!==document.body&&a!==document.documentElement){d+=a.offsetTop,e+=a.offsetLeft;var b=a.style.transform||a.style["-webkit-transform"]||a.style.MozTransform;if(b)if(match=b.match(/translate\((.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10);else if(match=b.match(/translate3d\((.+)px, (.+)px, (.+)px\)/))d+=parseInt(match[2],10),e+=parseInt(match[1],10)}};f(a);try{while(a=a.offsetParent)f(a)}catch(g){}d+=document.body.offsetTop,e+=document.body.offsetLeft,d+=document.body.parentNode.offsetTop,e+=document.body.parentNode.offsetLeft;var h=document.defaultView?window.getComputedStyle(document.body.parentNode,null):document.body.parentNode.currentStyle;document.body.parentNode.offsetTop!==parseInt(h.marginTop,10)&&!isNaN(parseInt(h.marginTop,10))&&(d+=parseInt(h.marginTop,10),e+=parseInt(h.marginLeft,10));return{top:d,left:e,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}}};var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Embedder=OpenLayers.Class(OpenLayers.Control,{initialize:function(a){a=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},setMap:function(a){$("#"+this.el+"-script").length&&(OpenLayers.Control.prototype.setMap.apply(this,arguments),$(a.div).prepend($('<input type="text" class="embed-src" />').css({"z-index":"9999999999",position:"relative"}).val("<div id='"+this.el+"-script'>"+$("#"+this.el+"-script").html()+"</div>"))),this.activate()},CLASS_NAME:"wax.ol.Embedder"});var wax=wax||{};wax.ol=wax.ol||{};var addEv=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)};wax.ol.Interaction=OpenLayers.Class(OpenLayers.Control,{feature:{},handlerOptions:null,handlers:null,gm:new wax.GridManager,initialize:function(a,b){this.options=b||{},this.clickAction=this.options.clickAction||"full",this.gm=new wax.GridManager(a),OpenLayers.Control.prototype.initialize.apply(this,[this.options||{}]),this.callbacks=this.options.callbacks||new wax.tooltip},setMap:function(a){addEv(a.viewPortDiv,"mousemove",wax.util.bind(this.getInfoForHover,this)),addEv(a.viewPortDiv,"mouseout",wax.util.bind(this.resetLayers,this)),this.clickHandler=new OpenLayers.Handler.Click(this,{click:this.getInfoForClick}),this.clickHandler.setMap(a),this.clickHandler.activate(),a.events.on({addlayer:this.resetLayers,changelayer:this.resetLayers,removelayer:this.resetLayers,changebaselayer:this.resetLayers,scope:this}),OpenLayers.Control.prototype.setMap.apply(this,arguments)},getTileStack:function(a,b){if(!a||!b)return[];var c=[];layerfound:for(var d=0;d<a.length;d++)for(var e=0;e<a[d].grid.length;e++)for(var f=0;f<a[d].grid[e].length;f++){if(a[d].grid[e][f].imgDiv)var g=wax.util.offset(a[d].grid[e][f].imgDiv);else var g=wax.util.offset(a[d].grid[e][f].frame);if(g&&g.top<b.y&&g.top+256>b.y&&g.left<b.x&&g.left+256>b.x){c.push(a[d].grid[e][f]);continue layerfound}}return c},viableLayers:function(){if(this._viableLayers)return this._viableLayers;this._viableLayers=[];for(var a in this.map.layers)this.map.layers[a].visibility===!0&&this.map.layers[a].CLASS_NAME==="OpenLayers.Layer.TMS"&&this._viableLayers.push(this.map.layers[a]);return this._viableLayers},resetLayers:function(a){this._viableLayers=null;var b=a.relatedTarget||a.toElement;b&&b.className!=="olTileImage"&&this.callbacks.out(this.map.viewPortDiv)},getInfoForClick:function(a){if(!!a){var b=this.viableLayers(),c=wax.util.eventoffset(a),d=this.getTileStack(this.viableLayers(),c),e=null,f=null,g=this;for(var h=0;h<d.length;h++){if(!d[h].url)continue;this.gm.getGrid(d[h].url,function(a,b){if(!!b){var e=b.getFeature(c.x,c.y,d[h].frame,{format:g.clickAction});if(e)switch(g.clickAction){case"full":g.callbacks.click(e,d[h].layer.map.viewPortDiv,h);break;case"location":window.location=e}}})}}},getInfoForHover:function(a){if(!!a){var b={format:"teaser"},c=this.viableLayers(),d=wax.util.eventoffset(a),e=this.getTileStack(this.viableLayers(),d),f=null,g=null,h=this;for(var i=0;i<e.length;i++){if(!e[i].url)continue;this.gm.getGrid(e[i].url,function(c,f){if(f&&e[i]){var g=f.getFeature(d.x,d.y,e[i].frame,b);if(g){if(!e[i])return;g&&h.feature[i]!==g?(h.feature[i]=g,h.callbacks.out(e[i].layer.map.div),h.callbacks.over(g,e[i].layer.map.div,i,a)):g||(h.feature[i]=null,h.callbacks.out(e[i].layer.map.div))}else h.feature[i]&&h.callbacks.out(e[i].layer.map.div),h.feature[i]=null}})}}},CLASS_NAME:"wax.ol.Interaction"});var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Legend=OpenLayers.Class(OpenLayers.Control,{CLASS_NAME:"wax.ol.Legend",legend:null,options:null,initialize:function(a){this.options=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},activate:function(){this.legend=new wax.Legend(this.map.viewPortDiv,this.options.container);return OpenLayers.Control.prototype.activate.apply(this,arguments)},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments),this.activate(),this.map.events.on({addlayer:this.setLegend,changelayer:this.setLegend,removelayer:this.setLegend,changebaselayer:this.setLegend,scope:this})},setLegend:function(){var a=[];for(var b=0;b<this.map.layers.length;b++){var c=this.map.layers[b];c&&c.getURL&&c.visibility&&a.push(c.getURL(new OpenLayers.Bounds))}this.legend.render(a)}});var wax=wax||{};wax.ol=wax.ol||{},wax.ol.Switcher=OpenLayers.Class(OpenLayers.Control,{CLASS_NAME:"wax.ol.Switcher",initialize:function(a){this.$element=$(a.e),this.options=a||{},OpenLayers.Control.prototype.initialize.apply(this,[a||{}])},setMap:function(a){OpenLayers.Control.prototype.setMap.apply(this,arguments),this.map.events.on({addlayer:this.redraw,changelayer:this.redraw,removelayer:this.redraw,changebaselayer:this.redraw,scope:this}),this.redraw()},layerClick:function(a){var b=a.currentTarget,c=$(b).data("layer");$("a.active",this.$element).removeClass("active"),$.each(this.map.getLayersBy("isBaseLayer",!1),function(){this.CLASS_NAME!=="OpenLayers.Layer.Vector.RootContainer"&&this.displayInLayerSwitcher&&this.setVisibility(!1)}),c.setVisibility(!0),$(b).addClass("active")},needsRedraw:function(){if(!this.layerStates||this.layerStates.length||this.map.layers.length!=this.layerStates.length)return!0;for(var a=0,b=this.layerStates.length;a<b;a++){var c=this.layerStates[a],d=this.map.layers[a];if(c.name!=d.name||c.inRange!=d.inRange||c.id!=d.id||c.visibility!=d.visibility)return!0}return!1},redraw:function(){if(this.needsRedraw()){this.$element.html("");var a=this.map.layers.length;this.layerStates=[];for(var b=0;b<a;b++){var c=this.map.layers[b];this.layerStates[b]={name:c.name,visibility:c.visibility,inRange:c.inRange,id:c.id}}var d=this.map.layers.slice();for(b=0,a=d.length;b<a;b++){var e=d[b];if(e.displayInLayerSwitcher){var f=e.isBaseLayer?e===this.map.baseLayer:e.getVisibility(),g=$.proxy(function(a){this.layerClick(a);return!1},this),h=$("<a></a>");h.click(g).attr("href","#").text(e.name).addClass("layer-toggle").data("layer",e).attr("disabled",!e.inRange),f&&h.addClass("active")}this.$element.append(h),this.$element.trigger("layeradded",h)}}}})
/*!
* 0.1.6 with IE readyState fix in https://github.com/ded/reqwest/issues/18
*
* Reqwest! A x-browser general purpose XHR connection manager

@@ -9,2 +7,2 @@ * copyright Dustin Diaz 2011

*/
!function(window){function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):!0)+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}function enc(a){return encodeURIComponent(a)}function reqwest(a,b){return new Reqwest(a,b)}function init(o,fn){function error(a){o.error&&o.error(a),complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText;switch(type){case"json":resp=eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function complete(a){o.complete&&o.complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function setType(a){if(/\.json$/.test(a))return"json";if(/\.jsonp$/.test(a))return"jsonp";if(/\.js$/.test(a))return"js";if(/\.html?$/.test(a))return"html";if(/\.xml$/.test(a))return"xml";return"js"}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function getRequest(a,b,c){if(a.type!="jsonp"){var f=xhr();f.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(f,a),f.onreadystatechange=readyState(f,b,c),a.before&&a.before(f),f.send(a.data||null);return f}var d=doc.createElement("script");window[getCallbackName(a)]=generalCallback,d.type="text/javascript",d.src=a.url,d.async=!0;var e=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(d)};d.onload=e,d.onreadystatechange=function(){d.readyState=="loaded"||d.readyState=="complete"&&e()},head.appendChild(d)}function generalCallback(a){lastValue=a}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function setHeaders(a,b){var c=b.headers||{};c.Accept="text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]="application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this)
!function(window){function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):"")+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}function enc(a){return encodeURIComponent(a)}function reqwest(a,b){return new Reqwest(a,b)}function init(o,fn){function error(a){o.error&&o.error(a),complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText,JSON;switch(type){case"json":resp=JSON?JSON.parse(r):eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function complete(a){o.complete&&o.complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function setType(a){if(/\.json$/.test(a))return"json";if(/\.jsonp$/.test(a))return"jsonp";if(/\.js$/.test(a))return"js";if(/\.html?$/.test(a))return"html";if(/\.xml$/.test(a))return"xml";return"js"}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function getRequest(a,b,c){if(a.type!="jsonp"){var f=xhr();f.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(f,a),f.onreadystatechange=readyState(f,b,c),a.before&&a.before(f),f.send(a.data||null);return f}var d=doc.createElement("script");window[getCallbackName(a)]=generalCallback,d.type="text/javascript",d.src=a.url,d.async=!0;var e=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(d)};d.onload=e,d.onreadystatechange=function(){/^loaded|complete$/.test(d.readyState)&&e()},head.appendChild(d)}function generalCallback(a){lastValue=a}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function setHeaders(a,b){var c=b.headers||{};c.Accept=c.Accept||"text/javascript, text/html, application/xml, text/xml, */*",c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest";if(b.data){c["Content-type"]=c["Content-type"]||"application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this)
{
"name": "wax",
"version": "2.1.4",
"version": "3.0.0",
"description": "Tools for improving web maps.",

@@ -19,6 +19,7 @@ "author": {

"devDependencies": {
"jshint": "0.2.x",
"jshint": "0.2.3",
"uglify-js": "1.0.x",
"docco": "0.3.x"
"docco": "0.3.x",
"banner": "0.0.x"
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc