Add the Long Hikes static site (longhikes.org)
Validate / validate (push) Canceled after 0s

web/ is a static site generator for the dataset, in Python's standard
library only. `python3 web/build.py --out _site` writes a page for each
of the 138 records, a finder on the home page with a map of the 85
lines, region and route indexes, and the repository's documents as
pages. Each line is offered as the record's GeoJSON and as a GPX
simplified to 5 m, with two archives of everything.

The site's name and address are set in web/site.toml: Long Hikes, at
https://longhikes.org. The dataset keeps its own name.

netlify.toml and web/static/_headers configure the Netlify site
(content types, download dispositions, caching, a content security
policy with no inline script). It is deployed with the Netlify CLI
from a local build, because Netlify cannot build from this forge.

MapLibre GL JS and the two typefaces are vendored under web/assets/;
map tiles come from OpenFreeMap. Tests: python3 -m unittest discover
-s web/tests (164).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-13 12:20:32 -07:00
1 parent c42cfbbe73
commit abfbeb00bd
77 files changed
+9287

No files matched your search

+796
View File
@@ -0,0 +1,796 @@
/* Site script, served at /assets/app.js (deferred). Vanilla JS, no build step.
1. Preferences: theme and length order (saved in localStorage; applied early by prefs.js)
2. Maps: .mapfig[data-map] figures. Data is fetched from data-src (same origin);
lines are drawn on a plain graticule first, then on an OpenFreeMap base map
when MapLibre and WebGL are available.
3. Trail finder (home page): search, filters, sort, URL query state, map/list highlight
4. Copy-credit buttons
Every page works without this script: the list holds every record and each map
frame keeps its size, border and caption. */
(function () {
'use strict';
var root = document.documentElement;
var darkQuery = window.matchMedia('(prefers-color-scheme: dark)');
var KM_PER_MI = 1.609344;
var fmt = new Intl.NumberFormat('en-US');
/* 1. Preferences ----------------------------------------------------------- */
function readPref(key) {
try { return localStorage.getItem(key); } catch (e) { return null; }
}
function writePref(key, value) {
try {
if (value) localStorage.setItem(key, value);
else localStorage.removeItem(key);
} catch (e) { /* storage blocked: the choice lasts for this page only */ }
}
function isDark() {
var t = root.dataset.theme;
return t ? t === 'dark' : darkQuery.matches;
}
function milesFirst() { return root.dataset.units === 'mi'; }
function setTheme(value) {
if (value === 'light' || value === 'dark') root.dataset.theme = value;
else delete root.dataset.theme;
writePref('lh-theme', value === 'light' || value === 'dark' ? value : null);
document.dispatchEvent(new Event('olt:theme'));
}
function setUnits(value) {
if (value === 'mi') root.dataset.units = 'mi';
else delete root.dataset.units;
writePref('lh-units', value === 'mi' ? 'mi' : null);
syncRadios('input[name="units"], input[name="units-list"]', value === 'mi' ? 'mi' : 'km');
document.dispatchEvent(new Event('olt:units'));
}
function syncRadios(selector, value) {
document.querySelectorAll(selector).forEach(function (input) { input.checked = input.value === value; });
}
syncRadios('input[name="theme"]', readPref('lh-theme') || 'auto');
syncRadios('input[name="units"], input[name="units-list"]', milesFirst() ? 'mi' : 'km');
document.querySelectorAll('input[name="theme"]').forEach(function (input) {
input.addEventListener('change', function () { if (input.checked) setTheme(input.value); });
});
document.querySelectorAll('input[name="units"], input[name="units-list"]').forEach(function (input) {
input.addEventListener('change', function () { if (input.checked) setUnits(input.value); });
});
darkQuery.addEventListener('change', function () {
if (!root.dataset.theme) document.dispatchEvent(new Event('olt:theme'));
});
/* A length in both units, in the reader's order: "1,287 km (800 mi)". */
function lengthText(km) {
var k = fmt.format(km) + ' km';
var m = fmt.format(Math.round(km / KM_PER_MI)) + ' mi';
return milesFirst() ? m + ' (' + k + ')' : k + ' (' + m + ')';
}
/* Resolve a colour token (light-dark() included) to an rgb() string. */
var probe = null;
function token(name) {
if (!probe) {
probe = document.createElement('span');
probe.hidden = true;
document.body.appendChild(probe);
}
probe.style.color = 'var(' + name + ')';
return getComputedStyle(probe).color;
}
/* 2. Maps ------------------------------------------------------------------- */
var STYLE_URL = 'https://tiles.openfreemap.org/styles/positron';
function linesOf(feature) {
var g = feature.geometry || {};
if (g.type === 'LineString') return [g.coordinates];
return g.type === 'MultiLineString' ? g.coordinates : [];
}
function bboxOf(fc) {
if (fc.bbox && fc.bbox.length === 4) return fc.bbox;
var b = [180, 90, -180, -90];
fc.features.forEach(function (f) {
linesOf(f).forEach(function (line) {
line.forEach(function (p) {
if (p[0] < b[0]) b[0] = p[0];
if (p[1] < b[1]) b[1] = p[1];
if (p[0] > b[2]) b[2] = p[0];
if (p[1] > b[3]) b[3] = p[1];
});
});
});
return b;
}
function bboxOfFeature(feature) {
var b = [180, 90, -180, -90];
var seen = false;
linesOf(feature).forEach(function (line) {
line.forEach(function (p) {
seen = true;
if (p[0] < b[0]) b[0] = p[0];
if (p[1] < b[1]) b[1] = p[1];
if (p[0] > b[2]) b[2] = p[0];
if (p[1] > b[3]) b[3] = p[1];
});
});
return seen ? b : null;
}
function mercY(lat) { return Math.log(Math.tan(Math.PI / 4 + (lat * Math.PI) / 360)); }
function invMercY(y) { return (360 / Math.PI) * Math.atan(Math.exp(y)) - 90; }
function dms(value, pos, neg) {
var a = Math.abs(value);
var d = Math.floor(a);
var m = Math.round((a - d) * 60);
if (m === 60) { d += 1; m = 0; }
return d + '°' + (m < 10 ? '0' : '') + m + '′' + (value >= 0 ? pos : neg);
}
/* Lines on a plain graticule (Web Mercator), no tiles. Returns the drawn extent. */
function drawFallback(host, fc, bbox, routeMain) {
var rect = host.getBoundingClientRect();
var W = Math.max(Math.round(rect.width), 280);
var H = Math.max(Math.round(rect.height), 180);
var pad = 28;
var rad = Math.PI / 180;
var cx = (bbox[0] + bbox[2]) / 2;
var y0 = mercY(bbox[1]);
var y1 = mercY(bbox[3]);
var cy = (y0 + y1) / 2;
var k = Math.min((W - 2 * pad) / Math.max((bbox[2] - bbox[0]) * rad, 1e-6),
(H - 2 * pad) / Math.max(y1 - y0, 1e-6));
function x(lon) { return W / 2 + (lon - cx) * rad * k; }
function y(lat) { return H / 2 - (mercY(lat) - cy) * k; }
var ext = { w: cx - W / 2 / k / rad, e: cx + W / 2 / k / rad, n: invMercY(cy + H / 2 / k), s: invMercY(cy - H / 2 / k) };
var span = Math.max(ext.e - ext.w, ext.n - ext.s);
var step = [0.25, 0.5, 1, 2, 5, 10, 15].filter(function (s) { return span / s <= 9; })[0] || 20;
var grat = '';
for (var lon = Math.ceil(ext.w / step) * step; lon <= ext.e; lon += step) grat += 'M' + x(lon).toFixed(1) + ' 0V' + H;
for (var lat = Math.ceil(ext.s / step) * step; lat <= ext.n; lat += step) grat += 'M0 ' + y(lat).toFixed(1) + 'H' + W;
var ns = 'http://www.w3.org/2000/svg';
var svg = document.createElementNS(ns, 'svg');
svg.setAttribute('viewBox', '0 0 ' + W + ' ' + H);
svg.setAttribute('preserveAspectRatio', 'xMidYMid slice');
svg.setAttribute('aria-hidden', 'true');
svg.setAttribute('focusable', 'false');
function path(cls, d, id) {
var p = document.createElementNS(ns, 'path');
p.setAttribute('class', cls);
p.setAttribute('d', d);
if (id) p.setAttribute('data-id', id);
svg.appendChild(p);
}
path('fallback__grat', grat);
var drawn = fc.features.map(function (f) {
var d = linesOf(f).map(function (line) {
return 'M' + line.map(function (p) { return x(p[0]).toFixed(1) + ' ' + y(p[1]).toFixed(1); }).join('L');
}).join('');
var p = f.properties || {};
var mod = p.role === 'alternate' ? ' fallback__line--alternate'
: (p.kind === 'route' || (routeMain && p.role === 'main')) ? ' fallback__line--route' : '';
return { d: d, mod: mod, id: p.id || '' };
});
drawn.forEach(function (l) { path('fallback__casing', l.d, l.id); });
drawn.forEach(function (l) { path('fallback__line' + l.mod, l.d, l.id); });
host.replaceChildren(svg);
return ext;
}
function webglAvailable() {
try {
var c = document.createElement('canvas');
return !!(c.getContext('webgl2') || c.getContext('webgl'));
} catch (e) { return false; }
}
/* Night version of the Positron base map: invert lightness, keep hue. */
var COLOR_PROPS = ['background-color', 'fill-color', 'fill-outline-color', 'line-color', 'text-color', 'text-halo-color'];
var ctx2d = null;
function parseColor(str) {
if (typeof str !== 'string' || !/^(#|rgb|hsl)/i.test(str.trim())) return null;
if (!ctx2d) ctx2d = document.createElement('canvas').getContext('2d');
ctx2d.fillStyle = '#000';
ctx2d.fillStyle = str;
var v = ctx2d.fillStyle;
var m;
if (v.charAt(0) === '#') return [parseInt(v.slice(1, 3), 16), parseInt(v.slice(3, 5), 16), parseInt(v.slice(5, 7), 16), 1];
if ((m = v.match(/rgba?\(([^)]+)\)/))) {
var parts = m[1].split(',').map(Number);
return [parts[0], parts[1], parts[2], parts.length > 3 ? parts[3] : 1];
}
return null;
}
function toHsl(r, g, b) {
r /= 255; g /= 255; b /= 255;
var max = Math.max(r, g, b), min = Math.min(r, g, b), l = (max + min) / 2, h = 0, s = 0;
if (max !== min) {
var d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
h = max === r ? (g - b) / d + (g < b ? 6 : 0) : max === g ? (b - r) / d + 2 : (r - g) / d + 4;
h *= 60;
}
return [h, s, l];
}
function nightColor(value, prop, layerId) {
if (Array.isArray(value)) return value.map(function (v) { return nightColor(v, prop, layerId); });
if (value && typeof value === 'object') {
var out = {};
Object.keys(value).forEach(function (k) { out[k] = nightColor(value[k], prop, layerId); });
return out;
}
var c = parseColor(value);
if (!c) return value;
if (layerId === 'water') return 'hsla(205, 22%, 6%, ' + c[3] + ')';
var hsl = toHsl(c[0], c[1], c[2]);
var l = prop === 'text-color' ? 0.92 - hsl[2] * 0.55 : 0.07 + (1 - hsl[2]) * 0.55;
return 'hsla(' + hsl[0].toFixed(0) + ', ' + (hsl[1] * 80).toFixed(0) + '%, ' + (l * 100).toFixed(1) + '%, ' + c[3] + ')';
}
function tintBasemap(map, originals) {
var dark = isDark();
map.getStyle().layers.forEach(function (layer) {
if (layer.id.indexOf('olt-') === 0) return;
COLOR_PROPS.forEach(function (prop) {
var key = layer.id + '|' + prop;
if (!(key in originals)) {
try { originals[key] = map.getPaintProperty(layer.id, prop); } catch (e) { originals[key] = undefined; }
}
var orig = originals[key];
if (orig === undefined) return;
try { map.setPaintProperty(layer.id, prop, dark ? nightColor(orig, prop, layer.id) : orig); } catch (e) { /* no such property */ }
});
});
}
function layerDefs(kind, routeMain) {
if (kind === 'overview') {
return [
{ id: 'olt-casing', color: '--casing', width: [3, 4, 9, 9] },
{ id: 'olt-hi', color: '--ink', width: [3, 7, 9, 11], filter: ['==', ['get', 'id'], ''] },
{ id: 'olt-line', color: '--trail', width: [3, 1.6, 9, 4], filter: ['!=', ['get', 'kind'], 'route'], hit: true },
{ id: 'olt-route', color: '--route', width: [3, 1.6, 9, 4], dash: [1.6, 1.1], filter: ['==', ['get', 'kind'], 'route'], hit: true }
];
}
return [
{ id: 'olt-casing', color: '--casing', width: [5, 4, 12, 8] },
{ id: 'olt-alt', color: '--trail', width: [5, 1.5, 12, 3], dash: [2, 1.6], filter: ['==', ['get', 'role'], 'alternate'] },
{ id: 'olt-main', color: routeMain ? '--route' : '--trail', width: [5, 2.5, 12, 5],
dash: routeMain ? [2, 1.2] : null, filter: ['==', ['get', 'role'], 'main'] }
];
}
/* Trail lines go under the base map's labels, as on a printed map. */
function addLineLayers(map, fc, defs) {
var firstLabel = map.getStyle().layers.filter(function (l) { return l.type === 'symbol'; })[0];
map.addSource('olt', { type: 'geojson', data: fc });
defs.forEach(function (def) {
var layer = {
id: def.id,
type: 'line',
source: 'olt',
layout: { 'line-join': 'round', 'line-cap': def.dash ? 'butt' : 'round' },
paint: {
'line-color': token(def.color),
'line-width': ['interpolate', ['linear'], ['zoom'], def.width[0], def.width[1], def.width[2], def.width[3]]
}
};
if (def.dash) layer.paint['line-dasharray'] = def.dash;
if (def.filter) layer.filter = def.filter;
map.addLayer(layer, firstLabel && firstLabel.id);
});
}
var maps = [];
var mapStarters = [];
function initMap(fig) {
var host = fig.querySelector('.map');
var fallback = host.querySelector('.map__fallback');
var status = host.querySelector('.map__status');
var nw = fig.querySelector('.mapfig__corner--nw');
var se = fig.querySelector('.mapfig__corner--se');
var kind = fig.dataset.map;
var routeMain = fig.dataset.route === 'yes';
var defs = layerDefs(kind, routeMain);
var onlyIds = (fig.dataset.ids || '').trim().split(/\s+/).filter(Boolean);
var entry = { kind: kind, map: null, fc: null, defs: defs, fallback: fallback,
visibleIds: onlyIds.length ? onlyIds : null, ready: false,
mapStarted: false, fullBounds: null, boundsById: null };
maps.push(entry);
var bbox = (fig.dataset.bbox || '').split(',').map(Number);
if (bbox.length !== 4 || bbox.some(isNaN)) bbox = null;
function corners(ext) {
if (nw) nw.textContent = dms(ext.n, 'N', 'S') + ' ' + dms(ext.w, 'E', 'W');
if (se) se.textContent = dms(ext.s, 'N', 'S') + ' ' + dms(ext.e, 'E', 'W');
}
function redrawFallback() {
if (!entry.ready && entry.fc) {
corners(drawFallback(fallback, entry.fc, bbox || bboxOf(entry.fc), routeMain));
if (entry.visibleIds) setVisible(entry, entry.visibleIds);
}
}
function fail(reason) {
if (entry.ready) return;
host.dataset.state = 'fallback';
status.textContent = 'Base map unavailable (' + reason + '). The line is drawn on a plain graticule.';
}
status.textContent = 'Loading the line…';
var dataReady = fetch(fig.dataset.src, { credentials: 'same-origin' })
.then(function (r) {
if (!r.ok) throw new Error(r.status);
return r.json();
})
.then(function (fc) {
entry.fc = fc;
bbox = bbox || bboxOf(fc);
entry.fullBounds = bbox.slice();
if (kind === 'overview') {
entry.boundsById = {};
fc.features.forEach(function (f) {
var id = (f.properties || {}).id;
var fb = id && bboxOfFeature(f);
if (fb) entry.boundsById[id] = fb;
});
}
if (!entry.ready && entry.mapStarted && window.maplibregl) status.textContent = 'Loading the base map…';
redrawFallback();
return fc;
})
.catch(function () {
host.dataset.state = 'error';
status.textContent = 'The line data did not load. Downloads on this page are unaffected.';
return null;
});
var resizeTimer;
window.addEventListener('resize', function () {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(redrawFallback, 150);
});
/* The MapLibre half of the map. Everything above (the fetch and the
fallback drawing) runs as soon as this script does; this part waits
until MapLibre is present (see startMaps below), because the page loads
this script before the MapLibre script. If it never arrives the
fallback drawing stays and fail() says why. */
function startMapLibre() {
if (!window.maplibregl) { dataReady.then(function (fc) { if (fc) fail('the map library did not load'); }); return; }
if (!webglAvailable()) { dataReady.then(function (fc) { if (fc) fail('WebGL is off in this browser'); }); return; }
if (!entry.ready && entry.fc) status.textContent = 'Loading the base map…';
var options = {
container: host.querySelector('.map__canvas'),
style: STYLE_URL,
attributionControl: { compact: true },
cooperativeGestures: true,
dragRotate: false,
pitchWithRotate: false,
touchPitch: false
};
if (bbox) {
options.bounds = [[bbox[0], bbox[1]], [bbox[2], bbox[3]]];
options.fitBoundsOptions = { padding: 32 };
}
var map = new maplibregl.Map(options);
entry.map = map;
map.touchZoomRotate.disableRotation();
map.addControl(new maplibregl.NavigationControl({ showCompass: false }), 'top-right');
var scale = new maplibregl.ScaleControl({ unit: milesFirst() ? 'imperial' : 'metric', maxWidth: 110 });
map.addControl(scale, 'bottom-left');
document.addEventListener('olt:units', function () {
scale.setUnit(milesFirst() ? 'imperial' : 'metric');
});
/* A narrow frame has no room for the open attribution beside the scale
bar; keep it behind its button there, resizing included. */
function collapseAttribution() {
if (host.clientWidth >= 560) return;
host.querySelectorAll('.maplibregl-ctrl-attrib').forEach(function (el) {
el.classList.remove('maplibregl-compact-show');
el.removeAttribute('open');
});
}
map.on('resize', collapseAttribution);
var originals = {};
var timer = setTimeout(function () { fail('tiles did not load'); }, 15000);
map.on('error', function () { if (!map.isStyleLoaded()) fail('the map style did not load'); });
var styleReady = new Promise(function (resolve) { map.on('load', resolve); });
Promise.all([dataReady, styleReady]).then(function (results) {
var fc = results[0];
if (!fc) return;
clearTimeout(timer);
tintBasemap(map, originals);
addLineLayers(map, fc, defs);
if (!bbox) {
bbox = bboxOf(fc);
entry.fullBounds = bbox.slice();
map.fitBounds([[bbox[0], bbox[1]], [bbox[2], bbox[3]]], { padding: 32, animate: false });
}
entry.ready = true;
host.dataset.state = 'ready';
status.textContent = '';
collapseAttribution();
if (entry.visibleIds) setVisible(entry, entry.visibleIds);
if (kind === 'overview') wireOverview(map, defs);
mapCorners();
});
function mapCorners() {
var b = map.getBounds();
corners({ w: b.getWest(), e: b.getEast(), n: b.getNorth(), s: b.getSouth() });
}
map.on('moveend', function () { if (entry.ready) mapCorners(); });
document.addEventListener('olt:theme', function () {
if (!entry.ready) return;
tintBasemap(map, originals);
defs.forEach(function (def) { map.setPaintProperty(def.id, 'line-color', token(def.color)); });
});
}
mapStarters.push(function () {
if (entry.mapStarted) return;
entry.mapStarted = true;
startMapLibre();
});
}
function startMaps() {
mapStarters.forEach(function (start) { start(); });
}
function entryFor(id) {
return document.querySelector('.entry[data-id="' + (window.CSS && CSS.escape ? CSS.escape(id) : id) + '"]');
}
function highlight(id) {
maps.forEach(function (m) {
if (m.map && m.ready && m.map.getLayer('olt-hi')) m.map.setFilter('olt-hi', ['==', ['get', 'id'], id || '']);
});
document.querySelectorAll('.entry.is-highlit').forEach(function (li) { li.classList.remove('is-highlit'); });
if (id) {
var li = entryFor(id);
if (li) li.classList.add('is-highlit');
}
}
function wireOverview(map, defs) {
var popup = new maplibregl.Popup({ closeButton: true, maxWidth: '18rem' });
defs.filter(function (d) { return d.hit; }).forEach(function (def) {
map.on('mousemove', def.id, function (e) {
map.getCanvas().style.cursor = 'pointer';
highlight(e.features[0].properties.id);
});
map.on('mouseleave', def.id, function () {
map.getCanvas().style.cursor = '';
highlight('');
});
map.on('click', def.id, function (e) {
var p = e.features[0].properties;
var box = document.createElement('div');
var a = document.createElement('a');
a.href = '/trails/' + encodeURIComponent(p.id) + '/';
a.textContent = p.name;
var meta = document.createElement('p');
meta.textContent = lengthText(Number(p.length_km)) + (p.kind === 'route' ? ' · person-defined route' : '');
box.appendChild(a);
box.appendChild(meta);
popup.setLngLat(e.lngLat).setDOMContent(box).addTo(map);
});
});
}
/* Fit the overview map to the lines still shown; when every line is shown
again that is the full extent the map opened at. */
function fitToVisible(entry, ids) {
var map = entry.map;
if (!map || !entry.ready || entry.kind !== 'overview' || !entry.boundsById) return;
var union = null;
var shown = 0;
var total = Object.keys(entry.boundsById).length;
ids.forEach(function (id) {
var b = entry.boundsById[id];
if (!b) return;
shown += 1;
union = union
? [Math.min(union[0], b[0]), Math.min(union[1], b[1]), Math.max(union[2], b[2]), Math.max(union[3], b[3])]
: b.slice();
});
if (!union) return;
var target = shown >= total && entry.fullBounds ? entry.fullBounds : union;
var reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
map.fitBounds([[target[0], target[1]], [target[2], target[3]]],
{ padding: 32, maxZoom: 11, animate: !reduceMotion });
}
function setVisible(entry, ids) {
entry.visibleIds = ids;
var set = {};
ids.forEach(function (id) { set[id] = true; });
entry.fallback.querySelectorAll('[data-id]').forEach(function (path) {
path.style.display = set[path.getAttribute('data-id')] ? '' : 'none';
});
var map = entry.map;
if (!map || !entry.ready) return;
var inSet = ['in', ['get', 'id'], ['literal', ids]];
entry.defs.forEach(function (def) {
if (def.id === 'olt-hi') return;
map.setFilter(def.id, def.filter ? ['all', def.filter, inSet] : inSet);
});
fitToVisible(entry, ids);
}
/* Fetch the line data and draw the fallback at once; start MapLibre now if
it is already here, and otherwise when the page has loaded (the deferred
MapLibre script follows this one). The finder and the other controls
below never wait for it. */
document.querySelectorAll('.mapfig[data-map]').forEach(initMap);
if (window.maplibregl || document.readyState === 'complete') startMaps();
else window.addEventListener('load', startMaps);
/* 3. Trail finder (home page) ------------------------------------------------ */
function initFinder(form) {
var list = document.getElementById('entries');
var items = Array.prototype.slice.call(list.querySelectorAll('.entry'));
var count = document.getElementById('results-count');
var empty = document.getElementById('empty-state');
var active = form.querySelector('.filters__active');
var lenHint = document.getElementById('len-hint');
var listHead = document.querySelector('.list-head');
var el = form.elements;
var sort = document.getElementById('sort');
var more = form.querySelector('.filters__more');
var total = items.length;
/* The count is the one live region. Keep it quiet through the first
application below so nothing is announced on load, and write to it
only when its text changes. The length hint is a description of the
length fields, not a live region of its own. */
if (count) count.setAttribute('aria-live', 'off');
if (lenHint) {
lenHint.removeAttribute('aria-live');
lenHint.removeAttribute('role');
[el.min, el.max].forEach(function (field) {
if (!field) return;
var described = (field.getAttribute('aria-describedby') || '').split(/\s+/).filter(Boolean);
if (described.indexOf('len-hint') === -1) described.push('len-hint');
field.setAttribute('aria-describedby', described.join(' '));
});
}
function setText(node, text) {
if (node && node.textContent !== text) node.textContent = text;
}
function hasOption(select, value) {
return Array.prototype.some.call(select.options, function (o) { return o.value === value; });
}
function read() {
var min = Number(el.min.value) || 0;
var max = Number(el.max.value) || Infinity;
var swapped = min > max;
if (swapped) { var keep = min; min = max; max = keep; }
return {
q: el.q.value.trim(),
words: el.q.value.trim().toLowerCase().split(/\s+/).filter(Boolean),
country: el.country.value,
region: el.region.value,
min: min,
max: max,
swapped: swapped,
designated: el.designated.checked,
route: el.route.checked,
line: el.line.checked,
policy: el.policy.value,
tier: el.tier.value
};
}
function matches(li, s) {
var d = li.dataset;
if (s.words.some(function (w) { return d.search.indexOf(w) === -1; })) return false;
if (s.country !== 'all') {
var countries = (d.countries || d.country || '').split(/\s+/).filter(Boolean);
if (countries.indexOf(s.country) === -1) return false;
}
if (s.region) {
var regions = d.regions.split(' ');
if (regions.indexOf(s.region) === -1 && regions.indexOf(s.region.slice(0, 2) + '-*') === -1) return false;
}
var km = Number(d.km);
if (km < s.min || km > s.max) return false;
if (d.kind === 'route' ? !s.route : !s.designated) return false;
if (s.line && d.line !== 'yes') return false;
if (s.policy && d.policy !== s.policy) return false;
if (s.tier && d.tier !== s.tier) return false;
return true;
}
function lengthLabel(km) {
var k = fmt.format(km) + ' km';
var m = fmt.format(Math.round(km / KM_PER_MI)) + ' mi';
return milesFirst() ? m + ' · ' + k : k + ' · ' + m;
}
function describeLength(s) {
var text;
if (!s.min && s.max === Infinity) text = 'Any length.';
else if (!s.min) text = 'Up to ' + lengthText(s.max) + '.';
else if (s.max === Infinity) text = 'From ' + lengthText(s.min) + ' up.';
else text = 'From ' + lengthText(s.min) + ' to ' + lengthText(s.max) + '.';
if (s.swapped) text += ' Shortest and longest were swapped.';
return text;
}
function relabelLengths() {
form.querySelectorAll('select[data-length-options] option').forEach(function (o) {
if (o.value) o.textContent = lengthLabel(Number(o.value));
});
setText(lenHint, describeLength(read()));
}
/* URL query <-> form. Only values that differ from the defaults are written. */
function toQuery(s) {
var p = new URLSearchParams();
if (s.q) p.set('q', s.q);
if (s.country !== 'all') p.set('country', s.country);
if (s.region) p.set('region', s.region);
if (s.min) p.set('min', String(s.min));
if (s.max !== Infinity) p.set('max', String(s.max));
if (s.designated !== s.route) p.set('kind', s.designated ? 'designated' : 'route');
else if (!s.designated) p.set('kind', 'none');
if (s.line) p.set('line', '1');
if (s.policy) p.set('policy', s.policy);
if (s.tier) p.set('tier', s.tier);
if (sort.value !== 'name') p.set('sort', sort.value);
return p.toString();
}
function fromQuery() {
var p = new URLSearchParams(window.location.search);
el.q.value = p.get('q') || '';
var country = p.get('country');
syncRadios('#finder-form input[name="country"]', country === 'US' || country === 'CA' ? country : 'all');
['region', 'min', 'max', 'policy', 'tier'].forEach(function (name) {
var v = p.get(name) || '';
el[name].value = hasOption(el[name], v) ? v : '';
});
var kind = p.get('kind');
el.designated.checked = kind !== 'route' && kind !== 'none';
el.route.checked = kind !== 'designated' && kind !== 'none';
el.line.checked = p.get('line') === '1';
var s = p.get('sort') || 'name';
sort.value = hasOption(sort, s) ? s : 'name';
limitRegions();
}
function limitRegions() {
var c = el.country.value;
el.region.querySelectorAll('optgroup').forEach(function (g) { g.disabled = c !== 'all' && g.dataset.country !== c; });
if (el.region.value && c !== 'all' && el.region.value.slice(0, 2) !== c) el.region.value = '';
}
function applySort() {
var key = sort.value;
items.slice().sort(function (a, b) {
if (key === 'long') return Number(b.dataset.km) - Number(a.dataset.km);
if (key === 'short') return Number(a.dataset.km) - Number(b.dataset.km);
return a.dataset.name.localeCompare(b.dataset.name);
}).forEach(function (li) { list.appendChild(li); });
}
function apply(updateUrl) {
var s = read();
var shown = [];
items.forEach(function (li) {
var ok = matches(li, s);
li.hidden = !ok;
if (ok) shown.push(li.dataset.id);
});
if (count && count.textContent !== shown.length + ' of ' + total + ' records') {
count.innerHTML = '';
var strong = document.createElement('strong');
strong.textContent = String(shown.length);
count.appendChild(strong);
count.appendChild(document.createTextNode(' of ' + total + ' records'));
}
empty.hidden = shown.length > 0;
if (listHead) listHead.hidden = shown.length === 0;
setText(lenHint, describeLength(s));
var n = (s.words.length ? 1 : 0) + (s.country !== 'all' ? 1 : 0) + (s.region ? 1 : 0) +
(s.min ? 1 : 0) + (s.max !== Infinity ? 1 : 0) + (!s.designated ? 1 : 0) + (!s.route ? 1 : 0) +
(s.line ? 1 : 0) + (s.policy ? 1 : 0) + (s.tier ? 1 : 0);
active.textContent = n ? n + ' active' : '';
maps.forEach(function (m) { if (m.kind === 'overview') setVisible(m, shown); });
if (updateUrl) {
var q = toQuery(s);
window.history.replaceState(null, '', (q ? '?' + q : window.location.pathname) + window.location.hash);
}
}
form.querySelectorAll('input[name="country"]').forEach(function (r) { r.addEventListener('change', limitRegions); });
form.addEventListener('input', function () { apply(true); });
form.addEventListener('change', function () { apply(true); });
form.addEventListener('submit', function (e) { e.preventDefault(); });
form.addEventListener('reset', function () {
setTimeout(function () {
el.region.querySelectorAll('optgroup').forEach(function (g) { g.disabled = false; });
apply(true);
}, 0);
});
document.querySelectorAll('[data-reset]').forEach(function (b) {
b.addEventListener('click', function () { form.reset(); el.q.focus(); });
});
sort.addEventListener('change', function () { applySort(); apply(true); });
document.addEventListener('olt:units', relabelLengths);
items.forEach(function (li) {
li.addEventListener('mouseenter', function () { highlight(li.dataset.id); });
li.addEventListener('mouseleave', function () { highlight(''); });
li.addEventListener('focusin', function () { highlight(li.dataset.id); });
li.addEventListener('focusout', function () { highlight(''); });
});
fromQuery();
relabelLengths();
applySort();
apply(false);
/* The count can announce from here on; the first application is done. */
setTimeout(function () { if (count) count.removeAttribute('aria-live'); }, 0);
/* The folded filters arrive closed; open them only where the filters
have their own column (the finder's wide layout), and leave them
closed on narrow screens. */
if (more && window.matchMedia('(min-width: 70rem)').matches) more.open = true;
window.addEventListener('popstate', function () { fromQuery(); applySort(); apply(false); });
}
var finder = document.getElementById('finder-form');
if (finder) initFinder(finder);
/* 4. Copy a required credit ------------------------------------------------ */
document.querySelectorAll('[data-copy]').forEach(function (button) {
var target = document.querySelector(button.dataset.copy);
var done = document.querySelector(button.dataset.copyStatus);
if (!target) return;
button.hidden = false;
button.addEventListener('click', function () {
var text = target.textContent.trim();
function ok() { if (done) done.textContent = 'Copied: ' + text; }
function manual() {
var range = document.createRange();
range.selectNodeContents(target);
var sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
if (done) done.textContent = 'Selected. Press Ctrl+C or ⌘C to copy.';
}
if (navigator.clipboard && navigator.clipboard.writeText) navigator.clipboard.writeText(text).then(ok, manual);
else manual();
});
});
})();
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 520" preserveAspectRatio="xMidYMid slice" fill="none" stroke="#9b7650" stroke-opacity=".42" stroke-linejoin="round"><path stroke-width="1" d="M0 298Q31 293 42 289Q54 284 63 278Q72 272 90 258Q108 243 114 239Q120 235 129 232Q138 228 183 216Q228 205 273 197Q318 189 330 184Q342 180 348 175Q354 170 361 163Q367 155 385 126Q402 96 408 93Q414 89 426 87Q438 85 447 82Q456 79 468 72Q480 65 492 52Q504 40 517 20L529 0"/><path stroke-width="1" d="M975 520Q981 496 992 470Q1002 444 1005 434Q1008 424 1008 415Q1009 406 1008 403Q1008 400 1005 395Q1002 390 996 388Q990 385 984 385Q978 385 945 397Q912 409 903 411Q894 413 885 413Q876 413 870 412Q864 410 858 407Q852 404 840 390Q828 377 822 372Q816 368 810 365Q804 363 798 363Q792 362 784 363Q777 365 770 368Q763 371 759 374Q754 377 749 382Q744 388 738 398Q732 408 713 449Q694 490 683 505L673 520"/><path stroke-width="1" d="M1416 0Q1423 18 1428 39Q1432 60 1436 69L1440 79"/><path stroke-width="1" d="M0 328Q30 326 43 321Q57 317 67 310Q78 304 102 284Q126 265 135 259Q144 253 156 247Q168 240 180 236Q192 231 207 227Q222 223 237 222Q252 220 264 220Q276 220 294 223Q312 226 318 226Q324 226 333 225Q342 223 348 220Q354 217 364 210Q373 203 400 176Q427 149 454 128Q480 107 489 99Q498 90 510 74Q522 57 537 28L553 0"/><path stroke-width="1" d="M1104 520Q1099 502 1096 495Q1092 488 1086 481Q1080 475 1070 467Q1060 460 1055 454Q1051 448 1049 442Q1047 436 1043 409Q1038 383 1035 376Q1032 369 1027 364Q1021 359 1015 356Q1008 354 999 354Q990 354 981 356Q972 358 951 366Q930 374 921 377Q912 379 903 380Q894 380 888 378Q883 377 878 374Q874 371 863 358Q852 345 846 340Q840 335 831 331Q822 328 804 324Q786 320 780 317Q774 313 770 306Q766 299 763 281Q759 263 756 254Q753 245 750 239Q746 233 742 229Q738 226 732 222Q726 219 720 217Q714 215 681 210Q648 204 640 201Q632 197 619 189Q606 180 597 178Q588 176 582 177Q576 179 570 184Q564 190 561 196Q557 203 557 212Q556 221 560 229Q564 236 576 247Q587 257 591 263Q595 269 598 278Q601 287 606 308Q610 329 614 338Q617 347 621 351Q624 356 630 361Q636 365 642 367Q648 369 663 372Q678 375 684 377Q690 380 693 383Q696 385 698 390Q700 394 700 400Q700 406 699 415Q697 424 689 445Q681 466 672 481Q663 496 650 508L637 520"/><path stroke-width="1" d="M1348 0Q1380 6 1385 9Q1391 12 1394 15Q1397 18 1402 27Q1407 36 1414 61Q1422 86 1425 91Q1428 96 1434 102L1440 109"/><path stroke-width="1" d="M0 353Q30 350 45 343Q60 337 72 329Q84 321 117 295Q150 269 162 262Q174 255 186 250Q198 246 210 243Q222 240 234 240Q246 239 255 240Q264 241 285 247Q306 253 315 254Q324 254 333 252Q342 251 354 245Q366 239 378 230Q390 221 417 196Q444 170 471 151Q499 131 505 126Q512 120 520 107Q528 94 542 62Q555 30 563 15L570 0"/><path stroke-width="1" d="M1143 520Q1135 508 1126 486Q1116 465 1110 456Q1104 448 1091 433Q1078 418 1075 412Q1071 406 1062 383Q1052 359 1048 353Q1044 348 1040 344Q1036 341 1028 337Q1020 334 1011 333Q1002 332 990 333Q978 335 954 340Q930 344 924 344Q918 344 912 342Q906 341 902 338Q898 335 887 324Q876 313 870 309Q864 306 858 303Q852 301 834 297Q816 292 807 287Q798 283 793 276Q788 269 777 248Q767 227 758 219Q750 211 741 207Q732 203 708 197Q684 192 675 189Q666 186 657 181Q648 176 630 162Q612 149 606 146Q600 144 591 142Q582 140 573 141Q564 142 558 144Q552 147 546 151Q540 155 536 161Q532 167 528 176Q524 185 520 200Q516 215 515 227Q513 239 514 248Q515 257 518 263Q522 270 525 272Q528 275 543 283Q558 290 565 298Q572 305 576 314Q579 323 585 347Q590 371 595 380Q599 389 606 393Q612 397 630 402Q648 407 654 411Q660 416 662 423Q665 430 664 439Q663 448 659 457Q655 466 649 476Q642 485 633 493Q624 501 615 506Q606 511 597 514Q588 516 579 516Q570 516 564 514Q558 512 546 502Q534 492 528 491Q522 489 513 493Q504 496 498 501Q492 505 486 513L479 520"/><path stroke-width="1" d="M1262 0Q1296 13 1326 18Q1356 23 1365 27Q1374 30 1377 33Q1381 36 1385 42Q1389 48 1396 69Q1404 90 1408 99Q1413 108 1419 114Q1424 120 1432 125L1440 130"/><path stroke-width="1" d="M0 375Q30 369 45 362Q60 356 75 345Q90 335 120 311Q150 286 162 279Q174 272 183 268Q192 264 204 261Q216 258 225 258Q234 257 243 259Q252 260 276 268Q300 276 309 276Q318 277 330 276Q342 274 354 270Q366 266 375 261Q384 257 411 236Q438 215 444 211Q450 208 456 206Q462 204 465 205Q468 205 471 210Q474 215 473 227Q472 239 467 254Q463 269 451 299Q439 329 438 335Q437 341 438 347Q438 354 441 358Q444 361 450 361Q456 361 480 348Q504 336 510 334Q516 333 522 333Q528 333 534 337Q540 340 542 343Q544 347 546 353Q548 359 548 365Q548 371 546 380Q545 389 541 397Q536 406 531 412Q527 418 512 432Q498 445 489 455Q480 465 471 479Q462 492 454 506L447 520"/><path stroke-width="1" d="M1203 520Q1176 514 1171 511Q1166 508 1162 504Q1158 500 1155 495Q1151 490 1139 466Q1128 442 1110 420Q1092 398 1077 370Q1062 342 1059 338Q1056 334 1050 330Q1044 325 1038 322Q1032 320 1023 318Q1014 316 987 316Q960 316 951 315Q942 314 933 310Q924 306 912 297Q900 288 894 284Q888 281 879 278Q870 275 852 272Q834 268 828 266Q822 264 814 257Q806 251 793 233Q780 215 771 208Q762 200 752 196Q742Line truncated

After

Width:  |  Height:  |  Size: 13 KiB

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><rect x="5" y="1" width="6" height="14" rx="1" fill="#b3261e"/></svg>

After

Width:  |  Height:  |  Size: 130 B

@@ -0,0 +1,93 @@
Copyright © 2017 IBM Corp. with Reserved Font Name "Plex"
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
+93
View File
@@ -0,0 +1,93 @@
Copyright 2014 The Source Serif 4 Project Authors (https://github.com/adobe-fonts/source-serif)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
/* Runs in <head>, before first paint: marks that JavaScript runs, and applies the
reader's saved theme and length order. Saved by app.js (footer switches). */
(function () {
'use strict';
var root = document.documentElement;
root.classList.add('js');
try {
var theme = localStorage.getItem('lh-theme');
var units = localStorage.getItem('lh-units');
if (theme === 'light' || theme === 'dark') root.dataset.theme = theme;
if (units === 'mi') root.dataset.units = 'mi';
} catch (e) { /* storage blocked: defaults apply */ }
})();
+1490
View File
File diff suppressed because it is too large. Load diff
+41
View File
@@ -0,0 +1,41 @@
# Third-party assets
Served from `/assets/`, so pages make no requests to CDNs or font services at
runtime. Map tiles, glyphs and sprites still come from OpenFreeMap.
## MapLibre GL JS
| File | Package | Version | Licence |
| --- | --- | --- | --- |
| `maplibre-gl/maplibre-gl.js`, `maplibre-gl/maplibre-gl.css` | maplibre-gl | 4.7.1 | BSD-3-Clause, `maplibre-gl/LICENSE.txt` |
Downloaded unchanged from `https://unpkg.com/maplibre-gl@4.7.1/dist/` on
2026-11-10. SHA-256:
```text
be9633c4d870e26fb37f1cfe5c5a77181667114003ea16207ac7850d8da8add1 maplibre-gl.js
576b085fdd9487a65a19215328c1e086c07ce5bf6da09b666b3806d3d008dae9 maplibre-gl.css
```
The standard build runs its worker from a `blob:` URL, which the site's
Content-Security-Policy allows (`worker-src blob:`). The bundle's last line
names a source map that is not vendored.
To upgrade: download `dist/maplibre-gl.js`, `dist/maplibre-gl.css` and
`LICENSE.txt` of the new version into `maplibre-gl/`, update this file, and
check that the trail maps still draw.
## Web fonts (`../fonts/`)
Latin subset only, as served by Google Fonts on 2026-11-10. Characters outside
it fall back to the system serif or sans. The `@font-face` rules are at the top
of `../style.css`.
| File | Family | Weights | Licence |
| --- | --- | --- | --- |
| `source-serif-4-latin.woff2` | Source Serif 4, roman | variable 400-700 | SIL OFL 1.1, `OFL-source-serif-4.txt` |
| `source-serif-4-italic-latin.woff2` | Source Serif 4, italic | variable 400-600 | SIL OFL 1.1, `OFL-source-serif-4.txt` |
| `ibm-plex-sans-condensed-{400,500,600}-latin.woff2` | IBM Plex Sans Condensed | 400, 500, 600 | SIL OFL 1.1, `OFL-ibm-plex-sans-condensed.txt` |
Source Serif 4 is the weight-only variable font (no optical-size axis): 51 KB
instead of 122 KB.
+116
View File
@@ -0,0 +1,116 @@
Copyright (c) 2023, MapLibre contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of MapLibre GL JS nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
Contains code from mapbox-gl-js v1.13 and earlier
Version v1.13 of mapbox-gl-js and earlier are licensed under a BSD-3-Clause license
Copyright (c) 2020, Mapbox
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Mapbox GL JS nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-------------------------------------------------------------------------------
Contains code from glfx.js
Copyright (C) 2011 by Evan Wallace
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
--------------------------------------------------------------------------------
Contains a portion of d3-color https://github.com/d3/d3-color
Copyright 2010-2016 Mike Bostock
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the author nor the names of contributors may be used to
endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+1
View File
@@ -0,0 +1 @@
.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewLine truncated
+59
View File
@@ -0,0 +1,59 @@
/**
* MapLibre GL JS
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.maplibregl = factory());
})(this, (function () { 'use strict';
/* eslint-disable */
var maplibregl = {};
var modules = {};
function define(moduleName, _dependencies, moduleFactory) {
modules[moduleName] = moduleFactory;
// to get the list of modules see generated dist/maplibre-gl-dev.js file (look for `define(` calls)
if (moduleName !== 'index') {
return;
}
// we assume that when an index module is initializing then other modules are loaded already
var workerBundleString = 'var sharedModule = {}; (' + modules.shared + ')(sharedModule); (' + modules.worker + ')(sharedModule);'
var sharedModule = {};
// the order of arguments of a module factory depends on rollup (it decides who is whose dependency)
// to check the correct order, see dist/maplibre-gl-dev.js file (look for `define(` calls)
// we assume that for our 3 chunks it will generate 3 modules and their order is predefined like the following
modules.shared(sharedModule);
modules.index(maplibregl, sharedModule);
if (typeof window !== 'undefined') {
maplibregl.setWorkerUrl(window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' })));
}
return maplibregl;
};
define("shared",["exports"],(function(t){"use strict";function e(t,e,r,n){return new(r||(r=Promise))((function(i,s){function a(t){try{l(n.next(t));}catch(t){s(t);}}function o(t){try{l(n.throw(t));}catch(t){s(t);}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e);}))).then(a,o);}l((n=n.apply(t,e||[])).next());}))}function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}"function"==typeof SuppressedError&&SuppressedError;var n=i;function i(t,e){this.x=t,this.y=e;}i.prototype={clone:function(){return new i(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},i.convert=function(t){return t instanceof i?t:Array.isArray(t)?new i(t[0],t[1]):t};var s=r(n),a=o;function o(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n;}o.prototype={sampleCurveX:function(t){return ((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return ((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return (3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)<e)return r;var s=this.sampleCurveDerivativeX(r);if(Math.abs(s)<1e-6)break;r-=i/s;}var a=0,o=1;for(r=t,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-t)<e));n++)t>i?a=r:o=r,r=.5*(o-a)+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var l=r(a);let u,c;function h(){return null==u&&(u="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),u}function p(){if(null==c&&(c=!1,h())){const t=5,e=new OffscreenCanvas(t,t).getContext("2d",{willReadFrequently:!0});if(e){for(let r=0;r<t*t;r++){const n=4*r;e.fillStyle=`rgb(${n},${n+1},${n+2})`,e.fillRect(r%t,Math.floor(r/t),1,1);}const r=e.getImageData(0,0,t,t).data;for(let e=0;e<t*t*4;e++)if(e%4!=3&&r[e]!==e){c=!0;break}}}return c||!1}function f(t,e,r,n){const i=new l(t,e,r,n);return t=>i.solve(t)}const d=f(.25,.1,.25,1);function y(t,e,r){return Math.min(r,Math.max(e,t))}function m(t,e,r){const n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function g(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}let x=1;function v(t,e,r){const n={};for(const r in t)n[r]=e.call(this,t[r],r,t);return n}function b(t,e,r){const n={};for(const r in t)e.call(this,t[r],r,t)&&(n[r]=t[r]);return n}function w(t){return Array.isArray(t)?t.map(w):"object"==typeof t&&t?v(t,w):t}const _={};function A(t){_[t]||("undefined"!=typeof console&&console.warn(t),_[t]=!0);}function S(t,e,r){return (r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function k(t){return "undefined"!=typeof WorkerGlobalScope&&void 0!==t&&t instanceof WorkerGlobalScope}let M=null;function I(t){return "undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap}const z="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCLine truncated
define("worker",["./shared"],(function(e){"use strict";class t{constructor(e){this.keyCache={},e&&this.replace(e);}replace(e){this._layerConfigs={},this._layers={},this.update(e,[]);}update(t,o){for(const o of t){this._layerConfigs[o.id]=o;const t=this._layers[o.id]=e.aA(o);t._featureFilter=e.a7(t.filter),this.keyCache[o.id]&&delete this.keyCache[o.id];}for(const e of o)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const i=e.bk(Object.values(this._layerConfigs),this.keyCache);for(const e of i){const t=e.map((e=>this._layers[e.id])),o=t[0];if("none"===o.visibility)continue;const i=o.source||"";let s=this.familiesBySource[i];s||(s=this.familiesBySource[i]={});const r=o.sourceLayer||"_geojsonTileLayer";let n=s[r];n||(n=s[r]=[]),n.push(t);}}}class o{constructor(t){const o={},i=[];for(const e in t){const s=t[e],r=o[e]={};for(const e in s){const t=s[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const o={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};i.push(o),r[e]={rect:o,metrics:t.metrics};}}const{w:s,h:r}=e.p(i),n=new e.o({width:s||1,height:r||1});for(const i in t){const s=t[i];for(const t in s){const r=s[+t];if(!r||0===r.bitmap.width||0===r.bitmap.height)continue;const a=o[i][t].rect;e.o.copy(r.bitmap,n,{x:0,y:0},{x:a.x+1,y:a.y+1},r.bitmap);}}this.image=n,this.positions=o;}}e.bl("GlyphAtlas",o);class i{constructor(t){this.tileID=new e.S(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[];}parse(t,i,r,n){return e._(this,void 0,void 0,(function*(){this.status="parsing",this.data=t,this.collisionBoxArray=new e.a5;const a=new e.bm(Object.keys(t.layers).sort()),l=new e.bn(this.tileID,this.promoteId);l.bucketLayerIDs=[];const c={},u={featureIndex:l,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:r},h=i.familiesBySource[this.source];for(const o in h){const i=t.layers[o];if(!i)continue;1===i.version&&e.w(`Vector tile source "${this.source}" layer "${o}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const n=a.encode(o),d=[];for(let e=0;e<i.length;e++){const t=i.feature(e),s=l.getId(t,o);d.push({feature:t,id:s,index:e,sourceLayerIndex:n});}for(const t of h[o]){const o=t[0];o.source!==this.source&&e.w(`layer.source = ${o.source} does not equal this.source = ${this.source}`),o.minzoom&&this.zoom<Math.floor(o.minzoom)||o.maxzoom&&this.zoom>=o.maxzoom||"none"!==o.visibility&&(s(t,this.zoom,r),(c[o.id]=o.createBucket({index:l.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:n,sourceID:this.source})).populate(d,u,this.tileID.canonical),l.bucketLayerIDs.push(t.map((e=>e.id))));}}const d=e.aF(u.glyphDependencies,(e=>Object.keys(e).map(Number)));this.inFlightDependencies.forEach((e=>null==e?void 0:e.abort())),this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(d).length){const e=new AbortController;this.inFlightDependencies.push(e),f=n.sendAsync({type:"GG",data:{stacks:d,source:this.source,tileID:this.tileID,type:"glyphs"}},e);}const g=Object.keys(u.iconDependencies);let p=Promise.resolve({});if(g.length){const e=new AbortController;this.inFlightDependencies.push(e),p=n.sendAsync({type:"GI",data:{icons:g,source:this.source,tileID:this.tileID,type:"icons"}},e);}const m=Object.keys(u.patternDependencies);let y=Promise.resolve({});if(m.length){const e=new AbortController;this.inFlightDependencies.push(e),y=n.sendAsync({type:"GI",data:{icons:m,source:this.source,tileID:this.tileID,type:"patterns"}},e);}const[v,w,x]=yield Promise.all([f,p,y]),b=new o(v),S=new e.bo(w,x);for(const t in c){const o=c[t];o instanceof e.a6?(s(o.layers,this.zoom,r),e.bp({bucket:o,glyphMap:v,glyphPositions:b.positions,imageMap:w,imagePositions:S.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):o.hasPattern&&(o instanceof e.bq||o instanceof e.br||o instanceof e.bs)&&(s(o.layers,this.zoom,r),o.addFeatures(u,this.tileID.canonical,S.patternPositions));}return this.status="done",{buckets:Object.values(c).filter((e=>!e.isEmpty())),featureIndex:l,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:b.image,imageAtlas:S,glyphMap:this.returnDependencies?v:null,iconMap:this.returnDependencies?w:null,glyphPositions:this.returnDependencies?b.positions:null}}))}}function s(t,o,i){const s=new e.z(o);for(const e of t)e.recalculate(s,i);}class r{constructor(e,t,o){this.actor=e,this.layerIndex=t,this.availableImages=o,this.fetching={},this.loading={},this.loaded={};}loadVeLine truncated
define("index",["exports","./shared"],(function(t,e){"use strict";var i="4.7.1";let a,s;const o={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:t=>new Promise(((i,a)=>{const s=requestAnimationFrame(i);t.signal.addEventListener("abort",(()=>{cancelAnimationFrame(s),a(e.c());}));})),getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){const e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,i.drawImage(t,0,0,t.width,t.height),i},resolveURL:t=>(a||(a=document.createElement("a")),a.href=t,a.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return !!matchMedia&&(null==s&&(s=matchMedia("(prefers-reduced-motion: reduce)")),s.matches)}};class r{static testProp(t){if(!r.docStyle)return t[0];for(let e=0;e<t.length;e++)if(t[e]in r.docStyle)return t[e];return t[0]}static create(t,e,i){const a=window.document.createElement(t);return void 0!==e&&(a.className=e),i&&i.appendChild(a),a}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){r.docStyle&&r.selectProp&&(r.userSelect=r.docStyle[r.selectProp],r.docStyle[r.selectProp]="none");}static enableDrag(){r.docStyle&&r.selectProp&&(r.docStyle[r.selectProp]=r.userSelect);}static setTransform(t,e){t.style[r.transformProp]=e;}static addEventListener(t,e,i,a={}){t.addEventListener(e,i,"passive"in a?a:a.capture);}static removeEventListener(t,e,i,a={}){t.removeEventListener(e,i,"passive"in a?a:a.capture);}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",r.suppressClickInternal,!0);}static suppressClick(){window.addEventListener("click",r.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",r.suppressClickInternal,!0);}),0);}static getScale(t){const e=t.getBoundingClientRect();return {x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}static getPoint(t,i,a){const s=i.boundingClientRect;return new e.P((a.clientX-s.left)/i.x-t.clientLeft,(a.clientY-s.top)/i.y-t.clientTop)}static mousePos(t,e){const i=r.getScale(t);return r.getPoint(t,i,e)}static touchPos(t,e){const i=[],a=r.getScale(t);for(let s=0;s<e.length;s++)i.push(r.getPoint(t,a,e[s]));return i}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t);}}r.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,r.selectProp=r.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),r.transformProp=r.testProp(["transform","WebkitTransform"]);const n={supported:!1,testSupport:function(t){!c&&h&&(u?d(t):l=t);}};let l,h,c=!1,u=!1;function d(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,h),t.isContextLost())return;n.supported=!0;}catch(t){}t.deleteTexture(e),c=!0;}var _;"undefined"!=typeof document&&(h=document.createElement("img"),h.onload=()=>{l&&d(l),l=null,u=!0;},h.onerror=()=>{c=!0,l=null;},h.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(t){let i,a,s,o;t.resetRequestQueue=()=>{i=[],a=0,s=0,o={};},t.addThrottleControl=t=>{const e=s++;return o[e]=t,e},t.removeThrottleControl=t=>{delete o[t],l();},t.getImage=(t,a,s=!0)=>new Promise(((o,r)=>{n.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),e.e(t,{type:"image"}),i.push({abortController:a,requestParameters:t,supportImageRefresh:s,state:"queued",onError:t=>{r(t);},onSuccess:t=>{o(t);}}),l();}));const r=t=>e._(this,void 0,void 0,(function*(){t.state="running";const{requestParameters:i,supportImageRefresh:s,onError:o,onSuccess:r,abortController:n}=t,c=!1===s&&!e.i(self)&&!e.g(i.url)&&(!i.headers||Object.keys(i.headers).reduce(((t,e)=>t&&"accept"===e),!0));a++;const u=c?h(i,n):e.m(i,n);try{const i=yield u;delete t.abortController,t.state="completed",i.data instanceof HTMLImageElement||e.b(i.data)?r(i):i.data&&r({data:yield(d=i.data,"function"==typeof createImageBitmap?e.d(d):e.f(d)),cacheControl:i.cacheControl,expires:i.expires});}catch(e){delete t.abortController,o(e);}finally{a--,l();}var d;})),l=()=>{const t=(()=>{for(const t of Object.keys(o))if(o[t]())return !0;return !1})()?e.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:e.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let e=a;e<t&&i.length>0;e++){const t=i.shift();t.abortController.signal.aborted?e--:r(t);}},h=(t,i)=>new Promise(((a,s)=>{const o=new Image,r=t.url,n=t.credentials;n&&"include"===n?o.crossOrigin="use-credentials":(n&&"same-origin"===n||!e.s(r))&&(o.crossOrigin="anonymous"),i.signal.addEventListener("abort",(()=>{o.src="",s(e.c());})),o.fetchPriority="high",o.onload=()=>{o.onerror=o.onload=null,a(Line truncated
//
// Our custom intro provides a specialized "define()" function, called by the
// AMD modules below, that sets up the worker blob URL and then executes the
// main module, storing its exported value as 'maplibregl'
var maplibregl$1 = maplibregl;
return maplibregl$1;
}));
//# sourceMappingURL=maplibre-gl.js.map