{
  "version": 3,
  "sources": ["route_rail_core.js"],
  "sourcesContent": ["/*\n * static/js/route_rail_core.js \u2014 rail one's pure half: the whole route's\n * profile, cut at its transitions (SNOW-1018).\n *\n * The rail sits below the map while a route is open. It draws the route's\n * elevation profile as ONE FILLED SHAPE PER LEG \u2014 a leg being the stretch\n * between two transitions (apps/routes/services/legs.py) \u2014 under one\n * stroked outline of the whole track, with distance ticks along its foot\n * and the route's figures beside it. This module is the arithmetic of that\n * drawing and nothing else: no DOM, no globals read at parse time, so every\n * rule below is covered in tests/js/test_route_rail_core.js.\n * static/js/route_rail.js is the DOM half.\n *\n * ## Where a leg sits on the x-axis\n *\n * A leg arrives as `{i, from, to, climbing}` where `from` / `to` are SAMPLE\n * indices into `properties.slope.angles`, both inclusive \u2014 the server\n * converted them from point indices (apps/routes/services/leg_wire.py).\n * The profile's x-axis is summed distance along the simplified geometry,\n * which is a different length again, so a sample index is placed BY SHARE:\n * segment i owns the i-th of N equal shares of the track. That is the rule\n * `slopeBands` in elevation_profile_core.js argues for at length, and it is\n * the same rule here so a segment sits at the same place on the rail as on\n * any profile drawn by that module.\n *\n * ## The tick step\n *\n * `niceStep` picks the smallest of 25 / 50 / 100 / 200 / 250 / 500 / 1000 /\n * 2000 / 5000 m that leaves at most 15 minor ticks strictly inside the\n * strip. Majors fall on a coarser step from `MAJOR_STEP`, and every label\n * on the strip is in ONE unit \u2014 metres when the majors are under a\n * kilometre apart, kilometres otherwise \u2014 so a strip never reads \"500 m,\n * 1 km, 1.5 km\".\n *\n * ## The meta line\n *\n * The rail's subtitle (SNOW-1065) is the routes list's meta line,\n * `formatMetaLine`: \"12.9km \u00B7 337m \u2191 \u00B7 1906m \u2193 \u00B7 2h51m\" in the list, with the\n * panel's strings and null rules. A null figure is OMITTED, never shown as\n * zero: a route whose GPX carried no elevation has an unknown ascent, not\n * a flat one (Route.ascent_m's docstring). The two-line header SNOW-1045\n * gave the rail, and its steep-terrain figure, went with rail two.\n *\n * The subtitle carries no time (SNOW-1537): the TIME LINE under the\n * profile does, `formatTimeLine` \u2014 \"4h25m total \u00B7 2h11m moving\" from a\n * `timing_summary`, and \"\u22485h30m estimated\" from an `estimate_s`. Since\n * SNOW-1568 only a TRIP's feature carries either: a route never shows a\n * time, so a route's Time line is empty.\n *\n * ## The eyebrow (SNOW-1537, SNOW-1568)\n *\n * The header's kind line says it is a route and how it arrived, `eyebrow`,\n * from the feature's `provenance` (apps/routes/views.py `_provenance`):\n *\n *   skied, with its day       \u2192 \"Route \u00B7 Skied Fri 13 Mar\" (saved from a\n *                               recorded trip, Save to my routes)\n *   uploaded                  \u2192 \"Route \u00B7 Uploaded\" (any GPX, <trk> or <rte>)\n *   sac                       \u2192 \"Route \u00B7 SAC\"\n *   drawn                     \u2192 \"Route \u00B7 Drawn\"\n *\n * \"Recorded\" and \"Planned\" went with SNOW-1568: a recording is a trip. A\n * cached feature from before still saying `recorded` reads \"Route \u00B7\n * Uploaded\"; one with no provenance keeps \"Route\".\n *\n * ## Stops (SNOW-1537)\n *\n * A recorded trip's stops arrive in its `timing_summary`, each at\n * `along_m` \u2014 metres along the line, on the profile's own axis \u2014 and its\n * stored `[lon, lat]`. `stopMarks` places a pause mark at each on the\n * outline; `stopAt` is the tap test, within a tolerance of a mark's centre;\n * `stopIndex` is the segment the cursor moves to for one.\n *\n * ## A placed point's readout\n *\n * A point placed on the route is drawn on the profile as a vertical line\n * with a dot where it crosses the outline, and two figures beside it\n * (2026-10-02): the elevation at the top (`pointElevation`) and the\n * distance from the start at the bottom (`pointDistance`). They sit right\n * of the line, left-aligned, unless they would not fit (`readoutSide`).\n *\n * Exports (frozen `self.pwaRouteRailCore`):\n *\n *   niceStep(spanM)                          \u2192 metres between minor ticks\n *   majorStep(spanM)                         \u2192 metres between labelled ticks\n *   tickUnit(spanM)                          \u2192 'm' or 'km', once per strip\n *   ticks(spanM, units?)                     \u2192 [{d, major, label}]\n *   pointDistance(index, sampleCount, spanM, units?) \u2192 a point's distance\n *                                              along the route, as a label\n *   formatDuration(seconds)                  \u2192 {hours, minutes}, or null\n *   formatMetaLine(figures, strings?)        \u2192 the routes list's meta line\n *   formatTimeLine(figures, strings?)        \u2192 the Time line's value, or ''\n *                                              (SNOW-1537)\n *   eyebrow(provenance, strings?)            \u2192 the header's kind line\n *                                              (SNOW-1537)\n *   stopMarks(profile, stops, box?)          \u2192 a pause mark per stop, placed\n *                                              on the outline (SNOW-1537)\n *   stopAt(marks, x, y, laneWidth, laneHeight, tolerance, box?)\n *                                            \u2192 the mark a press is on, or\n *                                              null (SNOW-1537)\n *   stopIndex(stop, profile, sampleCount)    \u2192 the segment a stop is in\n *   legSpan(leg, sampleCount, distanceM)     \u2192 [startM, endM] on the profile\n *   clipRun(run, start, end)                 \u2192 a run clipped to [start, end],\n *                                              its ends interpolated\n *   legPaths(profile, legs, sampleCount, box) \u2192 one fill per leg + outline\n *   liftPaths(profile, lifts, sampleCount, box) \u2192 a fill and an outline per\n *                                              lift ride (SNOW-994)\n *   profileY(profile, d, box?)               \u2192 the outline's y at distance d\n *   pointElevation(profile, index, sampleCount, units?) \u2192 a point's\n *                                              elevation, as a label\n *   onOutline(profile, fraction, offsetY, laneHeight, tolerance, box?)\n *                                            \u2192 whether a press is on the\n *                                              top line, loosely\n *   readoutSide(x, laneWidth, readoutWidth, gap) \u2192 which side of the\n *                                              cursor line its figures go\n *   BOX                                      \u2192 the lane's user-space box\n */\n\n// @ts-check\n\n(function () {\n  'use strict';\n\n  /**\n   * @typedef {{i: number, from: number, to: number, climbing: boolean}} Leg\n   *   A leg in sample indices, both ends inclusive.\n   */\n\n  /**\n   * @typedef {{d: number, e: number}} ProfilePoint\n   * @typedef {{\n   *   runs: Array<Array<ProfilePoint>>,\n   *   distanceM: number,\n   *   minEle: ?number,\n   *   maxEle: ?number,\n   *   hasElevation: boolean,\n   * }} Profile\n   *   A `pwaElevationProfileCore.readProfile` result.\n   */\n\n  /**\n   * @typedef {{width: number, height: number}} Box\n   */\n\n  /** The steps a minor tick may take, in metres, smallest first. */\n  var STEPS = [25, 50, 100, 200, 250, 500, 1000, 2000, 5000];\n\n  /** At most this many minor ticks strictly inside the strip. */\n  var MAX_MINORS = 15;\n\n  /**\n   * The labelled step for each minor step, in metres.\n   *\n   * Every major is a whole number of minors, so a label always sits on a\n   * tick. From 1000 up every major is a whole number of kilometres, which is\n   * what lets the strip carry kilometre labels without decimals.\n   *\n   * @type {Object<number, number>}\n   */\n  var MAJOR_STEP = {\n    25: 100,\n    50: 100,\n    100: 500,\n    200: 1000,\n    250: 1000,\n    500: 1000,\n    1000: 5000,\n    2000: 10000,\n    5000: 10000,\n  };\n\n  /**\n   * The lane's user-space box. The element is drawn with\n   * `preserveAspectRatio=\"none\"` across whatever width the rail has, so this\n   * is a coordinate system rather than a pixel size; strokes carry\n   * `vector-effect: non-scaling-stroke` so the stretch does not thicken them.\n   */\n  var BOX = Object.freeze({ width: 1000, height: 96 });\n\n  /** Vertical inset above the highest point and below the lowest. */\n  var PAD_Y = 6;\n\n  /**\n   * How far past either end of the line a stop may sit and still be drawn\n   * there, metres (SNOW-1537): the server's along_m and the profile's\n   * length are summed over different vertices.\n   */\n  var STOP_END_TOLERANCE_M = 1;\n\n  /** The English units, the fallback when no strings are passed. */\n  var DEFAULT_UNITS = Object.freeze({ m: '%(value)s m', km: '%(value)s km' });\n\n  /**\n   * The English templates for the meta line (SNOW-1065): the routes\n   * panel's msgids, byte for byte.\n   */\n  var DEFAULT_META_LINE = Object.freeze({\n    'meta-km': '%(km)skm',\n    'meta-both': '%(km)skm \u00B7 %(ascent)sm \u2191 \u00B7 %(descent)sm \u2193',\n    'meta-ascent': '%(km)skm \u00B7 %(ascent)sm \u2191',\n    'meta-descent': '%(km)skm \u00B7 %(descent)sm \u2193',\n    'meta-hm': '%(hours)sh%(minutes)sm',\n    'meta-duration': '%(figures)s \u00B7 %(duration)s',\n    'meta-sac-time': '%(figures)s \u00B7 %(time)s SAC',\n    'meta-sac-grade': '%(figures)s \u00B7 %(grade)s',\n  });\n\n  /**\n   * The English Time line (SNOW-1537): the panel's msgids, byte for byte.\n   */\n  var DEFAULT_TIME_LINE = Object.freeze({\n    'meta-hm': '%(hours)sh%(minutes)sm',\n    'time-recorded': '%(total)s total \u00B7 %(moving)s moving',\n    'time-planned': '\u2248%(estimate)s estimated',\n  });\n\n  /**\n   * The English eyebrows (SNOW-1568), keyed by provenance kind; a skied\n   * route names its trip's day.\n   */\n  var DEFAULT_EYEBROWS = Object.freeze({\n    'eyebrow-route': 'Route',\n    'eyebrow-skied': 'Route \u00B7 Skied %(day)s',\n    'eyebrow-uploaded': 'Route \u00B7 Uploaded',\n    'eyebrow-sac': 'Route \u00B7 SAC',\n    'eyebrow-drawn': 'Route \u00B7 Drawn',\n  });\n\n  /**\n   * Substitute `%(name)s` placeholders by name.\n   *\n   * The same rule as i18n_strings.js's `interpolate`, restated so this\n   * module stays free of globals: a locale may reorder the placeholders, so\n   * substitution is by name and never by position.\n   *\n   * @param {string} template The string with placeholders.\n   * @param {Object<string, string>} params The values.\n   * @returns {string}\n   */\n  function interpolate(template, params) {\n    return String(template).replace(/%\\((\\w+)\\)s/g, function (whole, name) {\n      return Object.prototype.hasOwnProperty.call(params, name) ? params[name] : whole;\n    });\n  }\n\n  /**\n   * The metres between minor ticks for a strip `spanM` long.\n   *\n   * The smallest step that leaves at most `MAX_MINORS` ticks strictly\n   * inside the strip \u2014 neither the start nor a tick landing exactly on the\n   * end is counted. A strip too long for even the largest step takes the\n   * largest; a strip with no length takes the smallest.\n   *\n   * @param {number} spanM The strip's length in metres.\n   * @returns {number}\n   */\n  function niceStep(spanM) {\n    if (!(spanM > 0)) return STEPS[0];\n    for (var i = 0; i < STEPS.length; i += 1) {\n      var interior = Math.ceil(spanM / STEPS[i]) - 1;\n      if (interior <= MAX_MINORS) return STEPS[i];\n    }\n    return STEPS[STEPS.length - 1];\n  }\n\n  /**\n   * The metres between labelled ticks.\n   *\n   * @param {number} spanM The strip's length in metres.\n   * @returns {number}\n   */\n  function majorStep(spanM) {\n    return MAJOR_STEP[niceStep(spanM)];\n  }\n\n  /**\n   * The one unit every label on the strip is written in.\n   *\n   * @param {number} spanM The strip's length in metres.\n   * @returns {'m'|'km'}\n   */\n  function tickUnit(spanM) {\n    return majorStep(spanM) >= 1000 ? 'km' : 'm';\n  }\n\n  /**\n   * Every tick on a strip, start first.\n   *\n   * @param {number} spanM The strip's length in metres.\n   * @param {{m?: string, km?: string}} [units] Label templates carrying\n   *   `%(value)s`, from the partial's strings template.\n   * @returns {Array<{d: number, major: boolean, label: ?string}>} `label`\n   *   is set on majors only, in the strip's one unit.\n   */\n  function ticks(spanM, units) {\n    if (!(spanM > 0)) return [];\n    var step = niceStep(spanM);\n    var major = MAJOR_STEP[step];\n    var unit = tickUnit(spanM);\n    var templates = { ...DEFAULT_UNITS, ...(units || {}) };\n    var template = templates[unit];\n\n    /** @type {Array<{d: number, major: boolean, label: ?string}>} */\n    var out = [];\n    for (var n = 0; n * step <= spanM; n += 1) {\n      var d = n * step;\n      var isMajor = d % major === 0;\n      out.push({\n        d: d,\n        major: isMajor,\n        label: isMajor\n          ? interpolate(template, { value: String(unit === 'km' ? d / 1000 : d) })\n          : null,\n      });\n    }\n    return out;\n  }\n\n  /**\n   * A point's distance along the route, as the profile's readout shows it\n   * (the eyebrow until 2026-10-02): the segment's midpoint as a share of the route's\n   * length, in metres to the nearest 10 under a kilometre and in\n   * kilometres to one decimal from there.\n   *\n   * @param {number} index The segment index.\n   * @param {number} sampleCount The segments the route has.\n   * @param {number} spanM The route's length, metres.\n   * @param {{m?: string, km?: string}} [units] Label templates carrying\n   *   `%(value)s`, from the partial's strings template.\n   * @returns {?string} Null for an index or a route it cannot place.\n   */\n  function pointDistance(index, sampleCount, spanM, units) {\n    if (!Number.isFinite(index) || !(sampleCount > 0) || !(spanM > 0)) return null;\n    var d = ((index + 0.5) / sampleCount) * spanM;\n    var templates = { ...DEFAULT_UNITS, ...(units || {}) };\n    var metres = Math.round(d / 10) * 10;\n    if (metres < 1000) return interpolate(templates.m, { value: String(metres) });\n    return interpolate(templates.km, { value: (d / 1000).toFixed(1) });\n  }\n\n  /**\n   * @param {*} value\n   * @returns {value is number}\n   */\n  function isKnown(value) {\n    return typeof value === 'number' && isFinite(value);\n  }\n\n  /**\n   * A recording's elapsed time, split for the meta line: whole minutes\n   * rounded half up; always an hours figure and padded minutes (\"4h05m\",\n   * \"0h41m\"), so a duration beside metres never reads as metres.\n   *\n   * The rule is `split_hours_minutes` in apps/core/durations.py, which the\n   * routes panel renders from; `Math.round` already rounds a .5 up, the\n   * tie Python's builtin `round` would break the other way.\n   *\n   * @param {*} seconds The elapsed time, seconds.\n   * @returns {?{hours: string, minutes: string}} Null when unknown.\n   */\n  function formatDuration(seconds) {\n    if (!isKnown(seconds) || seconds <= 0) return null;\n    var total = Math.round(seconds / 60);\n    var hours = Math.floor(total / 60);\n    var minutes = total % 60;\n    return { hours: String(hours), minutes: String(minutes).padStart(2, '0') };\n  }\n\n  /**\n   * The routes list's meta line (SNOW-1065): \"12.9km \u00B7 337m \u2191 \u00B7 1906m \u2193 \u00B7\n   * 2h51m\".\n   *\n   * The same strings and the same null rules as the routes panel's row\n   * (apps/routes/templates/routes/partials/_route.html), so one route reads\n   * the same in both places: the distance always; ascent and descent each\n   * only when known, never as zero; the elapsed time only when the\n   * recording has one. Kilometres to one decimal and whole metres with no\n   * separator, as the panel's `floatformat` filters write them.\n   *\n   * An SAC tour, or a saved copy of one, passes `sac` \u2014 the tour's\n   * properties \u2014 and SAC's guide time and grade join the end of the row:\n   * \"2.3km \u00B7 351m \u2191 \u00B7 49m \u2193 \u00B7 1h30m SAC \u00B7 F\". The time is tagged SAC so it\n   * never reads as the app's own estimate. `sac_time_s` is written as any\n   * duration is; a guide time with no seconds (\"2-3 h\") is shown as SAC's\n   * text, `sac_time`.\n   *\n   * @param {{distance_m?: ?number, ascent_m?: ?number, descent_m?: ?number,\n   *   duration_s?: ?number, sac?: ?{sac_time_s?: ?number, sac_time?: string,\n   *   grade?: string}}} figures The route's figures, or a leg's (which\n   *   has no duration).\n   * @param {Object<string, string>} [strings] Templates keyed as\n   *   `DEFAULT_META_LINE`, from the partial's strings template.\n   * @returns {string} The line; '' with no distance.\n   */\n  function formatMetaLine(figures, strings) {\n    var t = { ...DEFAULT_META_LINE, ...(strings || {}) };\n    var f = figures || {};\n    if (!isKnown(f.distance_m)) return '';\n    var km = (f.distance_m / 1000).toFixed(1);\n    var up = isKnown(f.ascent_m) ? Math.round(f.ascent_m).toFixed(0) : null;\n    var down = isKnown(f.descent_m) ? Math.round(f.descent_m).toFixed(0) : null;\n    var line;\n    if (up !== null && down !== null) {\n      line = interpolate(t['meta-both'], { km: km, ascent: up, descent: down });\n    } else if (up !== null) {\n      line = interpolate(t['meta-ascent'], { km: km, ascent: up });\n    } else if (down !== null) {\n      line = interpolate(t['meta-descent'], { km: km, descent: down });\n    } else {\n      line = interpolate(t['meta-km'], { km: km });\n    }\n    var duration = formatDuration(f.duration_s);\n    if (duration) {\n      line = interpolate(t['meta-duration'], { figures: line, duration: spell(duration, t) });\n    }\n    var sac = f.sac;\n    if (!sac) return line;\n    var guide = formatDuration(sac.sac_time_s);\n    var time = guide ? spell(guide, t) : sac.sac_time || '';\n    if (time) line = interpolate(t['meta-sac-time'], { figures: line, time: time });\n    if (sac.grade) line = interpolate(t['meta-sac-grade'], { figures: line, grade: String(sac.grade) });\n    return line;\n  }\n\n  /**\n   * A duration as the meta line writes it: \"2h51m\", or \"0h45m\" under an hour.\n   *\n   * @param {{hours: string, minutes: string}} duration From `formatDuration`.\n   * @param {Object<string, string>} t The meta line's templates.\n   * @returns {string}\n   */\n  function spell(duration, t) {\n    return interpolate(t['meta-hm'], duration);\n  }\n\n  /**\n   * The Time line's value (SNOW-1537): \"4h25m total \u00B7 2h11m moving\" on a\n   * recorded route, \"\u22485h30m estimated\" on a planned one, '' on neither.\n   *\n   * A recorded route's figures are its `timing_summary`, worked out from\n   * the record on read; moving time leaves out every pause and lift ride.\n   * A planned route's is `estimate_s`, the drawing tools' estimate, with no\n   * rate. A timed route never shows an estimate: it has the record.\n   *\n   * @param {{timing_summary?: ?{total_s?: number, moving_s?: number},\n   *   estimate_s?: ?number}} figures The route's properties.\n   * @param {Object<string, string>} [strings] Templates keyed as\n   *   `DEFAULT_TIME_LINE`.\n   * @returns {string}\n   */\n  function formatTimeLine(figures, strings) {\n    var t = { ...DEFAULT_TIME_LINE, ...(strings || {}) };\n    var f = figures || {};\n    var summary = f.timing_summary;\n    if (summary && typeof summary === 'object') {\n      var total = formatDuration(summary.total_s);\n      if (total) {\n        var moving = formatDuration(summary.moving_s) || { hours: '0', minutes: '00' };\n        return interpolate(t['time-recorded'], {\n          total: spell(total, t),\n          moving: spell(moving, t),\n        });\n      }\n    }\n    var estimate = formatDuration(f.estimate_s);\n    if (estimate) return interpolate(t['time-planned'], { estimate: spell(estimate, t) });\n    return '';\n  }\n\n  /**\n   * The header's kind line for one route (SNOW-1537, SNOW-1568).\n   *\n   * @param {?{kind?: string, day?: string}} provenance The feature's\n   *   `provenance`, or nothing. `day` is the skied trip's date, already\n   *   formatted by the server (\"Fri 13 Mar\").\n   * @param {Object<string, string>} [strings] Templates keyed as\n   *   `DEFAULT_EYEBROWS`.\n   * @returns {string} \"Route\" when the route says nothing of where it\n   *   came from.\n   */\n  function eyebrow(provenance, strings) {\n    var t = { ...DEFAULT_EYEBROWS, ...(strings || {}) };\n    var p = provenance && typeof provenance === 'object' ? provenance : {};\n    var day = typeof p.day === 'string' ? p.day.trim() : '';\n    if (p.kind === 'skied' && day) return interpolate(t['eyebrow-skied'], { day: day });\n    // A feature cached before SNOW-1568 may still say `recorded`.\n    if (p.kind === 'uploaded' || p.kind === 'recorded') return t['eyebrow-uploaded'];\n    if (p.kind === 'sac') return t['eyebrow-sac'];\n    if (p.kind === 'drawn') return t['eyebrow-drawn'];\n    return t['eyebrow-route'];\n  }\n\n  /**\n   * @typedef {{lon: number, lat: number, along_m: number,\n   *   duration_s: number}} Stop\n   *   One stop off a route's `timing_summary`.\n   */\n\n  /**\n   * A pause mark per stop (SNOW-1537): where on the lane each sits.\n   *\n   * `along_m` is metres along the route's line, the axis the profile's x\n   * is summed on, so the share is `along_m` over the profile's length. The\n   * mark sits on the outline there, at `profileY`; a stop over a stretch\n   * with no elevation sits on the lane's middle. A stop off either end of\n   * the line by more than `STOP_END_TOLERANCE_M` is dropped; one within\n   * it is clamped onto the end, since the server sums the stored points and\n   * the profile the render geometry, which can differ by a fraction of a\n   * metre over a route.\n   *\n   * @param {Profile} profile A `readProfile` result.\n   * @param {Array<Stop>} stops The route's stops.\n   * @param {Box} [box] The user-space box. Defaults to `BOX`.\n   * @returns {Array<{stop: Stop, fraction: number, y: number}>} `y` in\n   *   the box's user space.\n   */\n  function stopMarks(profile, stops, box) {\n    var b = box || BOX;\n    if (!profile || !(profile.distanceM > 0) || !Array.isArray(stops)) return [];\n    /** @type {Array<{stop: Stop, fraction: number, y: number}>} */\n    var marks = [];\n    stops.forEach(function (stop) {\n      if (!stop || !isKnown(stop.along_m)) return;\n      if (stop.along_m < -STOP_END_TOLERANCE_M) return;\n      if (stop.along_m > profile.distanceM + STOP_END_TOLERANCE_M) return;\n      var d = Math.min(profile.distanceM, Math.max(0, stop.along_m));\n      var y = profileY(profile, d, b);\n      marks.push({\n        stop: stop,\n        fraction: d / profile.distanceM,\n        y: y === null ? b.height / 2 : y,\n      });\n    });\n    return marks;\n  }\n\n  /**\n   * The pause mark a press is on (SNOW-1537): the nearest whose centre is\n   * within `tolerance` px of it, or null.\n   *\n   * @param {Array<{stop: Stop, fraction: number, y: number}>} marks From\n   *   `stopMarks`.\n   * @param {number} x The press, px from the lane's left edge.\n   * @param {number} y The press, px from the lane's top edge.\n   * @param {number} laneWidth The lane's rendered width, px.\n   * @param {number} laneHeight The lane's rendered height, px.\n   * @param {number} tolerance How far from a mark's centre counts, px.\n   * @param {Box} [box] The user-space box the marks' `y` is in.\n   * @returns {?{stop: Stop, fraction: number, y: number}}\n   */\n  function stopAt(marks, x, y, laneWidth, laneHeight, tolerance, box) {\n    var b = box || BOX;\n    if (!Array.isArray(marks) || !(laneWidth > 0) || !(laneHeight > 0)) return null;\n    var best = null;\n    var bestDistance = Infinity;\n    marks.forEach(function (mark) {\n      var dx = x - mark.fraction * laneWidth;\n      var dy = y - (mark.y / b.height) * laneHeight;\n      var distance = Math.sqrt(dx * dx + dy * dy);\n      if (distance <= tolerance && distance < bestDistance) {\n        best = mark;\n        bestDistance = distance;\n      }\n    });\n    return best;\n  }\n\n  /**\n   * The segment a stop lies in, by share: what the cursor moves to when\n   * the stop is selected (SNOW-1537), so the map's dot and the profile's\n   * line mark it.\n   *\n   * @param {Stop} stop The stop.\n   * @param {Profile} profile A `readProfile` result.\n   * @param {number} sampleCount N, the cursor's segments.\n   * @returns {?number} Null when either has no length.\n   */\n  function stopIndex(stop, profile, sampleCount) {\n    if (!stop || !isKnown(stop.along_m) || !profile || !(profile.distanceM > 0)) return null;\n    if (!(sampleCount > 0)) return null;\n    var at = Math.floor((stop.along_m / profile.distanceM) * sampleCount);\n    return Math.min(sampleCount - 1, Math.max(0, at));\n  }\n\n  /**\n   * Where a leg starts and ends on the profile's x-axis, in metres.\n   *\n   * @param {Leg} leg The leg, in sample indices.\n   * @param {number} sampleCount N, the length of `slope.angles`.\n   * @param {number} distanceM The profile's own length.\n   * @returns {[number, number]}\n   */\n  function legSpan(leg, sampleCount, distanceM) {\n    return [\n      (leg.from / sampleCount) * distanceM,\n      ((leg.to + 1) / sampleCount) * distanceM,\n    ];\n  }\n\n  /**\n   * Linear interpolation of the elevation at `d` between two points.\n   *\n   * @param {ProfilePoint} a\n   * @param {ProfilePoint} b\n   * @param {number} d\n   * @returns {ProfilePoint}\n   */\n  function between(a, b, d) {\n    if (b.d === a.d) return { d: d, e: a.e };\n    return { d: d, e: a.e + ((b.e - a.e) * (d - a.d)) / (b.d - a.d) };\n  }\n\n  /**\n   * The part of one elevation run lying inside `[start, end]`.\n   *\n   * The two ends are INTERPOLATED onto the boundary rather than snapped to\n   * the nearest vertex, so two adjacent legs share their boundary vertex\n   * exactly and no sliver of profile falls between their fills.\n   *\n   * @param {Array<ProfilePoint>} run\n   * @param {number} start\n   * @param {number} end\n   * @returns {Array<ProfilePoint>}\n   */\n  function clipRun(run, start, end) {\n    /** @type {Array<ProfilePoint>} */\n    var out = [];\n    for (var i = 0; i < run.length; i += 1) {\n      var p = run[i];\n      var prev = i > 0 ? run[i - 1] : null;\n      if (prev && prev.d < start && p.d > start) out.push(between(prev, p, start));\n      if (prev && prev.d < end && p.d > end) {\n        out.push(between(prev, p, end));\n        break;\n      }\n      if (p.d >= start && p.d <= end) out.push(p);\n      if (p.d > end) break;\n    }\n    return out;\n  }\n\n  /**\n   * One fill per leg, plus one outline of the whole track.\n   *\n   * @param {Profile} profile A `readProfile` result.\n   * @param {Array<Leg>} legs The route's legs; may be empty.\n   * @param {number} sampleCount N, the length of `slope.angles`.\n   * @param {Box} [box] The user-space box. Defaults to `BOX`.\n   * @returns {{\n   *   legs: Array<{leg: Leg, d: string, climbing: boolean}>,\n   *   outline: string,\n   * }} Empty paths when the profile has no drawable elevation. A leg whose\n   *   stretch holds no elevation at all is left out rather than given an\n   *   empty path.\n   */\n  function legPaths(profile, legs, sampleCount, box) {\n    var b = box || BOX;\n    var empty = { legs: [], outline: '' };\n    if (!profile || !profile.hasElevation || !(profile.distanceM > 0)) return empty;\n    var minEle = /** @type {number} */ (profile.minEle);\n    var maxEle = /** @type {number} */ (profile.maxEle);\n\n    var range = maxEle - minEle;\n    var floor = b.height - PAD_Y;\n    var usable = b.height - PAD_Y * 2;\n    /** @param {number} d */\n    var x = function (d) { return ((d / profile.distanceM) * b.width).toFixed(2); };\n    /** @param {number} e */\n    var y = function (e) {\n      return (range ? floor - ((e - minEle) / range) * usable : b.height / 2).toFixed(2);\n    };\n    /** @param {Array<ProfilePoint>} points */\n    var line = function (points) {\n      return points\n        .map(function (p, i) { return (i === 0 ? 'M' : 'L') + x(p.d) + ' ' + y(p.e); })\n        .join(' ');\n    };\n    /** @param {Array<ProfilePoint>} points */\n    var area = function (points) {\n      var base = floor.toFixed(2);\n      return line(points)\n        + ' L' + x(points[points.length - 1].d) + ' ' + base\n        + ' L' + x(points[0].d) + ' ' + base + ' Z';\n    };\n\n    var drawable = profile.runs.filter(function (run) { return run.length >= 2; });\n    var outline = drawable.map(line).join(' ');\n\n    /** @type {Array<{leg: Leg, d: string, climbing: boolean}>} */\n    var fills = [];\n    if (sampleCount > 0) {\n      (legs || []).forEach(function (leg) {\n        var span = legSpan(leg, sampleCount, profile.distanceM);\n        var pieces = drawable\n          .map(function (run) { return clipRun(run, span[0], span[1]); })\n          .filter(function (piece) { return piece.length >= 2; });\n        if (!pieces.length) return;\n        fills.push({ leg: leg, d: pieces.map(area).join(' '), climbing: !!leg.climbing });\n      });\n    }\n    return { legs: fills, outline: outline };\n  }\n\n  /**\n   * One band per lift ride over the profile (SNOW-994): the fill under the\n   * ride's stretch and the outline along its top, each a path the profile\n   * draws in the lift's teal over the leg fills.\n   *\n   * The rides are wire lift ranges, in the same sample indices as the\n   * legs, so a ride's stretch is `legSpan`'s and its fill is the one\n   * `legPaths` would draw for a leg there.\n   *\n   * @param {Profile} profile A `readProfile` result.\n   * @param {Array<{from: number, to: number}>} lifts The route's rides.\n   * @param {number} sampleCount N, the segments the rides index.\n   * @param {Box} [box] The user-space box. Defaults to `BOX`.\n   * @returns {Array<{d: string, outline: string}>} One per ride with any\n   *   elevation under it; empty with none.\n   */\n  function liftPaths(profile, lifts, sampleCount, box) {\n    var b = box || BOX;\n    if (!Array.isArray(lifts) || !lifts.length || !(sampleCount > 0)) return [];\n    var fills = legPaths(\n      profile,\n      lifts.map(function (lift, i) { return { i: i + 1, from: lift.from, to: lift.to, climbing: true }; }),\n      sampleCount,\n      b,\n    ).legs;\n    if (!fills.length) return [];\n    var minEle = /** @type {number} */ (profile.minEle);\n    var range = /** @type {number} */ (profile.maxEle) - minEle;\n    var floor = b.height - PAD_Y;\n    var usable = b.height - PAD_Y * 2;\n    /** @param {ProfilePoint} p */\n    var point = function (p) {\n      var y = range ? floor - ((p.e - minEle) / range) * usable : b.height / 2;\n      return ((p.d / profile.distanceM) * b.width).toFixed(2) + ' ' + y.toFixed(2);\n    };\n    return fills.map(function (fill) {\n      var span = legSpan(fill.leg, sampleCount, profile.distanceM);\n      var outline = profile.runs\n        .map(function (run) { return clipRun(run, span[0], span[1]); })\n        .filter(function (piece) { return piece.length >= 2; })\n        .map(function (piece) {\n          return piece.map(function (p, i) { return (i === 0 ? 'M' : 'L') + point(p); }).join(' ');\n        })\n        .join(' ');\n      return { d: fill.d, outline: outline };\n    });\n  }\n\n  /**\n   * The profile's elevation at one distance, interpolated between the two\n   * points either side of it.\n   *\n   * @param {Profile} profile A `readProfile` result.\n   * @param {number} d A distance on the profile's own axis.\n   * @returns {?number} Null where the profile has no elevation at `d`.\n   */\n  function elevationAt(profile, d) {\n    if (!profile || !profile.hasElevation) return null;\n    for (var r = 0; r < profile.runs.length; r += 1) {\n      var run = profile.runs[r];\n      for (var i = 1; i < run.length; i += 1) {\n        if (d < run[i - 1].d || d > run[i].d) continue;\n        return between(run[i - 1], run[i], d).e;\n      }\n    }\n    return null;\n  }\n\n  /**\n   * Where the outline sits at one distance, in the lane's user space.\n   *\n   * The y `legPaths` draws at `d` \u2014 where the cursor line meets the\n   * profile, which is where the dot marking the point's elevation sits\n   * (2026-10-02).\n   *\n   * @param {Profile} profile A `readProfile` result.\n   * @param {number} d A distance on the profile's own axis.\n   * @param {Box} [box] The user-space box. Defaults to `BOX`.\n   * @returns {?number} Null where the profile has no elevation at `d`.\n   */\n  function profileY(profile, d, box) {\n    var b = box || BOX;\n    var e = elevationAt(profile, d);\n    if (e === null) return null;\n    var minEle = /** @type {number} */ (profile.minEle);\n    var range = /** @type {number} */ (profile.maxEle) - minEle;\n    var floor = b.height - PAD_Y;\n    var usable = b.height - PAD_Y * 2;\n    return range ? floor - ((e - minEle) / range) * usable : b.height / 2;\n  }\n\n  /**\n   * The elevation of a placed point, as the profile's readout shows it\n   * (2026-10-02): the height the outline is drawn at under the cursor\n   * line, to the nearest metre.\n   *\n   * Read off the profile at the segment's midpoint by share \u2014 where the\n   * cursor line and its dot sit \u2014 so the figure is the height the dot\n   * marks.\n   *\n   * @param {Profile} profile A `readProfile` result.\n   * @param {number} index The segment index.\n   * @param {number} sampleCount The segments the route has.\n   * @param {{m?: string, km?: string}} [units] Label templates carrying\n   *   `%(value)s`, from the partial's strings template.\n   * @returns {?string} Null where the profile has no elevation there.\n   */\n  function pointElevation(profile, index, sampleCount, units) {\n    if (!profile || !Number.isFinite(index) || !(sampleCount > 0)) return null;\n    var e = elevationAt(profile, ((index + 0.5) / sampleCount) * profile.distanceM);\n    if (e === null) return null;\n    var templates = { ...DEFAULT_UNITS, ...(units || {}) };\n    return interpolate(templates.m, { value: String(Math.round(e)) });\n  }\n\n  /**\n   * Whether a press on the lane is on the profile's top line (2026-10-02).\n   *\n   * The target is the outline, loosely: anything within `tolerance` px of\n   * it, above or below, at the press's x. A press lower down, in the\n   * fill near the ticks, is not a reading of the profile and places\n   * nothing \u2014 a finger resting at the foot of the panel should not send\n   * the point somewhere.\n   *\n   * @param {Profile} profile A `readProfile` result.\n   * @param {number} fraction How far along the lane, 0 to 1.\n   * @param {number} offsetY The press's y, px from the lane's top edge.\n   * @param {number} laneHeight The lane's rendered height, px.\n   * @param {number} tolerance How far from the outline still counts, px.\n   * @param {Box} [box] The user-space box. Defaults to `BOX`.\n   * @returns {boolean} False where the profile has no elevation.\n   */\n  function onOutline(profile, fraction, offsetY, laneHeight, tolerance, box) {\n    var b = box || BOX;\n    if (!profile || !(profile.distanceM > 0) || !(laneHeight > 0)) return false;\n    var y = profileY(profile, fraction * profile.distanceM, b);\n    if (y === null) return false;\n    return Math.abs(offsetY - (y / b.height) * laneHeight) <= tolerance;\n  }\n\n  /**\n   * Which side of the cursor line the readout sits on (2026-10-02).\n   *\n   * The right, left-aligned, whenever it fits between the line and the\n   * lane's right edge; otherwise the left, right-aligned, so a point near\n   * the end of the route never has its figures clipped.\n   *\n   * @param {number} x The cursor line's x, px from the lane's left edge.\n   * @param {number} laneWidth The lane's width, px.\n   * @param {number} readoutWidth The wider of the two labels, px.\n   * @param {number} gap The space between the line and the labels, px.\n   * @returns {'right'|'left'}\n   */\n  function readoutSide(x, laneWidth, readoutWidth, gap) {\n    return x + gap + readoutWidth <= laneWidth ? 'right' : 'left';\n  }\n\n  self.pwaRouteRailCore = Object.freeze({\n    niceStep: niceStep,\n    majorStep: majorStep,\n    tickUnit: tickUnit,\n    ticks: ticks,\n    pointDistance: pointDistance,\n    formatDuration: formatDuration,\n    formatMetaLine: formatMetaLine,\n    formatTimeLine: formatTimeLine,\n    eyebrow: eyebrow,\n    stopMarks: stopMarks,\n    stopAt: stopAt,\n    stopIndex: stopIndex,\n    legSpan: legSpan,\n    clipRun: clipRun,\n    legPaths: legPaths,\n    liftPaths: liftPaths,\n    profileY: profileY,\n    pointElevation: pointElevation,\n    onOutline: onOutline,\n    readoutSide: readoutSide,\n    BOX: BOX,\n  });\n})();\n"],
  "mappings": "CAuHC,UAAY,CACX,aAwBA,IAAIA,EAAQ,CAAC,GAAI,GAAI,IAAK,IAAK,IAAK,IAAK,IAAM,IAAM,GAAI,EAGrDC,EAAa,GAWbC,EAAa,CACf,GAAI,IACJ,GAAI,IACJ,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAM,IACN,IAAM,IACN,IAAM,GACR,EAQIC,EAAM,OAAO,OAAO,CAAE,MAAO,IAAM,OAAQ,EAAG,CAAC,EAG/CC,EAAQ,EAORC,EAAuB,EAGvBC,EAAgB,OAAO,OAAO,CAAE,EAAG,cAAe,GAAI,cAAe,CAAC,EAMtEC,EAAoB,OAAO,OAAO,CACpC,UAAW,WACX,YAAa,4DACb,cAAe,mCACf,eAAgB,oCAChB,UAAW,yBACX,gBAAiB,gCACjB,gBAAiB,gCACjB,iBAAkB,4BACpB,CAAC,EAKGC,EAAoB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IAAOC,EAAegC,EAAQ,SAAS,EAC9E,GAAIuC,IAAM,KAAM,OAAO,KACvB,IAAI9E,EAAY,CAAE,GAAGpB,EAAe,GAAIgB,GAAS,CAAC,CAAG,EACrD,OAAOZ,EAAYgB,EAAU,EAAG,CAAE,MAAO,OAAO,KAAK,MAAM8E,CAAC,CAAC,CAAE,CAAC,CAClE,CAmBA,SAASkB,GAAUzD,EAAS0D,EAAUC,EAAShD,EAAYC,EAAWV,EAAK,CACzE,IAAIC,EAAID,GAAOhE,EACf,GAAI,CAAC8D,GAAW,EAAEA,EAAQ,UAAY,IAAM,EAAEW,EAAa,GAAI,MAAO,GACtE,IAAIL,EAAIC,EAASP,EAAS0D,EAAW1D,EAAQ,UAAWG,CAAC,EACzD,OAAIG,IAAM,KAAa,GAChB,KAAK,IAAIqD,EAAWrD,EAAIH,EAAE,OAAUQ,CAAU,GAAKC,CAC5D,CAeA,SAASgD,GAAYnD,EAAGC,EAAWmD,EAAcC,EAAK,CACpD,OAAOrD,EAAIqD,EAAMD,GAAgBnD,EAAY,QAAU,MACzD,CAEA,KAAK,iBAAmB,OAAO,OAAO,CACpC,SAAU5D,EACV,UAAWI,EACX,SAAUC,EACV,MAAOC,EACP,cAAeU,EACf,eAAgBM,EAChB,eAAgBK,EAChB,eAAgBc,EAChB,QAASI,EACT,UAAWI,EACX,OAAQS,EACR,UAAWW,EACX,QAASE,EACT,QAASK,EACT,SAAUK,EACV,UAAWkB,EACX,SAAU1C,EACV,eAAgBiD,GAChB,UAAWC,GACX,YAAaG,GACb,IAAK1H,CACP,CAAC,CACH,GAAG",
  "names": ["STEPS", "MAX_MINORS", "MAJOR_STEP", "BOX", "PAD_Y", "STOP_END_TOLERANCE_M", "DEFAULT_UNITS", "DEFAULT_META_LINE", "DEFAULT_TIME_LINE", "DEFAULT_EYEBROWS", "interpolate", "template", "params", "whole", "name", "niceStep", "spanM", "i", "interior", "majorStep", "tickUnit", "ticks", "units", "step", "major", "unit", "templates", "out", "n", "d", "isMajor", "pointDistance", "index", "sampleCount", "metres", "isKnown", "value", "formatDuration", "seconds", "total", "hours", "minutes", "formatMetaLine", "figures", "strings", "t", "f", "km", "up", "down", "line", "duration", "spell", "sac", "guide", "time", "formatTimeLine", "summary", "moving", "estimate", "eyebrow", "provenance", "p", "day", "stopMarks", "profile", "stops", "box", "b", "marks", "stop", "y", "profileY", "stopAt", "x", "laneWidth", "laneHeight", "tolerance", "best", "bestDistance", "mark", "dx", "dy", "distance", "stopIndex", "at", "legSpan", "leg", "distanceM", "between", "a", "clipRun", "run", "start", "end", "prev", "legPaths", "legs", "empty", "minEle", "maxEle", "range", "floor", "usable", "e", "points", "area", "base", "drawable", "outline", "fills", "span", "pieces", "piece", "liftPaths", "lifts", "lift", "point", "fill", "elevationAt", "r", "pointElevation", "onOutline", "fraction", "offsetY", "readoutSide", "readoutWidth", "gap"]
}
