{
  "version": 3,
  "sources": ["alpine_relief_core.js"],
  "sourcesContent": ["// @ts-check\n/*\n * static/js/alpine_relief_core.js \u2014 our relief past swisstopo's detail\n * (SNOW-1460).\n *\n * swisstopo's winter style draws its relief from relief.vt: hachures and a\n * hillshade, which stop where swisstopo's detailed relief does\n * (static/js/swisstopo_extent.js DETAILED_RELIEF). Past it the winter map\n * would be flat, so the `alpinerelief://` raster protocol paints relief from\n * the elevation tiles the 3D view already reads (MAP_3D_DEM_TILE_URL,\n * Terrarium-encoded), in static/js/alpine_relief_worker.js. Two things:\n *\n *   - A NEUTRAL HILLSHADE, lit from the north-west at 45\u00B0: grey shadow on\n *     slopes facing away from the light, a faint white on slopes facing it,\n *     nothing on the flat.\n *   - A NEUTRAL GREY ROCK TONE on slopes steeper than ROCK_SLOPE_DEGREES,\n *     darker on the shadow side, where the ground is too steep to hold snow\n *     and swisstopo would draw rock.\n *\n * THE TUNING. How strong each of the three is, and the slope the rock\n * starts at, is a `tuning` ({rockSlope, rockStrength, shadowStrength,\n * highlightStrength}; strengths 0..1 of full alpha). TUNING_DEFAULTS is\n * what every reader sees; a staff panel on /map/\n * (static/js/map_relief_tuning.js) hands the worker another, which\n * normaliseTuning clamps and tuningKey names for the tile URLs.\n *\n * Inside the detailed relief the tile is erased (alpha 0), so swisstopo's\n * hachures are never covered. The layer sits above swisstopo's flat edge\n * shading (beyond_switzerland_core.js places it).\n *\n * Everything that needs no canvas is here, so Vitest can pin it:\n * Terrarium decoding, slope and aspect, the shade, the rock tone, the erase\n * mask and the whole tile's paint into RGBA.\n *\n * THE PAINT LOOP runs once a pixel on the worker's only thread, so it\n * allocates nothing per pixel (SNOW-1475): it repeats the helpers' maths in\n * primitives, and Vitest holds the two byte for byte. Slope uses\n * Math.sqrt, not Math.hypot, which V8 does not inline and so boxes its\n * arguments.\n *\n * Exports (frozen `self.pwaAlpineReliefCore`):\n *\n *   PROTOCOL / TILE_SIZE / MIN_ZOOM / MAX_ZOOM / ROCK_SLOPE_DEGREES\n *   LIGHT_AZIMUTH / LIGHT_ALTITUDE\n *   TUNING_DEFAULTS / ROCK_SLOPE_RANGE\n *   normaliseTuning(tuning) / tuningKey(tuning)\n *   parseUrl(url) / tileUrl(template, tile)\n *   terrarium(r, g, b)\n *   metresPerPixel(tile, size)\n *   slopeAspect(heights, size, col, row, cell)\n *   shade(slope, aspect)\n *   hillshadePixel(slope, aspect, tuning?)\n *   rockPixel(slope, aspect, tuning?)\n *   eraseMask(polygons, tile, size)\n *   paint(dem, size, tile, polygons, tuning?)\n */\n(function () {\n  'use strict';\n\n  /** The MapLibre protocol the relief tiles come through. */\n  const PROTOCOL = 'alpinerelief';\n\n  /**\n   * Where an elevation tile comes from when our copy has none: AWS's\n   * Terrarium tiles, the same fallback map_3d_core's DEM loader uses\n   * (DEM_FALLBACK_TILE_URL there; a Vitest pins the two together). Our\n   * copy answers 204 outside its supported area and 404 for a missing\n   * tile, and without this the relief would have holes where 3D has none.\n   */\n  const DEM_FALLBACK_TILE_URL = 'https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png';\n\n  /** Our DEM tiles are 512 px; one relief tile is painted from one. */\n  const TILE_SIZE = 512;\n\n  /** The relief's zoom range; MapLibre enlarges the top tile above it. */\n  const MIN_ZOOM = 6;\n  const MAX_ZOOM = 14;\n\n  /** Steeper than this, the ground is drawn as rock (the default). */\n  const ROCK_SLOPE_DEGREES = 40;\n\n  /** Where the light comes from: the north-west, 45\u00B0 up. */\n  const LIGHT_AZIMUTH = 315;\n  const LIGHT_ALTITUDE = 45;\n\n  /** The shadow's grey. */\n  const SHADOW_RGB = Object.freeze([64, 64, 64]);\n  /** The highlight's white. */\n  const HIGHLIGHT_RGB = Object.freeze([255, 255, 255]);\n  /** The rock tone: lit and shadow-side greys. */\n  const ROCK_LIT_RGB = Object.freeze([170, 170, 170]);\n  const ROCK_SHADOW_RGB = Object.freeze([126, 126, 126]);\n\n  /**\n   * What every reader sees. Strengths are the strongest alpha, 0..1 of\n   * full; lightened from 0.55 rock and 0.45 shadow on 8 Nov 2026 (Hugo:\n   * \"lighten \u00D6tztal a touch\").\n   *\n   * @typedef {{rockSlope: number, rockStrength: number, shadowStrength: number, highlightStrength: number}} Tuning\n   * @type {Readonly<Tuning>}\n   */\n  const TUNING_DEFAULTS = Object.freeze({\n    rockSlope: ROCK_SLOPE_DEGREES,\n    rockStrength: 0.42,\n    shadowStrength: 0.36,\n    highlightStrength: 0.24,\n  });\n\n  /** The slopes the rock may start at, in degrees. */\n  const ROCK_SLOPE_RANGE = Object.freeze([25, 60]);\n\n  const EARTH_CIRCUMFERENCE = 40075016.686;\n  const RAD = Math.PI / 180;\n\n  /**\n   * @typedef {{z: number, x: number, y: number}} Tile\n   * @typedef {{rgb: ReadonlyArray<number>, alpha: number}} Pixel\n   */\n\n  /**\n   * A whole tuning from whatever was given: each value a finite number\n   * clamped to its range, anything missing or junk the default.\n   *\n   * @param {unknown} [tuning]\n   * @returns {Readonly<Tuning>}\n   */\n  function normaliseTuning(tuning) {\n    const given = tuning && typeof tuning === 'object' ? /** @type {Record<string, unknown>} */ (tuning) : {};\n    const pick = (/** @type {keyof Tuning} */ name, /** @type {number} */ min, /** @type {number} */ max) => {\n      const value = given[name];\n      const n = typeof value === 'number' ? value : typeof value === 'string' && value.trim() ? Number(value) : NaN;\n      return Number.isFinite(n) ? Math.min(max, Math.max(min, n)) : TUNING_DEFAULTS[name];\n    };\n    return Object.freeze({\n      rockSlope: pick('rockSlope', ROCK_SLOPE_RANGE[0], ROCK_SLOPE_RANGE[1]),\n      rockStrength: pick('rockStrength', 0, 1),\n      shadowStrength: pick('shadowStrength', 0, 1),\n      highlightStrength: pick('highlightStrength', 0, 1),\n    });\n  }\n\n  /**\n   * A short name for a tuning, the same for the same values: the relief\n   * tiles' `?v=`, so a new tuning is a new tile to MapLibre.\n   *\n   * @param {unknown} [tuning]\n   * @returns {string}\n   */\n  function tuningKey(tuning) {\n    const t = normaliseTuning(tuning);\n    const pct = (/** @type {number} */ n) => String(Math.round(n * 100));\n    return [Math.round(t.rockSlope), pct(t.rockStrength), pct(t.shadowStrength), pct(t.highlightStrength)].join('-');\n  }\n\n  /**\n   * Read `alpinerelief://{z}/{x}/{y}`.\n   *\n   * @param {string} url\n   * @returns {?Tile}\n   */\n  function parseUrl(url) {\n    const match = /^alpinerelief:\\/\\/(\\d+)\\/(\\d+)\\/(\\d+)(?:[?#].*)?$/.exec(url || '');\n    if (!match) return null;\n    return { z: Number(match[1]), x: Number(match[2]), y: Number(match[3]) };\n  }\n\n  /**\n   * Fill an XYZ template.\n   *\n   * @param {string} template\n   * @param {Tile} tile\n   * @returns {string}\n   */\n  function tileUrl(template, tile) {\n    return template\n      .replace('{z}', String(tile.z))\n      .replace('{x}', String(tile.x))\n      .replace('{y}', String(tile.y));\n  }\n\n  /**\n   * A Terrarium pixel's height in metres.\n   *\n   * @param {number} r\n   * @param {number} g\n   * @param {number} b\n   * @returns {number}\n   */\n  function terrarium(r, g, b) {\n    return r * 256 + g + b / 256 - 32768;\n  }\n\n  /**\n   * The ground width of one pixel at a tile's centre latitude, in metres.\n   *\n   * @param {Tile} tile\n   * @param {number} size\n   * @returns {number}\n   */\n  function metresPerPixel(tile, size) {\n    const n = Math.PI - (2 * Math.PI * (tile.y + 0.5)) / 2 ** tile.z;\n    const lat = Math.atan(Math.sinh(n));\n    return (EARTH_CIRCUMFERENCE * Math.cos(lat)) / (2 ** tile.z * size);\n  }\n\n  /**\n   * The slope (degrees) and aspect (degrees clockwise from north, the way\n   * the ground faces downhill) at one pixel, from its four neighbours; an\n   * edge pixel reads its own height for the neighbour it lacks.\n   *\n   * @param {Float32Array|ReadonlyArray<number>} heights Row-major, `size` square.\n   * @param {number} size\n   * @param {number} col\n   * @param {number} row\n   * @param {number} cell Metres per pixel.\n   * @returns {{slope: number, aspect: number}}\n   */\n  function slopeAspect(heights, size, col, row, cell) {\n    const at = (/** @type {number} */ c, /** @type {number} */ r) =>\n      heights[Math.min(size - 1, Math.max(0, r)) * size + Math.min(size - 1, Math.max(0, c))];\n    const left = col > 0 ? col - 1 : col;\n    const right = col < size - 1 ? col + 1 : col;\n    const up = row > 0 ? row - 1 : row;\n    const down = row < size - 1 ? row + 1 : row;\n    const dx = (right - left) * cell || cell;\n    const dy = (down - up) * cell || cell;\n    const east = (at(right, row) - at(left, row)) / dx;\n    // Rows run south, so north is up a row.\n    const north = (at(col, up) - at(col, down)) / dy;\n    const slope = Math.atan(Math.sqrt(east * east + north * north)) / RAD;\n    const aspect = east === 0 && north === 0\n      ? 0\n      : ((Math.atan2(-east, -north) / RAD) + 360) % 360;\n    return { slope, aspect };\n  }\n\n  /**\n   * How much light a slope gets, 0..1: 1 square on to the light, the cosine\n   * of the light's zenith on the flat.\n   *\n   * @param {number} slope Degrees.\n   * @param {number} aspect Degrees.\n   * @returns {number}\n   */\n  function shade(slope, aspect) {\n    const zenith = (90 - LIGHT_ALTITUDE) * RAD;\n    const s = slope * RAD;\n    const lit = Math.cos(zenith) * Math.cos(s)\n      + Math.sin(zenith) * Math.sin(s) * Math.cos((LIGHT_AZIMUTH - aspect) * RAD);\n    return Math.max(0, Math.min(1, lit));\n  }\n\n  /**\n   * The neutral hillshade at one slope: a grey shadow, a faint white\n   * highlight, or nothing on the flat.\n   *\n   * @param {number} slope\n   * @param {number} aspect\n   * @param {Tuning} [tuning]\n   * @returns {?Pixel}\n   */\n  function hillshadePixel(slope, aspect, tuning = TUNING_DEFAULTS) {\n    const flat = Math.cos((90 - LIGHT_ALTITUDE) * RAD);\n    const lit = shade(slope, aspect);\n    if (lit < flat) {\n      const alpha = Math.round(((flat - lit) / flat) * tuning.shadowStrength * 255);\n      return alpha ? { rgb: SHADOW_RGB, alpha } : null;\n    }\n    const alpha = Math.round(((lit - flat) / (1 - flat)) * tuning.highlightStrength * 255);\n    return alpha ? { rgb: HIGHLIGHT_RGB, alpha } : null;\n  }\n\n  /**\n   * The rock tone, on a slope steeper than the tuning's rockSlope: the\n   * darker grey on the side facing away from the light.\n   *\n   * @param {number} slope\n   * @param {number} aspect\n   * @param {Tuning} [tuning]\n   * @returns {?Pixel}\n   */\n  function rockPixel(slope, aspect, tuning = TUNING_DEFAULTS) {\n    if (!(slope > tuning.rockSlope)) return null;\n    const alpha = Math.round(tuning.rockStrength * 255);\n    if (!alpha) return null;\n    const towardsLight = Math.cos((LIGHT_AZIMUTH - aspect) * RAD) >= 0;\n    return { rgb: towardsLight ? ROCK_LIT_RGB : ROCK_SHADOW_RGB, alpha };\n  }\n\n  /**\n   * A pixel row's crossings with a ring, in pixel columns.\n   *\n   * @param {ReadonlyArray<ReadonlyArray<number>>} ring Pixel coordinates.\n   * @param {number} y\n   * @param {number[]} out\n   */\n  function crossings(ring, y, out) {\n    for (let i = 0, j = ring.length - 1; i < ring.length; j = i, i += 1) {\n      const [xi, yi] = ring[i];\n      const [xj, yj] = ring[j];\n      if ((yi > y) !== (yj > y)) out.push(xi + ((y - yi) * (xj - xi)) / (yj - yi));\n    }\n  }\n\n  /**\n   * Which pixels of a tile are inside the polygons (holes honoured): 1 to\n   * erase, 0 to paint. Filled a row at a time, at each pixel's centre.\n   *\n   * @param {ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<number>>>>} polygons [lng, lat].\n   * @param {Tile} tile\n   * @param {number} size\n   * @returns {Uint8Array}\n   */\n  function eraseMask(polygons, tile, size) {\n    const mask = new Uint8Array(size * size);\n    const scale = 2 ** tile.z;\n    const toPixel = (/** @type {ReadonlyArray<number>} */ point) => {\n      const sin = Math.sin(point[1] * RAD);\n      const worldX = ((point[0] + 180) / 360) * scale;\n      const worldY = (0.5 - Math.log((1 + sin) / (1 - sin)) / (4 * Math.PI)) * scale;\n      return [(worldX - tile.x) * size, (worldY - tile.y) * size];\n    };\n    const rings = polygons.flatMap((polygon) => polygon.map((ring) => ring.map(toPixel)));\n    const touches = rings.some((ring) => {\n      let minX = Infinity;\n      let maxX = -Infinity;\n      let minY = Infinity;\n      let maxY = -Infinity;\n      for (const [px, py] of ring) {\n        minX = Math.min(minX, px);\n        maxX = Math.max(maxX, px);\n        minY = Math.min(minY, py);\n        maxY = Math.max(maxY, py);\n      }\n      return maxX >= 0 && minX <= size && maxY >= 0 && minY <= size;\n    });\n    if (!touches) return mask;\n    /** @type {number[]} */\n    const xs = [];\n    for (let row = 0; row < size; row += 1) {\n      xs.length = 0;\n      for (const ring of rings) crossings(ring, row + 0.5, xs);\n      if (!xs.length) continue;\n      xs.sort((a, b) => a - b);\n      // Every ring is listed, holes included, so even-odd honours holes.\n      for (let k = 0; k + 1 < xs.length; k += 2) {\n        const from = Math.max(0, Math.ceil(xs[k] - 0.5));\n        const to = Math.min(size - 1, Math.floor(xs[k + 1] - 0.5));\n        for (let col = from; col <= to; col += 1) mask[row * size + col] = 1;\n      }\n    }\n    return mask;\n  }\n\n  /**\n   * Lay one colour over the pixel at `at` (source over), in place. It takes\n   * primitives, so the paint loop allocates nothing per pixel (SNOW-1475).\n   *\n   * @param {Uint8ClampedArray} out\n   * @param {number} at Byte offset.\n   * @param {ReadonlyArray<number>} rgb\n   * @param {number} alpha 0..255.\n   */\n  function overRgb(out, at, rgb, alpha) {\n    const a = alpha / 255;\n    const below = out[at + 3] / 255;\n    const total = a + below * (1 - a);\n    if (!total) return;\n    out[at] = Math.round((rgb[0] * a + out[at] * below * (1 - a)) / total);\n    out[at + 1] = Math.round((rgb[1] * a + out[at + 1] * below * (1 - a)) / total);\n    out[at + 2] = Math.round((rgb[2] * a + out[at + 2] * below * (1 - a)) / total);\n    out[at + 3] = Math.round(total * 255);\n  }\n\n  /**\n   * Paint one relief tile from one Terrarium tile.\n   *\n   * The loop runs once a pixel (262,144 times for a 512 px tile) on the\n   * worker's only thread, so it repeats `slopeAspect`, `shade`,\n   * `hillshadePixel` and `rockPixel` in primitives rather than calling\n   * them: no object or closure per pixel (SNOW-1475). Those helpers stay\n   * as the readable statement of the maths, and the tests hold the two\n   * byte for byte.\n   *\n   * @param {Uint8ClampedArray|Uint8Array} dem The DEM tile's RGBA, `size` square.\n   * @param {number} size\n   * @param {Tile} tile\n   * @param {ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<number>>>>} polygons\n   *   Where to erase: swisstopo's detailed relief.\n   * @param {unknown} [tuning] Normalised here; the defaults if left out.\n   * @returns {Uint8ClampedArray} RGBA.\n   */\n  function paint(dem, size, tile, polygons, tuning) {\n    const tuned = normaliseTuning(tuning);\n    const heights = new Float32Array(size * size);\n    for (let i = 0; i < size * size; i += 1) {\n      heights[i] = terrarium(dem[i * 4], dem[i * 4 + 1], dem[i * 4 + 2]);\n    }\n    const mask = eraseMask(polygons, tile, size);\n    const cell = metresPerPixel(tile, size);\n    const out = new Uint8ClampedArray(size * size * 4);\n    const zenith = (90 - LIGHT_ALTITUDE) * RAD;\n    const cosZenith = Math.cos(zenith);\n    const sinZenith = Math.sin(zenith);\n    const flat = Math.cos((90 - LIGHT_ALTITUDE) * RAD);\n    const rockAlpha = Math.round(tuned.rockStrength * 255);\n    const last = size - 1;\n    for (let row = 0; row < size; row += 1) {\n      const up = row > 0 ? row - 1 : row;\n      const down = row < last ? row + 1 : row;\n      const dy = (down - up) * cell || cell;\n      for (let col = 0; col < size; col += 1) {\n        const index = row * size + col;\n        if (mask[index]) continue;\n        const left = col > 0 ? col - 1 : col;\n        const right = col < last ? col + 1 : col;\n        const dx = (right - left) * cell || cell;\n        const east = (heights[row * size + right] - heights[row * size + left]) / dx;\n        // Rows run south, so north is up a row.\n        const north = (heights[up * size + col] - heights[down * size + col]) / dy;\n        const slope = Math.atan(Math.sqrt(east * east + north * north)) / RAD;\n        // `% 360` without the fmod: the bearing lies in [180, 540), where\n        // subtracting 360 is exact, so the result matches slopeAspect's.\n        const bearing = east === 0 && north === 0 ? 360 : (Math.atan2(-east, -north) / RAD) + 360;\n        const aspect = bearing >= 360 ? bearing - 360 : bearing;\n        const at = index * 4;\n        const s = slope * RAD;\n        const facing = Math.cos((LIGHT_AZIMUTH - aspect) * RAD);\n        const lit = Math.max(0, Math.min(1, cosZenith * Math.cos(s) + sinZenith * Math.sin(s) * facing));\n        if (lit < flat) {\n          const alpha = Math.round(((flat - lit) / flat) * tuned.shadowStrength * 255);\n          if (alpha) overRgb(out, at, SHADOW_RGB, alpha);\n        } else {\n          const alpha = Math.round(((lit - flat) / (1 - flat)) * tuned.highlightStrength * 255);\n          if (alpha) overRgb(out, at, HIGHLIGHT_RGB, alpha);\n        }\n        if (slope > tuned.rockSlope && rockAlpha) {\n          overRgb(out, at, facing >= 0 ? ROCK_LIT_RGB : ROCK_SHADOW_RGB, rockAlpha);\n        }\n      }\n    }\n    return out;\n  }\n\n  self.pwaAlpineReliefCore = Object.freeze({\n    PROTOCOL,\n    DEM_FALLBACK_TILE_URL,\n    TILE_SIZE,\n    MIN_ZOOM,\n    MAX_ZOOM,\n    ROCK_SLOPE_DEGREES,\n    LIGHT_AZIMUTH,\n    LIGHT_ALTITUDE,\n    TUNING_DEFAULTS,\n    ROCK_SLOPE_RANGE,\n    normaliseTuning,\n    tuningKey,\n    parseUrl,\n    tileUrl,\n    terrarium,\n    metresPerPixel,\n    slopeAspect,\n    shade,\n    hillshadePixel,\n    rockPixel,\n    eraseMask,\n    paint,\n  });\n})();\n"],
  "mappings": "CAwDC,UAAY,CACX,aAGA,MAAMA,EAAW,eASXC,EAAwB,0EAiBxBC,EAAa,OAAO,OAAO,CAAC,GAAI,GAAI,EAAE,CAAC,EAEvCC,EAAgB,OAAO,OAAO,CAAC,IAAK,IAAK,GAAG,CAAC,EAE7CC,EAAe,OAAO,OAAO,CAAC,IAAK,IAAK,GAAG,CAAC,EAC5CC,EAAkB,OAAO,OAAO,CAAC,IAAK,IAAK,GAAG,CAAC,EAU/CC,EAAkB,OAAO,OAAO,CACpC,UAAW,GACX,aAAc,IACd,eAAgB,IAChB,kBAAmB,GACrB,CAAC,EAGKC,EAAmB,OAAO,OAAO,CAAC,GAAI,EAAE,CAAC,EAEzCC,EAAsB,eACtBC,EAAM,KAAK,GAAK,IActB,SAAS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UMFERENCE", "RAD", "normaliseTuning", "tuning", "given", "pick", "name", "min", "max", "value", "n", "tuningKey", "pct", "parseUrl", "url", "match", "tileUrl", "template", "tile", "terrarium", "r", "g", "b", "metresPerPixel", "size", "lat", "slopeAspect", "heights", "col", "row", "cell", "at", "c", "left", "right", "up", "down", "dx", "dy", "east", "north", "slope", "aspect", "shade", "zenith", "s", "lit", "hillshadePixel", "flat", "alpha", "rockPixel", "crossings", "ring", "y", "out", "i", "j", "xi", "yi", "xj", "yj", "eraseMask", "polygons", "mask", "scale", "toPixel", "point", "sin", "worldX", "worldY", "rings", "polygon", "minX", "maxX", "minY", "maxY", "px", "py", "xs", "a", "k", "from", "to", "overRgb", "rgb", "below", "total", "paint", "dem", "tuned", "cosZenith", "sinZenith", "rockAlpha", "last", "index", "bearing", "facing"]
}
