uomtiles 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/_nuxt/7KYNy7kZ.js +1 -0
- package/.output/public/_nuxt/7Rgc2iDI2.js +1 -0
- package/.output/public/_nuxt/BA52uD81.js +1 -0
- package/.output/public/_nuxt/{CU486JdV2.js → BHSn2vP72.js} +2 -2
- package/.output/public/_nuxt/BRsHq3Fz2.js +1 -0
- package/.output/public/_nuxt/Bh2Uv1S7.js +1 -0
- package/.output/public/_nuxt/BiRI-vq-.js +1 -0
- package/.output/public/_nuxt/Bpc1HTfh.js +1 -0
- package/.output/public/_nuxt/C-b4mqsD.js +1 -0
- package/.output/public/_nuxt/C5Y76DD6.js +1 -0
- package/.output/public/_nuxt/CD84FXNW.js +1 -0
- package/.output/public/_nuxt/CGkIG2vL2.js +1 -0
- package/.output/public/_nuxt/CM9IbYJz.js +1 -0
- package/.output/public/_nuxt/CUJ4QmLF.js +1 -0
- package/.output/public/_nuxt/CUQ3MZqI.js +1 -0
- package/.output/public/_nuxt/CVwoxklV.js +1 -0
- package/.output/public/_nuxt/CeHZqNQ0.js +1 -0
- package/.output/public/_nuxt/CkfS_Wbu.js +3 -0
- package/.output/public/_nuxt/CoPjdBwX.js +1 -0
- package/.output/public/_nuxt/CxkDmpVY.js +1 -0
- package/.output/public/_nuxt/CzRdWh7s2.js +1 -0
- package/.output/public/_nuxt/D-IOtyQX.js +1 -0
- package/.output/public/_nuxt/D3Us7gX72.js +1 -0
- package/.output/public/_nuxt/{DaQqwE3R.js → D8GHPYwQ.js} +44 -44
- package/.output/public/_nuxt/DLIy3f3M.js +1 -0
- package/.output/public/_nuxt/{CovBj6WN.js → DQ8r1OSk.js} +1 -1
- package/.output/public/_nuxt/D_9SjQFe.js +1 -0
- package/.output/public/_nuxt/D_Ggu6R_2.js +1 -0
- package/.output/public/_nuxt/{Q79ec-Ro.js → DnVJUY7B.js} +1 -1
- package/.output/public/_nuxt/{Bd1EvHmY.js → DuGgjt-h2.js} +1 -1
- package/.output/public/_nuxt/GEOST6As.js +1 -0
- package/.output/public/_nuxt/{DpIPeY5m.js → GqgcWtrL.js} +1 -1
- package/.output/public/_nuxt/{0hm88Oke.js → Hbp_Okvs.js} +1 -1
- package/.output/public/_nuxt/JdUwgqKv.js +1 -0
- package/.output/public/_nuxt/KttxEAyP2.js +1 -0
- package/.output/public/_nuxt/L0GXeO1Y2.js +1 -0
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/ad8f3148-5aa4-4a0f-8e7a-e55147c5de1a.json +1 -0
- package/.output/public/_nuxt/entry.U-KS0GEu.css +1 -0
- package/.output/public/_nuxt/sMWyPZfC2.js +1 -0
- package/.output/public/_nuxt/zUWhKXtw2.js +1 -0
- package/.output/server/chunks/_/antigravity-nfz.mjs +629 -0
- package/.output/server/chunks/_/antigravity-nfz.mjs.map +1 -0
- package/.output/server/chunks/_/config.mjs +1 -1
- package/.output/server/chunks/_/file-workspace.mjs +1 -1
- package/.output/server/chunks/_/map-layer-update-manager.mjs +770 -0
- package/.output/server/chunks/_/map-layer-update-manager.mjs.map +1 -0
- package/.output/server/chunks/_/map-service.mjs +1 -1
- package/.output/server/chunks/_/uom-auth.mjs +1 -1
- package/.output/server/chunks/build/{CompletedTaskSelect-CKTpyHS3.mjs → CompletedTaskSelect-Ba03kTs9.mjs} +6 -7
- package/.output/server/chunks/build/{CompletedTaskSelect-CKTpyHS3.mjs.map → CompletedTaskSelect-Ba03kTs9.mjs.map} +1 -1
- package/.output/server/chunks/build/{Empty-BGIn09cL.mjs → Empty-CKvANuoV.mjs} +4 -103
- package/.output/server/chunks/build/Empty-CKvANuoV.mjs.map +1 -0
- package/.output/server/chunks/build/{FormField-DnJWfrKE.mjs → FormField-BJHVyy1m.mjs} +4 -35
- package/.output/server/chunks/build/FormField-BJHVyy1m.mjs.map +1 -0
- package/.output/server/chunks/build/{Input-AdlINKtJ.mjs → Input-DnAric-z.mjs} +1 -1
- package/.output/server/chunks/build/{Input-AdlINKtJ.mjs.map → Input-DnAric-z.mjs.map} +1 -1
- package/.output/server/chunks/build/MapLayerControl-DpNmYvcU.mjs +5720 -0
- package/.output/server/chunks/build/MapLayerControl-DpNmYvcU.mjs.map +1 -0
- package/.output/server/chunks/build/{Modal-CozaqIp1.mjs → Modal-BLhN9Eg2.mjs} +4 -18
- package/.output/server/chunks/build/{Modal-CozaqIp1.mjs.map → Modal-BLhN9Eg2.mjs.map} +1 -1
- package/.output/server/chunks/build/{OnlineMap-cFSicmkV.mjs → OnlineMap-B-sCfHkC.mjs} +6 -3
- package/.output/server/chunks/build/OnlineMap-B-sCfHkC.mjs.map +1 -0
- package/.output/server/chunks/build/{Pagination-GvNCxmOW.mjs → Pagination-CUzoLc_-.mjs} +1 -1
- package/.output/server/chunks/build/{Pagination-GvNCxmOW.mjs.map → Pagination-CUzoLc_-.mjs.map} +1 -1
- package/.output/server/chunks/build/Skeleton-CHp-GjOx.mjs +59 -0
- package/.output/server/chunks/build/Skeleton-CHp-GjOx.mjs.map +1 -0
- package/.output/server/chunks/build/{Slider-zQx1c7hB.mjs → Slider-CrIUK3pl.mjs} +5 -5
- package/.output/server/chunks/build/{Slider-zQx1c7hB.mjs.map → Slider-CrIUK3pl.mjs.map} +1 -1
- package/.output/server/chunks/build/{MapBaseLayerTabs-CRl5Zwlr.mjs → Tabs-cdLsZZoL.mjs} +429 -931
- package/.output/server/chunks/build/Tabs-cdLsZZoL.mjs.map +1 -0
- package/.output/server/chunks/build/{Tooltip-DNUdH4oF.mjs → Tooltip-DExIlyhu.mjs} +4 -195
- package/.output/server/chunks/build/Tooltip-DExIlyhu.mjs.map +1 -0
- package/.output/server/chunks/build/{advanced-5ZGMUBqC.mjs → advanced-DaSpS8Px.mjs} +31 -34
- package/.output/server/chunks/build/advanced-DaSpS8Px.mjs.map +1 -0
- package/.output/server/chunks/build/{compare-CtgF4Anj.mjs → compare-DaE10Dhp.mjs} +56 -37
- package/.output/server/chunks/build/compare-DaE10Dhp.mjs.map +1 -0
- package/.output/server/chunks/build/cookie-CziAmOf1.mjs +175 -0
- package/.output/server/chunks/build/cookie-CziAmOf1.mjs.map +1 -0
- package/.output/server/chunks/build/{dashboard-GneN-WPG.mjs → dashboard-Dq8mphss.mjs} +12 -6
- package/.output/server/chunks/build/{dashboard-GneN-WPG.mjs.map → dashboard-Dq8mphss.mjs.map} +1 -1
- package/.output/server/chunks/build/{details-CgufnL1d.mjs → details-DCNvSBgn.mjs} +5 -4
- package/.output/server/chunks/build/{details-CgufnL1d.mjs.map → details-DCNvSBgn.mjs.map} +1 -1
- package/.output/server/chunks/build/error-404-D9aQjJRn.mjs +1 -1
- package/.output/server/chunks/build/error-500-BNyA3wrb.mjs +1 -1
- package/.output/server/chunks/build/file-workspace-DMzPuPyG.mjs +104 -0
- package/.output/server/chunks/build/file-workspace-DMzPuPyG.mjs.map +1 -0
- package/.output/server/chunks/build/{interval-9B2MrM2e.mjs → interval-i5OZnTaK.mjs} +2 -2
- package/.output/server/chunks/build/{interval-9B2MrM2e.mjs.map → interval-i5OZnTaK.mjs.map} +1 -1
- package/.output/server/chunks/build/layers-50nqoWES.mjs +553 -0
- package/.output/server/chunks/build/layers-50nqoWES.mjs.map +1 -0
- package/.output/server/chunks/build/{login-Cf5EiCE4.mjs → login-BHSHtO-R.mjs} +6 -5
- package/.output/server/chunks/build/{login-Cf5EiCE4.mjs.map → login-BHSHtO-R.mjs.map} +1 -1
- package/.output/server/chunks/build/map-layers-C3HJoCLw.mjs +86 -0
- package/.output/server/chunks/build/map-layers-C3HJoCLw.mjs.map +1 -0
- package/.output/server/chunks/build/{DashboardSidebarToggle-CUI9NSow.mjs → overlay-BS4_B29H.mjs} +411 -4
- package/.output/server/chunks/build/overlay-BS4_B29H.mjs.map +1 -0
- package/.output/server/chunks/build/pages-5yYRS5nX.mjs +37 -0
- package/.output/server/chunks/build/pages-5yYRS5nX.mjs.map +1 -0
- package/.output/server/chunks/build/{pages-0c5sp_lv.mjs → pages-DfOPr0fC.mjs} +21 -21
- package/.output/server/chunks/build/pages-DfOPr0fC.mjs.map +1 -0
- package/.output/server/chunks/build/{services-BB49kSpd.mjs → services-DWlDpsbi.mjs} +45 -41
- package/.output/server/chunks/build/{services-BB49kSpd.mjs.map → services-DWlDpsbi.mjs.map} +1 -1
- package/.output/server/chunks/build/{tasks-BRcMLuRW.mjs → tasks-4b6D39Uy.mjs} +44 -100
- package/.output/server/chunks/build/{tasks-BRcMLuRW.mjs.map → tasks-4b6D39Uy.mjs.map} +1 -1
- package/.output/server/chunks/build/{tasks-Aa8PwjVL.mjs → tasks-BPPx2UMG.mjs} +10 -6
- package/.output/server/chunks/build/tasks-BPPx2UMG.mjs.map +1 -0
- package/.output/server/chunks/nitro/nitro.mjs +303 -244
- package/.output/server/chunks/routes/api/map/layers/_overlayLayer/update.get.mjs +29 -0
- package/.output/server/chunks/routes/api/map/layers/_overlayLayer/update.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/map/layers/_overlayLayer/update.post.mjs +31 -0
- package/.output/server/chunks/routes/api/map/layers/_overlayLayer/update.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/map/layers/_overlayLayer_.get.mjs +39 -0
- package/.output/server/chunks/routes/api/map/layers/_overlayLayer_.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/map/layers/status.get.mjs +60 -0
- package/.output/server/chunks/routes/api/map/layers/status.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/map/live/status.get.mjs +1 -1
- package/.output/server/chunks/routes/api/map/online/_layerGroup/_zoom/_tileX/_tileY_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/map/online-root/_layerGroup/_rootX/_rootY_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workspace/_filename/analysis.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workspace/_filename/download.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workspace/_filename/export/_format_.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workspace/_filename/export-estimate.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workspace/_filename/tile.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workspace/_filename/tiles.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workspace/_filename_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workspace/compare/batch.get.mjs +1 -1
- package/.output/server/chunks/routes/api/workspace/files.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workspace/stop.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workspace/tasks.post.mjs +2 -2
- package/.output/server/chunks/routes/renderer.mjs +3 -3
- package/.output/server/chunks/routes/services/wms.get.mjs +1 -1
- package/.output/server/chunks/routes/services/wmts.get.mjs +1 -1
- package/.output/server/chunks/virtual/entry.mjs +320 -443
- package/.output/server/chunks/virtual/entry.mjs.map +1 -1
- package/.output/server/chunks/virtual/precomputed.mjs +1 -1
- package/.output/server/chunks/virtual/styles.mjs +1 -1
- package/.output/server/node_modules/undici/index.js +234 -0
- package/.output/server/node_modules/undici/lib/api/abort-signal.js +59 -0
- package/.output/server/node_modules/undici/lib/api/api-connect.js +110 -0
- package/.output/server/node_modules/undici/lib/api/api-pipeline.js +252 -0
- package/.output/server/node_modules/undici/lib/api/api-request.js +214 -0
- package/.output/server/node_modules/undici/lib/api/api-stream.js +209 -0
- package/.output/server/node_modules/undici/lib/api/api-upgrade.js +111 -0
- package/.output/server/node_modules/undici/lib/api/index.js +7 -0
- package/.output/server/node_modules/undici/lib/api/readable.js +580 -0
- package/.output/server/node_modules/undici/lib/cache/memory-cache-store.js +279 -0
- package/.output/server/node_modules/undici/lib/cache/sqlite-cache-store.js +467 -0
- package/.output/server/node_modules/undici/lib/core/connect.js +153 -0
- package/.output/server/node_modules/undici/lib/core/constants.js +143 -0
- package/.output/server/node_modules/undici/lib/core/diagnostics.js +227 -0
- package/.output/server/node_modules/undici/lib/core/errors.js +477 -0
- package/.output/server/node_modules/undici/lib/core/request.js +464 -0
- package/.output/server/node_modules/undici/lib/core/socks5-client.js +422 -0
- package/.output/server/node_modules/undici/lib/core/socks5-utils.js +212 -0
- package/.output/server/node_modules/undici/lib/core/symbols.js +75 -0
- package/.output/server/node_modules/undici/lib/core/tree.js +160 -0
- package/.output/server/node_modules/undici/lib/core/util.js +992 -0
- package/.output/server/node_modules/undici/lib/dispatcher/agent.js +158 -0
- package/.output/server/node_modules/undici/lib/dispatcher/balanced-pool.js +219 -0
- package/.output/server/node_modules/undici/lib/dispatcher/client-h1.js +1731 -0
- package/.output/server/node_modules/undici/lib/dispatcher/client-h2.js +995 -0
- package/.output/server/node_modules/undici/lib/dispatcher/client.js +664 -0
- package/.output/server/node_modules/undici/lib/dispatcher/dispatcher-base.js +184 -0
- package/.output/server/node_modules/undici/lib/dispatcher/dispatcher.js +48 -0
- package/.output/server/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +146 -0
- package/.output/server/node_modules/undici/lib/dispatcher/fixed-queue.js +135 -0
- package/.output/server/node_modules/undici/lib/dispatcher/h2c-client.js +51 -0
- package/.output/server/node_modules/undici/lib/dispatcher/pool-base.js +214 -0
- package/.output/server/node_modules/undici/lib/dispatcher/pool.js +118 -0
- package/.output/server/node_modules/undici/lib/dispatcher/proxy-agent.js +319 -0
- package/.output/server/node_modules/undici/lib/dispatcher/retry-agent.js +35 -0
- package/.output/server/node_modules/undici/lib/dispatcher/round-robin-pool.js +137 -0
- package/.output/server/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +260 -0
- package/.output/server/node_modules/undici/lib/encoding/index.js +33 -0
- package/.output/server/node_modules/undici/lib/global.js +59 -0
- package/.output/server/node_modules/undici/lib/handler/cache-handler.js +760 -0
- package/.output/server/node_modules/undici/lib/handler/cache-revalidation-handler.js +124 -0
- package/.output/server/node_modules/undici/lib/handler/decorator-handler.js +67 -0
- package/.output/server/node_modules/undici/lib/handler/deduplication-handler.js +460 -0
- package/.output/server/node_modules/undici/lib/handler/redirect-handler.js +238 -0
- package/.output/server/node_modules/undici/lib/handler/retry-handler.js +418 -0
- package/.output/server/node_modules/undici/lib/handler/unwrap-handler.js +106 -0
- package/.output/server/node_modules/undici/lib/handler/wrap-handler.js +105 -0
- package/.output/server/node_modules/undici/lib/interceptor/cache.js +602 -0
- package/.output/server/node_modules/undici/lib/interceptor/decompress.js +259 -0
- package/.output/server/node_modules/undici/lib/interceptor/deduplicate.js +117 -0
- package/.output/server/node_modules/undici/lib/interceptor/dns.js +571 -0
- package/.output/server/node_modules/undici/lib/interceptor/dump.js +112 -0
- package/.output/server/node_modules/undici/lib/interceptor/redirect.js +21 -0
- package/.output/server/node_modules/undici/lib/interceptor/response-error.js +95 -0
- package/.output/server/node_modules/undici/lib/interceptor/retry.js +19 -0
- package/.output/server/node_modules/undici/lib/llhttp/constants.js +531 -0
- package/.output/server/node_modules/undici/lib/llhttp/llhttp-wasm.js +15 -0
- package/.output/server/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +15 -0
- package/.output/server/node_modules/undici/lib/llhttp/utils.js +12 -0
- package/.output/server/node_modules/undici/lib/mock/mock-agent.js +232 -0
- package/.output/server/node_modules/undici/lib/mock/mock-call-history.js +248 -0
- package/.output/server/node_modules/undici/lib/mock/mock-client.js +68 -0
- package/.output/server/node_modules/undici/lib/mock/mock-errors.js +29 -0
- package/.output/server/node_modules/undici/lib/mock/mock-interceptor.js +209 -0
- package/.output/server/node_modules/undici/lib/mock/mock-pool.js +68 -0
- package/.output/server/node_modules/undici/lib/mock/mock-symbols.js +32 -0
- package/.output/server/node_modules/undici/lib/mock/mock-utils.js +486 -0
- package/.output/server/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
- package/.output/server/node_modules/undici/lib/mock/snapshot-agent.js +353 -0
- package/.output/server/node_modules/undici/lib/mock/snapshot-recorder.js +588 -0
- package/.output/server/node_modules/undici/lib/mock/snapshot-utils.js +158 -0
- package/.output/server/node_modules/undici/lib/util/cache.js +676 -0
- package/.output/server/node_modules/undici/lib/util/date.js +670 -0
- package/.output/server/node_modules/undici/lib/util/promise.js +28 -0
- package/.output/server/node_modules/undici/lib/util/runtime-features.js +124 -0
- package/.output/server/node_modules/undici/lib/util/stats.js +32 -0
- package/.output/server/node_modules/undici/lib/util/timers.js +425 -0
- package/.output/server/node_modules/undici/lib/web/cache/cache.js +864 -0
- package/.output/server/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
- package/.output/server/node_modules/undici/lib/web/cache/util.js +45 -0
- package/.output/server/node_modules/undici/lib/web/cookies/constants.js +12 -0
- package/.output/server/node_modules/undici/lib/web/cookies/index.js +199 -0
- package/.output/server/node_modules/undici/lib/web/cookies/parse.js +314 -0
- package/.output/server/node_modules/undici/lib/web/cookies/util.js +352 -0
- package/.output/server/node_modules/undici/lib/web/eventsource/eventsource-stream.js +399 -0
- package/.output/server/node_modules/undici/lib/web/eventsource/eventsource.js +501 -0
- package/.output/server/node_modules/undici/lib/web/eventsource/util.js +29 -0
- package/.output/server/node_modules/undici/lib/web/fetch/body.js +509 -0
- package/.output/server/node_modules/undici/lib/web/fetch/constants.js +131 -0
- package/.output/server/node_modules/undici/lib/web/fetch/data-url.js +596 -0
- package/.output/server/node_modules/undici/lib/web/fetch/formdata-parser.js +586 -0
- package/.output/server/node_modules/undici/lib/web/fetch/formdata.js +259 -0
- package/.output/server/node_modules/undici/lib/web/fetch/global.js +40 -0
- package/.output/server/node_modules/undici/lib/web/fetch/headers.js +719 -0
- package/.output/server/node_modules/undici/lib/web/fetch/index.js +2413 -0
- package/.output/server/node_modules/undici/lib/web/fetch/request.js +1115 -0
- package/.output/server/node_modules/undici/lib/web/fetch/response.js +641 -0
- package/.output/server/node_modules/undici/lib/web/fetch/util.js +1522 -0
- package/.output/server/node_modules/undici/lib/web/infra/index.js +229 -0
- package/.output/server/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +307 -0
- package/.output/server/node_modules/undici/lib/web/webidl/index.js +1006 -0
- package/.output/server/node_modules/undici/lib/web/websocket/connection.js +329 -0
- package/.output/server/node_modules/undici/lib/web/websocket/constants.js +126 -0
- package/.output/server/node_modules/undici/lib/web/websocket/events.js +331 -0
- package/.output/server/node_modules/undici/lib/web/websocket/frame.js +133 -0
- package/.output/server/node_modules/undici/lib/web/websocket/permessage-deflate.js +100 -0
- package/.output/server/node_modules/undici/lib/web/websocket/receiver.js +507 -0
- package/.output/server/node_modules/undici/lib/web/websocket/sender.js +109 -0
- package/.output/server/node_modules/undici/lib/web/websocket/stream/websocketerror.js +104 -0
- package/.output/server/node_modules/undici/lib/web/websocket/stream/websocketstream.js +498 -0
- package/.output/server/node_modules/undici/lib/web/websocket/util.js +347 -0
- package/.output/server/node_modules/undici/lib/web/websocket/websocket.js +758 -0
- package/.output/server/node_modules/undici/package.json +152 -0
- package/.output/server/package.json +2 -1
- package/LICENSE +201 -2
- package/README.md +17 -4
- package/dist/package.json +3 -2
- package/dist/shared/antigravity-schema.js +45 -0
- package/dist/shared/dji-grid.js +62 -0
- package/dist/shared/types/map-layers.js +2 -0
- package/dist/src/cli.js +63 -5
- package/dist/src/core/dji-snapshot.js +135 -0
- package/dist/src/core/map-layer-paths.js +11 -0
- package/dist/src/map-layer-update.js +646 -0
- package/package.json +3 -2
- package/.output/public/_nuxt/BNfSclJ4.js +0 -1
- package/.output/public/_nuxt/BYzlinOr2.js +0 -1
- package/.output/public/_nuxt/Be4dNlar.js +0 -1
- package/.output/public/_nuxt/C7fHMLd7.js +0 -1
- package/.output/public/_nuxt/CNs_Ozdc.js +0 -1
- package/.output/public/_nuxt/CQ8inUdm.js +0 -1
- package/.output/public/_nuxt/Cc_JfSB1.js +0 -1
- package/.output/public/_nuxt/CyZDc0eO2.js +0 -1
- package/.output/public/_nuxt/CzFefJH0.js +0 -1
- package/.output/public/_nuxt/D-t0hXHB.js +0 -1
- package/.output/public/_nuxt/D3Pl7yw22.js +0 -1
- package/.output/public/_nuxt/D4gbGuiW.js +0 -1
- package/.output/public/_nuxt/DDp9lK3g.js +0 -1
- package/.output/public/_nuxt/DIIXHC50.js +0 -1
- package/.output/public/_nuxt/DWFUvzz0.js +0 -1
- package/.output/public/_nuxt/D_VoD6-f.js +0 -1
- package/.output/public/_nuxt/DfXX-x_z.js +0 -1
- package/.output/public/_nuxt/Dgyf2aNY.js +0 -1
- package/.output/public/_nuxt/GM5myUL22.js +0 -1
- package/.output/public/_nuxt/IC4wc76W.js +0 -1
- package/.output/public/_nuxt/IfL46N3Z.js +0 -1
- package/.output/public/_nuxt/KEU2l6zJ.js +0 -3
- package/.output/public/_nuxt/SEETjfdJ.js +0 -1
- package/.output/public/_nuxt/builds/meta/2c4adba2-91b5-44e4-91d3-50a61695207b.json +0 -1
- package/.output/public/_nuxt/entry.CZ_dkjcs.css +0 -1
- package/.output/public/_nuxt/nGp0t_eD.js +0 -1
- package/.output/server/chunks/build/Alert-DHVVSgdD.mjs +0 -1074
- package/.output/server/chunks/build/Alert-DHVVSgdD.mjs.map +0 -1
- package/.output/server/chunks/build/DashboardSidebarToggle-CUI9NSow.mjs.map +0 -1
- package/.output/server/chunks/build/Empty-BGIn09cL.mjs.map +0 -1
- package/.output/server/chunks/build/FocusScope-DNZVMnza.mjs +0 -207
- package/.output/server/chunks/build/FocusScope-DNZVMnza.mjs.map +0 -1
- package/.output/server/chunks/build/FormField-DnJWfrKE.mjs.map +0 -1
- package/.output/server/chunks/build/MapBaseLayerTabs-CRl5Zwlr.mjs.map +0 -1
- package/.output/server/chunks/build/OnlineMap-cFSicmkV.mjs.map +0 -1
- package/.output/server/chunks/build/Tooltip-DNUdH4oF.mjs.map +0 -1
- package/.output/server/chunks/build/advanced-5ZGMUBqC.mjs.map +0 -1
- package/.output/server/chunks/build/compare-CtgF4Anj.mjs.map +0 -1
- package/.output/server/chunks/build/pages-0c5sp_lv.mjs.map +0 -1
- package/.output/server/chunks/build/tasks-Aa8PwjVL.mjs.map +0 -1
|
@@ -0,0 +1,770 @@
|
|
|
1
|
+
import { c as createError, u as useRuntimeConfig } from '../nitro/nitro.mjs';
|
|
2
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
3
|
+
import { resolve, dirname } from 'node:path';
|
|
4
|
+
import { m as makeDjiBaseGrid, s as splitDjiCell, D as DJI_MAX_SPLIT_DEPTH, b as DJI_SATURATION_LIMIT, c as DJI_OVERLAP_DEGREES, d as DJI_TARGET_DIAGONAL_KM, e as DJI_ROW_DEGREES, f as DJI_LEVELS, h as DJI_ENDPOINT, i as DJI_COVERAGE, p as parseDjiSnapshot, j as assertAntigravityDatabaseSchema, k as getDjiNfzInfo, l as getAntigravityNfzInfo, M as MAP_LAYER_SNAPSHOT_FILENAMES } from './antigravity-nfz.mjs';
|
|
5
|
+
import { mkdir, stat, writeFile, rename, unlink, readFile, rm, readdir } from 'node:fs/promises';
|
|
6
|
+
import { DatabaseSync } from 'node:sqlite';
|
|
7
|
+
import { ProxyAgent, fetch } from 'undici';
|
|
8
|
+
import { s as serverDataDirectory } from './data-directory.mjs';
|
|
9
|
+
|
|
10
|
+
const DEFAULT_DJI_CONCURRENCY = 12;
|
|
11
|
+
const DJI_RESUME_MAX_AGE_MS = 6 * 60 * 60 * 1e3;
|
|
12
|
+
const ANTIGRAVITY_VERSION_ENDPOINT = "https://service.aerovista360.com/geo/open/getGeoDBInfo";
|
|
13
|
+
const ANTIGRAVITY_DOWNLOAD_HOST = "static.aerovista360.com";
|
|
14
|
+
const ANTIGRAVITY_SNAPSHOT_TYPE = 0;
|
|
15
|
+
const MAX_ANTIGRAVITY_MANIFEST_BYTES = 1024 * 1024;
|
|
16
|
+
const MAX_ANTIGRAVITY_SNAPSHOT_BYTES = 64 * 1024 * 1024;
|
|
17
|
+
async function updateDjiSnapshot(options) {
|
|
18
|
+
const context = createUpdateContext(options);
|
|
19
|
+
try {
|
|
20
|
+
await mkdir(context.outputDirectory, { recursive: true });
|
|
21
|
+
return await downloadDjiSnapshot(context, snapshotDestination(context.outputDirectory, options.destinationPath, "dji-nfz.json"));
|
|
22
|
+
} finally {
|
|
23
|
+
await closeUpdateContext(context);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function updateAntigravitySnapshot(options) {
|
|
27
|
+
const context = createUpdateContext(options);
|
|
28
|
+
try {
|
|
29
|
+
await mkdir(context.outputDirectory, { recursive: true });
|
|
30
|
+
return await downloadAntigravitySnapshot(context, snapshotDestination(context.outputDirectory, options.destinationPath, "antigravity-nfz.sqlite"));
|
|
31
|
+
} finally {
|
|
32
|
+
await closeUpdateContext(context);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function createUpdateContext(options) {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
if (!options || typeof options.outputDirectory !== "string" || !options.outputDirectory.trim()) {
|
|
38
|
+
throw new RangeError("Map layer output directory cannot be empty");
|
|
39
|
+
}
|
|
40
|
+
const outputDirectory = resolve(options.outputDirectory);
|
|
41
|
+
const djiConcurrency = (_a = options.djiConcurrency) != null ? _a : DEFAULT_DJI_CONCURRENCY;
|
|
42
|
+
const djiResume = (_b = options.djiResume) != null ? _b : true;
|
|
43
|
+
if (!Number.isInteger(djiConcurrency) || djiConcurrency <= 0) throw new RangeError("DJI concurrency must be a positive integer");
|
|
44
|
+
const proxy = process.env.HTTPS_PROXY || process.env.HTTP_PROXY || process.env.https_proxy || process.env.http_proxy;
|
|
45
|
+
return {
|
|
46
|
+
outputDirectory,
|
|
47
|
+
djiRawDirectory: resolve(options.djiRawDirectory || resolve(outputDirectory, "dji-raw")),
|
|
48
|
+
djiConcurrency,
|
|
49
|
+
djiResume,
|
|
50
|
+
onProgress: options.onProgress,
|
|
51
|
+
...proxy ? { dispatcher: new ProxyAgent(proxy) } : {}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
async function closeUpdateContext(context) {
|
|
55
|
+
var _a;
|
|
56
|
+
await ((_a = context.dispatcher) == null ? void 0 : _a.close());
|
|
57
|
+
}
|
|
58
|
+
async function downloadDjiSnapshot(context, destination = resolve(context.outputDirectory, "dji-nfz.json")) {
|
|
59
|
+
await mkdir(dirname(destination), { recursive: true });
|
|
60
|
+
const cells = makeDjiBaseGrid().map(queryCell);
|
|
61
|
+
reportProgress(context, "dji-nfz", "checking", 0, 1, "\u6B63\u5728\u8FDE\u63A5 DJI Flysafe");
|
|
62
|
+
const rawRootDirectory = context.djiRawDirectory;
|
|
63
|
+
await mkdir(rawRootDirectory, { recursive: true });
|
|
64
|
+
const session = await openDjiUpdateSession(rawRootDirectory, context.djiResume);
|
|
65
|
+
const rawDirectory = session.directory;
|
|
66
|
+
await mkdir(rawDirectory, { recursive: true });
|
|
67
|
+
reportProgress(context, "dji-nfz", "downloading", 0, cells.length, "\u6B63\u5728\u68C0\u67E5 DJI Flysafe \u533A\u57DF\u5206\u7247");
|
|
68
|
+
const areas = /* @__PURE__ */ new Map();
|
|
69
|
+
const serializedAreas = /* @__PURE__ */ new Map();
|
|
70
|
+
let completed = 0;
|
|
71
|
+
let queryCount = 0;
|
|
72
|
+
let occurrenceCount = 0;
|
|
73
|
+
let conflictingDuplicateCount = 0;
|
|
74
|
+
let resumedQueryCount = 0;
|
|
75
|
+
let saturatedQueryCount = 0;
|
|
76
|
+
let maximumLeafResultCount = 0;
|
|
77
|
+
const querySummaries = [];
|
|
78
|
+
const startedAtMilliseconds = Date.now();
|
|
79
|
+
const startedAt = session.startedAt;
|
|
80
|
+
async function processBatch(batch) {
|
|
81
|
+
const saturated = new Array(batch.length);
|
|
82
|
+
const workerCount = Math.min(context.djiConcurrency, batch.length);
|
|
83
|
+
const workers = Array.from({ length: workerCount }, async (_, worker) => {
|
|
84
|
+
for (let index = worker; index < batch.length; index += workerCount) {
|
|
85
|
+
const cell = batch[index];
|
|
86
|
+
const result = await readOrFetchDjiCell(cell, rawDirectory, context.djiResume, context.dispatcher);
|
|
87
|
+
if (result.resumed) resumedQueryCount++;
|
|
88
|
+
occurrenceCount += result.areas.length;
|
|
89
|
+
for (const area of result.areas) {
|
|
90
|
+
const key = djiAreaKey(area);
|
|
91
|
+
const serialized = JSON.stringify(area);
|
|
92
|
+
if (!areas.has(key)) {
|
|
93
|
+
areas.set(key, area);
|
|
94
|
+
serializedAreas.set(key, serialized);
|
|
95
|
+
} else if (serializedAreas.get(key) !== serialized) {
|
|
96
|
+
conflictingDuplicateCount++;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const isSaturated = result.areas.length >= DJI_SATURATION_LIMIT;
|
|
100
|
+
querySummaries.push({
|
|
101
|
+
id: djiCellName(cell),
|
|
102
|
+
...cell.parentId ? { parentId: cell.parentId } : {},
|
|
103
|
+
depth: cell.depth,
|
|
104
|
+
bounds: [cell.west, cell.south, cell.east, cell.north],
|
|
105
|
+
resultCount: result.areas.length,
|
|
106
|
+
saturated: isSaturated
|
|
107
|
+
});
|
|
108
|
+
if (isSaturated) {
|
|
109
|
+
if (cell.depth >= DJI_MAX_SPLIT_DEPTH) throw new Error(`DJI saturated cell reached maximum split depth: ${djiCellName(cell)}`);
|
|
110
|
+
saturated[index] = cell;
|
|
111
|
+
saturatedQueryCount++;
|
|
112
|
+
} else {
|
|
113
|
+
maximumLeafResultCount = Math.max(maximumLeafResultCount, result.areas.length);
|
|
114
|
+
}
|
|
115
|
+
completed++;
|
|
116
|
+
queryCount++;
|
|
117
|
+
reportProgress(
|
|
118
|
+
context,
|
|
119
|
+
"dji-nfz",
|
|
120
|
+
"downloading",
|
|
121
|
+
completed,
|
|
122
|
+
cells.length + saturatedQueryCount * 4,
|
|
123
|
+
`\u5DF2\u68C0\u67E5 ${completed} \u4E2A DJI Flysafe \u533A\u57DF\u5206\u7247`
|
|
124
|
+
);
|
|
125
|
+
if (completed % 20 === 0) {
|
|
126
|
+
const seconds = ((Date.now() - startedAtMilliseconds) / 1e3).toFixed(1);
|
|
127
|
+
process.stderr.write(`DJI FlySafe: ${completed} queries, ${areas.size} unique areas, ${seconds}s
|
|
128
|
+
`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
await Promise.all(workers);
|
|
133
|
+
return saturated.filter((cell) => Boolean(cell));
|
|
134
|
+
}
|
|
135
|
+
let frontier = cells;
|
|
136
|
+
while (frontier.length) {
|
|
137
|
+
const saturated = await processBatch(frontier);
|
|
138
|
+
frontier = saturated.flatMap((cell) => splitDjiCell(queryCell(cell)).map(queryCell));
|
|
139
|
+
if (frontier.length) process.stderr.write(`DJI FlySafe: splitting ${saturated.length} saturated queries into ${frontier.length} children
|
|
140
|
+
`);
|
|
141
|
+
}
|
|
142
|
+
if (conflictingDuplicateCount) throw new Error(`DJI returned ${conflictingDuplicateCount} conflicting duplicate areas`);
|
|
143
|
+
reportProgress(context, "dji-nfz", "validating", 0, 1, "\u6B63\u5728\u6821\u9A8C DJI Flysafe \u6570\u636E");
|
|
144
|
+
const sortedAreas = [...areas.values()].sort((left, right) => {
|
|
145
|
+
var _a, _b;
|
|
146
|
+
return String((_a = left == null ? void 0 : left.area_id) != null ? _a : "").localeCompare(String((_b = right == null ? void 0 : right.area_id) != null ? _b : ""), "en", { numeric: true });
|
|
147
|
+
});
|
|
148
|
+
const areasJson = JSON.stringify(sortedAreas);
|
|
149
|
+
const areasSha256 = createHash("sha256").update(areasJson).digest("hex");
|
|
150
|
+
const completedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
151
|
+
const snapshot = {
|
|
152
|
+
formatVersion: 2,
|
|
153
|
+
source: "DJI FlySafe",
|
|
154
|
+
scope: "global",
|
|
155
|
+
startedAt,
|
|
156
|
+
completedAt,
|
|
157
|
+
fetchedAt: completedAt,
|
|
158
|
+
coverage: DJI_COVERAGE,
|
|
159
|
+
query: {
|
|
160
|
+
algorithmVersion: "global-adaptive-grid-v1",
|
|
161
|
+
endpoint: DJI_ENDPOINT,
|
|
162
|
+
zonesMode: "flysafe_website",
|
|
163
|
+
drone: "dji-mavic-3",
|
|
164
|
+
levels: DJI_LEVELS,
|
|
165
|
+
rowDegrees: DJI_ROW_DEGREES,
|
|
166
|
+
targetDiagonalKm: DJI_TARGET_DIAGONAL_KM,
|
|
167
|
+
overlapDegrees: DJI_OVERLAP_DEGREES,
|
|
168
|
+
saturationLimit: DJI_SATURATION_LIMIT,
|
|
169
|
+
maxSplitDepth: DJI_MAX_SPLIT_DEPTH,
|
|
170
|
+
queryCount,
|
|
171
|
+
baseQueryCount: cells.length,
|
|
172
|
+
recursiveQueryCount: queryCount - cells.length,
|
|
173
|
+
saturatedQueryCount,
|
|
174
|
+
maximumLeafResultCount,
|
|
175
|
+
allLeafQueriesBelowSaturationLimit: true,
|
|
176
|
+
occurrenceCount,
|
|
177
|
+
uniqueAreaCount: sortedAreas.length,
|
|
178
|
+
duplicateOccurrences: occurrenceCount - sortedAreas.length,
|
|
179
|
+
conflictingDuplicateCount,
|
|
180
|
+
resumedQueryCount,
|
|
181
|
+
queries: querySummaries.sort((left, right) => left.id.localeCompare(right.id, "en", { numeric: true }))
|
|
182
|
+
},
|
|
183
|
+
areasSha256,
|
|
184
|
+
areas: sortedAreas
|
|
185
|
+
};
|
|
186
|
+
const contents = `${JSON.stringify(snapshot)}
|
|
187
|
+
`;
|
|
188
|
+
const existing = await readDjiSnapshotIdentity(destination);
|
|
189
|
+
if ((existing == null ? void 0 : existing.areasSha256) === areasSha256) {
|
|
190
|
+
reportProgress(context, "dji-nfz", "writing", 0, 1, "\u6B63\u5728\u8BB0\u5F55 DJI Flysafe \u68C0\u67E5\u65F6\u95F4");
|
|
191
|
+
await atomicWrite(destination, contents);
|
|
192
|
+
await completeDjiUpdateSession(session);
|
|
193
|
+
reportProgress(context, "dji-nfz", "writing", 1, 1, "\u5DF2\u68C0\u67E5\uFF0C\u533A\u57DF\u6570\u636E\u672A\u53D8\u5316");
|
|
194
|
+
return {
|
|
195
|
+
path: destination,
|
|
196
|
+
rawDirectory: rawRootDirectory,
|
|
197
|
+
queries: queryCount,
|
|
198
|
+
areas: sortedAreas.length,
|
|
199
|
+
bytes: Buffer.byteLength(contents),
|
|
200
|
+
sha256: createHash("sha256").update(contents).digest("hex"),
|
|
201
|
+
areasSha256,
|
|
202
|
+
fetchedAt: completedAt,
|
|
203
|
+
updated: false,
|
|
204
|
+
noUpdate: true
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
reportProgress(context, "dji-nfz", "writing", 0, 1, "\u6B63\u5728\u5199\u5165 DJI Flysafe \u5FEB\u7167");
|
|
208
|
+
await atomicWrite(destination, contents);
|
|
209
|
+
await completeDjiUpdateSession(session);
|
|
210
|
+
reportProgress(context, "dji-nfz", "writing", 1, 1, "DJI Flysafe \u66F4\u65B0\u5B8C\u6210");
|
|
211
|
+
return {
|
|
212
|
+
path: destination,
|
|
213
|
+
rawDirectory: rawRootDirectory,
|
|
214
|
+
queries: queryCount,
|
|
215
|
+
areas: snapshot.areas.length,
|
|
216
|
+
bytes: (await stat(destination)).size,
|
|
217
|
+
sha256: createHash("sha256").update(contents).digest("hex"),
|
|
218
|
+
areasSha256,
|
|
219
|
+
fetchedAt: completedAt,
|
|
220
|
+
updated: true,
|
|
221
|
+
noUpdate: false
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
async function readOrFetchDjiCell(cell, rawDirectory, resume, dispatcher) {
|
|
225
|
+
const url = djiRequestUrl(cell);
|
|
226
|
+
const requestHash = createHash("sha256").update(url.href).digest("hex").slice(0, 16);
|
|
227
|
+
const rawPath = resolve(rawDirectory, `${djiCellName(cell)}_${requestHash}.json`);
|
|
228
|
+
if (resume) {
|
|
229
|
+
try {
|
|
230
|
+
const payload = JSON.parse(await readFile(rawPath, "utf8"));
|
|
231
|
+
return { areas: djiResponseAreas(payload), resumed: true };
|
|
232
|
+
} catch {
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
let lastError;
|
|
236
|
+
for (let attempt = 1; attempt <= 7; attempt++) {
|
|
237
|
+
try {
|
|
238
|
+
const response = await fetch(url, {
|
|
239
|
+
signal: AbortSignal.timeout(6e4),
|
|
240
|
+
headers: { accept: "application/json", "user-agent": "Mozilla/5.0 uomtiles-map-layer-updater/1.0" },
|
|
241
|
+
...dispatcher ? { dispatcher } : {}
|
|
242
|
+
});
|
|
243
|
+
if (!response.ok) {
|
|
244
|
+
const error = new Error(`HTTP ${response.status}`);
|
|
245
|
+
error.retryAfterMilliseconds = retryAfterMilliseconds(response.headers.get("retry-after"));
|
|
246
|
+
throw error;
|
|
247
|
+
}
|
|
248
|
+
const declaredLength = Number(response.headers.get("content-length") || 0);
|
|
249
|
+
if (declaredLength > 16 * 1024 * 1024) throw new Error("DJI response is unexpectedly large");
|
|
250
|
+
const body = await response.text();
|
|
251
|
+
if (Buffer.byteLength(body) > 16 * 1024 * 1024) throw new Error("DJI response is unexpectedly large");
|
|
252
|
+
const payload = JSON.parse(body);
|
|
253
|
+
const responseAreas = djiResponseAreas(payload);
|
|
254
|
+
await atomicWrite(rawPath, body);
|
|
255
|
+
return { areas: responseAreas, resumed: false };
|
|
256
|
+
} catch (error) {
|
|
257
|
+
lastError = error;
|
|
258
|
+
if (attempt < 7) {
|
|
259
|
+
const backoff = Math.min(2e4, 600 * 2 ** (attempt - 1)) + Math.floor(Math.random() * 500);
|
|
260
|
+
const retryAfter = error instanceof Error && "retryAfterMilliseconds" in error ? Number(error.retryAfterMilliseconds || 0) : 0;
|
|
261
|
+
const delay = Math.max(backoff, retryAfter);
|
|
262
|
+
await new Promise((resolvePromise) => setTimeout(resolvePromise, delay));
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
throw new Error(`DJI cell ${djiCellName(cell)} failed: ${lastError instanceof Error ? lastError.message : String(lastError)}`);
|
|
267
|
+
}
|
|
268
|
+
function djiRequestUrl(cell) {
|
|
269
|
+
const url = new URL(DJI_ENDPOINT);
|
|
270
|
+
url.searchParams.set("ltlat", String(cell.north));
|
|
271
|
+
url.searchParams.set("ltlng", String(cell.west));
|
|
272
|
+
url.searchParams.set("rblat", String(cell.south));
|
|
273
|
+
url.searchParams.set("rblng", String(cell.east));
|
|
274
|
+
url.searchParams.set("zones_mode", "flysafe_website");
|
|
275
|
+
url.searchParams.set("drone", "dji-mavic-3");
|
|
276
|
+
url.searchParams.set("level", DJI_LEVELS);
|
|
277
|
+
return url;
|
|
278
|
+
}
|
|
279
|
+
function retryAfterMilliseconds(value) {
|
|
280
|
+
if (!value) return 0;
|
|
281
|
+
const seconds = Number(value);
|
|
282
|
+
if (Number.isFinite(seconds)) return Math.max(0, seconds * 1e3);
|
|
283
|
+
const date = Date.parse(value);
|
|
284
|
+
return Number.isFinite(date) ? Math.max(0, date - Date.now()) : 0;
|
|
285
|
+
}
|
|
286
|
+
function djiResponseAreas(payload) {
|
|
287
|
+
if (!isRecord(payload) || payload.code !== 0 || !isRecord(payload.data) || !Array.isArray(payload.data.areas)) {
|
|
288
|
+
throw new Error(djiResponseError(payload));
|
|
289
|
+
}
|
|
290
|
+
if (!payload.data.areas.every(isRecord)) throw new Error("invalid DJI response areas");
|
|
291
|
+
return payload.data.areas;
|
|
292
|
+
}
|
|
293
|
+
function djiResponseError(payload) {
|
|
294
|
+
if (!isRecord(payload)) return "invalid DJI response";
|
|
295
|
+
if (payload.data !== void 0 && payload.data !== null) return String(payload.data);
|
|
296
|
+
if (isRecord(payload.message) && typeof payload.message.english === "string") return payload.message.english;
|
|
297
|
+
return "invalid DJI response";
|
|
298
|
+
}
|
|
299
|
+
function djiCellName(cell) {
|
|
300
|
+
return cell.id;
|
|
301
|
+
}
|
|
302
|
+
function djiAreaKey(area) {
|
|
303
|
+
if ((area == null ? void 0 : area.area_id) === void 0 || (area == null ? void 0 : area.area_id) === null || String(area.area_id).trim() === "") {
|
|
304
|
+
throw new Error("DJI response area is missing area_id");
|
|
305
|
+
}
|
|
306
|
+
return `id:${area.area_id}`;
|
|
307
|
+
}
|
|
308
|
+
async function downloadAntigravitySnapshot(context, destination = resolve(context.outputDirectory, "antigravity-nfz.sqlite")) {
|
|
309
|
+
await mkdir(dirname(destination), { recursive: true });
|
|
310
|
+
const fetchedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
311
|
+
reportProgress(context, "antigravity-nfz", "checking", 0, 1, "\u6B63\u5728\u68C0\u67E5 Antigravity \u5728\u7EBF\u7248\u672C");
|
|
312
|
+
const manifest = await fetchAntigravityManifest(context);
|
|
313
|
+
const current = await inspectAntigravitySnapshot(destination).catch(() => null);
|
|
314
|
+
if ((current == null ? void 0 : current.version) === manifest.versionCode) {
|
|
315
|
+
reportProgress(context, "antigravity-nfz", "checking", 1, 1, "\u65E0\u65B0\u7248\u672C");
|
|
316
|
+
return {
|
|
317
|
+
path: destination,
|
|
318
|
+
bytes: current.bytes,
|
|
319
|
+
sha256: current.sha256,
|
|
320
|
+
sqliteSha256: current.sha256,
|
|
321
|
+
fences: current.fences,
|
|
322
|
+
version: current.version,
|
|
323
|
+
releasedAt: current.releasedAt,
|
|
324
|
+
expiresAt: current.expiresAt,
|
|
325
|
+
fetchedAt,
|
|
326
|
+
updated: false,
|
|
327
|
+
noUpdate: true
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
const wrapped = await downloadAntigravityFile(context, manifest);
|
|
331
|
+
reportProgress(context, "antigravity-nfz", "validating", 0, 1, "\u6B63\u5728\u6821\u9A8C Antigravity \u6570\u636E");
|
|
332
|
+
const databaseBytes = extractAntigravitySqlite(wrapped, manifest);
|
|
333
|
+
const temporary = `${destination}.${process.pid}.${Date.now()}.tmp`;
|
|
334
|
+
try {
|
|
335
|
+
await writeFile(temporary, databaseBytes, { mode: 420 });
|
|
336
|
+
const candidate = await inspectAntigravitySnapshot(temporary);
|
|
337
|
+
if (candidate.version !== manifest.versionCode) {
|
|
338
|
+
throw new Error(`Antigravity \u7248\u672C\u6821\u9A8C\u5931\u8D25\uFF1A\u9884\u671F ${manifest.versionCode}\uFF0C\u5B9E\u9645 ${candidate.version || "\u672A\u77E5"}`);
|
|
339
|
+
}
|
|
340
|
+
reportProgress(context, "antigravity-nfz", "writing", 0, 1, "\u6B63\u5728\u5199\u5165 Antigravity \u5FEB\u7167");
|
|
341
|
+
await rename(temporary, destination);
|
|
342
|
+
reportProgress(context, "antigravity-nfz", "writing", 1, 1, "Antigravity \u66F4\u65B0\u5B8C\u6210");
|
|
343
|
+
return {
|
|
344
|
+
path: destination,
|
|
345
|
+
bytes: candidate.bytes,
|
|
346
|
+
sha256: candidate.sha256,
|
|
347
|
+
sqliteSha256: candidate.sha256,
|
|
348
|
+
fences: candidate.fences,
|
|
349
|
+
version: candidate.version,
|
|
350
|
+
releasedAt: candidate.releasedAt || manifest.releasedAt,
|
|
351
|
+
expiresAt: candidate.expiresAt || manifest.expiresAt,
|
|
352
|
+
fetchedAt,
|
|
353
|
+
updated: (current == null ? void 0 : current.sha256) !== candidate.sha256,
|
|
354
|
+
noUpdate: (current == null ? void 0 : current.sha256) === candidate.sha256
|
|
355
|
+
};
|
|
356
|
+
} finally {
|
|
357
|
+
await unlink(temporary).catch(() => {
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
async function fetchAntigravityManifest(context) {
|
|
362
|
+
const response = await fetch(ANTIGRAVITY_VERSION_ENDPOINT, {
|
|
363
|
+
method: "POST",
|
|
364
|
+
redirect: "error",
|
|
365
|
+
signal: AbortSignal.timeout(3e4),
|
|
366
|
+
headers: {
|
|
367
|
+
accept: "application/json",
|
|
368
|
+
"content-type": "application/json",
|
|
369
|
+
"user-agent": "uomtiles-map-layer-updater/1.0"
|
|
370
|
+
},
|
|
371
|
+
body: JSON.stringify({ snapshotType: ANTIGRAVITY_SNAPSHOT_TYPE }),
|
|
372
|
+
...context.dispatcher ? { dispatcher: context.dispatcher } : {}
|
|
373
|
+
});
|
|
374
|
+
if (!response.ok) throw new Error(`Antigravity \u7248\u672C\u68C0\u67E5\u5931\u8D25\uFF1AHTTP ${response.status}`);
|
|
375
|
+
const declaredLength = Number(response.headers.get("content-length") || 0);
|
|
376
|
+
if (declaredLength > MAX_ANTIGRAVITY_MANIFEST_BYTES) throw new Error("Antigravity \u7248\u672C\u54CD\u5E94\u8FC7\u5927");
|
|
377
|
+
const body = await response.text();
|
|
378
|
+
if (Buffer.byteLength(body) > MAX_ANTIGRAVITY_MANIFEST_BYTES) throw new Error("Antigravity \u7248\u672C\u54CD\u5E94\u8FC7\u5927");
|
|
379
|
+
let payload;
|
|
380
|
+
try {
|
|
381
|
+
payload = JSON.parse(body);
|
|
382
|
+
} catch {
|
|
383
|
+
throw new Error("Antigravity \u7248\u672C\u54CD\u5E94\u683C\u5F0F\u65E0\u6548");
|
|
384
|
+
}
|
|
385
|
+
return parseAntigravityVersionManifest(payload);
|
|
386
|
+
}
|
|
387
|
+
function parseAntigravityVersionManifest(payload) {
|
|
388
|
+
var _a, _b, _c;
|
|
389
|
+
if (!isRecord(payload) || payload.code !== 0 || !isRecord(payload.data)) {
|
|
390
|
+
const message = isRecord(payload) && typeof payload.msg === "string" ? payload.msg : "\u54CD\u5E94\u683C\u5F0F\u65E0\u6548";
|
|
391
|
+
throw new Error(`Antigravity \u7248\u672C\u68C0\u67E5\u5931\u8D25\uFF1A${message}`);
|
|
392
|
+
}
|
|
393
|
+
const versionCode = (_a = optionalString(payload.data.versionCode)) == null ? void 0 : _a.trim();
|
|
394
|
+
const fileUrl = (_b = optionalString(payload.data.fileUrl)) == null ? void 0 : _b.trim();
|
|
395
|
+
const fileSize = Number(payload.data.fileSize);
|
|
396
|
+
const verifyToken = (_c = optionalString(payload.data.verifyToken)) == null ? void 0 : _c.trim().toLowerCase();
|
|
397
|
+
if (!versionCode || !/^[0-9][0-9A-Za-z._-]{1,63}$/.test(versionCode)) throw new Error("Antigravity \u7248\u672C\u53F7\u65E0\u6548");
|
|
398
|
+
if (!fileUrl) throw new Error("Antigravity \u4E0B\u8F7D\u5730\u5740\u7F3A\u5931");
|
|
399
|
+
validateAntigravityDownloadUrl(fileUrl);
|
|
400
|
+
if (!Number.isSafeInteger(fileSize) || fileSize < 4096 || fileSize > MAX_ANTIGRAVITY_SNAPSHOT_BYTES) {
|
|
401
|
+
throw new Error("Antigravity \u6587\u4EF6\u5927\u5C0F\u65E0\u6548");
|
|
402
|
+
}
|
|
403
|
+
if (!verifyToken || !/^[0-9a-f]{32}$/.test(verifyToken)) throw new Error("Antigravity \u6821\u9A8C\u4EE4\u724C\u65E0\u6548");
|
|
404
|
+
return {
|
|
405
|
+
versionCode,
|
|
406
|
+
fileUrl,
|
|
407
|
+
fileSize,
|
|
408
|
+
verifyToken,
|
|
409
|
+
releasedAt: optionalString(payload.data.releasedTime),
|
|
410
|
+
expiresAt: optionalString(payload.data.expiredTime)
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
function extractAntigravitySqlite(contents, manifest) {
|
|
414
|
+
const wrapped = Buffer.from(contents);
|
|
415
|
+
if (wrapped.length !== manifest.fileSize) throw new Error("Antigravity \u4E0B\u8F7D\u6587\u4EF6\u5927\u5C0F\u4E0E\u7248\u672C\u4FE1\u606F\u4E0D\u7B26");
|
|
416
|
+
const wrappedMd5 = createHash("md5").update(wrapped).digest("hex");
|
|
417
|
+
if (wrappedMd5 !== manifest.verifyToken.toLowerCase()) throw new Error("Antigravity \u4E0B\u8F7D\u6587\u4EF6\u6821\u9A8C\u5931\u8D25");
|
|
418
|
+
const marker = wrapped.indexOf(Buffer.from("SQLite format 3\0", "ascii"));
|
|
419
|
+
if (marker < 0) throw new Error("Antigravity \u6570\u636E\u4E2D\u672A\u627E\u5230 SQLite \u5FEB\u7167");
|
|
420
|
+
const databaseBytes = wrapped.subarray(marker);
|
|
421
|
+
if (databaseBytes.length < 4096 || databaseBytes.length % 4096 !== 0) {
|
|
422
|
+
throw new Error("Antigravity SQLite \u5FEB\u7167\u957F\u5EA6\u5F02\u5E38");
|
|
423
|
+
}
|
|
424
|
+
return Buffer.from(databaseBytes);
|
|
425
|
+
}
|
|
426
|
+
async function downloadAntigravityFile(context, manifest) {
|
|
427
|
+
let url = new URL(manifest.fileUrl);
|
|
428
|
+
let response;
|
|
429
|
+
for (let redirects = 0; ; redirects++) {
|
|
430
|
+
validateAntigravityDownloadUrl(url.href);
|
|
431
|
+
response = await fetch(url, {
|
|
432
|
+
redirect: "manual",
|
|
433
|
+
signal: AbortSignal.timeout(6e4),
|
|
434
|
+
headers: { accept: "application/octet-stream", "user-agent": "uomtiles-map-layer-updater/1.0" },
|
|
435
|
+
...context.dispatcher ? { dispatcher: context.dispatcher } : {}
|
|
436
|
+
});
|
|
437
|
+
if (response.status < 300 || response.status >= 400) break;
|
|
438
|
+
if (redirects >= 3) throw new Error("Antigravity \u4E0B\u8F7D\u91CD\u5B9A\u5411\u8FC7\u591A");
|
|
439
|
+
const location = response.headers.get("location");
|
|
440
|
+
if (!location) throw new Error("Antigravity \u4E0B\u8F7D\u91CD\u5B9A\u5411\u65E0\u6548");
|
|
441
|
+
url = new URL(location, url);
|
|
442
|
+
}
|
|
443
|
+
if (!response.ok) throw new Error(`Antigravity \u4E0B\u8F7D\u5931\u8D25\uFF1AHTTP ${response.status}`);
|
|
444
|
+
const declaredLength = Number(response.headers.get("content-length") || 0);
|
|
445
|
+
if (declaredLength && declaredLength !== manifest.fileSize) throw new Error("Antigravity \u4E0B\u8F7D\u6587\u4EF6\u5927\u5C0F\u4E0E\u7248\u672C\u4FE1\u606F\u4E0D\u7B26");
|
|
446
|
+
if (!response.body) throw new Error("Antigravity \u4E0B\u8F7D\u54CD\u5E94\u4E3A\u7A7A");
|
|
447
|
+
const chunks = [];
|
|
448
|
+
let completed = 0;
|
|
449
|
+
reportProgress(context, "antigravity-nfz", "downloading", 0, manifest.fileSize, "\u6B63\u5728\u4E0B\u8F7D Antigravity \u6570\u636E");
|
|
450
|
+
for await (const chunk of response.body) {
|
|
451
|
+
const bytes = Buffer.from(chunk);
|
|
452
|
+
completed += bytes.length;
|
|
453
|
+
if (completed > manifest.fileSize || completed > MAX_ANTIGRAVITY_SNAPSHOT_BYTES) {
|
|
454
|
+
throw new Error("Antigravity \u4E0B\u8F7D\u6587\u4EF6\u8FC7\u5927");
|
|
455
|
+
}
|
|
456
|
+
chunks.push(bytes);
|
|
457
|
+
reportProgress(context, "antigravity-nfz", "downloading", completed, manifest.fileSize, "\u6B63\u5728\u4E0B\u8F7D Antigravity \u6570\u636E");
|
|
458
|
+
}
|
|
459
|
+
if (completed !== manifest.fileSize) throw new Error("Antigravity \u4E0B\u8F7D\u6587\u4EF6\u4E0D\u5B8C\u6574");
|
|
460
|
+
return Buffer.concat(chunks, completed);
|
|
461
|
+
}
|
|
462
|
+
function validateAntigravityDownloadUrl(value) {
|
|
463
|
+
let url;
|
|
464
|
+
try {
|
|
465
|
+
url = new URL(value);
|
|
466
|
+
} catch {
|
|
467
|
+
throw new Error("Antigravity \u4E0B\u8F7D\u5730\u5740\u4E0D\u53D7\u4FE1\u4EFB");
|
|
468
|
+
}
|
|
469
|
+
if (url.protocol !== "https:" || url.hostname !== ANTIGRAVITY_DOWNLOAD_HOST || url.port || url.username || url.password || !url.pathname.endsWith(".InstaCry")) {
|
|
470
|
+
throw new Error("Antigravity \u4E0B\u8F7D\u5730\u5740\u4E0D\u53D7\u4FE1\u4EFB");
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
async function inspectAntigravitySnapshot(path) {
|
|
474
|
+
var _a;
|
|
475
|
+
const contents = await readFile(path);
|
|
476
|
+
const database = new DatabaseSync(path, { readOnly: true });
|
|
477
|
+
try {
|
|
478
|
+
const integrity = (_a = database.prepare("PRAGMA integrity_check").get()) == null ? void 0 : _a.integrity_check;
|
|
479
|
+
if (integrity !== "ok") throw new Error(`Antigravity SQLite \u5B8C\u6574\u6027\u6821\u9A8C\u5931\u8D25\uFF1A${integrity}`);
|
|
480
|
+
assertAntigravityDatabaseSchema(database);
|
|
481
|
+
const version = database.prepare(`
|
|
482
|
+
SELECT version_code, released_time, expired_time
|
|
483
|
+
FROM version
|
|
484
|
+
WHERE COALESCE(is_deleted, 0) = 0
|
|
485
|
+
ORDER BY id DESC LIMIT 1
|
|
486
|
+
`).get();
|
|
487
|
+
const countRow = database.prepare("SELECT COUNT(*) AS count FROM fences WHERE is_valid = 1 AND is_deleted = 0").get();
|
|
488
|
+
const fences = Number((countRow == null ? void 0 : countRow.count) || 0);
|
|
489
|
+
if (!Number.isSafeInteger(fences) || fences <= 0) throw new Error("Antigravity \u6709\u6548\u533A\u57DF\u6570\u91CF\u65E0\u6548");
|
|
490
|
+
return {
|
|
491
|
+
bytes: contents.length,
|
|
492
|
+
sha256: createHash("sha256").update(contents).digest("hex"),
|
|
493
|
+
fences,
|
|
494
|
+
version: optionalString(version == null ? void 0 : version.version_code),
|
|
495
|
+
releasedAt: optionalString(version == null ? void 0 : version.released_time),
|
|
496
|
+
expiresAt: optionalString(version == null ? void 0 : version.expired_time)
|
|
497
|
+
};
|
|
498
|
+
} finally {
|
|
499
|
+
database.close();
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
function queryCell(cell) {
|
|
503
|
+
const [west, south, east, north] = cell.bounds;
|
|
504
|
+
return { ...cell, west, south, east, north };
|
|
505
|
+
}
|
|
506
|
+
const DJI_UPDATE_FINGERPRINT = createHash("sha256").update(JSON.stringify({
|
|
507
|
+
algorithmVersion: "global-adaptive-grid-v1",
|
|
508
|
+
endpoint: DJI_ENDPOINT,
|
|
509
|
+
coverage: DJI_COVERAGE,
|
|
510
|
+
levels: DJI_LEVELS,
|
|
511
|
+
rowDegrees: DJI_ROW_DEGREES,
|
|
512
|
+
targetDiagonalKm: DJI_TARGET_DIAGONAL_KM,
|
|
513
|
+
overlapDegrees: DJI_OVERLAP_DEGREES,
|
|
514
|
+
saturationLimit: DJI_SATURATION_LIMIT,
|
|
515
|
+
maxSplitDepth: DJI_MAX_SPLIT_DEPTH
|
|
516
|
+
})).digest("hex");
|
|
517
|
+
async function openDjiUpdateSession(rawRootDirectory, resume = true) {
|
|
518
|
+
await mkdir(rawRootDirectory, { recursive: true });
|
|
519
|
+
const manifestPath = resolve(rawRootDirectory, "active-session.json");
|
|
520
|
+
if (resume) {
|
|
521
|
+
try {
|
|
522
|
+
const manifest = JSON.parse(await readFile(manifestPath, "utf8"));
|
|
523
|
+
if (isDjiSessionManifest(manifest) && manifest.fingerprint === DJI_UPDATE_FINGERPRINT && isRecentDjiSession(manifest.startedAt)) {
|
|
524
|
+
const session = {
|
|
525
|
+
manifestPath,
|
|
526
|
+
sessionId: manifest.sessionId,
|
|
527
|
+
startedAt: manifest.startedAt,
|
|
528
|
+
directory: resolve(rawRootDirectory, manifest.sessionId)
|
|
529
|
+
};
|
|
530
|
+
await pruneDjiUpdateSessions(rawRootDirectory, session.sessionId);
|
|
531
|
+
return session;
|
|
532
|
+
}
|
|
533
|
+
} catch {
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
537
|
+
const sessionId = `${startedAt.replace(/[:.]/g, "-")}-${randomUUID()}`;
|
|
538
|
+
await atomicWrite(manifestPath, `${JSON.stringify({ fingerprint: DJI_UPDATE_FINGERPRINT, sessionId, startedAt })}
|
|
539
|
+
`);
|
|
540
|
+
await pruneDjiUpdateSessions(rawRootDirectory, sessionId);
|
|
541
|
+
return { manifestPath, sessionId, startedAt, directory: resolve(rawRootDirectory, sessionId) };
|
|
542
|
+
}
|
|
543
|
+
async function completeDjiUpdateSession(session) {
|
|
544
|
+
await rm(session.directory, { recursive: true, force: true }).catch(() => {
|
|
545
|
+
});
|
|
546
|
+
try {
|
|
547
|
+
const manifest = JSON.parse(await readFile(session.manifestPath, "utf8"));
|
|
548
|
+
if (isDjiSessionManifest(manifest) && manifest.sessionId === session.sessionId) await unlink(session.manifestPath);
|
|
549
|
+
} catch (error) {
|
|
550
|
+
if ((error == null ? void 0 : error.code) !== "ENOENT") throw error;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
async function pruneDjiUpdateSessions(rawRootDirectory, keepSessionId) {
|
|
554
|
+
const entries = await readdir(rawRootDirectory, { withFileTypes: true }).catch(() => []);
|
|
555
|
+
await Promise.all(entries.filter((entry) => entry.isDirectory() && entry.name !== keepSessionId && isDjiSessionId(entry.name)).map((entry) => rm(resolve(rawRootDirectory, entry.name), { recursive: true, force: true }).catch(() => {
|
|
556
|
+
})));
|
|
557
|
+
}
|
|
558
|
+
function isRecentDjiSession(startedAt) {
|
|
559
|
+
const age = Date.now() - Date.parse(startedAt);
|
|
560
|
+
return Number.isFinite(age) && age >= 0 && age <= DJI_RESUME_MAX_AGE_MS;
|
|
561
|
+
}
|
|
562
|
+
function isDjiSessionId(value) {
|
|
563
|
+
return /^[0-9TZa-f-]+$/.test(value);
|
|
564
|
+
}
|
|
565
|
+
function isDjiSessionManifest(value) {
|
|
566
|
+
return isRecord(value) && typeof value.fingerprint === "string" && typeof value.sessionId === "string" && isDjiSessionId(value.sessionId) && typeof value.startedAt === "string" && Number.isFinite(Date.parse(value.startedAt));
|
|
567
|
+
}
|
|
568
|
+
async function atomicWrite(destination, data) {
|
|
569
|
+
const temporary = `${destination}.${process.pid}.${Date.now()}.tmp`;
|
|
570
|
+
await writeFile(temporary, data, { mode: 420 });
|
|
571
|
+
await rename(temporary, destination);
|
|
572
|
+
}
|
|
573
|
+
function snapshotDestination(outputDirectory, configuredPath, filename) {
|
|
574
|
+
const configured = configuredPath == null ? void 0 : configuredPath.trim();
|
|
575
|
+
return configured ? resolve(configured) : resolve(outputDirectory, filename);
|
|
576
|
+
}
|
|
577
|
+
async function readDjiSnapshotIdentity(path) {
|
|
578
|
+
try {
|
|
579
|
+
const contents = await readFile(path, "utf8");
|
|
580
|
+
const snapshot = parseDjiSnapshot(contents);
|
|
581
|
+
const areasSha256 = snapshot.areasSha256;
|
|
582
|
+
return {
|
|
583
|
+
areasSha256,
|
|
584
|
+
sha256: createHash("sha256").update(contents).digest("hex"),
|
|
585
|
+
bytes: Buffer.byteLength(contents),
|
|
586
|
+
fetchedAt: snapshot.fetchedAt
|
|
587
|
+
};
|
|
588
|
+
} catch {
|
|
589
|
+
return null;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
function reportProgress(context, source, phase, completed, total, message) {
|
|
593
|
+
var _a;
|
|
594
|
+
(_a = context.onProgress) == null ? void 0 : _a.call(context, { source, phase, completed, total, message });
|
|
595
|
+
}
|
|
596
|
+
function optionalString(value) {
|
|
597
|
+
return value === void 0 || value === null ? void 0 : String(value);
|
|
598
|
+
}
|
|
599
|
+
function isRecord(value) {
|
|
600
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
const VALID_SOURCES = ["dji-nfz", "antigravity-nfz"];
|
|
604
|
+
const tasks = /* @__PURE__ */ new Map();
|
|
605
|
+
const running = /* @__PURE__ */ new Map();
|
|
606
|
+
function isSource(value) {
|
|
607
|
+
return typeof value === "string" && VALID_SOURCES.includes(value);
|
|
608
|
+
}
|
|
609
|
+
function assertMapLayerUpdateSource(value) {
|
|
610
|
+
if (!isSource(value)) throw createError({ statusCode: 404, message: "\u5730\u56FE\u53E0\u52A0\u5C42\u4E0D\u5B58\u5728" });
|
|
611
|
+
return value;
|
|
612
|
+
}
|
|
613
|
+
function idleTask(source) {
|
|
614
|
+
return {
|
|
615
|
+
source,
|
|
616
|
+
taskId: null,
|
|
617
|
+
status: "idle",
|
|
618
|
+
phase: null,
|
|
619
|
+
completed: 0,
|
|
620
|
+
total: 0,
|
|
621
|
+
percent: null,
|
|
622
|
+
message: "\u5C1A\u672A\u66F4\u65B0",
|
|
623
|
+
startedAt: null,
|
|
624
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
625
|
+
finishedAt: null
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
function view(task, source) {
|
|
629
|
+
if (!task) return idleTask(source);
|
|
630
|
+
return {
|
|
631
|
+
source: task.source,
|
|
632
|
+
taskId: task.taskId,
|
|
633
|
+
status: task.status,
|
|
634
|
+
phase: task.phase,
|
|
635
|
+
completed: task.completed,
|
|
636
|
+
total: task.total,
|
|
637
|
+
percent: task.percent,
|
|
638
|
+
message: task.message,
|
|
639
|
+
startedAt: task.startedAt,
|
|
640
|
+
updatedAt: task.updatedAt,
|
|
641
|
+
finishedAt: task.finishedAt,
|
|
642
|
+
...task.version ? { version: task.version } : {},
|
|
643
|
+
...task.contentHash ? { contentHash: task.contentHash } : {},
|
|
644
|
+
...task.error ? { error: task.error } : {}
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
function getMapLayerUpdate(source) {
|
|
648
|
+
return view(tasks.get(source), source);
|
|
649
|
+
}
|
|
650
|
+
function startMapLayerUpdate(source) {
|
|
651
|
+
const active = running.get(source);
|
|
652
|
+
if (active) return view(active, source);
|
|
653
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
654
|
+
const task = {
|
|
655
|
+
source,
|
|
656
|
+
taskId: randomUUID(),
|
|
657
|
+
status: "running",
|
|
658
|
+
phase: "checking",
|
|
659
|
+
completed: 0,
|
|
660
|
+
total: 0,
|
|
661
|
+
percent: null,
|
|
662
|
+
message: source === "dji-nfz" ? "\u6B63\u5728\u68C0\u67E5 DJI Flysafe \u5728\u7EBF\u6570\u636E" : "\u6B63\u5728\u68C0\u67E5 Antigravity \u5728\u7EBF\u6570\u636E",
|
|
663
|
+
startedAt: now,
|
|
664
|
+
updatedAt: now,
|
|
665
|
+
finishedAt: null
|
|
666
|
+
};
|
|
667
|
+
tasks.set(source, task);
|
|
668
|
+
running.set(source, task);
|
|
669
|
+
void execute(task);
|
|
670
|
+
return view(task, source);
|
|
671
|
+
}
|
|
672
|
+
function updateProgress(task, progress) {
|
|
673
|
+
const phase = progress.phase;
|
|
674
|
+
const completed = nonNegativeNumber(progress.completed);
|
|
675
|
+
const total = nonNegativeNumber(progress.total);
|
|
676
|
+
task.phase = phase;
|
|
677
|
+
task.completed = completed;
|
|
678
|
+
task.total = total;
|
|
679
|
+
task.percent = total > 0 ? Math.min(100, Math.max(0, Math.round(completed / total * 100))) : null;
|
|
680
|
+
task.message = progress.message.trim() || phaseMessage(task.source, phase);
|
|
681
|
+
task.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
682
|
+
}
|
|
683
|
+
async function execute(task) {
|
|
684
|
+
const before = await sourceIdentity(task.source);
|
|
685
|
+
try {
|
|
686
|
+
const result = task.source === "dji-nfz" ? await runDji(task) : await runAntigravity(task);
|
|
687
|
+
const after = await sourceIdentity(task.source);
|
|
688
|
+
if (result.updated !== true && result.noUpdate !== true) {
|
|
689
|
+
throw new Error(`${mapLayerSourceLabel(task.source)} \u66F4\u65B0\u5668\u672A\u8FD4\u56DE\u6709\u6548\u5B8C\u6210\u72B6\u6001`);
|
|
690
|
+
}
|
|
691
|
+
const resultContentHash = snapshotResultContentHash(result);
|
|
692
|
+
if (resultContentHash && (after == null ? void 0 : after.contentHash) && resultContentHash !== after.contentHash) {
|
|
693
|
+
throw new Error(`${mapLayerSourceLabel(task.source)} \u5FEB\u7167\u5199\u5165\u540E\u6821\u9A8C\u5931\u8D25`);
|
|
694
|
+
}
|
|
695
|
+
const unchanged = result.noUpdate === true || result.updated === false || Boolean((before == null ? void 0 : before.contentHash) && resultContentHash && before.contentHash === resultContentHash);
|
|
696
|
+
task.version = ("version" in result ? result.version : void 0) || result.fetchedAt || (after == null ? void 0 : after.version);
|
|
697
|
+
task.contentHash = resultContentHash || (after == null ? void 0 : after.contentHash) || result.sha256;
|
|
698
|
+
task.completed = task.total > 0 ? task.total : 1;
|
|
699
|
+
task.total = task.total > 0 ? task.total : 1;
|
|
700
|
+
task.percent = 100;
|
|
701
|
+
task.phase = "writing";
|
|
702
|
+
task.status = unchanged ? "no-update" : "completed";
|
|
703
|
+
task.message = unchanged ? "\u5DF2\u68C0\u67E5\uFF0C\u533A\u57DF\u6570\u636E\u672A\u53D8\u5316" : before ? "\u66F4\u65B0\u5B8C\u6210" : "\u4E0B\u8F7D\u5B8C\u6210";
|
|
704
|
+
task.error = void 0;
|
|
705
|
+
} catch (error) {
|
|
706
|
+
task.status = "failed";
|
|
707
|
+
task.phase = null;
|
|
708
|
+
task.percent = null;
|
|
709
|
+
task.error = error instanceof Error ? error.message : String(error);
|
|
710
|
+
task.message = "\u66F4\u65B0\u5931\u8D25";
|
|
711
|
+
} finally {
|
|
712
|
+
task.finishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
713
|
+
task.updatedAt = task.finishedAt;
|
|
714
|
+
if (running.get(task.source) === task) running.delete(task.source);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
function snapshotResultContentHash(result) {
|
|
718
|
+
return "areasSha256" in result ? result.areasSha256 : result.sha256;
|
|
719
|
+
}
|
|
720
|
+
function mapLayerSourceLabel(source) {
|
|
721
|
+
return source === "dji-nfz" ? "DJI Flysafe" : "Antigravity";
|
|
722
|
+
}
|
|
723
|
+
async function runDji(task) {
|
|
724
|
+
const location = updateLocation("dji-nfz");
|
|
725
|
+
return updateDjiSnapshot({
|
|
726
|
+
...location,
|
|
727
|
+
djiRawDirectory: resolve(location.outputDirectory, "dji-raw"),
|
|
728
|
+
onProgress: (progress) => updateProgress(task, progress)
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
async function runAntigravity(task) {
|
|
732
|
+
return updateAntigravitySnapshot({
|
|
733
|
+
...updateLocation("antigravity-nfz"),
|
|
734
|
+
onProgress: (progress) => updateProgress(task, progress)
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
async function sourceIdentity(source) {
|
|
738
|
+
try {
|
|
739
|
+
if (source === "dji-nfz") {
|
|
740
|
+
const info2 = await getDjiNfzInfo();
|
|
741
|
+
return { version: info2.version, contentHash: info2.areasSha256 };
|
|
742
|
+
}
|
|
743
|
+
const info = await getAntigravityNfzInfo();
|
|
744
|
+
return { version: info.version, contentHash: info.sqliteSha256 };
|
|
745
|
+
} catch {
|
|
746
|
+
return null;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
function updateLocation(source) {
|
|
750
|
+
const config = useRuntimeConfig();
|
|
751
|
+
const configured = source === "dji-nfz" ? String(config.djiNfzPath || "").trim() : String(config.antigravityNfzPath || "").trim();
|
|
752
|
+
if (configured) {
|
|
753
|
+
const destinationPath = resolve(configured);
|
|
754
|
+
return { outputDirectory: dirname(destinationPath), destinationPath };
|
|
755
|
+
}
|
|
756
|
+
const filename = source === "dji-nfz" ? MAP_LAYER_SNAPSHOT_FILENAMES.dji : MAP_LAYER_SNAPSHOT_FILENAMES.antigravity;
|
|
757
|
+
const outputDirectory = resolve(serverDataDirectory(), "map-layers");
|
|
758
|
+
return { outputDirectory, destinationPath: resolve(outputDirectory, filename) };
|
|
759
|
+
}
|
|
760
|
+
function phaseMessage(source, phase) {
|
|
761
|
+
const name = source === "dji-nfz" ? "DJI Flysafe" : "Antigravity";
|
|
762
|
+
return phase === "checking" ? `\u6B63\u5728\u68C0\u67E5 ${name} \u5728\u7EBF\u7248\u672C` : phase === "downloading" ? `\u6B63\u5728\u4E0B\u8F7D ${name} \u6570\u636E` : phase === "validating" ? `\u6B63\u5728\u6821\u9A8C ${name} \u6570\u636E` : `\u6B63\u5728\u5199\u5165 ${name} \u5FEB\u7167`;
|
|
763
|
+
}
|
|
764
|
+
function nonNegativeNumber(value) {
|
|
765
|
+
const number = typeof value === "number" ? value : Number(value);
|
|
766
|
+
return Number.isFinite(number) && number >= 0 ? Math.floor(number) : 0;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
export { assertMapLayerUpdateSource as a, getMapLayerUpdate as g, startMapLayerUpdate as s };
|
|
770
|
+
//# sourceMappingURL=map-layer-update-manager.mjs.map
|