{
  "version": 3,
  "sources": ["offline_journey_core.js"],
  "sourcesContent": ["// @ts-check\n/*\n * static/js/offline_journey_core.js \u2014 one panel per downloaded area on\n * /offline/: three stages and one verdict (SNOW-1308).\n *\n * The offline report (`offline_audit_core.js`) answers about the app and\n * the map as a whole. What a reader about to lose signal asks is narrower\n * and more useful: *will THIS area work?* So each area the device holds\n * gets a panel above the report, and the panel answers three questions in\n * the order a trip depends on them:\n *\n *   - **The map.** The area's bucket verifies \u2014 its style, TileJSON and\n *     sprite (`areaState`, unchanged, SNOW-843/844), its terrain-class\n *     tiles where it was downloaded with them (SNOW-1138) \u2014 AND its\n *     basemap tiles are all there (`blobFullyCached` over the record's own\n *     tile template and ground, injected as `tiles`). The report never\n *     checked the tiles themselves; a bucket holding its documents and\n *     half its tiles read ready.\n *   - **The conditions.** The bulletins and weather inside the boundary\n *     were fetched today (`areaContentState` is `fresh`). Stale or never\n *     is a No here, not a caveat: the panel's question is whether the area\n *     is ready, and yesterday's bulletin is not. SNOW-1379: an area that\n *     carries the problem-terrain feed (downloaded with terrain tiles, in\n *     a terrain country) adds a \"Problem terrain\" line counting the days\n *     saved, from the urls the last sync stamped (`items.problemTerrain`,\n *     `withProblemTerrain`). SNOW-1387: a day not held makes the stage\n *     No (reason `terrain`), so the area reads \"Needs a refresh\" and Sync\n *     now fetches it again; a line that could not be read makes a Yes\n *     unknown. The stage's own No (stale, never) keeps its reason.\n *   - **User data.** Each trip and pin in the area, by name, Yes only\n *     when every url it needs is in Cache Storage. What \"needs\" means is\n *     stamped on the record by the sync that fetched them\n *     (`stampContentRecord`, `areaItemExpectation`) \u2014 `/api/area-items/`\n *     is never cached, so this page cannot ask offline. No stamp is\n *     unknown, and a signed-out reader gets no stage at all: they have no\n *     things, and an absent stage must not read as a fault.\n *\n *   SNOW-1417: the conditions stage also carries a \"SAC tours\" line (each\n *   tour's Feature and profile in Cache Storage, `toursLine`) and a\n *   \"Community observations\" line (the stamped report ids against the ids the\n *   map's overlay cache holds, which the caller reads and passes as\n *   `readings.reportIds`, `reportsLine`). Either short makes the stage No\n *   (`tours-missing`, `reports-missing`), as a missing problem-terrain day\n *   does.\n *\n * The verdict is one plain line, from `verdictFor`:\n *\n *   - `ready` \u2014 every stage is Yes.\n *   - `open-map` \u2014 the map stage is No. Tiles and documents can only be\n *     fetched where the basemap style is loaded, so the remedy is the\n *     map's Manage downloads sheet, never a tap here.\n *   - `refresh` \u2014 another stage is No; the tap runs Sync now.\n *   - `unknown` \u2014 a stage could not be read and none is No.\n *\n * A reading that could not be taken is unknown, never a Yes and never a\n * No \u2014 the report's rule, kept here.\n *\n * Pure: no DOM and no storage. Every reading arrives as an argument.\n * Reads `pwaOfflineAuditCore` at call time for `areaState`,\n * `areaContentState`, `completableArea` and `chosenAreas`, so the panels\n * and the report cannot disagree about one area.\n *\n * ## The connection panel (SNOW-1415)\n *\n * The header's connection panel asks the same question of every area on\n * every page, where the audit core is not loaded. `base.html` loads this\n * file globally for it. `stagesFromRecord` builds the stages from the\n * stored record alone: the map stage from a `verified` stamp that the\n * tile-capable pages write (`verifiedFromSync` on the map,\n * `verifiedFromStages` on /offline/), the conditions from `contentAt`,\n * and the reader's things from the same stamp. `verdictFor` is unchanged\n * and stays the one verdict. The record-only path never reads the audit\n * core, so it works where that core is absent.\n *\n * ## The Downloads inventory (SNOW-1418)\n *\n * `inventoryFor` lists what one area holds, row by row, for the reveal\n * under its row in the map's Downloads sheet: the map, the bulletin, the\n * weather, the reader's routes, trips and saved places, the SAC tours, the\n * resorts and the community reports. It reads the same stamp as\n * `stagesFromRecord`, and takes what the worker and the overlay cache\n * were read to hold as injected readings (`inventoryUrls` names the urls\n * to ask about).\n */\n\n(function () {\n  'use strict';\n\n  /**\n   * @typedef {'yes'|'no'|'unknown'} StageStatus\n   */\n\n  /**\n   * @typedef {Object} ThingRow\n   * @property {'trip'|'pin'} kind\n   * @property {string} name\n   * @property {StageStatus} status\n   */\n\n  /**\n   * @typedef {Object} TerrainLine\n   * @property {StageStatus} status Yes when every day is held.\n   * @property {number} held The days in Cache Storage.\n   * @property {number} total The days the last sync saved.\n   */\n\n  /**\n   * @typedef {Object} CountLine\n   * @property {StageStatus} status Yes when everything stamped is held.\n   * @property {number} held How many are on the device.\n   * @property {number} total How many the last sync saved.\n   * @property {string|null} [newestAt] Reports only: the newest one's\n   *   observed time (SNOW-1417).\n   */\n\n  /**\n   * @typedef {Object} Stage\n   * @property {StageStatus} status\n   * @property {string} [reason]\n   * @property {ThingRow[]} [rows] User data only.\n   * @property {TerrainLine} [terrain] The conditions stage only (SNOW-1379).\n   * @property {CountLine} [tours] The conditions stage only (SNOW-1417).\n   * @property {CountLine} [reports] The conditions stage only (SNOW-1417).\n   */\n\n  /**\n   * @typedef {Object} Panel\n   * @property {string} id The bucket id.\n   * @property {string} name\n   * @property {'region'|'dropzone'|'custom'} kind\n   * @property {boolean} orphaned\n   * @property {string|null} contentAt\n   * @property {{map: Stage, conditions: Stage, things: Stage|null}} stages\n   * @property {'ready'|'open-map'|'refresh'|'unknown'|'failed'} verdict\n   *   SNOW-1582: 'failed' only for a log-only panel.\n   * @property {boolean} canSync Whether this host can run Sync now for it.\n   * @property {number} bytes The recorded size, 0 where none landed.\n   * @property {DownloadLog|null} [log] SNOW-1582: its last download, and up\n   *   to four before it, from the area's own download log.\n   * @property {boolean} [logOnly] SNOW-1582: an area whose download left a\n   *   log and nothing else on the device \u2014 no record, no bucket \u2014 so its\n   *   panel is the log alone.\n   */\n\n  /**\n   * SNOW-1582: one run of an area's download log, as a panel shows it.\n   *\n   * @typedef {Object} LogRun\n   * @property {string} kind 'region' | 'custom' | 'sync' | 'complete'.\n   * @property {string} outcome 'ok' | 'failed' | 'cancelled' | 'stopped' |\n   *   'running'.\n   * @property {string} startedAt\n   * @property {Array<{stage: string, planned: number, ok: number,\n   *   failed: number, reason: string}>} stages\n   * @property {Array<{stage: string, kind: string, status: (number|null),\n   *   path: string}>} failures Every failure, a stopped run's last.\n   * @property {string} text The run as plain text, for the panel's Copy.\n   */\n\n  /**\n   * @typedef {Object} DownloadLog\n   * @property {LogRun} latest\n   * @property {LogRun[]} earlier Newest first, at most four.\n   */\n\n  // Regions first: a region is what most people download, and the ones\n  // they drew themselves are the exceptions. The order the report's Map\n  // downloads section used, kept.\n  /** @type {Array<'region'|'dropzone'|'custom'>} */\n  var KIND_ORDER = ['region', 'dropzone', 'custom'];\n\n  /**\n   * The audit core, read at call time.\n   *\n   * @returns {any}\n   */\n  function audit() {\n    return self.pwaOfflineAuditCore;\n  }\n\n  /**\n   * Fill ``%(key)s`` placeholders.\n   *\n   * @param {string} template\n   * @param {Record<string, string>} values\n   * @returns {string}\n   */\n  function fill(template, values) {\n    return String(template || '').replace(/%\\((\\w+)\\)s/g, function (_m, key) {\n      return Object.prototype.hasOwnProperty.call(values, key) ? values[key] : '';\n    });\n  }\n\n  /**\n   * Which kind of download a record is.\n   *\n   * @param {any} area\n   * @returns {'region'|'dropzone'|'custom'}\n   */\n  function areaKind(area) {\n    if (area && area.kind === 'region') return 'region';\n    return area && area.type === 'dropzone' ? 'dropzone' : 'custom';\n  }\n\n  /**\n   * The name an area is spoken of by: its stored name, the sheet's\n   * \"Custom area N\" default from its ordinal (SNOW-1133), or its id.\n   *\n   * @param {any} area\n   * @param {Record<string, string>} t\n   * @returns {string}\n   */\n  function areaName(area, t) {\n    if (area.name) return String(area.name);\n    if (typeof area.ordinal === 'number' && Number.isFinite(area.ordinal)) {\n      return fill(t['default-custom-name'] || 'Custom area %(n)s', { n: String(area.ordinal) });\n    }\n    return String(area.id);\n  }\n\n  /**\n   * The ground a record's tiles cover, as the blob `blobFullyCached`\n   * walks.\n   *\n   * A region carries the run's own `z` row spans. A custom area carries\n   * `bbox` + `band`, rebuilt the way it was fetched: a drop zone as its\n   * circle (`circleBlobForBBox`, SNOW-1136), a framed box as `buildBlob`.\n   *\n   * @param {any} area\n   * @param {any} download `pwaBasemapDownloadCore`.\n   * @returns {any} Null where the record names no ground.\n   */\n  function areaBlob(area, download) {\n    if (area.z) return { z: area.z };\n    var band = Array.isArray(area.band) ? area.band : null;\n    if (!Array.isArray(area.bbox) || !band) return null;\n    if (area.type === 'dropzone' && typeof download.circleBlobForBBox === 'function') {\n      return download.circleBlobForBBox(area.bbox, band[0], band[1]);\n    }\n    if (typeof download.buildBlob !== 'function') return null;\n    return download.buildBlob(area.bbox, band[0], band[1]);\n  }\n\n  /**\n   * Whether every basemap tile an area's ground implies is in its bucket.\n   *\n   * The reading is injected \u2014 `download` is `pwaBasemapDownloadCore`,\n   * passed by the caller \u2014 because static/offline.html loads no such core\n   * and this module stays pure. Unknown (null) for: no core, a bucket that\n   * did not answer, a record naming no tile template or no ground, or any\n   * throw. Never a No drawn from a reading that was not taken.\n   *\n   * @param {any} area An audit area reading.\n   * @param {any} download `pwaBasemapDownloadCore`, or null.\n   * @returns {boolean|null}\n   */\n  function tileReading(area, download) {\n    if (!area || !download || typeof download.blobFullyCached !== 'function') return null;\n    if (area.bucketReadable === false || area.orphaned) return null;\n    // SNOW-1478: every map the area holds, primary first; a record before\n    // that ticket reads as one, from its own `template`.\n    var templates =\n      typeof download.recordBasemaps === 'function'\n        ? download\n            .recordBasemaps(area)\n            .map(function (/** @type {any} */ entry) {\n              return entry.template;\n            })\n            .filter(Boolean)\n        : area.template\n          ? [area.template]\n          : [];\n    if (templates.length === 0) return null;\n    try {\n      var blob = areaBlob(area, download);\n      if (!blob) return null;\n      return templates.every(function (/** @type {any} */ template) {\n        return !!download.blobFullyCached(template, blob, area.entries || []);\n      });\n    } catch (_err) {\n      return null;\n    }\n  }\n\n  /**\n   * The map stage: the bucket verifies AND its tiles are all there.\n   *\n   * @param {any} area\n   * @param {boolean|null|undefined} tiles From `tileReading`.\n   * @returns {Stage}\n   */\n  function mapStage(area, tiles) {\n    var core = audit();\n    if (!core) return { status: 'unknown' };\n    var state = core.areaState(area).status;\n    if (state === 'ready') {\n      if (tiles === true) return { status: 'yes' };\n      if (tiles === false) return { status: 'no', reason: 'tiles' };\n      return { status: 'unknown', reason: 'tiles-unread' };\n    }\n    if (state === 'unreadable' || state === 'unverifiable') {\n      return { status: 'unknown', reason: state };\n    }\n    // `orphaned`, `incomplete`, `missing`.\n    return { status: 'no', reason: state };\n  }\n\n  /**\n   * The conditions stage: today's bulletins and weather are here.\n   *\n   * @param {any} area\n   * @param {string} [now]\n   * @returns {Stage}\n   */\n  function conditionsStage(area, now) {\n    var core = audit();\n    if (!core) return { status: 'unknown' };\n    var content = core.areaContentState(area, now);\n    if (content === 'fresh') return { status: 'yes' };\n    if (content === 'stale') return { status: 'no', reason: 'stale' };\n    if (content === 'never') return { status: 'no', reason: 'never' };\n    // `none`: the tiles do not verify (the map stage already says so) or\n    // an unparseable stamp. Neither is evidence about the content.\n    return { status: 'unknown' };\n  }\n\n  /**\n   * Whether a reader is signed in, from the account the device's queue is\n   * set for (`mutations.principal`, null when signed out).\n   *\n   * @param {any} readings\n   * @returns {boolean}\n   */\n  function isSignedIn(readings) {\n    var p = readings && readings.currentPrincipal;\n    return typeof p === 'string' && p !== '' && p !== 'anonymous' && p !== 'unknown';\n  }\n\n  /**\n   * Every url the shell cache holds, or null where it could not be read.\n   *\n   * @param {any} readings\n   * @returns {Map<string, any>|null} By url, each to its entry.\n   */\n  function shellUrls(readings) {\n    if (!readings || readings.cachesReadable === false || readings.failure) return null;\n    /** @type {Map<string, any>} */\n    var urls = new Map();\n    (Array.isArray(readings.shellEntries) ? readings.shellEntries : []).forEach(\n      /** @param {any} entry */ function (entry) {\n        if (entry && entry.url) urls.set(entry.url, entry);\n      },\n    );\n    return urls;\n  }\n\n  /**\n   * Whether one of your things' urls will open offline for this reader.\n   *\n   * Presence is not enough for the principal-scoped families \u2014 a trip page,\n   * its route, a pin's place sheet (`isPrincipalScoped`): the worker\n   * serves those only under a matching `X-SW-Principal`\n   * (`_principalMatches`), so one cached for another account is a No. A\n   * stamp whose read did not come back is unknown. Public weather sheets\n   * need only be there (SNOW-1308 review).\n   *\n   * @param {string} url Absolute.\n   * @param {Map<string, any>} held\n   * @param {string|null} principal\n   * @returns {StageStatus}\n   */\n  function urlState(url, held, principal) {\n    var entry = held.get(url);\n    if (!entry) return 'no';\n    var core = audit();\n    if (!core || typeof core.isPrincipalScoped !== 'function') return 'unknown';\n    if (!core.isPrincipalScoped(url)) return 'yes';\n    if (entry.stampUnread) return 'unknown';\n    return core.principalMatches(entry.principal, principal) ? 'yes' : 'no';\n  }\n\n  /**\n   * One url as the cache keys it \u2014 absolute, on this origin.\n   *\n   * @param {string} url\n   * @param {string} origin\n   * @returns {string}\n   */\n  function absolute(url, origin) {\n    try {\n      return new URL(url, origin || 'http://localhost').toString();\n    } catch (_err) {\n      return url;\n    }\n  }\n\n  /**\n   * The conditions stage's \"Problem terrain\" line: how many of the days\n   * the last sync saved are in Cache Storage (SNOW-1379).\n   *\n   * Only for an area that carries the feed: one downloaded with terrain\n   * tiles (`area.terrain`) whose last sync stamped a non-empty\n   * `items.problemTerrain` \u2014 the stamp is empty for an area outside the\n   * terrain countries, and absent for one not synced since this ticket.\n   * The feed is public, so presence is enough (`urlState`). A cache that\n   * could not be read counts nothing and is unknown.\n   *\n   * @param {any} area\n   * @param {{urls: Map<string, any>|null, origin: string,\n   *   principal?: string|null}} ctx\n   * @returns {TerrainLine|null} Null where the area carries no feed.\n   */\n  function problemTerrainLine(area, ctx) {\n    if (!area || !area.terrain) return null;\n    var stamped = area.items && area.items.problemTerrain;\n    if (!Array.isArray(stamped) || stamped.length === 0) return null;\n    var total = stamped.length;\n    if (!ctx.urls) return { status: 'unknown', held: 0, total: total };\n    var held = /** @type {Map<string, any>} */ (ctx.urls);\n    var count = stamped.filter(function (/** @type {string} */ url) {\n      return urlState(absolute(url, ctx.origin), held, ctx.principal || null) === 'yes';\n    }).length;\n    return { status: count === total ? 'yes' : 'no', held: count, total: total };\n  }\n\n  /**\n   * The conditions stage's \"SAC tours\" line: how many of the tours the\n   * last sync saved will open offline (SNOW-1417).\n   *\n   * A tour opens when its Feature and its height profile are both in\n   * Cache Storage. Public, so presence is enough (`urlState`). Null where\n   * the last sync stamped no tours: an area with none, or one not synced\n   * since this ticket, or a page without the ski-touring layer.\n   *\n   * @param {any} area\n   * @param {{urls: Map<string, any>|null, origin: string,\n   *   principal?: string|null}} ctx\n   * @returns {CountLine|null}\n   */\n  function toursLine(area, ctx) {\n    var stamped = area && area.items && area.items.tours;\n    if (!Array.isArray(stamped) || stamped.length === 0) return null;\n    var total = stamped.length;\n    if (!ctx.urls) return { status: 'unknown', held: 0, total: total };\n    var held = /** @type {Map<string, any>} */ (ctx.urls);\n    var count = stamped.filter(function (/** @type {any} */ tour) {\n      var urls = tour && Array.isArray(tour.urls) ? tour.urls : [];\n      return urls.length > 0 && urls.every(function (/** @type {string} */ url) {\n        return urlState(absolute(url, ctx.origin), held, ctx.principal || null) === 'yes';\n      });\n    }).length;\n    return { status: count === total ? 'yes' : 'no', held: count, total: total };\n  }\n\n  /**\n   * The conditions stage's \"Community observations\" line: how many of the\n   * reports inside the area the last sync saved are in the map's overlay\n   * cache (SNOW-1417).\n   *\n   * Reports are not in Cache Storage: the map keeps the whole feed in\n   * IndexedDB (`pwaMapOverlayCache`), so the caller reads it and passes\n   * the ids it holds. Null where the last sync stamped no reports field;\n   * an empty stamp is a Yes with nothing to count.\n   *\n   * @param {any} area\n   * @param {Set<string>|null|undefined} ids The report ids the overlay\n   *   cache holds, or null when it could not be read.\n   * @returns {CountLine|null}\n   */\n  function reportsLine(area, ids) {\n    var items = area && area.items;\n    var stamped = items && items.reports;\n    if (!Array.isArray(stamped)) return null;\n    var total = stamped.length;\n    var newestAt = typeof items.reportsNewestAt === 'string' ? items.reportsNewestAt : null;\n    if (!ids) return { status: 'unknown', held: 0, total: total, newestAt: newestAt };\n    var have = /** @type {Set<string>} */ (ids);\n    var count = stamped.filter(function (/** @type {any} */ report) {\n      return !!report && have.has(String(report.id));\n    }).length;\n    return { status: count === total ? 'yes' : 'no', held: count, total: total, newestAt: newestAt };\n  }\n\n  /**\n   * The \"User data\" stage: each trip and pin, Yes only when every url\n   * it needs is cached.\n   *\n   * @param {any} area\n   * @param {{signedIn: boolean, urls: Map<string, any>|null, origin: string,\n   *   principal?: string|null}} ctx\n   * @returns {Stage|null} Null for a signed-out reader: no stage at all.\n   */\n  function thingsStage(area, ctx) {\n    if (!ctx.signedIn) return null;\n    var items = area.items;\n    if (!items || !Array.isArray(items.trips) || !Array.isArray(items.pins)) {\n      return { status: 'unknown', reason: 'unrecorded', rows: [] };\n    }\n    // SNOW-1308 review: the names were written by whoever SYNCED, which\n    // need not be the area's downloader (`area.principal`) \u2014 another\n    // account signed in on this device can press Sync now. So the guard is\n    // the principal stamped with the items, and nothing is named unless it\n    // is this reader's: a missing, empty or different stamp is unknown.\n    var stamped = typeof items.principal === 'string' ? items.principal : '';\n    if (!stamped || stamped !== ctx.principal) {\n      return { status: 'unknown', reason: 'other-account', rows: [] };\n    }\n    /** @type {ThingRow[]} */\n    var rows = [];\n    /**\n     * @param {'trip'|'pin'} kind\n     * @param {any} item\n     */\n    var add = function (kind, item) {\n      if (!item) return;\n      var urls = Array.isArray(item.urls) ? item.urls : [];\n      /** @type {StageStatus} */\n      var status = 'unknown';\n      if (urls.length > 0 && ctx.urls) {\n        var held = /** @type {Map<string, any>} */ (ctx.urls);\n        var states = urls.map(function (/** @type {string} */ url) {\n          return urlState(absolute(url, ctx.origin), held, ctx.principal || null);\n        });\n        status =\n          states.indexOf('no') >= 0 ? 'no' : states.indexOf('unknown') >= 0 ? 'unknown' : 'yes';\n      }\n      rows.push({ kind: kind, name: typeof item.name === 'string' ? item.name : '', status: status });\n    };\n    items.trips.forEach(function (/** @type {any} */ trip) {\n      add('trip', trip);\n    });\n    items.pins.forEach(function (/** @type {any} */ pin) {\n      add('pin', pin);\n    });\n    if (rows.length === 0) return { status: 'yes', reason: 'none-here', rows: rows };\n    var statuses = rows.map(function (row) {\n      return row.status;\n    });\n    if (statuses.indexOf('no') >= 0) return { status: 'no', rows: rows };\n    if (statuses.indexOf('unknown') >= 0) return { status: 'unknown', rows: rows };\n    return { status: 'yes', rows: rows };\n  }\n\n  /**\n   * The one line a panel leads with.\n   *\n   * A map No outranks every other answer, because its remedy is somewhere\n   * else: tiles can only be fetched where the style is loaded. Any other\n   * No outranks an unknown, because the tap that fixes it is right here.\n   *\n   * SNOW-1583: stages read from a stored record carry the area's\n   * `outcome`, and it decides: `complete` is ready (green), `usable` \u2014\n   * the map is on the device, something else is not \u2014 is refresh\n   * (amber), and `unusable` \u2014 the map is not whole, so the area does not\n   * work offline yet \u2014 is open-map (red).\n   *\n   * @param {{map: Stage, conditions: Stage, things: Stage|null,\n   *   outcome?: ('complete'|'usable'|'unusable'|null)}} stages\n   * @returns {'ready'|'open-map'|'refresh'|'unknown'}\n   */\n  function verdictFor(stages) {\n    if (stages.outcome === 'complete') return 'ready';\n    if (stages.outcome === 'usable') return 'refresh';\n    if (stages.outcome === 'unusable') return 'open-map';\n    var list = [stages.map, stages.conditions];\n    if (stages.things) list.push(stages.things);\n    // SNOW-1483: a map missing only its terrain data is one Sync mends\n    // (it fetches the terrain tiles alone), so the tap is right here.\n    if (stages.map.status === 'no' && stages.map.reason !== 'terrain') return 'open-map';\n    var any = /** @param {StageStatus} status */ function (status) {\n      return list.some(function (stage) {\n        return stage.status === status;\n      });\n    };\n    if (any('no')) return 'refresh';\n    if (any('unknown')) return 'unknown';\n    return 'ready';\n  }\n\n  /**\n   * A \"tap to fix\" verdict only where a tap can fix it.\n   *\n   * Sync now needs an area whose tiles verify (`completableArea`); one\n   * whose map stage could not be read, with another stage No, would\n   * otherwise promise a tap that is never offered. It reads \"Can't tell\"\n   * instead (SNOW-1308 review).\n   *\n   * @param {'ready'|'open-map'|'refresh'|'unknown'} verdict\n   * @param {boolean} completable\n   * @returns {'ready'|'open-map'|'refresh'|'unknown'}\n   */\n  function tapCanFix(verdict, completable) {\n    return verdict === 'refresh' && !completable ? 'unknown' : verdict;\n  }\n\n  /**\n   * A stage with its \"Problem terrain\" line, where the area has one, and\n   * the line folded into the stage's answer (SNOW-1387, Hugo 2 Nov 2026):\n   * an area missing a day of the bulletin's slopes is not ready for\n   * offline, so a No line makes the stage No and the verdict \"Needs a\n   * refresh\". The stage's own No outranks it and keeps its reason (the\n   * bulletins themselves are stale, which the note says); an unread line\n   * makes a Yes unknown, never a Yes. A `terrain` reason has no note of\n   * its own: the line under the stage already says how many days are\n   * saved.\n   *\n   * @param {Stage} stage\n   * @param {TerrainLine|null} line\n   * @returns {Stage}\n   */\n  function withTerrainLine(stage, line) {\n    if (!line) return stage;\n    var out = Object.assign({}, stage, { terrain: line });\n    if (stage.status === 'no') return out;\n    if (line.status === 'no') return Object.assign(out, { status: 'no', reason: 'terrain' });\n    if (line.status === 'unknown' && stage.status === 'yes') {\n      return Object.assign(out, { status: 'unknown' });\n    }\n    return out;\n  }\n\n  /**\n   * A stage with a tours or reports line folded in (SNOW-1417), by the\n   * same rule as the problem-terrain line (`withTerrainLine`): a No line\n   * makes a stage that is not already No say No with the line's reason;\n   * an unread line makes a Yes unknown.\n   *\n   * @param {Stage} stage\n   * @param {'tours'|'reports'} key\n   * @param {CountLine|null} line\n   * @param {string} reason `tours-missing` or `reports-missing`.\n   * @returns {Stage}\n   */\n  function withCountLine(stage, key, line, reason) {\n    if (!line) return stage;\n    /** @type {Stage} */\n    var out = Object.assign({}, stage);\n    out[key] = line;\n    if (stage.status === 'no') return out;\n    if (line.status === 'no') return Object.assign(out, { status: 'no', reason: reason });\n    if (line.status === 'unknown' && stage.status === 'yes') {\n      return Object.assign(out, { status: 'unknown' });\n    }\n    return out;\n  }\n\n  /**\n   * @typedef {Object} Verified\n   * @property {'yes'|'no'|null} [map] Whether the area's tiles verified.\n   * @property {'yes'|'no'|null} [content] Whether everything the area's\n   *   content plan named, the reader's own things included, landed.\n   * @property {string} [reason] Why the map is No, where it is.\n   * @property {string} [principal] The account the content answer was\n   *   read for (the `pwa-user-id` meta). A content answer is only ever\n   *   shown back to that account.\n   * @property {string} at When the reading was taken (ISO).\n   * @property {Array<SyncStep>} [steps] SNOW-1487: the steps the last sync\n   *   did not finish, failed ones only. Absent when it finished them all.\n   * @property {Array<string>} [ran] SNOW-1487 review: the stages the sync\n   *   reached, by step name \u2014 only these replace their step. Read by\n   *   `stampVerifiedRecord`, never stored.\n   * @property {boolean} [cancelled] SNOW-1487 review: the sync was\n   *   stopped, so the stamp does not move `at`. Never stored.\n   */\n\n  /**\n   * SNOW-1487: one step a sync did not finish \u2014 `syncArea`'s, as stamped.\n   *\n   * @typedef {Object} SyncStep\n   * @property {'basemap'|'terrain'|'deps'|'content'} step\n   * @property {'network'|'interrupted'|'budget'|'quota'|'plan'} reason\n   * @property {number} [done]\n   * @property {number} [total]\n   * @property {number} [neededMb]\n   * @property {number|null} [freeMb]\n   */\n\n  /**\n   * SNOW-1487: the steps a stamp carries, narrowed to well-formed ones.\n   *\n   * @param {unknown} steps\n   * @returns {Array<SyncStep>}\n   */\n  function stepsOf(steps) {\n    if (!Array.isArray(steps)) return [];\n    return steps.filter(function (/** @type {any} */ entry) {\n      return !!entry && typeof entry.step === 'string' && typeof entry.reason === 'string';\n    });\n  }\n\n  /**\n   * SNOW-1487: whether a record's last sync failed to ADD a map or its\n   * terrain data \u2014 a step the verdict never reads\n   * (docs/decisions/a-failed-addition-never-hides-a-working-map.md).\n   *\n   * @param {any} record\n   * @param {'basemap'|'terrain'} step\n   * @returns {boolean}\n   */\n  function additionFailed(record, step) {\n    var v = record && record.verified && typeof record.verified === 'object' ? record.verified : null;\n    return stepsOf(v && v.steps).some(function (entry) {\n      return entry.step === step;\n    });\n  }\n\n  /**\n   * One stamp answer, narrowed: only Yes and No are claims.\n   *\n   * @param {unknown} value\n   * @returns {'yes'|'no'|null}\n   */\n  function answer(value) {\n    return value === 'yes' || value === 'no' ? value : null;\n  }\n\n  /**\n   * SNOW-1415: what one map-page sync learned, as a `verified` stamp.\n   *\n   * `syncArea`'s `tiles` is the map half. `'ok'` and `'none'` say only\n   * that the render dependencies are established\n   * (docs/decisions/a-pre-departure-sync-is-unconditional.md), so a Yes\n   * also needs `tilesHeld === true`: every tile of the area's grid is in\n   * its bucket (`tileReading`). `tilesHeld === false` is a No for the\n   * tiles; null is no reading, and leaves the map answer as it was.\n   * `'absent'`, `'failed'` and `'incomplete'` are No, and `'unknown'` is\n   * no claim at all. `content` is the content half's own answer, stamped\n   * for `principal` and only when there is one (a signed-out sync has no\n   * things of its own to answer for).\n   *\n   * SNOW-1487: the sync's `steps`, the ones it did not finish, are copied\n   * on, and an empty list is a claim too: it clears the last sync's. A\n   * `content` that is neither true nor false (a sync stopped before it\n   * read the content) stamps no content answer. SNOW-1487 review: the\n   * stages it reached (`ran`) and whether it was stopped (`cancelled`)\n   * ride along for `stampVerifiedRecord`.\n   *\n   * @param {{tiles?: string, tilesHeld?: boolean|null, content?: boolean,\n   *   steps?: Array<SyncStep>, ran?: Array<string>,\n   *   cancelled?: boolean}|null|undefined} result\n   * @param {string} at\n   * @param {string} [principal] The `pwa-user-id` the sync ran as.\n   * @returns {Verified|null} Null when the sync claimed nothing.\n   */\n  function verifiedFromSync(result, at, principal) {\n    if (!result) return null;\n    /** @type {Verified} */\n    var out = { at: at };\n    var depsOk = result.tiles === 'ok' || result.tiles === 'none';\n    if (depsOk && result.tilesHeld === true) out.map = 'yes';\n    else if (depsOk && result.tilesHeld === false) {\n      out.map = 'no';\n      out.reason = 'tiles';\n    } else if (\n      result.tiles === 'absent' ||\n      result.tiles === 'failed' ||\n      result.tiles === 'incomplete'\n    ) {\n      out.map = 'no';\n      out.reason = result.tiles === 'incomplete' ? 'tiles' : result.tiles;\n    }\n    // An absent bucket is never fetched into, so its content answer is\n    // no reading of the content at all.\n    if (result.tiles !== 'absent' && principal && typeof result.content === 'boolean') {\n      out.content = result.content ? 'yes' : 'no';\n      out.principal = principal;\n    }\n    var steps = Array.isArray(result.steps) ? stepsOf(result.steps) : null;\n    if (steps) out.steps = steps;\n    if (Array.isArray(result.ran)) {\n      out.ran = result.ran.filter(function (name) {\n        return typeof name === 'string';\n      });\n    }\n    if (result.cancelled) out.cancelled = true;\n    return out.map || out.content || steps ? out : null;\n  }\n\n  /**\n   * SNOW-1415: what one /offline/ panel read, as a `verified` stamp.\n   *\n   * The panel's map stage is the full reading (bucket and tiles); its\n   * things stage is the cache walk over the urls the last sync stamped.\n   * Unknown stages claim nothing, so a host that cannot read tiles\n   * (static/offline.html) never overwrites what the map page learned.\n   *\n   * @param {{map: Stage, things: Stage|null}} stages\n   * @param {string} at\n   * @param {string} [principal] The `pwa-user-id` the page was rendered\n   *   for. With none, the things answer is not stamped.\n   * @returns {Verified|null}\n   */\n  function verifiedFromStages(stages, at, principal) {\n    if (!stages) return null;\n    /** @type {Verified} */\n    var out = { at: at };\n    var map = stages.map ? answer(stages.map.status) : null;\n    if (map) out.map = map;\n    if (map === 'no' && stages.map.reason) out.reason = stages.map.reason;\n    var things = stages.things ? answer(stages.things.status) : null;\n    if (things && principal) {\n      out.content = things;\n      out.principal = principal;\n    }\n    return out.map || out.content ? out : null;\n  }\n\n  /**\n   * SNOW-1415: one record with a `verified` stamp merged in.\n   *\n   * Merged field by field, so a reading that claims only the content (a\n   * map-page sync that could not judge the tiles) keeps the map answer an\n   * earlier reading gave. A map Yes drops a stale map-No reason.\n   *\n   * SNOW-1487 review: `at` is when a reading last finished, which the\n   * Downloads sheet's \"Last synced\" line reads, so a stopped sync\n   * (`cancelled`) leaves it where it was. And a sync that names the stages\n   * it reached (`ran`) replaces only their steps: the last sync's step for\n   * a stage this one never started is kept.\n   *\n   * Synchronous, because every caller runs it inside a `readModifyWrite`\n   * mutator, which must not await. Device-only: `downloads_sync.js` sends\n   * a whitelist of fields, and this is not one of them.\n   *\n   * @param {any} entry The stored record.\n   * @param {Verified|null} verified\n   * @returns {any} A new record, or the entry itself when there is nothing\n   *   to stamp.\n   */\n  function stampVerifiedRecord(entry, verified) {\n    if (!entry || !verified) return entry;\n    var prior = entry.verified && typeof entry.verified === 'object' ? entry.verified : {};\n    var next = Object.assign({}, prior);\n    if (!verified.cancelled) next.at = verified.at;\n    if (verified.map) {\n      next.map = verified.map;\n      if (verified.map === 'no' && verified.reason) next.reason = verified.reason;\n      else delete next.reason;\n    }\n    if (verified.content) {\n      next.content = verified.content;\n      next.principal = verified.principal || '';\n    }\n    // SNOW-1487: the last sync's steps replace the one before's; a sync\n    // that finished them all clears them.\n    if (Array.isArray(verified.steps)) {\n      var ran = verified.ran;\n      var kept = Array.isArray(ran)\n        ? stepsOf(prior.steps).filter(function (entry) {\n            return /** @type {Array<string>} */ (ran).indexOf(entry.step) < 0;\n          })\n        : [];\n      var steps = kept.concat(verified.steps);\n      if (steps.length) next.steps = steps;\n      else delete next.steps;\n    }\n    return Object.assign({}, entry, { verified: next });\n  }\n\n  /**\n   * SNOW-1415: the stages of one area from its stored record alone.\n   *\n   * The connection panel runs on every page, where neither the audit's\n   * readings nor the tile arithmetic exist. So the pages that CAN read\n   * them stamp what they learned on the record (`verified`, from\n   * `verifiedFromSync` and `verifiedFromStages`), and every other page\n   * reads the stamp back through here. `verdictFor` then gives the same\n   * one-line answer the /offline/ panels give.\n   *\n   *   - **map** \u2014 the stamp's map answer. No stamp is unknown, which is\n   *     the honest answer for a record no tile-capable page has read.\n   *   - **conditions** \u2014 the record's own `contentAt`, by calendar day,\n   *     as `areaContentState` reads it; a fetch that fell short\n   *     (`contentIncomplete`) makes a fresh stamp No.\n   *   - **things** \u2014 the stamp's content answer, signed-in readers only,\n   *     and only when it was read for this reader's account\n   *     (`verified.principal`). Another account's answer is unknown here,\n   *     as `thingsStage` treats another account's items on /offline/.\n   *\n   * SNOW-1483: `terrainExpected` is whether this area should hold the\n   * terrain-class tiles (the page fetches terrain data and the area's\n   * ground meets their coverage). With it set, a record saved without\n   * `terrain` has a map stage of No, reason `terrain`, in place of a Yes,\n   * so the dot agrees with the inventory's Terrain row. A map No or\n   * unknown keeps its own answer. 3D (elevation) is never read.\n   *\n   * SNOW-1487: the steps a sync did not finish (`verified.steps`) are not\n   * read for the map or the verdict when they are ADDITIONS (`basemap`,\n   * `terrain`): a failed addition never hides a working map. A missing\n   * render dependency or a short content fetch already shows in the map\n   * and conditions answers.\n   *\n   * SNOW-1583: and the area's `outcome` (`outcomeFor`) \u2014 the record's\n   * own, or for a record written before it, the legacy reading over the\n   * probes the caller took (`depsMissing`, `swissMissing`) \u2014 which\n   * `verdictFor` reads first.\n   *\n   * @param {any} record A `basemap.regions` or `basemap.customAreas` row.\n   * @param {string|Date} [now]\n   * @param {{signedIn?: boolean, principal?: string, terrainExpected?: boolean,\n   *   depsMissing?: boolean, swissMissing?: boolean, partsMissing?: boolean}} [options]\n   * @returns {{map: Stage, conditions: Stage, things: Stage|null,\n   *   outcome: ('complete'|'usable'|'unusable'|null)}}\n   */\n  function stagesFromRecord(record, now, options) {\n    var opts = options || {};\n    var r = record || {};\n    var v = r.verified && typeof r.verified === 'object' ? r.verified : null;\n\n    /** @type {Stage} */\n    var map = { status: 'unknown', reason: 'unverified' };\n    var mapAnswer = v ? answer(v.map) : null;\n    if (mapAnswer === 'yes') map = { status: 'yes' };\n    else if (mapAnswer === 'no') map = { status: 'no', reason: String(v.reason || 'tiles') };\n    // SNOW-1487: a sync that tried to add the terrain data and failed has\n    // a notice of its own under the row, which says why and what to do;\n    // the map it holds still draws, so the dot stays as the map reads.\n    if (map.status === 'yes' && opts.terrainExpected && !r.terrain && !additionFailed(r, 'terrain')) {\n      map = { status: 'no', reason: 'terrain' };\n    }\n\n    /** @type {Stage} */\n    var conditions;\n    if (!r.contentAt) {\n      conditions = { status: 'no', reason: 'never' };\n    } else {\n      var fetched = new Date(r.contentAt);\n      var today = now ? new Date(now) : new Date();\n      if (Number.isNaN(fetched.getTime()) || Number.isNaN(today.getTime())) {\n        conditions = { status: 'unknown' };\n      } else if (fetched.toDateString() !== today.toDateString()) {\n        conditions = { status: 'no', reason: 'stale' };\n      } else if (r.contentIncomplete) {\n        conditions = { status: 'no', reason: 'incomplete' };\n      } else {\n        conditions = { status: 'yes' };\n      }\n    }\n\n    /** @type {Stage|null} */\n    var things = null;\n    if (opts.signedIn) {\n      var ours = !!(v && opts.principal && v.principal === opts.principal);\n      var contentAnswer = ours ? answer(v.content) : null;\n      if (contentAnswer === 'yes') things = { status: 'yes', rows: [] };\n      else if (contentAnswer === 'no') things = { status: 'no', reason: 'incomplete', rows: [] };\n      else things = { status: 'unknown', rows: [] };\n    }\n    // SNOW-1583: missing terrain is missing however the last sync went \u2014\n    // a failed addition leaves the area amber, not green.\n    var outcome = outcomeFor(r, {\n      depsMissing: !!opts.depsMissing,\n      swissMissing: !!opts.swissMissing,\n      terrainMissing: !!opts.terrainExpected && !r.terrain,\n      partsMissing: !!opts.partsMissing,\n    });\n    return { map: map, conditions: conditions, things: things, outcome: outcome };\n  }\n\n  /**\n   * SNOW-1583: what a stored area holds, as one of three outcomes \u2014 the\n   * record's own `outcome`, or for a record written before it, the legacy\n   * reading over the probes the caller took. Both are\n   * `pwaBasemapDownloadCore.recordOutcome`'s, read at call time; a page\n   * without that core (the connection panel on every page) reads only an\n   * outcome the record stores, and null otherwise, so the stages decide.\n   *\n   * @param {any} record\n   * @param {{depsMissing?: boolean, tilesHeld?: (boolean|null),\n   *   terrainMissing?: boolean, swissMissing?: boolean, partsMissing?: boolean}} [probes]\n   * @returns {'complete'|'usable'|'unusable'|null}\n   */\n  function outcomeFor(record, probes) {\n    var download = /** @type {any} */ (self).pwaBasemapDownloadCore;\n    if (download && typeof download.recordOutcome === 'function') {\n      return download.recordOutcome(record, probes);\n    }\n    var stored = record && record.outcome;\n    return stored === 'complete' || stored === 'usable' || stored === 'unusable' ? stored : null;\n  }\n\n  /**\n   * @typedef {'yes'|'missing'|'unknown'} InventoryStatus\n   */\n\n  /**\n   * @typedef {Object} InventoryRow\n   * @property {'map'|'swiss'|'terrain'|'boundaries'|'bulletin'|'weather'|'routes'|'trips'|'places'|'tours'|'resorts'|'reports'} key\n   * @property {InventoryStatus} status SNOW-1583: a tick (`yes`) or\n   *   `missing`; `unknown` only where nothing could be read.\n   * @property {number} [count] A count row's stamped total.\n   * @property {string} [at] The bulletin and weather rows: `contentAt`.\n   */\n\n  /**\n   * One stage status as an inventory status: a Yes is on the device, a No\n   * is missing.\n   *\n   * @param {Stage|null} stage\n   * @returns {InventoryStatus}\n   */\n  function fromStage(stage) {\n    if (!stage) return 'unknown';\n    if (stage.status === 'yes') return 'yes';\n    if (stage.status === 'no') return 'missing';\n    return 'unknown';\n  }\n\n  /**\n   * A count row's status from what the device was read to hold.\n   *\n   * Yes when every stamped thing is held, missing when one is not. Where\n   * nothing was read (`check` answers null), the row follows its stage,\n   * so it never says Missing on a reading it did not take.\n   *\n   * @param {any[]} stamped\n   * @param {function(any): (boolean|null)} check Held, not held, or unread.\n   * @param {InventoryStatus} fallback\n   * @returns {InventoryStatus}\n   */\n  function countStatus(stamped, check, fallback) {\n    var unread = false;\n    for (var i = 0; i < stamped.length; i++) {\n      var held = check(stamped[i]);\n      if (held === false) return 'missing';\n      if (held === null) unread = true;\n    }\n    return unread ? fallback : 'yes';\n  }\n\n  /**\n   * SNOW-1418: what one downloaded area holds, row by row \u2014 the inventory\n   * the Downloads sheet reveals under an area's row.\n   *\n   * SNOW-1583: the map and each other part, each a tick or Missing. A\n   * record with `parts` (`outcome`'s counts) says which parts its runs\n   * could not fetch, and such a part is Missing whatever else is read; a\n   * legacy record reads from its stamp, as before. The map, the region\n   * boundaries, the bulletin and the weather rows are always there. The\n   * bulletin and weather are on the device once a run fetched them whole\n   * (`contentAt` without `contentIncomplete` on a legacy record), however\n   * old: the date beside them says how old.\n   *\n   * A count row is there only when the last sync stamped its field, so a\n   * record synced before its field existed lists less rather than a zero\n   * it never counted. Routes, trips and saved places are the reader's\n   * own: shown only signed in, and only when the account that stamped them\n   * (`items.principal`) is this reader's. Saved places only when the area\n   * has some.\n   *\n   * The readings are optional and injected by the caller: `held`, the\n   * absolute urls the worker said it would serve offline (SNOW-1416's\n   * `held-content`), and `overlayIds`, the route and report ids the\n   * map's overlay cache holds. Absent or null, a row follows its stage.\n   * `terrainAvailable` adds the terrain row. SNOW-1487: it reads its own\n   * state, never the map's: missing when the area was saved without\n   * terrain data, and otherwise `terrainHeld` \u2014 whether every terrain\n   * tile the record implies is in its bucket (unknown when unread).\n   * `swissMissing` adds the \"Swiss map\" row, missing, for an area whose\n   * ground wants the Swisstopo map it does not hold yet: the next sync\n   * adds it.\n   *\n   * @param {any} record A `basemap.regions` or `basemap.customAreas` row.\n   * @param {string|Date} [now]\n   * @param {{signedIn?: boolean, principal?: string, origin?: string,\n   *   terrainAvailable?: boolean, terrainHeld?: boolean|null,\n   *   swissMissing?: boolean, held?: Set<string>|null,\n   *   overlayIds?: {routes?: Set<string>|null, reports?: Set<string>|null}|null}} [options]\n   * @returns {InventoryRow[]}\n   */\n  function inventoryFor(record, now, options) {\n    var opts = options || {};\n    var r = record || {};\n    // The map row is the map itself: terrain has its own row below, so\n    // the map stage is read without it.\n    var stages = stagesFromRecord(r, now, Object.assign({}, opts, { terrainExpected: false }));\n    var items = r.items && typeof r.items === 'object' ? r.items : {};\n    var held = opts.held instanceof Set ? opts.held : null;\n    var overlays = opts.overlayIds || {};\n    var origin = opts.origin || '';\n    var parts = r.parts && typeof r.parts === 'object' ? r.parts : null;\n    /** @param {string} key */\n    var failed = function (key) {\n      var part = parts ? parts[key] : null;\n      return !!part && typeof part.failed === 'number' && part.failed > 0;\n    };\n    /**\n     * A row's status with what the runs counted laid over it.\n     *\n     * @param {string} key\n     * @param {InventoryStatus} status\n     * @returns {InventoryStatus}\n     */\n    var settle = function (key, status) {\n      return failed(key) ? 'missing' : status;\n    };\n    // The bulletin and weather: on the device once fetched whole, however\n    // old (SNOW-1583). A record with parts says so part by part.\n    /** @type {InventoryStatus} */\n    var conditions;\n    if (parts) conditions = 'yes';\n    else conditions = r.contentAt && !r.contentIncomplete ? 'yes' : 'missing';\n    var things = fromStage(stages.things);\n    var at = typeof r.contentAt === 'string' ? r.contentAt : undefined;\n\n    /** @param {any} thing */\n    var urlsHeld = function (thing) {\n      var urls = thing && Array.isArray(thing.urls) ? thing.urls : [];\n      if (!held || urls.length === 0) return null;\n      var set = /** @type {Set<string>} */ (held);\n      return urls.every(function (/** @type {string} */ url) {\n        return set.has(absolute(url, origin));\n      });\n    };\n    /**\n     * @param {Set<string>|null|undefined} ids\n     * @param {string} field\n     */\n    var idHeld = function (ids, field) {\n      return function (/** @type {any} */ thing) {\n        if (!(ids instanceof Set) || !thing || !thing[field]) return null;\n        return ids.has(String(thing[field]));\n      };\n    };\n\n    /** @type {InventoryStatus} */\n    var map = fromStage(stages.map);\n    if (stages.outcome === 'unusable') map = 'missing';\n    else if (map === 'unknown' && (stages.outcome === 'complete' || stages.outcome === 'usable')) map = 'yes';\n    /** @type {InventoryRow[]} */\n    var rows = [{ key: 'map', status: settle('map', map) }];\n    // SNOW-1487: the Swisstopo map a sync has still to add.\n    if (opts.swissMissing || (parts && parts.swiss)) {\n      rows.push({ key: 'swiss', status: opts.swissMissing ? 'missing' : settle('swiss', 'yes') });\n    }\n    // The terrain-class tiles, on their own row where this page can fetch\n    // them, read from their own state: they ride in the map's bucket, but\n    // a map that draws says nothing about them (SNOW-1487).\n    if (opts.terrainAvailable) {\n      /** @type {InventoryStatus} */\n      var terrain = 'missing';\n      if (r.terrain) {\n        if (opts.terrainHeld === true) terrain = 'yes';\n        else if (opts.terrainHeld === false) terrain = 'missing';\n        else terrain = 'unknown';\n      }\n      rows.push({ key: 'terrain', status: settle('terrain', terrain) });\n    }\n    rows.push(\n      // SNOW-1583: the region boundaries the map outlines and colours.\n      { key: 'boundaries', status: settle('boundaries', 'yes') },\n      { key: 'bulletin', status: settle('bulletin', conditions), at: at },\n      { key: 'weather', status: settle('weather', conditions), at: at },\n    );\n    var ours =\n      !!opts.signedIn &&\n      typeof items.principal === 'string' &&\n      items.principal !== '' &&\n      items.principal === opts.principal;\n    // SNOW-1583 review: a part a run counted failed has its row, Missing,\n    // even where no run stamped what it holds (a first download whose\n    // tours failed stores no `items.tours`). The reader's own things only\n    // for a signed-in reader.\n    var signedIn = !!opts.signedIn;\n    if (ours && Array.isArray(items.routes)) {\n      rows.push({\n        key: 'routes',\n        status: settle('routes', countStatus(items.routes, idHeld(overlays.routes, 'uuid'), things)),\n        count: items.routes.length,\n      });\n    } else if (signedIn && failed('routes')) {\n      rows.push({ key: 'routes', status: 'missing' });\n    }\n    if (ours && Array.isArray(items.trips)) {\n      rows.push({\n        key: 'trips',\n        status: settle('trips', countStatus(items.trips, urlsHeld, things)),\n        count: items.trips.length,\n      });\n    } else if (signedIn && failed('trips')) {\n      rows.push({ key: 'trips', status: 'missing' });\n    }\n    if (ours && Array.isArray(items.pins) && items.pins.length > 0) {\n      rows.push({\n        key: 'places',\n        status: settle('places', countStatus(items.pins, urlsHeld, things)),\n        count: items.pins.length,\n      });\n    } else if (signedIn && failed('places')) {\n      rows.push({ key: 'places', status: 'missing' });\n    }\n    if (Array.isArray(items.tours)) {\n      rows.push({\n        key: 'tours',\n        status: settle('tours', countStatus(items.tours, urlsHeld, conditions)),\n        count: items.tours.length,\n      });\n    } else if (failed('tours')) {\n      rows.push({ key: 'tours', status: 'missing' });\n    }\n    if (Array.isArray(items.resorts)) {\n      rows.push({\n        key: 'resorts',\n        status: settle('resorts', countStatus(items.resorts, urlsHeld, conditions)),\n        count: items.resorts.length,\n      });\n    } else if (failed('resorts')) {\n      rows.push({ key: 'resorts', status: 'missing' });\n    }\n    if (Array.isArray(items.reports)) {\n      rows.push({\n        key: 'reports',\n        status: settle('reports', countStatus(items.reports, idHeld(overlays.reports, 'id'), conditions)),\n        count: items.reports.length,\n      });\n    } else if (failed('reports')) {\n      rows.push({ key: 'reports', status: 'missing' });\n    }\n    return rows;\n  }\n\n  /**\n   * SNOW-1418: every url an area's inventory asks the worker about \u2014 the\n   * stamped urls of its trips, pins, tours and resorts, absolute.\n   *\n   * @param {any} record\n   * @param {string} origin\n   * @returns {string[]}\n   */\n  function inventoryUrls(record, origin) {\n    var items = record && record.items && typeof record.items === 'object' ? record.items : {};\n    /** @type {string[]} */\n    var out = [];\n    ['trips', 'pins', 'tours', 'resorts'].forEach(function (field) {\n      var list = Array.isArray(items[field]) ? items[field] : [];\n      list.forEach(function (/** @type {any} */ thing) {\n        (thing && Array.isArray(thing.urls) ? thing.urls : []).forEach(function (/** @type {string} */ url) {\n          var href = absolute(url, origin);\n          if (out.indexOf(href) < 0) out.push(href);\n        });\n      });\n    });\n    return out;\n  }\n\n  /**\n   * SNOW-1582: one stored run as a panel shows it. A run the device\n   * stopped gains one failure of kind `stopped`, at the stage it reached,\n   * so the log names it as it names every other kind.\n   *\n   * @param {any} run A `log:download_runs` entry.\n   * @returns {LogRun}\n   */\n  function logRun(run) {\n    var core = audit();\n    var stages = (Array.isArray(run.stages) ? run.stages : []).map(function (/** @type {any} */ stage) {\n      return {\n        stage: String(stage.stage || ''),\n        planned: Number(stage.planned) || 0,\n        ok: Number(stage.ok) || 0,\n        failed: Number(stage.failed) || 0,\n        reason: stage.reason ? String(stage.reason) : '',\n      };\n    });\n    var failures = (Array.isArray(run.failures) ? run.failures : []).map(function (/** @type {any} */ f) {\n      return {\n        stage: String(f.stage || ''),\n        kind: String(f.kind || 'other'),\n        status: typeof f.status === 'number' ? f.status : null,\n        path: String(f.path || '').split('?')[0],\n      };\n    });\n    if (run.outcome === 'stopped') {\n      failures.push({\n        stage: stages.length ? stages[stages.length - 1].stage : '',\n        kind: 'stopped',\n        status: null,\n        path: '',\n      });\n    }\n    return {\n      kind: String(run.kind || ''),\n      outcome: String(run.outcome || ''),\n      startedAt: String(run.startedAt || ''),\n      stages: stages,\n      failures: failures,\n      text: core && typeof core.runLines === 'function' ? core.runLines(run).join('\\n') : '',\n    };\n  }\n\n  /**\n   * SNOW-1582: an area's download log \u2014 its latest run and up to four\n   * before it \u2014 or null for an area with none.\n   *\n   * @param {Array<any>|undefined} runs The area's runs, newest first.\n   * @returns {DownloadLog|null}\n   */\n  function downloadLog(runs) {\n    if (!Array.isArray(runs) || runs.length === 0) return null;\n    return { latest: logRun(runs[0]), earlier: runs.slice(1, 5).map(logRun) };\n  }\n\n  /**\n   * Every panel, in paint order.\n   *\n   * @param {any} readings What `offline_audit.js` collected.\n   * @param {Record<string, string>} t The journey's strings.\n   * @param {{tiles?: Record<string, boolean|null>, origin?: string,\n   *   canFetch?: boolean}} [options] `tiles` is each area's\n   *   `tileReading`, by id; `canFetch` whether this host can run Sync now.\n   * @returns {Panel[]}\n   */\n  function buildPanels(readings, t, options) {\n    var core = audit();\n    var opts = options || {};\n    var r = readings || {};\n    if (!core) return [];\n    var strings = t || {};\n    var tiles = opts.tiles || {};\n    var failed = !!r.failure;\n    var ctx = {\n      signedIn: isSignedIn(r),\n      urls: shellUrls(r),\n      origin: opts.origin || '',\n      principal: typeof r.currentPrincipal === 'string' ? r.currentPrincipal : null,\n    };\n    // SNOW-1417: the report ids the map's overlay cache holds, read by\n    // the caller; absent is unread.\n    /** @type {Set<string>|null} */\n    var reportIds = r.reportIds instanceof Set ? r.reportIds : null;\n    /** @type {any[]} */\n    var areas = core.chosenAreas(r);\n    // SNOW-1582: each area's download log, newest run first.\n    /** @type {Record<string, Array<any>>} */\n    var byArea =\n      typeof core.runsByArea === 'function' ? core.runsByArea(r.downloadRuns) : {};\n    /** @type {Panel[]} */\n    var panels = [];\n    KIND_ORDER.forEach(function (kind) {\n      areas\n        .filter(function (area) {\n          return areaKind(area) === kind;\n        })\n        .forEach(function (area) {\n          /** @type {{map: Stage, conditions: Stage, things: Stage|null}} */\n          var stages = failed\n            ? {\n                map: { status: 'unknown' },\n                conditions: { status: 'unknown' },\n                things: ctx.signedIn ? { status: 'unknown', rows: [] } : null,\n              }\n            : {\n                map: mapStage(area, tiles[area.id]),\n                conditions: withCountLine(\n                  withCountLine(\n                    withTerrainLine(conditionsStage(area, r.now), problemTerrainLine(area, ctx)),\n                    'tours',\n                    toursLine(area, ctx),\n                    'tours-missing',\n                  ),\n                  'reports',\n                  reportsLine(area, reportIds),\n                  'reports-missing',\n                ),\n                things: thingsStage(area, ctx),\n              };\n          panels.push({\n            id: String(area.id),\n            name: areaName(area, strings),\n            kind: kind,\n            orphaned: !!area.orphaned,\n            contentAt: typeof area.contentAt === 'string' ? area.contentAt : null,\n            stages: stages,\n            verdict: tapCanFix(verdictFor(stages), !failed && core.completableArea(area, r.now)),\n            canSync: !!opts.canFetch && !failed && core.completableArea(area, r.now),\n            bytes: typeof area.bytes === 'number' ? area.bytes : 0,\n            log: downloadLog(byArea[String(area.id)]),\n          });\n        });\n    });\n    // SNOW-1582: an area whose download left nothing but its log \u2014 the\n    // tile list never came, say \u2014 still has a panel, so View log has\n    // somewhere to open.\n    /** @type {Record<string, boolean>} */\n    var shown = {};\n    panels.forEach(function (panel) {\n      shown[panel.id] = true;\n    });\n    Object.keys(byArea).forEach(function (areaId) {\n      if (shown[areaId]) return;\n      var latest = byArea[areaId][0];\n      panels.push({\n        id: areaId,\n        name: String(latest.name || areaId),\n        kind: areaId.indexOf('region-') === 0 ? 'region' : 'custom',\n        orphaned: false,\n        contentAt: null,\n        stages: {\n          map: { status: 'unknown' },\n          conditions: { status: 'unknown' },\n          things: null,\n        },\n        verdict: 'failed',\n        canSync: false,\n        bytes: 0,\n        log: downloadLog(byArea[areaId]),\n        logOnly: true,\n      });\n    });\n    return panels;\n  }\n\n  self.pwaOfflineJourneyCore = Object.freeze({\n    buildPanels: buildPanels,\n    // SNOW-1582: an area's download log, as its panel shows it.\n    downloadLog: downloadLog,\n    verdictFor: verdictFor,\n    stagesFromRecord: stagesFromRecord,\n    inventoryFor: inventoryFor,\n    inventoryUrls: inventoryUrls,\n    verifiedFromSync: verifiedFromSync,\n    additionFailed: additionFailed,\n    verifiedFromStages: verifiedFromStages,\n    stampVerifiedRecord: stampVerifiedRecord,\n    mapStage: mapStage,\n    conditionsStage: conditionsStage,\n    thingsStage: thingsStage,\n    problemTerrainLine: problemTerrainLine,\n    toursLine: toursLine,\n    reportsLine: reportsLine,\n    withCountLine: withCountLine,\n    tileReading: tileReading,\n    isSignedIn: isSigned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ACV,GAAIG,EACJ,KAAM,OAAOC,EAAO,MAAQD,CAAM,EAClC,KAAMA,EAAO,QAAQ,SAAS,IAAM,EAAI,SAAW,SACnD,SAAU,GACV,UAAW,KACX,OAAQ,CACN,IAAK,CAAE,OAAQ,SAAU,EACzB,WAAY,CAAE,OAAQ,SAAU,EAChC,OAAQ,IACV,EACA,QAAS,SACT,QAAS,GACT,MAAO,EACP,IAAKV,EAAYM,EAAOI,CAAM,CAAC,EAC/B,QAAS,EACX,CAAC,EACH,CAAC,EACMH,CACT,CAEA,KAAK,sBAAwB,OAAO,OAAO,CACzC,YAAaL,GAEb,YAAaF,EACb,WAAY1E,EACZ,iBAAkBmC,EAClB,aAAcoB,GACd,cAAea,GACf,iBAAkB/C,GAClB,eAAgBN,EAChB,mBAAoBW,GACpB,oBAAqBG,GACrB,SAAUvE,EACV,gBAAiBI,EACjB,YAAa2B,EACb,mBAAoBb,EACpB,UAAWK,EACX,YAAaE,EACb,cAAe4B,EACf,YAAazD,EACb,WAAYW,EACZ,SAAUhB,CACZ,CAAC,CACH,GAAG",
  "names": ["KIND_ORDER", "audit", "fill", "template", "values", "_m", "key", "areaKind", "area", "areaName", "t", "areaBlob", "download", "band", "tileReading", "templates", "entry", "blob", "mapStage", "tiles", "core", "state", "conditionsStage", "now", "content", "isSignedIn", "readings", "p", "shellUrls", "urls", "urlState", "url", "held", "principal", "absolute", "origin", "problemTerrainLine", "ctx", "stamped", "total", "count", "toursLine", "tour", "reportsLine", "ids", "items", "newestAt", "have", "report", "thingsStage", "rows", "add", "kind", "item", "status", "states", "trip", "pin", "statuses", "row", "verdictFor", "stages", "list", "any", "stage", "tapCanFix", "verdict", "completable", "withTerrainLine", "line", "out", "withCountLine", "reason", "stepsOf", "steps", "additionFailed", "record", "step", "v", "answer", "value", "verifiedFromSync", "result", "at", "depsOk", "name", "verifiedFromStages", "map", "things", "stampVerifiedRecord", "verified", "prior", "next", "ran", "kept", "stagesFromRecord", "options", "opts", "r", "mapAnswer", "conditions", "fetched", "today", "ours", "contentAnswer", "outcome", "outcomeFor", "probes", "stored", "fromStage", "countStatus", "check", "fallback", "unread", "i", "inventoryFor", "overlays", "parts", "failed", "part", "settle", "urlsHeld", "thing", "set", "idHeld", "field", "terrain", "signedIn", "inventoryUrls", "href", "logRun", "run", "failures", "f", "downloadLog", "runs", "buildPanels", "strings", "reportIds", "areas", "byArea", "panels", "shown", "panel", "areaId", "latest"]
}
