{"version":3,"file":"boot-backdrop-9PYIhDHY.js","sources":["../../../../home/roko/Documents/Projects/Adjacent/noclip-unified/earth/refactor/ui/BootBackdropEntry.js"],"sourcesContent":["import { createBootVectorMap, getBootVectorViewBox, updateBootVectorMap, loadBootMapsourceDocument, renderBootMapsourceDocument } from './BootMapVector.js';\nimport { normalizeStartupLocation, readLastStartupLocation, readLegacyStartupLocation, resolveRootStartupLocation } from '../scene/StartupLocation.js';\n\n// Independent async HTML entry: no scene, UI framework, Three or provider imports.\n// Start geographic paint and acquisition while the application graph downloads.\nconst presentation = new URLSearchParams(location.search).get('presentation');\nconst host = document.getElementById('boot-map-basemap');\nif (host && !window.__noclipBootMap && !['orbital-header', 'earth-full'].includes(presentation)) {\n  const svg = createBootVectorMap();\n  host.replaceChildren(svg);\n  document.getElementById('boot-overlay')?.classList.add('active');\n  const state = { key: '', vectorController: null, vectorSequence: 0, resizeTimer: 0 };\n  const frame = locationValue => {\n    if (!locationValue || !host.isConnected) return;\n    const latLon = { ...locationValue, aglM: locationValue.altitude ?? 100 };\n    const framing = getBootVectorViewBox(latLon, innerWidth, innerHeight, { aglM: latLon.aglM });\n    const key = [latLon.lat.toFixed(5), latLon.lon.toFixed(5), framing.zoom.toFixed(3), innerWidth, innerHeight].join(':');\n    if (state.key === key) return;\n    const layout = updateBootVectorMap(svg, latLon, innerWidth, innerHeight, { aglM: latLon.aglM });\n    state.vectorController?.abort();\n    const controller = new AbortController();\n    Object.assign(state, { latLon, aglM: latLon.aglM, viewportW: innerWidth, viewportH: innerHeight,\n      key,\n      vectorLayout: layout, vectorController: controller, source: locationValue.source || 'seed' });\n    state.vectorSequence += 1;\n    const paint = async result => {\n      if (!controller.signal.aborted && svg.isConnected) {\n        await renderBootMapsourceDocument(svg, result, { signal: controller.signal });\n      }\n    };\n    void loadBootMapsourceDocument({ latLon, layout, signal: controller.signal, onProgress: paint })\n      .then(paint).catch(() => {});\n  };\n  const params = new URLSearchParams(location.search);\n  const explicit = normalizeStartupLocation({ lat: params.get('latitude') ?? params.get('lat'),\n    lon: params.get('longitude') ?? params.get('lon') ?? params.get('lng'), altitude: params.get('altitude') });\n  let saved = null;\n  try { saved = readLastStartupLocation() || readLegacyStartupLocation(); } catch {}\n  frame(explicit || saved);\n  const onResize = () => {\n    clearTimeout(state.resizeTimer);\n    state.resizeTimer = setTimeout(() => frame(state.latLon && { ...state.latLon, altitude: state.aglM }), 120);\n  };\n  window.addEventListener('resize', onResize);\n  const removal = new MutationObserver(() => {\n    if (host.isConnected) return;\n    state.vectorController?.abort();\n    clearTimeout(state.resizeTimer);\n    window.removeEventListener('resize', onResize);\n    removal.disconnect();\n  });\n  removal.observe(document.body, { childList: true });\n  window.__noclipEarlyBootBackdrop = { svg, state, adopt() {\n    clearTimeout(state.resizeTimer);\n    window.removeEventListener('resize', onResize);\n    removal.disconnect();\n  } };\n  const startup = window.__noclipRootStartupLocationPromise ||= resolveRootStartupLocation();\n  void startup.then(result => {\n    // The HTML boot owner takes over the existing request and startup promise.\n    if (!window.__noclipBootMap && result.location) frame(result.location);\n  }).catch(() => {});\n}\n"],"names":["presentation","host","svg","createBootVectorMap","_a","state","frame","locationValue","latLon","framing","getBootVectorViewBox","key","layout","updateBootVectorMap","controller","paint","result","renderBootMapsourceDocument","loadBootMapsourceDocument","params","explicit","normalizeStartupLocation","saved","readLastStartupLocation","readLegacyStartupLocation","onResize","removal","resolveRootStartupLocation"],"mappings":"uLAKA,MAAMA,EAAe,IAAI,gBAAgB,SAAS,MAAM,EAAE,IAAI,cAAc,EACtEC,EAAO,SAAS,eAAe,kBAAkB,QACvD,GAAIA,GAAQ,CAAC,OAAO,iBAAmB,CAAC,CAAC,iBAAkB,YAAY,EAAE,SAASD,CAAY,EAAG,CAC/F,MAAME,EAAMC,EAAmB,EAC/BF,EAAK,gBAAgBC,CAAG,GACxBE,EAAA,SAAS,eAAe,cAAc,IAAtC,MAAAA,EAAyC,UAAU,IAAI,UACvD,MAAMC,EAAQ,CAAE,IAAK,GAAI,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