{
  "version": 3,
  "sources": ["osm_clip_core.js"],
  "sourcesContent": ["// @ts-check\n/*\n * static/js/osm_clip_core.js \u2014 OpenStreetMap vector tiles clipped to outside\n * the swisstopo extent (SNOW-1460).\n *\n * Past the Swiss border the winter style draws OpenFreeMap's OpenMapTiles\n * vector tiles with its own layer definitions\n * (static/js/beyond_switzerland_core.js). Inside the swisstopo extent\n * (static/js/swisstopo_extent.js) swisstopo's base.vt draws, so every OSM\n * feature is clipped to outside it before MapLibre sees it. A `within`\n * filter cannot do that: it keeps or drops a whole feature, so a road or a\n * forest across the border would either draw twice or stop short.\n *\n * Pure geometry in TILE COORDINATES (0..extent, y down, as a vector tile\n * stores them), so the same file runs on the page for Vitest and in\n * static/js/osm_clip_worker.js through `importScripts`. It never decodes or\n * encodes a tile; the worker does that with static/js/vector_tile_kit.min.js.\n *\n *   - THE TILE. classifyTile says whether a tile is wholly inside the\n *     extent (it comes back empty), wholly outside (it passes through\n *     untouched) or on the border (each feature is clipped).\n *   - POLYGONS on a border tile are clipped to their outside part through\n *     polygon-clipping's difference; holes are kept.\n *   - LINES are cut where they cross the extent's edges, and only the\n *     pieces whose midpoint is outside are kept, so a line crossing twice\n *     becomes two pieces.\n *   - POINTS inside are dropped.\n *\n * Every coordinate it returns is rounded to a whole tile unit, which is\n * what a vector tile can store.\n *\n * Exports (frozen `self.pwaOsmClipCore`):\n *\n *   PROTOCOL / INSIDE / OUTSIDE / BORDER\n *   parseUrl(url) / tileUrl(template, tile)\n *   project(lng, lat, tile, extent)\n *   localExtent(polygons, tile, extent, clipping, margin)\n *   classifyTile(polygons, tile, extent, clipping)\n *   pointInPolygons(polygons, point)\n *   classifyRings(rings)\n *   clipPolygon(rings, local, clipping)\n *   cutLine(line, local)\n *   clipFeature(feature, local, clipping)\n *   clipLayers(layers, polygons, tile, clipping)\n */\n(function () {\n  'use strict';\n\n  /** The MapLibre protocol the clipped tiles come through. */\n  const PROTOCOL = 'osmclip';\n\n  /** What classifyTile answers. */\n  const INSIDE = 'inside';\n  const OUTSIDE = 'outside';\n  const BORDER = 'border';\n\n  /**\n   * How far past its edges a tile's local extent reaches, as a share of\n   * the tile: features carry a buffer beyond the tile, and a vertex out\n   * there must still be judged against the real border.\n   */\n  const MARGIN = 0.5;\n\n  /**\n   * @typedef {{z: number, x: number, y: number}} Tile\n   * @typedef {[number, number]} Pair\n   * @typedef {Pair[]} Ring\n   * @typedef {Ring[]} Polygon\n   * @typedef {Polygon[]} MultiPolygon\n   * @typedef {{type: number, geometry: any, tags?: object, id?: number}} Feature\n   */\n\n  /**\n   * Read `osmclip://{z}/{x}/{y}`.\n   *\n   * @param {string} url\n   * @returns {?Tile}\n   */\n  function parseUrl(url) {\n    const match = /^osmclip:\\/\\/(\\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 longitude and latitude in a tile's own coordinates.\n   *\n   * @param {number} lng\n   * @param {number} lat\n   * @param {Tile} tile\n   * @param {number} extent The tile's extent, usually 4096.\n   * @returns {Pair}\n   */\n  function project(lng, lat, tile, extent) {\n    const scale = 2 ** tile.z;\n    const sin = Math.sin((lat * Math.PI) / 180);\n    const worldX = ((lng + 180) / 360) * scale;\n    const worldY = (0.5 - Math.log((1 + sin) / (1 - sin)) / (4 * Math.PI)) * scale;\n    return [(worldX - tile.x) * extent, (worldY - tile.y) * extent];\n  }\n\n  /**\n   * The signed area of a ring, by the surveyor's formula: positive for a\n   * vector tile's exterior ring (clockwise on screen, y down).\n   *\n   * @param {ReadonlyArray<ReadonlyArray<number>>} ring\n   * @returns {number}\n   */\n  function signedArea(ring) {\n    let sum = 0;\n    for (let i = 0, j = ring.length - 1; i < ring.length; j = i, i += 1) {\n      sum += ring[j][0] * ring[i][1] - ring[i][0] * ring[j][1];\n    }\n    return sum / 2;\n  }\n\n  /**\n   * A square ring around a tile, `margin` tiles wide on each side.\n   *\n   * @param {number} extent\n   * @param {number} margin\n   * @returns {Polygon}\n   */\n  function tileRect(extent, margin) {\n    const lo = -margin * extent;\n    const hi = (1 + margin) * extent;\n    return [[[lo, lo], [hi, lo], [hi, hi], [lo, hi], [lo, lo]]];\n  }\n\n  /**\n   * Whether a ring's longitude/latitude box can touch the tile area.\n   *\n   * @param {ReadonlyArray<ReadonlyArray<number>>} ring Tile coordinates.\n   * @param {number} lo\n   * @param {number} hi\n   * @returns {boolean}\n   */\n  function ringTouches(ring, lo, hi) {\n    let minX = Infinity;\n    let minY = Infinity;\n    let maxX = -Infinity;\n    let maxY = -Infinity;\n    for (const [px, py] of ring) {\n      if (px < minX) minX = px;\n      if (px > maxX) maxX = px;\n      if (py < minY) minY = py;\n      if (py > maxY) maxY = py;\n    }\n    return maxX >= lo && minX <= hi && maxY >= lo && minY <= hi;\n  }\n\n  /**\n   * The extent's polygons in a tile's coordinates, cut to the tile and a\n   * margin around it. Empty when the extent does not reach the tile.\n   *\n   * @param {ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<number>>>>} polygons\n   *   The extent, [lng, lat].\n   * @param {Tile} tile\n   * @param {number} extent\n   * @param {any} clipping polygon-clipping.\n   * @param {number} [margin]\n   * @returns {MultiPolygon}\n   */\n  function localExtent(polygons, tile, extent, clipping, margin = MARGIN) {\n    const lo = -margin * extent;\n    const hi = (1 + margin) * extent;\n    /** @type {MultiPolygon} */\n    const projected = [];\n    for (const polygon of polygons) {\n      const rings = polygon.map((ring) =>\n        ring.map(([lng, lat]) => project(lng, lat, tile, extent)));\n      if (!ringTouches(rings[0], lo, hi)) continue;\n      projected.push(rings);\n    }\n    if (!projected.length) return [];\n    return clipping.intersection(projected, tileRect(extent, margin));\n  }\n\n  /** @param {MultiPolygon} polygons */\n  function totalArea(polygons) {\n    let area = 0;\n    for (const polygon of polygons) {\n      for (const ring of polygon) area += signedArea(ring);\n    }\n    return Math.abs(area);\n  }\n\n  /**\n   * Whether a tile is wholly inside the extent, wholly outside it, or on\n   * its border.\n   *\n   * @param {ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<number>>>>} polygons\n   * @param {Tile} tile\n   * @param {number} extent\n   * @param {any} clipping\n   * @returns {string} INSIDE, OUTSIDE or BORDER.\n   */\n  function classifyTile(polygons, tile, extent, clipping) {\n    const exact = localExtent(polygons, tile, extent, clipping, 0);\n    const area = totalArea(exact);\n    const full = extent * extent;\n    if (area <= full * 1e-9) return OUTSIDE;\n    if (area >= full * (1 - 1e-9)) return INSIDE;\n    return BORDER;\n  }\n\n  /**\n   * Even-odd: inside a ring.\n   *\n   * @param {ReadonlyArray<ReadonlyArray<number>>} ring\n   * @param {ReadonlyArray<number>} point\n   * @returns {boolean}\n   */\n  function inRing(ring, point) {\n    const [x, y] = point;\n    let inside = false;\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) && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi) inside = !inside;\n    }\n    return inside;\n  }\n\n  /**\n   * Whether a point is inside polygons with holes.\n   *\n   * @param {ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<number>>>>} polygons\n   * @param {ReadonlyArray<number>} point\n   * @returns {boolean}\n   */\n  function pointInPolygons(polygons, point) {\n    return polygons.some(([outer, ...holes]) =>\n      inRing(outer, point) && !holes.some((hole) => inRing(hole, point)));\n  }\n\n  /**\n   * A vector tile's polygon rings, grouped into polygons: a ring wound like\n   * the first starts a polygon, one wound the other way is its hole. Each\n   * ring is closed.\n   *\n   * @param {Ring[]} rings\n   * @returns {Polygon[]}\n   */\n  function classifyRings(rings) {\n    /** @type {Polygon[]} */\n    const polygons = [];\n    let exteriorSign = 0;\n    for (const raw of rings) {\n      const ring = closeRing(raw);\n      const area = signedArea(ring);\n      if (!area || ring.length < 4) continue;\n      const sign = Math.sign(area);\n      if (!exteriorSign) exteriorSign = sign;\n      if (sign === exteriorSign || !polygons.length) polygons.push([ring]);\n      else polygons[polygons.length - 1].push(ring);\n    }\n    return polygons;\n  }\n\n  /**\n   * @param {Ring} ring\n   * @returns {Ring}\n   */\n  function closeRing(ring) {\n    if (!ring.length) return ring;\n    const [fx, fy] = ring[0];\n    const [lx, ly] = ring[ring.length - 1];\n    return fx === lx && fy === ly ? ring : [...ring, [fx, fy]];\n  }\n\n  /**\n   * Round to whole tile units and drop repeated points.\n   *\n   * @param {ReadonlyArray<ReadonlyArray<number>>} points\n   * @returns {Ring}\n   */\n  function roundPoints(points) {\n    /** @type {Ring} */\n    const out = [];\n    for (const [px, py] of points) {\n      const x = Math.round(px);\n      const y = Math.round(py);\n      const last = out[out.length - 1];\n      if (!last || last[0] !== x || last[1] !== y) out.push([x, y]);\n    }\n    return out;\n  }\n\n  /**\n   * A ring rounded and wound the vector-tile way: exterior positive, holes\n   * negative. Null once rounding has collapsed it.\n   *\n   * @param {ReadonlyArray<ReadonlyArray<number>>} ring\n   * @param {boolean} exterior\n   * @returns {?Ring}\n   */\n  function tidyRing(ring, exterior) {\n    const rounded = roundPoints(ring);\n    if (rounded.length < 4) return null;\n    const area = signedArea(rounded);\n    if (!area) return null;\n    if ((area > 0) !== exterior) rounded.reverse();\n    return rounded;\n  }\n\n  /**\n   * The part of a polygon outside the extent, holes kept.\n   *\n   * @param {Ring[]} rings The feature's rings, as the tile stores them.\n   * @param {MultiPolygon} local The extent in this tile (localExtent).\n   * @param {any} clipping\n   * @returns {Ring[]} Rings, exteriors and their holes in order; empty when\n   *   nothing is outside.\n   */\n  function clipPolygon(rings, local, clipping) {\n    const polygons = classifyRings(rings);\n    if (!polygons.length) return [];\n    const outside = local.length ? clipping.difference(polygons, local) : polygons;\n    /** @type {Ring[]} */\n    const out = [];\n    for (const polygon of outside) {\n      const exterior = tidyRing(polygon[0], true);\n      if (!exterior) continue;\n      out.push(exterior);\n      for (const hole of polygon.slice(1)) {\n        const tidy = tidyRing(hole, false);\n        if (tidy) out.push(tidy);\n      }\n    }\n    return out;\n  }\n\n  /**\n   * Where segment a\u2192b crosses segment c\u2192d, as a share of a\u2192b, or null.\n   *\n   * @param {ReadonlyArray<number>} a\n   * @param {ReadonlyArray<number>} b\n   * @param {ReadonlyArray<number>} c\n   * @param {ReadonlyArray<number>} d\n   * @returns {?number}\n   */\n  function crossing(a, b, c, d) {\n    const rx = b[0] - a[0];\n    const ry = b[1] - a[1];\n    const sx = d[0] - c[0];\n    const sy = d[1] - c[1];\n    const denom = rx * sy - ry * sx;\n    if (!denom) return null;\n    const qx = c[0] - a[0];\n    const qy = c[1] - a[1];\n    const t = (qx * sy - qy * sx) / denom;\n    const u = (qx * ry - qy * rx) / denom;\n    if (t <= 0 || t >= 1 || u < 0 || u > 1) return null;\n    return t;\n  }\n\n  /**\n   * A line cut at the extent's edges, keeping the pieces whose midpoint is\n   * outside it.\n   *\n   * @param {ReadonlyArray<ReadonlyArray<number>>} line\n   * @param {MultiPolygon} local\n   * @returns {Ring[]} Lines of two points or more.\n   */\n  function cutLine(line, local) {\n    if (line.length < 2) return [];\n    if (!local.length) {\n      const whole = roundPoints(line);\n      return whole.length >= 2 ? [whole] : [];\n    }\n    /** @type {Array<[ReadonlyArray<number>, ReadonlyArray<number>]>} */\n    const edges = [];\n    for (const polygon of local) {\n      for (const ring of polygon) {\n        for (let i = 1; i < ring.length; i += 1) edges.push([ring[i - 1], ring[i]]);\n      }\n    }\n    /** @type {Ring[]} */\n    const pieces = [];\n    /** @type {?Ring} */\n    let current = null;\n    for (let i = 1; i < line.length; i += 1) {\n      const a = line[i - 1];\n      const b = line[i];\n      const cuts = [0, 1];\n      for (const [c, d] of edges) {\n        const t = crossing(a, b, c, d);\n        if (t !== null) cuts.push(t);\n      }\n      cuts.sort((p, q) => p - q);\n      for (let k = 1; k < cuts.length; k += 1) {\n        const t0 = cuts[k - 1];\n        const t1 = cuts[k];\n        if (t1 - t0 <= 1e-12) continue;\n        const at = (/** @type {number} */ t) => /** @type {Pair} */ ([\n          a[0] + (b[0] - a[0]) * t,\n          a[1] + (b[1] - a[1]) * t,\n        ]);\n        const mid = at((t0 + t1) / 2);\n        if (pointInPolygons(local, mid)) {\n          if (current) pieces.push(current);\n          current = null;\n          continue;\n        }\n        if (!current) current = [at(t0)];\n        current.push(at(t1));\n      }\n    }\n    if (current) pieces.push(current);\n    return pieces.map(roundPoints).filter((piece) => piece.length >= 2);\n  }\n\n  /**\n   * One feature clipped to outside the extent, in the shape the encoder\n   * takes (geojson-vt's: points a flat list, lines and polygons a list of\n   * rings). Null when nothing of it is outside.\n   *\n   * @param {Feature} feature `geometry` as the decoder's loadGeometry\n   *   gives it, as `[x, y]` pairs.\n   * @param {MultiPolygon} local\n   * @param {any} clipping\n   * @returns {?Feature}\n   */\n  function clipFeature(feature, local, clipping) {\n    /** @type {Ring[]} */\n    const rings = feature.geometry;\n    let geometry;\n    if (feature.type === 1) {\n      geometry = roundPoints(rings.flat()).filter((point) => !pointInPolygons(local, point));\n    } else if (feature.type === 2) {\n      geometry = rings.flatMap((line) => cutLine(line, local));\n    } else if (feature.type === 3) {\n      geometry = clipPolygon(rings, local, clipping);\n    } else {\n      return null;\n    }\n    if (!geometry.length) return null;\n    return { ...feature, geometry };\n  }\n\n  /**\n   * @typedef {{extent: number, features: Feature[]}} Layer\n   */\n\n  /**\n   * Every layer of a tile clipped to outside the extent. A tile wholly\n   * inside comes back with no layers; one wholly outside comes back as it\n   * was, with `status` saying which.\n   *\n   * @param {Record<string, Layer>} layers\n   * @param {ReadonlyArray<ReadonlyArray<ReadonlyArray<ReadonlyArray<number>>>>} polygons\n   * @param {Tile} tile\n   * @param {any} clipping\n   * @returns {{status: string, layers: Record<string, Layer>}}\n   */\n  function clipLayers(layers, polygons, tile, clipping) {\n    const names = Object.keys(layers);\n    const extent = names.length ? layers[names[0]].extent || 4096 : 4096;\n    const status = classifyTile(polygons, tile, extent, clipping);\n    if (status === INSIDE) return { status, layers: {} };\n    if (status === OUTSIDE) return { status, layers };\n    /** @type {Record<string, Layer>} */\n    const out = {};\n    /** @type {Map<number, MultiPolygon>} */\n    const locals = new Map();\n    for (const name of names) {\n      const layer = layers[name];\n      const layerExtent = layer.extent || 4096;\n      if (!locals.has(layerExtent)) {\n        locals.set(layerExtent, localExtent(polygons, tile, layerExtent, clipping));\n      }\n      const local = /** @type {MultiPolygon} */ (locals.get(layerExtent));\n      /** @type {Feature[]} */\n      const features = [];\n      for (const feature of layer.features) {\n        // polygon-clipping can throw on a degenerate ring. Dropping that one\n        // feature keeps the rest of the border tile, which would otherwise\n        // fail on every request, since its input never changes.\n        let clipped = null;\n        try {\n          clipped = clipFeature(feature, local, clipping);\n        } catch (_err) {\n          clipped = null;\n        }\n        if (clipped) features.push(clipped);\n      }\n      if (features.length) out[name] = { extent: layerExtent, features };\n    }\n    return { status, layers: out };\n  }\n\n  self.pwaOsmClipCore = Object.freeze({\n    PROTOCOL,\n    INSIDE,\n    OUTSIDE,\n    BORDER,\n    parseUrl,\n    tileUrl,\n    project,\n    localExtent,\n    classifyTile,\n    pointInPolygons,\n    classifyRings,\n    clipPolygon,\n    cutLine,\n    clipFeature,\n    clipLayers,\n  });\n})();\n"],
  "mappings": "CA6CC,UAAY,CACX,aAGA,MAAMA,EAAW,UAGXC,EAAS,SACTC,EAAU,UACVC,EAAS,SAwBf,SAASC,EAASC,EAAK,CACrB,MAAMC,EAAQ,+CAA+C,KAAKD,GAAO,EAAE,EAC3E,OAAKC,EACE,CAAE,EAAG,OAAOA,EAAM,CAAC,CAAC,EAAG,EAAG,OAAOA,EAAM,CAAC,CAAC,EAAG,EAAG,OAAOA,EAAM,CAAC,CAAC,CAAE,EADpD,IAErB,CASA,SAASC,EAAQC,EAAUC,EAAM,CAC/B,OA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EAAQ,MAAO,CAAE,OAAAgH,EAAQ,OAAQ,CAAC,CAAE,EACnD,GAAIA,IAAW/G,EAAS,MAAO,CAAE,OAAA+G,EAAQ,OAAAF,CAAO,EAEhD,MAAM1C,EAAM,CAAC,EAEP6C,EAAS,IAAI,IACnB,UAAWC,KAAQH,EAAO,CACxB,MAAMI,EAAQL,EAAOI,CAAI,EACnBE,EAAcD,EAAM,QAAU,KAC/BF,EAAO,IAAIG,CAAW,GACzBH,EAAO,IAAIG,EAAanF,EAAYC,EAAU1B,EAAM4G,EAAajF,CAAQ,CAAC,EAE5E,MAAMuC,EAAqCuC,EAAO,IAAIG,CAAW,EAE3DC,EAAW,CAAC,EAClB,UAAWV,KAAWQ,EAAM,SAAU,CAIpC,IAAIG,EAAU,KACd,GAAI,CACFA,EAAUZ,EAAYC,EAASjC,EAAOvC,CAAQ,CAChD,MAAe,CACbmF,EAAU,IACZ,CACIA,GAASD,EAAS,KAAKC,CAAO,CACpC,CACID,EAAS,SAAQjD,EAAI8C,CAAI,EAAI,CAAE,OAAQE,EAAa,SAAAC,CAAS,EACnE,CACA,MAAO,CAAE,OAAAL,EAAQ,OAAQ5C,CAAI,CAC/B,CAEA,KAAK,eAAiB,OAAO,OAAO,CAClC,SAAArE,EACA,OAAAC,EACA,QAAAC,EACA,OAAAC,EACA,SAAAC,EACA,QAAAG,EACA,QAAAG,EACA,YAAAwB,EACA,aAAAQ,EACA,gBAAAY,EACA,cAAAI,EACA,YAAAgB,EACA,QAAAkB,EACA,YAAAe,EACA,WAAAG,CACF,CAAC,CACH,GAAG",
  "names": ["PROTOCOL", "INSIDE", "OUTSIDE", "BORDER", "parseUrl", "url", "match", "tileUrl", "template", "tile", "project", "lng", "lat", "extent", "scale", "sin", "worldX", "worldY", "signedArea", "ring", "sum", "i", "j", "tileRect", "margin", "lo", "hi", "ringTouches", "minX", "minY", "maxX", "maxY", "px", "py", "localExtent", "polygons", "clipping", "projected", "polygon", "rings", "totalArea", "area", "classifyTile", "exact", "full", "inRing", "point", "x", "y", "inside", "xi", "yi", "xj", "yj", "pointInPolygons", "outer", "holes", "hole", "classifyRings", "exteriorSign", "raw", "closeRing", "sign", "fx", "fy", "lx", "ly", "roundPoints", "points", "out", "last", "tidyRing", "exterior", "rounded", "clipPolygon", "local", "outside", "tidy", "crossing", "a", "b", "c", "d", "rx", "ry", "sx", "sy", "denom", "qx", "qy", "t", "u", "cutLine", "line", "whole", "edges", "pieces", "current", "cuts", "p", "q", "k", "t0", "t1", "at", "mid", "piece", "clipFeature", "feature", "geometry", "clipLayers", "layers", "names", "status", "locals", "name", "layer", "layerExtent", "features", "clipped"]
}
