{
  "version": 3,
  "sources": ["offline_journey.js"],
  "sourcesContent": ["/*\n * static/js/offline_journey.js \u2014 paint one panel per downloaded area on\n * /offline/ and static/offline.html (SNOW-1308).\n *\n * A reading layer over what `offline_audit.js` already collects. It takes\n * no storage walk of its own: the audit announces every collection as\n * `snowdesk:offline-readings` (and answers `pwaOfflineAudit.latest()`),\n * and this module paints from that \u2014 on load it asks the audit for one\n * read, so every panel is answered before anyone runs the check.\n *\n * The one reading the audit does not take is arithmetic, not storage:\n * whether every basemap tile an area's ground implies is in its bucket,\n * which `offline_journey_core.js`'s `tileReading` asks of\n * `pwaBasemapDownloadCore.blobFullyCached` over the bucket entries the\n * audit already listed. Where that core is absent (static/offline.html)\n * the reading is unknown, and the map stage says \"Can't tell\" rather than\n * guessing.\n *\n * ## Two controls per panel, both existing verbs\n *\n *   - **Sync now** \u2014 the audit's own (`pwaOfflineAudit.syncArea`), offered\n *     exactly where the report used to offer it: a host that can fetch,\n *     and an area whose tiles verify. A \"Needs a refresh \u2014 tap to fix\"\n *     verdict is the same control; on a page opened with `?sync=all` it\n *     runs the whole \"Get ready for offline\" instead. On a host that\n *     cannot fetch, the verdict links to `/offline/?sync=<id>`.\n *   - **Remove** \u2014 `pwaBasemapAreaRemoval.evict`, the removal the map's\n *     Manage downloads sheet uses, for a recorded area and an orphaned\n *     bucket alike. Offered only where that module and what it needs are\n *     loaded. Afterwards the audit re-reads storage, and the panels are\n *     repainted from what is actually there.\n *\n * ## Each area's last download (SNOW-1582)\n *\n * A panel ends on its area's \"Last download\": the latest run of its\n * download log (`log:download_runs`, read by the audit as `downloadRuns`),\n * each stage with its counts and every failed request by its kind and\n * path, a Copy for the whole entry, and up to four earlier runs folded\n * below. The panel is `id=\"area-<id>\"`, and a page opened at that hash \u2014\n * the map's \"View log\" \u2014 opens its log and brings it into view.\n *\n * ## No class strings, no innerHTML\n *\n * Every element is cloned from a `<template>` in the host\n * (templates/includes/_offline_journey.html, or its inline copy in\n * static/offline.html) and filled through `textContent` and attributes.\n * The classes live in the templates, where ds-lint reads them; the\n * fallback page's copy carries none and styles by attribute.\n */\n\n(function () {\n  'use strict';\n\n  var ROOT_SELECTOR = '[data-offline-journey]';\n\n  // English copy, for static/offline.html, where `pwaStrings` is absent \u2014\n  // and the fallback wherever a key is missing from the strings template.\n  var FALLBACKS = {\n    'verdict-ready': 'Ready for offline',\n    'verdict-refresh': 'Needs a refresh \u2014 tap to fix',\n    'verdict-open-map': 'Needs a refresh \u2014 open the map',\n    'verdict-unknown': 'Can\u2019t tell',\n    // SNOW-1582: a panel that is only a failed download's log.\n    'verdict-failed': 'Download failed',\n    'stage-map': 'The map',\n    'stage-conditions': 'Bulletins and weather',\n    'stage-things': 'User data',\n    'answer-yes': 'Yes',\n    'answer-no': 'No',\n    'answer-unknown': '\u2014',\n    'note-map-tiles': 'some of its map tiles are missing',\n    'note-map-incomplete': 'what the map needs to draw it is incomplete',\n    'note-map-missing': 'recorded as downloaded, but nothing is stored',\n    'note-map-orphaned': 'an unfinished download taking up space \u2014 remove it',\n    'note-map-unreadable': 'this device\u2019s storage did not answer',\n    'note-map-unverifiable': 'downloaded before the app recorded what an area needs',\n    'note-map-tiles-unread': 'its map tiles could not be checked here',\n    'note-conditions-stale': 'from %(day)s, an earlier day',\n    'note-conditions-never': 'never saved',\n    // SNOW-1379: the conditions stage's problem-terrain line.\n    'line-problem-terrain': 'Problem terrain',\n    'problem-terrain-count': '%(held)s of %(total)s days saved',\n    // SNOW-1417: the conditions stage's tours and reports lines.\n    'line-tours': 'SAC tours',\n    'tours-count': '%(held)s of %(total)s saved',\n    'line-reports': 'Community observations',\n    'reports-count': '%(held)s of %(total)s saved',\n    'note-things-unrecorded': 'not recorded yet \u2014 sync this area to list them',\n    'note-things-none': 'None in this area',\n    'note-things-other-account': 'saved by another account',\n    'unnamed-trip': 'Unnamed trip',\n    'unnamed-pin': 'Unnamed pin',\n    'label-dropzone': '%(name)s (drop zone)',\n    'label-custom': '%(name)s (area you drew)',\n    'default-custom-name': 'Custom area %(n)s',\n    sync: 'Sync now',\n    'sync-label': 'Sync the bulletins and weather saved inside %(name)s',\n    remove: 'Remove',\n    'remove-label': 'Remove %(name)s from this device',\n    // SNOW-1308 review: the Manage downloads sheet's own confirmation\n    // (map_downloads_manager.js `confirm-remove`), word for word, so the\n    // one removal asks the same question on both surfaces. The unsized form\n    // is for an area with no recorded size \u2014 an unfinished download.\n    'confirm-remove':\n      'Remove the offline map for %(name)s? This frees %(size)s on this ' +\n      'device. You can download it again whenever you like.',\n    'confirm-remove-unsized':\n      'Remove the offline map for %(name)s? You can download it again whenever you like.',\n    // SNOW-1582: the Last download block.\n    'log-title': 'Last download',\n    'log-copy': 'Copy',\n    'log-copied': 'Copied',\n    'log-earlier': 'Earlier downloads',\n    'log-summary': '%(outcome)s \u00B7 %(kind)s \u00B7 %(when)s',\n    'log-outcome-ok': 'Finished',\n    'log-outcome-failed': 'Download failed',\n    'log-outcome-cancelled': 'Cancelled',\n    'log-outcome-stopped': 'Stopped by the device',\n    'log-outcome-running': 'Running',\n    'log-run-region': 'Region',\n    'log-run-custom': 'Area',\n    'log-run-sync': 'Sync',\n    'log-run-complete': 'Retry',\n    'log-stage-plan': 'Planning',\n    'log-stage-documents': 'Map documents',\n    'log-stage-content-plan': 'List of bulletins, weather and your things',\n    'log-stage-warm': 'Saving',\n    'log-stage-base-layer': 'Overview map',\n    'log-stage-verify': 'Checking',\n    'log-stage-record': 'Recording the download',\n    'log-stage-counts': '%(ok)s of %(planned)s',\n    'log-stage-failed': '%(count)s failed',\n    'log-kind-connection': 'No connection',\n    'log-kind-server': 'Server error %(status)s',\n    'log-kind-not-found': 'Not found on the server',\n    'log-kind-storage': 'Storage full',\n    'log-kind-stopped': 'Download stopped by the device',\n    'log-kind-other': 'Other error %(status)s',\n  };\n\n  // Which note a stage's reason reads as.\n  var MAP_NOTES = {\n    tiles: 'note-map-tiles',\n    incomplete: 'note-map-incomplete',\n    missing: 'note-map-missing',\n    orphaned: 'note-map-orphaned',\n    unreadable: 'note-map-unreadable',\n    unverifiable: 'note-map-unverifiable',\n    'tiles-unread': 'note-map-tiles-unread',\n  };\n  var THINGS_NOTES = {\n    unrecorded: 'note-things-unrecorded',\n    'none-here': 'note-things-none',\n    'other-account': 'note-things-other-account',\n  };\n\n  /**\n   * The translated copy, or the English fallbacks.\n   *\n   * @returns {Record<string, string>}\n   */\n  function strings() {\n    if (self.pwaStrings && typeof self.pwaStrings.read === 'function') {\n      return self.pwaStrings.read('offline-journey-strings-template', FALLBACKS);\n    }\n    return FALLBACKS;\n  }\n\n  /**\n   * One string, filled.\n   *\n   * @param {Record<string, string>} t\n   * @param {string} key\n   * @param {Record<string, string>} [values]\n   * @returns {string}\n   */\n  function say(t, key, values) {\n    var template = String(t[key] || FALLBACKS[key] || '');\n    return template.replace(/%\\((\\w+)\\)s/g, function (_m, name) {\n      return values && Object.prototype.hasOwnProperty.call(values, name) ? values[name] : '';\n    });\n  }\n\n  /**\n   * The first element a template holds, cloned.\n   *\n   * @param {Document} doc\n   * @param {string} id\n   * @returns {HTMLElement|null}\n   */\n  function clone(doc, id) {\n    var template = /** @type {HTMLTemplateElement|null} */ (doc.getElementById(id));\n    if (!template || !template.content) return null;\n    var first = template.content.firstElementChild;\n    return first ? /** @type {HTMLElement} */ (first.cloneNode(true)) : null;\n  }\n\n  /**\n   * Set one slot's text, by its data attribute.\n   *\n   * @param {HTMLElement} el\n   * @param {string} attr\n   * @param {string} text\n   * @returns {HTMLElement|null}\n   */\n  function fillSlot(el, attr, text) {\n    var slot = /** @type {HTMLElement|null} */ (el.querySelector('[' + attr + ']'));\n    if (slot) slot.textContent = text;\n    return slot;\n  }\n\n  /**\n   * The day content was fetched on, as the downloads surfaces date it\n   * (SNOW-1139's `pwaCachedStampCore.formatDay`), or its ISO date where\n   * that core is absent (static/offline.html).\n   *\n   * @param {string|null} contentAt\n   * @returns {string}\n   */\n  function contentDay(contentAt) {\n    if (!contentAt) return '';\n    var stamp = self.pwaCachedStampCore;\n    if (stamp && typeof stamp.formatDay === 'function') {\n      var day = stamp.formatDay(contentAt);\n      if (day) return day;\n    }\n    return String(contentAt).slice(0, 10);\n  }\n\n  /**\n   * A panel's label: its name, and its kind where that is not obvious.\n   *\n   * @param {Object} panel\n   * @param {Record<string, string>} t\n   * @returns {string}\n   */\n  function panelLabel(panel, t) {\n    if (panel.kind === 'dropzone') return say(t, 'label-dropzone', { name: panel.name });\n    if (panel.kind === 'custom') return say(t, 'label-custom', { name: panel.name });\n    return panel.name;\n  }\n\n  /**\n   * One stage row.\n   *\n   * @param {Document} doc\n   * @param {string} id\n   * @param {Object} stage\n   * @param {string} note\n   * @param {Record<string, string>} t\n   * @returns {HTMLElement|null}\n   */\n  function renderStage(doc, id, stage, note, t) {\n    var el = clone(doc, 'offline-journey-stage-template');\n    if (!el) return null;\n    el.setAttribute('data-journey-stage', id);\n    el.setAttribute('data-journey-status', stage.status);\n    fillSlot(el, 'data-journey-stage-label', say(t, 'stage-' + id));\n    fillSlot(el, 'data-journey-stage-value', say(t, 'answer-' + stage.status));\n    var noteEl = fillSlot(el, 'data-journey-stage-note', note);\n    if (noteEl) noteEl.hidden = !note;\n    var list = /** @type {HTMLElement|null} */ (el.querySelector('[data-journey-things]'));\n    var rows = Array.isArray(stage.rows) ? stage.rows : [];\n    if (list && rows.length) {\n      rows.forEach(function (row) {\n        var item = clone(doc, 'offline-journey-thing-template');\n        if (!item) return;\n        item.setAttribute('data-journey-thing', row.kind);\n        item.setAttribute('data-journey-status', row.status);\n        fillSlot(\n          item,\n          'data-journey-thing-name',\n          row.name || say(t, row.kind === 'trip' ? 'unnamed-trip' : 'unnamed-pin'),\n        );\n        fillSlot(item, 'data-journey-thing-value', say(t, 'answer-' + row.status));\n        list.appendChild(item);\n      });\n      list.hidden = false;\n    }\n    return el;\n  }\n\n  /**\n   * The conditions stage's \"Problem terrain\" line (SNOW-1379): the days\n   * of the feed the last sync saved that are still on the device, in the\n   * stage's own list, as a thing is in its stage.\n   *\n   * @param {Document} doc\n   * @param {HTMLElement} row The conditions stage row.\n   * @param {{status: string, held: number, total: number}} line\n   * @param {Record<string, string>} t\n   * @returns {void}\n   */\n  function renderTerrainLine(doc, row, line, t) {\n    renderCountLine(doc, row, line, t, 'problem-terrain');\n  }\n\n  /**\n   * One counted line under the conditions stage: the problem-terrain days\n   * (SNOW-1379), the SAC tours or the community reports (SNOW-1417). Its\n   * name is the `line-<kind>` string and its count `<kind>-count`.\n   *\n   * @param {Document} doc\n   * @param {HTMLElement} row The conditions stage row.\n   * @param {{status: string, held: number, total: number}} line\n   * @param {Record<string, string>} t\n   * @param {'problem-terrain'|'tours'|'reports'} kind\n   * @returns {void}\n   */\n  function renderCountLine(doc, row, line, t, kind) {\n    var list = /** @type {HTMLElement|null} */ (row.querySelector('[data-journey-things]'));\n    var item = clone(doc, 'offline-journey-thing-template');\n    if (!list || !item) return;\n    item.setAttribute('data-journey-thing', kind);\n    item.setAttribute('data-journey-status', line.status);\n    fillSlot(item, 'data-journey-thing-name', say(t, 'line-' + kind));\n    fillSlot(\n      item,\n      'data-journey-thing-value',\n      line.status === 'unknown'\n        ? say(t, 'answer-unknown')\n        : say(t, kind + '-count', { held: String(line.held), total: String(line.total) }),\n    );\n    list.appendChild(item);\n    list.hidden = false;\n  }\n\n  /**\n   * SNOW-1582: one line of a run \u2014 a name on the left, a value on the\n   * right.\n   *\n   * @param {Document} doc\n   * @param {string} hook The line's role: 'stage' or 'failure'.\n   * @param {string} name\n   * @param {string} value\n   * @returns {HTMLElement|null}\n   */\n  function logLine(doc, hook, name, value) {\n    var line = clone(doc, 'offline-journey-log-line-template');\n    if (!line) return null;\n    line.setAttribute('data-journey-log-line', hook);\n    fillSlot(line, 'data-journey-log-line-name', name);\n    fillSlot(line, 'data-journey-log-line-value', value);\n    return line;\n  }\n\n  /**\n   * SNOW-1582: one run of an area's download log \u2014 what it came to, then\n   * each stage it reached, then every failure by its kind and path.\n   *\n   * @param {Document} doc\n   * @param {Object} run A `LogRun` (offline_journey_core.js).\n   * @param {Record<string, string>} t\n   * @returns {HTMLElement|null}\n   */\n  function renderRun(doc, run, t) {\n    var el = clone(doc, 'offline-journey-log-run-template');\n    if (!el) return null;\n    el.setAttribute('data-journey-log-run', run.outcome);\n    fillSlot(\n      el,\n      'data-journey-log-run-summary',\n      say(t, 'log-summary', {\n        outcome: say(t, 'log-outcome-' + run.outcome) || run.outcome,\n        kind: say(t, 'log-run-' + run.kind) || run.kind,\n        when: runWhen(run.startedAt),\n      }),\n    );\n    var stages = /** @type {HTMLElement|null} */ (el.querySelector('[data-journey-log-run-stages]'));\n    if (stages) {\n      run.stages.forEach(function (/** @type {any} */ stage) {\n        var value = say(t, 'log-stage-counts', { ok: String(stage.ok), planned: String(stage.planned) });\n        if (stage.failed > 0) value += ' \u00B7 ' + say(t, 'log-stage-failed', { count: String(stage.failed) });\n        if (stage.reason) value += ' \u00B7 ' + stage.reason;\n        var line = logLine(doc, 'stage', say(t, 'log-stage-' + stage.stage) || stage.stage, value);\n        if (line) {\n          line.setAttribute('data-journey-log-stage', stage.stage);\n          stages.appendChild(line);\n        }\n      });\n    }\n    var failures = /** @type {HTMLElement|null} */ (el.querySelector('[data-journey-log-run-failures]'));\n    if (failures) {\n      run.failures.forEach(function (/** @type {any} */ failure) {\n        var status = failure.status === null ? '' : String(failure.status);\n        var kind = say(t, 'log-kind-' + failure.kind, { status: status }).trim() || failure.kind;\n        var line = logLine(doc, 'failure', kind, failure.path);\n        if (line) {\n          line.setAttribute('data-journey-log-kind', failure.kind);\n          failures.appendChild(line);\n        }\n      });\n    }\n    return el;\n  }\n\n  /**\n   * SNOW-1582: when a run began, as the downloads surfaces date a day and\n   * the clock time beside it.\n   *\n   * @param {string} startedAt\n   * @returns {string}\n   */\n  function runWhen(startedAt) {\n    if (!startedAt) return '';\n    var day = contentDay(startedAt);\n    var date = new Date(startedAt);\n    if (isNaN(date.getTime())) return day;\n    var hh = String(date.getHours()).padStart(2, '0');\n    var mm = String(date.getMinutes()).padStart(2, '0');\n    return day + ' ' + hh + ':' + mm;\n  }\n\n  /**\n   * SNOW-1582: a panel's Last download block, or null for an area with no\n   * log.\n   *\n   * @param {Document} doc\n   * @param {Object} panel\n   * @param {Record<string, string>} t\n   * @returns {HTMLElement|null}\n   */\n  function renderLog(doc, panel, t) {\n    if (!panel.log) return null;\n    var block = clone(doc, 'offline-journey-log-template');\n    if (!block) return null;\n    block.setAttribute('data-journey-log-block', panel.id);\n    fillSlot(block, 'data-journey-log-title', say(t, 'log-title'));\n    var latest = /** @type {HTMLElement|null} */ (block.querySelector('[data-journey-log-latest]'));\n    var run = renderRun(doc, panel.log.latest, t);\n    if (latest && run) latest.appendChild(run);\n    var copy = /** @type {HTMLButtonElement|null} */ (block.querySelector('[data-journey-log-copy]'));\n    if (copy) {\n      copy.textContent = say(t, 'log-copy');\n      copy.setAttribute('data-journey-log-copy', panel.id);\n      copy.setAttribute('data-journey-log-text', panel.log.latest.text);\n    }\n    var earlier = /** @type {HTMLElement|null} */ (block.querySelector('[data-journey-log-earlier]'));\n    var list = /** @type {HTMLElement|null} */ (block.querySelector('[data-journey-log-earlier-list]'));\n    if (earlier && list && panel.log.earlier.length) {\n      fillSlot(earlier, 'data-journey-log-earlier-title', say(t, 'log-earlier'));\n      panel.log.earlier.forEach(function (/** @type {any} */ older) {\n        var el = renderRun(doc, older, t);\n        if (el) list.appendChild(el);\n      });\n      earlier.hidden = false;\n    }\n    return block;\n  }\n\n  /**\n   * SNOW-1582: the area a page's hash names \u2014 `#area-<id>`, the map's\n   * View log \u2014 or '' for none.\n   *\n   * @returns {string}\n   */\n  function hashedArea() {\n    var hash = (self.location && self.location.hash) || '';\n    if (hash.indexOf('#area-') !== 0) return '';\n    try {\n      return decodeURIComponent(hash.slice('#area-'.length));\n    } catch (_err) {\n      return '';\n    }\n  }\n\n  /**\n   * SNOW-1582: open the log of the panel the hash names, and bring it into\n   * view. Once per hash: a repaint after a sync does not scroll again.\n   *\n   * @param {HTMLElement} output\n   * @param {{opened: string}} state\n   * @returns {void}\n   */\n  function openHashed(output, state) {\n    var areaId = hashedArea();\n    if (!areaId) return;\n    var panels = output.querySelectorAll('[data-journey-panel]');\n    for (var i = 0; i < panels.length; i += 1) {\n      var panel = /** @type {HTMLElement} */ (panels[i]);\n      if (panel.getAttribute('data-journey-panel') !== areaId) continue;\n      var block = /** @type {HTMLDetailsElement|null} */ (panel.querySelector('[data-journey-log-block]'));\n      if (block) block.open = true;\n      if (state.opened !== areaId && typeof panel.scrollIntoView === 'function') {\n        panel.scrollIntoView({ block: 'start' });\n      }\n      state.opened = areaId;\n      return;\n    }\n  }\n\n  /**\n   * Paint one panel.\n   *\n   * @param {Document} doc\n   * @param {Object} panel From `buildPanels`.\n   * @param {Record<string, string>} t\n   * @param {{canRemove: boolean, mapUrl: string, offlineUrl: string,\n   *   canFetch: boolean}} host\n   * @returns {HTMLElement|null}\n   */\n  function renderPanel(doc, panel, t, host) {\n    var el = clone(doc, 'offline-journey-panel-template');\n    if (!el) return null;\n    var label = panelLabel(panel, t);\n    el.setAttribute('data-journey-panel', panel.id);\n    // SNOW-1582: the anchor the map's View log opens.\n    el.id = 'area-' + panel.id;\n    el.setAttribute('data-journey-verdict-state', panel.verdict);\n    fillSlot(el, 'data-journey-name', label);\n\n    var verdictEl = /** @type {HTMLElement|null} */ (el.querySelector('[data-journey-verdict]'));\n    if (verdictEl) {\n      var text = say(t, 'verdict-' + panel.verdict);\n      var fix = null;\n      if (panel.verdict === 'open-map' && host.mapUrl) {\n        fix = clone(doc, 'offline-journey-fix-link-template');\n        if (fix) fix.setAttribute('href', host.mapUrl);\n      } else if (panel.verdict === 'refresh' && panel.canSync) {\n        fix = clone(doc, 'offline-journey-fix-button-template');\n        if (fix) fix.setAttribute('data-journey-fix', panel.id);\n      } else if (panel.verdict === 'refresh' && !host.canFetch && host.offlineUrl) {\n        // The fallback page cannot fetch; the page that can is one link\n        // away, and runs this area's Sync now on arrival (SNOW-951).\n        fix = clone(doc, 'offline-journey-fix-link-template');\n        if (fix) {\n          fix.setAttribute('href', host.offlineUrl + '?sync=' + encodeURIComponent(panel.id));\n        }\n      }\n      if (fix) {\n        fix.textContent = text;\n        verdictEl.appendChild(fix);\n      } else {\n        verdictEl.textContent = text;\n      }\n    }\n\n    var stages = /** @type {HTMLElement|null} */ (el.querySelector('[data-journey-stages]'));\n    // SNOW-1582: a log-only panel has no stages to answer \u2014 nothing of it\n    // is on the device \u2014 and no control but its log's Copy.\n    if (stages && panel.logOnly) stages.hidden = true;\n    if (stages && !panel.logOnly) {\n      var map = panel.stages.map;\n      var mapNote = map.status === 'yes' ? '' : say(t, MAP_NOTES[map.reason] || '');\n      var mapRow = renderStage(doc, 'map', map, mapNote, t);\n      if (mapRow) stages.appendChild(mapRow);\n\n      var conditions = panel.stages.conditions;\n      var conditionsNote = '';\n      if (conditions.reason === 'stale') {\n        conditionsNote = say(t, 'note-conditions-stale', { day: contentDay(panel.contentAt) });\n      } else if (conditions.reason === 'never') {\n        conditionsNote = say(t, 'note-conditions-never');\n      }\n      var conditionsRow = renderStage(doc, 'conditions', conditions, conditionsNote, t);\n      if (conditionsRow) {\n        if (conditions.terrain) renderTerrainLine(doc, conditionsRow, conditions.terrain, t);\n        if (conditions.tours) renderCountLine(doc, conditionsRow, conditions.tours, t, 'tours');\n        if (conditions.reports) renderCountLine(doc, conditionsRow, conditions.reports, t, 'reports');\n        stages.appendChild(conditionsRow);\n      }\n\n      var things = panel.stages.things;\n      if (things) {\n        var thingsNote = things.reason ? say(t, THINGS_NOTES[things.reason] || '') : '';\n        var thingsRow = renderStage(doc, 'things', things, thingsNote, t);\n        if (thingsRow) stages.appendChild(thingsRow);\n      }\n    }\n\n    var sync = /** @type {HTMLButtonElement|null} */ (el.querySelector('[data-journey-sync]'));\n    if (sync) {\n      sync.hidden = !panel.canSync;\n      sync.textContent = say(t, 'sync');\n      sync.setAttribute('aria-label', say(t, 'sync-label', { name: label }));\n      sync.setAttribute('data-journey-sync', panel.id);\n    }\n    var remove = /** @type {HTMLButtonElement|null} */ (el.querySelector('[data-journey-remove]'));\n    if (remove) {\n      remove.hidden = !host.canRemove || !!panel.logOnly;\n      remove.textContent = say(t, 'remove');\n      remove.setAttribute('aria-label', say(t, 'remove-label', { name: label }));\n      remove.setAttribute('data-journey-remove', panel.id);\n      remove.setAttribute('data-journey-confirm', confirmText(panel, label, t));\n    }\n    var logSlot = /** @type {HTMLElement|null} */ (el.querySelector('[data-journey-log]'));\n    var log = renderLog(doc, panel, t);\n    if (logSlot && log) {\n      logSlot.appendChild(log);\n      logSlot.hidden = false;\n    }\n    return el;\n  }\n\n  /**\n   * The question Remove asks before it deletes anything \u2014 the Manage\n   * downloads sheet's, naming the area and what it frees.\n   *\n   * @param {Object} panel\n   * @param {string} label\n   * @param {Record<string, string>} t\n   * @returns {string}\n   */\n  function confirmText(panel, label, t) {\n    var audit = self.pwaOfflineAuditCore;\n    var size = panel.bytes > 0 && audit ? audit.formatBytes(panel.bytes) : '';\n    return size\n      ? say(t, 'confirm-remove', { name: label, size: size })\n      : say(t, 'confirm-remove-unsized', { name: label });\n  }\n\n  /**\n   * SNOW-1417: the community report ids the map's overlay cache holds \u2014\n   * the feed a download saved, read straight from IndexedDB (`pwaDb`,\n   * `data:map_overlays`), because this page loads no map code.\n   *\n   * @returns {Promise<Set<string>|null>} Null when it could not be read.\n   */\n  function readReportIds() {\n    var db = window.pwaDb;\n    if (!db || typeof db.get !== 'function') return Promise.resolve(null);\n    return Promise.resolve()\n      .then(function () {\n        return db.get('data:map_overlays', 'community_reports');\n      })\n      .then(function (row) {\n        var features = row && row.geojson && row.geojson.features;\n        if (!Array.isArray(features)) return row ? null : new Set();\n        var ids = new Set();\n        features.forEach(function (feature) {\n          var id = feature && feature.properties && feature.properties.submission;\n          if (id) ids.add(String(id));\n        });\n        return ids;\n      })\n      .catch(function () {\n        return null;\n      });\n  }\n\n  /**\n   * Each area's tile reading, by id.\n   *\n   * @param {Object} readings\n   * @returns {Record<string, boolean|null>}\n   */\n  function tileReadings(readings) {\n    var core = self.pwaOfflineJourneyCore;\n    var audit = self.pwaOfflineAuditCore;\n    var out = {};\n    if (!core || !audit || !readings) return out;\n    var download = self.pwaBasemapDownloadCore || null;\n    audit.chosenAreas(readings).forEach(function (area) {\n      out[area.id] = core.tileReading(area, download);\n    });\n    return out;\n  }\n\n  /**\n   * Whether this page can remove an area.\n   *\n   * @returns {boolean}\n   */\n  function canRemove() {\n    var removal = self.pwaBasemapAreaRemoval;\n    return !!(removal && typeof removal.available === 'function' && removal.available());\n  }\n\n  /**\n   * SNOW-1415: write what each panel read back onto its area's record\n   * (`verified`), so the header's connection panel can answer for the\n   * area on pages that cannot read tiles. Not while a sync is running:\n   * the readings are mid-change, and the settled re-read stamps them.\n   * Only Yes and No are written (`verifiedFromStages`), so a host that\n   * cannot read tiles leaves the map answer as it was.\n   *\n   * @param {Array<Object>} panels From `buildPanels`.\n   * @param {Object} detail The audit's announcement.\n   * @returns {void}\n   */\n  function stampVerified(panels, detail) {\n    var core = self.pwaOfflineJourneyCore;\n    var audit = self.pwaOfflineAudit;\n    if (detail.running || !core || !audit || typeof audit.stampVerified !== 'function') return;\n    var at = new Date().toISOString();\n    var meta = document.querySelector('meta[name=\"pwa-user-id\"]');\n    var principal = (meta && meta.getAttribute('content')) || '';\n    panels.forEach(function (panel) {\n      if (panel.orphaned) return;\n      var verified = core.verifiedFromStages(panel.stages, at, principal);\n      if (verified) audit.stampVerified(panel.id, verified);\n    });\n  }\n\n  /**\n   * SNOW-1582: copy one run's whole log to the clipboard, and say so on\n   * the control.\n   *\n   * @param {HTMLElement} button\n   * @param {Record<string, string>} t\n   * @returns {Promise<void>}\n   */\n  async function copyLog(button, t) {\n    var text = button.getAttribute('data-journey-log-text') || '';\n    var clipboard = navigator.clipboard;\n    if (!text || !clipboard || typeof clipboard.writeText !== 'function') return;\n    try {\n      await clipboard.writeText(text);\n      button.textContent = say(t, 'log-copied');\n    } catch (_err) {\n      // Nothing to undo: the control keeps saying Copy.\n    }\n  }\n\n  /**\n   * Bind one host.\n   *\n   * @param {HTMLElement} root\n   * @returns {void}\n   */\n  function bind(root) {\n    var doc = root.ownerDocument;\n    var output = /** @type {HTMLElement|null} */ (root.querySelector('[data-journey-output]'));\n    var empty = /** @type {HTMLElement|null} */ (root.querySelector('[data-journey-empty]'));\n    var waiting = /** @type {HTMLElement|null} */ (root.querySelector('[data-journey-waiting]'));\n    if (!output) return;\n    var t = strings();\n    var busy = false;\n    var lastDetail = null;\n\n    // SNOW-1417: the community report ids the map's overlay cache holds \u2014\n    // IndexedDB, not Cache Storage, so read beside the audit's readings.\n    // Painted at once with the last ids read (none at first, which the core\n    // reads as unread), then again when a fresh read differs. The latest\n    // paint wins.\n    var reportIds = null;\n    var paintToken = 0;\n    var sameIds = function (a, b) {\n      if (!a || !b) return a === b;\n      if (a.size !== b.size) return false;\n      var same = true;\n      a.forEach(function (id) {\n        if (!b.has(id)) same = false;\n      });\n      return same;\n    };\n    var paint = function (detail) {\n      var core = self.pwaOfflineJourneyCore;\n      if (!core || !detail || !detail.readings) return;\n      lastDetail = detail;\n      paintWith(core, detail, Object.assign({}, detail.readings, { reportIds: reportIds }));\n      var token = ++paintToken;\n      readReportIds().then(function (ids) {\n        if (token !== paintToken || sameIds(ids, reportIds)) return;\n        reportIds = ids;\n        paintWith(core, detail, Object.assign({}, detail.readings, { reportIds: reportIds }));\n      });\n    };\n\n    var paintWith = function (core, detail, readings) {\n      var panels = core.buildPanels(readings, t, {\n        tiles: tileReadings(readings),\n        origin: self.location ? self.location.origin : '',\n        canFetch: !!detail.canFetch,\n      });\n      var host = {\n        canRemove: canRemove(),\n        canFetch: !!detail.canFetch,\n        mapUrl: root.getAttribute('data-map-downloads-url') || '',\n        offlineUrl: root.getAttribute('data-offline-url') || '',\n      };\n      output.textContent = '';\n      panels.forEach(function (panel) {\n        var el = renderPanel(doc, panel, t, host);\n        if (el) output.appendChild(el);\n      });\n      if (waiting) waiting.hidden = true;\n      if (empty) empty.hidden = panels.length > 0;\n      setBusy(busy || !!detail.running);\n      stampVerified(panels, detail);\n      openHashed(output, hashState);\n    };\n\n    // SNOW-1582: which hash has been scrolled to, so a repaint does not\n    // pull the page back to it.\n    var hashState = { opened: '' };\n    if (typeof self.addEventListener === 'function') {\n      self.addEventListener('hashchange', function () {\n        hashState.opened = '';\n        openHashed(output, hashState);\n      });\n    }\n\n    var setBusy = function (on) {\n      var controls = output.querySelectorAll(\n        '[data-journey-sync], [data-journey-remove], button[data-journey-fix]',\n      );\n      for (var i = 0; i < controls.length; i += 1) {\n        /** @type {HTMLButtonElement} */ (controls[i]).disabled = on;\n      }\n    };\n\n    var audit = function () {\n      return self.pwaOfflineAudit;\n    };\n\n    var act = async function (work) {\n      if (busy) return;\n      busy = true;\n      setBusy(true);\n      try {\n        await work();\n      } catch (_err) {\n        // The re-read below says what is true either way.\n      } finally {\n        busy = false;\n      }\n      if (lastDetail) setBusy(false);\n    };\n\n    var sync = function (areaId) {\n      return act(async function () {\n        var api = audit();\n        if (!api) return;\n        var detail = api.latest ? api.latest() : null;\n        if (detail && detail.syncAllRequested) await api.syncAll();\n        else await api.syncArea(areaId);\n      });\n    };\n\n    var removeArea = function (areaId) {\n      return act(async function () {\n        var removal = self.pwaBasemapAreaRemoval;\n        if (removal && typeof removal.evict === 'function') {\n          await removal.evict([areaId]);\n        }\n        // Never trust the attempt: read storage again, and the panels\n        // repaint from what is actually there.\n        var api = audit();\n        if (api && typeof api.refresh === 'function') await api.refresh();\n      });\n    };\n\n    output.addEventListener('click', function (event) {\n      var target = /** @type {HTMLElement} */ (event.target);\n      if (!target || !target.closest) return;\n      // SNOW-1582: Copy, on a panel's Last download.\n      var copyButton = target.closest('[data-journey-log-copy]');\n      if (copyButton) {\n        copyLog(/** @type {HTMLElement} */ (copyButton), t);\n        return;\n      }\n      var syncButton = target.closest('[data-journey-sync], button[data-journey-fix]');\n      if (syncButton) {\n        var id = syncButton.getAttribute('data-journey-sync') ||\n          syncButton.getAttribute('data-journey-fix');\n        if (id) sync(id);\n        return;\n      }\n      var removeButton = target.closest('[data-journey-remove]');\n      if (removeButton) {\n        var removeId = removeButton.getAttribute('data-journey-remove');\n        if (!removeId) return;\n        // window.confirm, as the Manage downloads sheet asks it: the copy\n        // names what goes and what it frees, so the choice is judged first.\n        var question = removeButton.getAttribute('data-journey-confirm') || '';\n        if (question && typeof window.confirm === 'function' && !window.confirm(question)) {\n          return;\n        }\n        removeArea(removeId);\n      }\n    });\n\n    doc.addEventListener('snowdesk:offline-readings', function (event) {\n      paint(/** @type {CustomEvent} */ (event).detail);\n    });\n\n    var api = audit();\n    if (!api || typeof api.latest !== 'function') return;\n    var current = api.latest();\n    if (current && current.readings) {\n      paint(current);\n    } else if (!current || !current.running) {\n      // No read yet, and none on its way: ask for one. A run already in\n      // flight (`?sync=`) announces its own readings when it lands.\n      api.refresh();\n    }\n  }\n\n  /**\n   * Bind every host on the page.\n   *\n   * @returns {void}\n   */\n  function init() {\n    var roots = document.querySelectorAll(ROOT_SELECTOR);\n    for (var i = 0; i < roots.length; i += 1) {\n      bind(/** @type {HTMLElement} */ (roots[i]));\n    }\n  }\n\n  self.pwaOfflineJourney = Object.freeze({ init: init });\n\n  if (document.readyState === 'loading') {\n    document.addEventListener('DOMContentLoaded', init);\n  } else {\n    init();\n  }\n})();\n"],
  "mappings": "CAkDC,UAAY,CACX,aAEA,IAAIA,EAAgB,yBAIhBC,EAAY,CACd,gBAAiB,oBACjB,kBAAmB,oCACnB,mBAAoB,sCACpB,kBAAmB,kBAEnB,iBAAkB,kBAClB,YAAa,UACb,mBAAoB,wBACpB,eAAgB,YAChB,aAAc,MACd,YAAa,KACb,iBAAkB,SAClB,iBAAkB,oCAClB,sBAAuB,8CACvB,mBAAoB,gDACpB,oBAAqB,0DACrB,sBAAuB,4CACvB,wBAAyB,wDACzB,wBAAyB,0CACzB,wBAAyB,+BACzB,wBAAyB,cAEzB,uBAAwB,kBACxB,wBAAyB,mCAEzB,aAAc,YACd,cAAe,8BACf,eAAgB,yB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AAiCgC,EAAM5E,CAAC,CAAE,CAE9C,CAEA,KAAK,kBAAoB,OAAO,OAAO,CAAE,KAAM2E,CAAK,CAAC,EAEjD,SAAS,aAAe,UAC1B,SAAS,iBAAiB,mBAAoBA,CAAI,EAElDA,EAAK,CAET,GAAG",
  "names": ["ROOT_SELECTOR", "FALLBACKS", "MAP_NOTES", "THINGS_NOTES", "strings", "say", "t", "key", "values", "template", "_m", "name", "clone", "doc", "id", "first", "fillSlot", "el", "attr", "text", "slot", "contentDay", "contentAt", "stamp", "day", "panelLabel", "panel", "renderStage", "stage", "note", "noteEl", "list", "rows", "row", "item", "renderTerrainLine", "line", "renderCountLine", "kind", "logLine", "hook", "value", "renderRun", "run", "runWhen", "stages", "failures", "failure", "status", "startedAt", "date", "hh", "mm", "renderLog", "block", "latest", "copy", "earlier", "older", "hashedArea", "hash", "openHashed", "output", "state", "areaId", "panels", "i", "renderPanel", "host", "label", "verdictEl", "fix", "map", "mapNote", "mapRow", "conditions", "conditionsNote", "conditionsRow", "things", "thingsNote", "thingsRow", "sync", "remove", "confirmText", "logSlot", "log", "audit", "size", "readReportIds", "db", "features", "ids", "feature", "tileReadings", "readings", "core", "out", "download", "area", "canRemove", "removal", "stampVerified", "detail", "at", "meta", "principal", "verified", "copyLog", "button", "clipboard", "bind", "root", "empty", "waiting", "busy", "lastDetail", "reportIds", "paintToken", "sameIds", "a", "b", "same", "paint", "paintWith", "token", "setBusy", "hashState", "on", "controls", "act", "work", "api", "removeArea", "event", "target", "copyButton", "syncButton", "removeButton", "removeId", "question", "current", "init", "roots"]
}
