{
  "version": 3,
  "sources": ["map_view_3d.js"],
  "sourcesContent": ["// @ts-check\n/*\n * static/js/map_view_3d.js \u2014 /map/'s 3-D view (SNOW-1449, SNOW-1455,\n * SNOW-1452, SNOW-1463).\n *\n * Loaded only for a signed-in reader in the map_3d flag (SNOW-1451)\n * (public/map.html), after map.js and the two 3-D helpers it reuses:\n * map_3d_core.js (the elevation source, the terrain, sky and sunlight\n * specs, the opening tilt and the pitch and pixel-ratio ceilings) and\n * map_3d_terrain.js (the elevation protocol and the idempotent install).\n * The rules that need no map are map_view_core.js's; this applies them.\n * See docs/decisions/a-3d-map-is-maplibre-terrain.md.\n *\n * ENTERING, from the 3D roundel or a tilt gesture, in either mode:\n *   1. the elevation protocol is registered, once;\n *   2. the map changes to the swisstopo winter map if it is not on it,\n *      without touching the picker's stored choice;\n *   3. the elevation source, the terrain, the sky and the north-west\n *      sunlight go on, the sunlight under the first label;\n *   4. the pixel ratio is capped (2x, or 1.5x on a canvas over 2.5 million\n *      device pixels, fitted again on each resize; SNOW-1464) and the\n *      camera eases to the opening tilt,\n *      with the pitch ceiling opened and the zoom floored at z9. A\n *      ?view=3d boot whose link named a tilt (`?at=` with a pitch above 0,\n *      published by map.js as snowdeskMapState.linkedPitch) keeps that\n *      pitch instead, including after the basemap swap (SNOW-1450);\n *   5. `?view=3d` is written and, if the basemap changed, one line says so.\n * LEAVING reverses all of it: the relief and the sunlight go (the\n * elevation source stays, so a return re-reads nothing), the camera ends\n * on pitch 0 with its bearing kept, and the reader's basemap comes back\n * (the ESRI one through resolveBasemapStyle; none at all when theirs is\n * swisstopo winter). The swisstopo rock hachures are the basemap's own\n * layers and are never touched.\n *\n * Every setStyle wipes the terrain with every other source, so while in\n * 3-D it is put back on `styledata`, gated on the elevation source being\n * gone. map.js's own reinstall of the overlays is separate and untouched.\n *\n * Both modes are drawn in 3-D (SNOW-1452), so a mode change keeps the view\n * and only re-reads the switch. map.js paints the danger fill as a light\n * wash in 3-D on snowdesk:map-view-changed; nothing here touches it. The\n * map leaves 3-D, with a line each, when it goes offline or is panned out\n * of Switzerland. Drawing a route\n * (snowdesk:route-draw) takes the relief and the tilt away and locks\n * tilting, on swisstopo winter; when it ends, 3-D comes back if it still\n * can, and otherwise the map leaves it.\n *\n * In 3-D the zoom stops at z9; a zoom-out at the floor says so once per\n * attempt (a burst of wheel ticks or one pinch), not once per tick. While\n * flat with 3-D available the pitch ceiling stays open, so a\n * reader's own tilt (it carries an originalEvent; an ease does not) is\n * what enters 3-D; anywhere else the ceiling is 0 and the map does not tilt.\n *\n * THE DEVICE (SNOW-1455). Three things lay 3-D flat and keep it off for\n * this visit only; nothing about the device is stored. Each goes through\n * exit({reason}), and the switch then reads the reason from available(),\n * so it is aria-disabled, a tap says why and the tilt stays locked.\n *   - The gate, worked out once at boot (map_view_core.deviceGate): no\n *     WebGL on the map's canvas, or 2 GB of memory or less on Android\n *     Chrome. A ?view=3d boot on such a device opens flat.\n *   - A lost WebGL context (MapLibre re-fires the canvas's\n *     webglcontextlost / webglcontextrestored as map events) goes flat\n *     with one line; until it is restored 3-D cannot be entered. The\n *     restore says nothing and turns the switch back on.\n *   - Frames over budget. A requestAnimationFrame loop runs between\n *     movestart and moveend, and for as long as the timelapse plays\n *     (snowdesk:timelapse-state, SNOW-1452), in 3-D and not suspended for\n *     a drawing. Its intervals go to map_3d_core.createFrameWatch, which\n *     trips on five failing ~2 s windows in a row (frameWindowFails). An\n *     interval either of whose frames saw tiles loading\n *     (!map.areTilesLoaded()) is not timed: close in, every pan fetches\n *     and drapes new tiles, and those frames run long on a phone that\n *     draws well (SNOW-1463). Timing starts after the first moveend that\n *     follows each tilt in, so the entering ease over a fresh style is\n *     not counted; the first interval of each run is dropped, and a\n *     hidden tab is never counted. Each closed window goes to the debug\n *     trace as `map 3d.window` while it records.\n *     A trip asks rather than drops (SNOW-1463): the map stays in 3-D,\n *     timing stops, and the toast says \"3D is running slowly here\" with\n *     \"Switch to 2D\" and \"Keep 3D\", and no timer. Switch to 2D goes flat\n *     for the visit (`left-slow`, then `why-slow` on the switch). Keep 3D,\n *     the \u00D7, or another line taking the toast's place all leave the\n *     watchdog silenced for the visit, playback included; nothing is\n *     stored. Leaving 3-D by any route takes the prompt away. During\n *     timelapse playback a trip still goes flat at once with no prompt,\n *     because playback cannot wait for a tap; that exit's basemap swap\n *     also stops the timelapse (SNOW-58).\n *\n * OFFLINE (SNOW-1453). A download with terrain data pins the elevation\n * tiles too, and stamps its record with their template, so offline 3-D\n * stays available inside a downloaded area: the boxes of the areas\n * stamped with today's template (basemap_download_core.elevationAreaBoxes\n * over pwaBasemapAreas.downloadedAreas()) go to availability as\n * `offlineAreas`. They are read at boot and again on every connectivity\n * change and snowdesk:downloads-changed; nothing probes the cache. Going\n * offline inside one keeps 3-D; a moveend offline with the centre outside\n * every box leaves it with a line, and panning back in makes it available\n * again without entering it. The read is asynchronous (IndexedDB), so an\n * offline ?view=3d boot waits for the first one before it decides, with\n * the switch disabled for `offline` until then; an online boot is\n * unchanged.\n *\n * THE 3D TEST (SNOW-1456). map_3d_test.js drives this map through three\n * more hooks. `canTest()` says whether the test may run here at all: not\n * offline (it needs tiles), not on a device the gate keeps out or with\n * the WebGL context lost, not while a route is drawn. `beginTest()` saves\n * the camera and the view, enters 3-D even when the watchdog has laid it\n * flat for the visit (every other gate still holds), and suspends the\n * watchdog until `endTest({verdict})`, which puts the camera and the view\n * back. A `smooth` or `stutter` verdict lifts the watchdog's latch, so\n * 3-D can be turned on again this visit; any other ending keeps it. The\n * `why-slow` line a tap on the disabled switch shows carries a \"Test this\n * device\" link that asks for the test (snowdesk:map-3d-test-requested).\n *\n * THE COVERAGE (SNOW-1460). 3-D opens over terrain_filter_core's Swiss box,\n * unless the map_beyond_switzerland flag is on: then\n * map_beyond_switzerland.js hands over the Alpine ring through\n * setCoverage, and a ?view=3d boot waits for it (capped, as the offline\n * wait is).\n *\n * Publishes `window.pwaMapView` (get / enter / exit / canTest / beginTest /\n * endTest / setCoverage): map.js reads the live view to retry the right basemap on a\n * reconnect, and the basemap picker hears `snowdesk:map-view-changed` to\n * disable its rows in 3-D.\n */\n(function mapView3dInit() {\n  'use strict';\n\n  const button = document.getElementById('map-view-toggle');\n  const mapEl = document.getElementById('map');\n  const viewCore = self.pwaMapViewCore;\n  const core = self.pwaMap3dCore;\n  const terrain = self.pwaMap3dTerrain;\n  const terrainCore = self.pwaTerrainFilterCore;\n  const state = window.snowdeskMapState;\n  const map = state ? state.map : null;\n  if (!button || !mapEl || !viewCore || !core || !terrain || !map) return;\n  if (mapEl.dataset.mapViewEnabled !== 'true') return;\n\n  const { FLAT, THREE_D } = viewCore.VIEWS;\n  const win = /** @type {any} */ (window);\n  /** Where map_state.js keeps the reader's basemap (BASEMAP_STORAGE_KEY). */\n  const BASEMAP_STORAGE_KEY = 'snowdesk.map.basemap';\n  const EASE_MS = 600;\n  /** Zoom-out input closer together than this is one attempt. */\n  const ATTEMPT_GAP_MS = 700;\n  /** How long an offline ?view=3d boot waits for the downloaded areas. */\n  const BOOT_BOXES_WAIT_MS = 2000;\n  /**\n   * Where 3-D opens: terrain_filter_core's Swiss box, until\n   * map_beyond_switzerland.js hands over the Alpine ring (SNOW-1460,\n   * setCoverage). Terrain mode's class tiles stay Swiss either way.\n   *\n   * @type {ReadonlyArray<number>|ReadonlyArray<ReadonlyArray<number>>|null}\n   */\n  let coverage = terrainCore ? terrainCore.COVERAGE_BOUNDS : null;\n  /** The map_beyond_switzerland flag is on: the coverage is handed over. */\n  const beyondSwitzerland = mapEl.dataset.mapBeyondSwitzerland === 'true';\n  /** Settles once the coverage has been handed over (or at once, unflagged). */\n  let coverageHanded = /** @type {(value?: unknown) => void} */ (() => {});\n  const coverageReady = beyondSwitzerland\n    ? new Promise((resolve) => { coverageHanded = resolve; })\n    : Promise.resolve();\n\n  const STRINGS = self.pwaStrings.read('map-view-strings-template', {\n    basemap: '3D uses the swisstopo winter map; yours comes back in 2D.',\n    'why-zoom': 'Zoom in to see 3D',\n    'why-offline': '3D needs a connection or a downloaded area',\n    'why-coverage': '3D covers Switzerland for now',\n    'why-editing': 'Finish drawing the route to see 3D',\n    'left-offline': 'Back in 2D: offline, 3D works only in a downloaded area.',\n    'left-coverage': 'Back in 2D: 3D covers Switzerland for now.',\n    'why-device': '3D is not available on this device',\n    'why-slow': '3D is too slow on this device',\n    'why-webgl': '3D comes back once the map\\'s graphics have reset',\n    'left-webgl': 'The map\\'s graphics reset, so it is flat again.',\n    'left-slow': 'Back in 2D: 3D is too slow on this device.',\n    'zoom-floor': '3D stops here. Switch to 2D to zoom out.',\n    'test-device': 'Test this device',\n    'slow-prompt': '3D is running slowly here',\n    'switch-2d': 'Switch to 2D',\n    'keep-3d': 'Keep 3D',\n  });\n\n  /** @type {string} */\n  let view = FLAT;\n  /** A route is being drawn. */\n  let drawing = false;\n  /** In 3-D, with the relief and the tilt held off for the drawing. */\n  let suspended = false;\n  /** The timelapse is playing (snowdesk:timelapse-state). */\n  let playing = false;\n  /** The camera is moving: between movestart and moveend. */\n  let moving = false;\n  /** @type {?number} */\n  let savedMinZoom = null;\n  /** @type {?number} */\n  let savedPixelRatio = null;\n  /**\n   * The reader's pixel ratio, held back while the WebGL context is lost:\n   * setPixelRatio resizes, and MapLibre takes a lost context's 0x0 drawing\n   * buffer for a hardware limit (_maxCanvasSize), so it waits for the\n   * restore.\n   *\n   * @type {?number}\n   */\n  let pendingPixelRatio = null;\n  let lastZoomOutAt = -Infinity;\n  /** The frame watchdog tripped: no more 3-D this visit. */\n  let tooSlow = false;\n  /**\n   * The reader was asked whether to keep 3-D on a slow device (SNOW-1463):\n   * the watchdog does not time anything again this visit. Never stored.\n   */\n  let silenced = false;\n  /** The slow prompt's buttons, while they are on the toast. */\n  let slowPrompt = /** @type {?HTMLElement} */ (null);\n  /** The map's WebGL context is lost and not yet restored. */\n  let contextLost = false;\n  /** The 3D test is running (beginTest to endTest): the watchdog rests. */\n  let testing = false;\n  /**\n   * The view and camera beginTest found, which endTest puts back.\n   *\n   * @type {?{view: string, camera: {center: [number, number], zoom: number, pitch: number, bearing: number}}}\n   */\n  let beforeTest = null;\n  /** deviceGate's answer, worked out once at boot; null lets 3-D in. */\n  let gated = /** @type {?string} */ (null);\n  /** The elevation tiles' template, which an area's stamp must match. */\n  const DEM_TEMPLATE = button.dataset.demTileUrl || '';\n  /**\n   * SNOW-1453: the boxes of the downloaded areas holding today's elevation\n   * tiles, where 3-D is available offline. Empty until the first read lands.\n   *\n   * @type {Array<ReadonlyArray<number>>}\n   */\n  let offlineAreas = [];\n  /** The read of the boxes now running, the latest one started. */\n  let boxesRead = /** @type {Promise<void>} */ (Promise.resolve());\n  /** Counts the reads, so an earlier one landing late is dropped. */\n  let boxesGeneration = 0;\n\n  // ---- What the page knows ----------------------------------------------\n\n  /** @param {string} text */\n  const say = (text) => {\n    if (win.MapSheet && typeof win.MapSheet.toast === 'function') win.MapSheet.toast(text);\n  };\n\n  /** @returns {boolean} */\n  const online = () => {\n    if (win.pwaConnectivity && typeof win.pwaConnectivity.isOnline === 'function') {\n      return win.pwaConnectivity.isOnline();\n    }\n    return navigator.onLine !== false;\n  };\n\n  /** @returns {{enabled: boolean, reason: ?string}} */\n  const available = () => viewCore.availability({\n    online: online(),\n    zoom: map.getZoom(),\n    gated: gated !== null,\n    // The test measures the device the watchdog judged; its latch waits.\n    tooSlow: tooSlow && !testing,\n    contextLost,\n    editing: drawing,\n    centre: map.getCenter(),\n    bounds: coverage,\n    offlineAreas,\n  });\n\n  /**\n   * Offline, with the centre outside every downloaded area that holds the\n   * elevation tiles: what lays 3-D flat once the map has gone offline.\n   *\n   * @returns {boolean}\n   */\n  const offlineOutside = () =>\n    !online() && !offlineAreas.some((box) => viewCore.covers(map.getCenter(), box));\n\n  /** @returns {Promise<Array<ReadonlyArray<number>>>} The boxes, read afresh. */\n  const readBoxes = async () => {\n    const areas = win.pwaBasemapAreas;\n    const downloads = win.pwaBasemapDownloadCore;\n    if (!DEM_TEMPLATE || !areas || typeof areas.downloadedAreas !== 'function') return [];\n    if (!downloads || typeof downloads.elevationAreaBoxes !== 'function') return [];\n    try {\n      // The device's own areas only: the account's would cost a request.\n      const held = await areas.downloadedAreas({ deviceOnly: true });\n      return downloads.elevationAreaBoxes(held, DEM_TEMPLATE);\n    } catch (_err) {\n      return [];\n    }\n  };\n\n  /**\n   * Read the boxes again; when the read lands, 3-D in use offline outside\n   * them is laid flat and the switch is brought up to date.\n   *\n   * @returns {Promise<void>}\n   */\n  const refreshBoxes = () => {\n    boxesGeneration += 1;\n    const generation = boxesGeneration;\n    boxesRead = readBoxes().then((boxes) => {\n      if (generation !== boxesGeneration) return;\n      offlineAreas = boxes;\n      if (view === THREE_D && offlineOutside()) exit({ reason: viewCore.REASONS.OFFLINE });\n      else sync();\n    });\n    return boxesRead;\n  };\n\n  /** @returns {Promise<void>} Once the latest read of the boxes has landed. */\n  const boxesSettled = async () => {\n    let read;\n    do {\n      read = boxesRead;\n      await read;\n    } while (read !== boxesRead);\n  };\n\n  /**\n   * A basemap row's style URL.\n   *\n   * @param {string} key\n   * @returns {string}\n   */\n  const urlFor = (key) => {\n    const row = /** @type {?HTMLElement} */ (\n      document.querySelector(`#basemap-menu [data-basemap-key=\"${key}\"]`)\n    );\n    return row ? row.dataset.basemapUrl || '' : '';\n  };\n\n  /** @returns {string} The reader's own basemap, as map.js reads it. */\n  const preferredKey = () => {\n    let stored = null;\n    try { stored = localStorage.getItem(BASEMAP_STORAGE_KEY); } catch (_err) { /* private mode */ }\n    return stored && urlFor(stored) ? stored : mapEl.dataset.defaultBasemapKey || '';\n  };\n\n  const exploded = new URLSearchParams(location.search).get('layers') === 'exploded';\n  /** The basemap the map is drawing (map.js booted it from the view). */\n  let drawn = exploded\n    ? viewCore.BASEMAP_KEY\n    : viewCore.basemapFor(viewCore.readView(location.search), preferredKey());\n  // The picker is the other thing that changes it.\n  // Counts every swap, the picker's included, so a fetch that resolves after\n  // a later swap has started cannot draw over it.\n  let swapGeneration = 0;\n  document.addEventListener('snowdesk:basemap-changing', (e) => {\n    const detail = /** @type {CustomEvent} */ (e).detail;\n    swapGeneration += 1;\n    if (detail && detail.key) drawn = detail.key;\n  });\n\n  /**\n   * Draw `key`, unless the map already is. The picker's stored choice is\n   * not touched. An ESRI basemap is fetched and rewritten first\n   * (map_state.js resolveBasemapStyle), so the swap is awaited.\n   *\n   * @param {string} key\n   * @returns {boolean} Whether a swap started.\n   */\n  const swapBasemap = (key) => {\n    if (!key || key === drawn) return false;\n    const url = urlFor(key);\n    if (!url) return false;\n    document.dispatchEvent(new CustomEvent('snowdesk:basemap-changing', { detail: { key, url } }));\n    drawn = key;\n    const generation = swapGeneration;\n    const resolve = win.resolveBasemapStyle;\n    // No diff: MapLibre 4.7.1 cannot diff a style that carries terrain (it\n    // warns, aborts tile requests and rebuilds anyway), and the swap\n    // replaces every source the basemap has.\n    Promise.resolve(typeof resolve === 'function' ? resolve(key, url) : url)\n      .then((style) => {\n        // A later swap started while this one was fetching; it wins.\n        if (generation !== swapGeneration) return;\n        map.setStyle(style, { diff: false });\n      })\n      .catch((/** @type {unknown} */ err) => console.warn('map_view_3d: could not change the basemap', err));\n    return true;\n  };\n\n  // ---- The relief -------------------------------------------------------\n\n  /** Put the relief on; a style still loading is retried on its styledata. */\n  const installNow = () => {\n    try {\n      terrain.installTerrain(map);\n    } catch (_err) {\n      // The style is not done loading; styledata comes again when it is.\n    }\n  };\n\n  const reinstall = () => {\n    if (view !== THREE_D || suspended) return;\n    if (map.getSource(core.DEM_SOURCE_ID) && terrain.hasTerrain(map)) return;\n    installNow();\n  };\n  map.on('styledata', reinstall);\n  map.on('style.load', reinstall);\n\n  const removeNow = () => {\n    try {\n      terrain.removeTerrain(map);\n    } catch (_err) {\n      // Nothing of it survived a setStyle; there is nothing to take away.\n    }\n  };\n\n  // ---- The controls -----------------------------------------------------\n\n  /** @returns {number} The pitch ceiling for where the map is now. */\n  const pitchCeiling = () => {\n    if (view === THREE_D) return suspended ? 0 : core.MAX_PITCH;\n    return available().enabled ? core.MAX_PITCH : 0;\n  };\n\n  /** The roundel's face and state, and the pitch ceiling. */\n  const sync = () => {\n    const pressed = view === THREE_D;\n    // A toggle's name stays put (\"3-D view\"); aria-pressed says whether it is on.\n    button.setAttribute('aria-pressed', pressed ? 'true' : 'false');\n    const blocked = !pressed && !available().enabled;\n    if (blocked) button.setAttribute('aria-disabled', 'true');\n    else button.removeAttribute('aria-disabled');\n    const ceiling = pitchCeiling();\n    if (map.getMaxPitch() !== ceiling) map.setMaxPitch(ceiling);\n  };\n\n  /**\n   * @param {string} next\n   * @param {string} [reason] Why the map left 3-D on its own (REASONS), if it did.\n   */\n  const announce = (next, reason) => {\n    document.documentElement.dataset.mapView = next;\n    try {\n      history.replaceState(history.state, '', location.pathname + viewCore.withView(location.search, next) + location.hash);\n    } catch (err) {\n      console.warn('map_view_3d: could not update the address bar', err);\n    }\n    const detail = reason ? { view: next, reason } : { view: next };\n    document.dispatchEvent(new CustomEvent('snowdesk:map-view-changed', { detail }));\n  };\n\n  // ---- The frame watchdog ----------------------------------------------\n\n  /**\n   * One closed watchdog window, onto the debug trace while it records.\n   *\n   * @param {object} closed What createFrameWatch's onWindow hears.\n   */\n  const traceWindow = (closed) => {\n    const log = win.pwaDebugLog;\n    if (!log || !log.on || typeof log.record !== 'function') return;\n    log.record('map', '3d.window', closed);\n  };\n\n  const watch = core.createFrameWatch({ onWindow: traceWindow });\n  /** A move has ended since the last tilt in, so moves are timed now. */\n  let timingArmed = false;\n  /** @type {?number} */\n  let frameRequest = null;\n  /** The last frame's timestamp in this run; null at the start of one. */\n  let lastFrameAt = /** @type {?number} */ (null);\n  /** The run's first interval has been dropped. */\n  let firstDropped = false;\n  /** The last frame saw tiles still loading. */\n  let lastFrameLoading = false;\n\n  /** @returns {boolean} Whether a move now is one the watchdog times. */\n  const timing = () =>\n    view === THREE_D && !suspended && timingArmed && !testing && !silenced && !document.hidden;\n\n  /** @returns {boolean} Whether the map is still fetching or draping tiles. */\n  const tilesLoading = () => typeof map.areTilesLoaded === 'function' && !map.areTilesLoaded();\n\n  /** Stop the loop; the next run starts afresh. */\n  const stopFrames = () => {\n    if (frameRequest !== null) window.cancelAnimationFrame(frameRequest);\n    frameRequest = null;\n    lastFrameAt = null;\n    firstDropped = false;\n    lastFrameLoading = false;\n  };\n\n  /** Go flat for the visit: the watchdog's own exit, or Switch to 2D. */\n  const dropForSlow = () => {\n    tooSlow = true;\n    exit({ reason: viewCore.REASONS.SLOW });\n  };\n\n  /**\n   * The watch tripped. During playback, flat at once; otherwise ask, and\n   * time nothing more whatever the answer.\n   */\n  const tripped = () => {\n    if (playing) {\n      dropForSlow();\n      return;\n    }\n    silenced = true;\n    stopFrames();\n    askSlow();\n  };\n\n  /** @param {number} at The frame's timestamp. */\n  const onFrame = (at) => {\n    frameRequest = null;\n    if (!timing() || !(moving || playing)) {\n      stopFrames();\n      return;\n    }\n    const loading = tilesLoading();\n    if (lastFrameAt !== null) {\n      // The first interval of a run carries the gesture's own start-up.\n      // An interval either end of which saw tiles loading is skipped.\n      if (!firstDropped) firstDropped = true;\n      else if (watch.push(at - lastFrameAt, loading || lastFrameLoading)) {\n        tripped();\n        return;\n      }\n    }\n    lastFrameAt = at;\n    lastFrameLoading = loading;\n    frameRequest = window.requestAnimationFrame(onFrame);\n  };\n\n  /** Start timing a move or playback, unless a run is on already. */\n  const startFrames = () => {\n    if (frameRequest !== null || !timing()) return;\n    lastFrameAt = null;\n    firstDropped = false;\n    frameRequest = window.requestAnimationFrame(onFrame);\n  };\n\n  /** @type {Record<string, string>} */\n  const WHY = {\n    zoom: STRINGS['why-zoom'],\n    offline: STRINGS['why-offline'],\n    coverage: STRINGS['why-coverage'],\n    editing: STRINGS['why-editing'],\n    device: STRINGS['why-device'],\n    slow: STRINGS['why-slow'],\n    webgl: STRINGS['why-webgl'],\n  };\n\n  /** @type {Record<string, string>} */\n  const LEFT = {\n    offline: STRINGS['left-offline'],\n    coverage: STRINGS['left-coverage'],\n    webgl: STRINGS['left-webgl'],\n    slow: STRINGS['left-slow'],\n  };\n\n  /**\n   * Tilt the relief in, with the ceiling open. Its ease is not timed.\n   *\n   * @param {number} [pitch] Where to tilt to: the opening tilt unless a\n   *   boot keeps a linked one.\n   */\n  const tiltIn = (pitch = core.OPENING_CAMERA.pitch) => {\n    timingArmed = false;\n    map.setMaxPitch(core.MAX_PITCH);\n    // freezeElevation: a boot tilts in before the style's styledata has\n    // installed the terrain, and MapLibre (4.7) tracks the ground's height\n    // on each ease frame only when terrain was on as the ease began\n    // (_prepareElevation). Terrain arriving mid-ease left the frame reading\n    // an unset centre, which threw inside the render queue and froze the\n    // map blank for good. A tilt keeps its centre, so there is no height to\n    // follow.\n    map.easeTo({ pitch, duration: EASE_MS, freezeElevation: true });\n    // easeTo stops an ease still running, and that fires its moveend here;\n    // the move this starts is the one whose end arms the timing.\n    timingArmed = false;\n  };\n\n  /**\n   * The tilt the boot camera's own link asked for (map.js publishes it on\n   * snowdeskMapState before it strips `?at=`), or null for none or 0.\n   *\n   * @returns {number|null}\n   */\n  const linkedPitch = () => {\n    const value = state ? state.linkedPitch : null;\n    return typeof value === 'number' && value > 0 ? Math.min(value, core.MAX_PITCH) : null;\n  };\n\n  /**\n   * Draw 3D at the ratio this canvas's size calls for (SNOW-1464): the\n   * device's, capped at 2x, and 1.5x on a large canvas.\n   *\n   * @returns {void}\n   */\n  const fitPixelRatio = () => {\n    const container = map.getContainer();\n    const ratio = core.pixelRatioFor(window.devicePixelRatio || 1, container.clientWidth, container.clientHeight);\n    if (ratio !== map.getPixelRatio()) map.setPixelRatio(ratio);\n  };\n\n  /**\n   * Enter 3-D, if it is available.\n   *\n   * @param {{gesture?: boolean, boot?: boolean}} [options]\n   * @returns {boolean} Whether the map is in 3-D now.\n   */\n  const enter = (options = {}) => {\n    if (view === THREE_D) return true;\n    const why = available();\n    // A boot below z9 is lifted to it by the floor, rather than refused.\n    if (!why.enabled && !(options.boot && why.reason === viewCore.REASONS.ZOOM)) {\n      if (!options.boot && why.reason) say(WHY[why.reason] || '');\n      if (!options.boot && why.reason === viewCore.REASONS.SLOW) offerTest();\n      return false;\n    }\n    terrain.registerDemProtocol(win.maplibregl, button.dataset.demTileUrl || '');\n    view = THREE_D;\n    suspended = false;\n    timingArmed = false;\n    savedMinZoom = map.getMinZoom();\n    map.setMinZoom(viewCore.MIN_ZOOM);\n    if (typeof map.setPixelRatio === 'function') {\n      savedPixelRatio = map.getPixelRatio();\n      fitPixelRatio();\n    }\n    const swapped = swapBasemap(viewCore.BASEMAP_KEY);\n    // A swap brings a new style; its styledata installs the relief.\n    if (!swapped) installNow();\n    // SNOW-1450: a boot from a link that asked for a tilt keeps it; every\n    // other entry tilts to the opening pitch.\n    const pitch = options.boot ? linkedPitch() : null;\n    const tilt = () => (pitch === null ? tiltIn() : tiltIn(pitch));\n    if (options.gesture) map.setMaxPitch(core.MAX_PITCH);\n    else tilt();\n    // A setStyle stops a camera ease where it stands (measured in\n    // Chromium), so the tilt runs again once the new style is in.\n    if (swapped && !options.gesture) {\n      map.once('style.load', () => {\n        if (view === THREE_D && !suspended) tilt();\n      });\n    }\n    announce(THREE_D);\n    sync();\n    if (swapped && !options.boot) say(STRINGS.basemap);\n    return true;\n  };\n\n  /**\n   * Leave 3-D: flat, on the reader's basemap.\n   *\n   * @param {{reason?: string}} [options]\n   * @returns {void}\n   */\n  const exit = (options = {}) => {\n    if (view !== THREE_D) return;\n    view = FLAT;\n    suspended = false;\n    hideSlowPrompt();\n    stopFrames();\n    watch.reset();\n    timingArmed = false;\n    removeNow();\n    map.setMinZoom(savedMinZoom === null ? 0 : savedMinZoom);\n    if (savedPixelRatio !== null && typeof map.setPixelRatio === 'function') {\n      if (contextLost) pendingPixelRatio = savedPixelRatio;\n      else map.setPixelRatio(savedPixelRatio);\n    }\n    savedPixelRatio = null;\n    // Flat at once, not eased: the setStyle below would stop an ease part\n    // way, leaving the flat map tilted.\n    map.jumpTo({ pitch: 0 });\n    swapBasemap(preferredKey());\n    // The reason travels with the change: a slow-frame trip stops the\n    // timelapse (map_timelapse.js), even when the reader's basemap is\n    // swisstopo winter and so no swap fires snowdesk:basemap-changing.\n    announce(FLAT, options.reason);\n    sync();\n    if (options.reason && LEFT[options.reason]) say(LEFT[options.reason]);\n  };\n\n  // ---- What moves the view ----------------------------------------------\n\n  button.addEventListener('click', (e) => {\n    // A tap on the segment already raised changes nothing; a tap on the\n    // other one, or Enter / Space on the switch, toggles.\n    const face = e.target instanceof Element ? e.target.closest('[data-view-face]') : null;\n    if (face && /** @type {HTMLElement} */ (face).dataset.viewFace === view) return;\n    if (view === THREE_D) {\n      exit();\n      return;\n    }\n    enter();\n  });\n\n  // The elevation tiles 3-D asks for first, warmed when the reader reaches\n  // for the roundel (map_3d_terrain.createPrefetcher, once per view).\n  const prefetch = terrain.createPrefetcher(button.dataset.demTileUrl || '');\n  for (const type of ['pointerenter', 'focus', 'touchstart']) {\n    button.addEventListener(type, () => {\n      if (view === FLAT && available().enabled) prefetch(map.getCenter(), map.getZoom());\n    }, { passive: true });\n  }\n\n  // A reader's own tilt enters 3-D, in either mode. An ease (ours, or the\n  // exit's way back to flat) carries no originalEvent.\n  map.on('pitch', (/** @type {any} */ e) => {\n    if (view !== FLAT || !e || !e.originalEvent) return;\n    if (map.getPitch() > 0) enter({ gesture: true });\n  });\n\n  // Both modes are drawn in 3-D: a mode change keeps the view.\n  document.addEventListener('snowdesk:map-mode-changed', sync);\n\n  // Offline, 3-D stays inside a downloaded area that holds the elevation\n  // tiles. The exit waits for the boxes to be read again (`refreshBoxes`\n  // decides it), so an area the reader downloaded or synced since the last\n  // read keeps them in 3-D rather than being judged on the old list.\n  const onConnectivity = () => {\n    sync();\n    refreshBoxes();\n  };\n  document.addEventListener('snowdesk:connectivity-changed', onConnectivity);\n  window.addEventListener('offline', onConnectivity);\n  window.addEventListener('online', onConnectivity);\n  // Every area-record write fires it: a download, a sync's stamp, a removal.\n  document.addEventListener('snowdesk:downloads-changed', () => {\n    refreshBoxes();\n  });\n\n  map.on('movestart', () => {\n    moving = true;\n    startFrames();\n  });\n\n  map.on('moveend', () => {\n    moving = false;\n    if (!playing) stopFrames();\n    // The first move to end after a tilt in is that ease; the next is timed.\n    if (view === THREE_D && !suspended) timingArmed = true;\n    if (view === THREE_D && !viewCore.covers(map.getCenter(), coverage)) {\n      exit({ reason: 'coverage' });\n      return;\n    }\n    // Offline, panned off every downloaded area: there is no elevation to\n    // draw. Panning back in makes 3-D available again, but does not enter.\n    if (view === THREE_D && offlineOutside()) {\n      exit({ reason: viewCore.REASONS.OFFLINE });\n      return;\n    }\n    // Playback started before the tilt-in ease ended is timed from now.\n    if (playing) startFrames();\n    sync();\n  });\n\n  // The timelapse plays in 3-D (it plays only on a desktop, SNOW-1452), and\n  // the watchdog times it as it times a move.\n  document.addEventListener('snowdesk:timelapse-state', (e) => {\n    const detail = /** @type {CustomEvent} */ (e).detail;\n    playing = !!(detail && detail.playing);\n    if (playing) startFrames();\n    else if (!moving) stopFrames();\n  });\n\n  document.addEventListener('snowdesk:route-draw', (e) => {\n    const detail = /** @type {CustomEvent} */ (e).detail;\n    drawing = !!(detail && detail.active);\n    if (view !== THREE_D) {\n      sync();\n      return;\n    }\n    if (drawing && !suspended) {\n      // Flat for the drawing, still on swisstopo winter: no setStyle.\n      suspended = true;\n      stopFrames();\n      removeNow();\n      map.jumpTo({ pitch: 0 });\n      sync();\n    } else if (!drawing && suspended) {\n      const why = available();\n      if (!why.enabled) {\n        exit({ reason: why.reason || undefined });\n        return;\n      }\n      suspended = false;\n      installNow();\n      tiltIn();\n      sync();\n    }\n  });\n\n  // A hidden tab draws nothing, and its gap is not a slow frame.\n  // Playback carries on behind a hidden tab, so timing it resumes when the\n  // tab comes back; a move has ended by then and starts its own run.\n  document.addEventListener('visibilitychange', () => {\n    if (document.hidden) stopFrames();\n    else if (playing) startFrames();\n  });\n\n  // A rotated iPad or a resized window can cross the large-canvas line. A\n  // setPixelRatio resizes too, and the second pass finds nothing to change.\n  map.on('resize', () => {\n    if (view !== THREE_D || contextLost || typeof map.setPixelRatio !== 'function') return;\n    fitPixelRatio();\n  });\n\n  // ---- WebGL lost and restored ------------------------------------------\n\n  map.on('webglcontextlost', () => {\n    contextLost = true;\n    if (view === THREE_D) exit({ reason: viewCore.REASONS.WEBGL });\n    else sync();\n  });\n\n  map.on('webglcontextrestored', () => {\n    contextLost = false;\n    // Flat already (the loss laid it flat); make sure, and say nothing.\n    if (view === THREE_D) exit();\n    if (map.getPitch() > 0) map.jumpTo({ pitch: 0 });\n    if (pendingPixelRatio !== null && typeof map.setPixelRatio === 'function') map.setPixelRatio(pendingPixelRatio);\n    pendingPixelRatio = null;\n    sync();\n  });\n\n  // ---- The zoom floor ---------------------------------------------------\n\n  /** One zoom-out input; the first of an attempt says where 3-D stops. */\n  const zoomOutAtFloor = () => {\n    if (view !== THREE_D || suspended) return;\n    if (map.getZoom() > viewCore.MIN_ZOOM + 0.01) return;\n    const now = Date.now();\n    const fresh = now - lastZoomOutAt > ATTEMPT_GAP_MS;\n    lastZoomOutAt = now;\n    if (fresh) say(STRINGS['zoom-floor']);\n  };\n\n  const container = map.getContainer();\n  container.addEventListener('wheel', (/** @type {WheelEvent} */ e) => {\n    if (e.deltaY > 0) zoomOutAtFloor();\n  }, { passive: true });\n  container.addEventListener('keydown', (/** @type {KeyboardEvent} */ e) => {\n    if (e.key === '-' || e.key === '_') zoomOutAtFloor();\n  });\n  /** The two fingers' last spread, while a pinch is on. */\n  let spread = 0;\n  /** @param {TouchEvent} e */\n  const pinchSpread = (e) => {\n    const [a, b] = [e.touches[0], e.touches[1]];\n    return Math.hypot(a.clientX - b.clientX, a.clientY - b.clientY);\n  };\n  container.addEventListener('touchstart', (/** @type {TouchEvent} */ e) => {\n    spread = e.touches.length === 2 ? pinchSpread(e) : 0;\n  }, { passive: true });\n  container.addEventListener('touchmove', (/** @type {TouchEvent} */ e) => {\n    if (e.touches.length !== 2 || !spread) return;\n    const now = pinchSpread(e);\n    if (now < spread - 8) zoomOutAtFloor();\n    spread = now;\n  }, { passive: true });\n\n  // ---- The 3D test (SNOW-1456) -------------------------------------------\n\n  /**\n   * Whether the 3D test may run here, and if not, why. The camera gates\n   * (zoom, coverage) do not count: the test flies its own camera over\n   * Saas-Fee.\n   *\n   * @returns {{ok: boolean, reason: ?string}}\n   */\n  const canTest = () => {\n    /** @param {string} reason */\n    const no = (reason) => ({ ok: false, reason });\n    if (gated !== null) return no(viewCore.REASONS.DEVICE);\n    if (contextLost) return no(viewCore.REASONS.WEBGL);\n    if (!online()) return no(viewCore.REASONS.OFFLINE);\n    if (drawing) return no(viewCore.REASONS.EDITING);\n    return { ok: true, reason: null };\n  };\n\n  /**\n   * Save the camera and the view, and enter 3-D for the test with the\n   * watchdog resting.\n   *\n   * @returns {boolean} Whether the map is in 3-D for the test.\n   */\n  const beginTest = () => {\n    if (testing) return view === THREE_D;\n    if (!canTest().ok) return false;\n    const centre = map.getCenter();\n    beforeTest = {\n      view,\n      camera: {\n        center: [centre.lng, centre.lat],\n        zoom: map.getZoom(),\n        pitch: map.getPitch(),\n        bearing: map.getBearing(),\n      },\n    };\n    testing = true;\n    stopFrames();\n    if (view === THREE_D) return true;\n    // Over Saas-Fee first, where the camera gates are met.\n    map.jumpTo({ center: core.OPENING_CAMERA.center.slice(), zoom: core.OPENING_CAMERA.zoom });\n    if (enter()) return true;\n    const saved = beforeTest;\n    testing = false;\n    beforeTest = null;\n    map.jumpTo({ ...saved.camera });\n    sync();\n    return false;\n  };\n\n  /**\n   * End the test: the watchdog wakes, a passing verdict lifts its latch,\n   * and the view and camera beginTest found come back.\n   *\n   * @param {{verdict?: string}} [result]\n   * @returns {void}\n   */\n  const endTest = (result = {}) => {\n    if (!testing) return;\n    testing = false;\n    const verdict = result && result.verdict;\n    if (verdict === 'smooth' || verdict === 'stutter') tooSlow = false;\n    watch.reset();\n    const saved = beforeTest;\n    beforeTest = null;\n    // Flat before the test: flat again, with no line (exit has no reason).\n    if (saved && saved.view !== THREE_D && view === THREE_D) exit();\n    if (saved) map.jumpTo({ ...saved.camera });\n    sync();\n  };\n\n  /** @returns {{toast: HTMLElement, body: Element}|null} The map toast's parts. */\n  const toastParts = () => {\n    const toast = document.getElementById('map-sheet-toast');\n    const body = toast ? toast.querySelector('[data-toast-body]') : null;\n    return toast && body ? { toast, body } : null;\n  };\n\n  /**\n   * A text button for the line the toast is showing.\n   *\n   * @param {string} label\n   * @param {string} hook The data attribute that names it.\n   * @param {() => void} onClick\n   * @returns {HTMLButtonElement}\n   */\n  const toastAction = (label, hook, onClick) => {\n    const action = document.createElement('button');\n    action.type = 'button';\n    action.className = 'ml-2 font-semibold underline underline-offset-2';\n    action.setAttribute(hook, '');\n    action.textContent = label;\n    action.addEventListener('click', onClick);\n    return action;\n  };\n\n  /**\n   * Put a \"Test this device\" link on the line the toast is showing (the\n   * `why-slow` line), which asks for the 3D test.\n   */\n  const offerTest = () => {\n    if (!canTest().ok) return;\n    const parts = toastParts();\n    if (!parts) return;\n    parts.body.append(' ', toastAction(STRINGS['test-device'], 'data-map-3d-test-open', () => {\n      parts.toast.classList.add('hidden');\n      document.dispatchEvent(new CustomEvent('snowdesk:map-3d-test-requested'));\n    }));\n  };\n\n  /**\n   * Ask whether to keep 3-D (SNOW-1463): the line and its two buttons, on\n   * a toast with no timer. The watchdog is silenced before this is asked,\n   * so a prompt that goes unanswered is Keep 3D.\n   */\n  function askSlow() {\n    if (win.MapSheet && typeof win.MapSheet.toast === 'function') {\n      win.MapSheet.toast(STRINGS['slow-prompt'], { sticky: true });\n    }\n    const parts = toastParts();\n    if (!parts) return;\n    const group = document.createElement('span');\n    group.setAttribute('data-map-3d-slow-prompt', '');\n    group.className = 'whitespace-nowrap';\n    group.append(\n      toastAction(STRINGS['switch-2d'], 'data-map-3d-switch-2d', () => {\n        hideSlowPrompt();\n        dropForSlow();\n      }),\n      toastAction(STRINGS['keep-3d'], 'data-map-3d-keep', hideSlowPrompt),\n    );\n    parts.body.append(' ', group);\n    slowPrompt = group;\n  }\n\n  /** Take the prompt away, if it is still the line the toast shows. */\n  function hideSlowPrompt() {\n    const group = slowPrompt;\n    slowPrompt = null;\n    if (!group || !group.isConnected) return;\n    const parts = toastParts();\n    if (parts) parts.toast.classList.add('hidden');\n    group.remove();\n  }\n\n  // ---- Boot -------------------------------------------------------------\n\n  /** @returns {boolean} Whether WebGL can be read from the map's canvas. */\n  const canvasHasWebgl = () => {\n    try {\n      const canvas = map.getCanvas();\n      // The context MapLibre made: asking for its own type hands it back.\n      return !!(canvas && (canvas.getContext('webgl2') || canvas.getContext('webgl')));\n    } catch (_err) {\n      return false;\n    }\n  };\n  // Only Chromium reports deviceMemory, so Android here means Android Chrome.\n  gated = viewCore.deviceGate({\n    webgl: canvasHasWebgl(),\n    deviceMemory: /** @type {any} */ (navigator).deviceMemory,\n    android: /Android/i.test(navigator.userAgent || ''),\n  });\n\n  document.documentElement.dataset.mapView = FLAT;\n  // map.js booted the view (swisstopo winter, the stored camera) from\n  // ?view=3d, in either mode, inside the coverage. A boot that still cannot\n  // enter (offline outside a downloaded area, or a device the gate keeps\n  // out) lays the map flat on the reader's basemap.\n  const bootInto3d = () => {\n    if (view === THREE_D) return;\n    if (!enter({ boot: true })) {\n      map.jumpTo({ pitch: 0 });\n      swapBasemap(preferredKey());\n      announce(FLAT);\n    }\n  };\n  refreshBoxes();\n  if (viewCore.readView(location.search) === THREE_D) {\n    // Online the boot is synchronous, as it always was. Offline it waits for\n    // the first read of the boxes, with the switch disabled until then, so\n    // nobody tilts in before the downloaded areas are known.\n    // The wait is capped: a read that never lands lays the map flat\n    // through the same path, rather than leaving the switch disabled.\n    // SNOW-1460: with map_beyond_switzerland the boot also waits for the\n    // Alpine coverage, which map_beyond_switzerland.js hands over as it\n    // loads, just after this script; under the same cap.\n    const cap = () => new Promise((resolve) => setTimeout(resolve, BOOT_BOXES_WAIT_MS));\n    if (online() && !beyondSwitzerland) bootInto3d();\n    else if (online()) Promise.race([coverageReady, cap()]).then(bootInto3d);\n    else Promise.race([Promise.all([boxesSettled(), coverageReady]), cap()]).then(bootInto3d);\n  }\n  sync();\n\n  /**\n   * SNOW-1460: the coverage 3-D opens over, handed over by\n   * map_beyond_switzerland.js (the Alpine ring). The switch is read again,\n   * and a waiting ?view=3d boot goes ahead.\n   *\n   * @param {ReadonlyArray<number>|ReadonlyArray<ReadonlyArray<number>>|null} next\n   */\n  const setCoverage = (next) => {\n    coverage = next;\n    coverageHanded();\n    sync();\n  };\n\n  window.pwaMapView = Object.freeze({\n    get: () => view,\n    enter: () => enter(),\n    exit: () => exit(),\n    canTest,\n    beginTest,\n    endTest,\n    setCoverage,\n  });\n})();\n"],
  "mappings": "CA6HC,UAAyB,CACxB,aAEA,MAAMA,EAAS,SAAS,eAAe,iBAAiB,EAClDC,EAAQ,SAAS,eAAe,KAAK,EACrCC,EAAW,KAAK,eAChBC,EAAO,KAAK,aACZC,EAAU,KAAK,gBACfC,GAAc,KAAK,qBACnBC,EAAQ,OAAO,iBACfC,EAAMD,EAAQA,EAAM,IAAM,KAEhC,GADI,CAACN,GAAU,CAACC,GAAS,CAACC,GAAY,CAACC,GAAQ,CAACC,GAAW,CAACG,GACxDN,EAAM,QAAQ,iBAAmB,OAAQ,OAE7C,KAAM,CAAE,KAAAO,EAAM,QAAAC,CAAQ,EAAIP,EAAS,MAC7BQ,EAA0B,OAE1BC,GAAsB,uBACtBC,GAAU,IAEVC,GAAiB,IAEjBC,GAAqB,IAQ3B,IAAIC,EAAWV,GAAcA,GAAY,gBAAkB,KAE3D,MAAMW,GAAoBf,EAAM,QAAQ,uBAAyB,OAEjE,IAAIgB,IAA2D,IAAM,CAAC,GACtE,MAAMC,GAAgBF,GAClB,IAAI,QAASG,GAAY,CAAEF,GAAiBE,CAAS,CAAC,EACtD,QAAQ,QAAQ,EAEdC,EAAU,KAAK,WAAW,KAAK,4BAA6B,CAChE,QAAS,4DACT,WAAY,oBACZ,cAAe,6CACf,eAAgB,gCAChB,cAAe,qCACf,eAAgB,2DAChB,gBAAiB,6CACjB,aAAc,qCACd,WAAY,gCACZ,YAAa,m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W,EACtCtG,EAAO,EAAG,QAAQ,KAAK,CAACzB,GAAegI,EAAI,CAAC,CAAC,EAAE,KAAKD,EAAU,EAClE,QAAQ,KAAK,CAAC,QAAQ,IAAI,CAACzF,GAAa,EAAGtC,EAAa,CAAC,EAAGgI,EAAI,CAAC,CAAC,EAAE,KAAKD,EAAU,CAC1F,CACA1F,EAAK,EASL,MAAM4F,GAAetE,GAAS,CAC5B9D,EAAW8D,EACX5D,GAAe,EACfsC,EAAK,CACP,EAEA,OAAO,WAAa,OAAO,OAAO,CAChC,IAAK,IAAMlC,EACX,MAAO,IAAMsF,EAAM,EACnB,KAAM,IAAMrD,EAAK,EACjB,QAAAuE,GACA,UAAAE,GACA,QAAAG,GACA,YAAAiB,EACF,CAAC,CACH,GAAG",
  "names": ["button", "mapEl", "viewCore", "core", "terrain", "terrainCore", "state", "map", "FLAT", "THREE_D", "win", "BASEMAP_STORAGE_KEY", "EASE_MS", "ATTEMPT_GAP_MS", "BOOT_BOXES_WAIT_MS", "coverage", "beyondSwitzerland", "coverageHanded", "coverageReady", "resolve", "STRINGS", "view", "drawing", "suspended", "playing", "moving", "savedMinZoom", "savedPixelRatio", "pendingPixelRatio", "lastZoomOutAt", "tooSlow", "silenced", "slowPrompt", "contextLost", "testing", "beforeTest", "gated", "DEM_TEMPLATE", "offlineAreas", "boxesRead", "boxesGeneration", "say", "text", "online", "available", "offlineOutside", "box", "readBoxes", "areas", "downloads", "held", "refreshBoxes", "generation", "boxes", "exit", "sync", "boxesSettled", "read", "urlFor", "key", "row", "preferredKey", "stored", "drawn", "swapGeneration", "detail", "swapBasemap", "url", "style", "err", "installNow", "reinstall", "removeNow", "pitchCeiling", "pressed", "ceiling", "announce", "next", "reason", "traceWindow", "closed", "log", "watch", "timingArmed", "frameRequest", "lastFrameAt", "firstDropped", "lastFrameLoading", "timing", "tilesLoading", "stopFrames", "dropForSlow", "tripped", "askSlow", "onFrame", "at", "loading", "startFrames", "WHY", "LEFT", "tiltIn", "pitch", "linkedPitch", "value", "fitPixelRatio", "container", "ratio", "enter", "options", "why", "offerTest", "swapped", "tilt", "hideSlowPrompt", "face", "prefetch", "type", "onConnectivity", "zoomOutAtFloor", "now", "fresh", "spread", "pinchSpread", "a", "b", "canTest", "no", "beginTest", "centre", "saved", "endTest", "result", "verdict", "toastParts", "toast", "body", "toastAction", "label", "hook", "onClick", "action", "parts", "group", "canvasHasWebgl", "canvas", "bootInto3d", "cap", "setCoverage"]
}
