[
  {
    "path": ".gitignore",
    "content": "# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\nlerna-debug.log*\n\n# no lock-file\npackage-lock.json\nyarn.lock\npnpm-lock.yaml\n\n# Diagnostic reports (https://nodejs.org/api/report.html)\nreport.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n*.lcov\n\n# nyc test coverage\n.nyc_output\n\n# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# Bower dependency directory (https://bower.io/)\nbower_components\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (https://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directories\nnode_modules/\njspm_packages/\n\n# TypeScript v1 declaration files\ntypings/\n\n# TypeScript cache\n*.tsbuildinfo\n\n# Optional npm cache directory\n.npm\n\n# Optional eslint cache\n.eslintcache\n\n# Microbundle cache\n.rpt2_cache/\n.rts2_cache_cjs/\n.rts2_cache_es/\n.rts2_cache_umd/\n\n# Optional REPL history\n.node_repl_history\n\n# Output of 'npm pack'\n*.tgz\n\n# Yarn Integrity file\n.yarn-integrity\n\n# dotenv environment variables file\n.env\n.env.test\n\n# parcel-bundler cache (https://parceljs.org/)\n.cache\n\n# Next.js build output\n.next\n\n# Nuxt.js build / generate output\n.nuxt\ndist\n\n# Gatsby files\n.cache/\n# Comment in the public line in if your project uses Gatsby and *not* Next.js\n# https://nextjs.org/blog/next-9-1#public-directory-support\n# public\n\n# vuepress build output\n.vuepress/dist\n\n# Serverless directories\n.serverless/\n\n# FuseBox cache\n.fusebox/\n\n# DynamoDB Local files\n.dynamodb/\n\n# TernJS port file\n.tern-port\nterrain\nconfig.json\ndem.tif"
  },
  {
    "path": ".npmrc",
    "content": "package-lock=false"
  },
  {
    "path": "CHANGES.md",
    "content": "# 更新日志\n## 2.1.0\n1. 支持多坐标系地形切片生成。\n2. 新增测试数据与测试用例。\n\n## 2.0.0\n核心依赖包变更，从node-gdal变更为node-gdal-async，变更优点如下：\n    \n1. gdal版本更新，JS语法更现代，适用于未来扩展和优化。\n2. 支持binding本机已安装的gdal程序，未来通过扩展本机gdal的webp驱动，支持生成webp格式的地形切片。\n3. 最新版本gdal的vsimem、vsicurl可以在未来版本开发新的特性，如对云上数据进行切片。\n\n\n其他：\n\n- 修复源地形文件open但没close bug。\n- 优化影像金字塔索引层级为根据数据自适应，之前版本根据影像分辨率自适应了zoom为高值上限，本次优化zoom为低值的下限。例如切5-14级别，但是从7级别开始，该缩小级别的影像宽高已经小于256像素，无需再建立其以下的索引。\n\n## 1.0.6\n\n新特性如下：\n- 输出切片位置可配置为mbtiles\n- 命令执行输入参数支持从配置文件读取，简化用户操作\n优化如下：\n- 数据重编码性能优化，栅格数据越大优化越明显\n\n## 1.0.5\n\n新特性如下：\n\n- 增加4490、4326的地形切片的生成\n- 增加切片输出目录的清理可选配置\n- 增加ctrl-c任务终止的临时文件清理\n- 修复子进程并发创建文件产生的bug\n\n## 1.0.4\n\n本版本无功能更新。特性如下：\n\n- 重构源码，拆分各个子模块任务区域\n- 代码添加了 JSDoc 注释，在 VSCode 开发时有较好的类型提示\n- 优化控制台进度提示文字的样式\n- 禁用 package 依赖锁文件的生成\n\n## 1.0.3\n\n具备基础的 DEM 切片功能，支持 tif 栅格文件作为输入数据源。\n\n- 支持 MapboxGL `raster-dem` 编码和 `terrarium` 编码的瓦片输出\n- 支持自定义瓦片尺寸，自动添加 1 像素裙边\n- 支持指定最大最小瓦片等级\n- 使用多进程加速创建瓦片\n"
  },
  {
    "path": "LICENSE",
    "content": "BSD 3-Clause License\n\nCopyright (c) 2022, 遥想公瑾当年\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n   list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\n   this list of conditions and the following disclaimer in the documentation\n   and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its\n   contributors may be used to endorse or promote products derived from\n   this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "README.md",
    "content": "# 简介\n\n根据 DEM 数据生成地形切片工具，使用 NodeJS + GDAL（NodeBinding）开发制作。可用于用户自定义 DEM 高程数据源生产地形瓦片，以便局域网离线使用。\n\n特点：\n\n- 支持 `mapbox` 和 `terrarium` 两种地形瓦片编码格式供mapboxgl使用，其中terrarium格式是[tangram](https://www.mapzen.com/products/tangram/)引擎的官方地形格式，tangram是另外一款开源的webgl二三维一体化的引擎；\n- 固定瓦片尺寸256，瓦片周围有1cell的buffer，即实际瓦片是258*258.\n- 自动读取数据源的坐标系统，重编码输入的 DEM 栅格文件，并重投影至指定的坐标系4490、4326、3857，默认3857，然后生成瓦片；\n- 支持适用于3857、4490、4326的地形切片生产；\n- 内置了影像金字塔索引和多进程实现（暂未使用多线程），加速瓦片生成速度；\n- 支持地形瓦片以文件目录或mbtiles两种格式存储；\n- 命令行提供了瓦片生成的进图条提示，便于用户查看生成进度。\n- 内置一些异常导致的临时文件清理工作。\n\n![生成进度条](./doc/progressbar.png)\n\n\n# 1. 安装与配置\n\n## 1.1. 配置 GDAL_DATA\n\n由于使用了 GDAL，用户需要 [下载 gdal-data.zip](./third-party/gdal-data.zip) 数据包，并配置 `GDAL_DATA` 环境变量为解压缩的目录。\n\n以 Windows 操作系统为例（此例直接使用 PostgreSQL 附带的资源，若用户有安装 PostgreSQL，也可以直接使用对应目录）：\n\n![配置环境变量](./doc/gdal-data.png)\n\n## 1.2. 安装\n\n从网络全局安装，成为命令行工具：\n\n```bash\nnpm i dem2terrain -g\nyarn add dem2terrain -g\npnpm add dem2terrain -g\n```\n\n源码安装（先将当前目录定位至工程根目录，且明白什么是 link 命令）：\n\n```bash\nnpm install && npm link\n# 或\nyarn && yarn link\n# 或\npnpm install && pnpm link --global\n```\n\n安装完毕后就可以当普通命令行程序使用了。\n\n## 1.3. 测试\n测试地形数据生产：\n```bash\nnpm run test\n\n```\n基于maplibregl地形预览：\n\n```bash\nnpm run server\n\n```\n浏览器输入地址进行预览：http://[ip]:[port]/terrain.html\n\n效果图如下：\n\n![地形测试可视化](./doc/terrain-test.png)\n\n# 2. 用法与说明\n\n当前支持作为命令行使用：\n\n```plaintext\n> dem2terrain --help\nUsage: dem2terrain [options]\n\n使用 GDAL 制作地形瓦片，支持 mapbox 和 terrarium 两种编码输出格式，当前仅输出 PNG 容器格式。\n\nOptions:\n  -v, --version               当前版本\n  -i, --input <string>        <必填> 输入 tif 格式的 DEM 文件路径，支持相对路径\n  -o, --output <string>       <必填> 输出目录，支持相对路径\n  -f, --configFile <File>     <可选> 通过配置文件执行任务，输入绝对路径，可参考配置模板\n  -g, --epsg <number>         <可选> Tile适用坐标系，3857 | 4490 | 4326 (default: 3857)\n  -r, --resampling <number>,  <可选> 构建影像金字塔或重投影时设置重采样策略，默认3，1:AVERAGE|2:BILINEAR|3:CUBIC|4:CUBICSPLINE|5:LANCZOS|6:MODE|7:NEAREST\n  -c, --clean <number>        <可选> 是否清空输出目录，0 | 1 (default: 0)\n  -z, --zoom <number-number>  <可选> 指定瓦片的等级生成范围。例如，想生成 7 ~ 12 级的瓦片，则输入 -z 7-12 (default: \"5-14\")\n  -e, --encoding <string>     <可选> 指定瓦片的数据编码规则（mapbox 或 terrarium） (default: \"mapbox\")\n  -h, --help                  帮助\n```\n\n可选参数说明：\n- `-i`: 输入 tif 格式的 DEM 文件路径，支持相对路径；\n- `-o`: 输出目录，支持相对路径；\n- `-g`: 指定地形Tile适用坐标系，默认是适用3857坐标系；\n- `-r`:  构建影像金字塔或重投影时设置重采样策略，默认3 CUBIC 采样；\n- `-z`: 由于地形栅格数据通常是 90m、30m 的空间分辨率，等级太大意义不大，等级太低时起伏辨识也不高，所以默认生成中间的 `5-14` 级；\n- `-c`: 指定是否预先清理输出瓦片的存储目录，默认0，不清理；\n- `-e`: 指定切片编码规则，默认 mapbox，用户可指定 terrarium 规则输出。\n- `-f`: 以上参数可以都放到一个配置json文件里，使用-f执行切片任务，简化操作；\n\n## 2.1 任务执行\n\n有两种形式执行命令行任务\n\n* 方式1：通过命令行参数执行任务\n```bash\ndem2terrain -z 4-15 -e terrarium -i ./ZONE.tiff -o ./output -c 1 -g 3857\n```\n\n* 方式2：通过配置文件执行任务\n\n1）配置参数\n```\n{\n    \"zoom\":\"5-13\",\n    \"epsg\": 3857,\n    \"encoding\": \"mapbox\",\n    \"input\": \"./data/xxx.tif\",\n    \"output\": \"./data/tile\",\n    \"clean\": true\n}\n```\n2）执行任务\n```bash\ndem2terrain -f d://config.json\n```\n\n## 2.2 数据输出\n支持地形切片生成以文件或mbtiles目录两种形式存储。\n\n* 以文件存储\n\n-o参数为文件目录，则以文件形式存储：\n```bash\ndem2terrain -z 4-15 -e terrarium -i ./ZONE.tiff -o ./output -c 1 -g 3857\n```\n\n* 以mbtiles存储\n\n-o参数带.mbtiles扩展名，则以mbtiles形式存储：\n```bash\ndem2terrain -z 4-15 -e terrarium -i ./ZONE.tiff -o ./output/tile.mbtiles -c 1 -g 3857\n```\n\n\n\n# 3. 使用输出成果\n\n使用 HTTP(S) 协议的 Web 服务器（例如 `nginx`、`IIS`）将生成的地形瓦片作为静态资源发布，即可使用。\n\n举例：根据 [MapboxGL 地形示例](https://docs.mapbox.com/mapbox-gl-js/example/add-terrain/) 简单修改，将在线数据源换成本地 Web 服务器发布的地址即可，注意编码格式要与生成时输入的编码格式一致。\n\n```javascript\n// 数据编码，'mapbox'或'terrarium'\nconst encoding = 'mapbox';\nconst maxZoom = 14;\nmap.addSource('my-custom-terrain', {\n  type: 'raster-dem',\n  encoding:encoding,\n  // 使用tiles方式替换本地发布的地形切片服务\n  tiles: ['./mapbox/{z}/{x}/{y}.png'],\n  // 注释掉官方的服务url，替换自己的\n\t//'url': 'mapbox://mapbox.mapbox-terrain-dem-v1',\n  tileSize: 256,\n  maxzoom: maxZoom,\n})\n```\n\n如下图所示：\n\n![本地离线切片可视化](./doc/demo.webp)\n\n# 4. TODO\n\n当前版本足够 MapboxGL.js 使用，但仍然有新功能未开发，留待以后扩展功能，初步拟定待扩展功能如下：\n\n- 大数据量的dem tif改用分块读取分块处理\n- 扩展 gdal 驱动，使其支持 webp，直接生成 webp 格式的切片\n- 重构核心模块，解耦，扩展使其支持生成 CesiumJS 支持的地形切片格式\n\n欢迎参与贡献，包括但不限于文档、功能扩展、性能优化！\n\n# 5. 安装问题\n\n## 5.1 c++编译环境问题\n\n由于node-gdal、node-gdal-next或node-gdal-async都会内置编译安装一个gdal，编译是需要依赖c++环境的，在win上常出现问题如下：\n```bash\nnpm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use\n```\n如果用户未安装vs c++环境，请最好安装下vs c++编译环境。\n如果用户已经安装了vs，例如vs2022仍提示找不到，配置如下：\n```bash\n# 配置npm的msvs版本号，例如安装了vs 2022\nnpm config set msvs_version 2022\n# 更新下node-gyp\nnpm install node-gyp@latest -g\n```\n## 5.2 环境变量冲突\n在node-gdal系列相关包npm安装成功后，使用过程中遇到投影操作定义就会报各种错误，典型错误如下：\n```\nconst srs= gdal.SpatialReference.fromProj4('+init=epsg:4326'); ^ Error: Corrupt Data\n```\n主要原因是win上各种软件包都会内置安装，环境变量冲突导致。\n\n例如，用户安装了PostGIS，会内置安装proj,geos,gdal并自动生成proj_lib的环境变量。\n```\nPROJ_LIB=C:\\Program Files\\PostgreSQL\\14\\share\\contrib\\postgis-3.1\\proj\n```\n当安装node-gdal-next或noe-gdal-async时，内置的proj和proj.db由于冲突不能生效，就会在使用过程中报各种错误。\n依此类推，如果用户安装了独立的GDAL，又有内置的proj，geos和环境变量也会有这种问题。\n解决办法：从系统环境变量中删除这些冲突的环境变量重启机器即可。\n\n## 5.3 最好的办法\n使用本机已编译好的gdal编译binding下node的gdal环境：\n```\nnpm install gdal-next --build-from-source --shared_gdal\n\nnpm install gdal-async --build-from-source --shared_gdal\n```\n\n这样，node的gdal环境可以和本机的gdal环境一致，能使用更多的驱动例如webp，内置驱动是没有的。\n这种操作可以让公用软件装一次，不会产生更多的冲突，linux上很方便。但由于windows上都不是源码编译，从.exe安装，因此不太适用。该操作适合c++编译环境熟悉的高级用户可定制安装多项扩展。\n\n\n# 6. 知识补充\n\n## 6.1. 参考资料\n\n- [GitHub - tilezen/joerd - terrarium](https://github.com/tilezen/joerd/blob/master/docs/formats.md#terrarium)\n\n- [MapboxDocs - raster-dem](https://docs.mapbox.com/data/tilesets/reference/mapbox-terrain-dem-v1/)\n\n## 6.2. 编解码差异\n\n`mapbox` 和 `terrarium` 都将高程值编码成 RGB 数组存储，下面以简单的编解码函数说明两种编码格式的差异。\n\nMapboxGL：\n\n```typescript\nfunction mapboxEncode(height: number) {\n  const value = Math.floor((height + 10000) * 10);\n  const r = value >> 16;\n  const g = value >> 8 & 0x0000FF;\n  const b = value & 0x0000FF;\n  return [r, g, b];\n}\n\nfunction mapboxDecode(\n  color: [number, number, number]\n) {\n  return -10000 + ((color[0] * 256 * 256 + color[1] * 256 + color[2]) * 0.1);\n}\n```\n\nterrarium：\n\n```typescript\nfunction terrariumEncode(height: number) {\n  height += 32768;\n  const r = Math.floor(height / 256.0);\n  const g = Math.floor(height % 256);\n  const b = Math.floor((height - Math.floor(height)) * 256.0);\n  return [r, g, b];\n}\n\nfunction terrariumDecode(\n  color: [number, number, number]\n) {\n  return (color[0] * 256 + color[1] + color[2] / 256.0) - 32768;\n}\n```\n\n对于 cesium 的地形编码和解码：\n\n```typescript\n// 每个点像素值是 int16\nfunction cesiumEncode(height: number) {\n  return Math.floor((height + 1000) / 0.2);\n}\n\nfunction cesiumDecode(pixel: number){\n  return (pixel * 0.2) - 1000;\n}\n```\n"
  },
  {
    "path": "bin/dem2terrain.js",
    "content": "#!/usr/bin/env node\nconst { program } = require('commander');\nconst main = require('../index');\nconst path = require('path');\nconst version = require('../package.json').version;\n\n// node版本检查\nif (+process.version.substring(1, 3) < 16) {\n  console.error(`node版本>=16，当前版本 ${process.version}`);\n  process.exit();\n}\n// { version } from 'node:process';\nprogram.name('dem2terrain')\n  .description('使用 GDAL 制作地形瓦片，支持 mapbox 和 terrarium 两种编码输出格式，当前仅输出 PNG 容器格式。')\n  .version(version, '-v, --version', '当前版本')\n  .helpOption('-h, --help', '帮助');\n\n// --- 配置可选参数\nprogram\n  .option('-i, --input <string>', '<必填> 输入 tif 格式的 DEM 文件路径，支持相对路径')\n  .option('-o, --output <string>', '<必填> 输出目录，支持相对路径')\n  .option('-f, --configFile <File>', '<可选> 通过配置文件执行任务，输入绝对路径，可参考配置模板')\n  .option('-r, --resampling <number>', `<可选> 构建影像金字塔或重投影时设置重采样策略，默认3，1:AVERAGE|\n  2:BILINEAR|3:CUBIC|\n  4:CUBICSPLINE|5:LANCZOS|\n  6:MODE|7:NEAREST`, 3)\n  .option('-g, --epsg <number>', '<可选> Tile适用坐标系，3857 | 4490 | 4326', 3857)\n  .option('-c, --clean <number>', '<可选> 是否清空输出目录，0 | 1', 0)\n  .option('-z, --zoom <number-number>', '<可选> 指定瓦片的等级生成范围。例如，想生成 7 ~ 12 级的瓦片，则输入 -z 7-12', '5-14')\n  .option('-e, --encoding <string>', '<可选> 指定瓦片的数据编码规则（mapbox 或 terrarium）', 'mapbox')\n  .option('-b, --baseHeight <number>', '<可选> 基准高度，默认0', 0);\n\n// --- 解析参数\nprogram.parse();\n\nconst options = program.opts();\n// 判别是否是配置文件还是命令行配置\nlet params;\nif (options['configFile'])\n  params = require(options['configFile']);\nelse\n  params = options;\nconst inputDem = params['input'];\nconst outputDir = params['output'];\nif (inputDem === undefined || outputDir === undefined) {\n  console.log('参数缺失: 输入文件路径或输出目录必填');\n  process.exit();\n}\n\nconst encoding = params['encoding'];\nconst epsg = Number(params['epsg']);\nconst isClean = Number(params['clean']);\nlet baseHeight = Number(params['baseHeight']);\nif (isNaN(baseHeight))\n  baseHeight = 0;\nlet zoom = params['zoom'];\nzoom = zoom.split('-');\nconst minZoom = Number(zoom[0]);\nconst maxZoom = Number(zoom[1]);\n\nif (isNaN(minZoom) || isNaN(maxZoom)) {\n  console.log(`参数 -zoom: ${zoom} 错误，应为整数`);\n  process.exit();\n}\nif (minZoom >= maxZoom) {\n  console.log(`参数 -zoom: ${zoom} 错误：最小级别: ${minZoom} 应小于最大级别: ${maxZoom}`);\n  process.exit();\n}\n\nconst inputAbsolutePath = path.isAbsolute(inputDem) ? inputDem : path.resolve(process.cwd(), inputDem);\nconst outFileAbsolutePath = path.isAbsolute(outputDir) ? outputDir : path.resolve(process.cwd(), outputDir);\n\nconst logMsg = `\\n>> 开始转换...\n- 输入文件: ${inputAbsolutePath}\n- 输出路径: ${outFileAbsolutePath}\n- Tile适用坐标系: EPSG:${epsg}\n- 瓦片编码: ${encoding === 'mapbox' ? 'mapbox(raster-dem)' : encoding}\n- 瓦片尺寸: 256 px\n- 瓦片等级: ${minZoom} 至 ${maxZoom} 级\n- 基准高度: ${baseHeight}\n`;\nconsole.log(logMsg);\n\nmain(inputDem, outputDir, {\n  minZoom,\n  maxZoom,\n  epsg,\n  encoding,\n  isClean,\n  baseHeight\n});"
  },
  {
    "path": "config.template.json",
    "content": "{\n    \"zoom\":\"5-14\",\n    \"epsg\": 3857,\n    \"encoding\": \"mapbox\",\n    \"input\": \"./xxx.tif\",\n    \"output\": \"./xxx\",\n    \"clean\": true\n}"
  },
  {
    "path": "index.js",
    "content": "const main = require('./src');\n\nmodule.exports = main;\n\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"dem2terrain\",\n  \"version\": \"2.2.8\",\n  \"description\": \"使用 GDAL 制作 DEM 栅格的地形瓦片\",\n  \"main\": \"index.js\",\n  \"preferGlobal\": true,\n  \"engines\": {\n    \"node\": \">= 16\"\n  },\n  \"bin\": {\n    \"dem2terrain\": \"./bin/dem2terrain.js\"\n  },\n  \"scripts\": {\n    \"test\": \"node ./test/app.js && dem2terrain -f ../test/config.json\",\n    \"server\": \"http-server ./test\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/FreeGIS/dem2terrain.git\"\n  },\n  \"keywords\": [\n    \"dem\",\n    \"mapboxgl\",\n    \"terrain\"\n  ],\n  \"author\": \"freegis\",\n  \"license\": \"BSD-3-Clause license\",\n  \"bugs\": {\n    \"url\": \"https://github.com/FreeGIS/dem2terrain/issues\"\n  },\n  \"homepage\": \"https://github.com/FreeGIS/dem2terrain#readme\",\n  \"dependencies\": {\n    \"@mapbox/mbtiles\": \"^0.12.1\",\n    \"cli-color\": \"^2.0.3\",\n    \"commander\": \"^14.0.0\",\n    \"errno\": \"^1.0.0\",\n    \"gdal-async\": \"^3.5.1\",\n    \"http-server\": \"^14.1.1\",\n    \"single-line-log\": \"^1.1.2\"\n  }\n}\n"
  },
  {
    "path": "src/createtile.js",
    "content": "const gdal = require('gdal-async');\nconst { getDriverByName } = require('./gdal-util');\nconst { mapboxEncode, terrariumEncode } = require('./dem-encode');\nconst path = require('path');\nconst fs = require('fs');\n\nlet dataset = null, noData = null, memDriver = null, pngDriver = null;\nconst invalidColor = [1, 134, 160];// 编码后凑海拔=0，修复地形塌陷产生空白\nlet outTileSize1;\nfunction forEachHeightBuffer(heightBuffer, encode) {\n    const channelLength = heightBuffer.length;\n    const rBuffer = new Uint8Array(channelLength);\n    const gBuffer = new Uint8Array(channelLength);\n    const bBuffer = new Uint8Array(channelLength);\n    const aBuffer = new Uint8Array(channelLength);\n    for (let i = 0; i < channelLength; i++) {\n        let heightVal = heightBuffer[i];\n        let color;\n        if (heightVal === noData)\n            color = invalidColor; // 编码后凑海拔=0，修复地形塌陷产生空白\n        else\n            color = encode(heightVal);\n        rBuffer[i] = color[0];\n        gBuffer[i] = color[1];\n        bBuffer[i] = color[2];\n        aBuffer[i] = 255;\n    }\n    return [rBuffer, gBuffer, bBuffer, aBuffer];\n}\n\n\nfunction writeTerrainTile(overviewInfo, readinfo, writeinfo, encoding) {\n    let readband;\n    if (overviewInfo.index === undefined)\n        readband = readinfo.ds.bands.get(1);\n    else // 从影像金字塔里读取band信息\n        readband = readinfo.ds.bands.get(1).overviews.get(overviewInfo.index);\n    let dataType = readband.dataType;\n    let heightBuffer;\n    // 特殊异常处理\n    if  (dataType == gdal.GDT_Byte) \n        heightBuffer = new Uint8Array(writeinfo.wxsize * writeinfo.wysize);\n    else if (dataType === gdal.GDT_Int16)\n        heightBuffer = new Int16Array(writeinfo.wxsize * writeinfo.wysize);\n    else if (dataType === gdal.GDT_Float32)\n        heightBuffer = new Float32Array(writeinfo.wxsize * writeinfo.wysize);\n    else if (dataType === 'Int8') {\n        heightBuffer = new Int16Array(writeinfo.wxsize * writeinfo.wysize);\n        dataType = gdal.Int16Array;\n    }\n\n    readband.pixels.read(readinfo.rx, readinfo.ry, readinfo.rxsize, readinfo.rysize, heightBuffer, {\n        buffer_width: writeinfo.wxsize,\n        buffer_height: writeinfo.wysize,\n        data_type: dataType\n    });\n    // heightBuffer转码rgb编码\n    let encodeBuffers;\n    // 循环高程，转rgb编码\n    if (encoding === 'mapbox') {\n        encodeBuffers = forEachHeightBuffer(heightBuffer, mapboxEncode);\n    } else if (encoding === 'terrarium') {\n        encodeBuffers = forEachHeightBuffer(heightBuffer, terrariumEncode);\n    }\n\n    let _length = outTileSize1 * outTileSize1;\n    let r = new Uint8Array(_length);\n    let g = new Uint8Array(_length);\n    let b = new Uint8Array(_length);\n    let a = new Uint8Array(_length);\n    for (let i = 0; i < _length; i++) {\n        r[i] = invalidColor[0];\n        g[i] = invalidColor[1];\n        b[i] = invalidColor[2];\n        a[i] = 255;\n    };\n    let defaultBuffers = [r, g, b, a];\n    [1, 2, 3, 4].forEach(index => {\n        let writeband = writeinfo.ds.bands.get(index);\n        // 先填充默认值\n        writeband.pixels.write(0, 0, outTileSize1, outTileSize1, defaultBuffers[index - 1]);\n        // 填充实际值\n        writeband.pixels.write(writeinfo.wx, writeinfo.wy, writeinfo.wxsize, writeinfo.wysize, encodeBuffers[index - 1]);\n    });\n}\n\n\nfunction createTile(createInfo, callback) {\n    const { outTileSize, overviewInfo, rb, wb, encoding, dsPath, x, y, z, outputTile } = createInfo;\n    outTileSize1 = outTileSize;\n    if (dataset === null) {\n        dataset = gdal.open(dsPath, 'r');\n        // 查询no_data数值\n        noData = dataset.bands.get(1).noDataValue;\n    }\n    // 创建一个mem内存，将读取的像素写入mem\n    if (memDriver === null)\n        memDriver = getDriverByName('mem');\n    const msmDS = memDriver.create(\"\", outTileSize, outTileSize, 4);\n    rb.ds = dataset;\n    wb.ds = msmDS;\n    writeTerrainTile(overviewInfo, rb, wb, encoding);\n    const pngPath = path.join(outputTile, z.toString(), x.toString(), y + '.png');\n    if (pngDriver === null)\n        pngDriver = getDriverByName('png');\n    let pngDs = pngDriver.createCopy(pngPath, msmDS);\n\n    // 释放内存\n    msmDS.flush();\n    msmDS.close();\n    pngDs.close();\n    callback(null, process.pid);\n}\nfunction closeDataset(callback) {\n    if (dataset) {\n        dataset.close();\n        dataset = null;\n        callback(null, process.pid);\n    }\n    callback(null, null);\n\n}\nmodule.exports = { createTile, closeDataset }"
  },
  {
    "path": "src/dem-encode.js",
    "content": "/**\n * MapboxGL raster-dem 编码\n * @param {number} height 高程值\n * @returns {[number, number, number]}\n */\nfunction mapboxEncode(height) {\n    const value = Math.floor((height + 10000) * 10);\n    const r = value >> 16;\n    const g = value >> 8 & 0x0000FF;\n    const b = value & 0x0000FF;\n    return [r, g, b];\n}\n\n/**\n * MapboxGL raster-dem 解码\n * @param {[number, number, number]} color \n * @returns {number} 高程值\n */\nfunction mapboxDecode(color) {\n    return -10000 + ((color[0] * 256 * 256 + color[1] * 256 + color[2]) * 0.1);\n}\n\n\n/**\n * Terrarium 编码\n * @param {number} height 高程值\n * @returns {[number, number, number]}\n */\nfunction terrariumEncode(height) {\n    height += 32768;\n    const r = Math.floor(height / 256.0);\n    const g = Math.floor(height % 256);\n    const b = Math.floor((height - Math.floor(height)) * 256.0);\n    return [r, g, b];\n}\n\n/**\n * Terrarium 解码\n * @param {[number, number, number]} color \n * @returns {number} 高程值\n */\nfunction terrariumDecode(color) {\n    return (color[0] * 256 + color[1] + color[2] / 256.0) - 32768;\n}\n\n\n/**\n * Cesium 编码\n * @param {number} height 高程值\n * @returns {number} 编码值，Int16\n */\nfunction cesiumEncode(height) {\n    return Math.floor((height + 1000) / 0.2);\n}\n/**\n* Cesium 解码\n* @param {number} pixel 编码值，Int16\n* @returns {number} 高程值\n*/\nfunction cesiumDecode(pixel) {\n    return (pixel * 0.2) - 1000;\n}\n\n\nconst mapboxDem = {\n    encode: mapboxEncode,\n    tileSchema: 'xyz',\n    tileSize: 512,\n    extension: 'png'\n}\nconst terrariumDem = {\n    encode: terrariumEncode,\n    tileSchema: 'xyz',\n    tileSize: 512,\n    extension: 'png'\n}\nconst cesiumDem = {\n    encode: cesiumEncode,\n    tileSchema: 'tms',\n    tileSize: 65,\n    extension: 'terrain'\n}\nmodule.exports = {\n    //mapboxDem, terrariumDem, cesiumDem\n    mapboxEncode, terrariumEncode\n}"
  },
  {
    "path": "src/gdal-util.js",
    "content": "const gdal = require('gdal-async');\n// 根据策略获取对应的采样方法\nfunction getBuildOverviewResampling(resampling) {\n  switch (resampling) {\n    case 1:\n      return \"AVERAGE\"; // 加权平均法\n    case 2:\n      return \"BILINEAR\"; // 双线性内插法\n    case 3:\n      return \"CUBIC\"; // 三次卷积内插法\n    case 4:\n      return \"CUBICSPLINE\"; // B样条卷积内插法\n    case 5:\n      return \"LANCZOS\"; // Lanczos窗口sinc卷积内插法\n    case 6:\n      return \"MODE\"; // 最常出现值法\n    case 7:\n      return \"NEAREST\"; // 最邻近法\n    default:\n      return \"CUBIC\";\n  }\n}\n\nfunction getResampling(resampling) {\n  switch (resampling) {\n    case 1:\n      return gdal_resampling = gdal.GRA_Average;\n    case 2:\n      return gdal_resampling = gdal.GRA_Bilinear;\n    case 3:\n      return gdal_resampling = gdal.GRA_Cubic;\n    case 4:\n      return gdal_resampling = gdal.GRA_CubicSpline;\n    case 5:\n      return gdal_resampling = gdal.GRA_Lanczos;\n    case 6:\n      return gdal_resampling = gdal.GRA_Mode;\n    case 7:\n      return gdal_resampling = gdal.GRA_NearestNeighbor;\n    default:\n      return gdal_resampling = gdal.GRA_Cubic;\n  }\n}\n\n\n/**\n * 根据驱动名称（支持任意大小写）获取 GDAL 驱动\n * @param {string} driverName 驱动名称\n * @returns {import('gdal').Driver}\n */\nfunction getDriverByName(driverName) {\n  const length = gdal.drivers.count();\n  let nameNormal = driverName.toUpperCase();\n  for (let i = 0; i < length; i++) {\n    const driver = gdal.drivers.get(i);\n    if (driver.description === nameNormal) { return driver; }\n  }\n  throw new Error(`当前gdal中不存在输入的驱动名称${nameNormal}`);\n}\n/**\n * @function 栅格重投影\n * @description 输入一个源数据，设置投影输出数据文件路径和投影坐标系的epsg编码，设置采样参数，输出栅格重投影文件\n * @param {string | import('gdal').Dataset} src_ds  输入的栅格文件路径或者gdal的数据集对象。\n * @param {string} reproject_path  输出的重投影后的栅格文件路径。\n * @param {number} t_epsg  重投影的坐标系epsg编码。\n * @param {number} resampling  重投影后的采样参数，默认是 0，意义为：0: average, 1: bilinear, 2: cubic, 3: cubicspline, 4: lanczos, 5: mode, 6: nearestNeighbor。\n * @return void\n *\n * @author freegis\n */\nfunction reprojectImage(src_ds, reproject_path, t_epsg, resampling = 1) {\n  let s_ds;\n  if (typeof (src_ds) === 'string')\n    s_ds = gdal.open(src_ds);\n  else\n    s_ds = src_ds;\n  // 获取源数据集的 坐标系\n  const s_srs = s_ds.srs;\n  // 投影的目标坐标系\n  const t_srs = gdal.SpatialReference.fromEPSGA(t_epsg);\n  // 输入源数据，源坐标系，目标坐标系，智能计算出输出的栅格像元分辨率和仿射变换参数\n  const { rasterSize, geoTransform } = gdal.suggestedWarpOutput({\n    src: s_ds,\n    s_srs: s_srs,\n    t_srs: t_srs\n  });\n  // 获取原始数据第一个band的数据类型，作为新的投影后的数据类型\n  // 如果不写，类似默认是uint8，而dem是 int16，就会数据错误\n  const dataType = s_ds.bands.get(1).dataType;\n  // 使用源数据的驱动，保持文件格式不变\n  const t_driver = s_ds.driver;\n  //创建输出图像\n  const t_ds = t_driver.create(reproject_path, rasterSize.x, rasterSize.y, s_ds.bands.count(), dataType);\n  //重置索引和仿射变换参数\n  t_ds.srs = t_srs;\n  t_ds.geoTransform = geoTransform;\n  //重采样方法\n  let gdal_resampling = getResampling(resampling);\n  gdal.reprojectImage({ src: s_ds, dst: t_ds, s_srs, t_srs, resampling: gdal_resampling });\n  // 关闭退出\n  t_ds.bands.get(1).noDataValue = s_ds.bands.get(1).noDataValue;\n  t_ds.close();\n  if (typeof (src_ds) === 'string')\n    s_ds.close();\n}\n\n\n\nmodule.exports = {\n  getDriverByName, reprojectImage, getBuildOverviewResampling\n}"
  },
  {
    "path": "src/index.js",
    "content": "const gdal = require('gdal-async');\nconst fs = require('fs');\nconst path = require('path');\nconst process = require('process');\nconst os = require('os');\nconst { prettyTime, uuid, wait, mkdirsSync, emptyDir } = require('./util');\nconst { reprojectImage, getBuildOverviewResampling } = require('./gdal-util');\nconst ProgressBar = require('./progressbar/index');\nconst { mb_open, mb_stop_writing, mb_put_tile } = require('./mbtiles-util');\n// 创建一个线程池\nconst workerFarm = require('./workfarm/index');\nconst workers = workerFarm(require.resolve('./createtile'), ['createTile', 'closeDataset']);\nconst { tileBoundMap, ST_TileEnvelope, getTileByCoors } = require('./tile-util');\nlet childPids = new Set();\nlet progressBar;\n/**\n * @typedef {{\n *   tminx: number;\n *   tminy: number;\n *   tmaxx: number;\n *   tmaxy: number;\n * }} LevelInfo\n * \n * @typedef {{\n *   [key: number]: LevelInfo;\n * }} LevelInfoDict\n * \n * @typedef {{\n *   index: number;\n *   startX: number;\n *   startY: number;\n *   width:number;\n *   height:number;\n *   resX:number;\n *   resY:number;\n * }} OverviewInfo\n * \n * @typedef {{\n *   [key: number]: OverviewInfo;\n * }} OverviewInfoDict\n */\n\n/**\n * @typedef {{\n *  ds: import('gdal').Dataset;\n *  path: string;\n * }} DsInfo\n * \n * @typedef {{\n *   tileCount: number;\n *   levelInfo: LevelInfoDict;\n *   completeCount: number;\n * }} StatisticsInfo\n * \n * @type {StatisticsInfo}\n */\nlet statistics = {\n  tileCount: 0,\n  completeCount: 0,\n  levelInfo: {}\n}\nprocess.on('SIGINT', function () {\n  console.log('\\n\\n>> 清理临时文件中...');\n  recycle();\n  console.log('>> 清理临时文件 - 完成');\n  process.exit();\n});\n\n\nfunction recycle() {\n  if (sourceDs !== null) {\n    try {\n      sourceDs.close();\n    } catch (e) { }\n    sourceDs = null;\n  }\n  if (projectDs !== null) {\n    try {\n      projectDs.close();\n    } catch (e) { }\n    projectDs = null;\n  }\n  /*if (encodeDs !== null) {\n    try {\n      encodeDs.close();\n    } catch (e) { }\n    encodeDs = null;\n  }*/\n  // 存在临时文件，强制删除\n  if (fs.existsSync(projectPath)) {\n    fs.unlinkSync(projectPath);\n    projectPath = null;\n  }\n  if (fs.existsSync(encodePath)) {\n    fs.unlinkSync(encodePath);\n    encodePath = null;\n  }\n  // 存在临时影像金字塔附属文件\n  const ovrPath = encodePath + '.ovr';\n  if (fs.existsSync(ovrPath))\n    fs.unlinkSync(ovrPath);\n}\n\n\n/**\n * 重投影数据集\n */\nconst project = (ds, epsg, resampling) => {\n  let projectDatasetPath = path.join(os.tmpdir(), `${uuid()}.tif`);\n  reprojectImage(ds, projectDatasetPath, epsg, resampling);\n  return projectDatasetPath;\n}\n\n\n/**\n * \n * @param {import('gdal').Dataset} dataset\n * @param {number} minZoom\n * \n * @returns {number} adjustZoom\n */\nconst buildPyramid = (\n  ds,\n  minZoom,\n  resampling\n) => {\n  const res = ds.geoTransform[1]; // 使用resx替代整个影像的分辨率\n  const maxPixel = Math.min(ds.rasterSize.x, ds.rasterSize.y);\n  // 金字塔分级制度，默认2的等比\n  let overviewNum = 1;\n  while (maxPixel / Math.pow(2, overviewNum) > 256) {\n    overviewNum++;\n  }\n  // 计算originZ\n  let res_zoom = (tileBoundTool.xmax - tileBoundTool.xmin) / 256;\n  let originZ = 0;\n  while (res_zoom / 2 > res) {\n    res_zoom = res_zoom / 2;\n    originZ++;\n  }\n  // 即从originZ以下，建立overviewNum个影像金字塔 <originZ| originZ-1 originZ-2 originZ-3 originZ-4 |originZ-5>\n  let overviews = [];\n  for (let zoom = originZ - 1; zoom >= originZ - 1 - overviewNum; zoom--) {\n    if (zoom < minZoom)\n      break;\n    const factor = Math.pow(2, originZ - zoom)\n    overviews.push(factor);\n\n  }\n  const buildOverviewResampling = getBuildOverviewResampling(resampling);\n  ds.buildOverviews(buildOverviewResampling, overviews);\n  // z>=originZ使用原始影像\n  return {\n    maxOverViewsZ: originZ - 1, // 大于该值用原始影像\n    minOverViewsZ: originZ - overviews.length  // 小于该值，用最后一级别影像金字塔索引\n  };\n}\n// 公共资源，包括ds，path对象\n\nlet sourceDs, projectDs = null;\n// , encodeDs\nlet projectPath, encodePath = null;\nlet tileBoundTool;\n\n/**\n * \n * @param {string} tifFilePath TIF 文件路径\n * @param {string} outputDir 输出目录\n * @param {{\n *   minZoom: number;\n *   maxZoom: number;\n *   epsg: number;\n *   encoding: 'mapbox' | 'terrarium';\n * }} options 可选配置\n */\nasync function main(input, output, options) {\n  // 计时开始\n  const startTime = global.performance.now();\n  // 结构可选参数\n  const { minZoom, maxZoom, epsg, encoding, isClean, resampling } = options;\n  // 固定瓦片尺寸\n  const tileSize = 256;\n  tileBoundTool = tileBoundMap.get(epsg);\n  // 判断是否以mbtiles转储\n  const isSavaMbtiles = (path.extname(output) === '.mbtiles');\n  // 定义切片临时输出目录\n  let outputDir = output;\n  // 如果以mbtiles存储重定向为临时目录\n  if (isSavaMbtiles === true)\n    outputDir = path.join(os.tmpdir(), uuid());\n\n  let stepIndex = 0;\n  if (isClean === 1) {\n    if (isSavaMbtiles === true && fs.existsSync(output))\n      fs.unlinkSync(output);\n    else\n      emptyDir(output);\n    console.log(`>> 步骤${++stepIndex}: 清空输出文件夹 - 完成`);\n  }\n  sourceDs = gdal.open(input, 'r');\n  //#region 步骤 1 - 重投影\n  if (sourceDs.srs.getAuthorityCode() !== epsg) {\n    projectPath = project(sourceDs, epsg, resampling);\n    projectDs = gdal.open(projectPath, 'r');\n    sourceDs.close(); // 原始的就不需要了\n    console.log(`>> 步骤${++stepIndex}: 重投影至 EPSG:${epsg} - 完成`);\n  } else {\n    projectDs = sourceDs;\n  }\n  sourceDs = null;\n  //#endregion\n  //#region 步骤 2 - 建立影像金字塔 由于地形通常是30m 90m精度\n  const overViewInfo = buildPyramid(projectDs, minZoom, resampling);\n  console.log(`>> 步骤${++stepIndex}: 构建影像金字塔索引 - 完成`);\n  //#endregion\n\n  //#region 步骤3 - 切片\n  const dsInfo = {\n    width: projectDs.rasterSize.x,\n    height: projectDs.rasterSize.y,\n    resX: projectDs.geoTransform[1],\n    resY: projectDs.geoTransform[5],\n    startX: projectDs.geoTransform[0],\n    startY: projectDs.geoTransform[3],\n    endX: projectDs.geoTransform[0] + projectDs.rasterSize.x * projectDs.geoTransform[1],\n    endY: projectDs.geoTransform[3] + projectDs.rasterSize.y * projectDs.geoTransform[5],\n    path: projectDs.description\n  }\n\n  // 计算切片总数\n  // 堆积任务数量\n  let pileUpCount = 0;\n  let miny, maxy;\n  if (dsInfo.startY < dsInfo.endY) {\n    miny = dsInfo.startY;\n    maxy = dsInfo.endY;\n  } else {\n    miny = dsInfo.endY;\n    maxy = dsInfo.startY;\n  }\n  // xyz是从左上角开始，往右下角走\n  let startPoint = [dsInfo.startX, maxy];\n  let endPoint = [dsInfo.endX, miny];\n  for (let tz = minZoom; tz <= maxZoom; ++tz) {\n    const minRC = getTileByCoors(startPoint, tz, tileBoundTool);\n    const maxRC = getTileByCoors(endPoint, tz, tileBoundTool);\n    statistics.tileCount += (maxRC.row - minRC.row + 1) * (maxRC.column - minRC.column + 1);\n    statistics.levelInfo[tz] = {\n      tminx: minRC.column,\n      tminy: minRC.row,\n      tmaxx: maxRC.column,\n      tmaxy: maxRC.row,\n    };\n  }\n  // 设置进度条任务总数\n  progressBar = new ProgressBar(60, `>> 步骤${++stepIndex}`);\n  progressBar.setTaskTotal(statistics.tileCount)\n  // 实际裙边有1像素 256+1+1 上下左右各1像素\n  // 裙边所需的缩放\n  let buffer = 1;\n  let outTileSize = tileSize;\n  if (encoding === 'mapbox') {\n    outTileSize = tileSize + buffer*2;\n  }\n  for (let tz = minZoom; tz <= maxZoom; tz++) {\n    const { tminx, tminy, tmaxx, tmaxy } = statistics.levelInfo[tz];\n    let overviewInfo;\n    // 根据z获取宽高和分辨率信息\n    if (tz > overViewInfo.maxOverViewsZ)\n      overviewInfo = dsInfo;\n    else {\n      let startZ = Math.max(tz, overViewInfo.minOverViewsZ);\n      const factorZoom = overViewInfo.maxOverViewsZ - startZ;\n      const factor = Math.pow(2, factorZoom+1);\n      overviewInfo = {\n        index: factorZoom, //影像金字塔序号从0开始\n        startX: dsInfo.startX,\n        startY: dsInfo.startY,\n        width: Math.ceil(dsInfo.width * 1.0 / factor),\n        height: Math.ceil(dsInfo.height * 1.0 / factor),\n        resX: dsInfo.resX * factor,\n        resY: dsInfo.resY * factor\n      };\n    }\n    for (let j = tminx; j <= tmaxx; j++) {\n      // 递归创建目录\n      mkdirsSync(path.join(outputDir, tz.toString(), j.toString()));\n      for (let i = tminy; i <= tmaxy; i++) {\n        const tileBound = ST_TileEnvelope(tz, j, i, buffer, tileBoundTool);\n        const { rb, wb } = geoQuery(\n          overviewInfo,\n          tileBound[0],\n          tileBound[3],\n          tileBound[2],\n          tileBound[1],\n          outTileSize\n        );\n        const createInfo = {\n          outTileSize,\n          overviewInfo,\n          rb,\n          wb,\n          encoding,\n          dsPath: dsInfo.path,\n          x: j,\n          y: i,\n          z: tz,\n          outputTile: outputDir\n        };\n        pileUpCount++;\n        if (pileUpCount > 500)\n          await wait(1000);\n        workers.createTile(createInfo, async function (err, pid) {\n          if (err) {\n            console.log(err);\n          }\n          childPids.add(pid);\n          statistics.completeCount++;\n          pileUpCount--;\n          // 更新进度条\n          progressBar.render(statistics.completeCount);\n          if (statistics.completeCount === statistics.tileCount) {\n            // 转储mbtiles\n            if (isSavaMbtiles === true) {\n              await importMbtiles(outputDir, output);\n              console.log(`\\n>> 步骤${++stepIndex}: 转储mbtiles - 完成`);\n            }\n            const endTime = global.performance.now()\n            const {\n              resultTime,\n              unit\n            } = prettyTime(endTime - startTime)\n            console.log(`\\n\\n转换完成，用时 ${resultTime.toFixed(2)} ${unit}。`)\n            //循环关闭子进程的ds，否则临时文件被占用删除不了\n            const call = {\n              method: 'closeDataset',\n              callback: function (_, closePid) {\n                childPids.delete(closePid);\n                if (childPids.size === 0) {\n                  // 关闭子进程任务\n                  workerFarm.end(workers);\n                  // 清除数据源信息\n                  recycle();\n                  resetStats();\n                }\n              },\n              args: [],\n              retries: 0\n            }\n            // 循环调用，关闭子进程资源\n            for (let childId in workers.farm.children) {\n              workers.farm.send(childId, call);\n            }\n          }\n        })\n      }\n    }\n  }\n  //#endregion\n}\n\nconst resetStats = () => {\n  statistics.tileCount = 0;\n  statistics.completeCount = 0;\n  statistics.levelInfo = {};\n}\n// 重构使其支持影像金字塔查询\n/**\n * \n * @param {OverviewInfo} overviewInfo \n * @param {number} ulx \n * @param {number} uly \n * @param {number} lrx \n * @param {number} lry \n * @param {number} [querysize=0] \n * @returns {{\n *   rb: { \n *     rx: number; \n *     ry: number; \n *     rxsize: number; \n *     rysize: number;\n *   };\n *   wb: { \n *     wx: number; \n *     wy: number; \n *     wxsize: number; \n *     wysize: number;\n *   };\n * }}\n */\nfunction geoQuery(overviewInfo, ulx, uly, lrx, lry, querysize = 0) {\n  const { startX, startY, width, height, resX, resY } = overviewInfo;\n  // 根据金字塔级别，重置分辨率，重置宽高\n  let rx = Math.floor((ulx - startX) / resX + 0.001);\n  let ry = Math.floor((uly - startY) / resY + 0.001);\n  let rxsize = Math.max(1, Math.floor((lrx - ulx) / resX + 0.5));\n  let rysize = Math.max(1, Math.floor((lry - uly) / resY + 0.5));\n  let wxsize, wysize;\n  if (!querysize) {\n    wxsize = rxsize;\n    wysize = rysize;\n  } else {\n    wxsize = querysize;\n    wysize = querysize;\n  }\n  let wx = 0;\n  if (rx < 0) {\n    let rxshift = Math.abs(rx);\n    wx = Math.floor(wxsize * (rxshift * 1.0 / rxsize));\n    wxsize = wxsize - wx;\n    rxsize = rxsize - Math.floor(rxsize * (rxshift * 1.0 / rxsize));\n    rx = 0;\n  }\n  if ((rx + rxsize) > width) {\n    wxsize = Math.floor(wxsize * (width - rx) * 1.0 / rxsize);\n    rxsize = width - rx;\n  }\n  let wy = 0;\n  if (ry < 0) {\n    const ryshift = Math.abs(ry);\n    wy = Math.floor(wysize * (ryshift * 1.0 / rysize));\n    wysize = wysize - wy;\n    rysize = rysize - Math.floor(rysize * (ryshift * 1.0 / rysize));\n    ry = 0;\n  }\n  if ((ry + rysize) > height) {\n    wysize = Math.floor(wysize * (height - ry) * 1.0 / rysize);\n    rysize = height - ry;\n  }\n  return {\n    rb: { rx, ry, rxsize, rysize },\n    wb: { wx, wy, wxsize, wysize }\n  }\n}\n\n/**\n * 根据tms或xyz策略修正Y的实际值\n * @param {number} ty \n * @param {number} tz \n * @param {boolean} tms2xyz \n * @returns {number}\n */\nfunction getYtile(ty, tz, tms2xyz = true) {\n  if (tms2xyz)\n    return Math.pow(2, tz) - 1 - ty;\n  return ty;\n}\n\n\n/**\n * 将目录里的切片导入mbtiles，删除文件目录\n * @param {number} tileDir \n * @param {number} mbtilesPath \n * @returns {Promise}\n */\nfunction importMbtiles(tileDir, mbtilesPath) {\n  return new Promise(async (res, rej) => {\n    let mbtiles = await mb_open(mbtilesPath, 'rwc');\n    // 遍历tile目录的tile，并转储至mbtiles\n    let z, x, y;\n    const zFolds = fs.readdirSync(tileDir);\n    const zCount = zFolds.length;\n    for (let i = 0; i < zCount; i++) {\n      let zFold = zFolds[i];\n      z = Number(zFold);\n      const zPath = path.join(tileDir, zFold);\n      // 遍历z下的x文件夹\n      const xFolds = fs.readdirSync(zPath);\n      const xCount = xFolds.length;\n      for (let j = 0; j < xCount; j++) {\n        let xFold = xFolds[j];\n        x = Number(xFold);\n        // 遍历x文件夹下的y文件\n        const xPath = path.join(zPath, xFold);\n        const yFiles = fs.readdirSync(xPath);\n\n        const yCount = yFiles.length;\n        // 每10个一批写入，否则sqlite容易报错database lock\n        let promises = [];\n        for (let k = 0; k < yCount; k++) {\n          const yFile = yFiles[k];\n          y = Number(yFile.split('.')[0]);\n          const yPath = path.join(xPath, yFile);\n          promises.push(mb_put_tile(mbtiles, z, x, y, yPath));\n        }\n        await Promise.all(promises);\n        promises = [];\n        // 删除目录\n        fs.rmdirSync(xPath);\n      }\n      fs.rmdirSync(zPath);\n    }\n    fs.rmdirSync(tileDir);\n    await mb_stop_writing(mbtiles);\n    res('import');\n  });\n}\nmodule.exports = main;"
  },
  {
    "path": "src/mbtiles-util.js",
    "content": "const fs = require('fs');\nconst MBTiles = require('@mapbox/mbtiles');\n// 打开mbtiles\nfunction mb_open(mbpath, mode) {\n    return new Promise((res, rej) => {\n        new MBTiles(`${mbpath}?mode=${mode}`, function (err, mbtiles) {\n            if (err)\n                rej(err);\n            if (mode === 'rw' || mode === 'rwc') {\n                mbtiles.startWriting(function (err) {\n                    if (err)\n                        rej(err);\n                    res(mbtiles);\n                });\n            }\n        });\n    })\n}\n// 停止写入\nfunction mb_stop_writing(mbtiles) {\n    return new Promise((res, rej) => {\n        mbtiles.stopWriting(function (err) {\n            if (err)\n                rej(err);\n            res('stopWriting');\n        });\n    });\n}\n// 插入xyz tile\nfunction mb_put_tile(mbtiles, z, x, y, tile_path, isUnlink = true) {\n    return new Promise((res, rej) => {\n        fs.readFile(tile_path, (err, data) => {\n            if (err)\n                rej(err);\n            mbtiles.putTile(z, x, y, data, function (err) {\n                if (err)\n                    rej(err);\n                if (isUnlink === true) {\n                    fs.unlink(tile_path, err => {\n                        if (err)\n                            rej(err);\n                        res('insert');\n                    })\n                } else\n                    res('insert');\n            });\n        })\n\n    })\n}\n\nmodule.exports = {\n    mb_open, mb_stop_writing, mb_put_tile\n}"
  },
  {
    "path": "src/progressbar/format.js",
    "content": "/**\n * \n * @param {string} str \n * @param {Array<any>} params \n * @returns \n */\nfunction format(str, params = []) {\n    const pattern = /{([\\s\\S])*?}/gim;\n    let index = 0;\n    let params_index = 0;\n    return str.replace(pattern, (match, tuple, offset) => {\n        index = offset + match.length;\n        params_index += 1;\n\n        // 异常格式处理，对于列表和对象类型的param，对外抛出异常\n        if (\n            Array.isArray(params[params_index - 1]) ||\n            typeof params[params_index - 1] === \"object\"\n        ) {\n            throw TypeError(params[params_index - 1] + \"不能为对象类型\");\n        }\n\n        if (match.length > 2) {\n            match = match.slice(1, match.length - 1);\n            return eval('params[params_index-1].' + match);;\n        } else {\n            return params[params_index - 1];\n        }\n    });\n}\nmodule.exports = format;"
  },
  {
    "path": "src/progressbar/index.js",
    "content": "/**\n * 进度条实现。\n */\nconst log = require('single-line-log').stdout;\nconst format = require('./format');\nconst cliColor = require('cli-color');\n/**\n * 进度条实现。\n */\nconst { blue, green, yellow, red } = cliColor;\n/**\n * 进度条\n */\nclass ProgressBar {\n    constructor(\n        barLength = 28,\n        description = 'PROGRESS'\n    ) {\n        this.length = barLength;\n        this.taskTotal = 0;\n        this.description = description;\n\n        //this.completed = 0;\n        //this.tickStep = tickStep;\n    }\n\n    /**\n     * 设置一共有多少个任务\n     * @param {number} value \n     */\n    setTaskTotal(value) {\n        this.taskTotal = value\n    }\n\n    /**\n     * 在控制台中绘制当前进度条\n     * @param {number} completed 完成了多少个任务\n     */\n    render(completed) {\n        //this.completed++;\n        //const completed = this.completed * this.tickStep;\n        const finishedRate = Number((completed / this.taskTotal).toFixed(4));\n        const finishedCellCount = Math.floor(finishedRate * this.length);\n        let i = 0\n        // 拼接黑色条\n        let cell = '';\n        for (i = 0; i < finishedCellCount; ++i) {\n            cell += '█';\n        }\n        // 拼接灰色条\n        let empty = '';\n        for (i = 0; i < this.length - finishedCellCount; ++i) {\n            empty += '░';\n        }\n\n        const percentStr = (100 * finishedRate).toFixed(2);\n\n        /**\n         * 使用cli-color进行包装美化。\n         */\n        const cellStyle = green.bgBlack.bold(cell);\n        const completedStyle = green.bold(completed);\n        const statusStyle = Number(finishedRate) === 1 ? green.bold('完成') : yellow.bold('转换中⏳')\n\n        // 拼接最终文本\n        const cmdtext = format(\n            \"{}: {} - {}% {}{} {}/{}\",\n            [\n                this.description,\n                statusStyle,\n                percentStr,\n                cellStyle,\n                empty,\n                completedStyle,\n                String(this.taskTotal),\n            ]\n        );\n\n        log(cmdtext);\n    }\n}\nmodule.exports = ProgressBar;"
  },
  {
    "path": "src/tile-util.js",
    "content": "// 切片范围\nlet tileBoundMap = new Map();\ntileBoundMap.set(3857, {\n    xmin: -20037508.342789244,\n    ymin: -20037508.342789244,\n    xmax: 20037508.342789244,\n    ymax: 20037508.342789244\n});\ntileBoundMap.set(900913, {\n    xmin: -20037508.342789244,\n    ymin: -20037508.342789244,\n    xmax: 20037508.342789244,\n    ymax: 20037508.342789244\n});\ntileBoundMap.set(4490, {\n    xmin: -180,\n    ymin: -90,\n    xmax: 180,\n    ymax: 90\n});\ntileBoundMap.set(4326, {\n    xmin: -180,\n    ymin: -90,\n    xmax: 180,\n    ymax: 90\n});\n// 根据xyz计算对应地理坐标系的地理边界\nfunction ST_TileEnvelope(z, x, y, offset = 0, bbox = tileBoundMap.get(3857)) {\n    const tile_size = 256.0;\n    const boundsWidth = bbox.xmax - bbox.xmin;\n    const boundsHeight = bbox.ymax - bbox.ymin;\n    if (boundsWidth <= 0 || boundsHeight <= 0)\n        throw new Error(\"Geometric bounds are too small\");\n    if (z < 0 || z >= 32)\n        throw new Error(`Invalid tile zoom value, ${z}`);\n    // 总瓦片数量=worldTileSize*worldTileSize\n    let worldTileSize = 0x01 << (z > 31 ? 31 : z);\n\n    if (x < 0 || x >= worldTileSize)\n        throw new Error(`Invalid tile x value, ${x}`);\n    if (y < 0 || y >= worldTileSize)\n        throw new Error(`Invalid tile y value, ${y}`);\n    // 地理切片分辨率\n    const tileGeoSizeX = boundsWidth * 1.0 / worldTileSize;\n    const tileGeoSizeY = boundsHeight * 1.0 / worldTileSize;\n\n    const tileGeoSize = Math.max(tileGeoSizeX,tileGeoSizeY);\n\n    let x1 = bbox.xmin + tileGeoSize * x - tileGeoSize / tile_size * offset;\n    let x2 = bbox.xmin + tileGeoSize * (x + 1) + tileGeoSize / tile_size * offset;\n\n    let y1 = bbox.ymax - tileGeoSize * (y + 1) - tileGeoSize / tile_size * offset;\n    let y2 = bbox.ymax - tileGeoSize * (y) + tileGeoSize / tile_size * offset;\n\n    return [x1, y1, x2, y2];\n\n}\n\n// 根据任意地理坐标计算在指定zoom层级下其对应的瓦片行列号\nfunction getTileByCoors(coor, zoom, bbox = tileBoundMap.get(3857)) {\n    // 计算coor与bbox左上角坐标\n    const left = bbox.xmin;\n    const top = bbox.ymax;\n    const _width = coor[0] - left;\n    const _height = top - coor[1];\n    let worldTileSize = 0x01 << zoom;\n    const boundsWidth = bbox.xmax - bbox.xmin;\n    const boundsHeight = bbox.ymax - bbox.ymin;\n    const tileGeoSize = Math.max(boundsWidth,boundsHeight)*1.0/worldTileSize;\n    const row = Math.floor(_height / tileGeoSize);\n    const column = Math.floor(_width / tileGeoSize);\n   \n    return {\n        row, column\n    }\n}\n\n\nmodule.exports = {\n    tileBoundMap, ST_TileEnvelope, getTileByCoors\n};"
  },
  {
    "path": "src/util.js",
    "content": "const fs = require('fs');\nconst path = require('path');\nconst s4 = () => {\n  return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);\n}\n\n/**\n * 获取随机 uuid\n * @returns {string}\n */\nconst uuid = () => {\n  return (s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4());\n}\n\nfunction wait(ms) {\n  return new Promise(resolve => setTimeout(() => resolve(), ms));\n};\n/**\n * 将毫秒转换为更合适显示的时间数字和单位\n * @param {number} timeInMs \n * @returns {{\n *   resultTime: number;\n *   unit: 'ms' | 'sec' | 'min' | 'hour';\n * }}\n */\nconst prettyTime = (timeInMs) => {\n  let result = 0\n  let unit = 'ms'\n  if (timeInMs < 1000) {\n    result = timeInMs\n  } else if (timeInMs < 60 * 1000) {\n    result = timeInMs / 1000\n    unit = 'sec'\n  } else if (timeInMs < 60 * 60 * 1000) {\n    result = timeInMs / (60 * 1000)\n    unit = 'min'\n  } else {\n    result = timeInMs / (60 * 60 * 1000)\n    unit = 'hour'\n  }\n  return {\n    resultTime: result,\n    unit\n  }\n}\n//递归创建目录\nfunction mkdirsSync(dirName) {\n  if (fs.existsSync(dirName)) {\n    return true;\n  } else {\n    if (mkdirsSync(path.dirname(dirName))) {\n      fs.mkdirSync(dirName);\n      return true;\n    }\n  }\n}\n\n\n/**\n * 清空文件夹下所有文件\n * @param {*} fold \n */\nfunction emptyDir(fold) {\n  if(fs.existsSync(fold)===false)\n    return;\n  const files = fs.readdirSync(fold);\n  files.forEach(file => {\n    const filePath = path.join(fold, file);\n    const stats = fs.statSync(filePath);\n    if (stats.isDirectory()) {\n      emptyDir(filePath);\n      fs.rmdirSync(filePath);\n    } else {\n      fs.unlinkSync(filePath);\n    }\n  });\n}\n\n\nmodule.exports = {\n  uuid, prettyTime, mkdirsSync, emptyDir, wait\n}"
  },
  {
    "path": "src/workfarm/child/index.js",
    "content": "'use strict'\n\nlet $module\n\n/*\n  let contextProto = this.context;\n  while (contextProto = Object.getPrototypeOf(contextProto)) {\n    completionGroups.push(Object.getOwnPropertyNames(contextProto));\n  }\n*/\n\n\nfunction handle (data) {\n  let idx      = data.idx\n    , child    = data.child\n    , method   = data.method\n    , args     = data.args\n    , callback = function () {\n        let _args = Array.prototype.slice.call(arguments)\n        if (_args[0] instanceof Error) {\n          let e = _args[0]\n          _args[0] = {\n              '$error'  : '$error'\n            , 'type'    : e.constructor.name\n            , 'message' : e.message\n            , 'stack'   : e.stack\n          }\n          Object.keys(e).forEach(function(key) {\n            _args[0][key] = e[key]\n          })\n        }\n        process.send({ owner: 'farm', idx: idx, child: child, args: _args })\n      }\n    , exec\n\n  if (method == null && typeof $module == 'function')\n    exec = $module\n  else if (typeof $module[method] == 'function')\n    exec = $module[method]\n\n  if (!exec)\n    return console.error('NO SUCH METHOD:', method)\n\n  exec.apply(null, args.concat([ callback ]))\n}\n\n\nprocess.on('message', function (data) {\n  if (data.owner !== 'farm') {\n    return;\n  }\n\n  if (!$module) return $module = require(data.module)\n  if (data.event == 'die') return process.exit(0)\n  handle(data)\n})\n"
  },
  {
    "path": "src/workfarm/farm.js",
    "content": "'use strict'\n\nconst DEFAULT_OPTIONS = {\n          workerOptions               : {}\n        , maxCallsPerWorker           : Infinity\n        , maxConcurrentWorkers        : (require('os').cpus() || { length: 1 }).length\n        , maxConcurrentCallsPerWorker : 10\n        , maxConcurrentCalls          : Infinity\n        , maxCallTime                 : Infinity // exceed this and the whole worker is terminated\n        , maxRetries                  : Infinity\n        , forcedKillTime              : 100\n        , autoStart                   : false\n        , onChild                     : function() {}\n      }\n\nconst fork                    = require('./fork')\n    , TimeoutError            = require('errno').create('TimeoutError')\n    , ProcessTerminatedError  = require('errno').create('ProcessTerminatedError')\n    , MaxConcurrentCallsError = require('errno').create('MaxConcurrentCallsError')\n\n\nfunction Farm (options, path) {\n  this.options     = Object.assign({}, DEFAULT_OPTIONS, options)\n  this.path        = path\n  this.activeCalls = 0\n}\n\n\n// make a handle to pass back in the form of an external API\nFarm.prototype.mkhandle = function (method) {\n  return function () {\n    let args = Array.prototype.slice.call(arguments)\n    if (this.activeCalls + this.callQueue.length >= this.options.maxConcurrentCalls) {\n      let err = new MaxConcurrentCallsError('Too many concurrent calls (active: ' + this.activeCalls + ', queued: ' + this.callQueue.length + ')')\n      if (typeof args[args.length - 1] == 'function')\n        return process.nextTick(args[args.length - 1].bind(null, err))\n      throw err\n    }\n    this.addCall({\n        method   : method\n      , callback : args.pop()\n      , args     : args\n      , retries  : 0\n    })\n  }.bind(this)\n}\n\n\n// a constructor of sorts\nFarm.prototype.setup = function (methods) {\n  let iface\n  if (!methods) { // single-function export\n    iface = this.mkhandle()\n  } else { // multiple functions on the export\n    iface = {}\n    methods.forEach(function (m) {\n      iface[m] = this.mkhandle(m)\n    }.bind(this))\n  }\n\n  this.searchStart    = -1\n  this.childId        = -1\n  this.children       = {}\n  this.activeChildren = 0\n  this.callQueue      = []\n\n  if (this.options.autoStart) {\n    while (this.activeChildren < this.options.maxConcurrentWorkers)\n      this.startChild()\n  }\n\n  return iface\n}\n\n\n// when a child exits, check if there are any outstanding jobs and requeue them\nFarm.prototype.onExit = function (childId) {\n  // delay this to give any sends a chance to finish\n  setTimeout(function () {\n    let doQueue = false\n    if (this.children[childId] && this.children[childId].activeCalls) {\n      this.children[childId].calls.forEach(function (call, i) {\n        if (!call) return\n        else if (call.retries >= this.options.maxRetries) {\n          this.receive({\n              idx   : i\n            , child : childId\n            , args  : [ new ProcessTerminatedError('cancel after ' + call.retries + ' retries!') ]\n          })\n        } else {\n          call.retries++\n          this.callQueue.unshift(call)\n          doQueue = true\n        }\n      }.bind(this))\n    }\n    this.stopChild(childId)\n    doQueue && this.processQueue()\n  }.bind(this), 10)\n}\n\n\n// start a new worker\nFarm.prototype.startChild = function () {\n  this.childId++\n\n  let forked = fork(this.path, this.options.workerOptions)\n    , id     = this.childId\n    , c      = {\n          send        : forked.send\n        , child       : forked.child\n        , calls       : []\n        , activeCalls : 0\n        , exitCode    : null\n      }\n\n  this.options.onChild(forked.child);\n\n  forked.child.on('message', function(data) {\n    if (data.owner !== 'farm') {\n      return;\n    }\n    this.receive(data);\n  }.bind(this))\n  forked.child.once('exit', function (code) {\n    c.exitCode = code\n    this.onExit(id)\n  }.bind(this))\n\n  this.activeChildren++\n  this.children[id] = c\n}\n\n\n// stop a worker, identified by id\nFarm.prototype.stopChild = function (childId) {\n  let child = this.children[childId]\n  if (child) {\n    child.send({owner: 'farm', event: 'die'})\n    setTimeout(function () {\n      if (child.exitCode === null)\n        child.child.kill('SIGKILL')\n    }, this.options.forcedKillTime).unref()\n    ;delete this.children[childId]\n    this.activeChildren--\n  }\n}\n\n\n// called from a child process, the data contains information needed to\n// look up the child and the original call so we can invoke the callback\nFarm.prototype.receive = function (data) {\n  let idx     = data.idx\n    , childId = data.child\n    , args    = data.args\n    , child   = this.children[childId]\n    , call\n\n  if (!child) {\n    return;\n  }\n\n  call = child.calls[idx]\n  if (!call) {\n   \n    return;\n  }\n\n  if (this.options.maxCallTime !== Infinity)\n    clearTimeout(call.timer)\n\n  if (args[0] && args[0].$error == '$error') {\n    let e = args[0]\n    switch (e.type) {\n      case 'TypeError': args[0] = new TypeError(e.message); break\n      case 'RangeError': args[0] = new RangeError(e.message); break\n      case 'EvalError': args[0] = new EvalError(e.message); break\n      case 'ReferenceError': args[0] = new ReferenceError(e.message); break\n      case 'SyntaxError': args[0] = new SyntaxError(e.message); break\n      case 'URIError': args[0] = new URIError(e.message); break\n      default: args[0] = new Error(e.message)\n    }\n    args[0].type = e.type\n    args[0].stack = e.stack\n\n    // Copy any custom properties to pass it on.\n    Object.keys(e).forEach(function(key) {\n      args[0][key] = e[key];\n    });\n  }\n\n  process.nextTick(function () {\n    call.callback.apply(null, args)\n  })\n\n  ;delete child.calls[idx]\n  child.activeCalls--\n  this.activeCalls--\n\n  if (child.calls.length >= this.options.maxCallsPerWorker\n      && !Object.keys(child.calls).length) {\n    // this child has finished its run, kill it\n    this.stopChild(childId)\n  }\n\n  // allow any outstanding calls to be processed\n  this.processQueue()\n}\n\n\nFarm.prototype.childTimeout = function (childId) {\n  let child = this.children[childId]\n    , i\n\n  if (!child)\n    return\n\n  for (i in child.calls) {\n    this.receive({\n        idx   : i\n      , child : childId\n      , args  : [ new TimeoutError('worker call timed out!') ]\n    })\n  }\n  this.stopChild(childId)\n}\n\n\n// send a call to a worker, identified by id\nFarm.prototype.send = function (childId, call) {\n  let child = this.children[childId]\n    , idx   = child.calls.length\n\n  child.calls.push(call)\n  child.activeCalls++\n  this.activeCalls++\n\n  child.send({\n      owner  : 'farm'\n    , idx    : idx\n    , child  : childId\n    , method : call.method\n    , args   : call.args\n  })\n\n  if (this.options.maxCallTime !== Infinity) {\n    call.timer =\n      setTimeout(this.childTimeout.bind(this, childId), this.options.maxCallTime)\n  }\n}\n\n\n// a list of active worker ids, in order, but the starting offset is\n// shifted each time this method is called, so we work our way through\n// all workers when handing out jobs\nFarm.prototype.childKeys = function () {\n  let cka = Object.keys(this.children)\n    , cks\n\n  if (this.searchStart >= cka.length - 1)\n    this.searchStart = 0\n  else\n    this.searchStart++\n\n  cks = cka.splice(0, this.searchStart)\n\n  return cka.concat(cks)\n}\n\n\n// Calls are added to a queue, this processes the queue and is called\n// whenever there might be a chance to send more calls to the workers.\n// The various options all impact on when we're able to send calls,\n// they may need to be kept in a queue until a worker is ready.\nFarm.prototype.processQueue = function () {\n  let cka, i = 0, childId\n\n  if (!this.callQueue.length)\n    return this.ending && this.end()\n\n  if (this.activeChildren < this.options.maxConcurrentWorkers)\n    this.startChild()\n\n  for (cka = this.childKeys(); i < cka.length; i++) {\n    childId = +cka[i]\n    if (this.children[childId].activeCalls < this.options.maxConcurrentCallsPerWorker\n        && this.children[childId].calls.length < this.options.maxCallsPerWorker) {\n\n      this.send(childId, this.callQueue.shift())\n      if (!this.callQueue.length)\n        return this.ending && this.end()\n    } /*else {\n      console.log(\n        , this.children[childId].activeCalls < this.options.maxConcurrentCallsPerWorker\n        , this.children[childId].calls.length < this.options.maxCallsPerWorker\n        , this.children[childId].calls.length , this.options.maxCallsPerWorker)\n    }*/\n  }\n\n  if (this.ending)\n    this.end()\n}\n\n\n// add a new call to the call queue, then trigger a process of the queue\nFarm.prototype.addCall = function (call) {\n  if (this.ending)\n    return this.end() // don't add anything new to the queue\n  this.callQueue.push(call)\n  this.processQueue()\n}\n\n\n// kills child workers when they're all done\nFarm.prototype.end = function (callback) {\n  let complete = true\n  if (this.ending === false)\n    return\n  if (callback)\n    this.ending = callback\n  else if (this.ending == null)\n    this.ending = true\n  Object.keys(this.children).forEach(function (child) {\n    if (!this.children[child])\n      return\n    if (!this.children[child].activeCalls)\n      this.stopChild(child)\n    else\n      complete = false\n  }.bind(this))\n\n  if (complete && typeof this.ending == 'function') {\n    process.nextTick(function () {\n      this.ending()\n      this.ending = false\n    }.bind(this))\n  }\n}\n\n\nmodule.exports              = Farm\nmodule.exports.TimeoutError = TimeoutError\n"
  },
  {
    "path": "src/workfarm/fork.js",
    "content": "'use strict'\n\nconst childProcess = require('child_process')\n    , childModule  = require.resolve('./child/index')\n\n\nfunction fork (forkModule, workerOptions) {\n  // suppress --debug / --inspect flags while preserving others (like --harmony)\n  let filteredArgs = process.execArgv.filter(function (v) {\n        return !(/^--(debug|inspect)/).test(v)\n      })\n    , options       = Object.assign({\n          execArgv : filteredArgs\n        , env      : process.env\n        , cwd      : process.cwd()\n      }, workerOptions)\n    , child         = childProcess.fork(childModule, process.argv, options)\n\n  child.on('error', function() {\n    // this *should* be picked up by onExit and the operation requeued\n  })\n\n  child.send({ owner: 'farm', module: forkModule })\n\n  // return a send() function for this child\n  return {\n      send  : child.send.bind(child)\n    , child : child\n  }\n}\n\n\nmodule.exports = fork\n"
  },
  {
    "path": "src/workfarm/index.js",
    "content": "'use strict'\n\nconst Farm = require('./farm')\n\nlet farms = [] // keep record of farms so we can end() them if required\n\n\nfunction farm (options, path, methods) {\n  if (typeof options == 'string') {\n    methods = path\n    path = options\n    options = {}\n  }\n\n  let f   = new Farm(options, path)\n    , api = f.setup(methods)\n    \n  farms.push({ farm: f, api: api });\n  api.farm = f;\n  // return the public API\n  return api;\n}\n\n\nfunction end (api, callback) {\n  for (let i = 0; i < farms.length; i++)\n    if (farms[i] && farms[i].api === api)\n      return farms[i].farm.end(callback)\n  process.nextTick(callback.bind(null, new Error('Worker farm not found!')))\n}\n\n\nmodule.exports     = farm\nmodule.exports.end = end\n"
  },
  {
    "path": "test/app.js",
    "content": "const path = require('path');\nconst fs = require('fs');\n\nconst demPath = path.join(__dirname, 'test.tif');\nconst tileDirPath = path.join(__dirname, 'terrain');\n\nconst config = {\n    \"zoom\": \"5-14\",\n    \"epsg\": 3857,\n    \"size\": 256,\n    \"resampling\": 2,\n    \"encoding\": \"mapbox\",\n    \"input\": demPath,\n    \"output\": tileDirPath,\n    \"clean\": true,\n    \"baseHeight\":0,\n}\n\nfs.writeFileSync(path.join(__dirname, 'config.json'), JSON.stringify(config));\n"
  },
  {
    "path": "test/mapbox-gl.css",
    "content": ".mapboxgl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0)}.mapboxgl-canvas{left:0;position:absolute;top:0}.mapboxgl-map:-webkit-full-screen{height:100%;width:100%}.mapboxgl-canary{background-color:salmon}.mapboxgl-canvas-container.mapboxgl-interactive,.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass{cursor:grab;-webkit-user-select:none;user-select:none}.mapboxgl-canvas-container.mapboxgl-interactive.mapboxgl-track-pointer{cursor:pointer}.mapboxgl-canvas-container.mapboxgl-interactive:active,.mapboxgl-ctrl-group button.mapboxgl-ctrl-compass:active{cursor:grabbing}.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate,.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate .mapboxgl-canvas{touch-action:pan-x pan-y}.mapboxgl-canvas-container.mapboxgl-touch-drag-pan,.mapboxgl-canvas-container.mapboxgl-touch-drag-pan .mapboxgl-canvas{touch-action:pinch-zoom}.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan,.mapboxgl-canvas-container.mapboxgl-touch-zoom-rotate.mapboxgl-touch-drag-pan .mapboxgl-canvas{touch-action:none}.mapboxgl-ctrl-bottom-left,.mapboxgl-ctrl-bottom-right,.mapboxgl-ctrl-top-left,.mapboxgl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.mapboxgl-ctrl-top-left{left:0;top:0}.mapboxgl-ctrl-top-right{right:0;top:0}.mapboxgl-ctrl-bottom-left{bottom:0;left:0}.mapboxgl-ctrl-bottom-right{bottom:0;right:0}.mapboxgl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.mapboxgl-ctrl-top-left .mapboxgl-ctrl{float:left;margin:10px 0 0 10px}.mapboxgl-ctrl-top-right .mapboxgl-ctrl{float:right;margin:10px 10px 0 0}.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl{float:left;margin:0 0 10px 10px}.mapboxgl-ctrl-bottom-right .mapboxgl-ctrl{float:right;margin:0 10px 10px 0}.mapboxgl-ctrl-group{background:#fff;border-radius:4px}.mapboxgl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (-ms-high-contrast:active){.mapboxgl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.mapboxgl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;overflow:hidden;padding:0;width:29px}.mapboxgl-ctrl-group button+button{border-top:1px solid #ddd}.mapboxgl-ctrl button .mapboxgl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (-ms-high-contrast:active){.mapboxgl-ctrl-icon{background-color:transparent}.mapboxgl-ctrl-group button+button{border-top:1px solid ButtonText}}.mapboxgl-ctrl-attrib-button:focus,.mapboxgl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.mapboxgl-ctrl button:disabled{cursor:not-allowed}.mapboxgl-ctrl button:disabled .mapboxgl-ctrl-icon{opacity:.25}.mapboxgl-ctrl-group button:first-child{border-radius:4px 4px 0 0}.mapboxgl-ctrl-group button:last-child{border-radius:0 0 4px 4px}.mapboxgl-ctrl-group button:only-child{border-radius:inherit}.mapboxgl-ctrl button:not(:disabled):hover{background-color:rgb(0 0 0/5%)}.mapboxgl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.mapboxgl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E\")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E\")}}.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E\")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E\")}}.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath id='south' d='M10.5 16l4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E\")}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath id='south' d='M10.5 16l4 8 4-8h-8z' fill='%23999'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 29 29'%3E%3Cpath d='M10.5 14l4-8 4 8h-8z'/%3E%3Cpath id='south' d='M10.5 16l4 8 4-8h-8z' fill='%23ccc'/%3E%3C/svg%3E\")}}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23333'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23aaa'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' fill='%23f00'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-waiting .mapboxgl-ctrl-icon{animation:mapboxgl-spin 2s linear infinite}@media (-ms-high-contrast:active){.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23fff'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23999'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' fill='%23f00'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e58978'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%2333b5e5'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23e54e33'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23000'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' display='none'/%3E%3C/svg%3E\")}.mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill='%23666'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle id='dot' cx='10' cy='10' r='2'/%3E%3Cpath id='stroke' d='M14 5l1 1-9 9-1-1 9-9z' fill='%23f00'/%3E%3C/svg%3E\")}}@keyframes mapboxgl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.mapboxgl-ctrl-logo{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd' viewBox='0 0 88 23'%3E%3Cdefs%3E%3Cpath id='logo' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='text' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='clip'%3E%3Crect x='0' y='0' width='100%25' height='100%25' fill='white'/%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/mask%3E%3Cg id='outline' opacity='0.3' stroke='%23000' stroke-width='3'%3E%3Ccircle mask='url(%23clip)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23text' mask='url(%23clip)'/%3E%3C/g%3E%3Cg id='fill' opacity='0.9' fill='%23fff'%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/g%3E%3C/svg%3E\");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.mapboxgl-ctrl-logo.mapboxgl-compact{width:23px}@media (-ms-high-contrast:active){a.mapboxgl-ctrl-logo{background-color:transparent;background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd' viewBox='0 0 88 23'%3E%3Cdefs%3E%3Cpath id='logo' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='text' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='clip'%3E%3Crect x='0' y='0' width='100%25' height='100%25' fill='white'/%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/mask%3E%3Cg id='outline' opacity='1' stroke='%23000' stroke-width='3'%3E%3Ccircle mask='url(%23clip)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23text' mask='url(%23clip)'/%3E%3C/g%3E%3Cg id='fill' opacity='1' fill='%23fff'%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/g%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){a.mapboxgl-ctrl-logo{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' fill-rule='evenodd' viewBox='0 0 88 23'%3E%3Cdefs%3E%3Cpath id='logo' d='M11.5 2.25c5.105 0 9.25 4.145 9.25 9.25s-4.145 9.25-9.25 9.25-9.25-4.145-9.25-9.25 4.145-9.25 9.25-9.25zM6.997 15.983c-.051-.338-.828-5.802 2.233-8.873a4.395 4.395 0 013.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39 0 1.18-.449 2.301-1.28 3.13C12.72 16.93 7 16 7 16l-.003-.017zM15.3 10.5l-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z'/%3E%3Cpath id='text' d='M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19c-1.04 0-2.03-.43-2.74-1.18v3.77c0 .13-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01c.01 0 .01 0 .01-.01.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V15c-.7.76-1.69 1.19-2.73 1.19-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.375-.19a4.24 4.24 0 00-4.16 3.29c-.13.59-.13 1.19 0 1.77a4.233 4.233 0 004.17 3.3c2.35 0 4.26-1.87 4.26-4.19 0-2.32-1.9-4.17-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18 1.88 0 3.45 1.4 3.84 3.28.13.59.13 1.2 0 1.8-.39 1.88-1.96 3.29-3.84 3.29-1.03 0-2.02-.43-2.73-1.18v.77c0 .12-.1.23-.23.23h-1.4c-.13 0-.23-.1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4c-.13 0-.23-.11-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55.45-.95 1.4-1.55 2.44-1.56 1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41c-.13 0-.23-.11-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.615 0h-1.61c-.04 0-.08-.01-.12-.03-.09-.06-.13-.19-.06-.28l2.43-3.71-2.39-3.65a.213.213 0 01-.03-.12c0-.12.09-.21.21-.21h1.61c.13 0 .24.06.3.17l1.41 2.37 1.4-2.37a.34.34 0 01.3-.17h1.6c.04 0 .08.01.12.03.09.06.13.19.06.28l-2.37 3.65 2.43 3.7c0 .05.01.09.01.13 0 .12-.09.21-.21.21h-1.61c-.13 0-.24-.06-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 01-.3.17zm-7.12-1.49c-1.33 0-2.42-1.12-2.42-2.51 0-1.39 1.08-2.52 2.42-2.52 1.33 0 2.42 1.12 2.42 2.51 0 1.39-1.08 2.51-2.42 2.52zm-19.865 0c-1.32 0-2.39-1.11-2.42-2.48v-.07c.02-1.38 1.09-2.49 2.4-2.49 1.32 0 2.41 1.12 2.41 2.51 0 1.39-1.07 2.52-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51c0-1.39 1.08-2.52 2.4-2.52 1.33 0 2.39 1.11 2.41 2.48l.02.08zm18.12 2.47c-1.32 0-2.39-1.11-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51c0 1.39-1.09 2.51-2.42 2.51z'/%3E%3C/defs%3E%3Cmask id='clip'%3E%3Crect x='0' y='0' width='100%25' height='100%25' fill='white'/%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/mask%3E%3Cg id='outline' opacity='1' stroke='%23fff' stroke-width='3' fill='%23fff'%3E%3Ccircle mask='url(%23clip)' cx='11.5' cy='11.5' r='9.25'/%3E%3Cuse xlink:href='%23text' mask='url(%23clip)'/%3E%3C/g%3E%3Cg id='fill' opacity='1' fill='%23000'%3E%3Cuse xlink:href='%23logo'/%3E%3Cuse xlink:href='%23text'/%3E%3C/g%3E%3C/svg%3E\")}}.mapboxgl-ctrl.mapboxgl-ctrl-attrib{background-color:hsla(0,0%,100%,.5);margin:0;padding:0 5px}@media screen{.mapboxgl-ctrl-attrib.mapboxgl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.mapboxgl-ctrl-attrib.mapboxgl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show,.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.mapboxgl-ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-inner{display:none}.mapboxgl-ctrl-attrib-button{background-color:hsla(0,0%,100%,.5);background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl-attrib-button,.mapboxgl-ctrl-top-left .mapboxgl-ctrl-attrib-button{left:0}.mapboxgl-ctrl-attrib.mapboxgl-compact .mapboxgl-ctrl-attrib-button,.mapboxgl-ctrl-attrib.mapboxgl-compact-show .mapboxgl-ctrl-attrib-inner{display:block}.mapboxgl-ctrl-attrib.mapboxgl-compact-show .mapboxgl-ctrl-attrib-button{background-color:rgb(0 0 0/5%)}.mapboxgl-ctrl-bottom-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{bottom:0;right:0}.mapboxgl-ctrl-top-right>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{right:0;top:0}.mapboxgl-ctrl-top-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{left:0;top:0}.mapboxgl-ctrl-bottom-left>.mapboxgl-ctrl-attrib.mapboxgl-compact:after{bottom:0;left:0}}@media screen and (-ms-high-contrast:active){.mapboxgl-ctrl-attrib.mapboxgl-compact:after{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd' fill='%23fff'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\")}}@media screen and (-ms-high-contrast:black-on-white){.mapboxgl-ctrl-attrib.mapboxgl-compact:after{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\")}}.mapboxgl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.mapboxgl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.mapboxgl-ctrl-attrib .mapbox-improve-map{font-weight:700;margin-left:2px}.mapboxgl-attrib-empty{display:none}.mapboxgl-ctrl-scale{background-color:hsla(0,0%,100%,.75);border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px;white-space:nowrap}.mapboxgl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.mapboxgl-popup-anchor-top,.mapboxgl-popup-anchor-top-left,.mapboxgl-popup-anchor-top-right{flex-direction:column}.mapboxgl-popup-anchor-bottom,.mapboxgl-popup-anchor-bottom-left,.mapboxgl-popup-anchor-bottom-right{flex-direction:column-reverse}.mapboxgl-popup-anchor-left{flex-direction:row}.mapboxgl-popup-anchor-right{flex-direction:row-reverse}.mapboxgl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.mapboxgl-popup-anchor-top .mapboxgl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.mapboxgl-popup-anchor-left .mapboxgl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.mapboxgl-popup-anchor-right .mapboxgl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.mapboxgl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.mapboxgl-popup-close-button:hover{background-color:rgb(0 0 0/5%)}.mapboxgl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:10px 10px 15px;pointer-events:auto;position:relative}.mapboxgl-popup-anchor-top-left .mapboxgl-popup-content{border-top-left-radius:0}.mapboxgl-popup-anchor-top-right .mapboxgl-popup-content{border-top-right-radius:0}.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-content{border-bottom-left-radius:0}.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-content{border-bottom-right-radius:0}.mapboxgl-popup-track-pointer{display:none}.mapboxgl-popup-track-pointer *{pointer-events:none;user-select:none}.mapboxgl-map:hover .mapboxgl-popup-track-pointer{display:flex}.mapboxgl-map:active .mapboxgl-popup-track-pointer{display:none}.mapboxgl-marker{left:0;opacity:1;position:absolute;top:0;transition:opacity .2s;will-change:transform}.mapboxgl-user-location-dot,.mapboxgl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.mapboxgl-user-location-dot:before{animation:mapboxgl-user-location-dot-pulse 2s infinite;content:\"\";position:absolute}.mapboxgl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px rgba(0,0,0,.35);box-sizing:border-box;content:\"\";height:19px;left:-2px;position:absolute;top:-2px;width:19px}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading{height:0;width:0}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:after,.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:before{border-bottom:7.5px solid #4aa1eb;content:\"\";position:absolute}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:before{border-left:7.5px solid transparent;transform:translateY(-28px) skewY(-20deg)}.mapboxgl-user-location-show-heading .mapboxgl-user-location-heading:after{border-right:7.5px solid transparent;transform:translate(7.5px,-28px) skewY(20deg)}@keyframes mapboxgl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.mapboxgl-user-location-dot-stale{background-color:#aaa}.mapboxgl-user-location-dot-stale:after{display:none}.mapboxgl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.mapboxgl-crosshair,.mapboxgl-crosshair .mapboxgl-interactive,.mapboxgl-crosshair .mapboxgl-interactive:active{cursor:crosshair}.mapboxgl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}@media print{.mapbox-improve-map{display:none}}.mapboxgl-scroll-zoom-blocker,.mapboxgl-touch-pan-blocker{align-items:center;background:rgba(0,0,0,.7);color:#fff;display:flex;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif;height:100%;justify-content:center;left:0;opacity:0;pointer-events:none;position:absolute;text-align:center;top:0;transition:opacity .75s ease-in-out;transition-delay:1s;width:100%}.mapboxgl-scroll-zoom-blocker-show,.mapboxgl-touch-pan-blocker-show{opacity:1;transition:opacity .1s ease-in-out}.mapboxgl-canvas-container.mapboxgl-touch-pan-blocker-override.mapboxgl-scrollable-page,.mapboxgl-canvas-container.mapboxgl-touch-pan-blocker-override.mapboxgl-scrollable-page .mapboxgl-canvas{touch-action:pan-x pan-y}"
  },
  {
    "path": "test/mapbox-gl.js",
    "content": "/* Mapbox GL JS is Copyright © 2020 Mapbox and subject to the Mapbox Terms of Service ((https://www.mapbox.com/legal/tos/). */\n(function (global, factory) {\ntypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\ntypeof define === 'function' && define.amd ? define(factory) :\n(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.mapboxgl = factory());\n})(this, (function () { 'use strict';\n\n/* eslint-disable */\n\nvar shared, worker, mapboxgl;\n// define gets called three times: one for each chunk. we rely on the order\n// they're imported to know which is which\nfunction define(_, chunk) {\nif (!shared) {\n    shared = chunk;\n} else if (!worker) {\n    worker = chunk;\n} else {\n    var workerBundleString = \"self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; (\" + shared + \")(sharedChunk); (\" + worker + \")(sharedChunk); self.onerror = null;\"\n\n    var sharedChunk = {};\n    shared(sharedChunk);\n    mapboxgl = chunk(sharedChunk);\n    if (typeof window !== 'undefined' && window && window.URL && window.URL.createObjectURL) {\n        mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));\n    }\n}\n}\n\n\ndefine([\"exports\"],(function(t){\"use strict\";var e=\"3.4.0\";let r;const n={API_URL:\"https://api.mapbox.com\",get API_URL_REGEX(){if(null==r){const t=/^((https?:)?\\/\\/)?([^\\/]+\\.)?mapbox\\.c(n|om)(\\/|\\?|$)/i;try{r=null!=process.env.API_URL_REGEX?new RegExp(process.env.API_URL_REGEX):t;}catch(e){r=t;}}return r},get API_TILEJSON_REGEX(){return /^((https?:)?\\/\\/)?([^\\/]+\\.)?mapbox\\.c(n|om)(\\/v[0-9]*\\/.*\\.json.*$)/i},get API_SPRITE_REGEX(){return /^((https?:)?\\/\\/)?([^\\/]+\\.)?mapbox\\.c(n|om)(\\/styles\\/v[0-9]*\\/)(.*\\/sprite.*\\..*$)/i},get API_FONTS_REGEX(){return /^((https?:)?\\/\\/)?([^\\/]+\\.)?mapbox\\.c(n|om)(\\/fonts\\/v[0-9]*\\/)(.*\\.pbf.*$)/i},get API_STYLE_REGEX(){return /^((https?:)?\\/\\/)?([^\\/]+\\.)?mapbox\\.c(n|om)(\\/styles\\/v[0-9]*\\/)(.*$)/i},get API_CDN_URL_REGEX(){return /^((https?:)?\\/\\/)?api\\.mapbox\\.c(n|om)(\\/mapbox-gl-js\\/)(.*$)/i},get EVENTS_URL(){if(!n.API_URL)return null;try{const t=new URL(n.API_URL);return \"api.mapbox.cn\"===t.hostname?\"https://events.mapbox.cn/events/v2\":\"api.mapbox.com\"===t.hostname?\"https://events.mapbox.com/events/v2\":null}catch(t){return null}},SESSION_PATH:\"/map-sessions/v1\",FEEDBACK_URL:\"https://apps.mapbox.com/feedback\",TILE_URL_VERSION:\"v4\",RASTER_URL_PREFIX:\"raster/v1\",RASTERARRAYS_URL_PREFIX:\"rasterarrays/v1\",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:\"mapbox://styles/mapbox/standard\",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:\"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm\",MESHOPT_URL:\"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm\",MESHOPT_SIMD_URL:\"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm\",GLYPHS_URL:\"mapbox://fonts/mapbox/{fontstack}/{range}.pbf\"};function i(t){return n.API_URL_REGEX.test(t)}function s(t){return 0===t.indexOf(\"mapbox:\")}function a(t){return n.API_CDN_URL_REGEX.test(t)}function o(t){return n.API_SPRITE_REGEX.test(t)}function l(t){return n.API_STYLE_REGEX.test(t)&&!o(t)}const u={create:\"create\",load:\"load\",fullLoad:\"fullLoad\"};function c(t){const e=t.name.split(\"?\")[0];return a(e)&&e.includes(\"mapbox-gl.js\")?\"javascript\":a(e)&&e.includes(\"mapbox-gl.css\")?\"css\":function(t){return n.API_FONTS_REGEX.test(t)}(e)?\"fontRange\":o(e)?\"sprite\":l(e)?\"style\":function(t){return n.API_TILEJSON_REGEX.test(t)}(e)?\"tilejson\":\"other\"}function h(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,\"default\")?t.default:t}var p={},f={};Object.defineProperty(f,\"__esModule\",{value:!0}),f.setMatrixArrayType=function(t){f.ARRAY_TYPE=m=t;},f.toRadian=function(t){return t*g},f.equals=function(t,e){return Math.abs(t-e)<=d*Math.max(1,Math.abs(t),Math.abs(e))},f.RANDOM=f.ARRAY_TYPE=f.EPSILON=void 0;var d=1e-6;f.EPSILON=d;var m=\"undefined\"!=typeof Float32Array?Float32Array:Array;f.ARRAY_TYPE=m;var y=Math.random;f.RANDOM=y;var g=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var x={};function b(t){return b=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},b(t)}Object.defineProperty(x,\"__esModule\",{value:!0}),x.create=function(){var t=new v.ARRAY_TYPE(4);return v.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},x.clone=function(t){var e=new v.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},x.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},x.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},x.fromValues=function(t,e,r,n){var i=new v.ARRAY_TYPE(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i},x.set=function(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t},x.transpose=function(t,e){if(t===e){var r=e[1];t[1]=e[2],t[2]=r;}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t},x.invert=function(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=r*s-i*n;return a?(t[0]=s*(a=1/a),t[1]=-n*a,t[2]=-i*a,t[3]=r*a,t):null},x.adjoint=function(t,e){var r=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=r,t},x.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},x.multiply=w,x.rotate=function(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=Math.sin(r),l=Math.cos(r);return t[0]=n*l+s*o,t[1]=i*l+a*o,t[2]=n*-o+s*l,t[3]=i*-o+a*l,t},x.scale=function(t,e,r){var n=e[1],i=e[2],s=e[3],a=r[0],o=r[1];return t[0]=e[0]*a,t[1]=n*a,t[2]=i*o,t[3]=s*o,t},x.fromRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t},x.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t},x.str=function(t){return \"mat2(\"+t[0]+\", \"+t[1]+\", \"+t[2]+\", \"+t[3]+\")\"},x.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3])},x.LDU=function(t,e,r,n){return t[2]=n[2]/n[0],r[0]=n[0],r[1]=n[1],r[3]=n[3]-t[2]*r[1],[t,e,r]},x.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t},x.subtract=M,x.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},x.equals=function(t,e){var r=t[0],n=t[1],i=t[2],s=t[3],a=e[0],o=e[1],l=e[2],u=e[3];return Math.abs(r-a)<=v.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-o)<=v.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-l)<=v.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(s-u)<=v.EPSILON*Math.max(1,Math.abs(s),Math.abs(u))},x.multiplyScalar=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},x.multiplyScalarAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t},x.sub=x.mul=void 0;var v=function(t,e){if(t&&t.__esModule)return t;if(null===t||\"object\"!==b(t)&&\"function\"!=typeof t)return {default:t};var r=_(void 0);if(r&&r.has(t))return r.get(t);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(\"default\"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=i?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s];}return n.default=t,r&&r.set(t,n),n}(f);function _(t){if(\"function\"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return (_=function(t){return t?r:e})(t)}function w(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=r[0],l=r[1],u=r[2],c=r[3];return t[0]=n*o+s*l,t[1]=i*o+a*l,t[2]=n*u+s*c,t[3]=i*u+a*c,t}function M(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}x.mul=w,x.sub=M;var A={};function S(t){return S=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},S(t)}Object.defineProperty(A,\"__esModule\",{value:!0}),A.create=function(){var t=new I.ARRAY_TYPE(6);return I.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t},A.clone=function(t){var e=new I.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},A.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},A.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},A.fromValues=function(t,e,r,n,i,s){var a=new I.ARRAY_TYPE(6);return a[0]=t,a[1]=e,a[2]=r,a[3]=n,a[4]=i,a[5]=s,a},A.set=function(t,e,r,n,i,s,a){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=s,t[5]=a,t},A.invert=function(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=r*s-n*i;return l?(t[0]=s*(l=1/l),t[1]=-n*l,t[2]=-i*l,t[3]=r*l,t[4]=(i*o-s*a)*l,t[5]=(n*a-r*o)*l,t):null},A.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},A.multiply=P,A.rotate=function(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=Math.sin(r),c=Math.cos(r);return t[0]=n*c+s*u,t[1]=i*c+a*u,t[2]=n*-u+s*c,t[3]=i*-u+a*c,t[4]=o,t[5]=l,t},A.scale=function(t,e,r){var n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=r[0],u=r[1];return t[0]=e[0]*l,t[1]=n*l,t[2]=i*u,t[3]=s*u,t[4]=a,t[5]=o,t},A.translate=function(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=r[0],c=r[1];return t[0]=n,t[1]=i,t[2]=s,t[3]=a,t[4]=n*u+s*c+o,t[5]=i*u+a*c+l,t},A.fromRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t[4]=0,t[5]=0,t},A.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t},A.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t},A.str=function(t){return \"mat2d(\"+t[0]+\", \"+t[1]+\", \"+t[2]+\", \"+t[3]+\", \"+t[4]+\", \"+t[5]+\")\"},A.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],1)},A.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t},A.subtract=E,A.multiplyScalar=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t},A.multiplyScalarAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t},A.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]},A.equals=function(t,e){var r=t[0],n=t[1],i=t[2],s=t[3],a=t[4],o=t[5],l=e[0],u=e[1],c=e[2],h=e[3],p=e[4],f=e[5];return Math.abs(r-l)<=I.EPSILON*Math.max(1,Math.abs(r),Math.abs(l))&&Math.abs(n-u)<=I.EPSILON*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(i-c)<=I.EPSILON*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(s-h)<=I.EPSILON*Math.max(1,Math.abs(s),Math.abs(h))&&Math.abs(a-p)<=I.EPSILON*Math.max(1,Math.abs(a),Math.abs(p))&&Math.abs(o-f)<=I.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))},A.sub=A.mul=void 0;var I=function(t,e){if(t&&t.__esModule)return t;if(null===t||\"object\"!==S(t)&&\"function\"!=typeof t)return {default:t};var r=k(void 0);if(r&&r.has(t))return r.get(t);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(\"default\"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=i?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s];}return n.default=t,r&&r.set(t,n),n}(f);function k(t){if(\"function\"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return (k=function(t){return t?r:e})(t)}function P(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=r[0],c=r[1],h=r[2],p=r[3],f=r[4],d=r[5];return t[0]=n*u+s*c,t[1]=i*u+a*c,t[2]=n*h+s*p,t[3]=i*h+a*p,t[4]=n*f+s*d+o,t[5]=i*f+a*d+l,t}function E(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t}A.mul=P,A.sub=E;var z={};function T(t){return T=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},T(t)}Object.defineProperty(z,\"__esModule\",{value:!0}),z.create=function(){var t=new B.ARRAY_TYPE(9);return B.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},z.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},z.clone=function(t){var e=new B.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},z.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},z.fromValues=function(t,e,r,n,i,s,a,o,l){var u=new B.ARRAY_TYPE(9);return u[0]=t,u[1]=e,u[2]=r,u[3]=n,u[4]=i,u[5]=s,u[6]=a,u[7]=o,u[8]=l,u},z.set=function(t,e,r,n,i,s,a,o,l,u){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=s,t[5]=a,t[6]=o,t[7]=l,t[8]=u,t},z.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},z.transpose=function(t,e){if(t===e){var r=e[1],n=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=i;}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t},z.invert=function(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],u=e[7],c=e[8],h=c*a-o*u,p=-c*s+o*l,f=u*s-a*l,d=r*h+n*p+i*f;return d?(t[0]=h*(d=1/d),t[1]=(-c*n+i*u)*d,t[2]=(o*n-i*a)*d,t[3]=p*d,t[4]=(c*r-i*l)*d,t[5]=(-o*r+i*s)*d,t[6]=f*d,t[7]=(-u*r+n*l)*d,t[8]=(a*r-n*s)*d,t):null},z.adjoint=function(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],u=e[7],c=e[8];return t[0]=a*c-o*u,t[1]=i*u-n*c,t[2]=n*o-i*a,t[3]=o*l-s*c,t[4]=r*c-i*l,t[5]=i*s-r*o,t[6]=s*u-a*l,t[7]=n*l-r*u,t[8]=r*a-n*s,t},z.determinant=function(t){var e=t[3],r=t[4],n=t[5],i=t[6],s=t[7],a=t[8];return t[0]*(a*r-n*s)+t[1]*(-a*e+n*i)+t[2]*(s*e-r*i)},z.multiply=R,z.translate=function(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=r[0],f=r[1];return t[0]=n,t[1]=i,t[2]=s,t[3]=a,t[4]=o,t[5]=l,t[6]=p*n+f*a+u,t[7]=p*i+f*o+c,t[8]=p*s+f*l+h,t},z.rotate=function(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=Math.sin(r),f=Math.cos(r);return t[0]=f*n+p*a,t[1]=f*i+p*o,t[2]=f*s+p*l,t[3]=f*a-p*n,t[4]=f*o-p*i,t[5]=f*l-p*s,t[6]=u,t[7]=c,t[8]=h,t},z.scale=function(t,e,r){var n=r[0],i=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},z.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t},z.fromRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=-r,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},z.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},z.fromMat2d=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t},z.fromQuat=function(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=r+r,o=n+n,l=i+i,u=r*a,c=n*a,h=n*o,p=i*a,f=i*o,d=i*l,m=s*a,y=s*o,g=s*l;return t[0]=1-h-d,t[3]=c-g,t[6]=p+y,t[1]=c+g,t[4]=1-u-d,t[7]=f-m,t[2]=p-y,t[5]=f+m,t[8]=1-u-h,t},z.normalFromMat4=function(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],u=e[7],c=e[8],h=e[9],p=e[10],f=e[11],d=e[12],m=e[13],y=e[14],g=e[15],x=r*o-n*a,b=r*l-i*a,v=r*u-s*a,_=n*l-i*o,w=n*u-s*o,M=i*u-s*l,A=c*m-h*d,S=c*y-p*d,I=c*g-f*d,k=h*y-p*m,P=h*g-f*m,E=p*g-f*y,z=x*E-b*P+v*k+_*I-w*S+M*A;return z?(t[0]=(o*E-l*P+u*k)*(z=1/z),t[1]=(l*I-a*E-u*S)*z,t[2]=(a*P-o*I+u*A)*z,t[3]=(i*P-n*E-s*k)*z,t[4]=(r*E-i*I+s*S)*z,t[5]=(n*I-r*P-s*A)*z,t[6]=(m*M-y*w+g*_)*z,t[7]=(y*v-d*M-g*b)*z,t[8]=(d*w-m*v+g*x)*z,t):null},z.projection=function(t,e,r){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/r,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t},z.str=function(t){return \"mat3(\"+t[0]+\", \"+t[1]+\", \"+t[2]+\", \"+t[3]+\", \"+t[4]+\", \"+t[5]+\", \"+t[6]+\", \"+t[7]+\", \"+t[8]+\")\"},z.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},z.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t},z.subtract=V,z.multiplyScalar=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t},z.multiplyScalarAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t},z.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},z.equals=function(t,e){var r=t[0],n=t[1],i=t[2],s=t[3],a=t[4],o=t[5],l=t[6],u=t[7],c=t[8],h=e[0],p=e[1],f=e[2],d=e[3],m=e[4],y=e[5],g=e[6],x=e[7],b=e[8];return Math.abs(r-h)<=B.EPSILON*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(n-p)<=B.EPSILON*Math.max(1,Math.abs(n),Math.abs(p))&&Math.abs(i-f)<=B.EPSILON*Math.max(1,Math.abs(i),Math.abs(f))&&Math.abs(s-d)<=B.EPSILON*Math.max(1,Math.abs(s),Math.abs(d))&&Math.abs(a-m)<=B.EPSILON*Math.max(1,Math.abs(a),Math.abs(m))&&Math.abs(o-y)<=B.EPSILON*Math.max(1,Math.abs(o),Math.abs(y))&&Math.abs(l-g)<=B.EPSILON*Math.max(1,Math.abs(l),Math.abs(g))&&Math.abs(u-x)<=B.EPSILON*Math.max(1,Math.abs(u),Math.abs(x))&&Math.abs(c-b)<=B.EPSILON*Math.max(1,Math.abs(c),Math.abs(b))},z.sub=z.mul=void 0;var B=function(t,e){if(t&&t.__esModule)return t;if(null===t||\"object\"!==T(t)&&\"function\"!=typeof t)return {default:t};var r=C(void 0);if(r&&r.has(t))return r.get(t);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(\"default\"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=i?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s];}return n.default=t,r&&r.set(t,n),n}(f);function C(t){if(\"function\"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return (C=function(t){return t?r:e})(t)}function R(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=r[0],f=r[1],d=r[2],m=r[3],y=r[4],g=r[5],x=r[6],b=r[7],v=r[8];return t[0]=p*n+f*a+d*u,t[1]=p*i+f*o+d*c,t[2]=p*s+f*l+d*h,t[3]=m*n+y*a+g*u,t[4]=m*i+y*o+g*c,t[5]=m*s+y*l+g*h,t[6]=x*n+b*a+v*u,t[7]=x*i+b*o+v*c,t[8]=x*s+b*l+v*h,t}function V(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t}z.mul=R,z.sub=V;var D={};function L(t){return L=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},L(t)}Object.defineProperty(D,\"__esModule\",{value:!0}),D.create=function(){var t=new F.ARRAY_TYPE(16);return F.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},D.clone=function(t){var e=new F.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},D.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},D.fromValues=function(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,m){var y=new F.ARRAY_TYPE(16);return y[0]=t,y[1]=e,y[2]=r,y[3]=n,y[4]=i,y[5]=s,y[6]=a,y[7]=o,y[8]=l,y[9]=u,y[10]=c,y[11]=h,y[12]=p,y[13]=f,y[14]=d,y[15]=m,y},D.set=function(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,m,y){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=s,t[5]=a,t[6]=o,t[7]=l,t[8]=u,t[9]=c,t[10]=h,t[11]=p,t[12]=f,t[13]=d,t[14]=m,t[15]=y,t},D.identity=U,D.transpose=function(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],s=e[6],a=e[7],o=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=s,t[11]=e[14],t[12]=i,t[13]=a,t[14]=o;}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},D.invert=function(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],u=e[7],c=e[8],h=e[9],p=e[10],f=e[11],d=e[12],m=e[13],y=e[14],g=e[15],x=r*o-n*a,b=r*l-i*a,v=r*u-s*a,_=n*l-i*o,w=n*u-s*o,M=i*u-s*l,A=c*m-h*d,S=c*y-p*d,I=c*g-f*d,k=h*y-p*m,P=h*g-f*m,E=p*g-f*y,z=x*E-b*P+v*k+_*I-w*S+M*A;return z?(t[0]=(o*E-l*P+u*k)*(z=1/z),t[1]=(i*P-n*E-s*k)*z,t[2]=(m*M-y*w+g*_)*z,t[3]=(p*w-h*M-f*_)*z,t[4]=(l*I-a*E-u*S)*z,t[5]=(r*E-i*I+s*S)*z,t[6]=(y*v-d*M-g*b)*z,t[7]=(c*M-p*v+f*b)*z,t[8]=(a*P-o*I+u*A)*z,t[9]=(n*I-r*P-s*A)*z,t[10]=(d*w-m*v+g*x)*z,t[11]=(h*v-c*w-f*x)*z,t[12]=(o*S-a*k-l*A)*z,t[13]=(r*k-n*S+i*A)*z,t[14]=(m*b-d*_-y*x)*z,t[15]=(c*_-h*b+p*x)*z,t):null},D.adjoint=function(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],u=e[7],c=e[8],h=e[9],p=e[10],f=e[11],d=e[12],m=e[13],y=e[14],g=e[15];return t[0]=o*(p*g-f*y)-h*(l*g-u*y)+m*(l*f-u*p),t[1]=-(n*(p*g-f*y)-h*(i*g-s*y)+m*(i*f-s*p)),t[2]=n*(l*g-u*y)-o*(i*g-s*y)+m*(i*u-s*l),t[3]=-(n*(l*f-u*p)-o*(i*f-s*p)+h*(i*u-s*l)),t[4]=-(a*(p*g-f*y)-c*(l*g-u*y)+d*(l*f-u*p)),t[5]=r*(p*g-f*y)-c*(i*g-s*y)+d*(i*f-s*p),t[6]=-(r*(l*g-u*y)-a*(i*g-s*y)+d*(i*u-s*l)),t[7]=r*(l*f-u*p)-a*(i*f-s*p)+c*(i*u-s*l),t[8]=a*(h*g-f*m)-c*(o*g-u*m)+d*(o*f-u*h),t[9]=-(r*(h*g-f*m)-c*(n*g-s*m)+d*(n*f-s*h)),t[10]=r*(o*g-u*m)-a*(n*g-s*m)+d*(n*u-s*o),t[11]=-(r*(o*f-u*h)-a*(n*f-s*h)+c*(n*u-s*o)),t[12]=-(a*(h*y-p*m)-c*(o*y-l*m)+d*(o*p-l*h)),t[13]=r*(h*y-p*m)-c*(n*y-i*m)+d*(n*p-i*h),t[14]=-(r*(o*y-l*m)-a*(n*y-i*m)+d*(n*l-i*o)),t[15]=r*(o*p-l*h)-a*(n*p-i*h)+c*(n*l-i*o),t},D.determinant=function(t){var e=t[0],r=t[1],n=t[2],i=t[3],s=t[4],a=t[5],o=t[6],l=t[7],u=t[8],c=t[9],h=t[10],p=t[11],f=t[12],d=t[13],m=t[14],y=t[15];return (e*a-r*s)*(h*y-p*m)-(e*o-n*s)*(c*y-p*d)+(e*l-i*s)*(c*m-h*d)+(r*o-n*a)*(u*y-p*f)-(r*l-i*a)*(u*m-h*f)+(n*l-i*o)*(u*d-c*f)},D.multiply=N,D.translate=function(t,e,r){var n,i,s,a,o,l,u,c,h,p,f,d,m=r[0],y=r[1],g=r[2];return e===t?(t[12]=e[0]*m+e[4]*y+e[8]*g+e[12],t[13]=e[1]*m+e[5]*y+e[9]*g+e[13],t[14]=e[2]*m+e[6]*y+e[10]*g+e[14],t[15]=e[3]*m+e[7]*y+e[11]*g+e[15]):(i=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],f=e[10],d=e[11],t[0]=n=e[0],t[1]=i,t[2]=s,t[3]=a,t[4]=o,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=p,t[10]=f,t[11]=d,t[12]=n*m+o*y+h*g+e[12],t[13]=i*m+l*y+p*g+e[13],t[14]=s*m+u*y+f*g+e[14],t[15]=a*m+c*y+d*g+e[15]),t},D.scale=function(t,e,r){var n=r[0],i=r[1],s=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},D.rotate=function(t,e,r,n){var i,s,a,o,l,u,c,h,p,f,d,m,y,g,x,b,v,_,w,M,A,S,I,k,P=n[0],E=n[1],z=n[2],T=Math.hypot(P,E,z);return T<F.EPSILON?null:(P*=T=1/T,E*=T,z*=T,i=Math.sin(r),s=Math.cos(r),l=e[1],u=e[2],c=e[3],p=e[5],f=e[6],d=e[7],y=e[9],g=e[10],x=e[11],b=P*P*(a=1-s)+s,w=P*E*a-z*i,M=E*E*a+s,A=z*E*a+P*i,S=P*z*a+E*i,I=E*z*a-P*i,k=z*z*a+s,t[0]=(o=e[0])*b+(h=e[4])*(v=E*P*a+z*i)+(m=e[8])*(_=z*P*a-E*i),t[1]=l*b+p*v+y*_,t[2]=u*b+f*v+g*_,t[3]=c*b+d*v+x*_,t[4]=o*w+h*M+m*A,t[5]=l*w+p*M+y*A,t[6]=u*w+f*M+g*A,t[7]=c*w+d*M+x*A,t[8]=o*S+h*I+m*k,t[9]=l*S+p*I+y*k,t[10]=u*S+f*I+g*k,t[11]=c*S+d*I+x*k,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},D.rotateX=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),s=e[4],a=e[5],o=e[6],l=e[7],u=e[8],c=e[9],h=e[10],p=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*i+u*n,t[5]=a*i+c*n,t[6]=o*i+h*n,t[7]=l*i+p*n,t[8]=u*i-s*n,t[9]=c*i-a*n,t[10]=h*i-o*n,t[11]=p*i-l*n,t},D.rotateY=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),s=e[0],a=e[1],o=e[2],l=e[3],u=e[8],c=e[9],h=e[10],p=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*i-u*n,t[1]=a*i-c*n,t[2]=o*i-h*n,t[3]=l*i-p*n,t[8]=s*n+u*i,t[9]=a*n+c*i,t[10]=o*n+h*i,t[11]=l*n+p*i,t},D.rotateZ=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),s=e[0],a=e[1],o=e[2],l=e[3],u=e[4],c=e[5],h=e[6],p=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*i+u*n,t[1]=a*i+c*n,t[2]=o*i+h*n,t[3]=l*i+p*n,t[4]=u*i-s*n,t[5]=c*i-a*n,t[6]=h*i-o*n,t[7]=p*i-l*n,t},D.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t},D.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},D.fromRotation=function(t,e,r){var n,i,s,a=r[0],o=r[1],l=r[2],u=Math.hypot(a,o,l);return u<F.EPSILON?null:(a*=u=1/u,o*=u,l*=u,n=Math.sin(e),i=Math.cos(e),t[0]=a*a*(s=1-i)+i,t[1]=o*a*s+l*n,t[2]=l*a*s-o*n,t[3]=0,t[4]=a*o*s-l*n,t[5]=o*o*s+i,t[6]=l*o*s+a*n,t[7]=0,t[8]=a*l*s+o*n,t[9]=o*l*s-a*n,t[10]=l*l*s+i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)},D.fromXRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n,t[6]=r,t[7]=0,t[8]=0,t[9]=-r,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},D.fromYRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=0,t[2]=-r,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=r,t[9]=0,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},D.fromZRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=0,t[4]=-r,t[5]=n,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},D.fromRotationTranslation=j,D.fromQuat2=function(t,e){var r=new F.ARRAY_TYPE(3),n=-e[0],i=-e[1],s=-e[2],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=n*n+i*i+s*s+a*a;return h>0?(r[0]=2*(o*a+c*n+l*s-u*i)/h,r[1]=2*(l*a+c*i+u*n-o*s)/h,r[2]=2*(u*a+c*s+o*i-l*n)/h):(r[0]=2*(o*a+c*n+l*s-u*i),r[1]=2*(l*a+c*i+u*n-o*s),r[2]=2*(u*a+c*s+o*i-l*n)),j(t,e,r),t},D.getTranslation=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t},D.getScaling=q,D.getRotation=function(t,e){var r=new F.ARRAY_TYPE(3);q(r,e);var n=1/r[0],i=1/r[1],s=1/r[2],a=e[0]*n,o=e[1]*i,l=e[2]*s,u=e[4]*n,c=e[5]*i,h=e[6]*s,p=e[8]*n,f=e[9]*i,d=e[10]*s,m=a+c+d,y=0;return m>0?(y=2*Math.sqrt(m+1),t[3]=.25*y,t[0]=(h-f)/y,t[1]=(p-l)/y,t[2]=(o-u)/y):a>c&&a>d?(y=2*Math.sqrt(1+a-c-d),t[3]=(h-f)/y,t[0]=.25*y,t[1]=(o+u)/y,t[2]=(p+l)/y):c>d?(y=2*Math.sqrt(1+c-a-d),t[3]=(p-l)/y,t[0]=(o+u)/y,t[1]=.25*y,t[2]=(h+f)/y):(y=2*Math.sqrt(1+d-a-c),t[3]=(o-u)/y,t[0]=(p+l)/y,t[1]=(h+f)/y,t[2]=.25*y),t},D.fromRotationTranslationScale=function(t,e,r,n){var i=e[0],s=e[1],a=e[2],o=e[3],l=i+i,u=s+s,c=a+a,h=i*l,p=i*u,f=i*c,d=s*u,m=s*c,y=a*c,g=o*l,x=o*u,b=o*c,v=n[0],_=n[1],w=n[2];return t[0]=(1-(d+y))*v,t[1]=(p+b)*v,t[2]=(f-x)*v,t[3]=0,t[4]=(p-b)*_,t[5]=(1-(h+y))*_,t[6]=(m+g)*_,t[7]=0,t[8]=(f+x)*w,t[9]=(m-g)*w,t[10]=(1-(h+d))*w,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t},D.fromRotationTranslationScaleOrigin=function(t,e,r,n,i){var s=e[0],a=e[1],o=e[2],l=e[3],u=s+s,c=a+a,h=o+o,p=s*u,f=s*c,d=s*h,m=a*c,y=a*h,g=o*h,x=l*u,b=l*c,v=l*h,_=n[0],w=n[1],M=n[2],A=i[0],S=i[1],I=i[2],k=(1-(m+g))*_,P=(f+v)*_,E=(d-b)*_,z=(f-v)*w,T=(1-(p+g))*w,B=(y+x)*w,C=(d+b)*M,R=(y-x)*M,V=(1-(p+m))*M;return t[0]=k,t[1]=P,t[2]=E,t[3]=0,t[4]=z,t[5]=T,t[6]=B,t[7]=0,t[8]=C,t[9]=R,t[10]=V,t[11]=0,t[12]=r[0]+A-(k*A+z*S+C*I),t[13]=r[1]+S-(P*A+T*S+R*I),t[14]=r[2]+I-(E*A+B*S+V*I),t[15]=1,t},D.fromQuat=function(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=r+r,o=n+n,l=i+i,u=r*a,c=n*a,h=n*o,p=i*a,f=i*o,d=i*l,m=s*a,y=s*o,g=s*l;return t[0]=1-h-d,t[1]=c+g,t[2]=p-y,t[3]=0,t[4]=c-g,t[5]=1-u-d,t[6]=f+m,t[7]=0,t[8]=p+y,t[9]=f-m,t[10]=1-u-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},D.frustum=function(t,e,r,n,i,s,a){var o=1/(r-e),l=1/(i-n),u=1/(s-a);return t[0]=2*s*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*s*l,t[6]=0,t[7]=0,t[8]=(r+e)*o,t[9]=(i+n)*l,t[10]=(a+s)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*s*2*u,t[15]=0,t},D.perspectiveNO=$,D.perspectiveZO=function(t,e,r,n,i){var s,a=1/Math.tan(e/2);return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(t[10]=i*(s=1/(n-i)),t[14]=i*n*s):(t[10]=-1,t[14]=-n),t},D.perspectiveFromFieldOfView=function(t,e,r,n){var i=Math.tan(e.upDegrees*Math.PI/180),s=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),o=Math.tan(e.rightDegrees*Math.PI/180),l=2/(a+o),u=2/(i+s);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=-(a-o)*l*.5,t[9]=(i-s)*u*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t},D.orthoNO=G,D.orthoZO=function(t,e,r,n,i,s,a){var o=1/(e-r),l=1/(n-i),u=1/(s-a);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=u,t[11]=0,t[12]=(e+r)*o,t[13]=(i+n)*l,t[14]=s*u,t[15]=1,t},D.lookAt=function(t,e,r,n){var i,s,a,o,l,u,c,h,p,f,d=e[0],m=e[1],y=e[2],g=n[0],x=n[1],b=n[2],v=r[0],_=r[1],w=r[2];return Math.abs(d-v)<F.EPSILON&&Math.abs(m-_)<F.EPSILON&&Math.abs(y-w)<F.EPSILON?U(t):(c=d-v,h=m-_,p=y-w,i=x*(p*=f=1/Math.hypot(c,h,p))-b*(h*=f),s=b*(c*=f)-g*p,a=g*h-x*c,(f=Math.hypot(i,s,a))?(i*=f=1/f,s*=f,a*=f):(i=0,s=0,a=0),o=h*a-p*s,l=p*i-c*a,u=c*s-h*i,(f=Math.hypot(o,l,u))?(o*=f=1/f,l*=f,u*=f):(o=0,l=0,u=0),t[0]=i,t[1]=o,t[2]=c,t[3]=0,t[4]=s,t[5]=l,t[6]=h,t[7]=0,t[8]=a,t[9]=u,t[10]=p,t[11]=0,t[12]=-(i*d+s*m+a*y),t[13]=-(o*d+l*m+u*y),t[14]=-(c*d+h*m+p*y),t[15]=1,t)},D.targetTo=function(t,e,r,n){var i=e[0],s=e[1],a=e[2],o=n[0],l=n[1],u=n[2],c=i-r[0],h=s-r[1],p=a-r[2],f=c*c+h*h+p*p;f>0&&(c*=f=1/Math.sqrt(f),h*=f,p*=f);var d=l*p-u*h,m=u*c-o*p,y=o*h-l*c;return (f=d*d+m*m+y*y)>0&&(d*=f=1/Math.sqrt(f),m*=f,y*=f),t[0]=d,t[1]=m,t[2]=y,t[3]=0,t[4]=h*y-p*m,t[5]=p*d-c*y,t[6]=c*m-h*d,t[7]=0,t[8]=c,t[9]=h,t[10]=p,t[11]=0,t[12]=i,t[13]=s,t[14]=a,t[15]=1,t},D.str=function(t){return \"mat4(\"+t[0]+\", \"+t[1]+\", \"+t[2]+\", \"+t[3]+\", \"+t[4]+\", \"+t[5]+\", \"+t[6]+\", \"+t[7]+\", \"+t[8]+\", \"+t[9]+\", \"+t[10]+\", \"+t[11]+\", \"+t[12]+\", \"+t[13]+\", \"+t[14]+\", \"+t[15]+\")\"},D.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},D.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t},D.subtract=Q,D.multiplyScalar=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t},D.multiplyScalarAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t[9]=e[9]+r[9]*n,t[10]=e[10]+r[10]*n,t[11]=e[11]+r[11]*n,t[12]=e[12]+r[12]*n,t[13]=e[13]+r[13]*n,t[14]=e[14]+r[14]*n,t[15]=e[15]+r[15]*n,t},D.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},D.equals=function(t,e){var r=t[0],n=t[1],i=t[2],s=t[3],a=t[4],o=t[5],l=t[6],u=t[7],c=t[8],h=t[9],p=t[10],f=t[11],d=t[12],m=t[13],y=t[14],g=t[15],x=e[0],b=e[1],v=e[2],_=e[3],w=e[4],M=e[5],A=e[6],S=e[7],I=e[8],k=e[9],P=e[10],E=e[11],z=e[12],T=e[13],B=e[14],C=e[15];return Math.abs(r-x)<=F.EPSILON*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(n-b)<=F.EPSILON*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(i-v)<=F.EPSILON*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(s-_)<=F.EPSILON*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(a-w)<=F.EPSILON*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(o-M)<=F.EPSILON*Math.max(1,Math.abs(o),Math.abs(M))&&Math.abs(l-A)<=F.EPSILON*Math.max(1,Math.abs(l),Math.abs(A))&&Math.abs(u-S)<=F.EPSILON*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(c-I)<=F.EPSILON*Math.max(1,Math.abs(c),Math.abs(I))&&Math.abs(h-k)<=F.EPSILON*Math.max(1,Math.abs(h),Math.abs(k))&&Math.abs(p-P)<=F.EPSILON*Math.max(1,Math.abs(p),Math.abs(P))&&Math.abs(f-E)<=F.EPSILON*Math.max(1,Math.abs(f),Math.abs(E))&&Math.abs(d-z)<=F.EPSILON*Math.max(1,Math.abs(d),Math.abs(z))&&Math.abs(m-T)<=F.EPSILON*Math.max(1,Math.abs(m),Math.abs(T))&&Math.abs(y-B)<=F.EPSILON*Math.max(1,Math.abs(y),Math.abs(B))&&Math.abs(g-C)<=F.EPSILON*Math.max(1,Math.abs(g),Math.abs(C))},D.sub=D.mul=D.ortho=D.perspective=void 0;var F=function(t,e){if(t&&t.__esModule)return t;if(null===t||\"object\"!==L(t)&&\"function\"!=typeof t)return {default:t};var r=O(void 0);if(r&&r.has(t))return r.get(t);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(\"default\"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=i?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s];}return n.default=t,r&&r.set(t,n),n}(f);function O(t){if(\"function\"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return (O=function(t){return t?r:e})(t)}function U(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function N(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],f=e[10],d=e[11],m=e[12],y=e[13],g=e[14],x=e[15],b=r[0],v=r[1],_=r[2],w=r[3];return t[0]=b*n+v*o+_*h+w*m,t[1]=b*i+v*l+_*p+w*y,t[2]=b*s+v*u+_*f+w*g,t[3]=b*a+v*c+_*d+w*x,t[4]=(b=r[4])*n+(v=r[5])*o+(_=r[6])*h+(w=r[7])*m,t[5]=b*i+v*l+_*p+w*y,t[6]=b*s+v*u+_*f+w*g,t[7]=b*a+v*c+_*d+w*x,t[8]=(b=r[8])*n+(v=r[9])*o+(_=r[10])*h+(w=r[11])*m,t[9]=b*i+v*l+_*p+w*y,t[10]=b*s+v*u+_*f+w*g,t[11]=b*a+v*c+_*d+w*x,t[12]=(b=r[12])*n+(v=r[13])*o+(_=r[14])*h+(w=r[15])*m,t[13]=b*i+v*l+_*p+w*y,t[14]=b*s+v*u+_*f+w*g,t[15]=b*a+v*c+_*d+w*x,t}function j(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=n+n,l=i+i,u=s+s,c=n*o,h=n*l,p=n*u,f=i*l,d=i*u,m=s*u,y=a*o,g=a*l,x=a*u;return t[0]=1-(f+m),t[1]=h+x,t[2]=p-g,t[3]=0,t[4]=h-x,t[5]=1-(c+m),t[6]=d+y,t[7]=0,t[8]=p+g,t[9]=d-y,t[10]=1-(c+f),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function q(t,e){var r=e[4],n=e[5],i=e[6],s=e[8],a=e[9],o=e[10];return t[0]=Math.hypot(e[0],e[1],e[2]),t[1]=Math.hypot(r,n,i),t[2]=Math.hypot(s,a,o),t}function $(t,e,r,n,i){var s,a=1/Math.tan(e/2);return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(t[10]=(i+n)*(s=1/(n-i)),t[14]=2*i*n*s):(t[10]=-1,t[14]=-2*n),t}function G(t,e,r,n,i,s,a){var o=1/(e-r),l=1/(n-i),u=1/(s-a);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*o,t[13]=(i+n)*l,t[14]=(a+s)*u,t[15]=1,t}function Q(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t}D.perspective=$,D.ortho=G,D.mul=N,D.sub=Q;var Y={},X={};function Z(t){return Z=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},Z(t)}Object.defineProperty(X,\"__esModule\",{value:!0}),X.create=H,X.clone=function(t){var e=new K.ARRAY_TYPE(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},X.length=J,X.fromValues=function(t,e,r){var n=new K.ARRAY_TYPE(3);return n[0]=t,n[1]=e,n[2]=r,n},X.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},X.set=function(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t},X.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t},X.subtract=tt,X.multiply=et,X.divide=rt,X.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t},X.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t},X.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t},X.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t},X.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t},X.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t},X.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t},X.distance=nt,X.squaredDistance=it,X.squaredLength=st,X.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},X.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t},X.normalize=function(t,e){var r=e[0],n=e[1],i=e[2],s=r*r+n*n+i*i;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t},X.dot=at,X.cross=function(t,e,r){var n=e[0],i=e[1],s=e[2],a=r[0],o=r[1],l=r[2];return t[0]=i*l-s*o,t[1]=s*a-n*l,t[2]=n*o-i*a,t},X.lerp=function(t,e,r,n){var i=e[0],s=e[1],a=e[2];return t[0]=i+n*(r[0]-i),t[1]=s+n*(r[1]-s),t[2]=a+n*(r[2]-a),t},X.hermite=function(t,e,r,n,i,s){var a=s*s,o=a*(2*s-3)+1,l=a*(s-2)+s,u=a*(s-1),c=a*(3-2*s);return t[0]=e[0]*o+r[0]*l+n[0]*u+i[0]*c,t[1]=e[1]*o+r[1]*l+n[1]*u+i[1]*c,t[2]=e[2]*o+r[2]*l+n[2]*u+i[2]*c,t},X.bezier=function(t,e,r,n,i,s){var a=1-s,o=a*a,l=s*s,u=o*a,c=3*s*o,h=3*l*a,p=l*s;return t[0]=e[0]*u+r[0]*c+n[0]*h+i[0]*p,t[1]=e[1]*u+r[1]*c+n[1]*h+i[1]*p,t[2]=e[2]*u+r[2]*c+n[2]*h+i[2]*p,t},X.random=function(t,e){e=e||1;var r=2*K.RANDOM()*Math.PI,n=2*K.RANDOM()-1,i=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(r)*i,t[1]=Math.sin(r)*i,t[2]=n*e,t},X.transformMat4=function(t,e,r){var n=e[0],i=e[1],s=e[2],a=r[3]*n+r[7]*i+r[11]*s+r[15];return t[0]=(r[0]*n+r[4]*i+r[8]*s+r[12])/(a=a||1),t[1]=(r[1]*n+r[5]*i+r[9]*s+r[13])/a,t[2]=(r[2]*n+r[6]*i+r[10]*s+r[14])/a,t},X.transformMat3=function(t,e,r){var n=e[0],i=e[1],s=e[2];return t[0]=n*r[0]+i*r[3]+s*r[6],t[1]=n*r[1]+i*r[4]+s*r[7],t[2]=n*r[2]+i*r[5]+s*r[8],t},X.transformQuat=function(t,e,r){var n=r[0],i=r[1],s=r[2],a=e[0],o=e[1],l=e[2],u=i*l-s*o,c=s*a-n*l,h=n*o-i*a,p=i*h-s*c,f=s*u-n*h,d=n*c-i*u,m=2*r[3];return c*=m,h*=m,f*=2,d*=2,t[0]=a+(u*=m)+(p*=2),t[1]=o+c+f,t[2]=l+h+d,t},X.rotateX=function(t,e,r,n){var i=[],s=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],s[0]=i[0],s[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),s[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=s[0]+r[0],t[1]=s[1]+r[1],t[2]=s[2]+r[2],t},X.rotateY=function(t,e,r,n){var i=[],s=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],s[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),s[1]=i[1],s[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=s[0]+r[0],t[1]=s[1]+r[1],t[2]=s[2]+r[2],t},X.rotateZ=function(t,e,r,n){var i=[],s=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],s[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),s[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),s[2]=i[2],t[0]=s[0]+r[0],t[1]=s[1]+r[1],t[2]=s[2]+r[2],t},X.angle=function(t,e){var r=t[0],n=t[1],i=t[2],s=e[0],a=e[1],o=e[2],l=Math.sqrt(r*r+n*n+i*i)*Math.sqrt(s*s+a*a+o*o),u=l&&at(t,e)/l;return Math.acos(Math.min(Math.max(u,-1),1))},X.zero=function(t){return t[0]=0,t[1]=0,t[2]=0,t},X.str=function(t){return \"vec3(\"+t[0]+\", \"+t[1]+\", \"+t[2]+\")\"},X.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},X.equals=function(t,e){var r=t[0],n=t[1],i=t[2],s=e[0],a=e[1],o=e[2];return Math.abs(r-s)<=K.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-a)<=K.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-o)<=K.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))},X.forEach=X.sqrLen=X.len=X.sqrDist=X.dist=X.div=X.mul=X.sub=void 0;var K=function(t,e){if(t&&t.__esModule)return t;if(null===t||\"object\"!==Z(t)&&\"function\"!=typeof t)return {default:t};var r=W(void 0);if(r&&r.has(t))return r.get(t);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(\"default\"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=i?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s];}return n.default=t,r&&r.set(t,n),n}(f);function W(t){if(\"function\"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return (W=function(t){return t?r:e})(t)}function H(){var t=new K.ARRAY_TYPE(3);return K.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function J(t){return Math.hypot(t[0],t[1],t[2])}function tt(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function et(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function rt(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t}function nt(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2])}function it(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return r*r+n*n+i*i}function st(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n}function at(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}X.sub=tt,X.mul=et,X.div=rt,X.dist=nt,X.sqrDist=it,X.len=J,X.sqrLen=st;var ot,lt=(ot=H(),function(t,e,r,n,i,s){var a,o;for(e||(e=3),r||(r=0),o=n?Math.min(n*e+r,t.length):t.length,a=r;a<o;a+=e)ot[0]=t[a],ot[1]=t[a+1],ot[2]=t[a+2],i(ot,ot,s),t[a]=ot[0],t[a+1]=ot[1],t[a+2]=ot[2];return t});X.forEach=lt;var ut={};function ct(t){return ct=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},ct(t)}Object.defineProperty(ut,\"__esModule\",{value:!0}),ut.create=ft,ut.clone=function(t){var e=new ht.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},ut.fromValues=function(t,e,r,n){var i=new ht.ARRAY_TYPE(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i},ut.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},ut.set=function(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t},ut.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t},ut.subtract=dt,ut.multiply=mt,ut.divide=yt,ut.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},ut.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},ut.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t},ut.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t},ut.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},ut.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},ut.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t},ut.distance=gt,ut.squaredDistance=xt,ut.length=bt,ut.squaredLength=vt,ut.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},ut.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},ut.normalize=function(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=r*r+n*n+i*i+s*s;return a>0&&(a=1/Math.sqrt(a)),t[0]=r*a,t[1]=n*a,t[2]=i*a,t[3]=s*a,t},ut.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},ut.cross=function(t,e,r,n){var i=r[0]*n[1]-r[1]*n[0],s=r[0]*n[2]-r[2]*n[0],a=r[0]*n[3]-r[3]*n[0],o=r[1]*n[2]-r[2]*n[1],l=r[1]*n[3]-r[3]*n[1],u=r[2]*n[3]-r[3]*n[2],c=e[0],h=e[1],p=e[2],f=e[3];return t[0]=h*u-p*l+f*o,t[1]=-c*u+p*a-f*s,t[2]=c*l-h*a+f*i,t[3]=-c*o+h*s-p*i,t},ut.lerp=function(t,e,r,n){var i=e[0],s=e[1],a=e[2],o=e[3];return t[0]=i+n*(r[0]-i),t[1]=s+n*(r[1]-s),t[2]=a+n*(r[2]-a),t[3]=o+n*(r[3]-o),t},ut.random=function(t,e){var r,n,i,s,a,o;e=e||1;do{a=(r=2*ht.RANDOM()-1)*r+(n=2*ht.RANDOM()-1)*n;}while(a>=1);do{o=(i=2*ht.RANDOM()-1)*i+(s=2*ht.RANDOM()-1)*s;}while(o>=1);var l=Math.sqrt((1-a)/o);return t[0]=e*r,t[1]=e*n,t[2]=e*i*l,t[3]=e*s*l,t},ut.transformMat4=function(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*s+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*s+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*s+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*s+r[15]*a,t},ut.transformQuat=function(t,e,r){var n=e[0],i=e[1],s=e[2],a=r[0],o=r[1],l=r[2],u=r[3],c=u*n+o*s-l*i,h=u*i+l*n-a*s,p=u*s+a*i-o*n,f=-a*n-o*i-l*s;return t[0]=c*u+f*-a+h*-l-p*-o,t[1]=h*u+f*-o+p*-a-c*-l,t[2]=p*u+f*-l+c*-o-h*-a,t[3]=e[3],t},ut.zero=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},ut.str=function(t){return \"vec4(\"+t[0]+\", \"+t[1]+\", \"+t[2]+\", \"+t[3]+\")\"},ut.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},ut.equals=function(t,e){var r=t[0],n=t[1],i=t[2],s=t[3],a=e[0],o=e[1],l=e[2],u=e[3];return Math.abs(r-a)<=ht.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-o)<=ht.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-l)<=ht.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(s-u)<=ht.EPSILON*Math.max(1,Math.abs(s),Math.abs(u))},ut.forEach=ut.sqrLen=ut.len=ut.sqrDist=ut.dist=ut.div=ut.mul=ut.sub=void 0;var ht=function(t,e){if(t&&t.__esModule)return t;if(null===t||\"object\"!==ct(t)&&\"function\"!=typeof t)return {default:t};var r=pt(void 0);if(r&&r.has(t))return r.get(t);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(\"default\"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=i?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s];}return n.default=t,r&&r.set(t,n),n}(f);function pt(t){if(\"function\"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return (pt=function(t){return t?r:e})(t)}function ft(){var t=new ht.ARRAY_TYPE(4);return ht.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function dt(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}function mt(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t}function yt(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t}function gt(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2],e[3]-t[3])}function xt(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],s=e[3]-t[3];return r*r+n*n+i*i+s*s}function bt(t){return Math.hypot(t[0],t[1],t[2],t[3])}function vt(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}ut.sub=dt,ut.mul=mt,ut.div=yt,ut.dist=gt,ut.sqrDist=xt,ut.len=bt,ut.sqrLen=vt;var _t=function(){var t=ft();return function(e,r,n,i,s,a){var o,l;for(r||(r=4),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,o=n;o<l;o+=r)t[0]=e[o],t[1]=e[o+1],t[2]=e[o+2],t[3]=e[o+3],s(t,t,a),e[o]=t[0],e[o+1]=t[1],e[o+2]=t[2],e[o+3]=t[3];return e}}();function wt(t){return wt=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},wt(t)}ut.forEach=_t,Object.defineProperty(Y,\"__esModule\",{value:!0}),Y.create=Et,Y.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},Y.setAxisAngle=zt,Y.getAxisAngle=function(t,e){var r=2*Math.acos(e[3]),n=Math.sin(r/2);return n>Mt.EPSILON?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),r},Y.getAngle=function(t,e){var r=Lt(t,e);return Math.acos(2*r*r-1)},Y.multiply=Tt,Y.rotateX=function(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],a=e[3],o=Math.sin(r),l=Math.cos(r);return t[0]=n*l+a*o,t[1]=i*l+s*o,t[2]=s*l-i*o,t[3]=a*l-n*o,t},Y.rotateY=function(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],a=e[3],o=Math.sin(r),l=Math.cos(r);return t[0]=n*l-s*o,t[1]=i*l+a*o,t[2]=s*l+n*o,t[3]=a*l-i*o,t},Y.rotateZ=function(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],a=e[3],o=Math.sin(r),l=Math.cos(r);return t[0]=n*l+i*o,t[1]=i*l-n*o,t[2]=s*l+a*o,t[3]=a*l-s*o,t},Y.calculateW=function(t,e){var r=e[0],n=e[1],i=e[2];return t[0]=r,t[1]=n,t[2]=i,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),t},Y.exp=Bt,Y.ln=Ct,Y.pow=function(t,e,r){return Ct(t,e),Dt(t,t,r),Bt(t,t),t},Y.slerp=Rt,Y.random=function(t){var e=Mt.RANDOM(),r=Mt.RANDOM(),n=Mt.RANDOM(),i=Math.sqrt(1-e),s=Math.sqrt(e);return t[0]=i*Math.sin(2*Math.PI*r),t[1]=i*Math.cos(2*Math.PI*r),t[2]=s*Math.sin(2*Math.PI*n),t[3]=s*Math.cos(2*Math.PI*n),t},Y.invert=function(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=r*r+n*n+i*i+s*s,o=a?1/a:0;return t[0]=-r*o,t[1]=-n*o,t[2]=-i*o,t[3]=s*o,t},Y.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},Y.fromMat3=Vt,Y.fromEuler=function(t,e,r,n){var i=.5*Math.PI/180;e*=i,r*=i,n*=i;var s=Math.sin(e),a=Math.cos(e),o=Math.sin(r),l=Math.cos(r),u=Math.sin(n),c=Math.cos(n);return t[0]=s*l*c-a*o*u,t[1]=a*o*c+s*l*u,t[2]=a*l*u-s*o*c,t[3]=a*l*c+s*o*u,t},Y.str=function(t){return \"quat(\"+t[0]+\", \"+t[1]+\", \"+t[2]+\", \"+t[3]+\")\"},Y.setAxes=Y.sqlerp=Y.rotationTo=Y.equals=Y.exactEquals=Y.normalize=Y.sqrLen=Y.squaredLength=Y.len=Y.length=Y.lerp=Y.dot=Y.scale=Y.mul=Y.add=Y.set=Y.copy=Y.fromValues=Y.clone=void 0;var Mt=Pt(f),At=Pt(z),St=Pt(X),It=Pt(ut);function kt(t){if(\"function\"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return (kt=function(t){return t?r:e})(t)}function Pt(t,e){if(t&&t.__esModule)return t;if(null===t||\"object\"!==wt(t)&&\"function\"!=typeof t)return {default:t};var r=kt(e);if(r&&r.has(t))return r.get(t);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(\"default\"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=i?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s];}return n.default=t,r&&r.set(t,n),n}function Et(){var t=new Mt.ARRAY_TYPE(4);return Mt.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function zt(t,e,r){r*=.5;var n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t}function Tt(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=r[0],l=r[1],u=r[2],c=r[3];return t[0]=n*c+a*o+i*u-s*l,t[1]=i*c+a*l+s*o-n*u,t[2]=s*c+a*u+n*l-i*o,t[3]=a*c-n*o-i*l-s*u,t}function Bt(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=Math.sqrt(r*r+n*n+i*i),o=Math.exp(s),l=a>0?o*Math.sin(a)/a:0;return t[0]=r*l,t[1]=n*l,t[2]=i*l,t[3]=o*Math.cos(a),t}function Ct(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=Math.sqrt(r*r+n*n+i*i),o=a>0?Math.atan2(a,s)/a:0;return t[0]=r*o,t[1]=n*o,t[2]=i*o,t[3]=.5*Math.log(r*r+n*n+i*i+s*s),t}function Rt(t,e,r,n){var i,s,a,o,l,u=e[0],c=e[1],h=e[2],p=e[3],f=r[0],d=r[1],m=r[2],y=r[3];return (s=u*f+c*d+h*m+p*y)<0&&(s=-s,f=-f,d=-d,m=-m,y=-y),1-s>Mt.EPSILON?(i=Math.acos(s),a=Math.sin(i),o=Math.sin((1-n)*i)/a,l=Math.sin(n*i)/a):(o=1-n,l=n),t[0]=o*u+l*f,t[1]=o*c+l*d,t[2]=o*h+l*m,t[3]=o*p+l*y,t}function Vt(t,e){var r,n=e[0]+e[4]+e[8];if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,t[0]=(e[5]-e[7])*(r=.5/r),t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else {var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var s=(i+1)%3,a=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*s+s]-e[3*a+a]+1),t[i]=.5*r,t[3]=(e[3*s+a]-e[3*a+s])*(r=.5/r),t[s]=(e[3*s+i]+e[3*i+s])*r,t[a]=(e[3*a+i]+e[3*i+a])*r;}return t}Y.clone=It.clone,Y.fromValues=It.fromValues,Y.copy=It.copy,Y.set=It.set,Y.add=It.add,Y.mul=Tt;var Dt=It.scale;Y.scale=Dt;var Lt=It.dot;Y.dot=Lt,Y.lerp=It.lerp;var Ft=It.length;Y.length=Ft,Y.len=Ft;var Ot=It.squaredLength;Y.squaredLength=Ot,Y.sqrLen=Ot;var Ut=It.normalize;Y.normalize=Ut,Y.exactEquals=It.exactEquals,Y.equals=It.equals;var Nt,jt,qt,$t=(Nt=St.create(),jt=St.fromValues(1,0,0),qt=St.fromValues(0,1,0),function(t,e,r){var n=St.dot(e,r);return n<-.999999?(St.cross(Nt,jt,e),St.len(Nt)<1e-6&&St.cross(Nt,qt,e),St.normalize(Nt,Nt),zt(t,Nt,Math.PI),t):n>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(St.cross(Nt,e,r),t[0]=Nt[0],t[1]=Nt[1],t[2]=Nt[2],t[3]=1+n,Ut(t,t))});Y.rotationTo=$t;var Gt,Qt,Yt=(Gt=Et(),Qt=Et(),function(t,e,r,n,i,s){return Rt(Gt,e,i,s),Rt(Qt,r,n,s),Rt(t,Gt,Qt,2*s*(1-s)),t});Y.sqlerp=Yt;var Xt,Zt=(Xt=At.create(),function(t,e,r,n){return Xt[0]=r[0],Xt[3]=r[1],Xt[6]=r[2],Xt[1]=n[0],Xt[4]=n[1],Xt[7]=n[2],Xt[2]=-e[0],Xt[5]=-e[1],Xt[8]=-e[2],Ut(t,Vt(t,Xt))});Y.setAxes=Zt;var Kt={};function Wt(t){return Wt=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},Wt(t)}Object.defineProperty(Kt,\"__esModule\",{value:!0}),Kt.create=function(){var t=new Ht.ARRAY_TYPE(8);return Ht.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0),t[3]=1,t},Kt.clone=function(t){var e=new Ht.ARRAY_TYPE(8);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e},Kt.fromValues=function(t,e,r,n,i,s,a,o){var l=new Ht.ARRAY_TYPE(8);return l[0]=t,l[1]=e,l[2]=r,l[3]=n,l[4]=i,l[5]=s,l[6]=a,l[7]=o,l},Kt.fromRotationTranslationValues=function(t,e,r,n,i,s,a){var o=new Ht.ARRAY_TYPE(8);o[0]=t,o[1]=e,o[2]=r,o[3]=n;var l=.5*i,u=.5*s,c=.5*a;return o[4]=l*n+u*r-c*e,o[5]=u*n+c*t-l*r,o[6]=c*n+l*e-u*t,o[7]=-l*t-u*e-c*r,o},Kt.fromRotationTranslation=ne,Kt.fromTranslation=function(t,e){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=.5*e[0],t[5]=.5*e[1],t[6]=.5*e[2],t[7]=0,t},Kt.fromRotation=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=0,t[5]=0,t[6]=0,t[7]=0,t},Kt.fromMat4=function(t,e){var r=Jt.create();te.getRotation(r,e);var n=new Ht.ARRAY_TYPE(3);return te.getTranslation(n,e),ne(t,r,n),t},Kt.copy=ie,Kt.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t},Kt.set=function(t,e,r,n,i,s,a,o,l){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=s,t[5]=a,t[6]=o,t[7]=l,t},Kt.getDual=function(t,e){return t[0]=e[4],t[1]=e[5],t[2]=e[6],t[3]=e[7],t},Kt.setDual=function(t,e){return t[4]=e[0],t[5]=e[1],t[6]=e[2],t[7]=e[3],t},Kt.getTranslation=function(t,e){var r=e[4],n=e[5],i=e[6],s=e[7],a=-e[0],o=-e[1],l=-e[2],u=e[3];return t[0]=2*(r*u+s*a+n*l-i*o),t[1]=2*(n*u+s*o+i*a-r*l),t[2]=2*(i*u+s*l+r*o-n*a),t},Kt.translate=function(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=.5*r[0],l=.5*r[1],u=.5*r[2],c=e[4],h=e[5],p=e[6],f=e[7];return t[0]=n,t[1]=i,t[2]=s,t[3]=a,t[4]=a*o+i*u-s*l+c,t[5]=a*l+s*o-n*u+h,t[6]=a*u+n*l-i*o+p,t[7]=-n*o-i*l-s*u+f,t},Kt.rotateX=function(t,e,r){var n=-e[0],i=-e[1],s=-e[2],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=o*a+c*n+l*s-u*i,p=l*a+c*i+u*n-o*s,f=u*a+c*s+o*i-l*n,d=c*a-o*n-l*i-u*s;return Jt.rotateX(t,e,r),t[4]=h*(a=t[3])+d*(n=t[0])+p*(s=t[2])-f*(i=t[1]),t[5]=p*a+d*i+f*n-h*s,t[6]=f*a+d*s+h*i-p*n,t[7]=d*a-h*n-p*i-f*s,t},Kt.rotateY=function(t,e,r){var n=-e[0],i=-e[1],s=-e[2],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=o*a+c*n+l*s-u*i,p=l*a+c*i+u*n-o*s,f=u*a+c*s+o*i-l*n,d=c*a-o*n-l*i-u*s;return Jt.rotateY(t,e,r),t[4]=h*(a=t[3])+d*(n=t[0])+p*(s=t[2])-f*(i=t[1]),t[5]=p*a+d*i+f*n-h*s,t[6]=f*a+d*s+h*i-p*n,t[7]=d*a-h*n-p*i-f*s,t},Kt.rotateZ=function(t,e,r){var n=-e[0],i=-e[1],s=-e[2],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=o*a+c*n+l*s-u*i,p=l*a+c*i+u*n-o*s,f=u*a+c*s+o*i-l*n,d=c*a-o*n-l*i-u*s;return Jt.rotateZ(t,e,r),t[4]=h*(a=t[3])+d*(n=t[0])+p*(s=t[2])-f*(i=t[1]),t[5]=p*a+d*i+f*n-h*s,t[6]=f*a+d*s+h*i-p*n,t[7]=d*a-h*n-p*i-f*s,t},Kt.rotateByQuatAppend=function(t,e,r){var n=r[0],i=r[1],s=r[2],a=r[3],o=e[0],l=e[1],u=e[2],c=e[3];return t[0]=o*a+c*n+l*s-u*i,t[1]=l*a+c*i+u*n-o*s,t[2]=u*a+c*s+o*i-l*n,t[3]=c*a-o*n-l*i-u*s,t[4]=(o=e[4])*a+(c=e[7])*n+(l=e[5])*s-(u=e[6])*i,t[5]=l*a+c*i+u*n-o*s,t[6]=u*a+c*s+o*i-l*n,t[7]=c*a-o*n-l*i-u*s,t},Kt.rotateByQuatPrepend=function(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=r[0],l=r[1],u=r[2],c=r[3];return t[0]=n*c+a*o+i*u-s*l,t[1]=i*c+a*l+s*o-n*u,t[2]=s*c+a*u+n*l-i*o,t[3]=a*c-n*o-i*l-s*u,t[4]=n*(c=r[7])+a*(o=r[4])+i*(u=r[6])-s*(l=r[5]),t[5]=i*c+a*l+s*o-n*u,t[6]=s*c+a*u+n*l-i*o,t[7]=a*c-n*o-i*l-s*u,t},Kt.rotateAroundAxis=function(t,e,r,n){if(Math.abs(n)<Ht.EPSILON)return ie(t,e);var i=Math.hypot(r[0],r[1],r[2]);n*=.5;var s=Math.sin(n),a=s*r[0]/i,o=s*r[1]/i,l=s*r[2]/i,u=Math.cos(n),c=e[0],h=e[1],p=e[2],f=e[3];t[0]=c*u+f*a+h*l-p*o,t[1]=h*u+f*o+p*a-c*l,t[2]=p*u+f*l+c*o-h*a,t[3]=f*u-c*a-h*o-p*l;var d=e[4],m=e[5],y=e[6],g=e[7];return t[4]=d*u+g*a+m*l-y*o,t[5]=m*u+g*o+y*a-d*l,t[6]=y*u+g*l+d*o-m*a,t[7]=g*u-d*a-m*o-y*l,t},Kt.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t},Kt.multiply=se,Kt.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t},Kt.lerp=function(t,e,r,n){var i=1-n;return ae(e,r)<0&&(n=-n),t[0]=e[0]*i+r[0]*n,t[1]=e[1]*i+r[1]*n,t[2]=e[2]*i+r[2]*n,t[3]=e[3]*i+r[3]*n,t[4]=e[4]*i+r[4]*n,t[5]=e[5]*i+r[5]*n,t[6]=e[6]*i+r[6]*n,t[7]=e[7]*i+r[7]*n,t},Kt.invert=function(t,e){var r=le(e);return t[0]=-e[0]/r,t[1]=-e[1]/r,t[2]=-e[2]/r,t[3]=e[3]/r,t[4]=-e[4]/r,t[5]=-e[5]/r,t[6]=-e[6]/r,t[7]=e[7]/r,t},Kt.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=e[7],t},Kt.normalize=function(t,e){var r=le(e);if(r>0){r=Math.sqrt(r);var n=e[0]/r,i=e[1]/r,s=e[2]/r,a=e[3]/r,o=e[4],l=e[5],u=e[6],c=e[7],h=n*o+i*l+s*u+a*c;t[0]=n,t[1]=i,t[2]=s,t[3]=a,t[4]=(o-n*h)/r,t[5]=(l-i*h)/r,t[6]=(u-s*h)/r,t[7]=(c-a*h)/r;}return t},Kt.str=function(t){return \"quat2(\"+t[0]+\", \"+t[1]+\", \"+t[2]+\", \"+t[3]+\", \"+t[4]+\", \"+t[5]+\", \"+t[6]+\", \"+t[7]+\")\"},Kt.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]},Kt.equals=function(t,e){var r=t[0],n=t[1],i=t[2],s=t[3],a=t[4],o=t[5],l=t[6],u=t[7],c=e[0],h=e[1],p=e[2],f=e[3],d=e[4],m=e[5],y=e[6],g=e[7];return Math.abs(r-c)<=Ht.EPSILON*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(n-h)<=Ht.EPSILON*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(i-p)<=Ht.EPSILON*Math.max(1,Math.abs(i),Math.abs(p))&&Math.abs(s-f)<=Ht.EPSILON*Math.max(1,Math.abs(s),Math.abs(f))&&Math.abs(a-d)<=Ht.EPSILON*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(o-m)<=Ht.EPSILON*Math.max(1,Math.abs(o),Math.abs(m))&&Math.abs(l-y)<=Ht.EPSILON*Math.max(1,Math.abs(l),Math.abs(y))&&Math.abs(u-g)<=Ht.EPSILON*Math.max(1,Math.abs(u),Math.abs(g))},Kt.sqrLen=Kt.squaredLength=Kt.len=Kt.length=Kt.dot=Kt.mul=Kt.setReal=Kt.getReal=void 0;var Ht=re(f),Jt=re(Y),te=re(D);function ee(t){if(\"function\"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return (ee=function(t){return t?r:e})(t)}function re(t,e){if(t&&t.__esModule)return t;if(null===t||\"object\"!==Wt(t)&&\"function\"!=typeof t)return {default:t};var r=ee(e);if(r&&r.has(t))return r.get(t);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(\"default\"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=i?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s];}return n.default=t,r&&r.set(t,n),n}function ne(t,e,r){var n=.5*r[0],i=.5*r[1],s=.5*r[2],a=e[0],o=e[1],l=e[2],u=e[3];return t[0]=a,t[1]=o,t[2]=l,t[3]=u,t[4]=n*u+i*l-s*o,t[5]=i*u+s*a-n*l,t[6]=s*u+n*o-i*a,t[7]=-n*a-i*o-s*l,t}function ie(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function se(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=r[4],l=r[5],u=r[6],c=r[7],h=e[4],p=e[5],f=e[6],d=e[7],m=r[0],y=r[1],g=r[2],x=r[3];return t[0]=n*x+a*m+i*g-s*y,t[1]=i*x+a*y+s*m-n*g,t[2]=s*x+a*g+n*y-i*m,t[3]=a*x-n*m-i*y-s*g,t[4]=n*c+a*o+i*u-s*l+h*x+d*m+p*g-f*y,t[5]=i*c+a*l+s*o-n*u+p*x+d*y+f*m-h*g,t[6]=s*c+a*u+n*l-i*o+f*x+d*g+h*y-p*m,t[7]=a*c-n*o-i*l-s*u+d*x-h*m-p*y-f*g,t}Kt.getReal=Jt.copy,Kt.setReal=Jt.copy,Kt.mul=se;var ae=Jt.dot;Kt.dot=ae;var oe=Jt.length;Kt.length=oe,Kt.len=oe;var le=Jt.squaredLength;Kt.squaredLength=le,Kt.sqrLen=le;var ue={};function ce(t){return ce=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},ce(t)}Object.defineProperty(ue,\"__esModule\",{value:!0}),ue.create=fe,ue.clone=function(t){var e=new he.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},ue.fromValues=function(t,e){var r=new he.ARRAY_TYPE(2);return r[0]=t,r[1]=e,r},ue.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},ue.set=function(t,e,r){return t[0]=e,t[1]=r,t},ue.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t},ue.subtract=de,ue.multiply=me,ue.divide=ye,ue.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},ue.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},ue.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t},ue.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t},ue.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},ue.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t},ue.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t},ue.distance=ge,ue.squaredDistance=xe,ue.length=be,ue.squaredLength=ve,ue.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},ue.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},ue.normalize=function(t,e){var r=e[0],n=e[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t},ue.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},ue.cross=function(t,e,r){var n=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=n,t},ue.lerp=function(t,e,r,n){var i=e[0],s=e[1];return t[0]=i+n*(r[0]-i),t[1]=s+n*(r[1]-s),t},ue.random=function(t,e){e=e||1;var r=2*he.RANDOM()*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t},ue.transformMat2=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t},ue.transformMat2d=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i+r[4],t[1]=r[1]*n+r[3]*i+r[5],t},ue.transformMat3=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[3]*i+r[6],t[1]=r[1]*n+r[4]*i+r[7],t},ue.transformMat4=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t},ue.rotate=function(t,e,r,n){var i=e[0]-r[0],s=e[1]-r[1],a=Math.sin(n),o=Math.cos(n);return t[0]=i*o-s*a+r[0],t[1]=i*a+s*o+r[1],t},ue.angle=function(t,e){var r=t[0],n=t[1],i=e[0],s=e[1],a=Math.sqrt(r*r+n*n)*Math.sqrt(i*i+s*s);return Math.acos(Math.min(Math.max(a&&(r*i+n*s)/a,-1),1))},ue.zero=function(t){return t[0]=0,t[1]=0,t},ue.str=function(t){return \"vec2(\"+t[0]+\", \"+t[1]+\")\"},ue.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},ue.equals=function(t,e){var r=t[0],n=t[1],i=e[0],s=e[1];return Math.abs(r-i)<=he.EPSILON*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-s)<=he.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))},ue.forEach=ue.sqrLen=ue.sqrDist=ue.dist=ue.div=ue.mul=ue.sub=ue.len=void 0;var he=function(t,e){if(t&&t.__esModule)return t;if(null===t||\"object\"!==ce(t)&&\"function\"!=typeof t)return {default:t};var r=pe(void 0);if(r&&r.has(t))return r.get(t);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(\"default\"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=i?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s];}return n.default=t,r&&r.set(t,n),n}(f);function pe(t){if(\"function\"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return (pe=function(t){return t?r:e})(t)}function fe(){var t=new he.ARRAY_TYPE(2);return he.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function de(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t}function me(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t}function ye(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t}function ge(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1])}function xe(t,e){var r=e[0]-t[0],n=e[1]-t[1];return r*r+n*n}function be(t){return Math.hypot(t[0],t[1])}function ve(t){var e=t[0],r=t[1];return e*e+r*r}ue.len=be,ue.sub=de,ue.mul=me,ue.div=ye,ue.dist=ge,ue.sqrDist=xe,ue.sqrLen=ve;var _e=function(){var t=fe();return function(e,r,n,i,s,a){var o,l;for(r||(r=2),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,o=n;o<l;o+=r)t[0]=e[o],t[1]=e[o+1],s(t,t,a),e[o]=t[0],e[o+1]=t[1];return e}}();function we(t){return we=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},we(t)}ue.forEach=_e,Object.defineProperty(p,\"__esModule\",{value:!0}),t.aa=p.vec4=t.Q=p.vec3=p.vec2=p.quat2=t.bl=p.quat=t.a9=p.mat4=t.ct=p.mat3=p.mat2d=t.b7=p.mat2=p.glMatrix=void 0;var Me=Re(f);p.glMatrix=Me;var Ae=Re(x);t.b7=p.mat2=Ae;var Se=Re(A);p.mat2d=Se;var Ie=Re(z);t.ct=p.mat3=Ie;var ke=Re(D);t.a9=p.mat4=ke;var Pe=Re(Y);t.bl=p.quat=Pe;var Ee=Re(Kt);p.quat2=Ee;var ze=Re(ue);p.vec2=ze;var Te=Re(X);t.Q=p.vec3=Te;var Be=Re(ut);function Ce(t){if(\"function\"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return (Ce=function(t){return t?r:e})(t)}function Re(t,e){if(t&&t.__esModule)return t;if(null===t||\"object\"!==we(t)&&\"function\"!=typeof t)return {default:t};var r=Ce(e);if(r&&r.has(t))return r.get(t);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(\"default\"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var a=i?Object.getOwnPropertyDescriptor(t,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=t[s];}return n.default=t,r&&r.set(t,n),n}t.aa=p.vec4=Be;var Ve=De;function De(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n;}De.prototype={sampleCurveX:function(t){return ((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return ((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return (3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)<e)return r;var s=this.sampleCurveDerivativeX(r);if(Math.abs(s)<1e-6)break;r-=i/s;}var a=0,o=1;for(r=t,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-t)<e));n++)t>i?a=r:o=r,r=.5*(o-a)+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var Le=h(Ve),Fe=Oe;function Oe(t,e){this.x=t,this.y=e;}Oe.prototype={clone:function(){return new Oe(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Oe.convert=function(t){return t instanceof Oe?t:Array.isArray(t)?new Oe(t[0],t[1]):t};var Ue=h(Fe);const Ne=Math.PI/180,je=180/Math.PI;function qe(t){return t*Ne}function $e(t){return t*je}const Ge=[[0,0],[1,0],[1,1],[0,1]];function Qe(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function Ye(t,e,r,n){const i=new Le(t,e,r,n);return function(t){return i.solve(t)}}const Xe=Ye(.25,.1,.25,1);function Ze(t,e,r){return Math.min(r,Math.max(e,t))}function Ke(t,e,r){return (r=Ze((r-t)/(e-t),0,1))*r*(3-2*r)}function We(t,e,r){const n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function He(t,e,r){if(!t.length)return r(null,[]);let n=t.length;const i=new Array(t.length);let s=null;t.forEach(((t,a)=>{e(t,((t,e)=>{t&&(s=t),i[a]=e,0==--n&&r(s,i);}));}));}function Je(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}let tr=1;function er(){return tr++}function rr(){return function t(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function nr(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function ir(t){return !!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function sr(t,e){t.forEach((t=>{e[t]&&(e[t]=e[t].bind(e));}));}function ar(t,e){return -1!==t.indexOf(e,t.length-e.length)}function or(t,e,r){const n={};for(const r in t)n[r]=e.call(this,t[r],r,t);return n}function lr(t,e,r){const n={};for(const r in t)e.call(this,t[r],r,t)&&(n[r]=t[r]);return n}function ur(t){return Array.isArray(t)?t.map(ur):\"object\"==typeof t&&t?or(t,ur):t}const cr={};function hr(t){cr[t]||(\"undefined\"!=typeof console&&console.warn(t),cr[t]=!0);}function pr(t,e,r){return (r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function fr(t){let e=0;for(let r,n,i=0,s=t.length,a=s-1;i<s;a=i++)r=t[i],n=t[a],e+=(n.x-r.x)*(r.y+n.y);return e}function dr([t,e,r]){const n=qe(e+90),i=qe(r);return {x:t*Math.cos(n)*Math.sin(i),y:t*Math.sin(n)*Math.sin(i),z:t*Math.cos(i),azimuthal:e,polar:r}}function mr(){return \"undefined\"!=typeof WorkerGlobalScope&&\"undefined\"!=typeof self&&self instanceof WorkerGlobalScope}function yr(t){const e={};if(t.replace(/(?:^|(?:\\s*\\,\\s*))([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)(?:\\=(?:([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)|(?:\\\"((?:[^\"\\\\]|\\\\.)*)\\\")))?/g,((t,r,n,i)=>{const s=n||i;return e[r]=!s||s.toLowerCase(),\"\"})),e[\"max-age\"]){const t=parseInt(e[\"max-age\"],10);isNaN(t)?delete e[\"max-age\"]:e[\"max-age\"]=t;}return e}let gr,xr,br,vr,_r,wr,Mr=null;function Ar(t){try{const e=self[t];return e.setItem(\"_mapbox_test_\",1),e.removeItem(\"_mapbox_test_\"),!0}catch(t){return !1}}function Sr(t,e){return [t[4*e],t[4*e+1],t[4*e+2],t[4*e+3]]}function Ir(t,e,r,n){for(;e<r;){const i=e+r>>1;t[i]<n?e=i+1:r=i;}return e}function kr(t,e,r,n){for(;e<r;){const i=e+r>>1;t[i]<=n?e=i+1:r=i;}return e}function Pr(t){return t>0?1/(1.001-t):1+t}function Er(t){return t>0?1-1/(1.001-t):-t}function zr(){return null==gr&&(gr=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext(\"2d\")&&\"function\"==typeof self.createImageBitmap),gr}const Tr={now:()=>void 0!==vr?vr:performance.now(),setNow(t){vr=t;},restoreNow(){vr=void 0;},frame(t){const e=requestAnimationFrame(t);return {cancel:()=>cancelAnimationFrame(e)}},getImageData(t,e=0){const{width:r,height:n}=t;_r||(_r=document.createElement(\"canvas\"));const i=_r.getContext(\"2d\",{willReadFrequently:!0});if(!i)throw new Error(\"failed to create canvas 2d context\");return (r>_r.width||n>_r.height)&&(_r.width=r,_r.height=n),i.clearRect(-e,-e,r+2*e,n+2*e),i.drawImage(t,0,0,r,n),i.getImageData(-e,-e,r+2*e,n+2*e)},resolveURL:t=>(xr||(xr=document.createElement(\"a\")),xr.href=t,xr.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return !!window.matchMedia&&(null==br&&(br=window.matchMedia(\"(prefers-reduced-motion: reduce)\")),br.matches)},hasCanvasFingerprintNoise(){if(void 0!==wr)return wr;if(!zr())return wr=!1,!1;const t=new OffscreenCanvas(85,1),e=t.getContext(\"2d\",{willReadFrequently:!0});let r=0;for(let n=0;n<t.width;++n)e.fillStyle=`rgba(${r++},${r++},${r++}, 255)`,e.fillRect(n,0,1,1);const n=e.getImageData(0,0,t.width,t.height);r=0;for(let t=0;t<n.data.length;++t)if(t%4!=3&&r++!==n.data[t])return wr=!0,!0;return wr=!1,!1}};function Br(t,e){const r=t.indexOf(\"?\");if(r<0)return `${t}?${new URLSearchParams(e).toString()}`;const n=new URLSearchParams(t.slice(r));for(const t in e)n.set(t,e[t]);return `${t.slice(0,r)}?${n.toString()}`}function Cr(t,e={persistentParams:[]}){const r=t.indexOf(\"?\");if(r<0)return t;const n=new URLSearchParams,i=new URLSearchParams(t.slice(r));for(const t of e.persistentParams){const e=i.get(t);e&&n.set(t,e);}const s=n.toString();return `${t.slice(0,r)}${s.length>0?`?${s}`:\"\"}`}const Rr=\"mapbox-tiles\";let Vr=500,Dr=50;let Lr,Fr;function Or(){try{return caches}catch(t){}}function Ur(){const t=Or();t&&!Lr&&(Lr=t.open(Rr));}let Nr=1/0;const jr={supported:!1,testSupport:function(t){!Gr&&$r&&(Qr?Xr(t):qr=t);}};let qr,$r,Gr=!1,Qr=!1;const Yr=\"undefined\"!=typeof self?self:{};function Xr(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,$r),t.isContextLost())return;jr.supported=!0;}catch(t){}t.deleteTexture(e),Gr=!0;}Yr.document&&($r=Yr.document.createElement(\"img\"),$r.onload=function(){qr&&Xr(qr),qr=null,Qr=!0;},$r.onerror=function(){Gr=!0,qr=null;},$r.src=\"data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=\");const Zr={Unknown:\"Unknown\",Style:\"Style\",Source:\"Source\",Tile:\"Tile\",Glyphs:\"Glyphs\",SpriteImage:\"SpriteImage\",SpriteJSON:\"SpriteJSON\",Image:\"Image\",Model:\"Model\"};\"function\"==typeof Object.freeze&&Object.freeze(Zr);class Kr extends Error{constructor(t,e,r){401===e&&i(r)&&(t+=\": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes\"),super(t),this.status=e,this.url=r;}toString(){return `${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Wr=mr()?()=>self.worker&&self.worker.referrer:()=>(\"blob:\"===location.protocol?parent:self).location.href;const Hr=function(t,e){if(!(/^file:/.test(r=t.url)||/^file:/.test(Wr())&&!/^\\w+:/.test(r))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty(\"signal\"))return function(t,e){const r=new AbortController,n=new Request(t.url,{method:t.method||\"GET\",body:t.body,credentials:t.credentials,headers:t.headers,referrer:Wr(),referrerPolicy:t.referrerPolicy,signal:r.signal});let s=!1,a=!1;const o=(l=n.url).indexOf(\"sku=\")>0&&i(l);var l;\"json\"===t.type&&n.headers.set(\"Accept\",\"application/json\");const u=(r,i,s)=>{if(a)return;if(r&&\"SecurityError\"!==r.message&&hr(r.toString()),i&&s)return c(i);const l=Date.now();fetch(n).then((r=>{if(r.ok){const t=o?r.clone():null;return c(r,t,l)}return e(new Kr(r.statusText,r.status,t.url))})).catch((r=>{\"AbortError\"!==r.name&&e(new Error(`${r.message} ${t.url}`));}));},c=(r,i,o)=>{(\"arrayBuffer\"===t.type?r.arrayBuffer():\"json\"===t.type?r.json():r.text()).then((t=>{a||(i&&o&&function(t,e,r){if(Ur(),!Lr)return;const n=yr(e.headers.get(\"Cache-Control\")||\"\");if(n[\"no-store\"])return;const i={status:e.status,statusText:e.statusText,headers:new Headers};e.headers.forEach(((t,e)=>i.headers.set(e,t))),n[\"max-age\"]&&i.headers.set(\"Expires\",new Date(r+1e3*n[\"max-age\"]).toUTCString());const s=i.headers.get(\"Expires\");if(!s)return;if(new Date(s).getTime()-r<42e4)return;let a=Cr(t.url,{persistentParams:[\"language\",\"worldview\"]});if(206===e.status){const e=t.headers.get(\"Range\");if(!e)return;i.status=200,a=Br(a,{range:e});}!function(t,e){if(void 0===Fr)try{new Response(new ReadableStream),Fr=!0;}catch(t){Fr=!1;}Fr?e(t.body):t.blob().then(e);}(e,(t=>{const e=new Response(t,i);Ur(),Lr&&Lr.then((t=>t.put(a,e))).catch((t=>hr(t.message)));}));}(n,i,o),s=!0,e(null,t,r.headers.get(\"Cache-Control\"),r.headers.get(\"Expires\")));})).catch((t=>{a||e(new Error(t.message));}));};return o?function(t,e){if(Ur(),!Lr)return e(null);Lr.then((r=>{let n=Cr(t.url,{persistentParams:[\"language\",\"worldview\"]});const i=t.headers.get(\"Range\");i&&(n=Br(n,{range:i})),r.match(n).then((t=>{const i=function(t){if(!t)return !1;const e=new Date(t.headers.get(\"Expires\")||0),r=yr(t.headers.get(\"Cache-Control\")||\"\");return e>Date.now()&&!r[\"no-cache\"]}(t);r.delete(n),i&&r.put(n,t.clone()),e(null,t,i);})).catch(e);})).catch(e);}(n,u):u(null,null),{cancel:()=>{a=!0,s||r.abort();}}}(t,e);if(mr()&&self.worker&&self.worker.actor)return self.worker.actor.send(\"getResource\",t,e,void 0,!0)}var r;return function(t,e){const r=new XMLHttpRequest;r.open(t.method||\"GET\",t.url,!0),\"arrayBuffer\"===t.type&&(r.responseType=\"arraybuffer\");for(const e in t.headers)r.setRequestHeader(e,t.headers[e]);return \"json\"===t.type&&(r.responseType=\"text\",r.setRequestHeader(\"Accept\",\"application/json\")),r.withCredentials=\"include\"===t.credentials,r.onerror=()=>{e(new Error(r.statusText));},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let n=r.response;if(\"json\"===t.type)try{n=JSON.parse(r.response);}catch(t){return e(t)}e(null,n,r.getResponseHeader(\"Cache-Control\"),r.getResponseHeader(\"Expires\"));}else e(new Kr(r.statusText,r.status,t.url));},r.send(t.body),{cancel:()=>r.abort()}}(t,e)},Jr=function(t,e){return Hr(Je(t,{type:\"arrayBuffer\"}),e)};function tn(t){const e=document.createElement(\"a\");return e.href=t,e.protocol===location.protocol&&e.host===location.host}const en=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=\";let rn,nn;rn=[],nn=0;const sn=function(t,e){if(jr.supported&&(t.headers||(t.headers={}),t.headers.accept=\"image/webp,*/*\"),nn>=n.MAX_PARALLEL_IMAGE_REQUESTS){const r={requestParameters:t,callback:e,cancelled:!1,cancel(){this.cancelled=!0;}};return rn.push(r),r}nn++;let r=!1;const i=()=>{if(!r)for(r=!0,nn--;rn.length&&nn<n.MAX_PARALLEL_IMAGE_REQUESTS;){const t=rn.shift(),{requestParameters:e,callback:r,cancelled:n}=t;n||(t.cancel=sn(e,r).cancel);}},s=Jr(t,((t,r,n,s)=>{i(),t?e(t):r&&(self.createImageBitmap?function(t,e){const r=new Blob([new Uint8Array(t)],{type:\"image/png\"});createImageBitmap(r).then((t=>{e(null,t);})).catch((t=>{e(new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`));}));}(r,((t,r)=>e(t,r,n,s))):function(t,e){const r=new Image;r.onload=()=>{e(null,r),URL.revokeObjectURL(r.src),r.onload=null,requestAnimationFrame((()=>{r.src=en;}));},r.onerror=()=>e(new Error(\"Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.\"));const n=new Blob([new Uint8Array(t)],{type:\"image/png\"});r.src=t.byteLength?URL.createObjectURL(n):en;}(r,((t,r)=>e(t,r,n,s))));}));return {cancel:()=>{s.cancel(),i();}}},an=\"01\",on=\"NO_ACCESS_TOKEN\",ln=/^(\\w+):\\/\\/([^/?]*)(\\/[^?]+)?\\??(.+)?/;function un(t){const e=t.match(ln);if(!e)throw new Error(\"Unable to parse URL object\");return {protocol:e[1],authority:e[2],path:e[3]||\"/\",params:e[4]?e[4].split(\"&\"):[]}}function cn(t){const e=t.params.length?`?${t.params.join(\"&\")}`:\"\";return `${t.protocol}://${t.authority}${t.path}${e}`}const hn=\"mapbox.eventData\";function pn(t){if(!t)return null;const e=t.split(\".\");if(!e||3!==e.length)return null;try{return JSON.parse(decodeURIComponent(atob(e[1]).split(\"\").map((t=>\"%\"+(\"00\"+t.charCodeAt(0).toString(16)).slice(-2))).join(\"\")))}catch(t){return null}}class fn{constructor(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null;}getStorageKey(t){const e=pn(n.ACCESS_TOKEN);let r=\"\";return r=e&&e.u?btoa(encodeURIComponent(e.u).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(Number(\"0x\"+e))))):n.ACCESS_TOKEN||\"\",t?`${hn}.${t}:${r}`:`${hn}:${r}`}fetchEventData(){const t=Ar(\"localStorage\"),e=this.getStorageKey(),r=this.getStorageKey(\"uuid\");if(t)try{const t=localStorage.getItem(e);t&&(this.eventData=JSON.parse(t));const n=localStorage.getItem(r);n&&(this.anonId=n);}catch(t){hr(\"Unable to read from LocalStorage\");}}saveEventData(){const t=Ar(\"localStorage\"),e=this.getStorageKey(),r=this.getStorageKey(\"uuid\"),n=this.anonId;if(t&&n)try{localStorage.setItem(r,n),Object.keys(this.eventData).length>=1&&localStorage.setItem(e,JSON.stringify(this.eventData));}catch(t){hr(\"Unable to write to LocalStorage\");}}processRequests(t){}postEvent(t,e,r,i){if(!n.EVENTS_URL)return;const s=un(n.EVENTS_URL);s.params.push(`access_token=${i||n.ACCESS_TOKEN||\"\"}`);const a={event:this.type,created:new Date(t).toISOString()},o=e?Je(a,e):a,l={url:cn(s),headers:{\"Content-Type\":\"text/plain\"},body:JSON.stringify([o])};this.pendingRequest=function(t,e){return Hr(Je(t,{method:\"POST\"}),e)}(l,(t=>{this.pendingRequest=null,r(t),this.saveEventData(),this.processRequests(i);}));}queueRequest(t,e){this.queue.push(t),this.processRequests(e);}}const dn=new class extends fn{constructor(t){super(\"appUserTurnstile\"),this._customAccessToken=t;}postTurnstileEvent(t,e){n.EVENTS_URL&&n.ACCESS_TOKEN&&Array.isArray(t)&&t.some((t=>s(t)||i(t)))&&this.queueRequest(Date.now(),e);}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const r=pn(n.ACCESS_TOKEN),i=r?r.u:n.ACCESS_TOKEN;let s=i!==this.eventData.tokenU;ir(this.anonId)||(this.anonId=rr(),s=!0);const a=this.queue.shift();if(this.eventData.lastSuccess){const t=new Date(this.eventData.lastSuccess),e=new Date(a),r=(a-this.eventData.lastSuccess)/864e5;s=s||r>=1||r<-1||t.getDate()!==e.getDate();}else s=!0;s?this.postEvent(a,{sdkIdentifier:\"mapbox-gl-js\",sdkVersion:e,skuId:an,\"enabled.telemetry\":!1,userId:this.anonId},(t=>{t||(this.eventData.lastSuccess=a,this.eventData.tokenU=i);}),t):this.processRequests();}},mn=dn.postTurnstileEvent.bind(dn),yn=new class extends fn{constructor(){super(\"map.load\"),this.success={},this.skuToken=\"\";}postMapLoadEvent(t,e,r,i){this.skuToken=e,this.errorCb=i,n.EVENTS_URL&&(r||n.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},r):this.errorCb(new Error(on)));}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;const{id:r,timestamp:n}=this.queue.shift();r&&this.success[r]||(this.anonId||this.fetchEventData(),ir(this.anonId)||(this.anonId=rr()),this.postEvent(n,{sdkIdentifier:\"mapbox-gl-js\",sdkVersion:e,skuId:an,skuToken:this.skuToken,userId:this.anonId},(t=>{t?this.errorCb(t):r&&(this.success[r]=!0);}),t));}remove(){this.errorCb=null;}},gn=yn.postMapLoadEvent.bind(yn),xn=new class extends fn{constructor(){super(\"style.load\"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap;}getMapInstanceId(t){let e=this.mapInstanceIdMap.get(t);return e||(e=rr(),this.mapInstanceIdMap.set(t,e)),e}getEventId(t){const e=this.eventIdPerMapInstanceMap.get(t)||0;return this.eventIdPerMapInstanceMap.set(t,e+1),e}postStyleLoadEvent(t,e){const{map:r,style:i,importedStyles:s}=e;if(!n.EVENTS_URL||!t&&!n.ACCESS_TOKEN)return;const a=this.getMapInstanceId(r),o={mapInstanceId:a,eventId:this.getEventId(a),style:i};s.length&&(o.importedStyles=s),this.queueRequest({timestamp:Date.now(),payload:o},t);}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:e,payload:r}=this.queue.shift();this.postEvent(e,r,(()=>{}),t);}},bn=xn.postStyleLoadEvent.bind(xn),vn=new class extends fn{constructor(){super(\"gljs.performance\");}postPerformanceEvent(t,e){n.EVENTS_URL&&(t||n.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:e},t);}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:r,performanceData:n}=this.queue.shift(),i=function(t){const r=performance.getEntriesByType(\"resource\"),n=performance.getEntriesByType(\"mark\"),i=function(t){const e={};if(t)for(const r in t)if(\"other\"!==r)for(const n of t[r]){const t=`${r}ResolveRangeMin`,i=`${r}ResolveRangeMax`,s=`${r}RequestCount`,a=`${r}RequestCachedCount`;e[t]=Math.min(e[t]||1/0,n.startTime),e[i]=Math.max(e[i]||-1/0,n.responseEnd);const o=t=>{void 0===e[t]&&(e[t]=0),++e[t];};void 0!==n.transferSize&&0===n.transferSize&&o(a),o(s);}return e}(function(t,e){const r={};if(t)for(const n of t){const t=e(n);void 0===r[t]&&(r[t]=[]),r[t].push(n);}return r}(r,c)),s=window.devicePixelRatio,a=navigator.connection||navigator.mozConnection||navigator.webkitConnection,o=a?a.effectiveType:void 0,h={counters:[],metadata:[],attributes:[]},p=(t,e,r)=>{null!=r&&t.push({name:e,value:r.toString()});};for(const t in i)p(h.counters,t,i[t]);if(t.interactionRange[0]!==1/0&&t.interactionRange[1]!==-1/0&&(p(h.counters,\"interactionRangeMin\",t.interactionRange[0]),p(h.counters,\"interactionRangeMax\",t.interactionRange[1])),n)for(const t of Object.keys(u)){const e=u[t],r=n.find((t=>t.name===e));r&&p(h.counters,e,r.startTime);}return p(h.counters,\"visibilityHidden\",t.visibilityHidden),p(h.attributes,\"style\",function(t){if(t)for(const e of t){const t=e.name.split(\"?\")[0];if(l(t)){const e=t.split(\"/\").slice(-2);if(2===e.length)return `mapbox://styles/${e[0]}/${e[1]}`}}}(r)),p(h.attributes,\"terrainEnabled\",t.terrainEnabled?\"true\":\"false\"),p(h.attributes,\"fogEnabled\",t.fogEnabled?\"true\":\"false\"),p(h.attributes,\"projection\",t.projection),p(h.attributes,\"zoom\",t.zoom),p(h.metadata,\"devicePixelRatio\",s),p(h.metadata,\"connectionEffectiveType\",o),p(h.metadata,\"navigatorUserAgent\",navigator.userAgent),p(h.metadata,\"screenWidth\",window.screen.width),p(h.metadata,\"screenHeight\",window.screen.height),p(h.metadata,\"windowWidth\",window.innerWidth),p(h.metadata,\"windowHeight\",window.innerHeight),p(h.metadata,\"mapWidth\",t.width/s),p(h.metadata,\"mapHeight\",t.height/s),p(h.metadata,\"webglRenderer\",t.renderer),p(h.metadata,\"webglVendor\",t.vendor),p(h.metadata,\"sdkVersion\",e),p(h.metadata,\"sdkIdentifier\",\"mapbox-gl-js\"),h}(n);for(const t of i.metadata);for(const t of i.counters);for(const t of i.attributes);this.postEvent(r,i,(()=>{}),t);}},_n=vn.postPerformanceEvent.bind(vn),wn=new class extends fn{constructor(){super(\"map.auth\"),this.success={},this.skuToken=\"\";}getSession(t,e,r,i){if(!n.API_URL||!n.SESSION_PATH)return;const s=un(n.API_URL+n.SESSION_PATH);s.params.push(`sku=${e||\"\"}`),s.params.push(`access_token=${i||n.ACCESS_TOKEN||\"\"}`);const a={url:cn(s),headers:{\"Content-Type\":\"text/plain\"}};this.pendingRequest=function(t,e){return Hr(Je(t,{method:\"GET\"}),e)}(a,(t=>{this.pendingRequest=null,r(t),this.saveEventData(),this.processRequests(i);}));}getSessionAPI(t,e,r,i){this.skuToken=e,this.errorCb=i,n.SESSION_PATH&&n.API_URL&&(r||n.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},r):this.errorCb(new Error(on)));}processRequests(t){if(this.pendingRequest||0===this.queue.length)return;const{id:e,timestamp:r}=this.queue.shift();e&&this.success[e]||this.getSession(r,this.skuToken,(t=>{t?this.errorCb(t):e&&(this.success[e]=!0);}),t);}remove(){this.errorCb=null;}},Mn=wn.getSessionAPI.bind(wn),An=new Set;var Sn={exports:{}},In={exports:{}};In.exports=function(t,e){var r,n,i,s,a,o,l,u;for(n=t.length-(r=3&t.length),i=e,a=3432918353,o=461845907,u=0;u<n;)l=255&t.charCodeAt(u)|(255&t.charCodeAt(++u))<<8|(255&t.charCodeAt(++u))<<16|(255&t.charCodeAt(++u))<<24,++u,i=27492+(65535&(s=5*(65535&(i=(i^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295;}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0};var kn=In.exports,Pn={exports:{}};Pn.exports=function(t,e){for(var r,n=t.length,i=e^n,s=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:i^=(255&t.charCodeAt(s+2))<<16;case 2:i^=(255&t.charCodeAt(s+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(s)))+((1540483477*(i>>>16)&65535)<<16);}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0};var En=kn,zn=Pn.exports;Sn.exports=En,Sn.exports.murmur3=En,Sn.exports.murmur2=zn;var Tn=h(Sn.exports);function Bn(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e));}function Cn(t,e,r){if(r&&r[t]){const n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1);}}class Rn{constructor(t,e={}){Je(this,e),this.type=t;}}class Vn extends Rn{constructor(t,e={}){super(\"error\",Je({error:t},e));}}class Dn{on(t,e){return this._listeners=this._listeners||{},Bn(t,e,this._listeners),this}off(t,e){return Cn(t,e,this._listeners),Cn(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},Bn(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){\"string\"==typeof t&&(t=new Rn(t,e||{}));const r=t.type;if(this.listens(r)){t.target=this;const e=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(const r of e)r.call(this,t);const n=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const e of n)Cn(r,e,this._oneTimeListeners),e.call(this,t);const i=this._eventedParent;i&&(Je(t,\"function\"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(t));}else t instanceof Vn&&console.error(t.error);return this}listens(t){return !!(this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}t.z=void 0;var Ln={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Fn(t){return (t=Math.round(t))<0?0:t>255?255:t}function On(t){return Fn(\"%\"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function Un(t){return (e=\"%\"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e;}function Nn(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{t.z={}.parseCSSColor=function(t){var e,r=t.replace(/ /g,\"\").toLowerCase();if(r in Ln)return Ln[r].slice();if(\"#\"===r[0])return 4===r.length?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===r.length&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=r.indexOf(\"(\"),i=r.indexOf(\")\");if(-1!==n&&i+1===r.length){var s=r.substr(0,n),a=r.substr(n+1,i-(n+1)).split(\",\"),o=1;switch(s){case\"rgba\":if(4!==a.length)return null;o=Un(a.pop());case\"rgb\":return 3!==a.length?null:[On(a[0]),On(a[1]),On(a[2]),o];case\"hsla\":if(4!==a.length)return null;o=Un(a.pop());case\"hsl\":if(3!==a.length)return null;var l=(parseFloat(a[0])%360+360)%360/360,u=Un(a[1]),c=Un(a[2]),h=c<=.5?c*(u+1):c+u-c*u,p=2*c-h;return [Fn(255*Nn(p,h,l+1/3)),Fn(255*Nn(p,h,l)),Fn(255*Nn(p,h,l-1/3)),o];default:return null}}return null};}catch(t){}class jn{constructor(t,e,r,n=1){this.r=t,this.g=e,this.b=r,this.a=n;}static parse(e){if(!e)return;if(e instanceof jn)return e;if(\"string\"!=typeof e)return;const r=t.z(e);return r?new jn(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){const[t,e,r,n]=this.toArray();return `rgba(${Math.round(t)},${Math.round(e)},${Math.round(r)},${n})`}toArray(){const{r:t,g:e,b:r,a:n}=this;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*r/n,n]}toArray01(){const{r:t,g:e,b:r,a:n}=this;return 0===n?[0,0,0,0]:[t/n,e/n,r/n,n]}toArray01Scaled(t){const{r:e,g:r,b:n,a:i}=this;return 0===i?[0,0,0]:[e/i*t,r/i*t,n/i*t]}toArray01PremultipliedAlpha(){const{r:t,g:e,b:r,a:n}=this;return [t,e,r,n]}toArray01Linear(){const{r:t,g:e,b:r,a:n}=this;return 0===n?[0,0,0,0]:[Math.pow(t/n,2.2),Math.pow(e/n,2.2),Math.pow(r/n,2.2),n]}}function qn(t,e,r){return t*(1-r)+e*r}function $n(t,e,r){return t.map(((t,n)=>qn(t,e[n],r)))}jn.black=new jn(0,0,0,1),jn.white=new jn(1,1,1,1),jn.transparent=new jn(0,0,0,0),jn.red=new jn(1,0,0,1),jn.blue=new jn(0,0,1,1);var Gn=Object.freeze({__proto__:null,array:$n,color:function(t,e,r){return new jn(qn(t.r,e.r,r),qn(t.g,e.g,r),qn(t.b,e.b,r),qn(t.a,e.a,r))},number:qn});function Qn(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}class Yn extends Error{constructor(t,e){super(e),this.message=e,this.key=t;}}class Xn{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,r]of e)this.bindings[t]=r;}concat(t){return new Xn(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return !!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const Zn={kind:\"null\"},Kn={kind:\"number\"},Wn={kind:\"string\"},Hn={kind:\"boolean\"},Jn={kind:\"color\"},ti={kind:\"object\"},ei={kind:\"value\"},ri={kind:\"collator\"},ni={kind:\"formatted\"},ii={kind:\"resolvedImage\"};function si(t,e){return {kind:\"array\",itemType:t,N:e}}function ai(t){if(\"array\"===t.kind){const e=ai(t.itemType);return \"number\"==typeof t.N?`array<${e}, ${t.N}>`:\"value\"===t.itemType.kind?\"array\":`array<${e}>`}return t.kind}const oi=[Zn,Kn,Wn,Hn,Jn,ni,ti,si(ei),ii];function li(t,e){if(\"error\"===e.kind)return null;if(\"array\"===t.kind){if(\"array\"===e.kind&&(0===e.N&&\"value\"===e.itemType.kind||!li(t.itemType,e.itemType))&&(\"number\"!=typeof t.N||t.N===e.N))return null}else {if(t.kind===e.kind)return null;if(\"value\"===t.kind)for(const t of oi)if(!li(t,e))return null}return `Expected ${ai(t)} but found ${ai(e)} instead.`}function ui(t,e){return e.some((e=>e.kind===t.kind))}function ci(t,e){return e.some((e=>\"null\"===e?null===t:\"array\"===e?Array.isArray(t):\"object\"===e?t&&!Array.isArray(t)&&\"object\"==typeof t:e===typeof t))}class hi{constructor(t,e,r){this.sensitivity=t?e?\"variant\":\"case\":e?\"accent\":\"base\",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:\"search\"});}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class pi{constructor(t,e,r,n,i){this.text=t.normalize?t.normalize():t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i;}}class fi{constructor(t){this.sections=t;}static fromString(t){return new fi([new pi(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.namePrimary.length))}static factory(t){return t instanceof fi?t:fi.fromString(t)}toString(){return 0===this.sections.length?\"\":this.sections.map((t=>t.text)).join(\"\")}serialize(){const t=[\"format\"];for(const e of this.sections){if(e.image){t.push([\"image\",e.image.namePrimary]);continue}t.push(e.text);const r={};e.fontStack&&(r[\"text-font\"]=[\"literal\",e.fontStack.split(\",\")]),e.scale&&(r[\"font-scale\"]=e.scale),e.textColor&&(r[\"text-color\"]=[\"rgba\"].concat(e.textColor.toArray())),t.push(r);}return t}}class di{constructor(t){this.namePrimary=t.namePrimary,t.nameSecondary&&(this.nameSecondary=t.nameSecondary),this.available=t.available;}toString(){return this.nameSecondary?`[${this.namePrimary},${this.nameSecondary}]`:this.namePrimary}static fromString(t,e){return t?new di({namePrimary:t,nameSecondary:e,available:!1}):null}serialize(){return this.nameSecondary?[\"image\",this.namePrimary,this.nameSecondary]:[\"image\",this.namePrimary]}}function mi(t,e,r,n){return \"number\"==typeof t&&t>=0&&t<=255&&\"number\"==typeof e&&e>=0&&e<=255&&\"number\"==typeof r&&r>=0&&r<=255?void 0===n||\"number\"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(\", \")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(\"number\"==typeof n?[t,e,r,n]:[t,e,r]).join(\", \")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function yi(t){if(null===t)return !0;if(\"string\"==typeof t)return !0;if(\"boolean\"==typeof t)return !0;if(\"number\"==typeof t)return !0;if(t instanceof jn)return !0;if(t instanceof hi)return !0;if(t instanceof fi)return !0;if(t instanceof di)return !0;if(Array.isArray(t)){for(const e of t)if(!yi(e))return !1;return !0}if(\"object\"==typeof t){for(const e in t)if(!yi(t[e]))return !1;return !0}return !1}function gi(t){if(null===t)return Zn;if(\"string\"==typeof t)return Wn;if(\"boolean\"==typeof t)return Hn;if(\"number\"==typeof t)return Kn;if(t instanceof jn)return Jn;if(t instanceof hi)return ri;if(t instanceof fi)return ni;if(t instanceof di)return ii;if(Array.isArray(t)){const e=t.length;let r;for(const e of t){const t=gi(e);if(r){if(r===t)continue;r=ei;break}r=t;}return si(r||ei,e)}return ti}function xi(t){const e=typeof t;return null===t?\"\":\"string\"===e||\"number\"===e||\"boolean\"===e?String(t):t instanceof jn||t instanceof fi||t instanceof di?t.toString():JSON.stringify(t)}class bi{constructor(t,e){this.type=t,this.value=e;}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!yi(t[1]))return e.error(\"invalid value\");const r=t[1];let n=gi(r);const i=e.expectedType;return \"array\"!==n.kind||0!==n.N||!i||\"array\"!==i.kind||\"number\"==typeof i.N&&0!==i.N||(n=i),new bi(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return !0}serialize(){return \"array\"===this.type.kind||\"object\"===this.type.kind?[\"literal\",this.value]:this.value instanceof jn?[\"rgba\"].concat(this.value.toArray()):this.value instanceof fi?this.value.serialize():this.value}}class vi{constructor(t){this.name=\"ExpressionEvaluationError\",this.message=t;}toJSON(){return this.message}}const _i={string:Wn,number:Kn,boolean:Hn,object:ti};class wi{constructor(t,e){this.type=t,this.args=e;}static parse(t,e){if(t.length<2)return e.error(\"Expected at least one argument.\");let r,n=1;const i=t[0];if(\"array\"===i){let i,s;if(t.length>2){const r=t[1];if(\"string\"!=typeof r||!(r in _i)||\"object\"===r)return e.error('The item type argument of \"array\" must be one of string, number, boolean',1);i=_i[r],n++;}else i=ei;if(t.length>3){if(null!==t[2]&&(\"number\"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to \"array\" must be a positive integer literal',2);s=t[2],n++;}r=si(i,s);}else r=_i[i];const s=[];for(;n<t.length;n++){const r=e.parse(t[n],n,ei);if(!r)return null;s.push(r);}return new wi(r,s)}evaluate(t){for(let e=0;e<this.args.length;e++){const r=this.args[e].evaluate(t);if(!li(this.type,gi(r)))return r;if(e===this.args.length-1)throw new vi(`Expected value to be of type ${ai(this.type)}, but found ${ai(gi(r))} instead.`)}return null}eachChild(t){this.args.forEach(t);}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=this.type,e=[t.kind];if(\"array\"===t.kind){const r=t.itemType;if(\"string\"===r.kind||\"number\"===r.kind||\"boolean\"===r.kind){e.push(r.kind);const n=t.N;(\"number\"==typeof n||this.args.length>1)&&e.push(n);}}return e.concat(this.args.map((t=>t.serialize())))}}class Mi{constructor(t){this.type=ni,this.sections=t;}static parse(t,e){if(t.length<2)return e.error(\"Expected at least one argument.\");const r=t[1];if(!Array.isArray(r)&&\"object\"==typeof r)return e.error(\"First argument must be an image or text section.\");const n=[];let i=!1;for(let r=1;r<=t.length-1;++r){const s=t[r];if(i&&\"object\"==typeof s&&!Array.isArray(s)){i=!1;let t=null;if(s[\"font-scale\"]&&(t=e.parse(s[\"font-scale\"],1,Kn),!t))return null;let r=null;if(s[\"text-font\"]&&(r=e.parse(s[\"text-font\"],1,si(Wn)),!r))return null;let a=null;if(s[\"text-color\"]&&(a=e.parse(s[\"text-color\"],1,Jn),!a))return null;const o=n[n.length-1];o.scale=t,o.font=r,o.textColor=a;}else {const s=e.parse(t[r],1,ei);if(!s)return null;const a=s.type.kind;if(\"string\"!==a&&\"value\"!==a&&\"null\"!==a&&\"resolvedImage\"!==a)return e.error(\"Formatted text type must be 'string', 'value', 'image' or 'null'.\");i=!0,n.push({content:s,scale:null,font:null,textColor:null});}}return new Mi(n)}evaluate(t){return new fi(this.sections.map((e=>{const r=e.content.evaluate(t);return gi(r)===ii?new pi(\"\",r,null,null,null):new pi(xi(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(\",\"):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor);}outputDefined(){return !1}serialize(){const t=[\"format\"];for(const e of this.sections){t.push(e.content.serialize());const r={};e.scale&&(r[\"font-scale\"]=e.scale.serialize()),e.font&&(r[\"text-font\"]=e.font.serialize()),e.textColor&&(r[\"text-color\"]=e.textColor.serialize()),t.push(r);}return t}}class Ai{constructor(t,e){this.type=ii,this.inputPrimary=t,this.inputSecondary=e;}static parse(t,e){if(t.length<2)return e.error(\"Expected two or more arguments.\");const r=e.parse(t[1],1,Wn);if(!r)return e.error(\"No image name provided.\");if(2===t.length)return new Ai(r);const n=e.parse(t[2],1,Wn);return n?new Ai(r,n):e.error(\"Secondary image variant is not a string.\")}evaluate(t){const e=di.fromString(this.inputPrimary.evaluate(t),this.inputSecondary?this.inputSecondary.evaluate(t):void 0);return e&&t.availableImages&&(e.available=t.availableImages.indexOf(e.namePrimary)>-1,e.nameSecondary&&e.available&&t.availableImages&&(e.available=t.availableImages.indexOf(e.nameSecondary)>-1)),e}eachChild(t){t(this.inputPrimary),this.inputSecondary&&t(this.inputSecondary);}outputDefined(){return !1}serialize(){return this.inputSecondary?[\"image\",this.inputPrimary.serialize(),this.inputSecondary.serialize()]:[\"image\",this.inputPrimary.serialize()]}}function Si(t){return t instanceof Number?\"number\":t instanceof String?\"string\":t instanceof Boolean?\"boolean\":Array.isArray(t)?\"array\":null===t?\"null\":typeof t}const Ii={\"to-boolean\":Hn,\"to-color\":Jn,\"to-number\":Kn,\"to-string\":Wn};class ki{constructor(t,e){this.type=t,this.args=e;}static parse(t,e){if(t.length<2)return e.error(\"Expected at least one argument.\");const r=t[0],n=[];let i=Zn;if(\"to-array\"===r){if(!Array.isArray(t[1]))return null;const r=t[1].length;if(e.expectedType){if(\"array\"!==e.expectedType.kind)return e.error(`Expected ${e.expectedType.kind} but found array.`);i=si(e.expectedType.itemType,r);}else {if(!(r>0&&yi(t[1][0])))return null;i=si(gi(t[1][0]),r);}for(let s=0;s<r;s++){const r=t[1][s];let a;if(\"array\"===Si(r))a=e.parse(r,void 0,i.itemType);else {const t=Si(r);if(t!==i.itemType.kind)return e.error(`Expected ${i.itemType.kind} but found ${t}.`);a=e.registry.literal.parse([\"literal\",void 0===r?null:r],e);}if(!a)return null;n.push(a);}}else {if((\"to-boolean\"===r||\"to-string\"===r)&&2!==t.length)return e.error(\"Expected one argument.\");i=Ii[r];for(let r=1;r<t.length;r++){const i=e.parse(t[r],r,ei);if(!i)return null;n.push(i);}}return new ki(i,n)}evaluate(t){if(\"boolean\"===this.type.kind)return Boolean(this.args[0].evaluate(t));if(\"color\"===this.type.kind){let e,r;for(const n of this.args){if(e=n.evaluate(t),r=null,e instanceof jn)return e;if(\"string\"==typeof e){const r=t.parseColor(e);if(r)return r}else if(Array.isArray(e)&&(r=e.length<3||e.length>4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:mi(e[0],e[1],e[2],e[3]),!r))return new jn(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new vi(r||`Could not parse color from value '${\"string\"==typeof e?e:String(JSON.stringify(e))}'`)}if(\"number\"===this.type.kind){let e=null;for(const r of this.args){if(e=r.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new vi(`Could not convert ${JSON.stringify(e)} to number.`)}return \"formatted\"===this.type.kind?fi.fromString(xi(this.args[0].evaluate(t))):\"resolvedImage\"===this.type.kind?di.fromString(xi(this.args[0].evaluate(t))):\"array\"===this.type.kind?this.args.map((e=>e.evaluate(t))):xi(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t);}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){if(\"formatted\"===this.type.kind)return new Mi([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(\"resolvedImage\"===this.type.kind)return new Ai(this.args[0]).serialize();const t=\"array\"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild((e=>{t.push(e.serialize());})),t}}const Pi=[\"Unknown\",\"Point\",\"LineString\",\"Polygon\"];class Ei{constructor(t,e){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=t,this.options=e;}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?\"number\"==typeof this.feature.type?Pi[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&\"geometry\"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(t){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const t=this.featureDistanceData.center,e=this.featureDistanceData.scale,{x:r,y:n}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(r*e-t[0])+this.featureDistanceData.bearing[1]*(n*e-t[1])}return 0}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=jn.parse(t)),e}getConfig(t){return this.options?this.options.get(t):null}}class zi{constructor(t,e,r,n,i){this.name=t,this.type=e,this._evaluate=r,this.args=n,this._overloadIndex=i;}evaluate(t){if(!this._evaluate){const t=zi.definitions[this.name];this._evaluate=Array.isArray(t)?t[2]:t.overloads[this._overloadIndex][1];}return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t);}outputDefined(){return !1}serialize(){return [this.name].concat(this.args.map((t=>t.serialize())))}static parse(t,e){const r=t[0],n=zi.definitions[r];if(!n)return e.error(`Unknown expression \"${r}\". If you wanted a literal array, use [\"literal\", [...]].`,0);const i=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,a=[];let o=null,l=-1;for(const[n,u]of s){if(Array.isArray(n)&&n.length!==t.length-1)continue;a.push(n),l++,o=new qs(e.registry,e.path,null,e.scope,void 0,e._scope,e.options);const s=[];let c=!1;for(let e=1;e<t.length;e++){const r=t[e],i=Array.isArray(n)?n[e-1]:n.type,a=o.parse(r,1+s.length,i);if(!a){c=!0;break}s.push(a);}if(!c)if(Array.isArray(n)&&n.length!==s.length)o.error(`Expected ${n.length} arguments, but found ${s.length} instead.`);else {for(let t=0;t<s.length;t++){const e=Array.isArray(n)?n[t]:n.type,r=s[t];o.concat(t+1).checkSubtype(e,r.type);}if(0===o.errors.length)return new zi(r,i,u,s,l)}}if(1===a.length)e.errors.push(...o.errors);else {const r=(a.length?a:s.map((([t])=>t))).map(Ti).join(\" | \"),n=[];for(let r=1;r<t.length;r++){const i=e.parse(t[r],1+n.length);if(!i)return null;n.push(ai(i.type));}e.error(`Expected arguments of type ${r}, but found (${n.join(\", \")}) instead.`);}return null}static register(t,e){zi.definitions=e;for(const r in e)t[r]=zi;}}function Ti(t){return Array.isArray(t)?`(${t.map(ai).join(\", \")})`:`(${ai(t.type)}...)`}class Bi{constructor(t,e,r){this.type=ri,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e;}static parse(t,e){if(2!==t.length)return e.error(\"Expected one argument.\");const r=t[1];if(\"object\"!=typeof r||Array.isArray(r))return e.error(\"Collator options argument must be an object.\");const n=e.parse(void 0!==r[\"case-sensitive\"]&&r[\"case-sensitive\"],1,Hn);if(!n)return null;const i=e.parse(void 0!==r[\"diacritic-sensitive\"]&&r[\"diacritic-sensitive\"],1,Hn);if(!i)return null;let s=null;return r.locale&&(s=e.parse(r.locale,1,Wn),!s)?null:new Bi(n,i,s)}evaluate(t){return new hi(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale);}outputDefined(){return !1}serialize(){const t={};return t[\"case-sensitive\"]=this.caseSensitive.serialize(),t[\"diacritic-sensitive\"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),[\"collator\",t]}}var Ci={exports:{}};Ci.exports=function(){function t(r,n,i,s,a){for(;s>i;){if(s-i>600){var o=s-i+1,l=n-i+1,u=Math.log(o),c=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*c*(o-c)/o)*(l-o/2<0?-1:1);t(r,n,Math.max(i,Math.floor(n-l*c/o+h)),Math.min(s,Math.floor(n+(o-l)*c/o+h)),a);}var p=r[n],f=i,d=s;for(e(r,i,n),a(r[s],p)>0&&e(r,i,s);f<d;){for(e(r,f,d),f++,d--;a(r[f],p)<0;)f++;for(;a(r[d],p)>0;)d--;}0===a(r[i],p)?e(r,i,d):e(r,++d,s),d<=n&&(i=d+1),n<=d&&(s=d-1);}}function e(t,e,r){var n=t[e];t[e]=t[r],t[r]=n;}function r(t,e){return t<e?-1:t>e?1:0}return function(e,n,i,s,a){t(e,n,i||0,s||e.length-1,a||r);}}();var Ri=h(Ci.exports);function Vi(t){let e=0;for(let r,n,i=0,s=t.length,a=s-1;i<s;a=i++)r=t[i],n=t[a],e+=(n.x-r.x)*(r.y+n.y);return e}function Di(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1]);}function Li(t,e){return !(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Fi(t,e,r){const n=t[0]-e[0],i=t[1]-e[1],s=t[0]-r[0],a=t[1]-r[1];return n*a-s*i==0&&n*s<=0&&i*a<=0}function Oi(t,e,r=!1){let n=!1;for(let o=0,l=e.length;o<l;o++){const l=e[o];for(let e=0,o=l.length,u=o-1;e<o;u=e++){const o=l[u],c=l[e];if(Fi(t,o,c))return r;(s=o)[1]>(i=t)[1]!=(a=c)[1]>i[1]&&i[0]<(a[0]-s[0])*(i[1]-s[1])/(a[1]-s[1])+s[0]&&(n=!n);}}var i,s,a;return n}function Ui(t,e,r,n){const i=n[0]-r[0],s=n[1]-r[1],a=(t[0]-r[0])*s-i*(t[1]-r[1]),o=(e[0]-r[0])*s-i*(e[1]-r[1]);return a>0&&o<0||a<0&&o>0}function Ni(t,e,r,n){return 0!=(i=[n[0]-r[0],n[1]-r[1]])[0]*(s=[e[0]-t[0],e[1]-t[1]])[1]-i[1]*s[0]&&!(!Ui(t,e,r,n)||!Ui(r,n,t,e));var i,s;}const ji=8192;function qi(t,e){const r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return [Math.round(r*i*ji),Math.round(n*i*ji)]}function $i(t,e){for(let r=0;r<e.length;r++)if(Oi(t,e[r]))return !0;return !1}function Gi(t,e,r){for(const n of r)for(let r=0,i=n.length,s=i-1;r<i;s=r++)if(Ni(t,e,n[s],n[r]))return !0;return !1}function Qi(t,e){for(let r=0;r<t.length;++r)if(!Oi(t[r],e))return !1;for(let r=0;r<t.length-1;++r)if(Gi(t[r],t[r+1],e))return !1;return !0}function Yi(t,e){for(let r=0;r<e.length;r++)if(Qi(t,e[r]))return !0;return !1}function Xi(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=[];for(let n=0;n<t[i].length;n++){const a=qi(t[i][n],r);Di(e,a),s.push(a);}n.push(s);}return n}function Zi(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=Xi(t[i],e,r);n.push(s);}return n}function Ki(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){const e=.5*n;let i=t[0]-r[0]>e?-n:r[0]-t[0]>e?n:0;0===i&&(i=t[0]-r[2]>e?-n:r[2]-t[0]>e?n:0),t[0]+=i;}Di(e,t);}function Wi(t,e,r,n){const i=Math.pow(2,n.z)*ji,s=[n.x*ji,n.y*ji],a=[];if(!t)return a;for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];Ki(n,e,r,i),a.push(n);}return a}function Hi(t,e,r,n){const i=Math.pow(2,n.z)*ji,s=[n.x*ji,n.y*ji],a=[];if(!t)return a;for(const r of t){const t=[];for(const n of r){const r=[n.x+s[0],n.y+s[1]];Di(e,r),t.push(r);}a.push(t);}if(e[2]-e[0]<=i/2){(o=e)[0]=o[1]=1/0,o[2]=o[3]=-1/0;for(const t of a)for(const n of t)Ki(n,e,r,i);}var o;return a}class Ji{constructor(t,e){this.type=Hn,this.geojson=t,this.geometries=e;}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(yi(t[1])){const e=t[1];if(\"FeatureCollection\"===e.type)for(let t=0;t<e.features.length;++t){const r=e.features[t].geometry.type;if(\"Polygon\"===r||\"MultiPolygon\"===r)return new Ji(e,e.features[t].geometry)}else if(\"Feature\"===e.type){const t=e.geometry.type;if(\"Polygon\"===t||\"MultiPolygon\"===t)return new Ji(e,e.geometry)}else if(\"Polygon\"===e.type||\"MultiPolygon\"===e.type)return new Ji(e,e)}return e.error(\"'within' expression requires valid geojson object that contains polygon geometry type.\")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if(\"Point\"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(!i)return !1;if(\"Polygon\"===e.type){const s=Xi(e.coordinates,n,i),a=Wi(t.geometry(),r,n,i);if(!Li(r,n))return !1;for(const t of a)if(!Oi(t,s))return !1}if(\"MultiPolygon\"===e.type){const s=Zi(e.coordinates,n,i),a=Wi(t.geometry(),r,n,i);if(!Li(r,n))return !1;for(const t of a)if(!$i(t,s))return !1}return !0}(t,this.geometries);if(\"LineString\"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(!i)return !1;if(\"Polygon\"===e.type){const s=Xi(e.coordinates,n,i),a=Hi(t.geometry(),r,n,i);if(!Li(r,n))return !1;for(const t of a)if(!Qi(t,s))return !1}if(\"MultiPolygon\"===e.type){const s=Zi(e.coordinates,n,i),a=Hi(t.geometry(),r,n,i);if(!Li(r,n))return !1;for(const t of a)if(!Yi(t,s))return !1}return !0}(t,this.geometries)}return !1}eachChild(){}outputDefined(){return !0}serialize(){return [\"within\",this.geojson]}}var ts={exports:{}};!function(t,e){t.exports=function(){var t={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},e=1/298.257223563,r=e*(2-e),n=Math.PI/180,i=function(e,i){if(void 0===e)throw new Error(\"No latitude given.\");if(i&&!t[i])throw new Error(\"Unknown unit \"+i+\". Use one of: \"+Object.keys(t).join(\", \"));var s=6378.137*n*(i?t[i]:1),a=Math.cos(e*n),o=1/(1-r*(1-a*a)),l=Math.sqrt(o);this.kx=s*l*a,this.ky=s*l*o*(1-r);},s={units:{configurable:!0}};function a(t,e){return t[0]===e[0]&&t[1]===e[1]}function o(t,e,r){var n=l(e[0]-t[0]);return [t[0]+n*r,t[1]+(e[1]-t[1])*r]}function l(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}return i.fromTile=function(t,e,r){var s=Math.PI*(1-2*(t+.5)/Math.pow(2,e)),a=Math.atan(.5*(Math.exp(s)-Math.exp(-s)))/n;return new i(a,r)},s.units.get=function(){return t},i.prototype.distance=function(t,e){var r=l(t[0]-e[0])*this.kx,n=(t[1]-e[1])*this.ky;return Math.sqrt(r*r+n*n)},i.prototype.bearing=function(t,e){var r=l(e[0]-t[0])*this.kx;return Math.atan2(r,(e[1]-t[1])*this.ky)/n},i.prototype.destination=function(t,e,r){var i=r*n;return this.offset(t,Math.sin(i)*e,Math.cos(i)*e)},i.prototype.offset=function(t,e,r){return [t[0]+e/this.kx,t[1]+r/this.ky]},i.prototype.lineDistance=function(t){for(var e=0,r=0;r<t.length-1;r++)e+=this.distance(t[r],t[r+1]);return e},i.prototype.area=function(t){for(var e=0,r=0;r<t.length;r++)for(var n=t[r],i=0,s=n.length,a=s-1;i<s;a=i++)e+=l(n[i][0]-n[a][0])*(n[i][1]+n[a][1])*(r?-1:1);return Math.abs(e)/2*this.kx*this.ky},i.prototype.along=function(t,e){var r=0;if(e<=0)return t[0];for(var n=0;n<t.length-1;n++){var i=t[n],s=t[n+1],a=this.distance(i,s);if((r+=a)>e)return o(i,s,(e-(r-a))/a)}return t[t.length-1]},i.prototype.pointToSegmentDistance=function(t,e,r){var n=e[0],i=e[1],s=l(r[0]-n)*this.kx,a=(r[1]-i)*this.ky,o=0;return 0===s&&0===a||((o=(l(t[0]-n)*this.kx*s+(t[1]-i)*this.ky*a)/(s*s+a*a))>1?(n=r[0],i=r[1]):o>0&&(n+=s/this.kx*o,i+=a/this.ky*o)),s=l(t[0]-n)*this.kx,a=(t[1]-i)*this.ky,Math.sqrt(s*s+a*a)},i.prototype.pointOnLine=function(t,e){for(var r,n,i,s,a=1/0,o=0;o<t.length-1;o++){var u=t[o][0],c=t[o][1],h=l(t[o+1][0]-u)*this.kx,p=(t[o+1][1]-c)*this.ky,f=0;0===h&&0===p||((f=(l(e[0]-u)*this.kx*h+(e[1]-c)*this.ky*p)/(h*h+p*p))>1?(u=t[o+1][0],c=t[o+1][1]):f>0&&(u+=h/this.kx*f,c+=p/this.ky*f));var d=(h=l(e[0]-u)*this.kx)*h+(p=(e[1]-c)*this.ky)*p;d<a&&(a=d,r=u,n=c,i=o,s=f);}return {point:[r,n],index:i,t:Math.max(0,Math.min(1,s))}},i.prototype.lineSlice=function(t,e,r){var n=this.pointOnLine(r,t),i=this.pointOnLine(r,e);if(n.index>i.index||n.index===i.index&&n.t>i.t){var s=n;n=i,i=s;}var o=[n.point],l=n.index+1,u=i.index;!a(r[l],o[0])&&l<=u&&o.push(r[l]);for(var c=l+1;c<=u;c++)o.push(r[c]);return a(r[u],i.point)||o.push(i.point),o},i.prototype.lineSliceAlong=function(t,e,r){for(var n=0,i=[],s=0;s<r.length-1;s++){var a=r[s],l=r[s+1],u=this.distance(a,l);if((n+=u)>t&&0===i.length&&i.push(o(a,l,(t-(n-u))/u)),n>=e)return i.push(o(a,l,(e-(n-u))/u)),i;n>t&&i.push(l);}return i},i.prototype.bufferPoint=function(t,e){var r=e/this.ky,n=e/this.kx;return [t[0]-n,t[1]-r,t[0]+n,t[1]+r]},i.prototype.bufferBBox=function(t,e){var r=e/this.ky,n=e/this.kx;return [t[0]-n,t[1]-r,t[2]+n,t[3]+r]},i.prototype.insideBBox=function(t,e){return l(t[0]-e[0])>=0&&l(t[0]-e[2])<=0&&t[1]>=e[1]&&t[1]<=e[3]},Object.defineProperties(i,s),i}();}(ts);var es=h(ts.exports),rs={exports:{}};!function(t,e){t.exports=function(){var t=function(t,r){if(void 0===t&&(t=[]),void 0===r&&(r=e),this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(var n=(this.length>>1)-1;n>=0;n--)this._down(n);};function e(t,e){return t<e?-1:t>e?1:0}return t.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1);},t.prototype.pop=function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}},t.prototype.peek=function(){return this.data[0]},t.prototype._up=function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,s=e[i];if(r(n,s)>=0)break;e[t]=s,t=i;}e[t]=n;},t.prototype._down=function(t){for(var e=this.data,r=this.compare,n=this.length>>1,i=e[t];t<n;){var s=1+(t<<1),a=e[s],o=s+1;if(o<this.length&&r(e[o],a)<0&&(s=o,a=e[o]),r(a,i)>=0)break;e[t]=a,t=s;}e[t]=i;},t}();}(rs);var ns=h(rs.exports),is=8192;function ss(t,e){return e.dist-t.dist}const as=100,os=50;function ls(t){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==t.length)return !1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return !1;return !0}function us(t){return t[1]-t[0]+1}function cs(t,e){const r=t[1]>=t[0]&&t[1]<e;return r||console.warn(\"Distance Expression: Index is out of range\"),r}function hs(t,e){if(t[0]>t[1])return [null,null];const r=us(t);if(e){if(2===r)return [t,null];const e=Math.floor(r/2);return [[t[0],t[0]+e],[t[0]+e,t[1]]]}{if(1===r)return [t,null];const e=Math.floor(r/2)-1;return [[t[0],t[0]+e],[t[0]+e+1,t[1]]]}}function ps(t,e){const r=[1/0,1/0,-1/0,-1/0];if(!cs(e,t.length))return r;for(let n=e[0];n<=e[1];++n)Di(r,t[n]);return r}function fs(t){const e=[1/0,1/0,-1/0,-1/0];for(let r=0;r<t.length;++r)for(let n=0;n<t[r].length;++n)Di(e,t[r][n]);return e}function ds(t,e,r){if(ls(t)||ls(e))return NaN;let n=0,i=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(i=t[1]-e[3]),t[3]<e[1]&&(i=e[1]-t[3]),r.distance([0,0],[n,i])}function ms(t){return 360*t-180}function ys(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function gs(t,e){const r=Math.pow(2,e.z),n=(t.y/is+e.y)/r;return [ms((t.x/is+e.x)/r),ys(n)]}function xs(t,e){const r=[];for(let n=0;n<t.length;++n)r.push(gs(t[n],e));return r}function bs(t,e,r){const n=r.pointOnLine(e,t).point;return r.distance(t,n)}function vs(t,e,r,n,i){const s=r.slice(n[0],n[1]+1);let a=1/0;for(let r=e[0];r<=e[1];++r)if(0===(a=Math.min(a,bs(t[r],s,i))))return 0;return a}function _s(t,e,r,n,i){const s=Math.min(i.pointToSegmentDistance(t,r,n),i.pointToSegmentDistance(e,r,n)),a=Math.min(i.pointToSegmentDistance(r,t,e),i.pointToSegmentDistance(n,t,e));return Math.min(s,a)}function ws(t,e,r,n,i){if(!cs(e,t.length)||!cs(n,r.length))return NaN;let s=1/0;for(let a=e[0];a<e[1];++a)for(let e=n[0];e<n[1];++e){if(Ni(t[a],t[a+1],r[e],r[e+1]))return 0;s=Math.min(s,_s(t[a],t[a+1],r[e],r[e+1],i));}return s}function Ms(t,e,r,n,i){if(!cs(e,t.length)||!cs(n,r.length))return NaN;let s=1/0;for(let a=e[0];a<=e[1];++a)for(let e=n[0];e<=n[1];++e)if(0===(s=Math.min(s,i.distance(t[a],r[e]))))return s;return s}function As(t,e,r){if(Oi(t,e,!0))return 0;let n=1/0;for(const i of e){const e=i.length;if(e<2)return console.warn(\"Distance Expression: Invalid polygon!\"),NaN;if(i[0]!==i[e-1]&&0===(n=Math.min(n,r.pointToSegmentDistance(t,i[e-1],i[0]))))return n;if(0===(n=Math.min(n,bs(t,i,r))))return n}return n}function Ss(t,e,r,n){if(!cs(e,t.length))return NaN;for(let n=e[0];n<=e[1];++n)if(Oi(t[n],r,!0))return 0;let i=1/0;for(let s=e[0];s<e[1];++s)for(const e of r)for(let r=0,a=e.length,o=a-1;r<a;o=r++){if(Ni(t[s],t[s+1],e[o],e[r]))return 0;i=Math.min(i,_s(t[s],t[s+1],e[o],e[r],n));}return i}function Is(t,e){for(const r of t)for(let t=0;t<=r.length-1;++t)if(Oi(r[t],e,!0))return !0;return !1}function ks(t,e,r,n=1/0){const i=fs(t),s=fs(e);if(n!==1/0&&ds(i,s,r)>=n)return n;if(Li(i,s)){if(Is(t,e))return 0}else if(Is(e,t))return 0;let a=n;for(const n of t)for(let t=0,i=n.length,s=i-1;t<i;s=t++)for(const i of e)for(let e=0,o=i.length,l=o-1;e<o;l=e++){if(Ni(n[s],n[t],i[l],i[e]))return 0;a=Math.min(a,_s(n[s],n[t],i[l],i[e],r));}return a}function Ps(t,e,r,n,i,s,a){if(null===s||null===a)return;const o=ds(ps(n,s),ps(i,a),r);o<e&&t.push({dist:o,range1:s,range2:a});}function Es(t,e,r,n,i=1/0){let s=Math.min(n.distance(t[0],r[0][0]),i);if(0===s)return s;const a=new ns([{dist:0,range1:[0,t.length-1],range2:[0,0]}],ss),o=e?os:as,l=fs(r);for(;a.length;){const i=a.pop();if(i.dist>=s)continue;const u=i.range1;if(us(u)<=o){if(!cs(u,t.length))return NaN;if(e){const e=Ss(t,u,r,n);if(0===(s=Math.min(s,e)))return s}else for(let e=u[0];e<=u[1];++e){const i=As(t[e],r,n);if(0===(s=Math.min(s,i)))return s}}else {const r=hs(u,e);if(null!==r[0]){const e=ds(ps(t,r[0]),l,n);e<s&&a.push({dist:e,range1:r[0],range2:[0,0]});}if(null!==r[1]){const e=ds(ps(t,r[1]),l,n);e<s&&a.push({dist:e,range1:r[1],range2:[0,0]});}}}return s}function zs(t,e,r,n,i,s=1/0){let a=Math.min(s,i.distance(t[0],r[0]));if(0===a)return a;const o=new ns([{dist:0,range1:[0,t.length-1],range2:[0,r.length-1]}],ss),l=e?os:as,u=n?os:as;for(;o.length;){const s=o.pop();if(s.dist>=a)continue;const c=s.range1,h=s.range2;if(us(c)<=l&&us(h)<=u){if(!cs(c,t.length)||!cs(h,r.length))return NaN;if(e&&n?a=Math.min(a,ws(t,c,r,h,i)):e||n?e&&!n?a=Math.min(a,vs(r,h,t,c,i)):!e&&n&&(a=Math.min(a,vs(t,c,r,h,i))):a=Math.min(a,Ms(t,c,r,h,i)),0===a)return a}else {const s=hs(c,e),l=hs(h,n);Ps(o,a,i,t,r,s[0],l[0]),Ps(o,a,i,t,r,s[0],l[1]),Ps(o,a,i,t,r,s[1],l[0]),Ps(o,a,i,t,r,s[1],l[1]);}}return a}function Ts(t,e,r,n,i=1/0){let s=i;const a=ps(t,[0,t.length-1]);for(const i of r)if(!(s!==1/0&&ds(a,ps(i,[0,i.length-1]),n)>=s)&&(s=Math.min(s,zs(t,e,i,!0,n,s)),0===s))return s;return s}function Bs(t,e,r,n,i=1/0){let s=i;const a=ps(t,[0,t.length-1]);for(const i of r){if(s!==1/0&&ds(a,fs(i),n)>=s)continue;const r=Es(t,e,i,n,s);if(isNaN(r))return r;if(0===(s=Math.min(s,r)))return s}return s}function Cs(t){return \"Point\"===t||\"MultiPoint\"===t||\"LineString\"===t||\"MultiLineString\"===t||\"Polygon\"===t||\"MultiPolygon\"===t}class Rs{constructor(t,e){this.type=Kn,this.geojson=t,this.geometries=e;}static parse(t,e){if(2!==t.length)return e.error(`'distance' expression requires either one argument, but found ' ${t.length-1} instead.`);if(yi(t[1])){const e=t[1];if(\"FeatureCollection\"===e.type){for(let t=0;t<e.features.length;++t)if(Cs(e.features[t].geometry.type))return new Rs(e,e.features[t].geometry)}else if(\"Feature\"===e.type){if(Cs(e.geometry.type))return new Rs(e,e.geometry)}else if(Cs(e.type))return new Rs(e,e)}return e.error(\"'distance' expression needs to be an array with format ['Distance', GeoJSONObj].\")}evaluate(t){const e=t.geometry(),r=t.canonicalID();if(null!=e&&null!=r){if(\"Point\"===t.geometryType())return function(t,e,r){const n=[];for(const r of t)for(const t of r)n.push(gs(t,e));const i=new es(n[0][1],\"meters\");return \"Point\"===r.type||\"MultiPoint\"===r.type||\"LineString\"===r.type?zs(n,!1,\"Point\"===r.type?[r.coordinates]:r.coordinates,\"LineString\"===r.type,i):\"MultiLineString\"===r.type?Ts(n,!1,r.coordinates,i):\"Polygon\"===r.type||\"MultiPolygon\"===r.type?Bs(n,!1,\"Polygon\"===r.type?[r.coordinates]:r.coordinates,i):null}(e,r,this.geometries);if(\"LineString\"===t.geometryType())return function(t,e,r){const n=[];for(const r of t){const t=[];for(const n of r)t.push(gs(n,e));n.push(t);}const i=new es(n[0][0][1],\"meters\");if(\"Point\"===r.type||\"MultiPoint\"===r.type||\"LineString\"===r.type)return Ts(\"Point\"===r.type?[r.coordinates]:r.coordinates,\"LineString\"===r.type,n,i);if(\"MultiLineString\"===r.type){let t=1/0;for(let e=0;e<r.coordinates.length;e++){const s=Ts(r.coordinates[e],!0,n,i,t);if(isNaN(s))return s;if(0===(t=Math.min(t,s)))return t}return t}if(\"Polygon\"===r.type||\"MultiPolygon\"===r.type){let t=1/0;for(let e=0;e<n.length;e++){const s=Bs(n[e],!0,\"Polygon\"===r.type?[r.coordinates]:r.coordinates,i,t);if(isNaN(s))return s;if(0===(t=Math.min(t,s)))return t}return t}return null}(e,r,this.geometries);if(\"Polygon\"===t.geometryType())return function(t,e,r){const n=[];for(const r of function(t,e){const r=t.length;if(r<=1)return [t];const n=[];let i,s;for(let e=0;e<r;e++){const r=Vi(t[e]);0!==r&&(t[e].area=Math.abs(r),void 0===s&&(s=r<0),s===r<0?(i&&n.push(i),i=[t[e]]):i.push(t[e]));}return i&&n.push(i),n}(t)){const t=[];for(let n=0;n<r.length;++n)t.push(xs(r[n],e));n.push(t);}const i=new es(n[0][0][0][1],\"meters\");if(\"Point\"===r.type||\"MultiPoint\"===r.type||\"LineString\"===r.type)return Bs(\"Point\"===r.type?[r.coordinates]:r.coordinates,\"LineString\"===r.type,n,i);if(\"MultiLineString\"===r.type){let t=1/0;for(let e=0;e<r.coordinates.length;e++){const s=Bs(r.coordinates[e],!0,n,i,t);if(isNaN(s))return s;if(0===(t=Math.min(t,s)))return t}return t}return \"Polygon\"===r.type||\"MultiPolygon\"===r.type?function(t,e,r){let n=1/0;for(const i of t)for(const t of e){const e=ks(i,t,r,n);if(isNaN(e))return e;if(0===(n=Math.min(n,e)))return n}return n}(\"Polygon\"===r.type?[r.coordinates]:r.coordinates,n,i):null}(e,r,this.geometries);console.warn(\"Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.\");}else console.warn(\"Distance Expression: requirs valid feature and canonical information.\");return null}eachChild(){}outputDefined(){return !0}serialize(){return [\"distance\",this.geojson]}}function Vs(t,e){switch(t){case\"string\":return xi(e);case\"number\":return +e;case\"boolean\":return !!e;case\"color\":return jn.parse(e);case\"formatted\":return fi.fromString(xi(e));case\"resolvedImage\":return di.fromString(xi(e))}return e}function Ds(t,e,r,n){return void 0!==n&&(t=n*Math.round(t/n)),void 0!==e&&t<e&&(t=e),void 0!==r&&t>r&&(t=r),t}class Ls{constructor(t,e,r){this.type=t,this.key=e,this.scope=r;}static parse(t,e){let r=e.expectedType;if(null==r&&(r=ei),t.length<2||t.length>3)return e.error(\"Invalid number of arguments for 'config' expression.\");const n=e.parse(t[1],1);if(!(n instanceof bi))return e.error(\"Key name of 'config' expression must be a string literal.\");if(t.length>=3){const i=e.parse(t[2],2);return i instanceof bi?new Ls(r,xi(n.value),xi(i.value)):e.error(\"Scope of 'config' expression must be a string literal.\")}return new Ls(r,xi(n.value))}evaluate(t){const e=[this.key,this.scope,t.scope].filter(Boolean).join(\"\u001f\"),r=t.getConfig(e);if(!r)return null;const{type:n,value:i,values:s,minValue:a,maxValue:o,stepValue:l}=r,u=r.default.evaluate(t);let c=u;if(i){const e=t.scope;t.scope=(e||\"\").split(\"\u001f\").slice(1).join(\"\u001f\"),c=i.evaluate(t),t.scope=e;}return n&&(c=Vs(n,c)),void 0===c||void 0===a&&void 0===o&&void 0===l||(\"number\"==typeof c?c=Ds(c,a,o,l):Array.isArray(c)&&(c=c.map((t=>\"number\"==typeof t?Ds(t,a,o,l):t)))),void 0!==i&&void 0!==c&&s&&!s.includes(c)&&(c=u,n&&(c=Vs(n,c))),(n&&n!==this.type||void 0!==c&&gi(c)!==this.type)&&(c=Vs(this.type.kind,c)),c}eachChild(){}outputDefined(){return !1}serialize(){const t=[\"config\",this.key];return this.scope&&t.concat(this.key),t}}function Fs(t){if(t instanceof zi){if(\"get\"===t.name&&1===t.args.length)return !1;if(\"feature-state\"===t.name)return !1;if(\"has\"===t.name&&1===t.args.length)return !1;if(\"properties\"===t.name||\"geometry-type\"===t.name||\"id\"===t.name)return !1;if(/^filter-/.test(t.name))return !1}if(t instanceof Ji)return !1;if(t instanceof Rs)return !1;let e=!0;return t.eachChild((t=>{e&&!Fs(t)&&(e=!1);})),e}function Os(t){if(t instanceof zi&&\"feature-state\"===t.name)return !1;let e=!0;return t.eachChild((t=>{e&&!Os(t)&&(e=!1);})),e}function Us(t){if(t instanceof Ls)return !1;let e=!0;return t.eachChild((t=>{e&&!Us(t)&&(e=!1);})),e}function Ns(t,e){if(t instanceof zi&&e.indexOf(t.name)>=0)return !1;let r=!0;return t.eachChild((t=>{r&&!Ns(t,e)&&(r=!1);})),r}class js{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e;}static parse(t,e){if(2!==t.length||\"string\"!=typeof t[1])return e.error(\"'var' expression requires exactly one string literal argument.\");const r=t[1];return e.scope.has(r)?new js(r,e.scope.get(r)):e.error(`Unknown variable \"${r}\". Make sure \"${r}\" has been bound in an enclosing \"let\" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return !1}serialize(){return [\"var\",this.name]}}class qs{constructor(t,e=[],r,n=new Xn,i=[],s,a){this.registry=t,this.path=e,this.key=e.map((t=>`[${t}]`)).join(\"\"),this.scope=n,this.errors=i,this.expectedType=r,this._scope=s,this.options=a;}parse(t,e,r,n,i={}){return e||r?this.concat(e,r,n)._parse(t,i):this._parse(t,i)}_parse(t,e){function r(t,e,r){return \"assert\"===r?new wi(e,[t]):\"coerce\"===r?new ki(e,[t]):t}if(null!==t&&\"string\"!=typeof t&&\"boolean\"!=typeof t&&\"number\"!=typeof t||(t=[\"literal\",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use [\"literal\", []].');const n=\"string\"==typeof t[0]?this.registry[t[0]]:void 0;if(n){let i=n.parse(t,this);if(!i)return null;if(this.expectedType){const t=this.expectedType,n=i.type;if(\"string\"!==t.kind&&\"number\"!==t.kind&&\"boolean\"!==t.kind&&\"object\"!==t.kind&&\"array\"!==t.kind||\"value\"!==n.kind)if(\"color\"!==t.kind&&\"formatted\"!==t.kind&&\"resolvedImage\"!==t.kind||\"value\"!==n.kind&&\"string\"!==n.kind){if(this.checkSubtype(t,n))return null}else i=r(i,t,e.typeAnnotation||\"coerce\");else i=r(i,t,e.typeAnnotation||\"assert\");}if(!(i instanceof bi)&&\"resolvedImage\"!==i.type.kind&&$s(i)){const t=new Ei(this._scope,this.options);try{i=new bi(i.type,i.evaluate(t));}catch(t){return this.error(t.message),null}}return i}return ki.parse([\"to-array\",t],this)}return this.error(void 0===t?\"'undefined' value invalid. Use null instead.\":\"object\"==typeof t?'Bare objects invalid. Use [\"literal\", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,r){const n=\"number\"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new qs(this.registry,n,e||null,i,this.errors,this._scope,this.options)}error(t,...e){const r=`${this.key}${e.map((t=>`[${t}]`)).join(\"\")}`;this.errors.push(new Yn(r,t));}checkSubtype(t,e){const r=li(t,e);return r&&this.error(r),r}}function $s(t){if(t instanceof js)return $s(t.boundExpression);if(t instanceof zi&&\"error\"===t.name)return !1;if(t instanceof Bi)return !1;if(t instanceof Ji)return !1;if(t instanceof Rs)return !1;if(t instanceof Ls)return !1;const e=t instanceof ki||t instanceof wi;let r=!0;return t.eachChild((t=>{r=e?r&&$s(t):r&&t instanceof bi;})),!!r&&Fs(t)&&Ns(t,[\"zoom\",\"heatmap-density\",\"line-progress\",\"raster-value\",\"sky-radial-progress\",\"accumulated\",\"is-supported-script\",\"pitch\",\"distance-from-center\",\"measure-light\",\"raster-particle-speed\"])}function Gs(t,e){const r=t.length-1;let n,i,s=0,a=r,o=0;for(;s<=a;)if(o=Math.floor((s+a)/2),n=t[o],i=t[o+1],n<=e){if(o===r||e<i)return o;s=o+1;}else {if(!(n>e))throw new vi(\"Input is not a number.\");a=o-1;}return 0}class Qs{constructor(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e);}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error(\"Expected an even number of arguments.\");const r=e.parse(t[1],1,Kn);if(!r)return null;const n=[];let i=null;e.expectedType&&\"value\"!==e.expectedType.kind&&(i=e.expectedType);for(let r=1;r<t.length;r+=2){const s=1===r?-1/0:t[r],a=t[r+1],o=r,l=r+1;if(\"number\"!=typeof s)return e.error('Input/output pairs for \"step\" expressions must be defined using literal numeric values (not computed expressions) for the input values.',o);if(n.length&&n[n.length-1][0]>=s)return e.error('Input/output pairs for \"step\" expressions must be arranged with input values in strictly ascending order.',o);const u=e.parse(a,l,i);if(!u)return null;i=i||u.type,n.push([s,u]);}return new Qs(i,r,n)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[Gs(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e);}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){const t=[\"step\",this.input.serialize()];for(let e=0;e<this.labels.length;e++)e>0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t}}const Ys=.95047,Xs=1.08883,Zs=4/29,Ks=6/29,Ws=3*Ks*Ks,Hs=Ks*Ks*Ks,Js=Math.PI/180,ta=180/Math.PI;function ea(t){return t>Hs?Math.pow(t,1/3):t/Ws+Zs}function ra(t){return t>Ks?t*t*t:Ws*(t-Zs)}function na(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function ia(t){return (t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function sa(t){const e=ia(t.r),r=ia(t.g),n=ia(t.b),i=ea((.4124564*e+.3575761*r+.1804375*n)/Ys),s=ea((.2126729*e+.7151522*r+.072175*n)/1);return {l:116*s-16,a:500*(i-s),b:200*(s-ea((.0193339*e+.119192*r+.9503041*n)/Xs)),alpha:t.a}}function aa(t){let e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*ra(e),r=Ys*ra(r),n=Xs*ra(n),new jn(na(3.2404542*r-1.5371385*e-.4985314*n),na(-.969266*r+1.8760108*e+.041556*n),na(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function oa(t,e,r){const n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}const la={forward:sa,reverse:aa,interpolate:function(t,e,r){return {l:qn(t.l,e.l,r),a:qn(t.a,e.a,r),b:qn(t.b,e.b,r),alpha:qn(t.alpha,e.alpha,r)}}},ua={forward:function(t){const{l:e,a:r,b:n}=sa(t),i=Math.atan2(n,r)*ta;return {h:i<0?i+360:i,c:Math.sqrt(r*r+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*Js,r=t.c;return aa({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return {h:oa(t.h,e.h,r),c:qn(t.c,e.c,r),l:qn(t.l,e.l,r),alpha:qn(t.alpha,e.alpha,r)}}};var ca=Object.freeze({__proto__:null,hcl:ua,lab:la});class ha{constructor(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e);}static interpolationFactor(t,e,r,n){let i=0;if(\"exponential\"===t.name)i=pa(e,t.base,r,n);else if(\"linear\"===t.name)i=pa(e,1,r,n);else if(\"cubic-bezier\"===t.name){const s=t.controlPoints;i=new Le(s[0],s[1],s[2],s[3]).solve(pa(e,1,r,n));}return i}static parse(t,e){let[r,n,i,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error(\"Expected an interpolation type expression.\",1);if(\"linear\"===n[0])n={name:\"linear\"};else if(\"exponential\"===n[0]){const t=n[1];if(\"number\"!=typeof t)return e.error(\"Exponential interpolation requires a numeric base.\",1,1);n={name:\"exponential\",base:t};}else {if(\"cubic-bezier\"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some((t=>\"number\"!=typeof t||t<0||t>1)))return e.error(\"Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.\",1);n={name:\"cubic-bezier\",controlPoints:t};}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error(\"Expected an even number of arguments.\");if(i=e.parse(i,2,Kn),!i)return null;const a=[];let o=null;\"interpolate-hcl\"===r||\"interpolate-lab\"===r?o=Jn:e.expectedType&&\"value\"!==e.expectedType.kind&&(o=e.expectedType);for(let t=0;t<s.length;t+=2){const r=s[t],n=s[t+1],i=t+3,l=t+4;if(\"number\"!=typeof r)return e.error('Input/output pairs for \"interpolate\" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(a.length&&a[a.length-1][0]>=r)return e.error('Input/output pairs for \"interpolate\" expressions must be arranged with input values in strictly ascending order.',i);const u=e.parse(n,l,o);if(!u)return null;o=o||u.type,a.push([r,u]);}return \"number\"===o.kind||\"color\"===o.kind||\"array\"===o.kind&&\"number\"===o.itemType.kind&&\"number\"==typeof o.N?new ha(o,r,n,i,a):e.error(`Type ${ai(o)} is not interpolatable.`)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);const s=Gs(e,n),a=ha.interpolationFactor(this.interpolation,n,e[s],e[s+1]),o=r[s].evaluate(t),l=r[s+1].evaluate(t);return \"interpolate\"===this.operator?Gn[this.type.kind.toLowerCase()](o,l,a):\"interpolate-hcl\"===this.operator?ua.reverse(ua.interpolate(ua.forward(o),ua.forward(l),a)):la.reverse(la.interpolate(la.forward(o),la.forward(l),a))}eachChild(t){t(this.input);for(const e of this.outputs)t(e);}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){let t;t=\"linear\"===this.interpolation.name?[\"linear\"]:\"exponential\"===this.interpolation.name?1===this.interpolation.base?[\"linear\"]:[\"exponential\",this.interpolation.base]:[\"cubic-bezier\"].concat(this.interpolation.controlPoints);const e=[this.operator,t,this.input.serialize()];for(let t=0;t<this.labels.length;t++)e.push(this.labels[t],this.outputs[t].serialize());return e}}function pa(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}class fa{constructor(t,e){this.type=t,this.args=e;}static parse(t,e){if(t.length<2)return e.error(\"Expectected at least one argument.\");let r=null;const n=e.expectedType;n&&\"value\"!==n.kind&&(r=n);const i=[];for(const n of t.slice(1)){const t=e.parse(n,1+i.length,r,void 0,{typeAnnotation:\"omit\"});if(!t)return null;r=r||t.type,i.push(t);}const s=n&&i.some((t=>li(n,t.type)));return new fa(s?ei:r,i)}evaluate(t){let e,r=null,n=0;for(const i of this.args){if(n++,r=i.evaluate(t),r&&r instanceof di&&!r.available&&(e||(e=r),r=null,n===this.args.length))return e;if(null!==r)break}return r}eachChild(t){this.args.forEach(t);}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=[\"coalesce\"];return this.eachChild((e=>{t.push(e.serialize());})),t}}class da{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e;}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result);}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const r=[];for(let n=1;n<t.length-1;n+=2){const i=t[n];if(\"string\"!=typeof i)return e.error(`Expected string, but found ${typeof i} instead.`,n);if(/[^a-zA-Z0-9_]/.test(i))return e.error(\"Variable names must contain only alphanumeric characters or '_'.\",n);const s=e.parse(t[n+1],n+1);if(!s)return null;r.push([i,s]);}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,r);return n?new da(r,n):null}outputDefined(){return this.result.outputDefined()}serialize(){const t=[\"let\"];for(const[e,r]of this.bindings)t.push(e,r.serialize());return t.push(this.result.serialize()),t}}class ma{constructor(t,e,r){this.type=t,this.index=e,this.input=r;}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,Kn),n=e.parse(t[2],2,si(e.expectedType||ei));return r&&n?new ma(n.type.itemType,r,n):null}evaluate(t){const e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new vi(`Array index out of bounds: ${e} < 0.`);if(e>=r.length)throw new vi(`Array index out of bounds: ${e} > ${r.length-1}.`);if(e!==Math.floor(e))throw new vi(`Array index must be an integer, but found ${e} instead.`);return r[e]}eachChild(t){t(this.index),t(this.input);}outputDefined(){return !1}serialize(){return [\"at\",this.index.serialize(),this.input.serialize()]}}class ya{constructor(t,e){this.type=Hn,this.needle=t,this.haystack=e;}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,ei),n=e.parse(t[2],2,ei);return r&&n?ui(r.type,[Hn,Wn,Kn,Zn,ei])?new ya(r,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${ai(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(null==r)return !1;if(!ci(e,[\"boolean\",\"string\",\"number\",\"null\"]))throw new vi(`Expected first argument to be of type boolean, string, number or null, but found ${ai(gi(e))} instead.`);if(!ci(r,[\"string\",\"array\"]))throw new vi(`Expected second argument to be of type array or string, but found ${ai(gi(r))} instead.`);return r.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack);}outputDefined(){return !0}serialize(){return [\"in\",this.needle.serialize(),this.haystack.serialize()]}}class ga{constructor(t,e,r){this.type=Kn,this.needle=t,this.haystack=e,this.fromIndex=r;}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,ei),n=e.parse(t[2],2,ei);if(!r||!n)return null;if(!ui(r.type,[Hn,Wn,Kn,Zn,ei]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${ai(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,Kn);return i?new ga(r,n,i):null}return new ga(r,n)}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!ci(e,[\"boolean\",\"string\",\"number\",\"null\"]))throw new vi(`Expected first argument to be of type boolean, string, number or null, but found ${ai(gi(e))} instead.`);if(!ci(r,[\"string\",\"array\"]))throw new vi(`Expected second argument to be of type array or string, but found ${ai(gi(r))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex);}outputDefined(){return !1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return [\"index-of\",this.needle.serialize(),this.haystack.serialize(),t]}return [\"index-of\",this.needle.serialize(),this.haystack.serialize()]}}class xa{constructor(t,e,r,n,i,s){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=s;}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error(\"Expected an even number of arguments.\");let r,n;e.expectedType&&\"value\"!==e.expectedType.kind&&(n=e.expectedType);const i={},s=[];for(let a=2;a<t.length-1;a+=2){let o=t[a];const l=t[a+1];Array.isArray(o)||(o=[o]);const u=e.concat(a);if(0===o.length)return u.error(\"Expected at least one branch label.\");for(const t of o){if(\"number\"!=typeof t&&\"string\"!=typeof t)return u.error(\"Branch labels must be numbers or strings.\");if(\"number\"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(\"number\"==typeof t&&Math.floor(t)!==t)return u.error(\"Numeric branch labels must be integer values.\");if(r){if(u.checkSubtype(r,gi(t)))return null}else r=gi(t);if(void 0!==i[String(t)])return u.error(\"Branch labels must be unique.\");i[String(t)]=s.length;}const c=e.parse(l,a,n);if(!c)return null;n=n||c.type,s.push(c);}const a=e.parse(t[1],1,ei);if(!a)return null;const o=e.parse(t[t.length-1],t.length-1,n);return o?\"value\"!==a.type.kind&&e.concat(1).checkSubtype(r,a.type)?null:new xa(r,n,a,i,s,o):null}evaluate(t){const e=this.input.evaluate(t);return (gi(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise);}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=[\"match\",this.input.serialize()],e=Object.keys(this.cases).sort(),r=[],n={};for(const t of e){const e=n[this.cases[t]];void 0===e?(n[this.cases[t]]=r.length,r.push([this.cases[t],[t]])):r[e][1].push(t);}const i=t=>\"number\"===this.inputType.kind?Number(t):t;for(const[e,n]of r)t.push(1===n.length?i(n[0]):n.map(i)),t.push(this.outputs[e].serialize());return t.push(this.otherwise.serialize()),t}}class ba{constructor(t,e,r){this.type=t,this.branches=e,this.otherwise=r;}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error(\"Expected an odd number of arguments.\");let r;e.expectedType&&\"value\"!==e.expectedType.kind&&(r=e.expectedType);const n=[];for(let i=1;i<t.length-1;i+=2){const s=e.parse(t[i],i,Hn);if(!s)return null;const a=e.parse(t[i+1],i+1,r);if(!a)return null;n.push([s,a]),r=r||a.type;}const i=e.parse(t[t.length-1],t.length-1,r);return i?new ba(r,n,i):null}evaluate(t){for(const[e,r]of this.branches)if(e.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,r]of this.branches)t(e),t(r);t(this.otherwise);}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=[\"case\"];return this.eachChild((e=>{t.push(e.serialize());})),t}}class va{constructor(t,e,r,n){this.type=t,this.input=e,this.beginIndex=r,this.endIndex=n;}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,ei),n=e.parse(t[2],2,Kn);if(!r||!n)return null;if(!ui(r.type,[si(ei),Wn,ei]))return e.error(`Expected first argument to be of type array or string, but found ${ai(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,Kn);return i?new va(r.type,r,n,i):null}return new va(r.type,r,n)}evaluate(t){const e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!ci(e,[\"string\",\"array\"]))throw new vi(`Expected first argument to be of type array or string, but found ${ai(gi(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex);}outputDefined(){return !1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return [\"slice\",this.input.serialize(),this.beginIndex.serialize(),t]}return [\"slice\",this.input.serialize(),this.beginIndex.serialize()]}}function _a(t,e){return \"==\"===t||\"!=\"===t?\"boolean\"===e.kind||\"string\"===e.kind||\"number\"===e.kind||\"null\"===e.kind||\"value\"===e.kind:\"string\"===e.kind||\"number\"===e.kind||\"value\"===e.kind}function wa(t,e,r,n){return 0===n.compare(e,r)}function Ma(t,e,r){const n=\"==\"!==t&&\"!=\"!==t;return class i{constructor(t,e,r){this.type=Hn,this.lhs=t,this.rhs=e,this.collator=r,this.hasUntypedArgument=\"value\"===t.type.kind||\"value\"===e.type.kind;}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error(\"Expected two or three arguments.\");const r=t[0];let s=e.parse(t[1],1,ei);if(!s)return null;if(!_a(r,s.type))return e.concat(1).error(`\"${r}\" comparisons are not supported for type '${ai(s.type)}'.`);let a=e.parse(t[2],2,ei);if(!a)return null;if(!_a(r,a.type))return e.concat(2).error(`\"${r}\" comparisons are not supported for type '${ai(a.type)}'.`);if(s.type.kind!==a.type.kind&&\"value\"!==s.type.kind&&\"value\"!==a.type.kind)return e.error(`Cannot compare types '${ai(s.type)}' and '${ai(a.type)}'.`);n&&(\"value\"===s.type.kind&&\"value\"!==a.type.kind?s=new wi(a.type,[s]):\"value\"!==s.type.kind&&\"value\"===a.type.kind&&(a=new wi(s.type,[a])));let o=null;if(4===t.length){if(\"string\"!==s.type.kind&&\"string\"!==a.type.kind&&\"value\"!==s.type.kind&&\"value\"!==a.type.kind)return e.error(\"Cannot use collator to compare non-string types.\");if(o=e.parse(t[3],3,ri),!o)return null}return new i(s,a,o)}evaluate(i){const s=this.lhs.evaluate(i),a=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){const e=gi(s),r=gi(a);if(e.kind!==r.kind||\"string\"!==e.kind&&\"number\"!==e.kind)throw new vi(`Expected arguments for \"${t}\" to be (string, string) or (number, number), but found (${e.kind}, ${r.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=gi(s),r=gi(a);if(\"string\"!==t.kind||\"string\"!==r.kind)return e(i,s,a)}return this.collator?r(i,s,a,this.collator.evaluate(i)):e(i,s,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator);}outputDefined(){return !0}serialize(){const e=[t];return this.eachChild((t=>{e.push(t.serialize());})),e}}}const Aa=Ma(\"==\",(function(t,e,r){return e===r}),wa),Sa=Ma(\"!=\",(function(t,e,r){return e!==r}),(function(t,e,r,n){return !wa(0,e,r,n)})),Ia=Ma(\"<\",(function(t,e,r){return e<r}),(function(t,e,r,n){return n.compare(e,r)<0})),ka=Ma(\">\",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),Pa=Ma(\"<=\",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),Ea=Ma(\">=\",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0}));class za{constructor(t,e,r,n,i,s){this.type=Wn,this.number=t,this.locale=e,this.currency=r,this.unit=n,this.minFractionDigits=i,this.maxFractionDigits=s;}static parse(t,e){if(3!==t.length)return e.error(\"Expected two arguments.\");const r=e.parse(t[1],1,Kn);if(!r)return null;const n=t[2];if(\"object\"!=typeof n||Array.isArray(n))return e.error(\"NumberFormat options argument must be an object.\");let i=null;if(n.locale&&(i=e.parse(n.locale,1,Wn),!i))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,Wn),!s))return null;let a=null;if(n.unit&&(a=e.parse(n.unit,1,Wn),!a))return null;let o=null;if(n[\"min-fraction-digits\"]&&(o=e.parse(n[\"min-fraction-digits\"],1,Kn),!o))return null;let l=null;return n[\"max-fraction-digits\"]&&(l=e.parse(n[\"max-fraction-digits\"],1,Kn),!l)?null:new za(r,i,s,a,o,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:(this.currency?\"currency\":this.unit&&\"unit\")||\"decimal\",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits);}outputDefined(){return !1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.unit&&(t.unit=this.unit.serialize()),this.minFractionDigits&&(t[\"min-fraction-digits\"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t[\"max-fraction-digits\"]=this.maxFractionDigits.serialize()),[\"number-format\",this.number.serialize(),t]}}class Ta{constructor(t){this.type=Kn,this.input=t;}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=e.parse(t[1],1);return r?\"array\"!==r.type.kind&&\"string\"!==r.type.kind&&\"value\"!==r.type.kind?e.error(`Expected argument of type string or array, but found ${ai(r.type)} instead.`):new Ta(r):null}evaluate(t){const e=this.input.evaluate(t);if(\"string\"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new vi(`Expected value to be of type string or array, but found ${ai(gi(e))} instead.`)}eachChild(t){t(this.input);}outputDefined(){return !1}serialize(){const t=[\"length\"];return this.eachChild((e=>{t.push(e.serialize());})),t}}function Ba(t){return function(){t=1831565813+(t|=0)|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const Ca={\"==\":Aa,\"!=\":Sa,\">\":ka,\"<\":Ia,\">=\":Ea,\"<=\":Pa,array:wi,at:ma,boolean:wi,case:ba,coalesce:fa,collator:Bi,format:Mi,image:Ai,in:ya,\"index-of\":ga,interpolate:ha,\"interpolate-hcl\":ha,\"interpolate-lab\":ha,length:Ta,let:da,literal:bi,match:xa,number:wi,\"number-format\":za,object:wi,slice:va,step:Qs,string:wi,\"to-boolean\":ki,\"to-color\":ki,\"to-number\":ki,\"to-string\":ki,var:js,within:Ji,distance:Rs,config:Ls};function Ra(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);const s=i?i.evaluate(t):1,a=mi(e,r,n,s);if(a)throw new vi(a);return new jn(e/255*s,r/255*s,n/255*s,s)}function Va(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);const s=i?i.evaluate(t):1,a=function(t,e,r,n){return \"number\"==typeof t&&t>=0&&t<=360?\"number\"==typeof e&&e>=0&&e<=100&&\"number\"==typeof r&&r>=0&&r<=100?void 0===n||\"number\"==typeof n&&n>=0&&n<=1?null:`Invalid hsla value [${[t,e,r,n].join(\", \")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(\"number\"==typeof n?[t,e,r,n]:[t,e,r]).join(\", \")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(\"number\"==typeof n?[t,e,r,n]:[t,e,r]).join(\", \")}]: 'h' must be between 0 and 360.`}(e,r,n,s);if(a)throw new vi(a);const o=`hsla(${e}, ${r}%, ${n}%, ${s})`,l=jn.parse(o);if(!l)throw new vi(`Failed to parse HSLA color: ${o}`);return l}function Da(t,e){return t in e}function La(t,e){const r=e[t];return void 0===r?null:r}function Fa(t){return {type:t}}function Oa(t){return {result:\"success\",value:t}}function Ua(t){return {result:\"error\",value:t}}function Na(t,e){return !!t&&!!t.parameters&&t.parameters.indexOf(e)>-1}function ja(t){return \"data-driven\"===t[\"property-type\"]}function qa(t){return Na(t.expression,\"measure-light\")}function $a(t){return Na(t.expression,\"zoom\")}function Ga(t){return !!t.expression&&t.expression.interpolated}function Qa(t){return \"object\"==typeof t&&null!==t&&!Array.isArray(t)}function Ya(t){return t}function Xa(t,e){const r=\"color\"===e.type,n=t.stops&&\"object\"==typeof t.stops[0][0],i=n||!(n||void 0!==t.property),s=t.type||(Ga(e)?\"exponential\":\"interval\");if(r&&((t=Qn({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],jn.parse(t[1])]))),t.default=jn.parse(t.default?t.default:e.default)),t.colorSpace&&\"rgb\"!==t.colorSpace&&!ca[t.colorSpace])throw new Error(`Unknown color space: ${t.colorSpace}`);let a,o,l;if(\"exponential\"===s)a=Ha;else if(\"interval\"===s)a=Wa;else if(\"categorical\"===s){a=Ka,o=Object.create(null);for(const e of t.stops)o[e[0]]=e[1];l=typeof t.stops[0][0];}else {if(\"identity\"!==s)throw new Error(`Unknown function type \"${s}\"`);a=Ja;}if(n){const r={},n=[];for(let e=0;e<t.stops.length;e++){const i=t.stops[e],s=i[0].zoom;void 0===r[s]&&(r[s]={zoom:s,type:t.type,property:t.property,default:t.default,stops:[]},n.push(s)),r[s].stops.push([i[0].value,i[1]]);}const i=[];for(const t of n)i.push([r[t].zoom,Xa(r[t],e)]);const s={name:\"linear\"};return {kind:\"composite\",interpolationType:s,interpolationFactor:ha.interpolationFactor.bind(void 0,s),zoomStops:i.map((t=>t[0])),evaluate:({zoom:r},n)=>Ha({stops:i,base:t.base},e,r).evaluate(r,n)}}if(i){const r=\"exponential\"===s?{name:\"exponential\",base:void 0!==t.base?t.base:1}:null;return {kind:\"camera\",interpolationType:r,interpolationFactor:ha.interpolationFactor.bind(void 0,r),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:r})=>a(t,e,r,o,l)}}return {kind:\"source\",evaluate(r,n){const i=n&&n.properties?n.properties[t.property]:void 0;return void 0===i?Za(t.default,e.default):a(t,e,i,o,l)}}}function Za(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Ka(t,e,r,n,i){return Za(typeof r===i?n[r]:void 0,t.default,e.default)}function Wa(t,e,r){if(\"number\"!==Si(r))return Za(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];const i=Gs(t.stops.map((t=>t[0])),r);return t.stops[i][1]}function Ha(t,e,r){const n=void 0!==t.base?t.base:1;if(\"number\"!==Si(r))return Za(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];const s=Gs(t.stops.map((t=>t[0])),r),a=function(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[s][0],t.stops[s+1][0]),o=t.stops[s][1],l=t.stops[s+1][1];let u=Gn[e.type]||Ya;if(t.colorSpace&&\"rgb\"!==t.colorSpace){const e=ca[t.colorSpace];u=(t,r)=>e.reverse(e.interpolate(e.forward(t),e.forward(r),a));}return \"function\"==typeof o.evaluate?{evaluate(...t){const e=o.evaluate.apply(void 0,t),r=l.evaluate.apply(void 0,t);if(void 0!==e&&void 0!==r)return u(e,r,a)}}:u(o,l,a)}function Ja(t,e,r){return \"color\"===e.type?r=jn.parse(r):\"formatted\"===e.type?r=fi.fromString(r.toString()):\"resolvedImage\"===e.type?r=di.fromString(r.toString()):Si(r)===e.type||\"enum\"===e.type&&e.values[r]||(r=void 0),Za(r,t.default,e.default)}zi.register(Ca,{error:[{kind:\"error\"},[Wn],(t,[e])=>{throw new vi(e.evaluate(t))}],typeof:[Wn,[ei],(t,[e])=>ai(gi(e.evaluate(t)))],\"to-rgba\":[si(Kn,4),[Jn],(t,[e])=>e.evaluate(t).toArray()],rgb:[Jn,[Kn,Kn,Kn],Ra],rgba:[Jn,[Kn,Kn,Kn,Kn],Ra],hsl:[Jn,[Kn,Kn,Kn],Va],hsla:[Jn,[Kn,Kn,Kn,Kn],Va],has:{type:Hn,overloads:[[[Wn],(t,[e])=>Da(e.evaluate(t),t.properties())],[[Wn,ti],(t,[e,r])=>Da(e.evaluate(t),r.evaluate(t))]]},get:{type:ei,overloads:[[[Wn],(t,[e])=>La(e.evaluate(t),t.properties())],[[Wn,ti],(t,[e,r])=>La(e.evaluate(t),r.evaluate(t))]]},\"feature-state\":[ei,[Wn],(t,[e])=>La(e.evaluate(t),t.featureState||{})],properties:[ti,[],t=>t.properties()],\"geometry-type\":[Wn,[],t=>t.geometryType()],id:[ei,[],t=>t.id()],zoom:[Kn,[],t=>t.globals.zoom],pitch:[Kn,[],t=>t.globals.pitch||0],\"distance-from-center\":[Kn,[],t=>t.distanceFromCenter()],\"measure-light\":[Kn,[Wn],(t,[e])=>t.measureLight(e.evaluate(t))],\"heatmap-density\":[Kn,[],t=>t.globals.heatmapDensity||0],\"line-progress\":[Kn,[],t=>t.globals.lineProgress||0],\"raster-value\":[Kn,[],t=>t.globals.rasterValue||0],\"raster-particle-speed\":[Kn,[],t=>t.globals.rasterParticleSpeed||0],\"sky-radial-progress\":[Kn,[],t=>t.globals.skyRadialProgress||0],accumulated:[ei,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],\"+\":[Kn,Fa(Kn),(t,e)=>{let r=0;for(const n of e)r+=n.evaluate(t);return r}],\"*\":[Kn,Fa(Kn),(t,e)=>{let r=1;for(const n of e)r*=n.evaluate(t);return r}],\"-\":{type:Kn,overloads:[[[Kn,Kn],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[Kn],(t,[e])=>-e.evaluate(t)]]},\"/\":[Kn,[Kn,Kn],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],\"%\":[Kn,[Kn,Kn],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[Kn,[],()=>Math.LN2],pi:[Kn,[],()=>Math.PI],e:[Kn,[],()=>Math.E],\"^\":[Kn,[Kn,Kn],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[Kn,[Kn],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[Kn,[Kn],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[Kn,[Kn],(t,[e])=>Math.log(e.evaluate(t))],log2:[Kn,[Kn],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[Kn,[Kn],(t,[e])=>Math.sin(e.evaluate(t))],cos:[Kn,[Kn],(t,[e])=>Math.cos(e.evaluate(t))],tan:[Kn,[Kn],(t,[e])=>Math.tan(e.evaluate(t))],asin:[Kn,[Kn],(t,[e])=>Math.asin(e.evaluate(t))],acos:[Kn,[Kn],(t,[e])=>Math.acos(e.evaluate(t))],atan:[Kn,[Kn],(t,[e])=>Math.atan(e.evaluate(t))],min:[Kn,Fa(Kn),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[Kn,Fa(Kn),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[Kn,[Kn],(t,[e])=>Math.abs(e.evaluate(t))],round:[Kn,[Kn],(t,[e])=>{const r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[Kn,[Kn],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[Kn,[Kn],(t,[e])=>Math.ceil(e.evaluate(t))],\"filter-==\":[Hn,[Wn,ei],(t,[e,r])=>t.properties()[e.value]===r.value],\"filter-id-==\":[Hn,[ei],(t,[e])=>t.id()===e.value],\"filter-type-==\":[Hn,[Wn],(t,[e])=>t.geometryType()===e.value],\"filter-<\":[Hn,[Wn,ei],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],\"filter-id-<\":[Hn,[ei],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],\"filter->\":[Hn,[Wn,ei],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],\"filter-id->\":[Hn,[ei],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],\"filter-<=\":[Hn,[Wn,ei],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],\"filter-id-<=\":[Hn,[ei],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],\"filter->=\":[Hn,[Wn,ei],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],\"filter-id->=\":[Hn,[ei],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],\"filter-has\":[Hn,[ei],(t,[e])=>e.value in t.properties()],\"filter-has-id\":[Hn,[],t=>null!==t.id()&&void 0!==t.id()],\"filter-type-in\":[Hn,[si(Wn)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],\"filter-id-in\":[Hn,[si(ei)],(t,[e])=>e.value.indexOf(t.id())>=0],\"filter-in-small\":[Hn,[Wn,si(ei)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],\"filter-in-large\":[Hn,[Wn,si(ei)],(t,[e,r])=>function(t,e,r,n){for(;r<=n;){const i=r+n>>1;if(e[i]===t)return !0;e[i]>t?n=i-1:r=i+1;}return !1}(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Hn,overloads:[[[Hn,Hn],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[Fa(Hn),(t,e)=>{for(const r of e)if(!r.evaluate(t))return !1;return !0}]]},any:{type:Hn,overloads:[[[Hn,Hn],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[Fa(Hn),(t,e)=>{for(const r of e)if(r.evaluate(t))return !0;return !1}]]},\"!\":[Hn,[Hn],(t,[e])=>!e.evaluate(t)],\"is-supported-script\":[Hn,[Wn],(t,[e])=>{const r=t.globals&&t.globals.isSupportedScript;return !r||r(e.evaluate(t))}],upcase:[Wn,[Wn],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Wn,[Wn],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Wn,Fa(ei),(t,e)=>e.map((e=>xi(e.evaluate(t)))).join(\"\")],\"resolved-locale\":[Wn,[ri],(t,[e])=>e.evaluate(t).resolvedLocale()],random:[Kn,[Kn,Kn,ei],(t,e)=>{const[r,n,i]=e.map((e=>e.evaluate(t)));if(r>n)return r;if(r===n)return r;let s;if(\"string\"==typeof i)s=function(t){let e=0;if(0===t.length)return e;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return e}(i);else {if(\"number\"!=typeof i)throw new vi(`Invalid seed input: ${i}`);s=i;}return r+Ba(s)()*(n-r)}]});class to{constructor(t,e,r,n){this.expression=t,this._warningHistory={},this._evaluator=new Ei(r,n),this._defaultValue=e?function(t){return \"color\"===t.type&&(Qa(t.default)||Array.isArray(t.default))?new jn(0,0,0,0):\"color\"===t.type?jn.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&\"enum\"===e.type?e.values:null;}evaluateWithoutErrorHandling(t,e,r,n,i,s,a,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n||null,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s,this._evaluator.featureTileCoord=a||null,this._evaluator.featureDistanceData=o||null,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,n,i,s,a,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n||null,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s||null,this._evaluator.featureTileCoord=a||null,this._evaluator.featureDistanceData=o||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||\"number\"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new vi(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(\", \")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,\"undefined\"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function eo(t){return Array.isArray(t)&&t.length>0&&\"string\"==typeof t[0]&&t[0]in Ca}function ro(t,e,r,n){const i=new qs(Ca,[],e?function(t){const e={color:Jn,string:Wn,number:Kn,enum:Wn,boolean:Hn,formatted:ni,resolvedImage:ii};return \"array\"===t.type?si(e[t.value]||ei,t.length):e[t.type]}(e):void 0,void 0,void 0,r,n),s=i.parse(t,void 0,void 0,void 0,e&&\"string\"===e.type?{typeAnnotation:\"coerce\"}:void 0);return s?Oa(new to(s,e,r,n)):Ua(i.errors)}class no{constructor(t,e,r){this.kind=t,this._styleExpression=e,this.isLightConstant=r,this.isStateDependent=\"constant\"!==t&&!Os(e.expression),this.isConfigDependent=!Us(e.expression);}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}}class io{constructor(t,e,r,n,i){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent=\"camera\"!==t&&!Os(e.expression),this.isLightConstant=i,this.isConfigDependent=!Us(e.expression),this.interpolationType=n;}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}interpolationFactor(t,e,r){return this.interpolationType?ha.interpolationFactor(this.interpolationType,t,e,r):0}}function so(t,e,r,n){if(\"error\"===(t=ro(t,e,r,n)).result)return t;const i=t.value.expression,s=Fs(i);if(!s&&!ja(e))return Ua([new Yn(\"\",\"data expressions not supported\")]);const a=Ns(i,[\"zoom\",\"pitch\",\"distance-from-center\"]);if(!a&&!$a(e))return Ua([new Yn(\"\",\"zoom expressions not supported\")]);const o=Ns(i,[\"measure-light\"]);if(!o&&!qa(e))return Ua([new Yn(\"\",\"measure-light expression not supported\")]);const l=e.expression&&e.expression.relaxZoomRestriction,u=oo(i);return u||a||l?u instanceof Yn?Ua([u]):u instanceof ha&&!Ga(e)?Ua([new Yn(\"\",'\"interpolate\" expressions cannot be used with this property')]):Oa(u?new io(s?\"camera\":\"composite\",t.value,u.labels,u instanceof ha?u.interpolation:void 0,o):new no(s?\"constant\":\"source\",t.value,o)):Ua([new Yn(\"\",'\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression, or in the properties of atmosphere.')])}class ao{constructor(t,e){this._parameters=t,this._specification=e,Qn(this,Xa(this._parameters,this._specification));}static deserialize(t){return new ao(t._parameters,t._specification)}static serialize(t){return {_parameters:t._parameters,_specification:t._specification}}}function oo(t){let e=null;if(t instanceof da)e=oo(t.result);else if(t instanceof fa){for(const r of t.args)if(e=oo(r),e)break}else (t instanceof Qs||t instanceof ha)&&t.input instanceof zi&&\"zoom\"===t.input.name&&(e=t);return e instanceof Yn||t.eachChild((t=>{const r=oo(t);r instanceof Yn?e=r:e&&r&&e!==r&&(e=new Yn(\"\",'Only one zoom-based \"step\" or \"interpolate\" subexpression may be used in an expression.'));})),e}var lo=co,uo=3;function co(t,e,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var i=new Int32Array(this.arrayBuffer);t=i[0],this.d=(e=i[1])+2*(r=i[2]);for(var s=0;s<this.d*this.d;s++){var a=i[uo+s],o=i[uo+s+1];n.push(a===o?null:i.subarray(a,o));}var l=i[uo+n.length+1];this.keys=i.subarray(i[uo+n.length],l),this.bboxes=i.subarray(l),this.insert=this._insertReadonly;}else {this.d=e+2*r;for(var u=0;u<this.d*this.d;u++)n.push([]);this.keys=[],this.bboxes=[];}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;var c=r/e*t;this.min=-c,this.max=t+c;}co.prototype.insert=function(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i);},co.prototype._insertReadonly=function(){throw \"Cannot insert into a GridIndex created from an ArrayBuffer.\"},co.prototype._insertCell=function(t,e,r,n,i,s){this.cells[i].push(s);},co.prototype.query=function(t,e,r,n,i){var s=this.min,a=this.max;if(t<=s&&e<=s&&a<=r&&a<=n&&!i)return Array.prototype.slice.call(this.keys);var o=[];return this._forEachCell(t,e,r,n,this._queryCell,o,{},i),o},co.prototype._queryCell=function(t,e,r,n,i,s,a,o){var l=this.cells[i];if(null!==l)for(var u=this.keys,c=this.bboxes,h=0;h<l.length;h++){var p=l[h];if(void 0===a[p]){var f=4*p;(o?o(c[f+0],c[f+1],c[f+2],c[f+3]):t<=c[f+2]&&e<=c[f+3]&&r>=c[f+0]&&n>=c[f+1])?(a[p]=!0,s.push(u[p])):a[p]=!1;}}},co.prototype._forEachCell=function(t,e,r,n,i,s,a,o){for(var l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),h=this._convertToCellCoord(n),p=l;p<=c;p++)for(var f=u;f<=h;f++){var d=this.d*f+p;if((!o||o(this._convertFromCellCoord(p),this._convertFromCellCoord(f),this._convertFromCellCoord(p+1),this._convertFromCellCoord(f+1)))&&i.call(this,t,e,r,n,d,s,a,o))return}},co.prototype._convertFromCellCoord=function(t){return (t-this.padding)/this.scale},co.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},co.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=uo+this.cells.length+1+1,r=0,n=0;n<this.cells.length;n++)r+=this.cells[n].length;var i=new Int32Array(e+r+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;for(var s=e,a=0;a<t.length;a++){var o=t[a];i[uo+a]=s,i.set(o,s),s+=o.length;}return i[uo+t.length]=s,i.set(this.keys,s),i[uo+t.length+1]=s+=this.keys.length,i.set(this.bboxes,s),s+=this.bboxes.length,i.buffer};var ho=h(lo);const po={};function fo(t,e,r={}){Object.defineProperty(t,\"_classRegistryKey\",{value:e,writeable:!1}),po[e]={klass:t,omit:r.omit||[]};}fo(Object,\"Object\"),ho.serialize=function(t,e){const r=t.toArrayBuffer();return e&&e.add(r),{buffer:r}},ho.deserialize=function(t){return new ho(t.buffer)},Object.defineProperty(ho,\"name\",{value:\"Grid\"}),fo(ho,\"Grid\"),fo(jn,\"Color\"),fo(Error,\"Error\"),fo(fi,\"Formatted\"),fo(pi,\"FormattedSection\"),fo(Kr,\"AJAXError\"),fo(di,\"ResolvedImage\"),fo(ao,\"StylePropertyFunction\"),fo(to,\"StyleExpression\",{omit:[\"_evaluator\"]}),fo(io,\"ZoomDependentExpression\"),fo(no,\"ZoomConstantExpression\"),fo(zi,\"CompoundExpression\",{omit:[\"_evaluate\"]});for(const t in Ca)po[Ca[t]._classRegistryKey]||fo(Ca[t],`Expression${t}`);function mo(t){return t&&\"undefined\"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&\"ArrayBuffer\"===t.constructor.name)}function yo(t){return self.ImageBitmap&&t instanceof ImageBitmap}function go(t,e){if(null==t||\"boolean\"==typeof t||\"number\"==typeof t||\"string\"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp)return t;if(mo(t)||yo(t))return e&&e.add(t),t;if(ArrayBuffer.isView(t)){const r=t;return e&&e.add(r.buffer),r}if(t instanceof ImageData)return e&&e.add(t.data.buffer),t;if(Array.isArray(t)){const r=[];for(const n of t)r.push(go(n,e));return r}if(t instanceof Map){const e={$name:\"Map\"};for(const[r,n]of t.entries())e[r]=go(n);return e}if(\"object\"==typeof t){const r=t.constructor,n=r._classRegistryKey;if(!n)throw new Error(`can't serialize object of unregistered class ${n}`);const i=r.serialize?r.serialize(t,e):{};if(!r.serialize){for(const r in t)t.hasOwnProperty(r)&&(po[n].omit.indexOf(r)>=0||(i[r]=go(t[r],e)));t instanceof Error&&(i.message=t.message);}if(i.$name)throw new Error(\"$name property is reserved for worker serialization logic.\");return \"Object\"!==n&&(i.$name=n),i}throw new Error(\"can't serialize object of type \"+typeof t)}function xo(t){if(null==t||\"boolean\"==typeof t||\"number\"==typeof t||\"string\"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||mo(t)||yo(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(xo);if(\"object\"==typeof t){const e=t.$name||\"Object\";if(\"Map\"===e){const e=new Map;for(const r of Object.keys(t))\"$name\"!==r&&e.set(r,xo(t[r]));return e}const{klass:r}=po[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);const n=Object.create(r.prototype);for(const e of Object.keys(t))\"$name\"!==e&&(n[e]=xo(t[e]));return n}throw new Error(\"can't deserialize object of type \"+typeof t)}const bo={\"Latin-1 Supplement\":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,\"Arabic Supplement\":t=>t>=1872&&t<=1919,\"Arabic Extended-A\":t=>t>=2208&&t<=2303,\"Hangul Jamo\":t=>t>=4352&&t<=4607,\"Unified Canadian Aboriginal Syllabics\":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,\"Unified Canadian Aboriginal Syllabics Extended\":t=>t>=6320&&t<=6399,\"General Punctuation\":t=>t>=8192&&t<=8303,\"Letterlike Symbols\":t=>t>=8448&&t<=8527,\"Number Forms\":t=>t>=8528&&t<=8591,\"Miscellaneous Technical\":t=>t>=8960&&t<=9215,\"Control Pictures\":t=>t>=9216&&t<=9279,\"Optical Character Recognition\":t=>t>=9280&&t<=9311,\"Enclosed Alphanumerics\":t=>t>=9312&&t<=9471,\"Geometric Shapes\":t=>t>=9632&&t<=9727,\"Miscellaneous Symbols\":t=>t>=9728&&t<=9983,\"Miscellaneous Symbols and Arrows\":t=>t>=11008&&t<=11263,\"CJK Radicals Supplement\":t=>t>=11904&&t<=12031,\"Kangxi Radicals\":t=>t>=12032&&t<=12255,\"Ideographic Description Characters\":t=>t>=12272&&t<=12287,\"CJK Symbols and Punctuation\":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,\"Hangul Compatibility Jamo\":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,\"Bopomofo Extended\":t=>t>=12704&&t<=12735,\"CJK Strokes\":t=>t>=12736&&t<=12783,\"Katakana Phonetic Extensions\":t=>t>=12784&&t<=12799,\"Enclosed CJK Letters and Months\":t=>t>=12800&&t<=13055,\"CJK Compatibility\":t=>t>=13056&&t<=13311,\"CJK Unified Ideographs Extension A\":t=>t>=13312&&t<=19903,\"Yijing Hexagram Symbols\":t=>t>=19904&&t<=19967,\"CJK Unified Ideographs\":t=>t>=19968&&t<=40959,\"Yi Syllables\":t=>t>=40960&&t<=42127,\"Yi Radicals\":t=>t>=42128&&t<=42191,\"Hangul Jamo Extended-A\":t=>t>=43360&&t<=43391,\"Hangul Syllables\":t=>t>=44032&&t<=55215,\"Hangul Jamo Extended-B\":t=>t>=55216&&t<=55295,\"Private Use Area\":t=>t>=57344&&t<=63743,\"CJK Compatibility Ideographs\":t=>t>=63744&&t<=64255,\"Arabic Presentation Forms-A\":t=>t>=64336&&t<=65023,\"Vertical Forms\":t=>t>=65040&&t<=65055,\"CJK Compatibility Forms\":t=>t>=65072&&t<=65103,\"Small Form Variants\":t=>t>=65104&&t<=65135,\"Arabic Presentation Forms-B\":t=>t>=65136&&t<=65279,\"Halfwidth and Fullwidth Forms\":t=>t>=65280&&t<=65519,\"CJK Unified Ideographs Extension B\":t=>t>=131072&&t<=173791};function vo(t){for(const e of t)if(Mo(e.charCodeAt(0)))return !0;return !1}function _o(t){for(const e of t)if(!wo(e.charCodeAt(0)))return !1;return !0}function wo(t){return !(bo.Arabic(t)||bo[\"Arabic Supplement\"](t)||bo[\"Arabic Extended-A\"](t)||bo[\"Arabic Presentation Forms-A\"](t)||bo[\"Arabic Presentation Forms-B\"](t))}function Mo(t){return !(746!==t&&747!==t&&(t<4352||!(bo[\"Bopomofo Extended\"](t)||bo.Bopomofo(t)||bo[\"CJK Compatibility Forms\"](t)&&!(t>=65097&&t<=65103)||bo[\"CJK Compatibility Ideographs\"](t)||bo[\"CJK Compatibility\"](t)||bo[\"CJK Radicals Supplement\"](t)||bo[\"CJK Strokes\"](t)||!(!bo[\"CJK Symbols and Punctuation\"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||bo[\"CJK Unified Ideographs Extension A\"](t)||bo[\"CJK Unified Ideographs\"](t)||bo[\"Enclosed CJK Letters and Months\"](t)||bo[\"Hangul Compatibility Jamo\"](t)||bo[\"Hangul Jamo Extended-A\"](t)||bo[\"Hangul Jamo Extended-B\"](t)||bo[\"Hangul Jamo\"](t)||bo[\"Hangul Syllables\"](t)||bo.Hiragana(t)||bo[\"Ideographic Description Characters\"](t)||bo.Kanbun(t)||bo[\"Kangxi Radicals\"](t)||bo[\"Katakana Phonetic Extensions\"](t)||bo.Katakana(t)&&12540!==t||!(!bo[\"Halfwidth and Fullwidth Forms\"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!bo[\"Small Form Variants\"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||bo[\"Unified Canadian Aboriginal Syllabics\"](t)||bo[\"Unified Canadian Aboriginal Syllabics Extended\"](t)||bo[\"Vertical Forms\"](t)||bo[\"Yijing Hexagram Symbols\"](t)||bo[\"Yi Syllables\"](t)||bo[\"Yi Radicals\"](t))))}function Ao(t){return !(Mo(t)||function(t){return !!(bo[\"Latin-1 Supplement\"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||bo[\"General Punctuation\"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||bo[\"Letterlike Symbols\"](t)||bo[\"Number Forms\"](t)||bo[\"Miscellaneous Technical\"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||bo[\"Control Pictures\"](t)&&9251!==t||bo[\"Optical Character Recognition\"](t)||bo[\"Enclosed Alphanumerics\"](t)||bo[\"Geometric Shapes\"](t)||bo[\"Miscellaneous Symbols\"](t)&&!(t>=9754&&t<=9759)||bo[\"Miscellaneous Symbols and Arrows\"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||bo[\"CJK Symbols and Punctuation\"](t)||bo.Katakana(t)||bo[\"Private Use Area\"](t)||bo[\"CJK Compatibility Forms\"](t)||bo[\"Small Form Variants\"](t)||bo[\"Halfwidth and Fullwidth Forms\"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function So(t){return t>=1424&&t<=2303||bo[\"Arabic Presentation Forms-A\"](t)||bo[\"Arabic Presentation Forms-B\"](t)}function Io(t,e){return !(!e&&So(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||bo.Khmer(t))}function ko(t){for(const e of t)if(So(e.charCodeAt(0)))return !0;return !1}const Po=\"deferred\",Eo=\"loading\",zo=\"loaded\";let To=null,Bo=\"unavailable\",Co=null;const Ro=function(t){t&&\"string\"==typeof t&&t.indexOf(\"NetworkError\")>-1&&(Bo=\"error\"),To&&To(t);};function Vo(){Do.fire(new Rn(\"pluginStateChange\",{pluginStatus:Bo,pluginURL:Co}));}const Do=new Dn,Lo=function(){return Bo},Fo=function(){if(Bo!==Po||!Co)throw new Error(\"rtl-text-plugin cannot be downloaded unless a pluginURL is specified\");Bo=Eo,Vo(),Co&&Jr({url:Co},(t=>{t?Ro(t):(Bo=zo,Vo());}));},Oo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Bo===zo||null!=Oo.applyArabicShaping,isLoading:()=>Bo===Eo,setState(t){Bo=t.pluginStatus,Co=t.pluginURL;},isParsed:()=>null!=Oo.applyArabicShaping&&null!=Oo.processBidirectionalText&&null!=Oo.processStyledBidirectionalText,getPluginURL:()=>Co};class Uo{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.transition=e.transition,this.pitch=e.pitch,this.brightness=e.brightness):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0);}isSupportedScript(t){return function(t,e){for(const r of t)if(!Io(r.charCodeAt(0),e))return !1;return !0}(t,Oo.isLoaded())}}class No{constructor(t,e,r,n){this.property=t,this.value=e,this.expression=function(t,e,r,n){if(Qa(t))return new ao(t,e);if(eo(t)||Array.isArray(t)&&t.length>0){const i=so(t,e,r,n);if(\"error\"===i.result)throw new Error(i.value.map((t=>`${t.key}: ${t.message}`)).join(\", \"));return i.value}{let r=t;return \"string\"==typeof t&&\"color\"===e.type&&(r=jn.parse(t)),{kind:\"constant\",isConfigDependent:!1,evaluate:()=>r}}}(void 0===e?t.specification.default:e,t.specification,r,n);}isDataDriven(){return \"source\"===this.expression.kind||\"composite\"===this.expression.kind}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}}class jo{constructor(t,e,r){this.property=t,this.value=new No(t,void 0,e,r);}transitioned(t,e){return new $o(this.property,this.value,e,Je({},t.transition,this.transition),t.now)}untransitioned(){return new $o(this.property,this.value,null,{},0)}}class qo{constructor(t,e,r){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._scope=e,this._options=r,this.isConfigDependent=!1;}getValue(t){return ur(this._values[t].value.value)}setValue(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new jo(this._values[t].property,this._scope,this._options)),this._values[t].value=new No(this._values[t].property,null===e?void 0:ur(e),this._scope,this._options),this.isConfigDependent=this.isConfigDependent||this._values[t].value.expression.isConfigDependent;}setTransitionOrValue(t,e){e&&(this._options=e);const r=this._properties.properties;if(t)for(const e in t){const n=t[e];if(ar(e,\"-transition\")){const t=e.slice(0,-11);r[t]&&this.setTransition(t,n);}else r[e]&&this.setValue(e,n);}}getTransition(t){return ur(this._values[t].transition)}setTransition(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new jo(this._values[t].property)),this._values[t].transition=ur(e)||void 0;}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);const n=this.getTransition(e);void 0!==n&&(t[`${e}-transition`]=n);}return t}transitioned(t,e){const r=new Go(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].transitioned(t,e._values[n]);return r}untransitioned(){const t=new Go(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class $o{constructor(t,e,r,n,i){const s=n.delay||0,a=n.duration||0;i=i||0,this.property=t,this.value=e,this.begin=i+s,this.end=this.begin+a,t.specification.transition&&(n.delay||n.duration)&&(this.prior=r);}possiblyEvaluate(t,e,r){const n=t.now||0,i=this.value.possiblyEvaluate(t,e,r),s=this.prior;if(s){if(n>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n<this.begin)return s.possiblyEvaluate(t,e,r);{const a=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(t,e,r),i,Qe(a))}}return i}}class Go{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues);}possiblyEvaluate(t,e,r){const n=new Xo(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return !0;return !1}}class Qo{constructor(t,e,r){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._scope=e,this._options=r,this.isConfigDependent=!1;}getValue(t){return ur(this._values[t].value)}setValue(t,e){this._values[t]=new No(this._values[t].property,null===e?void 0:ur(e),this._scope,this._options),this.isConfigDependent=this.isConfigDependent||this._values[t].expression.isConfigDependent;}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);}return t}possiblyEvaluate(t,e,r){const n=new Xo(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}}class Yo{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r;}isConstant(){return \"constant\"===this.value.kind}constantOr(t){return \"constant\"===this.value.kind?this.value.value:t}evaluate(t,e,r,n){return this.property.evaluate(this.value,this.parameters,t,e,r,n)}}class Xo{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues);}get(t){return this._values[t]}}class Zo{constructor(t){this.specification=t;}possiblyEvaluate(t,e){return t.expression.evaluate(e)}interpolate(t,e,r){const n=Gn[this.specification.type];return n?n(t,e,r):t}}class Ko{constructor(t,e){this.specification=t,this.overrides=e;}possiblyEvaluate(t,e,r,n){return new Yo(this,\"constant\"===t.expression.kind||\"camera\"===t.expression.kind?{kind:\"constant\",value:t.expression.evaluate(e,null,{},r,n)}:t.expression,e)}interpolate(t,e,r){if(\"constant\"!==t.value.kind||\"constant\"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new Yo(this,{kind:\"constant\",value:void 0},t.parameters);const n=Gn[this.specification.type];return n?new Yo(this,{kind:\"constant\",value:n(t.value.value,e.value.value,r)},t.parameters):t}evaluate(t,e,r,n,i,s){return \"constant\"===t.kind?t.value:t.evaluate(e,r,n,i,s)}}class Wo{constructor(t){this.specification=t;}possiblyEvaluate(t,e,r,n){return !!t.expression.evaluate(e,null,{},r,n)}interpolate(){return !1}}class Ho{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const e=new Uo(0,{});for(const r in t){const n=t[r];n.specification.overridable&&this.overridableProperties.push(r);const i=this.defaultPropertyValues[r]=new No(n,void 0),s=this.defaultTransitionablePropertyValues[r]=new jo(n);this.defaultTransitioningPropertyValues[r]=s.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate(e);}}}function Jo(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function tl(t){if(Array.isArray(t))return t.map(tl);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const r in t)e[r]=tl(t[r]);return e}return Jo(t)}fo(Ko,\"DataDrivenProperty\"),fo(Zo,\"DataConstantProperty\"),fo(Wo,\"ColorRampProperty\");var el=JSON.parse('{\"$version\":8,\"$root\":{\"version\":{\"required\":true,\"type\":\"enum\",\"values\":[8]},\"fragment\":{\"type\":\"boolean\"},\"name\":{\"type\":\"string\"},\"metadata\":{\"type\":\"*\"},\"center\":{\"type\":\"array\",\"value\":\"number\"},\"zoom\":{\"type\":\"number\"},\"bearing\":{\"type\":\"number\",\"default\":0,\"period\":360},\"pitch\":{\"type\":\"number\",\"default\":0},\"light\":{\"type\":\"light\"},\"lights\":{\"required\":false,\"type\":\"array\",\"value\":\"light-3d\"},\"terrain\":{\"type\":\"terrain\",\"optional\":true},\"fog\":{\"type\":\"fog\"},\"camera\":{\"type\":\"camera\"},\"imports\":{\"type\":\"array\",\"value\":\"import\"},\"schema\":{\"type\":\"schema\"},\"sources\":{\"required\":true,\"type\":\"sources\"},\"sprite\":{\"type\":\"string\"},\"glyphs\":{\"type\":\"string\",\"default\":\"mapbox://fonts/mapbox/{fontstack}/{range}.pbf\"},\"transition\":{\"type\":\"transition\"},\"projection\":{\"type\":\"projection\"},\"layers\":{\"required\":true,\"type\":\"array\",\"value\":\"layer\"},\"models\":{\"type\":\"models\"}},\"model\":{\"type\":\"string\",\"required\":true},\"import\":{\"id\":{\"type\":\"string\",\"required\":true},\"url\":{\"type\":\"string\",\"required\":true},\"config\":{\"type\":\"config\"},\"data\":{\"type\":\"$root\"}},\"config\":{\"*\":{\"type\":\"*\"}},\"schema\":{\"*\":{\"type\":\"option\"}},\"option\":{\"default\":{\"type\":\"*\",\"required\":true},\"type\":{\"type\":\"enum\",\"values\":{\"string\":1,\"number\":1,\"boolean\":1,\"color\":1}},\"array\":{\"type\":\"boolean\"},\"minValue\":{\"type\":\"number\"},\"maxValue\":{\"type\":\"number\"},\"stepValue\":{\"type\":\"number\"},\"values\":{\"type\":\"array\",\"value\":\"*\"},\"metadata\":{\"type\":\"*\"}},\"models\":{\"*\":{\"type\":\"model\"}},\"light-3d\":{\"id\":{\"type\":\"string\",\"required\":true},\"properties\":{\"type\":\"properties\"},\"type\":{\"type\":\"enum\",\"values\":{\"ambient\":{},\"directional\":{},\"flat\":{}}}},\"properties\":[\"properties_light_directional\",\"properties_light_ambient\",\"properties_light_flat\"],\"properties_light_directional\":{\"direction\":{\"type\":\"array\",\"default\":[210,30],\"minimum\":[0,0],\"maximum\":[360,90],\"length\":2,\"value\":\"number\",\"property-type\":\"data-constant\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]}},\"color\":{\"type\":\"color\",\"property-type\":\"data-constant\",\"default\":\"#ffffff\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true},\"intensity\":{\"type\":\"number\",\"property-type\":\"data-constant\",\"default\":0.5,\"minimum\":0,\"maximum\":1,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true},\"cast-shadows\":{\"type\":\"boolean\",\"default\":false,\"expression\":{},\"property-type\":\"data-constant\"},\"shadow-intensity\":{\"type\":\"number\",\"property-type\":\"data-constant\",\"default\":1,\"minimum\":0,\"maximum\":1,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true}},\"properties_light_ambient\":{\"color\":{\"type\":\"color\",\"property-type\":\"data-constant\",\"default\":\"#ffffff\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true},\"intensity\":{\"type\":\"number\",\"property-type\":\"data-constant\",\"default\":0.5,\"minimum\":0,\"maximum\":1,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true}},\"properties_light_flat\":{\"anchor\":{\"type\":\"enum\",\"default\":\"viewport\",\"values\":{\"map\":1,\"viewport\":1},\"property-type\":\"data-constant\",\"expression\":{\"parameters\":[\"zoom\"]}},\"position\":{\"type\":\"array\",\"default\":[1.15,210,30],\"length\":3,\"value\":\"number\",\"property-type\":\"data-constant\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]}},\"color\":{\"type\":\"color\",\"property-type\":\"data-constant\",\"default\":\"#ffffff\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true},\"intensity\":{\"type\":\"number\",\"property-type\":\"data-constant\",\"default\":0.5,\"minimum\":0,\"maximum\":1,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true}},\"sources\":{\"*\":{\"type\":\"source\"}},\"source\":[\"source_vector\",\"source_raster\",\"source_raster_dem\",\"source_raster_array\",\"source_geojson\",\"source_video\",\"source_image\",\"source_model\"],\"source_vector\":{\"type\":{\"required\":true,\"type\":\"enum\",\"values\":{\"vector\":1}},\"url\":{\"type\":\"string\"},\"tiles\":{\"type\":\"array\",\"value\":\"string\"},\"bounds\":{\"type\":\"array\",\"value\":\"number\",\"length\":4,\"default\":[-180,-85.051129,180,85.051129]},\"scheme\":{\"type\":\"enum\",\"values\":{\"xyz\":1,\"tms\":1},\"default\":\"xyz\"},\"minzoom\":{\"type\":\"number\",\"default\":0},\"maxzoom\":{\"type\":\"number\",\"default\":22},\"attribution\":{\"type\":\"string\"},\"promoteId\":{\"type\":\"promoteId\"},\"volatile\":{\"type\":\"boolean\",\"default\":false},\"*\":{\"type\":\"*\"}},\"source_raster\":{\"type\":{\"required\":true,\"type\":\"enum\",\"values\":{\"raster\":1}},\"url\":{\"type\":\"string\"},\"tiles\":{\"type\":\"array\",\"value\":\"string\"},\"bounds\":{\"type\":\"array\",\"value\":\"number\",\"length\":4,\"default\":[-180,-85.051129,180,85.051129]},\"minzoom\":{\"type\":\"number\",\"default\":0},\"maxzoom\":{\"type\":\"number\",\"default\":22},\"tileSize\":{\"type\":\"number\",\"default\":512},\"scheme\":{\"type\":\"enum\",\"values\":{\"xyz\":1,\"tms\":1},\"default\":\"xyz\"},\"attribution\":{\"type\":\"string\"},\"volatile\":{\"type\":\"boolean\",\"default\":false},\"*\":{\"type\":\"*\"}},\"source_raster_dem\":{\"type\":{\"required\":true,\"type\":\"enum\",\"values\":{\"raster-dem\":1}},\"url\":{\"type\":\"string\"},\"tiles\":{\"type\":\"array\",\"value\":\"string\"},\"bounds\":{\"type\":\"array\",\"value\":\"number\",\"length\":4,\"default\":[-180,-85.051129,180,85.051129]},\"minzoom\":{\"type\":\"number\",\"default\":0},\"maxzoom\":{\"type\":\"number\",\"default\":22},\"tileSize\":{\"type\":\"number\",\"default\":512},\"attribution\":{\"type\":\"string\"},\"encoding\":{\"type\":\"enum\",\"values\":{\"terrarium\":1,\"mapbox\":1},\"default\":\"mapbox\"},\"volatile\":{\"type\":\"boolean\",\"default\":false},\"*\":{\"type\":\"*\"}},\"source_raster_array\":{\"type\":{\"required\":true,\"type\":\"enum\",\"values\":{\"raster-array\":1}},\"url\":{\"type\":\"string\"},\"tiles\":{\"type\":\"array\",\"value\":\"string\"},\"bounds\":{\"type\":\"array\",\"value\":\"number\",\"length\":4,\"default\":[-180,-85.051129,180,85.051129]},\"minzoom\":{\"type\":\"number\",\"default\":0},\"maxzoom\":{\"type\":\"number\",\"default\":22},\"tileSize\":{\"type\":\"number\",\"default\":512},\"attribution\":{\"type\":\"string\"},\"rasterLayers\":{\"type\":\"*\"},\"volatile\":{\"type\":\"boolean\",\"default\":false},\"*\":{\"type\":\"*\"}},\"source_geojson\":{\"type\":{\"required\":true,\"type\":\"enum\",\"values\":{\"geojson\":1}},\"data\":{\"type\":\"*\"},\"maxzoom\":{\"type\":\"number\",\"default\":18},\"minzoom\":{\"type\":\"number\",\"default\":0},\"attribution\":{\"type\":\"string\"},\"buffer\":{\"type\":\"number\",\"default\":128,\"maximum\":512,\"minimum\":0},\"filter\":{\"type\":\"*\"},\"tolerance\":{\"type\":\"number\",\"default\":0.375},\"cluster\":{\"type\":\"boolean\",\"default\":false},\"clusterRadius\":{\"type\":\"number\",\"default\":50,\"minimum\":0},\"clusterMaxZoom\":{\"type\":\"number\"},\"clusterMinPoints\":{\"type\":\"number\"},\"clusterProperties\":{\"type\":\"*\"},\"lineMetrics\":{\"type\":\"boolean\",\"default\":false},\"generateId\":{\"type\":\"boolean\",\"default\":false},\"promoteId\":{\"type\":\"promoteId\"},\"dynamic\":{\"type\":\"boolean\",\"default\":false}},\"source_video\":{\"type\":{\"required\":true,\"type\":\"enum\",\"values\":{\"video\":1}},\"urls\":{\"required\":true,\"type\":\"array\",\"value\":\"string\"},\"coordinates\":{\"required\":true,\"type\":\"array\",\"length\":4,\"value\":{\"type\":\"array\",\"length\":2,\"value\":\"number\"}}},\"source_image\":{\"type\":{\"required\":true,\"type\":\"enum\",\"values\":{\"image\":1}},\"url\":{\"required\":false,\"type\":\"string\"},\"coordinates\":{\"required\":true,\"type\":\"array\",\"length\":4,\"value\":{\"type\":\"array\",\"length\":2,\"value\":\"number\"}}},\"source_model\":{\"type\":{\"required\":true,\"type\":\"enum\",\"values\":{\"model\":1,\"batched-model\":1}},\"maxzoom\":{\"type\":\"number\",\"default\":18},\"minzoom\":{\"type\":\"number\",\"default\":0},\"tiles\":{\"type\":\"array\",\"value\":\"string\"}},\"layer\":{\"id\":{\"type\":\"string\",\"required\":true},\"type\":{\"type\":\"enum\",\"values\":{\"fill\":{},\"line\":{},\"symbol\":{},\"circle\":{},\"heatmap\":{},\"fill-extrusion\":{},\"raster\":{},\"raster-particle\":{},\"hillshade\":{},\"model\":{},\"background\":{},\"sky\":{},\"slot\":{}},\"required\":true},\"metadata\":{\"type\":\"*\"},\"source\":{\"type\":\"string\"},\"source-layer\":{\"type\":\"string\"},\"slot\":{\"type\":\"string\"},\"minzoom\":{\"type\":\"number\",\"minimum\":0,\"maximum\":24},\"maxzoom\":{\"type\":\"number\",\"minimum\":0,\"maximum\":24},\"filter\":{\"type\":\"filter\"},\"layout\":{\"type\":\"layout\"},\"paint\":{\"type\":\"paint\"}},\"layout\":[\"layout_fill\",\"layout_line\",\"layout_circle\",\"layout_heatmap\",\"layout_fill-extrusion\",\"layout_symbol\",\"layout_raster\",\"layout_raster-particle\",\"layout_hillshade\",\"layout_background\",\"layout_sky\",\"layout_model\"],\"layout_background\":{\"visibility\":{\"type\":\"enum\",\"values\":{\"visible\":1,\"none\":1},\"default\":\"visible\",\"expression\":{},\"property-type\":\"constant\"}},\"layout_sky\":{\"visibility\":{\"type\":\"enum\",\"values\":{\"visible\":1,\"none\":1},\"default\":\"visible\",\"expression\":{},\"property-type\":\"constant\"}},\"layout_model\":{\"visibility\":{\"type\":\"enum\",\"values\":{\"visible\":1,\"none\":1},\"default\":\"visible\",\"expression\":{},\"property-type\":\"constant\"},\"model-id\":{\"type\":\"string\",\"default\":\"\",\"property-type\":\"data-driven\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]}}},\"layout_fill\":{\"fill-sort-key\":{\"type\":\"number\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"visibility\":{\"type\":\"enum\",\"values\":{\"visible\":1,\"none\":1},\"default\":\"visible\",\"expression\":{},\"property-type\":\"constant\"}},\"layout_circle\":{\"circle-sort-key\":{\"type\":\"number\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"visibility\":{\"type\":\"enum\",\"values\":{\"visible\":1,\"none\":1},\"default\":\"visible\",\"expression\":{},\"property-type\":\"constant\"}},\"layout_heatmap\":{\"visibility\":{\"type\":\"enum\",\"values\":{\"visible\":1,\"none\":1},\"default\":\"visible\",\"expression\":{},\"property-type\":\"constant\"}},\"layout_fill-extrusion\":{\"visibility\":{\"type\":\"enum\",\"values\":{\"visible\":1,\"none\":1},\"default\":\"visible\",\"expression\":{},\"property-type\":\"constant\"},\"fill-extrusion-edge-radius\":{\"type\":\"number\",\"private\":true,\"default\":0,\"minimum\":0,\"maximum\":1,\"expression\":{},\"property-type\":\"constant\"}},\"layout_line\":{\"line-cap\":{\"type\":\"enum\",\"values\":{\"butt\":1,\"round\":1,\"square\":1},\"default\":\"butt\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-join\":{\"type\":\"enum\",\"values\":{\"bevel\":1,\"round\":1,\"miter\":1,\"none\":1},\"default\":\"miter\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-miter-limit\":{\"type\":\"number\",\"default\":2,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-round-limit\":{\"type\":\"number\",\"default\":1.05,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-sort-key\":{\"type\":\"number\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"visibility\":{\"type\":\"enum\",\"values\":{\"visible\":1,\"none\":1},\"default\":\"visible\",\"expression\":{},\"property-type\":\"constant\"}},\"layout_symbol\":{\"symbol-placement\":{\"type\":\"enum\",\"values\":{\"point\":1,\"line\":1,\"line-center\":1},\"default\":\"point\",\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-spacing\":{\"type\":\"number\",\"default\":250,\"minimum\":1,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-avoid-edges\":{\"type\":\"boolean\",\"default\":false,\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-sort-key\":{\"type\":\"number\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"symbol-z-order\":{\"type\":\"enum\",\"values\":{\"auto\":1,\"viewport-y\":1,\"source\":1},\"default\":\"auto\",\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-z-elevate\":{\"type\":\"boolean\",\"default\":false,\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-allow-overlap\":{\"type\":\"boolean\",\"default\":false,\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-ignore-placement\":{\"type\":\"boolean\",\"default\":false,\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-optional\":{\"type\":\"boolean\",\"default\":false,\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-rotation-alignment\":{\"type\":\"enum\",\"values\":{\"map\":1,\"viewport\":1,\"auto\":1},\"default\":\"auto\",\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-size\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-text-fit\":{\"type\":\"enum\",\"values\":{\"none\":1,\"width\":1,\"height\":1,\"both\":1},\"default\":\"none\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-text-fit-padding\":{\"type\":\"array\",\"value\":\"number\",\"length\":4,\"default\":[0,0,0,0],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-image\":{\"type\":\"resolvedImage\",\"tokens\":true,\"expression\":{\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-rotate\":{\"type\":\"number\",\"default\":0,\"period\":360,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-padding\":{\"type\":\"number\",\"default\":2,\"minimum\":0,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-keep-upright\":{\"type\":\"boolean\",\"default\":false,\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-offset\":{\"type\":\"array\",\"value\":\"number\",\"length\":2,\"default\":[0,0],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-anchor\":{\"type\":\"enum\",\"values\":{\"center\":1,\"left\":1,\"right\":1,\"top\":1,\"bottom\":1,\"top-left\":1,\"top-right\":1,\"bottom-left\":1,\"bottom-right\":1},\"default\":\"center\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-pitch-alignment\":{\"type\":\"enum\",\"values\":{\"map\":1,\"viewport\":1,\"auto\":1},\"default\":\"auto\",\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-pitch-alignment\":{\"type\":\"enum\",\"values\":{\"map\":1,\"viewport\":1,\"auto\":1},\"default\":\"auto\",\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-rotation-alignment\":{\"type\":\"enum\",\"values\":{\"map\":1,\"viewport\":1,\"auto\":1},\"default\":\"auto\",\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-field\":{\"type\":\"formatted\",\"default\":\"\",\"tokens\":true,\"expression\":{\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-font\":{\"type\":\"array\",\"value\":\"string\",\"default\":[\"Open Sans Regular\",\"Arial Unicode MS Regular\"],\"expression\":{\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-size\":{\"type\":\"number\",\"default\":16,\"minimum\":0,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-max-width\":{\"type\":\"number\",\"default\":10,\"minimum\":0,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-line-height\":{\"type\":\"number\",\"default\":1.2,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-letter-spacing\":{\"type\":\"number\",\"default\":0,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-justify\":{\"type\":\"enum\",\"values\":{\"auto\":1,\"left\":1,\"center\":1,\"right\":1},\"default\":\"center\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-radial-offset\":{\"type\":\"number\",\"default\":0,\"property-type\":\"data-driven\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\"]}},\"text-variable-anchor\":{\"type\":\"array\",\"value\":\"enum\",\"values\":{\"center\":1,\"left\":1,\"right\":1,\"top\":1,\"bottom\":1,\"top-left\":1,\"top-right\":1,\"bottom-left\":1,\"bottom-right\":1},\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-anchor\":{\"type\":\"enum\",\"values\":{\"center\":1,\"left\":1,\"right\":1,\"top\":1,\"bottom\":1,\"top-left\":1,\"top-right\":1,\"bottom-left\":1,\"bottom-right\":1},\"default\":\"center\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-max-angle\":{\"type\":\"number\",\"default\":45,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-writing-mode\":{\"type\":\"array\",\"value\":\"enum\",\"values\":{\"horizontal\":1,\"vertical\":1},\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-rotate\":{\"type\":\"number\",\"default\":0,\"period\":360,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-padding\":{\"type\":\"number\",\"default\":2,\"minimum\":0,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-keep-upright\":{\"type\":\"boolean\",\"default\":true,\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-transform\":{\"type\":\"enum\",\"values\":{\"none\":1,\"uppercase\":1,\"lowercase\":1},\"default\":\"none\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-offset\":{\"type\":\"array\",\"value\":\"number\",\"length\":2,\"default\":[0,0],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-allow-overlap\":{\"type\":\"boolean\",\"default\":false,\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-ignore-placement\":{\"type\":\"boolean\",\"default\":false,\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-optional\":{\"type\":\"boolean\",\"default\":false,\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"visibility\":{\"type\":\"enum\",\"values\":{\"visible\":1,\"none\":1},\"default\":\"visible\",\"expression\":{},\"property-type\":\"constant\"}},\"layout_raster\":{\"visibility\":{\"type\":\"enum\",\"values\":{\"visible\":1,\"none\":1},\"default\":\"visible\",\"expression\":{},\"property-type\":\"constant\"}},\"layout_raster-particle\":{\"visibility\":{\"type\":\"enum\",\"values\":{\"visible\":1,\"none\":1},\"default\":\"visible\",\"expression\":{},\"property-type\":\"constant\"}},\"layout_hillshade\":{\"visibility\":{\"type\":\"enum\",\"values\":{\"visible\":1,\"none\":1},\"default\":\"visible\",\"expression\":{},\"property-type\":\"constant\"}},\"filter\":{\"type\":\"array\",\"value\":\"*\"},\"filter_symbol\":{\"type\":\"boolean\",\"default\":false,\"property-type\":\"data-driven\",\"expression\":{\"parameters\":[\"zoom\",\"feature\",\"pitch\",\"distance-from-center\"]}},\"filter_fill\":{\"type\":\"boolean\",\"default\":false,\"property-type\":\"data-driven\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]}},\"filter_line\":{\"type\":\"boolean\",\"default\":false,\"property-type\":\"data-driven\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]}},\"filter_circle\":{\"type\":\"boolean\",\"default\":false,\"property-type\":\"data-driven\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]}},\"filter_fill-extrusion\":{\"type\":\"boolean\",\"default\":false,\"property-type\":\"data-driven\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]}},\"filter_heatmap\":{\"type\":\"boolean\",\"default\":false,\"property-type\":\"data-driven\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]}},\"filter_operator\":{\"type\":\"enum\",\"values\":{\"==\":1,\"!=\":1,\">\":1,\">=\":1,\"<\":1,\"<=\":1,\"in\":1,\"!in\":1,\"all\":1,\"any\":1,\"none\":1,\"has\":1,\"!has\":1}},\"geometry_type\":{\"type\":\"enum\",\"values\":{\"Point\":1,\"LineString\":1,\"Polygon\":1}},\"function\":{\"expression\":{\"type\":\"expression\"},\"stops\":{\"type\":\"array\",\"value\":\"function_stop\"},\"base\":{\"type\":\"number\",\"default\":1,\"minimum\":0},\"property\":{\"type\":\"string\",\"default\":\"$zoom\"},\"type\":{\"type\":\"enum\",\"values\":{\"identity\":1,\"exponential\":1,\"interval\":1,\"categorical\":1},\"default\":\"exponential\"},\"colorSpace\":{\"type\":\"enum\",\"values\":{\"rgb\":1,\"lab\":1,\"hcl\":1},\"default\":\"rgb\"},\"default\":{\"type\":\"*\",\"required\":false}},\"function_stop\":{\"type\":\"array\",\"minimum\":0,\"maximum\":24,\"value\":[\"number\",\"color\"],\"length\":2},\"expression\":{\"type\":\"array\",\"value\":\"*\",\"minimum\":1},\"fog\":{\"range\":{\"type\":\"array\",\"default\":[0.5,10],\"minimum\":-20,\"maximum\":20,\"length\":2,\"value\":\"number\",\"property-type\":\"data-constant\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"],\"relaxZoomRestriction\":true}},\"color\":{\"type\":\"color\",\"property-type\":\"data-constant\",\"default\":\"#ffffff\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"],\"relaxZoomRestriction\":true},\"transition\":true},\"high-color\":{\"type\":\"color\",\"property-type\":\"data-constant\",\"default\":\"#245cdf\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"],\"relaxZoomRestriction\":true},\"transition\":true},\"space-color\":{\"type\":\"color\",\"property-type\":\"data-constant\",\"default\":[\"interpolate\",[\"linear\"],[\"zoom\"],4,\"#010b19\",7,\"#367ab9\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"],\"relaxZoomRestriction\":true},\"transition\":true},\"horizon-blend\":{\"type\":\"number\",\"property-type\":\"data-constant\",\"default\":[\"interpolate\",[\"linear\"],[\"zoom\"],4,0.2,7,0.1],\"minimum\":0,\"maximum\":1,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"],\"relaxZoomRestriction\":true},\"transition\":true},\"star-intensity\":{\"type\":\"number\",\"property-type\":\"data-constant\",\"default\":[\"interpolate\",[\"linear\"],[\"zoom\"],5,0.35,6,0],\"minimum\":0,\"maximum\":1,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"],\"relaxZoomRestriction\":true},\"transition\":true},\"vertical-range\":{\"type\":\"array\",\"default\":[0,0],\"minimum\":0,\"length\":2,\"value\":\"number\",\"property-type\":\"data-constant\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"],\"relaxZoomRestriction\":true}}},\"camera\":{\"camera-projection\":{\"type\":\"enum\",\"values\":{\"perspective\":1,\"orthographic\":1},\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"default\":\"perspective\",\"property-type\":\"data-constant\"}},\"light\":{\"anchor\":{\"type\":\"enum\",\"default\":\"viewport\",\"values\":{\"map\":1,\"viewport\":1},\"property-type\":\"data-constant\",\"expression\":{\"parameters\":[\"zoom\"]}},\"position\":{\"type\":\"array\",\"default\":[1.15,210,30],\"length\":3,\"value\":\"number\",\"property-type\":\"data-constant\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]}},\"color\":{\"type\":\"color\",\"property-type\":\"data-constant\",\"default\":\"#ffffff\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true},\"intensity\":{\"type\":\"number\",\"property-type\":\"data-constant\",\"default\":0.5,\"minimum\":0,\"maximum\":1,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true}},\"projection\":{\"name\":{\"type\":\"enum\",\"values\":{\"albers\":1,\"equalEarth\":1,\"equirectangular\":1,\"lambertConformalConic\":1,\"mercator\":1,\"naturalEarth\":1,\"winkelTripel\":1,\"globe\":1},\"default\":\"mercator\",\"required\":true},\"center\":{\"type\":\"array\",\"length\":2,\"value\":\"number\",\"property-type\":\"data-constant\",\"minimum\":[-180,-90],\"maximum\":[180,90]},\"parallels\":{\"type\":\"array\",\"length\":2,\"value\":\"number\",\"property-type\":\"data-constant\",\"minimum\":[-90,-90],\"maximum\":[90,90]}},\"terrain\":{\"source\":{\"type\":\"string\",\"required\":true},\"exaggeration\":{\"type\":\"number\",\"property-type\":\"data-constant\",\"default\":1,\"minimum\":0,\"maximum\":1000,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true}},\"paint\":[\"paint_fill\",\"paint_line\",\"paint_circle\",\"paint_heatmap\",\"paint_fill-extrusion\",\"paint_symbol\",\"paint_raster\",\"paint_hillshade\",\"paint_background\",\"paint_sky\",\"paint_model\"],\"paint_fill\":{\"fill-antialias\":{\"type\":\"boolean\",\"default\":true,\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"fill-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"fill-outline-color\":{\"type\":\"color\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"fill-translate\":{\"type\":\"array\",\"value\":\"number\",\"length\":2,\"default\":[0,0],\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-translate-anchor\":{\"type\":\"enum\",\"values\":{\"map\":1,\"viewport\":1},\"default\":\"map\",\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-pattern\":{\"type\":\"resolvedImage\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"fill-emissive-strength\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"]},\"property-type\":\"data-constant\"}},\"paint_fill-extrusion\":{\"fill-extrusion-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-translate\":{\"type\":\"array\",\"value\":\"number\",\"length\":2,\"default\":[0,0],\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-translate-anchor\":{\"type\":\"enum\",\"values\":{\"map\":1,\"viewport\":1},\"default\":\"map\",\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-pattern\":{\"type\":\"resolvedImage\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-height\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-base\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-vertical-gradient\":{\"type\":\"boolean\",\"default\":true,\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-ambient-occlusion-intensity\":{\"property-type\":\"data-constant\",\"type\":\"number\",\"private\":true,\"default\":0,\"minimum\":0,\"maximum\":1,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true},\"fill-extrusion-ambient-occlusion-radius\":{\"property-type\":\"data-constant\",\"type\":\"number\",\"private\":true,\"default\":3,\"minimum\":0,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true},\"fill-extrusion-ambient-occlusion-wall-radius\":{\"property-type\":\"data-constant\",\"type\":\"number\",\"default\":3,\"minimum\":0,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true},\"fill-extrusion-ambient-occlusion-ground-radius\":{\"property-type\":\"data-constant\",\"type\":\"number\",\"default\":3,\"minimum\":0,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true},\"fill-extrusion-ambient-occlusion-ground-attenuation\":{\"property-type\":\"data-constant\",\"type\":\"number\",\"default\":0.69,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]}},\"fill-extrusion-flood-light-color\":{\"property-type\":\"data-constant\",\"type\":\"color\",\"default\":\"#ffffff\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"]}},\"fill-extrusion-flood-light-intensity\":{\"property-type\":\"data-constant\",\"type\":\"number\",\"default\":0,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"]}},\"fill-extrusion-flood-light-wall-radius\":{\"property-type\":\"data-driven\",\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"feature\",\"feature-state\"]}},\"fill-extrusion-flood-light-ground-radius\":{\"property-type\":\"data-driven\",\"type\":\"number\",\"default\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"feature\",\"feature-state\"]}},\"fill-extrusion-flood-light-ground-attenuation\":{\"property-type\":\"data-constant\",\"type\":\"number\",\"default\":0.69,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]}},\"fill-extrusion-vertical-scale\":{\"property-type\":\"data-constant\",\"type\":\"number\",\"default\":1,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]}},\"fill-extrusion-rounded-roof\":{\"property-type\":\"data-constant\",\"type\":\"boolean\",\"default\":true,\"expression\":{\"parameters\":[\"zoom\"]}},\"fill-extrusion-cutoff-fade-range\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"maximum\":1,\"expression\":{},\"property-type\":\"data-constant\"},\"fill-extrusion-emissive-strength\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"]},\"property-type\":\"data-constant\"}},\"paint_line\":{\"line-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"line-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"line-translate\":{\"type\":\"array\",\"value\":\"number\",\"length\":2,\"default\":[0,0],\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-translate-anchor\":{\"type\":\"enum\",\"values\":{\"map\":1,\"viewport\":1},\"default\":\"map\",\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-width\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"line-gap-width\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"line-offset\":{\"type\":\"number\",\"default\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"line-blur\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"line-dasharray\":{\"type\":\"array\",\"value\":\"number\",\"minimum\":0,\"expression\":{\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-pattern\":{\"type\":\"resolvedImage\",\"expression\":{\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-gradient\":{\"type\":\"color\",\"expression\":{\"interpolated\":true,\"parameters\":[\"line-progress\"]},\"property-type\":\"color-ramp\"},\"line-trim-offset\":{\"type\":\"array\",\"value\":\"number\",\"length\":2,\"default\":[0,0],\"minimum\":[0,0],\"maximum\":[1,1],\"property-type\":\"constant\"},\"line-emissive-strength\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"]},\"property-type\":\"data-constant\"},\"line-border-width\":{\"type\":\"number\",\"private\":true,\"default\":0,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-border-color\":{\"type\":\"color\",\"private\":true,\"default\":\"rgba(0, 0, 0, 0)\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"}},\"paint_circle\":{\"circle-radius\":{\"type\":\"number\",\"default\":5,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"circle-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"circle-blur\":{\"type\":\"number\",\"default\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"circle-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"circle-translate\":{\"type\":\"array\",\"value\":\"number\",\"length\":2,\"default\":[0,0],\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-translate-anchor\":{\"type\":\"enum\",\"values\":{\"map\":1,\"viewport\":1},\"default\":\"map\",\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-pitch-scale\":{\"type\":\"enum\",\"values\":{\"map\":1,\"viewport\":1},\"default\":\"map\",\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-pitch-alignment\":{\"type\":\"enum\",\"values\":{\"map\":1,\"viewport\":1},\"default\":\"viewport\",\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-stroke-width\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"circle-stroke-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"circle-stroke-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"circle-emissive-strength\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"]},\"property-type\":\"data-constant\"}},\"paint_heatmap\":{\"heatmap-radius\":{\"type\":\"number\",\"default\":30,\"minimum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"heatmap-weight\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"heatmap-intensity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"heatmap-color\":{\"type\":\"color\",\"default\":[\"interpolate\",[\"linear\"],[\"heatmap-density\"],0,\"rgba(0, 0, 255, 0)\",0.1,\"royalblue\",0.3,\"cyan\",0.5,\"lime\",0.7,\"yellow\",1,\"red\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"heatmap-density\"]},\"property-type\":\"color-ramp\"},\"heatmap-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"}},\"paint_symbol\":{\"icon-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"icon-emissive-strength\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"text-emissive-strength\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"icon-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"icon-halo-color\":{\"type\":\"color\",\"default\":\"rgba(0, 0, 0, 0)\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"icon-halo-width\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"icon-halo-blur\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"icon-translate\":{\"type\":\"array\",\"value\":\"number\",\"length\":2,\"default\":[0,0],\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-translate-anchor\":{\"type\":\"enum\",\"values\":{\"map\":1,\"viewport\":1},\"default\":\"map\",\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-image-cross-fade\":{\"type\":\"number\",\"property-type\":\"data-driven\",\"default\":0,\"minimum\":0,\"maximum\":1,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"transition\":true},\"text-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"text-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"overridable\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"text-halo-color\":{\"type\":\"color\",\"default\":\"rgba(0, 0, 0, 0)\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"text-halo-width\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"text-halo-blur\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\",\"measure-light\"]},\"property-type\":\"data-driven\"},\"text-translate\":{\"type\":\"array\",\"value\":\"number\",\"length\":2,\"default\":[0,0],\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-translate-anchor\":{\"type\":\"enum\",\"values\":{\"map\":1,\"viewport\":1},\"default\":\"map\",\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-color-saturation\":{\"type\":\"number\",\"default\":0,\"minimum\":-1,\"maximum\":1,\"expression\":{},\"property-type\":\"data-constant\"},\"icon-color-contrast\":{\"type\":\"number\",\"default\":0,\"minimum\":-1,\"maximum\":1,\"expression\":{},\"property-type\":\"data-constant\"},\"icon-color-brightness-min\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"maximum\":1,\"expression\":{},\"property-type\":\"data-constant\"},\"icon-color-brightness-max\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"expression\":{},\"property-type\":\"data-constant\"}},\"paint_raster\":{\"raster-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-color\":{\"type\":\"color\",\"expression\":{\"interpolated\":true,\"parameters\":[\"raster-value\"]},\"property-type\":\"color-ramp\"},\"raster-color-mix\":{\"type\":\"array\",\"default\":[0.2126,0.7152,0.0722,0],\"length\":4,\"value\":\"number\",\"property-type\":\"data-constant\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]}},\"raster-color-range\":{\"type\":\"array\",\"length\":2,\"value\":\"number\",\"property-type\":\"data-constant\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]}},\"raster-hue-rotate\":{\"type\":\"number\",\"default\":0,\"period\":360,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-brightness-min\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-brightness-max\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-saturation\":{\"type\":\"number\",\"default\":0,\"minimum\":-1,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-contrast\":{\"type\":\"number\",\"default\":0,\"minimum\":-1,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-resampling\":{\"type\":\"enum\",\"values\":{\"linear\":1,\"nearest\":1},\"default\":\"linear\",\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-fade-duration\":{\"type\":\"number\",\"default\":300,\"minimum\":0,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-emissive-strength\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"]},\"property-type\":\"data-constant\"},\"raster-array-band\":{\"type\":\"string\",\"required\":false,\"property-type\":\"data-constant\"},\"raster-elevation\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"}},\"paint_raster-particle\":{\"raster-particle-array-band\":{\"type\":\"string\",\"required\":false,\"property-type\":\"data-constant\"},\"raster-particle-count\":{\"type\":\"number\",\"default\":512,\"minimum\":1,\"property-type\":\"data-constant\"},\"raster-particle-color\":{\"type\":\"color\",\"expression\":{\"interpolated\":true,\"parameters\":[\"raster-particle-speed\"]},\"property-type\":\"color-ramp\"},\"raster-particle-max-speed\":{\"type\":\"number\",\"default\":1,\"minimum\":1,\"property-type\":\"data-constant\"},\"raster-particle-speed-factor\":{\"type\":\"number\",\"default\":0.2,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-particle-fade-opacity-factor\":{\"type\":\"number\",\"default\":0.98,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-particle-reset-rate-factor\":{\"type\":\"number\",\"default\":0.8,\"minimum\":0,\"maximum\":1,\"property-type\":\"data-constant\"}},\"paint_hillshade\":{\"hillshade-illumination-direction\":{\"type\":\"number\",\"default\":335,\"minimum\":0,\"maximum\":359,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-illumination-anchor\":{\"type\":\"enum\",\"values\":{\"map\":1,\"viewport\":1},\"default\":\"viewport\",\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-exaggeration\":{\"type\":\"number\",\"default\":0.5,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-shadow-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"]},\"property-type\":\"data-constant\"},\"hillshade-highlight-color\":{\"type\":\"color\",\"default\":\"#FFFFFF\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"]},\"property-type\":\"data-constant\"},\"hillshade-accent-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"]},\"property-type\":\"data-constant\"},\"hillshade-emissive-strength\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"]},\"property-type\":\"data-constant\"}},\"paint_background\":{\"background-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"background-pattern\":{\"type\":\"resolvedImage\",\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"background-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"background-emissive-strength\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"measure-light\"]},\"property-type\":\"data-constant\"}},\"paint_sky\":{\"sky-type\":{\"type\":\"enum\",\"values\":{\"gradient\":1,\"atmosphere\":1},\"default\":\"atmosphere\",\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"sky-atmosphere-sun\":{\"type\":\"array\",\"value\":\"number\",\"length\":2,\"minimum\":[0,0],\"maximum\":[360,180],\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"sky-atmosphere-sun-intensity\":{\"type\":\"number\",\"default\":10,\"minimum\":0,\"maximum\":100,\"property-type\":\"data-constant\"},\"sky-gradient-center\":{\"type\":\"array\",\"value\":\"number\",\"default\":[0,0],\"length\":2,\"minimum\":[0,0],\"maximum\":[360,180],\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"sky-gradient-radius\":{\"type\":\"number\",\"default\":90,\"minimum\":0,\"maximum\":180,\"expression\":{\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"sky-gradient\":{\"type\":\"color\",\"default\":[\"interpolate\",[\"linear\"],[\"sky-radial-progress\"],0.8,\"#87ceeb\",1,\"white\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"sky-radial-progress\"]},\"property-type\":\"color-ramp\"},\"sky-atmosphere-halo-color\":{\"type\":\"color\",\"default\":\"white\",\"property-type\":\"data-constant\"},\"sky-atmosphere-color\":{\"type\":\"color\",\"default\":\"white\",\"property-type\":\"data-constant\"},\"sky-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"}},\"paint_model\":{\"model-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"model-rotation\":{\"type\":\"array\",\"value\":\"number\",\"length\":3,\"default\":[0,0,0],\"period\":360,\"property-type\":\"data-driven\",\"expression\":{\"interpolated\":true,\"parameters\":[\"feature\",\"feature-state\",\"zoom\"]},\"transition\":true},\"model-scale\":{\"type\":\"array\",\"value\":\"number\",\"length\":3,\"default\":[1,1,1],\"property-type\":\"data-driven\",\"expression\":{\"interpolated\":true,\"parameters\":[\"feature\",\"feature-state\",\"zoom\"]},\"transition\":true},\"model-translation\":{\"type\":\"array\",\"value\":\"number\",\"length\":3,\"default\":[0,0,0],\"property-type\":\"data-driven\",\"expression\":{\"interpolated\":true,\"parameters\":[\"feature\",\"feature-state\",\"zoom\"]},\"transition\":true},\"model-color\":{\"type\":\"color\",\"default\":\"#ffffff\",\"property-type\":\"data-driven\",\"expression\":{\"interpolated\":true,\"parameters\":[\"feature\",\"feature-state\",\"measure-light\",\"zoom\"]},\"transition\":true},\"model-color-mix-intensity\":{\"type\":\"number\",\"property-type\":\"data-driven\",\"default\":0,\"minimum\":0,\"maximum\":1,\"expression\":{\"interpolated\":true,\"parameters\":[\"feature\",\"feature-state\",\"measure-light\"]},\"transition\":true},\"model-type\":{\"type\":\"enum\",\"values\":{\"common-3d\":1,\"location-indicator\":1},\"default\":\"common-3d\",\"property-type\":\"data-constant\"},\"model-cast-shadows\":{\"type\":\"boolean\",\"default\":true,\"expression\":{},\"property-type\":\"data-constant\"},\"model-receive-shadows\":{\"type\":\"boolean\",\"default\":true,\"expression\":{},\"property-type\":\"data-constant\"},\"model-ambient-occlusion-intensity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\",\"transition\":true},\"model-emissive-strength\":{\"type\":\"number\",\"property-type\":\"data-driven\",\"default\":0,\"minimum\":0,\"maximum\":5,\"expression\":{\"interpolated\":true,\"parameters\":[\"feature\",\"feature-state\",\"measure-light\"]},\"transition\":true},\"model-roughness\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"property-type\":\"data-driven\",\"expression\":{\"interpolated\":true,\"parameters\":[\"feature\",\"feature-state\"]},\"transition\":true},\"model-height-based-emissive-strength-multiplier\":{\"type\":\"array\",\"default\":[1,1,1,1,0],\"length\":5,\"value\":\"number\",\"property-type\":\"data-driven\",\"expression\":{\"interpolated\":true,\"parameters\":[\"feature\",\"feature-state\",\"measure-light\"]},\"transition\":true},\"model-cutoff-fade-range\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"maximum\":1,\"expression\":{},\"property-type\":\"data-constant\"},\"model-front-cutoff\":{\"type\":\"array\",\"private\":true,\"value\":\"number\",\"property-type\":\"data-constant\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"length\":3,\"default\":[0,0,1],\"minimum\":[0,0,0],\"maximum\":[1,1,1]}},\"transition\":{\"duration\":{\"type\":\"number\",\"default\":300,\"minimum\":0},\"delay\":{\"type\":\"number\",\"default\":0,\"minimum\":0}},\"property-type\":{\"data-driven\":{\"type\":\"property-type\"},\"color-ramp\":{\"type\":\"property-type\"},\"data-constant\":{\"type\":\"property-type\"},\"constant\":{\"type\":\"property-type\"}},\"promoteId\":{\"*\":{\"type\":\"string\"}}}');function rl(t){if(!0===t||!1===t)return !0;if(!Array.isArray(t)||0===t.length)return !1;switch(t[0]){case\"has\":return t.length>=2&&\"$id\"!==t[1]&&\"$type\"!==t[1];case\"in\":return t.length>=3&&(\"string\"!=typeof t[1]||Array.isArray(t[2]));case\"!in\":case\"!has\":case\"none\":return !1;case\"==\":case\"!=\":case\">\":case\">=\":case\"<\":case\"<=\":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case\"any\":case\"all\":for(const e of t.slice(1))if(!rl(e)&&\"boolean\"!=typeof e)return !1;return !0;default:return !0}}function nl(t,e=\"fill\"){if(null==t)return {filter:()=>!0,needGeometry:!1,needFeature:!1};rl(t)||(t=cl(t));const r=t;let n=!0;try{n=function(t){if(!al(t))return t;let e=tl(t);return sl(e),e=il(e),e}(r);}catch(t){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\\nand paste the contents of this message in the report.\\nThank you!\\nFilter Expression:\\n${JSON.stringify(r,null,2)}\\n        `);}const i=el[`filter_${e}`],s=ro(n,i);let a=null;if(\"error\"===s.result)throw new Error(s.value.map((t=>`${t.key}: ${t.message}`)).join(\", \"));a=(t,e,r)=>s.value.evaluate(t,e,{},r);let o=null,l=null;if(n!==r){const t=ro(r,i);if(\"error\"===t.result)throw new Error(t.value.map((t=>`${t.key}: ${t.message}`)).join(\", \"));o=(e,r,n,i,s)=>t.value.evaluate(e,r,{},n,void 0,void 0,i,s),l=!Fs(t.value.expression);}return {filter:a,dynamicFilter:o||void 0,needGeometry:ul(n),needFeature:!!l}}function il(t){if(!Array.isArray(t))return t;const e=function(t){if(ol.has(t[0]))for(let e=1;e<t.length;e++)if(al(t[e]))return !0;return t}(t);return !0===e?e:e.map((t=>il(t)))}function sl(t){let e=!1;const r=[];if(\"case\"===t[0]){for(let n=1;n<t.length-1;n+=2)e=e||al(t[n]),r.push(t[n+1]);r.push(t[t.length-1]);}else if(\"match\"===t[0]){e=e||al(t[1]);for(let e=2;e<t.length-1;e+=2)r.push(t[e+1]);r.push(t[t.length-1]);}else if(\"step\"===t[0]){e=e||al(t[1]);for(let e=1;e<t.length-1;e+=2)r.push(t[e+1]);}e&&(t.length=0,t.push(\"any\",...r));for(let e=1;e<t.length;e++)sl(t[e]);}function al(t){if(!Array.isArray(t))return !1;if(\"pitch\"===(e=t[0])||\"distance-from-center\"===e)return !0;var e;for(let e=1;e<t.length;e++)if(al(t[e]))return !0;return !1}const ol=new Set([\"in\",\"==\",\"!=\",\">\",\">=\",\"<\",\"<=\",\"to-boolean\"]);function ll(t,e){return t<e?-1:t>e?1:0}function ul(t){if(!Array.isArray(t))return !1;if(\"within\"===t[0]||\"distance\"===t[0])return !0;for(let e=1;e<t.length;e++)if(ul(t[e]))return !0;return !1}function cl(t){if(!t)return !0;const e=t[0];return t.length<=1?\"any\"!==e:\"==\"===e?hl(t[1],t[2],\"==\"):\"!=\"===e?dl(hl(t[1],t[2],\"==\")):\"<\"===e||\">\"===e||\"<=\"===e||\">=\"===e?hl(t[1],t[2],e):\"any\"===e?(r=t.slice(1),[\"any\"].concat(r.map(cl))):\"all\"===e?[\"all\"].concat(t.slice(1).map(cl)):\"none\"===e?[\"all\"].concat(t.slice(1).map(cl).map(dl)):\"in\"===e?pl(t[1],t.slice(2)):\"!in\"===e?dl(pl(t[1],t.slice(2))):\"has\"===e?fl(t[1]):\"!has\"!==e||dl(fl(t[1]));var r;}function hl(t,e,r){switch(t){case\"$type\":return [`filter-type-${r}`,e];case\"$id\":return [`filter-id-${r}`,e];default:return [`filter-${r}`,t,e]}}function pl(t,e){if(0===e.length)return !1;switch(t){case\"$type\":return [\"filter-type-in\",[\"literal\",e]];case\"$id\":return [\"filter-id-in\",[\"literal\",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?[\"filter-in-large\",t,[\"literal\",e.sort(ll)]]:[\"filter-in-small\",t,[\"literal\",e]]}}function fl(t){switch(t){case\"$type\":return !0;case\"$id\":return [\"filter-has-id\"];default:return [\"filter-has\",t]}}function dl(t){return [\"!\",t]}const ml=\"\u001f\";function yl(t,e){return e?`${t}${ml}${e}`:t}const gl=\"-transition\",xl=new Set([\"fill\",\"line\",\"background\",\"hillshade\",\"raster\"]);class bl extends Dn{constructor(t,e,r,n){if(super(),this.id=t.id,this.fqid=yl(this.id,r),this.type=t.type,this.scope=r,this.options=n,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.isConfigDependent=!1,\"custom\"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,\"background\"!==t.type&&\"sky\"!==t.type&&\"slot\"!==t.type&&(this.source=t.source,this.sourceLayer=t[\"source-layer\"],this.filter=t.filter),t.slot&&(this.slot=t.slot),e.layout&&(this._unevaluatedLayout=new Qo(e.layout,this.scope,n),this.isConfigDependent=this.isConfigDependent||this._unevaluatedLayout.isConfigDependent),e.paint)){this._transitionablePaint=new qo(e.paint,this.scope,n);for(const e in t.paint)this.setPaintProperty(e,t.paint[e]);for(const e in t.layout)this.setLayoutProperty(e,t.layout[e]);this.isConfigDependent=this.isConfigDependent||this._transitionablePaint.isConfigDependent,this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Xo(e.paint);}}onAdd(t){}onRemove(t){}isDraped(t){return xl.has(this.type)}getLayoutProperty(t){return \"visibility\"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e){if(\"custom\"===this.type&&\"visibility\"===t)return void(this.visibility=e);const r=this._unevaluatedLayout;r._properties.properties[t]&&(r.setValue(t,e),this.isConfigDependent=this.isConfigDependent||r.isConfigDependent,\"visibility\"===t&&this.possiblyEvaluateVisibility());}possiblyEvaluateVisibility(){this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0});}getPaintProperty(t){return ar(t,gl)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e){const r=this._transitionablePaint,n=r._properties.properties;if(ar(t,gl)){const i=t.slice(0,-11);return n[i]&&r.setTransition(i,e||void 0),!1}if(!n[t])return !1;const i=r._values[t],s=i.value.isDataDriven(),a=i.value;r.setValue(t,e),this.isConfigDependent=this.isConfigDependent||r.isConfigDependent,this._handleSpecialPaintPropertyUpdate(t);const o=r._values[t].value,l=o.isDataDriven(),u=ar(t,\"pattern\")||\"line-dasharray\"===t;return l||s||u||this._handleOverridablePaintPropertyUpdate(t,a,o)}_handleSpecialPaintPropertyUpdate(t){}getProgramIds(){return null}getDefaultProgramParams(t,e){return null}_handleOverridablePaintPropertyUpdate(t,e,r){return !1}isHidden(t){return !!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||\"none\"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint);}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e);}serialize(){return lr({id:this.id,type:this.type,slot:this.slot,source:this.source,\"source-layer\":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()},((t,e)=>!(void 0===t||\"layout\"===e&&!Object.keys(t).length||\"paint\"===e&&!Object.keys(t).length)))}is3D(){return !1}isSky(){return !1}isTileClipped(){return !1}hasOffscreenPass(){return !1}hasShadowPass(){return !1}canCastShadows(){return !1}hasLightBeamPass(){return !1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof Yo&&ja(e.property.specification)&&(\"source\"===e.value.kind||\"composite\"===e.value.kind)&&e.value.isStateDependent)return !0}return !1}compileFilter(){this._filterCompiled||(this._featureFilter=nl(this.filter),this._filterCompiled=!0);}invalidateCompiledFilter(){this._filterCompiled=!1;}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(t){this._stats&&(\"shadow\"===t.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0);}queryRadius(t){}queryIntersectsFeature(t,e,r,n,i,s,a,o,l){}queryIntersectsMatchingFeature(t,e,r,n){}}const vl={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class _l{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8;}}class wl{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0);}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.add(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews());}clear(){this.length=0;}resize(t){this.reserve(t),this.length=t;}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e);}}_refreshViews(){throw new Error(\"StructArray#_refreshViews() must be implemented by each concrete StructArray layout\")}emplace(...t){throw new Error(\"StructArray#emplace() must be implemented by each concrete StructArray layout\")}emplaceBack(...t){throw new Error(\"StructArray#emplaceBack() must be implemented by each concrete StructArray layout\")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null;}}function Ml(t,e=1){let r=0,n=0;return {members:t.map((t=>{const i=vl[t.type].BYTES_PER_ELEMENT,s=r=Al(r,Math.max(e,i)),a=t.components||1;return n=Math.max(n,i),r+=i*a,{name:t.name,type:t.type,components:a,offset:s}})),size:Al(r,Math.max(n,e)),alignment:e}}function Al(t,e){return Math.ceil(t/e)*e}class Sl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t}}Sl.prototype.bytesPerElement=4,fo(Sl,\"StructArrayLayout2i4\");class Il extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t}}Il.prototype.bytesPerElement=6,fo(Il,\"StructArrayLayout3i6\");class kl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,t}}kl.prototype.bytesPerElement=8,fo(kl,\"StructArrayLayout4i8\");class Pl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=5*t;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=n,this.int16[a+3]=i,this.int16[a+4]=s,t}}Pl.prototype.bytesPerElement=10,fo(Pl,\"StructArrayLayout5i10\");class El extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s,a){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s,a)}emplace(t,e,r,n,i,s,a,o){const l=6*t,u=12*t,c=3*t;return this.int16[l+0]=e,this.int16[l+1]=r,this.uint8[u+4]=n,this.uint8[u+5]=i,this.uint8[u+6]=s,this.uint8[u+7]=a,this.float32[c+2]=o,t}}El.prototype.bytesPerElement=12,fo(El,\"StructArrayLayout2i4ub1f12\");class zl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=n,this.float32[s+3]=i,t}}zl.prototype.bytesPerElement=16,fo(zl,\"StructArrayLayout4f16\");class Tl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t}}Tl.prototype.bytesPerElement=8,fo(Tl,\"StructArrayLayout2f8\");class Bl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=6*t,o=3*t;return this.uint16[a+0]=e,this.uint16[a+1]=r,this.uint16[a+2]=n,this.uint16[a+3]=i,this.float32[o+2]=s,t}}Bl.prototype.bytesPerElement=12,fo(Bl,\"StructArrayLayout4ui1f12\");class Cl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.uint16[s+0]=e,this.uint16[s+1]=r,this.uint16[s+2]=n,this.uint16[s+3]=i,t}}Cl.prototype.bytesPerElement=8,fo(Cl,\"StructArrayLayout4ui8\");class Rl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=s,this.int16[o+5]=a,t}}Rl.prototype.bytesPerElement=12,fo(Rl,\"StructArrayLayout6i12\");class Vl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,n,i,s,a,o,l,u,c,h)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p){const f=12*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.uint16[f+4]=s,this.uint16[f+5]=a,this.uint16[f+6]=o,this.uint16[f+7]=l,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=h,this.int16[f+11]=p,t}}Vl.prototype.bytesPerElement=24,fo(Vl,\"StructArrayLayout4i4ui4i24\");class Dl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=10*t,l=5*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.float32[l+2]=i,this.float32[l+3]=s,this.float32[l+4]=a,t}}Dl.prototype.bytesPerElement=20,fo(Dl,\"StructArrayLayout3i3f20\");class Ll extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer);}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}Ll.prototype.bytesPerElement=4,fo(Ll,\"StructArrayLayout1ul4\");class Fl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t}}Fl.prototype.bytesPerElement=4,fo(Fl,\"StructArrayLayout2ui4\");class Ol extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p){const f=this.length;return this.resize(f+1),this.emplace(f,t,e,r,n,i,s,a,o,l,u,c,h,p)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,f){const d=20*t,m=10*t;return this.int16[d+0]=e,this.int16[d+1]=r,this.int16[d+2]=n,this.int16[d+3]=i,this.int16[d+4]=s,this.float32[m+3]=a,this.float32[m+4]=o,this.float32[m+5]=l,this.float32[m+6]=u,this.int16[d+14]=c,this.uint32[m+8]=h,this.uint16[d+18]=p,this.uint16[d+19]=f,t}}Ol.prototype.bytesPerElement=40,fo(Ol,\"StructArrayLayout5i4f1i1ul2ui40\");class Ul extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s,a){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s,a)}emplace(t,e,r,n,i,s,a,o){const l=8*t;return this.int16[l+0]=e,this.int16[l+1]=r,this.int16[l+2]=n,this.int16[l+4]=i,this.int16[l+5]=s,this.int16[l+6]=a,this.int16[l+7]=o,t}}Ul.prototype.bytesPerElement=16,fo(Ul,\"StructArrayLayout3i2i2i16\");class Nl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=4*t,o=8*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.int16[o+6]=i,this.int16[o+7]=s,t}}Nl.prototype.bytesPerElement=16,fo(Nl,\"StructArrayLayout2f1f2i16\");class jl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=12*t,a=3*t;return this.uint8[s+0]=e,this.uint8[s+1]=r,this.float32[a+1]=n,this.float32[a+2]=i,t}}jl.prototype.bytesPerElement=12,fo(jl,\"StructArrayLayout2ub2f12\");class ql extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t}}ql.prototype.bytesPerElement=6,fo(ql,\"StructArrayLayout3ui6\");class $l extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,m,y,g,x,b,v){const _=this.length;return this.resize(_+1),this.emplace(_,t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,m,y,g,x,b,v)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,m,y,g,x,b,v,_){const w=30*t,M=15*t,A=60*t;return this.int16[w+0]=e,this.int16[w+1]=r,this.int16[w+2]=n,this.float32[M+2]=i,this.float32[M+3]=s,this.uint16[w+8]=a,this.uint16[w+9]=o,this.uint32[M+5]=l,this.uint32[M+6]=u,this.uint32[M+7]=c,this.uint16[w+16]=h,this.uint16[w+17]=p,this.uint16[w+18]=f,this.float32[M+10]=d,this.float32[M+11]=m,this.uint8[A+48]=y,this.uint8[A+49]=g,this.uint8[A+50]=x,this.uint32[M+13]=b,this.int16[w+28]=v,this.uint8[A+58]=_,t}}$l.prototype.bytesPerElement=60,fo($l,\"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60\");class Gl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,m,y,g,x,b,v,_,w,M,A,S,I,k,P,E,z,T){const B=this.length;return this.resize(B+1),this.emplace(B,t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,m,y,g,x,b,v,_,w,M,A,S,I,k,P,E,z,T)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,m,y,g,x,b,v,_,w,M,A,S,I,k,P,E,z,T,B){const C=20*t,R=40*t,V=80*t;return this.float32[C+0]=e,this.float32[C+1]=r,this.int16[R+4]=n,this.int16[R+5]=i,this.int16[R+6]=s,this.int16[R+7]=a,this.int16[R+8]=o,this.int16[R+9]=l,this.int16[R+10]=u,this.int16[R+11]=c,this.int16[R+12]=h,this.uint16[R+13]=p,this.uint16[R+14]=f,this.uint16[R+15]=d,this.uint16[R+16]=m,this.uint16[R+17]=y,this.uint16[R+18]=g,this.uint16[R+19]=x,this.uint16[R+20]=b,this.uint16[R+21]=v,this.uint16[R+22]=_,this.uint16[R+23]=w,this.uint16[R+24]=M,this.uint16[R+25]=A,this.uint16[R+26]=S,this.uint16[R+27]=I,this.uint32[C+14]=k,this.float32[C+15]=P,this.float32[C+16]=E,this.float32[C+17]=z,this.float32[C+18]=T,this.uint8[V+76]=B,t}}Gl.prototype.bytesPerElement=80,fo(Gl,\"StructArrayLayout2f9i15ui1ul4f1ub80\");class Ql extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Ql.prototype.bytesPerElement=4,fo(Ql,\"StructArrayLayout1f4\");class Yl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=5*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.float32[a+3]=i,this.float32[a+4]=s,t}}Yl.prototype.bytesPerElement=20,fo(Yl,\"StructArrayLayout5f20\");class Xl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s,a){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s,a)}emplace(t,e,r,n,i,s,a,o){const l=7*t;return this.float32[l+0]=e,this.float32[l+1]=r,this.float32[l+2]=n,this.float32[l+3]=i,this.float32[l+4]=s,this.float32[l+5]=a,this.float32[l+6]=o,t}}Xl.prototype.bytesPerElement=28,fo(Xl,\"StructArrayLayout7f28\");class Zl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=6*t;return this.uint32[3*t+0]=e,this.uint16[s+2]=r,this.uint16[s+3]=n,this.uint16[s+4]=i,t}}Zl.prototype.bytesPerElement=12,fo(Zl,\"StructArrayLayout1ul3ui12\");class Kl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Kl.prototype.bytesPerElement=2,fo(Kl,\"StructArrayLayout1ui2\");class Wl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t}}Wl.prototype.bytesPerElement=12,fo(Wl,\"StructArrayLayout3f12\");class Hl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,m){const y=this.length;return this.resize(y+1),this.emplace(y,t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,m)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,m,y){const g=16*t;return this.float32[g+0]=e,this.float32[g+1]=r,this.float32[g+2]=n,this.float32[g+3]=i,this.float32[g+4]=s,this.float32[g+5]=a,this.float32[g+6]=o,this.float32[g+7]=l,this.float32[g+8]=u,this.float32[g+9]=c,this.float32[g+10]=h,this.float32[g+11]=p,this.float32[g+12]=f,this.float32[g+13]=d,this.float32[g+14]=m,this.float32[g+15]=y,t}}Hl.prototype.bytesPerElement=64,fo(Hl,\"StructArrayLayout16f64\");class Jl extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s,a){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s,a)}emplace(t,e,r,n,i,s,a,o){const l=10*t,u=5*t;return this.uint16[l+0]=e,this.uint16[l+1]=r,this.uint16[l+2]=n,this.uint16[l+3]=i,this.float32[u+2]=s,this.float32[u+3]=a,this.float32[u+4]=o,t}}Jl.prototype.bytesPerElement=20,fo(Jl,\"StructArrayLayout4ui3f20\");class tu extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.int16[1*t+0]=e,t}}tu.prototype.bytesPerElement=2,fo(tu,\"StructArrayLayout1i2\");class eu extends wl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer);}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint8[1*t+0]=e,t}}eu.prototype.bytesPerElement=1,fo(eu,\"StructArrayLayout1ub1\");class ru extends _l{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}ru.prototype.size=40;class nu extends Ol{get(t){return new ru(this,t)}}fo(nu,\"CollisionBoxArray\");class iu extends _l{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(t){this._structArray.uint8[this._pos1+49]=t;}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(t){this._structArray.uint8[this._pos1+50]=t;}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(t){this._structArray.uint32[this._pos4+13]=t;}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(t){this._structArray.uint8[this._pos1+58]=t;}}iu.prototype.size=60;class su extends $l{get(t){return new iu(this,t)}}fo(su,\"PlacedSymbolArray\");class au extends _l{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(t){this._structArray.uint32[this._pos4+14]=t;}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(t){this._structArray.float32[this._pos4+18]=t;}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}}au.prototype.size=80;class ou extends Gl{get(t){return new au(this,t)}}fo(ou,\"SymbolInstanceArray\");class lu extends Ql{getoffsetX(t){return this.float32[1*t+0]}}fo(lu,\"GlyphOffsetArray\");class uu extends Sl{getx(t){return this.int16[2*t+0]}gety(t){return this.int16[2*t+1]}}fo(uu,\"SymbolLineVertexArray\");class cu extends _l{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}cu.prototype.size=12;class hu extends Zl{get(t){return new cu(this,t)}}fo(hu,\"FeatureIndexArray\");class pu extends Fl{geta_centroid_pos0(t){return this.uint16[2*t+0]}geta_centroid_pos1(t){return this.uint16[2*t+1]}}fo(pu,\"FillExtrusionCentroidArray\");const fu=Ml([{name:\"a_pos\",components:2,type:\"Int16\"}],4),du=Ml([{name:\"a_pos_3\",components:3,type:\"Int16\"},{name:\"a_pos_normal_3\",components:3,type:\"Int16\"}]);class mu{constructor(t=[]){this.segments=t;}_prepareSegment(t,e,r,n){let i=this.segments[this.segments.length-1];return t>mu.MAX_VERTEX_ARRAY_LENGTH&&hr(`Max vertices per segment is ${mu.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!i||i.vertexLength+t>mu.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e,primitiveOffset:r,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i}prepareSegment(t,e,r,n){return this._prepareSegment(t,e.length,r.length,n)}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy();}static simpleSegment(t,e,r,n){return new mu([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}function yu(t,e){return 256*(t=Ze(Math.floor(t),0,255))+Ze(Math.floor(e),0,255)}mu.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,fo(mu,\"SegmentVector\");const gu=Ml([{name:\"a_pattern\",components:4,type:\"Uint16\"},{name:\"a_pixel_ratio\",components:1,type:\"Float32\"}]),xu=Ml([{name:\"a_dash\",components:4,type:\"Uint16\"}]);class bu{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1;}add(t,e,r,n){this.ids.push(vu(t)),this.positions.push(e,r,n);}eachPosition(t,e){const r=vu(t);let n=0,i=this.ids.length-1;for(;n<i;){const t=n+i>>1;this.ids[t]>=r?i=t:n=t+1;}for(;this.ids[n]===r;)e(this.positions[3*n],this.positions[3*n+1],this.positions[3*n+2]),n++;}static serialize(t,e){const r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return _u(r,n,0,r.length-1),e&&(e.add(r.buffer),e.add(n.buffer)),{ids:r,positions:n}}static deserialize(t){const e=new bu;let r;e.ids=t.ids,e.positions=t.positions;for(const t of e.ids)t!==r&&e.uniqueIds.push(t),r=t;return e.indexed=!0,e}}function vu(t){const e=+t;return !isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:Tn(String(t))}function _u(t,e,r,n){for(;r<n;){const i=t[r+n>>1];let s=r-1,a=n+1;for(;;){do{s++;}while(t[s]<i);do{a--;}while(t[a]>i);if(s>=a)break;wu(t,s,a),wu(e,3*s,3*a),wu(e,3*s+1,3*a+1),wu(e,3*s+2,3*a+2);}a-r<n-a?(_u(t,e,r,a),r=a+1):(_u(t,e,a+1,n),n=a);}}function wu(t,e,r){const n=t[e];t[e]=t[r],t[r]=n;}fo(bu,\"FeaturePositionMap\");class Mu{constructor(t){this.gl=t.gl,this.initialized=!1;}fetchUniformLocation(t,e){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(t,e),this.initialized=!0),!!this.location}set(t,e,r){throw new Error(\"Uniform#set() must be implemented by each concrete Uniform\")}}class Au extends Mu{constructor(t){super(t),this.current=0;}set(t,e,r){this.fetchUniformLocation(t,e)&&this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r));}}class Su extends Mu{constructor(t){super(t),this.current=0;}set(t,e,r){this.fetchUniformLocation(t,e)&&this.current!==r&&(this.current=r,this.gl.uniform1f(this.location,r));}}class Iu extends Mu{constructor(t){super(t),this.current=[0,0];}set(t,e,r){this.fetchUniformLocation(t,e)&&(r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1])));}}class ku extends Mu{constructor(t){super(t),this.current=[0,0,0];}set(t,e,r){this.fetchUniformLocation(t,e)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2])));}}class Pu extends Mu{constructor(t){super(t),this.current=[0,0,0,0];}set(t,e,r){this.fetchUniformLocation(t,e)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]&&r[3]===this.current[3]||(this.current=r,this.gl.uniform4f(this.location,r[0],r[1],r[2],r[3])));}}class Eu extends Mu{constructor(t){super(t),this.current=jn.transparent;}set(t,e,r){this.fetchUniformLocation(t,e)&&(r.r===this.current.r&&r.g===this.current.g&&r.b===this.current.b&&r.a===this.current.a||(this.current=r,this.gl.uniform4f(this.location,r.r,r.g,r.b,r.a)));}}const zu=new Float32Array(16);class Tu extends Mu{constructor(t){super(t),this.current=zu;}set(t,e,r){if(this.fetchUniformLocation(t,e)){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let t=1;t<16;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}}}const Bu=new Float32Array(9),Cu=new Float32Array(4);class Ru extends Mu{constructor(t){super(t),this.current=Cu;}set(t,e,r){if(this.fetchUniformLocation(t,e))for(let t=0;t<4;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix2fv(this.location,!1,r);break}}}function Vu(t){return [yu(255*t.r,255*t.g),yu(255*t.b,255*t.a)]}class Du{constructor(t,e,r){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=r;}setUniform(t,e,r,n,i){e.set(t,i,n.constantOr(this.value));}getBinding(t,e){return \"color\"===this.type?new Eu(t):new Su(t)}}class Lu{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.pattern=null,this.pixelRatio=1;}setConstantPatternPositions(t){this.pixelRatio=t.pixelRatio||1,this.pattern=t.tl.concat(t.br);}setUniform(t,e,r,n,i){const s=\"u_pattern\"===i||\"u_dash\"===i?this.pattern:\"u_pixel_ratio\"===i?this.pixelRatio:null;s&&e.set(t,i,s);}getBinding(t,e){return \"u_pattern\"===e||\"u_dash\"===e?new Pu(t):new Su(t)}}class Fu{constructor(t,e,r,n){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:\"Float32\",components:\"color\"===r?2:1,offset:0}))),this.paintVertexArray=new n;}populatePaintArray(t,e,r,n,i,s,a){const o=this.paintVertexArray.length,l=this.expression.evaluate(new Uo(0,{brightness:s}),e,{},i,n,a);this.paintVertexArray.resize(t),this._setPaintValue(o,t,l);}updatePaintArray(t,e,r,n,i,s,a){const o=this.expression.evaluate({zoom:0,brightness:a},r,n,void 0,i);this._setPaintValue(t,e,o);}_setPaintValue(t,e,r){if(\"color\"===this.type){const n=Vu(r);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,n[0],n[1]);}else {for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,r);this.maxValue=Math.max(this.maxValue,Math.abs(r));}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant));}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy();}}class Ou{constructor(t,e,r,n,i,s){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=r,this.useIntegerZoom=n,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:\"Float32\",components:\"color\"===r?4:2,offset:0}))),this.paintVertexArray=new s;}populatePaintArray(t,e,r,n,i,s,a){const o=this.expression.evaluate(new Uo(this.zoom,{brightness:s}),e,{},i,n,a),l=this.expression.evaluate(new Uo(this.zoom+1,{brightness:s}),e,{},i,n,a),u=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(u,t,o,l);}updatePaintArray(t,e,r,n,i,s,a){const o=this.expression.evaluate({zoom:this.zoom,brightness:a},r,n,void 0,i),l=this.expression.evaluate({zoom:this.zoom+1,brightness:a},r,n,void 0,i);this._setPaintValue(t,e,o,l);}_setPaintValue(t,e,r,n){if(\"color\"===this.type){const i=Vu(r),s=Vu(n);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i[0],i[1],s[0],s[1]);}else {for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r,n);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(n));}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant));}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy();}setUniform(t,e,r,n,i){const s=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,a=Ze(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(t,i,a);}getBinding(t,e){return new Su(t)}}class Uu{constructor(t,e,r,n,i){this.expression=t,this.layerId=i,this.paintVertexAttributes=(\"array\"===r?xu:gu).members;for(let t=0;t<e.length;++t);this.paintVertexArray=new n;}populatePaintArray(t,e,r){const n=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValues(n,t,e.patterns&&e.patterns[this.layerId],r);}updatePaintArray(t,e,r,n,i,s,a){this._setPaintValues(t,e,r.patterns&&r.patterns[this.layerId],s);}_setPaintValues(t,e,r,n){if(!n||!r)return;const i=n[r];if(!i)return;const{tl:s,br:a,pixelRatio:o}=i;for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,s[0],s[1],a[0],a[1],o);}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant));}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy();}}class Nu{constructor(t,e,r=(()=>!0)){this.binders={},this._buffers=[];const n=[];for(const i in t.paint._values){const s=t.paint.get(i);if(!r(i))continue;if(!(s instanceof Yo&&ja(s.property.specification)))continue;const a=$u(i,t.type),o=s.value,l=s.property.specification.type,u=!!s.property.useIntegerZoom,c=\"line-dasharray\"===i||i.endsWith(\"pattern\"),h=\"line-dasharray\"===i&&\"constant\"!==t.layout.get(\"line-cap\").value.kind;if(\"constant\"!==o.kind||h)if(\"source\"===o.kind||h||c){const e=Yu(i,l,\"source\");this.binders[i]=c?new Uu(o,a,l,e,t.id):new Fu(o,a,l,e),n.push(`/a_${i}`);}else {const t=Yu(i,l,\"composite\");this.binders[i]=new Ou(o,a,l,u,e,t),n.push(`/z_${i}`);}else this.binders[i]=c?new Lu(o.value,a):new Du(o.value,a,l),n.push(`/u_${i}`);}this.cacheKey=n.sort().join(\"\");}getMaxValue(t){const e=this.binders[t];return e instanceof Fu||e instanceof Ou?e.maxValue:0}populatePaintArrays(t,e,r,n,i,s,a){for(const o in this.binders){const l=this.binders[o];(l instanceof Fu||l instanceof Ou||l instanceof Uu)&&l.populatePaintArray(t,e,r,n,i,s,a);}}setConstantPatternPositions(t){for(const e in this.binders){const r=this.binders[e];r instanceof Lu&&r.setConstantPatternPositions(t);}}updatePaintArrays(t,e,r,n,i,s,a,o){let l=!1;const u=Object.keys(t),c=0!==u.length,h=c?u:e.uniqueIds;for(const u in this.binders){const p=this.binders[u];if((p instanceof Fu||p instanceof Ou||p instanceof Uu)&&(!0===p.expression.isStateDependent||!1===p.expression.isLightConstant)){const f=i.paint.get(u);p.expression=f.value;for(const r of h){const i=t[r.toString()];e.eachPosition(r,((t,e,r)=>{const l=n.feature(t);p.updatePaintArray(e,r,l,i,s,a,o);}));}if(!c)for(const e of r.uniqueIds){const i=t[e.toString()];r.eachPosition(e,((t,e,r)=>{const l=n.feature(t);p.updatePaintArray(e,r,l,i,s,a,o);}));}l=!0;}}return l}defines(){const t=[];for(const e in this.binders){const r=this.binders[e];(r instanceof Du||r instanceof Lu)&&t.push(...r.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)));}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof Fu||r instanceof Ou||r instanceof Uu)for(let e=0;e<r.paintVertexAttributes.length;e++)t.push(r.paintVertexAttributes[e].name);}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof Du||r instanceof Lu||r instanceof Ou)for(const e of r.uniformNames)t.push(e);}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t){const e=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof Du||n instanceof Lu||n instanceof Ou)for(const i of n.uniformNames)e.push({name:i,property:r,binding:n.getBinding(t,i)});}return e}setUniforms(t,e,r,n,i){for(const{name:e,property:s,binding:a}of r)this.binders[s].setUniform(t,a,i,n.get(s),e);}updatePaintBuffers(){this._buffers=[];for(const t in this.binders){const e=this.binders[t];(e instanceof Fu||e instanceof Ou||e instanceof Uu)&&e.paintVertexBuffer&&this._buffers.push(e.paintVertexBuffer);}}upload(t){for(const e in this.binders){const r=this.binders[e];(r instanceof Fu||r instanceof Ou||r instanceof Uu)&&r.upload(t);}this.updatePaintBuffers();}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof Fu||e instanceof Ou||e instanceof Uu)&&e.destroy();}}}class ju{constructor(t,e,r=(()=>!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new Nu(n,e,r);this.needsUpload=!1,this._featureMap=new bu,this._featureMapWithoutIds=new bu,this._bufferOffset=0,this._idlessCounter=0;}populatePaintArrays(t,e,r,n,i,s,a,o){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,e,n,i,s,a,o);void 0!==e.id?this._featureMap.add(e.id,r,this._bufferOffset,t):(this._featureMapWithoutIds.add(this._idlessCounter,r,this._bufferOffset,t),this._idlessCounter+=1),this._bufferOffset=t,this.needsUpload=!0;}updatePaintArrays(t,e,r,n,i,s){for(const a of r)this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(t,this._featureMap,this._featureMapWithoutIds,e,a,n,i,s||0)||this.needsUpload;}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1;}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy();}}const qu={\"text-opacity\":[\"opacity\"],\"icon-opacity\":[\"opacity\"],\"text-color\":[\"fill_color\"],\"icon-color\":[\"fill_color\"],\"text-emissive-strength\":[\"emissive_strength\"],\"icon-emissive-strength\":[\"emissive_strength\"],\"text-halo-color\":[\"halo_color\"],\"icon-halo-color\":[\"halo_color\"],\"text-halo-blur\":[\"halo_blur\"],\"icon-halo-blur\":[\"halo_blur\"],\"text-halo-width\":[\"halo_width\"],\"icon-halo-width\":[\"halo_width\"],\"line-gap-width\":[\"gapwidth\"],\"line-pattern\":[\"pattern\",\"pixel_ratio\"],\"fill-pattern\":[\"pattern\",\"pixel_ratio\"],\"fill-extrusion-pattern\":[\"pattern\",\"pixel_ratio\"],\"line-dasharray\":[\"dash\"]};function $u(t,e){return qu[t]||[t.replace(`${e}-`,\"\").replace(/-/g,\"_\")]}const Gu={\"line-pattern\":{source:Bl,composite:Bl},\"fill-pattern\":{source:Bl,composite:Bl},\"fill-extrusion-pattern\":{source:Bl,composite:Bl},\"line-dasharray\":{source:Cl,composite:Cl}},Qu={color:{source:Tl,composite:zl},number:{source:Ql,composite:Tl}};function Yu(t,e,r){const n=Gu[t];return n&&n[r]||Qu[e][r]}fo(Du,\"ConstantBinder\"),fo(Lu,\"PatternConstantBinder\"),fo(Fu,\"SourceExpressionBinder\"),fo(Uu,\"PatternCompositeBinder\"),fo(Ou,\"CompositeExpressionBinder\"),fo(Nu,\"ProgramConfiguration\",{omit:[\"_buffers\"]}),fo(ju,\"ProgramConfigurationSet\");const Xu=is/Math.PI/2,Zu=5,Ku=6,Wu=16383,Hu=64,Ju=[Hu,32,16],tc=-Xu,ec=Xu;function rc(t,e,r,n=Xu){return r=qe(r),[t*Math.sin(r)*n,-e*n,t*Math.cos(r)*n]}function nc(t,e,r){return rc(Math.cos(qe(t)),Math.sin(qe(t)),e,r)}const ic=6371008.8,sc=2*Math.PI*ic;class ac{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error(\"Invalid LngLat latitude value: must be between -90 and 90\")}wrap(){return new ac(We(this.lng,-180,180),this.lat)}toArray(){return [this.lng,this.lat]}toString(){return `LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return ic*Math.acos(Math.min(i,1))}toBounds(t=0){const e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new oc({lng:this.lng-r,lat:this.lat-e},{lng:this.lng+r,lat:this.lat+e})}toEcef(t){return nc(this.lat,this.lng,Xu+t*Xu/ic)}static convert(t){if(t instanceof ac)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new ac(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&\"object\"==typeof t&&null!==t)return new ac(Number(\"lng\"in t?t.lng:t.lon),Number(t.lat));throw new Error(\"`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]\")}}class oc{constructor(t,e){if(t)if(e)this.setSouthWest(t).setNorthEast(e);else if(4===t.length){const e=t;this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]);}else {const e=t;this.setSouthWest(e[0]).setNorthEast(e[1]);}}setNorthEast(t){return this._ne=t instanceof ac?new ac(t.lng,t.lat):ac.convert(t),this}setSouthWest(t){return this._sw=t instanceof ac?new ac(t.lng,t.lat):ac.convert(t),this}extend(t){const e=this._sw,r=this._ne;let n,i;if(t instanceof ac)n=t,i=t;else {if(!(t instanceof oc))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(oc.convert(t)):this.extend(ac.convert(t)):\"object\"==typeof t&&null!==t&&t.hasOwnProperty(\"lat\")&&(t.hasOwnProperty(\"lon\")||t.hasOwnProperty(\"lng\"))?this.extend(ac.convert(t)):this;if(n=t._sw,i=t._ne,!n||!i)return this}return e||r?(e.lng=Math.min(n.lng,e.lng),e.lat=Math.min(n.lat,e.lat),r.lng=Math.max(i.lng,r.lng),r.lat=Math.max(i.lat,r.lat)):(this._sw=new ac(n.lng,n.lat),this._ne=new ac(i.lng,i.lat)),this}getCenter(){return new ac((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new ac(this.getWest(),this.getNorth())}getSouthEast(){return new ac(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return [this._sw.toArray(),this._ne.toArray()]}toString(){return `LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return !(this._sw&&this._ne)}contains(t){const{lng:e,lat:r}=ac.convert(t);let n=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=e&&e>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}static convert(t){return !t||t instanceof oc?t:new oc(t)}}var lc={};!function(t,e){!function(t){function e(t,e,n){var i=r(256*t,256*(e=Math.pow(2,n)-e-1),n),s=r(256*(t+1),256*(e+1),n);return i[0]+\",\"+i[1]+\",\"+s[0]+\",\"+s[1]}function r(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return [t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}t.getURL=function(t,r,n,i,s,a){return a=a||{},t+\"?\"+[\"bbox=\"+e(n,i,s),\"format=\"+(a.format||\"image/png\"),\"service=\"+(a.service||\"WMS\"),\"version=\"+(a.version||\"1.1.1\"),\"request=\"+(a.request||\"GetMap\"),\"srs=\"+(a.srs||\"EPSG:3857\"),\"width=\"+(a.width||256),\"height=\"+(a.height||256),\"layers=\"+r].join(\"&\")},t.getTileBBox=e,t.getMercCoords=r,Object.defineProperty(t,\"__esModule\",{value:!0});}(e);}(0,lc);var uc=lc;class cc{constructor(t,e,r){this.z=t,this.x=e,this.y=r,this.key=fc(0,t,t,e,r);}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e){const r=uc.getTileBBox(this.x,this.y,this.z),n=function(t,e,r){let n,i=\"\";for(let s=t;s>0;s--)n=1<<s-1,i+=(e&n?1:0)+(r&n?2:0);return i}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(\"{prefix}\",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(\"tms\"===e?Math.pow(2,this.z)-this.y-1:this.y)).replace(\"{quadkey}\",n).replace(\"{bbox-epsg-3857}\",r)}toString(){return `${this.z}/${this.x}/${this.y}`}}class hc{constructor(t,e){this.wrap=t,this.canonical=e,this.key=fc(t,e.z,e.z,e.x,e.y);}}class pc{constructor(t,e,r,n,i){this.overscaledZ=t,this.wrap=e,this.canonical=new cc(r,+n,+i),this.key=0===e&&t===r?this.canonical.key:fc(e,t,r,n,i);}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){const e=this.canonical.z-t;return t>this.canonical.z?new pc(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new pc(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e=!0){if(this.overscaledZ===t&&e)return this.key;if(t>this.canonical.z)return fc(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y);{const r=this.canonical.z-t;return fc(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}}isChildOf(t){if(t.wrap!==this.wrap)return !1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.z<this.canonical.z&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return [new pc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return [new pc(e,this.wrap,e,r,n),new pc(e,this.wrap,e,r+1,n),new pc(e,this.wrap,e,r,n+1),new pc(e,this.wrap,e,r+1,n+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new pc(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new pc(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new hc(this.wrap,this.canonical)}toString(){return `${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function fc(t,e,r,n,i){const s=1<<Math.min(r,22);let a=s*(i%s)+n%s;return t&&r<22&&(a+=s*s*((t<0?-2*t-1:2*t)%(1<<2*(22-r)))),16*(32*a+r)+(e-r)}const dc=[t=>{let e=t.canonical.x-1,r=t.wrap;return e<0&&(e=(1<<t.canonical.z)-1,r--),new pc(t.overscaledZ,r,t.canonical.z,e,t.canonical.y)},t=>{let e=t.canonical.x+1,r=t.wrap;return e===1<<t.canonical.z&&(e=0,r++),new pc(t.overscaledZ,r,t.canonical.z,e,t.canonical.y)},t=>new pc(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,(0===t.canonical.y?1<<t.canonical.z:t.canonical.y)-1),t=>new pc(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y===(1<<t.canonical.z)-1?0:t.canonical.y+1)];fo(cc,\"CanonicalTileID\"),fo(pc,\"OverscaledTileID\",{omit:[\"projMatrix\",\"expandedProjMatrix\"]});const mc=0,yc=25.5;function gc(t){return sc*Math.cos(t*Math.PI/180)}function xc(t){return (180+t)/360}function bc(t){return (180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function vc(t,e){return t/gc(e)}function _c(t){return 360*t-180}function wc(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function Mc(t,e){return t*gc(wc(e))}const Ac=85.051129;function Sc(t){return Math.cos(qe(Ze(t,-Ac,Ac)))}function Ic(t,e){const r=Ze(e,mc,yc),n=Math.pow(2,r);return Sc(t)*sc/(512*n)}function kc(t){return 1/Math.cos(t*Math.PI/180)}function Pc(t,e=0){const r=Math.exp(Math.PI*(1-(t.y+e/is)/(1<<t.z)*2));return 80150034*r/(r*r+1)/is/(1<<t.z)}class Ec{constructor(t,e,r=0){this.x=+t,this.y=+e,this.z=+r;}static fromLngLat(t,e=0){const r=ac.convert(t);return new Ec(xc(r.lng),bc(r.lat),vc(e,r.lat))}toLngLat(){return new ac(_c(this.x),wc(this.y))}toAltitude(){return Mc(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/sc*kc(wc(this.y))}}function zc(t,e,r,n,i,s,a,o,l){const u=(e+n)/2,c=(r+i)/2,h=new Ue(u,c);o(h),function(t,e,r,n,i,s){const a=r-i,o=n-s;return Math.abs((n-e)*a-(r-t)*o)/Math.hypot(a,o)}(h.x,h.y,s.x,s.y,a.x,a.y)>=l?(zc(t,e,r,u,c,s,h,o,l),zc(t,u,c,n,i,h,a,o,l)):t.push(a);}function Tc(t,e,r){let n=t[0],i=n.x,s=n.y;e(n);const a=[n];for(let o=1;o<t.length;o++){const l=t[o],{x:u,y:c}=l;e(l),zc(a,i,s,u,c,n,l,e,r),i=u,s=c,n=l;}return a}function Bc(t,e,r,n){if(n(e,r)){const i=e.add(r)._mult(.5);Bc(t,e,i,n),Bc(t,i,r,n);}else t.push(r);}function Cc(t,e){let r=t[0];const n=[r];for(let i=1;i<t.length;i++){const s=t[i];Bc(n,r,s,e),r=s;}return n}const Rc=Math.pow(2,14)-1,Vc=-Rc-1;function Dc(t,e){const r=Math.round(t.x*e),n=Math.round(t.y*e);return t.x=Ze(r,Vc,Rc),t.y=Ze(n,Vc,Rc),(r<t.x||r>t.x+1||n<t.y||n>t.y+1)&&hr(\"Geometry exceeds allowed extent, reduce your vector tile buffer size\"),t}function Lc(t,e,r){const n=t.loadGeometry(),i=t.extent,s=is/i;if(e&&r&&r.projection.isReprojectedInTileSpace){const s=1<<e.z,{scale:a,x:o,y:l,projection:u}=r,c=t=>{const r=_c((e.x+t.x/i)/s),n=wc((e.y+t.y/i)/s),c=u.project(r,n);t.x=(c.x*a-o)*i,t.y=(c.y*a-l)*i;};for(let e=0;e<n.length;e++)if(1!==t.type)n[e]=Tc(n[e],c,1);else {const t=[];for(const r of n[e])r.x<0||r.x>=i||r.y<0||r.y>=i||(c(r),t.push(r));n[e]=t;}}for(const t of n)for(const e of t)Dc(e,s);return n}function Fc(t,e){return {type:t.type,id:t.id,properties:t.properties,geometry:e?Lc(t):[]}}function Oc(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2);}function Uc(t,e,r){const n=16384;t.emplaceBack(e.x,e.y,e.z,r[0]*n,r[1]*n,r[2]*n);}class Nc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.fqid)),this.index=t.index,this.hasPattern=!1,this.projection=t.projection,this.layoutVertexArray=new Sl,this.indexArray=new ql,this.segments=new mu,this.programConfigurations=new ju(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,r,n){const i=this.layers[0],s=[];let a=null;\"circle\"===i.type&&(a=i.layout.get(\"circle-sort-key\"));for(const{feature:e,id:i,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Fc(e,t);if(!this.layers[0]._featureFilter.filter(new Uo(this.zoom),u,r))continue;const c=a?a.evaluate(u,{},r):void 0,h={id:i,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Lc(e,r,n),patterns:{},sortKey:c};s.push(h);}a&&s.sort(((t,e)=>t.sortKey-e.sortKey));let o=null;\"globe\"===n.projection.name&&(this.globeExtVertexArray=new Rl,o=n.projection);for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n,l=t[s].feature;this.addFeature(n,i,s,e.availableImages,r,o,e.brightness),e.featureIndex.insert(l,i,s,a,this.index);}}update(t,e,r,n,i){const s=0!==Object.keys(t).length;s&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(t,e,s?this.stateDependentLayers:this.layers,r,n,i);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,fu.members),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=t.createVertexBuffer(this.globeExtVertexArray,du.members))),this.programConfigurations.upload(t),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy());}addFeature(t,e,r,n,i,s,a){for(const r of e)for(const e of r){const r=e.x,n=e.y;if(r<0||r>=is||n<0||n>=is)continue;if(s){const t=s.projectTilePoint(r,n,i),e=s.upVector(i,r,n),a=this.globeExtVertexArray;Uc(a,t,e),Uc(a,t,e),Uc(a,t,e),Uc(a,t,e);}const a=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),o=a.vertexLength;Oc(this.layoutVertexArray,r,n,-1,-1),Oc(this.layoutVertexArray,r,n,1,-1),Oc(this.layoutVertexArray,r,n,1,1),Oc(this.layoutVertexArray,r,n,-1,1),this.indexArray.emplaceBack(o,o+1,o+2),this.indexArray.emplaceBack(o,o+2,o+3),a.vertexLength+=4,a.primitiveLength+=2;}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n,i,a);}}function jc(t,e){for(let r=0;r<t.length;r++)if(Wc(e,t[r]))return !0;for(let r=0;r<e.length;r++)if(Wc(t,e[r]))return !0;return !!Qc(t,e)}function qc(t,e,r){return !!Wc(t,e)||!!Xc(e,t,r)}function $c(t,e){if(1===t.length)return Kc(e,t[0]);for(let r=0;r<e.length;r++){const n=e[r];for(let e=0;e<n.length;e++)if(Wc(t,n[e]))return !0}for(let r=0;r<t.length;r++)if(Kc(e,t[r]))return !0;for(let r=0;r<e.length;r++)if(Qc(t,e[r]))return !0;return !1}function Gc(t,e,r){if(t.length>1){if(Qc(t,e))return !0;for(let n=0;n<e.length;n++)if(Xc(e[n],t,r))return !0}for(let n=0;n<t.length;n++)if(Xc(t[n],e,r))return !0;return !1}function Qc(t,e){if(0===t.length||0===e.length)return !1;for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1];for(let t=0;t<e.length-1;t++)if(Yc(n,i,e[t],e[t+1]))return !0}return !1}function Yc(t,e,r,n){return pr(t,r,n)!==pr(e,r,n)&&pr(t,e,r)!==pr(t,e,n)}function Xc(t,e,r){const n=r*r;if(1===e.length)return t.distSqr(e[0])<n;for(let r=1;r<e.length;r++)if(Zc(t,e[r-1],e[r])<n)return !0;return !1}function Zc(t,e,r){const n=e.distSqr(r);if(0===n)return t.distSqr(e);const i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return t.distSqr(i<0?e:i>1?r:r.sub(e)._mult(i)._add(e))}function Kc(t,e){let r,n,i,s=!1;for(let a=0;a<t.length;a++){r=t[a];for(let t=0,a=r.length-1;t<r.length;a=t++)n=r[t],i=r[a],n.y>e.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(s=!s);}return s}function Wc(t,e){let r=!1;for(let n=0,i=t.length-1;n<t.length;i=n++){const s=t[n],a=t[i];s.y>e.y!=a.y>e.y&&e.x<(a.x-s.x)*(e.y-s.y)/(a.y-s.y)+s.x&&(r=!r);}return r}function Hc(t,e,r,n,i){for(const s of t)if(e<=s.x&&r<=s.y&&n>=s.x&&i>=s.y)return !0;const s=[new Ue(e,r),new Ue(e,i),new Ue(n,i),new Ue(n,r)];if(t.length>2)for(const e of s)if(Wc(t,e))return !0;for(let e=0;e<t.length-1;e++)if(Jc(t[e],t[e+1],s))return !0;return !1}function Jc(t,e,r){const n=r[0],i=r[2];if(t.x<n.x&&e.x<n.x||t.x>i.x&&e.x>i.x||t.y<n.y&&e.y<n.y||t.y>i.y&&e.y>i.y)return !1;const s=pr(t,e,r[0]);return s!==pr(t,e,r[1])||s!==pr(t,e,r[2])||s!==pr(t,e,r[3])}function th(t,e,r,n,i,s){let a=e.y-t.y,o=t.x-e.x;if(s=s||0){const t=a*a+o*o;if(0===t)return !0;const e=Math.sqrt(t);a/=e,o/=e;}return !((r.x-t.x)*a+(r.y-t.y)*o-s<0||(n.x-t.x)*a+(n.y-t.y)*o-s<0||(i.x-t.x)*a+(i.y-t.y)*o-s<0)}function eh(t,e,r,n,i,s,a){return !(th(t,e,n,i,s,a)||th(e,r,n,i,s,a)||th(r,t,n,i,s,a)||th(n,i,t,e,r,a)||th(i,s,t,e,r,a)||th(s,n,t,e,r,a))}function rh(t,e,r){const n=e.paint.get(t).value;return \"constant\"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function nh(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function ih(t,e,r,n,i){if(!e[0]&&!e[1])return t;const s=Ue.convert(e)._mult(i);\"viewport\"===r&&s._rotate(-n);const a=[];for(let e=0;e<t.length;e++)a.push(t[e].sub(s));return a}function sh(t,e,r,n){const i=Ue.convert(t)._mult(n);return \"viewport\"===e&&i._rotate(-r),i}fo(Nc,\"CircleBucket\",{omit:[\"layers\"]});const ah=new Ho({\"circle-sort-key\":new Ko(el.layout_circle[\"circle-sort-key\"]),visibility:new Zo(el.layout_circle.visibility)});var oh={paint:new Ho({\"circle-radius\":new Ko(el.paint_circle[\"circle-radius\"]),\"circle-color\":new Ko(el.paint_circle[\"circle-color\"]),\"circle-blur\":new Ko(el.paint_circle[\"circle-blur\"]),\"circle-opacity\":new Ko(el.paint_circle[\"circle-opacity\"]),\"circle-translate\":new Zo(el.paint_circle[\"circle-translate\"]),\"circle-translate-anchor\":new Zo(el.paint_circle[\"circle-translate-anchor\"]),\"circle-pitch-scale\":new Zo(el.paint_circle[\"circle-pitch-scale\"]),\"circle-pitch-alignment\":new Zo(el.paint_circle[\"circle-pitch-alignment\"]),\"circle-stroke-width\":new Ko(el.paint_circle[\"circle-stroke-width\"]),\"circle-stroke-color\":new Ko(el.paint_circle[\"circle-stroke-color\"]),\"circle-stroke-opacity\":new Ko(el.paint_circle[\"circle-stroke-opacity\"]),\"circle-emissive-strength\":new Zo(el.paint_circle[\"circle-emissive-strength\"])}),layout:ah};class lh{constructor(t,e){this.pos=t,this.dir=e;}intersectsPlane(e,r,n){const i=t.Q.dot(r,this.dir);if(Math.abs(i)<1e-6)return !1;const s=((e[0]-this.pos[0])*r[0]+(e[1]-this.pos[1])*r[1]+(e[2]-this.pos[2])*r[2])/i;return n[0]=this.pos[0]+this.dir[0]*s,n[1]=this.pos[1]+this.dir[1]*s,n[2]=this.pos[2]+this.dir[2]*s,!0}closestPointOnSphere(e,r,n){if(t.Q.equals(this.pos,e)||0===r)return n[0]=n[1]=n[2]=0,!1;const[i,s,a]=this.dir,o=this.pos[0]-e[0],l=this.pos[1]-e[1],u=this.pos[2]-e[2],c=i*i+s*s+a*a,h=2*(o*i+l*s+u*a),p=h*h-4*c*(o*o+l*l+u*u-r*r);if(p<0){const t=Math.max(-h/2,0),e=o+i*t,c=l+s*t,p=u+a*t,f=Math.hypot(e,c,p);return n[0]=e*r/f,n[1]=c*r/f,n[2]=p*r/f,!1}{const t=(-h-Math.sqrt(p))/(2*c);if(t<0){const t=Math.hypot(o,l,u);return n[0]=o*r/t,n[1]=l*r/t,n[2]=u*r/t,!1}return n[0]=o+i*t,n[1]=l+s*t,n[2]=u+a*t,!0}}}class uh{constructor(t,e,r,n,i){this.TL=t,this.TR=e,this.BR=r,this.BL=n,this.horizon=i;}static fromInvProjectionMatrix(e,r,n){const i=[-1,1,1],s=[1,1,1],a=[1,-1,1],o=[-1,-1,1],l=t.Q.transformMat4(i,i,e),u=t.Q.transformMat4(s,s,e),c=t.Q.transformMat4(a,a,e),h=t.Q.transformMat4(o,o,e);return new uh(l,u,c,h,r/n)}}function ch(e,r,n){let i=1/0,s=-1/0;const a=[];for(const o of e){t.Q.sub(a,o,r);const e=t.Q.dot(a,n);i=Math.min(i,e),s=Math.max(s,e);}return [i,s]}function hh(e,r){let n=!0;for(let i=0;i<e.planes.length;i++){const s=e.planes[i];let a=0;for(let e=0;e<r.length;e++)a+=t.Q.dot(s,r[e])+s[3]>=0;if(0===a)return 0;a!==r.length&&(n=!1);}return n?2:1}function ph(t,e){for(const r of t.projections){const n=ch(e,t.points[0],r.axis);if(r.projection[1]<n[0]||r.projection[0]>n[1])return 0}return 1}function fh(e,r){let n=0;const i=[0,0,0,0];for(let s=0;s<e.length;s++)i[0]=e[s][0],i[1]=e[s][1],i[2]=e[s][2],i[3]=1,t.aa.dot(i,r)>=0&&n++;return n}class dh{constructor(e,r){this.points=e||new Array(8).fill([0,0,0]),this.planes=r||new Array(6).fill([0,0,0,0]),this.bounds=mh.fromPoints(this.points),this.projections=[],this.frustumEdges=[t.Q.sub([],this.points[2],this.points[3]),t.Q.sub([],this.points[0],this.points[3]),t.Q.sub([],this.points[4],this.points[0]),t.Q.sub([],this.points[5],this.points[1]),t.Q.sub([],this.points[6],this.points[2]),t.Q.sub([],this.points[7],this.points[3])];for(const t of this.frustumEdges){const e=[0,-t[2],t[1]],r=[t[2],0,-t[0]];this.projections.push({axis:e,projection:ch(this.points,this.points[0],e)}),this.projections.push({axis:r,projection:ch(this.points,this.points[0],r)});}}static fromInvProjectionMatrix(e,r,n,i){const s=Math.pow(2,n),a=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((n=>{const a=t.aa.transformMat4([],n,e),o=1/a[3]/r*s;return t.aa.mul(a,a,[o,o,i?1/a[3]:o,o])})),o=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((e=>{const r=t.Q.sub([],a[e[0]],a[e[1]]),n=t.Q.sub([],a[e[2]],a[e[1]]),i=t.Q.normalize([],t.Q.cross([],r,n)),s=-t.Q.dot(i,a[e[1]]);return i.concat(s)})),l=[];for(let t=0;t<a.length;t++)l.push([a[t][0],a[t][1],a[t][2]]);return new dh(l,o)}intersectsPrecise(e,r,n){for(let t=0;t<r.length;t++)if(!fh(e,r[t]))return 0;for(let t=0;t<this.planes.length;t++)if(!fh(e,this.planes[t]))return 0;for(const r of n)for(const n of this.frustumEdges){const i=t.Q.cross([],r,n),s=t.Q.length(i);if(0===s)continue;t.Q.scale(i,i,1/s);const a=ch(this.points,this.points[0],i),o=ch(e,this.points[0],i);if(a[0]>o[1]||o[0]>a[1])return 0}return 1}}class mh{static fromPoints(e){const r=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0];for(const i of e)t.Q.min(r,r,i),t.Q.max(n,n,i);return new mh(r,n)}static fromTileIdAndHeight(t,e,r){const n=1<<t.canonical.z,i=t.canonical.x,s=t.canonical.y;return new mh([i/n,s/n,e],[(i+1)/n,(s+1)/n,r])}static applyTransform(e,r){const n=e.getCorners();for(let e=0;e<n.length;++e)t.Q.transformMat4(n[e],n[e],r);return mh.fromPoints(n)}static projectAabbCorners(e,r){const n=e.getCorners();for(let e=0;e<n.length;++e)t.Q.transformMat4(n[e],n[e],r);return n}constructor(e,r){this.min=e,this.max=r,this.center=t.Q.scale([],t.Q.add([],this.min,this.max),.5);}quadrant(e){const r=[e%2==0,e<2],n=t.Q.clone(this.min),i=t.Q.clone(this.max);for(let t=0;t<r.length;t++)n[t]=r[t]?this.min[t]:this.center[t],i[t]=r[t]?this.center[t]:this.max[t];return i[2]=this.max[2],new mh(n,i)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}distanceZ(t){return Math.max(Math.min(this.max[2],t[2]),this.min[2])-t[2]}getCorners(){const t=this.min,e=this.max;return [[t[0],t[1],t[2]],[e[0],t[1],t[2]],[e[0],e[1],t[2]],[t[0],e[1],t[2]],[t[0],t[1],e[2]],[e[0],t[1],e[2]],[e[0],e[1],e[2]],[t[0],e[1],e[2]]]}intersects(t){return this.intersectsAabb(t.bounds)?hh(t,this.getCorners()):0}intersectsFlat(t){return this.intersectsAabb(t.bounds)?hh(t,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(t,e){return e||this.intersects(t)?ph(t,this.getCorners()):0}intersectsPreciseFlat(t,e){return e||this.intersectsFlat(t)?ph(t,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(t){for(let e=0;e<3;++e)if(this.min[e]>t.max[e]||t.min[e]>this.max[e])return !1;return !0}intersectsAabbXY(t){return !(this.min[0]>t.max[0]||t.min[0]>this.max[0]||this.min[1]>t.max[1]||t.min[1]>this.max[1])}encapsulate(t){for(let e=0;e<3;e++)this.min[e]=Math.min(this.min[e],t.min[e]),this.max[e]=Math.max(this.max[e],t.max[e]);}encapsulatePoint(t){for(let e=0;e<3;e++)this.min[e]=Math.min(this.min[e],t[e]),this.max[e]=Math.max(this.max[e],t[e]);}closestPoint(t){return [Math.max(Math.min(this.max[0],t[0]),this.min[0]),Math.max(Math.min(this.max[1],t[1]),this.min[1]),Math.max(Math.min(this.max[2],t[2]),this.min[2])]}}fo(mh,\"Aabb\");const yh=Ml([{type:\"Float32\",name:\"a_globe_pos\",components:3},{type:\"Float32\",name:\"a_uv\",components:2}]),{members:gh}=yh,xh=Ml([{name:\"a_pos_3\",components:3,type:\"Int16\"}]);var bh=Ml([{name:\"a_pos\",type:\"Int16\",components:2}]);function vh(t){return t*Xu/ic}const _h=[new mh([tc,tc,tc],[ec,ec,ec]),new mh([tc,tc,tc],[0,0,ec]),new mh([0,tc,tc],[ec,0,ec]),new mh([tc,0,tc],[0,ec,ec]),new mh([0,0,tc],[ec,ec,ec])];function wh(e,r,n,i=!0){const s=t.Q.scale([],e._camera.position,e.worldSize),a=[r,n,1,1];t.aa.transformMat4(a,a,e.pixelMatrixInverse),t.aa.scale(a,a,1/a[3]);const o=t.Q.sub([],a,s),l=t.Q.normalize([],o),u=e.globeMatrix,c=[u[12],u[13],u[14]],h=t.Q.sub([],c,s),p=t.Q.length(h),f=t.Q.normalize([],h),d=e.worldSize/(2*Math.PI),m=t.Q.dot(f,l),y=Math.asin(d/p);if(y<Math.acos(m)){if(!i)return null;const e=[],r=[];t.Q.scale(e,l,p/m),t.Q.normalize(r,t.Q.sub(r,e,h)),t.Q.normalize(l,t.Q.add(l,h,t.Q.scale(l,r,Math.tan(y)*p)));}const g=[];new lh(s,l).closestPointOnSphere(c,d,g);const x=t.Q.normalize([],Sr(u,0)),b=t.Q.normalize([],Sr(u,1)),v=t.Q.normalize([],Sr(u,2)),_=t.Q.dot(x,g),w=t.Q.dot(b,g),M=t.Q.dot(v,g),A=$e(Math.asin(-w/d));let S=$e(Math.atan2(_,M));S=e.center.lng+function(t,e){const r=(e-t+180)%360-180;return r<-180?r+360:r}(e.center.lng,S);const I=xc(S),k=Ze(bc(A),0,1);return new Ec(I,k)}class Mh{constructor(e,r,n){this.a=t.Q.sub([],e,n),this.b=t.Q.sub([],r,n),this.center=n;const i=t.Q.normalize([],this.a),s=t.Q.normalize([],this.b);this.angle=Math.acos(t.Q.dot(i,s));}}function Ah(t,e){if(0===t.angle)return null;let r;return r=0===t.a[e]?1/t.angle*.5*Math.PI:1/t.angle*Math.atan(t.b[e]/t.a[e]/Math.sin(t.angle)-1/Math.tan(t.angle)),r<0||r>1?null:function(t,e,r,n){const i=Math.sin(r);return t*(Math.sin((1-n)*r)/i)+e*(Math.sin(n*r)/i)}(t.a[e],t.b[e],t.angle,Ze(r,0,1))+t.center[e]}function Sh(t){if(t.z<=1)return _h[t.z+2*t.y+t.x];const e=zh(Eh(t));return mh.fromPoints(e)}function Ih(e,r,n){return t.Q.scale(e,e,1-n),t.Q.scaleAndAdd(e,e,r,n)}function kh(e,r,n){for(const i of e)t.Q.transformMat4(i,i,r),t.Q.scale(i,i,n);}function Ph(e,r,n,i){const s=r/e.worldSize,a=e.globeMatrix;if(n.z<=1){const t=Sh(n).getCorners();return kh(t,a,s),mh.fromPoints(t)}const o=Eh(n,i),l=zh(o,Xu+vh(e._tileCoverLift));kh(l,a,s);const u=Number.MAX_VALUE,c=[-u,-u,-u],h=[u,u,u];if(o.contains(e.center)){for(const e of l)t.Q.min(h,h,e),t.Q.max(c,c,e);c[2]=0;const r=e.point,n=[r.x*s,r.y*s,0];return t.Q.min(h,h,n),t.Q.max(c,c,n),new mh(h,c)}if(e._tileCoverLift>0){for(const e of l)t.Q.min(h,h,e),t.Q.max(c,c,e);return new mh(h,c)}const p=[a[12]*s,a[13]*s,a[14]*s],f=o.getCenter(),d=Ze(e.center.lat,-Ac,Ac),m=Ze(f.lat,-Ac,Ac),y=xc(e.center.lng),g=bc(d);let x=y-xc(f.lng);const b=g-bc(m);x>.5?x-=1:x<-.5&&(x+=1);let v=0;if(Math.abs(x)>Math.abs(b))v=x>=0?1:3;else {v=b>=0?0:2;const e=[a[4]*s,a[5]*s,a[6]*s],r=-Math.sin(qe(b>=0?o.getSouth():o.getNorth()))*Xu;t.Q.scaleAndAdd(p,p,e,r);}const _=l[v],w=l[(v+1)%4],M=new Mh(_,w,p),A=[Ah(M,0)||_[0],Ah(M,1)||_[1],Ah(M,2)||_[2]],S=Oh(e.zoom);if(S>0){const i=function({x:t,y:e,z:r},n,i,s,a){const o=1/(1<<r);let l=t*o,u=l+o,c=e*o,h=c+o,p=0;const f=(l+u)/2-s;return f>.5?p=-1:f<-.5&&(p=1),l=((l+p)*n-(s*=n))*i+s,u=((u+p)*n-s)*i+s,c=(c*n-(a*=n))*i+a,h=(h*n-a)*i+a,[[l,h,0],[u,h,0],[u,c,0],[l,c,0]]}(n,r,e._pixelsPerMercatorPixel,y,g);for(let t=0;t<l.length;t++)Ih(l[t],i[t],S);const s=t.Q.add([],i[v],i[(v+1)%4]);t.Q.scale(s,s,.5),Ih(A,s,S);}for(const e of l)t.Q.min(h,h,e),t.Q.max(c,c,e);return h[2]=Math.min(_[2],w[2]),t.Q.min(h,h,A),t.Q.max(c,c,A),new mh(h,c)}function Eh({x:t,y:e,z:r},n=!1){const i=1/(1<<r),s=new ac(_c(t*i),e===(1<<r)-1&&n?-90:wc((e+1)*i)),a=new ac(_c((t+1)*i),0===e&&n?90:wc(e*i));return new oc(s,a)}function zh(t,e=Xu){const r=qe(t.getNorth()),n=qe(t.getSouth()),i=Math.cos(r),s=Math.cos(n),a=Math.sin(r),o=Math.sin(n),l=t.getWest(),u=t.getEast();return [rc(s,o,l,e),rc(s,o,u,e),rc(i,a,u,e),rc(i,a,l,e)]}function Th(t,e,r,n){const i=1<<r.z,s=(t/is+r.x)/i;return nc(wc((e/is+r.y)/i),_c(s),n)}function Bh({min:t,max:e}){return Wu/Math.max(e[0]-t[0],e[1]-t[1],e[2]-t[2])}const Ch=new Float64Array(16);function Rh(e){const r=Bh(e),n=t.a9.fromScaling(Ch,[r,r,r]);return t.a9.translate(n,n,t.Q.negate([],e.min))}function Vh(e){const r=t.a9.fromTranslation(Ch,e.min),n=1/Bh(e);return t.a9.scale(r,r,[n,n,n])}function Dh(t){const e=is/(2*Math.PI);return t/(2*Math.PI)/e}function Lh(t,e){return is/(512*Math.pow(2,t))*Bh(Sh(e))}function Fh(e,r,n,i,s){const a=Dh(n),o=[e,r,-n/(2*Math.PI)],l=t.a9.identity(new Float64Array(16));return t.a9.translate(l,l,o),t.a9.scale(l,l,[a,a,a]),t.a9.rotateX(l,l,qe(-s)),t.a9.rotateY(l,l,qe(-i)),l}function Oh(t){return Ke(Zu,Ku,t)}function Uh(e,r){const n=nc(r.lat,r.lng),i=function(e){const r=nc(e._center.lat,e._center.lng),n=t.Q.fromValues(0,1,0);let i=t.Q.cross([],n,r);const s=t.a9.fromRotation([],-e.angle,r);i=t.Q.transformMat4(i,i,s),t.a9.fromRotation(s,-e._pitch,i);const a=t.Q.normalize([],r);return t.Q.scale(a,a,vh(e.cameraToCenterDistance/e.pixelsPerMeter)),t.Q.transformMat4(a,a,s),t.Q.add([],r,a)}(e),s=t.Q.subtract([],i,n);return t.Q.angle(s,n)}function Nh(t,e){return Uh(t,e)>Math.PI/2*1.01}const jh=qe(85),qh=Math.cos(jh),$h=Math.sin(jh),Gh=t.a9.create(),Qh=t=>{const e=[];return \"map\"===t.paint.get(\"circle-pitch-alignment\")&&e.push(\"PITCH_WITH_MAP\"),\"map\"===t.paint.get(\"circle-pitch-scale\")&&e.push(\"SCALE_WITH_MAP\"),e};function Yh(e,r,n,i,s,a,o,l,u){if(a&&e.queryGeometry.isAboveHorizon)return !1;a&&(u*=e.pixelToTileUnitsFactor);const c=e.tileID.canonical,h=n.projection.upVectorScale(c,n.center.lat,n.worldSize).metersToTile;for(const p of r)for(const r of p){const p=r.add(l),f=s&&n.elevation?n.elevation.exaggeration()*s.getElevationAt(p.x,p.y,!0):0,d=n.projection.projectTilePoint(p.x,p.y,c);if(f>0){const t=n.projection.upVector(c,p.x,p.y);d.x+=t[0]*h*f,d.y+=t[1]*h*f,d.z+=t[2]*h*f;}const m=a?p:Xh(d.x,d.y,d.z,i),y=a?e.tilespaceRays.map((t=>Wh(t,f))):e.queryGeometry.screenGeometry,g=t.aa.transformMat4([],[d.x,d.y,d.z,1],i);if(!o&&a?u*=g[3]/n.cameraToCenterDistance:o&&!a&&(u*=n.cameraToCenterDistance/g[3]),a){const t=wc((r.y/is+c.y)/(1<<c.z));u/=n.projection.pixelsPerMeter(t,1)/vc(1,t);}if(qc(y,m,u))return !0}return !1}function Xh(e,r,n,i){const s=t.aa.transformMat4([],[e,r,n,1],i);return new Ue(s[0]/s[3],s[1]/s[3])}const Zh=t.Q.fromValues(0,0,0),Kh=t.Q.fromValues(0,0,1);function Wh(e,r){const n=t.Q.create();return Zh[2]=r,e.intersectsPlane(Zh,Kh,n),new Ue(n[0],n[1])}class Hh extends Nc{}function Jh(t,{width:e,height:r},n,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError(\"mismatched image size\")}else i=new Uint8Array(e*r*n);return t.width=e,t.height=r,t.data=i,t}function tp(t,e,r){const{width:n,height:i}=e;n===t.width&&i===t.height||(ep(t,e,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,i)},r),t.width=n,t.height=i,t.data=e.data);}function ep(t,e,r,n,i,s,a){if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError(\"out of range source coordinates for image copy\");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError(\"out of range destination coordinates for image copy\");const o=t.data,l=e.data,u=4===s&&a;for(let a=0;a<i.height;a++){const c=((r.y+a)*t.width+r.x)*s,h=((n.y+a)*e.width+n.x)*s;if(u)for(let t=0;t<i.width;t++){const e=c+t*s+3,r=h+t*s;l[r+0]=255,l[r+1]=255,l[r+2]=255,l[r+3]=o[e];}else for(let t=0;t<i.width*s;t++)l[h+t]=o[c+t];}return e}fo(Hh,\"HeatmapBucket\",{omit:[\"layers\"]});class rp{constructor(t,e){Jh(this,t,1,e);}resize(t){tp(this,new rp(t),1);}clone(){return new rp({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){ep(t,e,r,n,i,1);}}class np{constructor(t,e){Jh(this,t,4,e);}resize(t){tp(this,new np(t),4);}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t;}clone(){return new np({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i,s){ep(t,e,r,n,i,4,s);}}class ip{constructor(t,e){this.width=t.width,this.height=t.height,this.data=e instanceof Uint8Array?new Float32Array(e.buffer):e;}}fo(rp,\"AlphaImage\"),fo(np,\"RGBAImage\");const sp=new Ho({visibility:new Zo(el.layout_heatmap.visibility)});var ap={paint:new Ho({\"heatmap-radius\":new Ko(el.paint_heatmap[\"heatmap-radius\"]),\"heatmap-weight\":new Ko(el.paint_heatmap[\"heatmap-weight\"]),\"heatmap-intensity\":new Zo(el.paint_heatmap[\"heatmap-intensity\"]),\"heatmap-color\":new Wo(el.paint_heatmap[\"heatmap-color\"]),\"heatmap-opacity\":new Zo(el.paint_heatmap[\"heatmap-opacity\"])}),layout:sp};function op(t){const e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new np({width:r,height:n}),s=(r,n,s)=>{e[t.evaluationKey]=s;const a=t.expression.evaluate(e);a&&(i.data[r+n+0]=Math.floor(255*a.r/a.a),i.data[r+n+1]=Math.floor(255*a.g/a.a),i.data[r+n+2]=Math.floor(255*a.b/a.a),i.data[r+n+3]=Math.floor(255*a.a));};if(t.clips)for(let e=0,i=0;e<n;++e,i+=4*r)for(let n=0,a=0;n<r;n++,a+=4){const o=n/(r-1),{start:l,end:u}=t.clips[e];s(i,a,l*(1-o)+u*o);}else for(let t=0,e=0;t<r;t++,e+=4)s(0,e,t/(r-1));return i}const lp=new Ho({visibility:new Zo(el.layout_hillshade.visibility)});var up={paint:new Ho({\"hillshade-illumination-direction\":new Zo(el.paint_hillshade[\"hillshade-illumination-direction\"]),\"hillshade-illumination-anchor\":new Zo(el.paint_hillshade[\"hillshade-illumination-anchor\"]),\"hillshade-exaggeration\":new Zo(el.paint_hillshade[\"hillshade-exaggeration\"]),\"hillshade-shadow-color\":new Zo(el.paint_hillshade[\"hillshade-shadow-color\"]),\"hillshade-highlight-color\":new Zo(el.paint_hillshade[\"hillshade-highlight-color\"]),\"hillshade-accent-color\":new Zo(el.paint_hillshade[\"hillshade-accent-color\"]),\"hillshade-emissive-strength\":new Zo(el.paint_hillshade[\"hillshade-emissive-strength\"])}),layout:lp};const cp=Ml([{name:\"a_pos\",components:2,type:\"Int16\"}],4),{members:hp}=cp;var pp={exports:{}};function fp(t,e,r){r=r||2;var n,i,s,a,o,l,u,c=e&&e.length,h=c?e[0]*r:t.length,p=dp(t,0,h,r,!0),f=[];if(!p||p.next===p.prev)return f;if(c&&(p=function(t,e,r,n){var i,s,a,o=[];for(i=0,s=e.length;i<s;i++)(a=dp(t,e[i]*n,i<s-1?e[i+1]*n:t.length,n,!1))===a.next&&(a.steiner=!0),o.push(Sp(a));for(o.sort(_p),i=0;i<o.length;i++)r=wp(o[i],r);return r}(t,e,p,r)),t.length>80*r){n=s=t[0],i=a=t[1];for(var d=r;d<h;d+=r)(o=t[d])<n&&(n=o),(l=t[d+1])<i&&(i=l),o>s&&(s=o),l>a&&(a=l);u=0!==(u=Math.max(s-n,a-i))?32767/u:0;}return yp(p,f,r,n,i,u,0),f}function dp(t,e,r,n,i){var s,a;if(i===Fp(t,e,r,n)>0)for(s=e;s<r;s+=n)a=Vp(s,t[s],t[s+1],a);else for(s=r-n;s>=e;s-=n)a=Vp(s,t[s],t[s+1],a);return a&&Ep(a,a.next)&&(Dp(a),a=a.next),a}function mp(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!Ep(n,n.next)&&0!==Pp(n.prev,n,n.next))n=n.next;else {if(Dp(n),(n=e=n.prev)===n.next)break;r=!0;}}while(r||n!==e);return e}function yp(t,e,r,n,i,s,a){if(t){!a&&s&&function(t,e,r,n){var i=t;do{0===i.z&&(i.z=Ap(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,s,a,o,l,u=1;do{for(r=t,t=null,s=null,a=0;r;){for(a++,n=r,o=0,e=0;e<u&&(o++,n=n.nextZ);e++);for(l=u;o>0||l>0&&n;)0!==o&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,o--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;r=n;}s.nextZ=null,u*=2;}while(a>1)}(i);}(t,n,i,s);for(var o,l,u=t;t.prev!==t.next;)if(o=t.prev,l=t.next,s?xp(t,n,i,s):gp(t))e.push(o.i/r|0),e.push(t.i/r|0),e.push(l.i/r|0),Dp(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?yp(t=bp(mp(t),e,r),e,r,n,i,s,2):2===a&&vp(t,e,r,n,i,s):yp(mp(t),e,r,n,i,s,1);break}}}function gp(t){var e=t.prev,r=t,n=t.next;if(Pp(e,r,n)>=0)return !1;for(var i=e.x,s=r.x,a=n.x,o=e.y,l=r.y,u=n.y,c=i<s?i<a?i:a:s<a?s:a,h=o<l?o<u?o:u:l<u?l:u,p=i>s?i>a?i:a:s>a?s:a,f=o>l?o>u?o:u:l>u?l:u,d=n.next;d!==e;){if(d.x>=c&&d.x<=p&&d.y>=h&&d.y<=f&&Ip(i,o,s,l,a,u,d.x,d.y)&&Pp(d.prev,d,d.next)>=0)return !1;d=d.next;}return !0}function xp(t,e,r,n){var i=t.prev,s=t,a=t.next;if(Pp(i,s,a)>=0)return !1;for(var o=i.x,l=s.x,u=a.x,c=i.y,h=s.y,p=a.y,f=o<l?o<u?o:u:l<u?l:u,d=c<h?c<p?c:p:h<p?h:p,m=o>l?o>u?o:u:l>u?l:u,y=c>h?c>p?c:p:h>p?h:p,g=Ap(f,d,e,r,n),x=Ap(m,y,e,r,n),b=t.prevZ,v=t.nextZ;b&&b.z>=g&&v&&v.z<=x;){if(b.x>=f&&b.x<=m&&b.y>=d&&b.y<=y&&b!==i&&b!==a&&Ip(o,c,l,h,u,p,b.x,b.y)&&Pp(b.prev,b,b.next)>=0)return !1;if(b=b.prevZ,v.x>=f&&v.x<=m&&v.y>=d&&v.y<=y&&v!==i&&v!==a&&Ip(o,c,l,h,u,p,v.x,v.y)&&Pp(v.prev,v,v.next)>=0)return !1;v=v.nextZ;}for(;b&&b.z>=g;){if(b.x>=f&&b.x<=m&&b.y>=d&&b.y<=y&&b!==i&&b!==a&&Ip(o,c,l,h,u,p,b.x,b.y)&&Pp(b.prev,b,b.next)>=0)return !1;b=b.prevZ;}for(;v&&v.z<=x;){if(v.x>=f&&v.x<=m&&v.y>=d&&v.y<=y&&v!==i&&v!==a&&Ip(o,c,l,h,u,p,v.x,v.y)&&Pp(v.prev,v,v.next)>=0)return !1;v=v.nextZ;}return !0}function bp(t,e,r){var n=t;do{var i=n.prev,s=n.next.next;!Ep(i,s)&&zp(i,n,n.next,s)&&Cp(i,s)&&Cp(s,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(s.i/r|0),Dp(n),Dp(n.next),n=t=s),n=n.next;}while(n!==t);return mp(n)}function vp(t,e,r,n,i,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&kp(a,o)){var l=Rp(a,o);return a=mp(a,a.next),l=mp(l,l.next),yp(a,e,r,n,i,s,0),void yp(l,e,r,n,i,s,0)}o=o.next;}a=a.next;}while(a!==t)}function _p(t,e){return t.x-e.x}function wp(t,e){var r=function(t,e){var r,n=e,i=t.x,s=t.y,a=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){var o=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(o<=i&&o>a&&(a=o,r=n.x<n.next.x?n:n.next,o===i))return r}n=n.next;}while(n!==e);if(!r)return null;var l,u=r,c=r.x,h=r.y,p=1/0;n=r;do{i>=n.x&&n.x>=c&&i!==n.x&&Ip(s<h?i:a,s,c,h,s<h?a:i,s,n.x,n.y)&&(l=Math.abs(s-n.y)/(i-n.x),Cp(n,t)&&(l<p||l===p&&(n.x>r.x||n.x===r.x&&Mp(r,n)))&&(r=n,p=l)),n=n.next;}while(n!==u);return r}(t,e);if(!r)return e;var n=Rp(r,t);return mp(n,n.next),mp(r,r.next)}function Mp(t,e){return Pp(t.prev,t,e.prev)<0&&Pp(e.next,t,t.next)<0}function Ap(t,e,r,n,i){return (t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Sp(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;}while(e!==t);return r}function Ip(t,e,r,n,i,s,a,o){return (i-a)*(e-o)>=(t-a)*(s-o)&&(t-a)*(n-o)>=(r-a)*(e-o)&&(r-a)*(s-o)>=(i-a)*(n-o)}function kp(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&zp(r,r.next,t,e))return !0;r=r.next;}while(r!==t);return !1}(t,e)&&(Cp(t,e)&&Cp(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&i<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;}while(r!==t);return n}(t,e)&&(Pp(t.prev,t,e.prev)||Pp(t,e.prev,e))||Ep(t,e)&&Pp(t.prev,t,t.next)>0&&Pp(e.prev,e,e.next)>0)}function Pp(t,e,r){return (e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Ep(t,e){return t.x===e.x&&t.y===e.y}function zp(t,e,r,n){var i=Bp(Pp(t,e,r)),s=Bp(Pp(t,e,n)),a=Bp(Pp(r,n,t)),o=Bp(Pp(r,n,e));return i!==s&&a!==o||!(0!==i||!Tp(t,r,e))||!(0!==s||!Tp(t,n,e))||!(0!==a||!Tp(r,t,n))||!(0!==o||!Tp(r,e,n))}function Tp(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Bp(t){return t>0?1:t<0?-1:0}function Cp(t,e){return Pp(t.prev,t,t.next)<0?Pp(t,e,t.next)>=0&&Pp(t,t.prev,e)>=0:Pp(t,e,t.prev)<0||Pp(t,t.next,e)<0}function Rp(t,e){var r=new Lp(t.i,t.x,t.y),n=new Lp(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,s.next=n,n.prev=s,n}function Vp(t,e,r,n){var i=new Lp(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Dp(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ);}function Lp(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1;}function Fp(t,e,r,n){for(var i=0,s=e,a=r-n;s<r;s+=n)i+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return i}pp.exports=fp,pp.exports.default=fp,fp.deviation=function(t,e,r,n){var i=e&&e.length,s=Math.abs(Fp(t,0,i?e[0]*r:t.length,r));if(i)for(var a=0,o=e.length;a<o;a++)s-=Math.abs(Fp(t,e[a]*r,a<o-1?e[a+1]*r:t.length,r));var l=0;for(a=0;a<n.length;a+=3){var u=n[a]*r,c=n[a+1]*r,h=n[a+2]*r;l+=Math.abs((t[u]-t[h])*(t[c+1]-t[u+1])-(t[u]-t[c])*(t[h+1]-t[u+1]));}return 0===s&&0===l?0:Math.abs((l-s)/s)},fp.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var s=0;s<t[i].length;s++)for(var a=0;a<e;a++)r.vertices.push(t[i][s][a]);i>0&&r.holes.push(n+=t[i-1].length);}return r};var Op=h(pp.exports);function Up(t,e){const r=t.length;if(r<=1)return [t];const n=[];let i,s;for(let e=0;e<r;e++){const r=fr(t[e]);0!==r&&(t[e].area=Math.abs(r),void 0===s&&(s=r<0),s===r<0?(i&&n.push(i),i=[t[e]]):i.push(t[e]));}if(i&&n.push(i),e>1)for(let t=0;t<n.length;t++)n[t].length<=e||(Ri(n[t],e,1,n[t].length-1,Np),n[t]=n[t].slice(0,e));return n}function Np(t,e){return e.area-t.area}function jp(t,e,r){const n=r.patternDependencies;let i=!1;for(const r of e){const e=r.paint.get(`${t}-pattern`);e.isConstant()||(i=!0);const s=e.constantOr(null);s&&(i=!0,n[s]=!0);}return i}function qp(t,e,r,n,i){const s=i.patternDependencies;for(const a of e){const e=a.paint.get(`${t}-pattern`).value;if(\"constant\"!==e.kind){let t=e.evaluate({zoom:n},r,{},i.availableImages);t=t&&t.name?t.name:t,s[t]=!0,r.patterns[a.id]=t;}}return r}class $p{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.fqid)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Sl,this.indexArray=new ql,this.indexArray2=new Fl,this.programConfigurations=new ju(t.layers,t.zoom),this.segments=new mu,this.segments2=new mu,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.projection=t.projection;}populate(t,e,r,n){this.hasPattern=jp(\"fill\",this.layers,e);const i=this.layers[0].layout.get(\"fill-sort-key\"),s=[];for(const{feature:a,id:o,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Fc(a,t);if(!this.layers[0]._featureFilter.filter(new Uo(this.zoom),c,r))continue;const h=i?i.evaluate(c,{},r,e.availableImages):void 0,p={id:o,properties:a.properties,type:a.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Lc(a,r,n),patterns:{},sortKey:h};s.push(p);}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n;if(this.hasPattern){const t=qp(\"fill\",this.layers,n,this.zoom,e);this.patternFeatures.push(t);}else this.addFeature(n,i,s,r,{},e.availableImages,e.brightness);e.featureIndex.insert(t[s].feature,i,s,a,this.index);}}update(t,e,r,n,i){const s=0!==Object.keys(t).length;s&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(t,e,s?this.stateDependentLayers:this.layers,r,n,i);}addFeatures(t,e,r,n,i,s){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r,n,s);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,hp),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy());}addFeature(t,e,r,n,i,s=[],a){for(const t of Up(e,500)){let e=0;for(const r of t)e+=r.length;const r=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),n=r.vertexLength,i=[],s=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&s.push(i.length/2);const r=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),n=r.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(n+e.length-1,n),i.push(e[0].x),i.push(e[0].y);for(let t=1;t<e.length;t++)this.layoutVertexArray.emplaceBack(e[t].x,e[t].y),this.indexArray2.emplaceBack(n+t-1,n+t),i.push(e[t].x),i.push(e[t].y);r.vertexLength+=e.length,r.primitiveLength+=e.length;}const a=Op(i,s);for(let t=0;t<a.length;t+=3)this.indexArray.emplaceBack(n+a[t],n+a[t+1],n+a[t+2]);r.vertexLength+=e,r.primitiveLength+=a.length/3;}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,s,n,a);}}fo($p,\"FillBucket\",{omit:[\"layers\",\"patternFeatures\"]});const Gp=new Ho({\"fill-sort-key\":new Ko(el.layout_fill[\"fill-sort-key\"]),visibility:new Zo(el.layout_fill.visibility)});var Qp={paint:new Ho({\"fill-antialias\":new Zo(el.paint_fill[\"fill-antialias\"]),\"fill-opacity\":new Ko(el.paint_fill[\"fill-opacity\"]),\"fill-color\":new Ko(el.paint_fill[\"fill-color\"]),\"fill-outline-color\":new Ko(el.paint_fill[\"fill-outline-color\"]),\"fill-translate\":new Zo(el.paint_fill[\"fill-translate\"]),\"fill-translate-anchor\":new Zo(el.paint_fill[\"fill-translate-anchor\"]),\"fill-pattern\":new Ko(el.paint_fill[\"fill-pattern\"]),\"fill-emissive-strength\":new Zo(el.paint_fill[\"fill-emissive-strength\"])}),layout:Gp};const Yp=Ml([{name:\"a_pos_normal_ed\",components:4,type:\"Int16\"}]),Xp=Ml([{name:\"a_pos_end\",components:4,type:\"Int16\"},{name:\"a_angular_offset_factor\",components:1,type:\"Int16\"}]),Zp=Ml([{name:\"a_centroid_pos\",components:2,type:\"Uint16\"}]),Kp=Ml([{name:\"a_hidden_by_landmark\",components:1,type:\"Uint8\"}]),Wp=Ml([{name:\"a_pos_3\",components:3,type:\"Int16\"},{name:\"a_pos_normal_3\",components:3,type:\"Int16\"}]),{members:Hp}=Yp;var Jp={},tf=Fe,ef=rf;function rf(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields(nf,this,e);}function nf(t,e,r){1==t?e.id=r.readVarint():2==t?function(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i;}}(r,e):3==t?e.type=r.readVarint():4==t&&(e._geometry=r.pos);}function sf(t){for(var e,r,n=0,i=0,s=t.length,a=s-1;i<s;a=i++)n+=((r=t[a]).x-(e=t[i]).x)*(e.y+r.y);return n}rf.types=[\"Unknown\",\"Point\",\"LineString\",\"Polygon\"],rf.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,r=t.readVarint()+t.pos,n=1,i=0,s=0,a=0,o=[];t.pos<r;){if(i<=0){var l=t.readVarint();n=7&l,i=l>>3;}if(i--,1===n||2===n)s+=t.readSVarint(),a+=t.readSVarint(),1===n&&(e&&o.push(e),e=[]),e.push(new tf(s,a));else {if(7!==n)throw new Error(\"unknown command \"+n);e&&e.push(e[0].clone());}}return e&&o.push(e),o},rf.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,s=0,a=1/0,o=-1/0,l=1/0,u=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();r=7&c,n=c>>3;}if(n--,1===r||2===r)(i+=t.readSVarint())<a&&(a=i),i>o&&(o=i),(s+=t.readSVarint())<l&&(l=s),s>u&&(u=s);else if(7!==r)throw new Error(\"unknown command \"+r)}return [a,l,o,u]},rf.prototype.toGeoJSON=function(t,e,r){var n,i,s=this.extent*Math.pow(2,r),a=this.extent*t,o=this.extent*e,l=this.loadGeometry(),u=rf.types[this.type];function c(t){for(var e=0;e<t.length;e++){var r=t[e];t[e]=[360*(r.x+a)/s-180,360/Math.PI*Math.atan(Math.exp((180-360*(r.y+o)/s)*Math.PI/180))-90];}}switch(this.type){case 1:var h=[];for(n=0;n<l.length;n++)h[n]=l[n][0];c(l=h);break;case 2:for(n=0;n<l.length;n++)c(l[n]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return [t];for(var r,n,i=[],s=0;s<e;s++){var a=sf(t[s]);0!==a&&(void 0===n&&(n=a<0),n===a<0?(r&&i.push(r),r=[t[s]]):r.push(t[s]));}return r&&i.push(r),i}(l),n=0;n<l.length;n++)for(i=0;i<l[n].length;i++)c(l[n][i]);}1===l.length?l=l[0]:u=\"Multi\"+u;var p={type:\"Feature\",geometry:{type:u,coordinates:l},properties:this.properties};return \"id\"in this&&(p.id=this.id),p};var af=ef,of=lf;function lf(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(uf,this,e),this.length=this._features.length;}function uf(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var n=t.readVarint()>>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null;}return e}(r));}lf.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error(\"feature index out of bounds\");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new af(this._pbf,e,this.extent,this._keys,this._values)};var cf=of;function hf(t,e,r){if(3===t){var n=new cf(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n);}}var pf=Jp.VectorTile=function(t,e){this.layers=t.readFields(hf,{},e);},ff=Jp.VectorTileFeature=ef;function df(t,e,r,n){const i=[],s=0===n?(t,e,r,n,i,s)=>{t.push(new Ue(s,r+(s-e)/(n-e)*(i-r)));}:(t,e,r,n,i,s)=>{t.push(new Ue(e+(s-r)/(i-r)*(n-e),s));};for(const a of t){const t=[];for(const i of a){if(i.length<=2)continue;const a=[];for(let t=0;t<i.length-1;t++){const o=i[t].x,l=i[t].y,u=i[t+1].x,c=i[t+1].y,h=0===n?o:l,p=0===n?u:c;h<e?p>e&&s(a,o,l,u,c,e):h>r?p<r&&s(a,o,l,u,c,r):a.push(i[t]),p<e&&h>=e&&s(a,o,l,u,c,e),p>r&&h<=r&&s(a,o,l,u,c,r);}let o=i[i.length-1];const l=0===n?o.x:o.y;l>=e&&l<=r&&a.push(o),a.length&&(o=a[a.length-1],a[0].x===o.x&&a[0].y===o.y||a.push(a[0]),t.push(a));}t.length&&i.push(t);}return i}function mf(t,e){return t.x-e.x||t.y-e.y}function yf(t,e){return 0===mf(t.min,e.min)&&0===mf(t.max,e.max)}function gf(t,e){return !(t.min.x>e.max.x||t.max.x<e.min.x||t.min.y>e.max.y||t.max.y<e.min.y)}function xf(t,e,r){const n=1/is,i=1/(1<<r.canonical.z),s=(e.x*n+r.canonical.x)*i+r.wrap,a=(e.y*n+r.canonical.y)*i;return {min:new Ue((t.x*n+r.canonical.x)*i+r.wrap,(t.y*n+r.canonical.y)*i),max:new Ue(s,a)}}function bf(t,e,r){const n=1<<r.canonical.z,i=((e.x-r.wrap)*n-r.canonical.x)*is,s=(e.y*n-r.canonical.y)*is;return {min:new Ue(((t.x-r.wrap)*n-r.canonical.x)*is,(t.y*n-r.canonical.y)*is),max:new Ue(i,s)}}function vf(t,e,r,n,i,s,a){const o=t.indices,l=t.vertices,u=[];for(let c=n;c<n+i;c+=3){const n=e[r[c+0]+s],i=e[r[c+1]+s],h=e[r[c+2]+s],p=Math.min(n.x,i.x,h.x),f=Math.max(n.x,i.x,h.x),d=Math.min(n.y,i.y,h.y),m=Math.max(n.y,i.y,h.y);u.length=0,t.grid.query(new Ue(p,d),new Ue(f,m),u);for(let t=0;t<u.length;t++){const e=u[t];if(eh(l[o[3*e+0]],l[o[3*e+1]],l[o[3*e+2]],n,i,h,a))return !0}}return !1}function _f(t,e,r,n){if(!t||!r)return !1;let i=t.vertices;if(!e.canonical.equals(n.canonical)||e.wrap!==n.wrap){if(r.vertices.length<t.vertices.length)return _f(r,n,t,e);const s=e.canonical,a=n.canonical,o=Math.pow(2,a.z-s.z);i=t.vertices.map((t=>new Ue((t.x+s.x*is)*o-a.x*is,(t.y+s.y*is)*o-a.y*is)));}return vf(r,i,t.indices,0,t.indices.length,0,0)}Jp.VectorTileLayer=of;class wf{constructor(t){this.size=t,this.minimums=[],this.maximums=[],this.leaves=[];}getElevation(t,e){const r=this.toIdx(t,e);return {min:this.minimums[r],max:this.maximums[r]}}isLeaf(t,e){return this.leaves[this.toIdx(t,e)]}toIdx(t,e){return e*this.size+t}}function Mf(t,e,r,n){let i=0,s=Number.MAX_VALUE;for(let a=0;a<3;a++)if(Math.abs(n[a])<1e-15){if(r[a]<t[a]||r[a]>e[a])return null}else {const o=1/n[a];let l=(t[a]-r[a])*o,u=(e[a]-r[a])*o;if(l>u){const t=l;l=u,u=t;}if(l>i&&(i=l),u<s&&(s=u),i>s)return null}return i}function Af(t,e,r,n,i,s,a,o,l,u,c){const h=n-t,p=i-e,f=s-r,d=a-t,m=o-e,y=l-r,g=c[1]*y-c[2]*m,x=c[2]*d-c[0]*y,b=c[0]*m-c[1]*d,v=h*g+p*x+f*b;if(Math.abs(v)<1e-15)return null;const _=1/v,w=u[0]-t,M=u[1]-e,A=u[2]-r,S=(w*g+M*x+A*b)*_;if(S<0||S>1)return null;const I=M*f-A*p,k=A*h-w*f,P=w*p-M*h,E=(c[0]*I+c[1]*k+c[2]*P)*_;return E<0||S+E>1?null:(d*I+m*k+y*P)*_}function Sf(t,e,r){return (t-e)/(r-e)}function If(t,e,r,n,i,s,a,o,l){const u=1<<r,c=s-n,h=a-i,p=(t+1)/u*c+n,f=(e+0)/u*h+i,d=(e+1)/u*h+i;o[0]=(t+0)/u*c+n,o[1]=f,l[0]=p,l[1]=d;}class kf{constructor(t){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=t,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const e=function(t){const e=Math.ceil(Math.log2(t.dim/8)),r=[];let n=Math.ceil(Math.pow(2,e));const i=1/n,s=(t,e,r,n,i)=>{const s=n?1:0,a=(t+1)*r-s,o=e*r,l=(e+1)*r-s;i[0]=t*r,i[1]=o,i[2]=a,i[3]=l;};let a=new wf(n);const o=[];for(let e=0;e<n*n;e++){s(e%n,Math.floor(e/n),i,!1,o);const r=Ef(o[0],o[1],t),l=Ef(o[2],o[1],t),u=Ef(o[2],o[3],t),c=Ef(o[0],o[3],t);a.minimums.push(Math.min(r,l,u,c)),a.maximums.push(Math.max(r,l,u,c)),a.leaves.push(1);}for(r.push(a),n/=2;n>=1;n/=2){const t=r[r.length-1];a=new wf(n);for(let e=0;e<n*n;e++){s(e%n,Math.floor(e/n),2,!0,o);const r=t.getElevation(o[0],o[1]),i=t.getElevation(o[2],o[1]),l=t.getElevation(o[2],o[3]),u=t.getElevation(o[0],o[3]),c=t.isLeaf(o[0],o[1]),h=t.isLeaf(o[2],o[1]),p=t.isLeaf(o[2],o[3]),f=t.isLeaf(o[0],o[3]),d=Math.min(r.min,i.min,l.min,u.min),m=Math.max(r.max,i.max,l.max,u.max),y=c&&h&&p&&f;a.maximums.push(m),a.minimums.push(d),a.leaves.push(m-d<=5&&y?1:0);}r.push(a);}return r}(this.dem),r=e.length-1,n=e[r];this._addNode(n.minimums[0],n.maximums[0],n.leaves[0]),this._construct(e,0,0,r,0);}raycastRoot(t,e,r,n,i,s,a=1){return Mf([t,e,-100],[r,n,this.maximums[0]*a],i,s)}raycast(e,r,n,i,s,a,o=1){if(!this.nodeCount)return null;const l=this.raycastRoot(e,r,n,i,s,a,o);if(null==l)return null;const u=[],c=[],h=[],p=[],f=[{idx:0,t:l,nodex:0,nodey:0,depth:0}];for(;f.length>0;){const{idx:l,t:d,nodex:m,nodey:y,depth:g}=f.pop();if(this.leaves[l]){If(m,y,g,e,r,n,i,h,p);const l=1<<g,u=(m+0)/l,c=(m+1)/l,f=(y+0)/l,x=(y+1)/l,b=Ef(u,f,this.dem)*o,v=Ef(c,f,this.dem)*o,_=Ef(c,x,this.dem)*o,w=Ef(u,x,this.dem)*o,M=Af(h[0],h[1],b,p[0],h[1],v,p[0],p[1],_,s,a),A=Af(p[0],p[1],_,h[0],p[1],w,h[0],h[1],b,s,a),S=Math.min(null!==M?M:Number.MAX_VALUE,null!==A?A:Number.MAX_VALUE);if(S!==Number.MAX_VALUE)return S;{const e=t.Q.scaleAndAdd([],s,a,d);if(Pf(b,v,w,_,Sf(e[0],h[0],p[0]),Sf(e[1],h[1],p[1]))>=e[2])return d}continue}let x=0;for(let t=0;t<this._siblingOffset.length;t++){If((m<<1)+this._siblingOffset[t][0],(y<<1)+this._siblingOffset[t][1],g+1,e,r,n,i,h,p),h[2]=-100,p[2]=this.maximums[this.childOffsets[l]+t]*o;const f=Mf(h,p,s,a);if(null!=f){const e=f;u[t]=e;let r=!1;for(let n=0;n<x&&!r;n++)e>=u[c[n]]&&(c.splice(n,0,t),r=!0);r||(c[x]=t),x++;}}for(let t=0;t<x;t++){const e=c[t];f.push({idx:this.childOffsets[l]+e,t:u[e],nodex:(m<<1)+this._siblingOffset[e][0],nodey:(y<<1)+this._siblingOffset[e][1],depth:g+1});}}return null}_addNode(t,e,r){return this.minimums.push(t),this.maximums.push(e),this.leaves.push(r),this.childOffsets.push(0),this.nodeCount++}_construct(t,e,r,n,i){if(1===t[n].isLeaf(e,r))return;this.childOffsets[i]||(this.childOffsets[i]=this.nodeCount);const s=n-1,a=t[s];let o=0,l=0;for(let t=0;t<this._siblingOffset.length;t++){const n=2*e+this._siblingOffset[t][0],i=2*r+this._siblingOffset[t][1],s=a.getElevation(n,i),u=a.isLeaf(n,i),c=this._addNode(s.min,s.max,u);u&&(o|=1<<t),l||(l=c);}for(let n=0;n<this._siblingOffset.length;n++)o&1<<n||this._construct(t,2*e+this._siblingOffset[n][0],2*r+this._siblingOffset[n][1],s,l+n);}}function Pf(t,e,r,n,i,s){return qn(qn(t,r,s),qn(e,n,s),i)}function Ef(t,e,r){const n=r.dim,i=Ze(t*n-.5,0,n-1),s=Ze(e*n-.5,0,n-1),a=Math.floor(i),o=Math.floor(s),l=Math.min(a+1,n-1),u=Math.min(o+1,n-1);return Pf(r.get(a,o),r.get(l,o),r.get(a,u),r.get(l,u),i-a,s-o)}const zf={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function Tf(t,e,r){return (256*t*256+256*e+r)/10-1e4}function Bf(t,e,r){return 256*t+e+r/256-32768}class Cf{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(t,e,r,n=!1){if(this.uid=t,e.height!==e.width)throw new RangeError(\"DEM tiles must be square\");if(r&&\"mapbox\"!==r&&\"terrarium\"!==r)return hr(`\"${r}\" is not a valid encoding type. Valid types include \"mapbox\" and \"terrarium\".`);this.stride=e.height;const i=this.dim=e.height-2,s=new Uint32Array(e.data.buffer);if(this.pixels=new Uint8Array(e.data.buffer),this.floatView=new Float32Array(e.data.buffer),this.borderReady=n,this._modifiedForSources={},!n){for(let t=0;t<i;t++)s[this._idx(-1,t)]=s[this._idx(0,t)],s[this._idx(i,t)]=s[this._idx(i-1,t)],s[this._idx(t,-1)]=s[this._idx(t,0)],s[this._idx(t,i)]=s[this._idx(t,i-1)];s[this._idx(-1,-1)]=s[this._idx(0,0)],s[this._idx(i,-1)]=s[this._idx(i-1,0)],s[this._idx(-1,i)]=s[this._idx(0,i-1)],s[this._idx(i,i)]=s[this._idx(i-1,i-1)];}const a=\"terrarium\"===r?Bf:Tf;for(let t=0;t<s.length;++t){const e=4*t;this.floatView[t]=a(this.pixels[e],this.pixels[e+1],this.pixels[e+2]);}this._timestamp=Tr.now();}_buildQuadTree(){this._tree=new kf(this);}get(t,e,r=!1){r&&(t=Ze(t,-1,this.dim),e=Ze(e,-1,this.dim));const n=this._idx(t,e);return this.floatView[n]}set(t,e,r){const n=this._idx(t,e),i=this.floatView[n];return this.floatView[n]=r,r-i}static getUnpackVector(t){return zf[t]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError(\"out of range source coordinates for DEM data\");return (e+1)*this.stride+(t+1)}static pack(t,e){const r=[0,0,0,0],n=Cf.getUnpackVector(e);let i=Math.floor((t+n[3])/n[2]);return r[2]=i%256,i=Math.floor(i/256),r[1]=i%256,i=Math.floor(i/256),r[0]=i,r}getPixels(){return new ip({width:this.stride,height:this.stride},this.pixels)}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error(\"dem dimension mismatch\");let n=e*this.dim,i=e*this.dim+this.dim,s=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1;}switch(r){case-1:s=a-1;break;case 1:a=s+1;}const o=-e*this.dim,l=-r*this.dim;for(let e=s;e<a;e++)for(let r=n;r<i;r++){const n=4*this._idx(r,e),i=4*this._idx(r+o,e+l);this.pixels[n+0]=t.pixels[i+0],this.pixels[n+1]=t.pixels[i+1],this.pixels[n+2]=t.pixels[i+2],this.pixels[n+3]=t.pixels[i+3];}}onDeserialize(){this._tree&&(this._tree.dem=this);}}fo(Cf,\"DEMData\"),fo(kf,\"DemMinMaxQuadTree\",{omit:[\"dem\"]});class Rf{constructor(t,e,r){this._demTile=t,this._dem=this._demTile.dem,this._scale=e,this._offset=r;}static create(t,e,r){const n=r||t.findDEMTileFor(e);if(!n||!n.dem)return;const i=n.dem,s=n.tileID,a=1<<e.canonical.z-s.canonical.z;return new Rf(n,i.dim/is/a,[(e.canonical.x/a-s.canonical.x)*i.dim,(e.canonical.y/a-s.canonical.y)*i.dim])}tileCoordToPixel(t,e){const r=e*this._scale+this._offset[1],n=Math.floor(t*this._scale+this._offset[0]),i=Math.floor(r);return new Ue(n,i)}getElevationAt(t,e,r,n){const i=t*this._scale+this._offset[0],s=e*this._scale+this._offset[1],a=Math.floor(i),o=Math.floor(s),l=this._dem;return n=!!n,r?qn(qn(l.get(a,o,n),l.get(a,o+1,n),s-o),qn(l.get(a+1,o,n),l.get(a+1,o+1,n),s-o),i-a):l.get(a,o,n)}getElevationAtPixel(t,e,r){return this._dem.get(t,e,!!r)}getMeterToDEM(t){return (1<<this._demTile.tileID.canonical.z)*vc(1,t)*this._dem.stride}}const Vf=ff.types,Df=[\"fill-extrusion-base\",\"fill-extrusion-height\",\"fill-extrusion-color\",\"fill-extrusion-pattern\",\"fill-extrusion-flood-light-wall-radius\"],Lf=[\"fill-extrusion-flood-light-ground-radius\"],Ff=Math.pow(2,13),Of=Math.pow(2,15)-1,Uf=new Ue(0,1),Nf=2147483648;function jf(t,e,r,n,i,s,a,o){t.emplaceBack((e<<1)+a,(r<<1)+s,(Math.floor(n*Ff)<<1)+i,Math.round(o));}function qf(t,e,r,n,i,s){t.emplaceBack(e.x,e.y,(r.x<<1)+n,(r.y<<1)+i,s);}function $f(t,e,r){const n=16384;t.emplaceBack(e.x,e.y,e.z,r[0]*n,r[1]*n,r[2]*n);}class Gf{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0;}}class Qf{constructor(){this.centroidXY=new Ue(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new Ue(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Ue(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0;}span(){return new Ue(this.max.x-this.min.x,this.max.y-this.min.y)}}class Yf{constructor(){this.acc=new Ue(0,0),this.accCount=0,this.centroidDataIndex=0;}startRing(t,e){t.min.x===Number.MAX_VALUE&&(t.min.x=t.max.x=e.x,t.min.y=t.max.y=e.y);}appendEdge(t,e,r){this.accCount++,this.acc._add(e);let n=!!this.borders;e.x<t.min.x?(t.min.x=e.x,n=!0):e.x>t.max.x&&(t.max.x=e.x,n=!0),e.y<t.min.y?(t.min.y=e.y,n=!0):e.y>t.max.y&&(t.max.y=e.y,n=!0),((0===e.x||e.x===is)&&e.x===r.x)!=((0===e.y||e.y===is)&&e.y===r.y)&&this.processBorderOverlap(e,r),n&&this.checkBorderIntersection(e,r);}checkBorderIntersection(t,e){e.x<0!=t.x<0&&this.addBorderIntersection(0,qn(e.y,t.y,(0-e.x)/(t.x-e.x))),e.x>is!=t.x>is&&this.addBorderIntersection(1,qn(e.y,t.y,(is-e.x)/(t.x-e.x))),e.y<0!=t.y<0&&this.addBorderIntersection(2,qn(e.x,t.x,(0-e.y)/(t.y-e.y))),e.y>is!=t.y>is&&this.addBorderIntersection(3,qn(e.x,t.x,(is-e.y)/(t.y-e.y)));}addBorderIntersection(t,e){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const r=this.borders[t];e<r[0]&&(r[0]=e),e>r[1]&&(r[1]=e);}processBorderOverlap(t,e){if(t.x===e.x){if(t.y===e.y)return;const r=0===t.x?0:1;this.addBorderIntersection(r,e.y),this.addBorderIntersection(r,t.y);}else {const r=0===t.y?2:3;this.addBorderIntersection(r,e.x),this.addBorderIntersection(r,t.x);}}centroid(){return 0===this.accCount?new Ue(0,0):new Ue(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce(((t,e)=>t+ +(e[0]!==Number.MAX_VALUE)),0):0}}function Xf(t,e){const r=t.add(e)._unit(),n=Ze(t.x*r.x+t.y*r.y,-1,1);var i,s,a;return i=Math.acos(n),Math.min(4,Math.max(-4,Math.tan(i)))/4*Of*((s=t).x*(a=e).y-s.y*a.x<0?-1:1)}const Zf=[t=>t.x<0,t=>t.x>is,t=>t.y<0,t=>t.y>is];function Kf(t,e,r,n){const i=[4];if(0===n)return i;r._mult(n);const s=t.sub(r),a=e.sub(r),o=[t,e,s,a];for(let t=0;t<4;t++)for(const e of o)if(Zf[t](e)){i.push(t);break}return i}class Wf{constructor(t){this.vertexArray=new Pl,this.indexArray=new ql,this.programConfigurations=new ju(t.layers,t.zoom,(t=>Lf.includes(t))),this._segments=new mu,this.hiddenByLandmarkVertexArray=new eu,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new mu;}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(t,e,r,n=!1){const i=t.length;if(i>2){let s=Math.max(0,this._segments.get().length-1);const a=this._segments._prepareSegment(4*i,this.vertexArray.length,2*this._segmentToGroundQuads[s].length);let o;s!==this._segments.get().length-1&&(s++,this._segmentToGroundQuads[s]=[],this._segmentToRegionTriCounts[s]=[0,0,0,0,0]);{const e=t[0],r=t[1];o=Xf(e.sub(t[i-1])._perp()._unit(),r.sub(e)._perp()._unit());}for(let l=0;l<i;l++){const u=l===i-1?0:l+1,c=t[l],h=t[u],p=t[u===i-1?0:u+1],f=h.sub(c)._perp()._unit(),d=Xf(f,p.sub(h)._perp()._unit()),m=o,y=d;if(rd(c,h,e)||n&&nd(c,e)&&nd(h,e)){o=d;continue}const g=a.vertexLength;qf(this.vertexArray,c,h,1,1,m),qf(this.vertexArray,c,h,1,0,m),qf(this.vertexArray,c,h,0,1,y),qf(this.vertexArray,c,h,0,0,y),a.vertexLength+=4;const x=Kf(c,h,f,r);for(const t of x)this._segmentToGroundQuads[s].push({id:g,region:t}),this._segmentToRegionTriCounts[s][t]+=2,a.primitiveLength+=2;o=d;}}}prepareBorderSegments(){if(!this.hasData())return;const t=this._segments.get(),e=t.length;for(let t=0;t<e;t++)this._segmentToGroundQuads[t].sort(((t,e)=>t.region-e.region));for(let r=0;r<e;r++){const e=this._segmentToGroundQuads[r],n=t[r],i=this._segmentToRegionTriCounts[r];i.reduce(((t,e)=>t+e),0);let s=0;for(let t=0;t<=4;t++){const e=i[t];if(0!==e){let r=this.regionSegments[t];r||(r=this.regionSegments[t]=new mu);const i={vertexOffset:n.vertexOffset,primitiveOffset:n.primitiveOffset+s,vertexLength:n.vertexLength,primitiveLength:e};r.get().push(i);}s+=e;}for(let t=0;t<e.length;t++){const r=e[t].id;this.indexArray.emplaceBack(r,r+1,r+3),this.indexArray.emplaceBack(r,r+3,r+2);}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null;}addPaintPropertiesData(t,e,r,n,i,s){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,t,e,r,n,i,s);}upload(t){this.hasData()&&(this.vertexBuffer=t.createVertexBuffer(this.vertexArray,Xp.members),this.indexBuffer=t.createIndexBuffer(this.indexArray));}uploadPaintProperties(t){this.hasData()&&this.programConfigurations.upload(t);}update(t,e,r,n,i,s){this.hasData()&&this.programConfigurations.updatePaintArrays(t,e,r,n,i,s);}updateHiddenByLandmark(t){if(!this.hasData())return;const e=t.groundVertexCount+t.groundVertexArrayOffset;if(0===t.groundVertexCount)return;const r=t.flags&Nf?1:0;for(let n=t.groundVertexArrayOffset;n<e;++n)this.hiddenByLandmarkVertexArray.emplace(n,r);this._needsHiddenByLandmarkUpdate=!0;}uploadHiddenByLandmark(t){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=t.createVertexBuffer(this.hiddenByLandmarkVertexArray,Kp.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1);}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let t=0;t<=4;t++){const e=this.regionSegments[t];e&&e.destroy();}}}}class Hf{constructor(t){this.zoom=t.zoom,this.canonical=t.canonical,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.fqid)),this.index=t.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=t.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new ql,this.footprintVertices=new Sl,this.footprintSegments=[],this.layoutVertexArray=new kl,this.centroidVertexArray=new pu,this.indexArray=new ql,this.programConfigurations=new ju(t.layers,t.zoom,(t=>Df.includes(t))),this.segments=new mu,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.groundEffect=new Wf(t),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[];}populate(t,e,r,n){this.features=[],this.hasPattern=jp(\"fill-extrusion\",this.layers,e),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=Pc(r),this.edgeRadius=this.layers[0].layout.get(\"fill-extrusion-edge-radius\")/this.tileToMeter;for(const{feature:i,id:s,index:a,sourceLayerIndex:o}of t){const t=this.layers[0]._featureFilter.needGeometry,l=Fc(i,t);if(!this.layers[0]._featureFilter.filter(new Uo(this.zoom),l,r))continue;const u={id:s,sourceLayerIndex:o,index:a,geometry:t?l.geometry:Lc(i,r,n),properties:i.properties,type:i.type,patterns:{}},c=this.layoutVertexArray.length;this.hasPattern?this.features.push(qp(\"fill-extrusion\",this.layers,u,this.zoom,e)):this.addFeature(u,u.geometry,a,r,{},e.availableImages,n,e.brightness),e.featureIndex.insert(i,u.geometry,a,o,this.index,c);}this.sortBorders(),\"mercator\"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0;}addFeatures(t,e,r,n,i,s){for(const t of this.features){const{geometry:a}=t;this.addFeature(t,a,t.index,e,r,n,i,s);}this.sortBorders(),\"mercator\"===this.projection.name&&this.splitToSubtiles();}update(t,e,r,n,i){const s=0!==Object.keys(t).length;if(s&&!this.stateDependentLayers.length)return;const a=s?this.stateDependentLayers:this.layers;this.programConfigurations.updatePaintArrays(t,e,a,r,n,i),this.groundEffect.update(t,e,a,r,n,i);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Hp),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=t.createVertexBuffer(this.layoutVertexExtArray,Wp.members,!0)),this.groundEffect.upload(t)),this.groundEffect.uploadPaintProperties(t),this.programConfigurations.upload(t),this.uploaded=!0;}uploadCentroid(t){this.groundEffect.uploadHiddenByLandmark(t),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Zp.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1);}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy());}addFeature(t,e,r,n,i,s,a,o){const l=this.layers[0].paint.get(\"fill-extrusion-flood-light-ground-radius\").evaluate(t,{})/this.tileToMeter,u=[new Ue(0,0),new Ue(is,is)],c=a.projection,h=\"globe\"===c.name,p=\"Polygon\"===Vf[t.type],f=new Yf;f.centroidDataIndex=this.centroidData.length;const d=new Qf,m=this.layers[0].paint.get(\"fill-extrusion-base\").evaluate(t,{},n)<=0,y=this.layers[0].paint.get(\"fill-extrusion-height\").evaluate(t,{},n);d.height=y,d.vertexArrayOffset=this.layoutVertexArray.length,d.groundVertexArrayOffset=this.groundEffect.vertexArray.length,h&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Rl);const g=Up(e,500);for(let t=g.length-1;t>=0;t--){const e=g[t];(0===e.length||(x=e[0]).every((t=>t.x<=0))||x.every((t=>t.x>=is))||x.every((t=>t.y<=0))||x.every((t=>t.y>=is)))&&g.splice(t,1);}var x;let b;if(h)b=od(g,u,n);else {b=[];for(const t of g)b.push({polygon:t,bounds:u});}const v=p?this.edgeRadius:0,_=v>0&&this.zoom<17,w=(t,e)=>{if(0===t.length)return !1;const r=t[t.length-1];return e.x===r.x&&e.y===r.y};for(const{polygon:t,bounds:e}of b){let r=0,i=0;for(const e of t)p&&!e[0].equals(e[e.length-1])&&e.push(e[0]),i+=p?e.length-1:e.length;const s=this.segments.prepareSegment((p?5:4)*i,this.layoutVertexArray,this.indexArray);d.footprintSegIdx<0&&(d.footprintSegIdx=this.footprintSegments.length),d.polygonSegIdx<0&&(d.polygonSegIdx=this.polygonSegments.length);const a={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},o=new Gf;if(o.vertexOffset=this.footprintVertices.length,o.indexOffset=3*this.footprintIndices.length,o.ringIndices=[],p){const i=[],a=[];r=s.vertexLength;for(let r=0;r<t.length;r++){const u=t[r];u.length&&0!==r&&a.push(i.length/2);const p=[];let f,d;f=u[1].sub(u[0])._perp()._unit(),o.ringIndices.push(u.length-1);for(let t=1;t<u.length;t++){const e=u[t],r=u[t===u.length-1?1:t+1],a=e.clone();if(v){d=r.sub(e)._perp()._unit();const t=f.add(d)._unit(),n=v*Math.min(4,1/(f.x*t.x+f.y*t.y));a.x+=n*t.x,a.y+=n*t.y,a.x=Math.round(a.x),a.y=Math.round(a.y),f=d;}!m||0!==v&&!_||w(p,a)||p.push(a),jf(this.layoutVertexArray,a.x,a.y,0,0,1,1,0),s.vertexLength++,this.footprintVertices.emplaceBack(e.x,e.y),i.push(e.x,e.y),h&&$f(this.layoutVertexExtArray,c.projectTilePoint(a.x,a.y,n),c.upVector(n,a.x,a.y));}m&&(0===v||_)&&(0!==p.length&&w(p,p[0])&&p.pop(),this.groundEffect.addData(p,e,l));}const u=Op(i,a);for(let t=0;t<u.length;t+=3)this.footprintIndices.emplaceBack(o.vertexOffset+u[t+0],o.vertexOffset+u[t+1],o.vertexOffset+u[t+2]),this.indexArray.emplaceBack(r+u[t],r+u[t+2],r+u[t+1]),s.primitiveLength++;o.indexCount+=u.length,o.vertexCount+=this.footprintVertices.length-o.vertexOffset;}for(let i=0;i<t.length;i++){const a=t[i];f.startRing(d,a[0]);let o=a.length>4&&id(a[a.length-2],a[0],a[1]),u=v?td(a[a.length-2],a[0],a[1],v):0;const y=[];let g,x,b;x=a[1].sub(a[0])._perp()._unit();let _=!0;for(let t=1,i=0;t<a.length;t++){let l=a[t-1],p=a[t];const M=a[t===a.length-1?1:t+1];if(f.appendEdge(d,p,l),rd(p,l,e)){v&&(x=M.sub(p)._perp()._unit(),_=!_);continue}const A=p.sub(l)._perp(),S=A.x/(Math.abs(A.x)+Math.abs(A.y)),I=A.y>0?1:0,k=l.dist(p);if(i+k>32768&&(i=0),v){b=M.sub(p)._perp()._unit();let t=ed(l,p,M,Jf(x,b),v);isNaN(t)&&(t=0);const e=p.sub(l)._unit();l=l.add(e.mult(u))._round(),p=p.add(e.mult(-t))._round(),u=t,x=b,m&&this.zoom>=17&&(w(y,l)||y.push(l),w(y,p)||y.push(p));}const P=s.vertexLength,E=a.length>4&&id(l,p,M);let z=sd(i,o,_);if(jf(this.layoutVertexArray,l.x,l.y,S,I,0,0,z),jf(this.layoutVertexArray,l.x,l.y,S,I,0,1,z),i+=k,z=sd(i,E,!_),o=E,jf(this.layoutVertexArray,p.x,p.y,S,I,0,0,z),jf(this.layoutVertexArray,p.x,p.y,S,I,0,1,z),s.vertexLength+=4,this.indexArray.emplaceBack(P+0,P+1,P+2),this.indexArray.emplaceBack(P+1,P+3,P+2),s.primitiveLength+=2,v){const n=r+(1===t?a.length-2:t-2),i=1===t?r:n+1;if(this.indexArray.emplaceBack(P+1,n,P+3),this.indexArray.emplaceBack(n,i,P+3),s.primitiveLength+=2,void 0===g&&(g=P),!rd(M,a[t],e)){const e=t===a.length-1?g:s.vertexLength;this.indexArray.emplaceBack(P+2,P+3,e),this.indexArray.emplaceBack(P+3,e+1,e),this.indexArray.emplaceBack(P+3,i,e+1),s.primitiveLength+=3;}_=!_;}if(h){const t=this.layoutVertexExtArray,e=c.projectTilePoint(l.x,l.y,n),r=c.projectTilePoint(p.x,p.y,n),i=c.upVector(n,l.x,l.y),s=c.upVector(n,p.x,p.y);$f(t,e,i),$f(t,e,i),$f(t,r,s),$f(t,r,s);}}p&&(r+=a.length-1),m&&v&&this.zoom>=17&&(0!==y.length&&w(y,y[0])&&y.pop(),this.groundEffect.addData(y,e,l,v>0));}this.footprintSegments.push(o),a.triangleCount=this.indexArray.length-a.triangleArrayOffset,this.polygonSegments.push(a),++d.footprintSegLen,++d.polygonSegLen;}if(d.vertexCount=this.layoutVertexArray.length-d.vertexArrayOffset,d.groundVertexCount=this.groundEffect.vertexArray.length-d.groundVertexArrayOffset,0!==d.vertexCount){if(d.centroidXY=f.borders?Uf:this.encodeCentroid(f,d),this.centroidData.push(d),f.borders){this.featuresOnBorder.push(f);const t=this.featuresOnBorder.length-1;for(let e=0;e<f.borders.length;e++)f.borders[e][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[e].push(t);}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,s,n,o),this.groundEffect.addPaintPropertiesData(t,r,i,s,n,o),this.maxHeight=Math.max(this.maxHeight,y);}}sortBorders(){for(let t=0;t<this.borderFeatureIndices.length;t++)this.borderFeatureIndices[t].sort(((e,r)=>this.featuresOnBorder[e].borders[t][0]-this.featuresOnBorder[r].borders[t][0]));}splitToSubtiles(){const t=[];for(let e=0;e<this.centroidData.length;e++){const r=this.centroidData[e],n=+(r.min.y+r.max.y>is),i=2*n+(+(r.min.x+r.max.x>is)^n);for(let n=0;n<r.polygonSegLen;n++){const s=r.polygonSegIdx+n;t.push({centroidIdx:e,subtile:i,polygonSegmentIdx:s,triangleSegmentIdx:this.polygonSegments[s].triangleSegIdx});}}const e=new ql;t.sort(((t,e)=>t.triangleSegmentIdx===e.triangleSegmentIdx?t.subtile-e.subtile:t.triangleSegmentIdx-e.triangleSegmentIdx));let r=0,n=0,i=0;for(const e of t){if(e.triangleSegmentIdx!==r)break;i++;}const s=t.length;for(;n!==t.length;){r=t[n].triangleSegmentIdx;let a=0,o=n,l=n;for(let e=o;e<i&&t[e].subtile===a;e++)l++;for(;o!==i;){const n=t[o];a=n.subtile;const s=this.centroidData[n.centroidIdx].min.clone(),u=this.centroidData[n.centroidIdx].max.clone(),c={vertexOffset:this.segments.segments[r].vertexOffset,primitiveOffset:e.length,vertexLength:this.segments.segments[r].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let r=o;r<l;r++){const n=t[r],i=this.polygonSegments[n.polygonSegmentIdx],a=this.centroidData[n.centroidIdx].min,o=this.centroidData[n.centroidIdx].max,l=this.indexArray.uint16;for(let t=i.triangleArrayOffset;t<i.triangleArrayOffset+i.triangleCount;t++)e.emplaceBack(l[3*t],l[3*t+1],l[3*t+2]);c.primitiveLength+=i.triangleCount,s.x=Math.min(s.x,a.x),s.y=Math.min(s.y,a.y),u.x=Math.max(u.x,o.x),u.y=Math.max(u.y,o.y);}c.primitiveLength>0&&this.triangleSubSegments.push({segment:c,min:s,max:u}),o=l;for(let e=o;e<i&&t[e].subtile===t[o].subtile;e++)l++;}n=i;for(let e=n;e<s&&t[e].triangleSegmentIdx===t[n].triangleSegmentIdx;e++)i++;}e._trim(),this.indexArray=e;}getVisibleSegments(t,e,r){let n=0,i=0;const s=1<<t.canonical.z;if(e){const r=e.getMinMaxForTile(t);r&&(n=r.min,i=r.max);}i+=this.maxHeight;const a=t.toUnwrapped();let o;const l=[a.canonical.x/s+a.wrap,a.canonical.y/s],u=[(a.canonical.x+1)/s+a.wrap,(a.canonical.y+1)/s],c=new mu,h=(t,e,r)=>[t[0]*(1-r[0])+e[0]*r[0],t[1]*(1-r[1])+e[1]*r[1]],p=[],f=[];for(const t of this.triangleSubSegments){p[0]=t.min.x/is,p[1]=t.min.y/is,f[0]=t.max.x/is,f[1]=t.max.y/is;const e=h(l,u,p),s=h(l,u,f);if(0===new mh([e[0],e[1],n],[s[0],s[1],i]).intersectsPrecise(r)){o&&(c.segments.push(o),o=void 0);continue}const a=t.segment;o&&o.vertexOffset!==a.vertexOffset&&(c.segments.push(o),o=void 0),o?(o.vertexLength+=a.vertexLength,o.primitiveLength+=a.primitiveLength):o={vertexOffset:a.vertexOffset,primitiveLength:a.primitiveLength,vertexLength:a.vertexLength,primitiveOffset:a.primitiveOffset,sortKey:void 0,vaos:{}};}return o&&c.segments.push(o),c}encodeCentroid(t,e){const r=t.centroid(),n=e.span(),i=Math.min(7,Math.round(n.x*this.tileToMeter/10)),s=Math.min(7,Math.round(n.y*this.tileToMeter/10));return new Ue(Ze(r.x,1,is-1)<<3|i,Ze(r.y,1,is-1)<<3|s)}encodeBorderCentroid(t){if(!t.borders)return new Ue(0,0);const e=t.borders,r=Number.MAX_VALUE;if(e[0][0]!==r||e[1][0]!==r){const t=e[0][0]!==r?0:1;return new Ue(6|(e[0][0]!==r?0:65528),(e[t][0]+e[t][1])/2<<3|6)}{const t=e[2][0]!==r?2:3;return new Ue((e[t][0]+e[t][1])/2<<3|6,6|(e[2][0]!==r?0:65528))}}showCentroid(t){const e=this.centroidData[t.centroidDataIndex];e.flags&=Nf,e.centroidXY.x=0,e.centroidXY.y=0,this.writeCentroidToBuffer(e);}writeCentroidToBuffer(t){this.groundEffect.updateHiddenByLandmark(t);const e=t.vertexArrayOffset,r=t.vertexCount+t.vertexArrayOffset,n=t.flags&Nf?Uf:t.centroidXY,i=this.centroidVertexArray.geta_centroid_pos0(e);if(this.centroidVertexArray.geta_centroid_pos1(e)!==n.y||i!==n.x){for(let t=e;t<r;++t)this.centroidVertexArray.emplace(t,n.x,n.y);this.needsCentroidUpdate=!0;}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const t of this.centroidData)this.writeCentroidToBuffer(t);}updateReplacement(t,e){if(e.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=e.updateTime;const r=e.getReplacementRegionsForTile(t.toUnwrapped());if(function(t,e){if(t.length!==e.length)return !1;for(let r=0;r<t.length;r++)if(t[r].sourceId!==e[r].sourceId||!yf(t[r],e[r]))return !1;return !0}(this.activeReplacements,r))return;if(this.activeReplacements=r,0===this.centroidVertexArray.length)this.createCentroidsBuffer();else for(const t of this.centroidData)t.flags&=2147483647;const n=[];for(const e of this.activeReplacements){const r=Math.pow(2,e.footprintTileId.canonical.z-t.canonical.z);for(const i of this.centroidData)if(!(i.flags&Nf||e.min.x>i.max.x||i.min.x>e.max.x||e.min.y>i.max.y||i.min.y>e.max.y))for(let s=0;s<i.footprintSegLen;s++){const a=this.footprintSegments[i.footprintSegIdx+s];if(n.length=0,ld(this.footprintVertices,a.vertexOffset,a.vertexCount,e.footprintTileId.canonical,t.canonical,n),vf(e.footprint,n,this.footprintIndices.uint16,a.indexOffset,a.indexCount,-a.vertexOffset,-r)){i.flags|=Nf;break}}}for(const t of this.centroidData)this.writeCentroidToBuffer(t);this.borderDoneWithNeighborZ=[-1,-1,-1,-1];}footprintContainsPoint(t,e,r){let n=!1;for(let i=0;i<r.footprintSegLen;i++){const s=this.footprintSegments[r.footprintSegIdx+i];let a=0;for(const r of s.ringIndices){for(let i=a,o=r+a-1;i<r+a;o=i++){const r=this.footprintVertices.int16[2*(i+s.vertexOffset)+0],a=this.footprintVertices.int16[2*(i+s.vertexOffset)+1],l=this.footprintVertices.int16[2*(o+s.vertexOffset)+1];a>e!=l>e&&t<(this.footprintVertices.int16[2*(o+s.vertexOffset)+0]-r)*(e-a)/(l-a)+r&&(n=!n);}a=r;}}return n}getHeightAtTileCoord(t,e){let r=Number.NEGATIVE_INFINITY,n=!0;const i=4*(t+is)*is+(e+is);if(this.partLookup.hasOwnProperty(i)){const t=this.partLookup[i];return t?{height:t.height,hidden:!!(t.flags&Nf)}:void 0}for(const s of this.centroidData)t>s.max.x||s.min.x>t||e>s.max.y||s.min.y>e||this.footprintContainsPoint(t,e,s)&&s&&s.height>r&&(r=s.height,this.partLookup[i]=s,n=!!(s.flags&Nf));if(r!==Number.NEGATIVE_INFINITY)return {height:r,hidden:n};this.partLookup[i]=void 0;}}function Jf(t,e){const r=t.add(e)._unit();return t.x*r.x+t.y*r.y}function td(t,e,r,n){const i=e.sub(t)._perp()._unit(),s=r.sub(e)._perp()._unit();return ed(t,e,r,Jf(i,s),n)}function ed(t,e,r,n,i){const s=Math.sqrt(1-n*n);return Math.min(t.dist(e)/3,e.dist(r)/3,i*s/n)}function rd(t,e,r){return t.x<r[0].x&&e.x<r[0].x||t.x>r[1].x&&e.x>r[1].x||t.y<r[0].y&&e.y<r[0].y||t.y>r[1].y&&e.y>r[1].y}function nd(t,e){return t.x<e[0].x||t.x>e[1].x||t.y<e[0].y||t.y>e[1].y}function id(t,e,r){if(t.x<0||t.x>=is||e.x<0||e.x>=is||r.x<0||r.x>=is)return !1;const n=r.sub(e),i=n.perp(),s=t.sub(e);return (n.x*s.x+n.y*s.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(s.x*s.x+s.y*s.y))>-.866&&i.x*s.x+i.y*s.y<0}function sd(t,e,r){const n=e?2|t:-3&t;return r?1|n:-2&n}function ad(){const t=Math.PI/32,e=Math.tan(t),r=ic;return r*Math.sqrt(1+2*e*e)-r}function od(t,e,r){const n=1<<r.z,i=_c(r.x/n),s=_c((r.x+1)/n),a=wc(r.y/n),o=wc((r.y+1)/n);return function(t,e,r,n,i=0,s){const a=[];if(!t.length||!r||!n)return a;const o=(t,e)=>{for(const r of t)a.push({polygon:r,bounds:e});},l=Math.ceil(Math.log2(r)),u=Math.ceil(Math.log2(n)),c=l-u,h=[];for(let t=0;t<Math.abs(c);t++)h.push(c>0?0:1);for(let t=0;t<Math.min(l,u);t++)h.push(0),h.push(1);let p=t;if(p=df(p,e[0].y-i,e[1].y+i,1),p=df(p,e[0].x-i,e[1].x+i,0),!p.length)return a;const f=[];for(h.length?f.push({polygons:p,bounds:e,depth:0}):o(p,e);f.length;){const t=f.pop(),e=t.depth,r=h[e],n=t.bounds[0],a=t.bounds[1],l=0===r?n.x:n.y,u=0===r?a.x:a.y,c=s?s(r,l,u):.5*(l+u),p=df(t.polygons,l-i,c+i,r),d=df(t.polygons,c-i,u+i,r);if(p.length){const t=[n,new Ue(0===r?c:a.x,1===r?c:a.y)];h.length>e+1?f.push({polygons:p,bounds:t,depth:e+1}):o(p,t);}if(d.length){const t=[new Ue(0===r?c:n.x,1===r?c:n.y),a];h.length>e+1?f.push({polygons:d,bounds:t,depth:e+1}):o(d,t);}}return a}(t,e,Math.ceil((s-i)/11.25),Math.ceil((a-o)/11.25),1,((t,e,i)=>{if(0===t)return .5*(e+i);{const t=wc((r.y+e/is)/n);return (bc(.5*(wc((r.y+i/is)/n)+t))*n-r.y)*is}}))}function ld(t,e,r,n,i,s){const a=Math.pow(2,n.z-i.z);for(let o=0;o<r;o++){let r=t.int16[2*(o+e)+0],l=t.int16[2*(o+e)+1];r=(r+i.x*is)*a-n.x*is,l=(l+i.y*is)*a-n.y*is,s.push(new Ue(r,l));}}fo(Hf,\"FillExtrusionBucket\",{omit:[\"layers\",\"features\"]}),fo(Qf,\"PartData\"),fo(Gf,\"FootprintSegment\"),fo(Yf,\"BorderCentroidData\"),fo(Wf,\"GroundEffect\");const ud=new Ho({visibility:new Zo(el[\"layout_fill-extrusion\"].visibility),\"fill-extrusion-edge-radius\":new Zo(el[\"layout_fill-extrusion\"][\"fill-extrusion-edge-radius\"])});var cd={paint:new Ho({\"fill-extrusion-opacity\":new Zo(el[\"paint_fill-extrusion\"][\"fill-extrusion-opacity\"]),\"fill-extrusion-color\":new Ko(el[\"paint_fill-extrusion\"][\"fill-extrusion-color\"]),\"fill-extrusion-translate\":new Zo(el[\"paint_fill-extrusion\"][\"fill-extrusion-translate\"]),\"fill-extrusion-translate-anchor\":new Zo(el[\"paint_fill-extrusion\"][\"fill-extrusion-translate-anchor\"]),\"fill-extrusion-pattern\":new Ko(el[\"paint_fill-extrusion\"][\"fill-extrusion-pattern\"]),\"fill-extrusion-height\":new Ko(el[\"paint_fill-extrusion\"][\"fill-extrusion-height\"]),\"fill-extrusion-base\":new Ko(el[\"paint_fill-extrusion\"][\"fill-extrusion-base\"]),\"fill-extrusion-vertical-gradient\":new Zo(el[\"paint_fill-extrusion\"][\"fill-extrusion-vertical-gradient\"]),\"fill-extrusion-ambient-occlusion-intensity\":new Zo(el[\"paint_fill-extrusion\"][\"fill-extrusion-ambient-occlusion-intensity\"]),\"fill-extrusion-ambient-occlusion-radius\":new Zo(el[\"paint_fill-extrusion\"][\"fill-extrusion-ambient-occlusion-radius\"]),\"fill-extrusion-ambient-occlusion-wall-radius\":new Zo(el[\"paint_fill-extrusion\"][\"fill-extrusion-ambient-occlusion-wall-radius\"]),\"fill-extrusion-ambient-occlusion-ground-radius\":new Zo(el[\"paint_fill-extrusion\"][\"fill-extrusion-ambient-occlusion-ground-radius\"]),\"fill-extrusion-ambient-occlusion-ground-attenuation\":new Zo(el[\"paint_fill-extrusion\"][\"fill-extrusion-ambient-occlusion-ground-attenuation\"]),\"fill-extrusion-flood-light-color\":new Zo(el[\"paint_fill-extrusion\"][\"fill-extrusion-flood-light-color\"]),\"fill-extrusion-flood-light-intensity\":new Zo(el[\"paint_fill-extrusion\"][\"fill-extrusion-flood-light-intensity\"]),\"fill-extrusion-flood-light-wall-radius\":new Ko(el[\"paint_fill-extrusion\"][\"fill-extrusion-flood-light-wall-radius\"]),\"fill-extrusion-flood-light-ground-radius\":new Ko(el[\"paint_fill-extrusion\"][\"fill-extrusion-flood-light-ground-radius\"]),\"fill-extrusion-flood-light-ground-attenuation\":new Zo(el[\"paint_fill-extrusion\"][\"fill-extrusion-flood-light-ground-attenuation\"]),\"fill-extrusion-vertical-scale\":new Zo(el[\"paint_fill-extrusion\"][\"fill-extrusion-vertical-scale\"]),\"fill-extrusion-rounded-roof\":new Zo(el[\"paint_fill-extrusion\"][\"fill-extrusion-rounded-roof\"]),\"fill-extrusion-cutoff-fade-range\":new Zo(el[\"paint_fill-extrusion\"][\"fill-extrusion-cutoff-fade-range\"]),\"fill-extrusion-emissive-strength\":new Zo(el[\"paint_fill-extrusion\"][\"fill-extrusion-emissive-strength\"])}),layout:ud};class hd extends Ue{constructor(t,e,r){super(t,e),this.z=r;}}function pd(t,e){return t.x*e.x+t.y*e.y}function fd(t,e){if(1===t.length){let r=0;const n=e[r++];let i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;r<e.length;r++){const s=e[r],a=t[0],o=i.sub(n),l=s.sub(n),u=a.sub(n),c=pd(o,o),h=pd(o,l),p=pd(l,l),f=pd(u,o),d=pd(u,l),m=c*p-h*h,y=(p*f-h*d)/m,g=(c*d-h*f)/m,x=n.z*(1-y-g)+i.z*y+s.z*g;if(isFinite(x))return x}return 1/0}{let t=1/0;for(const r of e)t=Math.min(t,r.z);return t}}function dd(t,e,r,n,i,s,a,o){const l=a*i.getElevationAt(t,e,!0,!0),u=0!==s[0],c=u?0===s[1]?a*(s[0]/7-450):a*function(t,e,r){const n=Math.floor(e[0]/8),i=Math.floor(e[1]/8),s=10*(e[0]-8*n),a=10*(e[1]-8*i),o=t.getElevationAt(n,i,!0,!0),l=t.getMeterToDEM(r),u=Math.floor(.5*(s*l-1)),c=Math.floor(.5*(a*l-1)),h=t.tileCoordToPixel(n,i),p=2*u+1,f=2*c+1,d=function(t,e,r,n,i){return [t.getElevationAtPixel(e,r,!0),t.getElevationAtPixel(e+i,r,!0),t.getElevationAtPixel(e,r+i,!0),t.getElevationAtPixel(e+n,r+i,!0)]}(t,h.x-u,h.y-c,p,f),m=Math.abs(d[0]-d[1]),y=Math.abs(d[2]-d[3]),g=Math.abs(d[0]-d[2])+Math.abs(d[1]-d[3]),x=Math.min(.25,.5*l*(m+y)/p),b=Math.min(.25,.5*l*g/f);return o+Math.max(x*s,b*a)}(i,s,o):l;return {base:l+(0===r)?-1:r,top:u?Math.max(c+n,l+r+2):l+n}}const md=Ml([{name:\"a_pos_normal\",components:2,type:\"Int16\"},{name:\"a_data\",components:4,type:\"Uint8\"},{name:\"a_linesofar\",components:1,type:\"Float32\"}],4),{members:yd}=md,gd=Ml([{name:\"a_packed\",components:4,type:\"Float32\"}]),{members:xd}=gd,bd=Ml([{name:\"a_pattern_data\",components:2,type:\"Float32\"}]),{members:vd}=bd;class _d{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.image=new rp({width:t,height:e}),this.positions={},this.uploaded=!1;}getDash(t,e){const r=this.getKey(t,e);return this.positions[r]}trim(){const t=this.width,e=this.height=nr(this.nextRow);this.image.resize({width:t,height:e});}getKey(t,e){return t.join(\",\")+e}getDashRanges(t,e,r){const n=[];let i=t.length%2==1?-t[t.length-1]*r:0,s=t[0]*r,a=!0;n.push({left:i,right:s,isDash:a,zeroLength:0===t[0]});let o=t[0];for(let e=1;e<t.length;e++){a=!a;const l=t[e];i=o*r,o+=l,s=o*r,n.push({left:i,right:s,isDash:a,zeroLength:0===l});}return n}addRoundDash(t,e,r){const n=e/2;for(let e=-r;e<=r;e++){const i=this.width*(this.nextRow+r+e);let s=0,a=t[s];for(let o=0;o<this.width;o++){o/a.right>1&&(a=t[++s]);const l=Math.abs(o-a.left),u=Math.abs(o-a.right),c=Math.min(l,u);let h;const p=e/r*(n+1);if(a.isDash){const t=n-Math.abs(p);h=Math.sqrt(c*c+t*t);}else h=n-Math.sqrt(c*c+p*p);this.image.data[i+o]=Math.max(0,Math.min(255,h+128));}}}addRegularDash(t,e){for(let e=t.length-1;e>=0;--e){const r=t[e],n=t[e+1];r.zeroLength?t.splice(e,1):n&&n.isDash===r.isDash&&(n.left=r.left,t.splice(e,1));}const r=t[0],n=t[t.length-1];r.isDash===n.isDash&&(r.left=n.left-this.width,n.right=r.right+this.width);const i=this.width*this.nextRow;let s=0,a=t[s];for(let r=0;r<this.width;r++){r/a.right>1&&(a=t[++s]);const n=Math.abs(r-a.left),o=Math.abs(r-a.right),l=Math.min(n,o);this.image.data[i+r]=Math.max(0,Math.min(255,(a.isDash?l:-l)+e+128));}}addDash(t,e){const r=this.getKey(t,e);if(this.positions[r])return this.positions[r];const n=\"round\"===e,i=n?7:0,s=2*i+1;if(this.nextRow+s>this.height)return hr(\"LineAtlas out of space\"),null;0===t.length&&t.push(1);let a=0;for(let e=0;e<t.length;e++)t[e]<0&&(hr(\"Negative value is found in line dasharray, replacing values with 0\"),t[e]=0),a+=t[e];if(0!==a){const r=this.width/a,s=this.getDashRanges(t,this.width,r);n?this.addRoundDash(s,r,i):this.addRegularDash(s,\"square\"===e?.5*r:0);}const o=this.nextRow+i;this.nextRow+=s;const l={tl:[o,i],br:[a,0]};return this.positions[r]=l,l}}fo(_d,\"LineAtlas\");const wd=ff.types,Md=Math.cos(Math.PI/180*37.5),Ad=Math.cos(Math.PI/180*5);class Sd{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.fqid)),this.index=t.index,this.projection=t.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={};})),this.layoutVertexArray=new El,this.layoutVertexArray2=new zl,this.patternVertexArray=new Tl,this.indexArray=new ql,this.programConfigurations=new ju(t.layers,t.zoom),this.segments=new mu,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,r,n){this.hasPattern=jp(\"line\",this.layers,e);const i=this.layers[0].layout.get(\"line-sort-key\"),s=[];for(const{feature:e,id:a,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Fc(e,t);if(!this.layers[0]._featureFilter.filter(new Uo(this.zoom),u,r))continue;const c=i?i.evaluate(u,{},r):void 0,h={id:a,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Lc(e,r,n),patterns:{},sortKey:c};s.push(h);}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));const{lineAtlas:a,featureIndex:o}=e,l=this.addConstantDashes(a);for(const n of s){const{geometry:i,index:s,sourceLayerIndex:u}=n;if(l&&this.addFeatureDashes(n,a),this.hasPattern){const t=qp(\"line\",this.layers,n,this.zoom,e);this.patternFeatures.push(t);}else this.addFeature(n,i,s,r,a.positions,e.availableImages,e.brightness);o.insert(t[s].feature,i,s,u,this.index);}}addConstantDashes(t){let e=!1;for(const r of this.layers){const n=r.paint.get(\"line-dasharray\").value,i=r.layout.get(\"line-cap\").value;if(\"constant\"!==n.kind||\"constant\"!==i.kind)e=!0;else {const e=i.value,r=n.value;if(!r)continue;t.addDash(r,e);}}return e}addFeatureDashes(t,e){const r=this.zoom;for(const n of this.layers){const i=n.paint.get(\"line-dasharray\").value,s=n.layout.get(\"line-cap\").value;if(\"constant\"===i.kind&&\"constant\"===s.kind)continue;let a,o;if(\"constant\"===i.kind){if(a=i.value,!a)continue}else a=i.evaluate({zoom:r},t);o=\"constant\"===s.kind?s.value:s.evaluate({zoom:r},t),e.addDash(a,o),t.patterns[n.id]=e.getKey(a,o);}}update(t,e,r,n,i){const s=0!==Object.keys(t).length;s&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(t,e,s?this.stateDependentLayers:this.layers,r,n,i);}addFeatures(t,e,r,n,i,s){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r,n,s);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,xd)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=t.createVertexBuffer(this.patternVertexArray,vd)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,yd),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy());}lineFeatureClips(t){if(t.properties&&t.properties.hasOwnProperty(\"mapbox_clip_start\")&&t.properties.hasOwnProperty(\"mapbox_clip_end\"))return {start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,r,n,i,s,a){const o=this.layers[0].layout,l=o.get(\"line-join\").evaluate(t,{}),u=o.get(\"line-cap\").evaluate(t,{}),c=o.get(\"line-miter-limit\"),h=o.get(\"line-round-limit\");this.lineClips=this.lineFeatureClips(t);for(const r of e)this.addLine(r,t,l,u,c,h);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,s,n,a);}addLine(t,e,r,n,i,s){this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0;const a=\"none\"===r;if(this.patternJoinNone=this.hasPattern&&a,this.segmentStart=0,this.segmentPoints=[],this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance);}const o=\"Polygon\"===wd[e.type];let l=t.length;for(;l>=2&&t[l-1].equals(t[l-2]);)l--;let u=0;for(;u<l-1&&t[u].equals(t[u+1]);)u++;if(l<(o?3:2))return;\"bevel\"===r&&(i=1.05);const c=this.overscaling<=16?15*is/(512*this.overscaling):0,h=this.segments.prepareSegment(10*l,this.layoutVertexArray,this.indexArray);let p,f,d,m,y;this.e1=this.e2=-1,o&&(p=t[l-2],y=t[u].sub(p)._unit()._perp());for(let e=u;e<l;e++){if(d=e===l-1?o?t[u+1]:void 0:t[e+1],d&&t[e].equals(d))continue;y&&(m=y),p&&(f=p),p=t[e],y=d?d.sub(p)._unit()._perp():m,m=m||y;const g=f&&d;let x=g?r:o||a?\"butt\":n;const b=m.x*y.x+m.y*y.y;if(a){const t=function(t){if(t.patternJoinNone){const e=t.segmentPoints.length/2,r=t.lineSoFar-t.segmentStart;for(let n=0;n<e;++n){const e=t.segmentPoints[2*n+1],i=Math.round(t.segmentPoints[2*n])+.5+.25*e;t.patternVertexArray.emplaceBack(i,r),t.patternVertexArray.emplaceBack(i,r);}t.segmentPoints=[],t.segmentStart=t.lineSoFar;}t.e1=t.e2=-1;};if(g&&b<Ad){this.updateDistance(f,p),this.addCurrentVertex(p,m,1,1,h),t(this),this.addCurrentVertex(p,y,-1,-1,h);continue}if(f){if(!d){this.updateDistance(f,p),this.addCurrentVertex(p,m,1,1,h),t(this);continue}x=\"miter\";}}let v=m.add(y);0===v.x&&0===v.y||v._unit();const _=v.x*y.x+v.y*y.y,w=0!==_?1/_:1/0,M=2*Math.sqrt(2-2*_),A=_<Md&&f&&d,S=m.x*y.y-m.y*y.x>0;if(A&&e>u){const t=p.dist(f);if(t>2*c){const e=p.sub(p.sub(f)._mult(c/t)._round());this.updateDistance(f,e),this.addCurrentVertex(e,m,0,0,h),f=e;}}if(g&&\"round\"===x&&(w<s?x=\"miter\":w<=2&&(x=\"fakeround\")),\"miter\"===x&&w>i&&(x=\"bevel\"),\"bevel\"===x&&(w>2&&(x=\"flipbevel\"),w<i&&(x=\"miter\")),f&&this.updateDistance(f,p),\"miter\"===x)v._mult(w),this.addCurrentVertex(p,v,0,0,h);else if(\"flipbevel\"===x){if(w>100)v=y.mult(-1);else {const t=w*m.add(y).mag()/m.sub(y).mag();v._perp()._mult(t*(S?-1:1));}this.addCurrentVertex(p,v,0,0,h),this.addCurrentVertex(p,v.mult(-1),0,0,h);}else if(\"bevel\"===x||\"fakeround\"===x){const t=-Math.sqrt(w*w-1),e=S?t:0,r=S?0:t;if(f&&this.addCurrentVertex(p,m,e,r,h),\"fakeround\"===x){const t=Math.round(180*M/Math.PI/20);for(let e=1;e<t;e++){let r=e/t;if(.5!==r){const t=r-.5;r+=r*t*(r-1)*((1.0904+b*(b*(3.55645-1.43519*b)-3.2452))*t*t+(.848013+b*(.215638*b-1.06021)));}const n=y.sub(m)._mult(r)._add(m)._unit()._mult(S?-1:1);this.addHalfVertex(p,n.x,n.y,!1,S,0,h);}}d&&this.addCurrentVertex(p,y,-e,-r,h);}else \"butt\"===x?this.addCurrentVertex(p,v,0,0,h):\"square\"===x?(f||this.addCurrentVertex(p,v,-1,-1,h),this.addCurrentVertex(p,v,0,0,h),f&&this.addCurrentVertex(p,v,1,1,h)):\"round\"===x&&(f&&(this.addCurrentVertex(p,m,0,0,h),this.addCurrentVertex(p,m,1,1,h,!0)),d&&(this.addCurrentVertex(p,y,-1,-1,h,!0),this.addCurrentVertex(p,y,0,0,h)));if(A&&e<l-1){const t=p.dist(d);if(t>2*c){const e=p.add(d.sub(p)._mult(c/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,y,0,0,h),p=e;}}}}addCurrentVertex(t,e,r,n,i,s=!1){const a=e.y*n-e.x,o=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,s,!1,r,i),this.addHalfVertex(t,a,o,s,!0,-n,i),this.patternJoinNone&&this.segmentPoints.push(this.lineSoFar-this.segmentStart,r);}addHalfVertex({x:t,y:e},r,n,i,s,a,o){this.layoutVertexArray.emplaceBack((t<<1)+(i?1:0),(e<<1)+(s?1:0),Math.round(63*r)+128,Math.round(63*n)+128,1+(0===a?0:a<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const l=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),o.primitiveLength++),s?this.e2=l:this.e1=l;}updateScaledDistance(){if(this.lineClips){const t=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=t*this.lineClips.start+this.distance;}else this.lineSoFar=this.distance;}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance();}}fo(Sd,\"LineBucket\",{omit:[\"layers\",\"patternFeatures\"]});const Id=new Ho({\"line-cap\":new Ko(el.layout_line[\"line-cap\"]),\"line-join\":new Ko(el.layout_line[\"line-join\"]),\"line-miter-limit\":new Zo(el.layout_line[\"line-miter-limit\"]),\"line-round-limit\":new Zo(el.layout_line[\"line-round-limit\"]),\"line-sort-key\":new Ko(el.layout_line[\"line-sort-key\"]),visibility:new Zo(el.layout_line.visibility)});var kd={paint:new Ho({\"line-opacity\":new Ko(el.paint_line[\"line-opacity\"]),\"line-color\":new Ko(el.paint_line[\"line-color\"]),\"line-translate\":new Zo(el.paint_line[\"line-translate\"]),\"line-translate-anchor\":new Zo(el.paint_line[\"line-translate-anchor\"]),\"line-width\":new Ko(el.paint_line[\"line-width\"]),\"line-gap-width\":new Ko(el.paint_line[\"line-gap-width\"]),\"line-offset\":new Ko(el.paint_line[\"line-offset\"]),\"line-blur\":new Ko(el.paint_line[\"line-blur\"]),\"line-dasharray\":new Ko(el.paint_line[\"line-dasharray\"]),\"line-pattern\":new Ko(el.paint_line[\"line-pattern\"]),\"line-gradient\":new Wo(el.paint_line[\"line-gradient\"]),\"line-trim-offset\":new Zo(el.paint_line[\"line-trim-offset\"]),\"line-emissive-strength\":new Zo(el.paint_line[\"line-emissive-strength\"]),\"line-border-width\":new Ko(el.paint_line[\"line-border-width\"]),\"line-border-color\":new Ko(el.paint_line[\"line-border-color\"])}),layout:Id};function Pd(t,e,r){return e*(is/(t.tileSize*Math.pow(2,r-t.tileID.overscaledZ)))}function Ed(t,e){return 1/Pd(t,1,e.tileZoom)}function zd(t,e,r,n){return t.translatePosMatrix(n||e.tileID.projMatrix,e,r.paint.get(\"line-translate\"),r.paint.get(\"line-translate-anchor\"))}const Td=t=>{const e=[];Bd(t)&&e.push(\"RENDER_LINE_DASH\"),t.paint.get(\"line-gradient\")&&e.push(\"RENDER_LINE_GRADIENT\");const r=t.paint.get(\"line-trim-offset\");0===r[0]&&0===r[1]||e.push(\"RENDER_LINE_TRIM_OFFSET\"),0!==t.paint.get(\"line-border-width\").constantOr(1)&&e.push(\"RENDER_LINE_BORDER\");const n=\"none\"===t.layout.get(\"line-join\").constantOr(\"miter\"),i=!!t.paint.get(\"line-pattern\").constantOr(1);return n&&i&&e.push(\"LINE_JOIN_NONE\"),e};function Bd(t){const e=t.paint.get(\"line-dasharray\").value;return e.value||\"constant\"!==e.kind}const Cd=new class extends Ko{possiblyEvaluate(t,e){return e=new Uo(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,n){return e=Je({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,n)}}(kd.paint.properties[\"line-width\"].specification);function Rd(t,e){return e>0?e+2*t:t}Cd.useIntegerZoom=!0;const Vd=Ml([{name:\"a_pos_offset\",components:4,type:\"Int16\"},{name:\"a_tex_size\",components:4,type:\"Uint16\"},{name:\"a_pixeloffset\",components:4,type:\"Int16\"}],4),Dd=Ml([{name:\"a_globe_anchor\",components:3,type:\"Int16\"},{name:\"a_globe_normal\",components:3,type:\"Float32\"}],4),Ld=Ml([{name:\"a_projected_pos\",components:4,type:\"Float32\"}],4);Ml([{name:\"a_fade_opacity\",components:1,type:\"Uint32\"}],4);const Fd=Ml([{name:\"a_z_offset\",components:1,type:\"Float32\"}],4),Od=Ml([{name:\"a_texb\",components:2,type:\"Uint16\"}]),Ud=Ml([{name:\"a_placed\",components:2,type:\"Uint8\"},{name:\"a_shift\",components:2,type:\"Float32\"}]),Nd=Ml([{name:\"a_size_scale\",components:1,type:\"Float32\"},{name:\"a_padding\",components:2,type:\"Float32\"},{name:\"a_z_offset\",components:1,type:\"Float32\"}]);Ml([{type:\"Int16\",name:\"projectedAnchorX\"},{type:\"Int16\",name:\"projectedAnchorY\"},{type:\"Int16\",name:\"projectedAnchorZ\"},{type:\"Int16\",name:\"tileAnchorX\"},{type:\"Int16\",name:\"tileAnchorY\"},{type:\"Float32\",name:\"x1\"},{type:\"Float32\",name:\"y1\"},{type:\"Float32\",name:\"x2\"},{type:\"Float32\",name:\"y2\"},{type:\"Int16\",name:\"padding\"},{type:\"Uint32\",name:\"featureIndex\"},{type:\"Uint16\",name:\"sourceLayerIndex\"},{type:\"Uint16\",name:\"bucketIndex\"}]);const jd=Ml([{name:\"a_pos\",components:3,type:\"Int16\"},{name:\"a_anchor_pos\",components:2,type:\"Int16\"},{name:\"a_extrude\",components:2,type:\"Int16\"}],4),qd=Ml([{name:\"a_pos_2f\",components:2,type:\"Float32\"},{name:\"a_radius\",components:1,type:\"Float32\"},{name:\"a_flags\",components:2,type:\"Int16\"}],4);Ml([{name:\"triangle\",components:3,type:\"Uint16\"}]),Ml([{type:\"Int16\",name:\"projectedAnchorX\"},{type:\"Int16\",name:\"projectedAnchorY\"},{type:\"Int16\",name:\"projectedAnchorZ\"},{type:\"Float32\",name:\"tileAnchorX\"},{type:\"Float32\",name:\"tileAnchorY\"},{type:\"Uint16\",name:\"glyphStartIndex\"},{type:\"Uint16\",name:\"numGlyphs\"},{type:\"Uint32\",name:\"vertexStartIndex\"},{type:\"Uint32\",name:\"lineStartIndex\"},{type:\"Uint32\",name:\"lineLength\"},{type:\"Uint16\",name:\"segment\"},{type:\"Uint16\",name:\"lowerSize\"},{type:\"Uint16\",name:\"upperSize\"},{type:\"Float32\",name:\"lineOffsetX\"},{type:\"Float32\",name:\"lineOffsetY\"},{type:\"Uint8\",name:\"writingMode\"},{type:\"Uint8\",name:\"placedOrientation\"},{type:\"Uint8\",name:\"hidden\"},{type:\"Uint32\",name:\"crossTileID\"},{type:\"Int16\",name:\"associatedIconIndex\"},{type:\"Uint8\",name:\"flipState\"}]),Ml([{type:\"Float32\",name:\"tileAnchorX\"},{type:\"Float32\",name:\"tileAnchorY\"},{type:\"Int16\",name:\"projectedAnchorX\"},{type:\"Int16\",name:\"projectedAnchorY\"},{type:\"Int16\",name:\"projectedAnchorZ\"},{type:\"Int16\",name:\"rightJustifiedTextSymbolIndex\"},{type:\"Int16\",name:\"centerJustifiedTextSymbolIndex\"},{type:\"Int16\",name:\"leftJustifiedTextSymbolIndex\"},{type:\"Int16\",name:\"verticalPlacedTextSymbolIndex\"},{type:\"Int16\",name:\"placedIconSymbolIndex\"},{type:\"Int16\",name:\"verticalPlacedIconSymbolIndex\"},{type:\"Uint16\",name:\"key\"},{type:\"Uint16\",name:\"textBoxStartIndex\"},{type:\"Uint16\",name:\"textBoxEndIndex\"},{type:\"Uint16\",name:\"verticalTextBoxStartIndex\"},{type:\"Uint16\",name:\"verticalTextBoxEndIndex\"},{type:\"Uint16\",name:\"iconBoxStartIndex\"},{type:\"Uint16\",name:\"iconBoxEndIndex\"},{type:\"Uint16\",name:\"verticalIconBoxStartIndex\"},{type:\"Uint16\",name:\"verticalIconBoxEndIndex\"},{type:\"Uint16\",name:\"featureIndex\"},{type:\"Uint16\",name:\"numHorizontalGlyphVertices\"},{type:\"Uint16\",name:\"numVerticalGlyphVertices\"},{type:\"Uint16\",name:\"numIconVertices\"},{type:\"Uint16\",name:\"numVerticalIconVertices\"},{type:\"Uint16\",name:\"useRuntimeCollisionCircles\"},{type:\"Uint32\",name:\"crossTileID\"},{type:\"Float32\",components:2,name:\"textOffset\"},{type:\"Float32\",name:\"collisionCircleDiameter\"},{type:\"Float32\",name:\"zOffset\"},{type:\"Uint8\",name:\"hasIconTextFit\"}]),Ml([{type:\"Float32\",name:\"offsetX\"}]),Ml([{type:\"Int16\",name:\"x\"},{type:\"Int16\",name:\"y\"}]);var $d=24;const Gd=128;function Qd(t,e){const{expression:r}=e;if(\"constant\"===r.kind)return {kind:\"constant\",layoutSize:r.evaluate(new Uo(t+1))};if(\"source\"===r.kind)return {kind:\"source\"};{const{zoomStops:e,interpolationType:n}=r;let i=0;for(;i<e.length&&e[i]<=t;)i++;i=Math.max(0,i-1);let s=i;for(;s<e.length&&e[s]<t+1;)s++;s=Math.min(e.length-1,s);const a=e[i],o=e[s];return \"composite\"===r.kind?{kind:\"composite\",minZoom:a,maxZoom:o,interpolationType:n}:{kind:\"camera\",minZoom:a,maxZoom:o,minSize:r.evaluate(new Uo(a)),maxSize:r.evaluate(new Uo(o)),interpolationType:n}}}function Yd(t,{uSize:e,uSizeT:r},{lowerSize:n,upperSize:i}){return \"source\"===t.kind?n/Gd:\"composite\"===t.kind?qn(n/Gd,i/Gd,r):e}function Xd(t,e){let r=0,n=0;if(\"constant\"===t.kind)n=t.layoutSize;else if(\"source\"!==t.kind){const{interpolationType:i,minZoom:s,maxZoom:a}=t,o=i?Ze(ha.interpolationFactor(i,e,s,a),0,1):0;\"camera\"===t.kind?n=qn(t.minSize,t.maxSize,o):r=o;}return {uSizeT:r,uSize:n}}var Zd=Object.freeze({__proto__:null,SIZE_PACK_FACTOR:Gd,evaluateSizeForFeature:Yd,evaluateSizeForZoom:Xd,getSizeData:Qd});function Kd(t,e,r){return t.sections.forEach((t=>{t.text=function(t,e,r){const n=e.layout.get(\"text-transform\").evaluate(r,{});return \"uppercase\"===n?t=t.toLocaleUpperCase():\"lowercase\"===n&&(t=t.toLocaleLowerCase()),Oo.applyArabicShaping&&(t=Oo.applyArabicShaping(t)),t}(t.text,e,r);})),t}const Wd={\"!\":\"︕\",\"#\":\"＃\",$:\"＄\",\"%\":\"％\",\"&\":\"＆\",\"(\":\"︵\",\")\":\"︶\",\"*\":\"＊\",\"+\":\"＋\",\",\":\"︐\",\"-\":\"︲\",\".\":\"・\",\"/\":\"／\",\":\":\"︓\",\";\":\"︔\",\"<\":\"︿\",\"=\":\"＝\",\">\":\"﹀\",\"?\":\"︖\",\"@\":\"＠\",\"[\":\"﹇\",\"\\\\\":\"＼\",\"]\":\"﹈\",\"^\":\"＾\",_:\"︳\",\"`\":\"｀\",\"{\":\"︷\",\"|\":\"―\",\"}\":\"︸\",\"~\":\"～\",\"¢\":\"￠\",\"£\":\"￡\",\"¥\":\"￥\",\"¦\":\"￤\",\"¬\":\"￢\",\"¯\":\"￣\",\"–\":\"︲\",\"—\":\"︱\",\"‘\":\"﹃\",\"’\":\"﹄\",\"“\":\"﹁\",\"”\":\"﹂\",\"…\":\"︙\",\"‧\":\"・\",\"₩\":\"￦\",\"、\":\"︑\",\"。\":\"︒\",\"〈\":\"︿\",\"〉\":\"﹀\",\"《\":\"︽\",\"》\":\"︾\",\"「\":\"﹁\",\"」\":\"﹂\",\"『\":\"﹃\",\"』\":\"﹄\",\"【\":\"︻\",\"】\":\"︼\",\"〔\":\"︹\",\"〕\":\"︺\",\"〖\":\"︗\",\"〗\":\"︘\",\"！\":\"︕\",\"（\":\"︵\",\"）\":\"︶\",\"，\":\"︐\",\"－\":\"︲\",\"．\":\"・\",\"：\":\"︓\",\"；\":\"︔\",\"＜\":\"︿\",\"＞\":\"﹀\",\"？\":\"︖\",\"［\":\"﹇\",\"］\":\"﹈\",\"＿\":\"︳\",\"｛\":\"︷\",\"｜\":\"―\",\"｝\":\"︸\",\"｟\":\"︵\",\"｠\":\"︶\",\"｡\":\"︒\",\"｢\":\"﹁\",\"｣\":\"﹂\",\"←\":\"↑\",\"→\":\"↓\"};function Hd(t){return \"︶\"===t||\"﹈\"===t||\"︸\"===t||\"﹄\"===t||\"﹂\"===t||\"︾\"===t||\"︼\"===t||\"︺\"===t||\"︘\"===t||\"﹀\"===t||\"︐\"===t||\"︓\"===t||\"︔\"===t||\"｀\"===t||\"￣\"===t||\"︑\"===t||\"︒\"===t}function Jd(t){return \"︵\"===t||\"﹇\"===t||\"︷\"===t||\"﹃\"===t||\"﹁\"===t||\"︽\"===t||\"︻\"===t||\"︹\"===t||\"︗\"===t||\"︿\"===t}var tm={\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nread:function(t,e,r,n,i){var s,a,o=8*i-n-1,l=(1<<o)-1,u=l>>1,c=-7,h=r?i-1:0,p=r?-1:1,f=t[e+h];for(h+=p,s=f&(1<<-c)-1,f>>=-c,c+=o;c>0;s=256*s+t[e+h],h+=p,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=p,c-=8);if(0===s)s=1-u;else {if(s===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),s-=u;}return (f?-1:1)*a*Math.pow(2,s-n)},write:function(t,e,r,n,i,s){var a,o,l,u=8*s-i-1,c=(1<<u)-1,h=c>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,d=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=c?(o=0,a=c):a+h>=1?(o=(e*l-1)*Math.pow(2,i),a+=h):(o=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=255&o,f+=d,o/=256,i-=8);for(a=a<<i|o,u+=i;u>0;t[r+f]=255&a,f+=d,a/=256,u-=8);t[r+f-d]|=128*m;}},em=nm,rm=tm;function nm(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length;}nm.Varint=0,nm.Fixed64=1,nm.Bytes=2,nm.Fixed32=5;var im=4294967296,sm=1/im,am=\"undefined\"==typeof TextDecoder?null:new TextDecoder(\"utf8\");function om(t){return t.type===nm.Bytes?t.readVarint()+t.pos:t.pos+1}function lm(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function um(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i];}function cm(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r]);}function hm(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r]);}function pm(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r]);}function fm(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r]);}function dm(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r]);}function mm(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r]);}function ym(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r]);}function gm(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r]);}function xm(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r]);}function bm(t,e){return (t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function vm(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24;}function _m(t,e){return (t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}nm.prototype={destroy:function(){this.buf=null;},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,s=this.pos;this.type=7&n,t(i,e,this),this.pos===s&&this.skip(n);}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=bm(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=_m(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=bm(this.buf,this.pos)+bm(this.buf,this.pos+4)*im;return this.pos+=8,t},readSFixed64:function(){var t=bm(this.buf,this.pos)+_m(this.buf,this.pos+4)*im;return this.pos+=8,t},readFloat:function(){var t=rm.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=rm.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,s=r.buf;if(n=(112&(i=s[r.pos++]))>>4,i<128)return lm(t,n,e);if(n|=(127&(i=s[r.pos++]))<<3,i<128)return lm(t,n,e);if(n|=(127&(i=s[r.pos++]))<<10,i<128)return lm(t,n,e);if(n|=(127&(i=s[r.pos++]))<<17,i<128)return lm(t,n,e);if(n|=(127&(i=s[r.pos++]))<<24,i<128)return lm(t,n,e);if(n|=(1&(i=s[r.pos++]))<<31,i<128)return lm(t,n,e);throw new Error(\"Expected varint not more than 10 bytes\")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&am?function(t,e,r){return am.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n=\"\",i=e;i<r;){var s,a,o,l=t[i],u=null,c=l>239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(s=t[i+1]))&&(u=(31&l)<<6|63&s)<=127&&(u=null):3===c?(a=t[i+2],128==(192&(s=t[i+1]))&&128==(192&a)&&((u=(15&l)<<12|(63&s)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(a=t[i+2],o=t[i+3],128==(192&(s=t[i+1]))&&128==(192&a)&&128==(192&o)&&((u=(15&l)<<18|(63&s)<<12|(63&a)<<6|63&o)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c;}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==nm.Bytes)return t.push(this.readVarint(e));var r=om(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==nm.Bytes)return t.push(this.readSVarint());var e=om(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==nm.Bytes)return t.push(this.readBoolean());var e=om(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==nm.Bytes)return t.push(this.readFloat());var e=om(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==nm.Bytes)return t.push(this.readDouble());var e=om(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==nm.Bytes)return t.push(this.readFixed32());var e=om(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==nm.Bytes)return t.push(this.readSFixed32());var e=om(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==nm.Bytes)return t.push(this.readFixed64());var e=om(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==nm.Bytes)return t.push(this.readSFixed64());var e=om(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===nm.Varint)for(;this.buf[this.pos++]>127;);else if(e===nm.Bytes)this.pos=this.readVarint()+this.pos;else if(e===nm.Fixed32)this.pos+=4;else {if(e!==nm.Fixed64)throw new Error(\"Unimplemented type: \"+e);this.pos+=8;}},writeTag:function(t,e){this.writeVarint(t<<3|e);},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e;}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),vm(this.buf,t,this.pos),this.pos+=4;},writeSFixed32:function(t){this.realloc(4),vm(this.buf,t,this.pos),this.pos+=4;},writeFixed64:function(t){this.realloc(8),vm(this.buf,-1&t,this.pos),vm(this.buf,Math.floor(t*sm),this.pos+4),this.pos+=8;},writeSFixed64:function(t){this.realloc(8),vm(this.buf,-1&t,this.pos),vm(this.buf,Math.floor(t*sm),this.pos+4),this.pos+=8;},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error(\"Given varint doesn't fit into 10 bytes\");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7);}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))));}(n,e);}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))));},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t);},writeBoolean:function(t){this.writeVarint(Boolean(t));},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,s=0;s<e.length;s++){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){n>56319||s+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null;}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128);}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&um(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r;},writeFloat:function(t){this.realloc(4),rm.write(this.buf,t,this.pos,!0,23,4),this.pos+=4;},writeDouble:function(t){this.realloc(8),rm.write(this.buf,t,this.pos,!0,52,8),this.pos+=8;},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r];},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&um(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n;},writeMessage:function(t,e,r){this.writeTag(t,nm.Bytes),this.writeRawMessage(e,r);},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,cm,e);},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,hm,e);},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,dm,e);},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,pm,e);},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,fm,e);},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,mm,e);},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,ym,e);},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,gm,e);},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,xm,e);},writeBytesField:function(t,e){this.writeTag(t,nm.Bytes),this.writeBytes(e);},writeFixed32Field:function(t,e){this.writeTag(t,nm.Fixed32),this.writeFixed32(e);},writeSFixed32Field:function(t,e){this.writeTag(t,nm.Fixed32),this.writeSFixed32(e);},writeFixed64Field:function(t,e){this.writeTag(t,nm.Fixed64),this.writeFixed64(e);},writeSFixed64Field:function(t,e){this.writeTag(t,nm.Fixed64),this.writeSFixed64(e);},writeVarintField:function(t,e){this.writeTag(t,nm.Varint),this.writeVarint(e);},writeSVarintField:function(t,e){this.writeTag(t,nm.Varint),this.writeSVarint(e);},writeStringField:function(t,e){this.writeTag(t,nm.Bytes),this.writeString(e);},writeFloatField:function(t,e){this.writeTag(t,nm.Fixed32),this.writeFloat(e);},writeDoubleField:function(t,e){this.writeTag(t,nm.Fixed64),this.writeDouble(e);},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e));}};var wm=h(em);const Mm=3;function Am(t,e,r){e.glyphs=[],1===t&&r.readMessage(Sm,e);}function Sm(t,e,r){if(3===t){const{id:t,bitmap:n,width:i,height:s,left:a,top:o,advance:l}=r.readMessage(Im,{});e.glyphs.push({id:t,bitmap:new rp({width:i+2*Mm,height:s+2*Mm},n),metrics:{width:i,height:s,left:a,top:o,advance:l}});}else 4===t?e.ascender=r.readSVarint():5===t&&(e.descender=r.readSVarint());}function Im(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint());}const km=Mm,Pm={horizontal:1,vertical:2,horizontalOnly:3};class Em{constructor(){this.scale=1,this.fontStack=\"\",this.imageName=null;}static forText(t,e){const r=new Em;return r.scale=t||1,r.fontStack=e,r}static forImage(t){const e=new Em;return e.imageName=t,e}}class zm{constructor(){this.text=\"\",this.sectionIndex=[],this.sections=[],this.imageSectionID=null;}static fromFeature(t,e){const r=new zm;for(let n=0;n<t.sections.length;n++){const i=t.sections[n];i.image?r.addImageSection(i):r.addTextSection(i,e);}return r}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSections(){return this.sections}getSectionIndex(t){return this.sectionIndex[t]}getCodePoint(t){return this.text.codePointAt(t)}verticalizePunctuation(t){this.text=function(t,e){let r=\"\";for(let n=0;n<t.length;n++){const i=t.charCodeAt(n+1)||null,s=t.charCodeAt(n-1)||null;r+=!e&&(i&&Ao(i)&&!Wd[t[n+1]]||s&&Ao(s)&&!Wd[t[n-1]])||!Wd[t[n]]?t[n]:Wd[t[n]];}return r}(this.text,t);}trim(){let t=0;for(let e=0;e<this.text.length&&Bm[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let r=this.text.length-1;r>=0&&r>=t&&Bm[this.text.charCodeAt(r)];r--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e);}substring(t,e){const r=new zm;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(Em.forText(t.scale,t.fontStack||e));const r=this.sections.length-1;for(let e=0;e<t.text.length;++e)this.sectionIndex.push(r);}addImageSection(t){const e=t.image?t.image.namePrimary:\"\";if(0===e.length)return void hr(\"Can't add FormattedSection with an empty image.\");const r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCodePoint(r),this.sections.push(Em.forImage(e)),this.sectionIndex.push(this.sections.length-1)):hr(\"Reached maximum number of images 6401\");}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Tm(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d){const m=zm.fromFeature(t,i);h===Pm.vertical&&m.verticalizePunctuation(p);let y=[];const g=function(t,e,r,n,i,s){if(!t)return [];const a=[],o=function(t,e,r,n,i,s){let a=0;for(let r=0;r<t.length();r++){const o=t.getSection(r);a+=Rm(t.getCodePoint(r),o,n,i,e,s);}return a/Math.max(1,Math.ceil(a/r))}(t,e,r,n,i,s),l=t.text.indexOf(\"​\")>=0;let u=0;for(let r=0;r<t.length();r++){const h=t.getSection(r),p=t.getCodePoint(r);if(Bm[p]||(u+=Rm(p,h,n,i,e,s)),r<t.length()-1){const e=!((c=p)<11904||!(bo[\"Bopomofo Extended\"](c)||bo.Bopomofo(c)||bo[\"CJK Compatibility Forms\"](c)||bo[\"CJK Compatibility Ideographs\"](c)||bo[\"CJK Compatibility\"](c)||bo[\"CJK Radicals Supplement\"](c)||bo[\"CJK Strokes\"](c)||bo[\"CJK Symbols and Punctuation\"](c)||bo[\"CJK Unified Ideographs Extension A\"](c)||bo[\"CJK Unified Ideographs\"](c)||bo[\"Enclosed CJK Letters and Months\"](c)||bo[\"Halfwidth and Fullwidth Forms\"](c)||bo.Hiragana(c)||bo[\"Ideographic Description Characters\"](c)||bo[\"Kangxi Radicals\"](c)||bo[\"Katakana Phonetic Extensions\"](c)||bo.Katakana(c)||bo[\"Vertical Forms\"](c)||bo[\"Yi Radicals\"](c)||bo[\"Yi Syllables\"](c)));(Cm[p]||e||h.imageName)&&a.push(Lm(r+1,u,o,a,Dm(p,t.getCodePoint(r+1),e&&l),!1));}}var c;return Fm(Lm(t.length(),u,o,a,0,!0))}(m,u,s,e,n,f),{processBidirectionalText:x,processStyledBidirectionalText:b}=Oo;if(x&&1===m.sections.length){const t=x(m.toString(),g);for(const e of t){const t=new zm;t.text=e,t.sections=m.sections;for(let r=0;r<e.length;r++)t.sectionIndex.push(0);y.push(t);}}else if(b){const t=b(m.text,m.sectionIndex,g);for(const e of t){const t=new zm;t.text=e[0],t.sectionIndex=e[1],t.sections=m.sections,y.push(t);}}else y=function(t,e){const r=[],n=t.text;let i=0;for(const n of e)r.push(t.substring(i,n)),i=n;return i<n.length&&r.push(t.substring(i,n.length)),r}(m,g);const v=[],_={positionedLines:v,text:m.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:h,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(t,e,r,n,i,s,a,o,l,u,c,h){let p=0,f=0,d=0;const m=\"right\"===o?1:\"left\"===o?0:.5;let y=!1;for(const t of i){const r=t.getSections();for(const t of r){if(t.imageName)continue;const r=e[t.fontStack];if(r&&(y=void 0!==r.ascender&&void 0!==r.descender,!y))break}if(!y)break}let g=0;for(const a of i){a.trim();const i=a.getMaxScale(),o=(i-1)*$d,b={positionedGlyphs:[],lineOffset:0};t.positionedLines[g]=b;const v=b.positionedGlyphs;let _=0;if(!a.length()){f+=s,++g;continue}let w=0,M=0;for(let s=0;s<a.length();s++){const o=a.getSection(s),d=a.getSectionIndex(s),m=a.getCodePoint(s);let g=o.scale,b=null,A=null,S=null,I=$d,k=0;const P=!(l===Pm.horizontal||!c&&!Mo(m)||c&&(Bm[m]||(x=m,bo.Arabic(x)||bo[\"Arabic Supplement\"](x)||bo[\"Arabic Extended-A\"](x)||bo[\"Arabic Presentation Forms-A\"](x)||bo[\"Arabic Presentation Forms-B\"](x))));if(o.imageName){const e=n[o.imageName];if(!e)continue;S=o.imageName,t.iconsInText=t.iconsInText||!0,A=e.paddedRect;const r=e.displaySize;g=g*$d/h,b={width:r[0],height:r[1],left:0,top:-km,advance:P?r[1]:r[0],localGlyph:!1},k=y?-b.height*g:i*$d-17-r[1]*g,I=b.advance;const s=(P?r[0]:r[1])*g-$d*i;s>0&&s>_&&(_=s);}else {const t=r[o.fontStack];if(!t)continue;t[m]&&(A=t[m]);const n=e[o.fontStack];if(!n)continue;const s=n.glyphs[m];if(!s)continue;if(b=s.metrics,I=8203!==m?$d:0,y){const t=void 0!==n.ascender?Math.abs(n.ascender):0,e=void 0!==n.descender?Math.abs(n.descender):0,r=(t+e)*g;w<r&&(w=r,M=(t-e)/2*g),k=-t*g;}else k=(i-g)*$d-17;}P?(t.verticalizable=!0,v.push({glyph:m,imageName:S,x:p,y:f+k,vertical:P,scale:g,localGlyph:b.localGlyph,fontStack:o.fontStack,sectionIndex:d,metrics:b,rect:A}),p+=I*g+u):(v.push({glyph:m,imageName:S,x:p,y:f+k,vertical:P,scale:g,localGlyph:b.localGlyph,fontStack:o.fontStack,sectionIndex:d,metrics:b,rect:A}),p+=b.advance*g+u);}0!==v.length&&(d=Math.max(p-u,d),y?Um(v,m,_,M,s*i/2):Um(v,m,_,0,s/2)),p=0;const A=s*i+_;b.lineOffset=Math.max(_,o),f+=A,++g;}var x;const b=f,{horizontalAlign:v,verticalAlign:_}=Om(a);((function(t,e,r,n,i,s){const a=(e-r)*i,o=-s*n;for(const e of t)for(const t of e.positionedGlyphs)t.x+=a,t.y+=o;}))(t.positionedLines,m,v,_,d,b),t.top+=-_*b,t.bottom=t.top+b,t.left+=-v*d,t.right=t.left+d,t.hasBaseline=y;}(_,e,r,n,y,a,o,l,h,u,p,d),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return !1;return !0}(v)&&_}const Bm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Cm={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Rm(t,e,r,n,i,s){if(e.imageName){const t=n[e.imageName];return t?t.displaySize[0]*e.scale*$d/s+i:0}{const n=r[e.fontStack],s=n&&n.glyphs[t];return s?s.metrics.advance*e.scale+i:0}}function Vm(t,e,r,n){const i=Math.pow(t-e,2);return n?t<e?i/2:2*i:i+Math.abs(r)*r}function Dm(t,e,r){let n=0;return 10===t&&(n-=1e4),r&&(n+=150),40!==t&&65288!==t||(n+=50),41!==e&&65289!==e||(n+=50),n}function Lm(t,e,r,n,i,s){let a=null,o=Vm(e,r,i,s);for(const t of n){const n=Vm(e-t.x,r,i,s)+t.badness;n<=o&&(a=t,o=n);}return {index:t,x:e,priorBreak:a,badness:o}}function Fm(t){return t?Fm(t.priorBreak).concat(t.index):[]}function Om(t){let e=.5,r=.5;switch(t){case\"right\":case\"top-right\":case\"bottom-right\":e=1;break;case\"left\":case\"top-left\":case\"bottom-left\":e=0;}switch(t){case\"bottom\":case\"bottom-right\":case\"bottom-left\":r=1;break;case\"top\":case\"top-right\":case\"top-left\":r=0;}return {horizontalAlign:e,verticalAlign:r}}function Um(t,e,r,n,i){if(!(e||r||n||i))return;const s=t.length-1,a=t[s],o=(a.x+a.metrics.advance*a.scale)*e;for(let e=0;e<=s;e++)t[e].x-=o,t[e].y+=r+n+i;}function Nm(t,e,r,n){const{horizontalAlign:i,verticalAlign:s}=Om(n),a=r[0]-t.displaySize[0]*i,o=r[1]-t.displaySize[1]*s;return {imagePrimary:t,imageSecondary:e,top:o,bottom:o+t.displaySize[1],left:a,right:a+t.displaySize[0]}}function jm(t,e,r,n,i,s){const a=t.imagePrimary;let o;if(a.content){const t=a.content,e=a.pixelRatio||1;o=[t[0]/e,t[1]/e,a.displaySize[0]-t[2]/e,a.displaySize[1]-t[3]/e];}const l=e.left*s,u=e.right*s;let c,h,p,f;\"width\"===r||\"both\"===r?(f=i[0]+l-n[3],h=i[0]+u+n[1]):(f=i[0]+(l+u-a.displaySize[0])/2,h=f+a.displaySize[0]);const d=e.top*s,m=e.bottom*s;return \"height\"===r||\"both\"===r?(c=i[1]+d-n[0],p=i[1]+m+n[2]):(c=i[1]+(d+m-a.displaySize[1])/2,p=c+a.displaySize[1]),{imagePrimary:a,imageSecondary:void 0,top:c,right:h,bottom:p,left:f,collisionPadding:o}}class qm extends Ue{constructor(t,e,r,n,i){super(t,e),this.angle=n,this.z=r,void 0!==i&&(this.segment=i);}clone(){return new qm(this.x,this.y,this.z,this.angle,this.segment)}}function $m(t,e,r,n,i){if(void 0===e.segment)return !0;let s=e,a=e.segment+1,o=0;for(;o>-r/2;){if(a--,a<0)return !1;o-=t[a].dist(s),s=t[a];}o+=t[a].dist(t[a+1]),a++;const l=[];let u=0;for(;o<r/2;){const e=t[a],r=t[a+1];if(!r)return !1;let s=t[a-1].angleTo(e)-e.angleTo(r);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:o,angleDelta:s}),u+=s;o-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return !1;a++,o+=e.dist(r);}return !0}function Gm(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function Qm(t,e,r){return t?.6*e*r:0}function Ym(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Xm(t,e,r,n,i,s){const a=Qm(r,i,s),o=Ym(r,n)*s;let l=0;const u=Gm(t)/2;for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1],s=n.dist(i);if(l+s>u){const c=(u-l)/s,h=qn(n.x,i.x,c),p=qn(n.y,i.y,c),f=new qm(h,p,0,i.angleTo(n),r);return !a||$m(t,f,o,a,e)?f:void 0}l+=s;}}function Zm(t,e,r,n,i,s,a,o,l){const u=Qm(n,s,a),c=Ym(n,i),h=c*a,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h<e/4&&(e=h+e/4),Km(t,p?e/2*o%e:(c/2+2*s)*a*o%e,e,u,r,h,p,!1,l)}function Km(t,e,r,n,i,s,a,o,l){const u=s/2,c=Gm(t);let h=0,p=e-r,f=[];for(let e=0;e<t.length-1;e++){const a=t[e],o=t[e+1],d=a.dist(o),m=o.angleTo(a);for(;p+r<h+d;){p+=r;const y=(p-h)/d,g=qn(a.x,o.x,y),x=qn(a.y,o.y,y);if(g>=0&&g<l&&x>=0&&x<l&&p-u>=0&&p+u<=c){const r=new qm(g,x,0,m,e);n&&!$m(t,r,s,n,i)||f.push(r);}}h+=d;}return o||f.length||a||(f=Km(t,h/2,r,n,i,s,a,!0,l)),f}function Wm(t,e,r,n,i){const s=[];for(let a=0;a<t.length;a++){const o=t[a];let l;for(let t=0;t<o.length-1;t++){let a=o[t],u=o[t+1];a.x<e&&u.x<e||(a.x<e?a=new Ue(e,a.y+(e-a.x)/(u.x-a.x)*(u.y-a.y))._round():u.x<e&&(u=new Ue(e,a.y+(e-a.x)/(u.x-a.x)*(u.y-a.y))._round()),a.y<r&&u.y<r||(a.y<r?a=new Ue(a.x+(r-a.y)/(u.y-a.y)*(u.x-a.x),r)._round():u.y<r&&(u=new Ue(a.x+(r-a.y)/(u.y-a.y)*(u.x-a.x),r)._round()),a.x>=n&&u.x>=n||(a.x>=n?a=new Ue(n,a.y+(n-a.x)/(u.x-a.x)*(u.y-a.y))._round():u.x>=n&&(u=new Ue(n,a.y+(n-a.x)/(u.x-a.x)*(u.y-a.y))._round()),a.y>=i&&u.y>=i||(a.y>=i?a=new Ue(a.x+(i-a.y)/(u.y-a.y)*(u.x-a.x),i)._round():u.y>=i&&(u=new Ue(a.x+(i-a.y)/(u.y-a.y)*(u.x-a.x),i)._round()),l&&a.equals(l[l.length-1])||(l=[a],s.push(l)),l.push(u)))));}}return s}function Hm(t){let e=0,r=0;for(const n of t)e+=n.w*n.h,r=Math.max(r,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let i=0,s=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const r=n[t];if(!(e.w>r.w||e.h>r.h)){if(e.x=r.x,e.y=r.y,s=Math.max(s,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===r.w&&e.h===r.h){const e=n.pop();t<n.length&&(n[t]=e);}else e.h===r.h?(r.x+=e.w,r.w-=e.w):e.w===r.w?(r.y+=e.h,r.h-=e.h):(n.push({x:r.x+e.w,y:r.y,w:r.w-e.w,h:e.h}),r.y+=e.h,r.h-=e.h);break}}return {w:i,h:s,fill:e/(i*s)||0}}fo(qm,\"Anchor\");const Jm=1;class ty{constructor(t,{pixelRatio:e,version:r,stretchX:n,stretchY:i,content:s}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=i,this.content=s,this.version=r;}get tl(){return [this.paddedRect.x+Jm,this.paddedRect.y+Jm]}get br(){return [this.paddedRect.x+this.paddedRect.w-Jm,this.paddedRect.y+this.paddedRect.h-Jm]}get displaySize(){return [(this.paddedRect.w-2*Jm)/this.pixelRatio,(this.paddedRect.h-2*Jm)/this.pixelRatio]}}class ey{constructor(t,e){const r={},n={};this.haveRenderCallbacks=[];const i=[];this.addImages(t,r,i),this.addImages(e,n,i);const{w:s,h:a}=Hm(i),o=new np({width:s||1,height:a||1});for(const e in t){const n=t[e],i=r[e].paddedRect;np.copy(n.data,o,{x:0,y:0},{x:i.x+Jm,y:i.y+Jm},n.data,n.sdf);}for(const t in e){const r=e[t],i=n[t].paddedRect,s=i.x+Jm,a=i.y+Jm,l=r.data.width,u=r.data.height;np.copy(r.data,o,{x:0,y:0},{x:s,y:a},r.data),np.copy(r.data,o,{x:0,y:u-1},{x:s,y:a-1},{width:l,height:1}),np.copy(r.data,o,{x:0,y:0},{x:s,y:a+u},{width:l,height:1}),np.copy(r.data,o,{x:l-1,y:0},{x:s-1,y:a},{width:1,height:u}),np.copy(r.data,o,{x:0,y:0},{x:s+l,y:a},{width:1,height:u});}this.image=o,this.iconPositions=r,this.patternPositions=n;}addImages(t,e,r){for(const n in t){const i=t[n],s={x:0,y:0,w:i.data.width+2*Jm,h:i.data.height+2*Jm};r.push(s),e[n]=new ty(s,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n);}}patchUpdatedImages(t,e,r){this.haveRenderCallbacks=this.haveRenderCallbacks.filter((e=>t.hasImage(e,r))),t.dispatchRenderCallbacks(this.haveRenderCallbacks,r);for(const n in t.getUpdatedImages(r))this.patchUpdatedImage(this.iconPositions[n],t.getImage(n,r),e),this.patchUpdatedImage(this.patternPositions[n],t.getImage(n,r),e);}patchUpdatedImage(t,e,r){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[n,i]=t.tl,s=!!Object.keys(this.patternPositions).length;r.update(e.data,{useMipmap:s},{x:n,y:i});}}fo(ty,\"ImagePosition\"),fo(ey,\"ImageAtlas\");const ry=1e20;function ny(t,e,r,n,i,s,a,o,l){for(let u=e;u<e+n;u++)iy(t,r*s+u,s,i,a,o,l);for(let u=r;u<r+i;u++)iy(t,u*s+e,1,n,a,o,l);}function iy(t,e,r,n,i,s,a){s[0]=0,a[0]=-ry,a[1]=ry,i[0]=t[e];for(let o=1,l=0,u=0;o<n;o++){i[o]=t[e+o*r];const n=o*o;do{const t=s[l];u=(i[o]-i[t]+n-t*t)/(o-t)/2;}while(u<=a[l]&&--l>-1);l++,s[l]=o,a[l]=u,a[l+1]=ry;}for(let o=0,l=0;o<n;o++){for(;a[l+1]<o;)l++;const n=s[l],u=o-n;t[e+o*r]=i[n]+u*u;}}const sy=2,ay={none:0,ideographs:1,all:2};class oy{constructor(t,e,r){this.requestManager=t,this.localGlyphMode=e,this.localFontFamily=r,this.urls={},this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}};}setURL(t,e){this.urls[e]=t;}getGlyphs(t,e,r){const i=[],s=this.urls[e]||n.GLYPHS_URL;for(const e in t)for(const r of t[e])i.push({stack:e,id:r});He(i,(({stack:t,id:e},r)=>{let n=this.entries[t];n||(n=this.entries[t]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let i=n.glyphs[e];if(void 0!==i)return void r(null,{stack:t,id:e,glyph:i});if(i=this._tinySDF(n,t,e),i)return n.glyphs[e]=i,void r(null,{stack:t,id:e,glyph:i});const a=Math.floor(e/256);if(256*a>65535)return void r(new Error(\"glyphs > 65535 not supported\"));if(n.ranges[a])return void r(null,{stack:t,id:e,glyph:i});let o=n.requests[a];o||(o=n.requests[a]=[],oy.loadGlyphRange(t,a,s,this.requestManager,((t,e)=>{if(e){n.ascender=e.ascender,n.descender=e.descender;for(const t in e.glyphs)this._doesCharSupportLocalGlyph(+t)||(n.glyphs[+t]=e.glyphs[+t]);n.ranges[a]=!0;}for(const r of o)r(t,e);delete n.requests[a];}))),o.push(((n,i)=>{n?r(n):i&&r(null,{stack:t,id:e,glyph:i.glyphs[e]||null});}));}),((t,e)=>{if(t)r(t);else if(e){const t={};for(const{stack:r,id:n,glyph:i}of e)void 0===t[r]&&(t[r]={}),void 0===t[r].glyphs&&(t[r].glyphs={}),t[r].glyphs[n]=i&&{id:i.id,bitmap:i.bitmap.clone(),metrics:i.metrics},t[r].ascender=this.entries[r].ascender,t[r].descender=this.entries[r].descender;r(null,t);}}));}_doesCharSupportLocalGlyph(t){return this.localGlyphMode!==ay.none&&(this.localGlyphMode===ay.all?!!this.localFontFamily:!!this.localFontFamily&&(bo[\"CJK Unified Ideographs\"](t)||bo[\"Hangul Syllables\"](t)||bo.Hiragana(t)||bo.Katakana(t)||bo[\"CJK Symbols and Punctuation\"](t)||bo[\"CJK Unified Ideographs Extension A\"](t)||bo[\"CJK Unified Ideographs Extension B\"](t)))}_tinySDF(t,e,r){const n=this.localFontFamily;if(!n||!this._doesCharSupportLocalGlyph(r))return;let i=t.tinySDF;if(!i){let r=\"400\";/bold/i.test(e)?r=\"900\":/medium/i.test(e)?r=\"500\":/light/i.test(e)&&(r=\"200\"),i=t.tinySDF=new oy.TinySDF({fontFamily:n,fontWeight:r,fontSize:24*sy,buffer:3*sy,radius:8*sy}),i.fontWeight=r;}if(this.localGlyphs[i.fontWeight][r])return this.localGlyphs[i.fontWeight][r];const s=String.fromCodePoint(r),{data:a,width:o,height:l,glyphWidth:u,glyphHeight:c,glyphLeft:h,glyphTop:p,glyphAdvance:f}=i.draw(s);return this.localGlyphs[i.fontWeight][r]={id:r,bitmap:new rp({width:o,height:l},a),metrics:{width:u/sy,height:c/sy,left:h/sy,top:p/sy-27,advance:f/sy,localGlyph:!0}}}}oy.loadGlyphRange=function(t,e,r,n,i){const s=256*e,a=s+255,o=n.transformRequest(n.normalizeGlyphsURL(r).replace(\"{fontstack}\",t).replace(\"{range}\",`${s}-${a}`),Zr.Glyphs);Jr(o,((t,e)=>{if(t)i(t);else if(e){const t={},r=function(t){return new wm(t).readFields(Am,{})}(e);for(const e of r.glyphs)t[e.id]=e;i(null,{glyphs:t,ascender:r.ascender,descender:r.descender});}}));},oy.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:r=8,cutoff:n=.25,fontFamily:i=\"sans-serif\",fontWeight:s=\"normal\",fontStyle:a=\"normal\"}={}){this.buffer=e,this.cutoff=n,this.radius=r;const o=this.size=t+4*e,l=this._createCanvas(o),u=this.ctx=l.getContext(\"2d\",{willReadFrequently:!0});u.font=`${a} ${s} ${t}px ${i}`,u.textBaseline=\"alphabetic\",u.textAlign=\"left\",u.fillStyle=\"black\",this.gridOuter=new Float64Array(o*o),this.gridInner=new Float64Array(o*o),this.f=new Float64Array(o),this.z=new Float64Array(o+1),this.v=new Uint16Array(o);}_createCanvas(t){const e=document.createElement(\"canvas\");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:r,actualBoundingBoxDescent:n,actualBoundingBoxLeft:i,actualBoundingBoxRight:s}=this.ctx.measureText(t),a=Math.ceil(r),o=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s-i))),l=Math.min(this.size-this.buffer,a+Math.ceil(n)),u=o+2*this.buffer,c=l+2*this.buffer,h=Math.max(u*c,0),p=new Uint8ClampedArray(h),f={data:p,width:u,height:c,glyphWidth:o,glyphHeight:l,glyphTop:a,glyphLeft:0,glyphAdvance:e};if(0===o||0===l)return f;const{ctx:d,buffer:m,gridInner:y,gridOuter:g}=this;d.clearRect(m,m,o,l),d.fillText(t,m,m+a);const x=d.getImageData(m,m,o,l);g.fill(ry,0,h),y.fill(0,0,h);for(let t=0;t<l;t++)for(let e=0;e<o;e++){const r=x.data[4*(t*o+e)+3]/255;if(0===r)continue;const n=(t+m)*u+e+m;if(1===r)g[n]=0,y[n]=ry;else {const t=.5-r;g[n]=t>0?t*t:0,y[n]=t<0?t*t:0;}}ny(g,0,0,u,c,u,this.f,this.v,this.z),ny(y,m,m,o,l,u,this.f,this.v,this.z);for(let t=0;t<h;t++){const e=Math.sqrt(g[t])-Math.sqrt(y[t]);p[t]=Math.round(255-255*(e/this.radius+this.cutoff));}return f}};const ly=Jm;function uy(t,e,r,n){const i=[],s=t.imagePrimary,a=s.pixelRatio,o=s.paddedRect.w-2*ly,l=s.paddedRect.h-2*ly,u=t.right-t.left,c=t.bottom-t.top,h=s.stretchX||[[0,o]],p=s.stretchY||[[0,l]],f=(t,e)=>t+e[1]-e[0],d=h.reduce(f,0),m=p.reduce(f,0),y=o-d,g=l-m;let x=0,b=d,v=0,_=m,w=0,M=y,A=0,S=g;if(s.content&&n){const t=s.content;x=cy(h,0,t[0]),v=cy(p,0,t[1]),b=cy(h,t[0],t[2]),_=cy(p,t[1],t[3]),w=t[0]-x,A=t[1]-v,M=t[2]-t[0]-b,S=t[3]-t[1]-_;}const I=(n,i,o,l)=>{const h=py(n.stretch-x,b,u,t.left),p=fy(n.fixed-w,M,n.stretch,d),f=py(i.stretch-v,_,c,t.top),y=fy(i.fixed-A,S,i.stretch,m),g=py(o.stretch-x,b,u,t.left),I=fy(o.fixed-w,M,o.stretch,d),k=py(l.stretch-v,_,c,t.top),P=fy(l.fixed-A,S,l.stretch,m),E=new Ue(h,f),z=new Ue(g,f),T=new Ue(g,k),B=new Ue(h,k),C=new Ue(p/a,y/a),R=new Ue(I/a,P/a),V=e*Math.PI/180;if(V){const t=Math.sin(V),e=Math.cos(V),r=[e,-t,t,e];E._matMult(r),z._matMult(r),B._matMult(r),T._matMult(r);}const D=n.stretch+n.fixed,L=o.stretch+o.fixed,F=i.stretch+i.fixed,O=l.stretch+l.fixed,U=t.imageSecondary;return {tl:E,tr:z,bl:B,br:T,texPrimary:{x:s.paddedRect.x+ly+D,y:s.paddedRect.y+ly+F,w:L-D,h:O-F},texSecondary:U?{x:U.paddedRect.x+ly+D,y:U.paddedRect.y+ly+F,w:L-D,h:O-F}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:C,pixelOffsetBR:R,minFontScaleX:M/a/u,minFontScaleY:S/a/c,isSDF:r}};if(n&&(s.stretchX||s.stretchY)){const t=hy(h,y,d),e=hy(p,g,m);for(let r=0;r<t.length-1;r++){const n=t[r],s=t[r+1];for(let t=0;t<e.length-1;t++)i.push(I(n,e[t],s,e[t+1]));}}else i.push(I({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:o+1},{fixed:0,stretch:l+1}));return i}function cy(t,e,r){let n=0;for(const i of t)n+=Math.max(e,Math.min(r,i[1]))-Math.max(e,Math.min(r,i[0]));return n}function hy(t,e,r){const n=[{fixed:-ly,stretch:0}];for(const[e,r]of t){const t=n[n.length-1];n.push({fixed:e-t.stretch,stretch:t.stretch}),n.push({fixed:e-t.stretch,stretch:t.stretch+(r-e)});}return n.push({fixed:e+ly,stretch:r}),n}function py(t,e,r,n){return t/e*r+n}function fy(t,e,r,n){return t-e*r/n}function dy(t,e,r,n){const i=e+t.positionedLines[n].lineOffset;return 0===n?r+i/2:r+(i+(e+t.positionedLines[n-1].lineOffset))/2}function my(t,e=1,r=!1){let n=1/0,i=1/0,s=-1/0,a=-1/0;const o=t[0];for(let t=0;t<o.length;t++){const e=o[t];(!t||e.x<n)&&(n=e.x),(!t||e.y<i)&&(i=e.y),(!t||e.x>s)&&(s=e.x),(!t||e.y>a)&&(a=e.y);}const l=Math.min(s-n,a-i);let u=l/2;const c=new ns([],yy);if(0===l)return new Ue(n,i);for(let e=n;e<s;e+=l)for(let r=i;r<a;r+=l)c.push(new gy(e+u,r+u,u,t));let h=function(t){let e=0,r=0,n=0;const i=t[0];for(let t=0,s=i.length,a=s-1;t<s;a=t++){const s=i[t],o=i[a],l=s.x*o.y-o.x*s.y;r+=(s.x+o.x)*l,n+=(s.y+o.y)*l,e+=3*l;}return new gy(r/e,n/e,0,t)}(t),p=c.length;for(;c.length;){const n=c.pop();(n.d>h.d||!h.d)&&(h=n,r&&console.log(\"found best %d after %d probes\",Math.round(1e4*n.d)/1e4,p)),n.max-h.d<=e||(u=n.h/2,c.push(new gy(n.p.x-u,n.p.y-u,u,t)),c.push(new gy(n.p.x+u,n.p.y-u,u,t)),c.push(new gy(n.p.x-u,n.p.y+u,u,t)),c.push(new gy(n.p.x+u,n.p.y+u,u,t)),p+=4);}return r&&(console.log(`num probes: ${p}`),console.log(`best distance: ${h.d}`)),h.p}function yy(t,e){return e.max-t.max}class gy{constructor(t,e,r,n){this.p=new Ue(t,e),this.h=r,this.d=function(t,e){let r=!1,n=1/0;for(let i=0;i<e.length;i++){const s=e[i];for(let e=0,i=s.length,a=i-1;e<i;a=e++){const i=s[e],o=s[a];i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(r=!r),n=Math.min(n,Zc(t,i,o));}}return (r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2;}}const xy=Number.POSITIVE_INFINITY,by=Math.sqrt(2);function vy(t,[e,r]){let n=0,i=0;if(r===xy){e<0&&(e=0);const r=e/by;switch(t){case\"top-right\":case\"top-left\":i=r-7;break;case\"bottom-right\":case\"bottom-left\":i=7-r;break;case\"bottom\":i=7-e;break;case\"top\":i=e-7;}switch(t){case\"top-right\":case\"bottom-right\":n=-r;break;case\"top-left\":case\"bottom-left\":n=r;break;case\"left\":n=e;break;case\"right\":n=-e;}}else {switch(e=Math.abs(e),r=Math.abs(r),t){case\"top-right\":case\"top-left\":case\"top\":i=r-7;break;case\"bottom-right\":case\"bottom-left\":case\"bottom\":i=7-r;}switch(t){case\"top-right\":case\"bottom-right\":case\"right\":n=-e;break;case\"top-left\":case\"bottom-left\":case\"left\":n=e;}}return [n,i]}function _y(t){switch(t){case\"right\":case\"top-right\":case\"bottom-right\":return \"right\";case\"left\":case\"top-left\":case\"bottom-left\":return \"left\"}return \"center\"}function wy(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d){let m=s.textMaxSize.evaluate(e,{},h);void 0===m&&(m=a);const y=t.layers[0].layout,g=y.get(\"icon-offset\").evaluate(e,{},h),x=Iy(r.horizontal)||r.vertical,b=\"globe\"===p.name,v=$d,_=a/v,w=t.tilePixelRatio*m/v,M=(T=t.overscaling,t.zoom>18&&T>2&&(T>>=1),Math.max(is/(512*T),1)*y.get(\"symbol-spacing\")),A=y.get(\"text-padding\")*t.tilePixelRatio,S=y.get(\"icon-padding\")*t.tilePixelRatio,I=qe(y.get(\"text-max-angle\")),k=\"map\"===y.get(\"text-rotation-alignment\")&&\"point\"!==y.get(\"symbol-placement\"),P=\"map\"===y.get(\"icon-rotation-alignment\")&&\"point\"!==y.get(\"symbol-placement\"),E=y.get(\"symbol-placement\"),z=M/2;var T;const B=y.get(\"icon-text-fit\").evaluate(e,{},h),C=y.get(\"icon-text-fit-padding\").evaluate(e,{},h),R=\"none\"!==B;let V;!1===t.hasAnyIconTextFit&&R&&(t.hasAnyIconTextFit=!0),n&&R&&(t.allowVerticalPlacement&&r.vertical&&(V=jm(n,r.vertical,B,C,g,_)),x&&(n=jm(n,x,B,C,g,_)));const D=(a,o,m)=>{if(o.x<0||o.x>=is||o.y<0||o.y>=is)return;let y=null;if(b){const{x:t,y:e,z:r}=p.projectTilePoint(o.x,o.y,m);y={anchor:new qm(t,e,r,0,void 0),up:p.upVector(m,o.x,o.y)};}!function(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,m,y,g,x,b,v,_,w,M,A,S,I){const k=t.addToLineVertexArray(e,n);let P,E,z,T,B,C,R,V=0,D=0,L=0,F=0,O=-1,U=-1;const N={};let j=Tn(\"\");const q=r?r.anchor:e,$=\"none\"!==l.layout.get(\"icon-text-fit\").evaluate(v,{},A);let G=0,Q=0;if(void 0===l._unevaluatedLayout.getValue(\"text-radial-offset\")?[G,Q]=l.layout.get(\"text-offset\").evaluate(v,{},A).map((t=>t*$d)):(G=l.layout.get(\"text-radial-offset\").evaluate(v,{},A)*$d,Q=xy),t.allowVerticalPlacement&&i.vertical){const t=i.vertical;if(d)C=Py(t),o&&(R=Py(o));else {const r=l.layout.get(\"text-rotate\").evaluate(v,{},A)+90;z=ky(u,q,e,c,h,p,t,f,r,m),o&&(T=ky(u,q,e,c,h,p,o,g,r));}}if(s){const n=l.layout.get(\"icon-rotate\").evaluate(v,{},A),i=uy(s,n,w,$),a=o?uy(o,n,w,$):void 0;E=ky(u,q,e,c,h,p,s,g,n),V=4*i.length;const f=t.iconSizeData;let d=null;\"source\"===f.kind?(d=[Gd*l.layout.get(\"icon-size\").evaluate(v,{},A)],d[0]>Ay&&hr(`${t.layerIds[0]}: Value for \"icon-size\" is >= ${My}. Reduce your \"icon-size\".`)):\"composite\"===f.kind&&(d=[Gd*_.compositeIconSizes[0].evaluate(v,{},A),Gd*_.compositeIconSizes[1].evaluate(v,{},A)],(d[0]>Ay||d[1]>Ay)&&hr(`${t.layerIds[0]}: Value for \"icon-size\" is >= ${My}. Reduce your \"icon-size\".`)),t.addSymbols(t.icon,i,d,b,x,v,!1,r,e,k.lineStartIndex,k.lineLength,-1,M,A,S,I),O=t.icon.placedSymbolArray.length-1,a&&(D=4*a.length,t.addSymbols(t.icon,a,d,b,x,v,Pm.vertical,r,e,k.lineStartIndex,k.lineLength,-1,M,A,S,I),U=t.icon.placedSymbolArray.length-1);}for(const n in i.horizontal){const s=i.horizontal[n];P||(j=Tn(s.text),d?B=Py(s):P=ky(u,q,e,c,h,p,s,f,l.layout.get(\"text-rotate\").evaluate(v,{},A),m));const o=1===s.positionedLines.length;if(L+=Sy(t,r,e,s,a,l,d,v,m,k,i.vertical?Pm.horizontal:Pm.horizontalOnly,o?Object.keys(i.horizontal):[n],N,O,_,M,A,S),o)break}i.vertical&&(F+=Sy(t,r,e,i.vertical,a,l,d,v,m,k,Pm.vertical,[\"vertical\"],N,U,_,M,A,S));let Y=-1;const X=(t,e)=>t?Math.max(t,e):e;Y=X(B,Y),Y=X(C,Y),Y=X(R,Y);const Z=Y>-1?1:0;t.glyphOffsetArray.length>=65535&&hr(\"Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907\"),void 0!==v.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,v.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,q.x,q.y,q.z,N.right>=0?N.right:-1,N.center>=0?N.center:-1,N.left>=0?N.left:-1,N.vertical>=0?N.vertical:-1,O,U,j,void 0!==P?P:t.collisionBoxArray.length,void 0!==P?P+1:t.collisionBoxArray.length,void 0!==z?z:t.collisionBoxArray.length,void 0!==z?z+1:t.collisionBoxArray.length,void 0!==E?E:t.collisionBoxArray.length,void 0!==E?E+1:t.collisionBoxArray.length,T||t.collisionBoxArray.length,T?T+1:t.collisionBoxArray.length,c,L,F,V,D,Z,0,G,Q,Y,0,$?1:0);}(t,o,y,a,r,n,i,V,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,A,k,l,0,S,P,g,e,s,u,c,h,f,d);};if(\"line\"===E)for(const i of Wm(e.geometry,0,0,is,is)){const e=Zm(i,M,I,r.vertical||x,n,v,w,t.overscaling,is);for(const r of e)x&&Ey(t,x.text,z,r)||D(i,r,h);}else if(\"line-center\"===E){for(const t of e.geometry)if(t.length>1){const e=Xm(t,I,r.vertical||x,n,v,w);e&&D(t,e,h);}}else if(\"Polygon\"===e.type)for(const t of Up(e.geometry,0)){const e=my(t,16);D(t[0],new qm(e.x,e.y,0,0,void 0),h);}else if(\"LineString\"===e.type)for(const t of e.geometry)D(t,new qm(t[0].x,t[0].y,0,0,void 0),h);else if(\"Point\"===e.type)for(const t of e.geometry)for(const e of t)D([e],new qm(e.x,e.y,0,0,void 0),h);}const My=255,Ay=My*Gd;function Sy(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,m,y,g){const x=function(t,e,r,n,i,s,a,o){const l=[];if(0===e.positionedLines.length)return l;const u=n.layout.get(\"text-rotate\").evaluate(s,{})*Math.PI/180,c=function(t){const e=t[0],r=t[1],n=e*r;return n>0?[e,-r]:n<0?[-e,r]:0===e?[r,e]:[r,-e]}(r);let h=Math.abs(e.top-e.bottom);for(const t of e.positionedLines)h-=t.lineOffset;const p=e.positionedLines.length,f=h/p;let d=e.top-r[1];for(let t=0;t<p;++t){const n=e.positionedLines[t];d=dy(e,f,d,t);for(const t of n.positionedGlyphs){if(!t.rect)continue;const n=t.rect||{};let s=km+1,h=!0,p=1,f=0;if(t.imageName){const e=a[t.imageName];if(!e)continue;if(e.sdf){hr(\"SDF images are not supported in formatted text and will be ignored.\");continue}h=!1,p=e.pixelRatio,s=Jm/p;}const m=(i||o)&&t.vertical,y=t.metrics.advance*t.scale/2,g=t.metrics,x=t.rect;if(null===x)continue;o&&e.verticalizable&&(f=t.imageName?y-t.metrics.width*t.scale/2:0);const b=i?[t.x+y,t.y]:[0,0];let v=[0,0],_=[0,0],w=!1;i||(m?(_=[t.x+y+c[0],t.y+c[1]-f],w=!0):v=[t.x+y+r[0],t.y+r[1]-f]);const M=x.w*t.scale/(p*(t.localGlyph?sy:1)),A=x.h*t.scale/(p*(t.localGlyph?sy:1));let S,I,k,P;if(m){const e=t.y-d,r=new Ue(-y,y-e),n=-Math.PI/2,i=new Ue(..._);S=new Ue(-y+v[0],v[1]),S._rotateAround(n,r)._add(i),S.x+=-e+y,S.y-=(g.left-s)*t.scale;const a=t.imageName?g.advance*t.scale:$d*t.scale,o=String.fromCodePoint(t.glyph);Hd(o)?S.x+=(1-s)*t.scale:Jd(o)?S.x+=a-g.height*t.scale+(-s-1)*t.scale:S.x+=t.imageName||g.width+2*s===x.w&&g.height+2*s===x.h?(a-A)/2:(a-(g.height+2*s)*t.scale)/2,I=new Ue(S.x,S.y-M),k=new Ue(S.x+A,S.y),P=new Ue(S.x+A,S.y-M);}else {const e=(g.left-s)*t.scale-y+v[0],r=(-g.top-s)*t.scale+v[1],n=e+M,i=r+A;S=new Ue(e,r),I=new Ue(n,r),k=new Ue(e,i),P=new Ue(n,i);}if(u){let t;t=i?new Ue(0,0):w?new Ue(c[0],c[1]):new Ue(r[0],r[1]),S._rotateAround(u,t),I._rotateAround(u,t),k._rotateAround(u,t),P._rotateAround(u,t);}const E=new Ue(0,0),z=new Ue(0,0);l.push({tl:S,tr:I,bl:k,br:P,texPrimary:n,texSecondary:void 0,writingMode:e.writingMode,glyphOffset:b,sectionIndex:t.sectionIndex,isSDF:h,pixelOffsetTL:E,pixelOffsetBR:z,minFontScaleX:0,minFontScaleY:0});}}return l}(0,n,l,s,a,o,i,t.allowVerticalPlacement),b=t.textSizeData;let v=null;\"source\"===b.kind?(v=[Gd*s.layout.get(\"text-size\").evaluate(o,{},y)],v[0]>Ay&&hr(`${t.layerIds[0]}: Value for \"text-size\" is >= ${My}. Reduce your \"text-size\".`)):\"composite\"===b.kind&&(v=[Gd*d.compositeTextSizes[0].evaluate(o,{},y),Gd*d.compositeTextSizes[1].evaluate(o,{},y)],(v[0]>Ay||v[1]>Ay)&&hr(`${t.layerIds[0]}: Value for \"text-size\" is >= ${My}. Reduce your \"text-size\".`)),t.addSymbols(t.text,x,v,l,a,o,c,e,r,u.lineStartIndex,u.lineLength,f,m,y,g,!1);for(const e of h)p[e]=t.text.placedSymbolArray.length-1;return 4*x.length}function Iy(t){for(const e in t)return t[e];return null}function ky(t,e,r,n,i,s,a,o,l,u){let c=a.top,h=a.bottom,p=a.left,f=a.right;const d=a.collisionPadding;if(d&&(p-=d[0],c-=d[1],f+=d[2],h+=d[3]),l){const t=new Ue(p,c),e=new Ue(f,c),r=new Ue(p,h),n=new Ue(f,h),i=qe(l);let s=new Ue(0,0);u&&(s=new Ue(u[0],u[1])),t._rotateAround(i,s),e._rotateAround(i,s),r._rotateAround(i,s),n._rotateAround(i,s),p=Math.min(t.x,e.x,r.x,n.x),f=Math.max(t.x,e.x,r.x,n.x),c=Math.min(t.y,e.y,r.y,n.y),h=Math.max(t.y,e.y,r.y,n.y);}return t.emplaceBack(e.x,e.y,e.z,r.x,r.y,p,c,f,h,o,n,i,s),t.length-1}function Py(t){t.collisionPadding&&(t.top-=t.collisionPadding[1],t.bottom+=t.collisionPadding[3]);const e=t.bottom-t.top;return e>0?Math.max(10,e):null}function Ey(t,e,r,n){const i=t.compareText;if(e in i){const t=i[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])<r)return !0}else i[e]=[];return i[e].push(n),!1}function zy(t,e){const r=t.fovAboveCenter,n=t.elevation?t.elevation.getMinElevationBelowMSL()*e:0,i=(t._camera.position[2]*t.worldSize-n)/Math.cos(t._pitch),s=Math.sin(r)*i/Math.sin(Math.max(Math.PI/2-t._pitch-r,.01)),a=Math.sin(t._pitch)*s+i;return Math.min(1.01*a,i*(1/t._horizonShift))}function Ty(t,e){if(!e.isReprojectedInTileSpace)return {scale:1<<t.z,x:t.x,y:t.y,x2:t.x+1,y2:t.y+1,projection:e};const r=Math.pow(2,-t.z),n=t.x*r,i=(t.x+1)*r,s=t.y*r,a=(t.y+1)*r,o=_c(n),l=_c(i),u=wc(s),c=wc(a),h=e.project(o,u),p=e.project(l,u),f=e.project(l,c),d=e.project(o,c);let m=Math.min(h.x,p.x,f.x,d.x),y=Math.min(h.y,p.y,f.y,d.y),g=Math.max(h.x,p.x,f.x,d.x),x=Math.max(h.y,p.y,f.y,d.y);const b=r/16;function v(t,r,n,i,s,a){const o=(n+s)/2,l=(i+a)/2,u=e.project(_c(o),wc(l)),c=Math.max(0,m-u.x,y-u.y,u.x-g,u.y-x);m=Math.min(m,u.x),g=Math.max(g,u.x),y=Math.min(y,u.y),x=Math.max(x,u.y),c>b&&(v(t,u,n,i,o,l),v(u,r,o,l,s,a));}v(h,p,n,s,i,s),v(p,f,i,s,i,a),v(f,d,i,a,n,a),v(d,h,n,a,n,s),m-=b,y-=b,g+=b,x+=b;const _=1/Math.max(g-m,x-y);return {scale:_,x:m*_,y:y*_,x2:g*_,y2:x*_,projection:e}}function By(t,{x:e,y:r},n=0){return new Ue(((e-n)*t.scale-t.x)*is,(r*t.scale-t.y)*is)}const Cy=t.a9.identity(new Float32Array(16));class Ry{constructor(t){this.spec=t,this.name=t.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit=\"meters\",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=[\"custom\"],this.center=[0,0],this.range=[3.5,7];}project(t,e){return {x:0,y:0,z:0}}unproject(t,e){return new ac(0,0)}projectTilePoint(t,e,r){return {x:t,y:e,z:0}}locationPoint(t,e,r=!0){return t._coordinatePoint(t.locationCoordinate(e),r)}pixelsPerMeter(t,e){return vc(1,t)*e}pixelSpaceConversion(t,e,r){return 1}farthestPixelDistance(t){return zy(t,t.pixelsPerMeter)}pointCoordinate(t,e,r,n){const i=t.horizonLineFromTop(!1),s=new Ue(e,Math.max(i,r));return t.rayIntersectionCoordinate(t.pointRayIntersection(s,n))}pointCoordinate3D(t,e,r){const n=new Ue(e,r);if(t.elevation)return t.elevation.pointCoordinate(n);{const e=this.pointCoordinate(t,n.x,n.y,0);return [e.x,e.y,e.z]}}isPointAboveHorizon(t,e){if(t.elevation)return !this.pointCoordinate3D(t,e.x,e.y);const r=t.horizonLineFromTop();return e.y<r}createInversionMatrix(t,e){return Cy}createTileMatrix(e,r,n){let i,s,a;const o=n.canonical,l=t.a9.identity(new Float64Array(16));if(this.isReprojectedInTileSpace){const u=Ty(o,this);i=1,s=u.x+n.wrap*u.scale,a=u.y,t.a9.scale(l,l,[i/u.scale,i/u.scale,e.pixelsPerMeter/r]);}else i=r/e.zoomScale(o.z),s=(o.x+Math.pow(2,o.z)*n.wrap)*i,a=o.y*i;return t.a9.translate(l,l,[s,a,0]),t.a9.scale(l,l,[i/is,i/is,1]),l}upVector(t,e,r){return [0,0,1]}upVectorScale(t,e,r){return {metersToTile:1}}}class Vy extends Ry{constructor(t){super(t),this.range=[4,7],this.center=t.center||[-96,37.5];const[e,r]=this.parallels=t.parallels||[29.5,45.5],n=Math.sin(qe(e));this.n=(n+Math.sin(qe(r)))/2,this.c=1+n*(2*this.n-n),this.r0=Math.sqrt(this.c)/this.n;}project(t,e){const{n:r,c:n,r0:i}=this,s=qe(t-this.center[0]),a=qe(e),o=Math.sqrt(n-2*r*Math.sin(a))/r;return {x:o*Math.sin(s*r),y:o*Math.cos(s*r)-i,z:0}}unproject(t,e){const{n:r,c:n,r0:i}=this,s=i+e;let a=Math.atan2(t,Math.abs(s))*Math.sign(s);s*r<0&&(a-=Math.PI*Math.sign(t)*Math.sign(s));const o=qe(this.center[0])*r;a=We(a,-Math.PI-o,Math.PI-o);const l=Ze($e(a/r)+this.center[0],-180,180),u=Math.asin(Ze((n-(t*t+s*s)*r*r)/(2*r),-1,1)),c=Ze($e(u),-Ac,Ac);return new ac(l,c)}}const Dy=1.340264,Ly=-.081106,Fy=893e-6,Oy=.003796,Uy=Math.sqrt(3)/2;class Ny extends Ry{project(t,e){e=e/180*Math.PI,t=t/180*Math.PI;const r=Math.asin(Uy*Math.sin(e)),n=r*r,i=n*n*n;return {x:.5*(t*Math.cos(r)/(Uy*(Dy+3*Ly*n+i*(7*Fy+9*Oy*n)))/Math.PI+.5),y:1-.5*(r*(Dy+Ly*n+i*(Fy+Oy*n))/Math.PI+1),z:0}}unproject(t,e){t=(2*t-.5)*Math.PI;let r=e=(2*(1-e)-1)*Math.PI,n=r*r,i=n*n*n;for(let t,s,a,o=0;o<12&&(s=r*(Dy+Ly*n+i*(Fy+Oy*n))-e,a=Dy+3*Ly*n+i*(7*Fy+9*Oy*n),t=s/a,r=Ze(r-t,-Math.PI/3,Math.PI/3),n=r*r,i=n*n*n,!(Math.abs(t)<1e-12));++o);const s=Uy*t*(Dy+3*Ly*n+i*(7*Fy+9*Oy*n))/Math.cos(r),a=Math.asin(Math.sin(r)/Uy),o=Ze(180*s/Math.PI,-180,180),l=Ze(180*a/Math.PI,-Ac,Ac);return new ac(o,l)}}class jy extends Ry{constructor(t){super(t),this.wrap=!0,this.supportsWorldCopies=!0;}project(t,e){return {x:.5+t/360,y:.5-e/360,z:0}}unproject(t,e){const r=360*(t-.5),n=Ze(360*(.5-e),-Ac,Ac);return new ac(r,n)}}const qy=Math.PI/2;function $y(t){return Math.tan((qy+t)/2)}class Gy extends Ry{constructor(t){super(t),this.center=t.center||[0,30];const[e,r]=this.parallels=t.parallels||[30,30];let n=qe(e),i=qe(r);this.southernCenter=n+i<0,this.southernCenter&&(n=-n,i=-i);const s=Math.cos(n),a=$y(n);this.n=n===i?Math.sin(n):Math.log(s/Math.cos(i))/Math.log($y(i)/a),this.f=s*Math.pow($y(n),this.n)/this.n;}project(t,e){e=qe(e),this.southernCenter&&(e=-e),t=qe(t-this.center[0]);const r=1e-6,{n:n,f:i}=this;i>0?e<-qy+r&&(e=-qy+r):e>qy-r&&(e=qy-r);const s=i/Math.pow($y(e),n);let a=s*Math.sin(n*t),o=i-s*Math.cos(n*t);return a=.5*(a/Math.PI+.5),o=.5*(o/Math.PI+.5),{x:a,y:this.southernCenter?o:1-o,z:0}}unproject(t,e){t=(2*t-.5)*Math.PI,this.southernCenter&&(e=1-e),e=(2*(1-e)-.5)*Math.PI;const{n:r,f:n}=this,i=n-e,s=Math.sign(i),a=Math.sign(r)*Math.sqrt(t*t+i*i);let o=Math.atan2(t,Math.abs(i))*s;i*r<0&&(o-=Math.PI*Math.sign(t)*s);const l=Ze($e(o/r)+this.center[0],-180,180),u=Ze($e(2*Math.atan(Math.pow(n/a,1/r))-qy),-Ac,Ac);return new ac(l,this.southernCenter?-u:u)}}class Qy extends Ry{constructor(t){super(t),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null;}project(t,e){return {x:xc(t),y:bc(e),z:0}}unproject(t,e){const r=_c(t),n=wc(e);return new ac(r,n)}}const Yy=qe(Ac);class Xy extends Ry{project(t,e){const r=(e=qe(e))*e,n=r*r;return {x:.5*((t=qe(t))*(.8707-.131979*r+n*(n*(.003971*r-.001529*n)-.013791))/Math.PI+.5),y:1-.5*(e*(1.007226+r*(.015085+n*(.028874*r-.044475-.005916*n)))/Math.PI+1),z:0}}unproject(t,e){t=(2*t-.5)*Math.PI;let r=e=(2*(1-e)-1)*Math.PI,n=25,i=0,s=r*r;do{s=r*r;const t=s*s;i=(r*(1.007226+s*(.015085+t*(.028874*s-.044475-.005916*t)))-e)/(1.007226+s*(.045255+t*(.259866*s-.311325-.005916*11*t))),r=Ze(r-i,-Yy,Yy);}while(Math.abs(i)>1e-6&&--n>0);s=r*r;const a=Ze($e(t/(.8707+s*(s*(s*s*s*(.003971-.001529*s)-.013791)-.131979))),-180,180),o=$e(r);return new ac(a,o)}}const Zy=qe(Ac);class Ky extends Ry{project(t,e){e=qe(e),t=qe(t);const r=Math.cos(e),n=2/Math.PI,i=Math.acos(r*Math.cos(t/2)),s=Math.sin(i)/i,a=.5*(t*n+2*r*Math.sin(t/2)/s)||0,o=.5*(e+Math.sin(e)/s)||0;return {x:.5*(a/Math.PI+.5),y:1-.5*(o/Math.PI+1),z:0}}unproject(t,e){let r=t=(2*t-.5)*Math.PI,n=e=(2*(1-e)-1)*Math.PI,i=25;const s=1e-6;let a=0,o=0;do{const i=Math.cos(n),s=Math.sin(n),l=2*s*i,u=s*s,c=i*i,h=Math.cos(r/2),p=Math.sin(r/2),f=2*h*p,d=p*p,m=1-c*h*h,y=m?1/m:0,g=m?Math.acos(i*h)*Math.sqrt(1/m):0,x=.5*(2*g*i*p+2*r/Math.PI)-t,b=.5*(g*s+n)-e,v=.5*y*(c*d+g*i*h*u)+1/Math.PI,_=y*(f*l/4-g*s*p),w=.125*y*(l*p-g*s*c*f),M=.5*y*(u*h+g*d*i)+.5,A=_*w-M*v;a=(b*_-x*M)/A,o=(x*w-b*v)/A,r=Ze(r-a,-Math.PI,Math.PI),n=Ze(n-o,-Zy,Zy);}while((Math.abs(a)>s||Math.abs(o)>s)&&--i>0);return new ac($e(r),$e(n))}}class Wy extends Ry{constructor(t){super(t),this.center=t.center||[0,0],this.parallels=t.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(qe(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0;}project(t,e){const{scale:r,cosPhi:n}=this;return {x:qe(t)*n*r+.5,y:-Math.sin(qe(e))/n*r+.5,z:0}}unproject(t,e){const{scale:r,cosPhi:n}=this,i=-(e-.5)/r,s=Ze($e((t-.5)/r)/n,-180,180),a=Math.asin(Ze(i*n,-1,1)),o=Ze($e(a),-Ac,Ac);return new ac(s,o)}}class Hy extends Qy{constructor(t){super(t),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit=\"pixels\",this.unsupportedLayers=[\"debug\"],this.range=[3,5];}projectTilePoint(e,r,n){const i=Th(e,r,n),s=Rh(Sh(n));return t.Q.transformMat4(i,i,s),{x:i[0],y:i[1],z:i[2]}}locationPoint(e,r){const n=nc(r.lat,r.lng),i=t.Q.normalize([],n),s=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(r),e._centerAltitude):e._centerAltitude,a=vc(1,0)*is*s;t.Q.scaleAndAdd(n,n,i,a);const o=t.a9.identity(new Float64Array(16));return t.a9.multiply(o,e.pixelMatrix,e.globeMatrix),t.Q.transformMat4(n,n,o),new Ue(n[0],n[1])}pixelsPerMeter(t,e){return vc(1,0)*e}pixelSpaceConversion(t,e,r){const n=vc(1,t)*e,i=qn(vc(1,45)*e,n,r);return this.pixelsPerMeter(t,e)/i}createTileMatrix(e,r,n){const i=Vh(Sh(n.canonical));return t.a9.multiply(new Float64Array(16),e.globeMatrix,i)}createInversionMatrix(e,r){const{center:n}=e,i=Rh(Sh(r));return t.a9.rotateY(i,i,qe(n.lng)),t.a9.rotateX(i,i,qe(n.lat)),t.a9.scale(i,i,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(i)}pointCoordinate(t,e,r,n){return wh(t,e,r,!0)||new Ec(0,0)}pointCoordinate3D(t,e,r){const n=this.pointCoordinate(t,e,r,0);return [n.x,n.y,n.z]}isPointAboveHorizon(t,e){return !wh(t,e.x,e.y,!1)}farthestPixelDistance(e){const r=function(e,r){const n=e.cameraToCenterDistance,i=e._centerAltitude*r,s=e._camera,a=e._camera.forward(),o=t.Q.add([],t.Q.scale([],a,-n),[0,0,i]),l=e.worldSize/(2*Math.PI),u=[0,0,-l],c=e.width/e.height,h=Math.tan(e.fovAboveCenter),p=t.Q.scale([],s.up(),h),f=t.Q.scale([],s.right(),h*c),d=t.Q.normalize([],t.Q.add([],t.Q.add([],a,p),f)),m=[];let y;if(new lh(o,d).closestPointOnSphere(u,l,m)){const r=t.Q.add([],m,u),n=t.Q.sub([],r,o);y=Math.cos(e.fovAboveCenter)*t.Q.length(n);}else {const e=t.Q.sub([],o,u),r=t.Q.sub([],u,o);t.Q.normalize(r,r);const n=t.Q.length(e)-l;y=Math.sqrt(n*(n+2*l));const i=Math.acos(y/(l+n))-Math.acos(t.Q.dot(a,r));y*=Math.cos(i);}return 1.01*y}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),n=Oh(e.zoom);if(n>0){const t=zy(e,vc(1,e.center.lat)*e.worldSize),i=e.worldSize/(2*Math.PI),s=Math.max(e.width,e.height)/e.worldSize*Math.PI;return qn(r,t+i*(1-Math.cos(s)),Math.pow(n,10))}return r}upVector(t,e,r){return Th(e,r,t,1)}upVectorScale(t){return {metersToTile:vh(Bh(Sh(t)))}}}function Jy(t){const e=t.parallels,r=!!e&&Math.abs(e[0]+e[1])<.01;switch(t.name){case\"mercator\":return new Qy(t);case\"equirectangular\":return new jy(t);case\"naturalEarth\":return new Xy(t);case\"equalEarth\":return new Ny(t);case\"winkelTripel\":return new Ky(t);case\"albers\":return r?new Wy(t):new Vy(t);case\"lambertConformalConic\":return r?new Wy(t):new Gy(t);case\"globe\":return new Hy(t)}throw new Error(`Invalid projection name: ${t.name}`)}const tg=ff.types,eg=[{name:\"a_fade_opacity\",components:1,type:\"Uint8\",offset:0}];function rg(t,e,r,n,i,s,a,o,l,u,c,h,p){const f=o?Math.min(Ay,Math.round(o[0])):0,d=o?Math.min(Ay,Math.round(o[1])):0;t.emplaceBack(e,r,Math.round(32*n),Math.round(32*i),s,a,(f<<1)+(l?1:0),d,16*u,16*c,256*h,256*p);}function ng(t,e,r){t.emplaceBack(e,r);}function ig(t,e,r,n,i,s,a){t.emplaceBack(e,r,n,i,s,a);}function sg(t,e,r,n,i){t.emplaceBack(e,r,n,i),t.emplaceBack(e,r,n,i),t.emplaceBack(e,r,n,i),t.emplaceBack(e,r,n,i);}function ag(t){for(const e of t.sections)if(ko(e.text))return !0;return !1}class og{constructor(t){this.layoutVertexArray=new Vl,this.indexArray=new ql,this.programConfigurations=t,this.segments=new mu,this.dynamicLayoutVertexArray=new zl,this.opacityVertexArray=new Ll,this.placedSymbolArray=new su,this.iconTransitioningVertexArray=new Fl,this.globeExtVertexArray=new Dl,this.zOffsetVertexArray=new Ql;}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length&&0===this.iconTransitioningVertexArray.length}upload(t,e,r,n,i){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Vd.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Ld.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,eg,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=t.createVertexBuffer(this.iconTransitioningVertexArray,Od.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=t.createVertexBuffer(this.globeExtVertexArray,Dd.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||i)&&(this.zOffsetVertexBuffer=t.createVertexBuffer(this.zOffsetVertexArray,Fd.members,!0)),this.opacityVertexBuffer.itemSize=1),(r||n)&&this.programConfigurations.upload(t));}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy());}}fo(og,\"SymbolBuffers\");class lg{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new mu,this.collisionVertexArray=new jl,this.collisionVertexArrayExt=new zl;}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Ud.members,!0),this.collisionVertexBufferExt=t.createVertexBuffer(this.collisionVertexArrayExt,Nd.members,!0);}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy());}}fo(lg,\"CollisionBuffers\");class ug{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((t=>t.fqid)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=t.a9.identity([]),this.placementViewportMatrix=t.a9.identity([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Qd(this.zoom,r[\"text-size\"]),this.iconSizeData=Qd(this.zoom,r[\"icon-size\"]);const n=this.layers[0].layout,i=n.get(\"symbol-sort-key\"),s=n.get(\"symbol-z-order\");this.canOverlap=n.get(\"text-allow-overlap\")||n.get(\"icon-allow-overlap\")||n.get(\"text-ignore-placement\")||n.get(\"icon-ignore-placement\"),this.sortFeaturesByKey=\"viewport-y\"!==s&&void 0!==i.constantOr(1),this.sortFeaturesByY=(\"viewport-y\"===s||\"auto\"===s&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get(\"text-writing-mode\").map((t=>Pm[t])),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=n.get(\"symbol-z-elevate\");}createArrays(){this.text=new og(new ju(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new og(new ju(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new lu,this.lineVertexArray=new uu,this.symbolInstances=new ou;}calculateGlyphDependencies(t,e,r,n,i){for(let r=0;r<t.length;r++){const s=t.codePointAt(r);if(void 0===s)break;if(e[s]=!0,n&&i&&s<=65535){const n=Wd[t.charAt(r)];n&&(e[n.charCodeAt(0)]=!0);}}}populate(e,r,n,i){const s=this.layers[0],a=s.layout,o=\"globe\"===this.projection.name,l=a.get(\"text-font\"),u=a.get(\"text-field\"),c=a.get(\"icon-image\"),h=(\"constant\"!==u.value.kind||u.value.value instanceof fi&&!u.value.value.isEmpty()||u.value.value.toString().length>0)&&(\"constant\"!==l.value.kind||l.value.value.length>0),p=\"constant\"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,f=a.get(\"symbol-sort-key\");if(this.features=[],!h&&!p)return;const d=r.iconDependencies,m=r.glyphDependencies,y=r.availableImages,g=new Uo(this.zoom);for(const{feature:r,id:u,index:c,sourceLayerIndex:x}of e){const e=s._featureFilter.needGeometry,b=Fc(r,e);if(!s._featureFilter.filter(g,b,n))continue;if(e||(b.geometry=Lc(r,n,i)),o&&1!==r.type&&n.z<=5){const e=b.geometry,r=.98078528056,i=(e,i)=>{const s=Th(e.x,e.y,n,1),a=Th(i.x,i.y,n,1);return t.Q.dot(s,a)<r};for(let t=0;t<e.length;t++)e[t]=Cc(e[t],i);}let v,_;if(h){const t=s.getValueAndResolveTokens(\"text-field\",b,n,y),e=fi.factory(t);ag(e)&&(this.hasRTLText=!0),(!this.hasRTLText||\"unavailable\"===Lo()||this.hasRTLText&&Oo.isParsed())&&(v=Kd(e,s,b));}if(p){const t=s.getValueAndResolveTokens(\"icon-image\",b,n,y);_=t instanceof di?t:di.fromString(t);}if(!v&&!_)continue;const w=this.sortFeaturesByKey?f.evaluate(b,{},n):void 0;if(this.features.push({id:u,text:v,icon:_,index:c,sourceLayerIndex:x,geometry:b.geometry,properties:r.properties,type:tg[r.type],sortKey:w}),_&&(d[_.namePrimary]=!0,_.nameSecondary&&(d[_.nameSecondary]=!0)),v){const t=l.evaluate(b,{},n).join(\",\"),e=\"map\"===a.get(\"text-rotation-alignment\")&&\"point\"!==a.get(\"symbol-placement\");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Pm.vertical)>=0;for(const r of v.sections)if(r.image)d[r.image.namePrimary]=!0;else {const n=vo(v.toString()),i=r.fontStack||t,s=m[i]=m[i]||{};this.calculateGlyphDependencies(r.text,s,e,this.allowVerticalPlacement,n);}}}\"line\"===a.get(\"symbol-placement\")&&(this.features=function(t){const e={},r={},n=[];let i=0;function s(e){n.push(t[e]),i++;}function a(t,e,i){const s=r[t];return delete r[t],r[e]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(i[0]),s}function o(t,r,i){const s=e[r];return delete e[r],e[t]=s,n[s].geometry[0].shift(),n[s].geometry[0]=i[0].concat(n[s].geometry[0]),s}function l(t,e,r){const n=r?e[0][e[0].length-1]:e[0][0];return `${t}:${n.x}:${n.y}`}for(let u=0;u<t.length;u++){const c=t[u],h=c.geometry,p=c.text?c.text.toString():null;if(!p){s(u);continue}const f=l(p,h),d=l(p,h,!0);if(f in r&&d in e&&r[f]!==e[d]){const t=o(f,d,h),i=a(f,d,n[t].geometry);delete e[f],delete r[d],r[l(p,n[i].geometry,!0)]=i,n[t].geometry=null;}else f in r?a(f,d,h):d in e?o(f,d,h):(s(u),e[f]=i-1,r[d]=i-1);}return n.filter((t=>t.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey));}update(t,e,r,n,i){const s=0!==Object.keys(t).length;if(s&&!this.stateDependentLayers.length)return;const a=s?this.stateDependentLayers:this.layers;this.text.programConfigurations.updatePaintArrays(t,e,a,r,n,i),this.icon.programConfigurations.updatePaintArrays(t,e,a,r,n,i);}updateZOffset(){const t=(t,e,n)=>{r+=e,r>t.length&&t.resize(r);for(let i=-e;i<0;i++)t.emplace(i+r,n);},e=(t,e,r)=>{n+=e,n>t.length&&t.resize(n);for(let i=-e;i<0;i++)t.emplace(i+n,r);};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let r=0,n=0;for(let r=0;r<this.symbolInstances.length;r++){const n=this.symbolInstances.get(r),{numHorizontalGlyphVertices:i,numVerticalGlyphVertices:s,numIconVertices:a}=n,o=n.zOffset,l=a>0;if((i>0||s>0)&&(t(this.text.zOffsetVertexArray,i,o),t(this.text.zOffsetVertexArray,s,o)),l){const{placedIconSymbolIndex:t,verticalPlacedIconSymbolIndex:r}=n;t>=0&&e(this.icon.zOffsetVertexArray,a,o),r>=0&&e(this.icon.zOffsetVertexArray,n.numVerticalIconVertices,o);}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray);}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return !this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0;}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy();}getProjection(){return this.projectionInstance||(this.projectionInstance=Jy(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData();}addToLineVertexArray(t,e){const r=this.lineVertexArray.length;if(void 0!==t.segment)for(const{x:t,y:r}of e)this.lineVertexArray.emplaceBack(t,r);return {lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,m){const y=t.indexArray,g=t.layoutVertexArray,x=t.globeExtVertexArray,b=t.segments.prepareSegment(4*e.length,g,y,this.canOverlap?s.sortKey:void 0),v=this.glyphOffsetArray.length,_=b.vertexLength,w=this.allowVerticalPlacement&&a===Pm.vertical?Math.PI/2:0,M=s.text&&s.text.sections;for(let n=0;n<e.length;n++){const{tl:i,tr:a,bl:u,br:c,texPrimary:h,texSecondary:v,pixelOffsetTL:_,pixelOffsetBR:A,minFontScaleX:S,minFontScaleY:I,glyphOffset:k,isSDF:P,sectionIndex:E}=e[n],z=b.vertexLength,T=k[1];if(rg(g,l.x,l.y,i.x,T+i.y,h.x,h.y,r,P,_.x,_.y,S,I),rg(g,l.x,l.y,a.x,T+a.y,h.x+h.w,h.y,r,P,A.x,_.y,S,I),rg(g,l.x,l.y,u.x,T+u.y,h.x,h.y+h.h,r,P,_.x,A.y,S,I),rg(g,l.x,l.y,c.x,T+c.y,h.x+h.w,h.y+h.h,r,P,A.x,A.y,S,I),o){const{x:e,y:r,z:n}=o.anchor,[i,s,a]=o.up;ig(x,e,r,n,i,s,a),ig(x,e,r,n,i,s,a),ig(x,e,r,n,i,s,a),ig(x,e,r,n,i,s,a),sg(t.dynamicLayoutVertexArray,e,r,n,w);}else sg(t.dynamicLayoutVertexArray,l.x,l.y,l.z,w);if(m){const e=v||h;ng(t.iconTransitioningVertexArray,e.x,e.y),ng(t.iconTransitioningVertexArray,e.x+e.w,e.y),ng(t.iconTransitioningVertexArray,e.x,e.y+e.h),ng(t.iconTransitioningVertexArray,e.x+e.w,e.y+e.h);}y.emplaceBack(z,z+1,z+2),y.emplaceBack(z+1,z+2,z+3),b.vertexLength+=4,b.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(k[0]),n!==e.length-1&&E===e[n+1].sectionIndex||t.programConfigurations.populatePaintArrays(g.length,s,s.index,{},p,f,d,M&&M[E]);}const A=o?o.anchor:l;t.placedSymbolArray.emplaceBack(A.x,A.y,A.z,l.x,l.y,v,this.glyphOffsetArray.length-v,_,u,c,l.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],a,0,!1,0,h,0);}_commitLayoutVertex(t,e,r,n,i,s,a){t.emplaceBack(e,r,n,i,s,Math.round(a.x),Math.round(a.y));}_addCollisionDebugVertices(t,e,r,n,i,s,a){const o=r.segments.prepareSegment(4,r.layoutVertexArray,r.indexArray),l=o.vertexLength,u=a.tileAnchorX,c=a.tileAnchorY;for(let t=0;t<4;t++)r.collisionVertexArray.emplaceBack(0,0,0,0);this._commitDebugCollisionVertexUpdate(r.collisionVertexArrayExt,e,t.padding,a.zOffset),this._commitLayoutVertex(r.layoutVertexArray,n,i,s,u,c,new Ue(t.x1,t.y1)),this._commitLayoutVertex(r.layoutVertexArray,n,i,s,u,c,new Ue(t.x2,t.y1)),this._commitLayoutVertex(r.layoutVertexArray,n,i,s,u,c,new Ue(t.x2,t.y2)),this._commitLayoutVertex(r.layoutVertexArray,n,i,s,u,c,new Ue(t.x1,t.y2)),o.vertexLength+=4;const h=r.indexArray;h.emplaceBack(l,l+1),h.emplaceBack(l+1,l+2),h.emplaceBack(l+2,l+3),h.emplaceBack(l+3,l),o.primitiveLength+=4;}_addTextDebugCollisionBoxes(t,e,r,n,i,s){for(let a=n;a<i;a++){const n=r.get(a),i=this.getSymbolInstanceTextSize(t,s,e,a);this._addCollisionDebugVertices(n,i,this.textCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s);}}_addIconDebugCollisionBoxes(t,e,r,n,i,s){for(let a=n;a<i;a++){const n=r.get(a),i=this.getSymbolInstanceIconSize(t,e,s.placedIconSymbolIndex);this._addCollisionDebugVertices(n,i,this.iconCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s);}}generateCollisionDebugBuffers(t,e){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new lg(Ul,jd.members,Fl),this.iconCollisionBox=new lg(Ul,jd.members,Fl);const r=Xd(this.iconSizeData,t),n=Xd(this.textSizeData,t);for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);this._addTextDebugCollisionBoxes(n,t,e,s.textBoxStartIndex,s.textBoxEndIndex,s),this._addTextDebugCollisionBoxes(n,t,e,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s),this._addIconDebugCollisionBoxes(r,t,e,s.iconBoxStartIndex,s.iconBoxEndIndex,s),this._addIconDebugCollisionBoxes(r,t,e,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex,s);}}getSymbolInstanceTextSize(t,e,r,n){const i=this.text.placedSymbolArray.get(e.rightJustifiedTextSymbolIndex>=0?e.rightJustifiedTextSymbolIndex:e.centerJustifiedTextSymbolIndex>=0?e.centerJustifiedTextSymbolIndex:e.leftJustifiedTextSymbolIndex>=0?e.leftJustifiedTextSymbolIndex:e.verticalPlacedTextSymbolIndex>=0?e.verticalPlacedTextSymbolIndex:n),s=Yd(this.textSizeData,t,i)/$d;return this.tilePixelRatio*s}getSymbolInstanceIconSize(t,e,r){const n=this.icon.placedSymbolArray.get(r),i=Yd(this.iconSizeData,t,n);return this.tilePixelRatio*i}_commitDebugCollisionVertexUpdate(t,e,r,n){t.emplaceBack(e,-r,-r,n),t.emplaceBack(e,r,-r,n),t.emplaceBack(e,r,r,n),t.emplaceBack(e,-r,r,n);}_updateTextDebugCollisionBoxes(t,e,r,n,i,s){for(let a=n;a<i;a++){const n=r.get(a),i=this.getSymbolInstanceTextSize(t,s,e,a);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,i,n.padding,s.zOffset);}}_updateIconDebugCollisionBoxes(t,e,r,n,i,s){for(let a=n;a<i;a++){const n=r.get(a),i=this.getSymbolInstanceIconSize(t,e,s.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,i,n.padding,s.zOffset);}}updateCollisionDebugBuffers(t,e){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const r=Xd(this.iconSizeData,t),n=Xd(this.textSizeData,t);for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);this._updateTextDebugCollisionBoxes(n,t,e,s.textBoxStartIndex,s.textBoxEndIndex,s),this._updateTextDebugCollisionBoxes(n,t,e,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s),this._updateIconDebugCollisionBoxes(r,t,e,s.iconBoxStartIndex,s.iconBoxEndIndex,s),this._updateIconDebugCollisionBoxes(r,t,e,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex,s);}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt);}_deserializeCollisionBoxesForSymbol(t,e,r,n,i,s,a,o,l){const u={};if(e<r){const{x1:r,y1:n,x2:i,y2:s,padding:a,projectedAnchorX:o,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p,featureIndex:f}=t.get(e);u.textBox={x1:r,y1:n,x2:i,y2:s,padding:a,projectedAnchorX:o,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p},u.textFeatureIndex=f;}if(n<i){const{x1:e,y1:r,x2:i,y2:s,padding:a,projectedAnchorX:o,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p,featureIndex:f}=t.get(n);u.verticalTextBox={x1:e,y1:r,x2:i,y2:s,padding:a,projectedAnchorX:o,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p},u.verticalTextFeatureIndex=f;}if(s<a){const{x1:e,y1:r,x2:n,y2:i,padding:a,projectedAnchorX:o,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p,featureIndex:f}=t.get(s);u.iconBox={x1:e,y1:r,x2:n,y2:i,padding:a,projectedAnchorX:o,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p},u.iconFeatureIndex=f;}if(o<l){const{x1:e,y1:r,x2:n,y2:i,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p,featureIndex:f}=t.get(o);u.verticalIconBox={x1:e,y1:r,x2:n,y2:i,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p},u.verticalIconFeatureIndex=f;}return u}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex));}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(t,e){const r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs;for(let e=r.vertexStartIndex;e<n;e+=4)t.indexArray.emplaceBack(e,e+1,e+2),t.indexArray.emplaceBack(e+1,e+2,e+3);}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),r=Math.cos(t),n=[],i=[],s=[];for(let t=0;t<this.symbolInstances.length;++t){s.push(t);const a=this.symbolInstances.get(t);n.push(0|Math.round(e*a.tileAnchorX+r*a.tileAnchorY)),i.push(a.featureIndex);}return s.sort(((t,e)=>n[t]-n[e]||i[e]-i[t])),s}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let t=0;t<this.symbolInstances.length;++t)this.symbolInstanceIndexesSortedZOffset.push(t);}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort(((t,e)=>this.symbolInstances.get(e).zOffset-this.symbolInstances.get(t).zOffset))}addToSortKeyRanges(t,e){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1});}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex);const{rightJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:n,leftJustifiedTextSymbolIndex:i,verticalPlacedTextSymbolIndex:s,placedIconSymbolIndex:a,verticalPlacedIconSymbolIndex:o}=e;r>=0&&this.addIndicesForPlacedSymbol(this.text,r),n>=0&&n!==r&&this.addIndicesForPlacedSymbol(this.text,n),i>=0&&i!==n&&i!==r&&this.addIndicesForPlacedSymbol(this.text,i),s>=0&&this.addIndicesForPlacedSymbol(this.text,s),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a),o>=0&&this.addIndicesForPlacedSymbol(this.icon,o);}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray);}}}fo(ug,\"SymbolBucket\",{omit:[\"layers\",\"collisionBoxArray\",\"features\",\"compareText\"]}),ug.addDynamicAttributes=sg;const cg=new Ho({\"symbol-placement\":new Zo(el.layout_symbol[\"symbol-placement\"]),\"symbol-spacing\":new Zo(el.layout_symbol[\"symbol-spacing\"]),\"symbol-avoid-edges\":new Zo(el.layout_symbol[\"symbol-avoid-edges\"]),\"symbol-sort-key\":new Ko(el.layout_symbol[\"symbol-sort-key\"]),\"symbol-z-order\":new Zo(el.layout_symbol[\"symbol-z-order\"]),\"symbol-z-elevate\":new Zo(el.layout_symbol[\"symbol-z-elevate\"]),\"icon-allow-overlap\":new Zo(el.layout_symbol[\"icon-allow-overlap\"]),\"icon-ignore-placement\":new Zo(el.layout_symbol[\"icon-ignore-placement\"]),\"icon-optional\":new Zo(el.layout_symbol[\"icon-optional\"]),\"icon-rotation-alignment\":new Zo(el.layout_symbol[\"icon-rotation-alignment\"]),\"icon-size\":new Ko(el.layout_symbol[\"icon-size\"]),\"icon-text-fit\":new Ko(el.layout_symbol[\"icon-text-fit\"]),\"icon-text-fit-padding\":new Ko(el.layout_symbol[\"icon-text-fit-padding\"]),\"icon-image\":new Ko(el.layout_symbol[\"icon-image\"]),\"icon-rotate\":new Ko(el.layout_symbol[\"icon-rotate\"]),\"icon-padding\":new Zo(el.layout_symbol[\"icon-padding\"]),\"icon-keep-upright\":new Zo(el.layout_symbol[\"icon-keep-upright\"]),\"icon-offset\":new Ko(el.layout_symbol[\"icon-offset\"]),\"icon-anchor\":new Ko(el.layout_symbol[\"icon-anchor\"]),\"icon-pitch-alignment\":new Zo(el.layout_symbol[\"icon-pitch-alignment\"]),\"text-pitch-alignment\":new Zo(el.layout_symbol[\"text-pitch-alignment\"]),\"text-rotation-alignment\":new Zo(el.layout_symbol[\"text-rotation-alignment\"]),\"text-field\":new Ko(el.layout_symbol[\"text-field\"]),\"text-font\":new Ko(el.layout_symbol[\"text-font\"]),\"text-size\":new Ko(el.layout_symbol[\"text-size\"]),\"text-max-width\":new Ko(el.layout_symbol[\"text-max-width\"]),\"text-line-height\":new Ko(el.layout_symbol[\"text-line-height\"]),\"text-letter-spacing\":new Ko(el.layout_symbol[\"text-letter-spacing\"]),\"text-justify\":new Ko(el.layout_symbol[\"text-justify\"]),\"text-radial-offset\":new Ko(el.layout_symbol[\"text-radial-offset\"]),\"text-variable-anchor\":new Zo(el.layout_symbol[\"text-variable-anchor\"]),\"text-anchor\":new Ko(el.layout_symbol[\"text-anchor\"]),\"text-max-angle\":new Zo(el.layout_symbol[\"text-max-angle\"]),\"text-writing-mode\":new Zo(el.layout_symbol[\"text-writing-mode\"]),\"text-rotate\":new Ko(el.layout_symbol[\"text-rotate\"]),\"text-padding\":new Zo(el.layout_symbol[\"text-padding\"]),\"text-keep-upright\":new Zo(el.layout_symbol[\"text-keep-upright\"]),\"text-transform\":new Ko(el.layout_symbol[\"text-transform\"]),\"text-offset\":new Ko(el.layout_symbol[\"text-offset\"]),\"text-allow-overlap\":new Zo(el.layout_symbol[\"text-allow-overlap\"]),\"text-ignore-placement\":new Zo(el.layout_symbol[\"text-ignore-placement\"]),\"text-optional\":new Zo(el.layout_symbol[\"text-optional\"]),visibility:new Zo(el.layout_symbol.visibility)});var hg={paint:new Ho({\"icon-opacity\":new Ko(el.paint_symbol[\"icon-opacity\"]),\"icon-emissive-strength\":new Ko(el.paint_symbol[\"icon-emissive-strength\"]),\"text-emissive-strength\":new Ko(el.paint_symbol[\"text-emissive-strength\"]),\"icon-color\":new Ko(el.paint_symbol[\"icon-color\"]),\"icon-halo-color\":new Ko(el.paint_symbol[\"icon-halo-color\"]),\"icon-halo-width\":new Ko(el.paint_symbol[\"icon-halo-width\"]),\"icon-halo-blur\":new Ko(el.paint_symbol[\"icon-halo-blur\"]),\"icon-translate\":new Zo(el.paint_symbol[\"icon-translate\"]),\"icon-translate-anchor\":new Zo(el.paint_symbol[\"icon-translate-anchor\"]),\"icon-image-cross-fade\":new Ko(el.paint_symbol[\"icon-image-cross-fade\"]),\"text-opacity\":new Ko(el.paint_symbol[\"text-opacity\"]),\"text-color\":new Ko(el.paint_symbol[\"text-color\"],{runtimeType:Jn,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),\"text-halo-color\":new Ko(el.paint_symbol[\"text-halo-color\"]),\"text-halo-width\":new Ko(el.paint_symbol[\"text-halo-width\"]),\"text-halo-blur\":new Ko(el.paint_symbol[\"text-halo-blur\"]),\"text-translate\":new Zo(el.paint_symbol[\"text-translate\"]),\"text-translate-anchor\":new Zo(el.paint_symbol[\"text-translate-anchor\"]),\"icon-color-saturation\":new Zo(el.paint_symbol[\"icon-color-saturation\"]),\"icon-color-contrast\":new Zo(el.paint_symbol[\"icon-color-contrast\"]),\"icon-color-brightness-min\":new Zo(el.paint_symbol[\"icon-color-brightness-min\"]),\"icon-color-brightness-max\":new Zo(el.paint_symbol[\"icon-color-brightness-max\"])}),layout:cg};class pg{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:Zn,this.defaultValue=t;}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression);}outputDefined(){return !1}serialize(){return null}}fo(pg,\"FormatSectionOverride\",{omit:[\"defaultValue\"]});class fg extends bl{constructor(e,r,n){super(e,hg,r,n),this._colorAdjustmentMatrix=t.a9.identity([]);}recalculate(t,e){super.recalculate(t,e),\"auto\"===this.layout.get(\"icon-rotation-alignment\")&&(this.layout._values[\"icon-rotation-alignment\"]=\"point\"!==this.layout.get(\"symbol-placement\")?\"map\":\"viewport\"),\"auto\"===this.layout.get(\"text-rotation-alignment\")&&(this.layout._values[\"text-rotation-alignment\"]=\"point\"!==this.layout.get(\"symbol-placement\")?\"map\":\"viewport\"),\"auto\"===this.layout.get(\"text-pitch-alignment\")&&(this.layout._values[\"text-pitch-alignment\"]=this.layout.get(\"text-rotation-alignment\")),\"auto\"===this.layout.get(\"icon-pitch-alignment\")&&(this.layout._values[\"icon-pitch-alignment\"]=this.layout.get(\"icon-rotation-alignment\"));const r=this.layout.get(\"text-writing-mode\");if(r){const t=[];for(const e of r)t.indexOf(e)<0&&t.push(e);this.layout._values[\"text-writing-mode\"]=t;}else this.layout._values[\"text-writing-mode\"]=\"point\"===this.layout.get(\"symbol-placement\")?[\"horizontal\"]:[\"horizontal\",\"vertical\"];this._setPaintOverrides();}getColorAdjustmentMatrix(e,r,n,i){return this._saturation===e&&this._contrast===r&&this._brightnessMin===n&&this._brightnessMax===i||(this._colorAdjustmentMatrix=function(e,r,n,i){e=Er(e),r=Pr(r);const s=t.a9.create(),a=e/3,o=1-2*a,l=[o,a,a,0,a,o,a,0,a,a,o,0,0,0,0,1],u=.5-.5*r,c=i-n;return t.a9.multiply(s,[c,0,0,0,0,c,0,0,0,0,c,0,n,n,n,1],[r,0,0,0,0,r,0,0,0,0,r,0,u,u,u,1]),t.a9.multiply(s,s,l),s}(e,r,n,i),this._saturation=e,this._contrast=r,this._brightnessMin=n,this._brightnessMax=i),this._colorAdjustmentMatrix}getValueAndResolveTokens(t,e,r,n){const i=this.layout.get(t).evaluate(e,{},r,n),s=this._unevaluatedLayout._values[t];return s.isDataDriven()||eo(s.value)||!i?i:function(t,e){return e.replace(/{([^{}]+)}/g,((e,r)=>r in t?String(t[r]):\"\"))}(e.properties,i)}createBucket(t){return new ug(t)}queryRadius(){return 0}queryIntersectsFeature(){return !1}_setPaintOverrides(){for(const t of hg.paint.overridableProperties){if(!fg.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new pg(e),n=new to(r,e.property.specification,this.scope,this.options);let i=null;i=\"constant\"===e.value.kind||\"source\"===e.value.kind?new no(\"source\",n):new io(\"composite\",n,e.value.zoomStops,e.value._interpolationType),this.paint._values[t]=new Yo(e.property,i,e.parameters);}}_handleOverridablePaintPropertyUpdate(t,e,r){return !(!this.layout||e.isDataDriven()||r.isDataDriven())&&fg.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get(\"text-field\"),n=hg.paint.properties[e];let i=!1;const s=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(i=!0)};if(\"constant\"===r.value.kind&&r.value.value instanceof fi)s(r.value.value.sections);else if(\"source\"===r.value.kind){const t=e=>{i||(e instanceof bi&&gi(e.value)===ni?s(e.value.sections):e instanceof Mi?s(e.sections):e.eachChild(t));},e=r.value;e._styleExpression&&t(e._styleExpression.expression);}return i}getProgramIds(){const t=0!==this.paint.get(\"icon-opacity\").constantOr(1),e=0!==this.paint.get(\"text-opacity\").constantOr(1),r=[];return t&&r.push(\"symbolIcon\"),e&&r.push(\"symbolSDF\"),r}getDefaultProgramParams(t,e){return {config:new Nu(this,e),overrideFog:!1}}}const dg=new Ho({visibility:new Zo(el.layout_background.visibility)});var mg={paint:new Ho({\"background-color\":new Zo(el.paint_background[\"background-color\"]),\"background-pattern\":new Zo(el.paint_background[\"background-pattern\"]),\"background-opacity\":new Zo(el.paint_background[\"background-opacity\"]),\"background-emissive-strength\":new Zo(el.paint_background[\"background-emissive-strength\"])}),layout:dg};const yg=new Ho({visibility:new Zo(el.layout_raster.visibility)});var gg={paint:new Ho({\"raster-opacity\":new Zo(el.paint_raster[\"raster-opacity\"]),\"raster-color\":new Wo(el.paint_raster[\"raster-color\"]),\"raster-color-mix\":new Zo(el.paint_raster[\"raster-color-mix\"]),\"raster-color-range\":new Zo(el.paint_raster[\"raster-color-range\"]),\"raster-hue-rotate\":new Zo(el.paint_raster[\"raster-hue-rotate\"]),\"raster-brightness-min\":new Zo(el.paint_raster[\"raster-brightness-min\"]),\"raster-brightness-max\":new Zo(el.paint_raster[\"raster-brightness-max\"]),\"raster-saturation\":new Zo(el.paint_raster[\"raster-saturation\"]),\"raster-contrast\":new Zo(el.paint_raster[\"raster-contrast\"]),\"raster-resampling\":new Zo(el.paint_raster[\"raster-resampling\"]),\"raster-fade-duration\":new Zo(el.paint_raster[\"raster-fade-duration\"]),\"raster-emissive-strength\":new Zo(el.paint_raster[\"raster-emissive-strength\"]),\"raster-array-band\":new Zo(el.paint_raster[\"raster-array-band\"]),\"raster-elevation\":new Zo(el.paint_raster[\"raster-elevation\"])}),layout:yg},xg=Ml([{name:\"a_pos\",type:\"Int16\",components:2},{name:\"a_texture_pos\",type:\"Int16\",components:2}]);class bg{constructor(t,e,r,n){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(e,n);}update(t,e,r){const{width:n,height:i}=t,{context:s}=this,{gl:a}=s;if(a.bindTexture(a.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===a.RGBA&&(!e||!1!==e.premultiply)),r||this.size&&this.size[0]===n&&this.size[1]===i){const{x:e,y:s}=r||{x:0,y:0};if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||ImageBitmap&&t instanceof ImageBitmap)a.texSubImage2D(a.TEXTURE_2D,0,e,s,a.RGBA,a.UNSIGNED_BYTE,t);else {let r=this.format,o=a.UNSIGNED_BYTE;this.format===a.R32F&&(r=a.RED,o=a.FLOAT),a.texSubImage2D(a.TEXTURE_2D,0,e,s,n,i,r,o,t.data);}}else if(this.size=[n,i],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||ImageBitmap&&t instanceof ImageBitmap){let e=this.format;this.format===a.R8&&(e=a.RED),a.texImage2D(a.TEXTURE_2D,0,this.format,e,a.UNSIGNED_BYTE,t);}else {let e=this.format,r=this.format,s=a.UNSIGNED_BYTE;this.format===a.DEPTH_COMPONENT&&(e=a.DEPTH_COMPONENT16,s=a.UNSIGNED_SHORT),this.format===a.R8&&(r=a.RED),this.format===a.R32F&&(s=a.FLOAT,r=a.RED),a.texImage2D(a.TEXTURE_2D,0,e,n,i,0,r,s,t.data);}this.useMipmap=Boolean(e&&e.useMipmap),this.useMipmap&&a.generateMipmap(a.TEXTURE_2D);}bind(t,e,r=!1){const{context:n}=this,{gl:i}=n;i.bindTexture(i.TEXTURE_2D,this.texture),t!==this.minFilter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,this.useMipmap&&!r?t===i.NEAREST?i.NEAREST_MIPMAP_NEAREST:i.LINEAR_MIPMAP_LINEAR:t),this.minFilter=t),e!==this.wrapS&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,e),this.wrapS=e);}bindExtraParam(t,e,r,n){const{context:i}=this,{gl:s}=i;s.bindTexture(s.TEXTURE_2D,this.texture),e!==this.magFilter&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,e),this.magFilter=e),t!==this.minFilter&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,this.useMipmap?t===s.NEAREST?s.NEAREST_MIPMAP_NEAREST:s.LINEAR_MIPMAP_LINEAR:t),this.minFilter=t),r!==this.wrapS&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,r),this.wrapS=r),n!==this.wrapT&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,n),this.wrapT=n);}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null;}}class vg{constructor(t,e){this.context=t,this.texture=e;}bind(t,e){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),t!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,t),this.minFilter=t),e!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrapS=e);}}function _g(e,r,n,i,s,a,o,l){const u=[e,r,1,n,i,1,s,a,1],c=[o,l,1],h=t.ct.adjoint([],u),[p,f,d]=t.Q.transformMat3(c,c,h);return t.ct.multiply(u,u,[p,0,0,0,f,0,0,0,d])}function wg(e,r,n,i,s,a,o,l){const u=function(e,r,n,i,s,a,o,l){const u=_g(0,0,1,0,1,1,0,1),c=_g(e,r,n,i,s,a,o,l),h=t.ct.adjoint([],u);return t.ct.multiply(c,c,h)}(e,r,n,i,s,a,o,l);return [u[2]/u[8]/is,u[5]/u[8]/is]}function Mg(t){return [t[0],Math.min(Math.max(t[1],-Ac),Ac)]}class Ag extends Dn{constructor(t,e,r,n){super(),this.id=t,this.dispatcher=r,this.coordinates=e.coordinates,this.type=\"image\",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(n),this.options=e,this._dirty=!1;}load(t,e){if(this._loaded=e||!1,this.fire(new Rn(\"dataloading\",{dataType:\"source\"})),this.url=this.options.url,!this.url)return t&&(this.coordinates=t),this._loaded=!0,void this._finishLoading();this._imageRequest=sn(this.map._requestManager.transformRequest(this.url,Zr.Image),((e,r)=>{this._imageRequest=null,this._loaded=!0,e?this.fire(new Vn(e)):r&&(this.image=r instanceof HTMLImageElement?Tr.getImageData(r):r,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,t&&(this.coordinates=t),this._finishLoading());}));}loaded(){return this._loaded}updateImage(t){return t.url?(this._imageRequest&&t.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=t.url,this.load(t.coordinates,this._loaded),this):this}setTexture(t){if(!(t.handle instanceof WebGLTexture))throw new Error(\"The provided handle is not a WebGLTexture instance\");return this.texture=new vg(this.map.painter.context,t.handle),this.width=t.dimensions[0],this.height=t.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new Rn(\"data\",{dataType:\"source\",sourceDataType:\"metadata\"})));}onAdd(t){this.map=t,this.load();}onRemove(){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof vg||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy());}setCoordinates(t){if(this.coordinates=t,this._boundsArray=void 0,this._unsupportedCoords=!1,!t.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let e=t[0][1],r=t[0][1];for(const n of t)n[1]>r&&(r=n[1]),n[1]<e&&(e=n[1]);const n=(r+e)/2;if(n>Ac?this.onNorthPole=!0:n<-Ac&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const e=t.map(Ec.fromLngLat);this.tileID=function(t){let e=1/0,r=1/0,n=-1/0,i=-1/0;for(const s of t)e=Math.min(e,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x),i=Math.max(i,s.y);const s=Math.max(n-e,i-r),a=Math.max(0,Math.floor(-Math.log(s)/Math.LN2)),o=Math.pow(2,a);let l=Math.floor((e+n)/2*o);return l>1&&(l-=1),new cc(a,l,Math.floor((r+i)/2*o))}(e),this.minzoom=this.maxzoom=this.tileID.z;}return this.fire(new Rn(\"data\",{dataType:\"source\",sourceDataType:\"content\"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1;}_prepareData(e){for(const t in this.tiles){const e=this.tiles[t];\"loaded\"!==e.state&&(e.state=\"loaded\",e.texture=this.texture);}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const r=Ty(new cc(0,0,0),this.map.transform.projection),n=[r.projection.project(this.coordinates[0][0],this.coordinates[0][1]),r.projection.project(this.coordinates[1][0],this.coordinates[1][1]),r.projection.project(this.coordinates[2][0],this.coordinates[2][1]),r.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(t){const e=t[1].x-t[0].x,r=t[1].y-t[0].y,n=t[2].x-t[1].x,i=t[2].y-t[1].y,s=t[3].x-t[2].x,a=t[3].y-t[2].y,o=t[0].x-t[3].x,l=t[0].y-t[3].y,u=e*i-n*r,c=n*a-s*i,h=s*l-o*a,p=o*r-e*l;return u>0&&c>0&&h>0&&p>0||u<0&&c<0&&h<0&&p<0}(n))return console.warn(\"Image source coordinates are defining non-convex area in the Mercator projection\"),void(this._unsupportedCoords=!0);const i=Ty(this.tileID,this.map.transform.projection),[s,a,o,l]=this.coordinates.map((t=>{const e=i.projection.project(t[0],t[1]);return By(i,e)._round()}));this.perspectiveTransform=wg(s.x,s.y,a.x,a.y,o.x,o.y,l.x,l.y);const u=this._boundsArray=new kl;u.emplaceBack(s.x,s.y,0,0),u.emplaceBack(a.x,a.y,is,0),u.emplaceBack(l.x,l.y,0,is),u.emplaceBack(o.x,o.y,is,is),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(u,xg.members),this.boundsSegments=mu.simpleSegment(0,0,4,2);const c=[],h=[Mg((p=this.coordinates)[0]),Mg(p[1]),Mg(p[2]),Mg(p[3])];var p;const[f,d,m,y]=function(t){let e=t[0][0],r=e,n=t[0][1],i=n;for(let s=1;s<t.length;s++)t[s][0]<e?e=t[s][0]:t[s][0]>r&&(r=t[s][0]),t[s][1]<n?n=t[s][1]:t[s][1]>i&&(i=t[s][1]);return [e,n,r-e,i-n]}(h);{const i=new kl,[s,a,o,l]=function(t){let e=t[0].x,r=e,n=t[0].y,i=n;for(let s=1;s<t.length;s++)t[s].x<e?e=t[s].x:t[s].x>r&&(r=t[s].x),t[s].y<n?n=t[s].y:t[s].y>i&&(i=t[s].y);return [e,n,r-e,i-n]}(n),u=t=>[(t.x-s)/o,(t.y-a)/l],[h,p,g,x]=n.map(u),b=function(e,r,n,i,s,a,o,l){const u=_g(0,0,1,0,1,1,0,1),c=_g(e,r,n,i,s,a,o,l),h=t.ct.adjoint([],c);return t.ct.multiply(u,u,h)}(h[0],h[1],p[0],p[1],g[0],g[1],x[0],x[1]);this.elevatedGlobePerspectiveTransform=wg(h[0],h[1],p[0],p[1],g[0],g[1],x[0],x[1]);const v=(e,r)=>{c.push(e.lng);const n=Math.round((e.lng-f)/m*is),s=Math.round((e.lat-d)/y*is),a=u(r),o=t.Q.transformMat3([],[a[0],a[1],1],b),l=Math.round(o[0]/o[2]*is),h=Math.round(o[1]/o[2]*is);i.emplaceBack(n,s,l,h);},_=n[3].x-n[0].x,w=n[3].y-n[0].y,M=n[2].x-n[1].x,A=n[2].y-n[1].y;for(let t=0;t<65;t++){const e=t/64,i=[n[0].x+e*_,n[0].y+e*w],s=[n[1].x+e*M,n[1].y+e*A],a=s[0]-i[0],o=s[1]-i[1];for(let t=0;t<65;t++){const e=t/64,n={x:i[0]+a*e,y:i[1]+o*e,z:0};v(r.projection.unproject(n.x,n.y),n);}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(i,xg.members);}{this.maxLongitudeTriangleSize=0;let t=[],r=new ql;const n=(e,n,i)=>{r.emplaceBack(e,n,i);const s=c[e],a=c[n],o=c[i],l=Math.min(Math.min(s,a),o),u=Math.max(Math.max(s,a),o)-l;u>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=u),t.push(l+u/2);};for(let t=0;t<64;t++)for(let e=0;e<64;e++){const r=65*t+e,i=r+1,s=r+65,a=s+1;n(r,s,i),n(i,s,a);}[t,r]=function(t,e){const r=Array.from({length:t.length},((t,e)=>e));r.sort(((e,r)=>t[e]-t[r]));const n=[],i=new ql;for(let s=0;s<r.length;s++){const a=r[s];n.push(t[a]);const o=3*a,l=o+1;i.emplaceBack(e.uint16[o],e.uint16[l],e.uint16[l+1]);}return [n,i]}(t,r),this.elevatedGlobeTrianglesCenterLongitudes=t,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(r);}this.elevatedGlobeSegments=mu.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,m/is,0,y/is,0,0,d,f,0]);}prepare(){const t=0!==Object.keys(this.tiles).length;if(this.tileID&&!t)return;const e=this.map.painter.context,r=e.gl;!this._dirty||this.texture instanceof vg||(this.texture?this.texture.update(this.image):(this.texture=new bg(e,this.image,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this._dirty=!1),t&&this._prepareData(e);}loadTile(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state=\"errored\",e(null));}serialize(){return {type:\"image\",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return !1}getSegmentsForLongitude(t){const e=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!e)return null;const r=this.elevatedGlobeTrianglesCenterLongitudes;let n=((t,e)=>t+360*Math.round((e-t)/360))(t+180,r[0]);const i=new mu,s=(t,r)=>{i.segments.push({vertexOffset:0,primitiveOffset:t,vertexLength:e.segments[0].vertexLength,primitiveLength:r,sortKey:void 0,vaos:{}});},a=.51*this.maxLongitudeTriangleSize;if(Math.abs(r[0]-n)<=a){const t=kr(r,0,r.length,n+a);return t===r.length||s(t,Ir(r,t+1,r.length,n+360-a)-t),i}n<r[0]&&(n+=360);const o=Ir(r,0,r.length,n-a);if(o===r.length)return s(0,r.length),i;s(0,o-0);const l=kr(r,o+1,r.length,n+a);return l!==r.length&&s(l,r.length-l),i}}const Sg=(Math.pow(256,2)-1)/16907520;class Ig extends bl{constructor(t,e,r){super(t,gg,e,r),this.updateColorRamp(),this._curRampRange=[NaN,NaN];}getProgramIds(){return [\"raster\"]}hasColorMap(){return !!this._transitionablePaint._values[\"raster-color\"].value.value}tileCoverLift(){return this.paint.get(\"raster-elevation\")}isDraped(t){return !(t&&t._source instanceof Ag&&(t._source.onNorthPole||t._source.onSouthPole))&&0===this.paint.get(\"raster-elevation\")}_handleSpecialPaintPropertyUpdate(t){\"raster-color\"!==t&&\"raster-color-range\"!==t||(this._curRampRange=[NaN,NaN],this.updateColorRamp());}updateColorRamp(t){if(!this.hasColorMap())return;if(!this._curRampRange)return;const e=this._transitionablePaint._values[\"raster-color\"].value.expression,[r,n]=t||this._transitionablePaint._values[\"raster-color-range\"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(r)&&isNaN(n)||r===this._curRampRange[0]&&n===this._curRampRange[1]||(this.colorRamp=op({expression:e,evaluationKey:\"rasterValue\",image:this.colorRamp,clips:[{start:r,end:n}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[r,n]);}}const kg=new Ho({visibility:new Zo(el[\"layout_raster-particle\"].visibility)});var Pg={paint:new Ho({\"raster-particle-array-band\":new Zo(el[\"paint_raster-particle\"][\"raster-particle-array-band\"]),\"raster-particle-count\":new Zo(el[\"paint_raster-particle\"][\"raster-particle-count\"]),\"raster-particle-color\":new Wo(el[\"paint_raster-particle\"][\"raster-particle-color\"]),\"raster-particle-max-speed\":new Zo(el[\"paint_raster-particle\"][\"raster-particle-max-speed\"]),\"raster-particle-speed-factor\":new Zo(el[\"paint_raster-particle\"][\"raster-particle-speed-factor\"]),\"raster-particle-fade-opacity-factor\":new Zo(el[\"paint_raster-particle\"][\"raster-particle-fade-opacity-factor\"]),\"raster-particle-reset-rate-factor\":new Zo(el[\"paint_raster-particle\"][\"raster-particle-reset-rate-factor\"])}),layout:kg};class Eg extends bl{constructor(t,e,r){super(t,Pg,e,r),this._updateColorRamp(),this.lastInvalidatedAt=Tr.now();}onRemove(t){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy();}hasColorMap(){return !!this._transitionablePaint._values[\"raster-particle-color\"].value.value}getProgramIds(){return [\"rasterParticle\"]}hasOffscreenPass(){return \"none\"!==this.visibility}isDraped(t){return !1}_handleSpecialPaintPropertyUpdate(t){\"raster-particle-color\"!==t&&\"raster-particle-max-speed\"!==t||(this._updateColorRamp(),this._invalidateAnimationState()),\"raster-particle-count\"===t&&this._invalidateAnimationState();}_updateColorRamp(){if(!this.hasColorMap())return;const t=this._transitionablePaint._values[\"raster-particle-color\"].value.expression,e=this._transitionablePaint._values[\"raster-particle-max-speed\"].value.expression.evaluate({zoom:0});this.colorRamp=op({expression:t,evaluationKey:\"rasterParticleSpeed\",image:this.colorRamp,clips:[{start:0,end:e}],resolution:256}),this.colorRampTexture=null;}_invalidateAnimationState(){this.lastInvalidatedAt=Tr.now();}}class zg extends bl{constructor(t,e){super(t,{},e),this.implementation=t,t.slot&&(this.slot=t.slot);}is3D(){return \"3d\"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isDraped(t){return void 0!==this.implementation.renderToTile}shouldRedrape(){return !!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return !1}serialize(){}onAdd(t){this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl);}onRemove(t){this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl);}}const Tg=new Ho({visibility:new Zo(el.layout_sky.visibility)});var Bg={paint:new Ho({\"sky-type\":new Zo(el.paint_sky[\"sky-type\"]),\"sky-atmosphere-sun\":new Zo(el.paint_sky[\"sky-atmosphere-sun\"]),\"sky-atmosphere-sun-intensity\":new Zo(el.paint_sky[\"sky-atmosphere-sun-intensity\"]),\"sky-gradient-center\":new Zo(el.paint_sky[\"sky-gradient-center\"]),\"sky-gradient-radius\":new Zo(el.paint_sky[\"sky-gradient-radius\"]),\"sky-gradient\":new Wo(el.paint_sky[\"sky-gradient\"]),\"sky-atmosphere-halo-color\":new Zo(el.paint_sky[\"sky-atmosphere-halo-color\"]),\"sky-atmosphere-color\":new Zo(el.paint_sky[\"sky-atmosphere-color\"]),\"sky-opacity\":new Zo(el.paint_sky[\"sky-opacity\"])}),layout:Tg};function Cg(e,r,n){const i=[0,0,1],s=t.bl.identity([]);return t.bl.rotateY(s,s,n?-qe(e)+Math.PI:qe(e)),t.bl.rotateX(s,s,-qe(r)),t.Q.transformQuat(i,i,s),t.Q.normalize(i,i)}var Rg={paint:new Ho({})};function Vg(e,r){const n=Lg(e.projection,e.zoom,e.width,e.height),i=function(e,r,n,i,s){const a=new ac(n.lng-180*Fg,n.lat),o=new ac(n.lng+180*Fg,n.lat),l=e.project(a.lng,a.lat),u=e.project(o.lng,o.lat),c=-Math.atan2(u.y-l.y,u.x-l.x),h=Ec.fromLngLat(n);h.y=Ze(h.y,-1+Fg,1-Fg);const p=h.toLngLat(),f=e.project(p.lng,p.lat),d=Ec.fromLngLat(p);d.x+=Fg;const m=d.toLngLat(),y=e.project(m.lng,m.lat),g=Ug(y.x-f.x,y.y-f.y,c),x=Ec.fromLngLat(p);x.y+=Fg;const b=x.toLngLat(),v=e.project(b.lng,b.lat),_=Ug(v.x-f.x,v.y-f.y,c),w=Math.abs(g.x)/Math.abs(_.y),M=t.a9.identity([]);t.a9.rotateZ(M,M,-c*(1-(s?0:i)));const A=t.a9.identity([]);return t.a9.scale(A,A,[1,1-(1-w)*i,1]),A[4]=-_.x/_.y*i,t.a9.rotateZ(A,A,c),t.a9.multiply(A,M,A),A}(e.projection,0,e.center,n,r),s=Dg(e);return t.a9.scale(i,i,[s,s,1]),i}function Dg(t){const e=t.projection,r=Lg(t.projection,t.zoom,t.width,t.height),n=Og(e,t.center),i=Og(e,ac.convert(e.center));return Math.pow(2,n*r+(1-r)*i)}function Lg(t,e,r,n,i=1/0){const s=t.range;if(!s)return 0;const a=Math.min(i,Math.max(r,n)),o=Math.log(a/1024)/Math.LN2;return Ke(s[0]+o,s[1]+o,e)}const Fg=1/4e4;function Og(t,e){const r=Ze(e.lat,-Ac,Ac),n=new ac(e.lng-180*Fg,r),i=new ac(e.lng+180*Fg,r),s=t.project(n.lng,r),a=t.project(i.lng,r),o=Ec.fromLngLat(n),l=Ec.fromLngLat(i),u=a.x-s.x,c=a.y-s.y,h=l.x-o.x,p=l.y-o.y,f=Math.sqrt((h*h+p*p)/(u*u+c*c));return Math.log(f)/Math.LN2}function Ug(t,e,r){const n=Math.cos(r),i=Math.sin(r);return {x:t*n-e*i,y:t*i+e*n}}function Ng(e,r,n){t.a9.identity(e),t.a9.rotateZ(e,e,qe(r[2])),t.a9.rotateX(e,e,qe(r[0])),t.a9.rotateY(e,e,qe(r[1])),t.a9.scale(e,e,n),t.a9.multiply(e,e,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1]);}function jg(e,r,n,i,s,a,o,l){const u=[n[0]-r[0],n[1]-r[1],0],c=[i[0]-r[0],i[1]-r[1],0];if(t.Q.length(u)<1e-12||t.Q.length(c)<1e-12)return t.bl.identity(e);const h=t.Q.cross([],u,c);t.Q.normalize(h,h),t.Q.subtract(c,i,r),u[2]=(a-s)*l,c[2]=(o-s)*l;const p=u;return t.Q.cross(p,u,c),t.Q.normalize(p,p),t.bl.rotationTo(e,h,p)}function qg(e,r,n=!1){const i=Oh(r.zoom),s=function(e,r,n){const i=r.worldSize,s=[e[12],e[13],e[14]],a=wc(s[1]/i),o=_c(s[0]/i),l=t.a9.identity([]),u=vc(1,a)*i,c=vc(1,0)*i*Ic(a,r.zoom),h=1/Dh(i);let p=c*h;if(n){const t=Lg(r.projection,r.zoom,r.width,r.height,1024);p=h*r.projection.pixelSpaceConversion(r.center.lat,i,t);}const f=nc(a,o);t.Q.add(f,f,t.Q.scale([],t.Q.normalize([],f),u*p*s[2]));const d=function(e){const r=[e[0],e[1],e[2]];let n=[0,1,0];const i=t.Q.cross([],n,r);return t.Q.cross(n,r,i),0===t.Q.squaredLength(n)&&(n=[0,1,0],t.Q.cross(i,r,n)),t.Q.normalize(i,i),t.Q.normalize(n,n),t.Q.normalize(r,r),[i[0],i[1],i[2],0,n[0],n[1],n[2],0,r[0],r[1],r[2],0,e[0],e[1],e[2],1]}(f);t.a9.scale(l,l,[p,p,p*u]),t.a9.translate(l,l,[-s[0],-s[1],-s[2]]);const m=t.a9.multiply([],r.globeMatrix,d);return t.a9.multiply(m,m,l),t.a9.multiply(m,m,e),m}(e,r,n);if(i>0){const n=function(e,r){const n=r.worldSize,i=vc(1,0)*n*Ic(r.center.lat,r.zoom)/Dh(n),s=vc(1,r.center.lat)*n,a=t.a9.identity([]);return t.a9.rotateY(a,a,qe(r.center.lng)),t.a9.rotateX(a,a,qe(r.center.lat)),t.a9.translate(a,a,[0,0,Xu]),t.a9.scale(a,a,[i,i,i*s]),t.a9.translate(a,a,[r.point.x-.5*n,r.point.y-.5*n,0]),t.a9.multiply(a,a,e),t.a9.multiply(a,r.globeMatrix,a)}(e,r);return function(e,r,n){const i=(e,r,n)=>{const i=t.Q.length(e),s=t.Q.length(r),a=Ih(e,r,n);return t.Q.scale(a,a,1/t.Q.length(a)*qn(i,s,n))},s=i([e[0],e[1],e[2]],[r[0],r[1],r[2]],n),a=i([e[4],e[5],e[6]],[r[4],r[5],r[6]],n),o=i([e[8],e[9],e[10]],[r[8],r[9],r[10]],n),l=Ih([e[12],e[13],e[14]],[r[12],r[13],r[14]],n);return [s[0],s[1],s[2],0,a[0],a[1],a[2],0,o[0],o[1],o[2],0,l[0],l[1],l[2],1]}(s,n,i)}return s}function $g(t,e,r,n){const i=mh.projectAabbCorners(n,r);let s=Number.MAX_VALUE,a=-1;for(let t=0;t<i.length;++t){const r=i[t];r[0]=(.5*r[0]+.5)*e.width,r[1]=(.5-.5*r[1])*e.height,r[2]<s&&(a=t,s=r[2]);}const o=t=>new Ue(i[t][0],i[t][1]);let l;switch(a){case 0:case 6:l=[o(1),o(5),o(4),o(7),o(3),o(2),o(1)];break;case 1:case 7:l=[o(0),o(4),o(5),o(6),o(2),o(3),o(0)];break;case 3:case 5:l=[o(1),o(0),o(4),o(7),o(6),o(2),o(1)];break;default:l=[o(1),o(5),o(6),o(7),o(3),o(0),o(1)];}if(jc(t,l))return s}const Gg=Ml([{name:\"a_pos_3f\",components:3,type:\"Float32\"}]),Qg=Ml([{name:\"a_color_3f\",components:3,type:\"Float32\"}]),Yg=Ml([{name:\"a_color_4f\",components:4,type:\"Float32\"}]),Xg=Ml([{name:\"a_uv_2f\",components:2,type:\"Float32\"}]),Zg=Ml([{name:\"a_normal_3f\",components:3,type:\"Float32\"}]),Kg=Ml([{name:\"a_normal_matrix0\",components:4,type:\"Float32\"},{name:\"a_normal_matrix1\",components:4,type:\"Float32\"},{name:\"a_normal_matrix2\",components:4,type:\"Float32\"},{name:\"a_normal_matrix3\",components:4,type:\"Float32\"}]),Wg=Ml([{name:\"a_pbr\",components:4,type:\"Uint16\"},{name:\"a_heightBasedEmissiveStrength\",components:3,type:\"Float32\"}]);class Hg{constructor(t,e,r,n){this.message=(t?`${t}: `:\"\")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__);}}function Jg(t,e){const r=-1===t.indexOf(\"://\");try{return new URL(t,r&&e?\"http://example.com\":void 0),!0}catch(t){return !1}}class tx{constructor(t,e){this.feature=t,this.instancedDataOffset=e,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0];}}class ex{constructor(){this.instancedDataArray=new Hl,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={};}}class rx{constructor(t){this.zoom=t.zoom,this.canonical=t.canonical,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.fqid)),this.projection=t.projection,this.index=t.index,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1;}populate(t,e,r,n){this.tileToMeter=Pc(r);const i=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:s,id:a,index:o,sourceLayerIndex:l}of t){const t=null!=a?a:s.properties&&s.properties.hasOwnProperty(\"id\")?s.properties.id:void 0,u=Fc(s,i);if(!this.layers[0]._featureFilter.filter(new Uo(this.zoom),u,r))continue;const c={id:t,sourceLayerIndex:l,index:o,geometry:i?u.geometry:Lc(s,r,n),properties:s.properties,type:s.type,patterns:{}},h=this.addFeature(c,c.geometry,u);h&&e.featureIndex.insert(s,c.geometry,o,l,this.index,this.instancesPerModel[h].instancedDataArray.length,is/32);}this.lookup=null;}update(t,e,r,n){for(const e in this.instancesPerModel){const r=this.instancesPerModel[e];for(const e in t)r.idToFeaturesIndex.hasOwnProperty(e)&&(this.evaluate(r.features[r.idToFeaturesIndex[e]],t[e],r,!0),this.uploaded=!1);}this.maxHeight=0;}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return !1;let e=!1;for(const r in this.instancesPerModel){const n=this.instancesPerModel[r];for(const r of n.features){const i=this.layers[0],s=r.feature,a=this.canonical,o=i.paint.get(\"model-rotation\").evaluate(s,{},a),l=i.paint.get(\"model-scale\").evaluate(s,{},a),u=i.paint.get(\"model-translation\").evaluate(s,{},a);t.Q.exactEquals(r.rotation,o)&&t.Q.exactEquals(r.scale,l)&&t.Q.exactEquals(r.translation,u)||(this.evaluate(r,r.featureStates,n,!0),e=!0);}}return e}isEmpty(){for(const t in this.instancesPerModel)if(0!==this.instancesPerModel[t].instancedDataArray.length)return !1;return !0}uploadPending(){return !this.uploaded}upload(t){if(!this.uploaded)for(const e in this.instancesPerModel){const r=this.instancesPerModel[e];r.instancedDataArray.length<0||0===r.instancedDataArray.length||(r.instancedDataBuffer?r.instancedDataBuffer.updateData(r.instancedDataArray):r.instancedDataBuffer=t.createVertexBuffer(r.instancedDataArray,Kg.members,!0,void 0,this.instanceCount));}this.uploaded=!0;}destroy(){for(const t in this.instancesPerModel){const e=this.instancesPerModel[t];0!==e.instancedDataArray.length&&e.instancedDataBuffer&&e.instancedDataBuffer.destroy();}const t=this.layers[0].modelManager;if(t&&this.modelUris)for(const e of this.modelUris)t.removeModel(e,\"\");}addFeature(t,e,r){const n=this.layers[0],i=n.layout.get(\"model-id\").evaluate(r,{},this.canonical);if(!i)return hr(`modelId is not evaluated for layer ${n.id} and it is not going to get rendered.`),i;Jg(i,!1)&&(this.modelUris.includes(i)||this.modelUris.push(i)),this.instancesPerModel[i]||(this.instancesPerModel[i]=new ex);const s=this.instancesPerModel[i],a=s.instancedDataArray,o=new tx(r,a.length);for(const t of e)for(const e of t){if(e.x<0||e.x>=is||e.y<0||e.y>=is)continue;const t=(this.lookupDim-1)/is,r=this.lookupDim*(e.y*t|0)+e.x*t|0;if(this.lookup){if(0!==this.lookup[r])continue;this.lookup[r]=1;}this.instanceCount++;const n=a.length;a.resize(n+1),s.instancesEvaluatedElevation.push(0),a.float32[16*n]=e.x,a.float32[16*n+1]=e.y;}return o.instancedDataCount=s.instancedDataArray.length-o.instancedDataOffset,o.instancedDataCount>0&&(t.id&&(s.idToFeaturesIndex[t.id]=s.features.length),s.features.push(o),this.evaluate(o,{},s,!1)),i}getModelUris(){return this.modelUris}evaluate(t,e,r,n){const i=this.layers[0],s=t.feature,a=this.canonical,o=t.rotation=i.paint.get(\"model-rotation\").evaluate(s,e,a),l=t.scale=i.paint.get(\"model-scale\").evaluate(s,e,a),u=t.translation=i.paint.get(\"model-translation\").evaluate(s,e,a),c=i.paint.get(\"model-color\").evaluate(s,e,a);c.a=i.paint.get(\"model-color-mix-intensity\").evaluate(s,e,a);const h=[];this.maxVerticalOffset<u[2]&&(this.maxVerticalOffset=u[2]),this.maxScale=Math.max(Math.max(this.maxScale,l[0]),Math.max(l[1],l[2])),Ng(h,o,l);const p=Math.round(100*c.a)+c.b/1.05;for(let e=0;e<t.instancedDataCount;++e){const i=t.instancedDataOffset+e,s=16*i,o=r.instancedDataArray.float32;let l=0;n&&(l=o[s+6]-r.instancesEvaluatedElevation[i]);const f=0|o[s+1];o[s]=(0|o[s])+c.r/1.05,o[s+1]=f+c.g/1.05,o[s+2]=p,o[s+3]=1/(a.z>10?this.tileToMeter:Pc(a,f)),o[s+4]=u[0],o[s+5]=u[1],o[s+6]=u[2]+l,o[s+7]=h[0],o[s+8]=h[1],o[s+9]=h[2],o[s+10]=h[4],o[s+11]=h[5],o[s+12]=h[6],o[s+13]=h[8],o[s+14]=h[9],o[s+15]=h[10],r.instancesEvaluatedElevation[i]=u[2];}}}fo(rx,\"ModelBucket\",{omit:[\"layers\"]}),fo(ex,\"PerModelAttributes\"),fo(tx,\"ModelFeature\");const nx=new Ho({visibility:new Zo(el.layout_model.visibility),\"model-id\":new Ko(el.layout_model[\"model-id\"])});var ix={paint:new Ho({\"model-opacity\":new Zo(el.paint_model[\"model-opacity\"]),\"model-rotation\":new Ko(el.paint_model[\"model-rotation\"]),\"model-scale\":new Ko(el.paint_model[\"model-scale\"]),\"model-translation\":new Ko(el.paint_model[\"model-translation\"]),\"model-color\":new Ko(el.paint_model[\"model-color\"]),\"model-color-mix-intensity\":new Ko(el.paint_model[\"model-color-mix-intensity\"]),\"model-type\":new Zo(el.paint_model[\"model-type\"]),\"model-cast-shadows\":new Zo(el.paint_model[\"model-cast-shadows\"]),\"model-receive-shadows\":new Zo(el.paint_model[\"model-receive-shadows\"]),\"model-ambient-occlusion-intensity\":new Zo(el.paint_model[\"model-ambient-occlusion-intensity\"]),\"model-emissive-strength\":new Ko(el.paint_model[\"model-emissive-strength\"]),\"model-roughness\":new Ko(el.paint_model[\"model-roughness\"]),\"model-height-based-emissive-strength-multiplier\":new Ko(el.paint_model[\"model-height-based-emissive-strength-multiplier\"]),\"model-cutoff-fade-range\":new Zo(el.paint_model[\"model-cutoff-fade-range\"]),\"model-front-cutoff\":new Zo(el.paint_model[\"model-front-cutoff\"])}),layout:nx};const sx=64,ax={CoordinateSpaceTile:1,CoordinateSpaceYUp:2,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function ox(e,r,n,i,s,a,o,l,u,c=!1){const h=n.zoom,p=n.project(i),f=Ic(i.lat,h),d=1/f;t.a9.identity(e),t.a9.translate(e,e,[p.x+o[0]*d,p.y+o[1]*d,o[2]]);let m=1,y=1;const g=n.worldSize;if(c){if(\"mercator\"===n.projection.name){let e=0;n.elevation&&(e=n.elevation.getAtPointOrZero(new Ec(p.x/g,p.y/g),0));const r=t.aa.transformMat4([],[p.x,p.y,e,1],n.projMatrix)[3]/n.cameraToCenterDistance;m=r,y=r*Ic(n.center.lat,h);}else if(\"globe\"===n.projection.name){const r=qg(e,n),s=t.a9.multiply([],n.projMatrix,r),a=[0,0,0,1];t.aa.transformMat4(a,a,s);const o=a[3]/n.cameraToCenterDistance,l=Oh(h),u=n.projection.pixelsPerMeter(i.lat,g)*Ic(i.lat,h),c=n.projection.pixelsPerMeter(n.center.lat,g)*Ic(n.center.lat,h);m=o/qn(u,Sc(n.center.lat),l),y=o*f/u,m*=c,y*=c;}}else m=d;t.a9.scale(e,e,[m,m,y]);const x=[...e],b=r.orientation,v=[];if(Ng(v,[b[0]+s[0],b[1]+s[1],b[2]+s[2]],a),t.a9.multiply(e,x,v),l&&n.elevation){let s=0;const a=[];if(u&&n.elevation){s=function(e,r,n,i,s){const a=r.elevation;if(!a)return 0;const o=mh.projectAabbCorners(n,i),l=vc(1,s.lat)*r.worldSize,u=function(e,r){const n=[0,0,1],i=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const s of i){const i=e[s.corners[0]],a=e[s.corners[1]],o=e[s.corners[2]],l=[a[0]-i[0],a[1]-i[1],r*(a[2]-i[2])],u=t.Q.cross(l,l,[o[0]-i[0],o[1]-i[1],r*(o[2]-i[2])]);t.Q.normalize(u,u),s.dotProductWithUp=t.Q.dot(u,n);}return i.sort(((t,e)=>t.dotProductWithUp-e.dotProductWithUp)),i[0].corners}(o,l),c=o[u[0]],h=o[u[1]],p=o[u[2]],f=o[u[3]],d=a.getAtPointOrZero(new Ec(c[0]/r.worldSize,c[1]/r.worldSize),0),m=a.getAtPointOrZero(new Ec(h[0]/r.worldSize,h[1]/r.worldSize),0),y=a.getAtPointOrZero(new Ec(p[0]/r.worldSize,p[1]/r.worldSize),0),g=a.getAtPointOrZero(new Ec(f[0]/r.worldSize,f[1]/r.worldSize),0),x=(d+g)/2,b=(m+y)/2;return x>b?m<y?jg(e,h,f,c,m,g,d,l):jg(e,p,c,f,y,d,g,l):d<g?jg(e,c,h,p,d,m,y,l):jg(e,f,p,h,g,y,m,l),Math.max(x,b)}(a,n,r.aabb,e,i);const o=t.a9.fromQuat([],a),l=t.a9.multiply([],o,v);t.a9.multiply(e,x,l);}else s=n.elevation.getAtPointOrZero(new Ec(p.x/g,p.y/g),0);0!==s&&(e[14]+=s);}}function lx(t,e,r=!1){t.uploaded||(t.gfxTexture=new bg(e,t.image,r?e.gl.R8:e.gl.RGBA,{useMipmap:t.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),t.uploaded=!0,t.image=null);}function ux(t,e,r){t.indexBuffer=e.createIndexBuffer(t.indexArray,!1,!0),t.vertexBuffer=e.createVertexBuffer(t.vertexArray,Gg.members,!1,!0),t.normalArray&&(t.normalBuffer=e.createVertexBuffer(t.normalArray,Zg.members,!1,!0)),t.texcoordArray&&(t.texcoordBuffer=e.createVertexBuffer(t.texcoordArray,Xg.members,!1,!0)),t.colorArray&&(t.colorBuffer=e.createVertexBuffer(t.colorArray,(12===t.colorArray.bytesPerElement?Qg:Yg).members,!1,!0)),t.featureArray&&(t.pbrBuffer=e.createVertexBuffer(t.featureArray,Wg.members,!0)),t.segments=mu.simpleSegment(0,0,t.vertexArray.length,t.indexArray.length);const n=t.material;n.pbrMetallicRoughness.baseColorTexture&&lx(n.pbrMetallicRoughness.baseColorTexture,e),n.pbrMetallicRoughness.metallicRoughnessTexture&&lx(n.pbrMetallicRoughness.metallicRoughnessTexture,e),n.normalTexture&&lx(n.normalTexture,e),n.occlusionTexture&&lx(n.occlusionTexture,e,r),n.emissionTexture&&lx(n.emissionTexture,e);}function cx(t,e,r){if(t.meshes)for(const n of t.meshes)ux(n,e,r);if(t.children)for(const n of t.children)cx(n,e,r);}function hx(t){if(t.meshes)for(const e of t.meshes)e.indexArray.destroy(),e.vertexArray.destroy(),e.colorArray&&e.colorArray.destroy(),e.normalArray&&e.normalArray.destroy(),e.texcoordArray&&e.texcoordArray.destroy(),e.featureArray&&e.featureArray.destroy();if(t.children)for(const e of t.children)hx(e);}function px(t){if(t.meshes)for(const r of t.meshes)r.vertexBuffer&&(r.vertexBuffer.destroy(),r.indexBuffer.destroy(),r.normalBuffer&&r.normalBuffer.destroy(),r.texcoordBuffer&&r.texcoordBuffer.destroy(),r.colorBuffer&&r.colorBuffer.destroy(),r.pbrBuffer&&r.pbrBuffer.destroy(),r.segments.destroy(),r.material&&((e=r.material).pbrMetallicRoughness.baseColorTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),e.pbrMetallicRoughness.metallicRoughnessTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),e.normalTexture&&e.normalTexture.gfxTexture&&e.normalTexture.gfxTexture.destroy(),e.emissionTexture&&e.emissionTexture.gfxTexture&&e.emissionTexture.gfxTexture.destroy(),e.occlusionTexture&&e.occlusionTexture.gfxTexture&&e.occlusionTexture.gfxTexture.destroy()));var e;if(t.children)for(const e of t.children)px(e);}class fx{constructor(t){this._callback=t,this._triggered=!1,\"undefined\"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback();});}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback();}),0));}remove(){this._channel=void 0,this._callback=()=>{};}}class dx{constructor(){this.tasks={},this.taskQueue=[],sr([\"process\"],this),this.invoker=new fx(this.process),this.nextId=0;}add(t,e){const r=this.nextId++,n=function({type:t,isSymbolTile:e,zoom:r}){return r=r||0,\"message\"===t?0:\"maybePrepare\"!==t||e?\"parseTile\"!==t||e?\"parseTile\"===t&&e?300-r:\"maybePrepare\"===t&&e?400-r:500:200-r:100-r}(e);if(0===n){mr();try{t();}finally{}return null}return this.tasks[r]={fn:t,metadata:e,priority:n,id:r},this.taskQueue.push(r),this.invoker.trigger(),{cancel:()=>{delete this.tasks[r];}}}process(){mr();try{if(this.taskQueue=this.taskQueue.filter((t=>!!this.tasks[t])),!this.taskQueue.length)return;const t=this.pick();if(null===t)return;const e=this.tasks[t];if(delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),!e)return;e.fn();}finally{}}pick(){let t=null,e=1/0;for(let r=0;r<this.taskQueue.length;r++){const n=this.tasks[this.taskQueue[r]];n.priority<e&&(e=n.priority,t=r);}if(null===t)return null;const r=this.taskQueue[t];return this.taskQueue.splice(t,1),r}remove(){this.invoker.remove();}}class mx{constructor(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.cancelCallbacks={},sr([\"receive\"],this),this.target.addEventListener(\"message\",this.receive,!1),this.scheduler=new dx;}send(t,e,r,n,i=!1,s){const a=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(r.metadata=s,this.callbacks[a]=r);const o=new Set;return this.target.postMessage({id:a,type:t,hasCallback:!!r,targetMapId:n,mustQueue:i,sourceMapId:this.mapId,data:go(e,o)},o),{cancel:()=>{r&&delete this.callbacks[a],this.target.postMessage({id:a,type:\"<cancel>\",targetMapId:n,sourceMapId:this.mapId});}}}receive(t){const e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(\"<cancel>\"===e.type){const t=this.cancelCallbacks[r];delete this.cancelCallbacks[r],t&&t.cancel();}else if(e.mustQueue||mr()){const t=this.callbacks[r],n=this.scheduler.add((()=>this.processTask(r,e)),t&&t.metadata||{type:\"message\"});n&&(this.cancelCallbacks[r]=n);}else this.processTask(r,e);}processTask(t,e){if(delete this.cancelCallbacks[t],\"<response>\"===e.type){const r=this.callbacks[t];delete this.callbacks[t],r&&(e.error?r(xo(e.error)):r(null,xo(e.data)));}else {const r=new Set,n=e.hasCallback?(e,n)=>{this.target.postMessage({id:t,type:\"<response>\",sourceMapId:this.mapId,error:e?go(e):null,data:go(n,r)},r);}:t=>{},i=xo(e.data);if(this.parent[e.type])this.parent[e.type](e.sourceMapId,i,n);else if(this.parent.getWorkerSource){const t=e.type.split(\".\");this.parent.getWorkerSource(e.sourceMapId,t[0],i.source,i.scope)[t[1]](i,n);}else n(new Error(`Could not find function ${e.type}`));}}remove(){this.scheduler.remove(),this.target.removeEventListener(\"message\",this.receive,!1);}}class yx{constructor(t,e){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=er();const r=this.workerPool.acquire(this.id);for(let t=0;t<r.length;t++){const n=new yx.Actor(r[t],e,this.id);n.name=`Worker ${t}`,this.actors.push(n);}this.ready=!1,this.broadcast(\"checkIfReady\",null,(()=>{this.ready=!0;}));}broadcast(t,e,r){He(this.actors,((r,n)=>{r.send(t,e,n);}),r=r||function(){});}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach((t=>{t.remove();})),this.actors=[],this.workerPool.release(this.id);}}yx.Actor=mx;var gx={workerUrl:\"\",workerClass:null,workerParams:void 0};function xx(){return null!=gx.workerClass?new gx.workerClass:new self.Worker(gx.workerUrl,gx.workerParams)}const bx=\"mapboxgl_preloaded_worker_pool\";class vx{constructor(){this.active={};}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<vx.workerCount;)this.workers.push(new xx);return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.workers&&0===this.numActive()&&(this.workers.forEach((t=>{t.terminate();})),this.workers=null);}isPreloaded(){return !!this.active[bx]}numActive(){return Object.keys(this.active).length}}let _x;function wx(){return _x||(_x=new vx),_x}vx.workerCount=2;let Mx,Ax,Sx,Ix,kx,Px=null;function Ex(){return mr()&&self.worker&&self.worker.dracoUrl?self.worker.dracoUrl:Ax||n.DRACO_URL}function zx(){if(mr()&&self.worker&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(Ix)return Ix;const t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if(\"object\"!=typeof WebAssembly)throw new Error(\"WebAssembly not supported, cannot instantiate meshoptimizer\");return Ix=WebAssembly.validate(t)?n.MESHOPT_SIMD_URL:n.MESHOPT_URL,Ix}const Tx={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Bx={5120:\"DT_INT8\",5121:\"DT_UINT8\",5122:\"DT_INT16\",5123:\"DT_UINT16\",5125:\"DT_UINT32\",5126:\"DT_FLOAT32\"},Cx={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function Rx(t,e,r){const n=r.json.bufferViews.length,i=r.buffers.length;e.bufferView=n,r.json.bufferViews[n]={buffer:i,byteLength:t.byteLength},r.buffers[i]=t;}const Vx=\"KHR_draco_mesh_compression\";function Dx(t,e){const r=t.extensions&&t.extensions[Vx];if(!r)return;const n=new Sx.Decoder,i=qx(e,r.bufferView),s=new Sx.Mesh;if(!n.DecodeArrayToMesh(i,i.byteLength,s))throw new Error(\"Failed to decode Draco mesh\");const a=e.json.accessors[t.indices],o=Tx[a.componentType],l=a.count*o.BYTES_PER_ELEMENT,u=Sx._malloc(l);o===Uint16Array?n.GetTrianglesUInt16Array(s,l,u):n.GetTrianglesUInt32Array(s,l,u),Rx(Sx.memory.buffer.slice(u,u+l),a,e),Sx._free(u);for(const i of Object.keys(r.attributes)){const a=n.GetAttributeByUniqueId(s,r.attributes[i]),o=e.json.accessors[t.attributes[i]],l=Bx[o.componentType],u=o.count*Cx[o.type]*Tx[o.componentType].BYTES_PER_ELEMENT,c=Sx._malloc(u);n.GetAttributeDataArrayForAllPoints(s,a,Sx[l],u,c),Rx(Sx.memory.buffer.slice(c,c+u),o,e),Sx._free(c);}n.destroy(),s.destroy(),delete t.extensions[Vx];}const Lx=\"EXT_meshopt_compression\";function Fx(t,e){if(!t.extensions||!t.extensions[Lx])return;const r=t.extensions[Lx],n=new Uint8Array(e.buffers[r.buffer],r.byteOffset||0,r.byteLength||0),i=new Uint8Array(r.count*r.byteStride);kx.decodeGltfBuffer(i,r.count,r.byteStride,n,r.mode,r.filter),t.buffer=e.buffers.length,t.byteOffset=0,e.buffers[t.buffer]=i.buffer,delete t.extensions[Lx];}const Ox=1179937895,Ux=new TextDecoder(\"utf8\");function Nx(t,e){return new URL(t,e).href}function jx(t,e,r,n){return fetch(Nx(t.uri,n)).then((t=>t.arrayBuffer())).then((t=>{e.buffers[r]=t;}))}function qx(t,e){const r=t.json.bufferViews[e];return new Uint8Array(t.buffers[r.buffer],r.byteOffset||0,r.byteLength)}function $x(t,e,r,n){if(t.uri){const i=Nx(t.uri,n);return fetch(i).then((t=>t.blob())).then((t=>createImageBitmap(t))).then((t=>{e.images[r]=t;}))}if(void 0!==t.bufferView){const n=qx(e,t.bufferView),i=new Blob([n],{type:t.mimeType});return createImageBitmap(i).then((t=>{e.images[r]=t;}))}}function Gx(t,e=0,r){const n={json:null,images:[],buffers:[]};if(new Uint32Array(t,e,1)[0]===Ox){const r=new Uint32Array(t,e);let i=2;const s=(r[i++]>>2)-3,a=r[i++]>>2;if(i++,n.json=JSON.parse(Ux.decode(r.subarray(i,i+a))),i+=a,i<s){const s=r[i++];i++;const a=e+(i<<2);n.buffers[0]=t.slice(a,a+s);}}else n.json=JSON.parse(Ux.decode(new Uint8Array(t,e)));const{buffers:i,images:s,meshes:a,extensionsUsed:o,bufferViews:l}=n.json;let u=Promise.resolve();if(i){const t=[];for(let e=0;e<i.length;e++){const s=i[e];s.uri?t.push(jx(s,n,e,r)):n.buffers[e]||(n.buffers[e]=null);}u=Promise.all(t);}return u.then((()=>{const t=[],e=o&&o.includes(Vx),i=o&&o.includes(Lx);if(e&&t.push(function(){if(!Sx)return Mx||(Mx=function(t){let e,r=null;function n(){e=new Uint8Array(r.buffer);}function i(){throw new Error(\"Unexpected Draco error.\")}const s={a:{a:i,d:function(t,r,n){return e.copyWithin(t,r,r+n)},c:function(t){const i=e.length,s=Math.max(t>>>0,Math.ceil(1.2*i)),a=Math.ceil((s-i)/65536);try{return r.grow(a),n(),!0}catch(t){return !1}},b:i}};return (WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(t,s):t.then((t=>t.arrayBuffer())).then((t=>WebAssembly.instantiate(t,s)))).then((t=>{const{Rb:i,Qb:s,P:a,T:o,X:l,Ja:u,La:c,Qa:h,Va:p,Wa:f,eb:d,jb:m,f:y,e:g,yb:x,zb:b,Ab:v,Bb:_,Db:w,Gb:M}=t.instance.exports;r=g;const A=(()=>{let t=0,r=0,n=0,a=0;return o=>{n&&(i(a),i(t),r+=n,n=t=0),t||(r+=128,t=s(r));const l=o.length+7&-8;let u=t;l>=r&&(n=l,u=a=s(l));for(let t=0;t<o.length;t++)e[u+t]=o[t];return u}})();return n(),y(),{memory:g,_free:i,_malloc:s,Mesh:class{constructor(){this.ptr=a();}destroy(){o(this.ptr);}},Decoder:class{constructor(){this.ptr=u();}destroy(){m(this.ptr);}DecodeArrayToMesh(t,e,r){const n=A(t),i=c(this.ptr,n,e,r.ptr);return !!l(i)}GetAttributeByUniqueId(t,e){return {ptr:h(this.ptr,t.ptr,e)}}GetTrianglesUInt16Array(t,e,r){p(this.ptr,t.ptr,e,r);}GetTrianglesUInt32Array(t,e,r){f(this.ptr,t.ptr,e,r);}GetAttributeDataArrayForAllPoints(t,e,r,n,i){d(this.ptr,t.ptr,e.ptr,r,n,i);}},DT_INT8:x(),DT_UINT8:b(),DT_INT16:v(),DT_UINT16:_(),DT_UINT32:w(),DT_FLOAT32:M()}}))}(fetch(Ex())),Mx.then((t=>{Sx=t,Mx=void 0;})))}()),i&&t.push(function(){if(kx)return;const t=function(t){let e;const r=WebAssembly.instantiateStreaming(t,{}).then((t=>{e=t.instance,e.exports.__wasm_call_ctors();})),n={NONE:\"\",OCTAHEDRAL:\"meshopt_decodeFilterOct\",QUATERNION:\"meshopt_decodeFilterQuat\",EXPONENTIAL:\"meshopt_decodeFilterExp\"},i={ATTRIBUTES:\"meshopt_decodeVertexBuffer\",TRIANGLES:\"meshopt_decodeIndexBuffer\",INDICES:\"meshopt_decodeIndexSequence\"};return {ready:r,supported:!0,decodeGltfBuffer(t,r,s,a,o,l){!function(t,e,r,n,i,s,a){const o=t.exports.sbrk,l=n+3&-4,u=o(l*i),c=o(s.length),h=new Uint8Array(t.exports.memory.buffer);h.set(s,c);const p=e(u,n,i,c,s.length);if(0===p&&a&&a(u,l,i),r.set(h.subarray(u,u+n*i)),o(u-o(0)),0!==p)throw new Error(`Malformed buffer data: ${p}`)}(e,e.exports[i[o]],t,r,s,a,e.exports[n[l]]);}}}(fetch(zx()));return t.ready.then((()=>{kx=t;}))}()),s)for(let e=0;e<s.length;e++)t.push($x(s[e],n,e,r));return (t.length?Promise.all(t):Promise.resolve()).then((()=>{if(e&&a)for(const{primitives:t}of a)for(const e of t)Dx(e,n);if(i&&a&&l)for(const t of l)Fx(t,n);return n}))}))}class Qx{constructor(t,e,r,n){if(this.triangleCount=e.length/3,this.min=new Ue(0,0),this.max=new Ue(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===t.length)return;const[i,s]=[t[0].clone(),t[0].clone()];for(let e=1;e<t.length;++e){const r=t[e];i.x=Math.min(i.x,r.x),i.y=Math.min(i.y,r.y),s.x=Math.max(s.x,r.x),s.y=Math.max(s.y,r.y);}if(n){const t=Math.ceil(Math.max(s.x-i.x,s.y-i.y)/n);r=Math.max(r,t);}if(0===r)return;this.min=i,this.max=s;const a=this.max.sub(this.min);a.x=Math.max(a.x,1),a.y=Math.max(a.y,1);const o=Math.max(a.x,a.y)/r;this.cellsX=Math.max(1,Math.ceil(a.x/o)),this.cellsY=Math.max(1,Math.ceil(a.y/o)),this.xScale=1/o,this.yScale=1/o;const l=[];for(let r=0;r<this.triangleCount;r++){const n=t[e[3*r+0]].sub(this.min),i=t[e[3*r+1]].sub(this.min),s=t[e[3*r+2]].sub(this.min),a=Yx(Math.floor(Math.min(n.x,i.x,s.x)),this.xScale,this.cellsX),u=Yx(Math.floor(Math.max(n.x,i.x,s.x)),this.xScale,this.cellsX),c=Yx(Math.floor(Math.min(n.y,i.y,s.y)),this.yScale,this.cellsY),h=Yx(Math.floor(Math.max(n.y,i.y,s.y)),this.yScale,this.cellsY),p=new Ue(0,0),f=new Ue(0,0),d=new Ue(0,0),m=new Ue(0,0);for(let t=c;t<=h;++t){p.y=f.y=t*o,d.y=m.y=(t+1)*o;for(let e=a;e<=u;++e)p.x=d.x=e*o,f.x=m.x=(e+1)*o,(eh(n,i,s,p,f,m)||eh(n,i,s,p,m,d))&&l.push({cellIdx:t*this.cellsX+e,triIdx:r});}}if(0===l.length)return;l.sort(((t,e)=>t.cellIdx-e.cellIdx||t.triIdx-e.triIdx));let u=0;for(;u<l.length;){const t=l[u].cellIdx,e={start:this.payload.length,len:0};for(;u<l.length&&l[u].cellIdx===t;)++e.len,this.payload.push(l[u++].triIdx);this.cells[t]=e;}}query(t,e,r){if(0===this.triangleCount||0===this.cells.length)return;if(t.x>this.max.x||this.min.x>e.x)return;if(t.y>this.max.y||this.min.y>e.y)return;this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8)));for(let t=0;t<this.lookup.length;t++)this.lookup[t]=0;const n=Yx(t.x-this.min.x,this.xScale,this.cellsX),i=Yx(e.x-this.min.x,this.xScale,this.cellsX),s=Yx(t.y-this.min.y,this.yScale,this.cellsY),a=Yx(e.y-this.min.y,this.yScale,this.cellsY);for(let t=s;t<=a;t++)for(let e=n;e<=i;e++){const n=this.cells[t*this.cellsX+e];if(n)for(let t=0;t<n.len;t++){const e=this.payload[n.start+t],i=Math.floor(e/8),s=1<<e%8;if(!(this.lookup[i]&s)&&(this.lookup[i]|=s,r.push(e),r.length===this.triangleCount))return}}}}function Yx(t,e,r){return Math.max(0,Math.min(r-1,Math.floor(t*e)))}function Xx(t,e){const r=t.json.bufferViews[e.bufferView],n=Tx[e.componentType];return new n(t.buffers[r.buffer],(e.byteOffset||0)+(r.byteOffset||0),e.count*(r.byteStride&&r.byteStride!==Cx[e.type]*n.BYTES_PER_ELEMENT?r.byteStride/n.BYTES_PER_ELEMENT:Cx[e.type]))}function Zx(t,e,r,n){const i=Tx[e.componentType],s=function(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(i),a=t.json.bufferViews[e.bufferView],o=a.byteStride?a.byteStride/i.BYTES_PER_ELEMENT:Cx[e.type],l=r.float32,u=l.length/r.capacity;for(let t=0,r=0;t<e.count*o;t+=o,r+=u)for(let e=0;e<u;e++)l[r+e]=n[t+e]*s;r._trim();}function Kx(t,e,r){const n=t.indices,i=t.attributes,s={};s.indexArray=new ql;const a=e.json.accessors[n],o=a.count/3;s.indexArray.reserve(o);const l=Xx(e,a);for(let t=0;t<o;t++)s.indexArray.emplaceBack(l[3*t],l[3*t+1],l[3*t+2]);s.indexArray._trim(),s.vertexArray=new Wl;const u=e.json.accessors[i.POSITION];s.vertexArray.reserve(u.count);const c=Xx(e,u);for(let t=0;t<u.count;t++)s.vertexArray.emplaceBack(c[3*t],c[3*t+1],c[3*t+2]);if(s.vertexArray._trim(),s.aabb=new mh(u.min,u.max),s.centroid=function(t,e){const r=[0,0,0],n=t.length;if(n>0){for(let i=0;i<n;i++){const n=3*t[i];r[0]+=e[n],r[1]+=e[n+1],r[2]+=e[n+2];}r[0]/=n,r[1]/=n,r[2]/=n;}return r}(l,c),void 0!==i.COLOR_0){const t=e.json.accessors[i.COLOR_0],r=Cx[t.type],n=Xx(e,t);s.colorArray=3===r?new Wl:new zl,s.colorArray.resize(t.count),Zx(e,t,s.colorArray,n);}if(void 0!==i.NORMAL){s.normalArray=new Wl;const t=e.json.accessors[i.NORMAL];s.normalArray.resize(t.count);const r=Xx(e,t);Zx(e,t,s.normalArray,r);}if(void 0!==i.TEXCOORD_0&&r.length>0){s.texcoordArray=new Tl;const t=e.json.accessors[i.TEXCOORD_0];s.texcoordArray.resize(t.count);const r=Xx(e,t);Zx(e,t,s.texcoordArray,r);}if(void 0!==i._FEATURE_ID_RGBA4444){const t=e.json.accessors[i._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes(\"EXT_meshopt_compression\")&&(s.featureData=Xx(e,t));}void 0!==i._FEATURE_RGBA4444&&(s.featureData=new Uint32Array(Xx(e,e.json.accessors[i._FEATURE_RGBA4444]).buffer));const h=t.material;return s.material=function(t,e){const{emissiveFactor:r=[0,0,0],alphaMode:n=\"OPAQUE\",alphaCutoff:i=.5,normalTexture:s,occlusionTexture:a,emissiveTexture:o,doubleSided:l}=t,{baseColorFactor:u=[1,1,1,1],metallicFactor:c=1,roughnessFactor:h=1,baseColorTexture:p,metallicRoughnessTexture:f}=t.pbrMetallicRoughness||{},d=a?e[a.index]:void 0;if(a&&a.extensions&&a.extensions.KHR_texture_transform&&d){const t=a.extensions.KHR_texture_transform;d.offsetScale=[t.offset[0],t.offset[1],t.scale[0],t.scale[1]];}return {pbrMetallicRoughness:{baseColorFactor:new jn(...u),metallicFactor:c,roughnessFactor:h,baseColorTexture:p?e[p.index]:void 0,metallicRoughnessTexture:f?e[f.index]:void 0},doubleSided:l,emissiveFactor:r,alphaMode:n,alphaCutoff:i,normalTexture:s?e[s.index]:void 0,occlusionTexture:d,emissionTexture:o?e[o.index]:void 0,defined:void 0===t.defined}}(void 0!==h?e.json.materials[h]:{defined:!1},r),s}function Wx(e,r,n){const{matrix:i,rotation:s,translation:a,scale:o,mesh:l,extras:u,children:c}=e,h={};if(h.matrix=i||t.a9.fromRotationTranslationScale([],s||[0,0,0,1],a||[0,0,0],o||[1,1,1]),void 0!==l){h.meshes=n[l];const t=h.anchor=[0,0];for(const e of h.meshes){const{min:r,max:n}=e.aabb;t[0]+=r[0]+n[0],t[1]+=r[1]+n[1];}t[0]=Math.floor(t[0]/h.meshes.length/2),t[1]=Math.floor(t[1]/h.meshes.length/2);}if(u&&(u.id&&(h.id=u.id),u.lights&&(h.lights=function(t){if(!t.length)return [];const e=function(t){const e=atob(t),r=new Uint8Array(e.length);for(let t=0;t<e.length;t++)r[t]=e.codePointAt(t);return r}(t),r=[],n=e.length/24,i=new Uint16Array(e.buffer),s=new Float32Array(e.buffer);for(let t=0;t<n;t++){const e=i[2*t*6]/30,n=i[2*t*6+1]/30,a=i[2*t*6+10]/100,o=s[6*t+1],l=s[6*t+2],u=s[6*t+3],c=s[6*t+4],h=u-o,p=c-l,f=Math.hypot(h,p);r.push({pos:[o+.5*h,l+.5*p,n],normal:[p/f,-h/f,0],width:f,height:e,depth:a,points:[o,l,u,c]});}return r}(u.lights))),c){const t=[];for(const e of c)t.push(Wx(r.json.nodes[e],r,n));h.children=t;}return h}function Hx(t){if(0===t.vertices.length||0===t.indices.length)return null;const e=new Qx(t.vertices,t.indices,8,256),[r,n]=[e.min.clone(),e.max.clone()];return {vertices:t.vertices,indices:t.indices,grid:e,min:r,max:n}}function Jx(t){if(!t.extras||!t.extras.ground)return null;const e=t.extras.ground;if(!e||!Array.isArray(e)||0===e.length)return null;const r=e[0];if(!r||!Array.isArray(r)||0===r.length)return null;const n=[];for(const t of r){if(!Array.isArray(t)||2!==t.length)continue;const e=t[0],r=t[1];\"number\"==typeof e&&\"number\"==typeof r&&n.push(new Ue(e,r));}if(n.length<3)return null;n.length>1&&n[n.length-1].equals(n[0])&&n.pop();let i=0;for(let t=0;t<n.length;t++){const e=n[t],r=n[(t+1)%n.length],s=n[(t+2)%n.length];i+=(e.x-r.x)*(s.y-r.y)-(s.x-r.x)*(e.y-r.y);}i>0&&n.reverse();const s=Op(n.flatMap((t=>[t.x,t.y])),[]);return 0===s.length?null:{vertices:n,indices:s}}function tb(e,r){const n=[],i=[];let s=0;const a=[];for(const o of e){s=n.length;const e=o.vertexArray.float32,l=o.indexArray.uint16;for(let i=0;i<o.vertexArray.length;i++)a[0]=e[3*i+0],a[1]=e[3*i+1],a[2]=e[3*i+2],t.Q.transformMat4(a,a,r),n.push(new Ue(a[0],a[1]));for(let t=0;t<3*o.indexArray.length;t++)i.push(l[t]+s);}if(i.length%3!=0)return null;for(let t=0;t<i.length;t+=3){const e=n[i[t+0]],r=n[i[t+1]],s=n[i[t+2]];(e.x-r.x)*(s.y-r.y)-(s.x-r.x)*(e.y-r.y)>0&&([i[t+1],i[t+2]]=[i[t+2],i[t+1]]);}return {vertices:n,indices:i}}function eb(t){const e=function(t,e){const r=[],n=WebGL2RenderingContext;if(t.json.textures)for(const i of t.json.textures){const s={magFilter:n.LINEAR,minFilter:n.NEAREST,wrapS:n.REPEAT,wrapT:n.REPEAT};void 0!==i.sampler&&Object.assign(s,t.json.samplers[i.sampler]),r.push({image:e[i.source],sampler:s,uploaded:!1});}return r}(t,t.images),r=function(t,e){const r=[];for(const n of t.json.meshes){const i=[];for(const r of n.primitives)i.push(Kx(r,t,e));r.push(i);}return r}(t,e),{scenes:n,scene:i,nodes:s}=t.json,a=n?n[i||0].nodes:s,o=[];for(const e of a)o.push(Wx(s[e],t,r));return function(t,e,r){const n={},i=new Set;for(let s=0;s<t.length;s++){const t=r[e[s]];if(!t.extras)continue;const a=t.extras[\"mapbox:footprint:version\"],o=t.extras[\"mapbox:footprint:id\"];(a||o)&&i.add(s),\"1.0.0\"===a&&o&&(n[o]=s);}for(let s=0;s<t.length;s++){if(i.has(s))continue;const a=t[s],o=r[e[s]];if(!o.extras)continue;let l=null;a.id in n&&(l=tb(t[n[a.id]].meshes,a.matrix)),l||(l=Jx(o)),l&&(a.footprint=Hx(l));}if(i.size>0){const e=Array.from(i.values()).sort(((t,e)=>t-e));for(let r=e.length-1;r>=0;r--)t.splice(e[r],1);}}(o,a,t.json.nodes),o}function rb(t){t.heightmap=new Float32Array(4096),t.heightmap.fill(-1);const e=t.vertexArray.float32,r=t.aabb.min[0]-1,n=t.aabb.min[1]-1,i=sx/(t.aabb.max[0]-r+2),s=sx/(t.aabb.max[1]-n+2);for(let a=0;a<e.length;a+=3){const o=e[a+2],l=(e[a+0]-r)*i|0,u=(e[a+1]-n)*s|0;o>t.heightmap[u*sx+l]&&(t.heightmap[u*sx+l]=o);}}function nb(e,r){const n={};n.indexArray=new ql,n.indexArray.reserve(4*e.length),n.vertexArray=new Wl,n.vertexArray.reserve(10*e.length),n.colorArray=new zl,n.vertexArray.reserve(10*e.length);let i=0;for(const s of e){const e=Math.min(10,Math.max(4,1.3*s.height))*r,a=[-s.normal[1],s.normal[0],0],o=Math.min(.29,.1*s.width/s.depth),l=s.width-2*s.depth*r*(o+.01),u=t.Q.scaleAndAdd([],s.pos,a,l/2),c=t.Q.scaleAndAdd([],s.pos,a,-l/2),h=[u[0],u[1],u[2]+s.height],p=[c[0],c[1],c[2]+s.height],f=t.Q.scaleAndAdd([],s.normal,a,o);t.Q.scale(f,f,e);const d=t.Q.scaleAndAdd([],s.normal,a,-o);t.Q.scale(d,d,e),t.Q.add(f,u,f),t.Q.add(d,c,d),u[2]+=.1,c[2]+=.1,n.vertexArray.emplaceBack(f[0],f[1],f[2]),n.vertexArray.emplaceBack(d[0],d[1],d[2]),n.vertexArray.emplaceBack(u[0],u[1],u[2]),n.vertexArray.emplaceBack(c[0],c[1],c[2]),n.vertexArray.emplaceBack(h[0],h[1],h[2]),n.vertexArray.emplaceBack(p[0],p[1],p[2]),n.vertexArray.emplaceBack(u[0],u[1],u[2]),n.vertexArray.emplaceBack(c[0],c[1],c[2]),n.vertexArray.emplaceBack(f[0],f[1],f[2]),n.vertexArray.emplaceBack(d[0],d[1],d[2]);const m=l/e/2;n.colorArray.emplaceBack(-m-o,-1,m,.8),n.colorArray.emplaceBack(m+o,-1,m,.8),n.colorArray.emplaceBack(-m,0,m,1.3),n.colorArray.emplaceBack(m,0,m,1.3),n.colorArray.emplaceBack(m+o,-.8,m,.7),n.colorArray.emplaceBack(m+o,-.8,m,.7),n.colorArray.emplaceBack(0,0,m,1.3),n.colorArray.emplaceBack(0,0,m,1.3),n.colorArray.emplaceBack(m+o,-1.2,m,.8),n.colorArray.emplaceBack(m+o,-1.2,m,.8),n.indexArray.emplaceBack(6+i,4+i,8+i),n.indexArray.emplaceBack(7+i,9+i,5+i),n.indexArray.emplaceBack(0+i,1+i,2+i),n.indexArray.emplaceBack(1+i,3+i,2+i),i+=10;}const s={defined:!0,emissiveFactor:[0,0,0]},a={};return a.baseColorFactor=jn.white,s.pbrMetallicRoughness=a,n.material=s,n.aabb=new mh([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),n}fo(Qx,\"TriangleGridIndex\");class ib{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r;}}encode(t){return this._stringToNumber[t]}decode(t){return this._numberToString[t]}}const sb=[\"tile\",\"layer\",\"source\",\"sourceLayer\",\"state\"];class ab{constructor(t,e,r,n,i){this.type=\"Feature\",this._vectorTileFeature=t,this._z=e,this._x=r,this._y=n,this.properties=t.properties,this.id=i;}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(t){this._geometry=t;}toJSON(){const t={type:\"Feature\",state:void 0,geometry:this.geometry,properties:this.properties};void 0!==this.id&&(t.id=this.id);for(const e of sb)void 0!==this[e]&&(t[e]=this[e]);return t}}class ob{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new ho(is,16,0),this.featureIndexArray=new hu,this.promoteId=e,this.is3DTile=!1;}insert(t,e,r,n,i,s=0,a=0){const o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,i,s);const l=this.grid;for(let t=0;t<e.length;t++){const r=e[t],n=[1/0,1/0,-1/0,-1/0];for(let t=0;t<r.length;t++){const e=r[t];n[0]=Math.min(n[0],e.x),n[1]=Math.min(n[1],e.y),n[2]=Math.max(n[2],e.x),n[3]=Math.max(n[3],e.y);}0!==a&&(n[0]-=a,n[1]-=a,n[2]+=a,n[3]+=a),n[0]<is&&n[1]<is&&n[2]>=0&&n[3]>=0&&l.insert(o,n[0],n[1],n[2],n[3]);}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new pf(new wm(this.rawTileData)).layers,this.sourceLayerCoder=new ib(this.vtLayers?Object.keys(this.vtLayers).sort():[\"_geojsonTileLayer\"]),this.vtFeatures={};for(const t in this.vtLayers)this.vtFeatures[t]=[];}return this.vtLayers}query(t,e,r,n){this.loadVTLayers();const i=t.params||{},s=nl(i.filter),a=t.tileResult,o=t.transform,l=a.bufferedTilespaceBounds,u=this.grid.query(l.min.x,l.min.y,l.max.x,l.max.y,((t,e,r,n)=>Hc(a.bufferedTilespaceGeometry,t,e,r,n)));u.sort(ub);let c=null;o.elevation&&u.length>0&&(c=Rf.create(o.elevation,this.tileID));const h={};let p;for(let l=0;l<u.length;l++){const f=u[l];if(f===p)continue;p=f;const d=this.featureIndexArray.get(f);let m=null;if(this.is3DTile){const t=this.bucketLayerIDs[0][0],r=e[t];if(\"model\"!==r.type)continue;const{queryFeature:n,intersectionZ:i}=r.queryIntersectsMatchingFeature(a,d.featureIndex,s,o);n&&this.appendToResult(h,t,d.featureIndex,n,i);}else this.loadMatchingFeature(h,d,s,i.layers,i.availableImages,e,r,n,((e,r,n,i=0)=>(m||(m=Lc(e,this.tileID.canonical,t.tileTransform)),r.queryIntersectsFeature(a,e,n,m,this.z,t.transform,t.pixelPosMatrix,c,i))));}return h}loadMatchingFeature(t,e,r,n,i,s,a,o,l){const{featureIndex:u,bucketIndex:c,sourceLayerIndex:h,layoutVertexArrayOffset:p}=e,f=this.bucketLayerIDs[c];if(n&&!function(t,e){for(let r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return !0;return !1}(n,f))return;const d=this.sourceLayerCoder.decode(h),m=this.vtLayers[d].feature(u);if(r.needGeometry){const t=Fc(m,!0);if(!r.filter(new Uo(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!r.filter(new Uo(this.tileID.overscaledZ),m))return;const y=this.getId(m,d);for(let e=0;e<f.length;e++){const r=f[e];if(n&&n.indexOf(r)<0)continue;const c=s[r];if(!c)continue;let h={};void 0!==y&&o&&(h=o.getState(c.sourceLayer||\"_geojsonTileLayer\",y));const d=!l||l(m,c,h,p);if(!d)continue;const g=new ab(m,this.z,this.x,this.y,y),x=Je({},a[r]);x.paint=lb(x.paint,c.paint,m,h,i),x.layout=lb(x.layout,c.layout,m,h,i),g.layer=x,this.appendToResult(t,r,u,g,d);}}appendToResult(t,e,r,n,i){let s=t[e];void 0===s&&(s=t[e]=[]),s.push({featureIndex:r,feature:n,intersectionZ:i});}lookupSymbolFeatures(t,e,r,n,i,s,a,o){const l={};this.loadVTLayers();const u=nl(i);for(const i of t)this.loadMatchingFeature(l,{bucketIndex:r,sourceLayerIndex:n,featureIndex:i,layoutVertexArrayOffset:0},u,s,a,o,e);return l}loadFeature(t){const{featureIndex:e,sourceLayerIndex:r}=t;this.loadVTLayers();const n=this.sourceLayerCoder.decode(r),i=this.vtFeatures[n];if(i[e])return i[e];const s=this.vtLayers[n].feature(e);return i[e]=s,s}hasLayer(t){for(const e of this.bucketLayerIDs)for(const r of e)if(t===r)return !0;return !1}getId(t,e){let r=t.id;if(this.promoteId){const n=\"string\"==typeof this.promoteId?this.promoteId:this.promoteId[e];null!=n&&(r=t.properties[n]),\"boolean\"==typeof r&&(r=Number(r));}return r}}function lb(t,e,r,n,i){return or(t,((t,s)=>{const a=e instanceof Xo?e.get(s):null;return a&&a.evaluate?a.evaluate(r,n,i):a}))}function ub(t,e){return e-t}fo(ob,\"FeatureIndex\",{omit:[\"rawTileData\",\"sourceLayerCoder\"]});const cb=new Float32Array(262144),hb=new Uint8Array(262144);function pb(t){let e=0;if(t.meshes)for(const r of t.meshes)e=Math.max(e,r.aabb.max[2]);if(t.children)for(const r of t.children)e=Math.max(e,pb(r));return e}function fb(t,e,r){if(t.meshes)for(const n of t.meshes)n.aabb.min[0]!==1/0&&r.insert(e,n.aabb.min[0],n.aabb.min[1],n.aabb.max[0],n.aabb.max[1]);if(t.children)for(const n of t.children)fb(n,e,r);}const db=[\"\",\"wall\",\"door\",\"roof\",\"window\",\"lamp\",\"logo\"];class mb{constructor(t){this.node=t,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.feature={type:\"Point\",id:t.id,geometry:[],properties:{height:pb(t)}};}getLocalBounds(){if(!this.node.meshes)return new mh([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let t=0;const e=new mh([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const r of this.node.meshes)this.node.lightMeshIndex!==t&&e.encapsulate(r.aabb),t++;this.aabb=mh.applyTransform(e,this.node.matrix);}return this.aabb}}class yb{constructor(t,e,r,n,i,s){this.id=e,this.modelTraits|=ax.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,r&&(this.modelTraits|=ax.HasMapboxMeshFeatures),n&&(this.modelTraits|=ax.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:\"mercator\"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=i,this.dirty=!0,this.needsUpload=!1,this.nodesInfo=[];for(const e of t)this.nodesInfo.push(new mb(e)),fb(e,s.featureIndexArray.length,s.grid),s.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,s.bucketLayerIDs.length-1,0);}update(){console.log(\"Update 3D model bucket\");}populate(){console.log(\"populate 3D model bucket\");}uploadPending(){return !this.uploaded||this.needsUpload}upload(t){if(!this.needsUpload)return;const e=this.getNodesInfo();for(const r of e){const e=r.node;this.uploaded?this.updatePbrBuffer(e):cx(e,t,!0);}for(const t of e)hx(t.node);this.uploaded=!0,this.needsUpload=!1;}updatePbrBuffer(t){let e=!1;if(!t.meshes)return e;for(const r of t.meshes)r.pbrBuffer&&(r.pbrBuffer.updateData(r.featureArray),e=!0);return e}needsReEvaluation(t,e,r){const n=t.transform.projectionOptions,i=t.style.getBrightness(),s=this.brightness!==i;return !!(!this.uploaded||this.dirty||n.name!==this.projection.name||gb(r.paint.get(\"model-color\").value,s)||gb(r.paint.get(\"model-color-mix-intensity\").value,s)||gb(r.paint.get(\"model-roughness\").value,s)||gb(r.paint.get(\"model-emissive-strength\").value,s)||gb(r.paint.get(\"model-height-based-emissive-strength-multiplier\").value,s))&&(this.projection=n,this.brightness=i,!0)}evaluateScale(t,e){if(t.transform.zoom===this.zoom)return;this.zoom=t.transform.zoom;const r=this.getNodesInfo(),n=this.id.canonical;for(const t of r){const r=t.feature;t.evaluatedScale=e.paint.get(\"model-scale\").evaluate(r,{},n);}}evaluate(t){const e=this.getNodesInfo();for(const r of e){if(!r.node.meshes)continue;const e=r.feature,n=r.node.meshes&&r.node.meshes[0].featureData,i=r.evaluatedColor[2],s=r.evaluatedRMEA[2],a=this.id.canonical;if(r.hasTranslucentParts=!1,n){for(let n=0;n<db.length;n++){const i=db[n];i.length&&(e.properties.part=i);const s=t.paint.get(\"model-color\").evaluate(e,{},a),o=t.paint.get(\"model-color-mix-intensity\").evaluate(e,{},a);r.evaluatedColor[n]=[s.r,s.g,s.b,o],r.evaluatedRMEA[n][0]=t.paint.get(\"model-roughness\").evaluate(e,{},a),r.evaluatedRMEA[n][2]=t.paint.get(\"model-emissive-strength\").evaluate(e,{},a),r.evaluatedRMEA[n][3]=s.a,r.emissionHeightBasedParams[n]=t.paint.get(\"model-height-based-emissive-strength-multiplier\").evaluate(e,{},a),!r.hasTranslucentParts&&s.a<1&&(r.hasTranslucentParts=!0);}delete e.properties.part,bb(r,i!==r.evaluatedColor[2]||s!==r.evaluatedRMEA[2],this.modelTraits);}else r.evaluatedRMEA[0][2]=t.paint.get(\"model-emissive-strength\").evaluate(e,{},a);r.evaluatedScale=t.paint.get(\"model-scale\").evaluate(e,{},a),this.updatePbrBuffer(r.node)||(this.needsUpload=!0);}this.dirty=!1;}elevationUpdate(t,e,r,n){const i=t.findDEMTileFor(r);if(i&&(i.tileID.canonical!==this.terrainTile||e!==this.terrainExaggeration)){if(i.dem&&i.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=i.tileID.overscaledZ;const e=Rf.create(t,r,i);if(!e)return;this.modelTraits&ax.HasMapboxMeshFeatures&&this.updateDEM(t,e,r,n);for(const t of this.getNodesInfo()){const r=t.node;if(!r.footprint||!r.footprint.vertices||!r.footprint.vertices.length)continue;const n=r.footprint.vertices;let i=e.getElevationAt(n[0].x,n[0].y,!0,!0);for(let t=1;t<n.length;t++)i=Math.min(i,e.getElevationAt(n[t].x,n[t].y,!0,!0));r.elevation=i;}}this.terrainTile=i.tileID.canonical,this.terrainExaggeration=e;}}updateDEM(t,e,r,n){let i=e._dem._modifiedForSources[n];if(void 0===i&&(e._dem._modifiedForSources[n]=[],i=e._dem._modifiedForSources[n]),i.includes(r.canonical))return;const s=e._dem.dim;i.push(r.canonical);let a=!1;for(const t of this.getNodesInfo()){const r=t.node;if(!r.footprint||!r.footprint.grid)continue;const n=r.footprint.grid,i=e.tileCoordToPixel(n.min.x,n.min.y),o=e.tileCoordToPixel(n.max.x,n.max.y),l=Math.min(Math.min(s-o.y,i.x),Math.min(i.y,s-o.x));if(l<0)continue;const u=Ze(l,2,5);let c=Math.max(0,i.x-u),h=Math.max(0,i.y-u),p=Math.min(o.x+u,s-1),f=Math.min(o.y+u,s-1);for(let t=h;t<=f;++t)for(let e=c;e<=p;++e)hb[t*s+e]=255;let d=0,m=0;for(let t=0;t<n.cellsY;++t)for(let r=0;r<n.cellsX;++r){if(!n.cells[t*n.cellsX+r])continue;const i=e.tileCoordToPixel(n.min.x+r/n.xScale,n.min.y+t/n.yScale),a=e.tileCoordToPixel(n.min.x+(r+1)/n.xScale,n.min.y+(t+1)/n.yScale);for(let t=i.y;t<=Math.min(a.y+1,s-1);++t)for(let r=i.x;r<=Math.min(a.x+1,s-1);++r)255===hb[t*s+r]&&(hb[t*s+r]=0,d+=e.getElevationAtPixel(r,t),m++);}const y=d/m;c=Math.max(1,i.x-u),h=Math.max(1,i.y-u),p=Math.min(o.x+u,s-2),f=Math.min(o.y+u,s-2),a=!0;for(let t=h;t<=f;++t)for(let r=c;r<=p;++r)0===hb[t*s+r]&&(cb[t*s+r]=e._dem.set(r,t,y));for(let t=1;t<u;++t){c=Math.max(1,i.x-t),h=Math.max(1,i.y-t),p=Math.min(o.x+t,s-2),f=Math.min(o.y+t,s-2);for(let r=h;r<=f;++r)for(let n=c;n<=p;++n){const i=r*s+n;if(255===hb[i]){let a=0,o=0,l=-1,c=-1;for(let e=-1;e<=1;++e)for(let i=-1;i<=1;++i){const u=(r+e)*s+n+i;if(hb[u]>=t)continue;const h=cb[u],p=Math.abs(h);p>o&&(a=h,o=p,l=i,c=e);}if(o>.1){const s=1-(t+.5*Math.abs(l*c))/u;let o=e._dem.get(n,r)+a*s;const h=e._dem.get(n+l,r+c),p=e._dem.get(n-l,r-c,!0);(o-h)*(o-p)>0&&(o=(h+p)/2),cb[i]=e._dem.set(n,r,o),hb[i]=t;}}}}}a&&(e._demTile.needsDEMTextureUpload=!0,e._dem._timestamp=Tr.now());}getNodesInfo(){return this.nodesInfo}destroy(){const t=this.getNodesInfo();for(const e of t)hx(e.node),px(e.node);}isEmpty(){return !this.nodesInfo.length}updateReplacement(t,e){if(e.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=e.updateTime;const r=e.getReplacementRegionsForTile(t.toUnwrapped()),n=this.getNodesInfo();for(let t=0;t<this.nodesInfo.length;t++){const e=n[t].node;n[t].hiddenByReplacement=!!e.footprint&&!r.find((t=>t.footprint===e.footprint));}}getHeightAtTileCoord(e,r){const n=this.getNodesInfo(),i=[],s=[0,0,0];for(let a=0;a<this.nodesInfo.length;a++){const o=n[a],l=o.node.meshes[0],u=mh.applyTransform(l.aabb,o.node.matrix);if(e<u.min[0]||r<u.min[1]||e>u.max[0]||r>u.max[1])continue;const c=(e-l.aabb.min[0])/(l.aabb.max[0]-l.aabb.min[0])*sx|0,h=Math.min(63,(r-l.aabb.min[1])/(l.aabb.max[1]-l.aabb.min[1])*sx|0)*sx+Math.min(63,c);if(s[2]=l.heightmap[h],t.Q.transformMat4(s,s,o.node.matrix),!(l.heightmap[h]<0&&o.node.footprint)){if(o.hiddenByReplacement)return;return {height:s[2],maxHeight:o.feature.properties.height,hidden:!1,verticalScale:o.evaluatedScale[2]}}if(o.node.footprint.grid.query(new Ue(e,r),new Ue(e,r),i),i.length>0)return {height:void 0,maxHeight:o.feature.properties.height,hidden:o.hiddenByReplacement,verticalScale:o.evaluatedScale[2]}}}}function gb(t,e){return !t.isLightConstant&&e}function xb(t,e,r,n,i,s,a,o){let l=(61440&e|(61440&e)>>4)>>8,u=(3840&e|(3840&e)>>4)>>4,c=240&e|(240&e)>>4;r[3]>0&&(l=qn(l,255*r[0],r[3]),u=qn(u,255*r[1],r[3]),c=qn(c,255*r[2],r[3]));const h=l<<8|u,p=c<<8|Math.floor(255*n[3]),f=function(t){const e=Ze(t,0,2);return Math.min(Math.round(.5*e*255),255)}(n[2])<<8|15*n[0]<<4|15*n[1],d=Ze(i[0],0,1),m=Ze(i[1],0,1),y=Ze(i[2],0,1),g=Ze(i[3],0,1);let x,b,v,_;if(d!==m&&a!==s&&m!==d){const t=a-s;b=1/(t*(m-d)),v=-(s+t*d)/(t*(m-d));const e=Ze(i[4],-1,1);_=Math.pow(10,e),x=255*y<<8|255*g;}else x=65535,b=0,v=1,_=1;if(t.emplaceBack(h,p,f,x,b,v,_),o){const t=o.length;o.clear();for(let e=0;e<t;e++)o.emplaceBack(h,p,f,x,b,v,_);}}function bb(t,e,r){const n=t.node;let i=0;const s=r&ax.HasMeshoptCompression;for(const r of n.meshes){if(n.lights&&n.lightMeshIndex===i)continue;if(!r.featureData)continue;r.featureArray=new Jl,r.featureArray.reserve(r.featureData.length);let a=e;for(const e of r.featureData){const i=s?65535&e:e>>16&65535,o=s?e>>16&65535:65535&e,l=(15&o)<8?15&o:0,u=t.evaluatedRMEA[l],c=t.evaluatedColor[l],h=t.emissionHeightBasedParams[l];let p;if(a&&2===l&&n.lights&&(p=new Jl,p.resize(10*n.lights.length)),xb(r.featureArray,i,c,u,h,r.aabb.min[2],r.aabb.max[2],p),p&&a){a=!1;const t=n.meshes[n.lightMeshIndex];t.featureArray=p,t.featureArray._trim();}}r.featureArray._trim(),i++;}}function vb(t,e,r,n){const i=1<<t.z;e.lat=wc((n/is+t.y)/i),e.lng=_c((r/is+t.x)/i);}fo(yb,\"Tiled3dModelBucket\",{omit:[\"layers\"]}),fo(mb,\"Tiled3dModelFeature\");const _b={circle:class extends bl{constructor(t,e,r){super(t,oh,e,r);}createBucket(t){return new Nc(t)}queryRadius(t){const e=t;return rh(\"circle-radius\",this,e)+rh(\"circle-stroke-width\",this,e)+nh(this.paint.get(\"circle-translate\"))}queryIntersectsFeature(t,e,r,n,i,s,a,o){const l=sh(this.paint.get(\"circle-translate\"),this.paint.get(\"circle-translate-anchor\"),s.angle,t.pixelToTileUnitsFactor),u=this.paint.get(\"circle-radius\").evaluate(e,r)+this.paint.get(\"circle-stroke-width\").evaluate(e,r);return Yh(t,n,s,a,o,\"map\"===this.paint.get(\"circle-pitch-alignment\"),\"map\"===this.paint.get(\"circle-pitch-scale\"),l,u)}getProgramIds(){return [\"circle\"]}getDefaultProgramParams(t,e){const r=Qh(this);return {config:new Nu(this,e),defines:r,overrideFog:!1}}},heatmap:class extends bl{createBucket(t){return new Hh(t)}constructor(t,e,r){super(t,ap,e,r),this._updateColorRamp();}_handleSpecialPaintPropertyUpdate(t){\"heatmap-color\"===t&&this._updateColorRamp();}_updateColorRamp(){this.colorRamp=op({expression:this._transitionablePaint._values[\"heatmap-color\"].value.expression,evaluationKey:\"heatmapDensity\",image:this.colorRamp}),this.colorRampTexture=null;}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null);}queryRadius(t){return rh(\"heatmap-radius\",this,t)}queryIntersectsFeature(t,e,r,n,i,s,a,o){const l=this.paint.get(\"heatmap-radius\").evaluate(e,r);return Yh(t,n,s,a,o,!0,!0,new Ue(0,0),l)}hasOffscreenPass(){return 0!==this.paint.get(\"heatmap-opacity\")&&\"none\"!==this.visibility}getProgramIds(){return [\"heatmap\",\"heatmapTexture\"]}getDefaultProgramParams(t,e){return \"heatmap\"===t?{config:new Nu(this,e),overrideFog:!1}:{}}},hillshade:class extends bl{constructor(t,e,r){super(t,up,e,r);}hasOffscreenPass(){return 0!==this.paint.get(\"hillshade-exaggeration\")&&\"none\"!==this.visibility}getProgramIds(){return [\"hillshade\",\"hillshadePrepare\"]}getDefaultProgramParams(t,e){return {overrideFog:!1}}},fill:class extends bl{constructor(t,e,r){super(t,Qp,e,r);}getProgramIds(){const t=this.paint.get(\"fill-pattern\"),e=t&&t.constantOr(1),r=[e?\"fillPattern\":\"fill\"];return this.paint.get(\"fill-antialias\")&&r.push(e&&!this.getPaintProperty(\"fill-outline-color\")?\"fillOutlinePattern\":\"fillOutline\"),r}getDefaultProgramParams(t,e){return {config:new Nu(this,e),overrideFog:!1}}recalculate(t,e){super.recalculate(t,e);const r=this.paint._values[\"fill-outline-color\"];\"constant\"===r.value.kind&&void 0===r.value.value&&(this.paint._values[\"fill-outline-color\"]=this.paint._values[\"fill-color\"]);}createBucket(t){return new $p(t)}queryRadius(){return nh(this.paint.get(\"fill-translate\"))}queryIntersectsFeature(t,e,r,n,i,s){return !t.queryGeometry.isAboveHorizon&&$c(ih(t.tilespaceGeometry,this.paint.get(\"fill-translate\"),this.paint.get(\"fill-translate-anchor\"),s.angle,t.pixelToTileUnitsFactor),n)}isTileClipped(){return !0}},\"fill-extrusion\":class extends bl{constructor(t,e,r){super(t,cd,e,r),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0};}createBucket(t){return new Hf(t)}queryRadius(){return nh(this.paint.get(\"fill-extrusion-translate\"))}is3D(){return !0}hasShadowPass(){return !0}cutoffRange(){return this.paint.get(\"fill-extrusion-cutoff-fade-range\")}canCastShadows(){return !0}getProgramIds(){return [this.paint.get(\"fill-extrusion-pattern\").constantOr(1)?\"fillExtrusionPattern\":\"fillExtrusion\"]}queryIntersectsFeature(e,r,n,i,s,a,o,l,u){const c=sh(this.paint.get(\"fill-extrusion-translate\"),this.paint.get(\"fill-extrusion-translate-anchor\"),a.angle,e.pixelToTileUnitsFactor),h=this.paint.get(\"fill-extrusion-height\").evaluate(r,n),p=this.paint.get(\"fill-extrusion-base\").evaluate(r,n),f=[0,0],d=l&&a.elevation,m=a.elevation?a.elevation.exaggeration():1,y=e.tile.getBucket(this);if(d&&y instanceof Hf){const t=y.centroidVertexArray,e=u+1;e<t.length&&(f[0]=t.geta_centroid_pos0(e),f[1]=t.geta_centroid_pos1(e));}if(0===f[0]&&1===f[1])return !1;\"globe\"===a.projection.name&&(i=od([i],[new Ue(0,0),new Ue(is,is)],e.tileID.canonical).map((t=>t.polygon)).flat());const g=d?l:null,[x,b]=function(e,r,n,i,s,a,o,l,u,c,h){return \"globe\"===e.projection.name?function(e,r,n,i,s,a,o,l,u,c,h){const p=[],f=[],d=e.projection.upVectorScale(h,e.center.lat,e.worldSize).metersToTile,m=[0,0,0,1],y=[0,0,0,1],g=(t,e,r,n)=>{t[0]=e,t[1]=r,t[2]=n,t[3]=1;},x=ad();n>0&&(n+=x),i+=x;for(const x of r){const r=[],b=[];for(const p of x){const f=p.x+s.x,x=p.y+s.y,v=e.projection.projectTilePoint(f,x,h),_=e.projection.upVector(h,p.x,p.y);let w=n,M=i;if(o){const t=dd(f,x,n,i,o,l,u,c);w+=t.base,M+=t.top;}0!==n?g(m,v.x+_[0]*d*w,v.y+_[1]*d*w,v.z+_[2]*d*w):g(m,v.x,v.y,v.z),g(y,v.x+_[0]*d*M,v.y+_[1]*d*M,v.z+_[2]*d*M),t.Q.transformMat4(m,m,a),t.Q.transformMat4(y,y,a),r.push(new hd(m[0],m[1],m[2])),b.push(new hd(y[0],y[1],y[2]));}p.push(r),f.push(b);}return [p,f]}(e,r,n,i,s,a,o,l,u,c,h):o?function(e,r,n,i,s,a,o,l,u){const c=[],h=[],p=[0,0,0,1];for(const f of e){const e=[],d=[];for(const c of f){const h=c.x+i.x,f=c.y+i.y,m=dd(h,f,r,n,a,o,l,u);p[0]=h,p[1]=f,p[2]=m.base,p[3]=1,t.aa.transformMat4(p,p,s),p[3]=Math.max(p[3],1e-5);const y=new hd(p[0]/p[3],p[1]/p[3],p[2]/p[3]);p[0]=h,p[1]=f,p[2]=m.top,p[3]=1,t.aa.transformMat4(p,p,s),p[3]=Math.max(p[3],1e-5);const g=new hd(p[0]/p[3],p[1]/p[3],p[2]/p[3]);e.push(y),d.push(g);}c.push(e),h.push(d);}return [c,h]}(r,n,i,s,a,o,l,u,c):function(t,e,r,n,i){const s=[],a=[],o=i[8]*e,l=i[9]*e,u=i[10]*e,c=i[11]*e,h=i[8]*r,p=i[9]*r,f=i[10]*r,d=i[11]*r;for(const e of t){const t=[],r=[];for(const s of e){const e=s.x+n.x,a=s.y+n.y,m=i[0]*e+i[4]*a+i[12],y=i[1]*e+i[5]*a+i[13],g=i[2]*e+i[6]*a+i[14],x=i[3]*e+i[7]*a+i[15],b=m+o,v=y+l,_=g+u,w=Math.max(x+c,1e-5),M=m+h,A=y+p,S=g+f,I=Math.max(x+d,1e-5);t.push(new hd(b/w,v/w,_/w)),r.push(new hd(M/I,A/I,S/I));}s.push(t),a.push(r);}return [s,a]}(r,n,i,s,a)}(a,i,p,h,c,o,g,f,m,a.center.lat,e.tileID.canonical),v=e.queryGeometry;return function(t,e,r){let n=1/0;$c(r,e)&&(n=fd(r,e[0]));for(let i=0;i<e.length;i++){const s=e[i],a=t[i];for(let t=0;t<s.length-1;t++){const e=s[t],i=[e,s[t+1],a[t+1],a[t],e];jc(r,i)&&(n=Math.min(n,fd(r,i)));}}return n!==1/0&&n}(x,b,v.isPointQuery()?v.screenBounds:v.screenGeometry)}},line:class extends bl{constructor(t,e,r){super(t,kd,e,r),this.gradientVersion=0;}_handleSpecialPaintPropertyUpdate(t){if(\"line-gradient\"===t){const t=this._transitionablePaint._values[\"line-gradient\"].value.expression;this.stepInterpolant=t._styleExpression&&t._styleExpression.expression instanceof Qs,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER;}}gradientExpression(){return this._transitionablePaint._values[\"line-gradient\"].value.expression}widthExpression(){return this._transitionablePaint._values[\"line-width\"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values[\"line-floorwidth\"]=Cd.possiblyEvaluate(this._transitioningPaint._values[\"line-width\"].value,t);}createBucket(t){return new Sd(t)}getProgramIds(){return [this.paint.get(\"line-pattern\").constantOr(1)?\"linePattern\":\"line\"]}getDefaultProgramParams(t,e){const r=Td(this);return {config:new Nu(this,e),defines:r,overrideFog:!1}}queryRadius(t){const e=t,r=Rd(rh(\"line-width\",this,e),rh(\"line-gap-width\",this,e)),n=rh(\"line-offset\",this,e);return r/2+Math.abs(n)+nh(this.paint.get(\"line-translate\"))}queryIntersectsFeature(t,e,r,n,i,s){if(t.queryGeometry.isAboveHorizon)return !1;const a=ih(t.tilespaceGeometry,this.paint.get(\"line-translate\"),this.paint.get(\"line-translate-anchor\"),s.angle,t.pixelToTileUnitsFactor),o=t.pixelToTileUnitsFactor/2*Rd(this.paint.get(\"line-width\").evaluate(e,r),this.paint.get(\"line-gap-width\").evaluate(e,r)),l=this.paint.get(\"line-offset\").evaluate(e,r);return l&&(n=function(t,e){const r=[],n=new Ue(0,0);for(let i=0;i<t.length;i++){const s=t[i],a=[];for(let t=0;t<s.length;t++){const r=s[t],i=s[t+1],o=0===t?n:r.sub(s[t-1])._unit()._perp(),l=t===s.length-1?n:i.sub(r)._unit()._perp(),u=o._add(l)._unit();u._mult(1/(u.x*l.x+u.y*l.y)),a.push(u._mult(e)._add(r));}r.push(a);}return r}(n,l*t.pixelToTileUnitsFactor)),function(t,e,r){for(let n=0;n<e.length;n++){const i=e[n];if(t.length>=3)for(let e=0;e<i.length;e++)if(Wc(t,i[e]))return !0;if(Gc(t,i,r))return !0}return !1}(a,n,o)}isTileClipped(){return !0}},symbol:fg,background:class extends bl{constructor(t,e,r){super(t,mg,e,r);}getProgramIds(){return [this.paint.get(\"background-pattern\")?\"backgroundPattern\":\"background\"]}getDefaultProgramParams(t,e){return {overrideFog:!1}}},raster:Ig,\"raster-particle\":Eg,sky:class extends bl{constructor(t,e,r){super(t,Bg,e,r),this._updateColorRamp();}_handleSpecialPaintPropertyUpdate(t){\"sky-gradient\"===t?this._updateColorRamp():\"sky-atmosphere-sun\"!==t&&\"sky-atmosphere-halo-color\"!==t&&\"sky-atmosphere-color\"!==t&&\"sky-atmosphere-sun-intensity\"!==t||(this._skyboxInvalidated=!0);}_updateColorRamp(){this.colorRamp=op({expression:this._transitionablePaint._values[\"sky-gradient\"].value.expression,evaluationKey:\"skyRadialProgress\"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null);}needsSkyboxCapture(t){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return !0;if(!this.paint.get(\"sky-atmosphere-sun\")){const e=t.style.light.properties.get(\"position\");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return !1}getCenter(t,e){if(\"atmosphere\"===this.paint.get(\"sky-type\")){const r=this.paint.get(\"sky-atmosphere-sun\"),n=!r,i=t.style.light,s=i.properties.get(\"position\");return n&&\"viewport\"===i.properties.get(\"anchor\")&&hr(\"The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly.\"),n?Cg(s.azimuthal,90-s.polar,e):Cg(r[0],90-r[1],e)}const r=this.paint.get(\"sky-gradient-center\");return Cg(r[0],90-r[1],e)}isSky(){return !0}markSkyboxValid(t){this._skyboxInvalidated=!1,this._lightPosition=t.style.light.properties.get(\"position\");}hasOffscreenPass(){return !0}getProgramIds(){const t=this.paint.get(\"sky-type\");return \"atmosphere\"===t?[\"skyboxCapture\",\"skybox\"]:\"gradient\"===t?[\"skyboxGradient\"]:null}},slot:class extends bl{constructor(t,e,r){super(t,Rg,e);}},model:class extends bl{constructor(t,e,r){super(t,ix,e,r),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0};}createBucket(t){return new rx(t)}getProgramIds(){return [\"model\"]}is3D(){return !0}hasShadowPass(){return !0}canCastShadows(){return !0}hasLightBeamPass(){return !0}cutoffRange(){return this.paint.get(\"model-cutoff-fade-range\")}queryRadius(t){return t instanceof yb?is-1:0}queryIntersectsFeature(e,r,n,i,s,a){if(!this.modelManager)return !1;const o=this.modelManager,l=e.tile.getBucket(this);if(!(l&&l instanceof rx))return !1;const u=l;for(const n in u.instancesPerModel){const i=u.instancesPerModel[n],s=void 0!==r.id?r.id:r.properties&&r.properties.hasOwnProperty(\"id\")?r.properties.id:void 0;if(i.idToFeaturesIndex.hasOwnProperty(s)){const r=i.features[i.idToFeaturesIndex[s]],l=o.getModel(n,this.scope);if(!l)return !1;let c=t.a9.create();const h=new ac(0,0),p=u.canonical;let f=Number.MAX_VALUE;for(let n=0;n<r.instancedDataCount;++n){const s=16*(r.instancedDataOffset+n),o=i.instancedDataArray.float32,u=[o[s+4],o[s+5],o[s+6]];vb(p,h,o[s],0|o[s+1]),ox(c,l,a,h,r.rotation,r.scale,u,!1,!1,!1),\"globe\"===a.projection.name&&(c=qg(c,a));const d=t.a9.multiply([],a.projMatrix,c),m=e.queryGeometry,y=$g(m.isPointQuery()?m.screenBounds:m.screenGeometry,a,d,l.aabb);null!=y&&(f=Math.min(y,f));}return f!==Number.MAX_VALUE&&f}}return !1}_handleOverridablePaintPropertyUpdate(t,e,r){return !(!this.layout||e.isDataDriven()||r.isDataDriven()||\"model-color\"!==t&&\"model-color-mix-intensity\"!==t&&\"model-rotation\"!==t&&\"model-scale\"!==t&&\"model-translation\"!==t&&\"model-emissive-strength\"!==t)}_isPropertyZoomDependent(t){const e=this._transitionablePaint._values[t];return null!=e&&null!=e.value&&null!=e.value.expression&&e.value.expression instanceof io}isZoomDependent(){return this._isPropertyZoomDependent(\"model-scale\")||this._isPropertyZoomDependent(\"model-rotation\")||this._isPropertyZoomDependent(\"model-translation\")}queryIntersectsMatchingFeature(e,r,n,i){const s=e.tile,a=s.getBucket(this);let o=null,l=Number.MAX_VALUE;if(!(a&&a instanceof yb))return {queryFeature:o,intersectionZ:l};const u=a.getNodesInfo()[r];if(u.hiddenByReplacement||!u.node.meshes||!n.filter(new Uo(s.tileID.overscaledZ),u.feature,s.tileID.canonical))return {queryFeature:o,intersectionZ:l};const c=u.node,h=i.calculatePosMatrix(s.tileID.toUnwrapped(),i.worldSize),p=u.evaluatedScale;let f=0;i.elevation&&c.elevation&&(f=c.elevation*i.elevation.exaggeration()),t.a9.translate(h,h,[(c.anchor?c.anchor[0]:0)*(p[0]-1),(c.anchor?c.anchor[1]:0)*(p[1]-1),f]),t.a9.scale(h,h,p),t.a9.multiply(h,h,c.matrix);const d=e.queryGeometry,m=d.isPointQuery()?d.screenBounds:d.screenGeometry,y=function(e){const r=t.a9.multiply([],h,e.matrix),n=t.a9.multiply(r,i.expandedFarZProjMatrix,r);for(let t=0;t<e.meshes.length;++t){const r=e.meshes[t];if(t===e.lightMeshIndex)continue;const s=$g(m,i,n,r.aabb);null!=s&&(l=Math.min(s,l));}if(e.children)for(const t of e.children)y(t);};if(y(c),l===Number.MAX_VALUE)return {queryFeature:o,intersectionZ:l};const g=new ac(0,0);return vb(s.tileID.canonical,g,u.node.anchor[0],u.node.anchor[1]),o={type:\"Feature\",geometry:{type:\"Point\",coordinates:[g.lng,g.lat]},properties:u.feature.properties,id:u.feature.id,state:{},layer:this.serialize()},{queryFeature:o,intersectionZ:l}}}},wb={read:function(t,e){return t.readFields(wb._readField,{header_length:0,x:0,y:0,z:0,layers:[]},e)},_readField:function(t,e,r){1===t?e.header_length=r.readFixed32():2===t?e.x=r.readVarint():3===t?e.y=r.readVarint():4===t?e.z=r.readVarint():5===t&&e.layers.push(wb.Layer.read(r,r.readVarint()+r.pos));},PixelFormat:{PIXEL_FORMAT_UNKNOWN:{value:0,options:{}},PIXEL_FORMAT_UINT32:{value:1,options:{}},PIXEL_FORMAT_UINT16:{value:2,options:{}},PIXEL_FORMAT_UINT8:{value:3,options:{}}},Filter:{}};wb.Filter.read=function(t,e){return t.readFields(wb.Filter._readField,{delta_filter:null,filter:null,zigzag_filter:null,bitshuffle_filter:null,byteshuffle_filter:null},e)},wb.Filter._readField=function(t,e,r){1===t?(e.delta_filter=wb.Filter.Delta.read(r,r.readVarint()+r.pos),e.filter=\"delta_filter\"):2===t?(e.zigzag_filter=wb.Filter.Zigzag.read(r,r.readVarint()+r.pos),e.filter=\"zigzag_filter\"):3===t?(e.bitshuffle_filter=wb.Filter.BitShuffle.read(r,r.readVarint()+r.pos),e.filter=\"bitshuffle_filter\"):4===t&&(e.byteshuffle_filter=wb.Filter.ByteShuffle.read(r,r.readVarint()+r.pos),e.filter=\"byteshuffle_filter\");},wb.Filter.Delta={},wb.Filter.Delta.read=function(t,e){return t.readFields(wb.Filter.Delta._readField,{block_size:0},e)},wb.Filter.Delta._readField=function(t,e,r){1===t&&(e.block_size=r.readVarint());},wb.Filter.Zigzag={},wb.Filter.Zigzag.read=function(t,e){return t.readFields(wb.Filter.Zigzag._readField,{},e)},wb.Filter.Zigzag._readField=function(t,e,r){},wb.Filter.BitShuffle={},wb.Filter.BitShuffle.read=function(t,e){return t.readFields(wb.Filter.BitShuffle._readField,{},e)},wb.Filter.BitShuffle._readField=function(t,e,r){},wb.Filter.ByteShuffle={},wb.Filter.ByteShuffle.read=function(t,e){return t.readFields(wb.Filter.ByteShuffle._readField,{},e)},wb.Filter.ByteShuffle._readField=function(t,e,r){},wb.Codec={},wb.Codec.read=function(t,e){return t.readFields(wb.Codec._readField,{gzip_data:null,codec:null,jpeg_image:null,webp_image:null,png_image:null},e)},wb.Codec._readField=function(t,e,r){1===t?(e.gzip_data=wb.Codec.GzipData.read(r,r.readVarint()+r.pos),e.codec=\"gzip_data\"):2===t?(e.jpeg_image=wb.Codec.JpegImage.read(r,r.readVarint()+r.pos),e.codec=\"jpeg_image\"):3===t?(e.webp_image=wb.Codec.WebpImage.read(r,r.readVarint()+r.pos),e.codec=\"webp_image\"):4===t&&(e.png_image=wb.Codec.PngImage.read(r,r.readVarint()+r.pos),e.codec=\"png_image\");},wb.Codec.GzipData={},wb.Codec.GzipData.read=function(t,e){return t.readFields(wb.Codec.GzipData._readField,{},e)},wb.Codec.GzipData._readField=function(t,e,r){},wb.Codec.JpegImage={},wb.Codec.JpegImage.read=function(t,e){return t.readFields(wb.Codec.JpegImage._readField,{},e)},wb.Codec.JpegImage._readField=function(t,e,r){},wb.Codec.WebpImage={},wb.Codec.WebpImage.read=function(t,e){return t.readFields(wb.Codec.WebpImage._readField,{},e)},wb.Codec.WebpImage._readField=function(t,e,r){},wb.Codec.PngImage={},wb.Codec.PngImage.read=function(t,e){return t.readFields(wb.Codec.PngImage._readField,{},e)},wb.Codec.PngImage._readField=function(t,e,r){},wb.DataIndexEntry={},wb.DataIndexEntry.read=function(t,e){return t.readFields(wb.DataIndexEntry._readField,{first_byte:0,last_byte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},e)},wb.DataIndexEntry._readField=function(t,e,r){1===t?e.first_byte=r.readFixed64():2===t?e.last_byte=r.readFixed64():3===t?e.filters.push(wb.Filter.read(r,r.readVarint()+r.pos)):4===t?e.codec=wb.Codec.read(r,r.readVarint()+r.pos):5===t?e.offset=r.readFloat():6===t?e.scale=r.readFloat():7===t&&e.bands.push(r.readString());},wb.Layer={},wb.Layer.read=function(t,e){return t.readFields(wb.Layer._readField,{version:0,name:\"\",units:\"\",tilesize:0,buffer:0,pixel_format:0,data_index:[]},e)},wb.Layer._readField=function(t,e,r){1===t?e.version=r.readVarint():2===t?e.name=r.readString():3===t?e.units=r.readString():4===t?e.tilesize=r.readVarint():5===t?e.buffer=r.readVarint():6===t?e.pixel_format=r.readVarint():7===t&&e.data_index.push(wb.DataIndexEntry.read(r,r.readVarint()+r.pos));};const Mb={read:function(t,e){return t.readFields(Mb._readField,{uint32_values:null,values:null,fixed32_values:null},e)},_readField:function(t,e,r){2===t?(e.uint32_values=Mb.Uint32Values.read(r,r.readVarint()+r.pos),e.values=\"uint32_values\"):3===t&&(e.fixed32_values=Mb.Fixed32Values.read(r,r.readVarint()+r.pos),e.values=\"fixed32_values\");},Uint32Values:{}};Mb.Uint32Values.read=function(t,e){return t.readFields(Mb.Uint32Values._readField,{values:[]},e)},Mb.Uint32Values._readField=function(t,e,r){1===t&&(e.readValuesInto=function(t){if(2!==t.type)throw new Error(`Unsupported pbf type \"${t.type}\"`);const e=function(t){return 2===t.type?t.readVarint()+t.pos:t.pos+1}(t),r=t.pos;return t.pos=e,function(n){t.pos=r;let i=0;for(;t.pos<e;){const e=t.readVarint();n[i++]=e;}return n}}(r));},Mb.Fixed32Values={},Mb.Fixed32Values.read=function(t,e){return t.readFields(Mb.Fixed32Values._readField,{values:[]},e)},Mb.Fixed32Values._readField=function(t,e,r){throw new Error(\"Not implemented\")};\n/**\n * tiny-lru\n *\n * @copyright 2024 Jason Mulligan <jason.mulligan@avoidwork.com>\n * @license BSD-3-Clause\n * @version 11.2.6\n */\nclass Ab{constructor(t=0,e=0,r=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=r,this.size=0,this.ttl=e;}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){const e=this.items[t];delete this.items[t],this.size--,null!==e.prev&&(e.prev.next=e.next),null!==e.next&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev);}return this}entries(t=this.keys()){return t.map((t=>[t,this.get(t)]))}evict(t=!1){if(t||this.size>0){const t=this.first;delete this.items[t.key],0==--this.size?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null);}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){let e;if(this.has(t)){const r=this.items[t];this.ttl>0&&r.expiry<=Date.now()?this.delete(t):(e=r.value,this.set(t,e,!0));}return e}has(t){return t in this.items}keys(){const t=[];let e=this.first;for(;null!==e;)t.push(e.key),e=e.next;return t}set(t,e,r=!1,n=this.resetTtl){let i;if(r||this.has(t)){if(i=this.items[t],i.value=e,!1===r&&n&&(i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==i){const t=this.last,e=i.next,r=i.prev;this.first===i&&(this.first=i.next),i.next=null,i.prev=this.last,t.next=i,null!==r&&(r.next=e),null!==e&&(e.prev=r);}}else this.max>0&&this.size===this.max&&this.evict(!0),i=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},1==++this.size?this.first=i:this.last.next=i;return this.last=i,this}values(t=this.keys()){return t.map((t=>this.get(t)))}}function Sb(t,e){if(4!==e.length)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let r=e[3];for(let n=2;n>=1;n--){const i=1===n?1:0,s=2===n?1:0;for(let n=0;n<e[0];n++){const a=e[1]*n;for(let n=i;n<e[1];n++){const i=e[2]*(n+a);for(let n=s;n<e[2];n++){const s=e[3]*(n+i);for(let n=0;n<e[3];n++){const e=s+n;t[e]+=t[e-r];}}}}r*=e[n];}return t}function Ib(t){for(let e=0,r=t.length;e<r;e++)t[e]=t[e]>>>1^-(1&t[e]);return t}function kb(t,e){switch(e){case\"uint32\":return t;case\"uint16\":for(let e=0;e<t.length;e+=2){const r=t[e],n=t[e+1];t[e]=(240&r)>>4|(61440&r)>>8|(240&n)<<4|61440&n,t[e+1]=15&r|(3840&r)>>4|(15&n)<<8|(3840&n)<<4;}return t;case\"uint8\":for(let e=0;e<t.length;e+=4){const r=t[e],n=t[e+1],i=t[e+2],s=t[e+3];t[e+0]=(192&r)>>6|(192&n)>>4|(192&i)>>2|192&s,t[e+1]=(48&r)>>4|(48&n)>>2|48&i|(48&s)<<2,t[e+2]=(12&r)>>2|12&n|(12&i)<<2|(12&s)<<4,t[e+3]=3&r|(3&n)<<2|(3&i)<<4|(3&s)<<6;}return t;default:throw new Error(`Invalid pixel format, \"${e}\"`)}}class Pb extends Error{constructor(t){super(t),this.name=\"MRTError\";}}var Eb=Uint8Array,zb=Uint16Array,Tb=Int32Array,Bb=new Eb([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Cb=new Eb([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Rb=new Eb([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Vb=function(t,e){for(var r=new zb(31),n=0;n<31;++n)r[n]=e+=1<<t[n-1];var i=new Tb(r[30]);for(n=1;n<30;++n)for(var s=r[n];s<r[n+1];++s)i[s]=s-r[n]<<5|n;return {b:r,r:i}},Db=Vb(Bb,2),Lb=Db.b,Fb=Db.r;Lb[28]=258,Fb[258]=28;for(var Ob=Vb(Cb,0).b,Ub=new zb(32768),Nb=0;Nb<32768;++Nb){var jb=(43690&Nb)>>1|(21845&Nb)<<1;Ub[Nb]=((65280&(jb=(61680&(jb=(52428&jb)>>2|(13107&jb)<<2))>>4|(3855&jb)<<4))>>8|(255&jb)<<8)>>1;}var qb=function(t,e,r){for(var n=t.length,i=0,s=new zb(e);i<n;++i)t[i]&&++s[t[i]-1];var a,o=new zb(e);for(i=1;i<e;++i)o[i]=o[i-1]+s[i-1]<<1;if(r){a=new zb(1<<e);var l=15-e;for(i=0;i<n;++i)if(t[i])for(var u=i<<4|t[i],c=e-t[i],h=o[t[i]-1]++<<c,p=h|(1<<c)-1;h<=p;++h)a[Ub[h]>>l]=u;}else for(a=new zb(n),i=0;i<n;++i)t[i]&&(a[i]=Ub[o[t[i]-1]++]>>15-t[i]);return a},$b=new Eb(288);for(Nb=0;Nb<144;++Nb)$b[Nb]=8;for(Nb=144;Nb<256;++Nb)$b[Nb]=9;for(Nb=256;Nb<280;++Nb)$b[Nb]=7;for(Nb=280;Nb<288;++Nb)$b[Nb]=8;var Gb=new Eb(32);for(Nb=0;Nb<32;++Nb)Gb[Nb]=5;var Qb=qb($b,9,1),Yb=qb(Gb,5,1),Xb=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},Zb=function(t,e,r){var n=e/8|0;return (t[n]|t[n+1]<<8)>>(7&e)&r},Kb=function(t,e){var r=e/8|0;return (t[r]|t[r+1]<<8|t[r+2]<<16)>>(7&e)},Wb=[\"unexpected EOF\",\"invalid block type\",\"invalid length/literal\",\"invalid distance\",\"stream finished\",\"no stream handler\",,\"no callback\",\"invalid UTF-8 data\",\"extra field too long\",\"date not in range 1980-2099\",\"filename too long\",\"stream finishing\",\"invalid zip data\"],Hb=function(t,e,r){var n=new Error(e||Wb[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,Hb),!r)throw n;return n},Jb=new Eb(0),tv=\"undefined\"!=typeof TextDecoder&&new TextDecoder;try{tv.decode(Jb,{stream:!0});}catch(t){}const ev={gzip_data:\"gzip\"};const rv={0:\"uint32\",1:\"uint32\",2:\"uint16\",3:\"uint8\"},nv={uint32:1,uint16:2,uint8:4},iv={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};class sv{constructor(t=1){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=t;}getLayer(t){return this.layers[t]}getHeaderLength(t){const e=new Uint8Array(t),r=new DataView(t);if(13!==e[0])throw new Pb(\"File is not a valid MRT.\");return r.getUint32(1,!0)}parseHeader(t){const e=new Uint8Array(t),r=this.getHeaderLength(t);if(e.length<r)throw new Pb(`Expected header with length >= ${r} but got buffer of length ${e.length}`);const n=new wm(e.subarray(0,r)),i=wb.read(n);if(!isNaN(this.x)&&(this.x!==i.x||this.y!==i.y||this.z!==i.z))throw new Pb(`Invalid attempt to parse header ${i.z}/${i.x}/${i.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=i.x,this.y=i.y,this.z=i.z;for(const t of i.layers)this.layers[t.name]=new av(t,{cacheSize:this._cacheSize});return this}createDecodingTask(t){const e=[],r=this.getLayer(t.layerName);for(let n=0;n<r.dataIndex.length;n++){const i=r.dataIndex[n],s=i.first_byte-t.firstByte,a=i.last_byte+1-t.firstByte;if(n<t.firstBlock||n>t.lastBlock)continue;if(r._blocksInProgress.has(n))continue;const o={layerName:r.name,firstByte:s,lastByte:a,pixelFormat:r.pixelFormat,blockIndex:n,blockShape:[i.bands.length].concat(r.bandShape),buffer:r.buffer,codec:i.codec.codec,filters:i.filters.map((t=>t.filter))};r._blocksInProgress.add(n),e.push(o);}return new ov(e,(()=>{e.forEach((t=>r._blocksInProgress.delete(t.blockIndex)));}),((t,n)=>{if(e.forEach((t=>r._blocksInProgress.delete(t.blockIndex))),t)throw t;n.forEach((t=>{this.getLayer(t.layerName).processDecodedData(t);}));}))}}class av{constructor({version:t,name:e,units:r,tilesize:n,pixel_format:i,buffer:s,data_index:a},o){if(this.version=t,1!==this.version)throw new Pb(`Cannot parse raster layer encoded with MRT version ${t}`);this.name=e,this.units=r,this.tileSize=n,this.buffer=s,this.pixelFormat=rv[i],this.dataIndex=a,this.bandShape=[n+2*s,n+2*s,nv[this.pixelFormat]],this._decodedBlocks=function(t=1e3,e=0,r=!1){if(isNaN(t)||t<0)throw new TypeError(\"Invalid max value\");if(isNaN(e)||e<0)throw new TypeError(\"Invalid ttl value\");if(\"boolean\"!=typeof r)throw new TypeError(\"Invalid resetTtl value\");return new Ab(t,e,r)}(o?o.cacheSize:5),this._blocksInProgress=new Set;}processDecodedData(t){const e=t.blockIndex.toString();this._decodedBlocks.get(e)||this._decodedBlocks.set(e,t.data);}getBlockForBand(t){let e=0;switch(typeof t){case\"string\":for(const[r,n]of this.dataIndex.entries()){for(const[i,s]of n.bands.entries())if(s===t)return {bandIndex:e+i,blockIndex:r,blockBandIndex:i};e+=n.bands.length;}break;case\"number\":for(const[r,n]of this.dataIndex.entries()){if(t>=e&&t<e+n.bands.length)return {bandIndex:t,blockIndex:r,blockBandIndex:t-e};e+=n.bands.length;}break;default:throw new Pb(`Invalid band \\`${JSON.stringify(t)}\\`. Expected string or integer.`)}throw new Pb(`Band not found: ${JSON.stringify(t)}`)}getDataRange(t){let e=1/0,r=-1/0,n=1/0,i=-1/0;for(const s of t){const{blockIndex:t}=this.getBlockForBand(s);if(t<0)throw new Pb(`Invalid band: ${JSON.stringify(s)}`);const a=this.dataIndex[t];n=Math.min(n,t),i=Math.max(i,t),e=Math.min(e,a.first_byte),r=Math.max(r,a.last_byte);}return {layerName:this.name,firstByte:e,lastByte:r,firstBlock:n,lastBlock:i}}hasBand(t){const{blockIndex:e}=this.getBlockForBand(t);return e>=0}hasDataForBand(t){const{blockIndex:e}=this.getBlockForBand(t);return e>=0&&!!this._decodedBlocks.get(e.toString())}getBandView(t){const{blockIndex:e,blockBandIndex:r}=this.getBlockForBand(t),n=this._decodedBlocks.get(e.toString());if(!n)throw new Pb(`Data for band ${JSON.stringify(t)} of layer \"${this.name}\" not decoded.`);const i=this.dataIndex[e],s=this.bandShape.reduce(((t,e)=>t*e),1),a=r*s,o=n.subarray(a,a+s);return {data:o,bytes:new Uint8Array(o.buffer).subarray(o.byteOffset,o.byteOffset+o.byteLength),tileSize:this.tileSize,buffer:this.buffer,offset:i.offset,scale:i.scale}}}class ov{constructor(t,e,r){this.tasks=t,this._onCancel=e,this._onComplete=r,this._finalized=!1;}cancel(){this._finalized||(this._onCancel(),this._finalized=!0);}complete(t,e){this._finalized||(this._onComplete(t,e),this._finalized=!0);}}sv.performDecoding=function(t,e){return Promise.all(e.tasks.map((e=>{const{layerName:r,firstByte:n,lastByte:i,pixelFormat:s,blockShape:a,blockIndex:o,filters:l,codec:u}=e,c=new Uint8Array(t).subarray(n,i+1),h=new Uint32Array(a[0]*a[1]*a[2]);let p;if(\"gzip_data\"!==u)throw new Error(`Unhandled codec: ${u}`);return p=function(t,e){if(!globalThis.DecompressionStream&&\"gzip_data\"===e)return Promise.resolve(((s=function(t){31==t[0]&&139==t[1]&&8==t[2]||Hb(6,\"invalid gzip data\");var e=t[3],r=10;4&e&&(r+=2+(t[10]|t[11]<<8));for(var n=(e>>3&1)+(e>>4&1);n>0;n-=!t[r++]);return r+(2&e)}(i=t))+8>i.length&&Hb(6,\"invalid gzip data\"),function(t,e,r,n){var i=t.length;if(!i||e.f&&!e.l)return r||new Eb(0);var s=!r,a=s||2!=e.i,o=e.i;s&&(r=new Eb(3*i));var l,u,c=function(t){var e=r.length;if(t>e){var n=new Eb(Math.max(2*e,t));n.set(r),r=n;}},h=e.f||0,p=e.p||0,f=e.b||0,d=e.l,m=e.d,y=e.m,g=e.n,x=8*i;do{if(!d){h=Zb(t,p,1);var b=Zb(t,p+1,3);if(p+=3,!b){var v=t[(T=4+((p+7)/8|0))-4]|t[T-3]<<8,_=T+v;if(_>i){o&&Hb(0);break}a&&c(f+v),r.set(t.subarray(T,_),f),e.b=f+=v,e.p=p=8*_,e.f=h;continue}if(1==b)d=Qb,m=Yb,y=9,g=5;else if(2==b){var w=Zb(t,p,31)+257,M=Zb(t,p+10,15)+4,A=w+Zb(t,p+5,31)+1;p+=14;for(var S=new Eb(A),I=new Eb(19),k=0;k<M;++k)I[Rb[k]]=Zb(t,p+3*k,7);p+=3*M;var P=Xb(I),E=(1<<P)-1,z=qb(I,P,1);for(k=0;k<A;){var T,B=z[Zb(t,p,E)];if(p+=15&B,(T=B>>4)<16)S[k++]=T;else {var C=0,R=0;for(16==T?(R=3+Zb(t,p,3),p+=2,C=S[k-1]):17==T?(R=3+Zb(t,p,7),p+=3):18==T&&(R=11+Zb(t,p,127),p+=7);R--;)S[k++]=C;}}var V=S.subarray(0,w),D=S.subarray(w);y=Xb(V),g=Xb(D),d=qb(V,y,1),m=qb(D,g,1);}else Hb(1);if(p>x){o&&Hb(0);break}}a&&c(f+131072);for(var L=(1<<y)-1,F=(1<<g)-1,O=p;;O=p){var U=(C=d[Kb(t,p)&L])>>4;if((p+=15&C)>x){o&&Hb(0);break}if(C||Hb(2),U<256)r[f++]=U;else {if(256==U){O=p,d=null;break}var N=U-254;U>264&&(N=Zb(t,p,(1<<($=Bb[k=U-257]))-1)+Lb[k],p+=$);var j=m[Kb(t,p)&F],q=j>>4;if(j||Hb(3),p+=15&j,D=Ob[q],q>3){var $=Cb[q];D+=Kb(t,p)&(1<<$)-1,p+=$;}if(p>x){o&&Hb(0);break}a&&c(f+131072);var G=f+N;if(f<D){var Q=0-D,Y=Math.min(D,G);for(Q+f<0&&Hb(3);f<Y;++f)r[f]=(void 0)[Q+f];}for(;f<G;++f)r[f]=r[f-D];}}e.l=d,e.p=O,e.b=f,e.f=h,d&&(h=1,e.m=y,e.d=m,e.n=g);}while(!h);return f!=r.length&&s?(l=r,(null==(u=f)||u>l.length)&&(u=l.length),new Eb(l.subarray(0,u))):r.subarray(0,f)}(i.subarray(s,-8),{i:2},new Eb(((r=i)[(n=r.length)-4]|r[n-3]<<8|r[n-2]<<16|r[n-1]<<24)>>>0))));var r,n,i,s;const a=ev[e];if(!a)throw new Error(`Unhandled codec: ${e}`);const o=new globalThis.DecompressionStream(a);return new Response(new Blob([t]).stream().pipeThrough(o)).arrayBuffer().then((t=>new Uint8Array(t)))}(c,u).then((t=>{const e=Mb.read(new wm(t));if(\"uint32_values\"===e.values)return e.uint32_values.readValuesInto(h),new(0,iv[s])(h.buffer);throw new Error(`Unhandled numeric data \"${e.values}\"`)})),p.then((t=>{for(let e=l.length-1;e>=0;e--)switch(l[e]){case\"delta_filter\":Sb(t,a);break;case\"zigzag_filter\":Ib(t);break;case\"bitshuffle_filter\":kb(t,s);break;default:throw new Error(`Unhandled filter \"${l[e]}\"`)}return {layerName:r,blockIndex:o,data:t}})).catch((t=>{throw t}))})))},fo(ov,\"MRTDecodingBatch\",{omit:[\"_onCancel\",\"_onComplete\"]});const lv=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class uv{static from(t){if(!(t instanceof ArrayBuffer))throw new Error(\"Data must be an instance of ArrayBuffer.\");const[e,r]=new Uint8Array(t,0,2);if(219!==e)throw new Error(\"Data does not appear to be in a KDBush format.\");const n=r>>4;if(1!==n)throw new Error(`Got v${n} data when expected v1.`);const i=lv[15&r];if(!i)throw new Error(\"Unrecognized array type.\");const[s]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new uv(a,s,i,t)}constructor(t,e=64,r=Float64Array,n){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=lv.indexOf(this.ArrayType),s=2*t*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,o=(8-a%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+o,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+s+a+o),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+o,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t);}add(t,e){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=e,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return cv(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,r,n){if(!this._finished)throw new Error(\"Data not yet indexed - call index.finish().\");const{ids:i,coords:s,nodeSize:a}=this,o=[0,i.length-1,0],l=[];for(;o.length;){const u=o.pop()||0,c=o.pop()||0,h=o.pop()||0;if(c-h<=a){for(let a=h;a<=c;a++){const o=s[2*a],u=s[2*a+1];o>=t&&o<=r&&u>=e&&u<=n&&l.push(i[a]);}continue}const p=h+c>>1,f=s[2*p],d=s[2*p+1];f>=t&&f<=r&&d>=e&&d<=n&&l.push(i[p]),(0===u?t<=f:e<=d)&&(o.push(h),o.push(p-1),o.push(1-u)),(0===u?r>=f:n>=d)&&(o.push(p+1),o.push(c),o.push(1-u));}return l}within(t,e,r){if(!this._finished)throw new Error(\"Data not yet indexed - call index.finish().\");const{ids:n,coords:i,nodeSize:s}=this,a=[0,n.length-1,0],o=[],l=r*r;for(;a.length;){const u=a.pop()||0,c=a.pop()||0,h=a.pop()||0;if(c-h<=s){for(let r=h;r<=c;r++)dv(i[2*r],i[2*r+1],t,e)<=l&&o.push(n[r]);continue}const p=h+c>>1,f=i[2*p],d=i[2*p+1];dv(f,d,t,e)<=l&&o.push(n[p]),(0===u?t-r<=f:e-r<=d)&&(a.push(h),a.push(p-1),a.push(1-u)),(0===u?t+r>=f:e+r>=d)&&(a.push(p+1),a.push(c),a.push(1-u));}return o}}function cv(t,e,r,n,i,s){if(i-n<=r)return;const a=n+i>>1;hv(t,e,a,n,i,s),cv(t,e,r,n,a-1,1-s),cv(t,e,r,a+1,i,1-s);}function hv(t,e,r,n,i,s){for(;i>n;){if(i-n>600){const a=i-n+1,o=r-n+1,l=Math.log(a),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(a-u)/a)*(o-a/2<0?-1:1);hv(t,e,r,Math.max(n,Math.floor(r-o*u/a+c)),Math.min(i,Math.floor(r+(a-o)*u/a+c)),s);}const a=e[2*r+s];let o=n,l=i;for(pv(t,e,n,r),e[2*i+s]>a&&pv(t,e,n,i);o<l;){for(pv(t,e,o,l),o++,l--;e[2*o+s]<a;)o++;for(;e[2*l+s]>a;)l--;}e[2*n+s]===a?pv(t,e,n,l):(l++,pv(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1);}}function pv(t,e,r,n){fv(t,r,n),fv(e,2*r,2*n),fv(e,2*r+1,2*n+1);}function fv(t,e,r){const n=t[e];t[e]=t[r],t[r]=n;}function dv(t,e,r,n){const i=t-r,s=e-n;return i*i+s*s}t.$=class{constructor(t){this.specification=t;}possiblyEvaluate(t,e){return function([t,e]){const r=dr([1,t,e]);return {x:r.x,y:r.y,z:r.z}}(t.expression.evaluate(e))}interpolate(t,e,r){return {x:qn(t.x,e.x,r),y:qn(t.y,e.y,r),z:qn(t.z,e.z,r)}}},t.A=rl,t.B=Qa,t.C=zi,t.D=qa,t.E=Dn,t.F=function(t){const e=t.value;let r=[];if(!e)return r;const n=Si(e);return \"string\"!==n?(r=r.concat([new Hg(t.key,e,`string expected, \"${n}\" found`)]),r):(Jg(e,!0)||(r=r.concat([new Hg(t.key,e,`invalid url \"${e}\"`)])),r)},t.G=el,t.H=Ho,t.I=ty,t.J=Zo,t.K=class{constructor(t){this.specification=t;}possiblyEvaluate(t,e){return dr(t.expression.evaluate(e))}interpolate(t,e,r){return {x:qn(t.x,e.x,r),y:qn(t.y,e.y,r),z:qn(t.z,e.z,r),azimuthal:qn(t.azimuthal,e.azimuthal,r),polar:qn(t.polar,e.polar,r)}}},t.L=qo,t.M=class{constructor(t,e,r,n){this.id=t,this.position=null!=e?new ac(e[0],e[1]):new ac(0,0),this.orientation=null!=r?r:[0,0,0],this.nodes=n,this.uploaded=!1,this.aabb=new mh([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[];}_applyTransformations(e,r){if(t.a9.multiply(e.matrix,r,e.matrix),e.meshes)for(const t of e.meshes){const r=mh.applyTransform(t.aabb,e.matrix);this.aabb.encapsulate(r);}if(e.children)for(const t of e.children)this._applyTransformations(t,e.matrix);}computeBoundsAndApplyParent(){const e=t.a9.identity([]);for(const t of this.nodes)this._applyTransformations(t,e);}computeModelMatrix(t,e,r,n,i,s,a=!1){ox(this.matrix,this,t.transform,this.position,e,r,n,i,s,a);}upload(t){if(!this.uploaded){for(const e of this.nodes)cx(e,t);for(const t of this.nodes)hx(t);this.uploaded=!0;}}destroy(){for(const t of this.nodes)px(t);}},t.N=Uo,t.O=Ec,t.P=Ue,t.R=Zr,t.S=Ke,t.T=bg,t.U=Xo,t.V=Hg,t.W=Oh,t.X=qn,t.Y=is,t.Z=io,t._=$n,t.a=Vn,t.a$=sr,t.a0=function(t,e,r=0,n=!0){const i=new Ue(r,r),s=t.sub(i),a=e.add(i),o=[s,new Ue(a.x,s.y),a,new Ue(s.x,a.y)];return n&&o.push(s.clone()),o},t.a1=function(t,e){const r=[];for(let n=0;n<t.length;n++){const i=We(n-1,-1,t.length-1),s=We(n+1,-1,t.length-1),a=t[n],o=t[s],l=t[i].sub(a).unit(),u=o.sub(a).unit(),c=u.angleWithSep(l.x,l.y),h=l.add(u).unit().mult(-1*e/Math.sin(c/2));r.push(a.add(h));}return r},t.a2=By,t.a3=Hc,t.a4=function(e,r,n=0){return t.Q.fromValues(((r.x-n)*e.scale-e.x)*is,(r.y*e.scale-e.y)*is,Mc(r.z,r.y))},t.a5=lh,t.a6=Pd,t.a7=function(t){let e=1/0,r=1/0,n=-1/0,i=-1/0;for(const s of t)e=Math.min(e,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x),i=Math.max(i,s.y);return {min:new Ue(e,r),max:new Ue(n,i)}},t.a8=xc,t.aA=jn,t.aB=Ml,t.aC=Ba,t.aD=tu,t.aE=mu,t.aF=er,t.aG=nu,t.aH=ug,t.aI=function(){Oo.isLoading()||Oo.isLoaded()||\"deferred\"!==Lo()||Fo();},t.aJ=nl,t.aK=Fc,t.aL=ab,t.aM=yr,t.aN=Sd,t.aO=$p,t.aP=Lc,t.aQ=Sl,t.aR=Kl,t.aS=bh,t.aT=Op,t.aU=xg,t.aV=function(e,r){const n=Oh(r.zoom);if(0===n)return Sh(e);const i=Eh(e),s=zh(i),a=xc(i.getWest())*r.worldSize,o=xc(i.getEast())*r.worldSize,l=bc(i.getNorth())*r.worldSize,u=bc(i.getSouth())*r.worldSize,c=[a,l,0],h=[o,l,0],p=[a,u,0],f=[o,u,0],d=t.a9.invert([],r.globeMatrix);return t.Q.transformMat4(c,c,d),t.Q.transformMat4(h,h,d),t.Q.transformMat4(p,p,d),t.Q.transformMat4(f,f,d),s[0]=Ih(s[0],p,n),s[1]=Ih(s[1],f,n),s[2]=Ih(s[2],h,n),s[3]=Ih(s[3],c,n),mh.fromPoints(s)},t.aW=Rh,t.aX=Th,t.aY=Ih,t.aZ=Il,t.a_=xh,t.ab=Wc,t.ac=Tc,t.ad=Ze,t.ae=Xu,t.af=function(t,e){const r={};for(let n=0;n<e.length;n++){const i=e[n];i in t&&(r[i]=t[i]);}return r},t.ag=oc,t.ah=bc,t.ai=class{constructor(t){this.entries={},this.scheduler=t;}request(t,e,r,n){const i=this.entries[t]=this.entries[t]||{callbacks:[]};if(i.result){const[t,r]=i.result;return this.scheduler?this.scheduler.add((()=>{n(t,r);}),e):n(t,r),()=>{}}return i.callbacks.push(n),i.cancel||(i.cancel=r(((r,n)=>{i.result=[r,n];for(const t of i.callbacks)this.scheduler?this.scheduler.add((()=>{t(r,n);}),e):t(r,n);setTimeout((()=>delete this.entries[t]),3e3);}))),()=>{i.result||(i.callbacks=i.callbacks.filter((t=>t!==n)),i.callbacks.length||(i.cancel(),delete this.entries[t]));}}},t.aj=yl,t.ak=function(t,e,r){const n=JSON.stringify(t.request);return t.data&&(this.deduped.entries[n]={result:[null,t.data]}),this.deduped.request(n,{type:\"parseTile\",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom},(e=>{const n=Jr(t.request,((t,n,i,s)=>{t?e(t):n&&e(null,{vectorTile:r?void 0:new pf(new wm(n)),rawData:n,cacheControl:i,expires:s});}));return ()=>{n.cancel(),e();}}),e)},t.al=function(t){Nr++,Nr>Dr&&(t.getActor().send(\"enforceCacheSizeLimit\",Vr),Nr=0);},t.am=mn,t.an=zr,t.ao=function(t){return t<=1?1:Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},t.ap=pc,t.aq=Ig,t.ar=Eg,t.as=Ag,t.at=function(t,e){const r=document.createElement(\"video\");r.muted=!0,r.onloadstart=function(){e(null,r);};for(let e=0;e<t.length;e++){const n=document.createElement(\"source\");tn(t[e])||(r.crossOrigin=\"Anonymous\"),n.src=t[e],r.appendChild(n);}return {cancel:()=>{}}},t.au=vg,t.av=Ty,t.aw=_c,t.ax=wc,t.ay=kl,t.az=ql,t.b=Rn,t.b$=oy,t.b0=sv,t.b1=Jr,t.b2=function(t){const e=[];for(const r in t)e.push(t[r]);return e},t.b3=function(t,e){const r=[];for(const n in t)n in e||r.push(n);return r},t.b4=He,t.b5=[\"type\",\"source\",\"source-layer\",\"minzoom\",\"maxzoom\",\"filter\",\"layout\"],t.b6=function(e,r){const{x:n,y:i}=e.point,s=Fh(n,i,e.worldSize/e._pixelsPerMercatorPixel,0,0);return t.a9.multiply(s,s,Vh(Sh(r)))},t.b8=Xd,t.b9=Pm,t.bA=Ku,t.bB=function(e){const r=t.a9.identity(new Float64Array(16));t.a9.multiply(r,e.pixelMatrix,e.globeMatrix);const n=[0,tc,0],i=[0,ec,0];return t.Q.transformMat4(n,n,r),t.Q.transformMat4(i,i,r),[n[0]>0&&n[0]<=e.width&&n[1]>0&&n[1]<=e.height&&!Nh(e,new ac(e.center.lat,90)),i[0]>0&&i[0]<=e.width&&i[1]>0&&i[1]<=e.height&&!Nh(e,new ac(e.center.lat,-90))]},t.bC=function(e,r){const{scale:n}=e.tileTransform,i=n*is/(e.tileSize*Math.pow(2,r.zoom-e.tileID.overscaledZ+e.tileID.canonical.z));return t.b7.scale(new Float32Array(4),r.inverseAdjustmentMatrix,[i,i])},t.bD=Lg,t.bE=Vg,t.bF=function(e){const r=Vg(e,!0);return t.b7.invert([],[r[0],r[1],r[4],r[5]])},t.bG=uh,t.bH=function(t){const{x:e,y:r}=t.point,{lng:n,lat:i}=t._center;return Fh(e,r,t.worldSize,n,i)},t.bI=$e,t.bJ=Zu,t.bK=function(t){const e=Math.round((t+45+360)%360/90)%4;return Ge[e]},t.bL=45,t.bM=gc,t.bN=Tu,t.bO=Iu,t.bP=ku,t.bQ=Su,t.bR=Au,t.bS=Pu,t.bT=function(t,e,r){const n=Math.sqrt(t*t+e*e+r*r),i=n>0?Math.acos(r/n)*je:0;let s=0!==t||0!==e?Math.atan2(-e,-t)*je+90:0;return s<0&&(s+=360),[n,s,i]},t.bU=Pc,t.bV=mh,t.bW=dr,t.bX=function(t){return [Math.pow(t[0],1/2.2),Math.pow(t[1],1/2.2),Math.pow(t[2],1/2.2)]},t.bY=function(t){return t({pluginStatus:Bo,pluginURL:Co}),Do.on(\"pluginStateChange\",t),t},t.bZ=yx,t.b_=wx,t.ba=Yd,t.bb=function(t,e,r,n,i){const s=5*e+2;t.float32[s+0]=r,t.float32[s+1]=n,t.float32[s+2]=i;},t.bc=sg,t.bd=Wm,t.be=jc,t.bf=$d,t.bg=_y,t.bh=vy,t.bi=Om,t.bj=uv,t.bk=We,t.bm=qe,t.bn=Sr,t.bo=vc,t.bp=function(t,e,r){t[4*e+0]=r[0],t[4*e+1]=r[1],t[4*e+2]=r[2],t[4*e+3]=r[3];},t.bq=ac,t.br=Jy,t.bs=hc,t.bt=dh,t.bu=Dg,t.bv=cc,t.bw=Ph,t.bx=function(t,e,r,n,i,s,a,o,l){if(\"globe\"===l.name)return Ph(t,e,new cc(r,n,i),!1);const u=Ty({z:r,x:n,y:i},l);return new mh([(s+u.x/u.scale)*e,e*(u.y/u.scale),a],[(s+u.x2/u.scale)*e,e*(u.y2/u.scale),o])},t.by=function(t,e,r){let n=0;for(let r=0;r<2;++r){const i=0;t[r]>i&&(n+=(t[r]-i)*(t[r]-i)),e[r]<i&&(n+=(i-e[r])*(i-e[r]));}return n},t.bz=Ac,t.c=eb,t.c$=[1,1,1],t.c0=ay,t.c1=Wr,t.c2=Ro,t.c3=s,t.c4=Cr,t.c5=Tn,t.c6=ur,t.c7=function(t,e,r){return \"custom\"===t.type?new zg(t,e):new _b[t.type](t,e,r)},t.c8=function(t){const e=t.indexOf(ml);return e>=0?t.slice(0,e):t},t.c9=function(t){return t.indexOf(ml)>=0},t.cA=t=>({u_matrix:new Tu(t),u_pixels_to_tile_units:new Ru(t),u_device_pixel_ratio:new Su(t),u_units_to_pixels:new Iu(t),u_dash_image:new Au(t),u_gradient_image:new Au(t),u_image_height:new Su(t),u_texsize:new Iu(t),u_tile_units_to_pixels:new Su(t),u_alpha_discard_threshold:new Su(t),u_trim_offset:new Iu(t),u_emissive_strength:new Su(t)}),t.cB=t=>({u_matrix:new Tu(t),u_texsize:new Iu(t),u_pixels_to_tile_units:new Ru(t),u_device_pixel_ratio:new Su(t),u_image:new Au(t),u_units_to_pixels:new Iu(t),u_tile_units_to_pixels:new Su(t),u_alpha_discard_threshold:new Su(t),u_trim_offset:new Iu(t)}),t.cC=Nl,t.cD=qd,t.cE=Zd,t.cF=Qh,t.cG=(t,e,r,n,i,s)=>{const a=t.transform,o=\"globe\"===a.projection.name;let l;if(\"map\"===s.paint.get(\"circle-pitch-alignment\"))if(o){const t=Lh(a.zoom,e.canonical)*a._pixelsPerMercatorPixel;l=Float32Array.from([t,0,0,t]);}else l=a.calculatePixelsToTileUnitsMatrix(r);else l=new Float32Array([a.pixelsToGLUnits[0],0,0,a.pixelsToGLUnits[1]]);const u={u_camera_to_center_distance:t.transform.getCameraToCenterDistance(a.projection),u_matrix:t.translatePosMatrix(e.projMatrix,r,s.paint.get(\"circle-translate\"),s.paint.get(\"circle-translate-anchor\")),u_device_pixel_ratio:Tr.devicePixelRatio,u_extrude_scale:l,u_inv_rot_matrix:Gh,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:s.paint.get(\"circle-emissive-strength\")};if(o){u.u_inv_rot_matrix=n,u.u_merc_center=i,u.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],u.u_zoom_transition=Oh(a.zoom);const t=i[0]*is,r=i[1]*is;u.u_up_dir=a.projection.upVector(new cc(0,0,0),t,r);}return u},t.cH=Td,t.cI=(t,e,r,n,i,s)=>{const a=t.transform;return {u_matrix:zd(t,e,r,n),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:a.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:i,u_image:0,u_tile_units_to_pixels:Ed(e,a),u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:s}},t.cJ=(t,e,r,n,i,s,a)=>{const o=t.transform,l=o.calculatePixelsToTileUnitsMatrix(e);return {u_matrix:zd(t,e,r,n),u_pixels_to_tile_units:l,u_device_pixel_ratio:s,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:i,u_texsize:Bd(r)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Ed(e,t.transform),u_alpha_discard_threshold:0,u_trim_offset:a,u_emissive_strength:r.paint.get(\"line-emissive-strength\")}},t.cK=nr,t.cL=op,t.cM=ad,t.cN=dc,t.cO=Hf,t.cP=Nf,t.cQ=450,t.cR=7,t.cS=Sg,t.cT=256,t.cU=Vh,t.cV=Wl,t.cW=Yl,t.cX=Xl,t.cY=function(t,e,r,n,i){return Ze((t-e)/(r-e)*(i-n)+n,n,i)},t.cZ=Ic,t.c_=qg,t.ca=function(t){const e=t.indexOf(ml);return e>=0?t.slice(e+1):\"\"},t.cb=function(t){const e=[],r=t.id;return void 0===r&&e.push({message:`layers.${r}: missing required property \"id\"`}),void 0===t.render&&e.push({message:`layers.${r}: missing required method \"render\"`}),t.renderingMode&&\"2d\"!==t.renderingMode&&\"3d\"!==t.renderingMode&&e.push({message:`layers.${r}: property \"renderingMode\" must be either \"2d\" or \"3d\"`}),e},t.cc=lr,t.cd=Do,t.ce=Hr,t.cf=Eu,t.cg=class extends Mu{constructor(t){super(t),this.current=Bu;}set(t,e,r){if(this.fetchUniformLocation(t,e))for(let t=0;t<9;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix3fv(this.location,!1,r);break}}},t.ch=Qe,t.ci=function(t,e,r){const n=Oh(r.zoom),i=t.style.map._antialias,s=e.options.extStandardDerivativesForceOff||t.terrain&&t.terrain.exaggeration()>0;return 0===n&&!i&&!s},t.cj=function(e){const r=e.pixelsPerMeter,n=r/vc(1,e.center.lat),i=t.a9.identity(new Float64Array(16));return t.a9.translate(i,i,[e.point.x,e.point.y,0]),t.a9.scale(i,i,[n,n,r]),Float32Array.from(i)},t.ck=Eh,t.cl=function(t){const e=Ac-5;t=Ze(t,-e,e)/e*90;const r=Math.pow(Math.abs(Math.sin(qe(t))),3);return Math.round(r*(Ju.length-1))},t.cm=function(e,r,n,i){const s=r.getNorth(),a=r.getSouth(),o=r.getWest(),l=r.getEast(),u=1<<e.z,c=l-o,h=s-a,p=c/Hu,f=-h/Ju[n],d=[0,p,0,f,0,0,s,o,0];if(e.z>0){const e=180/i;t.ct.multiply(d,d,[e/c+1,0,0,0,e/h+1,0,-.5*e/p,.5*e/f,1]);}return d[2]=u,d[5]=e.x,d[8]=e.y,d},t.cn=Sh,t.co=function(e,r,n){const i=t.a9.identity(new Float64Array(16)),s=(r/(1<<e)-.5)*Math.PI*2;return t.a9.rotateY(i,n.globeMatrix,s),Float32Array.from(i)},t.cp=class{isDataAvailableAtPoint(t){const e=this._source();if(this.isUsingMockSource()||!e||t.y<0||t.y>1)return !1;const r=e.getSource().maxzoom,n=1<<r,i=Math.floor(t.x),s=Math.floor((t.x-i)*n),a=Math.floor(t.y*n),o=this.findDEMTileFor(new pc(r,i,r,s,a));return !(!o||!o.dem)}getAtPointOrZero(t,e=0){return this.getAtPoint(t,e)||0}getAtPoint(t,e,r=!0){if(this.isUsingMockSource())return null;null==e&&(e=null);const n=this._source();if(!n)return e;if(t.y<0||t.y>1)return e;const i=n.getSource().maxzoom,s=1<<i,a=Math.floor(t.x),o=t.x-a,l=new pc(i,a,i,Math.floor(o*s),Math.floor(t.y*s)),u=this.findDEMTileFor(l);if(!u||!u.dem)return e;const c=u.dem,h=1<<u.tileID.canonical.z,p=(o*h-u.tileID.canonical.x)*c.dim,f=(t.y*h-u.tileID.canonical.y)*c.dim,d=Math.floor(p),m=Math.floor(f);return (r?this.exaggeration():1)*qn(qn(c.get(d,m),c.get(d,m+1),f-m),qn(c.get(d+1,m),c.get(d+1,m+1),f-m),p-d)}getAtTileOffset(t,e,r){const n=1<<t.canonical.z;return this.getAtPointOrZero(new Ec(t.wrap+(t.canonical.x+e/is)/n,(t.canonical.y+r/is)/n))}getAtTileOffsetFunc(e,r,n,i){return s=>{const a=this.getAtTileOffset(e,s.x,s.y),o=i.upVector(e.canonical,s.x,s.y),l=i.upVectorScale(e.canonical,r,n).metersToTile;return t.Q.scale(o,o,a*l),o}}getForTilePoints(t,e,r,n){if(this.isUsingMockSource())return !1;const i=Rf.create(this,t,n);return !!i&&(e.forEach((t=>{t[2]=this.exaggeration()*i.getElevationAt(t[0],t[1],r);})),!0)}getMinMaxForTile(t){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(t);if(!e||!e.dem)return null;const r=e.dem.tree,n=e.tileID,i=1<<t.canonical.z-n.canonical.z;let s=t.canonical.x/i-n.canonical.x,a=t.canonical.y/i-n.canonical.y,o=0;for(let e=0;e<t.canonical.z-n.canonical.z&&!r.leaves[o];e++){s*=2,a*=2;const t=2*Math.floor(a)+Math.floor(s);o=r.childOffsets[o]+t,s%=1,a%=1;}return {min:this.exaggeration()*r.minimums[o],max:this.exaggeration()*r.maximums[o]}}getMinElevationBelowMSL(){throw new Error(\"Pure virtual method called.\")}raycast(t,e,r){throw new Error(\"Pure virtual method called.\")}pointCoordinate(t){throw new Error(\"Pure virtual method called.\")}_source(){throw new Error(\"Pure virtual method called.\")}isUsingMockSource(){throw new Error(\"Pure virtual method called.\")}exaggeration(){throw new Error(\"Pure virtual method called.\")}findDEMTileFor(t){throw new Error(\"Pure virtual method called.\")}get visibleDemTiles(){throw new Error(\"Getter must be implemented in subclass.\")}getMinMaxForVisibleTiles(){const t=this.visibleDemTiles;if(0===t.length)return null;let e=!1,r=Number.MAX_VALUE,n=Number.MIN_VALUE;for(const i of t){const t=this.getMinMaxForTile(i.tileID);t&&(r=Math.min(r,t.min),n=Math.max(n,t.max),e=!0);}return e?{min:r,max:n}:null}},t.cq=vh,t.cr=ip,t.cs=function(t,e){return [Math.pow(t[0],2.2)*e,Math.pow(t[1],2.2)*e,Math.pow(t[2],2.2)*e]},t.cu=Lh,t.cv=Er,t.cw=Pr,t.cx=256,t.cy=function(e,r){const n=[0,0,0],i=Rh(Sh(r.canonical));return t.Q.transformMat4(n,n,i),t.Q.transformMat4(n,n,e),n},t.cz=t=>({u_camera_to_center_distance:new Su(t),u_extrude_scale:new Ru(t),u_device_pixel_ratio:new Su(t),u_matrix:new Tu(t),u_inv_rot_matrix:new Tu(t),u_merc_center:new Iu(t),u_tile_id:new ku(t),u_zoom_transition:new Su(t),u_up_dir:new ku(t),u_emissive_strength:new Su(t)}),t.d=sn,t.d$=mx,t.d0=Rf,t.d1=ax,t.d2=Fl,t.d3=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[];}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[];}get updateTime(){return this._updateTime}getReplacementRegionsForTile(t){const e=xf(new Ue(0,0),new Ue(is,is),t),r=[];for(const n of this._activeRegions){if(n.hiddenByOverlap)continue;if(!gf(e,n))continue;const i=bf(n.min,n.max,t);r.push({min:i.min,max:i.max,sourceId:this._sourceIds[n.priority],footprint:n.footprint,footprintTileId:n.tileId});}return r}setSources(t){this._setSources(t.map((t=>({getSourceId:()=>t.cache.id,getFootprints:()=>{const e=[];for(const r of t.cache.getVisibleCoordinates()){const n=t.cache.getTile(r).buckets[t.layer];if(n)for(const t of n.getNodesInfo()){const n=t.node;n.footprint&&e.push({footprint:n.footprint,id:r.toUnwrapped()});}}return e}}))));}_addSource(t){const e=t.getFootprints();if(0!==e.length){for(const t of e){if(!t.footprint)continue;const e=xf(t.footprint.min,t.footprint.max,t.id);this._activeRegions.push({min:e.min,max:e.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:t.id,footprint:t.footprint});}this._sourceIds.push(t.getSourceId());}}_computeReplacement(){this._activeRegions.sort(((t,e)=>t.priority-e.priority||mf(t.min,e.min)||mf(t.max,e.max)));let t=this._activeRegions.length!==this._prevRegions.length;if(!t){let e=0,r=0;for(;!t&&e!==this._activeRegions.length;){const n=this._activeRegions[e],i=this._prevRegions[r];t=n.priority!==i.priority||!yf(n,i),++e,++r;}}if(t){++this._updateTime;const t=t=>{const e=this._activeRegions;if(t>=e.length)return t;const r=e[t].priority;for(;t<e.length&&e[t].priority===r;)++t;return t};if(this._sourceIds.length>1){let e=0,r=t(e);for(;e!==r;){let n=e;const i=e;for(;n!==r;){const t=this._activeRegions[n];t.hiddenByOverlap=!1;for(let e=0;e<i;e++){const r=this._activeRegions[e];if(!r.hiddenByOverlap&&gf(t,r)&&(t.hiddenByOverlap=_f(t.footprint,t.tileId,r.footprint,r.tileId),t.hiddenByOverlap))break}++n;}e=r,r=t(e);}}}}_setSources(t){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=t.length-1;e>=0;e--)this._addSource(t[e]);this._computeReplacement();}},t.d4=class{constructor(t){this._createGrid(t),this._createPoles(t);}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const t of this._poleSegments)t.destroy();for(const t of this._gridSegments)t.withSkirts.destroy(),t.withoutSkirts.destroy();}_fillGridMeshWithLods(t,e){const r=new Sl,n=new ql,i=[],s=t+1+2,a=e[0]+1,o=e[0]+1+(1+e.length),l=(t,e,r)=>{let n=t===s-1?t-2:0===t?t:t-1;return n+=r?24575:0,[n,e]};for(let t=0;t<s;++t)r.emplaceBack(...l(t,0,!0));for(let t=0;t<a;++t)for(let e=0;e<s;++e)r.emplaceBack(...l(e,t,(0===e||e===s-1)&&!0));for(let t=0;t<e.length;++t){const n=e[t];for(let t=0;t<s;++t)r.emplaceBack(...l(t,n,!0));}for(let t=0;t<e.length;++t){const a=n.length,l=e[t]+1+2,u=new ql;for(let r=0;r<l-1;r++){const i=r===l-2,a=i?s*(o-e.length+t-r):s;for(let t=0;t<s-1;t++){const e=r*s+t;0===r||i||0===t||t===s-2?(u.emplaceBack(e+1,e,e+a),u.emplaceBack(e+a,e+a+1,e+1)):(n.emplaceBack(e+1,e,e+a),n.emplaceBack(e+a,e+a+1,e+1));}}const c=mu.simpleSegment(0,a,r.length,n.length-a);for(let t=0;t<u.uint16.length;t+=3)n.emplaceBack(u.uint16[t],u.uint16[t+1],u.uint16[t+2]);const h=mu.simpleSegment(0,a,r.length,n.length-a);i.push({withoutSkirts:c,withSkirts:h});}return {vertices:r,indices:n,segments:i}}_createGrid(t){const e=this._fillGridMeshWithLods(Hu,Ju);this._gridSegments=e.segments,this._gridBuffer=t.createVertexBuffer(e.vertices,bh.members),this._gridIndexBuffer=t.createIndexBuffer(e.indices,!0);}_createPoles(t){const e=new ql;for(let t=0;t<=Hu;t++)e.emplaceBack(0,t+1,t+2);this._poleIndexBuffer=t.createIndexBuffer(e,!0);const r=new Yl,n=new Yl,i=new Yl,s=new Yl;this._poleSegments=[];for(let t=0,e=0;t<Zu;t++){const a=360/(1<<t);r.emplaceBack(0,-Xu,0,.5,0),n.emplaceBack(0,-Xu,0,.5,1),i.emplaceBack(0,-Xu,0,.5,.5),s.emplaceBack(0,-Xu,0,.5,.5);for(let t=0;t<=Hu;t++){let e=t/Hu,o=0;const l=qn(0,a,e),[u,c,h]=rc(qh,$h,l,Xu);r.emplaceBack(u,c,h,e,o),n.emplaceBack(u,c,h,e,1-o);const p=qe(l);e=.5+.5*Math.sin(p),o=.5+.5*Math.cos(p),i.emplaceBack(u,c,h,e,o),s.emplaceBack(u,c,h,e,1-o);}this._poleSegments.push(mu.simpleSegment(e,0,66,64)),e+=66;}this._poleNorthVertexBuffer=t.createVertexBuffer(r,gh,!1),this._poleSouthVertexBuffer=t.createVertexBuffer(n,gh,!1),this._texturedPoleNorthVertexBuffer=t.createVertexBuffer(i,gh,!1),this._texturedPoleSouthVertexBuffer=t.createVertexBuffer(s,gh,!1);}getGridBuffers(t,e){return [this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[t].withSkirts:this._gridSegments[t].withoutSkirts]}getPoleBuffers(t,e){return [e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[t]]}},t.d5=function(t){return An.has(t)},t.d6=Ye,t.d7=function(){return !!document.fullscreenElement||!!document.webkitFullscreenElement},t.d8=Xe,t.d9=kc,t.dA=vx,t.dB=function(t){const e=Or();if(!e)return;const r=e.delete(Rr);t&&r.catch(t).then((()=>t()));},t.dC=gx,t.dD=Ex,t.dE=function(t){Ax=Tr.resolveURL(t),Px||(Px=new yx(wx(),new Dn)),Px.broadcast(\"setDracoUrl\",Ax);},t.dF=zx,t.dG=function(t){Ix=Tr.resolveURL(t),Px||(Px=new yx(wx(),new Dn)),Px.broadcast(\"setMeshoptUrl\",Ix);},t.dH=fo,t.dI=rp,t.dJ=sy,t.dK=ib,t.dL=ob,t.dM=_d,t.dN=or,t.dO=ey,t.dP=function(t,e,r,n,i,s,a,o,l,u,c){t.createArrays(),t.tilePixelRatio=is/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;const h=t.layers[0].layout,p=t.layers[0]._unevaluatedLayout._values,f={};if(\"composite\"===t.textSizeData.kind){const{minZoom:e,maxZoom:r}=t.textSizeData;f.compositeTextSizes=[p[\"text-size\"].possiblyEvaluate(new Uo(e),o),p[\"text-size\"].possiblyEvaluate(new Uo(r),o)];}if(\"composite\"===t.iconSizeData.kind){const{minZoom:e,maxZoom:r}=t.iconSizeData;f.compositeIconSizes=[p[\"icon-size\"].possiblyEvaluate(new Uo(e),o),p[\"icon-size\"].possiblyEvaluate(new Uo(r),o)];}f.layoutTextSize=p[\"text-size\"].possiblyEvaluate(new Uo(l+1),o),f.layoutIconSize=p[\"icon-size\"].possiblyEvaluate(new Uo(l+1),o),f.textMaxSize=p[\"text-size\"].possiblyEvaluate(new Uo(18),o);const d=\"map\"===h.get(\"text-rotation-alignment\")&&\"point\"!==h.get(\"symbol-placement\"),m=h.get(\"text-size\");let y=!1;for(const e of t.features)if(e.icon&&e.icon.nameSecondary){y=!0;break}for(const s of t.features){const l=h.get(\"text-font\").evaluate(s,{},o).join(\",\"),p=m.evaluate(s,{},o),g=f.layoutTextSize.evaluate(s,{},o),x=(f.layoutIconSize.evaluate(s,{},o),{horizontal:{},vertical:void 0}),b=s.text;let v,_=[0,0];if(b){const n=b.toString(),a=h.get(\"text-letter-spacing\").evaluate(s,{},o)*$d,u=h.get(\"text-line-height\").evaluate(s,{},o)*$d,c=_o(n)?a:0,f=h.get(\"text-anchor\").evaluate(s,{},o),m=h.get(\"text-variable-anchor\");if(!m){const t=h.get(\"text-radial-offset\").evaluate(s,{},o);_=t?vy(f,[t*$d,xy]):h.get(\"text-offset\").evaluate(s,{},o).map((t=>t*$d));}let y=d?\"center\":h.get(\"text-justify\").evaluate(s,{},o);const v=\"point\"===h.get(\"symbol-placement\"),w=v?h.get(\"text-max-width\").evaluate(s,{},o)*$d:1/0,M=s=>{t.allowVerticalPlacement&&vo(n)&&(x.vertical=Tm(b,e,r,i,l,w,u,f,s,c,_,Pm.vertical,!0,g,p));};if(!d&&m){const t=\"auto\"===y?m.map((t=>_y(t))):[y];let n=!1;for(let s=0;s<t.length;s++){const a=t[s];if(!x.horizontal[a])if(n)x.horizontal[a]=x.horizontal[0];else {const t=Tm(b,e,r,i,l,w,u,\"center\",a,c,_,Pm.horizontal,!1,g,p);t&&(x.horizontal[a]=t,n=1===t.positionedLines.length);}}M(\"left\");}else {if(\"auto\"===y&&(y=_y(f)),v||h.get(\"text-writing-mode\").indexOf(\"horizontal\")>=0||!vo(n)){const t=Tm(b,e,r,i,l,w,u,f,y,c,_,Pm.horizontal,!1,g,p);t&&(x.horizontal[y]=t);}M(v?\"left\":y);}}let w=!1;if(s.icon&&s.icon.namePrimary){const e=n[s.icon.namePrimary];e&&(v=Nm(i[s.icon.namePrimary],s.icon.nameSecondary?i[s.icon.nameSecondary]:void 0,h.get(\"icon-offset\").evaluate(s,{},o),h.get(\"icon-anchor\").evaluate(s,{},o)),w=e.sdf,void 0===t.sdfIcons?t.sdfIcons=e.sdf:t.sdfIcons!==e.sdf&&hr(\"Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer\"),(e.pixelRatio!==t.pixelRatio||0!==h.get(\"icon-rotate\").constantOr(1))&&(t.iconsNeedLinear=!0));}const M=Iy(x.horizontal)||x.vertical;t.iconsInText||(t.iconsInText=!!M&&M.iconsInText),(M||v)&&wy(t,s,x,v,n,f,g,0,_,w,a,o,u,c,y);}s&&t.generateCollisionDebugBuffers(l,t.collisionBoxArray);},t.dQ=pf,t.dR=wm,t.dS=Cf,t.dT=ff,t.dU=Jp,t.dV=Fe,t.dW=em,t.dX=h,t.dY=function(t){let e=0;if(new Uint32Array(t,0,1)[0]!==Ox){const r=new Uint32Array(t,0,7),[,,n,i,s,a]=r;e=r.byteLength+i+s+a+s,(n!==t.byteLength||e>=t.byteLength)&&hr(\"Invalid b3dm header information.\");}return Gx(t,e)},t.dZ=function(t,e){const r=eb(t);for(const t of r){for(const e of t.meshes)rb(e);t.lights&&(t.lightMeshIndex=t.meshes.length,t.meshes.push(nb(t.lights,e)));}return r},t.d_=yb,t.da=nc,t.db=function([t,e,r]){const n=Math.hypot(t,e,r),i=Math.atan2(t,r),s=.5*Math.PI-Math.acos(-e/n);return new ac($e(i),$e(s))},t.dc=ic,t.dd=n,t.de=Nh,t.df=Uh,t.dg=function(e){const r=[0,0,0],n=t.a9.identity(new Float64Array(16));return t.a9.multiply(n,e.pixelMatrix,e.globeMatrix),t.Q.transformMat4(r,r,n),new Ue(r[0],r[1])},t.dh=function(t){const e=t.navigator?t.navigator.userAgent:null;return !!function(t){if(null==Mr){const e=t.navigator?t.navigator.userAgent:null;Mr=!!t.safari||!(!e||!(/\\b(iPad|iPhone|iPod)\\b/.test(e)||e.match(\"Safari\")&&!e.match(\"Chrome\")));}return Mr}(t)&&e&&(e.match(\"Version/15.4\")||e.match(\"Version/15.5\")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},t.di=class{constructor(t,e,r){this._transformRequestFn=t,this._customAccessToken=e,this._silenceAuthErrors=!!r,this._createSkuToken();}_createSkuToken(){const t=function(){let t=\"\";for(let e=0;e<10;e++)t+=\"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"[Math.floor(62*Math.random())];return {token:[\"1\",an,t].join(\"\"),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt;}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeStyleURL(t,r){if(!s(t))return t;const n=un(t);return n.params.push(`sdk=js-${e}`),n.path=`/styles/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||r)}normalizeGlyphsURL(t,e){if(!s(t))return t;const r=un(t);return r.path=`/fonts/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||e)}normalizeModelURL(t,e){if(!s(t))return t;const r=un(t);return r.path=`/models/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||e)}normalizeSourceURL(t,e,r,n){if(!s(t))return t;const i=un(t);return i.path=`/v4/${i.authority}.json`,i.params.push(\"secure\"),r&&i.params.push(`language=${r}`),n&&i.params.push(`worldview=${n}`),this._makeAPIURL(i,this._customAccessToken||e)}normalizeSpriteURL(t,e,r,n){const i=un(t);return s(t)?(i.path=`/styles/v1${i.path}/sprite${e}${r}`,this._makeAPIURL(i,this._customAccessToken||n)):(i.path+=`${e}${r}`,cn(i))}normalizeTileURL(t,e,r){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!s(t))return t;const i=un(t);i.path=i.path.replace(/(\\.(png|jpg)\\d*)(?=$)/,`${e||r&&\"raster\"!==i.authority&&512===r?\"@2x\":\"\"}${jr.supported?\".webp\":\"$1\"}`),\"raster\"===i.authority?i.path=`/${n.RASTER_URL_PREFIX}${i.path}`:\"rasterarrays\"===i.authority?i.path=`/${n.RASTERARRAYS_URL_PREFIX}${i.path}`:(i.path=i.path.replace(/^.+\\/v4\\//,\"/\"),i.path=`/${n.TILE_URL_VERSION}${i.path}`);const a=this._customAccessToken||function(t){for(const e of t){const t=e.match(/^access_token=(.*)$/);if(t)return t[1]}return null}(i.params)||n.ACCESS_TOKEN;return n.REQUIRE_ACCESS_TOKEN&&a&&this._skuToken&&i.params.push(`sku=${this._skuToken}`),this._makeAPIURL(i,a)}canonicalizeTileURL(t,e){const r=un(t);if(!r.path.match(/^(\\/v4\\/|\\/(raster|rasterarrays)\\/v1\\/)/)||!r.path.match(/\\.[\\w]+$/))return t;let i=\"mapbox://\";r.path.match(/^\\/raster\\/v1\\//)?i+=`raster/${r.path.replace(`/${n.RASTER_URL_PREFIX}/`,\"\")}`:r.path.match(/^\\/rasterarrays\\/v1\\//)?i+=`rasterarrays/${r.path.replace(`/${n.RASTERARRAYS_URL_PREFIX}/`,\"\")}`:i+=`tiles/${r.path.replace(`/${n.TILE_URL_VERSION}/`,\"\")}`;let s=r.params;return e&&(s=s.filter((t=>!t.match(/^access_token=/)))),s.length&&(i+=`?${s.join(\"&\")}`),i}canonicalizeTileset(t,e){const r=!!e&&s(e),n=[];for(const e of t.tiles||[])i(e)?n.push(this.canonicalizeTileURL(e,r)):n.push(e);return n}_makeAPIURL(t,e){const r=\"See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes\",i=un(n.API_URL);if(t.protocol=i.protocol,t.authority=i.authority,\"http\"===t.protocol){const e=t.params.indexOf(\"secure\");e>=0&&t.params.splice(e,1);}if(\"/\"!==i.path&&(t.path=`${i.path}${t.path}`),!n.REQUIRE_ACCESS_TOKEN)return cn(t);if(e=e||n.ACCESS_TOKEN,!this._silenceAuthErrors){if(!e)throw new Error(`An API access token is required to use Mapbox GL. ${r}`);if(\"s\"===e[0])throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${r}`)}return t.params=t.params.filter((t=>-1===t.indexOf(\"access_token\"))),t.params.push(`access_token=${e||\"\"}`),cn(t)}},t.dj=function(t,e){e?An.add(t):An.delete(t);},t.dk=jr,t.dl=_n,t.dm=Mn,t.dn=on,t.dp=gn,t.dq=bn,t.dr=function(t){An.delete(t);},t.ds=wn,t.dt=yn,t.du=e,t.dv=function(t,e){Vr=t,Dr=e;},t.dw=function(t,e,r=!1){if(Bo===Po||Bo===Eo||Bo===zo)throw new Error(\"setRTLTextPlugin cannot be called multiple times.\");Co=Tr.resolveURL(t),Bo=Po,To=e,Vo(),r||Fo();},t.dx=Lo,t.dy=function(){wx().acquire(bx);},t.dz=function(){const t=_x;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(bx),_x=null):console.warn(\"Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()\"));},t.e=Je,t.e0=Oo,t.e1=function(t){Ur(),Lr&&Lr.then((e=>{e.keys().then((r=>{for(let n=0;n<r.length-t;n++)e.delete(r[n]);}));}));},t.f=Tr,t.g=function(t,e){return Hr(Je(t,{type:\"json\"}),e)},t.h=np,t.i=class extends Hg{},t.j=Si,t.k=Qn,t.l=function(t){return fetch(t).then((t=>t.arrayBuffer())).then((e=>Gx(e,0,t)))},t.m=ja,t.n=$a,t.o=eo,t.p=Hm,t.q=tl,t.r=so,t.s=Ga,t.t=ro,t.u=Jo,t.v=Os,t.w=hr,t.x=Ns,t.y=Fs;}));\n\ndefine([\"./shared\"],(function(e){\"use strict\";function t(e){const t=e?e.url.toString():void 0;return t?performance.getEntriesByName(t):[]}function s(e){if(\"number\"==typeof e||\"boolean\"==typeof e||\"string\"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){let t=\"[\";for(const i of e)t+=`${s(i)},`;return `${t}]`}let t=\"{\";for(const i of Object.keys(e).sort())t+=`${i}:${s(e[i])},`;return `${t}}`}function i(t){let i=\"\";for(const o of e.b5)i+=`/${s(t[o])}`;return i}class o{constructor(e){this.keyCache={},this._layers={},this._layerConfigs={},e&&this.replace(e);}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t);}update(t,s,o){this._options=o;for(const s of t)this._layerConfigs[s.id]=s,(this._layers[s.id]=e.c7(s,this.scope,this._options)).compileFilter(),this.keyCache[s.id]&&delete this.keyCache[s.id];for(const e of s)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const r=function(e,t){const s={};for(let o=0;o<e.length;o++){const r=t&&t[e[o].id]||i(e[o]);t&&(t[e[o].id]=r);let n=s[r];n||(n=s[r]=[]),n.push(e[o]);}const o=[];for(const e in s)o.push(s[e]);return o}(e.b2(this._layerConfigs),this.keyCache);for(const e of r){const t=e.map((e=>this._layers[e.id])),s=t[0];if(\"none\"===s.visibility)continue;const i=s.source||\"\";let o=this.familiesBySource[i];o||(o=this.familiesBySource[i]={});const r=s.sourceLayer||\"_geojsonTileLayer\";let n=o[r];n||(n=o[r]=[]),n.push(t);}}}const r=1*e.dJ;class n{constructor(t){const s={},i=[];for(const e in t){const o=t[e],n=s[e]={};for(const e in o.glyphs){const t=o.glyphs[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const s=t.metrics.localGlyph?r:1,a={x:0,y:0,w:t.bitmap.width+2*s,h:t.bitmap.height+2*s};i.push(a),n[e]=a;}}const{w:o,h:n}=e.p(i),a=new e.dI({width:o||1,height:n||1});for(const i in t){const o=t[i];for(const t in o.glyphs){const n=o.glyphs[+t];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const l=s[i][t],h=n.metrics.localGlyph?r:1;e.dI.copy(n.bitmap,a,{x:0,y:0},{x:l.x+h,y:l.y+h},n.bitmap);}}this.image=a,this.positions=s;}}e.dH(n,\"GlyphAtlas\");class a{constructor(t){this.tileID=new e.ap(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.canonical=t.tileID.canonical,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.scope=t.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.promoteId=t.promoteId,this.isSymbolTile=t.isSymbolTile,this.tileTransform=e.av(t.tileID.canonical,t.projection),this.projection=t.projection,this.brightness=t.brightness,this.extraShadowCaster=!!t.extraShadowCaster;}parse(t,s,i,o,r){this.status=\"parsing\",this.data=t,this.collisionBoxArray=new e.aG;const a=new e.dK(Object.keys(t.layers).sort()),h=new e.dL(this.tileID,this.promoteId);h.bucketLayerIDs=[];const c={},u=new e.dM(256,256),d={featureIndex:h,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:u,availableImages:i,brightness:this.brightness},p=s.familiesBySource[this.source];for(const s in p){const o=t.layers[s];if(!o)continue;let r=!1,n=!1,u=!1;for(const e of p[s])\"symbol\"===e[0].type?r=!0:n=!0,e[0].is3D()&&\"model\"!==e[0].type&&(u=!0);if(this.extraShadowCaster&&!u)continue;if(!0===this.isSymbolTile&&!r)continue;if(!1===this.isSymbolTile&&!n)continue;1===o.version&&e.w(`Vector tile source \"${this.source}\" layer \"${s}\" does not use vector tile spec v2 and therefore may have some rendering errors.`);const f=a.encode(s),g=[];for(let e=0;e<o.length;e++){const t=o.feature(e),i=h.getId(t,s);g.push({feature:t,id:i,index:e,sourceLayerIndex:f});}for(const e of p[s]){const t=e[0];(!this.extraShadowCaster||t.is3D()&&\"model\"!==t.type)&&(void 0!==this.isSymbolTile&&\"symbol\"===t.type!==this.isSymbolTile||t.minzoom&&this.zoom<Math.floor(t.minzoom)||t.maxzoom&&this.zoom>=t.maxzoom||\"none\"!==t.visibility&&(l(e,this.zoom,d.brightness,i),(c[t.id]=t.createBucket({index:h.bucketLayerIDs.length,layers:e,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:f,sourceID:this.source,projection:this.projection.spec})).populate(g,d,this.tileID.canonical,this.tileTransform),h.bucketLayerIDs.push(e.map((e=>e.id)))));}}let f,g,m,y;u.trim();const v={type:\"maybePrepare\",isSymbolTile:this.isSymbolTile,zoom:this.zoom},x=()=>{if(f)return this.status=\"done\",r(f);if(this.extraShadowCaster)this.status=\"done\",r(null,{buckets:e.b2(c).filter((e=>!e.isEmpty())),featureIndex:h,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:d.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(g&&m&&y){const t=new n(g),s=new e.dO(m,y);for(const o in c){const r=c[o];r instanceof e.aH?(l(r.layers,this.zoom,d.brightness,i),e.dP(r,g,t.positions,m,s.iconPositions,this.showCollisionBoxes,i,this.tileID.canonical,this.tileZoom,this.projection,this.brightness)):r.hasPattern&&(r instanceof e.aN||r instanceof e.aO||r instanceof e.cO)&&(l(r.layers,this.zoom,d.brightness,i),r.addFeatures(d,this.tileID.canonical,s.patternPositions,i,this.tileTransform,this.brightness));}this.status=\"done\",r(null,{buckets:e.b2(c).filter((e=>!e.isEmpty())),featureIndex:h,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,lineAtlas:u,imageAtlas:s,brightness:d.brightness});}};if(!this.extraShadowCaster){const t=e.dN(d.glyphDependencies,(e=>Object.keys(e).map(Number)));Object.keys(t).length?o.send(\"getGlyphs\",{uid:this.uid,stacks:t,scope:this.scope},((e,t)=>{f||(f=e,g=t,x());}),void 0,!1,v):g={};const s=Object.keys(d.iconDependencies);s.length?o.send(\"getImages\",{icons:s,source:this.source,scope:this.scope,tileID:this.tileID,type:\"icons\"},((e,t)=>{f||(f=e,m=t,x());}),void 0,!1,v):m={};const i=Object.keys(d.patternDependencies);i.length?o.send(\"getImages\",{icons:i,source:this.source,scope:this.scope,tileID:this.tileID,type:\"patterns\"},((e,t)=>{f||(f=e,y=t,x());}),void 0,!1,v):y={};}x();}}function l(t,s,i,o){const r=new e.N(s,{brightness:i});for(const e of t)e.recalculate(r,o);}class h extends e.E{constructor(t,s,i,o,r,n){super(),this.actor=t,this.layerIndex=s,this.availableImages=i,this.loadVectorData=r||e.ak,this.loading={},this.loaded={},this.deduped=new e.ai(t.scheduler),this.isSpriteLoaded=o,this.scheduler=t.scheduler,this.brightness=n;}loadTile(s,i){const o=s.uid,r=s&&s.request,n=r&&r.collectResourceTiming,l=this.loading[o]=new a(s);l.abort=this.loadVectorData(s,((a,h)=>{const c=!this.loading[o];if(delete this.loading[o],c||a||!h)return l.status=\"done\",c||(this.loaded[o]=l),i(a);const u=h.rawData,d={};h.expires&&(d.expires=h.expires),h.cacheControl&&(d.cacheControl=h.cacheControl),l.vectorTile=h.vectorTile||new e.dQ(new e.dR(u));const p=()=>{l.parse(l.vectorTile,this.layerIndex,this.availableImages,this.actor,((s,o)=>{if(s||!o)return i(s);const a={};if(n){const e=t(r);e.length>0&&(a.resourceTiming=JSON.parse(JSON.stringify(e)));}i(null,e.e({rawTileData:u.slice(0)},o,d,a));}));};this.isSpriteLoaded?p():this.once(\"isSpriteLoaded\",(()=>{this.scheduler?this.scheduler.add(p,{type:\"parseTile\",isSymbolTile:s.isSymbolTile,zoom:s.tileZoom}):p();})),this.loaded=this.loaded||{},this.loaded[o]=l;}));}reloadTile(t,s){const i=this.loaded,o=t.uid,r=this;if(i&&i[o]){const n=i[o];n.showCollisionBoxes=t.showCollisionBoxes,n.projection=t.projection,n.brightness=t.brightness,n.tileTransform=e.av(t.tileID.canonical,t.projection),n.extraShadowCaster=t.extraShadowCaster;const a=(e,t)=>{const i=n.reloadCallback;i&&(delete n.reloadCallback,n.parse(n.vectorTile,r.layerIndex,this.availableImages,r.actor,i)),s(e,t);};\"parsing\"===n.status?n.reloadCallback=a:\"done\"===n.status&&(n.vectorTile?n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor,a):a());}else s(null,void 0);}abortTile(e,t){const s=e.uid,i=this.loading[s];i&&(i.abort&&i.abort(),delete this.loading[s]),t();}removeTile(e,t){const s=this.loaded,i=e.uid;s&&s[i]&&delete s[i],t();}}class c{loadTile(t,s){const{uid:i,encoding:o,rawImageData:r,padding:n}=t,a=ImageBitmap&&r instanceof ImageBitmap?this.getImageData(r,n):r;s(null,new e.dS(i,a,o,n<1));}getImageData(e,t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext(\"2d\",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);const s=this.offscreenCanvasContext.getImageData(-t,-t,e.width+2*t,e.height+2*t);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),s}}class u{decodeRasterArray({task:t,buffer:s},i){e.b0.performDecoding(s,t).then((e=>{i(null,e);}),(e=>{i(e);}));}}const d=e.dT.prototype.toGeoJSON;let p=class{constructor(t){this._feature=t,this.extent=e.Y,this.type=t.type,this.properties=t.tags,\"id\"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10));}loadGeometry(){if(1===this._feature.type){const t=[];for(const s of this._feature.geometry)t.push([new e.P(s[0],s[1])]);return t}{const t=[];for(const s of this._feature.geometry){const i=[];for(const t of s)i.push(new e.P(t[0],t[1]));t.push(i);}return t}}toGeoJSON(e,t,s){return d.call(this,e,t,s)}},f=class{constructor(t){this.layers={_geojsonTileLayer:this},this.name=\"_geojsonTileLayer\",this.extent=e.Y,this.length=t.length,this._features=t;}feature(e){return new p(this._features[e])}};var g={exports:{}},m=e.dV,y=e.dU.VectorTileFeature,v=x;function x(e,t){this.options=t||{},this.features=e,this.length=e.length;}function w(e,t){this.id=\"number\"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096;}x.prototype.feature=function(e){return new w(this.features[e],this.options.extent)},w.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var t=0;t<e.length;t++){for(var s=e[t],i=[],o=0;o<s.length;o++)i.push(new m(s[o][0],s[o][1]));this.geometry.push(i);}return this.geometry},w.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,s=-1/0,i=1/0,o=-1/0,r=0;r<e.length;r++)for(var n=e[r],a=0;a<n.length;a++){var l=n[a];t=Math.min(t,l.x),s=Math.max(s,l.x),i=Math.min(i,l.y),o=Math.max(o,l.y);}return [t,i,s,o]},w.prototype.toGeoJSON=y.prototype.toGeoJSON;var S=e.dW,b=v;function I(e){var t=new S;return function(e,t){for(var s in e.layers)t.writeMessage(3,M,e.layers[s]);}(e,t),t.finish()}function M(e,t){var s;t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||\"\"),t.writeVarintField(5,e.extent||4096);var i={keys:[],values:[],keycache:{},valuecache:{}};for(s=0;s<e.length;s++)i.feature=e.feature(s),t.writeMessage(2,k,i);var o=i.keys;for(s=0;s<o.length;s++)t.writeStringField(3,o[s]);var r=i.values;for(s=0;s<r.length;s++)t.writeMessage(4,L,r[s]);}function k(e,t){var s=e.feature;void 0!==s.id&&t.writeVarintField(1,s.id),t.writeMessage(2,T,e),t.writeVarintField(3,s.type),t.writeMessage(4,C,s);}function T(e,t){var s=e.feature,i=e.keys,o=e.values,r=e.keycache,n=e.valuecache;for(var a in s.properties){var l=s.properties[a],h=r[a];if(null!==l){void 0===h&&(i.push(a),r[a]=h=i.length-1),t.writeVarint(h);var c=typeof l;\"string\"!==c&&\"boolean\"!==c&&\"number\"!==c&&(l=JSON.stringify(l));var u=c+\":\"+l,d=n[u];void 0===d&&(o.push(l),n[u]=d=o.length-1),t.writeVarint(d);}}}function P(e,t){return (t<<3)+(7&e)}function _(e){return e<<1^e>>31}function C(e,t){for(var s=e.loadGeometry(),i=e.type,o=0,r=0,n=s.length,a=0;a<n;a++){var l=s[a],h=1;1===i&&(h=l.length),t.writeVarint(P(1,h));for(var c=3===i?l.length-1:l.length,u=0;u<c;u++){1===u&&1!==i&&t.writeVarint(P(2,c-1));var d=l[u].x-o,p=l[u].y-r;t.writeVarint(_(d)),t.writeVarint(_(p)),o+=d,r+=p;}3===i&&t.writeVarint(P(7,1));}}function L(e,t){var s=typeof e;\"string\"===s?t.writeStringField(1,e):\"boolean\"===s?t.writeBooleanField(7,e):\"number\"===s&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e));}g.exports=I,g.exports.fromVectorTileJs=I,g.exports.fromGeojsonVt=function(e,t){t=t||{};var s={};for(var i in e)s[i]=new b(e[i].features,t),s[i].name=i,s[i].version=t.version,s[i].extent=t.extent;return I({layers:s})},g.exports.GeoJSONWrapper=b;var D=e.dX(g.exports);const j={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},O=Math.fround||(z=new Float32Array(1),e=>(z[0]=+e,z[0]));var z;const Z=3,A=5,N=6;class E{constructor(e){this.options=Object.assign(Object.create(j),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[];}load(e){const{log:t,minZoom:s,maxZoom:i}=this.options;t&&console.time(\"total time\");const o=`prepare ${e.length} points`;t&&console.time(o),this.points=e;const r=[];for(let t=0;t<e.length;t++){const s=e[t];if(!s.geometry)continue;const[i,o]=s.geometry.coordinates,n=O(B(i)),a=O(J(o));r.push(n,a,1/0,t,-1,1),this.options.reduce&&r.push(0);}let n=this.trees[i+1]=this._createTree(r);t&&console.timeEnd(o);for(let e=i;e>=s;e--){const s=+Date.now();n=this.trees[e]=this._createTree(this._cluster(n,e)),t&&console.log(\"z%d: %d clusters in %dms\",e,n.numItems,+Date.now()-s);}return t&&console.timeEnd(\"total time\"),this}getClusters(e,t){let s=((e[0]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,e[1]));let o=180===e[2]?180:((e[2]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)s=-180,o=180;else if(s>o){const e=this.getClusters([s,i,180,r],t),n=this.getClusters([-180,i,o,r],t);return e.concat(n)}const n=this.trees[this._limitZoom(t)],a=n.range(B(s),J(r),B(o),J(i)),l=n.data,h=[];for(const e of a){const t=this.stride*e;h.push(l[t+A]>1?F(l,t,this.clusterProps):this.points[l[t+Z]]);}return h}getChildren(e){const t=this._getOriginId(e),s=this._getOriginZoom(e),i=\"No cluster with the specified id.\",o=this.trees[s];if(!o)throw new Error(i);const r=o.data;if(t*this.stride>=r.length)throw new Error(i);const n=this.options.radius/(this.options.extent*Math.pow(2,s-1)),a=o.within(r[t*this.stride],r[t*this.stride+1],n),l=[];for(const t of a){const s=t*this.stride;r[s+4]===e&&l.push(r[s+A]>1?F(r,s,this.clusterProps):this.points[r[s+Z]]);}if(0===l.length)throw new Error(i);return l}getLeaves(e,t,s){const i=[];return this._appendLeaves(i,e,t=t||10,s=s||0,0),i}getTile(e,t,s){const i=this.trees[this._limitZoom(e)],o=Math.pow(2,e),{extent:r,radius:n}=this.options,a=n/r,l=(s-a)/o,h=(s+1+a)/o,c={features:[]};return this._addTileFeatures(i.range((t-a)/o,l,(t+1+a)/o,h),i.data,t,s,o,c),0===t&&this._addTileFeatures(i.range(1-a/o,l,1,h),i.data,o,s,o,c),t===o-1&&this._addTileFeatures(i.range(0,l,a/o,h),i.data,-1,s,o,c),c.features.length?c:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const s=this.getChildren(e);if(t++,1!==s.length)break;e=s[0].properties.cluster_id;}return t}_appendLeaves(e,t,s,i,o){const r=this.getChildren(t);for(const t of r){const r=t.properties;if(r&&r.cluster?o+r.point_count<=i?o+=r.point_count:o=this._appendLeaves(e,r.cluster_id,s,i,o):o<i?o++:e.push(t),e.length===s)break}return o}_createTree(t){const s=new e.bj(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let e=0;e<t.length;e+=this.stride)s.add(t[e],t[e+1]);return s.finish(),s.data=t,s}_addTileFeatures(e,t,s,i,o,r){for(const n of e){const e=n*this.stride,a=t[e+A]>1;let l,h,c;if(a)l=W(t,e,this.clusterProps),h=t[e],c=t[e+1];else {const s=this.points[t[e+Z]];l=s.properties;const[i,o]=s.geometry.coordinates;h=B(i),c=J(o);}const u={type:1,geometry:[[Math.round(this.options.extent*(h*o-s)),Math.round(this.options.extent*(c*o-i))]],tags:l};let d;d=a||this.options.generateId?t[e+Z]:this.points[t[e+Z]].id,void 0!==d&&(u.id=d),r.features.push(u);}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:s,extent:i,reduce:o,minPoints:r}=this.options,n=s/(i*Math.pow(2,t)),a=e.data,l=[],h=this.stride;for(let s=0;s<a.length;s+=h){if(a[s+2]<=t)continue;a[s+2]=t;const i=a[s],c=a[s+1],u=e.within(a[s],a[s+1],n),d=a[s+A];let p=d;for(const e of u){const s=e*h;a[s+2]>t&&(p+=a[s+A]);}if(p>d&&p>=r){let e,r=i*d,n=c*d,f=-1;const g=(s/h<<5)+(t+1)+this.points.length;for(const i of u){const l=i*h;if(a[l+2]<=t)continue;a[l+2]=t;const c=a[l+A];r+=a[l]*c,n+=a[l+1]*c,a[l+4]=g,o&&(e||(e=this._map(a,s,!0),f=this.clusterProps.length,this.clusterProps.push(e)),o(e,this._map(a,l)));}a[s+4]=g,l.push(r/p,n/p,1/0,g,-1,p),o&&l.push(f);}else {for(let e=0;e<h;e++)l.push(a[s+e]);if(p>1)for(const e of u){const s=e*h;if(!(a[s+2]<=t)){a[s+2]=t;for(let e=0;e<h;e++)l.push(a[s+e]);}}}}return l}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return (e-this.points.length)%32}_map(e,t,s){if(e[t+A]>1){const i=this.clusterProps[e[t+N]];return s?Object.assign({},i):i}const i=this.points[e[t+Z]].properties,o=this.options.map(i);return s&&o===i?Object.assign({},o):o}}function F(e,t,s){return {type:\"Feature\",id:e[t+Z],properties:W(e,t,s),geometry:{type:\"Point\",coordinates:[(i=e[t],360*(i-.5)),G(e[t+1])]}};var i;}function W(e,t,s){const i=e[t+A],o=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?Math.round(i/100)/10+\"k\":i,r=e[t+N],n=-1===r?{}:Object.assign({},s[r]);return Object.assign(n,{cluster:!0,cluster_id:e[t+Z],point_count:i,point_count_abbreviated:o})}function B(e){return e/360+.5}function J(e){const t=Math.sin(e*Math.PI/180),s=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return s<0?0:s>1?1:s}function G(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}var Y={exports:{}};Y.exports=function(){function e(s,i,o,r){for(var n,a=r,l=o-i>>1,h=o-i,c=s[i],u=s[i+1],d=s[o],p=s[o+1],f=i+3;f<o;f+=3){var g=t(s[f],s[f+1],c,u,d,p);if(g>a)n=f,a=g;else if(g===a){var m=Math.abs(f-l);m<h&&(n=f,h=m);}}a>r&&(n-i>3&&e(s,i,n,r),s[n+2]=a,o-n>3&&e(s,n,o,r));}function t(e,t,s,i,o,r){var n=o-s,a=r-i;if(0!==n||0!==a){var l=((e-s)*n+(t-i)*a)/(n*n+a*a);l>1?(s=o,i=r):l>0&&(s+=n*l,i+=a*l);}return (n=e-s)*n+(a=t-i)*a}function s(e,t,s,o){var r={id:void 0===e?null:e,type:t,geometry:s,tags:o,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,s=e.type;if(\"Point\"===s||\"MultiPoint\"===s||\"LineString\"===s)i(e,t);else if(\"Polygon\"===s||\"MultiLineString\"===s)for(var o=0;o<t.length;o++)i(e,t[o]);else if(\"MultiPolygon\"===s)for(o=0;o<t.length;o++)for(var r=0;r<t[o].length;r++)i(e,t[o][r]);}(r),r}function i(e,t){for(var s=0;s<t.length;s+=3)e.minX=Math.min(e.minX,t[s]),e.minY=Math.min(e.minY,t[s+1]),e.maxX=Math.max(e.maxX,t[s]),e.maxY=Math.max(e.maxY,t[s+1]);}function o(e,t,i,l){if(t.geometry){var h=t.geometry.coordinates,c=t.geometry.type,u=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),d=[],p=t.id;if(i.promoteId?p=t.properties[i.promoteId]:i.generateId&&(p=l||0),\"Point\"===c)r(h,d);else if(\"MultiPoint\"===c)for(var f=0;f<h.length;f++)r(h[f],d);else if(\"LineString\"===c)n(h,d,u,!1);else if(\"MultiLineString\"===c){if(i.lineMetrics){for(f=0;f<h.length;f++)n(h[f],d=[],u,!1),e.push(s(p,\"LineString\",d,t.properties));return}a(h,d,u,!1);}else if(\"Polygon\"===c)a(h,d,u,!0);else {if(\"MultiPolygon\"!==c){if(\"GeometryCollection\"===c){for(f=0;f<t.geometry.geometries.length;f++)o(e,{id:p,geometry:t.geometry.geometries[f],properties:t.properties},i,l);return}throw new Error(\"Input data is not a valid GeoJSON object.\")}for(f=0;f<h.length;f++){var g=[];a(h[f],g,u,!0),d.push(g);}}e.push(s(p,c,d,t.properties));}}function r(e,t){t.push(l(e[0])),t.push(h(e[1])),t.push(0);}function n(t,s,i,o){for(var r,n,a=0,c=0;c<t.length;c++){var u=l(t[c][0]),d=h(t[c][1]);s.push(u),s.push(d),s.push(0),c>0&&(a+=o?(r*d-u*n)/2:Math.sqrt(Math.pow(u-r,2)+Math.pow(d-n,2))),r=u,n=d;}var p=s.length-3;s[2]=1,e(s,0,p,i),s[p+2]=1,s.size=Math.abs(a),s.start=0,s.end=s.size;}function a(e,t,s,i){for(var o=0;o<e.length;o++){var r=[];n(e[o],r,s,i),t.push(r);}}function l(e){return e/360+.5}function h(e){var t=Math.sin(e*Math.PI/180),s=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return s<0?0:s>1?1:s}function c(e,t,i,o,r,n,a,l){if(o/=t,n>=(i/=t)&&a<o)return e;if(a<i||n>=o)return null;for(var h=[],c=0;c<e.length;c++){var p=e[c],g=p.geometry,m=p.type,y=0===r?p.minX:p.minY,v=0===r?p.maxX:p.maxY;if(y>=i&&v<o)h.push(p);else if(!(v<i||y>=o)){var x=[];if(\"Point\"===m||\"MultiPoint\"===m)u(g,x,i,o,r);else if(\"LineString\"===m)d(g,x,i,o,r,!1,l.lineMetrics);else if(\"MultiLineString\"===m)f(g,x,i,o,r,!1);else if(\"Polygon\"===m)f(g,x,i,o,r,!0);else if(\"MultiPolygon\"===m)for(var w=0;w<g.length;w++){var S=[];f(g[w],S,i,o,r,!0),S.length&&x.push(S);}if(x.length){if(l.lineMetrics&&\"LineString\"===m){for(w=0;w<x.length;w++)h.push(s(p.id,m,x[w],p.tags));continue}\"LineString\"!==m&&\"MultiLineString\"!==m||(1===x.length?(m=\"LineString\",x=x[0]):m=\"MultiLineString\"),\"Point\"!==m&&\"MultiPoint\"!==m||(m=3===x.length?\"Point\":\"MultiPoint\"),h.push(s(p.id,m,x,p.tags));}}}return h.length?h:null}function u(e,t,s,i,o){for(var r=0;r<e.length;r+=3){var n=e[r+o];n>=s&&n<=i&&(t.push(e[r]),t.push(e[r+1]),t.push(e[r+2]));}}function d(e,t,s,i,o,r,n){for(var a,l,h=p(e),c=0===o?m:y,u=e.start,d=0;d<e.length-3;d+=3){var f=e[d],v=e[d+1],x=e[d+2],w=e[d+3],S=e[d+4],b=0===o?f:v,I=0===o?w:S,M=!1;n&&(a=Math.sqrt(Math.pow(f-w,2)+Math.pow(v-S,2))),b<s?I>s&&(l=c(h,f,v,w,S,s),n&&(h.start=u+a*l)):b>i?I<i&&(l=c(h,f,v,w,S,i),n&&(h.start=u+a*l)):g(h,f,v,x),I<s&&b>=s&&(l=c(h,f,v,w,S,s),M=!0),I>i&&b<=i&&(l=c(h,f,v,w,S,i),M=!0),!r&&M&&(n&&(h.end=u+a*l),t.push(h),h=p(e)),n&&(u+=a);}var k=e.length-3;f=e[k],v=e[k+1],x=e[k+2],(b=0===o?f:v)>=s&&b<=i&&g(h,f,v,x),k=h.length-3,r&&k>=3&&(h[k]!==h[0]||h[k+1]!==h[1])&&g(h,h[0],h[1],h[2]),h.length&&t.push(h);}function p(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function f(e,t,s,i,o,r){for(var n=0;n<e.length;n++)d(e[n],t,s,i,o,r,!1);}function g(e,t,s,i){e.push(t),e.push(s),e.push(i);}function m(e,t,s,i,o,r){var n=(r-t)/(i-t);return e.push(r),e.push(s+(o-s)*n),e.push(1),n}function y(e,t,s,i,o,r){var n=(r-s)/(o-s);return e.push(t+(i-t)*n),e.push(r),e.push(1),n}function v(e,t){for(var i=[],o=0;o<e.length;o++){var r,n=e[o],a=n.type;if(\"Point\"===a||\"MultiPoint\"===a||\"LineString\"===a)r=x(n.geometry,t);else if(\"MultiLineString\"===a||\"Polygon\"===a){r=[];for(var l=0;l<n.geometry.length;l++)r.push(x(n.geometry[l],t));}else if(\"MultiPolygon\"===a)for(r=[],l=0;l<n.geometry.length;l++){for(var h=[],c=0;c<n.geometry[l].length;c++)h.push(x(n.geometry[l][c],t));r.push(h);}i.push(s(n.id,a,r,n.tags));}return i}function x(e,t){var s=[];s.size=e.size,void 0!==e.start&&(s.start=e.start,s.end=e.end);for(var i=0;i<e.length;i+=3)s.push(e[i]+t,e[i+1],e[i+2]);return s}function w(e,t){if(e.transformed)return e;var s,i,o,r=1<<e.z,n=e.x,a=e.y;for(s=0;s<e.features.length;s++){var l=e.features[s],h=l.geometry,c=l.type;if(l.geometry=[],1===c)for(i=0;i<h.length;i+=2)l.geometry.push(S(h[i],h[i+1],t,r,n,a));else for(i=0;i<h.length;i++){var u=[];for(o=0;o<h[i].length;o+=2)u.push(S(h[i][o],h[i][o+1],t,r,n,a));l.geometry.push(u);}}return e.transformed=!0,e}function S(e,t,s,i,o,r){return [Math.round(s*(e*i-o)),Math.round(s*(t*i-r))]}function b(e,t,s,i,o){for(var r=t===o.maxZoom?0:o.tolerance/((1<<t)*o.extent),n={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:s,y:i,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<e.length;a++){n.numFeatures++,I(n,e[a],r,o);var l=e[a].minX,h=e[a].minY,c=e[a].maxX,u=e[a].maxY;l<n.minX&&(n.minX=l),h<n.minY&&(n.minY=h),c>n.maxX&&(n.maxX=c),u>n.maxY&&(n.maxY=u);}return n}function I(e,t,s,i){var o=t.geometry,r=t.type,n=[];if(\"Point\"===r||\"MultiPoint\"===r)for(var a=0;a<o.length;a+=3)n.push(o[a]),n.push(o[a+1]),e.numPoints++,e.numSimplified++;else if(\"LineString\"===r)M(n,o,e,s,!1,!1);else if(\"MultiLineString\"===r||\"Polygon\"===r)for(a=0;a<o.length;a++)M(n,o[a],e,s,\"Polygon\"===r,0===a);else if(\"MultiPolygon\"===r)for(var l=0;l<o.length;l++){var h=o[l];for(a=0;a<h.length;a++)M(n,h[a],e,s,!0,0===a);}if(n.length){var c=t.tags||null;if(\"LineString\"===r&&i.lineMetrics){for(var u in c={},t.tags)c[u]=t.tags[u];c.mapbox_clip_start=o.start/o.size,c.mapbox_clip_end=o.end/o.size;}var d={geometry:n,type:\"Polygon\"===r||\"MultiPolygon\"===r?3:\"LineString\"===r||\"MultiLineString\"===r?2:1,tags:c};null!==t.id&&(d.id=t.id),e.features.push(d);}}function M(e,t,s,i,o,r){var n=i*i;if(i>0&&t.size<(o?n:i))s.numPoints+=t.length/3;else {for(var a=[],l=0;l<t.length;l+=3)(0===i||t[l+2]>n)&&(s.numSimplified++,a.push(t[l]),a.push(t[l+1])),s.numPoints++;o&&function(e,t){for(var s=0,i=0,o=e.length,r=o-2;i<o;r=i,i+=2)s+=(e[i]-e[r])*(e[i+1]+e[r+1]);if(s>0===t)for(i=0,o=e.length;i<o/2;i+=2){var n=e[i],a=e[i+1];e[i]=e[o-2-i],e[i+1]=e[o-1-i],e[o-2-i]=n,e[o-1-i]=a;}}(a,r),e.push(a);}}function k(e,t){var s=(t=this.options=function(e,t){for(var s in t)e[s]=t[s];return e}(Object.create(this.options),t)).debug;if(s&&console.time(\"preprocess data\"),t.maxZoom<0||t.maxZoom>24)throw new Error(\"maxZoom should be in the 0-24 range\");if(t.promoteId&&t.generateId)throw new Error(\"promoteId and generateId cannot be used together.\");var i=function(e,t){var s=[];if(\"FeatureCollection\"===e.type)for(var i=0;i<e.features.length;i++)o(s,e.features[i],t,i);else o(s,\"Feature\"===e.type?e:{geometry:e},t);return s}(e,t);this.tiles={},this.tileCoords=[],s&&(console.timeEnd(\"preprocess data\"),console.log(\"index: maxZoom: %d, maxPoints: %d\",t.indexMaxZoom,t.indexMaxPoints),console.time(\"generate tiles\"),this.stats={},this.total=0),(i=function(e,t){var s=t.buffer/t.extent,i=e,o=c(e,1,-1-s,s,0,-1,2,t),r=c(e,1,1-s,2+s,0,-1,2,t);return (o||r)&&(i=c(e,1,-s,1+s,0,-1,2,t)||[],o&&(i=v(o,1).concat(i)),r&&(i=i.concat(v(r,-1)))),i}(i,t)).length&&this.splitTile(i,0,0,0),s&&(i.length&&console.log(\"features: %d, points: %d\",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd(\"generate tiles\"),console.log(\"tiles generated:\",this.total,JSON.stringify(this.stats)));}function T(e,t,s){return 32*((1<<e)*s+t)+e}return k.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},k.prototype.splitTile=function(e,t,s,i,o,r,n){for(var a=[e,t,s,i],l=this.options,h=l.debug;a.length;){i=a.pop(),s=a.pop(),t=a.pop(),e=a.pop();var u=1<<t,d=T(t,s,i),p=this.tiles[d];if(!p&&(h>1&&console.time(\"creation\"),p=this.tiles[d]=b(e,t,s,i,l),this.tileCoords.push({z:t,x:s,y:i}),h)){h>1&&(console.log(\"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)\",t,s,i,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd(\"creation\"));var f=\"z\"+t;this.stats[f]=(this.stats[f]||0)+1,this.total++;}if(p.source=e,o){if(t===l.maxZoom||t===o)continue;var g=1<<o-t;if(s!==Math.floor(r/g)||i!==Math.floor(n/g))continue}else if(t===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue;if(p.source=null,0!==e.length){h>1&&console.time(\"clipping\");var m,y,v,x,w,S,I=.5*l.buffer/l.extent,M=.5-I,k=.5+I,P=1+I;m=y=v=x=null,w=c(e,u,s-I,s+k,0,p.minX,p.maxX,l),S=c(e,u,s+M,s+P,0,p.minX,p.maxX,l),e=null,w&&(m=c(w,u,i-I,i+k,1,p.minY,p.maxY,l),y=c(w,u,i+M,i+P,1,p.minY,p.maxY,l),w=null),S&&(v=c(S,u,i-I,i+k,1,p.minY,p.maxY,l),x=c(S,u,i+M,i+P,1,p.minY,p.maxY,l),S=null),h>1&&console.timeEnd(\"clipping\"),a.push(m||[],t+1,2*s,2*i),a.push(y||[],t+1,2*s,2*i+1),a.push(v||[],t+1,2*s+1,2*i),a.push(x||[],t+1,2*s+1,2*i+1);}}},k.prototype.getTile=function(e,t,s){var i=this.options,o=i.extent,r=i.debug;if(e<0||e>24)return null;var n=1<<e,a=T(e,t=(t%n+n)%n,s);if(this.tiles[a])return w(this.tiles[a],o);r>1&&console.log(\"drilling down to z%d-%d-%d\",e,t,s);for(var l,h=e,c=t,u=s;!l&&h>0;)h--,c=Math.floor(c/2),u=Math.floor(u/2),l=this.tiles[T(h,c,u)];return l&&l.source?(r>1&&console.log(\"found parent tile z%d-%d-%d\",h,c,u),r>1&&console.time(\"drilling down\"),this.splitTile(l.source,h,c,u,e,t,s),r>1&&console.timeEnd(\"drilling down\"),this.tiles[a]?w(this.tiles[a],o):null):null},function(e,t){return new k(e,t)}}();var R=e.dX(Y.exports);function X(e,t){const s=e.tileID.canonical;if(!this._geoJSONIndex)return t(null,null);const i=this._geoJSONIndex.getTile(s.z,s.x,s.y);if(!i)return t(null,null);const o=new f(i.features);let r=D(o);0===r.byteOffset&&r.byteLength===r.buffer.byteLength||(r=new Uint8Array(r)),t(null,{vectorTile:o,rawData:r.buffer});}class V extends h{constructor(e,t,s,i,o,r){super(e,t,s,i,X,r),o&&(this.loadGeoJSON=o),this._featureMap=new Map;}loadData(s,i){const o=s&&s.request,r=o&&o.collectResourceTiming;this.loadGeoJSON(s,((n,a)=>{if(n||!a)return i(n);if(\"object\"!=typeof a)return i(new Error(`Input data given to '${s.source}' is not a valid GeoJSON object.`));{try{if(s.filter){const t=e.t(s.filter,{type:\"boolean\",\"property-type\":\"data-driven\",overridable:!1,transition:!1});if(\"error\"===t.result)throw new Error(t.value.map((e=>`${e.key}: ${e.message}`)).join(\", \"));a.features=a.features.filter((e=>t.value.evaluate({zoom:0},e)));}if(s.dynamic){\"Feature\"===a.type&&(a={type:\"FeatureCollection\",features:[a]}),s.append||this._featureMap.clear();for(const e of a.features||[]){const t=e.id;void 0!==t&&(e.geometry?this._featureMap.set(t,e):this._featureMap.delete(t));}a.features=[...this._featureMap.values()];}this._geoJSONIndex=s.cluster?new E(function({superclusterOptions:t,clusterProperties:s}){if(!s||!t)return t;const i={},o={},r={accumulated:null,zoom:0},n={properties:null},a=Object.keys(s);for(const t of a){const[r,n]=s[t],a=e.t(n),l=e.t(\"string\"==typeof r?[r,[\"accumulated\"],[\"get\",t]]:r);i[t]=a.value,o[t]=l.value;}return t.map=e=>{n.properties=e;const t={};for(const e of a)t[e]=i[e].evaluate(r,n);return t},t.reduce=(e,t)=>{n.properties=t;for(const t of a)r.accumulated=e[t],e[t]=o[t].evaluate(r,n);},t}(s)).load(a.features):R(a,s.geojsonVtOptions);}catch(n){return i(n)}this.loaded={};const l={};if(r){const e=t(o);e&&(l.resourceTiming={},l.resourceTiming[s.source]=JSON.parse(JSON.stringify(e)));}i(null,l);}}));}reloadTile(e,t){const s=this.loaded;return s&&s[e.uid]?super.reloadTile(e,t):this.loadTile(e,t)}loadGeoJSON(t,s){if(t.request)e.g(t.request,s);else {if(\"string\"!=typeof t.data)return s(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));try{return s(null,JSON.parse(t.data))}catch(e){return s(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId));}catch(e){t(e);}}getClusterChildren(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId));}catch(e){t(e);}}getClusterLeaves(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset));}catch(e){t(e);}}}class ${constructor(t,s){this.tileID=new e.ap(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.canonical=t.tileID.canonical,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=t.projection,this.brightness=s;}parse(t,s,i,o){this.status=\"parsing\";const r=new e.ap(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),n={},a=s.familiesBySource[i.source],l=new e.dL(r,i.promoteId);return l.bucketLayerIDs=[],l.is3DTile=!0,e.dY(t).then((t=>{if(!t)return o(new Error(\"Could not parse tile\"));const s=e.dZ(t,1/e.bU(i.tileID.canonical)),h=t.json.extensionsUsed&&t.json.extensionsUsed.includes(\"MAPBOX_mesh_features\")||t.json.asset.extras&&t.json.asset.extras.MAPBOX_mesh_features,c=t.json.extensionsUsed&&t.json.extensionsUsed.includes(\"EXT_meshopt_compression\"),u=new e.N(this.zoom,{brightness:this.brightness});for(const t in a)for(const i of a[t]){const t=i[0];l.bucketLayerIDs.push(i.map((e=>e.id))),t.recalculate(u,[]);const o=new e.d_(s,r,h,c,this.brightness,l);h||(o.needsUpload=!0),n[t.fqid]=o,o.evaluate(t);}this.status=\"done\",o(null,{buckets:n,featureIndex:l});})).catch((e=>o(new Error(e.message))))}}class U{constructor(e,t,s,i,o,r){this.actor=e,this.layerIndex=t,this.brightness=r,this.loading={},this.loaded={};}loadTile(t,s){const i=t.uid,o=this.loading[i]=new $(t,this.brightness);e.b1(t.request,((e,r)=>{const n=!this.loading[i];return delete this.loading[i],n||e?(o.status=\"done\",n||(this.loaded[i]=o),s(e)):r&&0!==r.byteLength?void o.parse(r,this.layerIndex,t,((e,t)=>{o.status=\"done\",this.loaded=this.loaded||{},this.loaded[i]=o,e||!t?s(e):s(null,t);})):(o.status=\"done\",this.loaded[i]=o,s())}));}reloadTile(e,t){const s=this.loaded,i=e.uid;if(s&&s[i]){const o=s[i];o.projection=e.projection,o.brightness=e.brightness;const r=(s,i)=>{o.reloadCallback&&(delete o.reloadCallback,this.loadTile(e,t)),t(s,i);};\"parsing\"===o.status?o.reloadCallback=r:\"done\"===o.status&&this.loadTile(e,t);}}abortTile(e,t){const s=e.uid;this.loading[s]&&delete this.loading[s],t();}removeTile(e,t){const s=this.loaded,i=e.uid;s&&s[i]&&delete s[i],t();}}class q{constructor(t){this.self=t,this.actor=new e.d$(t,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=e.br({name:\"mercator\"}),this.workerSourceTypes={vector:h,geojson:V,\"batched-model\":U},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(e,t)=>{if(this.workerSourceTypes[e])throw new Error(`Worker source with name \"${e}\" already registered.`);this.workerSourceTypes[e]=t;},this.self.registerRTLTextPlugin=t=>{if(e.e0.isParsed())throw new Error(\"RTL text plugin already registered.\");e.e0.applyArabicShaping=t.applyArabicShaping,e.e0.processBidirectionalText=t.processBidirectionalText,e.e0.processStyledBidirectionalText=t.processStyledBidirectionalText;};}clearCaches(e,t,s){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],delete this.rasterArrayWorkerSource,s();}checkIfReady(e,t,s){s();}setReferrer(e,t){this.referrer=t;}spriteLoaded(t,{scope:s,isLoaded:i}){if(this.isSpriteLoaded[t]||(this.isSpriteLoaded[t]={}),this.isSpriteLoaded[t][s]=i,this.workerSources[t]&&this.workerSources[t][s])for(const o in this.workerSources[t][s]){const r=this.workerSources[t][s][o];for(const t in r)r[t]instanceof h&&(r[t].isSpriteLoaded=i,r[t].fire(new e.b(\"isSpriteLoaded\")));}}setImages(e,{scope:t,images:s},i){if(this.availableImages[e]||(this.availableImages[e]={}),this.availableImages[e][t]=s,this.workerSources[e]&&this.workerSources[e][t]){for(const i in this.workerSources[e][t]){const o=this.workerSources[e][t][i];for(const e in o)o[e].availableImages=s;}i();}else i();}setProjection(t,s){this.projections[t]=e.br(s);}setBrightness(e,t,s){this.brightness=t,s();}setLayers(e,t,s){this.getLayerIndex(e,t.scope).replace(t.layers,t.options),s();}updateLayers(e,t,s){this.getLayerIndex(e,t.scope).update(t.layers,t.removedIds,t.options),s();}loadTile(e,t,s){t.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,t.type,t.source,t.scope).loadTile(t,s);}loadDEMTile(e,t,s){this.getDEMWorkerSource(e,t.source,t.scope).loadTile(t,s);}decodeRasterArray(e,t,s){this.getRasterArrayWorkerSource().decodeRasterArray(t,s);}reloadTile(e,t,s){t.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,t.type,t.source,t.scope).reloadTile(t,s);}abortTile(e,t,s){this.getWorkerSource(e,t.type,t.source,t.scope).abortTile(t,s);}removeTile(e,t,s){this.getWorkerSource(e,t.type,t.source,t.scope).removeTile(t,s);}removeSource(e,t,s){if(!(this.workerSources[e]&&this.workerSources[e][t.scope]&&this.workerSources[e][t.scope][t.type]&&this.workerSources[e][t.scope][t.type][t.source]))return;const i=this.workerSources[e][t.scope][t.type][t.source];delete this.workerSources[e][t.scope][t.type][t.source],void 0!==i.removeSource?i.removeSource(t,s):s();}loadWorkerSource(e,t,s){try{this.self.importScripts(t.url),s();}catch(e){s(e.toString());}}syncRTLPluginState(t,s,i){try{e.e0.setState(s);const t=e.e0.getPluginURL();if(e.e0.isLoaded()&&!e.e0.isParsed()&&null!=t){this.self.importScripts(t);const s=e.e0.isParsed();i(s?void 0:new Error(`RTL Text Plugin failed to import scripts from ${t}`),s);}}catch(e){i(e.toString());}}setDracoUrl(e,t){this.dracoUrl=t;}getAvailableImages(e,t){this.availableImages[e]||(this.availableImages[e]={});let s=this.availableImages[e][t];return s||(s=[]),s}getLayerIndex(e,t){this.layerIndexes[e]||(this.layerIndexes[e]={});let s=this.layerIndexes[e][t];return s||(s=this.layerIndexes[e][t]=new o,s.scope=t),s}getWorkerSource(e,t,s,i){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][i]||(this.workerSources[e][i]={}),this.workerSources[e][i][t]||(this.workerSources[e][i][t]={}),this.isSpriteLoaded[e]||(this.isSpriteLoaded[e]={}),!this.workerSources[e][i][t][s]){const o={send:(t,s,i,o,r,n)=>{this.actor.send(t,s,i,e,r,n);},scheduler:this.actor.scheduler};this.workerSources[e][i][t][s]=new this.workerSourceTypes[t](o,this.getLayerIndex(e,i),this.getAvailableImages(e,i),this.isSpriteLoaded[e][i],void 0,this.brightness);}return this.workerSources[e][i][t][s]}getDEMWorkerSource(e,t,s){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][s]||(this.demWorkerSources[e][s]={}),this.demWorkerSources[e][s][t]||(this.demWorkerSources[e][s][t]=new c),this.demWorkerSources[e][s][t]}getRasterArrayWorkerSource(){return this.rasterArrayWorkerSource||(this.rasterArrayWorkerSource=new u),this.rasterArrayWorkerSource}enforceCacheSizeLimit(t,s){e.e1(s);}getWorkerPerformanceMetrics(e,t,s){s(void 0,void 0);}}return \"undefined\"!=typeof WorkerGlobalScope&&\"undefined\"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new q(self)),q}));\n\ndefine([\"./shared\"],(function(e){\"use strict\";function t(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return !1;for(let o=0;o<e.length;o++)if(!t(e[o],i[o]))return !1;return !0}if(\"object\"==typeof e&&null!==e&&null!==i){if(\"object\"!=typeof i)return !1;if(Object.keys(e).length!==Object.keys(i).length)return !1;for(const o in e)if(!t(e[o],i[o]))return !1;return !0}return e===i}var i=o;function o(e){return !function(e){return \"undefined\"==typeof window||\"undefined\"==typeof document?\"not a browser\":function(){if(!(\"Worker\"in window&&\"Blob\"in window&&\"URL\"in window))return !1;var e,t,i=new Blob([\"\"],{type:\"text/javascript\"}),o=URL.createObjectURL(i);try{t=new Worker(o),e=!0;}catch(t){e=!1;}return t&&t.terminate(),URL.revokeObjectURL(o),e}()?function(){var e=document.createElement(\"canvas\");e.width=e.height=1;var t=e.getContext(\"2d\");if(!t)return !1;var i=t.getImageData(0,0,1,1);return i&&i.width===e.width}()?(void 0===r[t=e&&e.failIfMajorPerformanceCaveat]&&(r[t]=function(e){var t,i=function(e){var t=document.createElement(\"canvas\"),i=Object.create(o.webGLContextAttributes);return i.failIfMajorPerformanceCaveat=e,t.getContext(\"webgl2\",i)}(e);if(!i)return !1;try{t=i.createShader(i.VERTEX_SHADER);}catch(e){return !1}return !(!t||i.isContextLost())&&(i.shaderSource(t,\"void main() {}\"),i.compileShader(t),!0===i.getShaderParameter(t,i.COMPILE_STATUS))}(t)),r[t]?document.documentMode?\"insufficient ECMAScript 6 support\":void 0:\"insufficient WebGL2 support\"):\"insufficient Canvas/getImageData support\":\"insufficient worker support\";var t;}(e)}var r={};function s(e,t,i){const o=document.createElement(e);return null!=t&&(o.className=t),i&&i.appendChild(o),o}function n(e,t,i){const o=document.createElementNS(\"http://www.w3.org/2000/svg\",e);for(const e of Object.keys(t))o.setAttributeNS(null,e,String(t[e]));return i&&i.appendChild(o),o}o.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};const a=\"undefined\"!=typeof document?document.documentElement&&document.documentElement.style:null,l=a&&void 0!==a.userSelect?\"userSelect\":\"WebkitUserSelect\";let c;function h(){a&&l&&(c=a[l],a[l]=\"none\");}function u(){a&&l&&(a[l]=c);}function d(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener(\"click\",d,!0);}function _(){window.addEventListener(\"click\",d,!0),window.setTimeout((()=>{window.removeEventListener(\"click\",d,!0);}),0);}function p(e,t){const i=e.getBoundingClientRect();return g(e,i,t)}function f(e,t){const i=e.getBoundingClientRect(),o=[];for(let r=0;r<t.length;r++)o.push(g(e,i,t[r]));return o}function m(e){return void 0!==window.InstallTrigger&&2===e.button&&e.ctrlKey&&window.navigator.platform.toUpperCase().indexOf(\"MAC\")>=0?0:e.button}function g(t,i,o){const r=t.offsetWidth===i.width?1:t.offsetWidth/i.width;return new e.P((o.clientX-i.left)*r,(o.clientY-i.top)*r)}class v{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages=new Set;}isDirty(){return this._changed}setDirty(){this._changed=!0;}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(e,t){this._updatedSourceCaches[e]=t,this.setDirty();}discardSourceCacheUpdate(e){delete this._updatedSourceCaches[e];}updateLayer(e){const t=e.scope;this._updatedLayers[t]=this._updatedLayers[t]||new Set,this._updatedLayers[t].add(e.id),this.setDirty();}removeLayer(e){const t=e.scope;this._removedLayers[t]=this._removedLayers[t]||{},this._updatedLayers[t]=this._updatedLayers[t]||new Set,this._removedLayers[t][e.id]=e,this._updatedLayers[t].delete(e.id),this._updatedPaintProps.delete(e.fqid),this.setDirty();}getRemovedLayer(e){return this._removedLayers[e.scope]?this._removedLayers[e.scope][e.id]:null}discardLayerRemoval(e){this._removedLayers[e.scope]&&delete this._removedLayers[e.scope][e.id];}getLayerUpdatesByScope(){const e={};for(const t in this._updatedLayers)e[t]=e[t]||{},e[t].updatedIds=Array.from(this._updatedLayers[t].values());for(const t in this._removedLayers)e[t]=e[t]||{},e[t].removedIds=Object.keys(this._removedLayers[t]);return e}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(e){this._updatedPaintProps.add(e.fqid),this.setDirty();}getUpdatedImages(){return Array.from(this._updatedImages.values())}updateImage(e){this._updatedImages.add(e),this.setDirty();}resetUpdatedImages(){this._updatedImages.clear();}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages.clear();}}class x extends e.E{constructor(e){super(),this.requestManager=e,this.models={\"\":{}},this.numModelsLoading={};}loadModel(t,i){return e.l(this.requestManager.transformRequest(i,e.R.Model).url).then((i=>{if(!i)return;const o=e.c(i),r=new e.M(t,void 0,void 0,o);return r.computeBoundsAndApplyParent(),r})).catch((o=>{if(o&&404===o.status)return null;this.fire(new e.a(new Error(`Could not load model ${t} from ${i}: ${o.message}`)));}))}load(t,i){this.models[i]||(this.models[i]={});const o=Object.keys(t);this.numModelsLoading[i]=(this.numModelsLoading[i]||0)+o.length;const r=[];for(const e of o)r.push(this.loadModel(e,t[e]));Promise.allSettled(r).then((t=>{for(let e=0;e<t.length;e++){const{status:r,value:s}=t[e];\"fulfilled\"===r&&s&&(this.models[i][o[e]]={model:s,numReferences:1});}this.numModelsLoading[i]-=o.length,this.fire(new e.b(\"data\",{dataType:\"style\"}));})).catch((t=>{this.fire(new e.a(new Error(`Could not load models: ${t.message}`)));}));}isLoaded(){for(const e in this.numModelsLoading)if(this.numModelsLoading[e]>0)return !1;return !0}hasModel(e,t){return !!this.getModel(e,t)}getModel(e,t){return this.models[t]||(this.models[t]={}),this.models[t][e]?this.models[t][e].model:void 0}addModel(e,t,i){this.models[i]||(this.models[i]={}),this.hasModel(e,i)&&this.models[i][e].numReferences++,this.load({[e]:this.requestManager.normalizeModelURL(t)},i);}addModels(e,t){this.models[t]||(this.models[t]={});const i={};for(const o in e)this.models[t][o]={},i[o]=this.requestManager.normalizeModelURL(e[o]);this.load(i,t);}addModelsFromBucket(e,t){this.models[t]||(this.models[t]={});const i={};for(const o of e)this.hasModel(o,t)?this.models[t][o].numReferences++:i[o]=this.requestManager.normalizeModelURL(o);this.load(i,t);}removeModel(e,t){if(this.models[t]&&this.models[t][e]&&(this.models[t][e].numReferences--,0===this.models[t][e].numReferences)){const i=this.models[t][e].model;delete this.models[t][e],i.destroy();}}listModels(e){return this.models[e]||(this.models[e]={}),Object.keys(this.models[e])}upload(e,t){this.models[t]||(this.models[t]={});for(const i in this.models[t])this.models[t][i].model&&this.models[t][i].model.upload(e.context);}}class y{constructor(){this.state={},this.stateChanges={},this.deletedStates={};}updateState(t,i,o){const r=String(i);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][r]=this.stateChanges[t][r]||{},e.e(this.stateChanges[t][r],o),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==r&&(this.deletedStates[t][e]=null);}else if(this.deletedStates[t]&&null===this.deletedStates[t][r]){this.deletedStates[t][r]={};for(const e in this.state[t][r])o[e]||(this.deletedStates[t][r][e]=null);}else for(const e in o)this.deletedStates[t]&&this.deletedStates[t][r]&&null===this.deletedStates[t][r][e]&&delete this.deletedStates[t][r][e];}removeFeatureState(e,t,i){if(null===this.deletedStates[e])return;const o=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},i&&void 0!==t)null!==this.deletedStates[e][o]&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][i]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][o])for(i in this.deletedStates[e][o]={},this.stateChanges[e][o])this.deletedStates[e][o][i]=null;else this.deletedStates[e][o]=null;else this.deletedStates[e]=null;}getState(t,i){const o=String(i),r=e.e({},(this.state[t]||{})[o],(this.stateChanges[t]||{})[o]);if(null===this.deletedStates[t])return {};if(this.deletedStates[t]){const e=this.deletedStates[t][i];if(null===e)return {};for(const t in e)delete r[t];}return r}initializeTileState(e,t){e.setFeatureState(this.state,t);}coalesceChanges(t,i){const o={};for(const t in this.stateChanges){this.state[t]=this.state[t]||{};const i={};for(const o in this.stateChanges[t])this.state[t][o]||(this.state[t][o]={}),e.e(this.state[t][o],this.stateChanges[t][o]),i[o]=this.state[t][o];o[t]=i;}for(const t in this.deletedStates){this.state[t]=this.state[t]||{};const i={};if(null===this.deletedStates[t])for(const e in this.state[t])i[e]={},this.state[t][e]={};else for(const e in this.deletedStates[t]){if(null===this.deletedStates[t][e])this.state[t][e]={};else if(this.state[t][e])for(const i of Object.keys(this.deletedStates[t][e]))delete this.state[t][e][i];i[e]=this.state[t][e];}o[t]=o[t]||{},e.e(o[t],i);}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(o).length)for(const e in t)t[e].setFeatureState(o,i);}}function b(e){const{userImage:t}=e;return !!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class w extends e.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded={},this.requestors=[],this.patterns={},this.atlasImage={},this.atlasTexture={},this.dirty=!0;}createScope(t){this.images[t]={},this.loaded[t]=!1,this.updatedImages[t]={},this.patterns[t]={},this.callbackDispatchedThisFrame[t]={},this.atlasImage[t]=new e.h({width:1,height:1});}isLoaded(){for(const e in this.loaded)if(!this.loaded[e])return !1;return !0}setLoaded(e,t){if(this.loaded[t]!==e&&(this.loaded[t]=e,e)){for(const{ids:e,callback:i}of this.requestors)this._notify(e,t,i);this.requestors=[];}}hasImage(e,t){return !!this.getImage(e,t)}getImage(e,t){return this.images[t][e]}addImage(e,t,i){this._validate(e,i)&&(this.images[t][e]=i);}_validate(t,i){let o=!0;return this._validateStretch(i.stretchX,i.data&&i.data.width)||(this.fire(new e.a(new Error(`Image \"${t}\" has invalid \"stretchX\" value`))),o=!1),this._validateStretch(i.stretchY,i.data&&i.data.height)||(this.fire(new e.a(new Error(`Image \"${t}\" has invalid \"stretchY\" value`))),o=!1),this._validateContent(i.content,i)||(this.fire(new e.a(new Error(`Image \"${t}\" has invalid \"content\" value`))),o=!1),o}_validateStretch(e,t){if(!e)return !0;let i=0;for(const o of e){if(o[0]<i||o[1]<o[0]||t<o[1])return !1;i=o[1];}return !0}_validateContent(e,t){return !(e&&(4!==e.length||e[0]<0||t.data.width<e[0]||e[1]<0||t.data.height<e[1]||e[2]<0||t.data.width<e[2]||e[3]<0||t.data.height<e[3]||e[2]<e[0]||e[3]<e[1]))}updateImage(e,t,i){i.version=this.images[t][e].version+1,this.images[t][e]=i,this.updatedImages[t][e]=!0;}removeImage(e,t){const i=this.images[t][e];delete this.images[t][e],delete this.patterns[t][e],i.userImage&&i.userImage.onRemove&&i.userImage.onRemove();}listImages(e){return Object.keys(this.images[e])}getImages(e,t,i){let o=!0;const r=!!this.loaded[t];if(!r)for(const i of e)this.images[t][i]||(o=!1);r||o?this._notify(e,t,i):this.requestors.push({ids:e,scope:t,callback:i});}getUpdatedImages(e){return this.updatedImages[e]}_notify(t,i,o){const r={};for(const o of t){this.images[i][o]||this.fire(new e.b(\"styleimagemissing\",{id:o}));const t=this.images[i][o];t?r[o]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,hasRenderCallback:Boolean(t.userImage&&t.userImage.render)}:e.w(`Image \"${o}\" could not be loaded. Please make sure you have added the image with map.addImage() or a \"sprite\" property in your style. You can provide missing images by listening for the \"styleimagemissing\" map event.`);}o(null,r);}getPixelSize(e){const{width:t,height:i}=this.atlasImage[e];return {width:t,height:i}}getPattern(t,i){const o=this.patterns[i][t],r=this.getImage(t,i);if(!r)return null;if(o&&o.position.version===r.version)return o.position;if(o)o.position.version=r.version;else {const o={w:r.data.width+2,h:r.data.height+2,x:0,y:0},s=new e.I(o,r);this.patterns[i][t]={bin:o,position:s};}return this._updatePatternAtlas(i),this.patterns[i][t].position}bind(t,i){const o=t.gl;let r=this.atlasTexture[i];r?this.dirty&&(r.update(this.atlasImage[i]),this.dirty=!1):(r=new e.T(t,this.atlasImage[i],o.RGBA),this.atlasTexture[i]=r),r.bind(o.LINEAR,o.CLAMP_TO_EDGE);}_updatePatternAtlas(t){const i=[];for(const e in this.patterns[t])i.push(this.patterns[t][e].bin);const{w:o,h:r}=e.p(i),s=this.atlasImage[t];s.resize({width:o||1,height:r||1});for(const i in this.patterns[t]){const{bin:o}=this.patterns[t][i],r=o.x+1,n=o.y+1,a=this.images[t][i].data,l=a.width,c=a.height;e.h.copy(a,s,{x:0,y:0},{x:r,y:n},{width:l,height:c}),e.h.copy(a,s,{x:0,y:c-1},{x:r,y:n-1},{width:l,height:1}),e.h.copy(a,s,{x:0,y:0},{x:r,y:n+c},{width:l,height:1}),e.h.copy(a,s,{x:l-1,y:0},{x:r-1,y:n},{width:1,height:c}),e.h.copy(a,s,{x:0,y:0},{x:r+l,y:n},{width:1,height:c});}this.dirty=!0;}beginFrame(){for(const e in this.images)this.callbackDispatchedThisFrame[e]={};}dispatchRenderCallbacks(e,t){for(const i of e){if(this.callbackDispatchedThisFrame[t][i])continue;this.callbackDispatchedThisFrame[t][i]=!0;const e=this.images[t][i];b(e)&&this.updateImage(i,t,e);}}}function T(t){const i=t.key,o=t.value,r=t.valueSpec||{},s=t.objectElementValidators||{},n=t.style,a=t.styleSpec;let l=[];const c=e.j(o);if(\"object\"!==c)return [new e.V(i,o,`object expected, ${c} found`)];for(const t in o){const c=t.split(\".\")[0];let h;s[c]?h=s[c]:r[c]?h=W:s[\"*\"]?h=s[\"*\"]:r[\"*\"]&&(h=W),h?l=l.concat(h({key:(i?`${i}.`:i)+t,value:o[t],valueSpec:r[c]||r[\"*\"],style:n,styleSpec:a,object:o,objectKey:t},o)):l.push(new e.i(i,o[t],`unknown property \"${t}\"`));}for(const t in r)s[t]||r[t].required&&void 0===r[t].default&&void 0===o[t]&&l.push(new e.V(i,o,`missing required property \"${t}\"`));return l}function E(t){const i=t.value,o=t.valueSpec,r=t.style,s=t.styleSpec,n=t.key,a=t.arrayElementValidator||W;if(\"array\"!==e.j(i))return [new e.V(n,i,`array expected, ${e.j(i)} found`)];if(o.length&&i.length!==o.length)return [new e.V(n,i,`array length ${o.length} expected, length ${i.length} found`)];if(o[\"min-length\"]&&i.length<o[\"min-length\"])return [new e.V(n,i,`array length at least ${o[\"min-length\"]} expected, length ${i.length} found`)];let l={type:o.value,values:o.values,minimum:o.minimum,maximum:o.maximum,function:void 0};s.$version<7&&(l.function=o.function),\"object\"===e.j(o.value)&&(l=o.value);let c=[];for(let e=0;e<i.length;e++)c=c.concat(a({array:i,arrayIndex:e,value:i[e],valueSpec:l,style:r,styleSpec:s,key:`${n}[${e}]`},!0));return c}function S(t){const i=t.key,o=t.value,r=t.valueSpec;let s=e.j(o);if(\"number\"===s&&o!=o&&(s=\"NaN\"),\"number\"!==s)return [new e.V(i,o,`number expected, ${s} found`)];if(\"minimum\"in r){let s=r.minimum;if(\"array\"===e.j(r.minimum)&&(s=r.minimum[t.arrayIndex]),o<s)return [new e.V(i,o,`${o} is less than the minimum value ${s}`)]}if(\"maximum\"in r){let s=r.maximum;if(\"array\"===e.j(r.maximum)&&(s=r.maximum[t.arrayIndex]),o>s)return [new e.V(i,o,`${o} is greater than the maximum value ${s}`)]}return []}function C(t){const i=t.valueSpec,o=e.u(t.value.type);let r,s,n,a={};const l=\"categorical\"!==o&&void 0===t.value.property,c=!l,h=\"array\"===e.j(t.value.stops)&&\"array\"===e.j(t.value.stops[0])&&\"object\"===e.j(t.value.stops[0][0]),u=T({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if(\"identity\"===o)return [new e.V(t.key,t.value,'identity function may not have a \"stops\" property')];let i=[];const r=t.value;return i=i.concat(E({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:d})),\"array\"===e.j(r)&&0===r.length&&i.push(new e.V(t.key,r,\"array must have at least one stop\")),i},default:function(e){return W({key:e.key,value:e.value,valueSpec:i,style:e.style,styleSpec:e.styleSpec})}}});return \"identity\"===o&&l&&u.push(new e.V(t.key,t.value,'missing required property \"property\"')),\"identity\"===o||t.value.stops||u.push(new e.V(t.key,t.value,'missing required property \"stops\"')),\"exponential\"===o&&t.valueSpec.expression&&!e.s(t.valueSpec)&&u.push(new e.V(t.key,t.value,\"exponential functions not supported\")),t.styleSpec.$version>=8&&(c&&!e.m(t.valueSpec)?u.push(new e.V(t.key,t.value,\"property functions not supported\")):l&&!e.n(t.valueSpec)&&u.push(new e.V(t.key,t.value,\"zoom functions not supported\"))),\"categorical\"!==o&&!h||void 0!==t.value.property||u.push(new e.V(t.key,t.value,'\"property\" property is required')),u;function d(t){let o=[];const r=t.value,l=t.key;if(\"array\"!==e.j(r))return [new e.V(l,r,`array expected, ${e.j(r)} found`)];if(2!==r.length)return [new e.V(l,r,`array length 2 expected, length ${r.length} found`)];if(h){if(\"object\"!==e.j(r[0]))return [new e.V(l,r,`object expected, ${e.j(r[0])} found`)];if(void 0===r[0].zoom)return [new e.V(l,r,\"object stop key must have zoom\")];if(void 0===r[0].value)return [new e.V(l,r,\"object stop key must have value\")];const i=e.u(r[0].zoom);if(\"number\"!=typeof i)return [new e.V(l,r[0].zoom,\"stop zoom values must be numbers\")];if(n&&n>i)return [new e.V(l,r[0].zoom,\"stop zoom values must appear in ascending order\")];i!==n&&(n=i,s=void 0,a={}),o=o.concat(T({key:`${l}[0]`,value:r[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:S,value:_}}));}else o=o.concat(_({key:`${l}[0]`,value:r[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},r));return e.o(e.q(r[1]))?o.concat([new e.V(`${l}[1]`,r[1],\"expressions are not allowed in function stops.\")]):o.concat(W({key:`${l}[1]`,value:r[1],valueSpec:i,style:t.style,styleSpec:t.styleSpec}))}function _(t,n){const l=e.j(t.value),c=e.u(t.value),h=null!==t.value?t.value:n;if(r){if(l!==r)return [new e.V(t.key,h,`${l} stop domain type must match previous stop domain type ${r}`)]}else r=l;if(\"number\"!==l&&\"string\"!==l&&\"boolean\"!==l&&\"number\"!=typeof c&&\"string\"!=typeof c&&\"boolean\"!=typeof c)return [new e.V(t.key,h,\"stop domain value must be a number, string, or boolean\")];if(\"number\"!==l&&\"categorical\"!==o){let r=`number expected, ${l} found`;return e.m(i)&&void 0===o&&(r+='\\nIf you intended to use a categorical function, specify `\"type\": \"categorical\"`.'),[new e.V(t.key,h,r)]}return \"categorical\"!==o||\"number\"!==l||\"number\"==typeof c&&isFinite(c)&&Math.floor(c)===c?\"categorical\"!==o&&\"number\"===l&&\"number\"==typeof c&&\"number\"==typeof s&&void 0!==s&&c<s?[new e.V(t.key,h,\"stop domain values must appear in ascending order\")]:(s=c,\"categorical\"===o&&c in a?[new e.V(t.key,h,\"stop domain values must be unique\")]:(a[c]=!0,[])):[new e.V(t.key,h,`integer expected, found ${String(c)}`)]}}function I(t){const i=(\"property\"===t.expressionContext?e.r:e.t)(e.q(t.value),t.valueSpec);if(\"error\"===i.result)return i.value.map((i=>new e.V(`${t.key}${i.key}`,t.value,i.message)));const o=i.value.expression||i.value._styleExpression.expression;if(\"property\"===t.expressionContext&&\"text-font\"===t.propertyKey&&!o.outputDefined())return [new e.V(t.key,t.value,`Invalid data expression for \"${t.propertyKey}\". Output values must be contained as literals within the expression.`)];if(\"property\"===t.expressionContext&&\"layout\"===t.propertyType&&!e.v(o))return [new e.V(t.key,t.value,'\"feature-state\" data expressions are not supported with layout properties.')];if(\"filter\"===t.expressionContext)return D(o,t);if(t.expressionContext&&0===t.expressionContext.indexOf(\"cluster\")){if(!e.x(o,[\"zoom\",\"feature-state\"]))return [new e.V(t.key,t.value,'\"zoom\" and \"feature-state\" expressions are not supported with cluster properties.')];if(\"cluster-initial\"===t.expressionContext&&!e.y(o))return [new e.V(t.key,t.value,\"Feature data expressions are not supported with initial expression part of cluster properties.\")]}return []}function D(t,i){const o=new Set([\"zoom\",\"feature-state\",\"pitch\",\"distance-from-center\"]);if(i.valueSpec&&i.valueSpec.expression)for(const e of i.valueSpec.expression.parameters)o.delete(e);if(0===o.size)return [];const r=[];return t instanceof e.C&&o.has(t.name)?[new e.V(i.key,i.value,`[\"${t.name}\"] expression is not supported in a filter for a ${i.object.type} layer with id: ${i.object.id}`)]:(t.eachChild((e=>{r.push(...D(e,i));})),r)}function R(t){const i=t.key,o=t.value,r=t.valueSpec,s=[];return Array.isArray(r.values)?-1===r.values.indexOf(e.u(o))&&s.push(new e.V(i,o,`expected one of [${r.values.join(\", \")}], ${JSON.stringify(o)} found`)):-1===Object.keys(r.values).indexOf(e.u(o))&&s.push(new e.V(i,o,`expected one of [${Object.keys(r.values).join(\", \")}], ${JSON.stringify(o)} found`)),s}function A(t){return e.A(e.q(t.value))?I(e.k({},t,{expressionContext:\"filter\",valueSpec:t.styleSpec[`filter_${t.layerType||\"fill\"}`]})):P(t)}function P(t){const i=t.value,o=t.key;if(\"array\"!==e.j(i))return [new e.V(o,i,`array expected, ${e.j(i)} found`)];const r=t.styleSpec;let s,n=[];if(i.length<1)return [new e.V(o,i,\"filter array must have at least 1 element\")];switch(n=n.concat(R({key:`${o}[0]`,value:i[0],valueSpec:r.filter_operator,style:t.style,styleSpec:t.styleSpec})),e.u(i[0])){case\"<\":case\"<=\":case\">\":case\">=\":i.length>=2&&\"$type\"===e.u(i[1])&&n.push(new e.V(o,i,`\"$type\" cannot be use with operator \"${i[0]}\"`));case\"==\":case\"!=\":3!==i.length&&n.push(new e.V(o,i,`filter array for operator \"${i[0]}\" must have 3 elements`));case\"in\":case\"!in\":i.length>=2&&(s=e.j(i[1]),\"string\"!==s&&n.push(new e.V(`${o}[1]`,i[1],`string expected, ${s} found`)));for(let a=2;a<i.length;a++)s=e.j(i[a]),\"$type\"===e.u(i[1])?n=n.concat(R({key:`${o}[${a}]`,value:i[a],valueSpec:r.geometry_type,style:t.style,styleSpec:t.styleSpec})):\"string\"!==s&&\"number\"!==s&&\"boolean\"!==s&&n.push(new e.V(`${o}[${a}]`,i[a],`string, number, or boolean expected, ${s} found`));break;case\"any\":case\"all\":case\"none\":for(let e=1;e<i.length;e++)n=n.concat(P({key:`${o}[${e}]`,value:i[e],style:t.style,styleSpec:t.styleSpec}));break;case\"has\":case\"!has\":s=e.j(i[1]),2!==i.length?n.push(new e.V(o,i,`filter array for \"${i[0]}\" operator must have 2 elements`)):\"string\"!==s&&n.push(new e.V(`${o}[1]`,i[1],`string expected, ${s} found`));}return n}function L(t,i){const o=t.key,r=t.style,s=t.layer,n=t.styleSpec,a=t.value,l=t.objectKey,c=n[`${i}_${t.layerType}`];if(!c)return [];const h=l.match(/^(.*)-transition$/);if(\"paint\"===i&&h&&c[h[1]]&&c[h[1]].transition)return W({key:o,value:a,valueSpec:n.transition,style:r,styleSpec:n});const u=t.valueSpec||c[l];if(!u)return [new e.i(o,a,`unknown property \"${l}\"`)];let d;if(\"string\"===e.j(a)&&e.m(u)&&!u.tokens&&(d=/^{([^}]+)}$/.exec(a))){const t=`\\`{ \"type\": \"identity\", \"property\": ${d?JSON.stringify(d[1]):'\"_\"'} }\\``;return [new e.V(o,a,`\"${l}\" does not support interpolation syntax\\nUse an identity property function instead: ${t}.`)]}const _=[];if(\"symbol\"===t.layerType)\"text-field\"!==l||!r||r.glyphs||r.imports||_.push(new e.V(o,a,'use of \"text-field\" requires a style \"glyphs\" property')),\"text-font\"===l&&e.B(e.q(a))&&\"identity\"===e.u(a.type)&&_.push(new e.V(o,a,'\"text-font\" does not support identity functions'));else if(\"model\"===t.layerType&&\"paint\"===i&&s&&s.layout&&s.layout.hasOwnProperty(\"model-id\")&&e.m(u)&&(e.D(u)||e.n(u))){const t=e.r(e.q(a),u),i=t.value.expression||t.value._styleExpression.expression;i&&!e.x(i,[\"measure-light\"])&&(\"model-emissive-strength\"===l&&e.y(i)&&e.v(i)||_.push(new e.V(o,a,`${l} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)));}return _.concat(W({key:t.key,value:a,valueSpec:u,style:r,styleSpec:n,expressionContext:\"property\",propertyType:i,propertyKey:l}))}function M(e){return L(e,\"paint\")}function z(e){return L(e,\"layout\")}function O(t){let i=[];const o=t.value,r=t.key,s=t.style,n=t.styleSpec;o.type||o.ref||i.push(new e.V(r,o,'either \"type\" or \"ref\" is required'));let a=e.u(o.type);const l=e.u(o.ref);if(o.id){const n=e.u(o.id);for(let a=0;a<t.arrayIndex;a++){const t=s.layers[a];e.u(t.id)===n&&i.push(new e.V(r,o.id,`duplicate layer id \"${o.id}\", previously used at line ${t.id.__line__}`));}}if(\"ref\"in o){let t;[\"type\",\"source\",\"source-layer\",\"filter\",\"layout\"].forEach((t=>{t in o&&i.push(new e.V(r,o[t],`\"${t}\" is prohibited for ref layers`));})),s.layers.forEach((i=>{e.u(i.id)===l&&(t=i);})),t?t.ref?i.push(new e.V(r,o.ref,\"ref cannot reference another ref layer\")):a=e.u(t.type):\"string\"==typeof l&&i.push(new e.V(r,o.ref,`ref layer \"${l}\" not found`));}else if(\"background\"!==a&&\"sky\"!==a&&\"slot\"!==a)if(o.source){const t=s.sources&&s.sources[o.source],n=t&&e.u(t.type);t?\"vector\"===n&&\"raster\"===a?i.push(new e.V(r,o.source,`layer \"${o.id}\" requires a raster source`)):\"raster\"===n&&\"raster\"!==a?i.push(new e.V(r,o.source,`layer \"${o.id}\" requires a vector source`)):\"vector\"!==n||o[\"source-layer\"]?\"raster-dem\"===n&&\"hillshade\"!==a?i.push(new e.V(r,o.source,\"raster-dem source can only be used with layer type 'hillshade'.\")):\"raster-array\"!==n||[\"raster\",\"raster-particle\"].includes(a)?\"line\"!==a||!o.paint||!o.paint[\"line-gradient\"]&&!o.paint[\"line-trim-offset\"]||\"geojson\"===n&&t.lineMetrics?\"raster-particle\"===a&&\"raster-array\"!==n&&i.push(new e.V(r,o.source,`layer \"${o.id}\" requires a 'raster-array' source.`)):i.push(new e.V(r,o,`layer \"${o.id}\" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):i.push(new e.V(r,o.source,\"raster-array source can only be used with layer type 'raster'.\")):i.push(new e.V(r,o,`layer \"${o.id}\" must specify a \"source-layer\"`)):i.push(new e.V(r,o.source,`source \"${o.source}\" not found`));}else i.push(new e.V(r,o,'missing required property \"source\"'));return i=i.concat(T({key:r,value:o,valueSpec:n.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{\"*\":()=>[],type:()=>W({key:`${r}.type`,value:o.type,valueSpec:n.layer.type,style:t.style,styleSpec:t.styleSpec,object:o,objectKey:\"type\"}),filter:t=>A(e.k({layerType:a},t)),layout:t=>T({layer:o,key:t.key,value:t.value,valueSpec:{},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{\"*\":t=>z(e.k({layerType:a},t))}}),paint:t=>T({layer:o,key:t.key,value:t.value,valueSpec:{},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{\"*\":t=>M(e.k({layerType:a,layer:o},t))}})}})),i}function F(t){const i=t.value,o=t.key,r=e.j(i);return \"string\"!==r?[new e.V(o,i,`string expected, ${r} found`)]:[]}const B={promoteId:function({key:t,value:i}){if(\"string\"===e.j(i))return F({key:t,value:i});{const e=[];for(const o in i)e.push(...F({key:`${t}.${o}`,value:i[o]}));return e}}};function k(t){const i=t.value,o=t.key,r=t.styleSpec,s=t.style;if(!i.type)return [new e.V(o,i,'\"type\" is required')];const n=e.u(i.type);let a=[];switch([\"vector\",\"raster\",\"raster-dem\",\"raster-array\"].includes(n)&&(i.url||i.tiles||a.push(new e.i(o,i,'Either \"url\" or \"tiles\" is required.'))),n){case\"vector\":case\"raster\":case\"raster-dem\":case\"raster-array\":return a=a.concat(T({key:o,value:i,valueSpec:r[`source_${n.replace(\"-\",\"_\")}`],style:t.style,styleSpec:r,objectElementValidators:B})),a;case\"geojson\":if(a=T({key:o,value:i,valueSpec:r.source_geojson,style:s,styleSpec:r,objectElementValidators:B}),i.cluster)for(const e in i.clusterProperties){const[t,r]=i.clusterProperties[e],s=\"string\"==typeof t?[t,[\"accumulated\"],[\"get\",e]]:t;a.push(...I({key:`${o}.${e}.map`,value:r,expressionContext:\"cluster-map\"})),a.push(...I({key:`${o}.${e}.reduce`,value:s,expressionContext:\"cluster-reduce\"}));}return a;case\"video\":return T({key:o,value:i,valueSpec:r.source_video,style:s,styleSpec:r});case\"image\":return T({key:o,value:i,valueSpec:r.source_image,style:s,styleSpec:r});case\"canvas\":return [new e.V(o,null,\"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.\",\"source.canvas\")];default:return R({key:`${o}.type`,value:i.type,valueSpec:{values:N(r)},style:s,styleSpec:r})}}function N(e){return e.source.reduce(((t,i)=>{const o=e[i];return \"enum\"===o.type.type&&(t=t.concat(Object.keys(o.type.values))),t}),[])}function U(t){const i=t.value,o=t.styleSpec,r=o.light,s=t.style;let n=[];const a=e.j(i);if(void 0===i)return n;if(\"object\"!==a)return n=n.concat([new e.V(\"light\",i,`object expected, ${a} found`)]),n;for(const t in i){const a=t.match(/^(.*)-transition$/);n=n.concat(a&&r[a[1]]&&r[a[1]].transition?W({key:t,value:i[t],valueSpec:o.transition,style:s,styleSpec:o}):r[t]?W({key:t,value:i[t],valueSpec:r[t],style:s,styleSpec:o}):[new e.V(t,i[t],`unknown property \"${t}\"`)]);}return n}function G(t){const i=t.value;let o=[];if(!i)return o;const r=e.j(i);if(\"object\"!==r)return o=o.concat([new e.V(\"light-3d\",i,`object expected, ${r} found`)]),o;const s=t.styleSpec,n=s[\"light-3d\"],a=t.key,l=t.style,c=t.style.lights;for(const t of [\"type\",\"id\"])if(!(t in i))return o=o.concat([new e.V(\"light-3d\",i,`missing property ${t} on light`)]),o;if(i.type&&c)for(let r=0;r<t.arrayIndex;r++){const t=e.u(i.type),s=c[r];e.u(s.type)===t&&o.push(new e.V(a,i.id,`duplicate light type \"${i.type}\", previously defined at line ${s.id.__line__}`));}const h=`properties_light_${i.type}`;if(!(h in s))return o=o.concat([new e.V(\"light-3d\",i,`Invalid light type ${i.type}`)]),o;const u=s[h];for(const r in i)if(\"properties\"===r){const n=i[r],a=e.j(n);if(\"object\"!==a)return o=o.concat([new e.V(\"properties\",n,`object expected, ${a} found`)]),o;for(const i in n)o=o.concat(u[i]?W({key:i,value:n[i],valueSpec:u[i],style:l,styleSpec:s}):[new e.i(t.key,n[i],`unknown property \"${i}\"`)]);}else {const t=r.match(/^(.*)-transition$/);o=o.concat(t&&n[t[1]]&&n[t[1]].transition?W({key:r,value:i[r],valueSpec:s.transition,style:l,styleSpec:s}):n[r]?W({key:r,value:i[r],valueSpec:n[r],style:l,styleSpec:s}):[new e.i(r,i[r],`unknown property \"${r}\"`)]);}return o}function j(t){const i=t.value,o=t.key,r=t.style,s=t.styleSpec,n=s.terrain;let a=[];const l=e.j(i);if(void 0===i)return a;if(\"null\"===l)return a;if(\"object\"!==l)return a=a.concat([new e.V(\"terrain\",i,`object expected, ${l} found`)]),a;for(const t in i){const o=t.match(/^(.*)-transition$/);a=a.concat(o&&n[o[1]]&&n[o[1]].transition?W({key:t,value:i[t],valueSpec:s.transition,style:r,styleSpec:s}):n[t]?W({key:t,value:i[t],valueSpec:n[t],style:r,styleSpec:s}):[new e.i(t,i[t],`unknown property \"${t}\"`)]);}if(i.source){const t=r.sources&&r.sources[i.source],s=t&&e.u(t.type);t?\"raster-dem\"!==s&&a.push(new e.V(o,i.source,`terrain cannot be used with a source of type ${String(s)}, it only be used with a \"raster-dem\" source type`)):a.push(new e.V(o,i.source,`source \"${i.source}\" not found`));}else a.push(new e.V(o,i,'terrain is missing required property \"source\"'));return a}function V(t){const i=t.value,o=t.style,r=t.styleSpec,s=r.fog;let n=[];const a=e.j(i);if(void 0===i)return n;if(\"object\"!==a)return n=n.concat([new e.V(\"fog\",i,`object expected, ${a} found`)]),n;for(const t in i){const a=t.match(/^(.*)-transition$/);n=n.concat(a&&s[a[1]]&&s[a[1]].transition?W({key:t,value:i[t],valueSpec:r.transition,style:o,styleSpec:r}):s[t]?W({key:t,value:i[t],valueSpec:s[t],style:o,styleSpec:r}):[new e.i(t,i[t],`unknown property \"${t}\"`)]);}return n}const Z={\"*\":()=>[],array:E,boolean:function(t){const i=t.value,o=t.key,r=e.j(i);return \"boolean\"!==r?[new e.V(o,i,`boolean expected, ${r} found`)]:[]},number:S,color:function(t){const i=t.key,o=t.value,r=e.j(o);return \"string\"!==r?[new e.V(i,o,`color expected, ${r} found`)]:null===e.z(o)?[new e.V(i,o,`color expected, \"${o}\" found`)]:[]},enum:R,filter:A,function:C,layer:O,object:T,source:k,model:e.F,light:U,\"light-3d\":G,terrain:j,fog:V,string:F,formatted:function(e){return 0===F(e).length?[]:I(e)},resolvedImage:function(e){return 0===F(e).length?[]:I(e)},projection:function(t){const i=t.value,o=t.styleSpec,r=o.projection,s=t.style;let n=[];const a=e.j(i);if(\"object\"===a)for(const e in i)n=n.concat(W({key:e,value:i[e],valueSpec:r[e],style:s,styleSpec:o}));else \"string\"!==a&&(n=n.concat([new e.V(\"projection\",i,`object or string expected, ${a} found`)]));return n},import:function(t){const{value:i,styleSpec:o}=t,{data:r,...s}=i;Object.defineProperty(s,\"__line__\",{value:i.__line__,enumerable:!1});let n=T(e.k({},t,{value:s,valueSpec:o.import}));return \"\"===e.u(s.id)&&n.push(new e.V(`${t.key}.id`,s,\"import id can't be an empty string\")),r&&(n=n.concat(q(r,o,{key:`${t.key}.data`}))),n}};function W(t,i=!1){const o=t.value,r=t.valueSpec,s=t.styleSpec;if(r.expression&&e.B(e.u(o)))return C(t);if(r.expression&&e.o(e.q(o)))return I(t);if(r.type&&Z[r.type]){const o=Z[r.type](t);return !0===i&&o.length>0&&\"array\"===e.j(t.value)?I(t):o}return T(e.k({},t,{valueSpec:r.type?s[r.type]:r}))}function H(t){const i=t.value,o=t.key,r=F(t);return r.length||(-1===i.indexOf(\"{fontstack}\")&&r.push(new e.V(o,i,'\"glyphs\" url must include a \"{fontstack}\" token')),-1===i.indexOf(\"{range}\")&&r.push(new e.V(o,i,'\"glyphs\" url must include a \"{range}\" token'))),r}function q(t,i=e.G,o={}){return W({key:o.key||\"\",value:t,valueSpec:i.$root,styleSpec:i,style:t,objectElementValidators:{glyphs:H,\"*\":()=>[]}})}function Q(t,i=e.G){return se(q(t,i))}const $=e=>se(k(e)),X=e=>se(U(e)),Y=e=>se(G(e)),J=e=>se(j(e)),K=e=>se(V(e)),ee=e=>se(O(e)),te=e=>se(A(e)),ie=e=>se(M(e)),oe=e=>se(z(e)),re=t=>se(e.F(t));function se(e){return e.slice().sort(((e,t)=>e.line&&t.line?e.line-t.line:0))}function ne(t,i){let o=!1;if(i&&i.length)for(const r of i)r instanceof e.i?e.w(r.message):(t.fire(new e.a(new Error(r.message))),o=!0);return o}const ae=new e.H({anchor:new e.J(e.G.light.anchor),position:new e.K(e.G.light.position),color:new e.J(e.G.light.color),intensity:new e.J(e.G.light.intensity)});class le extends e.E{constructor(t,i=\"flat\"){super(),this._transitionable=new e.L(ae),this.setLight(t,i),this._transitioning=this._transitionable.untransitioned();}getLight(){return this._transitionable.serialize()}setLight(e,t,i={}){this._validate(X,e,i)||(this._transitionable.setTransitionOrValue(e),this.id=t);}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning);}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e);}_validate(t,i,o){return (!o||!1!==o.validate)&&ne(this,t.call(Q,e.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.G})))}}const ce=new e.H({source:new e.J(e.G.terrain.source),exaggeration:new e.J(e.G.terrain.exaggeration)});let he=class extends e.E{constructor(t,i,o,r){super(),this.scope=o,this._transitionable=new e.L(ce,o,r),this._transitionable.setTransitionOrValue(t,r),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=i;}get(){return this._transitionable.serialize()}set(e,t){this._transitionable.setTransitionOrValue(e,t);}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning);}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e);}getExaggeration(t){return this._transitioning.possiblyEvaluate(new e.N(t)).get(\"exaggeration\")}isZoomDependent(){const t=this._transitionable._values.exaggeration;return null!=t&&null!=t.value&&null!=t.value.expression&&t.value.expression instanceof e.Z}};const ue=45,de=65,_e=.05;function pe(t,i,o,r){const s=e.S(ue,de,o),[n,a]=fe(t,r);let l=1-Math.min(1,Math.exp((i-n)/(a-n)*-6));return l*=l*l,l=Math.min(1,1.00747*l),l*s*t.alpha}function fe(e,t){const i=.5/Math.tan(.5*t);return [e.range[0]+i,e.range[1]+i]}function me(t,i,o,r,s){const n=e.Q.transformMat4([],[i,o,r],s.mercatorFogMatrix);return pe(t,e.Q.length(n),s.pitch,s._fov)}function ge(t,i,o,r,s,n,a){const l=[[o,r,0],[s,r,0],[s,n,0],[o,n,0]];let c=Number.MAX_VALUE,h=-Number.MAX_VALUE;for(const t of l){const o=e.Q.transformMat4([],t,i),r=e.Q.length(o);c=Math.min(c,r),h=Math.max(h,r);}return [pe(t,c,a.pitch,a._fov),pe(t,h,a.pitch,a._fov)]}const ve=new e.H({range:new e.J(e.G.fog.range),color:new e.J(e.G.fog.color),\"high-color\":new e.J(e.G.fog[\"high-color\"]),\"space-color\":new e.J(e.G.fog[\"space-color\"]),\"horizon-blend\":new e.J(e.G.fog[\"horizon-blend\"]),\"star-intensity\":new e.J(e.G.fog[\"star-intensity\"]),\"vertical-range\":new e.J(e.G.fog[\"vertical-range\"])});class xe extends e.E{constructor(t,i,o,r){super(),this._transitionable=new e.L(ve,o,new Map(r)),this.set(t,r),this._transitioning=this._transitionable.untransitioned(),this._transform=i,this.properties=new e.U(ve);}get state(){const t=this._transform,i=\"globe\"===t.projection.name,o=e.W(t.zoom),r=this.properties.get(\"range\"),s=[.5,3];return {range:i?[e.X(s[0],r[0],o),e.X(s[1],r[1],o)]:r,horizonBlend:this.properties.get(\"horizon-blend\"),alpha:this.properties.get(\"color\").a}}get(){return this._transitionable.serialize()}set(t,i,o={}){if(this._validate(K,t,o))return;const r=e.e({},t);for(const t of Object.keys(e.G.fog))void 0===r[t]&&(r[t]=e.G.fog[t].default);this._options=r,this._transitionable.setTransitionOrValue(this._options,i);}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const i=this.properties&&this.properties.get(\"color\")||1;return (\"globe\"===this._transform.projection.name?1:e.S(ue,de,t))*i.a}getOpacityAtLatLng(t,i){return this._transform.projection.supportsFog?function(t,i,o){const r=e.O.fromLngLat(i),s=o.elevation?o.elevation.getAtPointOrZero(r):0;return me(t,r.x,r.y,s,o)}(this.state,t,i):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return [1,1];const i=this._transform.calculateFogTileMatrix(t.toUnwrapped());return ge(this.state,i,0,0,e.Y,e.Y,this._transform)}getOpacityForBounds(e,t,i,o,r){return this._transform.projection.supportsFog?ge(this.state,e,t,i,o,r,this._transform):[1,1]}getFovAdjustedRange(e){return this._transform.projection.supportsFog?fe(this.state,e):[0,1]}isVisibleOnFrustum(t){if(!this._transform.projection.supportsFog)return !1;const i=[4,5,6,7];for(const o of i){const i=t.points[o];let r;if(i[2]>=0)r=i;else {const s=t.points[o-4];r=e._(s,i,s[2]/(s[2]-i[2]));}if(me(this.state,r[0],r[1],0,this._transform)>=_e)return !0}return !1}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e));}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning);}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e);}_validate(t,i,o){return (!o||!1!==o.validate)&&ne(this,t.call(Q,e.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.G})))}}class ye extends e.E{constructor(t,i,o,r){super(),this.scope=o,this._options=t,this.properties=new e.U(i),this._transitionable=new e.L(i,o,new Map(r)),this._transitionable.setTransitionOrValue(t.properties),this._transitioning=this._transitionable.untransitioned();}updateConfig(e){this._transitionable.setTransitionOrValue(this._options.properties,new Map(e));}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning);}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e);}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(e,t){this._options=e,this._transitionable.setTransitionOrValue(e.properties,t);}shadowsEnabled(){return !!this.properties&&!0===this.properties.get(\"cast-shadows\")}}const be=new e.H({color:new e.J(e.G.properties_light_ambient.color),intensity:new e.J(e.G.properties_light_ambient.intensity)}),we=new e.H({direction:new e.$(e.G.properties_light_directional.direction),color:new e.J(e.G.properties_light_directional.color),intensity:new e.J(e.G.properties_light_directional.intensity),\"cast-shadows\":new e.J(e.G.properties_light_directional[\"cast-shadows\"]),\"shadow-intensity\":new e.J(e.G.properties_light_directional[\"shadow-intensity\"])});class Te{constructor(e,t,i,o){this.screenBounds=e,this.cameraPoint=t,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=i,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,o);}static createFromScreenPoints(t,i){let o,r;if(t instanceof e.P||\"number\"==typeof t[0]){const s=e.P.convert(t);o=[s],r=i.isPointAboveHorizon(s);}else {const s=e.P.convert(t[0]),n=e.P.convert(t[1]);o=[s,n],r=e.a0(s,n).every((e=>i.isPointAboveHorizon(e)));}return new Te(o,i.getCameraPoint(),r,i)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(t){return e.a0(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const i=this.screenBounds[0],o=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],r=e.a0(i,o,0,!1);return this.cameraPoint.y>o.y&&(this.cameraPoint.x>i.x&&this.cameraPoint.x<o.x?r.splice(3,0,this.cameraPoint):this.cameraPoint.x>=o.x?r[2]=this.cameraPoint:this.cameraPoint.x<=i.x&&(r[3]=this.cameraPoint)),e.a1(r,t)}bufferedCameraGeometryGlobe(t){const i=this.screenBounds[0],o=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],r=e.a0(i,o,t),s=this.cameraPoint.clone();switch(3*((s.y>i.y)+(s.y>o.y))+((s.x>i.x)+(s.x>o.x))){case 0:r[0]=s,r[4]=s.clone();break;case 1:r.splice(1,0,s);break;case 2:r[1]=s;break;case 3:r.splice(4,0,s);break;case 5:r.splice(2,0,s);break;case 6:r[3]=s;break;case 7:r.splice(3,0,s);break;case 8:r[2]=s;}return r}containsTile(t,i,o,r=0){const s=t.queryPadding/i._pixelsPerMercatorPixel+1,n=o?this._bufferedCameraMercator(s,i):this._bufferedScreenMercator(s,i);let a=t.tileID.wrap+(n.unwrapped?r:0);const l=n.polygon.map((i=>e.a2(t.tileTransform,i,a)));if(!e.a3(l,0,0,e.Y,e.Y))return;a=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?r:0);const c=this.screenGeometryMercator.polygon.map((i=>e.a4(t.tileTransform,i,a))),h=c.map((t=>new e.P(t[0],t[1]))),u=i.getFreeCameraOptions().position||new e.O(0,0,0),d=e.a4(t.tileTransform,u,a),_=c.map((t=>{const i=e.Q.sub(t,t,d);return e.Q.normalize(i,i),new e.a5(d,i)})),p=e.a6(t,1,i.zoom)*i._pixelsPerMercatorPixel;return {queryGeometry:this,tilespaceGeometry:h,tilespaceRays:_,bufferedTilespaceGeometry:l,bufferedTilespaceBounds:(f=e.a7(l),f.min.x=e.ad(f.min.x,0,e.Y),f.min.y=e.ad(f.min.y,0,e.Y),f.max.x=e.ad(f.max.x,0,e.Y),f.max.y=e.ad(f.max.y,0,e.Y),f),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:p};var f;}_bufferedScreenMercator(e,t){const i=Ce(e);if(this._screenRaycastCache[i])return this._screenRaycastCache[i];{let o;return o=\"globe\"===t.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),t):{polygon:this.bufferedScreenGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._screenRaycastCache[i]=o,o}}_bufferedCameraMercator(e,t){const i=Ce(e);if(this._cameraRaycastCache[i])return this._cameraRaycastCache[i];{let o;return o=\"globe\"===t.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),t):{polygon:this.bufferedCameraGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._cameraRaycastCache[i]=o,o}}_projectAndResample(t,i){const o=function(t,i){const o=e.a9.multiply([],i.pixelMatrix,i.globeMatrix),r=[0,-e.ae,0,1],s=[0,e.ae,0,1],n=[0,0,0,1];e.aa.transformMat4(r,r,o),e.aa.transformMat4(s,s,o),e.aa.transformMat4(n,n,o);const a=new e.P(r[0]/r[3],r[1]/r[3]),l=new e.P(s[0]/s[3],s[1]/s[3]),c=e.ab(t,a)&&r[3]<n[3],h=e.ab(t,l)&&s[3]<n[3];if(!c&&!h)return null;const u=function(e,t,i){for(let o=1;o<e.length;o++){const r=Se(t.pointCoordinate3D(e[o-1]).x),s=Se(t.pointCoordinate3D(e[o]).x);if(i<0){if(r<s)return {idx:o,t:-r/(s-1-r)}}else if(s<r)return {idx:o,t:(1-r)/(s+1-r)}}return null}(t,i,c?-1:1);if(!u)return null;const{idx:d,t:_}=u;let p=d>1?Ee(t.slice(0,d),i):[],f=d<t.length?Ee(t.slice(d),i):[];p=p.map((t=>new e.P(Se(t.x),t.y))),f=f.map((t=>new e.P(Se(t.x),t.y)));const m=[...p];0===m.length&&m.push(f[f.length-1]);const g=e.X(m[m.length-1].y,(0===f.length?p[0]:f[0]).y,_);let v;return v=c?[new e.P(0,g),new e.P(0,0),new e.P(1,0),new e.P(1,g)]:[new e.P(1,g),new e.P(1,1),new e.P(0,1),new e.P(0,g)],m.push(...v),0===f.length?m.push(p[0]):m.push(...f),{polygon:m.map((t=>new e.O(t.x,t.y))),unwrapped:!1}}(t,i);if(o)return o;const r=function(t,i){let o=!1,r=-1/0,s=0;for(let e=0;e<t.length-1;e++)t[e].x>r&&(r=t[e].x,s=e);for(let e=0;e<t.length-1;e++){const i=(s+e)%(t.length-1),r=t[i],n=t[i+1];Math.abs(r.x-n.x)>.5&&(r.x<n.x?(r.x+=1,0===i&&(t[t.length-1].x+=1)):(n.x+=1,i+1===t.length-1&&(t[0].x+=1)),o=!0);}const n=e.a8(i.center.lng);return o&&n<Math.abs(n-1)&&t.forEach((e=>{e.x-=1;})),{polygon:t,unwrapped:o}}(Ee(t,i).map((t=>new e.P(Se(t.x),t.y))),i);return {polygon:r.polygon.map((t=>new e.O(t.x,t.y))),unwrapped:r.unwrapped}}}function Ee(t,i){return e.ac(t,(e=>{const t=i.pointCoordinate3D(e);e.x=t.x,e.y=t.y;}),1/256)}function Se(e){return e<0?1+e%1:e%1}function Ce(e){return 100*e|0}function Ie(t,i,o,r,s){const n=function(o,r){if(o)return s(o);if(r){t.url&&r.tiles&&t.tiles&&delete t.tiles;const o=e.af(e.e(r,t),[\"tiles\",\"minzoom\",\"maxzoom\",\"attribution\",\"mapbox_logo\",\"bounds\",\"scheme\",\"tileSize\",\"encoding\"]);r.vector_layers&&(o.vectorLayers=r.vector_layers,o.vectorLayerIds=o.vectorLayers.map((e=>e.id))),r.raster_layers&&(o.rasterLayers=r.raster_layers,o.rasterLayerIds=o.rasterLayers.map((e=>e.id))),o.tiles=i.canonicalizeTileset(o,t.url),s(null,o);}};return t.url?e.g(i.transformRequest(i.normalizeSourceURL(t.url,null,o,r),e.R.Source),n):e.f.frame((()=>n(null,t)))}class De{constructor(t,i,o){this.bounds=e.ag.convert(this.validateBounds(t)),this.minzoom=i||0,this.maxzoom=o||24;}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(t){const i=Math.pow(2,t.z),o=Math.floor(e.a8(this.bounds.getWest())*i),r=Math.floor(e.ah(this.bounds.getNorth())*i),s=Math.ceil(e.a8(this.bounds.getEast())*i),n=Math.ceil(e.ah(this.bounds.getSouth())*i);return t.x>=o&&t.x<s&&t.y>=r&&t.y<n}}class Re extends e.E{constructor(t,i,o,r){if(super(),this.id=t,this.dispatcher=o,this.type=\"vector\",this.minzoom=0,this.maxzoom=22,this.scheme=\"xyz\",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,e.e(this,e.af(i,[\"url\",\"scheme\",\"tileSize\",\"promoteId\"])),this._options=e.e({type:\"vector\"},i),this._collectResourceTiming=!!i.collectResourceTiming,512!==this.tileSize)throw new Error(\"vector tile sources must have a tileSize of 512\");this.setEventedParent(r),this._tileWorkers={},this._deduped=new e.ai;}load(t){this._loaded=!1,this.fire(new e.b(\"dataloading\",{dataType:\"source\"}));const i=Array.isArray(this.map._language)?this.map._language.join():this.map._language,o=this.map._worldview;this._tileJSONRequest=Ie(this._options,this.map._requestManager,i,o,((r,s)=>{this._tileJSONRequest=null,this._loaded=!0,r?(i&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i}`),o&&2!==o.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${o}`),this.fire(new e.a(r))):s&&(e.e(this,s),s.bounds&&(this.tileBounds=new De(s.bounds,this.minzoom,this.maxzoom)),e.am(s.tiles,this.map._requestManager._customAccessToken),this.fire(new e.b(\"data\",{dataType:\"source\",sourceDataType:\"metadata\"})),this.fire(new e.b(\"data\",{dataType:\"source\",sourceDataType:\"content\"}))),t&&t(r);}));}loaded(){return this._loaded}hasTile(e){return !this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load();}reload(){this.cancelTileJSONRequest();const t=e.aj(this.id,this.scope);this.load((()=>this.map.style.clearSource(t)));}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(){this.cancelTileJSONRequest();}serialize(){return e.e({},this._options)}loadTile(t,i){const o=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme)),r={request:this.map._requestManager.transformRequest(o,e.R.Tile),data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:e.f.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster};if(r.request.collectResourceTiming=this._collectResourceTiming,t.actor&&\"expired\"!==t.state)\"loading\"===t.state?t.reloadCallback=i:t.request=t.actor.send(\"reloadTile\",r,s.bind(this));else if(t.actor=this._tileWorkers[o]=this._tileWorkers[o]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send(\"loadTile\",r,s.bind(this),void 0,!0);else {const i=e.ak.call({deduped:this._deduped},r,((e,i)=>{e||!i?s.call(this,e):(r.data={cacheControl:i.cacheControl,expires:i.expires,rawData:i.rawData.slice(0)},t.actor&&t.actor.send(\"loadTile\",r,s.bind(this),void 0,!0));}),!0);t.request={cancel:i};}function s(o,r){return delete t.request,t.aborted?i(null):o&&404!==o.status?i(o):(r&&r.resourceTiming&&(t.resourceTiming=r.resourceTiming),this.map._refreshExpiredTiles&&r&&t.setExpiryData(r),t.loadVectorData(r,this.map.painter),e.al(this.dispatcher),i(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send(\"abortTile\",{uid:e.uid,type:this.type,source:this.id,scope:this.scope});}unloadTile(e){e.actor&&e.actor.send(\"removeTile\",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy();}hasTransition(){return !1}afterUpdate(){this._tileWorkers={};}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null);}}class Ae extends e.E{constructor(t,i,o,r){super(),this.id=t,this.dispatcher=o,this.setEventedParent(r),this.type=\"raster\",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme=\"xyz\",this.tileSize=512,this._loaded=!1,this._options=e.e({type:\"raster\"},i),e.e(this,e.af(i,[\"url\",\"scheme\",\"tileSize\"]));}load(t){this._loaded=!1,this.fire(new e.b(\"dataloading\",{dataType:\"source\"})),this._tileJSONRequest=Ie(this._options,this.map._requestManager,null,null,((i,o)=>{this._tileJSONRequest=null,this._loaded=!0,i?this.fire(new e.a(i)):o&&(e.e(this,o),o.bounds&&(this.tileBounds=new De(o.bounds,this.minzoom,this.maxzoom)),e.am(o.tiles),this.fire(new e.b(\"data\",{dataType:\"source\",sourceDataType:\"metadata\"})),this.fire(new e.b(\"data\",{dataType:\"source\",sourceDataType:\"content\"}))),t&&t(i);}));}loaded(){return this._loaded}onAdd(e){this.map=e,this.load();}reload(){this.cancelTileJSONRequest();const t=e.aj(this.id,this.scope);this.load((()=>this.map.style.clearSource(t)));}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(){this.cancelTileJSONRequest();}serialize(){return e.e({},this._options)}hasTile(e){return !this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(t,i){const o=e.f.devicePixelRatio>=2,r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),o,this.tileSize);t.request=e.d(this.map._requestManager.transformRequest(r,e.R.Tile),((o,r,s,n)=>(delete t.request,t.aborted?(t.state=\"unloaded\",i(null)):o?(t.state=\"errored\",i(o)):r?(this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:s,expires:n}),t.setTexture(r,this.map.painter),t.state=\"loaded\",e.al(this.dispatcher),void i(null)):i(null))));}abortTile(e,t){e.request&&(e.request.cancel(),delete e.request),t();}unloadTile(t,i){t.texture&&t.texture instanceof e.T?(t.destroy(!0),t.texture&&t.texture instanceof e.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),i();}hasTransition(){return !1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null);}}class Pe extends Ae{constructor(t,i,o,r){super(t,i,o,r),this.type=\"raster-array\",this.maxzoom=22,this._options=e.e({type:\"raster-array\"},i);}triggerRepaint(e){const t=this.map.painter._terrain,i=this.map.style.getSourceCache(this.id);t&&t.enabled&&i&&t._clearRenderCacheForTile(i.id,e.tileID),this.map.triggerRepaint();}loadTile(t,i){const o=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),r=this.map._requestManager.transformRequest(o,e.R.Tile);t.requestParams=r,t.actor||(t.actor=this.dispatcher.getActor()),t.request=t.fetchHeader(void 0,((e,o,r,s)=>{if(delete t.request,t.aborted)return t.state=\"unloaded\",i(null);if(e){if(20===e.code)return;return t.state=\"errored\",i(e)}this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:r,expires:s}),t.state=\"empty\",i(null);}));}unloadTile(t){const i=t.texture;i&&i instanceof e.T?(t.destroy(!0),this.map.painter.saveTileTexture(i)):(t.destroy(),t.flushQueues(),t._isHeaderLoaded=!1,delete t._mrt,delete t.textureDescriptor),t.fbo&&(t.fbo.destroy(),delete t.fbo),delete t.request,delete t.requestParams,delete t.neighboringTiles,t.state=\"unloaded\";}prepareTile(t,i,o){t._isHeaderLoaded&&(\"empty\"!==t.state&&(t.state=\"reloading\"),t.fetchBand(i,o,((i,o)=>{if(i)return t.state=\"errored\",this.fire(new e.a(i)),void this.triggerRepaint(t);o&&(t.setTexture(o,this.map.painter),t.state=\"loaded\",this.triggerRepaint(t));})));}getInitialBand(e){if(!this.rasterLayers)return 0;const t=this.rasterLayers.find((({id:t})=>t===e)),i=t&&t.fields,o=i&&i.bands&&i.bands;return o?o[0]:0}getTextureDescriptor(t,i,o){if(!t)return;const r=i.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!r)return;let s=null;i instanceof e.aq?s=i.paint.get(\"raster-array-band\"):i instanceof e.ar&&(s=i.paint.get(\"raster-particle-array-band\"));const n=s||this.getInitialBand(r);if(null!=n)if(t.textureDescriptor){if(!t.updateNeeded(r,n)||o)return Object.assign({},t.textureDescriptor,{texture:t.texture})}else this.prepareTile(t,r,n);}}const Le=32,Me=33,ze=new Uint16Array(8184);for(let e=0;e<2046;e++){let t=e+2,i=0,o=0,r=0,s=0,n=0,a=0;for(1&t?r=s=n=Le:i=o=a=Le;(t>>=1)>1;){const e=i+r>>1,l=o+s>>1;1&t?(r=i,s=o,i=n,o=a):(i=r,o=s,r=n,s=a),n=e,a=l;}const l=4*e;ze[l+0]=i,ze[l+1]=o,ze[l+2]=r,ze[l+3]=s;}const Oe=new Uint16Array(2178),Fe=new Uint8Array(1089),Be=new Uint16Array(1089);function ke(e){return 0===e?-.03125:32===e?.03125:0}class Ne{constructor(e,t,i,o){this.id=Ne.uniqueIdxCounter,Ne.uniqueIdxCounter++,this.context=e;const r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||o||t.destroy();}bind(){this.context.bindElementBuffer.set(this.buffer);}updateData(e){this.id=Ne.uniqueIdxCounter,Ne.uniqueIdxCounter++;const t=this.context.gl;this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer);}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer);}}Ne.uniqueIdxCounter=0;const Ue={Int8:\"BYTE\",Uint8:\"UNSIGNED_BYTE\",Int16:\"SHORT\",Uint16:\"UNSIGNED_SHORT\",Int32:\"INT\",Uint32:\"UNSIGNED_INT\",Float32:\"FLOAT\"};class Ge{constructor(e,t,i,o,r,s){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=o,this.instanceCount=s,this.context=e;const n=e.gl;this.buffer=n.createBuffer(),e.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||r||t.destroy();}bind(){this.context.bindVertexBuffer.set(this.buffer);}updateData(e){const t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer);}enableAttributes(e,t){for(let i=0;i<this.attributes.length;i++){const o=t.attributes[this.attributes[i].name];void 0!==o&&e.enableVertexAttribArray(o);}}setVertexAttribPointers(e,t,i){for(let o=0;o<this.attributes.length;o++){const r=this.attributes[o],s=t.attributes[r.name];void 0!==s&&e.vertexAttribPointer(s,r.components,e[Ue[r.type]],!1,this.itemSize,r.offset+this.itemSize*(i||0));}}setVertexAttribDivisor(e,t,i){for(let o=0;o<this.attributes.length;o++){const r=t.attributes[this.attributes[o].name];void 0!==r&&this.instanceCount&&this.instanceCount>0&&e.vertexAttribDivisor(r,i);}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer);}}class je{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1;}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default);}}class Ve extends je{getDefault(){return e.aA.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1);}}class Ze extends je{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1);}}class We extends je{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1);}}class He extends je{getDefault(){return [!0,!0,!0,!0]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1);}}class qe extends je{getDefault(){return !0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1);}}class Qe extends je{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1);}}class $e extends je{getDefault(){return {func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1);}}class Xe extends je{getDefault(){const e=this.gl;return [e.KEEP,e.KEEP,e.KEEP]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1);}}class Ye extends je{getDefault(){return !1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1;}}class Je extends je{getDefault(){return [0,1]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1);}}class Ke extends je{getDefault(){return !1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1;}}class et extends je{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1);}}class tt extends je{getDefault(){return !1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1;}}class it extends je{getDefault(){const e=this.gl;return [e.ONE,e.ZERO,e.ONE,e.ZERO]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.blendFuncSeparate(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1);}}class ot extends je{getDefault(){return e.aA.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1);}}class rt extends je{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(e,e),this.current=e,this.dirty=!1);}}class st extends je{getDefault(){return !1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1;}}class nt extends je{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1);}}class at extends je{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1);}}let lt=class extends je{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1);}};class ct extends je{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1);}}class ht extends je{getDefault(){const e=this.gl;return [0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1);}}class ut extends je{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1;}}class dt extends je{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1;}}class _t extends je{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1;}}class pt extends je{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1;}}class ft extends je{getDefault(){return null}set(e){const t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1;}}class mt extends je{getDefault(){return null}set(e){this.gl&&(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1);}}class gt extends je{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1;}}class vt extends je{getDefault(){return !1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1;}}class xt extends je{getDefault(){return !1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1;}}class yt extends je{constructor(e,t){super(e),this.context=e,this.parent=t;}getDefault(){return null}}class bt extends yt{setDirty(){this.dirty=!0;}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1;}}class wt extends yt{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,this.attachment(),t.RENDERBUFFER,e),this.current=e,this.dirty=!1;}}class Tt extends yt{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,this.attachment(),t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1;}}class Et extends wt{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}class St{constructor(e,t,i,o,r){this.context=e,this.width=t,this.height=i;const s=this.framebuffer=e.gl.createFramebuffer();o&&(this.colorAttachment=new bt(e,s)),r&&(this.depthAttachmentType=r,this.depthAttachment=\"renderbuffer\"===r?new wt(e,s):new Tt(e,s));}destroy(){const e=this.context.gl;if(this.colorAttachment){const t=this.colorAttachment.get();t&&e.deleteTexture(t);}if(this.depthAttachment&&this.depthAttachmentType)if(\"renderbuffer\"===this.depthAttachmentType){const t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t);}else {const t=this.depthAttachment.get();t&&e.deleteTexture(t);}e.deleteFramebuffer(this.framebuffer);}}class Ct{constructor(e,t,i){this.func=e,this.mask=t,this.range=i;}}Ct.ReadOnly=!1,Ct.ReadWrite=!0,Ct.disabled=new Ct(519,Ct.ReadOnly,[0,1]);const It=7680;class Dt{constructor(e,t,i,o,r,s){this.test=e,this.ref=t,this.mask=i,this.fail=o,this.depthFail=r,this.pass=s;}}Dt.disabled=new Dt({func:519,mask:0},0,0,It,It,It);const Rt=771;class At{constructor(e,t,i,o){this.blendFunction=e,this.blendColor=t,this.mask=i,this.blendEquation=o;}}At.Replace=[1,0,1,0],At.disabled=new At(At.Replace,e.aA.transparent,[!1,!1,!1,!1]),At.unblended=new At(At.Replace,e.aA.transparent,[!0,!0,!0,!0]),At.alphaBlended=new At([1,Rt,1,Rt],e.aA.transparent,[!0,!0,!0,!0]),At.multiply=new At([774,0,774,0],e.aA.transparent,[!0,!0,!0,!0]);const Pt=1029,Lt=2305;class Mt{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i;}}Mt.disabled=new Mt(!1,Pt,Lt),Mt.backCCW=new Mt(!0,Pt,Lt),Mt.backCW=new Mt(!0,Pt,2304),Mt.frontCW=new Mt(!0,1028,2304),Mt.frontCCW=new Mt(!0,1028,Lt);class zt{constructor(e,t){this.gl=e,this.clearColor=new Ve(this),this.clearDepth=new Ze(this),this.clearStencil=new We(this),this.colorMask=new He(this),this.depthMask=new qe(this),this.stencilMask=new Qe(this),this.stencilFunc=new $e(this),this.stencilOp=new Xe(this),this.stencilTest=new Ye(this),this.depthRange=new Je(this),this.depthTest=new Ke(this),this.depthFunc=new et(this),this.blend=new tt(this),this.blendFunc=new it(this),this.blendColor=new ot(this),this.blendEquation=new rt(this),this.cullFace=new st(this),this.cullFaceSide=new nt(this),this.frontFace=new at(this),this.program=new lt(this),this.activeTexture=new ct(this),this.viewport=new ht(this),this.bindFramebuffer=new ut(this),this.bindRenderbuffer=new dt(this),this.bindTexture=new _t(this),this.bindVertexBuffer=new pt(this),this.bindElementBuffer=new ft(this),this.bindVertexArrayOES=new mt(this),this.pixelStoreUnpack=new gt(this),this.pixelStoreUnpackPremultiplyAlpha=new vt(this),this.pixelStoreUnpackFlipY=new xt(this),this.options=t?{...t}:{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=e.getExtension(\"EXT_texture_filter_anisotropic\")||e.getExtension(\"MOZ_EXT_texture_filter_anisotropic\")||e.getExtension(\"WEBKIT_EXT_texture_filter_anisotropic\"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=e.getExtension(\"WEBGL_debug_renderer_info\"),this.extDebugRendererInfo&&(this.renderer=e.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=e.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=e.getExtension(\"OES_texture_float_linear\")),this.extRenderToTextureHalfFloat=e.getExtension(\"EXT_color_buffer_half_float\"),this.extTimerQuery=e.getExtension(\"EXT_disjoint_timer_query_webgl2\"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxPointSize=e.getParameter(e.ALIASED_POINT_SIZE_RANGE)[1];}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault();}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0;}createIndexBuffer(e,t,i){return new Ne(this,e,t,i)}createVertexBuffer(e,t,i,o,r){return new Ge(this,e,t,i,o,r)}createRenderbuffer(e,t,i){const o=this.gl,r=o.createRenderbuffer();return this.bindRenderbuffer.set(r),o.renderbufferStorage(o.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),r}createFramebuffer(e,t,i,o){return new St(this,e,t,i,o)}clear({color:e,depth:t,stencil:i,colorMask:o}){const r=this.gl;let s=0;e&&(s|=r.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set(o||[!0,!0,!0,!0])),void 0!==t&&(s|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),void 0!==i&&(s|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),r.clear(s);}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace));}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1);}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1);}setColorMode(e){t(e.blendFunction,At.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor),e.blendEquation?this.blendEquation.set(e.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(e.mask);}unbindVAO(){this.bindVertexArrayOES.set(null);}}var Ot=e.aB([{name:\"a_index\",type:\"Int16\",components:1}]);const Ft=.15000000000000002;class Bt{constructor(t,i,o,r){const s={width:o[0],height:o[1],data:null},n=t.gl;this.targetColorTexture=new e.T(t,s,n.RGBA,{useMipmap:!1}),this.backgroundColorTexture=new e.T(t,s,n.RGBA,{useMipmap:!1}),this.context=t,this.setParticleTextureDimension(i,r),this.lastInvalidatedAt=0;}setParticleTextureDimension(t,i){if(this.particleTextureDimension===i)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const o=this.context.gl,r=i*i,s=new Uint8Array(4*r),n=.7692307692307692,a=e.aC(t.key);for(let e=0;e<s.length;e+=4){const t=n*(a()+Ft),i=n*(a()+Ft),o=255*t%1,r=255*i%1,l=o,c=i-r/255,h=r;s[e+0]=Math.floor(255*(t-o/255)),s[e+1]=Math.floor(255*l),s[e+2]=Math.floor(255*c),s[e+3]=Math.floor(255*h);}const l=new e.h({width:i,height:i},s);this.particleTexture0=new e.T(this.context,l,o.RGBA,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new e.T(this.context,l,o.RGBA,{premultiply:!1,useMipmap:!1});const c=new e.aD;c.reserve(r);for(let e=0;e<r;e++)c.emplaceBack(e);this.particleIndexBuffer=this.context.createVertexBuffer(c,Ot.members,!0),this.particleSegment=e.aE.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=i;}update(t){return !(this.lastInvalidatedAt<t&&(this.lastInvalidatedAt=e.f.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy();}}const kt={type:2,extent:e.Y,loadGeometry:()=>[[new e.P(0,0),new e.P(e.Y+1,0),new e.P(e.Y+1,e.Y+1),new e.P(0,e.Y+1),new e.P(0,0)]]};class Nt{constructor(t,i,o,r,s){this.tileID=t,this.uid=e.aF(),this.uses=0,this.tileSize=i,this.tileZoom=o,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=s,r&&r.style&&(this._lastUpdatedBrightness=r.style.getBrightness()),this.expiredRequestCount=0,this.state=\"loading\",r&&r.transform&&(this.projection=r.transform.projection);}registerFadeDuration(t){const i=t+this.timeAdded;i<e.f.now()||this.fadeEndTime&&i<this.fadeEndTime||(this.fadeEndTime=i);}wasRequested(){return \"errored\"===this.state||\"loaded\"===this.state||\"reloading\"===this.state}get tileTransform(){return this._tileTransform||(this._tileTransform=e.av(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(t,i,o){if(this.unloadVectorData(),this.state=\"loaded\",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(e,t){const i={};if(!t)return i;for(const o of e){const e=o.layerIds.map((e=>t.getLayer(e))).filter(Boolean);if(0!==e.length){o.layers=e,o.stateDependentLayerIds&&(o.stateDependentLayers=o.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(const t of e)i[t.fqid]=o;}}return i}(t.buckets,i.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const i=this.buckets[t];if(i instanceof e.aH){if(this.hasSymbolBuckets=!0,!o)break;i.justReloaded=!0;}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const i=this.buckets[t];if(i instanceof e.aH&&i.hasRTLText){this.hasRTLText=!0,e.aI();break}}this.queryPadding=0;for(const e in this.buckets){const t=this.buckets[e],o=i.style.getOwnLayer(e);if(!o)continue;const r=o.queryRadius(t);this.queryPadding=Math.max(this.queryPadding,r);}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas),this._lastUpdatedBrightness=t.brightness;}else this.collisionBoxArray=new e.aG;}unloadVectorData(){if(this.hasData()){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state=\"unloaded\";}}getBucket(e){return this.buckets[e.fqid]}upload(t){for(const e in this.buckets){const i=this.buckets[e];i.uploadPending()&&i.upload(t);}const i=t.gl,o=this.imageAtlas;if(o&&!o.uploaded){const r=!!Object.keys(o.patternPositions).length;this.imageAtlasTexture=new e.T(t,o.image,i.RGBA,{useMipmap:r}),this.imageAtlas.uploaded=!0;}this.glyphAtlasImage&&(this.glyphAtlasTexture=new e.T(t,this.glyphAtlasImage,i.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new e.T(t,this.lineAtlas.image,i.R8),this.lineAtlas.uploaded=!0);}prepare(e,t,i){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture,i),!t||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const o=t.style.getBrightness();(this._lastUpdatedBrightness||o)&&(this._lastUpdatedBrightness&&o&&Math.abs(this._lastUpdatedBrightness-o)<.001||(this._lastUpdatedBrightness=o,this.updateBuckets(void 0,t)));}queryRenderedFeatures(e,t,i,o,r,s,n,a){return this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)?this.latestFeatureIndex.query({tileResult:o,pixelPosMatrix:n,transform:s,params:r,tileTransform:this.tileTransform},e,t,i):{}}querySourceFeatures(t,i){const o=this.latestFeatureIndex;if(!o||!o.rawTileData)return;const r=o.loadVTLayers(),s=i?i.sourceLayer:\"\",n=r._geojsonTileLayer||r[s];if(!n)return;const a=e.aJ(i&&i.filter),{z:l,x:c,y:h}=this.tileID.canonical,u={z:l,x:c,y:h};for(let i=0;i<n.length;i++){const r=n.feature(i);if(a.needGeometry){const t=e.aK(r,!0);if(!a.filter(new e.N(this.tileID.overscaledZ),t,this.tileID.canonical))continue}else if(!a.filter(new e.N(this.tileID.overscaledZ),r))continue;const d=o.getId(r,s),_=new e.aL(r,l,c,h,d);_.tile=u,t.push(_);}}hasData(){return \"loaded\"===this.state||\"reloading\"===this.state||\"expired\"===this.state}bucketsLoaded(){for(const e in this.buckets)if(this.buckets[e].uploadPending())return !1;return !0}patternsLoaded(){return !!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const i=this.expirationTime;if(t.cacheControl){const i=e.aM(t.cacheControl);i[\"max-age\"]&&(this.expirationTime=Date.now()+1e3*i[\"max-age\"]);}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const e=Date.now();let t=!1;if(this.expirationTime>e)t=!1;else if(i)if(this.expirationTime<i)t=!0;else {const o=this.expirationTime-i;o?this.expirationTime=e+Math.max(o,3e4):t=!0;}else t=!0;t?(this.expiredRequestCount++,this.state=\"expired\"):this.expiredRequestCount=0;}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(e,t){this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&0!==Object.keys(e).length&&t&&this.updateBuckets(e,t);}updateBuckets(t,i){if(!this.latestFeatureIndex)return;const o=this.latestFeatureIndex.loadVTLayers(),r=i.style.listImages(),s=i.style.getBrightness();for(const n in this.buckets){if(!i.style.hasLayer(n))continue;const a=this.buckets[n],l=a.layers[0].sourceLayer||\"_geojsonTileLayer\",c=o[l];let h={};if(t&&(h=t[l],!c||!h||0===Object.keys(h).length))continue;if(a.update(h,c,r,this.imageAtlas&&this.imageAtlas.patternPositions||{},s),a instanceof e.aN||a instanceof e.aO){const e=i.style.getOwnSourceCache(a.layers[0].source);i._terrain&&i._terrain.enabled&&e&&a.programConfigurations.needsUpload&&i._terrain._clearRenderCacheForTile(e.id,this.tileID);}const u=i&&i.style&&i.style.getOwnLayer(n);u&&(this.queryPadding=Math.max(this.queryPadding,u.queryRadius(a)));}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return !this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<e.f.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0;}setHoldDuration(t){this.symbolFadeHoldUntil=e.f.now()+t;}setTexture(t,i){const o=i.context,r=o.gl;this.texture=this.texture||i.getTileTexture(t.width),this.texture&&this.texture instanceof e.T?this.texture.update(t,{useMipmap:!0}):(this.texture=new e.T(o,t,r.RGBA,{useMipmap:!0}),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));}setDependencies(e,t){const i={};for(const e of t)i[e]=!0;this.dependencies[e]=i;}hasDependency(e,t){for(const i of e){const e=this.dependencies[i];if(e)for(const i of t)if(e[i])return !0}return !1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(t,i){if(!i||\"mercator\"===i.name||this._tileDebugBuffer)return;const o=e.aP(kt,this.tileID.canonical,this.tileTransform)[0],r=new e.aQ,s=new e.aR;for(let e=0;e<o.length;e++){const{x:t,y:i}=o[e];r.emplaceBack(t,i),s.emplaceBack(e);}s.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(s),this._tileDebugBuffer=t.createVertexBuffer(r,e.aS.members),this._tileDebugSegments=e.aE.simpleSegment(0,0,r.length,s.length);}_makeTileBoundsBuffers(t,i){if(this._tileBoundsBuffer||!i||\"mercator\"===i.name)return;const o=e.aP(kt,this.tileID.canonical,this.tileTransform)[0];let r,s;if(this.isRaster){const t=function(t,i){const o=e.av(t,i),r=Math.pow(2,t.z);for(let s=0;s<Me;s++)for(let n=0;n<Me;n++){const a=e.aw((t.x+(n+ke(n))/Le)/r),l=e.ax((t.y+(s+ke(s))/Le)/r),c=i.project(a,l),h=s*Me+n;Oe[2*h+0]=Math.round((c.x*o.scale-o.x)*e.Y),Oe[2*h+1]=Math.round((c.y*o.scale-o.y)*e.Y);}Fe.fill(0),Be.fill(0);for(let e=2045;e>=0;e--){const t=4*e,i=ze[t+0],o=ze[t+1],r=ze[t+2],s=ze[t+3],n=i+r>>1,a=o+s>>1,l=n+a-o,c=a+i-n,h=o*Me+i,u=s*Me+r,d=a*Me+n,_=Math.hypot((Oe[2*h+0]+Oe[2*u+0])/2-Oe[2*d+0],(Oe[2*h+1]+Oe[2*u+1])/2-Oe[2*d+1])>=16;Fe[d]=Fe[d]||(_?1:0),e<1022&&(Fe[d]=Fe[d]||Fe[(o+c>>1)*Me+(i+l>>1)]||Fe[(s+c>>1)*Me+(r+l>>1)]);}const s=new e.ay,n=new e.az;let a=0;function l(t,i){const o=i*Me+t;return 0===Be[o]&&(s.emplaceBack(Oe[2*o+0],Oe[2*o+1],t*e.Y/Le,i*e.Y/Le),Be[o]=++a),Be[o]-1}function c(e,t,i,o,r,s){const a=e+i>>1,h=t+o>>1;if(Math.abs(e-r)+Math.abs(t-s)>1&&Fe[h*Me+a])c(r,s,e,t,a,h),c(i,o,r,s,a,h);else {const a=l(e,t),c=l(i,o),h=l(r,s);n.emplaceBack(a,c,h);}}return c(0,0,Le,Le,Le,0),c(Le,Le,0,0,0,Le),{vertices:s,indices:n}}(this.tileID.canonical,i);r=t.vertices,s=t.indices;}else {r=new e.ay,s=new e.az;for(const{x:e,y:t}of o)r.emplaceBack(e,t,0,0);const t=e.aT(r.int16,void 0,4);for(let e=0;e<t.length;e+=3)s.emplaceBack(t[e],t[e+1],t[e+2]);}this._tileBoundsBuffer=t.createVertexBuffer(r,e.aU.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(s),this._tileBoundsSegments=e.aE.simpleSegment(0,0,r.length,s.length);}_makeGlobeTileDebugBuffers(t,i){const o=i.projection;if(!o||\"globe\"!==o.name||i.freezeTileCoverage)return;const r=this.tileID.canonical,s=e.aV(r,i),n=e.aW(s),a=e.W(i.zoom);let l;a>0&&(l=e.a9.invert(new Float64Array(16),i.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,r,i,n,l,a),this._makeGlobeTileDebugTextBuffer(t,r,i,n,l,a);}_globePoint(t,i,o,r,s,n,a){let l=e.aX(t,i,o);if(n){const s=1<<o.z,c=e.a8(r.center.lng),h=e.ah(r.center.lat),u=(o.x+.5)/s-c;let d=0;u>.5?d=-1:u<-.5&&(d=1);let _=(t/e.Y+o.x)/s+d,p=(i/e.Y+o.y)/s;_=(_-c)*r._pixelsPerMercatorPixel+c,p=(p-h)*r._pixelsPerMercatorPixel+h;const f=[_*r.worldSize,p*r.worldSize,0];e.Q.transformMat4(f,f,n),l=e.aY(l,f,a);}return e.Q.transformMat4(l,l,s)}_makeGlobeTileDebugBorderBuffer(t,i,o,r,s,n){const a=new e.aQ,l=new e.aR,c=new e.aZ,h=(e,t,h,u,d)=>{const _=(h-e)/(d-1),p=(u-t)/(d-1),f=a.length;for(let h=0;h<d;h++){const u=e+h*_,d=t+h*p;a.emplaceBack(u,d);const m=this._globePoint(u,d,i,o,r,s,n);c.emplaceBack(m[0],m[1],m[2]),l.emplaceBack(f+h);}},u=e.Y;h(0,0,u,0,16),h(u,0,u,u,16),h(u,u,0,u,16),h(0,u,0,0,16),this._tileDebugIndexBuffer=t.createIndexBuffer(l),this._tileDebugBuffer=t.createVertexBuffer(a,e.aS.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(c,e.a_.members),this._tileDebugSegments=e.aE.simpleSegment(0,0,a.length,l.length);}_makeGlobeTileDebugTextBuffer(t,i,o,r,s,n){const a=e.Y/4,l=new e.aQ,c=new e.az,h=new e.aZ,u=25;c.reserve(32),l.reserve(u),h.reserve(u);const d=(e,t)=>u*e+t;for(let e=0;e<u;e++){const t=e*a;for(let e=0;e<u;e++){const c=e*a;l.emplaceBack(c,t);const u=this._globePoint(c,t,i,o,r,s,n);h.emplaceBack(u[0],u[1],u[2]);}}for(let e=0;e<4;e++)for(let t=0;t<4;t++){const i=d(e,t),o=d(e,t+1),r=d(e+1,t),s=d(e+1,t+1);c.emplaceBack(i,o,r),c.emplaceBack(r,o,s);}this._tileDebugTextIndexBuffer=t.createIndexBuffer(c),this._tileDebugTextBuffer=t.createVertexBuffer(l,e.aS.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(h,e.a_.members),this._tileDebugTextSegments=e.aE.simpleSegment(0,0,u,32);}destroy(t=!1){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),!t&&this.texture&&this.texture instanceof e.T&&(this.texture.destroy(),delete this.texture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state=\"unloaded\";}}const Ut={vector:Re,raster:Ae,\"raster-dem\":class extends Ae{constructor(t,i,o,r){super(t,i,o,r),this.type=\"raster-dem\",this.maxzoom=22,this._options=e.e({type:\"raster-dem\"},i),this.encoding=i.encoding||\"mapbox\";}loadTile(t,i){const o=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function r(e,o){e&&(t.state=\"errored\",i(e)),o&&(t.dem=o,t.dem.onDeserialize(),t.needsHillshadePrepare=!0,t.needsDEMTextureUpload=!0,t.state=\"loaded\",i(null));}t.request=e.d(this.map._requestManager.transformRequest(o,e.R.Tile),function(o,s,n,a){if(delete t.request,t.aborted)t.state=\"unloaded\",i(null);else if(o)t.state=\"errored\",i(o);else if(s){this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:n,expires:a});const i=ImageBitmap&&s instanceof ImageBitmap&&e.an(),o=1-(s.width-e.ao(s.width))/2;o<1||t.neighboringTiles||(t.neighboringTiles=this._getNeighboringTiles(t.tileID));const l=i?s:e.f.getImageData(s,o),c={uid:t.uid,coord:t.tileID,source:this.id,scope:this.scope,rawImageData:l,encoding:this.encoding,padding:o};t.actor&&\"expired\"!==t.state||(t.actor=this.dispatcher.getActor(),t.actor.send(\"loadDEMTile\",c,r.bind(this),void 0,!0));}}.bind(this));}_getNeighboringTiles(t){const i=t.canonical,o=Math.pow(2,i.z),r=(i.x-1+o)%o,s=0===i.x?t.wrap-1:t.wrap,n=(i.x+1+o)%o,a=i.x+1===o?t.wrap+1:t.wrap,l={};return l[new e.ap(t.overscaledZ,s,i.z,r,i.y).key]={backfilled:!1},l[new e.ap(t.overscaledZ,a,i.z,n,i.y).key]={backfilled:!1},i.y>0&&(l[new e.ap(t.overscaledZ,s,i.z,r,i.y-1).key]={backfilled:!1},l[new e.ap(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new e.ap(t.overscaledZ,a,i.z,n,i.y-1).key]={backfilled:!1}),i.y+1<o&&(l[new e.ap(t.overscaledZ,s,i.z,r,i.y+1).key]={backfilled:!1},l[new e.ap(t.overscaledZ,t.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new e.ap(t.overscaledZ,a,i.z,n,i.y+1).key]={backfilled:!1}),l}},\"raster-array\":Pe,geojson:class extends e.E{constructor(t,i,o,r){super(),this.id=t,this.type=\"geojson\",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=o.getActor(),this.setEventedParent(r),this._data=i.data,this._options=e.e({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),void 0!==i.minzoom&&(this.minzoom=i.minzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId;const s=e.Y/this.tileSize;this.workerOptions=e.e({source:this.id,scope:this.scope,cluster:i.cluster||!1,geojsonVtOptions:{buffer:(void 0!==i.buffer?i.buffer:128)*s,tolerance:(void 0!==i.tolerance?i.tolerance:.375)*s,extent:e.Y,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:void 0!==i.clusterMaxZoom?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:e.Y,radius:(void 0!==i.clusterRadius?i.clusterRadius:50)*s,log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter,dynamic:i.dynamic},i.workerOptions);}onAdd(e){this.map=e,this.setData(this._data);}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(t){return this._options.dynamic?(this._data=t,this._updateWorkerData(!0),this):this.fire(new e.a(new Error(\"Can't call updateData on a GeoJSON source with dynamic set to false.\")))}getClusterExpansionZoom(e,t){return this.actor.send(\"geojson.getClusterExpansionZoom\",{clusterId:e,source:this.id,scope:this.scope},t),this}getClusterChildren(e,t){return this.actor.send(\"geojson.getClusterChildren\",{clusterId:e,source:this.id,scope:this.scope},t),this}getClusterLeaves(e,t,i,o){return this.actor.send(\"geojson.getClusterLeaves\",{source:this.id,scope:this.scope,clusterId:e,limit:t,offset:i},o),this}_updateWorkerData(t=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new e.b(\"dataloading\",{dataType:\"source\"})),this._loaded=!1;const i=e.e({append:t},this.workerOptions);i.scope=this.scope;const o=this._data;\"string\"==typeof o?(i.request=this.map._requestManager.transformRequest(e.f.resolveURL(o),e.R.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(o),this._pendingLoad=this.actor.send(`${this.type}.loadData`,i,((i,o)=>{if(this._loaded=!0,this._pendingLoad=null,i)this.fire(new e.a(i));else {const t={dataType:\"source\",sourceDataType:this._metadataFired?\"content\":\"metadata\"};this._collectResourceTiming&&o&&o.resourceTiming&&o.resourceTiming[this.id]&&(t.resourceTiming=o.resourceTiming[this.id]),this.fire(new e.b(\"data\",t)),this._metadataFired=!0;}this._coalesce&&(this._updateWorkerData(t),this._coalesce=!1);}));}loaded(){return this._loaded}loadTile(t,i){const o=t.actor?\"reloadTile\":\"loadTile\";t.actor=this.actor;const r={type:this.type,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,scope:this.scope,pixelRatio:e.f.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0};t.request=this.actor.send(o,r,((e,r)=>(delete t.request,t.destroy(),t.aborted?i(null):e?i(e):(t.loadVectorData(r,this.map.painter,\"reloadTile\"===o),i(null)))),void 0,\"loadTile\"===o);}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0;}unloadTile(e){this.actor.send(\"removeTile\",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy();}onRemove(){this._pendingLoad&&this._pendingLoad.cancel();}serialize(){return e.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return !1}},video:class extends e.as{constructor(e,t,i,o){super(e,t,i,o),this.roundZoom=!0,this.type=\"video\",this.options=t;}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const i of t.urls)this.urls.push(this.map._requestManager.transformRequest(i,e.R.Source).url);e.at(this.urls,((t,i)=>{this._loaded=!0,t?this.fire(new e.a(t)):i&&(this.video=i,this.video.loop=!0,this.video.setAttribute(\"playsinline\",\"\"),this.video.addEventListener(\"playing\",(()=>{this.map.triggerRepaint();})),this.map&&this.video.play(),this._finishLoading());}));}pause(){this.video&&this.video.pause();}play(){this.video&&this.video.play();}seek(t){if(this.video){const i=this.video.seekable;t<i.start(0)||t>i.end(0)?this.fire(new e.a(new e.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=t;}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)));}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const t=this.map.painter.context,i=t.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new e.T(t,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(t);}serialize(){return {type:\"video\",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:e.as,model:class extends e.E{constructor(e,t,i,o){super(),this.id=e,this.type=\"model\",this.models=[],this._loaded=!1,this._options=t;}load(){const t=[];for(const i in this._options.models){const o=this._options.models[i],r=e.l(this.map._requestManager.transformRequest(o.uri,e.R.Model).url).then((t=>{if(!t)return;const r=e.c(t),s=new e.M(i,o.position,o.orientation,r);s.computeBoundsAndApplyParent(),this.models.push(s);})).catch((t=>{this.fire(new e.a(new Error(`Could not load model ${i} from ${o.uri}: ${t.message}`)));}));t.push(r);}return Promise.allSettled(t).then((()=>{this._loaded=!0,this.fire(new e.b(\"data\",{dataType:\"source\",sourceDataType:\"metadata\"}));})).catch((t=>{this.fire(new e.a(new Error(`Could not load models: ${t.message}`)));}))}onAdd(e){this.map=e,this.load();}hasTransition(){return !1}loaded(){return this._loaded}getModels(){return this.models}loadTile(e,t){}serialize(){return {type:\"model\"}}},\"batched-model\":class extends e.E{constructor(e,t,i,o){super(),this.type=\"batched-model\",this.id=e,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=i,this.reparseOverscaled=!1,this.scheme=\"xyz\",this._loaded=!1,this.setEventedParent(o);}onAdd(e){this.map=e,this.load();}load(t){this._loaded=!1,this.fire(new e.b(\"dataloading\",{dataType:\"source\"}));const i=Array.isArray(this.map._language)?this.map._language.join():this.map._language,o=this.map._worldview;this._tileJSONRequest=Ie(this._options,this.map._requestManager,i,o,((r,s)=>{this._tileJSONRequest=null,this._loaded=!0,r?(i&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i}`),o&&2!==o.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${o}`),this.fire(new e.a(r))):s&&(e.e(this,s),s.bounds&&(this.tileBounds=new De(s.bounds,this.minzoom,this.maxzoom)),e.am(s.tiles,this.map._requestManager._customAccessToken),this.fire(new e.b(\"data\",{dataType:\"source\",sourceDataType:\"metadata\"})),this.fire(new e.b(\"data\",{dataType:\"source\",sourceDataType:\"content\"}))),t&&t(r);}));}hasTransition(){return !1}hasTile(e){return !this.tileBounds||this.tileBounds.contains(e.canonical)}loaded(){return this._loaded}loadTile(t,i){const o=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme)),r={request:this.map._requestManager.transformRequest(o,e.R.Tile),data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0};if(t.actor&&\"expired\"!==t.state)if(\"loading\"===t.state)t.reloadCallback=i;else {if(t.buckets){const e=Object.values(t.buckets);for(const t of e)t.dirty=!0;return void(t.state=\"loaded\")}t.request=t.actor.send(\"reloadTile\",r,s.bind(this));}else t.actor=this.dispatcher.getActor(),t.request=t.actor.send(\"loadTile\",r,s.bind(this),void 0,!0);function s(e,o){return t.aborted?i(null):e&&404!==e.status?i(e):(o&&(o.resourceTiming&&(t.resourceTiming=o.resourceTiming),this.map._refreshExpiredTiles&&t.setExpiryData(o),t.buckets={...t.buckets,...o.buckets},o.featureIndex&&(t.latestFeatureIndex=o.featureIndex)),t.state=\"loaded\",void i(null))}}serialize(){return e.e({},this._options)}},canvas:class extends e.as{constructor(t,i,o,r){super(t,i,o,r),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((e=>!Array.isArray(e)||2!==e.length||e.some((e=>\"number\"!=typeof e))))||this.fire(new e.a(new e.V(`sources.${t}`,null,'\"coordinates\" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.a(new e.V(`sources.${t}`,null,'missing required property \"coordinates\"'))),i.animate&&\"boolean\"!=typeof i.animate&&this.fire(new e.a(new e.V(`sources.${t}`,null,'optional \"animate\" property must be a boolean value'))),i.canvas?\"string\"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new e.a(new e.V(`sources.${t}`,null,'\"canvas\" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new e.a(new e.V(`sources.${t}`,null,'missing required property \"canvas\"'))),this.options=i,this.animate=void 0===i.animate||i.animate;}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.a(new Error(\"Canvas dimensions cannot be less than or equal to zero.\"))):(this.play=function(){this._playing=!0,this.map.triggerRepaint();},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1);},this._finishLoading());}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play();}onRemove(){this.pause();}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context;this.texture?!t&&!this._playing||this.texture instanceof e.au||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.T(i,this.canvas,i.gl.RGBA,{premultiply:!0}),this._prepareData(i);}serialize(){return {type:\"canvas\",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of [this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return !0;return !1}},custom:class extends e.E{constructor(t,i,o,r){super(),this.id=t,this.type=\"custom\",this._dataType=\"raster\",this._dispatcher=o,this._implementation=i,this.setEventedParent(r),this.scheme=\"xyz\",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new e.a(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new e.a(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new De(this._implementation.bounds,this.minzoom,this.maxzoom)),i.update=this._update.bind(this),i.clearTiles=this._clearTiles.bind(this),i.coveringTiles=this._coveringTiles.bind(this),e.e(this,e.af(i,[\"dataType\",\"scheme\",\"minzoom\",\"maxzoom\",\"tileSize\",\"attribution\",\"minTileCacheSize\",\"maxTileCacheSize\"]));}serialize(){return e.af(this,[\"type\",\"scheme\",\"minzoom\",\"maxzoom\",\"tileSize\",\"attribution\"])}load(){this._loaded=!0,this.fire(new e.b(\"data\",{dataType:\"source\",sourceDataType:\"metadata\"})),this.fire(new e.b(\"data\",{dataType:\"source\",sourceDataType:\"content\"}));}loaded(){return this._loaded}onAdd(t){this._map=t,this._loaded=!1,this.fire(new e.b(\"dataloading\",{dataType:\"source\"})),this._implementation.onAdd&&this._implementation.onAdd(t),this.load();}onRemove(e){this._implementation.onRemove&&this._implementation.onRemove(e);}hasTile(e){if(this._implementation.hasTile){const{x:t,y:i,z:o}=e.canonical;return this._implementation.hasTile({x:t,y:i,z:o})}return !this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e,t){const{x:i,y:o,z:r}=e.tileID.canonical,s=new AbortController;e.request=Promise.resolve(this._implementation.loadTile({x:i,y:o,z:r},{signal:s.signal})).then(function(i){return delete e.request,e.aborted?(e.state=\"unloaded\",t(null)):void 0===i?(e.state=\"errored\",t(null)):null===i?(this.loadTileData(e,{width:this.tileSize,height:this.tileSize,data:null}),e.state=\"loaded\",t(null)):function(e){return e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof ImageBitmap||e instanceof HTMLImageElement}(i)?(this.loadTileData(e,i),e.state=\"loaded\",void t(null)):(e.state=\"errored\",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}.bind(this)).catch((i=>{20!==i.code&&(e.state=\"errored\",t(i));})),e.request.cancel=()=>s.abort();}loadTileData(e,t){e.setTexture(t,this._map.painter);}unloadTile(t,i){if(t.texture&&t.texture instanceof e.T?(t.destroy(!0),t.texture&&t.texture instanceof e.T&&this._map.painter.saveTileTexture(t.texture)):t.destroy(),this._implementation.unloadTile){const{x:e,y:i,z:o}=t.tileID.canonical;this._implementation.unloadTile({x:e,y:i,z:o});}i();}abortTile(e,t){e.request&&e.request.cancel&&(e.request.cancel(),delete e.request),t();}hasTransition(){return !1}_coveringTiles(){return this._map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map((e=>({x:e.canonical.x,y:e.canonical.y,z:e.canonical.z})))}_clearTiles(){const t=e.aj(this.id,this.scope);this._map.style.clearSource(t);}_update(){this.fire(new e.b(\"data\",{dataType:\"source\",sourceDataType:\"content\"}));}}},Gt=function(t,i,o,r){const s=new Ut[i.type](t,i,o,r);if(s.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${s.id}`);return e.a$([\"load\",\"abort\",\"unload\",\"serialize\",\"prepare\"],s),s};function jt(t,i){const o=e.a9.identity([]);return e.a9.scale(o,o,[.5*t.width,.5*-t.height,1]),e.a9.translate(o,o,[1,-1,0]),e.a9.multiply(o,o,t.calculateProjMatrix(i.toUnwrapped())),Float32Array.from(o)}function Vt(e,t,i,o,r,s,n,a=!1){const l=e.tilesIn(o,n,a);l.sort(Wt);const c=[];for(const o of l)c.push({wrappedTileID:o.tile.tileID.wrapped().key,queryResults:o.tile.queryRenderedFeatures(t,i,e._state,o,r,s,jt(e.transform,o.tile.tileID),a)});const h=function(e){const t={},i={};for(const o of e){const e=o.queryResults,r=o.wrappedTileID,s=i[r]=i[r]||{};for(const i in e){const o=e[i],r=s[i]=s[i]||{},n=t[i]=t[i]||[];for(const e of o)r[e.featureIndex]||(r[e.featureIndex]=!0,n.push(e));}}return t}(c);for(const t in h)h[t].forEach((t=>{const i=t.feature,o=i.layer;o&&\"background\"!==o.type&&\"sky\"!==o.type&&\"slot\"!==o.type&&(i.source=o.source,o[\"source-layer\"]&&(i.sourceLayer=o[\"source-layer\"]),i.state=void 0!==i.id?e.getFeatureState(o[\"source-layer\"],i.id):{});}));return h}function Zt(e,t){const i=e.getRenderableIds().map((t=>e.getTileByID(t))),o=[],r={};for(let e=0;e<i.length;e++){const s=i[e],n=s.tileID.canonical.key;r[n]||(r[n]=!0,s.querySourceFeatures(o,t));}return o}function Wt(e,t){const i=e.tileID,o=t.tileID;return i.overscaledZ-o.overscaledZ||i.canonical.y-o.canonical.y||i.wrap-o.wrap||i.canonical.x-o.canonical.x}class Ht extends Nt{constructor(e,t,i,o,r){super(e,t,i,o,r),this._workQueue=[],this._fetchQueue=[],this._isHeaderLoaded=!1;}setTexture(t,i){const o=i.context,r=o.gl;this.texture=this.texture||i.getTileTexture(t.width),this.texture&&this.texture instanceof e.T?this.texture.update(t,{useMipmap:!1,premultiply:!1}):this.texture=new e.T(o,t,r.RGBA,{useMipmap:!1,premultiply:!1});}flushQueues(){for(;this._workQueue.length;)this._workQueue.pop()();for(;this._fetchQueue.length;)this._fetchQueue.pop()();}fetchHeader(t=16384,i){const o=this._mrt=new e.b0(30),r=Object.assign({},this.requestParams,{headers:{Range:\"bytes=0-\"+(t-1)}});return this.entireBuffer=null,this.request=e.b1(r,((e,r,s,n)=>{if(e)i(e);else try{const e=o.getHeaderLength(r);if(e>t)return void(this.request=this.fetchHeader(e,i));o.parseHeader(r),this._isHeaderLoaded=!0;let a=0;for(const e of Object.values(o.layers))a=Math.max(a,e.dataIndex[e.dataIndex.length-1].last_byte);r.byteLength>=a&&(this.entireBuffer=r),i(null,this.entireBuffer||r,s,n);}catch(e){i(e);}})),this.request}fetchBand(t,i,o){const r=this._mrt;if(!this._isHeaderLoaded||!r)return void o(new Error(\"Tile header is not ready\"));const s=this.actor;if(!s)return void o(new Error(\"Can't fetch tile band without an actor\"));let n;const a=(e,r)=>{n.complete(e,r),e?o(e):(this.updateTextureDescriptor(t,i),o(null,this.textureDescriptor&&this.textureDescriptor.img));},l=(e,t)=>{if(e)return o(e);const i=s.send(\"decodeRasterArray\",{buffer:t,task:n},a,void 0,!0);this._workQueue.push((()=>{i&&i.cancel(),n.cancel();}));},c=r.getLayer(t);if(!c)return void o(new Error(`Unknown sourceLayer \"${t}\"`));if(c.hasDataForBand(i))return this.updateTextureDescriptor(t,i),void o(null,this.textureDescriptor?this.textureDescriptor.img:null);const h=c.getDataRange([i]);if(n=r.createDecodingTask(h),!n||n.tasks.length)if(this.flushQueues(),this.entireBuffer)l(null,this.entireBuffer.slice(h.firstByte,h.lastByte+1));else {const t=Object.assign({},this.requestParams,{headers:{Range:`bytes=${h.firstByte}-${h.lastByte}`}}),i=e.b1(t,l);this._fetchQueue.push((()=>{i.cancel(),n.cancel();}));}else o(null);}updateNeeded(e,t){return (!this.textureDescriptor||this.textureDescriptor.band!==t||this.textureDescriptor.layer!==e)&&\"errored\"!==this.state}updateTextureDescriptor(t,i){if(!this._mrt)return;const o=this._mrt.getLayer(t);if(!o||!o.hasBand(i)||!o.hasDataForBand(i))return;const{bytes:r,tileSize:s,buffer:n,offset:a,scale:l}=o.getBandView(i),c=s+2*n,h={data:r,width:c,height:c},u=this.texture;u&&u instanceof e.T&&u.update(h,{useMipmap:!1,premultiply:!1}),this.textureDescriptor={layer:t,band:i,img:h,buffer:n,offset:a,tileSize:s,format:o.pixelFormat,mix:[l,256*l,65536*l,16777216*l]};}}class qt{constructor(e,t){this.max=e,this.onRemove=t,this.reset();}reset(){for(const e in this.data)for(const t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,i){const o=e.wrapped().key;void 0===this.data[o]&&(this.data[o]=[]);const r={value:t,timeout:void 0};if(void 0!==i&&(r.timeout=setTimeout((()=>{this.remove(e,r);}),i)),this.data[o].push(r),this.order.push(o),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e);}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;const i=e.wrapped().key,o=void 0===t?0:this.data[i].indexOf(t),r=this.data[i][o];return this.data[i].splice(o,1),r.timeout&&clearTimeout(r.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(r.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e);}return this}filter(e){const t=[];for(const i in this.data)for(const o of this.data[i])e(o.value)||t.push(o);for(const e of t)this.remove(e.value.tileID,e);}}class Qt extends e.E{constructor(e,t,i){super(),this.id=e,this._onlySymbols=i,t.on(\"data\",(e=>{\"source\"===e.dataType&&\"metadata\"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&\"source\"===e.dataType&&\"content\"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform));})),t.on(\"error\",(()=>{this._sourceErrored=!0;})),this._source=t,this._tiles={},this._cache=new qt(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new y,this._isRaster=\"raster\"===this._source.type||\"raster-dem\"===this._source.type||\"raster-array\"===this._source.type||\"custom\"===this._source.type&&\"raster\"===this._source._dataType;}onAdd(e){this.map=e,this._minTileCacheSize=void 0===this._minTileCacheSize&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&e?e._maxTileCacheSize:this._maxTileCacheSize;}loaded(){if(this._sourceErrored)return !0;if(!this._sourceLoaded)return !1;if(!this._source.loaded())return !1;for(const e in this._tiles){const t=this._tiles[e];if(\"errored\"!==t.state&&(\"loaded\"!==t.state||!t.bucketsLoaded()))return !1}return !0}getSource(){return this._source}pause(){this._paused=!0;}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform);}_loadTile(e,t){return e.isSymbolTile=this._onlySymbols,e.isExtraShadowCaster=this._shadowCasterTiles[e.tileID.key],this._source.loadTile(e,t)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e,(()=>{}))}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e,(()=>{}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const t in this._tiles){const i=this._tiles[t];i.upload(e),i.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope);}}getIds(){return e.b2(this._tiles).map((e=>e.tileID)).sort($t).map((e=>e.key))}getRenderableIds(t,i){const o=[];for(const e in this._tiles)this._isIdRenderable(+e,t,i)&&o.push(this._tiles[e]);return t?o.sort(((t,i)=>{const o=t.tileID,r=i.tileID,s=new e.P(o.canonical.x,o.canonical.y)._rotate(this.transform.angle),n=new e.P(r.canonical.x,r.canonical.y)._rotate(this.transform.angle);return o.overscaledZ-r.overscaledZ||n.y-s.y||n.x-s.x})).map((e=>e.tileID.key)):o.map((e=>e.tileID)).sort($t).map((e=>e.key))}hasRenderableParent(e){const t=this.findLoadedParent(e,0);return !!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t,i){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())&&(i||!this._shadowCasterTiles[e])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else {this._cache.reset();for(const e in this._tiles)\"errored\"!==this._tiles[e].state&&this._reloadTile(+e,\"reloading\");}}_reloadTile(e,t){const i=this._tiles[e];i&&(\"loading\"!==i.state&&(i.state=t),this._loadTile(i,this._tileLoaded.bind(this,i,e,t)));}_tileLoaded(t,i,o,r){if(r)if(t.state=\"errored\",404!==r.status)this._source.fire(new e.a(r,{tile:t}));else {if(!(t.tileID.key in this._loadedParentTiles))return void this._source.fire(new e.b(\"data\",{dataType:\"source\",sourceDataType:\"error\",sourceId:this._source.id}));if(\"raster-dem\"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const e=this.map.painter.terrain;this.update(this.transform,e.getScaledDemTileSize(),!0),e.resetTileLookupCache(this.id);}else this.update(this.transform);}else t.timeAdded=e.f.now(),\"expired\"===o&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,t),\"raster-dem\"===this._source.type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new e.b(\"data\",{dataType:\"source\",tile:t,coord:t.tileID,sourceCacheId:this.id}));}_backfillDEM(e){const t=this.getRenderableIds();for(let o=0;o<t.length;o++){const r=t[o];if(e.neighboringTiles&&e.neighboringTiles[r]){const t=this.getTileByID(r);i(e,t),i(t,e);}}function i(e,t){if(!e.dem||e.dem.borderReady)return;e.needsHillshadePrepare=!0,e.needsDEMTextureUpload=!0;let i=t.tileID.canonical.x-e.tileID.canonical.x;const o=t.tileID.canonical.y-e.tileID.canonical.y,r=Math.pow(2,e.tileID.canonical.z),s=t.tileID.key;0===i&&0===o||Math.abs(o)>1||(Math.abs(i)>1&&(1===Math.abs(i+r)?i+=r:1===Math.abs(i-r)&&(i-=r)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,o),e.neighboringTiles&&e.neighboringTiles[s]&&(e.neighboringTiles[s].backfilled=!0)));}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,i,o){for(const r in this._tiles){let s=this._tiles[r];if(o[r]||!s.hasData()||s.tileID.overscaledZ<=t||s.tileID.overscaledZ>i)continue;let n=s.tileID;for(;s&&s.tileID.overscaledZ>t+1;){const e=s.tileID.scaledTo(s.tileID.overscaledZ-1);s=this._tiles[e.key],s&&s.hasData()&&(n=e);}let a=n;for(;a.overscaledZ>t;)if(a=a.scaledTo(a.overscaledZ-1),e[a.key]){o[n.key]=n;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){const i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=t?i:null}for(let i=e.overscaledZ-1;i>=t;i--){const t=e.scaledTo(i),o=this._getLoadedTile(t);if(o)return o}}_getLoadedTile(e){const t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,t){t=t||this._source.tileSize;const i=Math.ceil(e.width/t)+1,o=Math.ceil(e.height/t)+1,r=Math.floor(i*o*5),s=\"number\"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,r):r,n=\"number\"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,s):s;this._cache.setMaxSize(n);}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){const e={};for(const i in this._tiles){const o=this._tiles[i];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+t),e[o.tileID.key]=o;}this._tiles=e;for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(+e,this._tiles[e]);}}update(t,i,o,r){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!o)return;let s;if(this.updateCacheSize(t,i),\"globe\"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={},this.used||this.usedForTerrain)if(this._source.tileID)s=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((t=>new e.ap(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)));else if(0!==this.tileCoverLift){const r=t.clone();r.tileCoverLift=this.tileCoverLift,s=r.coveringTiles({tileSize:i||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!o,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.minzoom<=1&&\"globe\"===t.projection.name&&(s.push(new e.ap(1,0,1,0,0)),s.push(new e.ap(1,0,1,1,0)),s.push(new e.ap(1,0,1,0,1)),s.push(new e.ap(1,0,1,1,1)));}else s=t.coveringTiles({tileSize:i||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!o,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(s=s.filter((e=>this._source.hasTile(e))));else s=[];if(s.length>0&&this.castsShadows&&r&&\"globe\"!==this.transform.projection.name&&!this.usedForTerrain&&!Xt(this._source.type)){const e=t.coveringZoomLevel({tileSize:i||this._source.tileSize,roundZoom:this._source.roundZoom&&!o}),n=Math.min(e,this._source.maxzoom),a=t.extendTileCoverForShadows(s,r,n);for(const e of a)this._shadowCasterTiles[e.key]=!0,s.push(e);}const n=this._updateRetainedTiles(s);if(Xt(this._source.type)&&0!==s.length){const t={},i={},o=Object.keys(n);for(const r of o){const o=n[r],s=this._tiles[r];if(!s||s.fadeEndTime&&s.fadeEndTime<=e.f.now())continue;const a=this.findLoadedParent(o,Math.max(o.overscaledZ-Qt.maxOverzooming,this._source.minzoom));a&&(this._addTile(a.tileID),t[a.tileID.key]=a.tileID),i[r]=o;}const r=s[s.length-1].overscaledZ;for(const e in this._tiles){const t=this._tiles[e];if(n[e]||!t.hasData())continue;let o=t.tileID;for(;o.overscaledZ>r;){o=o.scaledTo(o.overscaledZ-1);const r=this._tiles[o.key];if(r&&r.hasData()&&i[o.key]){n[e]=t.tileID;break}}}for(const e in t)n[e]||(this._coveredTiles[e]=!0,n[e]=t[e]);}for(const e in n)this._tiles[e].clearFadeHold();const a=e.b3(this._tiles,n);for(const e of a){const t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(+e);}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate();}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e);}_updateRetainedTiles(e){const t={};if(0===e.length)return t;const i={},o=e.reduce(((e,t)=>Math.min(e,t.overscaledZ)),1/0),r=e[0].overscaledZ,s=Math.max(r-Qt.maxOverzooming,this._source.minzoom),n=Math.max(r+Qt.maxUnderzooming,this._source.minzoom),a={};for(const i of e){const e=this._addTile(i);t[i.key]=i,e.hasData()||o<this._source.maxzoom&&(a[i.key]=i);}this._retainLoadedChildren(a,o,n,t);for(const o of e){let e=this._tiles[o.key];if(e.hasData())continue;if(o.canonical.z>=this._source.maxzoom){const e=o.children(this._source.maxzoom)[0],i=this.getTile(e);if(i&&i.hasData()){t[e.key]=e;continue}}else {const e=o.children(this._source.maxzoom);if(t[e[0].key]&&t[e[1].key]&&t[e[2].key]&&t[e[3].key])continue}let r=e.wasRequested();for(let n=o.overscaledZ-1;n>=s;--n){const s=o.scaledTo(n);if(i[s.key])break;if(i[s.key]=!0,e=this.getTile(s),!e&&r&&(e=this._addTile(s)),e&&(t[s.key]=s,r=e.wasRequested(),e.hasData()))break}}return t}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let i,o=this._tiles[e].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){i=this._loadedParentTiles[o.key];break}t.push(o.key);const e=o.scaledTo(o.overscaledZ-1);if(i=this._getLoadedTile(e),i)break;o=e;}for(const e of t)this._loadedParentTiles[e]=i;}}_addTile(t){let i=this._tiles[t.key];if(i)return !0!==i.isExtraShadowCaster||!!this._shadowCasterTiles[t.key]||this._reloadTile(t.key,\"reloading\"),i;i=this._cache.getAndRemove(t),i&&(this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,i)));const o=Boolean(i);if(!o){const e=this.map?this.map.painter:null,o=this._source.tileSize*t.overscaleFactor();i=\"raster-array\"===this._source.type?new Ht(t,o,this.transform.tileZoom,e,this._isRaster):new Nt(t,o,this.transform.tileZoom,e,this._isRaster),this._loadTile(i,this._tileLoaded.bind(this,i,t.key,i.state));}return i?(i.uses++,this._tiles[t.key]=i,o||this._source.fire(new e.b(\"dataloading\",{tile:i,coord:i.tileID,dataType:\"source\"})),i):null}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,\"expired\"),delete this._timers[e];}),i));}_removeTile(e){const t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&\"reloading\"!==t.state||\"empty\"===t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))));}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id);}tilesIn(t,i,o){const r=[],s=this.transform;if(!s)return r;const n=\"globe\"===s.projection.name,a=e.a8(s.center.lng);for(const l in this._tiles){const c=this._tiles[l];if(o&&c.clearQueryDebugViz(),c.holdingForFade())continue;let h;if(n){const t=c.tileID.canonical;if(0===t.z){const i=[Math.abs(e.ad(a,...Yt(t,-1))-a),Math.abs(e.ad(a,...Yt(t,1))-a)];h=[0,2*i.indexOf(Math.min(...i))-1];}else {const i=[Math.abs(e.ad(a,...Yt(t,-1))-a),Math.abs(e.ad(a,...Yt(t,0))-a),Math.abs(e.ad(a,...Yt(t,1))-a)];h=[i.indexOf(Math.min(...i))-1];}}else h=[0];for(const e of h){const o=t.containsTile(c,s,i,e);o&&r.push(o);}}return r}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(e){return this._getRenderableCoordinates(e)}_getRenderableCoordinates(e,t){const i=this.getRenderableIds(e,t).map((e=>this._tiles[e].tileID)),o=\"globe\"===this.transform.projection.name;for(const e of i)e.projMatrix=this.transform.calculateProjMatrix(e.toUnwrapped()),e.expandedProjMatrix=o?this.transform.calculateProjMatrix(e.toUnwrapped(),!1,!0):e.projMatrix;return i}sortCoordinatesByDistance(e){const t=e.slice(),i=this.transform._camera.position,o=this.transform._camera.forward(),r={};for(const e of t){const t=1/(1<<e.canonical.z);r[e.key]=((e.canonical.x+.5)*t+e.wrap-i[0])*o[0]+((e.canonical.y+.5)*t-i[1])*o[1]-i[2]*o[2];}return t.sort(((e,t)=>r[e.key]-r[t.key])),t}hasTransition(){if(this._source.hasTransition())return !0;if(Xt(this._source.type))for(const t in this._tiles){const i=this._tiles[t];if(void 0!==i.fadeEndTime&&i.fadeEndTime>=e.f.now())return !0}return !1}setFeatureState(e,t,i){this._state.updateState(e=e||\"_geojsonTileLayer\",t,i);}removeFeatureState(e,t,i){this._state.removeFeatureState(e=e||\"_geojsonTileLayer\",t,i);}getFeatureState(e,t){return this._state.getState(e=e||\"_geojsonTileLayer\",t)}setDependencies(e,t,i){const o=this._tiles[e];o&&o.setDependencies(t,i);}reloadTilesForDependencies(e,t){for(const i in this._tiles)this._tiles[i].hasDependency(e,t)&&this._reloadTile(+i,\"reloading\");this._cache.filter((i=>!i.hasDependency(e,t)));}_preloadTiles(t,i){if(!this._sourceLoaded){const e=()=>{this._sourceLoaded&&(this._source.off(\"data\",e),this._preloadTiles(t,i));};return void this._source.on(\"data\",e)}const o=new Map,r=Array.isArray(t)?t:[t],s=this.map.painter.terrain,n=this.usedForTerrain&&s?s.getScaledDemTileSize():this._source.tileSize;for(const e of r){const t=e.coveringTiles({tileSize:n,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const e of t)o.set(e.key,e);this.usedForTerrain&&e.updateElevation(!1);}const a=Array.from(o.values());e.b4(a,((e,t)=>{const i=new Nt(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(i,(e=>{\"raster-dem\"===this._source.type&&i.dem&&this._backfillDEM(i),t(e,i);}));}),i);}}function $t(e,t){const i=Math.abs(2*e.wrap)-+(e.wrap<0),o=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||o-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function Xt(e){return \"raster\"===e||\"image\"===e||\"video\"===e||\"custom\"===e}function Yt(e,t){const i=1<<e.z;return [e.x/i+t,(e.x+1)/i+t]}Qt.maxOverzooming=10,Qt.maxUnderzooming=3;class Jt{constructor(e){this.style=e,this.layersGotHidden=!1,this.layers=[];}processLayersChanged(){this.layers=[];const e=!1,t=!1;for(const i in this.style._mergedLayers){const o=this.style._mergedLayers[i];if(\"fill-extrusion\"===o.type)this.layers.push({layer:o,visible:e,visibilityChanged:t});else if(\"model\"===o.type){const i=this.style.getLayerSource(o);i&&\"batched-model\"===i.type&&this.layers.push({layer:o,visible:e,visibilityChanged:t});}}}onNewFrame(e){this.layersGotHidden=!1;for(const t of this.layers){const i=t.layer;let o=!1;\"fill-extrusion\"===i.type?o=!i.isHidden(e)&&i.paint.get(\"fill-extrusion-opacity\")>0:\"model\"===i.type&&(o=!i.isHidden(e)&&i.paint.get(\"model-opacity\")>0),this.layersGotHidden=this.layersGotHidden||!o&&t.visible,t.visible=o;}}updateZOffset(e,t){this.currentBuildingBuckets=[];for(const e of this.layers){const i=e.layer,o=this.style.getLayerSourceCache(i);let r=1;\"fill-extrusion\"===i.type&&(r=e.visible?i.paint.get(\"fill-extrusion-vertical-scale\"):0);let s=o?o.getTile(t):null;if(!s&&o&&t.canonical.z>o.getSource().minzoom){let e=t.scaledTo(Math.min(o.getSource().maxzoom,t.overscaledZ-1));for(;e.overscaledZ>=o.getSource().minzoom&&(s=o.getTile(e),!s&&0!==e.overscaledZ);)e=e.scaledTo(e.overscaledZ-1);}this.currentBuildingBuckets.push({bucket:s?s.getBucket(i):null,tileID:s?s.tileID:t,verticalScale:r});}e.hasAnyZOffset=!1;let i=!1;for(let o=0;o<e.symbolInstances.length;o++){const r=e.symbolInstances.get(o),s=r.zOffset,n=this._getHeightAtTileOffset(t,r.tileAnchorX,r.tileAnchorY);r.zOffset=n!==Number.NEGATIVE_INFINITY?n:s,i||s===r.zOffset||(i=!0),e.hasAnyZOffset||0===r.zOffset||(e.hasAnyZOffset=!0);}i&&(e.zOffsetBuffersNeedUpload=!0,e.zOffsetSortDirty=!0);}_mapCoordToOverlappingTile(t,i,o,r){let s=i,n=o;if(t.canonical.z!==r.canonical.z){const a=r.canonical,l=1/(1<<t.canonical.z-a.z);s=(i+t.canonical.x*e.Y)*l-a.x*e.Y|0,n=(o+t.canonical.y*e.Y)*l-a.y*e.Y|0;}return {tileX:s,tileY:n}}_getHeightAtTileOffset(e,t,i){let o,r;for(let s=0;s<this.layers.length;++s){if(\"fill-extrusion\"!==this.layers[s].layer.type)continue;const{bucket:n,tileID:a,verticalScale:l}=this.currentBuildingBuckets[s];if(!n)continue;const{tileX:c,tileY:h}=this._mapCoordToOverlappingTile(e,t,i,a),u=n.getHeightAtTileCoord(c,h);u&&void 0!==u.height&&(u.hidden?o=u.height:r=Math.max(u.height*l,r||0));}if(void 0!==r)return r;for(let r=0;r<this.layers.length;++r){const s=this.layers[r];if(\"model\"!==s.layer.type||!s.visible)continue;const{bucket:n,tileID:a}=this.currentBuildingBuckets[r];if(!n)continue;const{tileX:l,tileY:c}=this._mapCoordToOverlappingTile(e,t,i,a),h=n.getHeightAtTileCoord(l,c);if(h&&!h.hidden)return void 0===h.height&&void 0!==o?Math.min(h.maxHeight,o)*h.verticalScale:h.height?h.height*h.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function Kt(t,i){const o={};for(const e in t)\"ref\"!==e&&(o[e]=t[e]);return e.b5.forEach((e=>{e in i&&(o[e]=i[e]);})),o}function ei(e){e=e.slice();const t=Object.create(null);for(let i=0;i<e.length;i++)t[e[i].id]=e[i];for(let i=0;i<e.length;i++)\"ref\"in e[i]&&(e[i]=Kt(e[i],t[e[i].ref]));return e}const ti={setStyle:\"setStyle\",addLayer:\"addLayer\",removeLayer:\"removeLayer\",setPaintProperty:\"setPaintProperty\",setLayoutProperty:\"setLayoutProperty\",setSlot:\"setSlot\",setFilter:\"setFilter\",addSource:\"addSource\",removeSource:\"removeSource\",setGeoJSONSourceData:\"setGeoJSONSourceData\",setLayerZoomRange:\"setLayerZoomRange\",setLayerProperty:\"setLayerProperty\",setCenter:\"setCenter\",setZoom:\"setZoom\",setBearing:\"setBearing\",setPitch:\"setPitch\",setSprite:\"setSprite\",setGlyphs:\"setGlyphs\",setTransition:\"setTransition\",setLight:\"setLight\",setTerrain:\"setTerrain\",setFog:\"setFog\",setCamera:\"setCamera\",setLights:\"setLights\",setProjection:\"setProjection\",addImport:\"addImport\",removeImport:\"removeImport\",updateImport:\"updateImport\"};function ii(e,t,i){i.push({command:ti.addSource,args:[e,t[e]]});}function oi(e,t,i){t.push({command:ti.removeSource,args:[e]}),i[e]=!0;}function ri(e,t,i,o){oi(e,i,o),ii(e,t,i);}function si(e,i,o){let r;for(r in e[o])if(e[o].hasOwnProperty(r)&&\"data\"!==r&&!t(e[o][r],i[o][r]))return !1;for(r in i[o])if(i[o].hasOwnProperty(r)&&\"data\"!==r&&!t(e[o][r],i[o][r]))return !1;return !0}function ni(e,i,o,r,s,n){let a;for(a in i=i||{},e=e||{})e.hasOwnProperty(a)&&(t(e[a],i[a])||o.push({command:n,args:[r,a,i[a],s]}));for(a in i)i.hasOwnProperty(a)&&!e.hasOwnProperty(a)&&(t(e[a],i[a])||o.push({command:n,args:[r,a,i[a],s]}));}function ai(e){return e.id}function li(e,t){return e[t.id]=t,e}class ci{constructor(e,t){this.reset(e,t);}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding;}lerp(t){if(1===this.points.length)return this.points[0];t=e.ad(t,0,1);let i=1,o=this._distances[i];const r=t*this.paddedLength+this.padding;for(;o<r&&i<this._distances.length;)o=this._distances[++i];const s=i-1,n=this._distances[s],a=o-n,l=a>0?(r-n)/a:0;return this.points[s].mult(1-l).add(this.points[i].mult(l))}}class hi{constructor(e,t,i){const o=this.boxCells=[],r=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let e=0;e<this.xCellCount*this.yCellCount;e++)o.push([]),r.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0;}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,i,o,r){this._forEachCell(t,i,o,r,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(o),this.bboxes.push(r);}insertCircle(e,t,i,o){this._forEachCell(t-o,i-o,t+o,i+o,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(o);}_insertBoxCell(e,t,i,o,r,s){this.boxCells[r].push(s);}_insertCircleCell(e,t,i,o,r,s){this.circleCells[r].push(s);}_query(e,t,i,o,r,s){if(i<0||e>this.width||o<0||t>this.height)return !r&&[];const n=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=o){if(r)return !0;for(let e=0;e<this.boxKeys.length;e++)n.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){const t=this.circles[3*e],i=this.circles[3*e+1],o=this.circles[3*e+2];n.push({key:this.circleKeys[e],x1:t-o,y1:i-o,x2:t+o,y2:i+o});}return s?n.filter(s):n}return this._forEachCell(e,t,i,o,this._queryCell,n,{hitTest:r,seenUids:{box:{},circle:{}}},s),r?n.length>0:n}_queryCircle(e,t,i,o,r){const s=e-i,n=e+i,a=t-i,l=t+i;if(n<0||s>this.width||l<0||a>this.height)return !o&&[];const c=[];return this._forEachCell(s,a,n,l,this._queryCellCircle,c,{hitTest:o,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}},r),o?c.length>0:c}query(e,t,i,o,r){return this._query(e,t,i,o,!1,r)}hitTest(e,t,i,o,r){return this._query(e,t,i,o,!0,r)}hitTestCircle(e,t,i,o){return this._queryCircle(e,t,i,!0,o)}_queryCell(e,t,i,o,r,s,n,a){const l=n.seenUids,c=this.boxCells[r];if(null!==c){const r=this.bboxes;for(const h of c)if(!l.box[h]){l.box[h]=!0;const c=4*h;if(e<=r[c+2]&&t<=r[c+3]&&i>=r[c+0]&&o>=r[c+1]&&(!a||a(this.boxKeys[h]))){if(n.hitTest)return s.push(!0),!0;s.push({key:this.boxKeys[h],x1:r[c],y1:r[c+1],x2:r[c+2],y2:r[c+3]});}}}const h=this.circleCells[r];if(null!==h){const r=this.circles;for(const c of h)if(!l.circle[c]){l.circle[c]=!0;const h=3*c;if(this._circleAndRectCollide(r[h],r[h+1],r[h+2],e,t,i,o)&&(!a||a(this.circleKeys[c]))){if(n.hitTest)return s.push(!0),!0;{const e=r[h],t=r[h+1],i=r[h+2];s.push({key:this.circleKeys[c],x1:e-i,y1:t-i,x2:e+i,y2:t+i});}}}}}_queryCellCircle(e,t,i,o,r,s,n,a){const l=n.circle,c=n.seenUids,h=this.boxCells[r];if(null!==h){const e=this.bboxes;for(const t of h)if(!c.box[t]){c.box[t]=!0;const i=4*t;if(this._circleAndRectCollide(l.x,l.y,l.radius,e[i+0],e[i+1],e[i+2],e[i+3])&&(!a||a(this.boxKeys[t])))return s.push(!0),!0}}const u=this.circleCells[r];if(null!==u){const e=this.circles;for(const t of u)if(!c.circle[t]){c.circle[t]=!0;const i=3*t;if(this._circlesCollide(e[i],e[i+1],e[i+2],l.x,l.y,l.radius)&&(!a||a(this.circleKeys[t])))return s.push(!0),!0}}}_forEachCell(e,t,i,o,r,s,n,a){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),h=this._convertToXCellCoord(i),u=this._convertToYCellCoord(o);for(let d=l;d<=h;d++)for(let l=c;l<=u;l++)if(r.call(this,e,t,i,o,this.xCellCount*l+d,s,n,a))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,o,r,s){const n=o-e,a=r-t,l=i+s;return l*l>n*n+a*a}_circleAndRectCollide(e,t,i,o,r,s,n){const a=(s-o)/2,l=Math.abs(e-(o+a));if(l>a+i)return !1;const c=(n-r)/2,h=Math.abs(t-(r+c));if(h>c+i)return !1;if(l<=a||h<=c)return !0;const u=l-a,d=h-c;return u*u+d*d<=i*i}}const ui={unknown:0,flipRequired:1,flipNotRequired:2},di=Math.tan(85*Math.PI/180);function _i(t,i,o,r,s,n,a){const l=e.a9.create();if(o)if(\"globe\"===n.name){const t=e.b6(s,i);e.a9.multiply(l,l,t);}else {const t=e.b7.invert([],a);l[0]=t[0],l[1]=t[1],l[4]=t[2],l[5]=t[3],r||e.a9.rotateZ(l,l,s.angle);}else e.a9.multiply(l,s.labelPlaneMatrix,t);return l}function pi(e,t,i,o,r,s,n){const a=_i(e,t,i,o,r,s,n);return \"globe\"===s.name&&i||(a[2]=a[6]=a[10]=a[14]=0),a}function fi(t,i,o,r,s,n,a){if(o){if(\"globe\"===n.name){const l=_i(t,i,o,r,s,n,a);return e.a9.invert(l,l),e.a9.multiply(l,t,l),l}{const i=e.a9.clone(t),o=e.a9.identity([]);return o[0]=a[0],o[1]=a[1],o[4]=a[2],o[5]=a[3],e.a9.multiply(i,i,o),r||e.a9.rotateZ(i,i,-s.angle),i}}return s.glCoordMatrix}function mi(t,i,o,r){const s=[t,i,o,1];o?e.aa.transformMat4(s,s,r):Ii(s,s,r);const n=s[3];return s[0]/=n,s[1]/=n,s[2]/=n,s}function gi(e,t){return Math.min(.5+e/t*.5,1.5)}function vi(e,t){const i=e[0]/e[3],o=e[1]/e[3];return i>=-t[0]&&i<=t[0]&&o>=-t[1]&&o<=t[1]}function xi(t,i,o,r,s,n,a,l,c,h){const u=o.transform,d=r?t.textSizeData:t.iconSizeData,_=e.b8(d,o.transform.zoom),p=\"globe\"===u.projection.name,f=[256/o.width*2+1,256/o.height*2+1],m=r?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;m.clear();let g=null;p&&(g=r?t.text.globeExtVertexArray:t.icon.globeExtVertexArray);const v=t.lineVertexArray,x=r?t.text.placedSymbolArray:t.icon.placedSymbolArray,y=o.transform.width/o.transform.height;let b,w=!1;for(let r=0;r<x.length;r++){const p=x.get(r),{numGlyphs:T,writingMode:E}=p;if(E!==e.b9.vertical||w||b===e.b9.horizontal||(w=!0),b=E,(p.hidden||E===e.b9.vertical)&&!w){Ci(T,m);continue}w=!1;const S=new e.P(p.tileAnchorX,p.tileAnchorY);let{x:C,y:I,z:D}=u.projection.projectTilePoint(S.x,S.y,h.canonical);if(c){const[e,t,i]=c(S);C+=e,I+=t,D+=i;}const R=[C,I,D,1];if(e.aa.transformMat4(R,R,i),!vi(R,f)){Ci(T,m);continue}const A=R[3],P=gi(o.transform.getCameraToCenterDistance(u.projection),A),L=e.ba(d,_,p),M=a?L/P:L*P,z=mi(C,I,D,s);if(z[3]<=0){Ci(T,m);continue}let O={};const F=a?null:c,B=wi(p,M,!1,l,i,s,n,t.glyphOffsetArray,v,m,g,z,S,O,y,F,u.projection,h,a);w=B.useVertical,F&&B.needsFlipping&&(O={}),(B.notEnoughRoom||w||B.needsFlipping&&wi(p,M,!0,l,i,s,n,t.glyphOffsetArray,v,m,g,z,S,O,y,F,u.projection,h,a).notEnoughRoom)&&Ci(T,m);}r?(t.text.dynamicLayoutVertexBuffer.updateData(m),g&&t.text.globeExtVertexBuffer&&t.text.globeExtVertexBuffer.updateData(g)):(t.icon.dynamicLayoutVertexBuffer.updateData(m),g&&t.icon.globeExtVertexBuffer&&t.icon.globeExtVertexBuffer.updateData(g));}function yi(e,t,i,o,r,s,n,a,l,c,h,u,d,_,p,f){const{lineStartIndex:m,glyphStartIndex:g,segment:v}=a,x=g+a.numGlyphs,y=m+a.lineLength,b=t.getoffsetX(g),w=t.getoffsetX(x-1),T=Si(e*b,i,o,r,s,n,v,m,y,l,c,h,u,d,!0,_,p,f);if(!T)return null;const E=Si(e*w,i,o,r,s,n,v,m,y,l,c,h,u,d,!0,_,p,f);return E?{first:T,last:E}:null}function bi(t,i,o,r){return t===e.b9.horizontal&&Math.abs(r)>Math.abs(o)?{useVertical:!0}:t===e.b9.vertical?r>0?{needsFlipping:!0}:null:i!==ui.unknown&&function(e,t){return 0===e||Math.abs(t/e)>di}(o,r)?i===ui.flipRequired?{needsFlipping:!0}:null:o<0?{needsFlipping:!0}:null}function wi(t,i,o,r,s,n,a,l,c,h,u,d,_,p,f,m,g,v,x){const y=i/24,b=t.lineOffsetX*y,w=t.lineOffsetY*y,{lineStartIndex:T,glyphStartIndex:E,numGlyphs:S,segment:C,writingMode:I,flipState:D}=t,R=T+t.lineLength,A=t=>{if(u){const[i,o,r]=t.up,s=h.length;e.bb(u,s+0,i,o,r),e.bb(u,s+1,i,o,r),e.bb(u,s+2,i,o,r),e.bb(u,s+3,i,o,r);}const[i,o,r]=t.point;e.bc(h,i,o,r,t.angle);};if(S>1){const e=yi(y,l,b,w,o,d,_,t,c,n,p,m,!1,g,v,x);if(!e)return {notEnoughRoom:!0};if(r&&!o){let[i,o,r]=e.first.point,[s,n,l]=e.last.point;[i,o]=mi(i,o,r,a),[s,n]=mi(s,n,l,a);const c=bi(I,D,(s-i)*f,n-o);if(t.flipState=c&&c.needsFlipping?ui.flipRequired:ui.flipNotRequired,c)return c}A(e.first);for(let e=E+1;e<E+S-1;e++){const t=Si(y*l.getoffsetX(e),b,w,o,d,_,C,T,R,c,n,p,m,!1,!1,g,v,x);if(!t)return h.length-=4*(e-E),{notEnoughRoom:!0};A(t);}A(e.last);}else {if(r&&!o){const i=mi(_.x,_.y,0,s),o=T+C+1,r=new e.P(c.getx(o),c.gety(o)),n=mi(r.x,r.y,0,s),a=n[3]>0?n:Ei(_,r,i,1,s,void 0,g,v.canonical),l=bi(I,D,(a[0]-i[0])*f,a[1]-i[1]);if(t.flipState=l&&l.needsFlipping?ui.flipRequired:ui.flipNotRequired,l)return l}const i=Si(y*l.getoffsetX(E),b,w,o,d,_,C,T,R,c,n,p,m,!1,!1,g,v,x);if(!i)return {notEnoughRoom:!0};A(i);}return {}}function Ti(e,t,i,o,r){const{x:s,y:n,z:a}=o.projectTilePoint(e.x,e.y,t);if(!r)return mi(s,n,a,i);const[l,c,h]=r(e);return mi(s+l,n+c,a+h,i)}function Ei(t,i,o,r,s,n,a,l){const c=Ti(t.sub(i)._unit()._add(t),l,s,a,n);return e.Q.sub(c,o,c),e.Q.normalize(c,c),e.Q.scaleAndAdd(c,o,c,r)}function Si(t,i,o,r,s,n,a,l,c,h,u,d,_,p,f,m,g,v){const x=r?t-i:t+i;let y=x>0?1:-1,b=0;r&&(y*=-1,b=Math.PI),y<0&&(b+=Math.PI);let w=l+a+(y>0?0:1)|0,T=s,E=s,S=0,C=0;const I=Math.abs(x),D=[],R=[];let A=n,P=A;const L=()=>Ei(P,A,E,I-S+1,u,_,m,g.canonical);for(;S+C<=I;){if(w+=y,w<l||w>=c)return null;if(E=T,P=A,D.push(E),p&&R.push(P),A=new e.P(h.getx(w),h.gety(w)),T=d[w],!T){const e=Ti(A,g.canonical,u,m,_);T=e[3]>0?d[w]=e:L();}S+=C,C=e.Q.distance(E,T);}f&&_&&(d[w]&&(T=L(),C=e.Q.distance(E,T)),d[w]=T);const M=(I-S)/C,z=A.sub(P)._mult(M)._add(P),O=e.Q.sub([],T,E),F=e.Q.scaleAndAdd([],E,O,M);let B=[0,0,1],k=O[0],N=O[1];if(v&&(B=m.upVector(g.canonical,z.x,z.y),0!==B[0]||0!==B[1]||1!==B[2])){const t=[B[2],0,-B[0]],i=e.Q.cross([],B,t);e.Q.normalize(t,t),e.Q.normalize(i,i),k=e.Q.dot(O,t),N=e.Q.dot(O,i);}if(o){const t=e.Q.cross([],B,O);e.Q.normalize(t,t),e.Q.scaleAndAdd(F,F,t,o*y);}const U=b+Math.atan2(N,k);return D.push(F),p&&R.push(z),{point:F,angle:U,path:D,tilePath:R,up:B}}function Ci(e,t){const i=t.length,o=i+4*e;t.resize(o),t.float32.fill(-1/0,4*i,4*o);}function Ii(e,t,i){const o=t[0],r=t[1];return e[0]=i[0]*o+i[4]*r+i[12],e[1]=i[1]*o+i[5]*r+i[13],e[3]=i[3]*o+i[7]*r+i[15],e}const Di=100;class Ri{constructor(e,t,i=new hi(e.width+200,e.height+200,25),o=new hi(e.width+200,e.height+200,25)){this.transform=e,this.grid=i,this.ignoredGrid=o,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+Di,this.screenBottomBoundary=e.height+Di,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.fogState=t;}placeCollisionBox(e,t,i,o,r,s,n,a){let l=i.projectedAnchorX,c=i.projectedAnchorY,h=i.projectedAnchorZ;const u=i.elevation,d=i.tileID,_=e.getProjection();if(u&&d){const[e,t,o]=_.upVector(d.canonical,i.tileAnchorX,i.tileAnchorY),r=_.upVectorScale(d.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;l+=e*u*r,c+=t*u*r,h+=o*u*r;}const p=this.projectAndGetPerspectiveRatio(n,l,c,h,i.tileID,\"globe\"===_.name||!!u||this.transform.pitch>0,_),f=s*p.perspectiveRatio,m=(i.x1*t+o.x-i.padding)*f+p.point.x,g=(i.y1*t+o.y-i.padding)*f+p.point.y,v=(i.x2*t+o.x+i.padding)*f+p.point.x,x=(i.y2*t+o.y+i.padding)*f+p.point.y,y=p.perspectiveRatio<=.55||p.occluded;return !this.isInsideGrid(m,g,v,x)||!r&&this.grid.hitTest(m,g,v,x,a)||y?{box:[],offscreen:!1,occluded:p.occluded}:{box:[m,g,v,x],offscreen:this.isOffscreen(m,g,v,x),occluded:!1}}placeCollisionCircles(t,i,o,r,s,n,a,l,c,h,u,d,_,p,f){const m=[],g=this.transform.elevation,v=t.getProjection(),x=g?g.getAtTileOffsetFunc(f,this.transform.center.lat,this.transform.worldSize,v):null,y=new e.P(o.tileAnchorX,o.tileAnchorY);let{x:b,y:w,z:T}=v.projectTilePoint(y.x,y.y,f.canonical);if(x){const[e,t,i]=x(y);b+=e,w+=t,T+=i;}const E=\"globe\"===v.name,S=this.projectAndGetPerspectiveRatio(a,b,w,T,f,E||!!g||this.transform.pitch>0,v),{perspectiveRatio:C}=S,I=(u?n/C:n*C)/e.bf,D=mi(b,w,T,l),R=S.signedDistanceFromCamera>0?yi(I,s,o.lineOffsetX*I,o.lineOffsetY*I,!1,D,y,o,r,l,{},g&&!u?x:null,u&&!!g,v,f,u):null;let A=!1,P=!1,L=!0;if(R&&!S.occluded){const t=.5*_*C+p,o=new e.P(-100,-100),r=new e.P(this.screenRightBoundary,this.screenBottomBoundary),s=new ci,{first:n,last:a}=R,l=n.path.length;let u=[];for(let e=l-1;e>=1;e--)u.push(n.path[e]);for(let e=1;e<a.path.length;e++)u.push(a.path[e]);const f=2.5*t;c&&(u=u.map((([e,t,i],o)=>(x&&!E&&(i=x(o<l-1?n.tilePath[l-1-o]:a.tilePath[o-l+2])[2]),mi(e,t,i,c)))),u.some((e=>e[3]<=0))&&(u=[]));let g=[];if(u.length>0){let t=1/0,i=-1/0,s=1/0,n=-1/0;for(const e of u)t=Math.min(t,e[0]),s=Math.min(s,e[1]),i=Math.max(i,e[0]),n=Math.max(n,e[1]);i>=o.x&&t<=r.x&&n>=o.y&&s<=r.y&&(g=[u.map((t=>new e.P(t[0],t[1])))],(t<o.x||i>r.x||s<o.y||n>r.y)&&(g=e.bd(g,o.x,o.y,r.x,r.y)));}for(const e of g){s.reset(e,.25*t);let o=0;o=s.length<=.5*t?1:Math.ceil(s.paddedLength/f)+1;for(let e=0;e<o;e++){const r=e/Math.max(o-1,1),n=s.lerp(r),a=n.x+Di,l=n.y+Di;m.push(a,l,t,0);const c=a-t,u=l-t,_=a+t,p=l+t;if(L=L&&this.isOffscreen(c,u,_,p),P=P||this.isInsideGrid(c,u,_,p),!i&&this.grid.hitTestCircle(a,l,t,d)&&(A=!0,!h))return {circles:[],offscreen:!1,collisionDetected:A,occluded:!1}}}}return {circles:!h&&A||!P?[]:m,offscreen:L,collisionDetected:A,occluded:S.occluded}}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return {};const i=[];let o=1/0,r=1/0,s=-1/0,n=-1/0;for(const a of t){const t=new e.P(a.x+Di,a.y+Di);o=Math.min(o,t.x),r=Math.min(r,t.y),s=Math.max(s,t.x),n=Math.max(n,t.y),i.push(t);}const a=this.grid.query(o,r,s,n).concat(this.ignoredGrid.query(o,r,s,n)),l={},c={};for(const t of a){const o=t.key;if(void 0===l[o.bucketInstanceId]&&(l[o.bucketInstanceId]={}),l[o.bucketInstanceId][o.featureIndex])continue;const r=[new e.P(t.x1,t.y1),new e.P(t.x2,t.y1),new e.P(t.x2,t.y2),new e.P(t.x1,t.y2)];e.be(i,r)&&(l[o.bucketInstanceId][o.featureIndex]=!0,void 0===c[o.bucketInstanceId]&&(c[o.bucketInstanceId]=[]),c[o.bucketInstanceId].push(o.featureIndex));}return c}insertCollisionBox(e,t,i,o,r){(t?this.ignoredGrid:this.grid).insert({bucketInstanceId:i,featureIndex:o,collisionGroupID:r},e[0],e[1],e[2],e[3]);}insertCollisionCircles(e,t,i,o,r){const s=t?this.ignoredGrid:this.grid,n={bucketInstanceId:i,featureIndex:o,collisionGroupID:r};for(let t=0;t<e.length;t+=4)s.insertCircle(n,e[t],e[t+1],e[t+2]);}projectAndGetPerspectiveRatio(t,i,o,r,s,n,a){const l=[i,o,r,1];let c=!1;if(r||this.transform.pitch>0){if(e.aa.transformMat4(l,l,t),this.fogState&&s&&\"globe\"!==a.name){const t=function(t,i,o,r,s,n){const a=n.calculateFogTileMatrix(s),l=[i,o,r];return e.Q.transformMat4(l,l,a),pe(t,e.Q.length(l),n.pitch,n._fov)}(this.fogState,i,o,r,s.toUnwrapped(),this.transform);c=t>.9;}}else Ii(l,l,t);const h=l[3];return {point:new e.P((l[0]/h+1)/2*this.transform.width+Di,(-l[1]/h+1)/2*this.transform.height+Di),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(a)/h*.5,1.5),signedDistanceFromCamera:h,occluded:n&&l[2]>h||c}}isOffscreen(e,t,i,o){return i<Di||e>=this.screenRightBoundary||o<Di||t>this.screenBottomBoundary}isInsideGrid(e,t,i,o){return i>=0&&e<this.gridRightBoundary&&o>=0&&t<this.gridBottomBoundary}getViewportMatrix(){const t=e.a9.identity([]);return e.a9.translate(t,t,[-100,-100,0]),t}}function Ai(t,i,o){const r=i.createTileMatrix(t,t.worldSize,o.toUnwrapped());return e.a9.multiply(new Float32Array(16),t.projMatrix,r)}function Pi(e,t,i){if(t.projection.name===i.projection.name)return e.projMatrix;const o=i.clone();return o.setProjection(t.projection),Ai(o,t.getProjection(),e)}function Li(e,t,i){return t.name===i.projection.name?e.projMatrix:Ai(i,t,e)}class Mi{constructor(e,t,i,o){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):o&&i?1:0,this.placed=i;}isHidden(){return 0===this.opacity&&!this.placed}}class zi{constructor(e,t,i,o,r,s=!1){this.text=new Mi(e?e.text:null,t,i,r),this.icon=new Mi(e?e.icon:null,t,o,r),this.clipped=s;}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Oi{constructor(e,t,i,o=!1){this.text=e,this.icon=t,this.skipFade=i,this.clipped=o;}}class Fi{constructor(){this.invProjMatrix=e.a9.create(),this.viewportMatrix=e.a9.create(),this.circles=[];}}class Bi{constructor(e,t,i,o,r){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=o,this.tileID=r;}}class ki{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={};}get(e){if(this.crossSourceCollisions)return {ID:0,predicate:null};if(!this.collisionGroups[e]){const t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t};}return this.collisionGroups[e]}}function Ni(t,i,o,r,s){const{horizontalAlign:n,verticalAlign:a}=e.bi(t),l=-(n-.5)*i,c=-(a-.5)*o,h=e.bh(t,r);return new e.P(l+h[0]*s,c+h[1]*s)}function Ui(t,i,o,r,s){const n=new e.P(t,i);return o&&n._rotate(r?s:-s),n}class Gi{constructor(e,t,i,o,r,s){this.transform=e.clone(),this.projection=e.projection.name,this.collisionIndex=new Ri(this.transform,r),this.buildingIndex=s,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=t,this.retainedQueryData={},this.collisionGroups=new ki(i),this.collisionCircleArrays={},this.prevPlacement=o,o&&(o.prevPlacement=void 0),this.placedOrientations={};}getBucketParts(t,i,o,r){const s=o.getBucket(i),n=o.latestFeatureIndex;if(!s||!n||i.fqid!==s.layerIds[0])return;const a=s.layers[0].layout,l=o.collisionBoxArray,c=Math.pow(2,this.transform.zoom-o.tileID.overscaledZ),h=o.tileSize/e.Y,u=o.tileID.toUnwrapped();this.transform.setProjection(s.projection);const d=(_=o.tileID,p=s.getProjection(),f=this.transform,p.name===this.projection?f.calculateProjMatrix(_.toUnwrapped()):Ai(f,p,_));var _,p,f;const m=\"map\"===a.get(\"text-pitch-alignment\"),g=\"map\"===a.get(\"text-rotation-alignment\");i.compileFilter();const v=i.dynamicFilter(),x=i.dynamicFilterNeedsFeature(),y=this.transform.calculatePixelsToTileUnitsMatrix(o),b=pi(d,o.tileID.canonical,m,g,this.transform,s.getProjection(),y);let w=null;if(m){const t=fi(d,o.tileID.canonical,m,g,this.transform,s.getProjection(),y);w=e.a9.multiply([],this.transform.labelPlaneMatrix,t);}let T=null;v&&o.latestFeatureIndex&&(T={unwrappedTileID:u,dynamicFilter:v,dynamicFilterNeedsFeature:x,featureIndex:o.latestFeatureIndex}),this.retainedQueryData[s.bucketInstanceId]=new Bi(s.bucketInstanceId,n,s.sourceLayerIndex,s.index,o.tileID);const E={bucket:s,layout:a,posMatrix:d,textLabelPlaneMatrix:b,labelToScreenMatrix:w,clippingData:T,scale:c,textPixelRatio:h,holdingForFade:o.holdingForFade(),collisionBoxArray:l,partiallyEvaluatedTextSize:e.b8(s.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:e.b8(s.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(s.sourceID)};if(r)for(const e of s.sortKeyRanges){const{sortKey:i,symbolInstanceStart:o,symbolInstanceEnd:r}=e;t.push({sortKey:i,symbolInstanceStart:o,symbolInstanceEnd:r,parameters:E});}else t.push({symbolInstanceStart:0,symbolInstanceEnd:s.symbolInstances.length,parameters:E});}attemptAnchorPlacement(e,t,i,o,r,s,n,a,l,c,h,u,d,_,p,f,m,g){const{textOffset0:v,textOffset1:x,crossTileID:y}=u,b=[v,x],w=Ni(e,i,o,b,r),T=this.collisionIndex.placeCollisionBox(_,r,t,Ui(w.x,w.y,s,n,this.transform.angle),h,a,l,c.predicate);if(f){const e=_.getSymbolInstanceIconSize(g,this.transform.zoom,u.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(_,e,f,Ui(w.x,w.y,s,n,this.transform.angle),h,a,l,c.predicate).box.length)return}if(T.box.length>0){let t;return this.prevPlacement&&this.prevPlacement.variableOffsets[y]&&this.prevPlacement.placements[y]&&this.prevPlacement.placements[y].text&&(t=this.prevPlacement.variableOffsets[y].anchor),this.variableOffsets[y]={textOffset:b,width:i,height:o,anchor:e,textScale:r,prevAnchor:t},this.markUsedJustification(_,e,u,p),_.allowVerticalPlacement&&(this.markUsedOrientation(_,p,u),this.placedOrientations[y]=p),{shift:w,placedGlyphBoxes:T}}}placeLayerBucketPart(t,i,o,r){const{bucket:s,layout:n,posMatrix:a,textLabelPlaneMatrix:l,labelToScreenMatrix:c,clippingData:h,textPixelRatio:u,holdingForFade:d,collisionBoxArray:_,partiallyEvaluatedTextSize:p,partiallyEvaluatedIconSize:f,collisionGroup:m}=t.parameters,g=n.get(\"text-optional\"),v=n.get(\"icon-optional\"),x=n.get(\"text-allow-overlap\"),y=n.get(\"icon-allow-overlap\"),b=\"map\"===n.get(\"text-rotation-alignment\"),w=\"map\"===n.get(\"text-pitch-alignment\"),T=\"viewport-y\"===n.get(\"symbol-z-order\"),E=n.get(\"symbol-z-elevate\");this.transform.setProjection(s.projection);let S=x&&(y||!s.hasIconData()||v),C=y&&(x||!s.hasTextData()||g);!s.collisionArrays&&_&&s.deserializeCollisionBoxes(_),o&&r&&s.updateCollisionDebugBuffers(this.transform.zoom,_);const I=(t,r,_)=>{const{crossTileID:T,numVerticalGlyphVertices:E}=t;if(h){const o={zoom:this.transform.zoom,pitch:this.transform.pitch};let r=null;if(h.dynamicFilterNeedsFeature){const e=this.retainedQueryData[s.bucketInstanceId];r=h.featureIndex.loadFeature({featureIndex:t.featureIndex,bucketIndex:e.bucketIndex,sourceLayerIndex:e.sourceLayerIndex,layoutVertexArrayOffset:0});}if(!(0,h.dynamicFilter)(o,r,this.retainedQueryData[s.bucketInstanceId].tileID.canonical,new e.P(t.tileAnchorX,t.tileAnchorY),this.transform.calculateDistanceTileData(h.unwrappedTileID)))return this.placements[T]=new Oi(!1,!1,!1,!0),void i.add(T)}if(i.has(T))return;if(d)return void(this.placements[T]=new Oi(!1,!1,!1));let I=!1,D=!1,R=!0,A=!1,P=!1,L=null,M={box:null,offscreen:null,occluded:null},z={box:null,offscreen:null,occluded:null},O=null,F=null,B=null,k=0,N=0,U=0;_.textFeatureIndex?k=_.textFeatureIndex:t.useRuntimeCollisionCircles&&(k=t.featureIndex),_.verticalTextFeatureIndex&&(N=_.verticalTextFeatureIndex);const G=e=>{e.tileID=this.retainedQueryData[s.bucketInstanceId].tileID;const i=this.transform.elevation;e.elevation=t.zOffset+(i?i.getAtTileOffset(e.tileID,e.tileAnchorX,e.tileAnchorY):0);},j=_.textBox;if(j){G(j);const i=i=>{let o=e.b9.horizontal;if(s.allowVerticalPlacement&&!i&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[T];e&&(this.placedOrientations[T]=e,o=e,this.markUsedOrientation(s,o,t));}return o},o=(t,i)=>{if(s.allowVerticalPlacement&&E>0&&_.verticalTextBox){for(const o of s.writingModes)if(o===e.b9.vertical?(M=i(),z=M):M=t(),M&&M.box&&M.box.length)break}else M=t();};if(n.get(\"text-variable-anchor\")){let l=n.get(\"text-variable-anchor\");if(this.prevPlacement&&this.prevPlacement.variableOffsets[T]){const e=this.prevPlacement.variableOffsets[T];l.indexOf(e.anchor)>0&&(l=l.filter((t=>t!==e.anchor)),l.unshift(e.anchor));}const c=(e,i,o)=>{const n=s.getSymbolInstanceTextSize(p,t,this.transform.zoom,r),c=(e.x2-e.x1)*n+2*e.padding,h=(e.y2-e.y1)*n+2*e.padding,d=t.hasIconTextFit&&!y?i:null;d&&G(d);let _={box:[],offscreen:!1,occluded:!1};const g=x?2*l.length:l.length;for(let i=0;i<g;++i){const g=this.attemptAnchorPlacement(l[i%l.length],e,c,h,n,b,w,u,a,m,i>=l.length,t,r,s,o,d,p,f);if(g&&(_=g.placedGlyphBoxes,_&&_.box&&_.box.length)){I=!0,L=g.shift;break}}return _};o((()=>c(j,_.iconBox,e.b9.horizontal)),(()=>{const t=_.verticalTextBox;return t&&G(t),s.allowVerticalPlacement&&!(M&&M.box&&M.box.length)&&E>0&&t?c(t,_.verticalIconBox,e.b9.vertical):{box:null,offscreen:null,occluded:null}})),M&&(I=M.box,R=M.offscreen,A=M.occluded);const h=i(!(!M||!M.box));if(!I&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[T];e&&(this.variableOffsets[T]=e,this.markUsedJustification(s,e.anchor,t,h));}}else {const n=(i,o)=>{const n=s.getSymbolInstanceTextSize(p,t,this.transform.zoom,r),l=this.collisionIndex.placeCollisionBox(s,n,i,new e.P(0,0),x,u,a,m.predicate);return l&&l.box&&l.box.length&&(this.markUsedOrientation(s,o,t),this.placedOrientations[T]=o),l};o((()=>n(j,e.b9.horizontal)),(()=>{const t=_.verticalTextBox;return s.allowVerticalPlacement&&E>0&&t?(G(t),n(t,e.b9.vertical)):{box:null,offscreen:null,occluded:null}})),i(!!(M&&M.box&&M.box.length));}}if(O=M,I=O&&O.box&&O.box.length>0,R=O&&O.offscreen,A=O&&O.occluded,t.useRuntimeCollisionCircles){const i=s.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex),r=e.ba(s.textSizeData,p,i),h=n.get(\"text-padding\");F=this.collisionIndex.placeCollisionCircles(s,x,i,s.lineVertexArray,s.glyphOffsetArray,r,a,l,c,o,w,m.predicate,t.collisionCircleDiameter*r/e.bf,h,this.retainedQueryData[s.bucketInstanceId].tileID),I=x||F.circles.length>0&&!F.collisionDetected,R=R&&F.offscreen,A=F.occluded;}if(_.iconFeatureIndex&&(U=_.iconFeatureIndex),_.iconBox){const i=i=>{G(i);const o=t.hasIconTextFit&&L?Ui(L.x,L.y,b,w,this.transform.angle):new e.P(0,0),r=s.getSymbolInstanceIconSize(f,this.transform.zoom,t.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(s,r,i,o,y,u,a,m.predicate)};z&&z.box&&z.box.length&&_.verticalIconBox?(B=i(_.verticalIconBox),D=B.box.length>0):(B=i(_.iconBox),D=B.box.length>0),R=R&&B.offscreen,P=B.occluded;}const V=g||0===t.numHorizontalGlyphVertices&&0===E,Z=v||0===t.numIconVertices;if(V||Z?Z?V||(D=D&&I):I=D&&I:D=I=D&&I,I&&O&&O.box&&this.collisionIndex.insertCollisionBox(O.box,n.get(\"text-ignore-placement\"),s.bucketInstanceId,z&&z.box&&N?N:k,m.ID),D&&B&&this.collisionIndex.insertCollisionBox(B.box,n.get(\"icon-ignore-placement\"),s.bucketInstanceId,U,m.ID),F&&(I&&this.collisionIndex.insertCollisionCircles(F.circles,n.get(\"text-ignore-placement\"),s.bucketInstanceId,k,m.ID),o)){const e=s.bucketInstanceId;let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=new Fi);for(let e=0;e<F.circles.length;e+=4)t.circles.push(F.circles[e+0]),t.circles.push(F.circles[e+1]),t.circles.push(F.circles[e+2]),t.circles.push(F.collisionDetected?1:0);}const W=\"globe\"!==s.projection.name;S=S&&(W||!A),C=C&&(W||!P),this.placements[T]=new Oi(I||S,D||C,R||s.justReloaded),i.add(T);};if(E&&this.buildingIndex&&(this.buildingIndex.updateZOffset(s,this.retainedQueryData[s.bucketInstanceId].tileID),s.updateZOffset()),T){const t=s.getSortedSymbolIndexes(this.transform.angle);for(let e=t.length-1;e>=0;--e){const i=t[e];I(s.symbolInstances.get(i),i,s.collisionArrays[i]);}s.hasAnyZOffset&&e.w(`${s.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`);}else if(s.hasAnyZOffset){const e=s.getSortedIndexesByZOffset();for(let t=0;t<e.length;++t){const i=e[t];I(s.symbolInstances.get(i),i,s.collisionArrays[i]);}}else for(let e=t.symbolInstanceStart;e<t.symbolInstanceEnd;e++)I(s.symbolInstances.get(e),e,s.collisionArrays[e]);if(o&&s.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[s.bucketInstanceId];e.a9.invert(t.invProjMatrix,a),t.viewportMatrix=this.collisionIndex.getViewportMatrix();}s.justReloaded=!1;}markUsedJustification(t,i,o,r){const{leftJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:n,rightJustifiedTextSymbolIndex:a,verticalPlacedTextSymbolIndex:l,crossTileID:c}=o,h=e.bg(i),u=r===e.b9.vertical?l:\"left\"===h?s:\"center\"===h?n:\"right\"===h?a:-1;s>=0&&(t.text.placedSymbolArray.get(s).crossTileID=u>=0&&s!==u?0:c),n>=0&&(t.text.placedSymbolArray.get(n).crossTileID=u>=0&&n!==u?0:c),a>=0&&(t.text.placedSymbolArray.get(a).crossTileID=u>=0&&a!==u?0:c),l>=0&&(t.text.placedSymbolArray.get(l).crossTileID=u>=0&&l!==u?0:c);}markUsedOrientation(t,i,o){const r=i===e.b9.horizontal||i===e.b9.horizontalOnly?i:0,s=i===e.b9.vertical?i:0,{leftJustifiedTextSymbolIndex:n,centerJustifiedTextSymbolIndex:a,rightJustifiedTextSymbolIndex:l,verticalPlacedTextSymbolIndex:c}=o,h=t.text.placedSymbolArray;n>=0&&(h.get(n).placedOrientation=r),a>=0&&(h.get(a).placedOrientation=r),l>=0&&(h.get(l).placedOrientation=r),c>=0&&(h.get(c).placedOrientation=s);}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const o=t?t.symbolFadeChange(e):1,r=t?t.opacities:{},s=t?t.variableOffsets:{},n=t?t.placedOrientations:{};for(const e in this.placements){const t=this.placements[e],s=r[e];s?(this.opacities[e]=new zi(s,o,t.text,t.icon,null,t.clipped),i=i||t.text!==s.text.placed||t.icon!==s.icon.placed):(this.opacities[e]=new zi(null,o,t.text,t.icon,t.skipFade,t.clipped),i=i||t.text||t.icon);}for(const e in r){const t=r[e];if(!this.opacities[e]){const r=new zi(t,o,!1,!1);r.isHidden()||(this.opacities[e]=r,i=i||t.text.placed||t.icon.placed);}}for(const e in s)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=s[e]);for(const e in n)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=n[e]);i?this.lastPlacementChangeTime=e:\"number\"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e);}updateLayerOpacities(e,t){const i=new Set;for(const o of t){const t=o.getBucket(e);t&&o.latestFeatureIndex&&e.fqid===t.layerIds[0]&&(this.updateBucketOpacities(t,i,o.collisionBoxArray),t.layers[0].layout.get(\"symbol-z-elevate\")&&this.buildingIndex&&(this.buildingIndex.updateZOffset(t,o.tileID),t.updateZOffset()));}}updateBucketOpacities(t,i,o){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const r=t.layers[0].layout,s=!!t.layers[0].dynamicFilter(),n=new zi(null,0,!1,!1,!0),a=r.get(\"text-allow-overlap\"),l=r.get(\"icon-allow-overlap\"),c=r.get(\"text-variable-anchor\"),h=\"map\"===r.get(\"text-rotation-alignment\"),u=\"map\"===r.get(\"text-pitch-alignment\"),d=new zi(null,0,a&&(l||!t.hasIconData()||r.get(\"icon-optional\")),l&&(a||!t.hasTextData()||r.get(\"text-optional\")),!0);!t.collisionArrays&&o&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(o);const _=(e,t,i)=>{for(let o=0;o<t/4;o++)e.opacityVertexArray.emplaceBack(i);};let p=0;for(let o=0;o<t.symbolInstances.length;o++){const r=t.symbolInstances.get(o),{numHorizontalGlyphVertices:a,numVerticalGlyphVertices:l,crossTileID:f,numIconVertices:m}=r,g=i.has(f);let v=this.opacities[f];g?v=n:v||(v=d,this.opacities[f]=v),i.add(f);const x=a>0||l>0,y=m>0,b=this.placedOrientations[f],w=b===e.b9.vertical,T=b===e.b9.horizontal||b===e.b9.horizontalOnly;if(!x&&!y||v.isHidden()||p++,x){const e=Xi(v.text);_(t.text,a,w?Yi:e),_(t.text,l,T?Yi:e);const i=v.text.isHidden(),{leftJustifiedTextSymbolIndex:o,centerJustifiedTextSymbolIndex:s,rightJustifiedTextSymbolIndex:n,verticalPlacedTextSymbolIndex:c}=r,h=t.text.placedSymbolArray,u=i||w?1:0;o>=0&&(h.get(o).hidden=u),s>=0&&(h.get(s).hidden=u),n>=0&&(h.get(n).hidden=u),c>=0&&(h.get(c).hidden=i||T?1:0);const d=this.variableOffsets[f];d&&this.markUsedJustification(t,d.anchor,r,b);const p=this.placedOrientations[f];p&&(this.markUsedJustification(t,\"left\",r,p),this.markUsedOrientation(t,p,r));}if(y){const e=Xi(v.icon),{placedIconSymbolIndex:i,verticalPlacedIconSymbolIndex:o}=r,s=t.icon.placedSymbolArray,n=v.icon.isHidden()?1:0;i>=0&&(_(t.icon,m,w?Yi:e),s.get(i).hidden=n),o>=0&&(_(t.icon,r.numVerticalIconVertices,T?Yi:e),s.get(o).hidden=n);}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const i=t.collisionArrays[o];if(i){let o=new e.P(0,0),n=!0;if(i.textBox||i.verticalTextBox){if(c){const e=this.variableOffsets[f];e?(o=Ni(e.anchor,e.width,e.height,e.textOffset,e.textScale),h&&o._rotate(u?this.transform.angle:-this.transform.angle)):n=!1;}s&&(n=!v.clipped),i.textBox&&ji(t.textCollisionBox.collisionVertexArray,v.text.placed,!n||w,o.x,o.y),i.verticalTextBox&&ji(t.textCollisionBox.collisionVertexArray,v.text.placed,!n||T,o.x,o.y);}const a=n&&Boolean(!T&&i.verticalIconBox);i.iconBox&&ji(t.iconCollisionBox.collisionVertexArray,v.icon.placed,a,r.hasIconTextFit?o.x:0,r.hasIconTextFit?o.y:0),i.verticalIconBox&&ji(t.iconCollisionBox.collisionVertexArray,v.icon.placed,!a,r.hasIconTextFit?o.x:0,r.hasIconTextFit?o.y:0);}}}if(t.fullyClipped=0===p,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=e.invProjMatrix,t.placementViewportMatrix=e.viewportMatrix,t.collisionCircleArray=e.circles,delete this.collisionCircleArrays[t.bucketInstanceId];}}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){const i=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*i>e}setStale(){this.stale=!0;}}function ji(e,t,i,o,r){e.emplaceBack(t?1:0,i?1:0,o||0,r||0),e.emplaceBack(t?1:0,i?1:0,o||0,r||0),e.emplaceBack(t?1:0,i?1:0,o||0,r||0),e.emplaceBack(t?1:0,i?1:0,o||0,r||0);}const Vi=Math.pow(2,25),Zi=Math.pow(2,24),Wi=Math.pow(2,17),Hi=Math.pow(2,16),qi=Math.pow(2,9),Qi=Math.pow(2,8),$i=Math.pow(2,1);function Xi(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const t=e.placed?1:0,i=Math.floor(127*e.opacity);return i*Vi+t*Zi+i*Wi+t*Hi+i*qi+t*Qi+i*$i+t}const Yi=0;class Ji{constructor(e){this._sortAcrossTiles=\"viewport-y\"!==e.layout.get(\"symbol-z-order\")&&void 0!==e.layout.get(\"symbol-sort-key\").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[];}continuePlacement(e,t,i,o,r){const s=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(s,o,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,r())return !0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,s.sort(((e,t)=>e.sortKey-t.sortKey)));this._currentPartIndex<s.length;){const e=s[this._currentPartIndex];if(t.placeLayerBucketPart(e,this._seenCrossTileIDs,i,0===e.symbolInstanceStart),this._currentPartIndex++,r())return !0}return !1}}class Ki{constructor(e,t,i,o,r,s,n,a,l){this.placement=new Gi(e,r,s,n,a,l),this._currentPlacementIndex=t.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=o,this._done=!1;}isDone(){return this._done}continuePlacement(t,i,o,r){const s=e.f.now(),n=()=>{const t=e.f.now()-s;return !this._forceFullPlacement&&t>2};for(;this._currentPlacementIndex>=0;){const s=i[t[this._currentPlacementIndex]],a=this.placement.collisionIndex.transform.zoom;if(\"symbol\"===s.type&&(!s.minzoom||s.minzoom<=a)&&(!s.maxzoom||s.maxzoom>a)){const t=s,i=t.layout.get(\"symbol-z-elevate\"),a=this._inProgressLayer=this._inProgressLayer||new Ji(t),l=e.aj(s.source,s.scope);if(a.continuePlacement(i?r[l]:o[l],this.placement,this._showCollisionBoxes,s,n))return;delete this._inProgressLayer;}this._currentPlacementIndex--;}this._done=!0;}commit(e){return this.placement.commit(e),this.placement}}const eo=512/e.Y/2;class to{constructor(t,i,o){this.tileID=t,this.bucketInstanceId=o,this.index=new e.bj(i.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const r=t.canonical.x*e.Y,s=t.canonical.y*e.Y;for(let e=0;e<i.length;e++){const{key:t,crossTileID:o,tileAnchorX:n,tileAnchorY:a}=i.get(e),l=Math.floor((r+n)*eo),c=Math.floor((s+a)*eo);this.index.add(l,c),this.keys.push(t),this.crossTileIDs.push(o);}this.index.finish();}findMatches(t,i,o){const r=this.tileID.canonical.z<i.canonical.z?1:Math.pow(2,this.tileID.canonical.z-i.canonical.z),s=eo/Math.pow(2,i.canonical.z-this.tileID.canonical.z),n=i.canonical.x*e.Y,a=i.canonical.y*e.Y;for(let e=0;e<t.length;e++){const i=t.get(e);if(i.crossTileID)continue;const{key:l,tileAnchorX:c,tileAnchorY:h}=i,u=Math.floor((n+c)*s),d=Math.floor((a+h)*s),_=this.index.range(u-r,d-r,u+r,d+r);for(const e of _){const t=this.crossTileIDs[e];if(this.keys[e]===l&&!o.has(t)){o.add(t),i.crossTileID=t;break}}}}}class io{constructor(){this.maxCrossTileID=0;}generate(){return ++this.maxCrossTileID}}class oo{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0;}handleWrapJump(e){const t=Math.round((e-this.lng)/360);if(0!==t)for(const e in this.indexes){const i=this.indexes[e],o={};for(const e in i){const r=i[e];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),o[r.tileID.key]=r;}this.indexes[e]=o;}this.lng=e;}addBucket(e,t,i){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return !1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key]);}for(let e=0;e<t.symbolInstances.length;e++)t.symbolInstances.get(e).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]=new Set);const o=this.usedCrossTileIDs[e.overscaledZ];for(const i in this.indexes){const r=this.indexes[i];if(Number(i)>e.overscaledZ)for(const i in r){const s=r[i];s.tileID.isChildOf(e)&&s.findMatches(t.symbolInstances,e,o);}else {const s=r[e.scaledTo(Number(i)).key];s&&s.findMatches(t.symbolInstances,e,o);}}for(let e=0;e<t.symbolInstances.length;e++){const r=t.symbolInstances.get(e);r.crossTileID||(r.crossTileID=i.generate(),o.add(r.crossTileID));}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new to(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(const i of t.crossTileIDs)this.usedCrossTileIDs[e].delete(i);}removeStaleBuckets(e){let t=!1;for(const i in this.indexes){const o=this.indexes[i];for(const r in o)e[o[r].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,o[r]),delete o[r],t=!0);}return t}}class ro{constructor(){this.layerIndexes={},this.crossTileIDs=new io,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={};}addLayer(e,t,i,o){let r=this.layerIndexes[e.fqid];void 0===r&&(r=this.layerIndexes[e.fqid]=new oo);let s=!1;const n={};\"globe\"!==o.name&&r.handleWrapJump(i);for(const i of t){const t=i.getBucket(e);t&&e.fqid===t.layerIds[0]&&(t.bucketInstanceId||(t.bucketInstanceId=++this.maxBucketInstanceId),r.addBucket(i.tileID,t,this.crossTileIDs)&&(s=!0),n[t.bucketInstanceId]=!0);}return r.removeStaleBuckets(n)&&(s=!0),s}pruneUnusedLayers(e){const t={};e.forEach((e=>{t[e]=!0;}));for(const e in this.layerIndexes)t[e]||delete this.layerIndexes[e];}}class so{constructor(e=0,t=0,i=0,o=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(o)||o<0)throw new Error(\"Invalid value for edge-insets, top, bottom, left and right must all be numbers\");this.top=e,this.bottom=t,this.left=i,this.right=o;}interpolate(t,i,o){return null!=i.top&&null!=t.top&&(this.top=e.X(t.top,i.top,o)),null!=i.bottom&&null!=t.bottom&&(this.bottom=e.X(t.bottom,i.bottom,o)),null!=i.left&&null!=t.left&&(this.left=e.X(t.left,i.left,o)),null!=i.right&&null!=t.right&&(this.right=e.X(t.right,i.right,o)),this}getCenter(t,i){const o=e.ad((this.left+t-this.right)/2,0,t),r=e.ad((this.top+i-this.bottom)/2,0,i);return new e.P(o,r)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new so(this.top,this.bottom,this.left,this.right)}toJSON(){return {top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function no(t,i){const o=e.bn(t,3);e.a9.fromQuat(t,i),e.bp(t,3,o);}function ao(t,i){const o=e.bl.identity([]);return e.bl.rotateZ(o,o,-i),e.bl.rotateX(o,o,-t),o}function lo(t,i){const o=[t[0],t[1],0],r=[i[0],i[1],0];if(e.Q.length(o)>=1e-15){const t=e.Q.normalize([],o);e.Q.scale(r,t,e.Q.dot(r,t)),i[0]=r[0],i[1]=r[1];}const s=e.Q.cross([],i,t);if(e.Q.len(s)<1e-15)return null;const n=Math.atan2(-s[1],s[0]);return ao(Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2]),n)}class co{constructor(e,t){this.position=e,this.orientation=t;}get position(){return this._position}set position(t){if(t){const i=t instanceof e.O?t:new e.O(t[0],t[1],t[2]);this._renderWorldCopies&&(i.x=e.bk(i.x,0,1)),this._position=i;}else this._position=null;}lookAtPoint(t,i){if(this.orientation=null,!this.position)return;const o=this.position,r=this._elevation?this._elevation.getAtPointOrZero(e.O.fromLngLat(t)):0,s=e.O.fromLngLat(t,r),n=[s.x-o.x,s.y-o.y,s.z-o.z];i||(i=[0,0,1]),i[2]=Math.abs(i[2]),this.orientation=lo(n,i);}setPitchBearing(t,i){this.orientation=ao(e.bm(t),e.bm(-i));}}class ho{constructor(t,i){this._transform=e.a9.identity([]),this.orientation=i,this.position=t;}get mercatorPosition(){const t=this.position;return new e.O(t[0],t[1],t[2])}get position(){const t=e.bn(this._transform,3);return [t[0],t[1],t[2]]}set position(t){var i;t&&e.bp(this._transform,3,[(i=t)[0],i[1],i[2],1]);}get orientation(){return this._orientation}set orientation(t){this._orientation=t||e.bl.identity([]),t&&no(this._transform,this._orientation);}getPitchBearing(){const e=this.forward(),t=this.right();return {bearing:Math.atan2(-t[1],t[0]),pitch:Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2])}}setPitchBearing(e,t){this._orientation=ao(e,t),no(this._transform,this._orientation);}forward(){const t=e.bn(this._transform,2);return [-t[0],-t[1],-t[2]]}up(){const t=e.bn(this._transform,1);return [-t[0],-t[1],-t[2]]}right(){const t=e.bn(this._transform,0);return [t[0],t[1],t[2]]}getCameraToWorld(t,i){const o=new Float64Array(16);return e.a9.invert(o,this.getWorldToCamera(t,i)),o}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,i,o){const r=this.position;e.Q.scale(r,r,-t);const s=new Float64Array(16);return e.a9.fromScaling(s,[o,o,o]),e.a9.translate(s,s,r),s[10]*=i,s}getWorldToCamera(t,i){const o=new Float64Array(16),r=new Float64Array(4),s=this.position;return e.bl.conjugate(r,this._orientation),e.Q.scale(s,s,-t),e.a9.fromQuat(o,r),e.a9.translate(o,o,s),o[1]*=-1,o[5]*=-1,o[9]*=-1,o[13]*=-1,o[8]*=i,o[9]*=i,o[10]*=i,o[11]*=i,o}getCameraToClipPerspective(t,i,o,r){const s=new Float64Array(16);return e.a9.perspective(s,t,i,o,r),s}getCameraToClipOrthographic(t,i,o,r,s,n){const a=new Float64Array(16);return e.a9.ortho(a,t,i,o,r,s,n),a}getDistanceToElevation(t,i=!1){const o=0===t?0:e.bo(t,i?e.ax(this.position[1]):this.position[1]),r=this.forward();return (o-this.position[2])/r[2]}clone(){return new ho([...this.position],[...this.orientation])}}const uo=(e,t,i)=>(1-i)*e+i*t,_o=e=>e*e*e*e*e;class po{constructor(t,i,o,r,s,n,a){this.tileSize=512,this._renderWorldCopies=void 0===s||s,this._minZoom=t||0,this._maxZoom=i||22,this._minPitch=null==o?0:o,this._maxPitch=null==r?60:r,this.setProjection(n),this.setMaxBounds(a),this.width=0,this.height=0,this._center=new e.bq(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new so,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new ho,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference=\"ground\",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1;}clone(){const e=new po(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,e.mercatorFromTransition=this.mercatorFromTransition,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._seaLevelZoom=this._seaLevelZoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._nearZ=this._nearZ,e._farZ=this._farZ,e._averageElevation=this._averageElevation,e._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e.frustumCorners=this.frustumCorners,e}get isOrthographic(){return \"globe\"!==this.projection.name&&this._orthographicProjectionAtLowPitch&&this.pitch<15}get elevation(){return this._elevation}set elevation(e){this._elevation!==e&&(this._elevation=e,this._updateCameraOnTerrain(),this._calcMatrices());}get depthOcclusionForSymbolsAndCircles(){return \"globe\"!==this.projection.name&&!this.isOrthographic}updateElevation(e,t=!1){const i=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(null==this._seaLevelZoom||i)&&this._updateCameraOnTerrain(),(e||i)&&this._constrainCamera(t),this._calcMatrices();}getProjection(){return e.af(this.projection,[\"name\",\"center\",\"parallels\"])}setProjection(i){this.projectionOptions=i||{name:\"mercator\"};const o=this.projection?this.getProjection():void 0;this.projection=e.br(this.projectionOptions);const r=!t(o,this.getProjection());return r&&this._calcMatrices(),this.mercatorFromTransition=!1,r}setOrthographicProjectionAtLowPitch(e){return this._orthographicProjectionAtLowPitch!==e&&(this._orthographicProjectionAtLowPitch=e,this._calcMatrices(),!0)}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:\"mercator\"},this.projection=e.br({name:\"mercator\"});const i=t!==this.projection.name;return i&&this._calcMatrices(),i}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e));}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e));}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e));}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e));}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e;}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const e=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get cameraWorldSize(){const e=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return e.bo(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.P(this.width,this.height)}get bearing(){return e.bk(this.rotation,-180,180)}set bearing(e){this.rotation=e;}get rotation(){return -this.angle/Math.PI*180}set rotation(t){const i=-t*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=e.b7.create(),e.b7.rotate(this.rotationMatrix,this.rotationMatrix,this.angle));}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const i=e.ad(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices());}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}get fovX(){return this._fov}get fovY(){const e=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/e)}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=e.bm(t),this._calcMatrices());}get averageElevation(){return this._averageElevation}set averageElevation(e){this._averageElevation=e,this._calcFogMatrices(),this._distanceTileDataCache={};}get zoom(){return this._zoom}set zoom(e){const t=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==t&&(this._unmodified=!1,this._setZoom(t),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices());}_setZoom(e){this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom;}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(e){this._tileCoverLift!==e&&(this._tileCoverLift=e);}_updateCameraOnTerrain(){const e=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,t=this.elevation&&e===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||e===Number.NEGATIVE_INFINITY&&(!t||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const i=this._elevation;t||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&i.exaggeration()&&this._centerAltitudeValidForExaggeration!==i.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*i.exaggeration(),this._centerAltitudeValidForExaggeration=i.exaggeration()):(this._centerAltitude=e||0,this._centerAltitudeValidForExaggeration=i.exaggeration()),this._updateSeaLevelZoom();}_updateSeaLevelZoom(){void 0!==this._centerAltitudeValidForExaggeration&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize));}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,i=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],o=this.horizonLineFromTop();let r=0,s=0;for(let n=0;n<i.length;n++){const a=new e.P(i[n][0]*this.width,o+i[n][1]*(this.height-o)),l=t.pointCoordinate(a);if(!l)continue;const c=1/Math.hypot(l[0]-this._camera.position[0],l[1]-this._camera.position[1]);r+=l[3]*c,s+=c;}return 0===s?NaN:r/s}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._terrainEnabled()&&(\"ground\"===this.cameraElevationReference?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices());}_updateZoomFromElevation(){if(null==this._seaLevelZoom||!this._elevation)return;const e=this._seaLevelZoom,t=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),i=this.pixelsPerMeter/this.worldSize*t,o=this._mercatorZfromZoom(e),r=this._mercatorZfromZoom(this._maxZoom),s=Math.max(o-i,r);this._setZoom(this._zoomFromMercatorZ(s));}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices());}computeZoomRelativeTo(t){const i=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));let o;o=t.z<this._camera.position[2]?[i.x,i.y,i.z]:[t.x,t.y,t.z];const r=e.Q.length(e.Q.sub([],this._camera.position,o));return e.ad(this._zoomFromMercatorZ(r),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height)return;if(!t.position&&!t.orientation)return;this._updateCameraState();let i=!1;if(t.orientation&&!e.bl.exactEquals(t.orientation,this._camera.orientation)&&(i=this._setCameraOrientation(t.orientation)),t.position){const o=[t.position.x,t.position.y,t.position.z];e.Q.exactEquals(o,this._camera.position)||(this._setCameraPosition(o),i=!0);}i&&(this._updateStateFromCamera(),this.recenterOnTerrain());}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,i=new co;return i.position=new e.O(t[0],t[1],t[2]),i.orientation=this._camera.orientation,i._elevation=this.elevation,i._renderWorldCopies=this.renderWorldCopies,i}_setCameraOrientation(t){if(!e.bl.length(t))return !1;e.bl.normalize(t,t);const i=e.Q.transformQuat([],[0,0,-1],t),o=e.Q.transformQuat([],[0,-1,0],t);if(o[2]<0)return !1;const r=lo(i,o);return !!r&&(this._camera.orientation=r,!0)}_setCameraPosition(t){const i=this.zoomScale(this.minZoom)*this.tileSize,o=this.zoomScale(this.maxZoom)*this.tileSize,r=this.cameraToCenterDistance;t[2]=e.ad(t[2],r/o,r/i),this._camera.position=t;}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this._constrain(),this._calcMatrices();}coveringZoomLevel(e){const t=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,t)}getVisibleUnwrappedCoordinates(t){const i=[new e.bs(0,t)];if(this.renderWorldCopies){const o=this.pointCoordinate(new e.P(0,0)),r=this.pointCoordinate(new e.P(this.width,0)),s=this.pointCoordinate(new e.P(this.width,this.height)),n=this.pointCoordinate(new e.P(0,this.height)),a=Math.floor(Math.min(o.x,r.x,s.x,n.x)),l=Math.floor(Math.max(o.x,r.x,s.x,n.x)),c=1;for(let o=a-c;o<=l+c;o++)0!==o&&i.push(new e.bs(o,t));}return i}isLODDisabled(e){return (!e||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCoverForShadows(t,i,o){let r=[];if(0===i[0]&&0===i[1])return r;for(const o of t){const t=o.canonical,s=o.overscaledZ,n=o.wrap,a=1<<t.z,l=t.x+1<a,c=t.x>0,h=t.y+1<a,u=t.y>0,d=o.wrap-(c?0:1),_=o.wrap+(l?0:1),p=c?t.x-1:a-1,f=l?t.x+1:0;i[0]<0?(r.push(new e.ap(s,_,t.z,f,t.y)),i[1]<0&&h&&(r.push(new e.ap(s,n,t.z,t.x,t.y+1)),r.push(new e.ap(s,_,t.z,f,t.y+1))),i[1]>0&&u&&(r.push(new e.ap(s,n,t.z,t.x,t.y-1)),r.push(new e.ap(s,_,t.z,f,t.y-1)))):i[0]>0?(r.push(new e.ap(s,d,t.z,p,t.y)),i[1]<0&&h&&(r.push(new e.ap(s,n,t.z,t.x,t.y+1)),r.push(new e.ap(s,d,t.z,p,t.y+1))),i[1]>0&&u&&(r.push(new e.ap(s,n,t.z,t.x,t.y-1)),r.push(new e.ap(s,d,t.z,p,t.y-1)))):i[1]<0&&h?r.push(new e.ap(s,n,t.z,t.x,t.y+1)):u&&r.push(new e.ap(s,n,t.z,t.x,t.y-1));}if(r.length>1){r.sort(((e,t)=>e.overscaledZ-t.overscaledZ||e.wrap-t.wrap||e.canonical.z-t.canonical.z||e.canonical.x-t.canonical.x||e.canonical.y-t.canonical.y));let e=0,t=0;for(;t<r.length;)r[t].equals(r[e])?++t:r[++e]=r[t++];r.length=e+1;}const s=[];for(const e of r)r.some((t=>e.isChildOf(t)))||s.push(e);return r=s.filter((e=>!t.some((t=>!!(e.overscaledZ<o&&t.isChildOf(e))||e.equals(t)||e.isChildOf(t))))),r}coveringTiles(t){let i=this.coveringZoomLevel(t);const o=i,r=this.elevation&&this.elevation.exaggeration(),s=r&&!t.isTerrainDEM,n=\"mercator\"===this.projection.name;if(void 0!==t.minzoom&&i<t.minzoom)return [];void 0!==t.maxzoom&&i>t.maxzoom&&(i=t.maxzoom);const a=this.locationCoordinate(this.center),l=this.center.lat,c=1<<i,h=[c*a.x,c*a.y,0],u=\"globe\"===this.projection.name,d=!u,_=e.bt.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i,d),p=u?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),f=c*e.bo(1,this.center.lat),m=this._camera.position[2]/e.bo(1,this.center.lat),g=[c*p.x,c*p.y,m*(d?1:f)],v=u||r,x=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),y=this.isLODDisabled(!0)?i:0;let b;if(this._elevation&&t.isTerrainDEM)b=1e4*this._elevation.exaggeration();else if(this._elevation){const e=this._elevation.getMinMaxForVisibleTiles();b=e?e.max:this._centerAltitude;}else b=this._centerAltitude;const w=t.isTerrainDEM?-b:this._elevation?this._elevation.getMinElevationBelowMSL():0,T=this.projection.isReprojectedInTileSpace?e.bu(this):1,E=t=>{const i=1/4e4,o=new e.O(t.x+i,t.y,t.z),r=new e.O(t.x,t.y+i,t.z),s=t.toLngLat(),n=o.toLngLat(),a=r.toLngLat(),l=this.locationCoordinate(s),c=this.locationCoordinate(n),h=this.locationCoordinate(a),u=Math.hypot(c.x-l.x,c.y-l.y),d=Math.hypot(h.x-l.x,h.y-l.y);return Math.sqrt(u*d)*T/i},S=t=>{const i=b,o=w;return {aabb:e.bx(this,c,0,0,0,t,o,i,this.projection),zoom:0,x:0,y:0,minZ:o,maxZ:i,wrap:t,fullyVisible:!1}},C=[];let I=[];const D=i,R=t.reparseOverscaled?o:i,A=e=>e*e,P=A((m-this._centerAltitude)*f),L=e=>{if(!this._elevation||!e.tileID||!n)return;const t=this._elevation.getMinMaxForTile(e.tileID),i=e.aabb;t?(i.min[2]=t.min,i.max[2]=t.max,i.center[2]=(i.min[2]+i.max[2])/2):(e.shouldSplit=M(e),e.shouldSplit||(i.min[2]=i.max[2]=i.center[2]=this._centerAltitude));},M=t=>{if(t.zoom<y)return !0;if(t.zoom===D)return !1;if(null!=t.shouldSplit)return t.shouldSplit;const i=t.aabb.distanceX(g),r=t.aabb.distanceY(g);let n=P,a=1;if(u){n=A(t.aabb.distanceZ(g));const i=Math.pow(2,t.zoom),o=e.ax((t.y+1)/i),r=e.ax(t.y/i),s=Math.min(Math.max(l,o),r),c=e.bM(s)/e.bM(l);if(a=s===l?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,c/this._mercatorScaleRatio),this.zoom<=e.bJ&&t.zoom===D-1&&c>=.9)return !0}else if(s&&(n=A(t.aabb.distanceZ(g)*f)),this.projection.isReprojectedInTileSpace&&o<=5){const i=Math.pow(2,t.zoom),o=E(new e.O((t.x+.5)/i,(t.y+.5)/i));a=o>.85?1:o;}const c=i*i+r*r+n,h=A((1<<D-t.zoom)*x*a*((e,t)=>{if(t*A(.707)<e)return 1;const i=Math.sqrt(t/e);return i/(1.4144271570014144+(Math.pow(1.1,i-1.4144271570014144+1)-1)/(1.1-1)-1)})(Math.max(n,P),c));return c<h};if(this.renderWorldCopies)for(let e=1;e<=3;e++)C.push(S(-e)),C.push(S(e));for(C.push(S(0));C.length>0;){const o=C.pop(),r=o.x,a=o.y;let l=o.fullyVisible;const d=()=>\"globe\"===this.projection.name&&(0===o.y||o.y===(1<<o.zoom)-1);if(!l){let t=v?o.aabb.intersects(_):o.aabb.intersectsFlat(_);if(0===t&&d()){const i=new e.bv(o.zoom,r,a);t=e.bw(this,c,i,!0).intersects(_);}if(0===t)continue;l=2===t;}if(o.zoom!==D&&M(o))for(let t=0;t<4;t++){const i=(r<<1)+t%2,h=(a<<1)+(t>>1),d={aabb:n?o.aabb.quadrant(t):e.bx(this,c,o.zoom+1,i,h,o.wrap,o.minZ,o.maxZ,this.projection),zoom:o.zoom+1,x:i,y:h,wrap:o.wrap,fullyVisible:l,tileID:void 0,shouldSplit:void 0,minZ:o.minZ,maxZ:o.maxZ};s&&!u&&(d.tileID=new e.ap(o.zoom+1===D?R:o.zoom+1,o.wrap,o.zoom+1,i,h),L(d)),C.push(d);}else {const s=o.zoom===D?R:o.zoom;if(t.minzoom&&t.minzoom>s)continue;if(!l){let t=v?o.aabb.intersectsPrecise(_):o.aabb.intersectsPreciseFlat(_);if(0===t&&d()){const i=new e.bv(o.zoom,r,a);t=e.bw(this,c,i,!0).intersectsPrecise(_);}if(0===t)continue}const n=h[0]-(.5+r+(o.wrap<<o.zoom))*(1<<i-o.zoom),u=h[1]-.5-a,p=o.tileID?o.tileID:new e.ap(s,o.wrap,o.zoom,r,a);I.push({tileID:p,distanceSq:n*n+u*u});}}if(this.fogCullDistSq){const i=this.fogCullDistSq,o=this.horizonLineFromTop();I=I.filter((r=>{const s=[0,0,0,1],n=[e.Y,e.Y,0,1],a=this.calculateFogTileMatrix(r.tileID.toUnwrapped());e.aa.transformMat4(s,s,a),e.aa.transformMat4(n,n,a);const l=e.aa.min([],s,n),c=e.aa.max([],s,n),h=e.by(l,c);if(0===h)return !0;let u=!1;const d=this._elevation;if(d&&h>i&&0!==o){const i=this.calculateProjMatrix(r.tileID.toUnwrapped());let s;t.isTerrainDEM||(s=d.getMinMaxForTile(r.tileID)),s||(s={min:w,max:b});const n=e.bK(this.rotation),a=[n[0]*e.Y,n[1]*e.Y,s.max];e.Q.transformMat4(a,a,i),u=(1-a[1])*this.height*.5<o;}return h<i||u}));}return I.sort(((e,t)=>e.distanceSq-t.distanceSq)).map((e=>e.tileID))}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices();}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(t){const i=e.ad(t.lat,-e.bz,e.bz),o=this.projection.project(t.lng,i);return new e.P(o.x*this.worldSize,o.y*this.worldSize)}unproject(e){return this.projection.unproject(e.x/this.worldSize,e.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/e.bo(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,i){let o,r;const s=this.centerPoint;if(\"globe\"===this.projection.name){const e=this.worldSize;o=(i.x-s.x)/e,r=(i.y-s.y)/e;}else {const e=this.pointCoordinate(i),t=this.pointCoordinate(s);o=e.x-t.x,r=e.y-t.y;}const n=this.locationCoordinate(t);this.setLocation(new e.O(n.x-o,n.y-r));}setLocation(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap());}locationPoint(e){return this.projection.locationPoint(this,e)}locationPoint3D(e){return this.projection.locationPoint(this,e,!0)}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}pointLocation3D(e){return this.coordinateLocation(this.pointCoordinate3D(e))}locationCoordinate(t,i){const o=i?e.bo(i,t.lat):void 0,r=this.projection.project(t.lng,t.lat);return new e.O(r.x,r.y,o)}coordinateLocation(e){return this.projection.unproject(e.x,e.y)}pointRayIntersection(t,i){const o=null!=i?i:this._centerAltitude,r=[t.x,t.y,0,1],s=[t.x,t.y,1,1];e.aa.transformMat4(r,r,this.pixelMatrixInverse),e.aa.transformMat4(s,s,this.pixelMatrixInverse);const n=s[3];e.aa.scale(r,r,1/r[3]),e.aa.scale(s,s,1/n);const a=r[2],l=s[2];return {p0:r,p1:s,t:a===l?0:(o-a)/(l-a)}}screenPointToMercatorRay(t){const i=[t.x,t.y,0,1],o=[t.x,t.y,1,1];return e.aa.transformMat4(i,i,this.pixelMatrixInverse),e.aa.transformMat4(o,o,this.pixelMatrixInverse),e.aa.scale(i,i,1/i[3]),e.aa.scale(o,o,1/o[3]),i[2]=e.bo(i[2],this._center.lat)*this.worldSize,o[2]=e.bo(o[2],this._center.lat)*this.worldSize,e.aa.scale(i,i,1/this.worldSize),e.aa.scale(o,o,1/this.worldSize),new e.a5([i[0],i[1],i[2]],e.Q.normalize([],e.Q.sub([],o,i)))}rayIntersectionCoordinate(t){const{p0:i,p1:o,t:r}=t,s=e.bo(i[2],this._center.lat),n=e.bo(o[2],this._center.lat);return new e.O(e.X(i[0],o[0],r)/this.worldSize,e.X(i[1],o[1],r)/this.worldSize,e.X(s,n,r))}pointCoordinate(e,t=this._centerAltitude){return this.projection.pointCoordinate(this,e.x,e.y,t)}pointCoordinate3D(t){if(!this.elevation)return this.pointCoordinate(t);let i=this.projection.pointCoordinate3D(this,t.x,t.y);if(i)return new e.O(i[0],i[1],i[2]);let o=0,r=this.horizonLineFromTop();if(t.y>r)return this.pointCoordinate(t);const s=.02*r,n=t.clone();for(let t=0;t<10&&r-o>s;t++){n.y=e.X(o,r,.66);const t=this.projection.pointCoordinate3D(this,n.x,n.y);t?(r=n.y,i=t):o=n.y;}return i?new e.O(i[0],i[1],i[2]):this.pointCoordinate(t)}isPointAboveHorizon(e){return this.projection.isPointAboveHorizon(this,e)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return !1;if(this.elevation||this.zoom>=e.bA)return !this.isPointAboveHorizon(t);const i=this.pointCoordinate(t);return i.y>=0&&i.y<=1}_coordinatePoint(t,i){const o=i&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,r=[t.x*this.worldSize,t.y*this.worldSize,o+t.toAltitude(),1];return e.aa.transformMat4(r,r,this.pixelMatrix),r[3]>0?new e.P(r[0]/r[3],r[1]/r[3]):new e.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:i}=this._edgeInsets,o=this.height-this._edgeInsets.bottom,r=this.width-this._edgeInsets.right,s=this.pointLocation3D(new e.P(i,t)),n=this.pointLocation3D(new e.P(r,t)),a=this.pointLocation3D(new e.P(r,o)),l=this.pointLocation3D(new e.P(i,o));let c=Math.min(s.lng,n.lng,a.lng,l.lng),h=Math.max(s.lng,n.lng,a.lng,l.lng),u=Math.min(s.lat,n.lat,a.lat,l.lat),d=Math.max(s.lat,n.lat,a.lat,l.lat);const _=Math.pow(2,-this.zoom)/16*270,p=\"globe\"===this.projection.name?1:4,f=(t,i,o,r,s)=>{const n=(t+o)/2,a=(i+r)/2,l=new e.P(n,a),{lng:m,lat:g}=this.pointLocation3D(l),v=Math.max(0,c-m,u-g,m-h,g-d);c=Math.min(c,m),h=Math.max(h,m),u=Math.min(u,g),d=Math.max(d,g),(s<p||v>_)&&(f(t,i,n,a,s+1),f(n,a,o,r,s+1));};if(f(i,t,r,t,1),f(r,t,r,o,1),f(r,o,i,o,1),f(i,o,i,t,1),\"globe\"===this.projection.name){const[t,i]=e.bB(this);t?(d=90,h=180,c=-180):i&&(u=-90,h=180,c=-180);}return new e.ag(new e.bq(c,u),new e.bq(h,d))}_getBoundsRectangular(t,i){const{top:o,left:r}=this._edgeInsets,s=this.height-this._edgeInsets.bottom,n=this.width-this._edgeInsets.right,a=new e.P(r,o),l=new e.P(n,o),c=new e.P(n,s),h=new e.P(r,s);let u=this.pointCoordinate(a,t),d=this.pointCoordinate(l,t);const _=this.pointCoordinate(c,i),p=this.pointCoordinate(h,i),f=(e,t)=>(t.y-e.y)/(t.x-e.x);return u.y>1&&d.y>=0?u=new e.O((1-p.y)/f(p,u)+p.x,1):u.y<0&&d.y<=1&&(u=new e.O(-p.y/f(p,u)+p.x,0)),d.y>1&&u.y>=0?d=new e.O((1-_.y)/f(_,d)+_.x,1):d.y<0&&u.y<=1&&(d=new e.O(-_.y/f(_,d)+_.x,0)),(new e.ag).extend(this.coordinateLocation(u)).extend(this.coordinateLocation(d)).extend(this.coordinateLocation(p)).extend(this.coordinateLocation(_))}_getBoundsRectangularTerrain(){const e=this.elevation;if(!e.visibleDemTiles.length||e.isUsingMockSource())return this._getBoundsRectangular(0,0);const t=e.visibleDemTiles.reduce(((e,t)=>{if(t.dem){const i=t.dem.tree;e.min=Math.min(e.min,i.minimums[0]),e.max=Math.max(e.max,i.maximums[0]);}return e}),{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(t.min*e.exaggeration(),t.max*e.exaggeration())}getBounds(){return \"mercator\"===this.projection.name||\"equirectangular\"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(e=!0){const t=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,i=this.height/2-t*(1-this._horizonShift);return e?Math.max(0,i):i}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-e.bz,this.maxLat=e.bz,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=e.a8(this.minLng)*this.tileSize,this.worldMaxX=e.a8(this.maxLng)*this.tileSize,this.worldMinY=e.ah(this.maxLat)*this.tileSize,this.worldMaxY=e.ah(this.minLat)*this.tileSize,this._constrain();}calculatePosMatrix(e,t){return this.projection.createTileMatrix(this,t,e)}calculateDistanceTileData(t){const i=t.key,o=this._distanceTileDataCache;if(o[i])return o[i];const r=t.canonical,s=1/this.height,n=this.cameraWorldSize,a=n/this.zoomScale(r.z),l=(r.x+Math.pow(2,r.z)*t.wrap)*a,c=r.y*a,h=this.point;h.x*=n/this.worldSize,h.y*=n/this.worldSize;const u=this.angle,d=Math.sin(-u),_=-Math.cos(-u);return o[i]={bearing:[d,_],center:[(h.x-l)*s,(h.y-c)*s],scale:a/e.Y*s},o[i]}calculateFogTileMatrix(t){const i=t.key,o=this._fogTileMatrixCache;if(o[i])return o[i];const r=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,t);return e.a9.multiply(r,this.worldToFogMatrix,r),o[i]=new Float32Array(r),o[i]}calculateProjMatrix(t,i=!1,o=!1){const r=t.key;let s;if(s=o?this._expandedProjMatrixCache:i?this._alignedProjMatrixCache:this._projMatrixCache,s[r])return s[r];const n=this.calculatePosMatrix(t,this.worldSize);let a;return a=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:o?this.expandedFarZProjMatrix:i?this.alignedProjMatrix:this.projMatrix,e.a9.multiply(n,a,n),s[r]=new Float32Array(n),s[r]}calculatePixelsToTileUnitsMatrix(t){const i=t.tileID.key,o=this._pixelsToTileUnitsCache;if(o[i])return o[i];const r=e.bC(t,this);return o[i]=r,o[i]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(\"globe\"===this.projection.name){const t=1/this.worldSize,i=e.a9.fromScaling([],[t,t,t]);return e.a9.multiply(i,i,this.globeMatrix),i}}recenterOnTerrain(){if(!this._elevation||\"globe\"===this.projection.name)return;const t=this._elevation;this._updateCameraState();const i=e.bo(1,this._center.lat)*this.worldSize,o=this._computeCameraPosition(i),r=this._camera.forward(),s=e.bo(1,this._center.lat);o[2]/=s,r[2]/=s,e.Q.normalize(r,r);const n=t.raycast(o,r,t.exaggeration());if(n){const t=e.Q.scaleAndAdd([],o,r,n),i=new e.O(t[0],t[1],e.bo(t[2],e.ax(t[1]))),a=(i.z+e.Q.length([i.x-o[0],i.y-o[1],i.z-o[2]*s]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(a),this._centerAltitude=i.toAltitude(),this._center=this.coordinateLocation(i),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices();}}_constrainCamera(t=!1){if(!this._elevation)return;const i=this._elevation,o=e.bo(1,this._center.lat)*this.worldSize,r=this._computeCameraPosition(o),s=i.getAtPointOrZero(new e.O(...r)),n=this.pixelsPerMeter/this.worldSize*s,a=this._minimumHeightOverTerrain(),l=r[2]-n;if(l<=a)if(l<0||t){const t=this.locationCoordinate(this._center,this._centerAltitude),i=[r[0],r[1],t.z-r[2]],o=e.Q.length(i);i[2]-=(a-l)/this._pixelsPerMercatorPixel;const s=e.Q.length(i);if(0===s)return;e.Q.scale(i,i,o/s*this._pixelsPerMercatorPixel),this._camera.position=[r[0],r[1],t.z*this._pixelsPerMercatorPixel-i[2]],this._updateStateFromCamera();}else this._isCameraConstrained=!0;}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=\"globe\"===this.projection.name||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||t){const i=this.center;return i.lat=e.ad(i.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(i.lng=e.ad(i.lng,this.minLng,this.maxLng)),this.center=i,void(this._constraining=!1)}const i=this._unmodified,{x:o,y:r}=this.point;let s=0,n=o,a=r;const l=this.width/2,c=this.height/2,h=this.worldMinY*this.scale,u=this.worldMaxY*this.scale;if(r-c<h&&(a=h+c),r+c>u&&(a=u-c),u-h<this.height&&(s=Math.max(s,this.height/(u-h)),a=(u+h)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const e=this.worldMinX*this.scale,t=this.worldMaxX*this.scale,i=this.worldSize/2-(e+t)/2;n=(o+i+this.worldSize)%this.worldSize-i,n-l<e&&(n=e+l),n+l>t&&(n=t-l),t-e<this.width&&(s=Math.max(s,this.width/(t-e)),n=(t+e)/2);}n===o&&a===r||(this.center=this.unproject(new e.P(n,a))),s&&(this.zoom+=this.scaleZoom(s)),this._constrainCamera(),this._unmodified=i,this._constraining=!1;}_minZoomForBounds(){let e=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(e=Math.max(e,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),e}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,i=\"globe\"===this.projection.name,o=this.pixelsPerMeter;\"globe\"===this.projection.name&&(this._mercatorScaleRatio=e.bo(1,this.center.lat)/e.bo(1,e.bL));const r=e.bD(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,r),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const s=\"meters\"===this.projection.zAxisUnit?o:1,n=this._camera.getWorldToCamera(this.worldSize,s);let a;const l=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(l[8]=2*-t.x/this.width,l[9]=2*t.y/this.height,this.isOrthographic){let e=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),i=e*this.aspect,o=-i,r=-e;i-=t.x,o-=t.x,e+=t.y,r+=t.y,a=this._camera.getCameraToClipOrthographic(o,i,r,e,this._nearZ,this._farZ),((e,t,i,o)=>{for(let r=0;r<16;r++)e[r]=uo(t[r],i[r],o);})(a,a,l,_o(this.pitch>=15?1:this.pitch/15));}else a=l;const c=e.a9.mul([],l,n);let h=e.a9.mul([],a,n);if(this.projection.isReprojectedInTileSpace){const t=this.locationCoordinate(this.center),i=e.a9.identity([]);e.a9.translate(i,i,[t.x*this.worldSize,t.y*this.worldSize,0]),e.a9.multiply(i,i,e.bE(this)),e.a9.translate(i,i,[-t.x*this.worldSize,-t.y*this.worldSize,0]),e.a9.multiply(h,h,i),e.a9.multiply(c,c,i),this.inverseAdjustmentMatrix=e.bF(this);}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=e.a9.scale([],h,[this.worldSize,this.worldSize,this.worldSize/s,1]),this.projMatrix=h,this.invProjMatrix=e.a9.invert(new Float64Array(16),this.projMatrix),i){const i=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);i[8]=2*-t.x/this.width,i[9]=2*t.y/this.height,this.expandedFarZProjMatrix=e.a9.mul([],i,n);}else this.expandedFarZProjMatrix=this.projMatrix;const u=e.a9.invert([],a);this.frustumCorners=e.bG.fromInvProjectionMatrix(u,this.horizonLineFromTop(),this.height),this.cameraFrustum=e.bt.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!i);const d=new Float32Array(16);e.a9.identity(d),e.a9.scale(d,d,[1,-1,1]),e.a9.rotateX(d,d,this._pitch),e.a9.rotateZ(d,d,this.angle);const _=e.a9.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=e.a9.clone(_);const p=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;_[8]=2*-t.x/this.width,_[9]=2*(t.y+p)/this.height,this.skyboxMatrix=e.a9.multiply(d,_,d);const f=this.point,m=f.x,g=f.y,v=this.width%2/2,x=this.height%2/2,y=Math.cos(this.angle),b=Math.sin(this.angle),w=m-Math.round(m)+y*v+b*x,T=g-Math.round(g)+y*x+b*v,E=new Float64Array(h);if(e.a9.translate(E,E,[w>.5?w-1:w,T>.5?T-1:T,0]),this.alignedProjMatrix=E,h=e.a9.create(),e.a9.scale(h,h,[this.width/2,-this.height/2,1]),e.a9.translate(h,h,[1,-1,0]),this.labelPlaneMatrix=h,h=e.a9.create(),e.a9.scale(h,h,[1,-1,1]),e.a9.translate(h,h,[-1,-1,0]),e.a9.scale(h,h,[2/this.width,2/this.height,1]),this.glCoordMatrix=h,this.pixelMatrix=e.a9.multiply(new Float64Array(16),this.labelPlaneMatrix,c),this._calcFogMatrices(),this._distanceTileDataCache={},h=e.a9.invert(new Float64Array(16),this.pixelMatrix),!h)throw new Error(\"failed to invert matrix\");if(this.pixelMatrixInverse=h,\"globe\"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=e.bH(this);const t=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=e.Q.transformMat4(t,t,n),this.globeRadius=this.worldSize/2/Math.PI-1;}else this.globeMatrix=h;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={};}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,i=this.cameraPixelsPerMeter,o=this._camera.position,r=1/this.height/this._pixelsPerMercatorPixel,s=[t,t,i];e.Q.scale(s,s,r),e.Q.scale(o,o,-1),e.Q.multiply(o,o,s);const n=e.a9.create();e.a9.translate(n,n,o),e.a9.scale(n,n,s),this.mercatorFogMatrix=n,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,i,r);}_computeCameraPosition(e){const t=(e=e||this.pixelsPerMeter)/this.pixelsPerMeter,i=this._camera.forward(),o=this.point,r=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*t-e/this.worldSize*this._centerAltitude;return [o.x/this.worldSize-i[0]*r,o.y/this.worldSize-i[1]*r,e/this.worldSize*this._centerAltitude-i[2]*r]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition());}_translateCameraConstrained(t){const i=this._maxCameraBoundsDistance()*Math.cos(this._pitch),o=this._camera.position[2],r=t[2];let s=1;this.projection.wrap&&(this.center=this.center.wrap()),r>0&&(s=Math.min((i-o)/r,1)),this._camera.position=e.Q.scaleAndAdd([],this._camera.position,t,s),this._updateStateFromCamera();}_updateStateFromCamera(){const t=this._camera.position,i=this._camera.forward(),{pitch:o,bearing:r}=this._camera.getPitchBearing(),s=e.bo(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,n=this._mercatorZfromZoom(this._maxZoom)*Math.cos(e.bm(this._maxPitch)),a=Math.max((t[2]-s)/Math.cos(o),n),l=this._zoomFromMercatorZ(a);e.Q.scaleAndAdd(t,t,i,a),this._pitch=e.ad(o,e.bm(this.minPitch),e.bm(this.maxPitch)),this.angle=e.bk(r,-Math.PI,Math.PI),this._setZoom(e.ad(l,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new e.O(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices();}_worldSizeFromZoom(e){return Math.pow(2,e)*this.tileSize}_mercatorZfromZoom(e){return this.cameraToCenterDistance/this._worldSizeFromZoom(e)}_minimumHeightOverTerrain(){const e=Math.min(null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(e)}_zoomFromMercatorZ(e){return this.scaleZoom(this.cameraToCenterDistance/(e*this.tileSize))}zoomFromMercatorZAdjusted(t){let i=0,o=e.bA,r=0,s=1/0;for(;o-i>1e-6&&o>i;){const e=i+.5*(o-i),n=this.tileSize*Math.pow(2,e),a=this.getCameraToCenterDistance(this.projection,e,n),l=this.scaleZoom(a/(t*this.tileSize)),c=Math.abs(e-l);c<s&&(s=c,r=e),e<l?i=e:o=e;}return r}_terrainEnabled(){return !(!this._elevation||!this.projection.supportsTerrain&&(e.w(\"Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain.\"),1))}anyCornerOffEdge(t,i){const o=Math.min(t.x,i.x),r=Math.max(t.x,i.x),s=Math.min(t.y,i.y),n=Math.max(t.y,i.y);if(s<this.horizonLineFromTop(!1))return !0;if(\"mercator\"!==this.projection.name)return !1;const a=[new e.P(o,s),new e.P(r,n),new e.P(o,n),new e.P(r,s)],l=this.renderWorldCopies?-3:0,c=this.renderWorldCopies?4:1;for(const e of a){const t=this.pointRayIntersection(e);if(t.t<0)return !0;const i=this.rayIntersectionCoordinate(t);if(i.x<l||i.y<0||i.x>c||i.y>1)return !0}return !1}isHorizonVisible(){return this.pitch+e.bI(this.fovAboveCenter)>88||this.anyCornerOffEdge(new e.P(0,0),new e.P(this.width,this.height))}zoomDeltaToMovement(t,i){const o=e.Q.length(e.Q.sub([],this._camera.position,t)),r=this._zoomFromMercatorZ(o)+i;return o-this._mercatorZfromZoom(r)}getCameraPoint(){if(\"globe\"===this.projection.name){const t=function([t,i,o],r){const s=[t,i,o,1];e.aa.transformMat4(s,s,r);const n=s[3]=Math.max(s[3],1e-6);return s[0]/=n,s[1]/=n,s[2]/=n,s}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new e.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(0,t))}}getCameraToCenterDistance(t,i=this.zoom,o=this.worldSize){const r=e.bD(t,i,this.width,this.height,1024),s=t.pixelSpaceConversion(this.center.lat,o,r);let n=.5/Math.tan(.5*this._fov)*this.height*s;return this.isOrthographic&&(n=uo(1,n,_o(this.pitch>=15?1:this.pitch/15))),n}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,\"meters\"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return \"globe\"===this.projection.name&&e.a9.multiply(t,t,this.globeMatrix),t}getFrustum(t){return e.bt.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,\"meters\"===this.projection.zAxisUnit)}}const fo={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,ShadowMap0:10},mo=(t,i)=>{if(i>0&&t.terrain&&e.w(\"Cutoff is currently disabled on terrain\"),i<=0||t.terrain)return {shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const o=t.transform,r=Math.max(Math.abs(o._zoom-(t.minCutoffZoom-1)),1),s=o.isLODDisabled(!1)?e.S(60,45,o.pitch):e.S(30,15,o.pitch),n=o._farZ-o._nearZ,a=i*o.height,l=((1-(c=s))*o.cameraToCenterDistance+c*(o._farZ+a))*r;var c;return {shouldRenderCutoff:s<1,uniformValues:{u_cutoff_params:[o._nearZ,o._farZ,(l-o._nearZ)/n,(l-a-o._nearZ)/n]}}},go={cascadeCount:2,shadowMapResolution:2048};class vo{constructor(e,t){this.aabb=e,this.lastCascade=t;}}class xo{add(e,t){const i=this.receivers[e.key];void 0!==i?(i.aabb.min[0]=Math.min(i.aabb.min[0],t.min[0]),i.aabb.min[1]=Math.min(i.aabb.min[1],t.min[1]),i.aabb.min[2]=Math.min(i.aabb.min[2],t.min[2]),i.aabb.max[0]=Math.max(i.aabb.max[0],t.max[0]),i.aabb.max[1]=Math.max(i.aabb.max[1],t.max[1]),i.aabb.max[2]=Math.max(i.aabb.max[2],t.max[2])):this.receivers[e.key]=new vo(t,null);}clear(){this.receivers={};}get(e){return this.receivers[e.key]}computeRequiredCascades(t,i,o){const r=e.bV.fromPoints(t.points);let s=0;for(const t in this.receivers){const n=this.receivers[t];if(!n)continue;if(!r.intersectsAabb(n.aabb))continue;n.aabb.min=r.closestPoint(n.aabb.min),n.aabb.max=r.closestPoint(n.aabb.max);const a=n.aabb.getCorners();for(let t=0;t<o.length;t++){let r=!0;for(const s of a){const n=[s[0]*i,s[1]*i,s[2]];if(e.Q.transformMat4(n,n,o[t].matrix),n[0]<-1||n[0]>1||n[1]<-1||n[1]>1){r=!1;break}}if(n.lastCascade=t,s=Math.max(s,t),r)break}}return s+1}}class yo{constructor(e){this.painter=e,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new xo,this._depthMode=new Ct(e.context.gl.LEQUAL,Ct.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,e.tp.registerParameter(this,[\"Shadows\"],\"_forceDisable\",{label:\"forceDisable\"},(()=>{this.painter.style.map.triggerRepaint();})),e.tp.registerParameter(go,[\"Shadows\"],\"cascadeCount\",{min:1,max:2,step:1}),e.tp.registerParameter(go,[\"Shadows\"],\"shadowMapResolution\",{min:32,max:2048,step:32}),e.tp.registerBinding(this,[\"Shadows\"],\"_numCascadesToRender\",{readonly:!0,label:\"numCascadesToRender\"});}destroy(){for(const e of this._cascades)e.texture.destroy(),e.framebuffer.destroy();this._cascades=[];}updateShadowParameters(t,i){const o=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!i||!i.properties)return;const r=i.properties.get(\"shadow-intensity\");if(!i.shadowsEnabled()||r<=0)return;if(this._shadowLayerCount=o.style.order.reduce(((e,i)=>{const r=o.style._mergedLayers[i];return e+(r.hasShadowPass()&&!r.isHidden(t.zoom)?1:0)}),0),this._enabled=this._shadowLayerCount>0,!this.enabled)return;const s=o.context,n=go.shadowMapResolution,a=go.shadowMapResolution;if(0===this._cascades.length||go.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let t=0;t<go.cascadeCount;++t){const t=o._shadowMapDebug,i=s.gl,r=s.createFramebuffer(n,a,t,\"texture\"),l=new e.T(s,{width:n,height:a,data:null},i.DEPTH_COMPONENT);if(r.depthAttachment.set(l.texture),t){const t=new e.T(s,{width:n,height:a,data:null},i.RGBA);r.colorAttachment.set(t.texture);}this._cascades.push({framebuffer:r,texture:l,matrix:[],far:0,boundingSphereRadius:0,frustum:new e.bt,scale:0});}}this.shadowDirection=wo(i);let l=0;if(t.elevation){const e=t.elevation,i=[1e4,-1e4];e.visibleDemTiles.filter((e=>e.dem)).forEach((e=>{const t=e.dem.tree;i[0]=Math.min(i[0],t.minimums[0]),i[1]=Math.max(i[1],t.maximums[0]);})),1e4!==i[0]&&(l=(i[1]-i[0])*e.exaggeration());}const c=1.5*t.cameraToCenterDistance,h=3*c,u=new Float64Array(16);for(let i=0;i<this._cascades.length;++i){const o=this._cascades[i];let r=t.height/50,s=1;1===go.cascadeCount?s=h:0===i?s=c:(r=c,s=h);const[n,a]=Eo(t,this.shadowDirection,r,s,go.shadowMapResolution,l);o.scale=t.scale,o.matrix=n,o.boundingSphereRadius=a,e.a9.invert(u,o.matrix),o.frustum=e.bt.fromInvProjectionMatrix(u,1,0,!0),o.far=s;}const d=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[d].far,this._cascades[d].far],this._uniformValues.u_shadow_intensity=r,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/go.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=go.shadowMapResolution,this._uniformValues.u_shadowmap_0=fo.ShadowMap0,this._uniformValues.u_shadowmap_1=fo.ShadowMap0+1,this._groundShadowTiles=o.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const _=o.transform.elevation;for(const e of this._groundShadowTiles){let t={min:0,max:0};if(_){const i=_.getMinMaxForTile(e);i&&(t=i);}this.addShadowReceiver(e.toUnwrapped(),t.min,t.max);}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(e){this._enabled=e;}drawShadowPass(t,i){if(!this.enabled)return;const o=this.painter,r=o.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(o.transform.getFrustum(0),o.transform.worldSize,this._cascades),r.viewport.set([0,0,go.shadowMapResolution,go.shadowMapResolution]);for(let s=0;s<this._numCascadesToRender;++s){o.currentShadowCascade=s,r.bindFramebuffer.set(this._cascades[s].framebuffer.framebuffer),r.clear({color:e.aA.white,depth:1});for(const e of t.order){const r=t._mergedLayers[e];if(!r.hasShadowPass()||r.isHidden(o.transform.zoom))continue;const s=t.getLayerSourceCache(r),n=s?i[s.id]:void 0;(\"model\"===r.type||n&&n.length)&&o.renderLayer(o,s,r,n);}}o.currentShadowCascade=0;}drawGroundShadows(){if(!this.enabled)return;const e=this.painter,t=e.style,i=e.context,o=t.directionalLight,r=t.ambientLight;if(!o||!r)return;const s=[],n=mo(e,e.longestCutoffRange);n.shouldRenderCutoff&&s.push(\"RENDER_CUTOFF\");const a=To(o,r),l=new Ct(i.gl.LEQUAL,Ct.ReadOnly,e.depthRangeFor3D);for(const t of this._groundShadowTiles){const o=t.toUnwrapped(),r=e.isTileAffectedByFog(t),c=e.getOrCreateProgram(\"groundShadow\",{defines:s,overrideFog:r});this.setupShadows(o,c),e.uploadCommonUniforms(i,c,o,null,n);const h={u_matrix:e.transform.calculateProjMatrix(o),u_ground_shadow_factor:a};c.draw(e,i.gl.TRIANGLES,l,Dt.disabled,At.multiply,Mt.disabled,h,\"ground_shadow\",e.tileExtentBuffer,e.quadTriangleIndexBuffer,e.tileExtentSegments,{},e.transform.zoom,null,null);}}getShadowPassColorMode(){return this.painter._shadowMapDebug?At.unblended:At.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(t){const i=this.painter.transform,o=i.calculatePosMatrix(t,i.worldSize);return e.a9.multiply(o,this._cascades[this.painter.currentShadowCascade].matrix,o),Float32Array.from(o)}calculateShadowPassMatrixFromMatrix(t){return e.a9.multiply(t,this._cascades[this.painter.currentShadowCascade].matrix,t),Float32Array.from(t)}setupShadows(t,i,o,r=0){if(!this.enabled)return;const s=this.painter.transform,n=this.painter.context,a=n.gl,l=this._uniformValues,c=new Float64Array(16),h=s.calculatePosMatrix(t,s.worldSize);for(let t=0;t<this._cascades.length;t++)e.a9.multiply(c,this._cascades[t].matrix,h),l[0===t?\"u_light_matrix_0\":\"u_light_matrix_1\"]=Float32Array.from(c),n.activeTexture.set(a.TEXTURE0+fo.ShadowMap0+t),this._cascades[t].texture.bind(a.NEAREST,a.CLAMP_TO_EDGE);if(this.useNormalOffset=!!o,this.useNormalOffset){const i=e.bU(t.canonical),n=2/s.tileSize*e.Y/go.shadowMapResolution,a=n*this._cascades[0].boundingSphereRadius,c=n*this._cascades[this._cascades.length-1].boundingSphereRadius,h=(\"vector-tile\"===o?1:3)/Math.pow(2,r-t.canonical.z-(1-s.zoom+Math.floor(s.zoom)));l.u_shadow_normal_offset=[i,a*h,c*h],l.u_shadow_bias=[6e-5,.0012,.012];}else l.u_shadow_bias=[36e-5,.0012,.012];i.setShadowUniformValues(n,l);}setupShadowsFromMatrix(t,i,o=!1){if(!this.enabled)return;const r=this.painter.context,s=r.gl,n=this._uniformValues,a=new Float64Array(16);for(let i=0;i<go.cascadeCount;i++)e.a9.multiply(a,this._cascades[i].matrix,t),n[0===i?\"u_light_matrix_0\":\"u_light_matrix_1\"]=Float32Array.from(a),r.activeTexture.set(s.TEXTURE0+fo.ShadowMap0+i),this._cascades[i].texture.bind(s.NEAREST,s.CLAMP_TO_EDGE);if(this.useNormalOffset=o,o){const e=5;n.u_shadow_normal_offset=[1,e,e],n.u_shadow_bias=[6e-5,.0012,.012];}else n.u_shadow_bias=[36e-5,.0012,.012];i.setShadowUniformValues(r,n);}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(t,i,o,r){if(r[2]>=0)return {};const s=function(t,i,o){const r=o/(1<<t.canonical.z);return new e.bV([t.canonical.x*r+t.wrap*o,t.canonical.y*r+t.wrap*o,0],[(t.canonical.x+1)*r+t.wrap*o,(t.canonical.y+1)*r+t.wrap*o,i])}(t,i,o).getCorners(),n=i/-r[2];r[0]<0?(e.Q.add(s[0],s[0],[r[0]*n,0,0]),e.Q.add(s[3],s[3],[r[0]*n,0,0])):r[0]>0&&(e.Q.add(s[1],s[1],[r[0]*n,0,0]),e.Q.add(s[2],s[2],[r[0]*n,0,0])),r[1]<0?(e.Q.add(s[0],s[0],[0,r[1]*n,0]),e.Q.add(s[1],s[1],[0,r[1]*n,0])):r[1]>0&&(e.Q.add(s[2],s[2],[0,r[1]*n,0]),e.Q.add(s[3],s[3],[0,r[1]*n,0]));const a={};return a.vertices=s,a.planes=[bo(s[1],s[0],s[4]),bo(s[2],s[1],s[5]),bo(s[3],s[2],s[6]),bo(s[0],s[3],s[7])],a}addShadowReceiver(t,i,o){this._receivers.add(t,e.bV.fromTileIdAndHeight(t,i,o));}getMaxCascadeForTile(e){const t=this._receivers.get(e);return t&&t.lastCascade?t.lastCascade:0}}function bo(t,i,o){const r=e.Q.sub([],o,i),s=e.Q.sub([],t,i),n=e.Q.cross([],r,s),a=e.Q.length(n);return 0===a?[0,0,1,0]:(e.Q.scale(n,n,1/a),[n[0],n[1],n[2],-e.Q.dot(n,i)])}function wo(t){const i=t.properties.get(\"direction\"),o=e.bT(i.x,i.y,i.z);o[2]=e.ad(o[2],0,75);const r=e.bW([o[0],o[1],o[2]]);return e.Q.fromValues(r.x,r.y,r.z)}function To(t,i){const o=t.properties.get(\"color\"),r=t.properties.get(\"intensity\"),s=t.properties.get(\"direction\"),n=[s.x,s.y,s.z],a=i.properties.get(\"color\"),l=i.properties.get(\"intensity\"),c=Math.max(e.Q.dot([0,0,1],n),0),h=[0,0,0];e.Q.scale(h,a.toArray01Linear().slice(0,3),l);const u=[0,0,0];return e.Q.scale(u,o.toArray01Linear().slice(0,3),c*r),e.bX([h[0]>0?h[0]/(h[0]+u[0]):0,h[1]>0?h[1]/(h[1]+u[1]):0,h[2]>0?h[2]/(h[2]+u[2]):0])}function Eo(t,i,o,r,s,n){const a=t.zoom,l=t.scale,c=t.worldSize,h=1/c,u=t.aspect,d=Math.sqrt(1+u*u)*Math.tan(.5*t.fovX),_=d*d,p=r-o,f=r+o;let m,g;_>p/f?(m=r,g=r*d):(m=.5*f*(1+_),g=.5*Math.sqrt(p*p+2*(r*r+o*o)*_+f*f*_*_));const v=t.projection.pixelsPerMeter(t.center.lat,c),x=t._camera.getCameraToWorldMercator(),y=[0,0,-m*h];e.Q.transformMat4(y,y,x);let b=g*h;const w=t._edgeInsets;if(!(0===w.left&&0===w.top&&0===w.right&&0===w.bottom||w.left===w.right&&w.top===w.bottom)){const i=t._camera.getWorldToCamera(t.worldSize,\"meters\"===t.projection.zAxisUnit?v:1),s=t._camera.getCameraToClipPerspective(t._fov,t.width/t.height,o,r);s[8]=2*-t.centerOffset.x/t.width,s[9]=2*t.centerOffset.y/t.height;const n=new Float64Array(16);e.a9.mul(n,s,i);const h=new Float64Array(16);e.a9.invert(h,n);const u=e.bt.fromInvProjectionMatrix(h,c,a,!0);for(const i of u.points){const o=((T=i)[0]/=l,T[1]/=l,T[2]=e.bo(T[2],t._center.lat),T);b=Math.max(b,e.Q.len(e.Q.subtract([],y,o)));}}var T;b*=s/(s-1);const E=Math.acos(i[2]),S=Math.atan2(-i[0],-i[1]),C=new ho;C.position=y,C.setPitchBearing(E,S);const I=C.getWorldToCamera(c,v),D=b*c,R=Math.min(t._mercatorZfromZoom(17)*c*-2,-2*D),A=C.getCameraToClipOrthographic(-D,D,-D,D,R,(D+n*v)/i[2]),P=new Float64Array(16);e.a9.multiply(P,A,I);const L=e.Q.fromValues(Math.floor(1e6*y[0])/1e6*c,Math.floor(1e6*y[1])/1e6*c,0),M=.5*s,z=[0,0,0];e.Q.transformMat4(z,L,P),e.Q.scale(z,z,M);const O=[Math.floor(z[0]),Math.floor(z[1]),Math.floor(z[2])],F=[0,0,0];e.Q.sub(F,z,O),e.Q.scale(F,F,-1/M);const B=new Float64Array(16);return e.a9.identity(B),e.a9.translate(B,B,F),e.a9.multiply(P,B,P),[P,D]}const So=(e,t)=>ne(e,t&&t.filter((e=>\"source.canvas\"!==e.identifier))),Co=e.af(ti,[\"addLayer\",\"removeLayer\",\"setLights\",\"setPaintProperty\",\"setLayoutProperty\",\"setSlot\",\"setFilter\",\"addSource\",\"removeSource\",\"setLayerZoomRange\",\"setLight\",\"setTransition\",\"setGeoJSONSourceData\",\"setTerrain\",\"setFog\",\"setProjection\",\"setCamera\",\"addImport\",\"removeImport\",\"updateImport\"]),Io=e.af(ti,[\"setCenter\",\"setZoom\",\"setBearing\",\"setPitch\"]),Do={version:8,layers:[],sources:{}},Ro={duration:300,delay:0};class Ao extends e.E{constructor(t,i={}){super(),this.map=t,this.scope=i.scope||\"\",this.globalId=null,this.fragments=[],this.importDepth=i.importDepth||0,this.importsCache=i.importsCache||new Map,this.resolvedImports=i.resolvedImports||new Set,this.transition=e.e({},Ro),this._buildingIndex=new Jt(this),this.crossTileSymbolIndex=new ro,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=i.styleChanges||new v,this.dispatcher=i.dispatcher?i.dispatcher:new e.bZ(e.b_(),this),i.imageManager?this.imageManager=i.imageManager:(this.imageManager=new w,this.imageManager.setEventedParent(this)),this.imageManager.createScope(this.scope),this.glyphManager=i.glyphManager?i.glyphManager:new e.b$(t._requestManager,i.localFontFamily?e.c0.all:i.localIdeographFontFamily?e.c0.ideographs:e.c0.none,i.localFontFamily||i.localIdeographFontFamily),i.modelManager?this.modelManager=i.modelManager:(this.modelManager=new x(t._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._order=[],this._markersNeedUpdate=!1,this.options=i.configOptions?i.configOptions:new Map,this._configDependentLayers=i.configDependentLayers?i.configDependentLayers:new Set,this._config=i.config,this._initialConfig=i.initialConfig,this.dispatcher.broadcast(\"setReferrer\",e.c1());const o=this;this._rtlTextPluginCallback=Ao.registerForPluginStateChange((t=>{o.dispatcher.broadcast(\"syncRTLPluginState\",{pluginStatus:t.pluginStatus,pluginURL:t.pluginURL},((t,i)=>{if(e.c2(t),i&&i.every((e=>e)))for(const e in o._sourceCaches){const t=o._sourceCaches[e],i=t.getSource().type;\"vector\"!==i&&\"geojson\"!==i||t.reload();}}));})),this.on(\"data\",(e=>{if(\"source\"!==e.dataType||\"metadata\"!==e.sourceDataType)return;const t=this.getOwnSource(e.sourceId);if(t&&t.vectorLayerIds)for(const e in this._layers){const i=this._layers[e];i.source===t.id&&this._validateLayer(i);}}));}load(e){return e?(\"string\"==typeof e?this.loadURL(e):this.loadJSON(e),this):this}_getGlobalId(t){if(!t)return null;if(\"string\"==typeof t){if(e.c3(t))return t;const i=e.c4(t);if(!i.startsWith(\"http\"))try{return new URL(i,location.href).toString()}catch(e){return i}return i}return `json://${e.c5(JSON.stringify(t))}`}_diffStyle(t,i,o){this.globalId=this._getGlobalId(t);const r=(e,t)=>{try{t(null,this.setState(e,o));}catch(e){t(e,!1);}};if(\"string\"==typeof t){const o=this.map._requestManager.normalizeStyleURL(t),s=this.map._requestManager.transformRequest(o,e.R.Style);e.g(s,((t,o)=>{t?this.fire(new e.a(t)):o&&r(o,i);}));}else \"object\"==typeof t&&r(t,i);}loadURL(t,i={}){this.fire(new e.b(\"dataloading\",{dataType:\"style\"}));const o=\"boolean\"==typeof i.validate?i.validate:!e.c3(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,i.accessToken),this.resolvedImports.add(t);const r=this.importsCache.get(t);if(r)return this._load(r,o);const s=this.map._requestManager.transformRequest(t,e.R.Style);this._request=e.g(s,((i,r)=>{if(this._request=null,i)this.fire(new e.a(i));else if(r)return this.importsCache.set(t,r),this._load(r,o)}));}loadJSON(t,i={}){this.fire(new e.b(\"dataloading\",{dataType:\"style\"})),this.globalId=this._getGlobalId(t),this._request=e.f.frame((()=>{this._request=null,this._load(t,!1!==i.validate);}));}loadEmpty(){this.fire(new e.b(\"dataloading\",{dataType:\"style\"})),this._load(Do,!1);}_loadImports(t,i,o){if(this.importDepth>=4)return e.w(\"Style doesn't support nesting deeper than 5\"),Promise.resolve();const r=[];for(const e of t){const t=this._createFragmentStyle(e),s=new Promise((e=>{t.once(\"style.import.load\",e),t.once(\"error\",e);})).then((()=>this.mergeAll()));if(r.push(s),this.resolvedImports.has(e.url)){t.loadEmpty();continue}const n=e.data||this.importsCache.get(e.url);n?(t.loadJSON(n,{validate:i}),this._isInternalStyle(n)&&(t.globalId=null)):e.url?t.loadURL(e.url,{validate:i}):t.loadEmpty();const a={style:t,id:e.id,config:e.config};if(o){const e=this.fragments.findIndex((({id:e})=>e===o));this.fragments=this.fragments.slice(0,e).concat(a).concat(this.fragments.slice(e));}else this.fragments.push(a);}return Promise.allSettled(r)}getImportGlobalIds(e=this,t=new Set){for(const i of e.fragments)i.style.globalId&&t.add(i.style.globalId),this.getImportGlobalIds(i.style,t);return [...t.values()]}_createFragmentStyle(t){const i=this.scope?e.aj(t.id,this.scope):t.id;let o;const r=this._initialConfig&&this._initialConfig[i];(t.config||r)&&(o=e.e({},t.config,r));const s=new Ao(this.map,{scope:i,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:o,configOptions:this.options,configDependentLayers:this._configDependentLayers});return s.setEventedParent(this.map,{style:s}),s}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast(\"setLayers\",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.isRootStyle();}_isInternalStyle(e){return this.isRootStyle()&&(e.fragment||!!e.schema&&!1!==e.fragment)}_load(t,i){const o=t.schema;if(this._isInternalStyle(t)){const o=e.e({},Do,{imports:[{id:\"basemap\",data:t,url:\"\"}]});return void this._load(o,i)}if(this.updateConfig(this._config,o),i&&So(this,Q(t)))return;this._loaded=!0,this.stylesheet=e.c6(t);for(const e in t.sources)this.addSource(e,t.sources[e],{validate:!1,isInitialLoad:!0});t.sprite?this._loadSprite(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast(\"spriteLoaded\",{scope:this.scope,isLoaded:!0})),this.glyphManager.setURL(t.glyphs,this.scope);const r=ei(this.stylesheet.layers);if(this._order=r.map((e=>e.id)),this.stylesheet.light&&e.w(\"The `light` root property is deprecated, prefer using `lights` with `flat` light type instead.\"),this.stylesheet.lights)if(1===this.stylesheet.lights.length&&\"flat\"===this.stylesheet.lights[0].type){const e=this.stylesheet.lights[0];this.light=new le(e.properties,e.id);}else this.setLights(this.stylesheet.lights);this.light||(this.light=new le(this.stylesheet.light)),this._layers={},this._serializedLayers={};for(const t of r){const i=e.c7(t,this.scope,this.options);i.isConfigDependent&&this._configDependentLayers.add(i.fqid),i.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=i,this._serializedLayers[i.id]=i.serialize();const o=this.getOwnLayerSourceCache(i),r=!!this.directionalLight&&this.directionalLight.shadowsEnabled();o&&i.canCastShadows()&&r&&(o.castsShadows=!0);}this.stylesheet.models&&this.modelManager.addModels(this.stylesheet.models,this.scope);const s=this.stylesheet.terrain;s&&(void 0===this.disableElevatedTerrain&&(this.disableElevatedTerrain=e.f.hasCanvasFingerprintNoise()),this.disableElevatedTerrain?e.w(\"Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode).\"):this.terrainSetForDrapingOnly()||this._createTerrain(s,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new e.b(\"data\",{dataType:\"style\"}));const n=this.isRootStyle();t.imports?this._loadImports(t.imports,i).then((()=>{this._reloadImports(),this.fire(new e.b(n?\"style.load\":\"style.import.load\"));})):(this._reloadImports(),this.fire(new e.b(n?\"style.load\":\"style.import.load\")));}isRootStyle(){return 0===this.importDepth}mergeAll(){let t,i,o,r,s,n,a,l;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle((e=>{if(e.stylesheet){if(null!=e.light&&(t=e.light),e.stylesheet.lights)for(const t of e.stylesheet.lights)\"ambient\"===t.type&&null!=e.ambientLight&&(i=e.ambientLight),\"directional\"===t.type&&null!=e.directionalLight&&(o=e.directionalLight);r=this._prioritizeTerrain(r,e.terrain,e.stylesheet.terrain),e.stylesheet.fog&&null!=e.fog&&(s=e.fog),null!=e.stylesheet.camera&&(l=e.stylesheet.camera),null!=e.stylesheet.projection&&(n=e.stylesheet.projection),null!=e.stylesheet.transition&&(a=e.stylesheet.transition);}})),this.light=t,this.ambientLight=i,this.directionalLight=o,this.fog=s,null===r?delete this.terrain:this.terrain=r,this.camera=l||{\"camera-projection\":\"perspective\"},this.projection=n||{name:\"mercator\"},this.transition=e.e({},Ro,a),this.mergeSources(),this.mergeLayers();}forEachFragmentStyle(e){const t=i=>{for(const e of i.fragments)t(e.style);e(i);};t(this);}_prioritizeTerrain(e,t,i){const o=e&&0===e.drapeRenderMode;return null===i?t&&0===t.drapeRenderMode?t:o?e:null:null!=t&&(!e||o||t&&1===t.drapeRenderMode)?t:e}mergeTerrain(){let e;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle((t=>{e=this._prioritizeTerrain(e,t.terrain,t.stylesheet.terrain);})),null===e?delete this.terrain:this.terrain=e;}mergeProjection(){let e;this.forEachFragmentStyle((t=>{null!=t.stylesheet.projection&&(e=t.stylesheet.projection);})),this.projection=e||{name:\"mercator\"};}mergeSources(){const t={},i={},o={};this.forEachFragmentStyle((r=>{for(const i in r._sourceCaches){const o=e.aj(i,r.scope);t[o]=r._sourceCaches[i];}for(const t in r._otherSourceCaches){const o=e.aj(t,r.scope);i[o]=r._otherSourceCaches[t];}for(const t in r._symbolSourceCaches){const i=e.aj(t,r.scope);o[i]=r._symbolSourceCaches[t];}})),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=i,this._mergedSymbolSourceCaches=o;}mergeLayers(){const t={},i=[],o={};this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle((o=>{for(const r of o._order){const s=o._layers[r];if(\"slot\"===s.type){const i=e.c8(r);if(t[i])continue;t[i]=[];}s.slot&&t[s.slot]?t[s.slot].push(s):i.push(s);}})),this._mergedOrder=[];const r=(i=[])=>{for(const s of i)if(\"slot\"===s.type){const i=e.c8(s.id);t[i]&&r(t[i]);}else {const t=e.aj(s.id,s.scope);this._mergedOrder.push(t),o[t]=s,s.is3D()&&(this._has3DLayers=!0),\"circle\"===s.type&&(this._hasCircleLayers=!0),\"symbol\"===s.type&&(this._hasSymbolLayers=!0);}};r(i),this._mergedLayers=o,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged();}terrainSetForDrapingOnly(){return !!this.terrain&&0===this.terrain.drapeRenderMode}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=e.e({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}setProjection(e){e?this.stylesheet.projection=e:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection();}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast(\"setProjection\",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0));}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection));}_loadSprite(t){this._spriteRequest=function(t,i,o){let r,s,n;const a=e.f.devicePixelRatio>1?\"@2x\":\"\";let l=e.g(i.transformRequest(i.normalizeSpriteURL(t,a,\".json\"),e.R.SpriteJSON),((e,t)=>{l=null,n||(n=e,r=t,h());})),c=e.d(i.transformRequest(i.normalizeSpriteURL(t,a,\".png\"),e.R.SpriteImage),((e,t)=>{c=null,n||(n=e,s=t,h());}));function h(){if(n)o(n);else if(r&&s){const t=e.f.getImageData(s),i={};for(const o in r){const{width:s,height:n,x:a,y:l,sdf:c,pixelRatio:h,stretchX:u,stretchY:d,content:_}=r[o],p=new e.h({width:s,height:n});e.h.copy(t,p,{x:a,y:l},{x:0,y:0},{width:s,height:n}),i[o]={data:p,pixelRatio:h,sdf:c,stretchX:u,stretchY:d,content:_};}o(null,i);}}return {cancel(){l&&(l.cancel(),l=null),c&&(c.cancel(),c=null);}}}(t,this.map._requestManager,((t,i)=>{if(this._spriteRequest=null,t)this.fire(new e.a(t));else if(i)for(const e in i)this.imageManager.addImage(e,this.scope,i[e]);this.imageManager.setLoaded(!0,this.scope),this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast(\"setImages\",{scope:this.scope,images:this._availableImages}),this.dispatcher.broadcast(\"spriteLoaded\",{scope:this.scope,isLoaded:!0}),this.fire(new e.b(\"data\",{dataType:\"style\"}));}));}_validateLayer(t){const i=this.getOwnSource(t.source);if(!i)return;const o=t.sourceLayer;o&&(\"geojson\"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(o))&&this.fire(new e.a(new Error(`Source layer \"${o}\" does not exist on source \"${i.id}\" as specified by style layer \"${t.id}\"`)));}loaded(){if(!this._loaded)return !1;if(Object.keys(this._changes.getUpdatedSourceCaches()).length)return !1;for(const e in this._sourceCaches)if(!this._sourceCaches[e].loaded())return !1;if(!this.imageManager.isLoaded())return !1;if(!this.modelManager.isLoaded())return !1;for(const{style:e}of this.fragments)if(!e.loaded())return !1;return !0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map(((e,t)=>{const i=this.fragments[t];return i&&i.style&&(e.data=i.style.serialize()),e}))}_serializeSources(){const e={};for(const t in this._sourceCaches){const i=this._sourceCaches[t].getSource();e[i.id]||(e[i.id]=i.serialize());}return e}_serializeLayers(e){const t=[];for(const i of e){const e=this._layers[i];e&&\"custom\"!==e.type&&t.push(e.serialize());}return t}hasLightTransitions(){return !(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return !!this.fog&&this.fog.hasTransition()}hasTransitions(){if(this.hasLightTransitions())return !0;if(this.hasFogTransition())return !0;for(const e in this._sourceCaches)if(this._sourceCaches[e].hasTransition())return !0;for(const e in this._layers)if(this._layers[e].hasTransition())return !0;return !1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}isLayerDraped(e){return !!this.terrain&&e.isDraped(this.getLayerSourceCache(e))}_checkLoaded(){if(!this._loaded)throw new Error(\"Style is not done loading\")}_checkLayer(t){const i=this.getOwnLayer(t);if(i)return i;this.fire(new e.a(new Error(`The layer '${t}' does not exist in the map's style.`)));}_checkSource(t){const i=this.getOwnSource(t);if(i)return i;this.fire(new e.a(new Error(`The source '${t}' does not exist in the map's style.`)));}update(t){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(t),this.directionalLight&&this.directionalLight.recalculate(t);const i=this.calculateLightsBrightness();t.brightness=i||0,i!==this._brightness&&(this._brightness=i,this.dispatcher.broadcast(\"setBrightness\",i));const o=this._changes.isDirty();if(this._changes.isDirty()){const e=this._changes.getLayerUpdatesByScope();for(const t in e){const{updatedIds:i,removedIds:o}=e[t];(i||o)&&this._updateWorkerLayers(t,i,o);}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(t),this.light&&this.light.updateTransitions(t),this.ambientLight&&this.ambientLight.updateTransitions(t),this.directionalLight&&this.directionalLight.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this._changes.reset();}const r={};for(const e in this._mergedSourceCaches){const t=this._mergedSourceCaches[e];r[e]=t.used,t.used=!1,t.tileCoverLift=0;}for(const e of this._mergedOrder){const i=this._mergedLayers[e];if(i.recalculate(t,this._availableImages),!i.isHidden(t.zoom)){const e=this.getLayerSourceCache(i);e&&(e.used=!0,e.tileCoverLift=Math.max(e.tileCoverLift,i.tileCoverLift()));}if(!this._precompileDone&&this._shouldPrecompile)for(let e=i.minzoom||0;e<(i.maxzoom||25.5);e++){const e=this.map.painter;if(e){const o=i.getProgramIds();if(!o)continue;for(const r of o){const o=i.getDefaultProgramParams(r,t.zoom);o&&(e.style=this,this.fog&&(e._fogVisible=!0,o.overrideFog=!0,e.getOrCreateProgram(r,o)),e._fogVisible=!1,o.overrideFog=!1,e.getOrCreateProgram(r,o),(this.stylesheet.terrain||this.stylesheet.projection&&\"globe\"===this.stylesheet.projection.name)&&(o.overrideRtt=!0,e.getOrCreateProgram(r,o)));}}}}this._shouldPrecompile&&(this._precompileDone=!0);for(const t in r){const i=this._mergedSourceCaches[t];r[t]!==i.used&&i.getSource().fire(new e.b(\"data\",{sourceDataType:\"visibility\",dataType:\"source\",sourceId:i.getSource().id}));}this.light&&this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),o&&this.fire(new e.b(\"data\",{dataType:\"style\"}));}_updateTilesForChangedImages(){const e=this._changes.getUpdatedImages();if(e.length){for(const t in this._sourceCaches)this._sourceCaches[t].reloadTilesForDependencies([\"icons\",\"patterns\"],e);this._changes.resetUpdatedImages();}}_updateWorkerLayers(e,t,i){const o=this.getFragmentStyle(e);o&&this.dispatcher.broadcast(\"updateLayers\",{layers:t?o._serializeLayers(t):[],scope:e,removedIds:i||[],options:o.options});}setState(i,o){if(this._checkLoaded(),So(this,Q(i)))return !1;(i=e.c6(i)).layers=ei(i.layers);const r=function(e,i){if(!e)return [{command:ti.setStyle,args:[i]}];let o=[];try{if(!t(e.version,i.version))return [{command:ti.setStyle,args:[i]}];t(e.center,i.center)||o.push({command:ti.setCenter,args:[i.center]}),t(e.zoom,i.zoom)||o.push({command:ti.setZoom,args:[i.zoom]}),t(e.bearing,i.bearing)||o.push({command:ti.setBearing,args:[i.bearing]}),t(e.pitch,i.pitch)||o.push({command:ti.setPitch,args:[i.pitch]}),t(e.sprite,i.sprite)||o.push({command:ti.setSprite,args:[i.sprite]}),t(e.glyphs,i.glyphs)||o.push({command:ti.setGlyphs,args:[i.glyphs]}),t(e.imports,i.imports)||function(e=[],i=[],o){i=i||[];const r=(e=e||[]).map(ai),s=i.map(ai),n=e.reduce(li,{}),a=i.reduce(li,{}),l=r.slice();let c,h,u,d;for(c=0,h=0;c<r.length;c++)u=r[c],a.hasOwnProperty(u)?h++:(o.push({command:ti.removeImport,args:[u]}),l.splice(l.indexOf(u,h),1));for(c=0,h=0;c<s.length;c++)u=s[s.length-1-c],l[l.length-1-c]!==u&&(n.hasOwnProperty(u)?(o.push({command:ti.removeImport,args:[u]}),l.splice(l.lastIndexOf(u,l.length-h),1)):h++,d=l[l.length-c],o.push({command:ti.addImport,args:[a[u],d]}),l.splice(l.length-c,0,u));for(const e of i){const i=n[e.id];i&&!t(i,e)&&o.push({command:ti.updateImport,args:[e.id,e]});}}(e.imports,i.imports,o),t(e.transition,i.transition)||o.push({command:ti.setTransition,args:[i.transition]}),t(e.light,i.light)||o.push({command:ti.setLight,args:[i.light]}),t(e.fog,i.fog)||o.push({command:ti.setFog,args:[i.fog]}),t(e.projection,i.projection)||o.push({command:ti.setProjection,args:[i.projection]}),t(e.lights,i.lights)||o.push({command:ti.setLights,args:[i.lights]}),t(e.camera,i.camera)||o.push({command:ti.setCamera,args:[i.camera]});const r={},s=[];!function(e,i,o,r){let s;for(s in i=i||{},e=e||{})e.hasOwnProperty(s)&&(i.hasOwnProperty(s)||oi(s,o,r));for(s in i){if(!i.hasOwnProperty(s))continue;const n=i[s];e.hasOwnProperty(s)?t(e[s],n)||(\"geojson\"===e[s].type&&\"geojson\"===n.type&&si(e,i,s)?o.push({command:ti.setGeoJSONSourceData,args:[s,n.data]}):ri(s,i,o,r)):ii(s,i,o);}}(e.sources,i.sources,s,r);const n=[];e.layers&&e.layers.forEach((e=>{e.source&&r[e.source]?o.push({command:ti.removeLayer,args:[e.id]}):n.push(e);}));let a=e.terrain;a&&r[a.source]&&(o.push({command:ti.setTerrain,args:[void 0]}),a=void 0),o=o.concat(s),t(a,i.terrain)||o.push({command:ti.setTerrain,args:[i.terrain]}),function(e,i,o){i=i||[];const r=(e=e||[]).map(ai),s=i.map(ai),n=e.reduce(li,{}),a=i.reduce(li,{}),l=r.slice(),c=Object.create(null);let h,u,d,_,p,f,m;for(h=0,u=0;h<r.length;h++)d=r[h],a.hasOwnProperty(d)?u++:(o.push({command:ti.removeLayer,args:[d]}),l.splice(l.indexOf(d,u),1));for(h=0,u=0;h<s.length;h++)d=s[s.length-1-h],l[l.length-1-h]!==d&&(n.hasOwnProperty(d)?(o.push({command:ti.removeLayer,args:[d]}),l.splice(l.lastIndexOf(d,l.length-u),1)):u++,f=l[l.length-h],o.push({command:ti.addLayer,args:[a[d],f]}),l.splice(l.length-h,0,d),c[d]=!0);for(h=0;h<s.length;h++)if(d=s[h],_=n[d],p=a[d],!c[d]&&!t(_,p))if(t(_.source,p.source)&&t(_[\"source-layer\"],p[\"source-layer\"])&&t(_.type,p.type)){for(m in ni(_.layout,p.layout,o,d,null,ti.setLayoutProperty),ni(_.paint,p.paint,o,d,null,ti.setPaintProperty),t(_.slot,p.slot)||o.push({command:ti.setSlot,args:[d,p.slot]}),t(_.filter,p.filter)||o.push({command:ti.setFilter,args:[d,p.filter]}),t(_.minzoom,p.minzoom)&&t(_.maxzoom,p.maxzoom)||o.push({command:ti.setLayerZoomRange,args:[d,p.minzoom,p.maxzoom]}),_)_.hasOwnProperty(m)&&\"layout\"!==m&&\"paint\"!==m&&\"filter\"!==m&&\"metadata\"!==m&&\"minzoom\"!==m&&\"maxzoom\"!==m&&\"slot\"!==m&&(0===m.indexOf(\"paint.\")?ni(_[m],p[m],o,d,m.slice(6),ti.setPaintProperty):t(_[m],p[m])||o.push({command:ti.setLayerProperty,args:[d,m,p[m]]}));for(m in p)p.hasOwnProperty(m)&&!_.hasOwnProperty(m)&&\"layout\"!==m&&\"paint\"!==m&&\"filter\"!==m&&\"metadata\"!==m&&\"minzoom\"!==m&&\"maxzoom\"!==m&&\"slot\"!==m&&(0===m.indexOf(\"paint.\")?ni(_[m],p[m],o,d,m.slice(6),ti.setPaintProperty):t(_[m],p[m])||o.push({command:ti.setLayerProperty,args:[d,m,p[m]]}));}else o.push({command:ti.removeLayer,args:[d]}),f=l[l.lastIndexOf(d)+1],o.push({command:ti.addLayer,args:[p,f]});}(n,i.layers,o);}catch(e){console.warn(\"Unable to compute style diff:\",e),o=[{command:ti.setStyle,args:[i]}];}return o}(this.serialize(),i).filter((e=>!(e.command in Io)));if(0===r.length)return !1;const s=r.filter((e=>!(e.command in Co)));if(s.length>0)throw new Error(`Unimplemented: ${s.map((e=>e.command)).join(\", \")}.`);const n=[];return r.forEach((e=>{n.push(this[e.command].apply(this,e.args));})),o&&Promise.all(n).then(o),this.stylesheet=i,this.mergeAll(),this.dispatcher.broadcast(\"setLayers\",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}addImage(t,i){return this.getImage(t)?this.fire(new e.a(new Error(\"An image with this name already exists.\"))):(this.imageManager.addImage(t,this.scope,i),this._afterImageUpdated(t),this)}updateImage(e,t){this.imageManager.updateImage(e,this.scope,t);}getImage(e){return this.imageManager.getImage(e,this.scope)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t,this.scope),this._afterImageUpdated(t),this):this.fire(new e.a(new Error(\"No image with this name exists.\")))}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(this.scope),this._changes.updateImage(t),this.dispatcher.broadcast(\"setImages\",{scope:this.scope,images:this._availableImages}),this.fire(new e.b(\"data\",{dataType:\"style\"}));}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModel(e,t,i={}){return this._checkLoaded(),this._validate(re,`models.${e}`,t,null,i)||(this.modelManager.addModel(e,t,this.scope),this._changes.setDirty()),this}hasModel(e){return this.modelManager.hasModel(e,this.scope)}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.scope),this):this.fire(new e.a(new Error(\"No model with this ID exists.\")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(t,i,o={}){if(this._checkLoaded(),void 0!==this.getOwnSource(t))throw new Error(`There is already a source with ID \"${t}\".`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(\", \")}.`);if([\"vector\",\"raster\",\"geojson\",\"video\",\"image\"].indexOf(i.type)>=0&&this._validate($,`sources.${t}`,i,null,o))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const r=Gt(t,i,this.dispatcher,this);r.scope=this.scope,r.setEventedParent(this,(()=>({isSourceLoaded:this._isSourceCacheLoaded(r.id),source:r.serialize(),sourceId:r.id})));const s=t=>{const i=(t?\"symbol:\":\"other:\")+r.id,o=e.aj(i,this.scope),s=this._sourceCaches[i]=new Qt(o,r,t);(t?this._symbolSourceCaches:this._otherSourceCaches)[r.id]=s,s.onAdd(this.map);};s(!1),\"vector\"!==i.type&&\"geojson\"!==i.type||s(!0),r.onAdd&&r.onAdd(this.map),o.isInitialLoad||(this.mergeSources(),this._changes.setDirty());}removeSource(t){this._checkLoaded();const i=this.getOwnSource(t);if(!i)throw new Error(\"There is no source with this ID\");for(const i in this._layers)if(this._layers[i].source===t)return this.fire(new e.a(new Error(`Source \"${t}\" cannot be removed while layer \"${i}\" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===t)return this.fire(new e.a(new Error(`Source \"${t}\" cannot be removed while terrain is using it.`)));const o=this.getOwnSourceCaches(t);for(const t of o){const i=e.c8(t.id);delete this._sourceCaches[i],this._changes.discardSourceCacheUpdate(t.id),t.fire(new e.b(\"data\",{sourceDataType:\"metadata\",dataType:\"source\",sourceId:t.getSource().id})),t.setEventedParent(null),t.clearTiles();}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],this.mergeSources(),i.setEventedParent(null),i.onRemove&&i.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(e,t){this._checkLoaded(),this.getOwnSource(e).setData(t),this._changes.setDirty();}getOwnSource(e){const t=this.getOwnSourceCache(e);return t&&t.getSource()}getOwnSources(){const e=[];for(const t in this._otherSourceCaches){const i=this.getOwnSourceCache(t);i&&e.push(i.getSource());}return e}areTilesLoaded(){const e=this._mergedSourceCaches;for(const t in e){const i=e[t]._tiles;for(const e in i){const t=i[e];if(\"loaded\"!==t.state&&\"errored\"!==t.state)return !1}}return !0}setLights(t){if(this._checkLoaded(),!t)return delete this.ambientLight,void delete this.directionalLight;const i=this._getTransitionParameters();for(const e of t){if(this._validate(Y,\"lights\",e))return;switch(e.type){case\"ambient\":if(this.ambientLight){const t=this.ambientLight;t.set(e),t.updateTransitions(i);}else this.ambientLight=new ye(e,be,this.scope,this.options);break;case\"directional\":if(this.directionalLight){const t=this.directionalLight;t.set(e),t.updateTransitions(i);}else this.directionalLight=new ye(e,we,this.scope,this.options);}}const o=new e.N(this.z||0,i);this.ambientLight&&this.ambientLight.recalculate(o),this.directionalLight&&this.directionalLight.recalculate(o),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast(\"setBrightness\",this._brightness);}calculateLightsBrightness(){const t=this.directionalLight,i=this.ambientLight;if(!t||!i)return;const o=e=>.2126*(e[0]<=.03928?e[0]/12.92:Math.pow((e[0]+.055)/1.055,2.4))+.7152*(e[1]<=.03928?e[1]/12.92:Math.pow((e[1]+.055)/1.055,2.4))+.0722*(e[2]<=.03928?e[2]/12.92:Math.pow((e[2]+.055)/1.055,2.4)),r=t.properties.get(\"color\").toArray01(),s=t.properties.get(\"intensity\"),n=t.properties.get(\"direction\"),a=1-e.bT(n.x,n.y,n.z)[2]/90,l=o(r)*s*a,c=i.properties.get(\"color\").toArray01(),h=i.properties.get(\"intensity\");return (l+o(c)*h)/2}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const e=[];return this.directionalLight&&e.push(this.directionalLight.get()),this.ambientLight&&e.push(this.ambientLight.get()),e}enable3dLights(){return !!this.ambientLight&&!!this.directionalLight}getFragmentStyle(t){if(!t)return this;if(e.c9(t)){const i=e.ca(t),o=this.fragments.find((({id:e})=>e===i));if(!o)throw new Error(`Style import not found: ${t}`);const r=e.c8(t);return o.style.getFragmentStyle(r)}{const e=this.fragments.find((({id:e})=>e===t));if(!e)throw new Error(`Style import not found: ${t}`);return e.style}}getConfigProperty(t,i){const o=this.getFragmentStyle(t);if(!o)return null;const r=e.aj(i,o.scope),s=o.options.get(r),n=s?s.value||s.default:null;return n?n.serialize():null}setConfigProperty(t,i,o){const r=this.getFragmentStyle(t);if(!r)return;const s=r.stylesheet.schema;if(!s||!s[i])return;const n=e.t(o);if(\"success\"!==n.result)return void So(this,n.value);const a=n.value.expression,l=e.aj(i,r.scope),c=r.options.get(l);if(!c)return;let h;const{minValue:u,maxValue:d,stepValue:_,type:p,values:f}=s[i],m=e.t(s[i].default);\"success\"===m.result&&(h=m.value.expression),h?(this.options.set(l,{...c,value:a,default:h,minValue:u,maxValue:d,stepValue:_,type:p,values:f}),this.updateConfigDependencies()):this.fire(new e.a(new Error(`No schema defined for the config option \"${i}\" in the \"${t}\" fragment.`)));}getConfig(t){const i=this.getFragmentStyle(t);if(!i)return null;const o=i.stylesheet.schema;if(!o)return null;const r={};for(const t in o){const o=e.aj(t,i.scope),s=i.options.get(o),n=s?s.value||s.default:null;r[t]=n?n.serialize():null;}return r}setConfig(e,t){const i=this.getFragmentStyle(e);i&&(i.updateConfig(t,i.stylesheet.schema),this.updateConfigDependencies());}getSchema(e){const t=this.getFragmentStyle(e);return t?t.stylesheet.schema:null}setSchema(e,t){const i=this.getFragmentStyle(e);i&&(i.stylesheet.schema=t,i.updateConfig(i._config,t),this.updateConfigDependencies());}updateConfig(t,i){if(this._config=t,t||i)if(i)for(const o in i){let r,s;const n=e.t(i[o].default);if(\"success\"===n.result&&(r=n.value.expression),t&&void 0!==t[o]){const i=e.t(t[o]);\"success\"===i.result&&(s=i.value.expression);}const{minValue:a,maxValue:l,stepValue:c,type:h,values:u}=i[o];if(r){const t=e.aj(o,this.scope);this.options.set(t,{default:r,value:s,minValue:a,maxValue:l,stepValue:c,type:h,values:u});}else this.fire(new e.a(new Error(`No schema defined for config option \"${o}\".`)));}else this.fire(new e.a(new Error(\"Attempting to set config for a style without schema.\")));}updateConfigDependencies(){for(const e of this._configDependentLayers){const t=this.getLayer(e);t&&(t.possiblyEvaluateVisibility(),this._updateLayer(t));}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this._changes.setDirty();}addLayer(t,i,o={}){this._checkLoaded();const r=t.id;if(this._layers[r])return void this.fire(new e.a(new Error(`Layer with id \"${r}\" already exists on this map`)));let s;if(\"custom\"===t.type){if(So(this,e.cb(t)))return;s=e.c7(t,this.scope,this.options);}else {if(\"object\"==typeof t.source&&(this.addSource(r,t.source),t=e.c6(t),t=e.e(t,{source:r})),this._validate(ee,`layers.${r}`,t,{arrayIndex:-1},o))return;s=e.c7(t,this.scope,this.options),this._validateLayer(s),s.setEventedParent(this,{layer:{id:r}}),this._serializedLayers[s.id]=s.serialize();}s.isConfigDependent&&this._configDependentLayers.add(s.fqid);let n=this._order.length;if(i){const t=this._order.indexOf(i);if(-1===t)return void this.fire(new e.a(new Error(`Layer with id \"${i}\" does not exist on this map.`)));s.slot===this._layers[i].slot?n=t:e.w(`Layer with id \"${i}\" has a different slot. Layers can only be rearranged within the same slot.`);}this._order.splice(n,0,r),this._layerOrderChanged=!0,this._layers[r]=s;const a=this.getOwnLayerSourceCache(s),l=!!this.directionalLight&&this.directionalLight.shadowsEnabled();a&&s.canCastShadows()&&l&&(a.castsShadows=!0);const c=this._changes.getRemovedLayer(s);if(c&&s.source&&a&&\"custom\"!==s.type){this._changes.discardLayerRemoval(s);const t=e.aj(s.source,s.scope);c.type!==s.type?this._changes.updateSourceCache(t,\"clear\"):(this._changes.updateSourceCache(t,\"reload\"),a.pause());}this._updateLayer(s),s.onAdd&&s.onAdd(this.map),s.scope=this.scope,this.mergeLayers();}moveLayer(t,i){this._checkLoaded();const o=this._checkLayer(t);if(!o)return;if(t===i)return;const r=this._order.indexOf(t);this._order.splice(r,1);let s=this._order.length;if(i){const t=this._order.indexOf(i);if(-1===t)return void this.fire(new e.a(new Error(`Layer with id \"${i}\" does not exist on this map.`)));o.slot===this._layers[i].slot?s=t:e.w(`Layer with id \"${i}\" has a different slot. Layers can only be rearranged within the same slot.`);}this._order.splice(s,0,t),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers();}removeLayer(e){this._checkLoaded();const t=this._checkLayer(e);if(!t)return;t.setEventedParent(null);const i=this._order.indexOf(e);this._order.splice(i,1),delete this._layers[e],delete this._serializedLayers[e],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(t.fqid),this._changes.removeLayer(t);const o=this.getOwnLayerSourceCache(t);if(o&&o.castsShadows){let e=!1;for(const i in this._layers)if(this._layers[i].source===t.source&&this._layers[i].canCastShadows()){e=!0;break}o.castsShadows=e;}t.onRemove&&t.onRemove(this.map),this.mergeLayers();}getOwnLayer(e){return this._layers[e]}hasLayer(e){return e in this._mergedLayers}hasLayerType(e){for(const t in this._layers)if(this._layers[t].type===e)return !0;return !1}setLayerZoomRange(e,t,i){this._checkLoaded();const o=this._checkLayer(e);o&&(o.minzoom===t&&o.maxzoom===i||(null!=t&&(o.minzoom=t),null!=i&&(o.maxzoom=i),this._updateLayer(o)));}setSlot(e,t){this._checkLoaded();const i=this._checkLayer(e);i&&i.slot!==t&&(i.slot=t,this._updateLayer(i));}setFilter(i,o,r={}){this._checkLoaded();const s=this._checkLayer(i);if(s&&!t(s.filter,o))return null==o?(s.filter=void 0,void this._updateLayer(s)):void(this._validate(te,`layers.${s.id}.filter`,o,{layerType:s.type},r)||(s.filter=e.c6(o),this._updateLayer(s)))}getFilter(t){const i=this._checkLayer(t);if(i)return e.c6(i.filter)}setLayoutProperty(i,o,r,s={}){this._checkLoaded();const n=this._checkLayer(i);if(n&&!t(n.getLayoutProperty(o),r)){if(null!=r&&(!s||!1!==s.validate)&&So(n,oe.call(Q,{key:`layers.${i}.layout.${o}`,layerType:n.type,objectKey:o,value:r,styleSpec:e.G,style:{glyphs:!0,sprite:!0}})))return;n.setLayoutProperty(o,r),n.isConfigDependent&&this._configDependentLayers.add(n.fqid),this._updateLayer(n);}}getLayoutProperty(e,t){const i=this._checkLayer(e);if(i)return i.getLayoutProperty(t)}setPaintProperty(i,o,r,s={}){this._checkLoaded();const n=this._checkLayer(i);if(!n)return;if(t(n.getPaintProperty(o),r))return;if(null!=r&&(!s||!1!==s.validate)&&So(n,ie.call(Q,{key:`layers.${i}.paint.${o}`,layerType:n.type,objectKey:o,value:r,styleSpec:e.G})))return;const a=n.setPaintProperty(o,r);n.isConfigDependent&&this._configDependentLayers.add(n.fqid),a&&this._updateLayer(n),this._changes.updatePaintProperties(n);}getPaintProperty(e,t){const i=this._checkLayer(e);if(i)return i.getPaintProperty(t)}setFeatureState(t,i){this._checkLoaded();const o=t.source,r=t.sourceLayer,s=this._checkSource(o);if(!s)return;const n=s.type;if(\"geojson\"===n&&r)return void this.fire(new e.a(new Error(\"GeoJSON sources cannot have a sourceLayer parameter.\")));if(\"vector\"===n&&!r)return void this.fire(new e.a(new Error(\"The sourceLayer parameter must be provided for vector source types.\")));void 0===t.id&&this.fire(new e.a(new Error(\"The feature id parameter must be provided.\")));const a=this.getOwnSourceCaches(o);for(const e of a)e.setFeatureState(r,t.id,i);}removeFeatureState(t,i){this._checkLoaded();const o=t.source,r=this._checkSource(o);if(!r)return;const s=r.type,n=\"vector\"===s?t.sourceLayer:void 0;if(\"vector\"===s&&!n)return void this.fire(new e.a(new Error(\"The sourceLayer parameter must be provided for vector source types.\")));if(i&&\"string\"!=typeof t.id&&\"number\"!=typeof t.id)return void this.fire(new e.a(new Error(\"A feature id is required to remove its specific state property.\")));const a=this.getOwnSourceCaches(o);for(const e of a)e.removeFeatureState(n,t.id,i);}getFeatureState(t){this._checkLoaded();const i=t.source,o=t.sourceLayer,r=this._checkSource(i);if(r){if(\"vector\"!==r.type||o)return void 0===t.id&&this.fire(new e.a(new Error(\"The feature id parameter must be provided.\"))),this.getOwnSourceCaches(i)[0].getFeatureState(o,t.id);this.fire(new e.a(new Error(\"The sourceLayer parameter must be provided for vector source types.\")));}}setTransition(t){return this.stylesheet.transition=e.e({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return e.e({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),i=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return e.cc({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:i,fog:this.stylesheet.fog,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},(e=>void 0!==e))}_updateLayer(t){this._changes.updateLayer(t);const i=this.getLayerSourceCache(t),o=e.aj(t.source,t.scope),r=this._changes.getUpdatedSourceCaches();t.source&&!r[o]&&i&&\"raster\"!==i.getSource().type&&(this._changes.updateSourceCache(o,\"reload\"),i.pause()),t.invalidateCompiledFilter();}_flattenAndSortRenderedFeatures(e){const t=e=>\"fill-extrusion\"===this._mergedLayers[e].type||\"model\"===this._mergedLayers[e].type,i=this.order,o={},r=[];for(let s=i.length-1;s>=0;s--){const n=i[s];if(t(n)){o[n]=s;for(const t of e){const e=t[n];if(e)for(const t of e)r.push(t);}}}r.sort(((e,t)=>t.intersectionZ-e.intersectionZ));const s=[];for(let n=i.length-1;n>=0;n--){const a=i[n];if(t(a))for(let e=r.length-1;e>=0;e--){const t=r[e].feature;if(o[t.layer.id]<n)break;s.push(t),r.pop();}else for(const t of e){const e=t[a];if(e)for(const t of e)s.push(t.feature);}}return s}queryRenderedFeatures(t,i,o){i&&i.filter&&this._validate(te,\"queryRenderedFeatures.filter\",i.filter,null,i),i.scope=this.scope,i.availableImages=this._availableImages,i.serializedLayers=this._serializedLayers;const r={};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new e.a(new Error(\"parameters.layers must be an Array.\"))),[];for(const t of i.layers){const i=this._mergedLayers[t];if(!i)return this.fire(new e.a(new Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];r[i.source]=!0;}}const s=[],n=i.serializedLayers||{},a=i&&i.layers?i.layers.some((e=>{const t=this.getLayer(e);return t&&t.is3D()})):this.has3DLayers(),l=Te.createFromScreenPoints(t,o);for(const e in this._mergedSourceCaches){const t=this._mergedSourceCaches[e].getSource();if(!t||t.scope!==i.scope)continue;const c=this._mergedSourceCaches[e].getSource().id;i.layers&&!r[c]||s.push(Vt(this._mergedSourceCaches[e],this._mergedLayers,n,l,i,o,a,!!this.map._showQueryGeometry));}return this.placement&&s.push(function(e,t,i,o,r,s,n){const a={},l=s.queryRenderedSymbols(o),c=[];for(const e of Object.keys(l).map(Number))c.push(n[e]);c.sort(Wt);for(const i of c){const o=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],t,i.bucketIndex,i.sourceLayerIndex,r.filter,r.layers,r.availableImages,e);for(const e in o){const t=a[e]=a[e]||[],r=o[e];r.sort(((e,t)=>{const o=i.featureSortOrder;if(o){const i=o.indexOf(e.featureIndex);return o.indexOf(t.featureIndex)-i}return t.featureIndex-e.featureIndex}));for(const e of r)t.push(e);}}for(const t in a)a[t].forEach((o=>{const r=o.feature,s=i(e[t]);if(!s)return;const n=s.getFeatureState(r.layer[\"source-layer\"],r.id);r.source=r.layer.source,r.layer[\"source-layer\"]&&(r.sourceLayer=r.layer[\"source-layer\"]),r.state=n;}));return a}(this._mergedLayers,n,this.getLayerSourceCache.bind(this),l.screenGeometry,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(s)}querySourceFeatures(e,t){t&&t.filter&&this._validate(te,\"querySourceFeatures.filter\",t.filter,null,t);const i=this.getOwnSourceCaches(e);let o=[];for(const e of i)o=o.concat(Zt(e,t));return o}addSourceType(e,t,i){return Ao.getSourceType(e)?i(new Error(`A source type called \"${e}\" already exists.`)):(Ao.setSourceType(e,t),t.workerSourceURL?void this.dispatcher.broadcast(\"loadWorkerSource\",{name:e,url:t.workerSourceURL},i):i(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(e,i,o={}){this._checkLoaded();const r=this.light.getLight();let s=!1;for(const i in e)if(!t(e[i],r[i])){s=!0;break}if(!s)return;const n=this._getTransitionParameters();this.light.setLight(e,i,o),this.light.updateTransitions(n);}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:\"\",exaggeration:0},0);}setTerrain(i,o=1){if(this._checkLoaded(),!i)return this.terrainSetForDrapingOnly()&&0!==o||delete this.terrain,null===i?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);let r=i;const s=null==i.source;if(1===o){if(\"object\"==typeof r.source){const t=\"terrain-dem-src\";this.addSource(t,r.source),r=e.c6(r),r=e.e(r,{source:t});}const t=e.e({},r),i={};if(this.terrain&&s){t.source=this.terrain.get().source;const e=this.terrain?this.getFragmentStyle(this.terrain.scope):null;e&&(i.style=e.serialize());}if(this._validate(J,\"terrain\",t,i))return}if(!this.terrain||this.terrain.scope!==this.scope&&!s||this.terrain&&o!==this.terrain.drapeRenderMode){if(!r)return;this._createTerrain(r,o),this.fire(new e.b(\"data\",{dataType:\"style\"}));}else {const o=this.terrain,s=o.get();for(const t of Object.keys(e.G.terrain))!r.hasOwnProperty(t)&&e.G.terrain[t].default&&(r[t]=e.G.terrain[t].default);for(const r in i)if(!t(i[r],s[r])){o.set(i,this.options),this.stylesheet.terrain=i;const t=this._getTransitionParameters({duration:0});o.updateTransitions(t),this.fire(new e.b(\"data\",{dataType:\"style\"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0;}_createFog(e){const t=this.fog=new xe(e,this.map.transform,this.scope,this.options);this.stylesheet.fog=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i);}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask((()=>{for(const e of this.map._markers)e._evaluateOpacity();}));}getFog(){return this.fog?this.fog.get():null}setFog(e){if(this._checkLoaded(),!e)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const i=this.fog;if(!t(i.get(),e)){i.set(e,this.options),this.stylesheet.fog=i.get();const t=this._getTransitionParameters({duration:0});i.updateTransitions(t);}}else this._createFog(e);this._markersNeedUpdate=!0;}_getTransitionParameters(t){return {now:e.f.now(),transition:e.e(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const e=[],t=[];for(const i in this._mergedLayers)this.isLayerDraped(this._mergedLayers[i])?e.push(i):t.push(i);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...e),this._drapedFirstOrder.push(...t);}_createTerrain(e,t){const i=this.terrain=new he(e,t,this.scope,this.options);1===t&&(this.stylesheet.terrain=e),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const o=this._getTransitionParameters({duration:0});i.updateTransitions(o);}_force3DLayerUpdate(){for(const e in this._layers){const t=this._layers[e];\"fill-extrusion\"===t.type&&this._updateLayer(t);}}_forceSymbolLayerUpdate(){for(const e in this._layers){const t=this._layers[e];\"symbol\"===t.type&&this._updateLayer(t);}}_validate(t,i,o,r,s={}){if(s&&!1===s.validate)return !1;const n=e.e({},this.serialize());return So(this,t.call(Q,e.e({key:i,style:n,value:o,styleSpec:e.G},r)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.cd.off(\"pluginStateChange\",this._rtlTextPluginCallback);for(const e in this._mergedLayers)this._mergedLayers[e].setEventedParent(null);for(const e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles(),this._mergedSourceCaches[e].setEventedParent(null);this.setEventedParent(null),delete this.fog,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.dispatcher.remove());}clearSource(e){const t=this.getSourceCaches(e);for(const e of t)e.clearTiles();}clearSources(){for(const e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles();}reloadSource(e){const t=this.getSourceCaches(e);for(const e of t)e.resume(),e.reload();}reloadSources(){for(const e of this.getSources())e.reload&&e.reload();}updateSources(e){let t;this.directionalLight&&(t=wo(this.directionalLight));for(const i in this._mergedSourceCaches)this._mergedSourceCaches[i].update(e,void 0,void 0,t);}_generateCollisionBoxes(){for(const e in this._sourceCaches){const t=this._sourceCaches[e];t.resume(),t.reload();}}_updatePlacement(t,i,o,r,s=!1){let n=!1,a=!1;const l={},c={};for(const i of this._mergedOrder){const o=this._mergedLayers[i];if(\"symbol\"!==o.type)continue;const r=e.aj(o.source,o.scope);let s=l[r];if(!s){const e=this.getLayerSourceCache(o);if(!e)continue;const t=e.getRenderableIds(!0).map((t=>e.getTileByID(t)));c[r]=t.slice(),s=l[r]=t.sort(((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)));}const a=this.crossTileSymbolIndex.addLayer(o,s,t.center.lng,t.projection);n=n||a;}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),s=s||this._layerOrderChanged||0===o,this._layerOrderChanged&&this.fire(new e.b(\"neworder\")),(s||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.f.now(),t.zoom))&&(this.pauseablePlacement=new Ki(t,this._mergedOrder,s,i,o,r,this.placement,this.fog&&t.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,l,c),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.f.now()),a=!0),n&&this.pauseablePlacement.placement.setStale()),a||n){this._buildingIndex.onNewFrame(t.zoom);for(const t of this._mergedOrder){const i=this._mergedLayers[t];\"symbol\"===i.type&&this.placement.updateLayerOpacities(i,l[e.aj(i.source,i.scope)]);}}return !this.pauseablePlacement.isDone()||this.placement.hasTransitions(e.f.now())}_releaseSymbolFadeTiles(){for(const e in this._sourceCaches)this._sourceCaches[e].releaseSymbolFadeTiles();}addImport(t,i){this._checkLoaded();const o=this.stylesheet.imports=this.stylesheet.imports||[];if(-1!==o.findIndex((({id:e})=>e===t.id)))return void this.fire(new e.a(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!i)return o.push(t),this._loadImports([t],!0);const r=o.findIndex((({id:e})=>e===i));return -1===r&&this.fire(new e.a(new Error(`Import with id \"${i}\" does not exist on this map.`))),this.stylesheet.imports=o.slice(0,r).concat(t).concat(o.slice(r)),this._loadImports([t],!0,i)}updateImport(e,i){this._checkLoaded();const o=this.stylesheet.imports||[],r=this.getImportIndex(e);return -1===r?this:\"string\"==typeof i?(this.setImportUrl(e,i),this):(i.url&&i.url!==o[r].url&&this.setImportUrl(e,i.url),t(i.config,o[r].config)||this.setImportConfig(e,i.config),t(i.data,o[r].data)||this.setImportData(e,i.data),this)}moveImport(e,t){this._checkLoaded();let i=this.stylesheet.imports||[];const o=this.getImportIndex(e);if(-1===o)return this;const r=this.getImportIndex(t);if(-1===r)return this;const s=i[o],n=this.fragments[o];return i=i.filter((({id:t})=>t!==e)),this.fragments=this.fragments.filter((({id:t})=>t!==e)),this.stylesheet.imports=i.slice(0,r).concat(s).concat(i.slice(r)),this.fragments=this.fragments.slice(0,r).concat(n).concat(this.fragments.slice(r)),this.mergeLayers(),this}setImportUrl(e,t){this._checkLoaded();const i=this.stylesheet.imports||[],o=this.getImportIndex(e);if(-1===o)return this;i[o].url=t;const r=this.fragments[o];return r.style=this._createFragmentStyle(i[o]),r.style.on(\"style.import.load\",(()=>this.mergeAll())),r.style.loadURL(t),this}setImportData(e,t){this._checkLoaded();const i=this.getImportIndex(e),o=this.stylesheet.imports||[];return -1===i?this:t?(this.fragments[i].style.setState(t),this._reloadImports(),this):(delete o[i].data,this.setImportUrl(e,o[i].url))}setImportConfig(e,t){this._checkLoaded();const i=this.getImportIndex(e),o=this.stylesheet.imports||[];if(-1===i)return this;t?o[i].config=t:delete o[i].config;const r=this.fragments[i],s=r.style.stylesheet&&r.style.stylesheet.schema;return r.config=t,r.style.updateConfig(t,s),this.updateConfigDependencies(),this}removeImport(e){this._checkLoaded();const t=this.stylesheet.imports||[],i=this.getImportIndex(e);-1!==i&&(t.splice(i,1),this.fragments[i].style._remove(),this.fragments.splice(i,1),this._reloadImports());}getImportIndex(t){const i=(this.stylesheet.imports||[]).findIndex((e=>e.id===t));return -1===i&&this.fire(new e.a(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),i}getLayer(e){return this._mergedLayers[e]}getSources(){const e=[];for(const t in this._mergedOtherSourceCaches){const i=this._mergedOtherSourceCaches[t];i&&e.push(i.getSource());}return e}getSource(e,t){const i=this.getSourceCache(e,t);return i&&i.getSource()}getLayerSource(e){const t=this.getLayerSourceCache(e);return t&&t.getSource()}getSourceCache(t,i){const o=e.aj(t,i);return this._mergedOtherSourceCaches[o]}getLayerSourceCache(t){const i=e.aj(t.source,t.scope);return \"symbol\"===t.type?this._mergedSymbolSourceCaches[i]:this._mergedOtherSourceCaches[i]}getSourceCaches(e){if(null==e)return Object.values(this._mergedSourceCaches);const t=[];return this._mergedOtherSourceCaches[e]&&t.push(this._mergedOtherSourceCaches[e]),this._mergedSymbolSourceCaches[e]&&t.push(this._mergedSymbolSourceCaches[e]),t}updateSourceCaches(){const e=this._changes.getUpdatedSourceCaches();for(const t in e){const i=e[t];\"reload\"===i?this.reloadSource(t):\"clear\"===i&&this.clearSource(t);}}updateLayers(e){const t=this._changes.getUpdatedPaintProperties();for(const i of t){const t=this.getLayer(i);t&&t.updateTransitions(e);}}getImages(e,t,i){this.imageManager.getImages(t.icons,t.scope,i),this._updateTilesForChangedImages();const o=e=>{e&&e.setDependencies(t.tileID.key,t.type,t.icons);};o(this._otherSourceCaches[t.source]),o(this._symbolSourceCaches[t.source]);}getGlyphs(e,t,i){this.glyphManager.getGlyphs(t.stacks,t.scope,i);}getResource(t,i,o){return e.ce(i,o)}getOwnSourceCache(e){return this._otherSourceCaches[e]}getOwnLayerSourceCache(e){return \"symbol\"===e.type?this._symbolSourceCaches[e.source]:this._otherSourceCaches[e.source]}getOwnSourceCaches(e){const t=[];return this._otherSourceCaches[e]&&t.push(this._otherSourceCaches[e]),this._symbolSourceCaches[e]&&t.push(this._symbolSourceCaches[e]),t}_isSourceCacheLoaded(t){const i=this.getOwnSourceCaches(t);return 0===i.length?(this.fire(new e.a(new Error(`There is no source with ID '${t}'`))),!1):i.every((e=>e.loaded()))}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}_clearWorkerCaches(){this.dispatcher.broadcast(\"clearCaches\");}destroy(){this._clearWorkerCaches(),this.fragments.forEach((e=>{e.style._remove();})),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain);}}Ao.getSourceType=function(e){return Ut[e]},Ao.setSourceType=function(e,t){Ut[e]=t;},Ao.registerForPluginStateChange=e.bY;var Po=\"\\n#define EPSILON 0.0000001\\n#define PI 3.141592653589793\\n#ifdef RENDER_CUTOFF\\nfloat cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}\\n#endif\",Lo=\"\\nout vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth)\\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\\n#ifdef INDICATOR_CUTOUT\\nuniform vec2 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;\\n#endif\\nvec4 applyCutout(vec4 color) {\\n#ifdef INDICATOR_CUTOUT\\nfloat holeMinOpacity=u_indicator_cutout_params.x;float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);\\n#else\\nreturn color;\\n#endif\\n}\\n#ifdef DEBUG_WIREFRAME\\n#define HANDLE_WIREFRAME_DEBUG \\\\\\nglFragColor=vec4(0.7,0.0,0.0,0.7); \\\\\\ngl_FragDepth=gl_FragCoord.z-0.0001;\\n#else\\n#define HANDLE_WIREFRAME_DEBUG\\n#endif\\n#ifdef RENDER_CUTOFF\\nuniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;\\n#endif\\nvec4 textureLodCustom(sampler2D image,vec2 pos,vec2 lod_coord) {vec2 size=vec2(textureSize(image,0));vec2 dx=dFdx(lod_coord.xy*size);vec2 dy=dFdy(lod_coord.xy*size);float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}\",Mo=\"\\n#define EXTENT 8192.0\\n#define RAD_TO_DEG 180.0/PI\\n#define DEG_TO_RAD PI/180.0\\n#define GLOBE_RADIUS EXTENT/PI/2.0\\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\\n#ifdef PROJECTION_GLOBE_VIEW\\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\\n#ifndef PROJECTED_POS_ON_VIEWPORT\\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\\n#else\\nreturn vec3(0.0);\\n#endif\\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\\n#endif\\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}\\n#ifdef RENDER_CUTOFF\\nuniform vec4 u_cutoff_params;out float v_cutoff_opacity;\\n#endif\\nconst vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}\",zo=\"in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}\",Oo=\"\\n#define ELEVATION_SCALE 7.0\\n#define ELEVATION_OFFSET 450.0\\n#ifdef PROJECTION_GLOBE_VIEW\\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\\n#else\\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\\n#endif\\n#ifdef TERRAIN\\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) {\\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;\\n#else\\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\\n#endif\\n}float prevElevation(vec2 apos) {\\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;\\n#else\\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\\n#endif\\n}\\n#ifdef TERRAIN_VERTEX_MORPHING\\nfloat elevation(vec2 apos) {\\n#ifdef ZERO_EXAGGERATION\\nreturn 0.0;\\n#endif\\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\\n#else\\nfloat elevation(vec2 apos) {\\n#ifdef ZERO_EXAGGERATION\\nreturn 0.0;\\n#endif\\nreturn currentElevation(apos);}\\n#endif\\nhighp float unpack_depth(highp vec4 rgba_depth)\\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(\\nunpack_depth(texture(u_depth,uv-df.xz)),unpack_depth(texture(u_depth,uv+df.xz)),unpack_depth(texture(u_depth,uv-df.zy)),unpack_depth(texture(u_depth,uv+df.zy))\\n);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\\n#else\\nfloat elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }\\n#endif\",Fo=\"#ifdef FOG\\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\\n#endif\",Bo=\"highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}\\n#ifdef FOG\\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {\\n#ifdef FOG_DITHERING\\nvec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);\\n#else\\nreturn color;\\n#endif\\n}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\\n#endif\",ko=\"#ifdef RASTER_ARRAY\\nuniform sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)\\n);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)\\n);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}\\n#endif\",No=\"#ifdef RASTER_ARRAY\\nuniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec4 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=vec2(u_data_offset+dot(t.rg,u_data_scale.yx),-(u_data_offset+dot(t.ba,u_data_scale.yx)));velocity/=max(u_max_speed,length(velocity));return velocity;}\\n#endif\\nuniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}\",Uo=\"#ifdef RENDER_SHADOWS\\nuniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}\\n#endif//RENDER_SHADOWS\",Go=\"#ifdef RENDER_SHADOWS\\n#ifdef DEPTH_TEXTURE\\nuniform highp sampler2D u_shadowmap_0;uniform highp sampler2D u_shadowmap_1;\\n#else\\nuniform sampler2D u_shadowmap_0;uniform sampler2D u_shadowmap_1;\\n#endif\\nuniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;highp float shadow_sample_1(highp vec2 uv,highp float compare) {highp float shadow_depth;\\n#ifdef DEPTH_TEXTURE\\nshadow_depth=texture(u_shadowmap_1,uv).r;\\n#else\\nshadow_depth=unpack_depth(texture(u_shadowmap_1,uv))*0.5+0.5;\\n#endif\\nreturn step(shadow_depth,compare);}highp float shadow_sample_0(highp vec2 uv,highp float compare) {highp float shadow_depth;\\n#ifdef DEPTH_TEXTURE\\nshadow_depth=texture(u_shadowmap_0,uv).r;\\n#else\\nshadow_depth=unpack_depth(texture(u_shadowmap_0,uv))*0.5+0.5;\\n#endif\\nreturn step(shadow_depth,compare);}float shadow_occlusion_1(highp vec4 pos,highp float bias) {highp vec2 uv=pos.xy;return shadow_sample_1(uv,pos.z-bias);}float shadow_occlusion_0(highp vec4 pos,highp float bias) {highp float compare0=pos.z-bias;\\n#ifdef NATIVE\\nhighp vec2 uv=pos.xy;highp vec4 samples=textureGather(u_shadowmap_0,uv,0);lowp vec4 stepSamples=step(samples,vec4(compare0));\\n#else\\nhighp vec2 uv00=pos.xy-vec2(0.5*u_shadow_texel_size);highp vec2 uv10=uv00+vec2(u_shadow_texel_size,0.0);highp vec2 uv01=uv00+vec2(0.0,u_shadow_texel_size);highp vec2 uv11=uv01+vec2(u_shadow_texel_size,0.0);lowp vec4 stepSamples=vec4(\\nshadow_sample_0(uv01,compare0),shadow_sample_0(uv11,compare0),shadow_sample_0(uv10,compare0),shadow_sample_0(uv00,compare0)\\n);\\n#endif\\nvec2 f=fract(pos.xy*u_shadow_map_resolution-vec2(0.5));lowp vec2 lerpx=mix(stepSamples.wx,stepSamples.zy,f.xx);return mix(lerpx.x,lerpx.y,f.y);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {\\n#ifdef SHADOWS_SINGLE_CASCADE\\nlight_view_pos0.xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);\\n#else\\nlight_view_pos0.xyz/=light_view_pos0.w;light_view_pos1.xyz/=light_view_pos1.w;vec4 uv=vec4(light_view_pos0.xy,light_view_pos1.xy);vec4 abs_bounds=abs(uv);if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}light_view_pos1.xyz=light_view_pos1.xyz*0.5+0.5;float occlusion1=shadow_occlusion_1(light_view_pos1,bias);return mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth));\\n#endif\\n}highp float calculate_shadow_bias(float NDotL) {\\n#ifdef NORMAL_OFFSET\\nreturn 0.5*u_shadow_bias.x;\\n#else\\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\\n#endif\\n}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}\\n#endif\";const jo=[];Qo(Po,jo),Qo(Mo,jo),Qo(Lo,jo);const Vo={\"_prelude_fog.vertex.glsl\":Fo,\"_prelude_terrain.vertex.glsl\":Oo,\"_prelude_shadow.vertex.glsl\":Uo,\"_prelude_fog.fragment.glsl\":Bo,\"_prelude_shadow.fragment.glsl\":Go,\"_prelude_lighting.glsl\":\"\\n#ifdef LIGHTING_3D_MODE\\nuniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}\\n#endif//LIGHTING_3D_MODE\",\"_prelude_raster_array.glsl\":ko,\"_prelude_raster_particle.glsl\":No},Zo={};$o(\"\",Oo),$o(Bo,Fo),$o(Go,Uo),$o(ko,\"\"),$o(No,\"\");const Wo=$o(Lo,Mo),Ho=Po;var qo={background:$o('#include \"_prelude_fog.fragment.glsl\"\\n#include \"_prelude_lighting.glsl\"\\nuniform vec4 u_color;uniform float u_opacity;\\n#ifdef LIGHTING_3D_MODE\\nin vec4 v_color;\\n#endif\\nvoid main() {vec4 out_color;\\n#ifdef LIGHTING_3D_MODE\\nout_color=v_color;\\n#else\\nout_color=u_color;\\n#endif\\n#ifdef FOG\\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\\n#endif\\nglFragColor=out_color*u_opacity;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_fog.vertex.glsl\"\\n#include \"_prelude_lighting.glsl\"\\nin vec2 a_pos;uniform mat4 u_matrix;\\n#ifdef LIGHTING_3D_MODE\\nuniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength;\\n#endif\\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\\n#ifdef LIGHTING_3D_MODE\\nv_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);\\n#endif\\n#ifdef FOG\\nv_fog_pos=fog_position(a_pos);\\n#endif\\n}'),backgroundPattern:$o('#include \"_prelude_fog.fragment.glsl\"\\n#include \"_prelude_lighting.glsl\"\\nuniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in vec2 v_pos;void main() {vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\\n#endif\\n#ifdef FOG\\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\\n#endif\\nglFragColor=out_color*u_opacity;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_fog.vertex.glsl\"\\nuniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_tile_units_to_pixels,a_pos);\\n#ifdef FOG\\nv_fog_pos=fog_position(a_pos);\\n#endif\\n}'),circle:$o('#include \"_prelude_fog.fragment.glsl\"\\n#include \"_prelude_lighting.glsl\"\\nin vec3 v_data;in float v_visibility;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define mediump float radius\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define highp vec4 stroke_color\\n#pragma mapbox: define mediump float stroke_width\\n#pragma mapbox: define lowp float stroke_opacity\\nuniform float u_emissive_strength;void main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize mediump float radius\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize highp vec4 stroke_color\\n#pragma mapbox: initialize mediump float stroke_width\\n#pragma mapbox: initialize lowp float stroke_opacity\\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\\n#endif\\n#ifdef FOG\\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\\n#endif\\nglFragColor=out_color*(v_visibility*opacity_t);\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\n}','#include \"_prelude_fog.vertex.glsl\"\\n#include \"_prelude_terrain.vertex.glsl\"\\n#define NUM_VISIBILITY_RINGS 2\\n#define INV_SQRT2 0.70710678\\n#define ELEVATION_BIAS 0.0001\\n#define NUM_SAMPLES_PER_RING 16\\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;\\n#ifdef PROJECTION_GLOBE_VIEW\\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\\n#endif\\nout vec3 v_data;out float v_visibility;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define mediump float radius\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define highp vec4 stroke_color\\n#pragma mapbox: define mediump float stroke_width\\n#pragma mapbox: define lowp float stroke_opacity\\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\\n#if defined(TERRAIN)\\nreturn elevation(pos)+ELEVATION_BIAS;\\n#else\\nreturn 0.0;\\n#endif\\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\\n#ifdef PITCH_WITH_MAP\\n#ifdef PROJECTION_GLOBE_VIEW\\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\\n#else\\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\\n#endif\\n#else\\nreturn projected_center+vec4(sample_offset,0,0);\\n#endif\\n}float get_sample_step() {\\n#ifdef PITCH_WITH_MAP\\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\\n#else\\nreturn PI/float(NUM_SAMPLES_PER_RING);\\n#endif\\n}void main(void) {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize mediump float radius\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize highp vec4 stroke_color\\n#pragma mapbox: initialize mediump float stroke_width\\n#pragma mapbox: initialize lowp float stroke_opacity\\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;\\n#ifdef PROJECTION_GLOBE_VIEW\\nvec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);\\n#else \\nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\\n#endif\\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\\n#ifdef PITCH_WITH_MAP\\n#ifdef SCALE_WITH_MAP\\nview_scale=1.0;\\n#else\\nview_scale=projected_center.w/u_camera_to_center_distance;\\n#endif\\n#else\\n#ifdef SCALE_WITH_MAP\\nview_scale=u_camera_to_center_distance;\\n#else\\nview_scale=projected_center.w;\\n#endif\\n#endif\\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\\n#ifdef TERRAIN\\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\\n#ifdef PITCH_WITH_MAP\\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\\n#else\\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\\n#endif\\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\\n#else\\nvisibility=1.0;\\n#endif\\n#ifdef PROJECTION_GLOBE_VIEW\\nvisibility=1.0;\\n#endif\\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\\n#ifdef FOG\\nv_fog_pos=fog_position(world_center.xyz);\\n#endif\\n}'),clippingMask:$o(\"void main() {glFragColor=vec4(1.0);}\",\"in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}\"),heatmap:$o('#include \"_prelude_fog.fragment.glsl\"\\nuniform highp float u_intensity;in vec2 v_extrude;\\n#pragma mapbox: define highp float weight\\n#define GAUSS_COEF 0.3989422804014327\\nvoid main() {\\n#pragma mapbox: initialize highp float weight\\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0);\\n#ifdef FOG\\nif (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\\n#endif\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_terrain.vertex.glsl\"\\n#include \"_prelude_fog.vertex.glsl\"\\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;\\n#ifdef PROJECTION_GLOBE_VIEW\\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\\n#endif\\nout vec2 v_extrude;\\n#pragma mapbox: define highp float weight\\n#pragma mapbox: define mediump float radius\\nconst highp float ZERO=1.0/255.0/16.0;\\n#define GAUSS_COEF 0.3989422804014327\\nvoid main(void) {\\n#pragma mapbox: initialize highp float weight\\n#pragma mapbox: initialize mediump float radius\\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;\\n#ifdef PROJECTION_GLOBE_VIEW\\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\\n#else\\npos=vec3(tilePos+extrude,elevation(tilePos));\\n#endif\\ngl_Position=u_matrix*vec4(pos,1);\\n#ifdef FOG\\nv_fog_pos=fog_position(pos);\\n#endif\\n}'),heatmapTexture:$o(\"uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(0.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}\",\"in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}\"),collisionBox:$o(\"in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}\",'#include \"_prelude_terrain.vertex.glsl\"\\nin vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in float a_size_scale;in vec2 a_padding;in float a_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*(a_z_offset+elevation(a_anchor_pos)),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}'),collisionCircle:$o(\"in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}\",\"in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd  =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz  /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}\"),debug:$o(\"uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}\",'#include \"_prelude_terrain.vertex.glsl\"\\nin vec2 a_pos;\\n#ifdef PROJECTION_GLOBE_VIEW\\nin vec3 a_pos_3;\\n#endif\\nout vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\\n#ifdef PROJECTION_GLOBE_VIEW\\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);\\n#else\\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\\n#endif\\n}'),fill:$o('#include \"_prelude_fog.fragment.glsl\"\\n#include \"_prelude_lighting.glsl\"\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float opacity\\nuniform float u_emissive_strength;void main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float opacity\\nvec4 out_color=color;\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\\n#endif\\n#ifdef FOG\\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\\n#endif\\nglFragColor=out_color*opacity;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_fog.vertex.glsl\"\\nin vec2 a_pos;uniform mat4 u_matrix;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float opacity\\ngl_Position=u_matrix*vec4(a_pos,0,1);\\n#ifdef FOG\\nv_fog_pos=fog_position(a_pos);\\n#endif\\n}'),fillOutline:$o('#include \"_prelude_fog.fragment.glsl\"\\n#include \"_prelude_lighting.glsl\"\\nin highp vec2 v_pos;uniform float u_emissive_strength;\\n#pragma mapbox: define highp vec4 outline_color\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 outline_color\\n#pragma mapbox: initialize lowp float opacity\\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\\n#endif\\n#ifdef FOG\\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\\n#endif\\nglFragColor=out_color*(alpha*opacity);\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_fog.vertex.glsl\"\\nin vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;\\n#pragma mapbox: define highp vec4 outline_color\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 outline_color\\n#pragma mapbox: initialize lowp float opacity\\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\\n#ifdef FOG\\nv_fog_pos=fog_position(a_pos);\\n#endif\\n}'),fillOutlinePattern:$o('#include \"_prelude_fog.fragment.glsl\"\\n#include \"_prelude_lighting.glsl\"\\nuniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_emissive_strength;in highp vec2 v_pos;in highp vec2 v_pos_world;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp vec4 pattern\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump vec4 pattern\\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\\n#endif\\n#ifdef FOG\\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\\n#endif\\nglFragColor=out_color*(alpha*opacity);\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_fog.vertex.glsl\"\\nuniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;out highp vec2 v_pos_world;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp vec4 pattern\\n#pragma mapbox: define lowp float pixel_ratio\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump vec4 pattern\\n#pragma mapbox: initialize lowp float pixel_ratio\\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\\n#ifdef FOG\\nv_fog_pos=fog_position(a_pos);\\n#endif\\n}'),fillPattern:$o('#include \"_prelude_fog.fragment.glsl\"\\n#include \"_prelude_lighting.glsl\"\\nuniform vec2 u_texsize;uniform sampler2D u_image;in vec2 v_pos;uniform float u_emissive_strength;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp vec4 pattern\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump vec4 pattern\\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\\n#endif\\n#ifdef FOG\\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\\n#endif\\nglFragColor=out_color*opacity;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_fog.vertex.glsl\"\\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp vec4 pattern\\n#pragma mapbox: define lowp float pixel_ratio\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump vec4 pattern\\n#pragma mapbox: initialize lowp float pixel_ratio\\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\\n#ifdef FOG\\nv_fog_pos=fog_position(a_pos);\\n#endif\\n}'),fillExtrusion:$o('#include \"_prelude_fog.fragment.glsl\"\\n#include \"_prelude_shadow.fragment.glsl\"\\n#include \"_prelude_lighting.glsl\"\\nin vec4 v_color;in vec4 v_flat;\\n#ifdef RENDER_SHADOWS\\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\\n#endif\\nuniform lowp float u_opacity;\\n#ifdef FAUX_AO\\nuniform lowp vec2 u_ao;in vec2 v_ao;\\n#endif\\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\\nin vec4 v_roof_color;\\n#endif\\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\\nin highp vec3 v_normal;\\n#endif\\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\\nin float v_flood_radius;in float v_has_floodlight;\\n#endif\\nuniform float u_emissive_strength;in float v_height;void main() {\\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\\nvec3 normal=normalize(v_normal);\\n#endif\\nfloat z;vec4 color=v_color;\\n#ifdef ZERO_ROOF_RADIUS\\nz=float(normal.z > 0.00001);\\n#ifdef LIGHTING_3D_MODE\\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\\n#else\\ncolor=mix(v_color,v_roof_color,z);\\n#endif\\n#endif\\nfloat h=max(0.0,v_height);float ao_shade=1.0;\\n#ifdef FAUX_AO\\nfloat intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\\n#ifdef ZERO_ROOF_RADIUS\\nconcave*=(1.0-z);\\n#endif\\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);\\n#ifdef LIGHTING_3D_MODE\\n#ifdef FLOOD_LIGHT\\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\\n#else\\ncolor.rgb*=ao_shade;\\n#endif\\n#else\\ncolor.rgb*=ao_shade;\\n#endif\\n#endif\\n#ifdef LIGHTING_3D_MODE\\nfloat flood_radiance=0.0;\\n#ifdef FLOOD_LIGHT\\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\\n#endif\\n#ifdef RENDER_SHADOWS\\n#ifdef FLOOD_LIGHT\\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);\\n#else\\nfloat shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\\n#endif\\n#else\\ncolor.rgb=apply_lighting(color.rgb,normal);\\n#ifdef FLOOD_LIGHT\\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\\n#endif\\n#endif\\ncolor.rgb=mix(color.rgb,v_flat.rgb,u_emissive_strength);color*=u_opacity;\\n#endif\\n#ifdef FOG\\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\\n#endif\\n#ifdef INDICATOR_CUTOUT\\ncolor=applyCutout(color);\\n#endif\\nglFragColor=color;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_fog.vertex.glsl\"\\n#include \"_prelude_terrain.vertex.glsl\"\\n#include \"_prelude_shadow.vertex.glsl\"\\n#include \"_prelude_lighting.glsl\"\\nuniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\\n#ifdef PROJECTION_GLOBE_VIEW\\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\\n#endif\\nuniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;\\n#ifdef RENDER_SHADOWS\\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\\n#endif\\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\\nout vec4 v_roof_color;\\n#endif\\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\\nout highp vec3 v_normal;\\n#endif\\n#ifdef FAUX_AO\\nuniform lowp vec2 u_ao;out vec2 v_ao;\\n#endif\\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\\nout float v_flood_radius;out float v_has_floodlight;\\n#endif\\nout float v_height;\\n#pragma mapbox: define highp float base\\n#pragma mapbox: define highp float height\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define highp float flood_light_wall_radius\\nvoid main() {\\n#pragma mapbox: initialize highp float base\\n#pragma mapbox: initialize highp float height\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize highp float flood_light_wall_radius\\nbase*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));\\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\\nv_normal=normal;\\n#endif\\nbase=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\\n#if defined(HAS_CENTROID) || defined(TERRAIN)\\ncentroid_pos=a_centroid_pos;\\n#endif\\nfloat ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;\\n#ifdef TERRAIN\\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h);\\n#else\\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\\n#endif\\n#ifdef PROJECTION_GLOBE_VIEW\\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\\n#endif\\nfloat cutoff=1.0;vec3 scaled_pos=pos;\\n#ifdef RENDER_CUTOFF\\nvec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);cutoff=max(0.01,cutoff_opacity(u_cutoff_params,ground.z));if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);\\n#endif\\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff < 0.01 && centroid_pos.x !=0.0));gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;\\n#ifdef RENDER_SHADOWS\\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\\n#ifdef NORMAL_OFFSET\\nvec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\\n#endif\\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);\\n#endif\\nfloat NdotL=0.0;float colorvalue=0.0;\\n#ifndef LIGHTING_3D_MODE\\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(\\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\\n#endif\\n#ifdef FAUX_AO\\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\\n#ifdef TERRAIN\\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\\n#endif\\nv_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\\n#ifdef PROJECTION_GLOBE_VIEW\\ntop_height+=u_height_lift;\\n#endif\\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\\n#endif\\n#ifdef LIGHTING_3D_MODE\\n#ifdef FLOOD_LIGHT\\nfloat is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;\\n#endif\\nv_color=vec4(color.rgb,1.0);v_flat=vec4(linearProduct(color.rgb,vec3(calculate_NdotL(normal))),1.0);\\n#else\\nv_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\\n#endif\\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;\\n#endif\\n#ifdef FOG\\nv_fog_pos=fog_position(pos);\\n#endif\\n}'),fillExtrusionDepth:$o(\"in highp float v_depth;void main() {\\n#ifndef DEPTH_TEXTURE\\nglFragColor=pack_depth(v_depth);\\n#endif\\n}\",'#include \"_prelude_terrain.vertex.glsl\"\\nuniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_vertical_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\\n#pragma mapbox: define highp float base\\n#pragma mapbox: define highp float height\\nout highp float v_depth;void main() {\\n#pragma mapbox: initialize highp float base\\n#pragma mapbox: initialize highp float height\\nbase*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\\n#if defined(HAS_CENTROID) || defined(TERRAIN)\\ncentroid_pos=a_centroid_pos;\\n#endif\\nvec3 pos;\\n#ifdef TERRAIN\\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base);pos=vec3(pos_nx.xy,h);\\n#else\\npos=vec3(pos_nx.xy,t > 0.0 ? height : base);\\n#endif\\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}'),fillExtrusionPattern:$o('#include \"_prelude_fog.fragment.glsl\"\\n#include \"_prelude_lighting.glsl\"\\nuniform vec2 u_texsize;uniform sampler2D u_image;\\n#ifdef FAUX_AO\\nuniform lowp vec2 u_ao;in vec3 v_ao;\\n#endif\\n#ifdef LIGHTING_3D_MODE\\nin vec3 v_normal;\\n#endif\\nin vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;\\n#pragma mapbox: define highp float base\\n#pragma mapbox: define highp float height\\n#pragma mapbox: define mediump vec4 pattern\\n#pragma mapbox: define highp float pixel_ratio\\nvoid main() {\\n#pragma mapbox: initialize highp float base\\n#pragma mapbox: initialize highp float height\\n#pragma mapbox: initialize mediump vec4 pattern\\n#pragma mapbox: initialize highp float pixel_ratio\\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\\n#else\\nout_color=out_color*v_lighting;\\n#endif\\n#ifdef FAUX_AO\\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\\n#endif\\n#ifdef FOG\\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\\n#endif\\n#ifdef INDICATOR_CUTOUT\\nout_color=applyCutout(out_color);\\n#endif\\nglFragColor=out_color;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_fog.vertex.glsl\"\\n#include \"_prelude_terrain.vertex.glsl\"\\n#include \"_prelude_lighting.glsl\"\\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\\n#ifdef PROJECTION_GLOBE_VIEW\\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\\n#endif\\nout vec2 v_pos;out vec4 v_lighting;\\n#ifdef FAUX_AO\\nuniform lowp vec2 u_ao;out vec3 v_ao;\\n#endif\\n#ifdef LIGHTING_3D_MODE\\nout vec3 v_normal;\\n#endif\\n#pragma mapbox: define highp float base\\n#pragma mapbox: define highp float height\\n#pragma mapbox: define mediump vec4 pattern\\n#pragma mapbox: define highp float pixel_ratio\\nvoid main() {\\n#pragma mapbox: initialize highp float base\\n#pragma mapbox: initialize highp float height\\n#pragma mapbox: initialize mediump vec4 pattern\\n#pragma mapbox: initialize highp float pixel_ratio\\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\\n#if defined(HAS_CENTROID) || defined(TERRAIN)\\ncentroid_pos=a_centroid_pos;\\n#endif\\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\\n#ifdef TERRAIN\\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h);\\n#else\\np=vec3(pos_nx.xy,z);\\n#endif\\n#ifdef PROJECTION_GLOBE_VIEW\\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\\n#endif\\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\\n? pos_nx.xy\\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\\n#ifdef LIGHTING_3D_MODE\\nNdotL=calculate_NdotL(normal);\\n#else\\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\\n#endif\\nif (normal.y !=0.0) {float r=0.84;\\n#ifndef LIGHTING_3D_MODE\\nr=mix(0.7,0.98,1.0-u_lightintensity);\\n#endif\\nNdotL*=(\\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\\n#ifdef FAUX_AO\\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\\n#ifdef TERRAIN\\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\\n#endif\\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\\n#ifdef PROJECTION_GLOBE_VIEW\\ntop_height+=u_height_lift;\\n#endif\\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\\n#endif\\n#ifdef LIGHTING_3D_MODE\\nv_normal=normal;\\n#else\\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\\n#endif \\n#ifdef FOG\\nv_fog_pos=fog_position(p);\\n#endif\\n}'),groundShadow:$o('#include \"_prelude_shadow.fragment.glsl\"\\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\\n#ifdef FOG\\nin float v_fog_opacity;\\n#endif\\nvoid main() {float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);\\n#ifdef RENDER_CUTOFF\\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));\\n#endif\\n#ifdef FOG\\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\\n#endif\\n#ifdef INDICATOR_CUTOUT\\nshadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0)).r);\\n#endif\\nglFragColor=vec4(shadow,1.0);}','#include \"_prelude_fog.vertex.glsl\"\\nuniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\\n#ifdef FOG\\nout float v_fog_opacity;\\n#endif\\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);\\n#ifdef FOG\\nv_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);\\n#endif\\n}'),fillExtrusionGroundEffect:$o(\"uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;\\n#ifdef SDF_SUBPASS\\nin highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}\\n#ifdef FOG\\nin highp float v_fog;\\n#endif\\n#endif\\nvoid main() {\\n#ifdef CLEAR_SUBPASS\\nvec4 color=vec4(1.0);\\n#ifdef CLEAR_FROM_TEXTURE\\ncolor=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));\\n#endif\\nglFragColor=color;\\n#else\\n#ifdef SDF_SUBPASS\\nhighp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;\\n#ifdef FOG\\nfog=v_fog;\\n#endif\\n#ifdef RENDER_CUTOFF\\nfog*=v_cutoff_opacity;\\n#endif\\nglFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));\\n#else\\nvec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);\\n#ifdef OVERDRAW_INSPECTOR\\ncolor=vec4(1.0);\\n#endif\\nglFragColor=color;\\n#endif\\nHANDLE_WIREFRAME_DEBUG;\\n#endif\\n}\",'#include \"_prelude_fog.vertex.glsl\"\\nin highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;\\n#ifdef SDF_SUBPASS\\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\\n#ifdef FOG\\nout highp float v_fog;\\n#endif\\n#endif\\nuniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp vec2 u_ao;\\n#pragma mapbox: define highp float flood_light_ground_radius\\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\\n#pragma mapbox: initialize highp float flood_light_ground_radius\\nvec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(1.0,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;\\n#ifdef SDF_SUBPASS\\nv_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);\\n#ifdef FOG\\nv_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);\\n#endif\\n#endif\\nfloat hidden_by_landmark=0.0;\\n#ifdef HAS_CENTROID\\nhidden_by_landmark=a_hidden_by_landmark;\\n#endif\\nfloat isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));\\n#ifdef RENDER_CUTOFF\\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\\n#endif\\n}'),hillshadePrepare:$o(\"precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\\n)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(\\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}\",\"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}\"),hillshade:$o('#include \"_prelude_fog.fragment.glsl\"\\n#include \"_prelude_lighting.glsl\"\\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;\\n#ifdef LIGHTING_3D_MODE\\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\\n#endif\\n#ifdef FOG\\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\\n#endif\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_fog.vertex.glsl\"\\nuniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\\n#ifdef FOG\\nv_fog_pos=fog_position(a_pos);\\n#endif\\n}'),line:$o('#include \"_prelude_fog.fragment.glsl\"\\n#include \"_prelude_lighting.glsl\"\\nuniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec4 v_uv;\\n#ifdef RENDER_LINE_DASH\\nuniform sampler2D u_dash_image;in vec2 v_tex;\\n#endif\\n#ifdef RENDER_LINE_GRADIENT\\nuniform sampler2D u_gradient_image;\\n#endif\\nfloat luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float floorwidth\\n#pragma mapbox: define lowp vec4 dash\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float border_width\\n#pragma mapbox: define lowp vec4 border_color\\nfloat linearstep(float edge0,float edge1,float x) {return  clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float floorwidth\\n#pragma mapbox: initialize lowp vec4 dash\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float border_width\\n#pragma mapbox: initialize lowp vec4 border_color\\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\\n#ifdef RENDER_LINE_DASH\\nfloat sdfdist=texture(u_dash_image,v_tex).r;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\\n#endif\\nhighp vec4 out_color;\\n#ifdef RENDER_LINE_GRADIENT\\nout_color=texture(u_gradient_image,v_uv.xy);\\n#else\\nout_color=color;\\n#endif\\nfloat trimmed=1.0;\\n#ifdef RENDER_LINE_TRIM_OFFSET\\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {out_color=vec4(0,0,0,0);trimmed=0.0;}}\\n#endif\\nif (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}\\n#ifdef RENDER_LINE_BORDER\\nfloat edgeBlur=(border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {    \\nfloat Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color.rgb=mix(border_color.rgb*border_color.a*trimmed,out_color.rgb,smoothAlpha);}}\\n#endif\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\\n#endif\\n#ifdef FOG\\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\\n#endif\\nout_color*=(alpha*opacity);\\n#ifdef INDICATOR_CUTOUT\\nout_color=applyCutout(out_color);\\n#endif\\nglFragColor=out_color;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_fog.vertex.glsl\"\\n#define EXTRUDE_SCALE 0.015873016\\nin vec2 a_pos_normal;in vec4 a_data;\\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\\nin highp vec4 a_packed;\\n#endif\\n#ifdef RENDER_LINE_DASH\\nin float a_linesofar;\\n#endif\\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec4 v_uv;\\n#ifdef RENDER_LINE_DASH\\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;\\n#endif\\n#ifdef RENDER_LINE_GRADIENT\\nuniform float u_image_height;\\n#endif\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float floorwidth\\n#pragma mapbox: define lowp vec4 dash\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define mediump float gapwidth\\n#pragma mapbox: define lowp float offset\\n#pragma mapbox: define mediump float width\\n#pragma mapbox: define lowp float border_width\\n#pragma mapbox: define lowp vec4 border_color\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float floorwidth\\n#pragma mapbox: initialize lowp vec4 dash\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump float gapwidth\\n#pragma mapbox: initialize lowp float offset\\n#pragma mapbox: initialize mediump float width\\n#pragma mapbox: initialize lowp float border_width\\n#pragma mapbox: initialize lowp vec4 border_color\\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\\n#ifndef RENDER_TO_TEXTURE\\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\\n#else\\nv_gamma_scale=1.0;\\n#endif\\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];\\n#ifdef RENDER_LINE_GRADIENT\\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);\\n#else\\nv_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\\n#endif\\n#endif\\n#ifdef RENDER_LINE_DASH\\nfloat scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y);\\n#endif\\nv_width2=vec2(outset,inset);\\n#ifdef FOG\\nv_fog_pos=fog_position(pos);\\n#endif\\n}'),linePattern:$o('#include \"_prelude_fog.fragment.glsl\"\\n#include \"_prelude_lighting.glsl\"\\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform mediump float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\\n#ifdef RENDER_LINE_TRIM_OFFSET\\nin highp vec4 v_uv;\\n#endif\\n#ifdef LINE_JOIN_NONE\\nin vec2 v_pattern_data;\\n#endif\\n#pragma mapbox: define lowp vec4 pattern\\n#pragma mapbox: define lowp float pixel_ratio\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize mediump vec4 pattern\\n#pragma mapbox: initialize lowp float pixel_ratio\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;vec2 pattern_size=vec2(display_size.x/u_tile_units_to_pixels,display_size.y);float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float pattern_x=v_linesofar/pattern_size.x*aspect;float x=mod(pattern_x,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);\\n#ifdef RENDER_LINE_TRIM_OFFSET\\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {color=vec4(0,0,0,0);}}\\n#endif\\n#ifdef LINE_JOIN_NONE\\nfloat pattern_len=pattern_size.x/aspect;float segment_phase=pattern_len-mod((v_linesofar-v_pattern_data.x),pattern_len);float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}\\n#endif\\n#ifdef LIGHTING_3D_MODE\\ncolor=apply_lighting_ground(color);\\n#endif\\n#ifdef FOG\\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\\n#endif\\ncolor*=(alpha*opacity);\\n#ifdef INDICATOR_CUTOUT\\ncolor=applyCutout(color);\\n#endif\\nglFragColor=color;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_fog.vertex.glsl\"\\n#define scale 0.015873016\\nin vec2 a_pos_normal;in vec4 a_data;\\n#ifdef RENDER_LINE_TRIM_OFFSET\\nin highp vec4 a_packed;\\n#endif\\nin float a_linesofar;\\n#ifdef LINE_JOIN_NONE\\nin vec2 a_pattern_data;out vec2 v_pattern_data;\\n#endif\\nuniform mat4 u_matrix;uniform mediump float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\\n#ifdef RENDER_LINE_TRIM_OFFSET\\nout highp vec4 v_uv;\\n#endif\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float offset\\n#pragma mapbox: define mediump float gapwidth\\n#pragma mapbox: define mediump float width\\n#pragma mapbox: define lowp float floorwidth\\n#pragma mapbox: define lowp vec4 pattern\\n#pragma mapbox: define lowp float pixel_ratio\\nvoid main() {\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float offset\\n#pragma mapbox: initialize mediump float gapwidth\\n#pragma mapbox: initialize mediump float width\\n#pragma mapbox: initialize lowp float floorwidth\\n#pragma mapbox: initialize mediump vec4 pattern\\n#pragma mapbox: initialize lowp float pixel_ratio\\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\\n#ifndef RENDER_TO_TEXTURE\\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\\n#else\\nv_gamma_scale=1.0;\\n#endif\\n#ifdef RENDER_LINE_TRIM_OFFSET\\nfloat a_uv_x=a_packed[0];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\\n#endif\\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\\n#ifdef LINE_JOIN_NONE\\nv_width+=ANTIALIASING;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5/u_tile_units_to_pixels;v_linesofar+=line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);\\n#endif\\n#ifdef FOG\\nv_fog_pos=fog_position(pos);\\n#endif\\n}'),raster:$o('#include \"_prelude_fog.fragment.glsl\"\\n#include \"_prelude_lighting.glsl\"\\n#include \"_prelude_raster_array.glsl\"\\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;\\n#ifdef PROJECTION_GLOBE_VIEW\\nin float v_split_fade;\\n#endif\\nuniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;\\n#ifndef RASTER_ARRAY\\nuniform sampler2D u_image0;uniform sampler2D u_image1;\\n#endif\\n#ifdef RASTER_COLOR\\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;\\n#endif\\nvoid main() {vec4 color0,color1,color;vec2 value;\\n#ifdef RASTER_COLOR\\n#ifdef RASTER_ARRAY\\n#ifdef RASTER_ARRAY_LINEAR\\nvalue=mix(\\nraTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\\n);\\n#else\\nvalue=mix(\\nraTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\\n);\\n#endif\\nif (value.y > 0.0) value.x/=value.y;\\n#else\\ncolor=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);\\n#endif\\ncolor=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;\\n#else\\ncolor0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);\\n#endif\\ncolor.a*=u_opacity;\\n#ifdef GLOBE_POLES\\ncolor.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);\\n#endif\\nvec3 rgb=color.rgb;rgb=vec3(\\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;\\n#endif\\n#ifdef FOG\\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\\n#endif\\nglFragColor=vec4(out_color*color.a,color.a);\\n#ifdef PROJECTION_GLOBE_VIEW\\nglFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));\\n#endif\\n#ifdef RENDER_CUTOFF\\nglFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);\\n#endif\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_fog.vertex.glsl\"\\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\\n#ifdef GLOBE_POLES\\nin vec3 a_globe_pos;in vec2 a_uv;\\n#else\\nin vec2 a_pos;in vec2 a_texture_pos;\\n#endif\\nout vec2 v_pos0;out vec2 v_pos1;out float v_depth;\\n#ifdef PROJECTION_GLOBE_VIEW\\nout float v_split_fade;\\n#endif\\nvoid main() {vec2 uv;\\n#ifdef GLOBE_POLES\\nvec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos   ,1.0);uv=a_uv;\\n#ifdef FOG\\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\\n#endif\\n#else\\nfloat w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;\\n#ifdef PROJECTION_GLOBE_VIEW\\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);    \\nv_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\\n#ifdef FOG\\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\\n#endif\\n#else\\ngl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\\n#ifdef FOG\\nv_fog_pos=fog_position(a_pos);\\n#endif\\n#endif\\n#endif\\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;\\n#ifdef RENDER_CUTOFF\\nv_depth=gl_Position.z;\\n#endif\\n}'),rasterParticle:$o('#include \"_prelude_fog.fragment.glsl\"\\n#include \"_prelude_lighting.glsl\"\\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb;\\n#endif\\n#ifdef FOG\\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\\n#endif\\nglFragColor=vec4(out_color*color.a,color.a);\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_fog.vertex.glsl\"\\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\\nin vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;\\n#ifdef PROJECTION_GLOBE_VIEW\\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\\n#ifdef FOG\\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\\n#endif\\n#else\\nuv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\\n#ifdef FOG\\nv_fog_pos=fog_position(a_pos);\\n#endif\\n#endif\\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}'),rasterParticleDraw:$o(\"uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}\",'#include \"_prelude_raster_particle.glsl\"\\nin float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(\\nmod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-vec2(1.0),0.0,1.0);v_particle_speed=length(velocity);}gl_PointSize=1.0;}'),rasterParticleTexture:$o(\"uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}\",\"in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}\"),rasterParticleUpdate:$o('#include \"_prelude_raster_particle.glsl\"\\nuniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp float speed=velocity==INVALID_VELOCITY ? 0.0 : length(velocity);highp float reset_rate_bump=speed*u_reset_rate;highp vec2 particle_pos_min=-u_particle_pos_offset;highp vec2 particle_pos_max=vec2(1.0)+u_particle_pos_offset;highp vec2 pos_drop_rate=vec2(1.0)-step(particle_pos_min,pos)+step(particle_pos_max,pos);highp float drop_rate=max(u_reset_rate+reset_rate_bump,length(pos_drop_rate));highp float drop=step(1.0-drop_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}',\"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}\"),symbolIcon:$o('#include \"_prelude_lighting.glsl\"\\nuniform sampler2D u_texture;\\n#ifdef ICON_TRANSITION\\nuniform float u_icon_transition;\\n#endif\\nin float v_fade_opacity;in vec2 v_tex_a;\\n#ifdef ICON_TRANSITION\\nin vec2 v_tex_b;\\n#endif\\n#ifdef COLOR_ADJUSTMENT\\nuniform mat4 u_color_adj_mat;\\n#endif\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float emissive_strength\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float emissive_strength\\nlowp float alpha=opacity*v_fade_opacity;vec4 out_color;\\n#ifdef ICON_TRANSITION\\nvec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);\\n#else\\nout_color=texture(u_texture,v_tex_a);\\n#endif\\n#ifdef COLOR_ADJUSTMENT\\nout_color=u_color_adj_mat*out_color;\\n#endif\\nout_color*=alpha;\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\\n#endif\\nglFragColor=out_color;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_terrain.vertex.glsl\"\\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;\\n#ifdef Z_OFFSET\\nin float a_z_offset;\\n#endif\\n#ifdef PROJECTION_GLOBE_VIEW\\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\\n#endif\\n#ifdef ICON_TRANSITION\\nin vec2 a_texb;\\n#endif\\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform vec3 u_up_vector;\\n#ifdef PROJECTION_GLOBE_VIEW\\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\\n#endif\\nout vec2 v_tex_a;\\n#ifdef ICON_TRANSITION\\nout vec2 v_tex_b;\\n#endif\\nout float v_fade_opacity;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float emissive_strength\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float emissive_strength\\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor);\\n#ifdef Z_OFFSET\\ne+=a_z_offset;\\n#endif\\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\\n#ifdef PROJECTION_GLOBE_VIEW\\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\\n#else\\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\\n#endif\\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\\ncamera_to_anchor_distance/u_camera_to_center_distance :\\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjected_point;\\n#ifdef PROJECTION_GLOBE_VIEW\\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\\n#else\\noffsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\\n#endif\\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\\n#ifdef PROJECTION_GLOBE_VIEW\\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\\n#else\\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\\n#endif\\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\\n#ifdef TERRAIN\\n#ifdef PITCH_WITH_MAP_TERRAIN\\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\\n#endif\\n#endif\\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;float projection_transition_fade=1.0;\\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\\n#endif\\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);\\n#ifdef PROJECTION_GLOBE_VIEW\\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);\\n#else\\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);\\n#endif\\nv_tex_a=a_tex/u_texsize;\\n#ifdef ICON_TRANSITION\\nv_tex_b=a_texb/u_texsize;\\n#endif\\nv_fade_opacity=out_fade_opacity;}'),symbolSDF:$o('#include \"_prelude_lighting.glsl\"\\n#define SDF_PX 8.0\\nuniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;in float v_draw_halo;in vec2 v_data0;in vec3 v_data1;\\n#pragma mapbox: define highp vec4 fill_color\\n#pragma mapbox: define highp vec4 halo_color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float halo_width\\n#pragma mapbox: define lowp float halo_blur\\n#pragma mapbox: define lowp float emissive_strength\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 fill_color\\n#pragma mapbox: initialize highp vec4 halo_color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float halo_width\\n#pragma mapbox: initialize lowp float halo_blur\\n#pragma mapbox: initialize lowp float emissive_strength\\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);vec4 out_color=color*(alpha*opacity*fade_opacity);\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\\n#endif\\nglFragColor=out_color;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_terrain.vertex.glsl\"\\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;\\n#ifdef Z_OFFSET\\nin float a_z_offset;\\n#endif\\n#ifdef PROJECTION_GLOBE_VIEW\\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\\n#endif\\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform bool u_is_halo;\\n#ifdef PROJECTION_GLOBE_VIEW\\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\\n#endif\\nout float v_draw_halo;out vec2 v_data0;out vec3 v_data1;\\n#pragma mapbox: define highp vec4 fill_color\\n#pragma mapbox: define highp vec4 halo_color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float halo_width\\n#pragma mapbox: define lowp float halo_blur\\n#pragma mapbox: define lowp float emissive_strength\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 fill_color\\n#pragma mapbox: initialize highp vec4 halo_color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float halo_width\\n#pragma mapbox: initialize lowp float halo_blur\\n#pragma mapbox: initialize lowp float emissive_strength\\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor);\\n#ifdef Z_OFFSET\\ne+=a_z_offset;\\n#endif\\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\\n#ifdef PROJECTION_GLOBE_VIEW\\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\\n#else\\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\\n#endif\\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\\ncamera_to_anchor_distance/u_camera_to_center_distance :\\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;\\n#ifdef PROJECTION_GLOBE_VIEW\\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\\n#else\\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\\n#endif\\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\\n#ifdef PROJECTION_GLOBE_VIEW\\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\\n#else\\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\\n#endif\\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);\\n#ifdef TERRAIN\\n#ifdef PITCH_WITH_MAP_TERRAIN\\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\\n#endif\\n#endif\\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;float projection_transition_fade=1.0;\\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\\n#endif\\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);\\n#ifdef PROJECTION_GLOBE_VIEW\\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);\\n#else\\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);\\n#endif\\nfloat gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,out_fade_opacity);}'),symbolTextAndIcon:$o('#include \"_prelude_lighting.glsl\"\\n#define SDF_PX 8.0\\n#define SDF 1.0\\n#define ICON 0.0\\nuniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_halo;in float v_draw_halo;in vec4 v_data0;in vec4 v_data1;\\n#pragma mapbox: define highp vec4 fill_color\\n#pragma mapbox: define highp vec4 halo_color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float halo_width\\n#pragma mapbox: define lowp float halo_blur\\n#pragma mapbox: define lowp float emissive_strength\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 fill_color\\n#pragma mapbox: initialize highp vec4 halo_color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float halo_width\\n#pragma mapbox: initialize lowp float halo_blur\\n#pragma mapbox: initialize lowp float emissive_strength\\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);vec4 out_color=color*(alpha*opacity*fade_opacity);\\n#ifdef LIGHTING_3D_MODE\\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\\n#endif\\nglFragColor=out_color;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_terrain.vertex.glsl\"\\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_projected_pos;in float a_fade_opacity;\\n#ifdef Z_OFFSET\\nin float a_z_offset;\\n#endif\\n#ifdef PROJECTION_GLOBE_VIEW\\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\\n#endif\\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;\\n#ifdef PROJECTION_GLOBE_VIEW\\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\\n#endif\\nout float v_draw_halo;out vec4 v_data0;out vec4 v_data1;\\n#pragma mapbox: define highp vec4 fill_color\\n#pragma mapbox: define highp vec4 halo_color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float halo_width\\n#pragma mapbox: define lowp float halo_blur\\n#pragma mapbox: define lowp float emissive_strength\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 fill_color\\n#pragma mapbox: initialize highp vec4 halo_color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float halo_width\\n#pragma mapbox: initialize lowp float halo_blur\\n#pragma mapbox: initialize lowp float emissive_strength\\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor);\\n#ifdef Z_OFFSET\\ne+=a_z_offset;\\n#endif\\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\\n#ifdef PROJECTION_GLOBE_VIEW\\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\\n#else\\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\\n#endif\\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\\ncamera_to_anchor_distance/u_camera_to_center_distance :\\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\\n#ifdef PROJECTION_GLOBE_VIEW\\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\\n#else\\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\\n#endif\\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale);\\n#ifdef TERRAIN\\n#ifdef PITCH_WITH_MAP_TERRAIN\\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\\n#endif\\n#endif\\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;\\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\\n#endif\\nfloat out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);\\n#ifdef PROJECTION_GLOBE_VIEW\\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);\\n#else\\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);\\n#endif\\nfloat gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,out_fade_opacity,is_sdf);}'),terrainRaster:$o('#include \"_prelude_fog.fragment.glsl\"\\n#include \"_prelude_shadow.fragment.glsl\"\\n#include \"_prelude_lighting.glsl\"\\nuniform sampler2D u_image0;in vec2 v_pos0;\\n#ifdef FOG\\nin float v_fog_opacity;\\n#endif\\n#ifdef RENDER_SHADOWS\\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\\n#endif\\nuniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;\\n#ifdef LIGHTING_3D_MODE\\nconst vec3 normal=vec3(0.0,0.0,1.0);\\n#ifdef RENDER_SHADOWS\\nfloat cutoffOpacity=1.0;\\n#ifdef RENDER_CUTOFF\\ncutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);\\n#endif\\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\\nvec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;\\n#else\\nfloat lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));\\n#endif\\n#else\\nfloat lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);\\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\\ncolor.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0;\\n#endif\\n#endif\\n#else\\ncolor=image_color;\\n#endif\\n#ifdef FOG\\n#ifdef ZERO_EXAGGERATION\\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\\n#else\\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\\n#endif\\n#endif\\nglFragColor=color;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_fog.vertex.glsl\"\\n#include \"_prelude_terrain.vertex.glsl\"\\nuniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;\\n#ifdef FOG\\nout float v_fog_opacity;\\n#endif\\n#ifdef RENDER_SHADOWS\\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth;\\n#endif\\nvoid main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\\n#ifdef FOG\\n#ifdef ZERO_EXAGGERATION\\nv_fog_pos=fog_position(decodedPos);\\n#else\\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\\n#endif\\n#endif\\n#ifdef RENDER_SHADOWS\\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);\\n#endif\\n}'),terrainDepth:$o(\"precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}\",'#include \"_prelude_terrain.vertex.glsl\"\\nuniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}'),skybox:$o('#include \"_prelude_fog.fragment.glsl\"\\nin lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;\\n#ifdef FOG\\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\\n#endif\\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\n}',zo),skyboxGradient:$o('#include \"_prelude_fog.fragment.glsl\"\\nin highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));\\n#ifdef FOG\\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\\n#endif\\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);glFragColor=color;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\n}',zo),skyboxCapture:$o(\"\\nin highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;\\n#define BETA_R                  vec3(5.5e-6,13.0e-6,22.4e-6)\\n#define BETA_M                  vec3(21e-6,21e-6,21e-6)\\n#define MIE_G                   0.76\\n#define DENSITY_HEIGHT_SCALE_R  8000.0\\n#define DENSITY_HEIGHT_SCALE_M  1200.0\\n#define PLANET_RADIUS           6360e3\\n#define ATMOSPHERE_RADIUS       6420e3\\n#define SAMPLE_STEPS            10\\n#define DENSITY_STEPS           4\\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}\",\"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}\"),globeRaster:$o('#include \"_prelude_fog.fragment.glsl\"\\n#include \"_prelude_lighting.glsl\"\\nuniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0;\\n#ifndef FOG\\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\\n#endif\\nvoid main() {vec4 color;\\n#ifdef CUSTOM_ANTIALIASING\\nvec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);\\n#ifdef LIGHTING_3D_MODE\\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\\nraster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(raster.rgb*antialias,antialias);\\n#else\\nraster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);\\n#endif\\n#else\\ncolor=vec4(raster.rgb*antialias,raster.a*antialias);\\n#endif\\n#else\\ncolor=texture(u_image0,v_pos0);\\n#ifdef LIGHTING_3D_MODE\\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\\ncolor=apply_lighting_with_emission_ground(color,color.a);color.a=1.0;\\n#else\\ncolor=apply_lighting_ground(color);\\n#endif\\n#endif\\n#endif\\n#ifdef FOG\\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\\n#endif\\ncolor*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_fog.vertex.glsl\"\\n#include \"_prelude_terrain.vertex.glsl\"\\nuniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;\\n#ifdef GLOBE_POLES\\nin vec3 a_globe_pos;in vec2 a_uv;\\n#else\\nin vec2 a_pos;\\n#endif\\nout vec2 v_pos0;void main() {\\n#ifdef GLOBE_POLES\\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\\n#else\\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\\n#endif\\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\\n#ifdef GLOBE_POLES\\nvec3 up_vector=globe_derived_up_vector;\\n#else\\nvec3 up_vector=elevationVector(tile_pos);\\n#endif\\nfloat height=elevation(tile_pos);globe_pos+=up_vector*height;\\n#ifndef GLOBE_POLES\\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\\n#endif\\n#ifdef GLOBE_POLES\\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\\n#else\\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\\n#endif\\ngl_Position=u_proj_matrix*interpolated_pos;\\n#ifdef FOG\\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\\n#endif\\n}'),globeAtmosphere:$o('#include \"_prelude_fog.fragment.glsl\"\\nuniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\\n#ifdef PROJECTION_GLOBE_VIEW\\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {\\n#ifdef ALPHA_PASS\\nglFragColor=vec4(0,0,0,0);return;\\n#else\\n#ifdef NATIVE\\nglFragColor=vec4(1,1,1,1);\\n#else\\nglFragColor=vec4(0,0,0,1);\\n#endif\\nreturn;\\n#endif\\n}\\n#endif\\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\\n#ifdef PROJECTION_GLOBE_VIEW\\nhighp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\\n#else\\nhorizon_angle=horizon_angle_mercator;\\n#endif\\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;\\n#ifdef ALPHA_PASS\\nfloat a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);\\n#else\\nvec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;\\n#ifndef NATIVE\\nc=dither(c,gl_FragCoord.xy+u_temporal_offset);\\n#endif\\nglFragColor=vec4(c*t,t);\\n#endif\\n}',\"in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}\"),model:$o('#include \"_prelude_fog.fragment.glsl\"\\n#include \"_prelude_shadow.fragment.glsl\"\\n#include \"_prelude_lighting.glsl\"\\nuniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;\\n#ifdef RENDER_SHADOWS\\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;in float v_depth_shadows;\\n#endif\\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\\nuniform vec4 u_occlusionTextureTransform;\\n#endif\\n#pragma mapbox: define-attribute highp vec3 normal_3f\\n#pragma mapbox: define-attribute highp vec3 color_3f\\n#pragma mapbox: define-attribute highp vec4 color_4f\\n#pragma mapbox: define-attribute highp vec2 uv_2f\\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\\n#pragma mapbox: initialize-attribute highp vec3 color_3f\\n#pragma mapbox: initialize-attribute highp vec4 color_4f\\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\\n#ifdef HAS_ATTRIBUTE_a_pbr\\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\\n#endif\\n#ifdef HAS_TEXTURE_u_baseColorTexture\\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;\\n#endif\\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\\nuniform sampler2D u_metallicRoughnessTexture;\\n#endif\\n#ifdef HAS_TEXTURE_u_occlusionTexture\\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\\n#endif\\n#ifdef HAS_TEXTURE_u_normalTexture\\nuniform sampler2D u_normalTexture;\\n#endif\\n#ifdef HAS_TEXTURE_u_emissionTexture\\nuniform sampler2D u_emissionTexture;\\n#endif\\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\\nin highp float v_depth;uniform sampler2D u_depthTexture;uniform vec2 u_inv_depth_size;bool isOccluded() {vec2 coord=gl_FragCoord.xy*u_inv_depth_size;highp float depth=unpack_depth(texture(u_depthTexture,coord));return v_depth > depth+0.0005;}\\n#endif\\n#define saturate(_x) clamp(_x,0.,1.)\\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)\\n{\\n#ifdef LIGHTING_3D_MODE\\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\\n#ifdef RENDER_SHADOWS\\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\\n#else\\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\\n#endif\\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\\n#else\\nvec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3;\\n#endif\\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\\n#ifdef HAS_ATTRIBUTE_a_color_3f\\nalbedo*=vec4(color_3f,1.0);\\n#endif\\n#ifdef HAS_ATTRIBUTE_a_pbr\\n#else\\n#ifdef HAS_ATTRIBUTE_a_color_4f\\nalbedo*=color_4f;\\n#endif\\n#endif\\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\\nif(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;\\n#endif\\nif(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}\\n#endif\\nreturn vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {\\n#ifdef HAS_TEXTURE_u_normalTexture\\nhighp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;\\n#else\\nreturn mat3(1.0);\\n#endif\\n}highp vec3 getNormal(){highp vec3 n;\\n#ifdef HAS_ATTRIBUTE_a_normal_3f\\nn=normalize(normal_3f);\\n#else\\nhighp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0;\\n#endif\\n#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\\nvec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);\\n#endif\\nreturn n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;\\n#ifdef HAS_ATTRIBUTE_a_pbr\\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\\n#endif\\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) \\nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\\n#endif\\nconst float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)\\n{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)\\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\\n{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)\\n{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)\\n{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)\\n{\\n#ifdef LIGHTING_3D_MODE\\nreturn mat.diffuseColor;\\n#else\\nreturn mat.diffuseColor/PI;\\n#endif\\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\\n{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)\\n{vec3 env_light=vec3(0.65,0.65,0.65);\\n#ifdef LIGHTING_3D_MODE\\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\\n#endif\\nvec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)\\n{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;\\n#ifdef RENDER_SHADOWS\\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\\n#else\\nlighting_factor=NdotL;\\n#endif\\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\\n#if !defined(LIGHTING_3D_MODE)\\nconst vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);\\n#endif\\ncolor*=intensityFactor;return color;}void main() {\\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\\nif (isOccluded()) {discard;}\\n#endif\\nvec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;\\n#ifdef LIGHTING_3D_MODE\\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\\n#endif\\nvec4 finalColor;\\n#ifdef DIFFUSE_SHADED\\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\\n#ifdef HAS_TEXTURE_u_occlusionTexture\\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\\n#endif\\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\\n#else\\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\\n#else\\nvec2 uv=uv_2f;\\n#endif\\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\\n#endif\\nvec4 emissive=u_emissiveFactor;\\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\\n#endif\\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\\n#ifdef HAS_ATTRIBUTE_a_pbr\\nfloat resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);color=mix(color,v_color_mix.rgb,min(1.0,resEmission));\\n#ifdef HAS_ATTRIBUTE_a_color_4f\\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);\\n#endif\\n#endif\\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\\n#endif\\n#ifdef FOG\\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\\n#endif\\n#ifdef RENDER_CUTOFF\\nfinalColor*=v_cutoff_opacity;\\n#endif\\n#ifdef INDICATOR_CUTOUT\\nfinalColor=applyCutout(finalColor);\\n#endif\\nglFragColor=finalColor;\\n#ifdef OVERDRAW_INSPECTOR\\nglFragColor=vec4(1.0);\\n#endif\\nHANDLE_WIREFRAME_DEBUG;}','#include \"_prelude_fog.vertex.glsl\"\\n#include \"_prelude_shadow.vertex.glsl\"\\nin vec3 a_pos_3f;\\n#pragma mapbox: define-attribute highp vec3 normal_3f\\n#pragma mapbox: define-attribute highp vec2 uv_2f\\n#pragma mapbox: define-attribute highp vec3 color_3f\\n#pragma mapbox: define-attribute highp vec4 color_4f\\n#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr\\n#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength\\nuniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\\n#ifdef INSTANCED_ARRAYS\\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\\n#else\\nuniform highp mat4 u_normal_matrix;\\n#endif\\n#ifdef RENDER_SHADOWS\\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth_shadows;\\n#endif\\nout vec4 v_position_height;out lowp vec4 v_color_mix;\\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\\nout highp float v_depth;\\n#endif\\n#ifdef HAS_ATTRIBUTE_a_pbr\\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\\n#endif\\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\\n#pragma mapbox: initialize-attribute highp vec3 color_3f\\n#pragma mapbox: initialize-attribute highp vec4 color_4f\\n#pragma mapbox: initialize-attribute-custom highp vec4 pbr\\n#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength\\nhighp mat4 normal_matrix;\\n#ifdef INSTANCED_ARRAYS\\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\\n#else\\nnormal_matrix=u_normal_matrix;\\n#endif\\nvec3 local_pos;mat3 rs;\\n#ifdef MODEL_POSITION_ON_GPU\\nvec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=u_matrix*pos;pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;\\n#else\\nlocal_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);\\n#endif\\nv_position_height.w=a_pos_3f.z;\\n#ifdef HAS_ATTRIBUTE_a_pbr\\nvec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;\\n#endif\\n#ifdef FOG\\nv_fog_pos=fog_position(local_pos);\\n#endif\\n#ifdef RENDER_CUTOFF\\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\\n#endif\\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\\nv_depth=gl_Position.z/gl_Position.w;\\n#endif\\n#ifdef HAS_ATTRIBUTE_a_normal_3f\\n#ifdef MODEL_POSITION_ON_GPU\\nfloat x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);\\n#else\\nnormal_3f=vec3(normal_matrix*vec4(normal_3f,0));\\n#endif\\n#endif\\n#ifdef HAS_ATTRIBUTE_a_pbr\\n#ifdef HAS_ATTRIBUTE_a_color_4f\\nv_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);\\n#endif\\n#endif\\n#ifdef RENDER_SHADOWS\\nvec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);\\n#ifdef NORMAL_OFFSET\\n#ifdef HAS_ATTRIBUTE_a_normal_3f\\n#ifdef MODEL_POSITION_ON_GPU\\nvec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\\n#else\\nvec3 offset=shadow_normal_offset_model(normalize(normal_3f));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\\n#endif\\n#endif\\n#endif\\nv_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;\\n#endif\\n}'),modelDepth:$o(\"in highp float v_depth;void main() {\\n#ifndef DEPTH_TEXTURE\\nglFragColor=pack_depth(v_depth);\\n#endif\\n}\",\"in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;\\n#ifdef MODEL_POSITION_ON_GPU\\n#ifdef INSTANCED_ARRAYS\\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\\n#else\\nuniform highp mat4 u_instance;\\n#endif\\nuniform highp mat4 u_node_matrix;\\n#endif\\nvoid main() {\\n#ifdef MODEL_POSITION_ON_GPU\\nhighp mat4 instance;\\n#ifdef INSTANCED_ARRAYS\\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\\n#else\\ninstance=u_instance;\\n#endif\\nvec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=u_matrix*pos;\\n#else\\ngl_Position=u_matrix*vec4(a_pos_3f,1);\\n#endif\\nv_depth=gl_Position.z/gl_Position.w;}\"),stars:$o(\"in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)\\n{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}\",\"\\nin vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}\")};function Qo(e,t){const i=e.replace(/\\s*\\/\\/[^\\n]*\\n/g,\"\\n\").split(\"\\n\");for(let e of i)if(e=e.trim(),\"#\"===e[0]&&e.includes(\"if\")&&!e.includes(\"endif\")){e=e.replace(\"#\",\"\").replace(/ifdef|ifndef|elif|if/g,\"\").replace(/!|defined|\\(|\\)|\\|\\||&&/g,\"\").replace(/\\s+/g,\" \").trim();const i=e.split(\" \");for(const e of i)t.includes(e)||t.push(e);}}function $o(e,t){const i=/#include\\s+\"([^\"]+)\"/g,o=/#pragma mapbox: ([\\w\\-]+) ([\\w]+) ([\\w]+) ([\\w]+)/g;let r=t.match(/(attribute(\\S*)|(^\\s*|;)in) (highp |mediump |lowp )?([\\w]+) ([\\w]+)/gm);r&&(r=r.map((e=>{const t=e.split(\" \");return t[t.length-1]})),r=[...new Set(r)]);const s={},n=[],a=[];if(e=e.replace(i,((e,t)=>(a.push(t),\"\"))),(t=t.replace(i,((e,t)=>(n.push(t),\"\")))).includes(\"flat out\"))return void console.error('The usage of \"flat\" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let l=[...jo];Qo(e,l),Qo(t,l);for(const e of [...n,...a])Vo[e]||console.error(`Undefined include: ${e}`),Zo[e]||(Zo[e]=[],Qo(Vo[e],Zo[e])),l=[...l,...Zo[e]];return {fragmentSource:e=e.replace(o,((e,t,i,o,r)=>(s[r]=!0,\"define\"===t?`\\n#ifndef HAS_UNIFORM_u_${r}\\nin ${i} ${o} ${r};\\n#else\\nuniform ${i} ${o} u_${r};\\n#endif\\n`:\"initialize\"===t?`\\n#ifdef HAS_UNIFORM_u_${r}\\n    ${i} ${o} ${r} = u_${r};\\n#endif\\n`:\"define-attribute\"===t?`\\n#ifdef HAS_ATTRIBUTE_a_${r}\\n    in ${i} ${o} ${r};\\n#endif\\n`:\"initialize-attribute\"===t?\"\":void 0))),vertexSource:t=t.replace(o,((e,t,i,o,r)=>{const n=\"float\"===o?\"vec2\":o,a=r.match(/color/)?\"color\":n;return \"define-attribute-vertex-shader-only\"===t?`\\n#ifdef HAS_ATTRIBUTE_a_${r}\\nin ${i} ${o} a_${r};\\n#endif\\n`:s[r]?\"define\"===t?`\\n#ifndef HAS_UNIFORM_u_${r}\\nuniform lowp float u_${r}_t;\\nin ${i} ${n} a_${r};\\nout ${i} ${o} ${r};\\n#else\\nuniform ${i} ${o} u_${r};\\n#endif\\n`:\"initialize\"===t?\"vec4\"===a?`\\n#ifndef HAS_UNIFORM_u_${r}\\n    ${r} = a_${r};\\n#else\\n    ${i} ${o} ${r} = u_${r};\\n#endif\\n`:`\\n#ifndef HAS_UNIFORM_u_${r}\\n    ${r} = unpack_mix_${a}(a_${r}, u_${r}_t);\\n#else\\n    ${i} ${o} ${r} = u_${r};\\n#endif\\n`:\"define-attribute\"===t?`\\n#ifdef HAS_ATTRIBUTE_a_${r}\\n    in ${i} ${o} a_${r};\\n    out ${i} ${o} ${r};\\n#endif\\n`:\"initialize-attribute\"===t?`\\n#ifdef HAS_ATTRIBUTE_a_${r}\\n    ${r} = a_${r};\\n#endif\\n`:void 0:\"define\"===t?`\\n#ifndef HAS_UNIFORM_u_${r}\\nuniform lowp float u_${r}_t;\\nin ${i} ${n} a_${r};\\n#else\\nuniform ${i} ${o} u_${r};\\n#endif\\n`:\"define-instanced\"===t?\"mat4\"===a?`\\n#ifdef INSTANCED_ARRAYS\\nin vec4 a_${r}0;\\nin vec4 a_${r}1;\\nin vec4 a_${r}2;\\nin vec4 a_${r}3;\\n#else\\nuniform ${i} ${o} u_${r};\\n#endif\\n`:`\\n#ifdef INSTANCED_ARRAYS\\nin ${i} ${n} a_${r};\\n#else\\nuniform ${i} ${o} u_${r};\\n#endif\\n`:\"initialize-attribute-custom\"===t?`\\n#ifdef HAS_ATTRIBUTE_a_${r}\\n    ${i} ${o} ${r} = a_${r};\\n#endif\\n`:\"vec4\"===a?`\\n#ifndef HAS_UNIFORM_u_${r}\\n    ${i} ${o} ${r} = a_${r};\\n#else\\n    ${i} ${o} ${r} = u_${r};\\n#endif\\n`:`\\n#ifndef HAS_UNIFORM_u_${r}\\n    ${i} ${o} ${r} = unpack_mix_${a}(a_${r}, u_${r}_t);\\n#else\\n    ${i} ${o} ${r} = u_${r};\\n#endif\\n`})),staticAttributes:r,usedDefines:l,vertexIncludes:n,fragmentIncludes:a}}class Xo{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null;}bind(e,t,i,o,r,s,n,a){this.context=e;let l=this.boundPaintVertexBuffers.length!==o.length;for(let e=0;!l&&e<o.length;e++)this.boundPaintVertexBuffers[e]!==o[e]&&(l=!0);let c=this.boundDynamicVertexBuffers.length!==n.length;for(let e=0;!c&&e<n.length;e++)this.boundDynamicVertexBuffers[e]!==n[e]&&(c=!0);if(!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||l||c||this.boundIndexBuffer!==r||this.boundVertexOffset!==s)this.freshBind(t,i,o,r,s,n,a);else {e.bindVertexArrayOES.set(this.vao);for(const i of n)i&&(i.bind(),a&&i.instanceCount&&i.setVertexAttribDivisor(e.gl,t,a));r&&r.dynamicDraw&&r.bind();}}freshBind(e,t,i,o,r,s,n){const a=e.numAttributes,l=this.context,c=l.gl;this.vao&&this.destroy(),this.vao=l.gl.createVertexArray(),l.bindVertexArrayOES.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=o,this.boundVertexOffset=r,this.boundDynamicVertexBuffers=s,t.enableAttributes(c,e),t.bind(),t.setVertexAttribPointers(c,e,r);for(const t of i)t.enableAttributes(c,e),t.bind(),t.setVertexAttribPointers(c,e,r);for(const t of s)t&&(t.enableAttributes(c,e),t.bind(),t.setVertexAttribPointers(c,e,r),n&&t.instanceCount&&t.setVertexAttribDivisor(c,e,n));o&&o.bind(),l.currentNumAttributes=a;}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null);}}function Yo(t,i){const o=Math.pow(2,i.canonical.z),r=i.canonical.y;return [new e.O(0,r/o).toLngLat().lat,new e.O(0,(r+1)/o).toLngLat().lat]}function Jo(t,i,o,r,s,n,a){const l=t.context,c=l.gl,h=o.hillshadeFBO;if(!h)return;t.prepareDrawTile();const u=t.isTileAffectedByFog(i),d=t.getOrCreateProgram(\"hillshade\",{overrideFog:u});l.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,h.colorAttachment.get());const _=((t,i,o,r)=>{const s=o.paint.get(\"hillshade-shadow-color\"),n=o.paint.get(\"hillshade-highlight-color\"),a=o.paint.get(\"hillshade-accent-color\"),l=o.paint.get(\"hillshade-emissive-strength\");let c=e.bm(o.paint.get(\"hillshade-illumination-direction\"));if(\"viewport\"===o.paint.get(\"hillshade-illumination-anchor\"))c-=t.transform.angle;else if(t.style&&t.style.enable3dLights()&&t.style.directionalLight){const i=t.style.directionalLight.properties.get(\"direction\"),o=e.bT(i.x,i.y,i.z);c=e.bm(o[1]);}const h=!t.options.moving;return {u_matrix:r||t.transform.calculateProjMatrix(i.tileID.toUnwrapped(),h),u_image:0,u_latrange:Yo(0,i.tileID),u_light:[o.paint.get(\"hillshade-exaggeration\"),c],u_shadow:s,u_highlight:n,u_emissive_strength:l,u_accent:a}})(t,o,r,t.terrain?i.projMatrix:null);t.uploadCommonUniforms(l,d,i.toUnwrapped());const{tileBoundsBuffer:p,tileBoundsIndexBuffer:f,tileBoundsSegments:m}=t.getTileBoundsBuffers(o);d.draw(t,c.TRIANGLES,s,n,a,Mt.disabled,_,r.id,p,f,m);}function Ko(t,i,o){if(!i.needsDEMTextureUpload)return;const r=t.context,s=r.gl;r.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||t.getTileTexture(o.stride);const n=o.getPixels();i.demTexture?i.demTexture.update(n,{premultiply:!1}):i.demTexture=new e.T(r,n,s.R32F,{premultiply:!1}),i.needsDEMTextureUpload=!1;}function er(t,i,o){const r=t.context,s=r.gl;if(!i.dem)return;const n=i.dem;if(r.activeTexture.set(s.TEXTURE1),Ko(t,i,n),!i.demTexture)return;i.demTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE);const a=n.dim;r.activeTexture.set(s.TEXTURE0);let l=i.hillshadeFBO;if(!l){const t=new e.T(r,{width:a,height:a,data:null},s.RGBA);t.bind(s.LINEAR,s.CLAMP_TO_EDGE),l=i.hillshadeFBO=r.createFramebuffer(a,a,!0,\"renderbuffer\"),l.colorAttachment.set(t.texture);}r.bindFramebuffer.set(l.framebuffer),r.viewport.set([0,0,a,a]);const{tileBoundsBuffer:c,tileBoundsIndexBuffer:h,tileBoundsSegments:u}=t.getMercatorTileBoundsBuffers(),d=[];t.linearFloatFilteringSupported()&&d.push(\"TERRAIN_DEM_FLOAT_FORMAT\"),t.getOrCreateProgram(\"hillshadePrepare\",{defines:d}).draw(t,s.TRIANGLES,Ct.disabled,Dt.disabled,At.unblended,Mt.disabled,((t,i)=>{const o=i.stride,r=e.a9.create();return e.a9.ortho(r,0,e.Y,-e.Y,0,0,1),e.a9.translate(r,r,[0,-e.Y,0]),{u_matrix:r,u_image:1,u_dimension:[o,o],u_zoom:t.overscaledZ}})(i.tileID,n),o.id,c,h,u),i.needsHillshadePrepare=!1;}const tr=t=>({u_matrix:new e.bN(t),u_image0:new e.bR(t),u_skirt_height:new e.bQ(t),u_ground_shadow_factor:new e.bP(t)}),ir=(e,t,i)=>({u_matrix:e,u_image0:0,u_skirt_height:t,u_ground_shadow_factor:i}),or=(e,t,i,o,r,s,n,a,l,c,h,u,d,_,p,f)=>({u_proj_matrix:Float32Array.from(e),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(o),u_merc_matrix:i,u_zoom_transition:r,u_merc_center:s,u_image0:0,u_frustum_tl:n,u_frustum_tr:a,u_frustum_br:l,u_frustum_bl:c,u_globe_pos:h,u_globe_radius:u,u_viewport:d,u_grid_matrix:f?Float32Array.from(f):new Float32Array(9),u_skirt_height:_,u_far_z_cutoff:p});function rr(e,t){return null!=e&&null!=t&&!(!e.hasData()||!t.hasData())&&null!=e.demTexture&&null!=t.demTexture&&e.tileID.key!==t.tileID.key}const sr=new class{constructor(){this.operations={};}newMorphing(e,t,i,o,r){if(e in this.operations){const t=this.operations[e];t.to.tileID.key!==i.tileID.key&&(t.queued=i);}else this.operations[e]={startTime:o,phase:0,duration:r,from:t,to:i,queued:null};}getMorphValuesForProxy(e){if(!(e in this.operations))return null;const t=this.operations[e];return {from:t.from,to:t.to,phase:t.phase}}update(e){for(const t in this.operations){const i=this.operations[t];for(i.phase=(e-i.startTime)/i.duration;i.phase>=1||!this._validOp(i);)if(!this._nextOp(i,e)){delete this.operations[t];break}}}_nextOp(e,t){return !!e.queued&&(e.from=e.to,e.to=e.queued,e.queued=null,e.phase=0,e.startTime=t,!0)}_validOp(e){return e.from.hasData()&&e.to.hasData()}},nr={0:null,1:\"TERRAIN_VERTEX_MORPHING\"};function ar(e,t,i){if(0===t)return 0;const o=t<1&&514===i?.25/t:1;return 6*Math.pow(1.5,22-e)*Math.max(t,1)*o}function lr(e,t){const i=1<<e.z;return !t&&(0===e.x||e.x===i-1)||0===e.y||e.y===i-1}const cr=e=>({u_matrix:e});function hr(t,i,o,r,s){if(s>0){const n=e.f.now(),a=(n-t.timeAdded)/s,l=i?(n-i.timeAdded)/s:-1,c=o.getSource(),h=r.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),u=!i||Math.abs(i.tileID.overscaledZ-h)>Math.abs(t.tileID.overscaledZ-h),d=u&&t.refreshedUponExpiration?1:e.ad(u?a:1-l,0,1);return t.refreshedUponExpiration&&a>=1&&(t.refreshedUponExpiration=!1),i?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return {opacity:1,mix:0}}class ur extends Qt{constructor(t){const i={type:\"raster-dem\",maxzoom:t.transform.maxZoom},o=new e.bZ(e.b_(),null),r=Gt(\"mock-dem\",i,o,t.style);super(\"mock-dem\",r,!1),r.setEventedParent(this),this._sourceLoaded=!0;}_loadTile(e,t){e.state=\"loaded\",t(null);}}class dr extends Qt{constructor(t){const i=Gt(\"proxy\",{type:\"geojson\",maxzoom:t.transform.maxZoom},new e.bZ(e.b_(),null),t.style);super(\"proxy\",i,!1),i.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={};}update(e,t,i){if(e.freezeTileCoverage)return;this.transform=e;const o=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce(((t,i)=>{if(t[i.key]=\"\",!this._tiles[i.key]){const t=new Nt(i,this._source.tileSize*i.overscaleFactor(),e.tileZoom);t.state=\"loaded\",this._tiles[i.key]=t;}return t}),{});for(const e in this._tiles)e in o||(this.freeFBO(e),this._tiles[e].unloadVectorData(),delete this._tiles[e]);}freeFBO(e){const t=this.proxyCachedFBO[e];if(void 0!==t){const i=Object.values(t);this.renderCachePool.push(...i),delete this.proxyCachedFBO[e];}}deallocRenderCache(){this.renderCache.forEach((e=>e.fb.destroy())),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={};}}class _r extends e.ap{constructor(e,t,i){super(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y),this.proxyTileKey=t,this.projMatrix=i;}}class pr extends e.cp{constructor(t,i){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},t.tp.registerParameter(this._debugParams,[\"Terrain\"],\"sortTilesHiZFirst\",{},(()=>{this._style.map.triggerRepaint();})),t.tp.registerParameter(this._debugParams,[\"Terrain\"],\"disableRenderCache\",{},(()=>{this._style.map.triggerRepaint();})),t.tp.registerButton([\"Terrain\"],\"Invalidate Render Cache\",(()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint();})),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[o,r,s]=function(t){const i=new e.aQ,o=new e.az,r=131;i.reserve(17161),o.reserve(33800);const s=e.Y/128,n=e.Y+s/2,a=n+s;for(let t=-s;t<a;t+=s)for(let o=-s;o<a;o+=s){const r=o<0||o>n||t<0||t>n?24575:0,s=e.ad(Math.round(o),0,e.Y),a=e.ad(Math.round(t),0,e.Y);i.emplaceBack(s+r,a);}const l=(e,t)=>{const i=t*r+e;o.emplaceBack(i+1,i,i+r),o.emplaceBack(i+r,i+r+1,i+1);};for(let e=1;e<129;e++)for(let t=1;t<129;t++)l(t,e);return [0,129].forEach((e=>{for(let t=0;t<130;t++)l(t,e),l(e,t);})),[i,o,32768]}(),n=t.context;this.gridBuffer=n.createVertexBuffer(o,e.aS.members),this.gridIndexBuffer=n.createIndexBuffer(r),this.gridSegments=e.aE.simpleSegment(0,0,o.length,r.length),this.gridNoSkirtSegments=e.aE.simpleSegment(0,0,o.length,s),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new dr(i.map),this.orthoMatrix=e.a9.create(),e.a9.ortho(this.orthoMatrix,\"globe\"===this.painter.transform.projection.name?.015:0,e.Y,0,e.Y,0,1);const a=n.gl;this._overlapStencilMode=new Dt({func:a.GEQUAL,mask:255},0,255,a.KEEP,a.KEEP,a.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=i,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new ur(i.map),this._pendingGroundEffectLayers=[];}set style(e){e.on(\"data\",this._onStyleDataEvent.bind(this)),this._style=e,this._style.map.on(\"moveend\",(()=>{this._clearLineLayersFromRenderCache();}));}update(t,i,o){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const r=t.terrain.properties,s=0===t.terrain.drapeRenderMode,n=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=e.f.now();const a=t.terrain&&t.terrain.scope,l=r.get(\"source\"),c=s?this._mockSourceCache:t.getSourceCache(l,a);if(!c)return void e.w(`Couldn't find terrain source \"${l}\".`);if(this.sourceCache=c,this._exaggeration=n?this.calculateExaggeration(i):r.get(\"exaggeration\"),!i.projection.requiresDraping&&n&&0===this._exaggeration)return void this._disable();this.enabled=!0;const h=()=>{this.sourceCache.used&&e.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.\\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const t=this.getScaledDemTileSize();this.sourceCache.update(i,t,!0),this.resetTileLookupCache(this.sourceCache.id);};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,h(),this._initializing=!0),h(),i.updateElevation(!0,o),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(i),this._emptyDEMTextureDirty=!0,this._previousZoom=i.zoom;}else this._disable();}calculateExaggeration(t){const i=this._previousCameraAltitude,o=t.getFreeCameraOptions().position.z/t.pixelsPerMeter*t.worldSize;this._previousCameraAltitude=o;const r=null!=i?o-i:Number.MAX_VALUE;if(Math.abs(r)<2)return this._exaggeration;const s=t.zoom,n=this._style.terrain;if(!this._previousUpdateTimestamp)return n.getExaggeration(s);let a=s-this._previousZoom;const l=this._previousUpdateTimestamp;let c=s;null!=this._evaluationZoom&&(c=this._evaluationZoom,Math.abs(s-c)>.5&&(a=.5*(s-c+a)),a*r<0&&(c+=a)),this._evaluationZoom=c;const h=n.getExaggeration(c),u=h===n.getExaggeration(Math.max(0,c-.1));if(u&&Math.abs(h-this._exaggeration)<.01)return h;let d=Math.min(.1,.00375*(this._updateTimestamp-l));return (u||h<.1||Math.abs(a)<1e-4)&&(d=Math.min(.2,4*d)),e.X(this._exaggeration,h,d)}resetTileLookupCache(e){this._findCoveringTileCache[e]={};}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(e){e.coord&&\"source\"===e.dataType?this._clearRenderCacheForTile(e.sourceCacheId,e.coord):\"style\"===e.dataType&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0);}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const e in this._style._mergedSourceCaches)this._style._mergedSourceCaches[e].usedForTerrain=!1;}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach((e=>e.fb.destroy())),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy();}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const e=2*this.proxySourceCache.getSource().tileSize;return [e,e]}set useVertexMorphing(e){this._useVertexMorphing=e;}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const i=this.proxySourceCache,o=this.painter.transform;this._initializing&&(this._initializing=0===o._centerAltitude&&-1===this.getAtPointOrZero(e.O.fromLngLat(o.center),-1),this._emptyDEMTextureDirty=!this._initializing);const r=this.proxyCoords=i.getIds().map((e=>{const t=i.getTileByID(e).tileID;return t.projMatrix=o.calculateProjMatrix(t.toUnwrapped()),t}));!function(t,i){const o=i.transform.pointCoordinate(i.transform.getCameraPoint()),r=new e.P(o.x,o.y);t.sort(((t,i)=>{if(i.overscaledZ-t.overscaledZ)return i.overscaledZ-t.overscaledZ;const o=new e.P(t.canonical.x+(1<<t.canonical.z)*t.wrap,t.canonical.y),s=new e.P(i.canonical.x+(1<<i.canonical.z)*i.wrap,i.canonical.y),n=r.mult(1<<t.canonical.z);return n.x-=.5,n.y-=.5,n.distSqr(o)-n.distSqr(s)}));}(r,this.painter);const s=this.proxyToSource||{};this.proxyToSource={},r.forEach((e=>{this.proxyToSource[e.key]={};})),this.terrainTileForTile={};const n=this._style._mergedSourceCaches;for(const e in n){const i=n[e];if(!i.used)continue;if(i!==this.sourceCache&&this.resetTileLookupCache(i.id),this._setupProxiedCoordsForOrtho(i,t[e],s),i.usedForTerrain)continue;const o=t[e];i.getSource().reparseOverscaled&&this._assignTerrainTiles(o);}this.proxiedCoords[i.id]=r.map((e=>new _r(e,e.key,this.orthoMatrix))),this._assignTerrainTiles(r),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(s),this.renderingToTexture=!1;const a={};this._visibleDemTiles=[];for(const e of this.proxyCoords){const t=this.terrainTileForTile[e.key];if(!t)continue;const i=t.tileID.key;i in a||(this._visibleDemTiles.push(t),a[i]=i);}}_assignTerrainTiles(e){this._initializing||e.forEach((e=>{if(this.terrainTileForTile[e.key])return;const t=this._findTileCoveringTileID(e,this.sourceCache);t&&(this.terrainTileForTile[e.key]=t);}));}_prepareDEMTextures(){const e=this.painter.context,t=e.gl;for(const i in this.terrainTileForTile){const o=this.terrainTileForTile[i],r=o.dem;!r||o.demTexture&&!o.needsDEMTextureUpload||(e.activeTexture.set(t.TEXTURE1),Ko(this.painter,o,r));}}_prepareDemTileUniforms(e,t,i,o){if(!t||null==t.demTexture)return !1;const r=e.tileID.canonical,s=Math.pow(2,t.tileID.canonical.z-r.z),n=o||\"\";return i[`u_dem_tl${n}`]=[r.x*s%1,r.y*s%1],i[`u_dem_scale${n}`]=s,!0}get emptyDEMTexture(){return !this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const t=this.painter.context,i=t.gl;if(!this._emptyDepthBufferTexture){const o=new e.h({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new e.T(t,o,i.RGBA,{premultiply:!1});}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let e=0;const t=this._visibleDemTiles.reduce(((t,i)=>{if(!i.dem)return t;const o=i.dem.tree.minimums[0];return o>0&&e++,t+o}),0);return e?t/e:0}_updateEmptyDEMTexture(){const t=this.painter.context,i=t.gl;t.activeTexture.set(i.TEXTURE2);const o=this._getLoadedAreaMinimum(),[r,s]=(()=>{const t=new e.cr({width:1,height:1},new Float32Array([o]));return [i.R32F,t]})();this._emptyDEMTextureDirty=!1;let n=this._emptyDEMTexture;return n?n.update(s,{premultiply:!1}):n=this._emptyDEMTexture=new e.T(t,s,r,{premultiply:!1}),n}setupElevationDraw(t,i,o){const r=this.painter.context,s=r.gl,n={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0};n.u_exaggeration=this.exaggeration();let a=null,l=null,c=1;if(o&&o.morphing&&this._useVertexMorphing){const e=o.morphing.srcDemTile,i=o.morphing.dstDemTile;c=o.morphing.phase,e&&i&&(this._prepareDemTileUniforms(t,e,n,\"_prev\")&&(l=e),this._prepareDemTileUniforms(t,i,n)&&(a=i));}const h=e=>e&&e.demTexture&&this.painter.linearFloatFilteringSupported()?s.LINEAR:s.NEAREST,u=e=>{n.u_dem_size=1===e.size[0]?1:e.size[0]-2;};if(l&&a)r.activeTexture.set(s.TEXTURE2),a.demTexture.bind(h(a),s.CLAMP_TO_EDGE),r.activeTexture.set(s.TEXTURE4),l.demTexture.bind(h(l),s.CLAMP_TO_EDGE),a.demTexture&&u(a.demTexture),n.u_dem_lerp=c;else {a=this.terrainTileForTile[t.tileID.key],r.activeTexture.set(s.TEXTURE2);const e=this._prepareDemTileUniforms(t,a,n)?a.demTexture:this.emptyDEMTexture;e.bind(h(a),s.CLAMP_TO_EDGE),u(e);}if(r.activeTexture.set(s.TEXTURE3),o&&o.useDepthForOcclusion?(this._depthTexture&&this._depthTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE),this._depthFBO&&(n.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height])):(this.emptyDepthBufferTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE),n.u_depth_size_inv=[1,1]),o&&o.useMeterToDem&&a){const t=(1<<a.tileID.canonical.z)*e.bo(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;n.u_meter_to_dem=t;}if(o&&o.labelPlaneMatrixInv&&(n.u_label_plane_matrix_inv=o.labelPlaneMatrixInv),i.setTerrainUniformValues(r,n),\"globe\"===this.painter.transform.projection.name){const e=this.globeUniformValues(this.painter.transform,t.tileID.canonical,o&&o.useDenormalizedUpVectorScale);i.setGlobeUniformValues(r,e);}}globeUniformValues(t,i,o){const r=t.projection;return {u_tile_tl_up:r.upVector(i,0,0),u_tile_tr_up:r.upVector(i,e.Y,0),u_tile_br_up:r.upVector(i,e.Y,e.Y),u_tile_bl_up:r.upVector(i,0,e.Y),u_tile_up_scale:o?e.cq(1):r.upVectorScale(i,t.center.lat,t.worldSize).metersToTile}}renderToBackBuffer(t){const i=this.painter,o=this.painter.context;0!==t.length&&(o.bindFramebuffer.set(null),o.viewport.set([0,0,i.width,i.height]),i.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(t,i,o,r,s){if(\"globe\"===t.transform.projection.name)!function(t,i,o,r,s){const n=t.context,a=n.gl;let l,c;const h=t.transform,u=e.ci(t,n,h),d=(e,i)=>{if(c===i)return;const o=[nr[i],\"PROJECTION_GLOBE_VIEW\"];u&&o.push(\"CUSTOM_ANTIALIASING\");const r=t.isTileAffectedByFog(e);l=t.getOrCreateProgram(\"globeRaster\",{defines:o,overrideFog:r}),c=i;},_=t.colorModeForRenderPass(),p=new Ct(a.LEQUAL,Ct.ReadWrite,t.depthRangeFor3D);sr.update(s);const f=e.cj(h),m=[e.a8(h.center.lng),e.ah(h.center.lat)],g=t.globeSharedBuffers,v=[h.width*e.f.devicePixelRatio,h.height*e.f.devicePixelRatio],x=Float32Array.from(h.globeMatrix),y={useDenormalizedUpVectorScale:!0};{const h=t.transform,u=ar(h.zoom,i.exaggeration(),i.sourceCache._source.tileSize);c=-1;const b=a.TRIANGLES;for(const c of r){const r=o.getTile(c),w=Dt.disabled,T=i.prevTerrainTileForTile[c.key],E=i.terrainTileForTile[c.key];rr(T,E)&&sr.newMorphing(c.key,T,E,s,250),n.activeTexture.set(a.TEXTURE0),r.texture&&r.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const S=sr.getMorphValuesForProxy(c.key),C=S?1:0;S&&e.k(y,{morphing:{srcDemTile:S.from,dstDemTile:S.to,phase:e.ch(S.phase)}});const I=e.ck(c.canonical),D=e.cl(I.getCenter().lat),R=e.cm(c.canonical,I,D,h.worldSize/h._pixelsPerMercatorPixel),A=e.aW(e.cn(c.canonical)),P=or(h.expandedFarZProjMatrix,x,f,A,e.W(h.zoom),m,h.frustumCorners.TL,h.frustumCorners.TR,h.frustumCorners.BR,h.frustumCorners.BL,h.globeCenterInViewSpace,h.globeRadius,v,u,h._farZ,R);if(d(c,C),l&&(i.setupElevationDraw(r,l,y),t.uploadCommonUniforms(n,l,c.toUnwrapped()),g)){const[e,i,o]=g.getGridBuffers(D,0!==u);l.draw(t,b,p,w,_,Mt.backCCW,P,\"globe_raster\",e,i,o);}}}if(g&&(t.renderDefaultNorthPole||t.renderDefaultSouthPole)){const s=[\"GLOBE_POLES\",\"PROJECTION_GLOBE_VIEW\"];u&&s.push(\"CUSTOM_ANTIALIASING\"),l=t.getOrCreateProgram(\"globeRaster\",{defines:s});for(const s of r){const{x:r,y:c,z:u}=s.canonical,d=0===c,f=c===(1<<u)-1,[x,b,w,T]=g.getPoleBuffers(u,!1);if(T&&(d||f)){const c=o.getTile(s);n.activeTexture.set(a.TEXTURE0),c.texture&&c.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);let g=e.co(u,r,h);const E=e.aW(e.cn(s.canonical)),S=(e,i)=>e.draw(t,a.TRIANGLES,p,Dt.disabled,_,Mt.disabled,or(h.expandedFarZProjMatrix,g,g,E,0,m,h.frustumCorners.TL,h.frustumCorners.TR,h.frustumCorners.BR,h.frustumCorners.BL,h.globeCenterInViewSpace,h.globeRadius,v,0,h._farZ),\"globe_pole_raster\",i,w,T);i.setupElevationDraw(c,l,y),t.uploadCommonUniforms(n,l,s.toUnwrapped()),d&&t.renderDefaultNorthPole&&S(l,x),f&&t.renderDefaultSouthPole&&(g=e.a9.scale(e.a9.create(),g,[1,-1,1]),S(l,b));}}}}(t,i,o,r,s);else {const n=t.context,a=n.gl;let l,c;const h=t.shadowRenderer,u=mo(t,t.longestCutoffRange),d=e=>{if(c===e)return;const i=[];i.push(nr[e]),u.shouldRenderCutoff&&i.push(\"RENDER_CUTOFF\"),l=t.getOrCreateProgram(\"terrainRaster\",{defines:i}),c=e;},_=t.colorModeForRenderPass(),p=new Ct(a.LEQUAL,Ct.ReadWrite,t.depthRangeFor3D);sr.update(s);const f=t.transform,m=ar(f.zoom,i.exaggeration(),i.sourceCache._source.tileSize);let g=[0,0,0];if(h){const e=t.style.directionalLight,i=t.style.ambientLight;e&&i&&(g=To(e,i));}{c=-1;const v=a.TRIANGLES,[x,y]=[i.gridIndexBuffer,i.gridSegments];for(const c of r){const r=o.getTile(c),b=Dt.disabled,w=i.prevTerrainTileForTile[c.key],T=i.terrainTileForTile[c.key];rr(w,T)&&sr.newMorphing(c.key,w,T,s,250),n.activeTexture.set(a.TEXTURE0),r.texture&&r.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const E=sr.getMorphValuesForProxy(c.key),S=E?1:0;let C;E&&(C={morphing:{srcDemTile:E.from,dstDemTile:E.to,phase:e.ch(E.phase)}});const I=ir(c.projMatrix,lr(c.canonical,f.renderWorldCopies)?m/10:m,g);if(d(S),!l)continue;i.setupElevationDraw(r,l,C);const D=c.toUnwrapped();h&&h.setupShadows(D,l),t.uploadCommonUniforms(n,l,D,null,u),l.draw(t,v,p,b,_,Mt.backCCW,I,\"terrain_raster\",i.gridBuffer,x,y);}}}}(i,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,i.gpuTimingDeferredRenderEnd(),t.splice(0,t.length));}renderBatch(t){if(0===this._drapedRenderBatches.length)return t+1;this.renderingToTexture=!0;const i=this.painter,o=this.painter.context,r=this.proxySourceCache,s=this.proxiedCoords[r.id],n=this._drapedRenderBatches.shift(),a=i.style.order,l=[];let c=0;for(const h of s){const s=r.getTileByID(h.proxyTileKey),u=r.proxyCachedFBO[h.key]?r.proxyCachedFBO[h.key][t]:void 0,d=void 0!==u?r.renderCache[u]:this.pool[c++],_=void 0!==u;if(s.texture=d.tex,_&&!d.dirty){l.push(s.tileID);continue}let p;o.bindFramebuffer.set(d.fb.framebuffer),this.renderedToTile=!1,d.dirty&&(o.clear({color:e.aA.transparent,stencil:0}),d.dirty=!1);for(let e=n.start;e<=n.end;++e){const t=i.style._mergedLayers[a[e]];if(t.isHidden(i.transform.zoom))continue;const r=i.style.getLayerSourceCache(t),s=r?this.proxyToSource[h.key][r.id]:[h];if(!s)continue;const n=s;o.viewport.set([0,0,d.fb.width,d.fb.height]),p!==(r?r.id:null)&&(this._setupStencil(d,s,t,r),p=r?r.id:null),i.renderLayer(i,r,t,n);}if(0===this._drapedRenderBatches.length)for(const e of this._pendingGroundEffectLayers){const t=i.style._mergedLayers[a[e]];if(t.isHidden(i.transform.zoom))continue;const r=i.style.getLayerSourceCache(t),s=r?this.proxyToSource[h.key][r.id]:[h];if(!s)continue;const n=s;o.viewport.set([0,0,d.fb.width,d.fb.height]),p!==(r?r.id:null)&&(this._setupStencil(d,s,t,r),p=r?r.id:null),i.renderLayer(i,r,t,n);}this.renderedToTile?(d.dirty=!0,l.push(s.tileID)):_||--c,5===c&&(c=0,this.renderToBackBuffer(l));}return this.renderToBackBuffer(l),this.renderingToTexture=!1,o.bindFramebuffer.set(null),o.viewport.set([0,0,i.width,i.height]),n.end+1}postRender(){}isLayerOrderingCorrect(e){const t=e.order.length;let i=-1,o=t;for(let r=0;r<t;++r)this._style.isLayerDraped(e._mergedLayers[e.order[r]])?i=Math.max(i,r):o=Math.min(o,r);return o>i}getMinElevationBelowMSL(){let e=0;return this._visibleDemTiles.filter((e=>e.dem)).forEach((t=>{e=Math.min(e,t.dem.tree.minimums[0]);})),0===e?e:(e-30)*this._exaggeration}raycast(e,t,i){if(!this._visibleDemTiles)return null;const o=this._visibleDemTiles.filter((e=>e.dem)).map((o=>{const r=o.tileID,s=1<<r.overscaledZ,{x:n,y:a}=r.canonical,l=n/s,c=(n+1)/s,h=a/s,u=(a+1)/s;return {minx:l,miny:h,maxx:c,maxy:u,t:o.dem.tree.raycastRoot(l,h,c,u,e,t,i),tile:o}}));o.sort(((e,t)=>(null!==e.t?e.t:Number.MAX_VALUE)-(null!==t.t?t.t:Number.MAX_VALUE)));for(const r of o){if(null==r.t)return null;const o=r.tile.dem.tree.raycast(r.minx,r.miny,r.maxx,r.maxy,e,t,i);if(null!=o)return o}return null}_createFBO(){const t=this.painter.context,i=t.gl,o=this.drapeBufferSize;t.activeTexture.set(i.TEXTURE0);const r=new e.T(t,{width:o[0],height:o[1],data:null},i.RGBA);r.bind(i.LINEAR,i.CLAMP_TO_EDGE);const s=t.createFramebuffer(o[0],o[1],!0,null);return s.colorAttachment.set(r.texture),s.depthAttachment=new Et(t,s.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,o[0],o[1]),this._stencilRef=0,s.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):s.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&i.texParameterf(i.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:s,tex:r,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO());}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache)return !0;if(this._style.hasLightTransitions())return !0;for(const e in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[e].hasTransition())return !0;return this._style.order.some((e=>{const t=this._style._mergedLayers[e],i=t.isHidden(this.painter.transform.zoom);return \"custom\"===t.type?!i&&t.shouldRedrape():!i&&t.hasTransition()}))}_clearLineLayersFromRenderCache(){let t=!1;for(const e of this._style.getSources())if(e instanceof Re){t=!0;break}if(!t)return;const i={};for(let t=0;t<this._style.order.length;++t){const o=this._style._mergedLayers[this._style.order[t]],r=this._style.getLayerSourceCache(o);if(r&&!i[r.id]&&!o.isHidden(this.painter.transform.zoom)&&\"line\"===o.type&&o.widthExpression()instanceof e.Z){i[r.id]=!0;for(const e of this.proxyCoords){const t=this.proxyToSource[e.key][r.id];if(t)for(const e of t)this._clearRenderCacheForTile(r.id,e);}}}}_clearRasterLayersFromRenderCache(){let e=!1;for(const t in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[t]._source instanceof Ae){e=!0;break}if(!e)return;const t={};for(let e=0;e<this._style.order.length;++e){const i=this._style._mergedLayers[this._style.order[e]],o=this._style.getLayerSourceCache(i);if(!o||t[o.id])continue;if(i.isHidden(this.painter.transform.zoom)||\"raster\"!==i.type)continue;const r=i.paint.get(\"raster-fade-duration\");for(const e of this.proxyCoords){const t=this.proxyToSource[e.key][o.id];if(t)for(const e of t){const t=hr(o.getTile(e),o.findLoadedParent(e,0),o,this.painter.transform,r);(1!==t.opacity||0!==t.mix)&&this._clearRenderCacheForTile(o.id,e);}}}}_setupDrapedRenderBatches(){const t=this._style.order,i=t.length;if(0===i)return;const o=[];this._pendingGroundEffectLayers=[];let r,s=0,n=this._style._mergedLayers[t[s]];for(;!this._style.isLayerDraped(n)&&n.isHidden(this.painter.transform.zoom)&&++s<i;)n=this._style._mergedLayers[t[s]];for(;s<i;++s){const e=this._style._mergedLayers[t[s]];e.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(e)?void 0===r&&(r=s):(\"fill-extrusion\"===e.type&&this._pendingGroundEffectLayers.push(s),void 0!==r&&(o.push({start:r,end:s-1}),r=void 0)));}if(void 0!==r&&o.push({start:r,end:s-1}),0!==o.length){const t=o[o.length-1];this._pendingGroundEffectLayers.every((e=>e>t.end))||e.w(\"fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.\");}this._drapedRenderBatches=o;}_setupRenderCache(e){const t=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,t.renderCache.length>t.renderCachePool.length){const e=Object.values(t.proxyCachedFBO);t.proxyCachedFBO={};for(let i=0;i<e.length;++i){const o=Object.values(e[i]);t.renderCachePool.push(...o);}}return}this._clearRasterLayersFromRenderCache();const i=this.proxyCoords,o=this._tilesDirty;for(let r=i.length-1;r>=0;r--){const s=i[r];if(t.getTileByID(s.key),void 0!==t.proxyCachedFBO[s.key]){const i=e[s.key],r=this.proxyToSource[s.key];let n=0;for(const e in r){const t=r[e],s=i[e];if(!s||s.length!==t.length||t.some(((t,i)=>t!==s[i]||o[e]&&o[e].hasOwnProperty(t.key)))){n=-1;break}++n;}for(const e in t.proxyCachedFBO[s.key])t.renderCache[t.proxyCachedFBO[s.key][e]].dirty=n<0||n!==Object.values(i).length;}}const r=[...this._drapedRenderBatches];r.sort(((e,t)=>t.end-t.start-(e.end-e.start)));for(const e of r)for(const o of i){if(t.proxyCachedFBO[o.key])continue;let i=t.renderCachePool.pop();void 0===i&&t.renderCache.length<50&&(i=t.renderCache.length,t.renderCache.push(this._createFBO())),void 0!==i&&(t.proxyCachedFBO[o.key]={},t.proxyCachedFBO[o.key][e.start]=i,t.renderCache[i].dirty=!0);}this._tilesDirty={};}_setupStencil(e,t,i,o){if(!o||!this._sourceTilesOverlap[o.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const r=this.painter.context,s=r.gl;if(t.length<=1)return void(this._overlapStencilType=!1);let n;if(i.isTileClipped())n=t.length,this._overlapStencilMode.test={func:s.EQUAL,mask:255},this._overlapStencilType=\"Clip\";else {if(!(t[0].overscaledZ>t[t.length-1].overscaledZ))return void(this._overlapStencilType=!1);n=1,this._overlapStencilMode.test={func:s.GREATER,mask:255},this._overlapStencilType=\"Mask\";}this._stencilRef+n>255&&(r.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=n,this._overlapStencilMode.ref=this._stencilRef,i.isTileClipped()&&this._renderTileClippingMasks(t,this._overlapStencilMode.ref);}clipOrMaskOverlapStencilType(){return \"Clip\"===this._overlapStencilType||\"Mask\"===this._overlapStencilType}stencilModeForRTTOverlap(e){return this.renderingToTexture&&this._overlapStencilType?(\"Clip\"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[e.key]),this._overlapStencilMode):Dt.disabled}_renderTileClippingMasks(e,t){const i=this.painter,o=this.painter.context,r=o.gl;i._tileClippingMaskIDs={},o.setColorMode(At.disabled),o.setDepthMode(Ct.disabled);const s=i.getOrCreateProgram(\"clippingMask\");for(const o of e){const e=i._tileClippingMaskIDs[o.key]=--t;s.draw(i,r.TRIANGLES,Ct.disabled,new Dt({func:r.ALWAYS,mask:0},e,255,r.KEEP,r.KEEP,r.REPLACE),At.disabled,Mt.disabled,cr(o.projMatrix),\"$clipping\",i.tileExtentBuffer,i.quadTriangleIndexBuffer,i.tileExtentSegments);}}pointCoordinate(t){const i=this.painter.transform;if(t.x<0||t.x>i.width||t.y<0||t.y>i.height)return null;const o=[t.x,t.y,1,1];e.aa.transformMat4(o,o,i.pixelMatrixInverse),e.aa.scale(o,o,1/o[3]),o[0]/=i.worldSize,o[1]/=i.worldSize;const r=i._camera.position,s=e.bo(1,i.center.lat),n=[r[0],r[1],r[2]/s,0],a=e.Q.subtract([],o.slice(0,3),n);e.Q.normalize(a,a);const l=this.raycast(n,a,this._exaggeration);return null!==l&&l?(e.Q.scaleAndAdd(n,n,a,l),n[3]=n[2],n[2]*=s,n):null}drawDepth(){const t=this.painter,i=t.context,o=this.proxySourceCache,r=Math.ceil(t.width),s=Math.ceil(t.height);if(!this._depthFBO||this._depthFBO.width===r&&this._depthFBO.height===s||(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),!this._depthFBO){const t=i.gl,o=i.createFramebuffer(r,s,!0,\"renderbuffer\");i.activeTexture.set(t.TEXTURE0);const n=new e.T(i,{width:r,height:s,data:null},t.RGBA);n.bind(t.NEAREST,t.CLAMP_TO_EDGE),o.colorAttachment.set(n.texture);const a=i.createRenderbuffer(i.gl.DEPTH_COMPONENT16,r,s);o.depthAttachment.set(a),this._depthFBO=o,this._depthTexture=n;}i.bindFramebuffer.set(this._depthFBO.framebuffer),i.viewport.set([0,0,r,s]),function(e,t,i,o){if(\"globe\"===e.transform.projection.name)return;const r=e.context,s=r.gl;r.clear({depth:1});const n=e.getOrCreateProgram(\"terrainDepth\"),a=new Ct(s.LESS,Ct.ReadWrite,e.depthRangeFor3D);for(const r of o){const o=i.getTile(r),l=ir(r.projMatrix,0,[0,0,0]);t.setupElevationDraw(o,n),n.draw(e,s.TRIANGLES,a,Dt.disabled,At.unblended,Mt.backCCW,l,\"terrain_depth\",t.gridBuffer,t.gridIndexBuffer,t.gridNoSkirtSegments);}}(t,this,o,this.proxyCoords);}_setupProxiedCoordsForOrtho(t,i,o){if(t.getSource()instanceof e.as)return this._setupProxiedCoordsForImageSource(t,i,o);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const r=this.proxiedCoords[t.id]=[],s=this.proxyCoords;for(let e=0;e<s.length;e++){const i=s[e],n=this._findTileCoveringTileID(i,t);if(n){const e=this._createProxiedId(i,n,o[i.key]&&o[i.key][t.id]);r.push(e),this.proxyToSource[i.key][t.id]=[e];}}let n=!1;const a=new Set;for(let e=0;e<i.length;e++){const s=t.getTile(i[e]);if(!s||!s.hasData())continue;const l=this._findTileCoveringTileID(s.tileID,this.proxySourceCache);if(l&&l.tileID.canonical.z!==s.tileID.canonical.z){const e=this.proxyToSource[l.tileID.key][t.id],i=this._createProxiedId(l.tileID,s,o[l.tileID.key]&&o[l.tileID.key][t.id]);e?e.splice(e.length-1,0,i):this.proxyToSource[l.tileID.key][t.id]=[i];const c=this.proxyToSource[l.tileID.key][t.id];a.has(c)||a.add(c),r.push(i),n=!0;}}if(this._sourceTilesOverlap[t.id]=n,n&&this._debugParams.sortTilesHiZFirst)for(const e of a)e.sort(((e,t)=>t.overscaledZ-e.overscaledZ));}_setupProxiedCoordsForImageSource(t,i,o){if(!t.getSource().loaded())return;const r=this.proxiedCoords[t.id]=[],s=this.proxyCoords,n=t.getSource(),a=n.tileID;if(!a)return;const l=new e.P(a.x,a.y)._div(1<<a.z),c=n.coordinates.map(e.O.fromLngLat).reduce(((e,t)=>(e.min.x=Math.min(e.min.x,t.x-l.x),e.min.y=Math.min(e.min.y,t.y-l.y),e.max.x=Math.max(e.max.x,t.x-l.x),e.max.y=Math.max(e.max.y,t.y-l.y),e)),{min:new e.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new e.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),h=(t,i)=>{const o=t.wrap+t.canonical.x/(1<<t.canonical.z),r=t.canonical.y/(1<<t.canonical.z),s=e.Y/(1<<t.canonical.z),n=i.wrap+i.canonical.x/(1<<i.canonical.z),a=i.canonical.y/(1<<i.canonical.z);return o+s<n+c.min.x||o>n+c.max.x||r+s<a+c.min.y||r>a+c.max.y};for(let e=0;e<s.length;e++){const n=s[e];for(let e=0;e<i.length;e++){const s=t.getTile(i[e]);if(!s||!s.hasData())continue;if(h(n,s.tileID))continue;const a=this._createProxiedId(n,s,o[n.key]&&o[n.key][t.id]),l=this.proxyToSource[n.key][t.id];l?l.push(a):this.proxyToSource[n.key][t.id]=[a],r.push(a);}}}_createProxiedId(t,i,o){let r=this.orthoMatrix;if(o){const e=o.find((e=>e.key===i.tileID.key));if(e)return e}if(i.tileID.key!==t.key){const o=t.canonical.z-i.tileID.canonical.z;let s,n,a;r=e.a9.create();const l=i.tileID.wrap-t.wrap<<t.overscaledZ;o>0?(s=e.Y>>o,n=s*((i.tileID.canonical.x<<o)-t.canonical.x+l),a=s*((i.tileID.canonical.y<<o)-t.canonical.y)):(s=e.Y<<-o,n=e.Y*(i.tileID.canonical.x-(t.canonical.x+l<<-o)),a=e.Y*(i.tileID.canonical.y-(t.canonical.y<<-o))),e.a9.ortho(r,0,s,0,s,0,1),e.a9.translate(r,r,[n,a,0]);}return new _r(i.tileID,t.key,r)}_findTileCoveringTileID(t,i){let o=i.getTile(t);if(o&&o.hasData())return o;const r=this._findCoveringTileCache[i.id],s=r[t.key];if(o=s?i.getTileByID(s):null,o&&o.hasData()||null===s)return o;let n=o?o.tileID:t,a=n.overscaledZ;const l=i.getSource().minzoom,c=[];if(!s){const r=i.getSource().maxzoom;if(t.canonical.z>=r){const o=t.canonical.z-r;i.getSource().reparseOverscaled?(a=Math.max(t.canonical.z+2,i.transform.tileZoom),n=new e.ap(a,t.wrap,r,t.canonical.x>>o,t.canonical.y>>o)):0!==o&&(a=r,n=new e.ap(a,t.wrap,r,t.canonical.x>>o,t.canonical.y>>o));}n.key!==t.key&&(c.push(n.key),o=i.getTile(n));}const h=e=>{c.forEach((t=>{r[t]=e;})),c.length=0;};for(a-=1;a>=l&&(!o||!o.hasData());a--){o&&h(o.tileID.key);const e=n.calculateScaledKey(a);if(o=i.getTileByID(e),o&&o.hasData())break;const t=r[e];if(null===t)break;void 0===t?c.push(e):o=i.getTileByID(t);}return h(o?o.tileID.key:null),o&&o.hasData()?o:null}findDEMTileFor(e){return this.enabled?this._findTileCoveringTileID(e,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0;}_clearRenderCacheForTile(e,t){let i=this._tilesDirty[e];i||(i=this._tilesDirty[e]={}),i[t.key]=!0;}}function fr(t,i,o){const r=function(t,i,o){const r=e.Q.dot(i,t),s=e.Q.dot(o,[.2126,.7152,.0722]),n=(e,t,i)=>(1-i)*e+i*t,a=n(1-.3*Math.min(s,1),1,Math.min(r+1,1));return n(.92,1,Math.asin(e.ad(i[2],-1,1))/Math.PI+.5)*a}(t,[0,0,1],i),s=[0,0,0];e.Q.scale(s,o.slice(0,3),r);const n=[0,0,0];e.Q.scale(n,i.slice(0,3),t[2]);const a=[0,0,0];return e.Q.add(a,s,n),e.bX(a)}const mr=[\"fill\",\"fillOutline\",\"fillPattern\",\"line\",\"linePattern\",\"background\",\"backgroundPattern\",\"hillshade\",\"raster\"],gr=[\"stars\",\"fillExtrusion\",\"fillExtrusionGroundEffect\",\"model\",\"symbolSDF\",\"symbolIcon\",\"symbolTextAndIcon\"];class vr{static cacheKey(e,t,i,o){let r=`${t}${o?o.cacheKey:\"\"}`;for(const t of i)e.usedDefines.includes(t)&&(r+=`/${t}`);return r}constructor(t,i,o,r,s,n){const a=t.gl;this.program=a.createProgram(),this.configuration=r,this.name=i,this.fixedDefines=[...n];const l=r?r.getBinderAttributes():[],c=(o.staticAttributes||[]).concat(l);let h=r?r.defines():[];h=h.concat(n.map((e=>`#define ${e}`)));const u=\"#version 300 es\\n\";let d=u+h.concat(\"precision mediump float;\",Ho,Wo.fragmentSource).join(\"\\n\");for(const e of o.fragmentIncludes)d+=`\\n${Vo[e]}`;d+=`\\n${o.fragmentSource}`;let _=u+h.concat(\"precision highp float;\",Ho,Wo.vertexSource).join(\"\\n\");for(const e of o.vertexIncludes)_+=`\\n${Vo[e]}`;_+=`\\n${o.vertexSource}`;const p=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);a.shaderSource(p,d),a.compileShader(p),a.attachShader(this.program,p);const f=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())this.failedToCreate=!0;else {a.shaderSource(f,_),a.compileShader(f),a.attachShader(this.program,f),this.attributes={},this.numAttributes=c.length;for(let e=0;e<this.numAttributes;e++)if(c[e]){const t=c[e].startsWith(\"a_\")?c[e]:`a_${c[e]}`;a.bindAttribLocation(this.program,e,t),this.attributes[t]=e;}a.linkProgram(this.program),a.deleteShader(f),a.deleteShader(p),this.fixedUniforms=s(t),this.binderUniforms=r?r.getUniforms(t):[],n.includes(\"TERRAIN\")&&(this.terrainUniforms=(t=>({u_dem:new e.bR(t),u_dem_prev:new e.bR(t),u_dem_tl:new e.bO(t),u_dem_scale:new e.bQ(t),u_dem_tl_prev:new e.bO(t),u_dem_scale_prev:new e.bQ(t),u_dem_size:new e.bQ(t),u_dem_lerp:new e.bQ(t),u_exaggeration:new e.bQ(t),u_depth:new e.bR(t),u_depth_size_inv:new e.bO(t),u_meter_to_dem:new e.bQ(t),u_label_plane_matrix_inv:new e.bN(t)}))(t)),n.includes(\"GLOBE\")&&(this.globeUniforms=(t=>({u_tile_tl_up:new e.bP(t),u_tile_tr_up:new e.bP(t),u_tile_br_up:new e.bP(t),u_tile_bl_up:new e.bP(t),u_tile_up_scale:new e.bQ(t)}))(t)),n.includes(\"FOG\")&&(this.fogUniforms=(t=>({u_fog_matrix:new e.bN(t),u_fog_range:new e.bO(t),u_fog_color:new e.bS(t),u_fog_horizon_blend:new e.bQ(t),u_fog_vertical_limit:new e.bO(t),u_fog_temporal_offset:new e.bQ(t),u_frustum_tl:new e.bP(t),u_frustum_tr:new e.bP(t),u_frustum_br:new e.bP(t),u_frustum_bl:new e.bP(t),u_globe_pos:new e.bP(t),u_globe_radius:new e.bQ(t),u_globe_transition:new e.bQ(t),u_is_globe:new e.bR(t),u_viewport:new e.bO(t)}))(t)),n.includes(\"RENDER_CUTOFF\")&&(this.cutoffUniforms=(t=>({u_cutoff_params:new e.bS(t)}))(t)),n.includes(\"LIGHTING_3D_MODE\")&&(this.lightsUniforms=(t=>({u_lighting_ambient_color:new e.bP(t),u_lighting_directional_dir:new e.bP(t),u_lighting_directional_color:new e.bP(t),u_ground_radiance:new e.bP(t)}))(t)),n.includes(\"RENDER_SHADOWS\")&&(this.shadowUniforms=(t=>({u_light_matrix_0:new e.bN(t),u_light_matrix_1:new e.bN(t),u_fade_range:new e.bO(t),u_shadow_normal_offset:new e.bP(t),u_shadow_intensity:new e.bQ(t),u_shadow_texel_size:new e.bQ(t),u_shadow_map_resolution:new e.bQ(t),u_shadow_direction:new e.bP(t),u_shadow_bias:new e.bP(t),u_shadowmap_0:new e.bR(t),u_shadowmap_1:new e.bR(t)}))(t));}}setTerrainUniformValues(e,t){if(!this.terrainUniforms)return;const i=this.terrainUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e]&&i[e].set(this.program,e,t[e]);}}setGlobeUniformValues(e,t){if(!this.globeUniforms)return;const i=this.globeUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e]&&i[e].set(this.program,e,t[e]);}}setFogUniformValues(e,t){if(!this.fogUniforms)return;const i=this.fogUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e]);}}setCutoffUniformValues(e,t){if(!this.cutoffUniforms)return;const i=this.cutoffUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e]);}}setLightsUniformValues(e,t){if(!this.lightsUniforms)return;const i=this.lightsUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e]);}}setShadowUniformValues(e,t){if(this.failedToCreate||!this.shadowUniforms)return;const i=this.shadowUniforms;e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e]);}_drawDebugWireframe(t,i,o,r,s,n,a,l,c,h){const u=t.options.wireframe;if(!1===u.terrain&&!1===u.layers2D&&!1===u.layers3D)return;const d=t.context;if(!(()=>!(!u.terrain||\"terrainRaster\"!==this.name&&\"globeRaster\"!==this.name)||!(!u.layers2D||t._terrain&&t._terrain.renderingToTexture||!mr.includes(this.name))||!(!u.layers3D||!gr.includes(this.name)))())return;const _=d.gl,p=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,s,d);if(!p)return;const f=[...this.fixedDefines];f.push(\"DEBUG_WIREFRAME\");const m=t.getOrCreateProgram(this.name,{config:this.configuration,defines:f});d.program.set(m.program);const g=(e,t,i)=>{if(t[e]&&i[e])for(const o in t[e])i[e][o]&&i[e][o].set(i.program,o,t[e][o].current);};c&&c.setUniforms(m.program,d,m.binderUniforms,a,{zoom:l}),g(\"fixedUniforms\",this,m),g(\"terrainUniforms\",this,m),g(\"globeUniforms\",this,m),g(\"fogUniforms\",this,m),g(\"lightsUniforms\",this,m),g(\"shadowUniforms\",this,m),p.bind(),d.setColorMode(new At([_.ONE,_.ONE_MINUS_SRC_ALPHA,_.ZERO,_.ONE],e.aA.transparent,[!0,!0,!0,!1])),d.setDepthMode(new Ct(i.func===_.LESS?_.LEQUAL:i.func,Ct.ReadOnly,i.range)),d.setStencilMode(Dt.disabled);const v=3*n.primitiveLength*2,x=3*n.primitiveOffset*2*2;h&&h>1?_.drawElementsInstanced(_.LINES,v,_.UNSIGNED_SHORT,x,h):_.drawElements(_.LINES,v,_.UNSIGNED_SHORT,x),s.bind(),d.program.set(this.program),d.setDepthMode(i),d.setStencilMode(o),d.setColorMode(r);}draw(e,t,i,o,r,s,n,a,l,c,h,u,d,_,p,f){const m=e.context,g=m.gl;if(this.failedToCreate)return;m.program.set(this.program),m.setDepthMode(i),m.setStencilMode(o),m.setColorMode(r),m.setCullFace(s);for(const e of Object.keys(this.fixedUniforms))this.fixedUniforms[e].set(this.program,e,n[e]);_&&_.setUniforms(this.program,m,this.binderUniforms,u,{zoom:d});const v={[g.POINTS]:1,[g.LINES]:2,[g.TRIANGLES]:3,[g.LINE_STRIP]:1}[t],x=f&&f>0?1:void 0;for(const s of h.get()){const n=s.vaos||(s.vaos={});(n[a]||(n[a]=new Xo)).bind(m,this,l,_?_.getPaintVertexBuffers():[],c,s.vertexOffset,p||[],x),f&&f>1?g.drawElementsInstanced(t,s.primitiveLength*v,g.UNSIGNED_SHORT,s.primitiveOffset*v*2,f):c?g.drawElements(t,s.primitiveLength*v,g.UNSIGNED_SHORT,s.primitiveOffset*v*2):g.drawArrays(t,s.vertexOffset,s.vertexLength),t===g.TRIANGLES&&c&&this._drawDebugWireframe(e,i,o,r,c,s,u,d,_,f);}}}function xr(t,i){const o=Math.pow(2,i.tileID.overscaledZ),r=i.tileSize*Math.pow(2,t.transform.tileZoom)/o,s=r*(i.tileID.canonical.x+i.tileID.wrap*o),n=r*i.tileID.canonical.y;return {u_image:0,u_texsize:i.imageAtlasTexture?i.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/e.a6(i,1,t.transform.tileZoom),u_pixel_coord_upper:[s>>16,n>>16],u_pixel_coord_lower:[65535&s,65535&n]}}const yr=e.a9.create(),br=(t,i,o,r,s,n,a,l,c,h,u,d,_,p,f,m)=>{const g=i.style.light,v=g.properties.get(\"position\"),x=[v.x,v.y,v.z],y=e.ct.create();\"viewport\"===g.properties.get(\"anchor\")&&(e.ct.fromRotation(y,-i.transform.angle),e.Q.transformMat3(x,x,y));const b=g.properties.get(\"color\"),w=i.transform,T={u_matrix:t,u_lightpos:x,u_lightintensity:g.properties.get(\"intensity\"),u_lightcolor:[b.r,b.g,b.b],u_vertical_gradient:+o,u_opacity:r,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:yr,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:s,u_edge_radius:n,u_flood_light_color:d,u_vertical_scale:_,u_flood_light_intensity:p,u_ground_shadow_factor:f,u_emissive_strength:m};return \"globe\"===w.projection.name&&(T.u_tile_id=[a.canonical.x,a.canonical.y,1<<a.canonical.z],T.u_zoom_transition=c,T.u_inv_rot_matrix=u,T.u_merc_center=h,T.u_up_dir=w.projection.upVector(new e.bv(0,0,0),h[0]*e.Y,h[1]*e.Y),T.u_height_lift=l),T},wr=(e,t,i)=>({u_matrix:e,u_edge_radius:t,u_vertical_scale:i}),Tr=(t,i,o,r,s,n,a,l,c,h,u,d,_,p)=>{const f=br(t,i,o,r,s,n,a,c,h,u,d,_,p,1,[0,0,0],0),m={u_height_factor:-Math.pow(2,a.overscaledZ)/l.tileSize/8};return e.e(f,xr(i,l),m)},Er=(e,t)=>({u_matrix:e,u_emissive_strength:t}),Sr=(t,i,o,r)=>e.e(Er(t,i),xr(o,r)),Cr=(e,t,i)=>({u_matrix:e,u_world:i,u_emissive_strength:t}),Ir=(t,i,o,r,s)=>e.e(Sr(t,i,o,r),{u_world:s}),Dr=(t,i,o,r)=>{const s=e.Y/o.tileSize;return {u_matrix:t,u_camera_to_center_distance:i.getCameraToCenterDistance(r),u_extrude_scale:[i.pixelsToGLUnits[0]/s,i.pixelsToGLUnits[1]/s]}},Rr=(e,t,i=1)=>({u_matrix:e,u_color:t,u_overlay:0,u_overlay_scale:i}),Ar=e.a9.create(),Pr=(t,i,o,r,s,n,a)=>{const l=t.transform,c=\"globe\"===l.projection.name,h=c?e.cu(l.zoom,i.canonical)*l._pixelsPerMercatorPixel:e.a6(o,1,n),u={u_matrix:i.projMatrix,u_extrude_scale:h,u_intensity:a,u_inv_rot_matrix:Ar,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){u.u_inv_rot_matrix=r,u.u_merc_center=s,u.u_tile_id=[i.canonical.x,i.canonical.y,1<<i.canonical.z],u.u_zoom_transition=e.W(l.zoom);const t=s[0]*e.Y,o=s[1]*e.Y;u.u_up_dir=l.projection.upVector(new e.bv(0,0,0),t,o);}return u};function Lr(e,[t,i,o,r],[s,n]){if(s===n)return [0,0,0,0];const a=255*(e-1)/(e*(n-s));return [t*a,i*a,o*a,r*a]}function Mr(e,t,[i,o]){return i===o?0:.5/e+(t-i)*(e-1)/(e*(o-i))}const zr=(t,i,o,r,s,n,a,l,c,h,u,d,_,p,f,m,g,v,x,y,b)=>({u_matrix:t,u_normalize_matrix:i,u_globe_matrix:o,u_merc_matrix:r,u_grid_matrix:s,u_tl_parent:n,u_scale_parent:h,u_fade_t:u.mix,u_opacity:u.opacity*d.paint.get(\"raster-opacity\"),u_image0:0,u_image1:1,u_brightness_low:d.paint.get(\"raster-brightness-min\"),u_brightness_high:d.paint.get(\"raster-brightness-max\"),u_saturation_factor:e.cv(d.paint.get(\"raster-saturation\")),u_contrast_factor:e.cw(d.paint.get(\"raster-contrast\")),u_spin_weights:Or(d.paint.get(\"raster-hue-rotate\")),u_perspective_transform:_,u_raster_elevation:p,u_zoom_transition:a,u_merc_center:l,u_cutoff_params:c,u_colorization_mix:Lr(e.cx,m,v),u_colorization_offset:Mr(e.cx,g,v),u_color_ramp:f,u_texture_offset:[y/(x+2*y),x/(x+2*y)],u_texture_res:[x+2*y,x+2*y],u_emissive_strength:b});function Or(e){e*=Math.PI/180;const t=Math.sin(e),i=Math.cos(e);return [(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}const Fr=(e,t,i,o,r,s,n,a,l,c,h,u)=>({u_matrix:e,u_normalize_matrix:t,u_globe_matrix:i,u_merc_matrix:o,u_grid_matrix:r,u_tl_parent:s,u_scale_parent:c,u_fade_t:h.mix,u_opacity:h.opacity,u_image0:0,u_image1:1,u_raster_elevation:u,u_zoom_transition:n,u_merc_center:a,u_cutoff_params:l}),Br=(e,t,i,o,r,s,n,a,l,c)=>({u_particle_texture:e,u_particle_texture_side_len:t,u_tile_offset:i,u_velocity:o,u_color_ramp:s,u_velocity_res:r,u_max_speed:n,u_uv_offset:a,u_data_scale:l,u_data_offset:c,u_particle_pos_scale:1.3,u_particle_pos_offset:[Ft,Ft]}),kr=(e,t,i,o,r,s,n,a,l,c)=>({u_particle_texture:e,u_particle_texture_side_len:t,u_velocity:i,u_velocity_res:o,u_max_speed:r,u_speed_factor:s,u_reset_rate:n,u_rand_seed:Math.random(),u_uv_offset:a,u_data_scale:l,u_data_offset:c,u_particle_pos_scale:1.3,u_particle_pos_offset:[Ft,Ft]}),Nr=e.a9.create(),Ur=(t,i,o,r,s,n,a,l,c,h,u,d,_,p,f,m,g,v)=>{const x=s.transform,y={u_is_size_zoom_constant:+(\"constant\"===t||\"source\"===t),u_is_size_feature_constant:+(\"constant\"===t||\"camera\"===t),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:x.getCameraToCenterDistance(m),u_rotate_symbol:+o,u_aspect_ratio:x.width/x.height,u_fade_change:s.options.fadeDuration?s.symbolFadeChange:1,u_matrix:n,u_label_plane_matrix:a,u_coord_matrix:l,u_is_text:+c,u_pitch_with_map:+r,u_texsize:h,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Nr,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:Nr,u_up_vector:[0,-1,0],u_color_adj_mat:g,u_icon_transition:v||0};return \"globe\"===m.name&&(y.u_tile_id=[u.canonical.x,u.canonical.y,1<<u.canonical.z],y.u_zoom_transition=d,y.u_inv_rot_matrix=p,y.u_merc_center=_,y.u_camera_forward=x._camera.forward(),y.u_ecef_origin=e.cy(x.globeMatrix,u.toUnwrapped()),y.u_tile_matrix=Float32Array.from(x.globeMatrix),y.u_up_vector=f),y},Gr=(t,i,o,r,s,n,a,l,c,h,u,d,_,p,f,m,g)=>e.e(Ur(t,i,o,r,s,n,a,l,c,h,d,_,p,f,m,g),{u_gamma_scale:r?s.transform.getCameraToCenterDistance(g)*Math.cos(s.terrain?0:s.transform._pitch):1,u_device_pixel_ratio:e.f.devicePixelRatio,u_is_halo:+u,undefined:void 0}),jr=(t,i,o,r,s,n,a,l,c,h,u,d,_,p,f,m)=>e.e(Gr(t,i,o,r,s,n,a,l,!0,c,!0,u,d,_,p,f,m),{u_texsize_icon:h,u_texture_icon:1}),Vr=(e,t,i,o)=>({u_matrix:e,u_emissive_strength:t,u_opacity:i,u_color:o}),Zr=(t,i,o,r,s,n,a)=>e.e(function(t,i,o,r){const s=o.imageManager.getPattern(t.toString(),i),{width:n,height:a}=o.imageManager.getPixelSize(i),l=Math.pow(2,r.tileID.overscaledZ),c=r.tileSize*Math.pow(2,o.transform.tileZoom)/l,h=c*(r.tileID.canonical.x+r.tileID.wrap*l),u=c*r.tileID.canonical.y;return {u_image:0,u_pattern_tl:s.tl,u_pattern_br:s.br,u_texsize:[n,a],u_pattern_size:s.displaySize,u_tile_units_to_pixels:1/e.a6(r,1,o.transform.tileZoom),u_pixel_coord_upper:[h>>16,u>>16],u_pixel_coord_lower:[65535&h,65535&u]}}(s,n,r,a),{u_matrix:t,u_emissive_strength:i,u_opacity:o}),Wr=new Float32Array(e.a9.identity([])),Hr=(t,i,o,r,s,n,a,l,c,h,u,d,_,p=[0,0,0],f)=>{const m=s.style.light,g=m.properties.get(\"position\"),v=[-g.x,-g.y,g.z],x=e.ct.create();\"viewport\"===m.properties.get(\"anchor\")&&(e.ct.fromRotation(x,-s.transform.angle),e.Q.transformMat3(v,v,x));const y=\"MASK\"===u.alphaMode,b=m.properties.get(\"color\"),w=_.paint.get(\"model-ambient-occlusion-intensity\"),T=_.paint.get(\"model-color\").constantOr(e.aA.white),E=_.paint.get(\"model-color-mix-intensity\").constantOr(0);return {u_matrix:t,u_lighting_matrix:i,u_normal_matrix:o,u_node_matrix:r||Wr,u_lightpos:v,u_lightintensity:m.properties.get(\"intensity\"),u_lightcolor:[b.r,b.g,b.b],u_camera_pos:p,u_opacity:n,u_baseTextureIsAlpha:0,u_alphaMask:+y,u_alphaCutoff:u.alphaCutoff,u_baseColorFactor:[a.r,a.g,a.b,a.a],u_emissiveFactor:[l[0],l[1],l[2],1],u_metallicFactor:c,u_roughnessFactor:h,u_baseColorTexture:fo.BaseColor,u_metallicRoughnessTexture:fo.MetallicRoughness,u_normalTexture:fo.Normal,u_occlusionTexture:fo.Occlusion,u_emissionTexture:fo.Emission,u_color_mix:[T.r,T.g,T.b,E],u_aoIntensity:w,u_emissive_strength:d,u_occlusionTextureTransform:f||[0,0,0,0]}},qr=(e,t=Wr,i=Wr)=>({u_matrix:e,u_instance:t,u_node_matrix:i}),Qr={fillExtrusion:t=>({u_matrix:new e.bN(t),u_lightpos:new e.bP(t),u_lightintensity:new e.bQ(t),u_lightcolor:new e.bP(t),u_vertical_gradient:new e.bQ(t),u_opacity:new e.bQ(t),u_edge_radius:new e.bQ(t),u_ao:new e.bO(t),u_tile_id:new e.bP(t),u_zoom_transition:new e.bQ(t),u_inv_rot_matrix:new e.bN(t),u_merc_center:new e.bO(t),u_up_dir:new e.bP(t),u_height_lift:new e.bQ(t),u_flood_light_color:new e.bP(t),u_vertical_scale:new e.bQ(t),u_flood_light_intensity:new e.bQ(t),u_ground_shadow_factor:new e.bP(t),u_emissive_strength:new e.bQ(t)}),fillExtrusionDepth:t=>({u_matrix:new e.bN(t),u_edge_radius:new e.bQ(t),u_vertical_scale:new e.bQ(t)}),fillExtrusionPattern:t=>({u_matrix:new e.bN(t),u_lightpos:new e.bP(t),u_lightintensity:new e.bQ(t),u_lightcolor:new e.bP(t),u_vertical_gradient:new e.bQ(t),u_height_factor:new e.bQ(t),u_edge_radius:new e.bQ(t),u_ao:new e.bO(t),u_tile_id:new e.bP(t),u_zoom_transition:new e.bQ(t),u_inv_rot_matrix:new e.bN(t),u_merc_center:new e.bO(t),u_up_dir:new e.bP(t),u_height_lift:new e.bQ(t),u_image:new e.bR(t),u_texsize:new e.bO(t),u_pixel_coord_upper:new e.bO(t),u_pixel_coord_lower:new e.bO(t),u_tile_units_to_pixels:new e.bQ(t),u_opacity:new e.bQ(t)}),fillExtrusionGroundEffect:t=>({u_matrix:new e.bN(t),u_opacity:new e.bQ(t),u_ao_pass:new e.bQ(t),u_meter_to_tile:new e.bQ(t),u_ao:new e.bO(t),u_flood_light_intensity:new e.bQ(t),u_flood_light_color:new e.bP(t),u_attenuation:new e.bQ(t),u_edge_radius:new e.bQ(t),u_fb:new e.bR(t),u_fb_size:new e.bQ(t)}),fill:t=>({u_matrix:new e.bN(t),u_emissive_strength:new e.bQ(t)}),fillPattern:t=>({u_matrix:new e.bN(t),u_emissive_strength:new e.bQ(t),u_image:new e.bR(t),u_texsize:new e.bO(t),u_pixel_coord_upper:new e.bO(t),u_pixel_coord_lower:new e.bO(t),u_tile_units_to_pixels:new e.bQ(t)}),fillOutline:t=>({u_matrix:new e.bN(t),u_emissive_strength:new e.bQ(t),u_world:new e.bO(t)}),fillOutlinePattern:t=>({u_matrix:new e.bN(t),u_emissive_strength:new e.bQ(t),u_world:new e.bO(t),u_image:new e.bR(t),u_texsize:new e.bO(t),u_pixel_coord_upper:new e.bO(t),u_pixel_coord_lower:new e.bO(t),u_tile_units_to_pixels:new e.bQ(t)}),circle:e.cz,collisionBox:t=>({u_matrix:new e.bN(t),u_camera_to_center_distance:new e.bQ(t),u_extrude_scale:new e.bO(t)}),collisionCircle:t=>({u_matrix:new e.bN(t),u_inv_matrix:new e.bN(t),u_camera_to_center_distance:new e.bQ(t),u_viewport_size:new e.bO(t)}),debug:t=>({u_color:new e.cf(t),u_matrix:new e.bN(t),u_overlay:new e.bR(t),u_overlay_scale:new e.bQ(t)}),clippingMask:t=>({u_matrix:new e.bN(t)}),heatmap:t=>({u_extrude_scale:new e.bQ(t),u_intensity:new e.bQ(t),u_matrix:new e.bN(t),u_inv_rot_matrix:new e.bN(t),u_merc_center:new e.bO(t),u_tile_id:new e.bP(t),u_zoom_transition:new e.bQ(t),u_up_dir:new e.bP(t)}),heatmapTexture:t=>({u_image:new e.bR(t),u_color_ramp:new e.bR(t),u_opacity:new e.bQ(t)}),hillshade:t=>({u_matrix:new e.bN(t),u_image:new e.bR(t),u_latrange:new e.bO(t),u_light:new e.bO(t),u_shadow:new e.cf(t),u_highlight:new e.cf(t),u_emissive_strength:new e.bQ(t),u_accent:new e.cf(t)}),hillshadePrepare:t=>({u_matrix:new e.bN(t),u_image:new e.bR(t),u_dimension:new e.bO(t),u_zoom:new e.bQ(t)}),line:e.cA,linePattern:e.cB,raster:t=>({u_matrix:new e.bN(t),u_normalize_matrix:new e.bN(t),u_globe_matrix:new e.bN(t),u_merc_matrix:new e.bN(t),u_grid_matrix:new e.cg(t),u_tl_parent:new e.bO(t),u_scale_parent:new e.bQ(t),u_fade_t:new e.bQ(t),u_opacity:new e.bQ(t),u_image0:new e.bR(t),u_image1:new e.bR(t),u_brightness_low:new e.bQ(t),u_brightness_high:new e.bQ(t),u_saturation_factor:new e.bQ(t),u_contrast_factor:new e.bQ(t),u_spin_weights:new e.bP(t),u_perspective_transform:new e.bO(t),u_raster_elevation:new e.bQ(t),u_zoom_transition:new e.bQ(t),u_merc_center:new e.bO(t),u_cutoff_params:new e.bS(t),u_colorization_mix:new e.bS(t),u_colorization_offset:new e.bQ(t),u_color_ramp:new e.bR(t),u_texture_offset:new e.bO(t),u_texture_res:new e.bO(t),u_emissive_strength:new e.bQ(t)}),rasterParticle:t=>({u_matrix:new e.bN(t),u_normalize_matrix:new e.bN(t),u_globe_matrix:new e.bN(t),u_merc_matrix:new e.bN(t),u_grid_matrix:new e.cg(t),u_tl_parent:new e.bO(t),u_scale_parent:new e.bQ(t),u_fade_t:new e.bQ(t),u_opacity:new e.bQ(t),u_image0:new e.bR(t),u_image1:new e.bR(t),u_raster_elevation:new e.bQ(t),u_zoom_transition:new e.bQ(t),u_merc_center:new e.bO(t),u_cutoff_params:new e.bS(t)}),rasterParticleTexture:t=>({u_texture:new e.bR(t),u_opacity:new e.bQ(t)}),rasterParticleDraw:t=>({u_particle_texture:new e.bR(t),u_particle_texture_side_len:new e.bQ(t),u_tile_offset:new e.bO(t),u_velocity:new e.bR(t),u_color_ramp:new e.bR(t),u_velocity_res:new e.bO(t),u_max_speed:new e.bQ(t),u_uv_offset:new e.bO(t),u_data_scale:new e.bS(t),u_data_offset:new e.bQ(t),u_particle_pos_scale:new e.bQ(t),u_particle_pos_offset:new e.bO(t)}),rasterParticleUpdate:t=>({u_particle_texture:new e.bR(t),u_particle_texture_side_len:new e.bQ(t),u_velocity:new e.bR(t),u_velocity_res:new e.bO(t),u_max_speed:new e.bQ(t),u_speed_factor:new e.bQ(t),u_reset_rate:new e.bQ(t),u_rand_seed:new e.bQ(t),u_uv_offset:new e.bO(t),u_data_scale:new e.bS(t),u_data_offset:new e.bQ(t),u_particle_pos_scale:new e.bQ(t),u_particle_pos_offset:new e.bO(t)}),symbolIcon:t=>({u_is_size_zoom_constant:new e.bR(t),u_is_size_feature_constant:new e.bR(t),u_size_t:new e.bQ(t),u_size:new e.bQ(t),u_camera_to_center_distance:new e.bQ(t),u_rotate_symbol:new e.bR(t),u_aspect_ratio:new e.bQ(t),u_fade_change:new e.bQ(t),u_matrix:new e.bN(t),u_label_plane_matrix:new e.bN(t),u_coord_matrix:new e.bN(t),u_is_text:new e.bR(t),u_pitch_with_map:new e.bR(t),u_texsize:new e.bO(t),u_tile_id:new e.bP(t),u_zoom_transition:new e.bQ(t),u_inv_rot_matrix:new e.bN(t),u_merc_center:new e.bO(t),u_camera_forward:new e.bP(t),u_tile_matrix:new e.bN(t),u_up_vector:new e.bP(t),u_ecef_origin:new e.bP(t),u_texture:new e.bR(t),u_icon_transition:new e.bQ(t),u_color_adj_mat:new e.bN(t)}),symbolSDF:t=>({u_is_size_zoom_constant:new e.bR(t),u_is_size_feature_constant:new e.bR(t),u_size_t:new e.bQ(t),u_size:new e.bQ(t),u_camera_to_center_distance:new e.bQ(t),u_rotate_symbol:new e.bR(t),u_aspect_ratio:new e.bQ(t),u_fade_change:new e.bQ(t),u_matrix:new e.bN(t),u_label_plane_matrix:new e.bN(t),u_coord_matrix:new e.bN(t),u_is_text:new e.bR(t),u_pitch_with_map:new e.bR(t),u_texsize:new e.bO(t),u_texture:new e.bR(t),u_gamma_scale:new e.bQ(t),u_device_pixel_ratio:new e.bQ(t),u_tile_id:new e.bP(t),u_zoom_transition:new e.bQ(t),u_inv_rot_matrix:new e.bN(t),u_merc_center:new e.bO(t),u_camera_forward:new e.bP(t),u_tile_matrix:new e.bN(t),u_up_vector:new e.bP(t),u_ecef_origin:new e.bP(t),u_is_halo:new e.bR(t)}),symbolTextAndIcon:t=>({u_is_size_zoom_constant:new e.bR(t),u_is_size_feature_constant:new e.bR(t),u_size_t:new e.bQ(t),u_size:new e.bQ(t),u_camera_to_center_distance:new e.bQ(t),u_rotate_symbol:new e.bR(t),u_aspect_ratio:new e.bQ(t),u_fade_change:new e.bQ(t),u_matrix:new e.bN(t),u_label_plane_matrix:new e.bN(t),u_coord_matrix:new e.bN(t),u_is_text:new e.bR(t),u_pitch_with_map:new e.bR(t),u_texsize:new e.bO(t),u_texsize_icon:new e.bO(t),u_texture:new e.bR(t),u_texture_icon:new e.bR(t),u_gamma_scale:new e.bQ(t),u_device_pixel_ratio:new e.bQ(t),u_is_halo:new e.bR(t)}),background:t=>({u_matrix:new e.bN(t),u_emissive_strength:new e.bQ(t),u_opacity:new e.bQ(t),u_color:new e.cf(t)}),backgroundPattern:t=>({u_matrix:new e.bN(t),u_emissive_strength:new e.bQ(t),u_opacity:new e.bQ(t),u_image:new e.bR(t),u_pattern_tl:new e.bO(t),u_pattern_br:new e.bO(t),u_texsize:new e.bO(t),u_pattern_size:new e.bO(t),u_pixel_coord_upper:new e.bO(t),u_pixel_coord_lower:new e.bO(t),u_tile_units_to_pixels:new e.bQ(t)}),terrainRaster:tr,terrainDepth:tr,skybox:t=>({u_matrix:new e.bN(t),u_sun_direction:new e.bP(t),u_cubemap:new e.bR(t),u_opacity:new e.bQ(t),u_temporal_offset:new e.bQ(t)}),skyboxGradient:t=>({u_matrix:new e.bN(t),u_color_ramp:new e.bR(t),u_center_direction:new e.bP(t),u_radius:new e.bQ(t),u_opacity:new e.bQ(t),u_temporal_offset:new e.bQ(t)}),skyboxCapture:t=>({u_matrix_3f:new e.cg(t),u_sun_direction:new e.bP(t),u_sun_intensity:new e.bQ(t),u_color_tint_r:new e.bS(t),u_color_tint_m:new e.bS(t),u_luminance:new e.bQ(t)}),globeRaster:t=>({u_proj_matrix:new e.bN(t),u_globe_matrix:new e.bN(t),u_normalize_matrix:new e.bN(t),u_merc_matrix:new e.bN(t),u_zoom_transition:new e.bQ(t),u_merc_center:new e.bO(t),u_image0:new e.bR(t),u_grid_matrix:new e.cg(t),u_skirt_height:new e.bQ(t),u_far_z_cutoff:new e.bQ(t),u_frustum_tl:new e.bP(t),u_frustum_tr:new e.bP(t),u_frustum_br:new e.bP(t),u_frustum_bl:new e.bP(t),u_globe_pos:new e.bP(t),u_globe_radius:new e.bQ(t),u_viewport:new e.bO(t)}),globeAtmosphere:t=>({u_frustum_tl:new e.bP(t),u_frustum_tr:new e.bP(t),u_frustum_br:new e.bP(t),u_frustum_bl:new e.bP(t),u_horizon:new e.bQ(t),u_transition:new e.bQ(t),u_fadeout_range:new e.bQ(t),u_color:new e.bS(t),u_high_color:new e.bS(t),u_space_color:new e.bS(t),u_temporal_offset:new e.bQ(t),u_horizon_angle:new e.bQ(t)}),model:t=>({u_matrix:new e.bN(t),u_lighting_matrix:new e.bN(t),u_normal_matrix:new e.bN(t),u_node_matrix:new e.bN(t),u_lightpos:new e.bP(t),u_lightintensity:new e.bQ(t),u_lightcolor:new e.bP(t),u_camera_pos:new e.bP(t),u_opacity:new e.bQ(t),u_baseColorFactor:new e.bS(t),u_emissiveFactor:new e.bS(t),u_metallicFactor:new e.bQ(t),u_roughnessFactor:new e.bQ(t),u_baseTextureIsAlpha:new e.bR(t),u_alphaMask:new e.bR(t),u_alphaCutoff:new e.bQ(t),u_baseColorTexture:new e.bR(t),u_metallicRoughnessTexture:new e.bR(t),u_normalTexture:new e.bR(t),u_occlusionTexture:new e.bR(t),u_emissionTexture:new e.bR(t),u_color_mix:new e.bS(t),u_aoIntensity:new e.bQ(t),u_emissive_strength:new e.bQ(t),u_occlusionTextureTransform:new e.bS(t)}),modelDepth:t=>({u_matrix:new e.bN(t),u_instance:new e.bN(t),u_node_matrix:new e.bN(t)}),groundShadow:t=>({u_matrix:new e.bN(t),u_ground_shadow_factor:new e.bP(t)}),stars:t=>({u_matrix:new e.bN(t),u_up:new e.bP(t),u_right:new e.bP(t),u_intensity_multiplier:new e.bQ(t)})};let $r;function Xr(t,i,o,r,s,n,a){const l=t.context,c=l.gl,h=t.transform,u=t.getOrCreateProgram(\"collisionBox\"),d=[];let _=0,p=0;for(let l=0;l<r.length;l++){const f=r[l],m=i.getTile(f),g=m.getBucket(o);if(!g)continue;const v=Pi(f,g,h);let x=v;0===s[0]&&0===s[1]||(x=t.translatePosMatrix(v,m,s,n));const y=a?g.textCollisionBox:g.iconCollisionBox,b=g.collisionCircleArray;if(b.length>0){const t=e.a9.create(),i=x;e.a9.mul(t,g.placementInvProjMatrix,h.glCoordMatrix),e.a9.mul(t,t,g.placementViewportMatrix),d.push({circleArray:b,circleOffset:p,transform:i,invTransform:t,projection:g.getProjection()}),_+=b.length/4,p=_;}y&&(t.terrain&&t.terrain.setupElevationDraw(m,u),u.draw(t,c.LINES,Ct.disabled,Dt.disabled,t.colorModeForRenderPass(),Mt.disabled,Dr(x,h,m,g.getProjection()),o.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,null,h.zoom,null,[y.collisionVertexBuffer,y.collisionVertexBufferExt]));}if(!a||!d.length)return;const f=t.getOrCreateProgram(\"collisionCircle\"),m=new e.cC;m.resize(4*_),m._trim();let g=0;for(const e of d)for(let t=0;t<e.circleArray.length/4;t++){const i=4*t,o=e.circleArray[i+0],r=e.circleArray[i+1],s=e.circleArray[i+2],n=e.circleArray[i+3];m.emplace(g++,o,r,s,n,0),m.emplace(g++,o,r,s,n,1),m.emplace(g++,o,r,s,n,2),m.emplace(g++,o,r,s,n,3);}(!$r||$r.length<2*_)&&($r=function(t){const i=2*t,o=new e.az;o.resize(i),o._trim();for(let e=0;e<i;e++){const t=6*e;o.uint16[t+0]=4*e+0,o.uint16[t+1]=4*e+1,o.uint16[t+2]=4*e+2,o.uint16[t+3]=4*e+2,o.uint16[t+4]=4*e+3,o.uint16[t+5]=4*e+0;}return o}(_));const v=l.createIndexBuffer($r,!0),x=l.createVertexBuffer(m,e.cD.members,!0);for(const i of d){const r={u_matrix:i.transform,u_inv_matrix:i.invTransform,u_camera_to_center_distance:(y=h).getCameraToCenterDistance(i.projection),u_viewport_size:[y.width,y.height]};f.draw(t,c.TRIANGLES,Ct.disabled,Dt.disabled,t.colorModeForRenderPass(),Mt.disabled,r,o.id,x,v,e.aE.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,h.zoom);}var y;x.destroy(),v.destroy();}const Yr=e.a9.create();function Jr(t){const i=t._camera.getWorldToCamera(t.worldSize,1),o=e.a9.multiply([],i,t.globeMatrix);e.a9.invert(o,o);const r=[0,0,0],s=[0,1,0,0];return e.aa.transformMat4(s,s,o),r[0]=s[0],r[1]=s[1],r[2]=s[2],e.Q.normalize(r,r),r}function Kr({width:t,height:i,anchor:o,textOffset:r,textScale:s},n){const{horizontalAlign:a,verticalAlign:l}=e.bi(o),c=-(a-.5)*t,h=-(l-.5)*i,u=e.bh(o,r);return new e.P((c/s+u[0])*n,(h/s+u[1])*n)}function es(t,i,o,r,s,n,a,l,c,h,u){const d=t.text.placedSymbolArray,_=t.text.dynamicLayoutVertexArray,p=t.icon.dynamicLayoutVertexArray,f={},m=t.getProjection(),g=Li(l,m,n),v=n.elevation,x=m.upVectorScale(l.canonical,n.center.lat,n.worldSize).metersToTile;_.clear();for(let p=0;p<d.length;p++){const y=d.get(p),{tileAnchorX:b,tileAnchorY:w,numGlyphs:T}=y,E=y.hidden||!y.crossTileID||t.allowVerticalPlacement&&!y.placedOrientation?null:r[y.crossTileID];if(E){let r=0,d=0,p=0;if(v){const e=v?v.getAtTileOffset(l,b,w):0,[t,i,o]=m.upVector(l.canonical,b,w);r=e*t*x,d=e*i*x,p=e*o*x;}let[S,C,I,D]=mi(y.projectedAnchorX+r,y.projectedAnchorY+d,y.projectedAnchorZ+p,o?g:a);const R=gi(n.getCameraToCenterDistance(m),D);let A=s.evaluateSizeForFeature(t.textSizeData,h,y)*R/e.bf;o&&(A*=t.tilePixelRatio/c);const P=Kr(E,A);o?(({x:S,y:C,z:I}=m.projectTilePoint(b+P.x,w+P.y,l.canonical)),[S,C,I]=mi(S+r,C+d,I+p,a)):(i&&P._rotate(-n.angle),S+=P.x,C+=P.y,I=0);const L=t.allowVerticalPlacement&&y.placedOrientation===e.b9.vertical?Math.PI/2:0;for(let t=0;t<T;t++)e.bc(_,S,C,I,L);u&&y.associatedIconIndex>=0&&(f[y.associatedIconIndex]={x:S,y:C,z:I,angle:L});}else Ci(T,_);}if(u){p.clear();const i=t.icon.placedSymbolArray;for(let t=0;t<i.length;t++){const o=i.get(t),{numGlyphs:r}=o,s=f[t];if(o.hidden||!s)Ci(r,p);else {const{x:t,y:i,z:o,angle:n}=s;for(let s=0;s<r;s++)e.bc(p,t,i,o,n);}}t.icon.dynamicLayoutVertexBuffer.updateData(p);}t.text.dynamicLayoutVertexBuffer.updateData(_);}function ts(t,i,o,r,s,n,a={}){const l=o.paint.get(\"icon-translate\"),c=o.paint.get(\"text-translate\"),h=o.paint.get(\"icon-translate-anchor\"),u=o.paint.get(\"text-translate-anchor\"),d=o.layout.get(\"icon-rotation-alignment\"),_=o.layout.get(\"text-rotation-alignment\"),p=o.layout.get(\"icon-pitch-alignment\"),f=o.layout.get(\"text-pitch-alignment\"),m=o.layout.get(\"icon-keep-upright\"),g=o.layout.get(\"text-keep-upright\"),v=o.paint.get(\"icon-color-saturation\"),x=o.paint.get(\"icon-color-contrast\"),y=o.paint.get(\"icon-color-brightness-min\"),b=o.paint.get(\"icon-color-brightness-max\"),w=t.context,T=w.gl,E=t.transform,S=\"map\"===d,C=\"map\"===_,I=\"map\"===p,D=\"map\"===f,R=void 0!==o.layout.get(\"symbol-sort-key\").constantOr(1);let A=!1;const P=t.depthModeForSublayer(0,Ct.ReadOnly),L=[e.a8(E.center.lng),e.ah(E.center.lat)],M=o.layout.get(\"text-variable-anchor\"),z=\"globe\"===E.projection.name,O=[],F=[0,-1,0];for(const s of r){const r=i.getTile(s),n=r.getBucket(o);if(!n)continue;if(\"mercator\"===n.projection.name&&z)continue;if(n.fullyClipped)continue;const d=\"globe\"===n.projection.name,_=d?e.W(E.zoom):0,p=Li(s,n.getProjection(),E),f=E.calculatePixelsToTileUnitsMatrix(r),w=M&&n.hasTextData(),P=n.hasIconTextFit()&&w&&n.hasIconData(),B=n.getProjection().createInversionMatrix(E,s.canonical),k=()=>{const i=S&&\"point\"!==o.layout.get(\"symbol-placement\"),a=[],c=i||P,u=o.paint.get(\"icon-image-cross-fade\").constantOr(0);t.terrainRenderModeElevated()&&I&&a.push(\"PITCH_WITH_MAP_TERRAIN\"),d&&(a.push(\"PROJECTION_GLOBE_VIEW\"),c&&a.push(\"PROJECTED_POS_ON_VIEWPORT\")),u>0&&a.push(\"ICON_TRANSITION\"),n.icon.zOffsetVertexBuffer&&a.push(\"Z_OFFSET\"),0===v&&0===x&&0===y&&1===b||a.push(\"COLOR_ADJUSTMENT\");const g=n.icon.programConfigurations.get(o.id),w=t.getOrCreateProgram(n.sdfIcons?\"symbolSDF\":\"symbolIcon\",{config:g,defines:a});let C;const D=r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],R=n.iconSizeData,A=e.b8(R,E.zoom),M=I||0!==E.pitch,O=_i(p,r.tileID.canonical,I,S,E,n.getProjection(),f),k=fi(p,r.tileID.canonical,I,S,E,n.getProjection(),f),N=t.translatePosMatrix(k,r,l,h,!0),U=t.translatePosMatrix(p,r,l,h),G=c?Yr:O,j=S&&!I&&!i;let V=F;!z&&!E.mercatorFromTransition||S||(V=Jr(E));const Z=d?V:F;if(n.sdfIcons&&!n.iconsInText)C=Gr(R.kind,A,j,I,t,U,G,N,!1,D,!0,s,_,L,B,Z,n.getProjection());else {const e=o.getColorAdjustmentMatrix(v,x,y,b);C=Ur(R.kind,A,j,I,t,U,G,N,!1,D,s,_,L,B,Z,n.getProjection(),e,u);}const W=r.imageAtlasTexture?r.imageAtlasTexture:null,H=1!==o.layout.get(\"icon-size\").constantOr(0)||n.iconsNeedLinear,q=n.sdfIcons||t.options.rotating||t.options.zooming||H||M?T.LINEAR:T.NEAREST,Q=n.sdfIcons&&0!==o.paint.get(\"icon-halo-width\").constantOr(1),$=t.terrain&&I&&i?e.a9.invert(e.a9.create(),O):Yr;if(i&&n.icon){const e=E.elevation,i=e?e.getAtTileOffsetFunc(s,E.center.lat,E.worldSize,n.getProjection()):null,o=pi(p,r.tileID.canonical,I,S,E,n.getProjection(),f);xi(n,p,t,!1,o,k,I,m,i,s);}return {program:w,buffers:n.icon,uniformValues:C,atlasTexture:W,atlasTextureIcon:null,atlasInterpolation:q,atlasInterpolationIcon:null,isSDF:n.sdfIcons,hasHalo:Q,tile:r,labelPlaneMatrixInv:$}},N=()=>{const i=C&&\"point\"!==o.layout.get(\"symbol-placement\"),a=[],l=i||M||P;t.terrainRenderModeElevated()&&D&&a.push(\"PITCH_WITH_MAP_TERRAIN\"),d&&(a.push(\"PROJECTION_GLOBE_VIEW\"),l&&a.push(\"PROJECTED_POS_ON_VIEWPORT\")),n.text.zOffsetVertexBuffer&&a.push(\"Z_OFFSET\");const h=n.text.programConfigurations.get(o.id),m=t.getOrCreateProgram(n.iconsInText?\"symbolTextAndIcon\":\"symbolSDF\",{config:h,defines:a});let v,x=[0,0],y=null;const b=n.textSizeData;n.iconsInText&&(x=r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],y=r.imageAtlasTexture?r.imageAtlasTexture:null,v=D||0!==E.pitch||t.options.rotating||t.options.zooming||\"composite\"===b.kind||\"camera\"===b.kind?T.LINEAR:T.NEAREST);const w=r.glyphAtlasTexture?r.glyphAtlasTexture.size:[0,0],S=e.b8(b,E.zoom),I=_i(p,r.tileID.canonical,D,C,E,n.getProjection(),f),R=fi(p,r.tileID.canonical,D,C,E,n.getProjection(),f),A=t.translatePosMatrix(R,r,c,u,!0),O=t.translatePosMatrix(p,r,c,u),k=l?Yr:I,N=C&&!D&&!i;let U=F;!z&&!E.mercatorFromTransition||C||(U=Jr(E));const G=d?U:F;let j;j=n.iconsInText?jr(b.kind,S,N,D,t,O,k,A,w,x,s,_,L,B,G,n.getProjection()):Gr(b.kind,S,N,D,t,O,k,A,!0,w,!0,s,_,L,B,G,n.getProjection());const V=r.glyphAtlasTexture?r.glyphAtlasTexture:null,Z=T.LINEAR,W=0!==o.paint.get(\"text-halo-width\").constantOr(1),H=t.terrain&&D&&i?e.a9.invert(e.a9.create(),I):Yr;if(i&&n.text){const e=E.elevation,i=e?e.getAtTileOffsetFunc(s,E.center.lat,E.worldSize,n.getProjection()):null,o=pi(p,r.tileID.canonical,D,C,E,n.getProjection(),f);xi(n,p,t,!0,o,R,D,g,i,s);}return {program:m,buffers:n.text,uniformValues:j,atlasTexture:V,atlasTextureIcon:y,atlasInterpolation:Z,atlasInterpolationIcon:v,isSDF:!0,hasHalo:W,tile:r,labelPlaneMatrixInv:H}},U=n.icon.segments.get().length,G=n.text.segments.get().length,j=U&&!a.onlyText?k():null,V=G&&!a.onlyIcons?N():null,Z=o.paint.get(\"icon-opacity\").constantOr(1),W=o.paint.get(\"text-opacity\").constantOr(1);if(R&&n.canOverlap){A=!0;const t=Z&&!a.onlyText?n.icon.segments.get():[],i=W&&!a.onlyIcons?n.text.segments.get():[];for(const i of t)O.push({segments:new e.aE([i]),sortKey:i.sortKey,state:j});for(const t of i)O.push({segments:new e.aE([t]),sortKey:t.sortKey,state:V});}else a.onlyText||O.push({segments:Z?n.icon.segments:new e.aE([]),sortKey:0,state:j}),a.onlyIcons||O.push({segments:W?n.text.segments:new e.aE([]),sortKey:0,state:V});}A&&O.sort(((e,t)=>e.sortKey-t.sortKey));for(const e of O){const i=e.state;if(i)if(t.terrain&&t.terrain.setupElevationDraw(i.tile,i.program,{useDepthForOcclusion:E.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:i.labelPlaneMatrixInv}),w.activeTexture.set(T.TEXTURE0),i.atlasTexture&&i.atlasTexture.bind(i.atlasInterpolation,T.CLAMP_TO_EDGE,!0),i.atlasTextureIcon&&(w.activeTexture.set(T.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,T.CLAMP_TO_EDGE,!0)),t.uploadCommonLightUniforms(t.context,i.program),i.hasHalo){const r=i.uniformValues;r.u_is_halo=1,is(i.buffers,e.segments,o,t,i.program,P,s,n,r,2),r.u_is_halo=0;}else {if(i.isSDF){const r=i.uniformValues;i.hasHalo&&(r.u_is_halo=1,is(i.buffers,e.segments,o,t,i.program,P,s,n,r,1)),r.u_is_halo=0;}is(i.buffers,e.segments,o,t,i.program,P,s,n,i.uniformValues,1);}}}function is(e,t,i,o,r,s,n,a,l,c){const h=[e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer,e.iconTransitioningVertexBuffer,e.globeExtVertexBuffer,e.zOffsetVertexBuffer];r.draw(o,o.context.gl.TRIANGLES,s,n,a,Mt.disabled,l,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,o.transform.zoom,e.programConfigurations.get(i.id),h,c);}function os(e,t,i,o,r,s,n){const a=e.context.gl,l=i.paint.get(\"fill-pattern\"),c=l&&l.constantOr(1);let h,u,d,_,p;n?(u=c&&!i.getPaintProperty(\"fill-outline-color\")?\"fillOutlinePattern\":\"fillOutline\",h=a.LINES):(u=c?\"fillPattern\":\"fill\",h=a.TRIANGLES);for(const f of o){const o=t.getTile(f);if(c&&!o.patternsLoaded())continue;const m=o.getBucket(i);if(!m)continue;e.prepareDrawTile();const g=m.programConfigurations.get(i.id),v=e.isTileAffectedByFog(f),x=e.getOrCreateProgram(u,{config:g,overrideFog:v});c&&(e.context.activeTexture.set(a.TEXTURE0),o.imageAtlasTexture&&o.imageAtlasTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),g.updatePaintBuffers());const y=l.constantOr(null);if(y&&o.imageAtlas){const e=o.imageAtlas.patternPositions[y.toString()];e&&g.setConstantPatternPositions(e);}const b=e.translatePosMatrix(f.projMatrix,o,i.paint.get(\"fill-translate\"),i.paint.get(\"fill-translate-anchor\")),w=i.paint.get(\"fill-emissive-strength\");if(n){_=m.indexBuffer2,p=m.segments2;const t=e.terrain&&e.terrain.renderingToTexture?e.terrain.drapeBufferSize:[a.drawingBufferWidth,a.drawingBufferHeight];d=\"fillOutlinePattern\"===u&&c?Ir(b,w,e,o,t):Cr(b,w,t);}else _=m.indexBuffer,p=m.segments,d=c?Sr(b,w,e,o):Er(b,w);e.uploadCommonUniforms(e.context,x,f.toUnwrapped()),x.draw(e,h,r,e.stencilModeForClipping(f),s,Mt.disabled,d,i.id,m.layoutVertexBuffer,_,p,i.paint,e.transform.zoom,g,void 0);}}function rs(t,i,o,r,s,n,a,l){o.resetLayerRenderingStats(t);const c=t.context,h=c.gl,u=t.transform,d=o.paint.get(\"fill-extrusion-pattern\"),_=d.constantOr(1),p=o.paint.get(\"fill-extrusion-opacity\"),f=t.style.enable3dLights(),m=o.paint.get(f&&!_?\"fill-extrusion-ambient-occlusion-wall-radius\":\"fill-extrusion-ambient-occlusion-radius\"),g=[o.paint.get(\"fill-extrusion-ambient-occlusion-intensity\"),m],v=o.layout.get(\"fill-extrusion-edge-radius\"),x=v>0&&!o.paint.get(\"fill-extrusion-rounded-roof\"),y=x?0:v,b=\"globe\"===u.projection.name?e.cM():0,w=\"globe\"===u.projection.name,T=w?e.W(u.zoom):0,E=[e.a8(u.center.lng),e.ah(u.center.lat)],S=o.paint.get(\"fill-extrusion-flood-light-color\").toArray01().slice(0,3),C=o.paint.get(\"fill-extrusion-flood-light-intensity\"),I=o.paint.get(\"fill-extrusion-vertical-scale\"),D=mo(t,o.paint.get(\"fill-extrusion-cutoff-fade-range\")),R=o.paint.get(\"fill-extrusion-emissive-strength\"),A=[];let P;w&&A.push(\"PROJECTION_GLOBE_VIEW\"),g[0]>0&&A.push(\"FAUX_AO\"),x&&A.push(\"ZERO_ROOF_RADIUS\"),l&&A.push(\"HAS_CENTROID\"),C>0&&A.push(\"FLOOD_LIGHT\"),D.shouldRenderCutoff&&A.push(\"RENDER_CUTOFF\");const L=\"shadow\"===t.renderPass,M=t.shadowRenderer,z=L&&!!M;t.shadowRenderer&&(t.shadowRenderer.useNormalOffset=!0);let O=[0,0,0];if(M){const e=t.style.directionalLight,i=t.style.ambientLight;e&&i&&(O=To(e,i)),P=A.concat([\"SHADOWS_SINGLE_CASCADE\"]);}const F=z?\"fillExtrusionDepth\":_?\"fillExtrusionPattern\":\"fillExtrusion\",B=o.getLayerRenderingStats();for(const e of r){const r=i.getTile(e),f=r.getBucket(o);if(!f||f.projection.name!==u.projection.name)continue;let m=!1;M&&(m=0===M.getMaxCascadeForTile(e.toUnwrapped()));const v=t.isTileAffectedByFog(e),x=f.programConfigurations.get(o.id),z=t.getOrCreateProgram(F,{config:x,defines:m?P:A,overrideFog:v});if(t.terrain&&t.terrain.setupElevationDraw(r,z,{useMeterToDem:!0}),!f.centroidVertexBuffer){const e=z.attributes.a_centroid_pos;void 0!==e&&h.vertexAttrib2f(e,0,0);}!L&&M&&M.setupShadows(r.tileID.toUnwrapped(),z,\"vector-tile\",r.tileID.overscaledZ),_&&(t.context.activeTexture.set(h.TEXTURE0),r.imageAtlasTexture&&r.imageAtlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),x.updatePaintBuffers());const k=d.constantOr(null);if(k&&r.imageAtlas){const e=r.imageAtlas.patternPositions[k.toString()];e&&x.setConstantPatternPositions(e);}const N=o.paint.get(\"fill-extrusion-vertical-gradient\");let U;if(L&&M){if(hs(r.tileID,f,t))continue;const e=M.calculateShadowPassMatrixFromTile(r.tileID.toUnwrapped());U=wr(e,y,I);}else {const i=t.translatePosMatrix(e.expandedProjMatrix,r,o.paint.get(\"fill-extrusion-translate\"),o.paint.get(\"fill-extrusion-translate-anchor\")),s=u.projection.createInversionMatrix(u,e.canonical);U=_?Tr(i,t,N,p,g,y,e,r,b,T,E,s,S,I):br(i,t,N,p,g,y,e,b,T,E,s,S,I,C,O,R);}t.uploadCommonUniforms(c,z,e.toUnwrapped(),null,D);let G=f.segments;if(\"mercator\"===u.projection.name&&!L&&(G=f.getVisibleSegments(r.tileID,t.terrain,t.transform.getFrustum(0)),!G.get().length))continue;if(B)if(L)for(const e of G.get())B.numRenderedVerticesInShadowPass+=e.primitiveLength;else for(const e of G.get())B.numRenderedVerticesInTransparentPass+=e.primitiveLength;const j=[];(t.terrain||l)&&j.push(f.centroidVertexBuffer),w&&j.push(f.layoutVertexExtBuffer),z.draw(t,c.gl.TRIANGLES,s,n,a,Mt.backCCW,U,o.id,f.layoutVertexBuffer,f.indexBuffer,G,o.paint,t.transform.zoom,x,j);}t.shadowRenderer&&(t.shadowRenderer.useNormalOffset=!1);}function ss(t,i,o,r,s,n,a,l,c,h,u,d,_,p,f,m,g,v,x){const y=t.context,b=y.gl,w=t.transform,T=t.transform.zoom,E=[],S=mo(t,o.paint.get(\"fill-extrusion-cutoff-fade-range\"));\"clear\"===h?(E.push(\"CLEAR_SUBPASS\"),x&&(E.push(\"CLEAR_FROM_TEXTURE\"),y.activeTexture.set(b.TEXTURE0),x.bind(b.LINEAR,b.CLAMP_TO_EDGE))):\"sdf\"===h&&E.push(\"SDF_SUBPASS\"),g&&E.push(\"HAS_CENTROID\"),S.shouldRenderCutoff&&E.push(\"RENDER_CUTOFF\");const C=o.layout.get(\"fill-extrusion-edge-radius\"),I=(e,i,r,h,v)=>{const b=i.programConfigurations.get(o.id),w=t.isTileAffectedByFog(e),I=t.getOrCreateProgram(\"fillExtrusionGroundEffect\",{config:b,defines:E,overrideFog:w}),D=((e,t,i,o,r,s,n,a,l,c,h)=>({u_matrix:t,u_opacity:i,u_ao_pass:o?1:0,u_meter_to_tile:r,u_ao:s,u_flood_light_intensity:n,u_flood_light_color:a,u_attenuation:l,u_edge_radius:c,u_fb:0,u_fb_size:h}))(0,h,u,c,v,[d,_*v],p,f,m,T>=17?0:C*v,x?x.size[0]:0),R=[];g&&R.push(i.hiddenByLandmarkVertexBuffer),t.uploadCommonUniforms(y,I,e.toUnwrapped(),null,S),I.draw(t,y.gl.TRIANGLES,s,n,a,l,D,o.id,i.vertexBuffer,i.indexBuffer,r,o.paint,T,b,R);};for(const s of r){const r=i.getTile(s),n=r.getBucket(o);if(!n||n.projection.name!==w.projection.name||!n.groundEffect||n.groundEffect&&!n.groundEffect.hasData())continue;const a=n.groundEffect,l=1/n.tileToMeter;{const e=t.translatePosMatrix(s.projMatrix,r,o.paint.get(\"fill-extrusion-translate\"),o.paint.get(\"fill-extrusion-translate-anchor\")),i=a.getDefaultSegment();I(s,a,i,e,l);}if(v)for(let n=0;n<4;n++){const a=e.cN[n](s),c=i.getTile(a);if(!c)continue;const h=c.getBucket(o);if(!h||h.projection.name!==w.projection.name||!h.groundEffect||h.groundEffect&&!h.groundEffect.hasData())continue;const u=h.groundEffect;let d,_;0===n?(d=[-e.Y,0,0],_=1):1===n?(d=[e.Y,0,0],_=0):2===n?(d=[0,-e.Y,0],_=3):(d=[0,e.Y,0],_=2);const p=u.regionSegments[_];if(!p)continue;const f=new Float32Array(16);e.a9.translate(f,s.projMatrix,d),I(s,u,p,t.translatePosMatrix(f,r,o.paint.get(\"fill-extrusion-translate\"),o.paint.get(\"fill-extrusion-translate-anchor\")),l);}}}function ns(t,i,o,r,s,n,a){0===r.centroidVertexArray.length&&r.createCentroidsBuffer();const l=n?n.findDEMTileFor(o):null;if(!(l&&l.dem||a))return;const c=t=>new e.P(Math.ceil((t+e.cQ)*e.cR),0),h=e=>{const t=i.getSource().minzoom,o=e=>{const t=i.getTileByID(e);if(t&&t.hasData())return t.getBucket(s)},r=[0,-1,1];for(const i of r){if(e.overscaledZ+i<t)continue;const r=o(e.calculateScaledKey(e.overscaledZ+i));if(r)return r}},u=[0,0,0],d=(t,i)=>(u[0]=Math.min(t.min.y,i.min.y),u[1]=Math.max(t.max.y,i.max.y),u[2]=e.Y-i.min.x>t.max.x?i.min.x-e.Y:t.max.x,u),_=(t,i)=>(u[0]=Math.min(t.min.x,i.min.x),u[1]=Math.max(t.max.x,i.max.x),u[2]=e.Y-i.min.y>t.max.y?i.min.y-e.Y:t.max.y,u),p=[(e,t)=>d(e,t),(e,t)=>d(t,e),(e,t)=>_(e,t),(e,t)=>_(t,e)],f=(t,i,r,s,a,c,h)=>{if(!n)return 0;const u=[[c?r:t,c?t:r,0],[c?r:i,c?i:r,0]],d=h<0?e.Y+h:h,_=[c?d:(t+i)/2,c?(t+i)/2:d,0];return 0===r&&h<0||0!==r&&h>0?n.getForTilePoints(a,[_],!0,s):u.push(_),n.getForTilePoints(o,u,!0,l),Math.max(u[0][2],u[1][2],_[2])/n.exaggeration()};for(let t=0;t<4;t++){const i=r.borderFeatureIndices[t];if(0===i.length)continue;const s=e.cN[t](o),l=h(s);if(!(l&&l instanceof e.cO))continue;if(r.borderDoneWithNeighborZ[t]===l.canonical.z)continue;0===l.centroidVertexArray.length&&l.createCentroidsBuffer();const u=n?n.findDEMTileFor(s):null;if(!(u&&u.dem||a))continue;const d=(t<2?1:5)-t,_=l.borderDoneWithNeighborZ[d]!==r.canonical.z,v=l.borderFeatureIndices[d];let x=0;if(r.canonical.z!==l.canonical.z){for(const e of i)r.showCentroid(r.featuresOnBorder[e]);if(_)for(const e of v)l.showCentroid(l.featuresOnBorder[e]);r.borderDoneWithNeighborZ[t]=l.canonical.z,l.borderDoneWithNeighborZ[d]=r.canonical.z;}for(const o of i){const i=r.featuresOnBorder[o],n=r.centroidData[i.centroidDataIndex],h=i.borders[t];let _;for(;x<v.length;){_=l.featuresOnBorder[v[x]];const e=_.borders[d];if(e[1]>h[0]+3||e[0]>h[0]-3)break;l.showCentroid(_),x++;}if(_&&x<v.length){const o=x;let y=0;for(;!(_.borders[d][0]>h[1]-3)&&(y++,++x!==v.length);)_=l.featuresOnBorder[v[x]];if(_=l.featuresOnBorder[v[o]],y>1){const e=_.borders[d];Math.abs(h[0]-e[0])<3&&Math.abs(h[1]-e[1])<3&&(y=1,x=o+1);}else if(0===y){r.showCentroid(i);continue}const b=l.centroidData[_.centroidDataIndex];a&&1===y&&(((m=n).flags|(g=b).flags)&e.cP?(m.flags|=e.cP,g.flags|=e.cP):(m.flags&=~e.cP,g.flags&=~e.cP));const w=i.intersectsCount()>1||_.intersectsCount()>1;if(y>1)x=o,n.centroidXY=b.centroidXY=new e.P(0,0);else if(u&&u.dem&&!w){const i=p[t](n,b),o=t%2?e.Y-1:0,r=f(i[0],Math.min(e.Y-1,i[1]),o,u,s,t<2,i[2]);n.centroidXY=b.centroidXY=c(r);}else w?n.centroidXY=b.centroidXY=new e.P(0,0):(n.centroidXY=r.encodeBorderCentroid(i),b.centroidXY=l.encodeBorderCentroid(_));r.writeCentroidToBuffer(n),l.writeCentroidToBuffer(b);}else r.showCentroid(i);}r.borderDoneWithNeighborZ[t]=l.canonical.z,l.borderDoneWithNeighborZ[d]=r.canonical.z;}var m,g;(r.needsCentroidUpdate||!r.centroidVertexBuffer&&0!==r.centroidVertexArray.length)&&r.uploadCentroid(t);}const as=[1,0,0],ls=[0,1,0],cs=[0,0,1];function hs(t,i,o){const r=o.transform,s=o.shadowRenderer;if(!s)return !0;const n=t.toUnwrapped(),a=r.tileSize*s._cascades[o.currentShadowCascade].scale;let l=i.maxHeight;if(r.elevation){const e=r.elevation.getMinMaxForTile(t);e&&(l+=e.max);}const c=[...s.shadowDirection];c[2]=-c[2];const h=s.computeSimplifiedTileShadowVolume(n,l,a,c);if(!h)return !1;const u=[as,ls,cs,c,[c[0],0,c[2]],[0,c[1],c[2]]],d=\"globe\"===r.projection.name,_=r.scaleZoom(a),p=e.bt.fromInvProjectionMatrix(r.invProjMatrix,r.worldSize,_,!d),f=s.getCurrentCascadeFrustum();return 0===p.intersectsPrecise(h.vertices,h.planes,u)||0===f.intersectsPrecise(h.vertices,h.planes,u)}function us(t){return [t[0]*e.cS,t[1]*e.cS,t[2]*e.cS,0]}function ds(t,i,o,r,s,n,a,l,c){const h=r.getSource(),u=o.globeSharedBuffers;if(!u)return;let d,_,p;if(i&&(d=r.getTile(i)),h instanceof e.as?(_=h.texture,p=e.co(0,0,o.transform)):d&&i&&(_=d.texture,p=e.co(i.canonical.z,i.canonical.x,o.transform)),!_||!p)return;t||(p=e.a9.scale(e.a9.create(),p,[1,-1,1]));const f=o.context,m=f.gl,g=\"nearest\"===s.paint.get(\"raster-resampling\")?m.NEAREST:m.LINEAR,v=o.colorModeForDrapableLayerRenderPass(n),x=a.defines;x.push(\"GLOBE_POLES\");const y=new Ct(m.LEQUAL,Ct.ReadWrite,o.depthRangeFor3D),b=Float32Array.from(o.transform.expandedFarZProjMatrix),w=Float32Array.from(e.aW(e.cn(new e.bv(0,0,0))));o.terrain&&o.terrain.prepareDrawTile(),f.activeTexture.set(m.TEXTURE0),_.bind(g,m.CLAMP_TO_EDGE),f.activeTexture.set(m.TEXTURE1),_.bind(g,m.CLAMP_TO_EDGE),_.useMipmap&&f.extTextureFilterAnisotropic&&o.transform.pitch>20&&m.texParameterf(m.TEXTURE_2D,f.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,f.extTextureFilterAnisotropicMax);const[T,E,S,C]=i?u.getPoleBuffers(i.canonical.z,!1):u.getPoleBuffers(0,!0),I=s.paint.get(\"raster-elevation\");let D;t?(D=T,o.renderDefaultNorthPole=0!==I):(D=E,o.renderDefaultSouthPole=0!==I);const R=us(a.mix),A=((e,t,i,o,r,s,n,a,l,c,h,u,d)=>zr(e,t,i,new Float32Array(16),new Float32Array(9),[0,0],o,[0,0],[0,0,0,0],1,{opacity:1,mix:0},s,[0,0]||[0,0],a,2,c,h,u,1,0,d))(b,w,p,e.W(o.transform.zoom),0,s,0,I,0,R,a.offset,a.range,n),P=o.getOrCreateProgram(\"raster\",{defines:x});o.uploadCommonUniforms(f,P,null),P.draw(o,m.TRIANGLES,y,c,v,l,A,s.id,D,S,C);}function _s(e){const t=e._nearZ,i=e.projection.farthestPixelDistance(e),o=i-t,r=.2*e.height,s=t+r;return [t,i,(s-r-t)/o,(s-t)/o]}function ps(e,t,i,o){if(e)return t instanceof Pe&&e instanceof Ht?t.getTextureDescriptor(e,i,!0):{texture:e.texture,mix:us(o.mix),offset:o.offset,buffer:0,tileSize:1}}function fs(t,i,o){if(!t)return null;const r=i.getTextureDescriptor(t,o,!0);if(!r)return null;let{texture:s,mix:n,offset:a,tileSize:l,buffer:c,format:h}=r;if(!s||!h)return null;let u=!1;return \"uint32\"===h&&(u=!0,n[3]=0,n=Lr(e.cT,n,[0,o.paint.get(\"raster-particle-max-speed\")]),a=Mr(e.cT,a,[0,o.paint.get(\"raster-particle-max-speed\")])),{texture:s,textureOffset:[c/(l+2*c),l/(l+2*c)],tileSize:l,scalarData:u,scale:n,offset:a,defines:[\"RASTER_ARRAY\",{uint8:\"DATA_FORMAT_UINT8\",uint16:\"DATA_FORMAT_UINT16\",uint32:\"DATA_FORMAT_UINT32\"}[h]]}}function ms(e){const t=e._nearZ,i=e.projection.farthestPixelDistance(e),o=i-t,r=.2*e.height,s=t+r;return [t,i,(s-r-t)/o,(s-t)/o]}const gs=new e.aA(1,0,0,1),vs=new e.aA(0,1,0,1),xs=new e.aA(0,0,1,1),ys=new e.aA(1,0,1,1),bs=new e.aA(0,1,1,1);function ws(t,i,o,r,s,n,a){const l=t.context,c=t.transform,h=l.gl,u=\"globe\"===c.projection.name,d=u?[\"PROJECTION_GLOBE_VIEW\"]:[];let _=e.a9.clone(o.projMatrix);if(u&&e.W(c.zoom)>0){const t=e.aV(o.canonical,c),i=e.cU(t);_=e.a9.multiply(new Float32Array(16),c.globeMatrix,i),e.a9.multiply(_,c.projMatrix,_);}const p=e.a9.create();p[12]+=2*s/(e.f.devicePixelRatio*c.width),p[13]+=2*n/(e.f.devicePixelRatio*c.height),e.a9.multiply(_,p,_);const f=t.getOrCreateProgram(\"debug\",{defines:d}),m=i.getTileByID(o.key);t.terrain&&t.terrain.setupElevationDraw(m,f);const g=Ct.disabled,v=Dt.disabled,x=t.colorModeForRenderPass(),y=\"$debug\";l.activeTexture.set(h.TEXTURE0),t.emptyTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),u?m._makeGlobeTileDebugBuffers(t.context,c):m._makeDebugTileBoundsBuffers(t.context,c.projection);const b=m._tileDebugBuffer||t.debugBuffer,w=m._tileDebugIndexBuffer||t.debugIndexBuffer,T=m._tileDebugSegments||t.debugSegments;if(f.draw(t,h.LINE_STRIP,g,v,x,Mt.disabled,Rr(_,r),y,b,w,T,null,null,null,[m._globeTileDebugBorderBuffer]),a){const e=m.latestRawTileData,i=Math.floor((e&&e.byteLength||0)/1024);let r=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(r+=` => ${o.overscaledZ}`),r+=` ${m.state}`,r+=` ${i}kb`,function(e,t){e.initDebugOverlayCanvas();const i=e.debugOverlayCanvas,o=e.context.gl,r=e.debugOverlayCanvas.getContext(\"2d\");r.clearRect(0,0,i.width,i.height),r.shadowColor=\"white\",r.shadowBlur=2,r.lineWidth=1.5,r.strokeStyle=\"white\",r.textBaseline=\"top\",r.font=\"bold 36px Open Sans, sans-serif\",r.fillText(t,5,5),r.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE);}(t,r);}const E=i.getTile(o).tileSize,S=512/Math.min(E,512)*(o.overscaledZ/c.zoom)*.5,C=m._tileDebugTextBuffer||t.debugBuffer,I=m._tileDebugTextIndexBuffer||t.quadTriangleIndexBuffer,D=m._tileDebugTextSegments||t.debugSegments;f.draw(t,h.TRIANGLES,g,v,At.alphaBlended,Mt.disabled,Rr(_,e.aA.transparent,S),y,C,I,D,null,null,null,[m._globeTileDebugTextBuffer]);}function Ts(e,t,i,o){Ss(e,0,t+i/2,e.transform.width,i,o);}function Es(e,t,i,o){Ss(e,t-i/2,0,i,e.transform.height,o);}function Ss(t,i,o,r,s,n){const a=t.context,l=a.gl;l.enable(l.SCISSOR_TEST),l.scissor(i*e.f.devicePixelRatio,o*e.f.devicePixelRatio,r*e.f.devicePixelRatio,s*e.f.devicePixelRatio),a.clear({color:n}),l.disable(l.SCISSOR_TEST);}const Cs=e.aB([{name:\"a_pos_3f\",components:3,type:\"Float32\"}]),{members:Is}=Cs;function Ds(e,t,i,o){e.emplaceBack(t,i,o);}class Rs{constructor(t){this.vertexArray=new e.cV,this.indices=new e.az,Ds(this.vertexArray,-1,-1,1),Ds(this.vertexArray,1,-1,1),Ds(this.vertexArray,-1,1,1),Ds(this.vertexArray,1,1,1),Ds(this.vertexArray,-1,-1,-1),Ds(this.vertexArray,1,-1,-1),Ds(this.vertexArray,-1,1,-1),Ds(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=t.createVertexBuffer(this.vertexArray,Is),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=e.aE.simpleSegment(0,0,36,12);}}function As(t,i,o,r,s,n){const a=t.context.gl,l=i.paint.get(\"sky-atmosphere-color\"),c=i.paint.get(\"sky-atmosphere-halo-color\"),h=i.paint.get(\"sky-atmosphere-sun-intensity\"),u=((e,t,i,o,r)=>({u_matrix_3f:e,u_sun_direction:t,u_sun_intensity:i,u_color_tint_r:[o.r,o.g,o.b,o.a],u_color_tint_m:[r.r,r.g,r.b,r.a],u_luminance:5e-5}))(e.ct.fromMat4(e.ct.create(),r),s,h,l,c);a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+n,i.skyboxTexture,0),o.draw(t,a.TRIANGLES,Ct.disabled,Dt.disabled,At.unblended,Mt.frontCW,u,\"skyboxCapture\",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment);}const Ps=e.aB([{type:\"Float32\",name:\"a_pos\",components:3},{type:\"Float32\",name:\"a_uv\",components:2}]);class Ls{constructor(t){const i=new e.cW;i.emplaceBack(-1,1,1,0,0),i.emplaceBack(1,1,1,1,0),i.emplaceBack(1,-1,1,1,1),i.emplaceBack(-1,-1,1,0,1);const o=new e.az;o.emplaceBack(0,1,2),o.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(i,Ps.members),this.indexBuffer=t.createIndexBuffer(o),this.segments=e.aE.simpleSegment(0,0,4,2);}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy();}}const Ms=e.aB([{type:\"Float32\",name:\"a_pos_3f\",components:3},{type:\"Float32\",name:\"a_uv\",components:2},{type:\"Float32\",name:\"a_size_scale\",components:1},{type:\"Float32\",name:\"a_fade_opacity\",components:1}]);class zs{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200;}}class Os{constructor(t){this.colorModeAlphaBlendedWriteRGB=new At([1,Rt,1,Rt],e.aA.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new At([1,0,1,0],e.aA.transparent,[!1,!1,!1,!0]),this.params=new zs,this.updateNeeded=!0,t.tp.registerParameter(this.params,[\"Stars\"],\"starsCount\",{min:100,max:16e3,step:1},(()=>{this.updateNeeded=!0;})),t.tp.registerParameter(this.params,[\"Stars\"],\"sizeMultiplier\",{min:.01,max:2,step:.01}),t.tp.registerParameter(this.params,[\"Stars\"],\"sizeRange\",{min:0,max:200,step:1},(()=>{this.updateNeeded=!0;})),t.tp.registerParameter(this.params,[\"Stars\"],\"intensityRange\",{min:0,max:200,step:1},(()=>{this.updateNeeded=!0;}));}update(t){const i=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Ls(i);const t=this.params.sizeRange,o=this.params.intensityRange,r=function(t){const i=e.aC(30),o=[];for(let r=0;r<t;++r){const t=2*Math.PI*i(),r=Math.acos(1-2*i())-.5*Math.PI;o.push(e.Q.fromValues(Math.cos(r)*Math.cos(t),Math.cos(r)*Math.sin(t),Math.sin(r)));}return o}(this.params.starsCount),s=e.aC(300),n=new e.cX,a=new e.az;let l=0;for(let i=0;i<r.length;++i){const c=e.Q.scale([],r[i],200),h=Math.max(0,1+.01*t*(1*s()-.5)),u=Math.max(0,1+.01*o*(1*s()-.5));n.emplaceBack(c[0],c[1],c[2],-1,-1,h,u),n.emplaceBack(c[0],c[1],c[2],1,-1,h,u),n.emplaceBack(c[0],c[1],c[2],1,1,h,u),n.emplaceBack(c[0],c[1],c[2],-1,1,h,u),a.emplaceBack(l+0,l+1,l+2),a.emplaceBack(l+0,l+2,l+3),l+=4;}this.starsVx=i.createVertexBuffer(n,Ms.members),this.starsIdx=i.createIndexBuffer(a),this.starsSegments=e.aE.simpleSegment(0,0,n.length,a.length);}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy();}drawAtmosphereGlow(t,i){const o=t.context,r=o.gl,s=t.transform,n=new Ct(r.LEQUAL,Ct.ReadOnly,[0,1]),a=e.W(s.zoom),l=i.properties.get(\"color\").toArray01(),c=i.properties.get(\"high-color\").toArray01(),h=i.properties.get(\"space-color\").toArray01PremultipliedAlpha(),u=5e-4,d=e.cY(i.properties.get(\"horizon-blend\"),0,1,u,.25),_=e.ci(t,o,s)&&d===u?s.worldSize/(2*Math.PI*1.025)-1:s.globeRadius,p=t.frameCounter/1e3%1,f=e.Q.length(s.globeCenterInViewSpace),m=Math.sqrt(Math.pow(f,2)-Math.pow(_,2)),g=Math.acos(m/f),v=e=>{const i=\"globe\"===s.projection.name?[\"PROJECTION_GLOBE_VIEW\",\"FOG\"]:[\"FOG\"];e&&i.push(\"ALPHA_PASS\");const u=t.getOrCreateProgram(\"globeAtmosphere\",{defines:i}),_=((e,t,i,o,r,s,n,a,l,c,h,u)=>({u_frustum_tl:e,u_frustum_tr:t,u_frustum_br:i,u_frustum_bl:o,u_horizon:r,u_transition:s,u_fadeout_range:n,u_color:a,u_high_color:l,u_space_color:c,u_temporal_offset:h,u_horizon_angle:u}))(s.frustumCorners.TL,s.frustumCorners.TR,s.frustumCorners.BR,s.frustumCorners.BL,s.frustumCorners.horizon,a,d,l,c,h,p,g);t.uploadCommonUniforms(o,u);const f=this.atmosphereBuffer;f&&u.draw(t,r.TRIANGLES,n,Dt.disabled,e?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,Mt.backCW,_,e?\"atmosphere_glow_alpha\":\"atmosphere_glow\",f.vertexBuffer,f.indexBuffer,f.segments);};v(!1),v(!0);}drawStars(t,i){const o=e.ad(i.properties.get(\"star-intensity\"),0,1);if(0===o)return;const r=t.context,s=r.gl,n=t.transform,a=t.getOrCreateProgram(\"stars\"),l=e.bl.identity([]);e.bl.rotateX(l,l,-n._pitch),e.bl.rotateZ(l,l,-n.angle),e.bl.rotateX(l,l,e.bm(n._center.lat)),e.bl.rotateY(l,l,-e.bm(n._center.lng));const c=e.a9.fromQuat(new Float32Array(16),l),h=e.a9.multiply([],n.starsProjMatrix,c),u=e.ct.fromMat4([],c),d=e.ct.invert([],u),_=[0,1,0];e.Q.transformMat3(_,_,d),e.Q.scale(_,_,this.params.sizeMultiplier);const p=[1,0,0];e.Q.transformMat3(p,p,d),e.Q.scale(p,p,this.params.sizeMultiplier);const f=(m=_,g=p,v=o,{u_matrix:Float32Array.from(h),u_up:m,u_right:g,u_intensity_multiplier:v});var m,g,v;t.uploadCommonUniforms(r,a),this.starsVx&&this.starsIdx&&a.draw(t,s.TRIANGLES,Ct.disabled,Dt.disabled,this.colorModeAlphaBlendedWriteRGB,Mt.disabled,f,\"atmosphere_stars\",this.starsVx,this.starsIdx,this.starsSegments);}}function Fs(t,i){const o=[...t],r=i.cameraWorldSizeForFog/i.worldSize,s=e.a9.identity([]);return e.a9.scale(s,s,[r,r,1]),e.a9.multiply(o,s,o),e.a9.multiply(o,i.worldToFogMatrix,o),o}function Bs(e,t,i,o){const r=i.material,s=o.context,{baseColorTexture:n,metallicRoughnessTexture:a}=r.pbrMetallicRoughness,{normalTexture:l,occlusionTexture:c,emissionTexture:h}=r;function u(t,i,o){if(t&&(e.push(i),s.activeTexture.set(s.gl.TEXTURE0+o),t.gfxTexture)){const{minFilter:e,magFilter:i,wrapS:o,wrapT:r}=t.sampler;t.gfxTexture.bindExtraParam(e,i,o,r);}}u(n,\"HAS_TEXTURE_u_baseColorTexture\",fo.BaseColor),u(a,\"HAS_TEXTURE_u_metallicRoughnessTexture\",fo.MetallicRoughness),u(l,\"HAS_TEXTURE_u_normalTexture\",fo.Normal),u(c,\"HAS_TEXTURE_u_occlusionTexture\",fo.Occlusion),u(h,\"HAS_TEXTURE_u_emissionTexture\",fo.Emission),i.texcoordBuffer&&(e.push(\"HAS_ATTRIBUTE_a_uv_2f\"),t.push(i.texcoordBuffer)),i.colorBuffer&&(e.push(12===i.colorBuffer.itemSize?\"HAS_ATTRIBUTE_a_color_3f\":\"HAS_ATTRIBUTE_a_color_4f\"),t.push(i.colorBuffer)),i.normalBuffer&&(e.push(\"HAS_ATTRIBUTE_a_normal_3f\"),t.push(i.normalBuffer)),i.pbrBuffer&&(e.push(\"HAS_ATTRIBUTE_a_pbr\"),e.push(\"HAS_ATTRIBUTE_a_heightBasedEmissiveStrength\"),t.push(i.pbrBuffer)),\"OPAQUE\"!==r.alphaMode&&\"MASK\"!==r.alphaMode||e.push(\"UNPREMULT_TEXTURE_IN_SHADER\"),r.defined||e.push(\"DIFFUSE_SHADED\"),e.push(\"USE_STANDARD_DERIVATIVES\");}function ks(t,i,o,r,s,n){const a=o.paint.get(\"model-opacity\"),l=i.context,c=new Ct(i.context.gl.LEQUAL,Ct.ReadWrite,i.depthRangeFor3D),h=i.transform,u=t.mesh,d=u.material,_=d.pbrMetallicRoughness,p=i.style.fog;let f;f=\"pixels\"===i.transform.projection.zAxisUnit?[...t.nodeModelMatrix]:e.a9.multiply([],r.zScaleMatrix,t.nodeModelMatrix),e.a9.multiply(f,r.negCameraPosMatrix,f);const m=e.a9.invert([],f);e.a9.transpose(m,m);const g=o.paint.get(\"model-emissive-strength\").constantOr(0),v=Hr(new Float32Array(t.worldViewProjection),new Float32Array(f),new Float32Array(m),null,i,a,_.baseColorFactor,d.emissiveFactor,_.metallicFactor,_.roughnessFactor,d,g,o),x={defines:[]},y=[];Bs(x.defines,y,u,i);const b=i.shadowRenderer;b&&(b.useNormalOffset=!1);let w=null;if(p){const e=Fs(t.nodeModelMatrix,i.transform);if(w=new Float32Array(e),\"globe\"!==h.projection.name){const t=u.aabb.min,i=u.aabb.max,[o,r]=p.getOpacityForBounds(e,t[0],t[1],i[0],i[1]);x.overrideFog=o>=_e||r>=_e;}}const T=mo(i,o.paint.get(\"model-cutoff-fade-range\"));T.shouldRenderCutoff&&x.defines.push(\"RENDER_CUTOFF\");const E=i.getOrCreateProgram(\"model\",x);i.uploadCommonUniforms(l,E,null,w,T),\"shadow\"!==i.renderPass&&b&&b.setupShadowsFromMatrix(t.nodeModelMatrix,E),E.draw(i,l.gl.TRIANGLES,c,s,n,u.material.doubleSided?Mt.disabled:Mt.backCCW,v,o.id,u.vertexBuffer,u.indexBuffer,u.segments,o.paint,i.transform.zoom,void 0,y);}function Ns(t,i,o,r,s,n,a){let l;l=\"globe\"===t.projection.name?e.c_(o,t):[...o],e.a9.multiply(l,l,i.matrix);const c=e.a9.multiply([],r,l);if(i.meshes)for(const t of i.meshes){if(\"BLEND\"!==t.material.alphaMode){a.push({mesh:t,depth:0,modelIndex:s,worldViewProjection:c,nodeModelMatrix:l});continue}const i=e.Q.transformMat4([],t.centroid,c);i[2]>0&&n.push({mesh:t,depth:i[2],modelIndex:s,worldViewProjection:c,nodeModelMatrix:l});}if(i.children)for(const e of i.children)Ns(t,e,o,r,s,n,a);}function Us(e,t,i,o){const r=i.shadowRenderer;if(!r)return;const s=r.getShadowPassDepthMode(),n=r.getShadowPassColorMode(),a=r.calculateShadowPassMatrixFromMatrix(t),l=qr(a);i.getOrCreateProgram(\"modelDepth\",{defines:i._shadowMapDebug?[]:[\"DEPTH_TEXTURE\"]}).draw(i,i.context.gl.TRIANGLES,s,Dt.disabled,n,Mt.backCCW,l,o.id,e.vertexBuffer,e.indexBuffer,e.segments,o.paint,i.transform.zoom,void 0,void 0);}function Gs(t,i,o){const r=i.updateZoomBasedPaintProperties(),s=function(t,i,o){let r,s,n,a=t.terrain?t.terrain.exaggeration():0;if(t.terrain&&a>0){const i=t.terrain,s=i.findDEMTileFor(o);s&&s.dem?r=e.d0.create(i,o,s):a=0;}if(0===a&&(i.terrainElevationMin=0,i.terrainElevationMax=0),a===i.validForExaggeration&&(0===a||r&&r._demTile&&r._demTile.tileID===i.validForDEMTile.id&&r._dem._timestamp===i.validForDEMTile.timestamp))return !1;for(const e in i.instancesPerModel){const t=i.instancesPerModel[e];for(let e=0;e<t.instancedDataArray.length;++e){const o=(r?a*r.getElevationAt(0|t.instancedDataArray.float32[16*e],0|t.instancedDataArray.float32[16*e+1],!0,!0):0)+t.instancesEvaluatedElevation[e];t.instancedDataArray.float32[16*e+6]=o,s=s?Math.min(i.terrainElevationMin,o):o,n=n?Math.max(i.terrainElevationMax,o):o;}}return i.terrainElevationMin=s||0,i.terrainElevationMax=n||0,i.validForExaggeration=a,i.validForDEMTile=r&&r._demTile?{id:r._demTile.tileID,timestamp:r._dem._timestamp}:{id:void 0,timestamp:0},!0}(t,i,o);(r||s)&&(i.uploaded=!1,i.upload(t.context));}const js={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new e.bV([0,0,0],[e.Y,e.Y,0])};function Vs(t,i){const o=1<<t.canonical.z,r=i.getFreeCameraOptions().position,s=i.elevation,n=t.canonical.x/o,a=(t.canonical.x+1)/o,l=t.canonical.y/o,c=(t.canonical.y+1)/o;let h=i._centerAltitude;if(s){const e=s.getMinMaxForTile(t);e&&e.max>h&&(h=e.max);}const u=e.ad(r.x,n,a)-r.x,d=e.ad(r.y,l,c)-r.y,_=e.bo(h,i.center.lat)-r.z;return i._zoomFromMercatorZ(Math.sqrt(u*u+d*d+_*_))}function Zs(e,t,i,o,r,s,n){const a=e.context,l=\"shadow\"===e.renderPass,c=e.shadowRenderer,h=l&&c?c.getShadowPassDepthMode():new Ct(a.gl.LEQUAL,Ct.ReadWrite,e.depthRangeFor3D),u=e.isTileAffectedByFog(s);if(i.meshes)for(const d of i.meshes){const _=[\"MODEL_POSITION_ON_GPU\"],p=[];let f,m,g;o.instancedDataArray.length>20&&_.push(\"INSTANCED_ARRAYS\");const v=mo(e,t.paint.get(\"model-cutoff-fade-range\"));if(v.shouldRenderCutoff&&_.push(\"RENDER_CUTOFF\"),l&&c)f=e.getOrCreateProgram(\"modelDepth\",{defines:_}),m=qr(n.shadowTileMatrix,n.shadowTileMatrix,Float32Array.from(i.matrix)),g=c.getShadowPassColorMode();else {Bs(_,p,d,e),f=e.getOrCreateProgram(\"model\",{defines:_,overrideFog:u});const o=d.material,l=o.pbrMetallicRoughness,h=t.paint.get(\"model-opacity\"),x=t.paint.get(\"model-emissive-strength\").constantOr(0);m=Hr(s.expandedProjMatrix,Float32Array.from(i.matrix),new Float32Array(16),null,e,h,l.baseColorFactor,o.emissiveFactor,l.metallicFactor,l.roughnessFactor,o,x,t,r),c&&(n.shadowUniformsInitialized?f.setShadowUniformValues(a,c.getShadowUniformValues()):(c.setupShadows(s.toUnwrapped(),f,\"model-tile\",s.overscaledZ),n.shadowUniformsInitialized=!0)),g=v.shouldRenderCutoff||h<1||\"OPAQUE\"!==o.alphaMode?At.alphaBlended:At.unblended;}e.uploadCommonUniforms(a,f,s.toUnwrapped(),null,v);const x=d.material.doubleSided?Mt.disabled:Mt.backCCW;if(o.instancedDataArray.length>20)p.push(o.instancedDataBuffer),f.draw(e,a.gl.TRIANGLES,h,Dt.disabled,g,x,m,t.id,d.vertexBuffer,d.indexBuffer,d.segments,t.paint,e.transform.zoom,void 0,p,o.instancedDataArray.length);else {const i=l?\"u_instance\":\"u_normal_matrix\";for(let r=0;r<o.instancedDataArray.length;++r)m[i]=new Float32Array(o.instancedDataArray.arrayBuffer,64*r,16),f.draw(e,a.gl.TRIANGLES,h,Dt.disabled,g,x,m,t.id,d.vertexBuffer,d.indexBuffer,d.segments,t.paint,e.transform.zoom,void 0,p);}}if(i.children)for(const a of i.children)Zs(e,t,a,o,r,s,n);}const Ws=[1,-1,1];function Hs(t,i,o,r){if(!o.modelManager)return !0;const s=o.modelManager;if(!o.shadowRenderer)return !0;const n=o.shadowRenderer,a=i.aabb;let l=!0,c=t.maxHeight;if(0===c){let e=0;for(const i in t.instancesPerModel){const t=s.getModel(i,r);t?e=Math.max(e,Math.max(Math.max(t.aabb.max[0],t.aabb.max[1]),t.aabb.max[2])):l=!1;}c=t.maxScale*e*1.41+t.maxVerticalOffset,l&&(t.maxHeight=c);}a.max[2]=c,a.min[2]+=t.terrainElevationMin,a.max[2]+=t.terrainElevationMax,e.Q.transformMat4(a.min,a.min,i.tileMatrix),e.Q.transformMat4(a.max,a.max,i.tileMatrix);const h=a.intersects(n.getCurrentCascadeFrustum());return 0===o.currentShadowCascade&&(t.isInsideFirstShadowMapFrustum=2===h),0===h}class qs{}class Qs{constructor(){this._storage=new Map;}getLinesFromTrianglesBuffer(t,i,o){{const e=this._storage.get(i.id);if(e)return e.lastUsedFrameIdx=t,e.buf}const r=o.gl,s=r.getBufferParameter(r.ELEMENT_ARRAY_BUFFER,r.BUFFER_SIZE),n=new ArrayBuffer(s),a=new Int16Array(n);r.getBufferSubData(r.ELEMENT_ARRAY_BUFFER,0,new Int16Array(n));const l=new e.d2;for(let e=0;e<s/2;e+=3){const t=a[e],i=a[e+1],o=a[e+2];l.emplaceBack(t,i),l.emplaceBack(i,o),l.emplaceBack(o,t);}const c=o.bindVertexArrayOES.current,h=new qs;return h.buf=new Ne(o,l),h.lastUsedFrameIdx=t,this._storage.set(i.id,h),o.bindVertexArrayOES.set(c),h.buf}update(e){for(const[t,i]of this._storage)e-i.lastUsedFrameIdx>30&&(i.buf.destroy(),this._storage.delete(t));}destroy(){for(const[e,t]of this._storage)t.buf.destroy(),this._storage.delete(e);}}const $s={symbol:function(t,i,o,r,s){if(\"translucent\"!==t.renderPass)return;const n=Dt.disabled,a=t.colorModeForRenderPass();o.layout.get(\"text-variable-anchor\")&&function(t,i,o,r,s,n,a){const l=i.transform,c=\"map\"===s,h=\"map\"===n;for(const i of t){const t=r.getTile(i),s=t.getBucket(o);if(!s||!s.text||!s.text.segments.get().length)continue;const n=e.b8(s.textSizeData,l.zoom),u=Li(i,s.getProjection(),l),d=l.calculatePixelsToTileUnitsMatrix(t),_=_i(u,t.tileID.canonical,h,c,l,s.getProjection(),d),p=s.hasIconTextFit()&&s.hasIconData();if(n){const o=Math.pow(2,l.zoom-t.tileID.overscaledZ);es(s,c,h,a,e.cE,l,_,i,o,n,p);}}}(r,t,o,i,o.layout.get(\"text-rotation-alignment\"),o.layout.get(\"text-pitch-alignment\"),s);const l=0!==o.paint.get(\"icon-opacity\").constantOr(1),c=0!==o.paint.get(\"text-opacity\").constantOr(1);void 0!==o.layout.get(\"symbol-sort-key\").constantOr(1)&&(l||c)?ts(t,i,o,r,n,a):(l&&ts(t,i,o,r,n,a,{onlyIcons:!0}),c&&ts(t,i,o,r,n,a,{onlyText:!0})),i.map.showCollisionBoxes&&(Xr(t,i,o,r,o.paint.get(\"text-translate\"),o.paint.get(\"text-translate-anchor\"),!0),Xr(t,i,o,r,o.paint.get(\"icon-translate\"),o.paint.get(\"icon-translate-anchor\"),!1));},circle:function(t,i,o,r){if(\"translucent\"!==t.renderPass)return;const s=o.paint.get(\"circle-opacity\"),n=o.paint.get(\"circle-stroke-width\"),a=o.paint.get(\"circle-stroke-opacity\"),l=void 0!==o.layout.get(\"circle-sort-key\").constantOr(1),c=o.paint.get(\"circle-emissive-strength\");if(0===s.constantOr(1)&&(0===n.constantOr(1)||0===a.constantOr(1)))return;const h=t.context,u=h.gl,d=t.transform,_=t.depthModeForSublayer(0,Ct.ReadOnly),p=Dt.disabled,f=t.colorModeForDrapableLayerRenderPass(c),m=\"globe\"===d.projection.name,g=[e.a8(d.center.lng),e.ah(d.center.lat)],v=[];for(let s=0;s<r.length;s++){const n=r[s],a=i.getTile(n),c=a.getBucket(o);if(!c||c.projection.name!==d.projection.name)continue;const h=c.programConfigurations.get(o.id),u=e.cF(o),_=t.isTileAffectedByFog(n);m&&u.push(\"PROJECTION_GLOBE_VIEW\");const p=t.getOrCreateProgram(\"circle\",{config:h,defines:u,overrideFog:_}),f=c.layoutVertexBuffer,x=c.globeExtVertexBuffer,y=c.indexBuffer,b=d.projection.createInversionMatrix(d,n.canonical),w={programConfiguration:h,program:p,layoutVertexBuffer:f,globeExtVertexBuffer:x,indexBuffer:y,uniformValues:e.cG(t,n,a,b,g,o),tile:a};if(l){const t=c.segments.get();for(const i of t)v.push({segments:new e.aE([i]),sortKey:i.sortKey,state:w});}else v.push({segments:c.segments,sortKey:0,state:w});}l&&v.sort(((e,t)=>e.sortKey-t.sortKey));const x={useDepthForOcclusion:d.depthOcclusionForSymbolsAndCircles};for(const e of v){const{programConfiguration:i,program:r,layoutVertexBuffer:s,globeExtVertexBuffer:n,indexBuffer:a,uniformValues:l,tile:c}=e.state,m=e.segments;t.terrain&&t.terrain.setupElevationDraw(c,r,x),t.uploadCommonUniforms(h,r,c.tileID.toUnwrapped()),r.draw(t,u.TRIANGLES,_,p,f,Mt.disabled,l,o.id,s,a,m,o.paint,d.zoom,i,[n]);}},heatmap:function(t,i,o,r){if(0!==o.paint.get(\"heatmap-opacity\"))if(\"offscreen\"===t.renderPass){const s=t.context,n=s.gl,a=Dt.disabled,l=new At([n.ONE,n.ONE,n.ONE,n.ONE],e.aA.transparent,[!0,!0,!0,!0]);!function(e,t,i,o){const r=e.gl,s=t.width*o,n=t.height*o;e.activeTexture.set(r.TEXTURE1),e.viewport.set([0,0,s,n]);let a=i.heatmapFbo;if(!a||a&&(a.width!==s||a.height!==n)){a&&a.destroy();const t=r.createTexture();r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),a=i.heatmapFbo=e.createFramebuffer(s,n,!0,null),function(e,t,i,o,r,s){const n=e.gl;n.texImage2D(n.TEXTURE_2D,0,e.extRenderToTextureHalfFloat?n.RGBA16F:n.RGBA,r,s,0,n.RGBA,e.extRenderToTextureHalfFloat?n.HALF_FLOAT:n.UNSIGNED_BYTE,null),o.colorAttachment.set(i);}(e,0,t,a,s,n);}else r.bindTexture(r.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer);}(s,t,o,\"globe\"===t.transform.projection.name?.5:.25),s.clear({color:e.aA.transparent});const c=t.transform,h=\"globe\"===c.projection.name,u=h?[\"PROJECTION_GLOBE_VIEW\"]:[],d=h?Mt.frontCCW:Mt.disabled,_=[e.a8(c.center.lng),e.ah(c.center.lat)];for(let e=0;e<r.length;e++){const p=r[e];if(i.hasRenderableParent(p))continue;const f=i.getTile(p),m=f.getBucket(o);if(!m||m.projection.name!==c.projection.name)continue;const g=t.isTileAffectedByFog(p),v=m.programConfigurations.get(o.id),x=t.getOrCreateProgram(\"heatmap\",{config:v,defines:u,overrideFog:g}),{zoom:y}=t.transform;t.terrain&&t.terrain.setupElevationDraw(f,x),t.uploadCommonUniforms(s,x,p.toUnwrapped());const b=c.projection.createInversionMatrix(c,p.canonical);x.draw(t,n.TRIANGLES,Ct.disabled,a,l,d,Pr(t,p,f,b,_,y,o.paint.get(\"heatmap-intensity\")),o.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,o.paint,t.transform.zoom,v,h?[m.globeExtVertexBuffer]:null);}s.viewport.set([0,0,t.width,t.height]);}else \"translucent\"===t.renderPass&&(t.context.setColorMode(t.colorModeForRenderPass()),function(t,i){const o=t.context,r=o.gl,s=i.heatmapFbo;if(!s)return;o.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,s.colorAttachment.get()),o.activeTexture.set(r.TEXTURE1);let n=i.colorRampTexture;n||(n=i.colorRampTexture=new e.T(o,i.colorRamp,r.RGBA)),n.bind(r.LINEAR,r.CLAMP_TO_EDGE),t.getOrCreateProgram(\"heatmapTexture\").draw(t,r.TRIANGLES,Ct.disabled,Dt.disabled,t.colorModeForRenderPass(),Mt.disabled,((e,t,i,o)=>({u_image:0,u_color_ramp:1,u_opacity:t.paint.get(\"heatmap-opacity\")}))(0,i),i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,i.paint,t.transform.zoom);}(t,o));},line:function(t,i,o,r){if(\"translucent\"!==t.renderPass)return;const s=o.paint.get(\"line-opacity\"),n=o.paint.get(\"line-width\");if(0===s.constantOr(1)||0===n.constantOr(1))return;const a=o.paint.get(\"line-emissive-strength\"),l=t.depthModeForSublayer(0,Ct.ReadOnly),c=t.colorModeForDrapableLayerRenderPass(a),h=t.terrain&&t.terrain.renderingToTexture?1:e.f.devicePixelRatio,u=o.paint.get(\"line-dasharray\"),d=u.constantOr(1),_=o.layout.get(\"line-cap\"),p=o.paint.get(\"line-pattern\"),f=p.constantOr(1),m=1!==o.paint.get(\"line-opacity\").constantOr(1);let g=!f&&m;const v=o.paint.get(\"line-gradient\"),x=f?\"linePattern\":\"line\",y=t.context,b=y.gl,w=e.cH(o);t.terrain&&t.terrain.clipOrMaskOverlapStencilType()&&(g=!1);for(const s of r){const r=i.getTile(s);if(f&&!r.patternsLoaded())continue;const n=r.getBucket(o);if(!n)continue;t.prepareDrawTile();const a=n.programConfigurations.get(o.id),m=t.isTileAffectedByFog(s),T=t.getOrCreateProgram(x,{config:a,defines:w,overrideFog:m}),E=p.constantOr(null);if(E&&r.imageAtlas){const e=r.imageAtlas.patternPositions[E.toString()];e&&a.setConstantPatternPositions(e);}const S=u.constantOr(null),C=_.constantOr(null);if(!f&&S&&C&&r.lineAtlas){const e=r.lineAtlas.getDash(S,C);e&&a.setConstantPatternPositions(e);}let[I,D]=o.paint.get(\"line-trim-offset\");if(\"round\"===C||\"square\"===C){const e=1;I!==D&&(0===I&&(I-=e),1===D&&(D+=e));}const R=t.terrain?s.projMatrix:null,A=f?e.cI(t,r,o,R,h,[I,D]):e.cJ(t,r,o,R,n.lineClipsArray.length,h,[I,D]);if(v){const r=n.gradients[o.id];let a=r.texture;if(o.gradientVersion!==r.version){let l=256;if(o.stepInterpolant){const o=i.getSource().maxzoom,r=s.canonical.z===o?Math.ceil(1<<t.transform.maxZoom-s.canonical.z):1;l=e.ad(e.cK(n.maxLineLength/e.Y*1024*r),256,y.maxTextureSize);}r.gradient=e.cL({expression:o.gradientExpression(),evaluationKey:\"lineProgress\",resolution:l,image:r.gradient||void 0,clips:n.lineClipsArray}),r.texture?r.texture.update(r.gradient):r.texture=new e.T(y,r.gradient,b.RGBA),r.version=o.gradientVersion,a=r.texture;}y.activeTexture.set(b.TEXTURE1),a.bind(o.stepInterpolant?b.NEAREST:b.LINEAR,b.CLAMP_TO_EDGE);}d&&(y.activeTexture.set(b.TEXTURE0),r.lineAtlasTexture&&r.lineAtlasTexture.bind(b.LINEAR,b.REPEAT),a.updatePaintBuffers()),f&&(y.activeTexture.set(b.TEXTURE0),r.imageAtlasTexture&&r.imageAtlasTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE),a.updatePaintBuffers()),t.uploadCommonUniforms(y,T,s.toUnwrapped());const P=e=>{T.draw(t,b.TRIANGLES,l,e,c,Mt.disabled,A,o.id,n.layoutVertexBuffer,n.indexBuffer,n.segments,o.paint,t.transform.zoom,a,[n.layoutVertexBuffer2,n.patternVertexBuffer]);};if(g){const e=t.stencilModeForClipping(s).ref;0===e&&t.terrain&&y.clear({stencil:0});const i={func:b.EQUAL,mask:255};A.u_alpha_discard_threshold=.8,P(new Dt(i,e,255,b.KEEP,b.KEEP,b.INVERT)),A.u_alpha_discard_threshold=0,P(new Dt(i,e,255,b.KEEP,b.KEEP,b.KEEP));}else P(t.stencilModeForClipping(s));}g&&(t.resetStencilClippingMasks(),t.terrain&&y.clear({stencil:0}));},fill:function(t,i,o,r){const s=o.paint.get(\"fill-color\"),n=o.paint.get(\"fill-opacity\");if(0===n.constantOr(1))return;const a=o.paint.get(\"fill-emissive-strength\"),l=t.colorModeForDrapableLayerRenderPass(a),c=o.paint.get(\"fill-pattern\"),h=t.opaquePassEnabledForLayer()&&!c.constantOr(1)&&1===s.constantOr(e.aA.transparent).a&&1===n.constantOr(0)?\"opaque\":\"translucent\";if(t.renderPass===h){const e=t.depthModeForSublayer(1,\"opaque\"===t.renderPass?Ct.ReadWrite:Ct.ReadOnly);os(t,i,o,r,e,l,!1);}if(\"translucent\"===t.renderPass&&o.paint.get(\"fill-antialias\")){const e=t.depthModeForSublayer(o.getPaintProperty(\"fill-outline-color\")?2:0,Ct.ReadOnly);os(t,i,o,r,e,l,!0);}},\"fill-extrusion\":function(t,i,o,r){const s=o.paint.get(\"fill-extrusion-opacity\"),n=t.context,a=n.gl,l=t.terrain,c=l&&l.renderingToTexture;if(0===s)return;const h=t.conflationActive&&t.layerUsedInConflation(o,i.getSource());if(h&&function(e,t,i,o){for(const r of o){const o=t.getTile(r).getBucket(i);o&&(o.updateReplacement(r,e.replacementSource),o.uploadCentroid(e.context));}}(t,i,o,r),l||h)for(const e of r){const r=i.getTile(e).getBucket(o);r&&ns(t.context,i,e,r,o,l,h);}if(\"shadow\"===t.renderPass&&t.shadowRenderer){const n=t.shadowRenderer;if(l&&s<.65&&o._transitionablePaint._values[\"fill-extrusion-opacity\"].value.expression instanceof e.Z)return;const a=n.getShadowPassDepthMode(),c=n.getShadowPassColorMode();rs(t,i,o,r,a,Dt.disabled,c,h);}else if(\"translucent\"===t.renderPass){const u=!o.paint.get(\"fill-extrusion-pattern\").constantOr(1),d=o.paint.get(\"fill-extrusion-color\").constantOr(e.aA.white);if(!c&&0!==d.a){const e=new Ct(t.context.gl.LEQUAL,Ct.ReadWrite,t.depthRangeFor3D);1===s&&u?rs(t,i,o,r,e,Dt.disabled,At.unblended,h):(rs(t,i,o,r,e,Dt.disabled,At.disabled,h),rs(t,i,o,r,e,t.stencilModeFor3D(),t.colorModeForRenderPass(),h),t.resetStencilClippingMasks());}if(t.style.enable3dLights()&&u&&(!l&&\"globe\"!==t.transform.projection.name||c)){const s=o.paint.get(\"fill-extrusion-opacity\"),u=o.paint.get(\"fill-extrusion-ambient-occlusion-intensity\"),d=o.paint.get(\"fill-extrusion-ambient-occlusion-ground-radius\"),_=o.paint.get(\"fill-extrusion-flood-light-intensity\"),p=o.paint.get(\"fill-extrusion-flood-light-color\").toArray01().slice(0,3),f=u>0&&d>0,m=_>0,g=(e,t,i)=>(1-i)*e+i*t,v=n=>{const l=t.depthModeForSublayer(1,Ct.ReadOnly,a.LEQUAL,!0),c=o.paint.get(n?\"fill-extrusion-ambient-occlusion-ground-attenuation\":\"fill-extrusion-flood-light-ground-attenuation\"),f=g(.1,3,c),m=t._showOverdrawInspector;if(!m){const c=new Dt({func:a.ALWAYS,mask:255},255,255,a.KEEP,a.KEEP,a.REPLACE),m=new At([a.ONE,a.ONE,a.ONE,a.ONE],e.aA.transparent,[!1,!1,!1,!0],a.MIN);ss(t,i,o,r,l,c,m,Mt.disabled,n,\"sdf\",s,u,d,_,p,f,h,!1);}{const c=m?Dt.disabled:new Dt({func:a.EQUAL,mask:255},255,255,a.KEEP,a.DECR,a.DECR),g=m?t.colorModeForRenderPass():new At([a.ONE_MINUS_DST_ALPHA,a.DST_ALPHA,a.ONE,a.ONE],e.aA.transparent,[!0,!0,!0,!0]);ss(t,i,o,r,l,c,g,Mt.disabled,n,\"color\",s,u,d,_,p,f,h,!1);}};if(c){const c=(n,l,c)=>{const f=t.depthModeForSublayer(1,Ct.ReadOnly,a.LEQUAL,!1),m=o.paint.get(n?\"fill-extrusion-ambient-occlusion-ground-attenuation\":\"fill-extrusion-flood-light-ground-attenuation\"),v=g(.1,3,m);{const c=new At([a.ONE,a.ONE,a.ONE,a.ONE],e.aA.transparent,[!1,!1,!1,!0]);ss(t,i,o,r,f,Dt.disabled,c,Mt.disabled,n,\"clear\",s,u,d,_,p,v,h,l);}{const c=new Dt({func:a.ALWAYS,mask:255},255,255,a.KEEP,a.KEEP,a.REPLACE),m=new At([a.ONE,a.ONE,a.ONE,a.ONE],e.aA.transparent,[!1,!1,!1,!0],a.MIN);ss(t,i,o,r,f,c,m,Mt.disabled,n,\"sdf\",s,u,d,_,p,v,h,l);}{const c=n?a.ZERO:a.ONE_MINUS_DST_ALPHA,m=new Dt({func:a.EQUAL,mask:255},255,255,a.KEEP,a.DECR,a.DECR),g=new At([c,a.DST_ALPHA,a.ONE_MINUS_DST_ALPHA,a.ZERO],e.aA.transparent,[!0,!0,!0,!0]);ss(t,i,o,r,f,m,g,Mt.disabled,n,\"color\",s,u,d,_,p,v,h,l);}{const m=new At([a.ONE,a.ONE,a.ONE,n?a.ZERO:a.ONE],e.aA.transparent,[!1,!1,!1,!0],n?a.FUNC_ADD:a.MAX);ss(t,i,o,r,f,Dt.disabled,m,Mt.disabled,n,\"clear\",s,u,d,_,p,v,h,l,c);}};if(f||m){let i;if(t.prepareDrawTile(),l){const t=l.drapeBufferSize[0],o=l.drapeBufferSize[1];i=l.framebufferCopyTexture,i&&(!i||i.size[0]===t&&i.size[1]===o)||(i&&i.destroy(),i=l.framebufferCopyTexture=new e.T(n,new e.h({width:t,height:o}),a.RGBA)),i.bind(a.LINEAR,a.CLAMP_TO_EDGE),a.copyTexImage2D(a.TEXTURE_2D,0,a.RGBA,0,0,t,o,0);}f&&c(!0,!1,i),m&&c(!1,!0,i);}}else f&&v(!0),m&&v(!1);}}},hillshade:function(e,t,i,o){if(\"offscreen\"!==e.renderPass&&\"translucent\"!==e.renderPass)return;if(e.style.disableElevatedTerrain)return;const r=e.context,s=e.terrain&&e.terrain.renderingToTexture,[n,a]=\"translucent\"!==e.renderPass||s?[{},o]:e.stencilConfigForOverlap(o);for(const o of a){const r=t.getTile(o);if(r.needsHillshadePrepare&&\"offscreen\"===e.renderPass)er(e,r,i);else if(\"translucent\"===e.renderPass){const t=e.depthModeForSublayer(0,Ct.ReadOnly),a=i.paint.get(\"hillshade-emissive-strength\"),l=e.colorModeForDrapableLayerRenderPass(a),c=s&&e.terrain?e.terrain.stencilModeForRTTOverlap(o):n[o.overscaledZ];Jo(e,o,r,i,t,c,l);}}r.viewport.set([0,0,e.width,e.height]),e.resetStencilClippingMasks();},raster:function(t,i,o,r,s,n){if(\"translucent\"!==t.renderPass)return;if(0===o.paint.get(\"raster-opacity\"))return;const a=\"globe\"===t.transform.projection.name,l=0!==o.paint.get(\"raster-elevation\"),c=l&&a;if(t.renderElevatedRasterBackface&&!c)return;const h=t.context,u=h.gl,d=i.getSource(),_=function(t,i,o,r){const s=i.paint.get(\"raster-color\"),n=\"raster-array\"===t.type,a=[],l=i.paint.get(\"raster-resampling\"),c=i.paint.get(\"raster-color-mix\");let h=i.paint.get(\"raster-color-range\");const u=[c[0],c[1],c[2],0],d=c[3];let _=\"nearest\"===l?r.NEAREST:r.LINEAR;if(n&&(a.push(\"RASTER_ARRAY\"),s||a.push(\"RASTER_COLOR\"),\"linear\"===l&&a.push(\"RASTER_ARRAY_LINEAR\"),_=r.NEAREST,!h&&t.rasterLayers)){const e=t.rasterLayers.find((({id:e})=>e===i.sourceLayer));e&&e.fields&&e.fields.range&&(h=e.fields.range);}if(h=h||[0,1],s){a.push(\"RASTER_COLOR\"),o.activeTexture.set(r.TEXTURE2),i.updateColorRamp(h);let t=i.colorRampTexture;t||(t=i.colorRampTexture=new e.T(o,i.colorRamp,r.RGBA)),t.bind(r.LINEAR,r.CLAMP_TO_EDGE);}return {mix:u,range:h,offset:d,defines:a,resampling:_}}(d,o,h,u);if(d instanceof e.as&&!r.length&&!a)return;const p=o.paint.get(\"raster-emissive-strength\"),f=t.colorModeForDrapableLayerRenderPass(p),m=t.terrain&&t.terrain.renderingToTexture,g=!t.options.moving,v=\"nearest\"===o.paint.get(\"raster-resampling\")?u.NEAREST:u.LINEAR;if(d instanceof e.as&&!r.length&&(d.onNorthPole||d.onSouthPole)){const e=l?t.stencilModeFor3D():Dt.disabled;return void ds(!!d.onNorthPole,null,t,i,o,p,_,Mt.disabled,e)}if(!r.length)return;const[x,y]=d instanceof e.as||m?[{},r]:t.stencilConfigForOverlap(r),b=y[y.length-1].overscaledZ;c&&_.defines.push(\"PROJECTION_GLOBE_VIEW\"),l&&_.defines.push(\"RENDER_CUTOFF\");const w=(r,s,y)=>{for(const w of r){const r=w.toUnwrapped(),T=i.getTile(w);if(m&&(!T||!T.hasData()))continue;h.activeTexture.set(u.TEXTURE0);const E=ps(T,d,o,_);if(!E||!E.texture)continue;const{texture:S,mix:C,offset:I,tileSize:D,buffer:R}=E;let A,P;m?(A=Ct.disabled,P=w.projMatrix):l?(A=new Ct(u.LEQUAL,Ct.ReadWrite,t.depthRangeFor3D),P=a?Float32Array.from(t.transform.expandedFarZProjMatrix):t.transform.calculateProjMatrix(r,g)):(A=t.depthModeForSublayer(w.overscaledZ-b,1===o.paint.get(\"raster-opacity\")?Ct.ReadWrite:Ct.ReadOnly,u.LESS),P=t.transform.calculateProjMatrix(r,g));const L=t.terrain&&m?t.terrain.stencilModeForRTTOverlap(w):x[w.overscaledZ],M=n?0:o.paint.get(\"raster-fade-duration\");T.registerFadeDuration(M);const z=i.findLoadedParent(w,0),O=hr(T,z,i,t.transform,M);let F,B;t.terrain&&t.terrain.prepareDrawTile(),h.activeTexture.set(u.TEXTURE0),S.bind(v,u.CLAMP_TO_EDGE),h.activeTexture.set(u.TEXTURE1),z?(z.texture&&z.texture.bind(v,u.CLAMP_TO_EDGE),F=Math.pow(2,z.tileID.overscaledZ-T.tileID.overscaledZ),B=[T.tileID.canonical.x*F%1,T.tileID.canonical.y*F%1]):S.bind(v,u.CLAMP_TO_EDGE),S.useMipmap&&h.extTextureFilterAnisotropic&&t.transform.pitch>20&&u.texParameterf(u.TEXTURE_2D,h.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,h.extTextureFilterAnisotropicMax);const k=t.transform;let N;const U=l?_s(k):[0,0,0,0];let G,j,V,Z,W,H=0;if(c&&d instanceof e.as&&d.coordinates.length>3)G=Float32Array.from(e.aW(e.cn(new e.bv(0,0,0)))),j=Float32Array.from(k.globeMatrix),V=Float32Array.from(e.cj(k)),Z=[e.a8(k.center.lng),e.ah(k.center.lat)],N=d.elevatedGlobePerspectiveTransform,W=d.elevatedGlobeGridMatrix||new Float32Array(9);else if(c){const t=e.ck(w.canonical);H=e.cl(t.getCenter().lat),G=Float32Array.from(e.aW(e.cn(w.canonical))),j=Float32Array.from(k.globeMatrix),V=Float32Array.from(e.cj(k)),Z=[e.a8(k.center.lng),e.ah(k.center.lat)],N=[0,0],W=Float32Array.from(e.cm(w.canonical,t,H,k.worldSize/k._pixelsPerMercatorPixel));}else N=d instanceof e.as?d.perspectiveTransform:[0,0],G=new Float32Array(16),j=new Float32Array(9),V=new Float32Array(16),Z=[0,0],W=new Float32Array(9);const q=zr(P,G,j,V,W,B||[0,0],e.W(t.transform.zoom),Z,U,F||1,O,o,N,l?o.paint.get(\"raster-elevation\"):0,2,C,I,_.range,D,R,p),Q=t.isTileAffectedByFog(w),$=t.getOrCreateProgram(\"raster\",{defines:_.defines,overrideFog:Q});if(t.uploadCommonUniforms(h,$,r),d instanceof e.as){const i=d.elevatedGlobeVertexBuffer,r=d.elevatedGlobeIndexBuffer;if(m||!a)d.boundsBuffer&&d.boundsSegments&&$.draw(t,u.TRIANGLES,A,Dt.disabled,f,Mt.disabled,q,o.id,d.boundsBuffer,t.quadTriangleIndexBuffer,d.boundsSegments);else if(i&&r){const n=k.zoom<=e.bJ?d.elevatedGlobeSegments:d.getSegmentsForLongitude(k.center.lng);n&&$.draw(t,u.TRIANGLES,A,Dt.disabled,f,s,q,o.id,i,r,n);}}else if(c){A=new Ct(u.LEQUAL,Ct.ReadOnly,t.depthRangeFor3D);const e=t.globeSharedBuffers;if(e){const[i,r,n]=e.getGridBuffers(H,!1);$.draw(t,u.TRIANGLES,A,y||L,t.colorModeForRenderPass(),s,q,o.id,i,r,n);}}else {const{tileBoundsBuffer:e,tileBoundsIndexBuffer:i,tileBoundsSegments:r}=t.getTileBoundsBuffers(T);$.draw(t,u.TRIANGLES,A,L,f,Mt.disabled,q,o.id,e,i,r);}}if(!(d instanceof e.as)&&c)for(const e of r){const r=e.canonical.y===(1<<e.canonical.z)-1;0===e.canonical.y&&ds(!0,e,t,i,o,p,_,s,y||Dt.disabled),r&&ds(!1,e,t,i,o,p,_,s===Mt.frontCW?Mt.backCW:Mt.frontCW,y||Dt.disabled);}};c?w(y,t.renderElevatedRasterBackface?Mt.backCW:Mt.frontCW,t.stencilModeFor3D()):w(y,Mt.disabled,void 0),t.resetStencilClippingMasks();},\"raster-particle\":function(t,i,o,r,s,n){\"offscreen\"===t.renderPass&&function(t,i,o,r){if(!r.length)return;const s=t.context,n=s.gl,a=i.getSource();if(!(a instanceof Pe))return;const l=Math.ceil(Math.sqrt(o.paint.get(\"raster-particle-count\")));let c=o.particleFramebuffer;c?c.width!==l&&(c.destroy(),c=o.particleFramebuffer=s.createFramebuffer(l,l,!0,null)):c=o.particleFramebuffer=s.createFramebuffer(l,l,!0,null);const h=[];for(const e of r){const t=i.getTile(e);if(!(t instanceof Ht))continue;const r=fs(t,a,o);if(!r)continue;const n=[t.tileSize,t.tileSize];let c=o.tileFramebuffer;c||(c=o.tileFramebuffer=s.createFramebuffer(n[0],n[1],!0,null));let u=t.rasterParticleState;u||(u=t.rasterParticleState=new Bt(s,e,n,l));const d=u.update(o.lastInvalidatedAt);u.particleTextureDimension!==l&&u.setParticleTextureDimension(e,l);const _=u.targetColorTexture;u.targetColorTexture=u.backgroundColorTexture,u.backgroundColorTexture=_;const p=u.particleTexture0;u.particleTexture0=u.particleTexture1,u.particleTexture1=p,h.push([e,r,u,d]);}if(0===h.length)return;const u=e.f.now(),d=o.previousDrawTimestamp?.001*(u-o.previousDrawTimestamp):.0167;if(o.previousDrawTimestamp=u,o.hasColorMap()){s.activeTexture.set(n.TEXTURE0+2);let t=o.colorRampTexture;t||(t=o.colorRampTexture=new e.T(s,o.colorRamp,n.RGBA)),t.bind(n.LINEAR,n.CLAMP_TO_EDGE);}s.bindFramebuffer.set(o.tileFramebuffer.framebuffer),function(t,i,o){const r=t.context,s=r.gl,n=i.tileFramebuffer;r.activeTexture.set(s.TEXTURE0);const a={u_texture:0,u_opacity:1.05*(c=i.paint.get(\"raster-particle-fade-opacity-factor\"))/(c+.05)},l=t.getOrCreateProgram(\"rasterParticleTexture\",{defines:[],overrideFog:!1});var c;for(const c of o){const[,,o,h]=c;n.colorAttachment.set(o.targetColorTexture.texture),r.viewport.set([0,0,n.width,n.height]),r.clear({color:e.aA.transparent}),h&&(o.backgroundColorTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE),l.draw(t,s.TRIANGLES,Ct.disabled,Dt.disabled,At.alphaBlended,Mt.disabled,a,i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments));}}(t,o,h),function(t,i,o,r){const s=t.context,n=s.gl,a=o.tileFramebuffer,l=\"globe\"===t.transform.projection.name,c=o.paint.get(\"raster-particle-max-speed\");for(const h of r){const[r,u,d]=h;s.activeTexture.set(n.TEXTURE0+0),u.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),a.colorAttachment.set(d.targetColorTexture.texture);const _=t.getOrCreateProgram(\"rasterParticleDraw\",{defines:u.defines,overrideFog:!1});s.activeTexture.set(n.TEXTURE0+1);const p=u.scalarData?[]:[0,1,2,3].map((t=>e.cN[t](r)));p.push(r);const f=r.canonical.x,m=r.canonical.y;for(const e of p){const s=i.getTile(l?e.wrapped():e);if(!s)continue;const a=s.rasterParticleState;if(!a)continue;const h=e.canonical.x+(1<<e.canonical.z)*(e.wrap-r.wrap),d=e.canonical.y;a.particleTexture0.bind(n.NEAREST,n.CLAMP_TO_EDGE);const p=Br(1,a.particleTexture0.size[0],[h-f,d-m],0,u.texture.size,2,c,u.textureOffset,u.scale,u.offset);_.draw(t,n.POINTS,Ct.disabled,Dt.disabled,At.alphaBlended,Mt.disabled,p,o.id,a.particleIndexBuffer,void 0,a.particleSegment);}}}(t,i,o,h),s.bindFramebuffer.set(o.particleFramebuffer.framebuffer),function(t,i,o,r){const s=t.context,n=s.gl,a=i.paint.get(\"raster-particle-max-speed\"),l=r*i.paint.get(\"raster-particle-speed-factor\")*.3,c=function(e){return Math.pow(e,6)}(.01+1*i.paint.get(\"raster-particle-reset-rate-factor\")),h=i.particleFramebuffer;s.viewport.set([0,0,h.width,h.height]);for(const r of o){const[,o,u]=r;s.activeTexture.set(n.TEXTURE0+0),o.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),s.activeTexture.set(n.TEXTURE0+1);const d=u.particleTexture0;d.bind(n.NEAREST,n.CLAMP_TO_EDGE);const _=kr(1,d.size[0],0,o.texture.size,a,l,c,o.textureOffset,o.scale,o.offset);h.colorAttachment.set(u.particleTexture1.texture),s.clear({color:e.aA.transparent}),t.getOrCreateProgram(\"rasterParticleUpdate\",{defines:o.defines}).draw(t,n.TRIANGLES,Ct.disabled,Dt.disabled,At.unblended,Mt.disabled,_,i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments);}}(t,o,h,d);}(t,i,o,r),\"translucent\"===t.renderPass&&(function(t,i,o,r,s){const n=t.context,a=n.gl,l=!t.options.moving,c=\"globe\"===t.transform.projection.name;if(!r.length)return;const[h,u]=t.stencilConfigForOverlap(r),d=[];c&&d.push(\"PROJECTION_GLOBE_VIEW\");const _=t.stencilModeFor3D();for(const r of u){const s=r.toUnwrapped(),u=i.getTile(r);if(!u.rasterParticleState)continue;const p=u.rasterParticleState,f=100;u.registerFadeDuration(f);const m=i.findLoadedParent(r,0),g=hr(u,m,i,t.transform,f);let v,x;t.terrain&&t.terrain.prepareDrawTile(),n.activeTexture.set(a.TEXTURE0),p.targetColorTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),n.activeTexture.set(a.TEXTURE1),m&&m.rasterParticleState?(m.rasterParticleState.targetColorTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),v=Math.pow(2,m.tileID.overscaledZ-u.tileID.overscaledZ),x=[u.tileID.canonical.x*v%1,u.tileID.canonical.y*v%1]):p.targetColorTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const y=c?Float32Array.from(t.transform.expandedFarZProjMatrix):t.transform.calculateProjMatrix(s,l),b=t.transform,w=ms(b),T=e.ck(r.canonical),E=e.cl(T.getCenter().lat);let S,C,I,D,R;c?(S=Float32Array.from(e.aW(e.cn(r.canonical))),C=Float32Array.from(b.globeMatrix),I=Float32Array.from(e.cj(b)),D=[e.a8(b.center.lng),e.ah(b.center.lat)],R=Float32Array.from(e.cm(r.canonical,T,E,b.worldSize/b._pixelsPerMercatorPixel))):(S=new Float32Array(16),C=new Float32Array(9),I=new Float32Array(16),D=[0,0],R=new Float32Array(9));const A=Fr(y,S,C,I,R,x||[0,0],e.W(t.transform.zoom),D,w,v||1,g,250),P=t.isTileAffectedByFog(r),L=t.getOrCreateProgram(\"rasterParticle\",{defines:d,overrideFog:P});if(t.uploadCommonUniforms(n,L,s),c){const e=new Ct(a.LEQUAL,Ct.ReadWrite,t.depthRangeFor3D),i=0,r=t.globeSharedBuffers;if(r){const[s,n,l]=r.getGridBuffers(E,0!==i);L.draw(t,a.TRIANGLES,e,_,At.alphaBlended,Mt.backCCW,A,o.id,s,n,l);}}else {const e=t.depthModeForSublayer(0,Ct.ReadOnly),i=h[r.overscaledZ],{tileBoundsBuffer:s,tileBoundsIndexBuffer:n,tileBoundsSegments:l}=t.getTileBoundsBuffers(u);L.draw(t,a.TRIANGLES,e,i,At.alphaBlended,Mt.disabled,A,o.id,s,n,l);}}t.resetStencilClippingMasks();}(t,i,o,r),t.style.map.triggerRepaint());},background:function(e,t,i,o){const r=i.paint.get(\"background-color\"),s=i.paint.get(\"background-opacity\"),n=i.paint.get(\"background-emissive-strength\");if(0===s)return;const a=e.context,l=a.gl,c=e.transform,h=c.tileSize,u=i.paint.get(\"background-pattern\");if(e.isPatternMissing(u,i.scope))return;const d=!u&&1===r.a&&1===s&&e.opaquePassEnabledForLayer()?\"opaque\":\"translucent\";if(e.renderPass!==d)return;const _=Dt.disabled,p=e.depthModeForSublayer(0,\"opaque\"===d?Ct.ReadWrite:Ct.ReadOnly),f=e.colorModeForDrapableLayerRenderPass(n),m=u?\"backgroundPattern\":\"background\";let g,v=o;v||(g=e.getBackgroundTiles(),v=Object.values(g).map((e=>e.tileID))),u&&(a.activeTexture.set(l.TEXTURE0),e.imageManager.bind(e.context,i.scope));for(const d of v){const v=e.isTileAffectedByFog(d),x=e.getOrCreateProgram(m,{overrideFog:v}),y=d.toUnwrapped(),b=o?d.projMatrix:e.transform.calculateProjMatrix(y);e.prepareDrawTile();const w=t?t.getTile(d):g?g[d.key]:new Nt(d,h,c.zoom,e),T=u?Zr(b,n,s,e,u,i.scope,{tileID:d,tileSize:h}):Vr(b,n,s,r);e.uploadCommonUniforms(a,x,y);const{tileBoundsBuffer:E,tileBoundsIndexBuffer:S,tileBoundsSegments:C}=e.getTileBoundsBuffers(w);x.draw(e,l.TRIANGLES,p,_,f,Mt.disabled,T,i.id,E,S,C);}},sky:function(t,i,o){const r=t._atmosphere?e.W(t.transform.zoom):1,s=o.paint.get(\"sky-opacity\")*r;if(0===s)return;const n=t.context,a=o.paint.get(\"sky-type\"),l=new Ct(n.gl.LEQUAL,Ct.ReadOnly,[0,1]),c=t.frameCounter/1e3%1;\"atmosphere\"===a?\"offscreen\"===t.renderPass?o.needsSkyboxCapture(t)&&(function(t,i,o,r){const s=t.context,n=s.gl;let a=i.skyboxFbo;if(!a){a=i.skyboxFbo=s.createFramebuffer(32,32,!0,null),i.skyboxGeometry=new Rs(s),i.skyboxTexture=s.gl.createTexture(),n.bindTexture(n.TEXTURE_CUBE_MAP,i.skyboxTexture),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MAG_FILTER,n.LINEAR);for(let e=0;e<6;++e)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,n.RGBA,32,32,0,n.RGBA,n.UNSIGNED_BYTE,null);}s.bindFramebuffer.set(a.framebuffer),s.viewport.set([0,0,32,32]);const l=i.getCenter(t,!0),c=t.getOrCreateProgram(\"skyboxCapture\"),h=new Float64Array(16);e.a9.identity(h),e.a9.rotateY(h,h,.5*-Math.PI),As(t,i,c,h,l,0),e.a9.identity(h),e.a9.rotateY(h,h,.5*Math.PI),As(t,i,c,h,l,1),e.a9.identity(h),e.a9.rotateX(h,h,.5*-Math.PI),As(t,i,c,h,l,2),e.a9.identity(h),e.a9.rotateX(h,h,.5*Math.PI),As(t,i,c,h,l,3),e.a9.identity(h),As(t,i,c,h,l,4),e.a9.identity(h),e.a9.rotateY(h,h,Math.PI),As(t,i,c,h,l,5),s.viewport.set([0,0,t.width,t.height]);}(t,o),o.markSkyboxValid(t)):\"sky\"===t.renderPass&&function(e,t,i,o,r){const s=e.context,n=s.gl,a=e.transform,l=e.getOrCreateProgram(\"skybox\");s.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_CUBE_MAP,t.skyboxTexture);const c=((e,t,i,o,r)=>({u_matrix:e,u_sun_direction:t,u_cubemap:0,u_opacity:o,u_temporal_offset:r}))(a.skyboxMatrix,t.getCenter(e,!1),0,o,r);e.uploadCommonUniforms(s,l),l.draw(e,n.TRIANGLES,i,Dt.disabled,e.colorModeForRenderPass(),Mt.backCW,c,\"skybox\",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment);}(t,o,l,s,c):\"gradient\"===a&&\"sky\"===t.renderPass&&function(t,i,o,r,s){const n=t.context,a=n.gl,l=t.transform,c=t.getOrCreateProgram(\"skyboxGradient\");i.skyboxGeometry||(i.skyboxGeometry=new Rs(n)),n.activeTexture.set(a.TEXTURE0);let h=i.colorRampTexture;h||(h=i.colorRampTexture=new e.T(n,i.colorRamp,a.RGBA)),h.bind(a.LINEAR,a.CLAMP_TO_EDGE);const u=((t,i,o,r,s)=>({u_matrix:t,u_color_ramp:0,u_center_direction:i,u_radius:e.bm(o),u_opacity:r,u_temporal_offset:s}))(l.skyboxMatrix,i.getCenter(t,!1),i.paint.get(\"sky-gradient-radius\"),r,s);t.uploadCommonUniforms(n,c),c.draw(t,a.TRIANGLES,o,Dt.disabled,t.colorModeForRenderPass(),Mt.backCW,u,\"skyboxGradient\",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment);}(t,o,l,s,c);},debug:function(t,i,o,r,s,n){for(let a=0;a<o.length;a++)if(s){const s=1,l=.8,c=new e.aA(r.r*l,r.g*l,r.b*l,1);ws(t,i,o[a],r,-s,-s,n),ws(t,i,o[a],r,-s,s,n),ws(t,i,o[a],r,s,s,n),ws(t,i,o[a],r,s,-s,n),ws(t,i,o[a],c,0,0,n);}else ws(t,i,o[a],r,0,0,n);},custom:function(t,i,o,r){const s=t.context,n=o.implementation;if(!t.transform.projection.unsupportedLayers||!t.transform.projection.unsupportedLayers.includes(\"custom\")||t.terrain&&(t.terrain.renderingToTexture||\"offscreen\"===t.renderPass)&&o.isDraped(i)){if(\"offscreen\"===t.renderPass){const i=n.prerender;if(i){if(t.setCustomLayerDefaults(),s.setColorMode(t.colorModeForRenderPass()),\"globe\"===t.transform.projection.name){const o=t.transform.pointMerc;i.call(n,s.gl,t.transform.customLayerMatrix(),t.transform.getProjection(),t.transform.globeToMercatorMatrix(),e.W(t.transform.zoom),[o.x,o.y],t.transform.pixelsPerMeterRatio);}else i.call(n,s.gl,t.transform.customLayerMatrix());s.setDirty(),t.setBaseState();}}else if(\"translucent\"===t.renderPass){if(t.terrain&&t.terrain.renderingToTexture){const i=n.renderToTile;if(i){const o=r[0].canonical,a=new e.O(o.x+r[0].wrap*(1<<o.z),o.y,o.z);s.setDepthMode(Ct.disabled),s.setStencilMode(Dt.disabled),s.setColorMode(t.colorModeForRenderPass()),t.setCustomLayerDefaults(),i.call(n,s.gl,a),s.setDirty(),t.setBaseState();}return}t.setCustomLayerDefaults(),s.setColorMode(t.colorModeForRenderPass()),s.setStencilMode(Dt.disabled);const i=\"3d\"===n.renderingMode?new Ct(t.context.gl.LEQUAL,Ct.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,Ct.ReadOnly);if(s.setDepthMode(i),\"globe\"===t.transform.projection.name){const i=t.transform.pointMerc;n.render(s.gl,t.transform.customLayerMatrix(),t.transform.getProjection(),t.transform.globeToMercatorMatrix(),e.W(t.transform.zoom),[i.x,i.y],t.transform.pixelsPerMeterRatio);}else n.render(s.gl,t.transform.customLayerMatrix());s.setDirty(),t.setBaseState(),s.bindFramebuffer.set(null);}}else e.w(\"Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.\");},model:function(t,i,o,r){if(\"opaque\"===t.renderPass)return;const s=o.paint.get(\"model-opacity\");if(0===s)return;const n=o.paint.get(\"model-cast-shadows\");if(\"shadow\"===t.renderPass){if(!n)return;if(t.terrain&&s<.65&&o._transitionablePaint._values[\"model-opacity\"].value.expression instanceof e.Z)return}const a=t.shadowRenderer,l=o.paint.get(\"model-receive-shadows\");a&&(a.useNormalOffset=!0,l||(a.enabled=!1));const c=()=>{a&&(a.useNormalOffset=!0,l||(a.enabled=!0));},h=i.getSource();if(\"light-beam\"===t.renderPass&&\"batched-model\"!==h.type)return;if(\"vector\"===h.type||\"geojson\"===h.type)return function(t,i,o,r,s){const n=t.transform;if(\"mercator\"!==n.projection.name)return void e.w(`Drawing 3D models for ${n.projection.name} projection is not yet implemented`);const a=n.getFreeCameraOptions().position;if(!t.modelManager)return;const l=t.modelManager;o.modelManager=l;const c=t.shadowRenderer;if(!o._unevaluatedLayout._values.hasOwnProperty(\"model-id\"))return;const h=o._unevaluatedLayout._values[\"model-id\"],u={...o.layout.get(\"model-id\").parameters};for(const d of r){const r=i.getTile(d).getBucket(o);if(!r||r.projection.name!==n.projection.name)continue;const _=r.getModelUris();_&&!r.modelsRequested&&(l.addModelsFromBucket(_,s),r.modelsRequested=!0);const p=Vs(d,n);u.zoom=p;const f=h.possiblyEvaluate(u);if(Gs(t,r,d),js.shadowUniformsInitialized=!1,js.useSingleShadowCascade=!!c&&0===c.getMaxCascadeForTile(d.toUnwrapped()),\"shadow\"===t.renderPass&&c){if(1===t.currentShadowCascade&&r.isInsideFirstShadowMapFrustum)continue;const i=n.calculatePosMatrix(d.toUnwrapped(),n.worldSize);if(js.tileMatrix.set(i),js.shadowTileMatrix=Float32Array.from(c.calculateShadowPassMatrixFromMatrix(i)),js.aabb.min.fill(0),js.aabb.max[0]=js.aabb.max[1]=e.Y,js.aabb.max[2]=0,Hs(r,js,t,o.scope))continue}const m=1<<d.canonical.z,g=[((a.x-d.wrap)*m-d.canonical.x)*e.Y,(a.y*m-d.canonical.y)*e.Y,a.z*m*e.Y];for(let e in r.instancesPerModel){const i=r.instancesPerModel[e];i.features.length>0&&(e=f.evaluate(i.features[0].feature,{}));const n=l.getModel(e,s);if(n&&n.uploaded)for(const e of n.nodes)Zs(t,o,e,i,g,d,js);}}}(t,i,o,r,\"vector\"===h.type?o.scope:\"\"),void c();if(!h.loaded())return;if(\"batched-model\"===h.type)return function(t,i,o,r){o.resetLayerRenderingStats(t);const s=t.context,n=t.transform,a=t.style.fog,l=t.shadowRenderer;if(\"mercator\"!==n.projection.name)return void e.w(`Drawing 3D landmark models for ${n.projection.name} projection is not yet implemented`);const c=t.transform.getFreeCameraOptions().position,h=e.Q.scale([],[c.x,c.y,c.z],t.transform.worldSize);e.Q.negate(h,h);const u=e.a9.identity([]),d=e.cZ(n.center.lat,n.zoom),_=e.a9.fromScaling([],[1,1,1/d]);e.a9.translate(u,u,h);const p=o.paint.get(\"model-opacity\"),f=new Ct(s.gl.LEQUAL,Ct.ReadWrite,t.depthRangeFor3D),m=new Ct(s.gl.LEQUAL,Ct.ReadOnly,t.depthRangeFor3D),g=new e.bV([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),v=\"shadow\"===t.renderPass,x=v&&l?l.getCurrentCascadeFrustum():n.getFrustum(n.scaleZoom(n.worldSize)),y=o.getLayerRenderingStats(),b=function(c,h){for(const d of r){const r=i.getTile(d).getBucket(o);if(!r||!r.uploaded)continue;let b=!1;l&&(b=0===l.getMaxCascadeForTile(d.toUnwrapped()));const w=n.calculatePosMatrix(d.toUnwrapped(),n.worldSize),T=r.modelTraits;for(const i of r.getNodesInfo()){if(i.hiddenByReplacement)continue;if(!i.node.meshes)continue;const r=i.evaluatedScale,d=i.node;let E=0;if(t.terrain&&d.elevation&&(E=d.elevation*t.terrain.exaggeration()),r[0]<=1&&r[1]<=1&&r[2]<=1&&0===(()=>{const t=i.getLocalBounds();return g.min=[...t.min],g.max=[...t.max],g.min[2]+=E,g.max[2]+=E,e.Q.transformMat4(g.min,g.min,w),e.Q.transformMat4(g.max,g.max,w),g})().intersects(x))continue;const S=[...w];e.a9.translate(S,S,[(d.anchor?d.anchor[0]:0)*(r[0]-1),(d.anchor?d.anchor[1]:0)*(r[1]-1),E]),e.Q.exactEquals(r,e.c$)||e.a9.scale(S,S,r);const C=e.a9.multiply([],S,d.matrix);let I=e.a9.multiply([],_,S);e.a9.multiply(I,u,I);const D=e.a9.invert([],I);e.a9.transpose(D,D),e.a9.scale(D,D,Ws),I=e.a9.multiply(I,I,d.matrix);const R=\"light-beam\"===t.renderPass,A=e.a9.multiply([],n.expandedFarZProjMatrix,C),P=e.a9.multiply([],n.expandedFarZProjMatrix,S),L=T&e.d1.HasMapboxMeshFeatures,M=L?0:i.evaluatedRMEA[0][2];for(let e=0;e<d.meshes.length;++e){const r=d.meshes[e],u=e===d.lightMeshIndex;let _=A;if(u){if(!R&&!t.terrain&&t.shadowRenderer){t.currentLayer<t.firstLightBeamLayer&&(t.firstLightBeamLayer=t.currentLayer);continue}_=P;}else if(R)continue;const g={defines:[]},x=[];if(Bs(g.defines,x,r,t),L||g.defines.push(\"DIFFUSE_SHADED\"),b&&g.defines.push(\"SHADOWS_SINGLE_CASCADE\"),y&&(v?y.numRenderedVerticesInShadowPass+=r.vertexArray.length:y.numRenderedVerticesInTransparentPass+=r.vertexArray.length),v){Us(r,C,t,o);continue}let w=null;if(a){const e=Fs(C,t.transform);if(w=new Float32Array(e),\"globe\"!==n.projection.name){const t=r.aabb.min,i=r.aabb.max,[o,s]=a.getOpacityForBounds(e,t[0],t[1],i[0],i[1]);g.overrideFog=o>=_e||s>=_e;}}const T=r.material;let E;T.occlusionTexture&&T.occlusionTexture.offsetScale&&(E=T.occlusionTexture.offsetScale,g.defines.push(\"OCCLUSION_TEXTURE_TRANSFORM\")),!v&&l&&(l.useNormalOffset=!!r.normalBuffer);const z=t.getOrCreateProgram(\"model\",g);!v&&l&&l.setupShadowsFromMatrix(S,z,l.useNormalOffset),t.uploadCommonUniforms(s,z,null,w);const O=T.pbrMetallicRoughness;O.metallicFactor=.9,O.roughnessFactor=.5;const F=Hr(new Float32Array(_),new Float32Array(I),new Float32Array(D),new Float32Array(d.matrix),t,p,O.baseColorFactor,T.emissiveFactor,O.metallicFactor,O.roughnessFactor,T,M,o,[0,0,0],E);z.draw(t,s.gl.TRIANGLES,h&&!u?f:m,Dt.disabled,c?u||p<1||i.hasTranslucentParts?At.alphaBlended:At.unblended:At.disabled,Mt.backCCW,F,o.id,r.vertexBuffer,r.indexBuffer,r.segments,o.paint,t.transform.zoom,void 0,x);}}}};((function(e,t,i,o){const r=e.terrain?e.terrain.exaggeration():0,s=e.transform.zoom;for(const n of o){const o=t.getTile(n).getBucket(i);o&&(e.conflationActive&&o.updateReplacement(n,e.replacementSource),o.evaluateScale(e,i),e.terrain&&r>0&&o.elevationUpdate(e.terrain,r,n,i.source),o.needsReEvaluation(e,s,i)&&o.evaluate(i));}}))(t,i,o,r),1===p?b(!0,!0):(b(!1,!0),b(!0,!1));}(t,i,o,r),void c();const u=h.getModels(),d=[],_=t.transform.getFreeCameraOptions().position,p=e.Q.scale([],[_.x,_.y,_.z],t.transform.worldSize);e.Q.negate(p,p);const f=[],m=[];let g=0;for(const i of u){const r=o.paint.get(\"model-rotation\").constantOr(null),s=o.paint.get(\"model-scale\").constantOr(null),n=o.paint.get(\"model-translation\").constantOr(null);i.computeModelMatrix(t,r,s,n,!0,!0,!1);const a=e.a9.identity([]),l=e.cZ(i.position.lat,t.transform.zoom),c=e.a9.fromScaling([],[1,1,1/l]);e.a9.translate(a,a,p),d.push({zScaleMatrix:c,negCameraPosMatrix:a});for(const e of i.nodes)Ns(t.transform,e,i.matrix,t.transform.expandedFarZProjMatrix,g,f,m);g++;}if(f.sort(((e,t)=>t.depth-e.depth)),\"shadow\"!==t.renderPass){if(1===s)for(const e of m)ks(e,t,o,d[e.modelIndex],Dt.disabled,t.colorModeForRenderPass());else {for(const e of m)ks(e,t,o,d[e.modelIndex],Dt.disabled,At.disabled);for(const e of m)ks(e,t,o,d[e.modelIndex],t.stencilModeFor3D(),t.colorModeForRenderPass());t.resetStencilClippingMasks();}for(const e of f)ks(e,t,o,d[e.modelIndex],Dt.disabled,t.colorModeForRenderPass());c();}else {for(const e of m)Us(e.mesh,e.nodeModelMatrix,t,o);for(const e of f)Us(e.mesh,e.nodeModelMatrix,t,o);c();}}},Xs={model:function(e,t,i){const o=t.getSource();if(!o.loaded())return;if(\"vector\"===o.type||\"geojson\"===o.type)return void(i.modelManager&&i.modelManager.upload(i,\"vector\"===o.type?e.scope:\"\"));if(\"batched-model\"===o.type)return;const r=o.getModels();for(const e of r)e.upload(i.context);},raster:function(e,t,i){const o=t.getSource();if(!(o instanceof Pe&&o.loaded()))return;const r=e.sourceLayer||o.rasterLayerIds&&o.rasterLayerIds[0];if(!r)return;const s=e.paint.get(\"raster-array-band\")||o.getInitialBand(r);if(null==s)return;const n=t.getIds().map((e=>t.getTileByID(e)));for(const e of n)e.updateNeeded(r,s)&&o.prepareTile(e,r,s);},\"raster-particle\":function(e,t,i){const o=t.getSource();if(!(o instanceof Pe&&o.loaded()))return;const r=e.sourceLayer||o.rasterLayerIds&&o.rasterLayerIds[0];if(!r)return;const s=e.paint.get(\"raster-particle-array-band\")||o.getInitialBand(r);if(null==s)return;const n=t.getIds().map((e=>t.getTileByID(e)));for(const e of n)e.updateNeeded(r,s)&&o.prepareTile(e,r,s);}};class Ys{constructor(t,i,o,r){this.context=new zt(t,i),this.transform=o,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=r,this._timeStamp=(new Date).getTime(),this._averageFPS=0,this._fpsHistory=[],this._debugParams={showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const s=[\"fill\",\"line\",\"symbol\",\"circle\",\"heatmap\",\"fill-extrusion\",\"raster\",\"raster-particle\",\"hillshade\",\"model\",\"background\",\"sky\"];for(const e of s)this._debugParams.enabledLayers[e]=!0;r.registerParameter(this._debugParams,[\"Terrain\"],\"showTerrainProxyTiles\",{},(()=>{this.style.map.triggerRepaint();})),r.registerParameter(this._debugParams,[\"FPS\"],\"fpsWindow\",{min:1,max:100,step:1}),r.registerBinding(this._debugParams,[\"FPS\"],\"continousRedraw\",{readonly:!0,label:\"continuous redraw\"}),r.registerBinding(this,[\"FPS\"],\"_averageFPS\",{readonly:!0,label:\"value\"}),r.registerBinding(this,[\"FPS\"],\"_averageFPS\",{readonly:!0,label:\"graph\",view:\"graph\",min:0,max:200});for(const e of s)r.registerParameter(this._debugParams.enabledLayers,[\"Debug\",\"Layers\"],e);this.setup(),this.numSublayers=Qt.maxUnderzooming+Qt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new e.d3,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new yo(this),this._wireframeDebugCache=new Qs,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0;}updateTerrain(e,t){const i=!!e&&!!e.terrain&&this.transform.projection.supportsTerrain;if(!(i||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new pr(this,e));const o=this._terrain;this.transform.elevation=i?o:null,o.update(e,this.transform,t),this.transform.elevation&&!o.enabled&&(this.transform.elevation=null);}_updateFog(e){const t=e.fog;if(!t||\"globe\"===this.transform.projection.name||t.getOpacity(this.transform.pitch)<1||t.properties.get(\"horizon-blend\")<.03)return void(this.transform.fogCullDistSq=null);const[i,o]=t.getFovAdjustedRange(this.transform._fov);if(i>o)return void(this.transform.fogCullDistSq=null);const r=i+.78*(o-i);this.transform.fogCullDistSq=r*r;}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,i){if(this.width=t*e.f.devicePixelRatio,this.height=i*e.f.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const e of this.style.order)this.style._mergedLayers[e].resize();}setup(){const t=this.context,i=new e.aQ;i.emplaceBack(0,0),i.emplaceBack(e.Y,0),i.emplaceBack(0,e.Y),i.emplaceBack(e.Y,e.Y),this.tileExtentBuffer=t.createVertexBuffer(i,e.aS.members),this.tileExtentSegments=e.aE.simpleSegment(0,0,4,2);const o=new e.aQ;o.emplaceBack(0,0),o.emplaceBack(e.Y,0),o.emplaceBack(0,e.Y),o.emplaceBack(e.Y,e.Y),this.debugBuffer=t.createVertexBuffer(o,e.aS.members),this.debugSegments=e.aE.simpleSegment(0,0,4,5);const r=new e.aQ;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(-1,1),r.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(r,e.aS.members),this.viewportSegments=e.aE.simpleSegment(0,0,4,2);const s=new e.ay;s.emplaceBack(0,0,0,0),s.emplaceBack(e.Y,0,e.Y,0),s.emplaceBack(0,e.Y,0,e.Y),s.emplaceBack(e.Y,e.Y,e.Y,e.Y),this.mercatorBoundsBuffer=t.createVertexBuffer(s,e.aU.members),this.mercatorBoundsSegments=e.aE.simpleSegment(0,0,4,2);const n=new e.az;n.emplaceBack(0,1,2),n.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(n);const a=new e.aR;for(const e of [0,1,3,2,0])a.emplaceBack(e);this.debugIndexBuffer=t.createIndexBuffer(a),this.emptyTexture=new e.T(t,new e.h({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA),this.identityMat=e.a9.create();const l=this.context.gl;this.stencilClearMode=new Dt({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.loadTimeStamps.push(performance.now());}getMercatorTileBoundsBuffers(){return {tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(e){return e._makeTileBoundsBuffers(this.context,this.transform.projection),e._tileBoundsBuffer?{tileBoundsBuffer:e._tileBoundsBuffer,tileBoundsIndexBuffer:e._tileBoundsIndexBuffer,tileBoundsSegments:e._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const e=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram(\"clippingMask\").draw(this,e.TRIANGLES,Ct.disabled,this.stencilClearMode,At.disabled,Mt.disabled,cr(this.identityMat),\"$clipping\",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments);}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={});}_renderTileClippingMasks(e,t,i){if(!t||this.currentStencilSource===t.id||!e.isTileClipped()||!i||0===i.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let e=!1;for(const t of i)if(void 0===this._tileClippingMaskIDs[t.key]){e=!0;break}if(!e)return}this.currentStencilSource=t.id;const o=this.context,r=o.gl;this.nextStencilID+i.length>256&&this.clearStencil(),o.setColorMode(At.disabled),o.setDepthMode(Ct.disabled);const s=this.getOrCreateProgram(\"clippingMask\");this._tileClippingMaskIDs={};for(const e of i){const i=t.getTile(e),o=this._tileClippingMaskIDs[e.key]=this.nextStencilID++,{tileBoundsBuffer:n,tileBoundsIndexBuffer:a,tileBoundsSegments:l}=this.getTileBoundsBuffers(i);s.draw(this,r.TRIANGLES,Ct.disabled,new Dt({func:r.ALWAYS,mask:0},o,255,r.KEEP,r.KEEP,r.REPLACE),At.disabled,Mt.disabled,cr(e.projMatrix),\"$clipping\",n,a,l);}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,t=this.context.gl;return new Dt({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(e);const t=this.context.gl;return new Dt({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}stencilConfigForOverlap(e){const t=this.context.gl,i=e.sort(((e,t)=>t.overscaledZ-e.overscaledZ)),o=i[i.length-1].overscaledZ,r=i[0].overscaledZ-o+1;if(r>1){this.currentStencilSource=void 0,this.nextStencilID+r>256&&this.clearStencil();const e={};for(let i=0;i<r;i++)e[i+o]=new Dt({func:t.GEQUAL,mask:255},i+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=r,[e,i]}return [{[o]:Dt.disabled},i]}colorModeForRenderPass(){const t=this.context.gl;if(this._showOverdrawInspector){const i=1/8;return new At([t.CONSTANT_COLOR,t.ONE,t.CONSTANT_COLOR,t.ONE],new e.aA(i,i,i,0),[!0,!0,!0,!0])}return \"opaque\"===this.renderPass?At.unblended:At.alphaBlended}colorModeForDrapableLayerRenderPass(t){const i=this.context.gl;return (()=>this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture)()&&\"translucent\"===this.renderPass?new At([i.ONE,i.ONE_MINUS_SRC_ALPHA,i.CONSTANT_ALPHA,i.ONE_MINUS_SRC_ALPHA],new e.aA(0,0,0,void 0===t?0:t),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(e,t,i,o=!1){if(!this.opaquePassEnabledForLayer()&&!o)return Ct.disabled;const r=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Ct(i||this.context.gl.LEQUAL,t,[r,r])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}updateAverageFPS(){const e=(new Date).getTime(),t=e-this._timeStamp;this._timeStamp=e,this._fpsHistory.push(0===t?0:1e3/t),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce(((e,t)=>e+t/this._fpsHistory.length),0));}render(t,i){this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=t.map.repaint,this.style=t,this.options=i;const o=this.style._mergedLayers,r=this.style.order.filter((e=>{const t=o[e];return !(t.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[t.type]})),s=r.map((e=>o[e])),n=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(e.f.now()),this.imageManager.beginFrame();let a=0,l=!1;for(const e in n){const t=n[e];t.used&&(t.prepare(this.context),t.getSource().usedInConflation&&++a);}for(const e of s)e.isHidden(this.transform.zoom)||this.prepareLayer(e);const c={},h={},u={},d={},_={};for(const e in n){const t=n[e];c[e]=t.getVisibleCoordinates(),h[e]=c[e].slice().reverse(),u[e]=t.getVisibleCoordinates(!0).reverse(),d[e]=t.getShadowCasterCoordinates(),_[e]=t.sortCoordinatesByDistance(c[e]);}const p=e=>{const t=this.style.getLayerSourceCache(e);return t&&t.used?t.getSource():null};if(a){const e=[];for(const t of s)this.layerUsedInConflation(t,p(t))&&e.push(t);if(e&&e.length>1){const t=[];for(const i of e){const e=this.style.getLayerSourceCache(i);e&&e.used&&e.getSource().usedInConflation&&t.push({layer:i.fqid,cache:e});}this.replacementSource.setSources(t),l=!0;}}l||this.replacementSource.clear(),this.conflationActive=l,this.minCutoffZoom=0,this.longestCutoffRange=0;for(const e of s){const t=e.cutoffRange();if(this.longestCutoffRange=Math.max(t,this.longestCutoffRange),t>0){const t=p(e);t&&(this.minCutoffZoom=Math.max(t.minzoom,this.minCutoffZoom)),e.minzoom&&(this.minCutoffZoom=Math.max(e.minzoom,this.minCutoffZoom));}}this.opaquePassCutoff=1/0;for(let e=0;e<s.length;e++)if(s[e].is3D()){this.opaquePassCutoff=e;break}const f=this.style&&this.style.fog;f?(this._fogVisible=0!==f.getOpacity(this.transform.pitch),this._fogVisible&&\"globe\"!==this.transform.projection.name&&(this._fogVisible=f.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(u),this.opaquePassCutoff=0);const m=this._shadowRenderer;if(m){m.updateShadowParameters(this.transform,this.style.directionalLight);for(const e in n)for(const t of c[e]){let e={min:0,max:0};this.terrain&&(e=this.terrain.getMinMaxForTile(t)||e),m.addShadowReceiver(t.toUnwrapped(),e.min,e.max);}}if(\"globe\"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new e.d4(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new Os(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),!e.d5(this.context.gl))return;this.renderPass=\"offscreen\";for(const e of s){const i=t.getLayerSourceCache(e);if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const o=i?h[i.id]:void 0;(\"custom\"===e.type||\"raster\"===e.type||\"raster-particle\"===e.type||e.isSky()||o&&o.length)&&this.renderLayer(this,i,e,o);}this.depthRangeFor3D=[0,1-(s.length+2)*this.numSublayers*this.depthEpsilon];const g=this.terrain;g&&(this.style.hasSymbolLayers()||this.style.hasCircleLayers())&&!this.transform.isOrthographic&&g.drawDepth(),this._shadowRenderer&&(this.renderPass=\"shadow\",this._shadowRenderer.drawShadowPass(this.style,d)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const v=\"globe\"===this.transform.projection.name||this.transform.isHorizonVisible(),x=(()=>{if(i.showOverdrawInspector)return e.aA.black;if(this.style.fog&&this.transform.projection.supportsFog&&!v){const t=this.style.fog.properties.get(\"color\").toArray01();return new e.aA(...t)}if(this.style.fog&&this.transform.projection.supportsFog&&v){const t=this.style.fog.properties.get(\"space-color\").toArray01();return new e.aA(...t)}return e.aA.transparent})();if(this.context.clear({color:x,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.showOverdrawInspector,this.renderPass=\"opaque\",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&v&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=r.length-1;this.currentLayer>=0;this.currentLayer--){const e=s[this.currentLayer],i=t.getLayerSourceCache(e);if(e.isSky())continue;const o=i?(e.is3D()?_:h)[i.id]:void 0;this._renderTileClippingMasks(e,i,o),this.renderLayer(this,i,e,o);}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&v&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass=\"sky\",(!this._atmosphere||e.W(this.transform.zoom)>0)&&(\"globe\"===this.transform.projection.name||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<r.length;this.currentLayer++){const e=s[this.currentLayer],i=t.getLayerSourceCache(e);e.isSky()&&this.renderLayer(this,i,e,i?h[i.id]:void 0);}function y(e,t){let i;return t&&(i=(\"symbol\"===e.type?u:e.is3D()?_:h)[t.id]),i}if(this.renderPass=\"translucent\",\"globe\"===this.transform.projection.name){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<r.length;){const e=s[this.currentLayer];if(\"raster\"===e.type){const i=t.getLayerSourceCache(e);this.renderLayer(this,i,e,y(e,i));}++this.currentLayer;}this.renderElevatedRasterBackface=!1;}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let b=0;for(m&&(b=m.getShadowCastingLayerCount());this.currentLayer<r.length;){const e=s[this.currentLayer],i=t.getLayerSourceCache(e);if(e.isSky())++this.currentLayer;else if(g&&this.style.isLayerDraped(e)){if(e.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=g.renderBatch(this.currentLayer);}else {if(this._renderTileClippingMasks(e,i,i?c[i.id]:void 0),this.renderLayer(this,i,e,y(e,i)),!g&&m&&b>0&&e.hasShadowPass()&&0==--b&&(m.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer)){const e=this.currentLayer;for(this.renderPass=\"light-beam\",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=e;this.currentLayer++){const e=s[this.currentLayer];if(!e.hasLightBeamPass())continue;const i=t.getLayerSourceCache(e);this.renderLayer(this,i,e,i?h[i.id]:void 0);}this.currentLayer=e,this.renderPass=\"translucent\";}++this.currentLayer;}}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let i=null;s.forEach((e=>{const o=t.getLayerSourceCache(e);o&&!e.isHidden(this.transform.zoom)&&o.getVisibleCoordinates().length&&(!i||i.getSource().maxzoom<o.getSource().maxzoom)&&(i=o);})),i&&this.options.showTileBoundaries&&$s.debug(this,i,i.getVisibleCoordinates(),e.aA.red,!1,this.options.showParseStatus);}this.terrain&&this._debugParams.showTerrainProxyTiles&&$s.debug(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new e.aA(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(e){const t=e.transform.padding;Ts(e,e.transform.height-(t.top||0),3,gs),Ts(e,t.bottom||0,3,vs),Es(e,t.left||0,3,xs),Es(e,e.transform.width-(t.right||0),3,ys);const i=e.transform.centerPoint;!function(e,t,i,o){Ss(e,t-1,i-10,2,20,o),Ss(e,t-10,i-1,20,2,o);}(e,i.x,e.transform.height-i.y,bs);}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveCanvasCopy()),l||(this.conflationActive=!1);}prepareLayer(e){this.gpuTimingStart(e);const{unsupportedLayers:t}=this.transform.projection,i=!t||!t.includes(e.type);if(Xs[e.type]&&(i||this.terrain&&\"custom\"===e.type)){const t=this.style.getLayerSourceCache(e);Xs[e.type](e,t,this);}this.gpuTimingEnd();}renderLayer(e,t,i,o){i.isHidden(this.transform.zoom)||(\"background\"===i.type||\"sky\"===i.type||\"custom\"===i.type||\"model\"===i.type||\"raster\"===i.type||\"raster-particle\"===i.type||o&&o.length)&&(this.id=i.id,this.gpuTimingStart(i),(!e.transform.projection.unsupportedLayers||!e.transform.projection.unsupportedLayers.includes(i.type)||e.terrain&&\"custom\"===i.type)&&$s[i.type](e,t,i,o,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd());}gpuTimingStart(e){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery,i=this.context.gl;let o=this.gpuTimers[e.id];o||(o=this.gpuTimers[e.id]={calls:0,cpuTime:0,query:i.createQuery()}),o.calls++,i.beginQuery(t.TIME_ELAPSED_EXT,o.query);}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const e=this.context.extTimerQuery,t=this.context.gl,i=t.createQuery();this.deferredRenderGpuTimeQueries.push(i),t.beginQuery(e.TIME_ELAPSED_EXT,i);}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT);}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT);}collectGpuTimers(){const e=this.gpuTimers;return this.gpuTimers={},e}collectDeferredRenderGpuQueries(){const e=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],e}queryGpuTimers(e){const t={};for(const i in e){const o=e[i],r=this.context.extTimerQuery,s=r.getQueryParameter(o.query,this.context.gl.QUERY_RESULT)/1e6;r.deleteQueryEXT(o.query),t[i]=s;}return t}queryGpuTimeDeferredRender(e){if(!this.options.gpuTimingDeferredRender)return 0;const t=this.context.extTimerQuery,i=this.context.gl;let o=0;for(const r of e)o+=t.getQueryParameter(r,i.QUERY_RESULT)/1e6,t.deleteQueryEXT(r);return o}translatePosMatrix(t,i,o,r,s){if(!o[0]&&!o[1])return t;const n=s?\"map\"===r?this.transform.angle:0:\"viewport\"===r?-this.transform.angle:0;if(n){const e=Math.sin(n),t=Math.cos(n);o=[o[0]*t-o[1]*e,o[0]*e+o[1]*t];}const a=[s?o[0]:e.a6(i,o[0],this.transform.zoom),s?o[1]:e.a6(i,o[1],this.transform.zoom),0],l=new Float32Array(16);return e.a9.translate(l,t,a),l}saveTileTexture(e){const t=e.size[0],i=this._tileTextures[t];i?i.push(e):this._tileTextures[t]=[e];}getTileTexture(e){const t=this._tileTextures[e];return t&&t.length>0?t.pop():null}isPatternMissing(e,t){return null===e||void 0!==e&&!this.imageManager.getPattern(e.toString(),t)}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture}linearFloatFilteringSupported(){return null!=this.context.extTextureFloatLinear}currentGlobalDefines(e,t,i){const o=void 0===i?this.terrain&&this.terrain.renderingToTexture:i,r=this.terrain&&0===this.terrain.exaggeration(),s=[];return this.style&&this.style.enable3dLights()&&(\"globeRaster\"===e||\"terrainRaster\"===e?(s.push(\"LIGHTING_3D_MODE\"),s.push(\"LIGHTING_3D_ALPHA_EMISSIVENESS\")):o||s.push(\"LIGHTING_3D_MODE\")),\"shadow\"===this.renderPass?this._shadowMapDebug||s.push(\"DEPTH_TEXTURE\"):this.shadowRenderer&&(this.shadowRenderer.useNormalOffset?s.push(\"RENDER_SHADOWS\",\"DEPTH_TEXTURE\",\"NORMAL_OFFSET\"):s.push(\"RENDER_SHADOWS\",\"DEPTH_TEXTURE\")),this.terrainRenderModeElevated()&&(s.push(\"TERRAIN\"),this.linearFloatFilteringSupported()&&s.push(\"TERRAIN_DEM_FLOAT_FORMAT\"),r&&s.push(\"ZERO_EXAGGERATION\")),\"globe\"===this.transform.projection.name&&s.push(\"GLOBE\"),!this._fogVisible||o||void 0!==t&&!t||s.push(\"FOG\",\"FOG_DITHERING\"),o&&s.push(\"RENDER_TO_TEXTURE\"),this._showOverdrawInspector&&s.push(\"OVERDRAW_INSPECTOR\"),s}getOrCreateProgram(e,t){this.cache=this.cache||{};const i=t&&t.defines||[],o=t&&t.config,r=this.currentGlobalDefines(e,t&&t.overrideFog,t&&t.overrideRtt).concat(i),s=vr.cacheKey(qo[e],e,r,o);return this.cache[s]||(this.cache[s]=new vr(this.context,e,qo[e],o,Qr[e],r)),this.cache[s]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault();}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD);}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement(\"canvas\"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new e.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA));}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy();}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile();}uploadCommonLightUniforms(t,i){if(this.style.enable3dLights()){const o=this.style.directionalLight,r=this.style.ambientLight;if(o&&r){const s=((t,i)=>{const o=t.properties.get(\"direction\"),r=t.properties.get(\"color\").toArray01(),s=t.properties.get(\"intensity\"),n=i.properties.get(\"color\").toArray01(),a=i.properties.get(\"intensity\"),l=[o.x,o.y,o.z],c=e.cs(n,a),h=e.cs(r,s);return {u_lighting_ambient_color:c,u_lighting_directional_dir:l,u_lighting_directional_color:h,u_ground_radiance:fr(l,h,c)}})(o,r);i.setLightsUniformValues(t,s);}}}uploadCommonUniforms(t,i,o,r,s){if(this.uploadCommonLightUniforms(t,i),this.terrain&&this.terrain.renderingToTexture)return;const n=this.style.fog;if(n){const s=n.getOpacity(this.transform.pitch),a=((t,i,o,r,s,n,a,l,c,h,u,d)=>{const _=t.transform,p=i.properties.get(\"color\").toArray01();p[3]=r;const f=t.frameCounter/1e3%1,[m,g]=i.properties.get(\"vertical-range\");return {u_fog_matrix:o?_.calculateFogTileMatrix(o):d||t.identityMat,u_fog_range:i.getFovAdjustedRange(_._fov),u_fog_color:p,u_fog_horizon_blend:i.properties.get(\"horizon-blend\"),u_fog_vertical_limit:[Math.min(m,g),g],u_fog_temporal_offset:f,u_frustum_tl:s,u_frustum_tr:n,u_frustum_br:a,u_frustum_bl:l,u_globe_pos:c,u_globe_radius:h,u_viewport:u,u_globe_transition:e.W(_.zoom),u_is_globe:+(\"globe\"===_.projection.name)}})(this,n,o,s,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*e.f.devicePixelRatio,this.transform.height*e.f.devicePixelRatio],r);i.setFogUniformValues(t,a);}s&&i.setCutoffUniformValues(t,s.uniformValues);}setTileLoadedFlag(e){this.tileLoaded=e;}saveCanvasCopy(){const e=this.canvasCopy();e&&(this.frameCopies.push(e),this.tileLoaded=!1);}canvasCopy(){const e=this.context.gl,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,0,0,e.drawingBufferWidth,e.drawingBufferHeight,0),t}getCanvasCopiesAndTimestamps(){return {canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return !1;const e=this.style&&this.style.fog;return !!e&&0!==e.getOpacity(this.transform.pitch)}getBackgroundTiles(){const e=this._backgroundTiles,t=this._backgroundTiles={},i=this.transform.coveringTiles({tileSize:512});for(const o of i)t[o.key]=e[o.key]||new Nt(o,512,this.transform.tileZoom,this);return t}clearBackgroundTiles(){this._backgroundTiles={};}layerUsedInConflation(e,t){return !(!e.is3D()||e.minzoom&&e.minzoom>this.transform.zoom||\"building\"!==e.sourceLayer&&(!t||\"batched-model\"!==t.type))}isTileAffectedByFog(e){if(!this.style||!this.style.fog)return !1;if(\"globe\"===this.transform.projection.name)return !0;let t=this._cachedTileFogOpacities[e.key];return t||(this._cachedTileFogOpacities[e.key]=t=this.style.fog.getOpacityForTile(e)),t[0]>=_e||t[1]>=_e}}function Js(e,t){let i=!1,o=null;const r=()=>{o=null,i&&(e(),o=setTimeout(r,t),i=!1);};return ()=>(i=!0,o||r(),o)}class Ks{constructor(t){this._hashName=t&&encodeURIComponent(t),e.a$([\"_getCurrentHash\",\"_onHashChange\",\"_updateHash\"],this),this._updateHash=Js(this._updateHashUnthrottled.bind(this),300);}addTo(e){return this._map=e,window.addEventListener(\"hashchange\",this._onHashChange,!1),e.on(\"moveend\",this._updateHash),this}remove(){return this._map?(this._map.off(\"moveend\",this._updateHash),window.removeEventListener(\"hashchange\",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const e=this._map;if(!e)return \"\";const t=en(e);if(this._hashName){const e=this._hashName;let i=!1;const o=location.hash.slice(1).split(\"&\").map((o=>{const r=o.split(\"=\")[0];return r===e?(i=!0,`${r}=${t}`):o})).filter((e=>e));return i||o.push(`${e}=${t}`),`#${o.join(\"&\")}`}return `#${t}`}_getCurrentHash(){const e=location.hash.replace(\"#\",\"\");if(this._hashName){let t;return e.split(\"&\").map((e=>e.split(\"=\"))).forEach((e=>{e[0]===this._hashName&&(t=e);})),(t&&t[1]||\"\").split(\"/\")}return e.split(\"/\")}_onHashChange(){const e=this._map;if(!e)return !1;const t=this._getCurrentHash();if(t.length>=3&&!t.some((e=>isNaN(e)))){const i=e.dragRotate.isEnabled()&&e.touchZoomRotate.isEnabled()?+(t[3]||0):e.getBearing();return e.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0}return !1}_updateHashUnthrottled(){history.replaceState(history.state,\"\",location.href.replace(/(#.+)?$/,this.getHashString()));}}function en(e,t){const i=e.getCenter(),o=Math.round(100*e.getZoom())/100,r=Math.ceil((o*Math.LN2+Math.log(512/360/.5))/Math.LN10),s=Math.pow(10,r),n=Math.round(i.lng*s)/s,a=Math.round(i.lat*s)/s,l=e.getBearing(),c=e.getPitch();let h=t?`/${n}/${a}/${o}`:`${o}/${a}/${n}`;return (l||c)&&(h+=\"/\"+Math.round(10*l)/10),c&&(h+=`/${Math.round(c)}`),h}const tn={linearity:.3,easing:e.d6(0,0,.3,1)},on=e.e({deceleration:2500,maxSpeed:1400},tn),rn=e.e({deceleration:20,maxSpeed:1400},tn),sn=e.e({deceleration:1e3,maxSpeed:360},tn),nn=e.e({deceleration:1e3,maxSpeed:90},tn);class an{constructor(e){this._map=e,this.clear();}clear(){this._inertiaBuffer=[];}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.f.now(),settings:t});}_drainInertiaBuffer(){const t=this._inertiaBuffer,i=e.f.now();for(;t.length>0&&i-t[0].time>160;)t.shift();}_onMoveEnd(t){if(this._map._prefersReducedMotion())return;if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:e}of this._inertiaBuffer)i.zoom+=e.zoomDelta||0,i.bearing+=e.bearingDelta||0,i.pitch+=e.pitchDelta||0,e.panDelta&&i.pan._add(e.panDelta),e.around&&(i.around=e.around),e.pinchAround&&(i.pinchAround=e.pinchAround);const o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,r={};if(i.pan.mag()){const s=cn(i.pan.mag(),o,e.e({},on,t||{}));r.offset=i.pan.mult(s.amount/i.pan.mag()),r.center=this._map.transform.center,ln(r,s);}if(i.zoom){const e=cn(i.zoom,o,rn);r.zoom=this._map.transform.zoom+e.amount,ln(r,e);}if(i.bearing){const t=cn(i.bearing,o,sn);r.bearing=this._map.transform.bearing+e.ad(t.amount,-179,179),ln(r,t);}if(i.pitch){const e=cn(i.pitch,o,nn);r.pitch=this._map.transform.pitch+e.amount,ln(r,e);}if(r.zoom||r.bearing){const e=void 0===i.pinchAround?i.around:i.pinchAround;r.around=e?this._map.unproject(e):this._map.getCenter();}return this.clear(),r.noMoveStart=!0,r}}function ln(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing);}function cn(t,i,o){const{maxSpeed:r,linearity:s,deceleration:n}=o,a=e.ad(t*s/(i/1e3),-r,r),l=Math.abs(a)/(n*s);return {easing:o.easing,duration:1e3*l,amount:a*(l/2)}}class hn extends e.b{preventDefault(){this._defaultPrevented=!0;}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,o,r={}){const s=p(i.getCanvasContainer(),o),n=i.unproject(s);super(t,e.e({point:s,lngLat:n,originalEvent:o},r)),this._defaultPrevented=!1,this.target=i;}}class un extends e.b{preventDefault(){this._defaultPrevented=!0;}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,o){const r=\"touchend\"===t?o.changedTouches:o.touches,s=f(i.getCanvasContainer(),r),n=s.map((e=>i.unproject(e))),a=s.reduce(((e,t,i,o)=>e.add(t.div(o.length))),new e.P(0,0));super(t,{points:s,point:a,lngLats:n,lngLat:i.unproject(a),originalEvent:o}),this._defaultPrevented=!1;}}class dn extends e.b{preventDefault(){this._defaultPrevented=!0;}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){super(e,{originalEvent:i}),this._defaultPrevented=!1;}}class _n{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance;}reset(){this._mousedownPos=void 0;}wheel(e){return this._firePreventable(new dn(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new hn(e.type,this._map,e))}mouseup(e){this._map.fire(new hn(e.type,this._map,e));}preclick(t){const i=e.e({},t);i.type=\"preclick\",this._map.fire(new hn(i.type,this._map,i));}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||(this.preclick(e),this._map.fire(new hn(e.type,this._map,e)));}dblclick(e){return this._firePreventable(new hn(e.type,this._map,e))}mouseover(e){this._map.fire(new hn(e.type,this._map,e));}mouseout(e){this._map.fire(new hn(e.type,this._map,e));}touchstart(e){return this._firePreventable(new un(e.type,this._map,e))}touchmove(e){this._map.fire(new un(e.type,this._map,e));}touchend(e){this._map.fire(new un(e.type,this._map,e));}touchcancel(e){this._map.fire(new un(e.type,this._map,e));}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return {}}isEnabled(){return !0}isActive(){return !1}enable(){}disable(){}}class pn{constructor(e){this._map=e;}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0;}mousemove(e){this._map.fire(new hn(e.type,this._map,e));}mousedown(){this._delayContextMenu=!0;}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new hn(\"contextmenu\",this._map,this._contextMenuEvent)),delete this._contextMenuEvent);}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new hn(e.type,this._map,e)),this._map.listens(\"contextmenu\")&&e.preventDefault();}isEnabled(){return !0}isActive(){return !1}enable(){}disable(){}}class fn{constructor(e,t){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1;}isEnabled(){return !!this._enabled}isActive(){return !!this._active}enable(){this.isEnabled()||(this._enabled=!0);}disable(){this.isEnabled()&&(this._enabled=!1);}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(h(),this._startPos=this._lastPos=t,this._active=!0);}mousemoveWindow(e,t){if(!this._active)return;const i=t,o=this._startPos,r=this._lastPos;if(!o||!r||r.equals(i)||!this._box&&i.dist(o)<this._clickTolerance)return;this._lastPos=i,this._box||(this._box=s(\"div\",\"mapboxgl-boxzoom\",this._container),this._container.classList.add(\"mapboxgl-crosshair\"),this._fireEvent(\"boxzoomstart\",e));const n=Math.min(o.x,i.x),a=Math.max(o.x,i.x),l=Math.min(o.y,i.y),c=Math.max(o.y,i.y);this._map._requestDomTask((()=>{this._box&&(this._box.style.transform=`translate(${n}px,${l}px)`,this._box.style.width=a-n+\"px\",this._box.style.height=c-l+\"px\");}));}mouseupWindow(t,i){if(!this._active)return;const o=this._startPos,r=i;if(o&&0===t.button){if(this.reset(),_(),o.x!==r.x||o.y!==r.y)return this._map.fire(new e.b(\"boxzoomend\",{originalEvent:t})),{cameraAnimation:e=>e.fitScreenCoordinates(o,r,this._map.getBearing(),{linear:!1})};this._fireEvent(\"boxzoomcancel\",t);}}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent(\"boxzoomcancel\",e));}blur(){this.reset();}reset(){this._active=!1,this._container.classList.remove(\"mapboxgl-crosshair\"),this._box&&(this._box.remove(),this._box=null),u(),delete this._startPos,delete this._lastPos;}_fireEvent(t,i){return this._map.fire(new e.b(t,{originalEvent:i}))}}function mn(e,t){const i={};for(let o=0;o<e.length;o++)i[e[o].identifier]=t[o];return i}class gn{constructor(e){this.reset(),this.numTouches=e.numTouches;}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1;}touchstart(t,i,o){(this.centroid||o.length>this.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=t.timeStamp),o.length===this.numTouches&&(this.centroid=function(t){const i=new e.P(0,0);for(const e of t)i._add(e);return i.div(t.length)}(i),this.touches=mn(o,i)));}touchmove(e,t,i){if(this.aborted||!this.centroid)return;const o=mn(i,t);for(const e in this.touches){const t=o[e];(!t||t.dist(this.touches[e])>30)&&(this.aborted=!0);}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class vn{constructor(e){this.singleTap=new gn(e),this.numTaps=e.numTaps,this.reset();}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset();}touchstart(e,t,i){this.singleTap.touchstart(e,t,i);}touchmove(e,t,i){this.singleTap.touchmove(e,t,i);}touchend(e,t,i){const o=this.singleTap.touchend(e,t,i);if(o){const t=e.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(o)<30;if(t&&i||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class xn{constructor(){this._zoomIn=new vn({numTouches:1,numTaps:2}),this._zoomOut=new vn({numTouches:2,numTaps:1}),this.reset();}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset();}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i);}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i);}touchend(e,t,i){const o=this._zoomIn.touchend(e,t,i),r=this._zoomOut.touchend(e,t,i);return o?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()+1,around:t.unproject(o)},{originalEvent:e})}):r?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()-1,around:t.unproject(r)},{originalEvent:e})}):void 0}touchcancel(){this.reset();}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}const yn={0:1,2:2};class bn{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1;}blur(){this.reset();}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0;}_correctButton(e,t){return !1}_move(e,t){return {}}mousedown(e,t){if(this._lastPoint)return;const i=m(e);this._correctButton(e,i)&&(this._lastPoint=t,this._eventButton=i);}mousemoveWindow(e,t){const i=this._lastPoint;if(i)if(e.preventDefault(),null!=this._eventButton&&function(e,t){const i=yn[t];return void 0===e.buttons||(e.buttons&i)!==i}(e,this._eventButton))this.reset();else if(this._moved||!(t.dist(i)<this._clickTolerance))return this._moved=!0,this._lastPoint=t,this._move(i,t)}mouseupWindow(e){this._lastPoint&&m(e)===this._eventButton&&(this._moved&&_(),this.reset());}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}class wn extends bn{mousedown(e,t){super.mousedown(e,t),this._lastPoint&&(this._active=!0);}_correctButton(e,t){return 0===t&&!e.ctrlKey}_move(e,t){return {around:t,panDelta:t.sub(e)}}}class Tn extends bn{_correctButton(e,t){return 0===t&&e.ctrlKey||2===t}_move(e,t){const i=.8*(t.x-e.x);if(i)return this._active=!0,{bearingDelta:i}}contextmenu(e){e.preventDefault();}}class En extends bn{_correctButton(e,t){return 0===t&&e.ctrlKey||2===t}_move(e,t){const i=-.5*(t.y-e.y);if(i)return this._active=!0,{pitchDelta:i}}contextmenu(e){e.preventDefault();}}class Sn{constructor(t,i){this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=i.clickTolerance||1,this.reset(),e.a$([\"_addTouchPanBlocker\",\"_showTouchPanBlockerAlert\"],this);}reset(){this._active=!1,this._touches={},this._sum=new e.P(0,0);}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(t,i,o){if(this._active&&!(o.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(1===o.length&&!e.d7())return void this._showTouchPanBlockerAlert();\"hidden\"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility=\"hidden\",clearTimeout(this._alertTimer));}return t.cancelable&&t.preventDefault(),this._calculateTransform(t,i,o)}}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&i.length<this._minTouches&&this.reset();}touchcancel(){this.reset();}_calculateTransform(t,i,o){o.length>0&&(this._active=!0);const r=mn(o,i),s=new e.P(0,0),n=new e.P(0,0);let a=0;for(const e in r){const t=r[e],i=this._touches[e];i&&(s._add(t),n._add(t.sub(i)),a++,r[e]=t);}if(this._touches=r,a<this._minTouches||!n.mag())return;const l=n.div(a);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:s.div(a),panDelta:l}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add(\"mapboxgl-touch-pan-blocker-override\",\"mapboxgl-scrollable-page\"));}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove(\"mapboxgl-touch-pan-blocker-override\",\"mapboxgl-scrollable-page\")),this.reset();}isEnabled(){return !!this._enabled}isActive(){return !!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=s(\"div\",\"mapboxgl-touch-pan-blocker\",this._map._container),this._alertContainer.textContent=this._map._getUIString(\"TouchPanBlocker.Message\"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`);}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility=\"visible\",this._alertContainer.classList.add(\"mapboxgl-touch-pan-blocker-show\"),this._alertContainer.setAttribute(\"role\",\"alert\"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout((()=>{this._alertContainer.classList.remove(\"mapboxgl-touch-pan-blocker-show\"),this._alertContainer.removeAttribute(\"role\");}),500);}}class Cn{constructor(){this.reset();}reset(){this._active=!1,this._firstTwoTouches=void 0;}_start(e){}_move(e,t,i){return {}}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]));}touchmove(e,t,i){const o=this._firstTwoTouches;if(!o)return;e.preventDefault();const[r,s]=o,n=In(i,t,r),a=In(i,t,s);if(!n||!a)return;const l=this._aroundCenter?null:n.add(a).div(2);return this._move([n,a],l,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;const[o,r]=this._firstTwoTouches,s=In(i,t,o),n=In(i,t,r);s&&n||(this._active&&_(),this.reset());}touchcancel(){this.reset();}enable(e){this._enabled=!0,this._aroundCenter=!!e&&\"center\"===e.around;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}function In(e,t,i){for(let o=0;o<e.length;o++)if(e[o].identifier===i)return t[o]}function Dn(e,t){return Math.log(e/t)/Math.LN2}class Rn extends Cn{reset(){super.reset(),this._distance=0,this._startDistance=0;}_start(e){this._startDistance=this._distance=e[0].dist(e[1]);}_move(e,t){const i=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Dn(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Dn(this._distance,i),pinchAround:t}}}function An(e,t){return 180*e.angleWith(t)/Math.PI}class Pn extends Cn{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0;}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1]);}_move(e,t){const i=this._vector;if(this._vector=e[0].sub(e[1]),i&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:An(this._vector,i),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const t=25/(Math.PI*this._minDiameter)*360,i=this._startVector;if(!i)return !1;const o=An(e,i);return Math.abs(o)<t}}function Ln(e){return Math.abs(e.y)>Math.abs(e.x)}class Mn extends Cn{constructor(e){super(),this._map=e;}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0;}_start(e){this._lastPoints=e,Ln(e[0].sub(e[1]))&&(this._valid=!1);}_move(t,i,o){const r=this._lastPoints;if(!r)return;const s=t[0].sub(r[0]),n=t[1].sub(r[1]);return this._map._cooperativeGestures&&!e.d7()&&o.touches.length<3||(this._valid=this.gestureBeginsVertically(s,n,o.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(s.y+n.y)/2*-.5})}gestureBeginsVertically(e,t,i){if(void 0!==this._valid)return this._valid;const o=e.mag()>=2,r=t.mag()>=2;if(!o&&!r)return;if(!o||!r)return null==this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const s=e.y>0==t.y>0;return Ln(e)&&Ln(t)&&s}}const zn={panStep:100,bearingStep:15,pitchStep:10};class On{constructor(){const e=zn;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1;}blur(){this.reset();}reset(){this._active=!1;}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,o=0,r=0,s=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),r=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),r=1);break;case 38:e.shiftKey?o=1:(e.preventDefault(),s=-1);break;case 40:e.shiftKey?o=-1:(e.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(i=0,o=0),{cameraAnimation:n=>{const a=n.getZoom();n.easeTo({duration:300,easeId:\"keyboardHandler\",easing:Fn,zoom:t?Math.round(a)+t*(e.shiftKey?2:1):a,bearing:n.getBearing()+i*this._bearingStep,pitch:n.getPitch()+o*this._pitchStep,offset:[-r*this._panStep,-s*this._panStep],center:n.getCenter()},{originalEvent:e});}}}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0;}enableRotation(){this._rotationDisabled=!1;}}function Fn(e){return e*(2-e)}const Bn=4.000244140625,kn=1/450;class Nn{constructor(t,i){this._map=t,this._el=t.getCanvasContainer(),this._handler=i,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=kn,e.a$([\"_onTimeout\",\"_addScrollZoomBlocker\",\"_showBlockerAlert\"],this);}setZoomRate(e){this._defaultZoomRate=e;}setWheelZoomRate(e){this._wheelZoomRate=e;}isEnabled(){return !!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return !!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&\"center\"===e.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker());}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()));}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||e.d7()))return void this._showBlockerAlert();\"hidden\"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility=\"hidden\",clearTimeout(this._alertTimer));}let i=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const o=e.f.now(),r=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,0!==i&&i%Bn==0?this._type=\"wheel\":0!==i&&Math.abs(i)<4?this._type=\"trackpad\":r>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(r*i)<200?\"trackpad\":\"wheel\",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),t.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=t,this._delta-=i,this._active||this._start(t)),t.preventDefault();}_onTimeout(e){this._type=\"wheel\",this._delta-=this._lastValue,this._active||this._start(e);}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const t=p(this._el,e);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:t,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame());}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._map.transform;\"wheel\"===this._type&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const i=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(0!==this._delta){const e=\"wheel\"===this._type&&Math.abs(this._delta)>Bn?this._wheelZoomRate:this._defaultZoomRate;let o=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==o&&(o=1/o);const r=i(),s=Math.pow(2,r),n=\"number\"==typeof this._targetZoom?t.zoomScale(this._targetZoom):s;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(n*o))),\"wheel\"===this._type&&(this._startZoom=r,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0;}const o=\"number\"==typeof this._targetZoom?this._targetZoom:i(),r=this._startZoom,s=this._easing;let n,a=!1;if(\"wheel\"===this._type&&r&&s){const t=Math.min((e.f.now()-this._lastWheelEventTime)/200,1),i=s(t);n=e.X(r,o,i),t<1?this._frameId||(this._frameId=!0):a=!0;}else n=o,a=!0;this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout;}),200));let l=n-i();return l*this._lastDelta<0&&(l=0),{noInertia:!0,needsRenderFrame:!a,zoomDelta:l,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let i=e.d8;if(this._prevEase){const t=this._prevEase,o=(e.f.now()-t.start)/t.duration,r=t.easing(o+.01)-t.easing(o),s=.27/Math.sqrt(r*r+1e-4)*.01,n=Math.sqrt(.0729-s*s);i=e.d6(s,n,.25,1);}return this._prevEase={start:e.f.now(),duration:t,easing:i},i}blur(){this.reset();}reset(){this._active=!1;}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=s(\"div\",\"mapboxgl-scroll-zoom-blocker\",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString(\"ScrollZoomBlocker.CmdMessage\"):this._map._getUIString(\"ScrollZoomBlocker.CtrlMessage\"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`);}_showBlockerAlert(){this._alertContainer.style.visibility=\"visible\",this._alertContainer.classList.add(\"mapboxgl-scroll-zoom-blocker-show\"),this._alertContainer.setAttribute(\"role\",\"alert\"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout((()=>{this._alertContainer.classList.remove(\"mapboxgl-scroll-zoom-blocker-show\"),this._alertContainer.removeAttribute(\"role\");}),200);}}class Un{constructor(e,t){this._clickZoom=e,this._tapZoom=t;}enable(){this._clickZoom.enable(),this._tapZoom.enable();}disable(){this._clickZoom.disable(),this._tapZoom.disable();}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Gn{constructor(){this.reset();}reset(){this._active=!1;}blur(){this.reset();}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:i.getZoom()+(e.shiftKey?-1:1),around:i.unproject(t)},{originalEvent:e});}}}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}class jn{constructor(){this._tap=new vn({numTouches:1,numTaps:1}),this.reset();}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset();}touchstart(e,t,i){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=t[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(e,t,i));}touchmove(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const o=t[0],r=o.y-this._swipePoint.y;return this._swipePoint=o,e.preventDefault(),this._active=!0,{zoomDelta:r/128}}}else this._tap.touchmove(e,t,i);}touchend(e,t,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(e,t,i)&&(this._tapTime=e.timeStamp);}touchcancel(){this.reset();}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}class Vn{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i;}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add(\"mapboxgl-touch-drag-pan\");}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove(\"mapboxgl-touch-drag-pan\");}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Zn{constructor(e,t,i){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=t,this._mousePitch=i;}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable();}disable(){this._mouseRotate.disable(),this._mousePitch.disable();}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Wn{constructor(e,t,i,o){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=o,this._rotationDisabled=!1,this._enabled=!0;}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add(\"mapboxgl-touch-zoom-rotate\");}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove(\"mapboxgl-touch-zoom-rotate\");}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable();}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable();}}const Hn=e=>e.zoom||e.drag||e.pitch||e.rotate;class qn extends e.b{}class Qn{constructor(){this.constants=[1,1,.01],this.radius=0;}setup(t,i){const o=e.Q.sub([],i,t);this.radius=e.Q.length(o[2]<0?e.Q.div([],o,this.constants):[o[0],o[1],0]);}projectRay(t){e.Q.div(t,t,this.constants),e.Q.normalize(t,t),e.Q.mul(t,t,this.constants);const i=e.Q.scale([],t,this.radius);if(i[2]>0){const t=e.Q.scale([],[0,0,1],e.Q.dot(i,[0,0,1])),o=e.Q.scale([],e.Q.normalize([],[i[0],i[1],0]),this.radius),r=e.Q.add([],i,e.Q.scale([],e.Q.sub([],e.Q.add([],o,t),i),2));i[0]=r[0],i[1]=r[1];}return i}}function $n(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class Xn{constructor(t,i){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new an(t),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Qn,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(i),e.a$([\"handleEvent\",\"handleWindowEvent\"],this);const o=this._el;this._listeners=[[o,\"touchstart\",{passive:!0}],[o,\"touchmove\",{passive:!1}],[o,\"touchend\",void 0],[o,\"touchcancel\",void 0],[o,\"mousedown\",void 0],[o,\"mousemove\",void 0],[o,\"mouseup\",void 0],[document,\"mousemove\",{capture:!0}],[document,\"mouseup\",void 0],[o,\"mouseover\",void 0],[o,\"mouseout\",void 0],[o,\"dblclick\",void 0],[o,\"click\",void 0],[o,\"keydown\",{capture:!1}],[o,\"keyup\",void 0],[o,\"wheel\",{passive:!1}],[o,\"contextmenu\",void 0],[window,\"blur\",void 0]];for(const[e,t,i]of this._listeners){const o=e===document?this.handleWindowEvent:this.handleEvent;e.addEventListener(t,o,i);}}destroy(){for(const[e,t,i]of this._listeners){const o=e===document?this.handleWindowEvent:this.handleEvent;e.removeEventListener(t,o,i);}}_addDefaultHandlers(e){const t=this._map,i=t.getCanvasContainer();this._add(\"mapEvent\",new _n(t,e));const o=t.boxZoom=new fn(t,e);this._add(\"boxZoom\",o);const r=new xn,s=new Gn;t.doubleClickZoom=new Un(s,r),this._add(\"tapZoom\",r),this._add(\"clickZoom\",s);const n=new jn;this._add(\"tapDragZoom\",n);const a=t.touchPitch=new Mn(t);this._add(\"touchPitch\",a);const l=new Tn(e),c=new En(e);t.dragRotate=new Zn(e,l,c),this._add(\"mouseRotate\",l,[\"mousePitch\"]),this._add(\"mousePitch\",c,[\"mouseRotate\"]);const h=new wn(e),u=new Sn(t,e);t.dragPan=new Vn(i,h,u),this._add(\"mousePan\",h),this._add(\"touchPan\",u,[\"touchZoom\",\"touchRotate\"]);const d=new Pn,_=new Rn;t.touchZoomRotate=new Wn(i,_,d,n),this._add(\"touchRotate\",d,[\"touchPan\",\"touchZoom\"]),this._add(\"touchZoom\",_,[\"touchPan\",\"touchRotate\"]),this._add(\"blockableMapEvent\",new pn(t));const p=t.scrollZoom=new Nn(t,this);this._add(\"scrollZoom\",p,[\"mousePan\"]);const f=t.keyboard=new On;this._add(\"keyboard\",f);for(const i of [\"boxZoom\",\"doubleClickZoom\",\"tapDragZoom\",\"touchPitch\",\"dragRotate\",\"dragPan\",\"touchZoomRotate\",\"scrollZoom\",\"keyboard\"])e.interactive&&e[i]&&t[i].enable(e[i]);}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t;}stop(e){if(!this._updatingCamera){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[],this._originalZoom=void 0;}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return !0;return !1}isZooming(){return !!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return !!this._eventsInProgress.rotate}isMoving(){return !!Hn(this._eventsInProgress)||this.isZooming()}_isDragging(){return !!this._eventsInProgress.drag}_blockedByActive(e,t,i){for(const o in e)if(o!==i&&(!t||t.indexOf(o)<0))return !0;return !1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`);}_getMapTouches(e){const t=[];for(const i of e)this._el.contains(i.target)&&t.push(i);return t}handleEvent(e,t){this._updatingCamera=!0;const i=\"renderFrame\"===e.type,o=i?void 0:e,r={needsRenderFrame:!1},s={},n={},a=e.touches?this._getMapTouches(e.touches):void 0,l=a?f(this._el,a):i?void 0:p(this._el,e);for(const{handlerName:i,handler:c,allowed:h}of this._handlers){if(!c.isEnabled())continue;let u;this._blockedByActive(n,h,i)?c.reset():c[t||e.type]&&(u=c[t||e.type](e,l,a),this.mergeHandlerResult(r,s,u,i,o),u&&u.needsRenderFrame&&this._triggerRenderFrame()),(u||c.isActive())&&(n[i]=c);}const c={};for(const e in this._previousActiveHandlers)n[e]||(c[e]=o);this._previousActiveHandlers=n,(Object.keys(c).length||$n(r))&&(this._changes.push([r,s,c]),this._triggerRenderFrame()),(Object.keys(n).length||$n(r))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:h}=r;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map));}mergeHandlerResult(t,i,o,r,s){if(!o)return;e.e(t,o);const n={handlerName:r,originalEvent:o.originalEvent||s};void 0!==o.zoomDelta&&(i.zoom=n),void 0!==o.panDelta&&(i.drag=n),void 0!==o.pitchDelta&&(i.pitch=n),void 0!==o.bearingDelta&&(i.rotate=n);}_applyChanges(){const t={},i={},o={};for(const[r,s,n]of this._changes)r.panDelta&&(t.panDelta=(t.panDelta||new e.P(0,0))._add(r.panDelta)),r.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+r.pitchDelta),void 0!==r.around&&(t.around=r.around),void 0!==r.aroundCoord&&(t.aroundCoord=r.aroundCoord),void 0!==r.pinchAround&&(t.pinchAround=r.pinchAround),r.noInertia&&(t.noInertia=r.noInertia),e.e(i,s),e.e(o,n);this._updateMapTransform(t,i,o),this._changes=[];}_updateMapTransform(t,i,o){const r=this._map,s=r.transform,n=e=>[e.x,e.y,e.z];if((e=>{const t=this._eventsInProgress.drag;return t&&!this._handlersById[t.handlerName].isActive()})()&&!$n(t)){const e=s.zoom;s.cameraElevationReference=\"sea\",null!=this._originalZoom&&s._orthographicProjectionAtLowPitch&&\"globe\"!==s.projection.name&&0===s.pitch?(s.cameraElevationReference=\"ground\",s.zoom=this._originalZoom):(s.recenterOnTerrain(),s.cameraElevationReference=\"ground\"),e!==s.zoom&&this._map._update(!0);}if(s._isCameraConstrained&&r._stop(!0),!$n(t))return void this._fireEvents(i,o,!0);let{panDelta:a,zoomDelta:l,bearingDelta:c,pitchDelta:h,around:u,aroundCoord:d,pinchAround:_}=t;s._isCameraConstrained&&(l>0&&(l=0),s._isCameraConstrained=!1),void 0!==_&&(u=_),(l||(e=>i[e]&&!this._eventsInProgress[e])(\"drag\"))&&u&&(this._dragOrigin=n(s.pointCoordinate3D(u)),this._originalZoom=s.zoom,this._trackingEllipsoid.setup(s._camera.position,this._dragOrigin)),s.cameraElevationReference=\"sea\",r._stop(!0),u=u||r.transform.centerPoint,c&&(s.bearing+=c),h&&(s.pitch+=h),s._updateCameraState();const p=[0,0,0];if(a)if(\"mercator\"===s.projection.name){const e=this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(u).dir),t=this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(u.sub(a)).dir);p[0]=t[0]-e[0],p[1]=t[1]-e[1];}else {const t=s.pointCoordinate(u);if(\"globe\"===s.projection.name){a=a.rotate(-s.angle);const i=s._pixelsPerMercatorPixel/s.worldSize;p[0]=-a.x*e.d9(e.ax(t.y))*i,p[1]=-a.y*e.d9(s.center.lat)*i;}else {const e=s.pointCoordinate(u.sub(a));t&&e&&(p[0]=e.x-t.x,p[1]=e.y-t.y);}}const f=s.zoom,m=[0,0,0];if(l){const t=n(d||s.pointCoordinate3D(u)),i={dir:e.Q.normalize([],e.Q.sub([],t,s._camera.position))};if(i.dir[2]<0){const o=s.zoomDeltaToMovement(t,l);e.Q.scale(m,i.dir,o);}}const g=e.Q.add(p,p,m);s._translateCameraConstrained(g),l&&Math.abs(s.zoom-f)>1e-4&&s.recenterOnTerrain(),s.cameraElevationReference=\"ground\",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(i,o,!0);}_fireEvents(t,i,o){const r=Hn(this._eventsInProgress),s=Hn(t),n={};for(const e in t){const{originalEvent:i}=t[e];this._eventsInProgress[e]||(n[`${e}start`]=i),this._eventsInProgress[e]=t[e];}!r&&s&&this._fireEvent(\"movestart\",s.originalEvent);for(const e in n)this._fireEvent(e,n[e]);s&&this._fireEvent(\"move\",s.originalEvent);for(const e in t){const{originalEvent:i}=t[e];this._fireEvent(e,i);}const a={};let l;for(const e in this._eventsInProgress){const{handlerName:t,originalEvent:o}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],l=i[t]||o,a[`${e}end`]=l);}for(const e in a)this._fireEvent(e,a[e]);const c=Hn(this._eventsInProgress);if(o&&(r||s)&&!c){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap;t?(i(t.bearing||this._map.getBearing())&&(t.bearing=0),this._map.easeTo(t,{originalEvent:l})):(this._map.fire(new e.b(\"moveend\",{originalEvent:l})),i(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1;}}_fireEvent(t,i){this._map.fire(new e.b(t,i?{originalEvent:i}:{}));}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((e=>{this._frameId=void 0,this.handleEvent(new qn(\"renderFrame\",{timeStamp:e})),this._applyChanges();}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame());}}const Yn=\"map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.\";class Jn extends e.E{constructor(t,i){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=i.bearingSnap,this._respectPrefersReducedMotion=!1!==i.respectPrefersReducedMotion,e.a$([\"_renderFrameCallback\"],this);}getCenter(){return new e.bq(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}panBy(t,i,o){return t=e.P.convert(t).mult(-1),this.panTo(this.transform.center,e.e({offset:t},i),o)}panTo(t,i,o){return this.easeTo(e.e({center:t},i),o)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(t,i,o){return this.easeTo(e.e({zoom:t},i),o)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(t,i,o){return this.easeTo(e.e({bearing:t},i),o)}resetNorth(t,i){return this.rotateTo(0,e.e({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo(e.e({bearing:0,pitch:0,duration:1e3},t),i),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}cameraForBounds(t,i){t=e.ag.convert(t);const o=i&&i.bearing||0,r=i&&i.pitch||0,s=t.getNorthWest(),n=t.getSouthEast();return this._cameraForBounds(this.transform,s,n,o,r,i)}_extendPadding(t){const i={top:0,right:0,bottom:0,left:0};return null==t?e.e({},i,this.transform.padding):\"number\"==typeof t?{top:t,bottom:t,right:t,left:t}:e.e({},i,t)}_extendCameraOptions(t){return (t=e.e({offset:[0,0],maxZoom:this.transform.maxZoom},t)).padding=this._extendPadding(t.padding),t}_minimumAABBFrustumDistance(e,t){const i=t.max[0]-t.min[0],o=t.max[1]-t.min[1];return i/o>e.aspect?i/(2*Math.tan(.5*e.fovX)*e.aspect):o/(2*Math.tan(.5*e.fovY)*e.aspect)}_cameraForBoundsOnGlobe(t,i,o,r,s,n){const a=t.clone(),l=this._extendCameraOptions(n);a.bearing=r,a.pitch=s;const c=e.bq.convert(i),h=e.bq.convert(o),u=.5*(c.lat+h.lat),d=.5*(c.lng+h.lng),_=e.da(u,d),p=e.Q.normalize([],_),f=e.Q.normalize([],e.Q.cross([],p,[0,1,0])),m=e.Q.cross([],f,p),g=[f[0],f[1],f[2],0,m[0],m[1],m[2],0,p[0],p[1],p[2],0,0,0,0,1],v=[_,e.da(c.lat,c.lng),e.da(h.lat,c.lng),e.da(h.lat,h.lng),e.da(c.lat,h.lng),e.da(u,c.lng),e.da(u,h.lng),e.da(c.lat,d),e.da(h.lat,d)];let x=e.bV.fromPoints(v.map((t=>[e.Q.dot(f,t),e.Q.dot(m,t),e.Q.dot(p,t)])));const y=e.Q.transformMat4([],x.center,g);0===e.Q.squaredLength(y)&&e.Q.set(y,0,0,1),e.Q.normalize(y,y),e.Q.scale(y,y,e.ae),a.center=e.db(y);const b=a.getWorldToCameraMatrix(),w=e.a9.invert(new Float64Array(16),b);x=e.bV.applyTransform(x,e.a9.multiply([],b,g));const T=this._extendAABB(x,a,l,r);if(!T)return void e.w(\"Map cannot fit within canvas with the given bounds, padding, and/or offset.\");x=T,e.Q.transformMat4(y,y,b);const E=.5*(x.max[2]-x.min[2]),S=this._minimumAABBFrustumDistance(a,x),C=e.Q.scale([],[0,0,1],E),I=e.Q.add(C,y,C),D=S+(0===a.pitch?0:e.Q.distance(y,I)),R=a.globeCenterInViewSpace,A=e.Q.sub([],y,[R[0],R[1],R[2]]);e.Q.normalize(A,A),e.Q.scale(A,A,D);const P=e.Q.add([],y,A);e.Q.transformMat4(P,P,w);const L=e.dc/e.ae,M=e.Q.length(P),z=e.bo(Math.max(M*L-e.dc,Number.EPSILON),0),O=Math.min(a.zoomFromMercatorZAdjusted(z),l.maxZoom);return O>.5*(e.bJ+e.bA)?(a.setProjection({name:\"mercator\"}),a.zoom=O,this._cameraForBounds(a,i,o,r,s,n)):{center:a.center,zoom:O,bearing:r,pitch:s}}_extendAABB(t,i,o,r){const s=.5*((o.padding.left||0)+(o.padding.right||0)),n=.5*((o.padding.top||0)+(o.padding.bottom||0)),a=n,l=s,c=s,h=n,u=i.width-(l+c),d=i.height-(a+h),_=e.Q.sub([],t.max,t.min),p=Math.min(u/_[0],d/_[1]),f=Math.min(i.scaleZoom(i.scale*p),o.maxZoom);if(isNaN(f))return null;const m=i.scale/i.zoomScale(f),g=new e.bV([t.min[0]-l*m,t.min[1]-h*m,t.min[2]],[t.max[0]+c*m,t.max[1]+a*m,t.max[2]]),v=(\"number\"==typeof o.offset.x&&\"number\"==typeof o.offset.y?new e.P(o.offset.x,o.offset.y):e.P.convert(o.offset)).rotate(-e.bm(r));return g.center[0]-=v.x*m,g.center[1]+=v.y*m,g}queryTerrainElevation(t,i){const o=this.transform.elevation;return o?(i=e.e({},{exaggerated:!0},i),o.getAtPoint(e.O.fromLngLat(t),null,i.exaggerated)):null}_cameraForBounds(t,i,o,r,s,n){if(\"globe\"===t.projection.name)return this._cameraForBoundsOnGlobe(t,i,o,r,s,n);const a=t.clone(),l=this._extendCameraOptions(n);a.bearing=r,a.pitch=s;const c=e.bq.convert(i),h=e.bq.convert(o),u=new e.bq(c.lng,h.lat),d=new e.bq(h.lng,c.lat),_=a.project(c),p=a.project(h),f=this.queryTerrainElevation(c),m=this.queryTerrainElevation(h),g=this.queryTerrainElevation(u),v=this.queryTerrainElevation(d),x=[[_.x,_.y,Math.min(f||0,m||0,g||0,v||0)],[p.x,p.y,Math.max(f||0,m||0,g||0,v||0)]];let y=e.bV.fromPoints(x);const b=a.getWorldToCameraMatrix(),w=e.a9.invert(new Float64Array(16),b);y=e.bV.applyTransform(y,b);const T=this._extendAABB(y,a,l,r);if(!T)return void e.w(\"Map cannot fit within canvas with the given bounds, padding, and/or offset.\");y=T;const E=.5*e.Q.sub([],y.max,y.min)[2],S=this._minimumAABBFrustumDistance(a,y),C=[0,0,1,0];e.aa.transformMat4(C,C,b),e.aa.normalize(C,C);const I=e.Q.scale([],C,S+E),D=e.Q.add([],y.center,I);e.Q.transformMat4(y.center,y.center,w),e.Q.transformMat4(D,D,w);const R=[y.center[0],y.center[1],D[2]*a.pixelsPerMeter];e.Q.scale(R,R,1/a.worldSize);const A=e.aw(R[0]),P=e.ax(R[1]),L=Math.min(a._zoomFromMercatorZ(R[2]),l.maxZoom),M=new e.bq(A,P);return a.mercatorFromTransition&&L<.5*(e.bJ+e.bA)?(a.setProjection({name:\"globe\"}),a.zoom=L,this._cameraForBounds(a,i,o,r,s,n)):{center:M,zoom:L,bearing:r,pitch:s}}fitBounds(e,t,i){const o=this.cameraForBounds(e,t);return this._fitInternal(o,t,i)}fitScreenCoordinates(t,i,o,r,s){const n=e.P.convert(t),a=e.P.convert(i),l=new e.P(Math.min(n.x,a.x),Math.min(n.y,a.y)),c=new e.P(Math.max(n.x,a.x),Math.max(n.y,a.y));if(\"mercator\"===this.transform.projection.name&&this.transform.anyCornerOffEdge(n,a))return this;const h=this.transform.pointLocation3D(l),u=this.transform.pointLocation3D(c),d=this.transform.pointLocation3D(new e.P(l.x,c.y)),_=this.transform.pointLocation3D(new e.P(c.x,l.y)),p=[Math.min(h.lng,u.lng,d.lng,_.lng),Math.min(h.lat,u.lat,d.lat,_.lat)],f=[Math.max(h.lng,u.lng,d.lng,_.lng),Math.max(h.lat,u.lat,d.lat,_.lat)],m=r&&r.pitch?r.pitch:this.getPitch(),g=this._cameraForBounds(this.transform,p,f,o,m,r);return this._fitInternal(g,r,s)}_fitInternal(t,i,o){return t?(i=e.e(t,i)).linear?this.easeTo(i,o):this.flyTo(i,o):this}jumpTo(t,i){this.stop();const o=t.preloadOnly?this.transform.clone():this.transform;let r=!1,s=!1,n=!1;return \"zoom\"in t&&o.zoom!==+t.zoom&&(r=!0,o.zoom=+t.zoom),void 0!==t.center&&(o.center=e.bq.convert(t.center)),\"bearing\"in t&&o.bearing!==+t.bearing&&(s=!0,o.bearing=+t.bearing),\"pitch\"in t&&o.pitch!==+t.pitch&&(n=!0,o.pitch=+t.pitch),null==t.padding||o.isPaddingEqual(t.padding)||(o.padding=t.padding),t.preloadOnly?(this._preloadTiles(o),this):(this.fire(new e.b(\"movestart\",i)).fire(new e.b(\"move\",i)),r&&this.fire(new e.b(\"zoomstart\",i)).fire(new e.b(\"zoom\",i)).fire(new e.b(\"zoomend\",i)),s&&this.fire(new e.b(\"rotatestart\",i)).fire(new e.b(\"rotate\",i)).fire(new e.b(\"rotateend\",i)),n&&this.fire(new e.b(\"pitchstart\",i)).fire(new e.b(\"pitch\",i)).fire(new e.b(\"pitchend\",i)),this.fire(new e.b(\"moveend\",i)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||e.w(Yn),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,i){const o=this.transform;if(!o.projection.supportsFreeCamera)return e.w(Yn),this;this.stop();const r=o.zoom,s=o.pitch,n=o.bearing;o.setFreeCameraOptions(t);const a=r!==o.zoom,l=s!==o.pitch,c=n!==o.bearing;return this.fire(new e.b(\"movestart\",i)).fire(new e.b(\"move\",i)),a&&this.fire(new e.b(\"zoomstart\",i)).fire(new e.b(\"zoom\",i)).fire(new e.b(\"zoomend\",i)),c&&this.fire(new e.b(\"rotatestart\",i)).fire(new e.b(\"rotate\",i)).fire(new e.b(\"rotateend\",i)),l&&this.fire(new e.b(\"pitchstart\",i)).fire(new e.b(\"pitch\",i)).fire(new e.b(\"pitchend\",i)),this.fire(new e.b(\"moveend\",i)),this}easeTo(t,i){this._stop(!1,t.easeId),(!1===(t=e.e({offset:[0,0],duration:500,easing:e.d8},t)).animate||this._prefersReducedMotion(t))&&(t.duration=0);const o=this.transform,r=this.getZoom(),s=this.getBearing(),n=this.getPitch(),a=this.getPadding(),l=\"zoom\"in t?+t.zoom:r,c=\"bearing\"in t?this._normalizeBearing(t.bearing,s):s,h=\"pitch\"in t?+t.pitch:n,u=this._extendPadding(t.padding),d=e.P.convert(t.offset);let _,p,f;if(\"globe\"===o.projection.name){const i=e.O.fromLngLat(o.center),r=d.rotate(-o.angle);i.x+=r.x/o.worldSize,i.y+=r.y/o.worldSize;const s=i.toLngLat(),n=e.bq.convert(t.center||s);this._normalizeCenter(n),_=o.centerPoint.add(r),p=new e.P(i.x,i.y).mult(o.worldSize),f=new e.P(e.a8(n.lng),e.ah(n.lat)).mult(o.worldSize).sub(p);}else {_=o.centerPoint.add(d);const i=o.pointLocation(_),r=e.bq.convert(t.center||i);this._normalizeCenter(r),p=o.project(i),f=o.project(r).sub(p);}const m=o.zoomScale(l-r);let g,v;t.around&&(g=e.bq.convert(t.around),v=o.locationPoint(g));const x=this._zooming||l!==r,y=this._rotating||s!==c,b=this._pitching||h!==n,w=!o.isPaddingEqual(u),T=o=>T=>{if(x&&(o.zoom=e.X(r,l,T)),y&&(o.bearing=e.X(s,c,T)),b&&(o.pitch=e.X(n,h,T)),w&&(o.interpolatePadding(a,u,T),_=o.centerPoint.add(d)),g)o.setLocationAtPoint(g,v);else {const e=o.zoomScale(o.zoom-r),t=l>r?Math.min(2,m):Math.max(.5,m),i=Math.pow(t,1-T),s=o.unproject(p.add(f.mult(T*i)).mult(e));o.setLocationAtPoint(o.renderWorldCopies?s.wrap():s,_);}return t.preloadOnly||this._fireMoveEvents(i),o};if(t.preloadOnly){const e=this._emulate(T,t.duration,o);return this._preloadTiles(e),this}const E={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=x,this._rotating=y,this._pitching=b,this._padding=w,this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,E),this._ease(T(o),(e=>{\"sea\"===o.cameraElevationReference&&o.recenterOnTerrain(),this._afterEase(i,e);}),t),this}_prepareEase(t,i,o={}){this._moving=!0,this.transform.cameraElevationReference=\"sea\",this.transform._orthographicProjectionAtLowPitch&&0===this.transform.pitch&&\"globe\"!==this.transform.projection.name&&(this.transform.cameraElevationReference=\"ground\"),i||o.moving||this.fire(new e.b(\"movestart\",t)),this._zooming&&!o.zooming&&this.fire(new e.b(\"zoomstart\",t)),this._rotating&&!o.rotating&&this.fire(new e.b(\"rotatestart\",t)),this._pitching&&!o.pitching&&this.fire(new e.b(\"pitchstart\",t));}_fireMoveEvents(t){this.fire(new e.b(\"move\",t)),this._zooming&&this.fire(new e.b(\"zoom\",t)),this._rotating&&this.fire(new e.b(\"rotate\",t)),this._pitching&&this.fire(new e.b(\"pitch\",t));}_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;this._easeId=void 0,this.transform.cameraElevationReference=\"ground\";const o=this._zooming,r=this._rotating,s=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,o&&this.fire(new e.b(\"zoomend\",t)),r&&this.fire(new e.b(\"rotateend\",t)),s&&this.fire(new e.b(\"pitchend\",t)),this.fire(new e.b(\"moveend\",t));}flyTo(t,i){if(this._prefersReducedMotion(t)){const o=e.af(t,[\"center\",\"zoom\",\"bearing\",\"pitch\",\"around\"]);return this.jumpTo(o,i)}this.stop(),t=e.e({offset:[0,0],speed:1.2,curve:1.42,easing:e.d8},t);const o=this.transform,r=this.getZoom(),s=this.getBearing(),n=this.getPitch(),a=this.getPadding(),l=\"zoom\"in t?e.ad(+t.zoom,o.minZoom,o.maxZoom):r,c=\"bearing\"in t?this._normalizeBearing(t.bearing,s):s,h=\"pitch\"in t?+t.pitch:n,u=this._extendPadding(t.padding),d=o.zoomScale(l-r),_=e.P.convert(t.offset);let p=o.centerPoint.add(_);const f=o.pointLocation(p),m=e.bq.convert(t.center||f);this._normalizeCenter(m);const g=o.project(f),v=o.project(m).sub(g);let x=t.curve;const y=Math.max(o.width,o.height),b=y/d,w=v.mag();if(\"minZoom\"in t){const i=e.ad(Math.min(t.minZoom,r,l),o.minZoom,o.maxZoom),s=y/o.zoomScale(i-r);x=Math.sqrt(s/w*2);}const T=x*x;function E(e){const t=(b*b-y*y+(e?-1:1)*T*T*w*w)/(2*(e?b:y)*T*w);return Math.log(Math.sqrt(t*t+1)-t)}function S(e){return (Math.exp(e)-Math.exp(-e))/2}function C(e){return (Math.exp(e)+Math.exp(-e))/2}const I=E(0);let D=function(e){return C(I)/C(I+x*e)},R=function(e){return y*((C(I)*(S(t=I+x*e)/C(t))-S(I))/T)/w;var t;},A=(E(1)-I)/x;if(Math.abs(w)<1e-6||!isFinite(A)){if(Math.abs(y-b)<1e-6)return this.easeTo(t,i);const e=b<y?-1:1;A=Math.abs(Math.log(b/y))/x,R=function(){return 0},D=function(t){return Math.exp(e*x*t)};}t.duration=\"duration\"in t?+t.duration:1e3*A/(\"screenSpeed\"in t?+t.screenSpeed/x:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0);const P=s!==c,L=h!==n,M=!o.isPaddingEqual(u),z=o=>d=>{const f=d*A,x=1/D(f);o.zoom=1===d?l:r+o.scaleZoom(x),P&&(o.bearing=e.X(s,c,d)),L&&(o.pitch=e.X(n,h,d)),M&&(o.interpolatePadding(a,u,d),p=o.centerPoint.add(_));const y=1===d?m:o.unproject(g.add(v.mult(R(f))).mult(x));return o.setLocationAtPoint(o.renderWorldCopies?y.wrap():y,p),o._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(i),o};if(t.preloadOnly){const e=this._emulate(z,t.duration,o);return this._preloadTiles(e),this}return this._zooming=!0,this._rotating=P,this._pitching=L,this._padding=M,this._prepareEase(i,!1),this._ease(z(o),(()=>this._afterEase(i)),t),this}isEasing(){return !!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(e){}_cancelRenderFrame(e){}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const e=this._onEaseEnd;this._onEaseEnd=void 0,e.call(this,t);}if(!e){const e=this.handlers;e&&e.stop(!1);}return this}_ease(t,i,o){!1===o.animate||0===o.duration?(t(1),i()):(this._easeStart=e.f.now(),this._easeOptions=o,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback));}_renderFrameCallback(){const t=Math.min((e.f.now()-this._easeStart)/this._easeOptions.duration,1),i=this._onEaseFrame;i&&i(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop();}_normalizeBearing(t,i){t=e.bk(t,-180,180);const o=Math.abs(t-i);return Math.abs(t-360-i)<o&&(t-=360),Math.abs(t+360-i)<o&&(t+=360),t}_normalizeCenter(e){const t=this.transform;if(t.maxBounds)return;if(\"globe\"!==t.projection.name&&!t.renderWorldCopies)return;const i=e.lng-t.center.lng;e.lng+=i>180?-360:i<-180?360:0;}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&e.f.prefersReducedMotion&&!(t&&t.essential)}_emulate(e,t,i){const o=Math.ceil(15*t/1e3),r=[],s=e(i.clone());for(let e=0;e<=o;e++){const t=s(e/o);r.push(t.clone());}return r}_preloadTiles(e,t){}}class Kn{constructor(t={}){this.options=t,e.a$([\"_toggleAttribution\",\"_updateEditLink\",\"_updateData\",\"_updateCompact\"],this);}getDefaultPosition(){return \"bottom-right\"}onAdd(e){const t=this.options&&this.options.compact;return this._map=e,this._container=s(\"div\",\"mapboxgl-ctrl mapboxgl-ctrl-attrib\"),this._compactButton=s(\"button\",\"mapboxgl-ctrl-attrib-button\",this._container),s(\"span\",\"mapboxgl-ctrl-icon\",this._compactButton).setAttribute(\"aria-hidden\",\"true\"),this._compactButton.type=\"button\",this._compactButton.addEventListener(\"click\",this._toggleAttribution),this._setElementTitle(this._compactButton,\"ToggleAttribution\"),this._innerContainer=s(\"div\",\"mapboxgl-ctrl-attrib-inner\",this._container),t&&this._container.classList.add(\"mapboxgl-compact\"),this._updateAttributions(),this._updateEditLink(),this._map.on(\"styledata\",this._updateData),this._map.on(\"sourcedata\",this._updateData),this._map.on(\"moveend\",this._updateEditLink),void 0===t&&(this._map.on(\"resize\",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off(\"styledata\",this._updateData),this._map.off(\"sourcedata\",this._updateData),this._map.off(\"moveend\",this._updateEditLink),this._map.off(\"resize\",this._updateCompact),this._map=void 0,this._attribHTML=void 0;}_setElementTitle(e,t){const i=this._map._getUIString(`AttributionControl.${t}`);e.removeAttribute(\"title\"),e.firstElementChild&&e.firstElementChild.setAttribute(\"title\",i);}_toggleAttribution(){this._container.classList.contains(\"mapboxgl-compact-show\")?(this._container.classList.remove(\"mapboxgl-compact-show\"),this._compactButton.setAttribute(\"aria-expanded\",\"false\")):(this._container.classList.add(\"mapboxgl-compact-show\"),this._compactButton.setAttribute(\"aria-expanded\",\"true\"));}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(\".mapbox-improve-map\"));const i=[{key:\"owner\",value:this.styleOwner},{key:\"id\",value:this.styleId},{key:\"access_token\",value:this._map._requestManager._customAccessToken||e.dd.ACCESS_TOKEN}];if(t){const o=i.reduce(((e,t,o)=>(t.value&&(e+=`${t.key}=${t.value}${o<i.length-1?\"&\":\"\"}`),e)),\"?\");t.href=`${e.dd.FEEDBACK_URL}/${o}#${en(this._map,!0)}`,t.rel=\"noopener nofollow\",this._setElementTitle(t,\"MapFeedback\");}}_updateData(e){!e||\"metadata\"!==e.sourceDataType&&\"visibility\"!==e.sourceDataType&&\"style\"!==e.dataType||(this._updateAttributions(),this._updateEditLink());}_updateAttributions(){if(!this._map.style)return;let e=[];if(this._map.style.stylesheet){const e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id;}const t=this._map.style._mergedSourceCaches;for(const i in t){const o=t[i];if(o.used){const t=o.getSource();t.attribution&&e.indexOf(t.attribution)<0&&e.push(t.attribution);}}e.sort(((e,t)=>e.length-t.length)),e=e.filter(((t,i)=>{for(let o=i+1;o<e.length;o++)if(e[o].indexOf(t)>=0)return !1;return !0})),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=[...this.options.customAttribution,...e]:e.unshift(this.options.customAttribution));const i=e.join(\" | \");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=i,this._container.classList.remove(\"mapboxgl-attrib-empty\")):this._container.classList.add(\"mapboxgl-attrib-empty\"),this._editLink=null);}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add(\"mapboxgl-compact\"):this._container.classList.remove(\"mapboxgl-compact\",\"mapboxgl-compact-show\");}}class ea{constructor(){e.a$([\"_updateLogo\",\"_updateCompact\"],this);}onAdd(e){this._map=e,this._container=s(\"div\",\"mapboxgl-ctrl\");const t=s(\"a\",\"mapboxgl-ctrl-logo\");return t.target=\"_blank\",t.rel=\"noopener nofollow\",t.href=\"https://www.mapbox.com/\",t.setAttribute(\"aria-label\",this._map._getUIString(\"LogoControl.Title\")),t.setAttribute(\"rel\",\"noopener nofollow\"),this._container.appendChild(t),this._container.style.display=\"none\",this._map.on(\"sourcedata\",this._updateLogo),this._updateLogo(),this._map.on(\"resize\",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off(\"sourcedata\",this._updateLogo),this._map.off(\"resize\",this._updateCompact);}getDefaultPosition(){return \"bottom-left\"}_updateLogo(e){e&&\"metadata\"!==e.sourceDataType||(this._container.style.display=this._logoRequired()?\"block\":\"none\");}_logoRequired(){if(!this._map.style)return !0;const e=this._map.style._sourceCaches;if(0===Object.entries(e).length)return !0;for(const t in e){const i=e[t].getSource();if(i.hasOwnProperty(\"mapbox_logo\")&&!i.mapbox_logo)return !1}return !0}_updateCompact(){const e=this._container.children;if(e.length){const t=e[0];this._map.getCanvasContainer().offsetWidth<250?t.classList.add(\"mapboxgl-compact\"):t.classList.remove(\"mapboxgl-compact\");}}}class ta{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1;}add(e){const t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){const t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(const t of i)if(t.id===e)return void(t.cancelled=!0)}run(e=0){const t=this._currentlyRunning=this._queue;this._queue=[];for(const i of t)if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1;}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[];}}function ia(t,i,o){if(t=new e.bq(t.lng,t.lat),i){const r=new e.bq(t.lng-360,t.lat),s=new e.bq(t.lng+360,t.lat),n=360*Math.ceil(Math.abs(t.lng-o.center.lng)/360),a=o.locationPoint(t).distSqr(i),l=i.x<0||i.y<0||i.x>o.width||i.y>o.height;o.locationPoint(r).distSqr(i)<a&&(l||Math.abs(r.lng-o.center.lng)<n)?t=r:o.locationPoint(s).distSqr(i)<a&&(l||Math.abs(s.lng-o.center.lng)<n)&&(t=s);}for(;Math.abs(t.lng-o.center.lng)>180;){const e=o.locationPoint(t);if(e.x>=0&&e.y>=0&&e.x<=o.width&&e.y<=o.height)break;t.lng>o.center.lng?t.lng-=360:t.lng+=360;}return t}const oa={center:\"translate(-50%,-50%)\",top:\"translate(-50%,0)\",\"top-left\":\"translate(0,0)\",\"top-right\":\"translate(-100%,0)\",bottom:\"translate(-50%,-100%)\",\"bottom-left\":\"translate(0,-100%)\",\"bottom-right\":\"translate(-100%,-100%)\",left:\"translate(0,-50%)\",right:\"translate(-100%,-50%)\"};class ra extends e.E{constructor(t,i){if(super(),(t instanceof HTMLElement||i)&&(t=e.e({element:t},i)),e.a$([\"_update\",\"_onMove\",\"_onUp\",\"_addDragHandler\",\"_onMapClick\",\"_onKeyPress\",\"_clearFadeTimer\"],this),this._anchor=t&&t.anchor||\"center\",this._color=t&&t.color||\"#3FB1CE\",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state=\"inactive\",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||\"auto\",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment||\"auto\",this._updateMoving=()=>this._update(!0),this._occludedOpacity=t&&t.occludedOpacity||.2,t&&t.element)this._element=t.element,this._offset=e.P.convert(t&&t.offset||[0,0]);else {this._defaultMarker=!0,this._element=s(\"div\");const i=41,o=27,r=n(\"svg\",{display:\"block\",height:i*this._scale+\"px\",width:o*this._scale+\"px\",viewBox:`0 0 ${o} ${i}`},this._element),a=n(\"radialGradient\",{id:\"shadowGradient\"},n(\"defs\",{},r));n(\"stop\",{offset:\"10%\",\"stop-opacity\":.4},a),n(\"stop\",{offset:\"100%\",\"stop-opacity\":.05},a),n(\"ellipse\",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:\"url(#shadowGradient)\"},r),n(\"path\",{fill:this._color,d:\"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z\"},r),n(\"path\",{opacity:.25,d:\"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z\"},r),n(\"circle\",{fill:\"white\",cx:13.5,cy:13.5,r:5.5},r),this._offset=e.P.convert(t&&t.offset||[0,-14]);}this._element.hasAttribute(\"aria-label\")||this._element.setAttribute(\"aria-label\",\"Map marker\"),this._element.hasAttribute(\"role\")||this._element.setAttribute(\"role\",\"img\"),this._element.classList.add(\"mapboxgl-marker\"),this._element.addEventListener(\"dragstart\",(e=>{e.preventDefault();})),this._element.addEventListener(\"mousedown\",(e=>{e.preventDefault();}));const o=this._element.classList;for(const e in oa)o.remove(`mapboxgl-marker-anchor-${e}`);o.add(`mapboxgl-marker-anchor-${this._anchor}`);const r=t&&t.className?t.className.trim().split(/\\s+/):[];o.add(...r),this._popup=null;}addTo(e){return e===this._map||(this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on(\"move\",this._updateMoving),e.on(\"moveend\",this._update),e.on(\"remove\",this._clearFadeTimer),e._addMarker(this),this.setDraggable(this._draggable),this._update(),e.on(\"click\",this._onMapClick)),this}remove(){const e=this._map;return e&&(e.off(\"click\",this._onMapClick),e.off(\"move\",this._updateMoving),e.off(\"moveend\",this._update),e.off(\"mousedown\",this._addDragHandler),e.off(\"touchstart\",this._addDragHandler),e.off(\"mouseup\",this._onUp),e.off(\"touchend\",this._onUp),e.off(\"mousemove\",this._onMove),e.off(\"touchmove\",this._onMove),e.off(\"remove\",this._clearFadeTimer),e._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.bq.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute(\"role\"),this._element.removeEventListener(\"keypress\",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute(\"tabindex\")),e){if(!(\"offset\"in e.options)){const t=38.1,i=13.5,o=Math.sqrt(Math.pow(i,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],\"top-left\":[0,0],\"top-right\":[0,0],bottom:[0,-t],\"bottom-left\":[o,-1*(t-i+o)],\"bottom-right\":[-o,-1*(t-i+o)],left:[i,-1*(t-i)],right:[-i,-1*(t-i)]}:this._offset;}this._popup=e,e._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute(\"role\",\"button\"),this._originalTabIndex=this._element.getAttribute(\"tabindex\"),this._originalTabIndex||this._element.setAttribute(\"tabindex\",\"0\"),this._element.addEventListener(\"keypress\",this._onKeyPress),this._element.setAttribute(\"aria-expanded\",\"false\");}return this}_onKeyPress(e){const t=e.code,i=e.charCode||e.keyCode;\"Space\"!==t&&\"Enter\"!==t&&32!==i&&13!==i||this.togglePopup();}_onMapClick(e){const t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup();}getPopup(){return this._popup}togglePopup(){const e=this._popup;return e?(e.isOpen()?(e.remove(),this._element.setAttribute(\"aria-expanded\",\"false\")):this._map&&(e.addTo(this._map),this._element.setAttribute(\"aria-expanded\",\"true\")),this):this}_behindTerrain(){const e=this._map,t=this._pos;if(!e||!t)return !1;const i=e.unproject(t),o=e.getFreeCameraOptions();if(!o.position)return !1;const r=o.position.toLngLat();return r.distanceTo(i)<.9*r.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const i=this._pos;if(!i||i.x<0||i.x>t.transform.width||i.y<0||i.y>t.transform.height)return void this._clearFadeTimer();const o=t.unproject(i);let r;t._showingGlobe()&&e.de(t.transform,this._lngLat)?r=0:(r=1-t._queryFogOpacity(o),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(r*=this._occludedOpacity)),this._element.style.opacity=`${r}`,this._element.style.pointerEvents=r>0?\"auto\":\"none\",this._popup&&this._popup._setOpacity(r),this._fadeTimer=null;}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null);}_updateDOM(){const e=this._pos;if(!e||!this._map)return;const t=this._offset.mult(this._scale);this._element.style.transform=`\\n            translate(${e.x}px,${e.y}px)\\n            ${oa[this._anchor]}\\n            ${this._calculateXYTransform()} ${this._calculateZTransform()}\\n            translate(${t.x}px,${t.y}px)\\n        `;}_calculateXYTransform(){const t=this._pos,i=this._map,o=this.getPitchAlignment();if(!i||!t||\"map\"!==o)return \"\";if(!i._showingGlobe()){const e=i.getPitch();return e?`rotateX(${e}deg)`:\"\"}const r=e.bI(e.df(i.transform,this._lngLat)),s=t.sub(e.dg(i.transform)),n=Math.abs(s.x)+Math.abs(s.y);if(0===n)return \"\";const a=r/n;return `rotateX(${-s.y*a}deg) rotateY(${s.x*a}deg)`}_calculateZTransform(){const t=this._pos,i=this._map;if(!i||!t)return \"\";let o=0;const r=this.getRotationAlignment();if(\"map\"===r)if(i._showingGlobe()){const t=i.project(new e.bq(this._lngLat.lng,this._lngLat.lat+.001)),r=i.project(new e.bq(this._lngLat.lng,this._lngLat.lat-.001)).sub(t);o=e.bI(Math.atan2(r.y,r.x))-90;}else o=-i.getBearing();else if(\"horizon\"===r){const r=e.S(4,6,i.getZoom()),s=e.dg(i.transform);s.y+=r*i.transform.height;const n=t.sub(s),a=e.bI(Math.atan2(n.y,n.x));o=(a>90?a-270:a+90)*(1-r);}return o+=this._rotation,o?`rotateZ(${o}deg)`:\"\"}_update(e){cancelAnimationFrame(this._updateFrameId);const t=this._map;t&&(t.transform.renderWorldCopies&&(this._lngLat=ia(this._lngLat,this._pos,t.transform)),this._pos=t.project(this._lngLat),!0===e?this._updateFrameId=requestAnimationFrame((()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM());})):this._pos=this._pos.round(),t._requestDomTask((()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(t._showingGlobe()||t.getTerrain()||t.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)));})));}getOffset(){return this._offset}setOffset(t){return this._offset=e.P.convert(t),this._update(),this}addClassName(e){return this._element.classList.add(e),this}removeClassName(e){return this._element.classList.remove(e),this}toggleClassName(e){return this._element.classList.toggle(e)}_onMove(t){const i=this._map;if(!i)return;const o=this._pointerdownPos,r=this._positionDelta;if(o&&r){if(!this._isDragging){const e=this._clickTolerance||i._clickTolerance;if(t.point.dist(o)<e)return;this._isDragging=!0;}this._pos=t.point.sub(r),this._lngLat=i.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents=\"none\",\"pending\"===this._state&&(this._state=\"active\",this.fire(new e.b(\"dragstart\"))),this.fire(new e.b(\"drag\"));}}_onUp(){this._element.style.pointerEvents=\"auto\",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const t=this._map;t&&(t.off(\"mousemove\",this._onMove),t.off(\"touchmove\",this._onMove)),\"active\"===this._state&&this.fire(new e.b(\"dragend\")),this._state=\"inactive\";}_addDragHandler(e){const t=this._map,i=this._pos;t&&i&&this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(i),this._pointerdownPos=e.point,this._state=\"pending\",t.on(\"mousemove\",this._onMove),t.on(\"touchmove\",this._onMove),t.once(\"mouseup\",this._onUp),t.once(\"touchend\",this._onUp));}setDraggable(e){this._draggable=!!e;const t=this._map;return t&&(e?(t.on(\"mousedown\",this._addDragHandler),t.on(\"touchstart\",this._addDragHandler)):(t.off(\"mousedown\",this._addDragHandler),t.off(\"touchstart\",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||\"auto\",this._update(),this}getRotationAlignment(){return \"auto\"===this._rotationAlignment||\"horizon\"===this._rotationAlignment&&this._map&&!this._map._showingGlobe()?\"viewport\":this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e||\"auto\",this._update(),this}getPitchAlignment(){return \"auto\"===this._pitchAlignment?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(e){return this._occludedOpacity=e||.2,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const sa={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:\"\",maxWidth:\"240px\"},na=[\"a[href]\",\"[tabindex]:not([tabindex='-1'])\",\"[contenteditable]:not([contenteditable='false'])\",\"button:not([disabled])\",\"input:not([disabled])\",\"select:not([disabled])\",\"textarea:not([disabled])\"].join(\", \");function aa(t=new e.P(0,0),i=\"bottom\"){if(\"number\"==typeof t){const o=Math.round(Math.sqrt(.5*Math.pow(t,2)));switch(i){case\"top\":return new e.P(0,t);case\"top-left\":return new e.P(o,o);case\"top-right\":return new e.P(-o,o);case\"bottom\":return new e.P(0,-t);case\"bottom-left\":return new e.P(o,-o);case\"bottom-right\":return new e.P(-o,-o);case\"left\":return new e.P(t,0);case\"right\":return new e.P(-t,0)}return new e.P(0,0)}return t instanceof e.P||Array.isArray(t)?e.P.convert(t):e.P.convert(t[i]||[0,0])}class la{constructor(e){this.jumpTo(e);}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const i=e.ch((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-i)+this._end*i}isEasing(e){return e>=this._startTime&&e<=this._endTime}jumpTo(e){this._startTime=-1/0,this._endTime=-1/0,this._start=e,this._end=e;}easeTo(e,t,i){this._start=this.getValue(t),this._end=e,this._startTime=t,this._endTime=t+i;}}class ca{registerParameter(e,t,i,o,r){}registerButton(e,t,i){}registerBinding(e,t,i,o){}refreshUI(){}}const ha={\"AttributionControl.ToggleAttribution\":\"Toggle attribution\",\"AttributionControl.MapFeedback\":\"Map feedback\",\"FullscreenControl.Enter\":\"Enter fullscreen\",\"FullscreenControl.Exit\":\"Exit fullscreen\",\"GeolocateControl.FindMyLocation\":\"Find my location\",\"GeolocateControl.LocationNotAvailable\":\"Location not available\",\"LogoControl.Title\":\"Mapbox logo\",\"Map.Title\":\"Map\",\"NavigationControl.ResetBearing\":\"Reset bearing to north\",\"NavigationControl.ZoomIn\":\"Zoom in\",\"NavigationControl.ZoomOut\":\"Zoom out\",\"ScrollZoomBlocker.CtrlMessage\":\"Use ctrl + scroll to zoom the map\",\"ScrollZoomBlocker.CmdMessage\":\"Use ⌘ + scroll to zoom the map\",\"TouchPanBlocker.Message\":\"Use two fingers to move the map\"},ua={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:\"sans-serif\",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1},da={showCompass:!0,showZoom:!0,visualizePitch:!1};class _a{constructor(t,i,o=!1){this._clickTolerance=10,this.element=i,this.mouseRotate=new Tn({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,o&&(this.mousePitch=new En({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),e.a$([\"mousedown\",\"mousemove\",\"mouseup\",\"touchstart\",\"touchmove\",\"touchend\",\"reset\"],this),i.addEventListener(\"mousedown\",this.mousedown),i.addEventListener(\"touchstart\",this.touchstart,{passive:!1}),i.addEventListener(\"touchmove\",this.touchmove),i.addEventListener(\"touchend\",this.touchend),i.addEventListener(\"touchcancel\",this.reset);}down(e,t){this.mouseRotate.mousedown(e,t),this.mousePitch&&this.mousePitch.mousedown(e,t),h();}move(e,t){const i=this.map,o=this.mouseRotate.mousemoveWindow(e,t),r=o&&o.bearingDelta;if(r&&i.setBearing(i.getBearing()+r),this.mousePitch){const o=this.mousePitch.mousemoveWindow(e,t),r=o&&o.pitchDelta;r&&i.setPitch(i.getPitch()+r);}}off(){const e=this.element;e.removeEventListener(\"mousedown\",this.mousedown),e.removeEventListener(\"touchstart\",this.touchstart,{passive:!1}),e.removeEventListener(\"touchmove\",this.touchmove),e.removeEventListener(\"touchend\",this.touchend),e.removeEventListener(\"touchcancel\",this.reset),this.offTemp();}offTemp(){u(),window.removeEventListener(\"mousemove\",this.mousemove),window.removeEventListener(\"mouseup\",this.mouseup);}mousedown(t){this.down(e.e({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),p(this.element,t)),window.addEventListener(\"mousemove\",this.mousemove),window.addEventListener(\"mouseup\",this.mouseup);}mousemove(e){this.move(e,p(this.element,e));}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp();}touchstart(e){1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=f(this.element,e.targetTouches)[0],this.down({type:\"mousedown\",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos));}touchmove(e){1!==e.targetTouches.length?this.reset():(this._lastPos=f(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos));}touchend(e){0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset();}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp();}}const pa={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},fa={maxWidth:100,unit:\"metric\"},ma={kilometer:\"km\",meter:\"m\",mile:\"mi\",foot:\"ft\",\"nautical-mile\":\"nm\"},ga={version:e.du,supported:i,setRTLTextPlugin:e.dw,getRTLTextPluginStatus:e.dx,Map:class extends Jn{constructor(t){const i=t;if(null!=(t=e.e({},ua,t)).minZoom&&null!=t.maxZoom&&t.minZoom>t.maxZoom)throw new Error(\"maxZoom must be greater than or equal to minZoom\");if(null!=t.minPitch&&null!=t.maxPitch&&t.minPitch>t.maxPitch)throw new Error(\"maxPitch must be greater than or equal to minPitch\");if(null!=t.minPitch&&t.minPitch<0)throw new Error(\"minPitch must be greater than or equal to 0\");if(null!=t.maxPitch&&t.maxPitch>85)throw new Error(\"maxPitch must be less than or equal to 85\");if(t.antialias&&e.dh(window)&&(t.antialias=!1,e.w(\"Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609\")),super(new po(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),t),this._repaint=!!t.repaint,this._interactive=t.interactive,this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._antialias=t.antialias,this._trackResize=t.trackResize,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=t.crossSourceCollisions,this._collectResourceTiming=t.collectResourceTiming,this._language=this._parseLanguage(t.language),this._worldview=t.worldview,this._renderTaskQueue=new ta,this._domRenderTaskQueue=new ta,this._controls=[],this._markers=[],this._popups=[],this._mapId=e.aF(),this._locale=e.e({},ha,t.locale),this._clickTolerance=t.clickTolerance,this._cooperativeGestures=t.cooperativeGestures,this._performanceMetricsCollection=t.performanceMetricsCollection,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new la(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._requestManager=new e.di(t.transformRequest,t.accessToken,t.testMode),this._silenceAuthErrors=!!t.testMode,this._contextCreateOptions=t.contextCreateOptions?{...t.contextCreateOptions}:{},\"string\"==typeof t.container){const e=document.getElementById(t.container);if(!e)throw new Error(`Container '${t.container.toString()}' not found.`);this._container=e;}else {if(!(t.container instanceof HTMLElement))throw new Error(\"Invalid type: 'container' must be a String or HTMLElement.\");this._container=t.container;}if(this._container.childNodes.length>0&&e.w(\"The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead.\"),t.maxBounds&&this.setMaxBounds(t.maxBounds),e.a$([\"_onWindowOnline\",\"_onWindowResize\",\"_onVisibilityChange\",\"_onMapScroll\",\"_contextLost\",\"_contextRestored\"],this),this._setupContainer(),this._tp=t.devtools?new ca(this):new ca,this._tp.registerParameter(this,[\"Debug\"],\"showOverdrawInspector\"),this._tp.registerParameter(this,[\"Debug\"],\"showTileBoundaries\"),this._tp.registerParameter(this,[\"Debug\"],\"showParseStatus\"),this._tp.registerParameter(this,[\"Debug\"],\"repaint\"),this._tp.registerParameter(this,[\"Debug\"],\"showTileAABBs\"),this._tp.registerParameter(this,[\"Debug\"],\"showPadding\"),this._tp.registerParameter(this,[\"Debug\"],\"showCollisionBoxes\",{noSave:!0}),this._tp.registerParameter(this.transform,[\"Debug\"],\"freezeTileCoverage\",{noSave:!0},(()=>{this._update();})),this._tp.registerParameter(this,[\"Debug\",\"Wireframe\"],\"showTerrainWireframe\"),this._tp.registerParameter(this,[\"Debug\",\"Wireframe\"],\"showLayers2DWireframe\"),this._tp.registerParameter(this,[\"Debug\",\"Wireframe\"],\"showLayers3DWireframe\"),this._setupPainter(),void 0===this.painter)throw new Error(\"Failed to initialize WebGL.\");if(this.on(\"move\",(()=>this._update(!1))),this.on(\"moveend\",(()=>this._update(!1))),this.on(\"zoom\",(()=>this._update(!0))),this._fullscreenchangeEvent=\"onfullscreenchange\"in document?\"fullscreenchange\":\"webkitfullscreenchange\",window.addEventListener(\"online\",this._onWindowOnline,!1),window.addEventListener(\"resize\",this._onWindowResize,!1),window.addEventListener(\"orientationchange\",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener(\"visibilitychange\",this._onVisibilityChange,!1),this.handlers=new Xn(this,t),this._localFontFamily=t.localFontFamily,this._localIdeographFontFamily=t.localIdeographFontFamily,(t.style||!t.testMode)&&this.setStyle(t.style||e.dd.DEFAULT_STYLE,{config:t.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),t.projection&&this.setProjection(t.projection),t.hash&&(this._hash=new Ks(\"string\"==typeof t.hash&&t.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){null==i.center&&null==i.zoom||(this.transform._unmodified=!1),this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch});const o=t.bounds;o&&(this.resize(),this.fitBounds(o,e.e({},t.fitBoundsOptions,{duration:0})));}this.resize(),t.attributionControl&&this.addControl(new Kn({customAttribution:t.customAttribution})),this._logoControl=new ea,this.addControl(this._logoControl,t.logoPosition),this.on(\"style.load\",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent();})),this.on(\"data\",(t=>{this._update(\"style\"===t.dataType),this.fire(new e.b(`${t.dataType}data`,t));})),this.on(\"dataloading\",(t=>{this.fire(new e.b(`${t.dataType}dataloading`,t));}));}_getMapId(){return this._mapId}addControl(t,i){if(void 0===i&&(i=t.getDefaultPosition?t.getDefaultPosition():\"top-right\"),!t||!t.onAdd)return this.fire(new e.a(new Error(\"Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.\")));const o=t.onAdd(this);this._controls.push(t);const r=this._controlPositions[i];return -1!==i.indexOf(\"bottom\")?r.insertBefore(o,r.firstChild):r.appendChild(o),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.a(new Error(\"Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.\")));const i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(t){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const i=!this._moving;return i&&this.fire(new e.b(\"movestart\",t)).fire(new e.b(\"move\",t)),this.fire(new e.b(\"resize\",t)),i&&this.fire(new e.b(\"moveend\",t)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(t){return this.transform.setMaxBounds(e.ag.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t?this.setZoom(t):this.fire(new e.b(\"zoomstart\")).fire(new e.b(\"zoom\")).fire(new e.b(\"zoomend\")),this;throw new Error(\"minZoom must be between -2 and the current maxZoom, inclusive\")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t?this.setZoom(t):this.fire(new e.b(\"zoomstart\")).fire(new e.b(\"zoom\")).fire(new e.b(\"zoomend\")),this;throw new Error(\"maxZoom must be greater than the current minZoom\")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error(\"minPitch must be greater than or equal to 0\");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t?this.setPitch(t):this.fire(new e.b(\"pitchstart\")).fire(new e.b(\"pitch\")).fire(new e.b(\"pitchend\")),this;throw new Error(\"minPitch must be between 0 and the current maxPitch, inclusive\")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=null==t?85:t)>85)throw new Error(\"maxPitch must be less than or equal to 85\");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t?this.setPitch(t):this.fire(new e.b(\"pitchstart\")).fire(new e.b(\"pitch\")).fire(new e.b(\"pitchend\")),this;throw new Error(\"maxPitch must be greater than or equal to minPitch\")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(e){return \"auto\"===e?navigator.language:Array.isArray(e)?0===e.length?void 0:e.map((e=>\"auto\"===e?navigator.language:e)):e}setLanguage(e){const t=this._parseLanguage(e);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const e of this._controls)e._setLanguage&&e._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(e){return this.style&&e!==this._worldview?(this._worldview=e,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:\"globe\",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return \"globe\"===this.transform.projection.name}setProjection(e){return this._lazyInitEmptyStyle(),e?\"string\"==typeof e&&(e={name:e}):e=null,this._useExplicitProjection=!!e,this._prioritizeAndUpdateProjection(e,this.style.projection)}_updateProjectionTransition(){if(\"globe\"!==this.getProjection().name)return;const t=this.transform,i=t.projection.name;let o;\"globe\"===i&&t.zoom>=e.bA?(t.setMercatorFromTransition(),o=!0):\"mercator\"===i&&t.zoom<e.bA&&(t.setProjection({name:\"globe\"}),o=!0),o&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate());}_prioritizeAndUpdateProjection(e,t){return this._updateProjection(e||t||{name:\"mercator\"})}_updateProjection(t){let i;return i=\"globe\"===t.name&&this.transform.zoom>=e.bA?this.transform.setMercatorFromTransition():this.transform.setProjection(t),this.style.applyProjectionUpdate(),i&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(t){return this.transform.locationPoint3D(e.bq.convert(t))}unproject(t){return this.transform.pointLocation3D(e.P.convert(t))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(e,t,i){if(\"mouseenter\"===e||\"mouseover\"===e){let o=!1;const r=r=>{const s=t.filter((e=>this.getLayer(e))),n=s.length?this.queryRenderedFeatures(r.point,{layers:s}):[];n.length?o||(o=!0,i.call(this,new hn(e,this,r.originalEvent,{features:n}))):o=!1;},s=()=>{o=!1;};return {layers:new Set(t),listener:i,delegates:{mousemove:r,mouseout:s}}}if(\"mouseleave\"===e||\"mouseout\"===e){let o=!1;const r=r=>{const s=t.filter((e=>this.getLayer(e)));(s.length?this.queryRenderedFeatures(r.point,{layers:s}):[]).length?o=!0:o&&(o=!1,i.call(this,new hn(e,this,r.originalEvent)));},s=t=>{o&&(o=!1,i.call(this,new hn(e,this,t.originalEvent)));};return {layers:new Set(t),listener:i,delegates:{mousemove:r,mouseout:s}}}{const o=e=>{const o=t.filter((e=>this.getLayer(e))),r=o.length?this.queryRenderedFeatures(e.point,{layers:o}):[];r.length&&(e.features=r,i.call(this,e),delete e.features);};return {layers:new Set(t),listener:i,delegates:{[e]:o}}}}on(e,t,i){if(void 0===i)return super.on(e,t);if(Array.isArray(t)||(t=[t]),t)for(const e of t)if(!this._isValidId(e))return this;const o=this._createDelegatedListener(e,t,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(o);for(const e in o.delegates)this.on(e,o.delegates[e]);return this}once(e,t,i){if(void 0===i)return super.once(e,t);if(Array.isArray(t)||(t=[t]),t)for(const e of t)if(!this._isValidId(e))return this;const o=this._createDelegatedListener(e,t,i);for(const e in o.delegates)this.once(e,o.delegates[e]);return this}off(e,t,i){if(void 0===i)return super.off(e,t);t=new Set(Array.isArray(t)?t:[t]);for(const e of t)if(!this._isValidId(e))return this;const o=(e,t)=>{if(e.size!==t.size)return !1;for(const i of e)if(!t.has(i))return !1;return !0},r=this._delegatedListeners?this._delegatedListeners[e]:void 0;return r&&(e=>{for(let r=0;r<e.length;r++){const s=e[r];if(s.listener===i&&o(s.layers,t)){for(const e in s.delegates)this.off(e,s.delegates[e]);return e.splice(r,1),this}}})(r),this}queryRenderedFeatures(t,i){if(!this.style)return [];if(void 0!==i||void 0===t||t instanceof e.P||Array.isArray(t)||(i=t,t=void 0),t=t||[[0,0],[this.transform.width,this.transform.height]],(i=i||{}).layers&&Array.isArray(i.layers))for(const e of i.layers)if(!this._isValidId(e))return [];return this.style.queryRenderedFeatures(t,i,this.transform)}querySourceFeatures(e,t){return this._isValidId(e)?this.style.querySourceFeatures(e,t):[]}isPointOnSurface(t){const{name:i}=this.transform.projection;return \"globe\"!==i&&\"mercator\"!==i&&e.w(`${i} projection does not support isPointOnSurface, this API may behave unexpectedly.`),this.transform.isPointOnSurface(e.P.convert(t))}setStyle(t,i){return i=e.e({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},i),this.style&&t&&!1!==i.diff&&i.localFontFamily===this._localFontFamily&&i.localIdeographFontFamily===this._localIdeographFontFamily&&!i.config?(this.style._diffStyle(t,((o,r)=>{o?(e.w(`Unable to perform style diff: ${String(o.message||o.error||o)}. Rebuilding the style from scratch.`),this._updateStyle(t,i)):r&&this._update(!0);}),(()=>{this._postStyleLoadEvent();})),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._localFontFamily=i.localFontFamily,this._updateStyle(t,i))}_getUIString(e){const t=this._locale[e];if(null==t)throw new Error(`Missing UI string '${e}'`);return t}_updateStyle(t,i){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),t){const o=e.e({},i);i&&i.config&&(o.initialConfig=i.config,delete o.config),this.style=new Ao(this,o).setEventedParent(this,{style:this.style}).load(t);}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new Ao(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty());}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(e.w(\"There is no style added to the map.\"),!1)}_isValidId(t){return null==t?(this.fire(new e.a(new Error(\"IDs can't be empty.\"))),!1):!e.c9(t)||(this.fire(new e.a(new Error(`IDs can't contain special symbols: \"${t}\".`))),!1)}addSource(e,t){return this._isValidId(e)?(this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)):this}isSourceLoaded(e){return !!this._isValidId(e)&&!!this.style&&this.style._isSourceCacheLoaded(e)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(e,t,i){this._lazyInitEmptyStyle(),this.style.addSourceType(e,t,i);}removeSource(e){return this._isValidId(e)?(this.style.removeSource(e),this._updateTerrain(),this._update(!0)):this}getSource(e){return this._isValidId(e)?this.style.getOwnSource(e):null}addImage(t,i,{pixelRatio:o=1,sdf:r=!1,stretchX:s,stretchY:n,content:a}={}){if(this._lazyInitEmptyStyle(),i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap){const{width:l,height:c,data:h}=e.f.getImageData(i);this.style.addImage(t,{data:new e.h({width:l,height:c},h),pixelRatio:o,stretchX:s,stretchY:n,content:a,sdf:r,version:0});}else if(void 0===i.width||void 0===i.height)this.fire(new e.a(new Error(\"Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`\")));else {const{width:l,height:c}=i,h=i;this.style.addImage(t,{data:new e.h({width:l,height:c},new Uint8Array(h.data)),pixelRatio:o,stretchX:s,stretchY:n,content:a,sdf:r,version:0,userImage:h}),h.onAdd&&h.onAdd(this,t);}}updateImage(t,i){this._lazyInitEmptyStyle();const o=this.style.getImage(t);if(!o)return void this.fire(new e.a(new Error(\"The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.\")));const r=i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap?e.f.getImageData(i):i,{width:s,height:n}=r,a=r.data;if(void 0===s||void 0===n)return void this.fire(new e.a(new Error(\"Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`\")));if(s!==o.data.width||n!==o.data.height)return void this.fire(new e.a(new Error(`The width and height of the updated image (${s}, ${n})\\n                must be that same as the previous version of the image\\n                (${o.data.width}, ${o.data.height})`)));const l=!(i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap);o.data.replace(a,l),this.style.updateImage(t,o);}hasImage(t){return t?!!this.style&&!!this.style.getImage(t):(this.fire(new e.a(new Error(\"Missing required image id\"))),!1)}removeImage(e){this.style.removeImage(e);}loadImage(t,i){e.d(this._requestManager.transformRequest(t,e.R.Image),((t,o)=>{i(t,o instanceof HTMLImageElement?e.f.getImageData(o):o);}));}listImages(){return this.style.listImages()}addModel(e,t){this._lazyInitEmptyStyle(),this.style.addModel(e,t);}hasModel(t){return t?this.style.hasModel(t):(this.fire(new e.a(new Error(\"Missing required model id\"))),!1)}removeModel(e){this.style.removeModel(e);}listModels(){return this.style.listModels()}addLayer(e,t){return this._isValidId(e.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)):this}getSlot(e){const t=this.getLayer(e);return t&&t.slot||null}setSlot(e,t){return this.style.setSlot(e,t),this.style.mergeLayers(),this._update(!0)}addImport(e,t){return this.style.addImport(e,t),this}updateImport(e,t){return \"string\"!=typeof t&&t.id!==e?(this.removeImport(e),this.addImport(t)):(this.style.updateImport(e,t),this._update(!0))}removeImport(e){return this.style.removeImport(e),this}moveImport(e,t){return this.style.moveImport(e,t),this._update(!0)}moveLayer(e,t){return this._isValidId(e)?(this.style.moveLayer(e,t),this._update(!0)):this}removeLayer(e){return this._isValidId(e)?(this.style.removeLayer(e),this._update(!0)):this}getLayer(e){return this._isValidId(e)?this.style.getOwnLayer(e):null}setLayerZoomRange(e,t,i){return this._isValidId(e)?(this.style.setLayerZoomRange(e,t,i),this._update(!0)):this}setFilter(e,t,i={}){return this._isValidId(e)?(this.style.setFilter(e,t,i),this._update(!0)):this}getFilter(e){return this._isValidId(e)?this.style.getFilter(e):null}setPaintProperty(e,t,i,o={}){return this._isValidId(e)?(this.style.setPaintProperty(e,t,i,o),this._update(!0)):this}getPaintProperty(e,t){return this._isValidId(e)?this.style.getPaintProperty(e,t):null}setLayoutProperty(e,t,i,o={}){return this._isValidId(e)?(this.style.setLayoutProperty(e,t,i,o),this._update(!0)):this}getLayoutProperty(e,t){return this._isValidId(e)?this.style.getLayoutProperty(e,t):null}getSchema(e){return this.style.getSchema(e)}setSchema(e,t){return this.style.setSchema(e,t),this._update(!0)}getConfig(e){return this.style.getConfig(e)}setConfig(e,t){return this.style.setConfig(e,t),this._update(!0)}getConfigProperty(e,t){return this.style.getConfigProperty(e,t)}setConfigProperty(e,t,i){return this.style.setConfigProperty(e,t,i),this._update(!0)}setLights(e){if(this._lazyInitEmptyStyle(),e&&1===e.length&&\"flat\"===e[0].type){const t=e[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},\"flat\");}else this.style.setLights(e),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const e=this.style.getLights()||[];return 0===e.length&&e.push({id:this.style.light.id,type:\"flat\",properties:this.style.getFlatLight()}),e}setLight(e,t={}){return console.log(\"The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead.\"),this.setLights([{id:\"flat\",type:\"flat\",properties:e}])}getLight(){return console.log(\"The `map.getLight` function is deprecated, prefer using `map.getLights` instead.\"),this.style.getFlatLight()}setTerrain(e){return this._lazyInitEmptyStyle(),!e&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(e),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(e){return this._lazyInitEmptyStyle(),this.style.setFog(e),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setCamera(e){return this.style.setCamera(e),this._triggerCameraUpdate(e)}_triggerCameraUpdate(e){return this._update(this.transform.setOrthographicProjectionAtLowPitch(\"orthographic\"===e[\"camera-projection\"]))}getCamera(){return this.style.camera}_queryFogOpacity(t){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(e.bq.convert(t),this.transform):0}setFeatureState(e,t){return this._isValidId(e.source)?(this.style.setFeatureState(e,t),this._update()):this}removeFeatureState(e,t){return this._isValidId(e.source)?(this.style.removeFeatureState(e,t),this._update()):this}getFeatureState(e){return this._isValidId(e.source)?this.style.getFeatureState(e):null}_updateContainerDimensions(){if(!this._container)return;const e=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let i,o,r,s=this._container;for(;s&&(!o||!r);){const e=window.getComputedStyle(s).transform;e&&\"none\"!==e&&(i=e.match(/matrix.*\\((.+)\\)/)[1].split(\", \"),i[0]&&\"0\"!==i[0]&&\"1\"!==i[0]&&(o=i[0]),i[3]&&\"0\"!==i[3]&&\"1\"!==i[3]&&(r=i[3])),s=s.parentElement;}this._containerWidth=o?Math.abs(e/o):e,this._containerHeight=r?Math.abs(t/r):t;}_detectMissingCSS(){\"rgb(250, 128, 114)\"!==window.getComputedStyle(this._missingCSSCanary).getPropertyValue(\"background-color\")&&e.w(\"This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.\");}_setupContainer(){const e=this._container;e.classList.add(\"mapboxgl-map\"),(this._missingCSSCanary=s(\"div\",\"mapboxgl-canary\",e)).style.visibility=\"hidden\",this._detectMissingCSS();const t=this._canvasContainer=s(\"div\",\"mapboxgl-canvas-container\",e);this._canvas=s(\"canvas\",\"mapboxgl-canvas\",t),this._interactive&&(t.classList.add(\"mapboxgl-interactive\"),this._canvas.setAttribute(\"tabindex\",\"0\")),this._canvas.addEventListener(\"webglcontextlost\",this._contextLost,!1),this._canvas.addEventListener(\"webglcontextrestored\",this._contextRestored,!1),this._canvas.setAttribute(\"aria-label\",this._getUIString(\"Map.Title\")),this._canvas.setAttribute(\"role\",\"region\"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const i=this._controlContainer=s(\"div\",\"mapboxgl-control-container\",e),o=this._controlPositions={};[\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\"].forEach((e=>{o[e]=s(\"div\",`mapboxgl-ctrl-${e}`,i);})),this._container.addEventListener(\"scroll\",this._onMapScroll,!1);}_resizeCanvas(t,i){const o=e.f.devicePixelRatio||1;this._canvas.width=o*Math.ceil(t),this._canvas.height=o*Math.ceil(i),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${i}px`;}_addMarker(e){this._markers.push(e);}_removeMarker(e){const t=this._markers.indexOf(e);-1!==t&&this._markers.splice(t,1);}_addPopup(e){this._popups.push(e);}_removePopup(e){const t=this._popups.indexOf(e);-1!==t&&this._popups.splice(t,1);}_setupPainter(){const t=e.e({},i.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),o=this._canvas.getContext(\"webgl2\",t);o?(e.dj(o,!0),this.painter=new Ys(o,this._contextCreateOptions,this.transform,this._tp),this.on(\"data\",(e=>{\"source\"===e.dataType&&this.painter.setTileLoadedFlag(!0);})),e.dk.testSupport(o)):this.fire(new e.a(new Error(\"Failed to initialize WebGL\")));}_contextLost(t){t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.b(\"webglcontextlost\",{originalEvent:t}));}_contextRestored(t){this._setupPainter(),this.resize(),this._update(),this.fire(new e.b(\"webglcontextrestored\",{originalEvent:t}));}_onMapScroll(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return !this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e);}_requestDomTask(e){!this.loaded()||this.loaded()&&!this.isMoving()?e():this._domRenderTaskQueue.add(e);}_render(t){let i;this.fire(new e.b(\"renderstart\"));const o=this.painter.context.extTimerQuery,r=e.f.now(),s=this.painter.context.gl;if(this.listens(\"gpu-timing-frame\")&&(i=s.createQuery(),s.beginQuery(o.TIME_ELAPSED_EXT,i)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(t),this._domRenderTaskQueue.run(t),this._removed)return;this._updateProjectionTransition();const n=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,i=this.transform.pitch,o=e.f.now(),r=new e.N(t,{now:o,fadeDuration:n,pitch:i,transition:this.style.transition});this.style.update(r);}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let a=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),a=this._updateAverageElevation(r),this.style.updateSources(this.transform),this._forceMarkerAndPopupUpdate()):a=this._updateAverageElevation(r),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,n,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:n,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens(\"gpu-timing-layer\"),gpuTimingDeferredRender:!!this.listens(\"gpu-timing-deferred-render\"),speedIndexTiming:this.speedIndexTiming}),this.fire(new e.b(\"render\")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new e.b(\"load\"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),i){const t=e.f.now()-r;s.endQuery(o.TIME_ELAPSED_EXT),setTimeout((()=>{const o=s.getQueryParameter(i,s.QUERY_RESULT)/1e6;s.deleteQuery(i),this.fire(new e.b(\"gpu-timing-frame\",{cpuTime:t,gpuTime:o}));}),50);}if(this.listens(\"gpu-timing-layer\")){const t=this.painter.collectGpuTimers();setTimeout((()=>{const i=this.painter.queryGpuTimers(t);this.fire(new e.b(\"gpu-timing-layer\",{layerTimes:i}));}),50);}if(this.listens(\"gpu-timing-deferred-render\")){const t=this.painter.collectDeferredRenderGpuQueries();setTimeout((()=>{const i=this.painter.queryGpuTimeDeferredRender(t);this.fire(new e.b(\"gpu-timing-deferred-render\",{gpuTime:i}));}),50);}const l=this._sourcesDirty||this._styleDirty||this._placementDirty||a;if(l||this._repaint)this.triggerRepaint();else {const t=!this.isMoving()&&this.loaded();if(t&&(a=this._updateAverageElevation(r,!0)),a)this.triggerRepaint();else if(this._triggerFrame(!1),t&&(this.fire(new e.b(\"idle\")),this._isInitialLoad=!1,this.speedIndexTiming)){const t=this._calculateSpeedIndex();this.fire(new e.b(\"speedindexcompleted\",{speedIndex:t})),this.speedIndexTiming=!1;}}!this._loaded||this._fullyLoaded||l||(this._fullyLoaded=!0,this._performanceMetricsCollection&&e.dl(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate());}_forceMarkerAndPopupUpdate(e){for(const t of this._markers)e&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!e||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update();}_updateAverageElevation(e,t=!1){const i=e=>(this.transform.averageElevation=e,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&i(0);const o=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(o||(t||e-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(e)){const t=this.transform.averageElevation;let r=this.transform.sampleAverageElevation();this.transform.elevation&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(r)?r=0:this._averageElevationLastSampledAt=e;const s=Math.abs(t-r);if(s>1){if(this._isInitialLoad||o)return this._averageElevation.jumpTo(r),i(r);this._averageElevation.easeTo(r,e,300);}else if(s>1e-4)return this._averageElevation.jumpTo(r),i(r)}return !!this._averageElevation.isEasing(e)&&i(this._averageElevation.getValue(e))}_authenticate(){e.dm(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(t=>{if(t&&(t.message===e.dn||401===t.status)){const t=this.painter.context.gl;e.dj(t,!1),this._logoControl instanceof ea&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new e.a(new Error(\"A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/\")));}})),e.dp(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(()=>{}));}_postStyleLoadEvent(){this.style.globalId&&e.dq(this._requestManager._customAccessToken,{map:this,skuToken:this._requestManager._skuToken,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()});}_updateTerrain(){const e=this._isDragging();this.painter.updateTerrain(this.style,e);}_calculateSpeedIndex(){const e=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const i=this.painter.context.gl,o=i.createFramebuffer();function r(e){i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0);const t=new Uint8Array(i.drawingBufferWidth*i.drawingBufferHeight*4);return i.readPixels(0,0,i.drawingBufferWidth,i.drawingBufferHeight,i.RGBA,i.UNSIGNED_BYTE,t),t}return i.bindFramebuffer(i.FRAMEBUFFER,o),this._canvasPixelComparison(r(e),t.canvasCopies.map(r),t.timeStamps)}_canvasPixelComparison(e,t,i){let o=i[1]-i[0];const r=e.length/4;for(let s=0;s<t.length;s++){const n=t[s];let a=0;for(let t=0;t<n.length;t+=4)n[t]===e[t]&&n[t+1]===e[t+1]&&n[t+2]===e[t+2]&&n[t+3]===e[t+3]&&(a+=1);o+=(i[s+2]-i[s+1])*(1-a/r);}return o}remove(){this._hash&&this._hash.remove();for(const e of this._controls)e.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener(\"resize\",this._onWindowResize,!1),window.removeEventListener(\"orientationchange\",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener(\"online\",this._onWindowOnline,!1),window.removeEventListener(\"visibilitychange\",this._onVisibilityChange,!1);const t=this.painter.context.gl.getExtension(\"WEBGL_lose_context\");t&&t.loseContext(),this._canvas.removeEventListener(\"webglcontextlost\",this._contextLost,!1),this._canvas.removeEventListener(\"webglcontextrestored\",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove(\"mapboxgl-map\"),this._container.removeEventListener(\"scroll\",this._onMapScroll,!1),e.dr(this.painter.context.gl),e.ds.remove(),e.dt.remove(),this._removed=!0,this.fire(new e.b(\"remove\"));}triggerRepaint(){this._triggerFrame(!0);}_triggerFrame(t){this._renderNextFrame=this._renderNextFrame||t,this.style&&!this._frame&&(this._frame=e.f.frame((e=>{const t=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,t&&this._render(e);})));}_preloadTiles(t){const i=this.style?this.style.getSourceCaches():[];return e.b4(i,((e,i)=>e._preloadTiles(t,i)),(()=>{this.triggerRepaint();})),this}_onWindowOnline(){this._update();}_onWindowResize(e){this._trackResize&&this.resize({originalEvent:e})._update();}_onVisibilityChange(){\"hidden\"===document.visibilityState&&this._visibilityHidden++;}get showTileBoundaries(){return !!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._tp.refreshUI(),this._update());}get showParseStatus(){return !!this._showParseStatus}set showParseStatus(e){this._showParseStatus!==e&&(this._showParseStatus=e,this._tp.refreshUI(),this._update());}get showTerrainWireframe(){return !!this._showTerrainWireframe}set showTerrainWireframe(e){this._showTerrainWireframe!==e&&(this._showTerrainWireframe=e,this._tp.refreshUI(),this._update());}get showLayers2DWireframe(){return !!this._showLayers2DWireframe}set showLayers2DWireframe(e){this._showLayers2DWireframe!==e&&(this._showLayers2DWireframe=e,this._tp.refreshUI(),this._update());}get showLayers3DWireframe(){return !!this._showLayers3DWireframe}set showLayers3DWireframe(e){this._showLayers3DWireframe!==e&&(this._showLayers3DWireframe=e,this._tp.refreshUI(),this._update());}get speedIndexTiming(){return !!this._speedIndexTiming}set speedIndexTiming(e){this._speedIndexTiming!==e&&(this._speedIndexTiming=e,this._update());}get showPadding(){return !!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._tp.refreshUI(),this._update());}get showCollisionBoxes(){return !!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,this._tp.refreshUI(),e?this.style._generateCollisionBoxes():this._update());}get showOverdrawInspector(){return !!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._tp.refreshUI(),this._update());}get repaint(){return !!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this._tp.refreshUI(),this.triggerRepaint());}get vertices(){return !!this._vertices}set vertices(e){this._vertices=e,this._update();}get showTileAABBs(){return !!this._showTileAABBs}set showTileAABBs(e){this._showTileAABBs!==e&&(this._showTileAABBs=e,this._tp.refreshUI(),e&&this._update());}_setCacheLimits(t,i){e.dv(t,i);}get version(){return e.du}},NavigationControl:class{constructor(t){this.options=e.e({},da,t),this._container=s(\"div\",\"mapboxgl-ctrl mapboxgl-ctrl-group\"),this._container.addEventListener(\"contextmenu\",(e=>e.preventDefault())),this.options.showZoom&&(e.a$([\"_setButtonTitle\",\"_updateZoomButtons\"],this),this._zoomInButton=this._createButton(\"mapboxgl-ctrl-zoom-in\",(e=>{this._map&&this._map.zoomIn({},{originalEvent:e});})),s(\"span\",\"mapboxgl-ctrl-icon\",this._zoomInButton).setAttribute(\"aria-hidden\",\"true\"),this._zoomOutButton=this._createButton(\"mapboxgl-ctrl-zoom-out\",(e=>{this._map&&this._map.zoomOut({},{originalEvent:e});})),s(\"span\",\"mapboxgl-ctrl-icon\",this._zoomOutButton).setAttribute(\"aria-hidden\",\"true\")),this.options.showCompass&&(e.a$([\"_rotateCompassArrow\"],this),this._compass=this._createButton(\"mapboxgl-ctrl-compass\",(e=>{const t=this._map;t&&(this.options.visualizePitch?t.resetNorthPitch({},{originalEvent:e}):t.resetNorth({},{originalEvent:e}));})),this._compassIcon=s(\"span\",\"mapboxgl-ctrl-icon\",this._compass),this._compassIcon.setAttribute(\"aria-hidden\",\"true\"));}_updateZoomButtons(){const e=this._map;if(!e)return;const t=e.getZoom(),i=t===e.getMaxZoom(),o=t===e.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=o,this._zoomInButton.setAttribute(\"aria-disabled\",i.toString()),this._zoomOutButton.setAttribute(\"aria-disabled\",o.toString());}_rotateCompassArrow(){const e=this._map;if(!e)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(e.transform.pitch*(Math.PI/180)),.5)}) rotateX(${e.transform.pitch}deg) rotateZ(${e.transform.angle*(180/Math.PI)}deg)`:`rotate(${e.transform.angle*(180/Math.PI)}deg)`;e._requestDomTask((()=>{this._compassIcon&&(this._compassIcon.style.transform=t);}));}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,\"ZoomIn\"),this._setButtonTitle(this._zoomOutButton,\"ZoomOut\"),e.on(\"zoom\",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,\"ResetBearing\"),this.options.visualizePitch&&e.on(\"pitch\",this._rotateCompassArrow),e.on(\"rotate\",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new _a(e,this._compass,this.options.visualizePitch)),this._container}onRemove(){const e=this._map;e&&(this._container.remove(),this.options.showZoom&&e.off(\"zoom\",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&e.off(\"pitch\",this._rotateCompassArrow),e.off(\"rotate\",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0);}_createButton(e,t){const i=s(\"button\",e,this._container);return i.type=\"button\",i.addEventListener(\"click\",t),i}_setButtonTitle(e,t){if(!this._map)return;const i=this._map._getUIString(`NavigationControl.${t}`);e.setAttribute(\"aria-label\",i),e.firstElementChild&&e.firstElementChild.setAttribute(\"title\",i);}},GeolocateControl:class extends e.E{constructor(t){super();const i=navigator.geolocation;this.options=e.e({geolocation:i},pa,t),e.a$([\"_onSuccess\",\"_onError\",\"_onZoom\",\"_finish\",\"_setupUI\",\"_updateCamera\",\"_updateMarker\",\"_updateMarkerRotation\",\"_onDeviceOrientation\"],this),this._updateMarkerRotationThrottled=Js(this._updateMarkerRotation,20),this._numberOfWatches=0;}onAdd(e){return this._map=e,this._container=s(\"div\",\"mapboxgl-ctrl mapboxgl-ctrl-group\"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off(\"zoom\",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1;}_checkGeolocationSupport(e){const t=(t=!!this.options.geolocation)=>{this._supportsGeolocation=t,e(t);};void 0!==this._supportsGeolocation?e(this._supportsGeolocation):void 0!==navigator.permissions?navigator.permissions.query({name:\"geolocation\"}).then((e=>t(\"denied\"!==e.state))).catch((()=>t())):t();}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),i=e.coords;return !!t&&(i.longitude<t.getWest()||i.longitude>t.getEast()||i.latitude<t.getSouth()||i.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case\"WAITING_ACTIVE\":this._watchState=\"ACTIVE_ERROR\",this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-active\"),this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-active-error\");break;case\"ACTIVE_LOCK\":this._watchState=\"ACTIVE_ERROR\",this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-active\"),this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-active-error\"),this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-waiting\");break;case\"BACKGROUND\":this._watchState=\"BACKGROUND_ERROR\",this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-background\"),this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-background-error\"),this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-waiting\");}}_onSuccess(t){if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.b(\"outofmaxbounds\",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case\"WAITING_ACTIVE\":case\"ACTIVE_LOCK\":case\"ACTIVE_ERROR\":this._watchState=\"ACTIVE_LOCK\",this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-active-error\"),this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-active\");break;case\"BACKGROUND\":case\"BACKGROUND_ERROR\":this._watchState=\"BACKGROUND\",this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-background-error\"),this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-background\");}this.options.showUserLocation&&\"OFF\"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&\"ACTIVE_LOCK\"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName(\"mapboxgl-user-location-dot-stale\"),this.fire(new e.b(\"geolocate\",t)),this._finish();}}_updateCamera(t){const i=new e.bq(t.coords.longitude,t.coords.latitude),o=t.coords.accuracy,r=this._map.getBearing(),s=e.e({bearing:r},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(o),s,{geolocateSource:!0});}_updateMarker(t){if(t){const i=new e.bq(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius();}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove();}_updateCircleRadius(){const t=this._map.transform,i=e.bo(1,t._center.lat)*t.worldSize,o=Math.ceil(2*this._accuracy*i);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`;}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius();}_updateMarkerRotation(){this._userLocationDotMarker&&\"number\"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName(\"mapboxgl-user-location-show-heading\")):(this._userLocationDotMarker.removeClassName(\"mapboxgl-user-location-show-heading\"),this._userLocationDotMarker.setRotation(0));}_onError(t){if(this._map){if(this.options.trackUserLocation)if(1===t.code){this._watchState=\"OFF\",this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-active\"),this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-active-error\"),this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-background\"),this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-background-error\"),this._geolocateButton.disabled=!0;const e=this._map._getUIString(\"GeolocateControl.LocationNotAvailable\");this._geolocateButton.setAttribute(\"aria-label\",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute(\"title\",e),void 0!==this._geolocationWatchID&&this._clearWatch();}else {if(3===t.code&&this._noTimeout)return;this._setErrorState();}\"OFF\"!==this._watchState&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName(\"mapboxgl-user-location-dot-stale\"),this.fire(new e.b(\"error\",t)),this._finish();}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0;}_setupUI(t){if(void 0!==this._map){if(this._container.addEventListener(\"contextmenu\",(e=>e.preventDefault())),this._geolocateButton=s(\"button\",\"mapboxgl-ctrl-geolocate\",this._container),s(\"span\",\"mapboxgl-ctrl-icon\",this._geolocateButton).setAttribute(\"aria-hidden\",\"true\"),this._geolocateButton.type=\"button\",!1===t){e.w(\"Geolocation support is not available so the GeolocateControl will be disabled.\");const t=this._map._getUIString(\"GeolocateControl.LocationNotAvailable\");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute(\"aria-label\",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute(\"title\",t);}else {const e=this._map._getUIString(\"GeolocateControl.FindMyLocation\");this._geolocateButton.setAttribute(\"aria-label\",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute(\"title\",e);}this.options.trackUserLocation&&(this._geolocateButton.setAttribute(\"aria-pressed\",\"false\"),this._watchState=\"OFF\"),this.options.showUserLocation&&(this._dotElement=s(\"div\",\"mapboxgl-user-location\"),this._dotElement.appendChild(s(\"div\",\"mapboxgl-user-location-dot\")),this._dotElement.appendChild(s(\"div\",\"mapboxgl-user-location-heading\")),this._userLocationDotMarker=new ra({element:this._dotElement,rotationAlignment:\"map\",pitchAlignment:\"map\"}),this._circleElement=s(\"div\",\"mapboxgl-user-location-accuracy-circle\"),this._accuracyCircleMarker=new ra({element:this._circleElement,pitchAlignment:\"map\"}),this.options.trackUserLocation&&(this._watchState=\"OFF\"),this._map.on(\"zoom\",this._onZoom)),this._geolocateButton.addEventListener(\"click\",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on(\"movestart\",(t=>{t.geolocateSource||\"ACTIVE_LOCK\"!==this._watchState||t.originalEvent&&\"resize\"===t.originalEvent.type||(this._watchState=\"BACKGROUND\",this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-background\"),this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-active\"),this.fire(new e.b(\"trackuserlocationend\")));}));}}_onDeviceOrientation(e){this._userLocationDotMarker&&(e.webkitCompassHeading?this._heading=e.webkitCompassHeading:!0===e.absolute&&(this._heading=-1*e.alpha),this._updateMarkerRotationThrottled());}trigger(){if(!this._setup)return e.w(\"Geolocate control triggered before added to a map\"),!1;if(this.options.trackUserLocation){switch(this._watchState){case\"OFF\":this._watchState=\"WAITING_ACTIVE\",this.fire(new e.b(\"trackuserlocationstart\"));break;case\"WAITING_ACTIVE\":case\"ACTIVE_LOCK\":case\"ACTIVE_ERROR\":case\"BACKGROUND_ERROR\":this._numberOfWatches--,this._noTimeout=!1,this._watchState=\"OFF\",this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-active\"),this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-active-error\"),this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-background\"),this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-background-error\"),this.fire(new e.b(\"trackuserlocationend\"));break;case\"BACKGROUND\":this._watchState=\"ACTIVE_LOCK\",this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-background\"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.b(\"trackuserlocationstart\"));}switch(this._watchState){case\"WAITING_ACTIVE\":this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-active\");break;case\"ACTIVE_LOCK\":this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-active\");break;case\"ACTIVE_ERROR\":this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-active-error\");break;case\"BACKGROUND\":this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-background\");break;case\"BACKGROUND_ERROR\":this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-background-error\");}if(\"OFF\"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add(\"mapboxgl-ctrl-geolocate-waiting\"),this._geolocateButton.setAttribute(\"aria-pressed\",\"true\"),this._numberOfWatches++,this._numberOfWatches>1?(e={maximumAge:6e5,timeout:0},this._noTimeout=!0):(e=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,e),this.options.showUserHeading&&this._addDeviceOrientationListener();}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return !0}_addDeviceOrientationListener(){const e=()=>{\"ondeviceorientationabsolute\"in window?window.addEventListener(\"deviceorientationabsolute\",this._onDeviceOrientation):window.addEventListener(\"deviceorientation\",this._onDeviceOrientation);};\"undefined\"!=typeof DeviceMotionEvent&&\"function\"==typeof DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((t=>{\"granted\"===t&&e();})).catch(console.error):e();}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener(\"deviceorientation\",this._onDeviceOrientation),window.removeEventListener(\"deviceorientationabsolute\",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove(\"mapboxgl-ctrl-geolocate-waiting\"),this._geolocateButton.setAttribute(\"aria-pressed\",\"false\"),this.options.showUserLocation&&this._updateMarker(null);}},AttributionControl:Kn,ScaleControl:class{constructor(t){this.options=e.e({},fa,t),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat(\"en\",{style:\"unit\",unitDisplay:\"short\",unit:\"meter\"}),!0}catch(e){return !1}}(),e.a$([\"_update\",\"_setScale\",\"setUnit\"],this);}getDefaultPosition(){return \"bottom-left\"}_update(){const e=this.options.maxWidth||100,t=this._map,i=t._containerHeight/2,o=t._containerWidth/2-e/2,r=t.unproject([o,i]),s=t.unproject([o+e,i]),n=r.distanceTo(s);if(\"imperial\"===this.options.unit){const t=3.2808*n;t>5280?this._setScale(e,t/5280,\"mile\"):this._setScale(e,t,\"foot\");}else \"nautical\"===this.options.unit?this._setScale(e,n/1852,\"nautical-mile\"):n>=1e3?this._setScale(e,n/1e3,\"kilometer\"):this._setScale(e,n,\"meter\");}_setScale(e,t,i){this._map._requestDomTask((()=>{const o=function(e){const t=Math.pow(10,`${Math.floor(e)}`.length-1);let i=e/t;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(i),t*i}(t),r=o/t;this._container.innerHTML=this._isNumberFormatSupported&&\"nautical-mile\"!==i?new Intl.NumberFormat(this._language,{style:\"unit\",unitDisplay:\"short\",unit:i}).format(o):`${o}&nbsp;${ma[i]}`,this._container.style.width=e*r+\"px\";}));}onAdd(e){return this._map=e,this._language=e.getLanguage(),this._container=s(\"div\",\"mapboxgl-ctrl mapboxgl-ctrl-scale\",e.getContainer()),this._container.dir=\"auto\",this._map.on(\"move\",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off(\"move\",this._update),this._map=void 0;}_setLanguage(e){this._language=e,this._update();}setUnit(e){this.options.unit=e,this._update();}},FullscreenControl:class{constructor(t){this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:e.w(\"Full screen control 'container' must be a DOM element.\")),e.a$([\"_onClickFullscreen\",\"_changeIcon\"],this),\"onfullscreenchange\"in document?this._fullscreenchange=\"fullscreenchange\":\"onwebkitfullscreenchange\"in document&&(this._fullscreenchange=\"webkitfullscreenchange\");}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=s(\"div\",\"mapboxgl-ctrl mapboxgl-ctrl-group\"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display=\"none\",e.w(\"This device does not support fullscreen mode.\")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon);}_checkFullscreenSupport(){return !(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const e=this._fullscreenButton=s(\"button\",\"mapboxgl-ctrl-fullscreen\",this._controlContainer);s(\"span\",\"mapboxgl-ctrl-icon\",e).setAttribute(\"aria-hidden\",\"true\"),e.type=\"button\",this._updateTitle(),this._fullscreenButton.addEventListener(\"click\",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon);}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute(\"aria-label\",e),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute(\"title\",e);}_getTitle(){return this._map._getUIString(this._isFullscreen()?\"FullscreenControl.Exit\":\"FullscreenControl.Enter\")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle(\"mapboxgl-ctrl-shrink\"),this._fullscreenButton.classList.toggle(\"mapboxgl-ctrl-fullscreen\"),this._updateTitle());}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen();}},Popup:class extends e.E{constructor(t){super(),this.options=e.e(Object.create(sa),t),e.a$([\"_update\",\"_onClose\",\"remove\",\"_onMouseEvent\"],this),this._classList=new Set(t&&t.className?t.className.trim().split(/\\s+/):[]);}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&t.on(\"preclick\",this._onClose),this.options.closeOnMove&&t.on(\"move\",this._onClose),t.on(\"remove\",this.remove),this._update(),t._addPopup(this),this._focusFirstElement(),this._trackPointer?(t.on(\"mousemove\",this._onMouseEvent),t.on(\"mouseup\",this._onMouseEvent),t._canvasContainer.classList.add(\"mapboxgl-track-pointer\")):t.on(\"move\",this._update),this.fire(new e.b(\"open\")),this}isOpen(){return !!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const t=this._map;return t&&(t.off(\"move\",this._update),t.off(\"move\",this._onClose),t.off(\"preclick\",this._onClose),t.off(\"click\",this._onClose),t.off(\"remove\",this.remove),t.off(\"mousemove\",this._onMouseEvent),t.off(\"mouseup\",this._onMouseEvent),t.off(\"drag\",this._onMouseEvent),t._canvasContainer&&t._canvasContainer.classList.remove(\"mapboxgl-track-pointer\"),t._removePopup(this),this._map=void 0),this.fire(new e.b(\"close\")),this}getLngLat(){return this._lngLat}setLngLat(t){this._lngLat=e.bq.convert(t),this._pos=null,this._trackPointer=!1,this._update();const i=this._map;return i&&(i.on(\"move\",this._update),i.off(\"mousemove\",this._onMouseEvent),i._canvasContainer.classList.remove(\"mapboxgl-track-pointer\")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const e=this._map;return e&&(e.off(\"move\",this._update),e.on(\"mousemove\",this._onMouseEvent),e.on(\"drag\",this._onMouseEvent),e._canvasContainer.classList.add(\"mapboxgl-track-pointer\")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){const t=document.createDocumentFragment(),i=document.createElement(\"body\");let o;for(i.innerHTML=e;o=i.firstChild,o;)t.appendChild(o);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=s(\"div\",\"mapboxgl-popup-content\",this._container||void 0);if(t.appendChild(e),this.options.closeButton){const e=this._closeButton=s(\"button\",\"mapboxgl-popup-close-button\",t);e.type=\"button\",e.setAttribute(\"aria-label\",\"Close popup\"),e.setAttribute(\"aria-hidden\",\"true\"),e.innerHTML=\"&#215;\",e.addEventListener(\"click\",this._onClose);}return this._update(),this._focusFirstElement(),this}addClassName(e){return this._classList.add(e),this._updateClassList(),this}removeClassName(e){return this._classList.delete(e),this._updateClassList(),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){let t;return this._classList.delete(e)?t=!1:(this._classList.add(e),t=!0),this._updateClassList(),t}_onMouseEvent(e){this._update(e.point);}_getAnchor(e){if(this.options.anchor)return this.options.anchor;const t=this._map,i=this._container,o=this._pos;if(!t||!i||!o)return \"bottom\";const r=i.offsetWidth,s=i.offsetHeight,n=o.x<r/2,a=o.x>t.transform.width-r/2;if(o.y+e<s)return n?\"top-left\":a?\"top-right\":\"top\";if(o.y>t.transform.height-s){if(n)return \"bottom-left\";if(a)return \"bottom-right\"}return n?\"left\":a?\"right\":\"bottom\"}_updateClassList(){const e=this._container;if(!e)return;const t=[...this._classList];t.push(\"mapboxgl-popup\"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push(\"mapboxgl-popup-track-pointer\"),e.className=t.join(\" \");}_update(t){const i=this._map,o=this._content;if(!i||!this._lngLat&&!this._trackPointer||!o)return;let r=this._container;if(r||(r=this._container=s(\"div\",\"mapboxgl-popup\",i.getContainer()),this._tip=s(\"div\",\"mapboxgl-popup-tip\",r),r.appendChild(o)),this.options.maxWidth&&r.style.maxWidth!==this.options.maxWidth&&(r.style.maxWidth=this.options.maxWidth),i.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=ia(this._lngLat,this._pos,i.transform)),!this._trackPointer||t){const e=this._pos=this._trackPointer&&t?t:i.project(this._lngLat),o=aa(this.options.offset),r=this._anchor=this._getAnchor(o.y),s=aa(this.options.offset,r),n=e.add(s).round();i._requestDomTask((()=>{this._container&&r&&(this._container.style.transform=`${oa[r]} translate(${n.x}px,${n.y}px)`);}));}if(!this._marker&&i._showingGlobe()){const t=e.de(i.transform,this._lngLat)?0:1;this._setOpacity(t);}this._updateClassList();}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(na);e&&e.focus();}_onClose(){this.remove();}_setOpacity(e){this._container&&(this._container.style.opacity=`${e}`),this._content&&(this._content.style.pointerEvents=e?\"auto\":\"none\");}},Marker:ra,Style:Ao,LngLat:e.bq,LngLatBounds:e.ag,Point:e.P,MercatorCoordinate:e.O,FreeCameraOptions:co,Evented:e.E,config:e.dd,prewarm:e.dy,clearPrewarmedResources:e.dz,get accessToken(){return e.dd.ACCESS_TOKEN},set accessToken(t){e.dd.ACCESS_TOKEN=t;},get baseApiUrl(){return e.dd.API_URL},set baseApiUrl(t){e.dd.API_URL=t;},get workerCount(){return e.dA.workerCount},set workerCount(t){e.dA.workerCount=t;},get maxParallelImageRequests(){return e.dd.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.dd.MAX_PARALLEL_IMAGE_REQUESTS=t;},clearStorage(t){e.dB(t);},get workerUrl(){return e.dC.workerUrl},set workerUrl(t){e.dC.workerUrl=t;},get workerClass(){return e.dC.workerClass},set workerClass(t){e.dC.workerClass=t;},get workerParams(){return e.dC.workerParams},set workerParams(t){e.dC.workerParams=t;},get dracoUrl(){return e.dD()},set dracoUrl(t){e.dE(t);},get meshoptUrl(){return e.dF()},set meshoptUrl(t){e.dG(t);},setNow:e.f.setNow,restoreNow:e.f.restoreNow};return ga}));\n\n//\n// Our custom intro provides a specialized \"define()\" function, called by the\n// AMD modules below, that sets up the worker blob URL and then executes the\n// main module, storing its exported value as 'mapboxgl'\n\n\nvar mapboxgl$1 = mapboxgl;\n\nreturn mapboxgl$1;\n\n}));\n//# sourceMappingURL=mapbox-gl.js.map\n"
  },
  {
    "path": "test/maplibre/maplibre-gl.css",
    "content": ".maplibregl-map{-webkit-tap-highlight-color:rgb(0 0 0/0);font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (-ms-high-contrast:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (-ms-high-contrast:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}.maplibregl-ctrl button:not(:disabled):hover{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E\")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-9z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5z'/%3E%3C/svg%3E\")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E\")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3h1zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16h1zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5H13zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1V7.5z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1h-5.5zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1v-5.5zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1v5.5zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1h5.5z'/%3E%3C/svg%3E\")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8h-8z'/%3E%3C/svg%3E\")}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath fill='%23999' d='m10.5 16 4 8 4-8h-8z'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8h-8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8h-8z'/%3E%3C/svg%3E\")}}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1 9-9z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (-ms-high-contrast:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1 9-9z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1zm0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7z'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1 9-9z'/%3E%3C/svg%3E\")}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.255 1.255 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5.11 5.11 0 0 1 .314-.787l.009-.016a4.623 4.623 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.76 4.76 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 0 1 .689 1.004 4.73 4.73 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 0 1-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.778 4.778 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.47 4.47 0 0 1-1.935-.424 1.252 1.252 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.402 2.402 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 0 1-1.782 1.884 4.767 4.767 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.47 4.47 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 0 1-1.115.676h-.098a1.255 1.255 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 0 0-.668-.428l-.27-.12a3.293 3.293 0 0 0-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 0 0-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 0 0 1.382 1.381 3.883 3.883 0 0 0 1.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.17 2.17 0 0 0 .468-.29l.178-.161a2.163 2.163 0 0 0 .397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 0 0-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 0 0-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 0 0-.353-.389.851.851 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 0 0 .331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 0 0 1.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 0 0-.415.262l-.199.166a3.35 3.35 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 0 0-.284.136 1.99 1.99 0 0 0-.363.254 2.237 2.237 0 0 0-.46.569l-.082.162a2.56 2.56 0 0 0-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 0 0 .367.385.937.937 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 0 0-.503.135l-.012.007a.859.859 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 0 0 .14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 0 0-.345-.79 1.175 1.175 0 0 0-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 0 0-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 0 0 .316.224l.223.122a3.21 3.21 0 0 0 1.44.322 3.785 3.785 0 0 0 1.875-.477 3.52 3.52 0 0 0 1.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 0 0-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 0 0-1.527.344l-.086.043-.165.09a3.412 3.412 0 0 0-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 0 0 .566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 0 0 .975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 0 0-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 0 0-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2.086 2.086 0 0 0-.411.148 2.18 2.18 0 0 0-.4.249 2.482 2.482 0 0 0-.485.499 2.659 2.659 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 0 1 .466-.636 2.52 2.52 0 0 1 .399-.253 2.19 2.19 0 0 1 .224-.099zm9.784 2.656.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 0 0-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 0 1-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 0 0-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 0 1-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 0 1 1.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 0 1 1.234.231 3.341 3.341 0 0 1 .97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 0 1-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 0 0-.807-.872 2.098 2.098 0 0 0-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 0 1-1.316 1.399 3.51 3.51 0 0 1-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 0 1-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 0 1-.856-.346 1.165 1.165 0 0 1-.346-.856 1.053 1.053 0 0 1 .346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 0 1 .345.79 1.159 1.159 0 0 1-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 0 1-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 0 1 1.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 0 1 1.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 0 1-1.382 1.366 3.785 3.785 0 0 1-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 0 0-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 0 1 1.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 0 1-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 0 1 1.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 0 0 .938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath fill='%23000' fill-opacity='.4' d='m8.166 16.146-.002.002a1.54 1.54 0 0 1-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 0 0 .113.023.286.286 0 0 0 .189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 0 0 .074.047zm-2.52-.548a16.898 16.898 0 0 1-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 0 1-1.182 1.315h.15a1.912 1.912 0 0 1 1.914 1.914v1.84a1.912 1.912 0 0 1-1.914 1.914H4.377a1.912 1.912 0 0 1-1.914-1.914v-1.84a1.912 1.912 0 0 1 1.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z'/%3E%3Cpath fill='%23e1e3e9' d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 0 1-.189.07.286.286 0 0 1-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z'/%3E%3Cpath fill='%23fff' d='M4.377 15.948a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659zm4.83 1.16H5.114v.838h4.093z'/%3E%3C/g%3E%3C/svg%3E\");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (-ms-high-contrast:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.255 1.255 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5.11 5.11 0 0 1 .314-.787l.009-.016a4.623 4.623 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.76 4.76 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 0 1 .689 1.004 4.73 4.73 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 0 1-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.778 4.778 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.47 4.47 0 0 1-1.935-.424 1.252 1.252 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.402 2.402 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 0 1-1.782 1.884 4.767 4.767 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.47 4.47 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 0 1-1.115.676h-.098a1.255 1.255 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 0 0-.668-.428l-.27-.12a3.293 3.293 0 0 0-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 0 0-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 0 0 1.382 1.381 3.883 3.883 0 0 0 1.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.17 2.17 0 0 0 .468-.29l.178-.161a2.163 2.163 0 0 0 .397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 0 0-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 0 0-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 0 0-.353-.389.851.851 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 0 0 .331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 0 0 1.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 0 0-.415.262l-.199.166a3.35 3.35 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 0 0-.284.136 1.99 1.99 0 0 0-.363.254 2.237 2.237 0 0 0-.46.569l-.082.162a2.56 2.56 0 0 0-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 0 0 .367.385.937.937 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 0 0-.503.135l-.012.007a.859.859 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 0 0 .14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 0 0-.345-.79 1.175 1.175 0 0 0-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 0 0-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 0 0 .316.224l.223.122a3.21 3.21 0 0 0 1.44.322 3.785 3.785 0 0 0 1.875-.477 3.52 3.52 0 0 0 1.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 0 0-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 0 0-1.527.344l-.086.043-.165.09a3.412 3.412 0 0 0-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 0 0 .566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 0 0 .975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 0 0-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 0 0-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2.086 2.086 0 0 0-.411.148 2.18 2.18 0 0 0-.4.249 2.482 2.482 0 0 0-.485.499 2.659 2.659 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 0 1 .466-.636 2.52 2.52 0 0 1 .399-.253 2.19 2.19 0 0 1 .224-.099zm9.784 2.656.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 0 0-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 0 1-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 0 0-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 0 1-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 0 1 1.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 0 1 1.234.231 3.341 3.341 0 0 1 .97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 0 1-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 0 0-.807-.872 2.098 2.098 0 0 0-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 0 1-1.316 1.399 3.51 3.51 0 0 1-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 0 1-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 0 1-.856-.346 1.165 1.165 0 0 1-.346-.856 1.053 1.053 0 0 1 .346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 0 1 .345.79 1.159 1.159 0 0 1-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 0 1-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 0 1 1.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 0 1 1.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 0 1-1.382 1.366 3.785 3.785 0 0 1-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 0 0-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 0 1 1.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 0 1-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 0 1 1.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 0 0 .938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath fill='%23000' fill-opacity='.4' d='m8.166 16.146-.002.002a1.54 1.54 0 0 1-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 0 0 .113.023.286.286 0 0 0 .189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 0 0 .074.047zm-2.52-.548a16.898 16.898 0 0 1-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 0 1-1.182 1.315h.15a1.912 1.912 0 0 1 1.914 1.914v1.84a1.912 1.912 0 0 1-1.914 1.914H4.377a1.912 1.912 0 0 1-1.914-1.914v-1.84a1.912 1.912 0 0 1 1.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z'/%3E%3Cpath fill='%23e1e3e9' d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 0 1-.189.07.286.286 0 0 1-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z'/%3E%3Cpath fill='%23fff' d='M4.377 15.948a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659zm4.83 1.16H5.114v.838h4.093z'/%3E%3C/g%3E%3C/svg%3E\")}}@media (-ms-high-contrast:black-on-white){a.maplibregl-ctrl-logo{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.255 1.255 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.255 1.255 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5.11 5.11 0 0 1 .314-.787l.009-.016a4.623 4.623 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.548 4.548 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4.314.319.566.676.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.416 2.416 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.448 2.448 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675c.211.2.381.43.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.76 4.76 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.407 3.407 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.255 1.255 0 0 1 .689 1.004 4.73 4.73 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528 0 .343-.02.694-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.815 5.815 0 0 1-.548-2.512c0-.286.017-.567.053-.843a1.255 1.255 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.778 4.778 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.47 4.47 0 0 1-1.935-.424 1.252 1.252 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.402 2.402 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.703 4.703 0 0 1-1.782 1.884 4.767 4.767 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.47 4.47 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a4.983 4.983 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.255 1.255 0 0 1-1.115.676h-.098a1.255 1.255 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15c.329-.237.574-.499.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267c-.088-.22-.264-.438-.526-.658l-.032-.028a3.16 3.16 0 0 0-.668-.428l-.27-.12a3.293 3.293 0 0 0-1.235-.23c-.757 0-1.415.163-1.974.493a3.36 3.36 0 0 0-1.3 1.382c-.297.593-.444 1.284-.444 2.074 0 .8.17 1.503.51 2.107a3.795 3.795 0 0 0 1.382 1.381 3.883 3.883 0 0 0 1.893.477c.53 0 1.015-.11 1.455-.33zm-2.789-5.38c-.384.45-.575 1.038-.575 1.762 0 .735.186 1.332.559 1.794.384.45.933.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.17 2.17 0 0 0 .468-.29l.178-.161a2.163 2.163 0 0 0 .397-.561c.163-.333.244-.717.244-1.15v-.115c0-.472-.098-.894-.296-1.267l-.043-.077a2.211 2.211 0 0 0-.633-.709l-.13-.086-.047-.028a2.099 2.099 0 0 0-1.073-.285c-.702 0-1.244.231-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.958.958 0 0 0-.353-.389.851.851 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.626 2.626 0 0 0 .331.423c.213.22.464.402.755.548l.173.074c.433.17.93.255 1.49.255.68 0 1.295-.165 1.844-.493a3.447 3.447 0 0 0 1.316-1.4c.329-.603.493-1.299.493-2.089 0-1.273-.33-2.243-.988-2.913-.658-.68-1.52-1.02-2.584-1.02-.598 0-1.124.115-1.575.347a2.807 2.807 0 0 0-.415.262l-.199.166a3.35 3.35 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138c.137.193.297.36.48.5l.155.11.053.034c.34.197.713.297 1.119.297.714 0 1.262-.225 1.645-.675.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.29 0-.569.053-.835.16a2.366 2.366 0 0 0-.284.136 1.99 1.99 0 0 0-.363.254 2.237 2.237 0 0 0-.46.569l-.082.162a2.56 2.56 0 0 0-.213 1.072v.115c0 .471.098.894.296 1.267l.135.211zm.964-.818a1.11 1.11 0 0 0 .367.385.937.937 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a.995.995 0 0 0-.503.135l-.012.007a.859.859 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.43 1.43 0 0 0 .14.66zm15.7-6.222c.232-.23.346-.516.346-.856a1.053 1.053 0 0 0-.345-.79 1.175 1.175 0 0 0-.84-.329c-.34 0-.625.11-.855.33a1.053 1.053 0 0 0-.346.79c0 .34.115.625.346.855.23.23.516.346.856.346.34 0 .62-.115.839-.346zm4.337 9.314.033-1.332c.128.269.324.518.59.747l.098.081a3.727 3.727 0 0 0 .316.224l.223.122a3.21 3.21 0 0 0 1.44.322 3.785 3.785 0 0 0 1.875-.477 3.52 3.52 0 0 0 1.382-1.366c.352-.593.526-1.29.526-2.09 0-.79-.147-1.48-.444-2.073a3.235 3.235 0 0 0-1.283-1.399c-.549-.34-1.195-.51-1.942-.51a3.476 3.476 0 0 0-1.527.344l-.086.043-.165.09a3.412 3.412 0 0 0-.33.214c-.288.21-.507.446-.656.707a1.893 1.893 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.482 2.482 0 0 0 .566.7c.078.065.159.125.245.18l.144.08a2.105 2.105 0 0 0 .975.232c.713 0 1.262-.225 1.645-.675.384-.46.576-1.053.576-1.778 0-.734-.192-1.327-.576-1.777-.373-.46-.921-.692-1.645-.692a2.18 2.18 0 0 0-1.015.235c-.147.075-.285.17-.415.282l-.15.142a2.086 2.086 0 0 0-.42.594c-.149.32-.223.685-.223 1.1v.115c0 .47.097.89.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.868.868 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.13 1.13 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013c.23-.087.472-.134.724-.14l.069-.002c.329 0 .542.033.642.099l.247-1.794c-.13-.066-.37-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2.086 2.086 0 0 0-.411.148 2.18 2.18 0 0 0-.4.249 2.482 2.482 0 0 0-.485.499 2.659 2.659 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884c0-.364.053-.678.159-.943a1.49 1.49 0 0 1 .466-.636 2.52 2.52 0 0 1 .399-.253 2.19 2.19 0 0 1 .224-.099zm9.784 2.656.05-.922c0-1.162-.285-2.062-.856-2.698-.559-.647-1.42-.97-2.584-.97-.746 0-1.415.163-2.007.493a3.462 3.462 0 0 0-1.4 1.382c-.329.604-.493 1.306-.493 2.106 0 .714.143 1.371.428 1.975.285.593.73 1.07 1.332 1.432.604.351 1.355.526 2.255.526.649 0 1.204-.062 1.668-.185l.044-.012.135-.04c.409-.122.736-.263.984-.421l-.542-1.267c-.2.108-.415.199-.642.274l-.297.087c-.34.088-.773.131-1.3.131-.636 0-1.135-.147-1.497-.444a1.573 1.573 0 0 1-.192-.193c-.244-.294-.415-.705-.512-1.234l-.004-.021h5.43zm-5.427-1.256-.003.022h3.752v-.138c-.007-.485-.104-.857-.288-1.118a1.056 1.056 0 0 0-.156-.176c-.307-.285-.746-.428-1.316-.428-.657 0-1.155.202-1.494.604-.253.3-.417.712-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81c-.68 0-1.311-.16-1.893-.478a3.795 3.795 0 0 1-1.381-1.382c-.34-.604-.51-1.306-.51-2.106 0-.79.147-1.482.444-2.074a3.364 3.364 0 0 1 1.3-1.382c.559-.33 1.217-.494 1.974-.494a3.293 3.293 0 0 1 1.234.231 3.341 3.341 0 0 1 .97.575c.264.22.44.439.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332c-.186.395-.526.746-1.02 1.053a3.167 3.167 0 0 1-1.662.444zm.296-1.482c.626 0 1.152-.214 1.58-.642.428-.44.642-1.01.642-1.711v-.115c0-.472-.098-.894-.296-1.267a2.211 2.211 0 0 0-.807-.872 2.098 2.098 0 0 0-1.119-.313c-.702 0-1.245.231-1.629.692-.384.45-.575 1.037-.575 1.76 0 .736.186 1.333.559 1.795.384.45.933.675 1.645.675zm6.521-6.237h1.711v1.4c.604-1.065 1.547-1.597 2.83-1.597 1.064 0 1.926.34 2.584 1.02.659.67.988 1.641.988 2.914 0 .79-.164 1.487-.493 2.09a3.456 3.456 0 0 1-1.316 1.399 3.51 3.51 0 0 1-1.844.493c-.636 0-1.19-.11-1.662-.329a2.665 2.665 0 0 1-1.086-.97l.017 5.134h-1.728V9.242zm4.048 6.22c.714 0 1.262-.224 1.645-.674.385-.46.576-1.048.576-1.762 0-.746-.192-1.338-.576-1.777-.372-.45-.92-.675-1.645-.675-.395 0-.768.098-1.12.296-.34.187-.613.46-.822.823-.197.351-.296.763-.296 1.234v.115c0 .472.098.894.296 1.267.209.362.483.647.823.855.34.197.713.297 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.159 1.159 0 0 1-.856-.346 1.165 1.165 0 0 1-.346-.856 1.053 1.053 0 0 1 .346-.79c.23-.219.516-.329.856-.329.329 0 .609.11.839.33a1.053 1.053 0 0 1 .345.79 1.159 1.159 0 0 1-.345.855c-.22.23-.5.346-.84.346zm7.875 9.133a3.167 3.167 0 0 1-1.662-.444c-.482-.307-.817-.658-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283c.186-.438.548-.812 1.086-1.119a3.486 3.486 0 0 1 1.778-.477c.746 0 1.393.17 1.942.51a3.235 3.235 0 0 1 1.283 1.4c.297.592.444 1.282.444 2.072 0 .8-.175 1.498-.526 2.09a3.52 3.52 0 0 1-1.382 1.366 3.785 3.785 0 0 1-1.876.477zm-.296-1.481c.713 0 1.26-.225 1.645-.675.384-.46.577-1.053.577-1.778 0-.734-.193-1.327-.577-1.776-.373-.46-.921-.692-1.645-.692a2.115 2.115 0 0 0-1.58.659c-.428.428-.642.992-.642 1.694v.115c0 .473.098.895.296 1.267a2.385 2.385 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481c.176-.505.46-.91.856-1.217a2.14 2.14 0 0 1 1.349-.46c.351 0 .593.032.724.098l-.247 1.794c-.099-.066-.313-.099-.642-.099-.516 0-.988.164-1.416.494-.417.329-.626.855-.626 1.58v3.883h-1.777V9.242zm9.534 7.718c-.9 0-1.651-.175-2.255-.526-.603-.362-1.047-.84-1.332-1.432a4.567 4.567 0 0 1-.428-1.975c0-.8.164-1.502.493-2.106a3.462 3.462 0 0 1 1.4-1.382c.592-.33 1.262-.494 2.007-.494 1.163 0 2.024.324 2.584.97.57.637.856 1.537.856 2.7 0 .296-.017.603-.05.92h-5.43c.12.67.356 1.153.708 1.45.362.296.86.443 1.497.443.526 0 .96-.044 1.3-.131a4.123 4.123 0 0 0 .938-.362l.542 1.267c-.274.175-.647.329-1.119.46-.472.132-1.042.197-1.711.197zm1.596-4.558c.01-.68-.137-1.158-.444-1.432-.307-.285-.746-.428-1.316-.428-1.152 0-1.815.62-1.991 1.86h3.752z'/%3E%3Cg fill-rule='evenodd' stroke-width='1.036'%3E%3Cpath fill='%23000' fill-opacity='.4' d='m8.166 16.146-.002.002a1.54 1.54 0 0 1-2.009 0l-.002-.002-.043-.034-.002-.002-.199-.162H4.377a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659H8.411l-.202.164zm-1.121-.905a.29.29 0 0 0 .113.023.286.286 0 0 0 .189-.07l.077-.063c.634-.508 4.672-3.743 4.672-7.575 0-2.55-2.215-4.625-4.938-4.625S2.221 5.006 2.221 7.556c0 3.225 2.86 6.027 4.144 7.137h.004l.04.038.484.4.077.063a.628.628 0 0 0 .074.047zm-2.52-.548a16.898 16.898 0 0 1-1.183-1.315C2.187 11.942.967 9.897.967 7.555c0-3.319 2.855-5.88 6.192-5.88 3.338 0 6.193 2.561 6.193 5.881 0 2.34-1.22 4.387-2.376 5.822a16.898 16.898 0 0 1-1.182 1.315h.15a1.912 1.912 0 0 1 1.914 1.914v1.84a1.912 1.912 0 0 1-1.914 1.914H4.377a1.912 1.912 0 0 1-1.914-1.914v-1.84a1.912 1.912 0 0 1 1.914-1.914zm3.82-6.935c0 .692-.55 1.222-1.187 1.222s-1.185-.529-1.185-1.222.548-1.222 1.185-1.222c.638 0 1.186.529 1.186 1.222zm-1.186 2.477c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477zm2.048 7.71H5.114v-.838h4.093z'/%3E%3Cpath fill='%23e1e3e9' d='M2.222 7.555c0-2.55 2.214-4.625 4.937-4.625 2.723 0 4.938 2.075 4.938 4.625 0 3.832-4.038 7.068-4.672 7.575l-.077.063a.286.286 0 0 1-.189.07.286.286 0 0 1-.188-.07l-.077-.063c-.634-.507-4.672-3.743-4.672-7.575zm4.937 2.68c1.348 0 2.442-1.11 2.442-2.478S8.507 5.28 7.159 5.28 4.72 6.39 4.72 7.758s1.092 2.477 2.44 2.477z'/%3E%3Cpath fill='%23fff' d='M4.377 15.948a.657.657 0 0 0-.659.659v1.84a.657.657 0 0 0 .659.659h5.565a.657.657 0 0 0 .659-.659v-1.84a.657.657 0 0 0-.659-.659zm4.83 1.16H5.114v.838h4.093z'/%3E%3C/g%3E%3C/svg%3E\")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:hsla(0,0%,100%,.5);margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:hsla(0,0%,100%,.5);background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:rgb(0 0 0/5%)}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (-ms-high-contrast:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\")}}@media screen and (-ms-high-contrast:black-on-white){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E\")}}.maplibregl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:hsla(0,0%,100%,.75);border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:rgb(0 0 0/5%)}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:\"\";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px rgba(0,0,0,.35);box-sizing:border-box;content:\"\";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:rgba(0,0,0,.4);color:#fff;display:flex;font-size:1.4em;inset:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(width <= 480px){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999}"
  },
  {
    "path": "test/maplibre/maplibre-gl.js",
    "content": "/* MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v3.1.0/LICENSE.txt */\n(function (global, factory) {\ntypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\ntypeof define === 'function' && define.amd ? define(factory) :\n(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.maplibregl = factory());\n})(this, (function () { 'use strict';\n\n/* eslint-disable */\n\nvar shared, worker, maplibregl;\n// define gets called three times: one for each chunk. we rely on the order\n// they're imported to know which is which\nfunction define(_, chunk) {\n    if (!shared) {\n        shared = chunk;\n    } else if (!worker) {\n        worker = chunk;\n    } else {\n        var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);'\n\n        var sharedChunk = {};\n        shared(sharedChunk);\n        maplibregl = chunk(sharedChunk);\n        if (typeof window !== 'undefined') {\n            maplibregl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' }));\n        }\n    }\n}\n\n\ndefine([\"exports\"],(function(t){\"use strict\";function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,\"default\")?t.default:t}var r=n;function n(t,e){this.x=t,this.y=e;}n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t};var i=e(r),a=s;function s(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n;}s.prototype={sampleCurveX:function(t){return ((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return ((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return (3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)<e)return r;var a=this.sampleCurveDerivativeX(r);if(Math.abs(a)<1e-6)break;r-=i/a;}var s=0,o=1;for(r=t,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-t)<e));n++)t>i?s=r:o=r,r=.5*(o-s)+s;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var o=e(a);function l(t,e,r,n){const i=new o(t,e,r,n);return function(t){return i.solve(t)}}const u=l(.25,.1,.25,1);function c(t,e,r){return Math.min(r,Math.max(e,t))}function h(t,e,r){const n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function p(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}let f=1;function d(t,e){t.forEach((t=>{e[t]&&(e[t]=e[t].bind(e));}));}function y(t,e,r){const n={};for(const i in t)n[i]=e.call(r||this,t[i],i,t);return n}function m(t,e,r){const n={};for(const i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n}function g(t){return Array.isArray(t)?t.map(g):\"object\"==typeof t&&t?y(t,g):t}const x={};function v(t){x[t]||(\"undefined\"!=typeof console&&console.warn(t),x[t]=!0);}function b(t,e,r){return (r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function w(t){let e=0;for(let r,n,i=0,a=t.length,s=a-1;i<a;s=i++)r=t[i],n=t[s],e+=(n.x-r.x)*(r.y+n.y);return e}function _(){return \"undefined\"!=typeof WorkerGlobalScope&&\"undefined\"!=typeof self&&self instanceof WorkerGlobalScope}let A=null;function k(t){if(null==A){const e=t.navigator?t.navigator.userAgent:null;A=!!t.safari||!(!e||!(/\\b(iPad|iPhone|iPod)\\b/.test(e)||e.match(\"Safari\")&&!e.match(\"Chrome\")));}return A}function S(t){return \"undefined\"!=typeof ImageBitmap&&t instanceof ImageBitmap}const I=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=\";let z,M;const P={now:\"undefined\"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(t){const e=requestAnimationFrame(t);return {cancel:()=>cancelAnimationFrame(e)}},getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){const e=window.document.createElement(\"canvas\"),r=e.getContext(\"2d\",{willReadFrequently:!0});if(!r)throw new Error(\"failed to create canvas 2d context\");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0,t.width,t.height),r},resolveURL:t=>(z||(z=document.createElement(\"a\")),z.href=t,z.href),hardwareConcurrency:\"undefined\"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return !!matchMedia&&(null==M&&(M=matchMedia(\"(prefers-reduced-motion: reduce)\")),M.matches)}},B={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:\"\"};class C extends Error{constructor(t,e,r,n){super(`AJAXError: ${e} (${t}): ${r}`),this.status=t,this.statusText=e,this.url=r,this.body=n;}}const V=_()?()=>self.worker&&self.worker.referrer:()=>(\"blob:\"===window.location.protocol?window.parent:window).location.href,E=t=>B.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf(\"://\"))];function F(t,e){const r=new AbortController,n=new Request(t.url,{method:t.method||\"GET\",body:t.body,credentials:t.credentials,headers:t.headers,referrer:V(),signal:r.signal});let i=!1,a=!1;\"json\"===t.type&&n.headers.set(\"Accept\",\"application/json\");return a||fetch(n).then((r=>r.ok?(r=>{(\"arrayBuffer\"===t.type||\"image\"===t.type?r.arrayBuffer():\"json\"===t.type?r.json():r.text()).then((t=>{a||(i=!0,e(null,t,r.headers.get(\"Cache-Control\"),r.headers.get(\"Expires\")));})).catch((t=>{a||e(new Error(t.message));}));})(r):r.blob().then((n=>e(new C(r.status,r.statusText,t.url,n)))))).catch((t=>{20!==t.code&&e(new Error(t.message));})),{cancel:()=>{a=!0,i||r.abort();}}}const T=function(t,e){if(/:\\/\\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(_()&&self.worker&&self.worker.actor)return self.worker.actor.send(\"getResource\",t,e);if(!_())return (E(t.url)||F)(t,e)}if(!(/^file:/.test(r=t.url)||/^file:/.test(V())&&!/^\\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,\"signal\"))return F(t,e);if(_()&&self.worker&&self.worker.actor)return self.worker.actor.send(\"getResource\",t,e,void 0,!0)}var r;return function(t,e){const r=new XMLHttpRequest;r.open(t.method||\"GET\",t.url,!0),\"arrayBuffer\"!==t.type&&\"image\"!==t.type||(r.responseType=\"arraybuffer\");for(const e in t.headers)r.setRequestHeader(e,t.headers[e]);return \"json\"===t.type&&(r.responseType=\"text\",r.setRequestHeader(\"Accept\",\"application/json\")),r.withCredentials=\"include\"===t.credentials,r.onerror=()=>{e(new Error(r.statusText));},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let n=r.response;if(\"json\"===t.type)try{n=JSON.parse(r.response);}catch(t){return e(t)}e(null,n,r.getResponseHeader(\"Cache-Control\"),r.getResponseHeader(\"Expires\"));}else {const n=new Blob([r.response],{type:r.getResponseHeader(\"Content-Type\")});e(new C(r.status,r.statusText,t.url,n));}},r.send(t.body),{cancel:()=>r.abort()}}(t,e)},L=function(t,e){return T(p(t,{type:\"arrayBuffer\"}),e)};function $(t){if(!t||t.indexOf(\"://\")<=0||0===t.indexOf(\"data:image/\")||0===t.indexOf(\"blob:\"))return !0;const e=new URL(t),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function D(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e));}function O(t,e,r){if(r&&r[t]){const n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1);}}class U{constructor(t,e={}){p(this,e),this.type=t;}}class R extends U{constructor(t,e={}){super(\"error\",p({error:t},e));}}class q{on(t,e){return this._listeners=this._listeners||{},D(t,e,this._listeners),this}off(t,e){return O(t,e,this._listeners),O(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},D(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){\"string\"==typeof t&&(t=new U(t,e||{}));const r=t.type;if(this.listens(r)){t.target=this;const e=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(const r of e)r.call(this,t);const n=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const e of n)O(r,e,this._oneTimeListeners),e.call(this,t);const i=this._eventedParent;i&&(p(t,\"function\"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(t));}else t instanceof R&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var j={$version:8,$root:{version:{required:!0,type:\"enum\",values:[8]},name:{type:\"string\"},metadata:{type:\"*\"},center:{type:\"array\",value:\"number\"},zoom:{type:\"number\"},bearing:{type:\"number\",default:0,period:360,units:\"degrees\"},pitch:{type:\"number\",default:0,units:\"degrees\"},light:{type:\"light\"},terrain:{type:\"terrain\"},sources:{required:!0,type:\"sources\"},sprite:{type:\"sprite\"},glyphs:{type:\"string\"},transition:{type:\"transition\"},layers:{required:!0,type:\"array\",value:\"layer\"}},sources:{\"*\":{type:\"source\"}},source:[\"source_vector\",\"source_raster\",\"source_raster_dem\",\"source_geojson\",\"source_video\",\"source_image\"],source_vector:{type:{required:!0,type:\"enum\",values:{vector:{}}},url:{type:\"string\"},tiles:{type:\"array\",value:\"string\"},bounds:{type:\"array\",value:\"number\",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:\"enum\",values:{xyz:{},tms:{}},default:\"xyz\"},minzoom:{type:\"number\",default:0},maxzoom:{type:\"number\",default:22},attribution:{type:\"string\"},promoteId:{type:\"promoteId\"},volatile:{type:\"boolean\",default:!1},\"*\":{type:\"*\"}},source_raster:{type:{required:!0,type:\"enum\",values:{raster:{}}},url:{type:\"string\"},tiles:{type:\"array\",value:\"string\"},bounds:{type:\"array\",value:\"number\",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:\"number\",default:0},maxzoom:{type:\"number\",default:22},tileSize:{type:\"number\",default:512,units:\"pixels\"},scheme:{type:\"enum\",values:{xyz:{},tms:{}},default:\"xyz\"},attribution:{type:\"string\"},volatile:{type:\"boolean\",default:!1},\"*\":{type:\"*\"}},source_raster_dem:{type:{required:!0,type:\"enum\",values:{\"raster-dem\":{}}},url:{type:\"string\"},tiles:{type:\"array\",value:\"string\"},bounds:{type:\"array\",value:\"number\",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:\"number\",default:0},maxzoom:{type:\"number\",default:22},tileSize:{type:\"number\",default:512,units:\"pixels\"},attribution:{type:\"string\"},encoding:{type:\"enum\",values:{terrarium:{},mapbox:{}},default:\"mapbox\"},volatile:{type:\"boolean\",default:!1},\"*\":{type:\"*\"}},source_geojson:{type:{required:!0,type:\"enum\",values:{geojson:{}}},data:{required:!0,type:\"*\"},maxzoom:{type:\"number\",default:18},attribution:{type:\"string\"},buffer:{type:\"number\",default:128,maximum:512,minimum:0},filter:{type:\"*\"},tolerance:{type:\"number\",default:.375},cluster:{type:\"boolean\",default:!1},clusterRadius:{type:\"number\",default:50,minimum:0},clusterMaxZoom:{type:\"number\"},clusterMinPoints:{type:\"number\"},clusterProperties:{type:\"*\"},lineMetrics:{type:\"boolean\",default:!1},generateId:{type:\"boolean\",default:!1},promoteId:{type:\"promoteId\"}},source_video:{type:{required:!0,type:\"enum\",values:{video:{}}},urls:{required:!0,type:\"array\",value:\"string\"},coordinates:{required:!0,type:\"array\",length:4,value:{type:\"array\",length:2,value:\"number\"}}},source_image:{type:{required:!0,type:\"enum\",values:{image:{}}},url:{required:!0,type:\"string\"},coordinates:{required:!0,type:\"array\",length:4,value:{type:\"array\",length:2,value:\"number\"}}},layer:{id:{type:\"string\",required:!0},type:{type:\"enum\",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},\"fill-extrusion\":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:\"*\"},source:{type:\"string\"},\"source-layer\":{type:\"string\"},minzoom:{type:\"number\",minimum:0,maximum:24},maxzoom:{type:\"number\",minimum:0,maximum:24},filter:{type:\"filter\"},layout:{type:\"layout\"},paint:{type:\"paint\"}},layout:[\"layout_fill\",\"layout_line\",\"layout_circle\",\"layout_heatmap\",\"layout_fill-extrusion\",\"layout_symbol\",\"layout_raster\",\"layout_hillshade\",\"layout_background\"],layout_background:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_fill:{\"fill-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_circle:{\"circle-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_heatmap:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},\"layout_fill-extrusion\":{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_line:{\"line-cap\":{type:\"enum\",values:{butt:{},round:{},square:{}},default:\"butt\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-join\":{type:\"enum\",values:{bevel:{},round:{},miter:{}},default:\"miter\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-miter-limit\":{type:\"number\",default:2,requires:[{\"line-join\":\"miter\"}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-round-limit\":{type:\"number\",default:1.05,requires:[{\"line-join\":\"round\"}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_symbol:{\"symbol-placement\":{type:\"enum\",values:{point:{},line:{},\"line-center\":{}},default:\"point\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-spacing\":{type:\"number\",default:250,minimum:1,units:\"pixels\",requires:[{\"symbol-placement\":\"line\"}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-avoid-edges\":{type:\"boolean\",default:!1,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"symbol-z-order\":{type:\"enum\",values:{auto:{},\"viewport-y\":{},source:{}},default:\"auto\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-allow-overlap\":{type:\"boolean\",default:!1,requires:[\"icon-image\",{\"!\":\"icon-overlap\"}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-overlap\":{type:\"enum\",values:{never:{},always:{},cooperative:{}},requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-ignore-placement\":{type:\"boolean\",default:!1,requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-optional\":{type:\"boolean\",default:!1,requires:[\"icon-image\",\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-rotation-alignment\":{type:\"enum\",values:{map:{},viewport:{},auto:{}},default:\"auto\",requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-size\":{type:\"number\",default:1,minimum:0,units:\"factor of the original icon size\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-text-fit\":{type:\"enum\",values:{none:{},width:{},height:{},both:{}},default:\"none\",requires:[\"icon-image\",\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-text-fit-padding\":{type:\"array\",value:\"number\",length:4,default:[0,0,0,0],units:\"pixels\",requires:[\"icon-image\",\"text-field\",{\"icon-text-fit\":[\"both\",\"width\",\"height\"]}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-image\":{type:\"resolvedImage\",tokens:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-rotate\":{type:\"number\",default:0,period:360,units:\"degrees\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-padding\":{type:\"padding\",default:[2],units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-keep-upright\":{type:\"boolean\",default:!1,requires:[\"icon-image\",{\"icon-rotation-alignment\":\"map\"},{\"symbol-placement\":[\"line\",\"line-center\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-offset\":{type:\"array\",value:\"number\",length:2,default:[0,0],requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-anchor\":{type:\"enum\",values:{center:{},left:{},right:{},top:{},bottom:{},\"top-left\":{},\"top-right\":{},\"bottom-left\":{},\"bottom-right\":{}},default:\"center\",requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-pitch-alignment\":{type:\"enum\",values:{map:{},viewport:{},auto:{}},default:\"auto\",requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-pitch-alignment\":{type:\"enum\",values:{map:{},viewport:{},auto:{}},default:\"auto\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-rotation-alignment\":{type:\"enum\",values:{map:{},viewport:{},\"viewport-glyph\":{},auto:{}},default:\"auto\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-field\":{type:\"formatted\",default:\"\",tokens:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-font\":{type:\"array\",value:\"string\",default:[\"Open Sans Regular\",\"Arial Unicode MS Regular\"],requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-size\":{type:\"number\",default:16,minimum:0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-max-width\":{type:\"number\",default:10,minimum:0,units:\"ems\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-line-height\":{type:\"number\",default:1.2,units:\"ems\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-letter-spacing\":{type:\"number\",default:0,units:\"ems\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-justify\":{type:\"enum\",values:{auto:{},left:{},center:{},right:{}},default:\"center\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-radial-offset\":{type:\"number\",units:\"ems\",default:0,requires:[\"text-field\"],\"property-type\":\"data-driven\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]}},\"text-variable-anchor\":{type:\"array\",value:\"enum\",values:{center:{},left:{},right:{},top:{},bottom:{},\"top-left\":{},\"top-right\":{},\"bottom-left\":{},\"bottom-right\":{}},requires:[\"text-field\",{\"symbol-placement\":[\"point\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-anchor\":{type:\"enum\",values:{center:{},left:{},right:{},top:{},bottom:{},\"top-left\":{},\"top-right\":{},\"bottom-left\":{},\"bottom-right\":{}},default:\"center\",requires:[\"text-field\",{\"!\":\"text-variable-anchor\"}],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-max-angle\":{type:\"number\",default:45,units:\"degrees\",requires:[\"text-field\",{\"symbol-placement\":[\"line\",\"line-center\"]}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-writing-mode\":{type:\"array\",value:\"enum\",values:{horizontal:{},vertical:{}},requires:[\"text-field\",{\"symbol-placement\":[\"point\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-rotate\":{type:\"number\",default:0,period:360,units:\"degrees\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-padding\":{type:\"number\",default:2,minimum:0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-keep-upright\":{type:\"boolean\",default:!0,requires:[\"text-field\",{\"text-rotation-alignment\":\"map\"},{\"symbol-placement\":[\"line\",\"line-center\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-transform\":{type:\"enum\",values:{none:{},uppercase:{},lowercase:{}},default:\"none\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-offset\":{type:\"array\",value:\"number\",units:\"ems\",length:2,default:[0,0],requires:[\"text-field\",{\"!\":\"text-radial-offset\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-allow-overlap\":{type:\"boolean\",default:!1,requires:[\"text-field\",{\"!\":\"text-overlap\"}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-overlap\":{type:\"enum\",values:{never:{},always:{},cooperative:{}},requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-ignore-placement\":{type:\"boolean\",default:!1,requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-optional\":{type:\"boolean\",default:!1,requires:[\"text-field\",\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_raster:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_hillshade:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},filter:{type:\"array\",value:\"*\"},filter_operator:{type:\"enum\",values:{\"==\":{},\"!=\":{},\">\":{},\">=\":{},\"<\":{},\"<=\":{},in:{},\"!in\":{},all:{},any:{},none:{},has:{},\"!has\":{},within:{}}},geometry_type:{type:\"enum\",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:\"expression\"},stops:{type:\"array\",value:\"function_stop\"},base:{type:\"number\",default:1,minimum:0},property:{type:\"string\",default:\"$zoom\"},type:{type:\"enum\",values:{identity:{},exponential:{},interval:{},categorical:{}},default:\"exponential\"},colorSpace:{type:\"enum\",values:{rgb:{},lab:{},hcl:{}},default:\"rgb\"},default:{type:\"*\",required:!1}},function_stop:{type:\"array\",minimum:0,maximum:24,value:[\"number\",\"color\"],length:2},expression:{type:\"array\",value:\"*\",minimum:1},light:{anchor:{type:\"enum\",default:\"viewport\",values:{map:{},viewport:{}},\"property-type\":\"data-constant\",transition:!1,expression:{interpolated:!1,parameters:[\"zoom\"]}},position:{type:\"array\",default:[1.15,210,30],length:3,value:\"number\",\"property-type\":\"data-constant\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]}},color:{type:\"color\",\"property-type\":\"data-constant\",default:\"#ffffff\",expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},intensity:{type:\"number\",\"property-type\":\"data-constant\",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0}},terrain:{source:{type:\"string\",required:!0},exaggeration:{type:\"number\",minimum:0,default:1}},paint:[\"paint_fill\",\"paint_line\",\"paint_circle\",\"paint_heatmap\",\"paint_fill-extrusion\",\"paint_symbol\",\"paint_raster\",\"paint_hillshade\",\"paint_background\"],paint_fill:{\"fill-antialias\":{type:\"boolean\",default:!0,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"fill-pattern\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-outline-color\":{type:\"color\",transition:!0,requires:[{\"!\":\"fill-pattern\"},{\"fill-antialias\":!0}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"fill-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"cross-faded-data-driven\"}},\"paint_fill-extrusion\":{\"fill-extrusion-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"fill-extrusion-pattern\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"fill-extrusion-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"cross-faded-data-driven\"},\"fill-extrusion-height\":{type:\"number\",default:0,minimum:0,units:\"meters\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-base\":{type:\"number\",default:0,minimum:0,units:\"meters\",transition:!0,requires:[\"fill-extrusion-height\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-vertical-gradient\":{type:\"boolean\",default:!0,transition:!1,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_line:{\"line-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"line-pattern\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"line-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-width\":{type:\"number\",default:1,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-gap-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-offset\":{type:\"number\",default:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-blur\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-dasharray\":{type:\"array\",value:\"number\",minimum:0,transition:!0,units:\"line widths\",requires:[{\"!\":\"line-pattern\"}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"cross-faded\"},\"line-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"cross-faded-data-driven\"},\"line-gradient\":{type:\"color\",transition:!1,requires:[{\"!\":\"line-dasharray\"},{\"!\":\"line-pattern\"},{source:\"geojson\",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:[\"line-progress\"]},\"property-type\":\"color-ramp\"}},paint_circle:{\"circle-radius\":{type:\"number\",default:5,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-blur\":{type:\"number\",default:0,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"circle-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-pitch-scale\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-pitch-alignment\":{type:\"enum\",values:{map:{},viewport:{}},default:\"viewport\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-stroke-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-stroke-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-stroke-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"}},paint_heatmap:{\"heatmap-radius\":{type:\"number\",default:30,minimum:1,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"heatmap-weight\":{type:\"number\",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"heatmap-intensity\":{type:\"number\",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"heatmap-color\":{type:\"color\",default:[\"interpolate\",[\"linear\"],[\"heatmap-density\"],0,\"rgba(0, 0, 255, 0)\",.1,\"royalblue\",.3,\"cyan\",.5,\"lime\",.7,\"yellow\",1,\"red\"],transition:!1,expression:{interpolated:!0,parameters:[\"heatmap-density\"]},\"property-type\":\"color-ramp\"},\"heatmap-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_symbol:{\"icon-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-color\":{type:\"color\",default:\"rgba(0, 0, 0, 0)\",transition:!0,requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-blur\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"icon-image\",\"icon-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-color\":{type:\"color\",default:\"#000000\",transition:!0,overridable:!0,requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-color\":{type:\"color\",default:\"rgba(0, 0, 0, 0)\",transition:!0,requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-blur\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"text-field\",\"text-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_raster:{\"raster-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-hue-rotate\":{type:\"number\",default:0,period:360,transition:!0,units:\"degrees\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-brightness-min\":{type:\"number\",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-brightness-max\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-saturation\":{type:\"number\",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-contrast\":{type:\"number\",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-resampling\":{type:\"enum\",values:{linear:{},nearest:{}},default:\"linear\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-fade-duration\":{type:\"number\",default:300,minimum:0,transition:!1,units:\"milliseconds\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_hillshade:{\"hillshade-illumination-direction\":{type:\"number\",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-illumination-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"viewport\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-exaggeration\":{type:\"number\",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-shadow-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-highlight-color\":{type:\"color\",default:\"#FFFFFF\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-accent-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_background:{\"background-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"background-pattern\"}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"background-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"cross-faded\"},\"background-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},transition:{duration:{type:\"number\",default:300,minimum:0,units:\"milliseconds\"},delay:{type:\"number\",default:0,minimum:0,units:\"milliseconds\"}},\"property-type\":{\"data-driven\":{type:\"property-type\"},\"cross-faded\":{type:\"property-type\"},\"cross-faded-data-driven\":{type:\"property-type\"},\"color-ramp\":{type:\"property-type\"},\"data-constant\":{type:\"property-type\"},constant:{type:\"property-type\"}},promoteId:{\"*\":{type:\"string\"}}};const N=[\"type\",\"source\",\"source-layer\",\"minzoom\",\"maxzoom\",\"filter\",\"layout\"];function Z(t,e){const r={};for(const e in t)\"ref\"!==e&&(r[e]=t[e]);return N.forEach((t=>{t in e&&(r[t]=e[t]);})),r}function K(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return !1;for(let r=0;r<t.length;r++)if(!K(t[r],e[r]))return !1;return !0}if(\"object\"==typeof t&&null!==t&&null!==e){if(\"object\"!=typeof e)return !1;if(Object.keys(t).length!==Object.keys(e).length)return !1;for(const r in t)if(!K(t[r],e[r]))return !1;return !0}return t===e}const G={setStyle:\"setStyle\",addLayer:\"addLayer\",removeLayer:\"removeLayer\",setPaintProperty:\"setPaintProperty\",setLayoutProperty:\"setLayoutProperty\",setFilter:\"setFilter\",addSource:\"addSource\",removeSource:\"removeSource\",setGeoJSONSourceData:\"setGeoJSONSourceData\",setLayerZoomRange:\"setLayerZoomRange\",setLayerProperty:\"setLayerProperty\",setCenter:\"setCenter\",setZoom:\"setZoom\",setBearing:\"setBearing\",setPitch:\"setPitch\",setSprite:\"setSprite\",setGlyphs:\"setGlyphs\",setTransition:\"setTransition\",setLight:\"setLight\"};function J(t,e,r){r.push({command:G.addSource,args:[t,e[t]]});}function X(t,e,r){e.push({command:G.removeSource,args:[t]}),r[t]=!0;}function Y(t,e,r,n){X(t,r,n),J(t,e,r);}function H(t,e,r){let n;for(n in t[r])if(Object.prototype.hasOwnProperty.call(t[r],n)&&\"data\"!==n&&!K(t[r][n],e[r][n]))return !1;for(n in e[r])if(Object.prototype.hasOwnProperty.call(e[r],n)&&\"data\"!==n&&!K(t[r][n],e[r][n]))return !1;return !0}function W(t,e,r,n,i,a){let s;for(s in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,s)&&(K(t[s],e[s])||r.push({command:a,args:[n,s,e[s],i]}));for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&!Object.prototype.hasOwnProperty.call(t,s)&&(K(t[s],e[s])||r.push({command:a,args:[n,s,e[s],i]}));}function Q(t){return t.id}function tt(t,e){return t[e.id]=e,t}class et{constructor(t,e,r,n){this.message=(t?`${t}: `:\"\")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__);}}function rt(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}class nt extends Error{constructor(t,e){super(e),this.message=e,this.key=t;}}class it{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,r]of e)this.bindings[t]=r;}concat(t){return new it(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return !!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const at={kind:\"null\"},st={kind:\"number\"},ot={kind:\"string\"},lt={kind:\"boolean\"},ut={kind:\"color\"},ct={kind:\"object\"},ht={kind:\"value\"},pt={kind:\"collator\"},ft={kind:\"formatted\"},dt={kind:\"padding\"},yt={kind:\"resolvedImage\"};function mt(t,e){return {kind:\"array\",itemType:t,N:e}}function gt(t){if(\"array\"===t.kind){const e=gt(t.itemType);return \"number\"==typeof t.N?`array<${e}, ${t.N}>`:\"value\"===t.itemType.kind?\"array\":`array<${e}>`}return t.kind}const xt=[at,st,ot,lt,ut,ft,ct,mt(ht),dt,yt];function vt(t,e){if(\"error\"===e.kind)return null;if(\"array\"===t.kind){if(\"array\"===e.kind&&(0===e.N&&\"value\"===e.itemType.kind||!vt(t.itemType,e.itemType))&&(\"number\"!=typeof t.N||t.N===e.N))return null}else {if(t.kind===e.kind)return null;if(\"value\"===t.kind)for(const t of xt)if(!vt(t,e))return null}return `Expected ${gt(t)} but found ${gt(e)} instead.`}function bt(t,e){return e.some((e=>e.kind===t.kind))}function wt(t,e){return e.some((e=>\"null\"===e?null===t:\"array\"===e?Array.isArray(t):\"object\"===e?t&&!Array.isArray(t)&&\"object\"==typeof t:e===typeof t))}function _t(t,e){return \"array\"===t.kind&&\"array\"===e.kind?t.itemType.kind===e.itemType.kind&&\"number\"==typeof t.N:t.kind===e.kind}const At=.96422,kt=.82521,St=4/29,It=6/29,zt=3*It*It,Mt=It*It*It,Pt=Math.PI/180,Bt=180/Math.PI;function Ct(t){return (t%=360)<0&&(t+=360),t}function Vt([t,e,r,n]){let i,a;const s=Ft((.2225045*(t=Et(t))+.7168786*(e=Et(e))+.0606169*(r=Et(r)))/1);t===e&&e===r?i=a=s:(i=Ft((.4360747*t+.3850649*e+.1430804*r)/At),a=Ft((.0139322*t+.0971045*e+.7141733*r)/kt));const o=116*s-16;return [o<0?0:o,500*(i-s),200*(s-a),n]}function Et(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ft(t){return t>Mt?Math.pow(t,1/3):t/zt+St}function Tt([t,e,r,n]){let i=(t+16)/116,a=isNaN(e)?i:i+e/500,s=isNaN(r)?i:i-r/200;return i=1*$t(i),a=At*$t(a),s=kt*$t(s),[Lt(3.1338561*a-1.6168667*i-.4906146*s),Lt(-.9787684*a+1.9161415*i+.033454*s),Lt(.0719453*a-.2289914*i+1.4052427*s),n]}function Lt(t){return (t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function $t(t){return t>It?t*t*t:zt*(t-St)}function Dt(t){return parseInt(t.padEnd(2,t),16)/255}function Ot(t,e){return Ut(e?t/100:t,0,1)}function Ut(t,e,r){return Math.min(Math.max(e,t),r)}function Rt(t){return !t.some(Number.isNaN)}const qt={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class jt{constructor(t,e,r,n=1,i=!0){this.r=t,this.g=e,this.b=r,this.a=n,i||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter(\"rgb\",[t,e,r,n]));}static parse(t){if(t instanceof jt)return t;if(\"string\"!=typeof t)return;const e=function(t){if(\"transparent\"===(t=t.toLowerCase()))return [0,0,0,0];const e=qt[t];if(e){const[t,r,n]=e;return [t/255,r/255,n/255,1]}if(t.startsWith(\"#\")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let r=1;return [Dt(t.slice(r,r+=e)),Dt(t.slice(r,r+=e)),Dt(t.slice(r,r+=e)),Dt(t.slice(r,r+e)||\"ff\")]}if(t.startsWith(\"rgb\")){const e=t.match(/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(e){const[t,r,n,i,a,s,o,l,u,c,h,p]=e,f=[i||\" \",o||\" \",c].join(\"\");if(\"  \"===f||\"  /\"===f||\",,\"===f||\",,,\"===f){const t=[n,s,u].join(\"\"),e=\"%%%\"===t?100:\"\"===t?255:0;if(e){const t=[Ut(+r/e,0,1),Ut(+a/e,0,1),Ut(+l/e,0,1),h?Ot(+h,p):1];if(Rt(t))return t}}return}}const r=t.match(/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(r){const[t,e,n,i,a,s,o,l,u]=r,c=[n||\" \",a||\" \",o].join(\"\");if(\"  \"===c||\"  /\"===c||\",,\"===c||\",,,\"===c){const t=[+e,Ut(+i,0,100),Ut(+s,0,100),l?Ot(+l,u):1];if(Rt(t))return function([t,e,r,n]){function i(n){const i=(n+t/30)%12,a=e*Math.min(r,1-r);return r-a*Math.max(-1,Math.min(i-3,9-i,1))}return t=Ct(t),e/=100,r/=100,[i(0),i(8),i(4),n]}(t)}}}(t);return e?new jt(...e,!1):void 0}get rgb(){const{r:t,g:e,b:r,a:n}=this,i=n||1/0;return this.overwriteGetter(\"rgb\",[t/i,e/i,r/i,n])}get hcl(){return this.overwriteGetter(\"hcl\",function(t){const[e,r,n,i]=Vt(t),a=Math.sqrt(r*r+n*n);return [Math.round(1e4*a)?Ct(Math.atan2(n,r)*Bt):NaN,a,e,i]}(this.rgb))}get lab(){return this.overwriteGetter(\"lab\",Vt(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,r,n]=this.rgb;return `rgba(${[t,e,r].map((t=>Math.round(255*t))).join(\",\")},${n})`}}jt.black=new jt(0,0,0,1),jt.white=new jt(1,1,1,1),jt.transparent=new jt(0,0,0,0),jt.red=new jt(1,0,0,1);class Nt{constructor(t,e,r){this.sensitivity=t?e?\"variant\":\"case\":e?\"accent\":\"base\",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:\"search\"});}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Zt{constructor(t,e,r,n,i){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i;}}class Kt{constructor(t){this.sections=t;}static fromString(t){return new Kt([new Zt(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof Kt?t:Kt.fromString(t)}toString(){return 0===this.sections.length?\"\":this.sections.map((t=>t.text)).join(\"\")}}class Gt{constructor(t){this.values=t.slice();}static parse(t){if(t instanceof Gt)return t;if(\"number\"==typeof t)return new Gt([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if(\"number\"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]];}return new Gt(t)}}toString(){return JSON.stringify(this.values)}}class Jt{constructor(t){this.name=t.name,this.available=t.available;}toString(){return this.name}static fromString(t){return t?new Jt({name:t,available:!1}):null}}function Xt(t,e,r,n){return \"number\"==typeof t&&t>=0&&t<=255&&\"number\"==typeof e&&e>=0&&e<=255&&\"number\"==typeof r&&r>=0&&r<=255?void 0===n||\"number\"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(\", \")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(\"number\"==typeof n?[t,e,r,n]:[t,e,r]).join(\", \")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Yt(t){if(null===t)return !0;if(\"string\"==typeof t)return !0;if(\"boolean\"==typeof t)return !0;if(\"number\"==typeof t)return !0;if(t instanceof jt)return !0;if(t instanceof Nt)return !0;if(t instanceof Kt)return !0;if(t instanceof Gt)return !0;if(t instanceof Jt)return !0;if(Array.isArray(t)){for(const e of t)if(!Yt(e))return !1;return !0}if(\"object\"==typeof t){for(const e in t)if(!Yt(t[e]))return !1;return !0}return !1}function Ht(t){if(null===t)return at;if(\"string\"==typeof t)return ot;if(\"boolean\"==typeof t)return lt;if(\"number\"==typeof t)return st;if(t instanceof jt)return ut;if(t instanceof Nt)return pt;if(t instanceof Kt)return ft;if(t instanceof Gt)return dt;if(t instanceof Jt)return yt;if(Array.isArray(t)){const e=t.length;let r;for(const e of t){const t=Ht(e);if(r){if(r===t)continue;r=ht;break}r=t;}return mt(r||ht,e)}return ct}function Wt(t){const e=typeof t;return null===t?\"\":\"string\"===e||\"number\"===e||\"boolean\"===e?String(t):t instanceof jt||t instanceof Kt||t instanceof Gt||t instanceof Jt?t.toString():JSON.stringify(t)}class Qt{constructor(t,e){this.type=t,this.value=e;}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Yt(t[1]))return e.error(\"invalid value\");const r=t[1];let n=Ht(r);const i=e.expectedType;return \"array\"!==n.kind||0!==n.N||!i||\"array\"!==i.kind||\"number\"==typeof i.N&&0!==i.N||(n=i),new Qt(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return !0}}class te{constructor(t){this.name=\"ExpressionEvaluationError\",this.message=t;}toJSON(){return this.message}}const ee={string:ot,number:st,boolean:lt,object:ct};class re{constructor(t,e){this.type=t,this.args=e;}static parse(t,e){if(t.length<2)return e.error(\"Expected at least one argument.\");let r,n=1;const i=t[0];if(\"array\"===i){let i,a;if(t.length>2){const r=t[1];if(\"string\"!=typeof r||!(r in ee)||\"object\"===r)return e.error('The item type argument of \"array\" must be one of string, number, boolean',1);i=ee[r],n++;}else i=ht;if(t.length>3){if(null!==t[2]&&(\"number\"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to \"array\" must be a positive integer literal',2);a=t[2],n++;}r=mt(i,a);}else {if(!ee[i])throw new Error(`Types doesn't contain name = ${i}`);r=ee[i];}const a=[];for(;n<t.length;n++){const r=e.parse(t[n],n,ht);if(!r)return null;a.push(r);}return new re(r,a)}evaluate(t){for(let e=0;e<this.args.length;e++){const r=this.args[e].evaluate(t);if(!vt(this.type,Ht(r)))return r;if(e===this.args.length-1)throw new te(`Expected value to be of type ${gt(this.type)}, but found ${gt(Ht(r))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t);}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const ne={\"to-boolean\":lt,\"to-color\":ut,\"to-number\":st,\"to-string\":ot};class ie{constructor(t,e){this.type=t,this.args=e;}static parse(t,e){if(t.length<2)return e.error(\"Expected at least one argument.\");const r=t[0];if(!ne[r])throw new Error(`Can't parse ${r} as it is not part of the known types`);if((\"to-boolean\"===r||\"to-string\"===r)&&2!==t.length)return e.error(\"Expected one argument.\");const n=ne[r],i=[];for(let r=1;r<t.length;r++){const n=e.parse(t[r],r,ht);if(!n)return null;i.push(n);}return new ie(n,i)}evaluate(t){if(\"boolean\"===this.type.kind)return Boolean(this.args[0].evaluate(t));if(\"color\"===this.type.kind){let e,r;for(const n of this.args){if(e=n.evaluate(t),r=null,e instanceof jt)return e;if(\"string\"==typeof e){const r=t.parseColor(e);if(r)return r}else if(Array.isArray(e)&&(r=e.length<3||e.length>4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Xt(e[0],e[1],e[2],e[3]),!r))return new jt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new te(r||`Could not parse color from value '${\"string\"==typeof e?e:JSON.stringify(e)}'`)}if(\"padding\"===this.type.kind){let e;for(const r of this.args){e=r.evaluate(t);const n=Gt.parse(e);if(n)return n}throw new te(`Could not parse padding from value '${\"string\"==typeof e?e:JSON.stringify(e)}'`)}if(\"number\"===this.type.kind){let e=null;for(const r of this.args){if(e=r.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new te(`Could not convert ${JSON.stringify(e)} to number.`)}return \"formatted\"===this.type.kind?Kt.fromString(Wt(this.args[0].evaluate(t))):\"resolvedImage\"===this.type.kind?Jt.fromString(Wt(this.args[0].evaluate(t))):Wt(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t);}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const ae=[\"Unknown\",\"Point\",\"LineString\",\"Polygon\"];class se{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null;}id(){return this.feature&&\"id\"in this.feature?this.feature.id:null}geometryType(){return this.feature?\"number\"==typeof this.feature.type?ae[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&\"geometry\"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=jt.parse(t)),e}}class oe{constructor(t,e,r=[],n,i=new it,a=[]){this.registry=t,this.path=r,this.key=r.map((t=>`[${t}]`)).join(\"\"),this.scope=i,this.errors=a,this.expectedType=n,this._isConstant=e;}parse(t,e,r,n,i={}){return e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)}_parse(t,e){function r(t,e,r){return \"assert\"===r?new re(e,[t]):\"coerce\"===r?new ie(e,[t]):t}if(null!==t&&\"string\"!=typeof t&&\"boolean\"!=typeof t&&\"number\"!=typeof t||(t=[\"literal\",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use [\"literal\", []].');const n=t[0];if(\"string\"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use [\"literal\", [...]].`,0),null;const i=this.registry[n];if(i){let n=i.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,i=n.type;if(\"string\"!==t.kind&&\"number\"!==t.kind&&\"boolean\"!==t.kind&&\"object\"!==t.kind&&\"array\"!==t.kind||\"value\"!==i.kind)if(\"color\"!==t.kind&&\"formatted\"!==t.kind&&\"resolvedImage\"!==t.kind||\"value\"!==i.kind&&\"string\"!==i.kind)if(\"padding\"!==t.kind||\"value\"!==i.kind&&\"number\"!==i.kind&&\"array\"!==i.kind){if(this.checkSubtype(t,i))return null}else n=r(n,t,e.typeAnnotation||\"coerce\");else n=r(n,t,e.typeAnnotation||\"coerce\");else n=r(n,t,e.typeAnnotation||\"assert\");}if(!(n instanceof Qt)&&\"resolvedImage\"!==n.type.kind&&this._isConstant(n)){const t=new se;try{n=new Qt(n.type,n.evaluate(t));}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression \"${n}\". If you wanted a literal array, use [\"literal\", [...]].`,0)}return this.error(void 0===t?\"'undefined' value invalid. Use null instead.\":\"object\"==typeof t?'Bare objects invalid. Use [\"literal\", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,r){const n=\"number\"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new oe(this.registry,this._isConstant,n,e||null,i,this.errors)}error(t,...e){const r=`${this.key}${e.map((t=>`[${t}]`)).join(\"\")}`;this.errors.push(new nt(r,t));}checkSubtype(t,e){const r=vt(t,e);return r&&this.error(r),r}}class le{constructor(t,e,r){this.type=pt,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e;}static parse(t,e){if(2!==t.length)return e.error(\"Expected one argument.\");const r=t[1];if(\"object\"!=typeof r||Array.isArray(r))return e.error(\"Collator options argument must be an object.\");const n=e.parse(void 0!==r[\"case-sensitive\"]&&r[\"case-sensitive\"],1,lt);if(!n)return null;const i=e.parse(void 0!==r[\"diacritic-sensitive\"]&&r[\"diacritic-sensitive\"],1,lt);if(!i)return null;let a=null;return r.locale&&(a=e.parse(r.locale,1,ot),!a)?null:new le(n,i,a)}evaluate(t){return new Nt(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale);}outputDefined(){return !1}}const ue=8192;function ce(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1]);}function he(t,e){return !(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function pe(t,e){const r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return [Math.round(r*i*ue),Math.round(n*i*ue)]}function fe(t,e,r){const n=t[0]-e[0],i=t[1]-e[1],a=t[0]-r[0],s=t[1]-r[1];return n*s-a*i==0&&n*a<=0&&i*s<=0}function de(t,e){let r=!1;for(let s=0,o=e.length;s<o;s++){const o=e[s];for(let e=0,s=o.length;e<s-1;e++){if(fe(t,o[e],o[e+1]))return !1;(i=o[e])[1]>(n=t)[1]!=(a=o[e+1])[1]>n[1]&&n[0]<(a[0]-i[0])*(n[1]-i[1])/(a[1]-i[1])+i[0]&&(r=!r);}}var n,i,a;return r}function ye(t,e){for(let r=0;r<e.length;r++)if(de(t,e[r]))return !0;return !1}function me(t,e,r,n){const i=n[0]-r[0],a=n[1]-r[1],s=(t[0]-r[0])*a-i*(t[1]-r[1]),o=(e[0]-r[0])*a-i*(e[1]-r[1]);return s>0&&o<0||s<0&&o>0}function ge(t,e,r){for(const u of r)for(let r=0;r<u.length-1;++r)if(0!=(o=[(s=u[r+1])[0]-(a=u[r])[0],s[1]-a[1]])[0]*(l=[(i=e)[0]-(n=t)[0],i[1]-n[1]])[1]-o[1]*l[0]&&me(n,i,a,s)&&me(a,s,n,i))return !0;var n,i,a,s,o,l;return !1}function xe(t,e){for(let r=0;r<t.length;++r)if(!de(t[r],e))return !1;for(let r=0;r<t.length-1;++r)if(ge(t[r],t[r+1],e))return !1;return !0}function ve(t,e){for(let r=0;r<e.length;r++)if(xe(t,e[r]))return !0;return !1}function be(t,e,r){const n=[];for(let i=0;i<t.length;i++){const a=[];for(let n=0;n<t[i].length;n++){const s=pe(t[i][n],r);ce(e,s),a.push(s);}n.push(a);}return n}function we(t,e,r){const n=[];for(let i=0;i<t.length;i++){const a=be(t[i],e,r);n.push(a);}return n}function _e(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){const e=.5*n;let i=t[0]-r[0]>e?-n:r[0]-t[0]>e?n:0;0===i&&(i=t[0]-r[2]>e?-n:r[2]-t[0]>e?n:0),t[0]+=i;}ce(e,t);}function Ae(t,e,r,n){const i=Math.pow(2,n.z)*ue,a=[n.x*ue,n.y*ue],s=[];for(const n of t)for(const t of n){const n=[t.x+a[0],t.y+a[1]];_e(n,e,r,i),s.push(n);}return s}function ke(t,e,r,n){const i=Math.pow(2,n.z)*ue,a=[n.x*ue,n.y*ue],s=[];for(const r of t){const t=[];for(const n of r){const r=[n.x+a[0],n.y+a[1]];ce(e,r),t.push(r);}s.push(t);}if(e[2]-e[0]<=i/2){(o=e)[0]=o[1]=1/0,o[2]=o[3]=-1/0;for(const t of s)for(const n of t)_e(n,e,r,i);}var o;return s}class Se{constructor(t,e){this.type=lt,this.geojson=t,this.geometries=e;}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Yt(t[1])){const e=t[1];if(\"FeatureCollection\"===e.type)for(let t=0;t<e.features.length;++t){const r=e.features[t].geometry.type;if(\"Polygon\"===r||\"MultiPolygon\"===r)return new Se(e,e.features[t].geometry)}else if(\"Feature\"===e.type){const t=e.geometry.type;if(\"Polygon\"===t||\"MultiPolygon\"===t)return new Se(e,e.geometry)}else if(\"Polygon\"===e.type||\"MultiPolygon\"===e.type)return new Se(e,e)}return e.error(\"'within' expression requires valid geojson object that contains polygon geometry type.\")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if(\"Point\"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(\"Polygon\"===e.type){const a=be(e.coordinates,n,i),s=Ae(t.geometry(),r,n,i);if(!he(r,n))return !1;for(const t of s)if(!de(t,a))return !1}if(\"MultiPolygon\"===e.type){const a=we(e.coordinates,n,i),s=Ae(t.geometry(),r,n,i);if(!he(r,n))return !1;for(const t of s)if(!ye(t,a))return !1}return !0}(t,this.geometries);if(\"LineString\"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(\"Polygon\"===e.type){const a=be(e.coordinates,n,i),s=ke(t.geometry(),r,n,i);if(!he(r,n))return !1;for(const t of s)if(!xe(t,a))return !1}if(\"MultiPolygon\"===e.type){const a=we(e.coordinates,n,i),s=ke(t.geometry(),r,n,i);if(!he(r,n))return !1;for(const t of s)if(!ve(t,a))return !1}return !0}(t,this.geometries)}return !1}eachChild(){}outputDefined(){return !0}}class Ie{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e;}static parse(t,e){if(2!==t.length||\"string\"!=typeof t[1])return e.error(\"'var' expression requires exactly one string literal argument.\");const r=t[1];return e.scope.has(r)?new Ie(r,e.scope.get(r)):e.error(`Unknown variable \"${r}\". Make sure \"${r}\" has been bound in an enclosing \"let\" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return !1}}class ze{constructor(t,e,r,n){this.name=t,this.type=e,this._evaluate=r,this.args=n;}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t);}outputDefined(){return !1}static parse(t,e){const r=t[0],n=ze.definitions[r];if(!n)return e.error(`Unknown expression \"${r}\". If you wanted a literal array, use [\"literal\", [...]].`,0);const i=Array.isArray(n)?n[0]:n.type,a=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,s=a.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let o=null;for(const[n,a]of s){o=new oe(e.registry,Me,e.path,null,e.scope);const s=[];let l=!1;for(let e=1;e<t.length;e++){const r=t[e],i=Array.isArray(n)?n[e-1]:n.type,a=o.parse(r,1+s.length,i);if(!a){l=!0;break}s.push(a);}if(!l)if(Array.isArray(n)&&n.length!==s.length)o.error(`Expected ${n.length} arguments, but found ${s.length} instead.`);else {for(let t=0;t<s.length;t++){const e=Array.isArray(n)?n[t]:n.type,r=s[t];o.concat(t+1).checkSubtype(e,r.type);}if(0===o.errors.length)return new ze(r,i,a,s)}}if(1===s.length)e.errors.push(...o.errors);else {const r=(s.length?s:a).map((([t])=>{return e=t,Array.isArray(e)?`(${e.map(gt).join(\", \")})`:`(${gt(e.type)}...)`;var e;})).join(\" | \"),n=[];for(let r=1;r<t.length;r++){const i=e.parse(t[r],1+n.length);if(!i)return null;n.push(gt(i.type));}e.error(`Expected arguments of type ${r}, but found (${n.join(\", \")}) instead.`);}return null}static register(t,e){ze.definitions=e;for(const r in e)t[r]=ze;}}function Me(t){if(t instanceof Ie)return Me(t.boundExpression);if(t instanceof ze&&\"error\"===t.name)return !1;if(t instanceof le)return !1;if(t instanceof Se)return !1;const e=t instanceof ie||t instanceof re;let r=!0;return t.eachChild((t=>{r=e?r&&Me(t):r&&t instanceof Qt;})),!!r&&Pe(t)&&Ce(t,[\"zoom\",\"heatmap-density\",\"line-progress\",\"accumulated\",\"is-supported-script\"])}function Pe(t){if(t instanceof ze){if(\"get\"===t.name&&1===t.args.length)return !1;if(\"feature-state\"===t.name)return !1;if(\"has\"===t.name&&1===t.args.length)return !1;if(\"properties\"===t.name||\"geometry-type\"===t.name||\"id\"===t.name)return !1;if(/^filter-/.test(t.name))return !1}if(t instanceof Se)return !1;let e=!0;return t.eachChild((t=>{e&&!Pe(t)&&(e=!1);})),e}function Be(t){if(t instanceof ze&&\"feature-state\"===t.name)return !1;let e=!0;return t.eachChild((t=>{e&&!Be(t)&&(e=!1);})),e}function Ce(t,e){if(t instanceof ze&&e.indexOf(t.name)>=0)return !1;let r=!0;return t.eachChild((t=>{r&&!Ce(t,e)&&(r=!1);})),r}function Ve(t,e){const r=t.length-1;let n,i,a=0,s=r,o=0;for(;a<=s;)if(o=Math.floor((a+s)/2),n=t[o],i=t[o+1],n<=e){if(o===r||e<i)return o;a=o+1;}else {if(!(n>e))throw new te(\"Input is not a number.\");s=o-1;}return 0}class Ee{constructor(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e);}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error(\"Expected an even number of arguments.\");const r=e.parse(t[1],1,st);if(!r)return null;const n=[];let i=null;e.expectedType&&\"value\"!==e.expectedType.kind&&(i=e.expectedType);for(let r=1;r<t.length;r+=2){const a=1===r?-1/0:t[r],s=t[r+1],o=r,l=r+1;if(\"number\"!=typeof a)return e.error('Input/output pairs for \"step\" expressions must be defined using literal numeric values (not computed expressions) for the input values.',o);if(n.length&&n[n.length-1][0]>=a)return e.error('Input/output pairs for \"step\" expressions must be arranged with input values in strictly ascending order.',o);const u=e.parse(s,l,i);if(!u)return null;i=i||u.type,n.push([a,u]);}return new Ee(i,r,n)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[Ve(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e);}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Fe(t,e,r){return t+r*(e-t)}function Te(t,e,r){return t.map(((t,n)=>Fe(t,e[n],r)))}const Le={number:Fe,color:function(t,e,r,n=\"rgb\"){switch(n){case\"rgb\":{const[n,i,a,s]=Te(t.rgb,e.rgb,r);return new jt(n,i,a,s,!1)}case\"hcl\":{const[n,i,a,s]=t.hcl,[o,l,u,c]=e.hcl;let h,p;if(isNaN(n)||isNaN(o))isNaN(n)?isNaN(o)?h=NaN:(h=o,1!==a&&0!==a||(p=l)):(h=n,1!==u&&0!==u||(p=i));else {let t=o-n;o>n&&t>180?t-=360:o<n&&n-o>180&&(t+=360),h=n+r*t;}const[f,d,y,m]=function([t,e,r,n]){return t=isNaN(t)?0:t*Pt,Tt([r,Math.cos(t)*e,Math.sin(t)*e,n])}([h,null!=p?p:Fe(i,l,r),Fe(a,u,r),Fe(s,c,r)]);return new jt(f,d,y,m,!1)}case\"lab\":{const[n,i,a,s]=Tt(Te(t.lab,e.lab,r));return new jt(n,i,a,s,!1)}}},array:Te,padding:function(t,e,r){return new Gt(Te(t.values,e.values,r))}};class $e{constructor(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e);}static interpolationFactor(t,e,r,n){let i=0;if(\"exponential\"===t.name)i=De(e,t.base,r,n);else if(\"linear\"===t.name)i=De(e,1,r,n);else if(\"cubic-bezier\"===t.name){const a=t.controlPoints;i=new o(a[0],a[1],a[2],a[3]).solve(De(e,1,r,n));}return i}static parse(t,e){let[r,n,i,...a]=t;if(!Array.isArray(n)||0===n.length)return e.error(\"Expected an interpolation type expression.\",1);if(\"linear\"===n[0])n={name:\"linear\"};else if(\"exponential\"===n[0]){const t=n[1];if(\"number\"!=typeof t)return e.error(\"Exponential interpolation requires a numeric base.\",1,1);n={name:\"exponential\",base:t};}else {if(\"cubic-bezier\"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some((t=>\"number\"!=typeof t||t<0||t>1)))return e.error(\"Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.\",1);n={name:\"cubic-bezier\",controlPoints:t};}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error(\"Expected an even number of arguments.\");if(i=e.parse(i,2,st),!i)return null;const s=[];let o=null;\"interpolate-hcl\"===r||\"interpolate-lab\"===r?o=ut:e.expectedType&&\"value\"!==e.expectedType.kind&&(o=e.expectedType);for(let t=0;t<a.length;t+=2){const r=a[t],n=a[t+1],i=t+3,l=t+4;if(\"number\"!=typeof r)return e.error('Input/output pairs for \"interpolate\" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(s.length&&s[s.length-1][0]>=r)return e.error('Input/output pairs for \"interpolate\" expressions must be arranged with input values in strictly ascending order.',i);const u=e.parse(n,l,o);if(!u)return null;o=o||u.type,s.push([r,u]);}return _t(o,st)||_t(o,ut)||_t(o,dt)||_t(o,mt(st))?new $e(o,r,n,i,s):e.error(`Type ${gt(o)} is not interpolatable.`)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);const a=Ve(e,n),s=$e.interpolationFactor(this.interpolation,n,e[a],e[a+1]),o=r[a].evaluate(t),l=r[a+1].evaluate(t);switch(this.operator){case\"interpolate\":return Le[this.type.kind](o,l,s);case\"interpolate-hcl\":return Le.color(o,l,s,\"hcl\");case\"interpolate-lab\":return Le.color(o,l,s,\"lab\")}}eachChild(t){t(this.input);for(const e of this.outputs)t(e);}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function De(t,e,r,n){const i=n-r,a=t-r;return 0===i?0:1===e?a/i:(Math.pow(e,a)-1)/(Math.pow(e,i)-1)}class Oe{constructor(t,e){this.type=t,this.args=e;}static parse(t,e){if(t.length<2)return e.error(\"Expectected at least one argument.\");let r=null;const n=e.expectedType;n&&\"value\"!==n.kind&&(r=n);const i=[];for(const n of t.slice(1)){const t=e.parse(n,1+i.length,r,void 0,{typeAnnotation:\"omit\"});if(!t)return null;r=r||t.type,i.push(t);}if(!r)throw new Error(\"No output type\");const a=n&&i.some((t=>vt(n,t.type)));return new Oe(a?ht:r,i)}evaluate(t){let e,r=null,n=0;for(const i of this.args)if(n++,r=i.evaluate(t),r&&r instanceof Jt&&!r.available&&(e||(e=r.name),r=null,n===this.args.length&&(r=e)),null!==r)break;return r}eachChild(t){this.args.forEach(t);}outputDefined(){return this.args.every((t=>t.outputDefined()))}}class Ue{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e;}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result);}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const r=[];for(let n=1;n<t.length-1;n+=2){const i=t[n];if(\"string\"!=typeof i)return e.error(`Expected string, but found ${typeof i} instead.`,n);if(/[^a-zA-Z0-9_]/.test(i))return e.error(\"Variable names must contain only alphanumeric characters or '_'.\",n);const a=e.parse(t[n+1],n+1);if(!a)return null;r.push([i,a]);}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,r);return n?new Ue(r,n):null}outputDefined(){return this.result.outputDefined()}}class Re{constructor(t,e,r){this.type=t,this.index=e,this.input=r;}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,st),n=e.parse(t[2],2,mt(e.expectedType||ht));return r&&n?new Re(n.type.itemType,r,n):null}evaluate(t){const e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new te(`Array index out of bounds: ${e} < 0.`);if(e>=r.length)throw new te(`Array index out of bounds: ${e} > ${r.length-1}.`);if(e!==Math.floor(e))throw new te(`Array index must be an integer, but found ${e} instead.`);return r[e]}eachChild(t){t(this.index),t(this.input);}outputDefined(){return !1}}class qe{constructor(t,e){this.type=lt,this.needle=t,this.haystack=e;}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,ht),n=e.parse(t[2],2,ht);return r&&n?bt(r.type,[lt,ot,st,at,ht])?new qe(r,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${gt(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return !1;if(!wt(e,[\"boolean\",\"string\",\"number\",\"null\"]))throw new te(`Expected first argument to be of type boolean, string, number or null, but found ${gt(Ht(e))} instead.`);if(!wt(r,[\"string\",\"array\"]))throw new te(`Expected second argument to be of type array or string, but found ${gt(Ht(r))} instead.`);return r.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack);}outputDefined(){return !0}}class je{constructor(t,e,r){this.type=st,this.needle=t,this.haystack=e,this.fromIndex=r;}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,ht),n=e.parse(t[2],2,ht);if(!r||!n)return null;if(!bt(r.type,[lt,ot,st,at,ht]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${gt(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,st);return i?new je(r,n,i):null}return new je(r,n)}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!wt(e,[\"boolean\",\"string\",\"number\",\"null\"]))throw new te(`Expected first argument to be of type boolean, string, number or null, but found ${gt(Ht(e))} instead.`);if(!wt(r,[\"string\",\"array\"]))throw new te(`Expected second argument to be of type array or string, but found ${gt(Ht(r))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex);}outputDefined(){return !1}}class Ne{constructor(t,e,r,n,i,a){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=a;}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error(\"Expected an even number of arguments.\");let r,n;e.expectedType&&\"value\"!==e.expectedType.kind&&(n=e.expectedType);const i={},a=[];for(let s=2;s<t.length-1;s+=2){let o=t[s];const l=t[s+1];Array.isArray(o)||(o=[o]);const u=e.concat(s);if(0===o.length)return u.error(\"Expected at least one branch label.\");for(const t of o){if(\"number\"!=typeof t&&\"string\"!=typeof t)return u.error(\"Branch labels must be numbers or strings.\");if(\"number\"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(\"number\"==typeof t&&Math.floor(t)!==t)return u.error(\"Numeric branch labels must be integer values.\");if(r){if(u.checkSubtype(r,Ht(t)))return null}else r=Ht(t);if(void 0!==i[String(t)])return u.error(\"Branch labels must be unique.\");i[String(t)]=a.length;}const c=e.parse(l,s,n);if(!c)return null;n=n||c.type,a.push(c);}const s=e.parse(t[1],1,ht);if(!s)return null;const o=e.parse(t[t.length-1],t.length-1,n);return o?\"value\"!==s.type.kind&&e.concat(1).checkSubtype(r,s.type)?null:new Ne(r,n,s,i,a,o):null}evaluate(t){const e=this.input.evaluate(t);return (Ht(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise);}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}}class Ze{constructor(t,e,r){this.type=t,this.branches=e,this.otherwise=r;}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error(\"Expected an odd number of arguments.\");let r;e.expectedType&&\"value\"!==e.expectedType.kind&&(r=e.expectedType);const n=[];for(let i=1;i<t.length-1;i+=2){const a=e.parse(t[i],i,lt);if(!a)return null;const s=e.parse(t[i+1],i+1,r);if(!s)return null;n.push([a,s]),r=r||s.type;}const i=e.parse(t[t.length-1],t.length-1,r);if(!i)return null;if(!r)throw new Error(\"Can't infer output type\");return new Ze(r,n,i)}evaluate(t){for(const[e,r]of this.branches)if(e.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,r]of this.branches)t(e),t(r);t(this.otherwise);}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}}class Ke{constructor(t,e,r,n){this.type=t,this.input=e,this.beginIndex=r,this.endIndex=n;}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,ht),n=e.parse(t[2],2,st);if(!r||!n)return null;if(!bt(r.type,[mt(ht),ot,ht]))return e.error(`Expected first argument to be of type array or string, but found ${gt(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,st);return i?new Ke(r.type,r,n,i):null}return new Ke(r.type,r,n)}evaluate(t){const e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!wt(e,[\"string\",\"array\"]))throw new te(`Expected first argument to be of type array or string, but found ${gt(Ht(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex);}outputDefined(){return !1}}function Ge(t,e){return \"==\"===t||\"!=\"===t?\"boolean\"===e.kind||\"string\"===e.kind||\"number\"===e.kind||\"null\"===e.kind||\"value\"===e.kind:\"string\"===e.kind||\"number\"===e.kind||\"value\"===e.kind}function Je(t,e,r,n){return 0===n.compare(e,r)}function Xe(t,e,r){const n=\"==\"!==t&&\"!=\"!==t;return class i{constructor(t,e,r){this.type=lt,this.lhs=t,this.rhs=e,this.collator=r,this.hasUntypedArgument=\"value\"===t.type.kind||\"value\"===e.type.kind;}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error(\"Expected two or three arguments.\");const r=t[0];let a=e.parse(t[1],1,ht);if(!a)return null;if(!Ge(r,a.type))return e.concat(1).error(`\"${r}\" comparisons are not supported for type '${gt(a.type)}'.`);let s=e.parse(t[2],2,ht);if(!s)return null;if(!Ge(r,s.type))return e.concat(2).error(`\"${r}\" comparisons are not supported for type '${gt(s.type)}'.`);if(a.type.kind!==s.type.kind&&\"value\"!==a.type.kind&&\"value\"!==s.type.kind)return e.error(`Cannot compare types '${gt(a.type)}' and '${gt(s.type)}'.`);n&&(\"value\"===a.type.kind&&\"value\"!==s.type.kind?a=new re(s.type,[a]):\"value\"!==a.type.kind&&\"value\"===s.type.kind&&(s=new re(a.type,[s])));let o=null;if(4===t.length){if(\"string\"!==a.type.kind&&\"string\"!==s.type.kind&&\"value\"!==a.type.kind&&\"value\"!==s.type.kind)return e.error(\"Cannot use collator to compare non-string types.\");if(o=e.parse(t[3],3,pt),!o)return null}return new i(a,s,o)}evaluate(i){const a=this.lhs.evaluate(i),s=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){const e=Ht(a),r=Ht(s);if(e.kind!==r.kind||\"string\"!==e.kind&&\"number\"!==e.kind)throw new te(`Expected arguments for \"${t}\" to be (string, string) or (number, number), but found (${e.kind}, ${r.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=Ht(a),r=Ht(s);if(\"string\"!==t.kind||\"string\"!==r.kind)return e(i,a,s)}return this.collator?r(i,a,s,this.collator.evaluate(i)):e(i,a,s)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator);}outputDefined(){return !0}}}const Ye=Xe(\"==\",(function(t,e,r){return e===r}),Je),He=Xe(\"!=\",(function(t,e,r){return e!==r}),(function(t,e,r,n){return !Je(0,e,r,n)})),We=Xe(\"<\",(function(t,e,r){return e<r}),(function(t,e,r,n){return n.compare(e,r)<0})),Qe=Xe(\">\",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),tr=Xe(\"<=\",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),er=Xe(\">=\",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0}));class rr{constructor(t,e,r,n,i){this.type=ot,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=i;}static parse(t,e){if(3!==t.length)return e.error(\"Expected two arguments.\");const r=e.parse(t[1],1,st);if(!r)return null;const n=t[2];if(\"object\"!=typeof n||Array.isArray(n))return e.error(\"NumberFormat options argument must be an object.\");let i=null;if(n.locale&&(i=e.parse(n.locale,1,ot),!i))return null;let a=null;if(n.currency&&(a=e.parse(n.currency,1,ot),!a))return null;let s=null;if(n[\"min-fraction-digits\"]&&(s=e.parse(n[\"min-fraction-digits\"],1,st),!s))return null;let o=null;return n[\"max-fraction-digits\"]&&(o=e.parse(n[\"max-fraction-digits\"],1,st),!o)?null:new rr(r,i,a,s,o)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?\"currency\":\"decimal\",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits);}outputDefined(){return !1}}class nr{constructor(t){this.type=ft,this.sections=t;}static parse(t,e){if(t.length<2)return e.error(\"Expected at least one argument.\");const r=t[1];if(!Array.isArray(r)&&\"object\"==typeof r)return e.error(\"First argument must be an image or text section.\");const n=[];let i=!1;for(let r=1;r<=t.length-1;++r){const a=t[r];if(i&&\"object\"==typeof a&&!Array.isArray(a)){i=!1;let t=null;if(a[\"font-scale\"]&&(t=e.parse(a[\"font-scale\"],1,st),!t))return null;let r=null;if(a[\"text-font\"]&&(r=e.parse(a[\"text-font\"],1,mt(ot)),!r))return null;let s=null;if(a[\"text-color\"]&&(s=e.parse(a[\"text-color\"],1,ut),!s))return null;const o=n[n.length-1];o.scale=t,o.font=r,o.textColor=s;}else {const a=e.parse(t[r],1,ht);if(!a)return null;const s=a.type.kind;if(\"string\"!==s&&\"value\"!==s&&\"null\"!==s&&\"resolvedImage\"!==s)return e.error(\"Formatted text type must be 'string', 'value', 'image' or 'null'.\");i=!0,n.push({content:a,scale:null,font:null,textColor:null});}}return new nr(n)}evaluate(t){return new Kt(this.sections.map((e=>{const r=e.content.evaluate(t);return Ht(r)===yt?new Zt(\"\",r,null,null,null):new Zt(Wt(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(\",\"):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor);}outputDefined(){return !1}}class ir{constructor(t){this.type=yt,this.input=t;}static parse(t,e){if(2!==t.length)return e.error(\"Expected two arguments.\");const r=e.parse(t[1],1,ot);return r?new ir(r):e.error(\"No image name provided.\")}evaluate(t){const e=this.input.evaluate(t),r=Jt.fromString(e);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(e)>-1),r}eachChild(t){t(this.input);}outputDefined(){return !1}}class ar{constructor(t){this.type=st,this.input=t;}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=e.parse(t[1],1);return r?\"array\"!==r.type.kind&&\"string\"!==r.type.kind&&\"value\"!==r.type.kind?e.error(`Expected argument of type string or array, but found ${gt(r.type)} instead.`):new ar(r):null}evaluate(t){const e=this.input.evaluate(t);if(\"string\"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new te(`Expected value to be of type string or array, but found ${gt(Ht(e))} instead.`)}eachChild(t){t(this.input);}outputDefined(){return !1}}const sr={\"==\":Ye,\"!=\":He,\">\":Qe,\"<\":We,\">=\":er,\"<=\":tr,array:re,at:Re,boolean:re,case:Ze,coalesce:Oe,collator:le,format:nr,image:ir,in:qe,\"index-of\":je,interpolate:$e,\"interpolate-hcl\":$e,\"interpolate-lab\":$e,length:ar,let:Ue,literal:Qt,match:Ne,number:re,\"number-format\":rr,object:re,slice:Ke,step:Ee,string:re,\"to-boolean\":ie,\"to-color\":ie,\"to-number\":ie,\"to-string\":ie,var:Ie,within:Se};function or(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);const a=i?i.evaluate(t):1,s=Xt(e,r,n,a);if(s)throw new te(s);return new jt(e/255,r/255,n/255,a,!1)}function lr(t,e){return t in e}function ur(t,e){const r=e[t];return void 0===r?null:r}function cr(t){return {type:t}}function hr(t){return {result:\"success\",value:t}}function pr(t){return {result:\"error\",value:t}}function fr(t){return \"data-driven\"===t[\"property-type\"]||\"cross-faded-data-driven\"===t[\"property-type\"]}function dr(t){return !!t.expression&&t.expression.parameters.indexOf(\"zoom\")>-1}function yr(t){return !!t.expression&&t.expression.interpolated}function mr(t){return t instanceof Number?\"number\":t instanceof String?\"string\":t instanceof Boolean?\"boolean\":Array.isArray(t)?\"array\":null===t?\"null\":typeof t}function gr(t){return \"object\"==typeof t&&null!==t&&!Array.isArray(t)}function xr(t){return t}function vr(t,e){const r=\"color\"===e.type,n=t.stops&&\"object\"==typeof t.stops[0][0],i=n||!(n||void 0!==t.property),a=t.type||(yr(e)?\"exponential\":\"interval\");if(r||\"padding\"===e.type){const n=r?jt.parse:Gt.parse;(t=rt({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],n(t[1])]))),t.default=n(t.default?t.default:e.default);}if(t.colorSpace&&\"rgb\"!==(s=t.colorSpace)&&\"hcl\"!==s&&\"lab\"!==s)throw new Error(`Unknown color space: \"${t.colorSpace}\"`);var s;let o,l,u;if(\"exponential\"===a)o=Ar;else if(\"interval\"===a)o=_r;else if(\"categorical\"===a){o=wr,l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];u=typeof t.stops[0][0];}else {if(\"identity\"!==a)throw new Error(`Unknown function type \"${a}\"`);o=kr;}if(n){const r={},n=[];for(let e=0;e<t.stops.length;e++){const i=t.stops[e],a=i[0].zoom;void 0===r[a]&&(r[a]={zoom:a,type:t.type,property:t.property,default:t.default,stops:[]},n.push(a)),r[a].stops.push([i[0].value,i[1]]);}const i=[];for(const t of n)i.push([r[t].zoom,vr(r[t],e)]);const a={name:\"linear\"};return {kind:\"composite\",interpolationType:a,interpolationFactor:$e.interpolationFactor.bind(void 0,a),zoomStops:i.map((t=>t[0])),evaluate:({zoom:r},n)=>Ar({stops:i,base:t.base},e,r).evaluate(r,n)}}if(i){const r=\"exponential\"===a?{name:\"exponential\",base:void 0!==t.base?t.base:1}:null;return {kind:\"camera\",interpolationType:r,interpolationFactor:$e.interpolationFactor.bind(void 0,r),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:r})=>o(t,e,r,l,u)}}return {kind:\"source\",evaluate(r,n){const i=n&&n.properties?n.properties[t.property]:void 0;return void 0===i?br(t.default,e.default):o(t,e,i,l,u)}}}function br(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function wr(t,e,r,n,i){return br(typeof r===i?n[r]:void 0,t.default,e.default)}function _r(t,e,r){if(\"number\"!==mr(r))return br(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];const i=Ve(t.stops.map((t=>t[0])),r);return t.stops[i][1]}function Ar(t,e,r){const n=void 0!==t.base?t.base:1;if(\"number\"!==mr(r))return br(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];const a=Ve(t.stops.map((t=>t[0])),r),s=function(t,e,r,n){const i=n-r,a=t-r;return 0===i?0:1===e?a/i:(Math.pow(e,a)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[a][0],t.stops[a+1][0]),o=t.stops[a][1],l=t.stops[a+1][1],u=Le[e.type]||xr;return \"function\"==typeof o.evaluate?{evaluate(...e){const r=o.evaluate.apply(void 0,e),n=l.evaluate.apply(void 0,e);if(void 0!==r&&void 0!==n)return u(r,n,s,t.colorSpace)}}:u(o,l,s,t.colorSpace)}function kr(t,e,r){switch(e.type){case\"color\":r=jt.parse(r);break;case\"formatted\":r=Kt.fromString(r.toString());break;case\"resolvedImage\":r=Jt.fromString(r.toString());break;case\"padding\":r=Gt.parse(r);break;default:mr(r)===e.type||\"enum\"===e.type&&e.values[r]||(r=void 0);}return br(r,t.default,e.default)}ze.register(sr,{error:[{kind:\"error\"},[ot],(t,[e])=>{throw new te(e.evaluate(t))}],typeof:[ot,[ht],(t,[e])=>gt(Ht(e.evaluate(t)))],\"to-rgba\":[mt(st,4),[ut],(t,[e])=>{const[r,n,i,a]=e.evaluate(t).rgb;return [255*r,255*n,255*i,a]}],rgb:[ut,[st,st,st],or],rgba:[ut,[st,st,st,st],or],has:{type:lt,overloads:[[[ot],(t,[e])=>lr(e.evaluate(t),t.properties())],[[ot,ct],(t,[e,r])=>lr(e.evaluate(t),r.evaluate(t))]]},get:{type:ht,overloads:[[[ot],(t,[e])=>ur(e.evaluate(t),t.properties())],[[ot,ct],(t,[e,r])=>ur(e.evaluate(t),r.evaluate(t))]]},\"feature-state\":[ht,[ot],(t,[e])=>ur(e.evaluate(t),t.featureState||{})],properties:[ct,[],t=>t.properties()],\"geometry-type\":[ot,[],t=>t.geometryType()],id:[ht,[],t=>t.id()],zoom:[st,[],t=>t.globals.zoom],\"heatmap-density\":[st,[],t=>t.globals.heatmapDensity||0],\"line-progress\":[st,[],t=>t.globals.lineProgress||0],accumulated:[ht,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],\"+\":[st,cr(st),(t,e)=>{let r=0;for(const n of e)r+=n.evaluate(t);return r}],\"*\":[st,cr(st),(t,e)=>{let r=1;for(const n of e)r*=n.evaluate(t);return r}],\"-\":{type:st,overloads:[[[st,st],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[st],(t,[e])=>-e.evaluate(t)]]},\"/\":[st,[st,st],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],\"%\":[st,[st,st],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[st,[],()=>Math.LN2],pi:[st,[],()=>Math.PI],e:[st,[],()=>Math.E],\"^\":[st,[st,st],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[st,[st],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[st,[st],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[st,[st],(t,[e])=>Math.log(e.evaluate(t))],log2:[st,[st],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[st,[st],(t,[e])=>Math.sin(e.evaluate(t))],cos:[st,[st],(t,[e])=>Math.cos(e.evaluate(t))],tan:[st,[st],(t,[e])=>Math.tan(e.evaluate(t))],asin:[st,[st],(t,[e])=>Math.asin(e.evaluate(t))],acos:[st,[st],(t,[e])=>Math.acos(e.evaluate(t))],atan:[st,[st],(t,[e])=>Math.atan(e.evaluate(t))],min:[st,cr(st),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[st,cr(st),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[st,[st],(t,[e])=>Math.abs(e.evaluate(t))],round:[st,[st],(t,[e])=>{const r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[st,[st],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[st,[st],(t,[e])=>Math.ceil(e.evaluate(t))],\"filter-==\":[lt,[ot,ht],(t,[e,r])=>t.properties()[e.value]===r.value],\"filter-id-==\":[lt,[ht],(t,[e])=>t.id()===e.value],\"filter-type-==\":[lt,[ot],(t,[e])=>t.geometryType()===e.value],\"filter-<\":[lt,[ot,ht],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],\"filter-id-<\":[lt,[ht],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],\"filter->\":[lt,[ot,ht],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],\"filter-id->\":[lt,[ht],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],\"filter-<=\":[lt,[ot,ht],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],\"filter-id-<=\":[lt,[ht],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],\"filter->=\":[lt,[ot,ht],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],\"filter-id->=\":[lt,[ht],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],\"filter-has\":[lt,[ht],(t,[e])=>e.value in t.properties()],\"filter-has-id\":[lt,[],t=>null!==t.id()&&void 0!==t.id()],\"filter-type-in\":[lt,[mt(ot)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],\"filter-id-in\":[lt,[mt(ht)],(t,[e])=>e.value.indexOf(t.id())>=0],\"filter-in-small\":[lt,[ot,mt(ht)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],\"filter-in-large\":[lt,[ot,mt(ht)],(t,[e,r])=>function(t,e,r,n){for(;r<=n;){const i=r+n>>1;if(e[i]===t)return !0;e[i]>t?n=i-1:r=i+1;}return !1}(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:lt,overloads:[[[lt,lt],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[cr(lt),(t,e)=>{for(const r of e)if(!r.evaluate(t))return !1;return !0}]]},any:{type:lt,overloads:[[[lt,lt],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[cr(lt),(t,e)=>{for(const r of e)if(r.evaluate(t))return !0;return !1}]]},\"!\":[lt,[lt],(t,[e])=>!e.evaluate(t)],\"is-supported-script\":[lt,[ot],(t,[e])=>{const r=t.globals&&t.globals.isSupportedScript;return !r||r(e.evaluate(t))}],upcase:[ot,[ot],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[ot,[ot],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[ot,cr(ht),(t,e)=>e.map((e=>Wt(e.evaluate(t)))).join(\"\")],\"resolved-locale\":[ot,[pt],(t,[e])=>e.evaluate(t).resolvedLocale()]});class Sr{constructor(t,e){var r;this.expression=t,this._warningHistory={},this._evaluator=new se,this._defaultValue=e?\"color\"===(r=e).type&&gr(r.default)?new jt(0,0,0,0):\"color\"===r.type?jt.parse(r.default)||null:\"padding\"===r.type?Gt.parse(r.default)||null:void 0===r.default?null:r.default:null,this._enumValues=e&&\"enum\"===e.type?e.values:null;}evaluateWithoutErrorHandling(t,e,r,n,i,a){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,n,i,a){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||\"number\"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new te(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(\", \")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,\"undefined\"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function Ir(t){return Array.isArray(t)&&t.length>0&&\"string\"==typeof t[0]&&t[0]in sr}function zr(t,e){const r=new oe(sr,Me,[],e?function(t){const e={color:ut,string:ot,number:st,enum:ot,boolean:lt,formatted:ft,padding:dt,resolvedImage:yt};return \"array\"===t.type?mt(e[t.value]||ht,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&\"string\"===e.type?{typeAnnotation:\"coerce\"}:void 0);return n?hr(new Sr(n,e)):pr(r.errors)}class Mr{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent=\"constant\"!==t&&!Be(e.expression);}evaluateWithoutErrorHandling(t,e,r,n,i,a){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,a)}evaluate(t,e,r,n,i,a){return this._styleExpression.evaluate(t,e,r,n,i,a)}}class Pr{constructor(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent=\"camera\"!==t&&!Be(e.expression),this.interpolationType=n;}evaluateWithoutErrorHandling(t,e,r,n,i,a){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,a)}evaluate(t,e,r,n,i,a){return this._styleExpression.evaluate(t,e,r,n,i,a)}interpolationFactor(t,e,r){return this.interpolationType?$e.interpolationFactor(this.interpolationType,t,e,r):0}}function Br(t,e){const r=zr(t,e);if(\"error\"===r.result)return r;const n=r.value.expression,i=Pe(n);if(!i&&!fr(e))return pr([new nt(\"\",\"data expressions not supported\")]);const a=Ce(n,[\"zoom\"]);if(!a&&!dr(e))return pr([new nt(\"\",\"zoom expressions not supported\")]);const s=Vr(n);return s||a?s instanceof nt?pr([s]):s instanceof $e&&!yr(e)?pr([new nt(\"\",'\"interpolate\" expressions cannot be used with this property')]):hr(s?new Pr(i?\"camera\":\"composite\",r.value,s.labels,s instanceof $e?s.interpolation:void 0):new Mr(i?\"constant\":\"source\",r.value)):pr([new nt(\"\",'\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.')])}class Cr{constructor(t,e){this._parameters=t,this._specification=e,rt(this,vr(this._parameters,this._specification));}static deserialize(t){return new Cr(t._parameters,t._specification)}static serialize(t){return {_parameters:t._parameters,_specification:t._specification}}}function Vr(t){let e=null;if(t instanceof Ue)e=Vr(t.result);else if(t instanceof Oe){for(const r of t.args)if(e=Vr(r),e)break}else (t instanceof Ee||t instanceof $e)&&t.input instanceof ze&&\"zoom\"===t.input.name&&(e=t);return e instanceof nt||t.eachChild((t=>{const r=Vr(t);r instanceof nt?e=r:!e&&r?e=new nt(\"\",'\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.'):e&&r&&e!==r&&(e=new nt(\"\",'Only one zoom-based \"step\" or \"interpolate\" subexpression may be used in an expression.'));})),e}function Er(t){if(!0===t||!1===t)return !0;if(!Array.isArray(t)||0===t.length)return !1;switch(t[0]){case\"has\":return t.length>=2&&\"$id\"!==t[1]&&\"$type\"!==t[1];case\"in\":return t.length>=3&&(\"string\"!=typeof t[1]||Array.isArray(t[2]));case\"!in\":case\"!has\":case\"none\":return !1;case\"==\":case\"!=\":case\">\":case\">=\":case\"<\":case\"<=\":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case\"any\":case\"all\":for(const e of t.slice(1))if(!Er(e)&&\"boolean\"!=typeof e)return !1;return !0;default:return !0}}const Fr={type:\"boolean\",default:!1,transition:!1,\"property-type\":\"data-driven\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]}};function Tr(t){if(null==t)return {filter:()=>!0,needGeometry:!1};Er(t)||(t=Dr(t));const e=zr(t,Fr);if(\"error\"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(\", \"));return {filter:(t,r,n)=>e.value.evaluate(t,r,{},n),needGeometry:$r(t)}}function Lr(t,e){return t<e?-1:t>e?1:0}function $r(t){if(!Array.isArray(t))return !1;if(\"within\"===t[0])return !0;for(let e=1;e<t.length;e++)if($r(t[e]))return !0;return !1}function Dr(t){if(!t)return !0;const e=t[0];return t.length<=1?\"any\"!==e:\"==\"===e?Or(t[1],t[2],\"==\"):\"!=\"===e?qr(Or(t[1],t[2],\"==\")):\"<\"===e||\">\"===e||\"<=\"===e||\">=\"===e?Or(t[1],t[2],e):\"any\"===e?(r=t.slice(1),[\"any\"].concat(r.map(Dr))):\"all\"===e?[\"all\"].concat(t.slice(1).map(Dr)):\"none\"===e?[\"all\"].concat(t.slice(1).map(Dr).map(qr)):\"in\"===e?Ur(t[1],t.slice(2)):\"!in\"===e?qr(Ur(t[1],t.slice(2))):\"has\"===e?Rr(t[1]):\"!has\"===e?qr(Rr(t[1])):\"within\"!==e||t;var r;}function Or(t,e,r){switch(t){case\"$type\":return [`filter-type-${r}`,e];case\"$id\":return [`filter-id-${r}`,e];default:return [`filter-${r}`,t,e]}}function Ur(t,e){if(0===e.length)return !1;switch(t){case\"$type\":return [\"filter-type-in\",[\"literal\",e]];case\"$id\":return [\"filter-id-in\",[\"literal\",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?[\"filter-in-large\",t,[\"literal\",e.sort(Lr)]]:[\"filter-in-small\",t,[\"literal\",e]]}}function Rr(t){switch(t){case\"$type\":return !0;case\"$id\":return [\"filter-has-id\"];default:return [\"filter-has\",t]}}function qr(t){return [\"!\",t]}function jr(t){const e=typeof t;if(\"number\"===e||\"boolean\"===e||\"string\"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e=\"[\";for(const r of t)e+=`${jr(r)},`;return `${e}]`}const r=Object.keys(t).sort();let n=\"{\";for(let e=0;e<r.length;e++)n+=`${JSON.stringify(r[e])}:${jr(t[r[e]])},`;return `${n}}`}function Nr(t){let e=\"\";for(const r of N)e+=`/${jr(t[r])}`;return e}function Zr(t){const e=t.value;return e?[new et(t.key,e,\"constants have been deprecated as of v8\")]:[]}function Kr(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Gr(t){if(Array.isArray(t))return t.map(Gr);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const r in t)e[r]=Gr(t[r]);return e}return Kr(t)}function Jr(t){const e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},a=t.style,s=t.styleSpec,o=t.validateSpec;let l=[];const u=mr(r);if(\"object\"!==u)return [new et(e,r,`object expected, ${u} found`)];for(const t in r){const u=t.split(\".\")[0],c=n[u]||n[\"*\"];let h;if(i[u])h=i[u];else if(n[u])h=o;else if(i[\"*\"])h=i[\"*\"];else {if(!n[\"*\"]){l.push(new et(e,r[t],`unknown property \"${t}\"`));continue}h=o;}l=l.concat(h({key:(e?`${e}.`:e)+t,value:r[t],valueSpec:c,style:a,styleSpec:s,object:r,objectKey:t,validateSpec:o},r));}for(const t in n)i[t]||n[t].required&&void 0===n[t].default&&void 0===r[t]&&l.push(new et(e,r,`missing required property \"${t}\"`));return l}function Xr(t){const e=t.value,r=t.valueSpec,n=t.style,i=t.styleSpec,a=t.key,s=t.arrayElementValidator||t.validateSpec;if(\"array\"!==mr(e))return [new et(a,e,`array expected, ${mr(e)} found`)];if(r.length&&e.length!==r.length)return [new et(a,e,`array length ${r.length} expected, length ${e.length} found`)];if(r[\"min-length\"]&&e.length<r[\"min-length\"])return [new et(a,e,`array length at least ${r[\"min-length\"]} expected, length ${e.length} found`)];let o={type:r.value,values:r.values};i.$version<7&&(o.function=r.function),\"object\"===mr(r.value)&&(o=r.value);let l=[];for(let r=0;r<e.length;r++)l=l.concat(s({array:e,arrayIndex:r,value:e[r],valueSpec:o,validateSpec:t.validateSpec,style:n,styleSpec:i,key:`${a}[${r}]`}));return l}function Yr(t){const e=t.key,r=t.value,n=t.valueSpec;let i=mr(r);return \"number\"===i&&r!=r&&(i=\"NaN\"),\"number\"!==i?[new et(e,r,`number expected, ${i} found`)]:\"minimum\"in n&&r<n.minimum?[new et(e,r,`${r} is less than the minimum value ${n.minimum}`)]:\"maximum\"in n&&r>n.maximum?[new et(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function Hr(t){const e=t.valueSpec,r=Kr(t.value.type);let n,i,a,s={};const o=\"categorical\"!==r&&void 0===t.value.property,l=!o,u=\"array\"===mr(t.value.stops)&&\"array\"===mr(t.value.stops[0])&&\"object\"===mr(t.value.stops[0][0]),c=Jr({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if(\"identity\"===r)return [new et(t.key,t.value,'identity function may not have a \"stops\" property')];let e=[];const n=t.value;return e=e.concat(Xr({key:t.key,value:n,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),\"array\"===mr(n)&&0===n.length&&e.push(new et(t.key,n,\"array must have at least one stop\")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return \"identity\"===r&&o&&c.push(new et(t.key,t.value,'missing required property \"property\"')),\"identity\"===r||t.value.stops||c.push(new et(t.key,t.value,'missing required property \"stops\"')),\"exponential\"===r&&t.valueSpec.expression&&!yr(t.valueSpec)&&c.push(new et(t.key,t.value,\"exponential functions not supported\")),t.styleSpec.$version>=8&&(l&&!fr(t.valueSpec)?c.push(new et(t.key,t.value,\"property functions not supported\")):o&&!dr(t.valueSpec)&&c.push(new et(t.key,t.value,\"zoom functions not supported\"))),\"categorical\"!==r&&!u||void 0!==t.value.property||c.push(new et(t.key,t.value,'\"property\" property is required')),c;function h(t){let r=[];const n=t.value,o=t.key;if(\"array\"!==mr(n))return [new et(o,n,`array expected, ${mr(n)} found`)];if(2!==n.length)return [new et(o,n,`array length 2 expected, length ${n.length} found`)];if(u){if(\"object\"!==mr(n[0]))return [new et(o,n,`object expected, ${mr(n[0])} found`)];if(void 0===n[0].zoom)return [new et(o,n,\"object stop key must have zoom\")];if(void 0===n[0].value)return [new et(o,n,\"object stop key must have value\")];if(a&&a>Kr(n[0].zoom))return [new et(o,n[0].zoom,\"stop zoom values must appear in ascending order\")];Kr(n[0].zoom)!==a&&(a=Kr(n[0].zoom),i=void 0,s={}),r=r.concat(Jr({key:`${o}[0]`,value:n[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Yr,value:p}}));}else r=r.concat(p({key:`${o}[0]`,value:n[0],valueSpec:{},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},n));return Ir(Gr(n[1]))?r.concat([new et(`${o}[1]`,n[1],\"expressions are not allowed in function stops.\")]):r.concat(t.validateSpec({key:`${o}[1]`,value:n[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function p(t,a){const o=mr(t.value),l=Kr(t.value),u=null!==t.value?t.value:a;if(n){if(o!==n)return [new et(t.key,u,`${o} stop domain type must match previous stop domain type ${n}`)]}else n=o;if(\"number\"!==o&&\"string\"!==o&&\"boolean\"!==o)return [new et(t.key,u,\"stop domain value must be a number, string, or boolean\")];if(\"number\"!==o&&\"categorical\"!==r){let n=`number expected, ${o} found`;return fr(e)&&void 0===r&&(n+='\\nIf you intended to use a categorical function, specify `\"type\": \"categorical\"`.'),[new et(t.key,u,n)]}return \"categorical\"!==r||\"number\"!==o||isFinite(l)&&Math.floor(l)===l?\"categorical\"!==r&&\"number\"===o&&void 0!==i&&l<i?[new et(t.key,u,\"stop domain values must appear in ascending order\")]:(i=l,\"categorical\"===r&&l in s?[new et(t.key,u,\"stop domain values must be unique\")]:(s[l]=!0,[])):[new et(t.key,u,`integer expected, found ${l}`)]}}function Wr(t){const e=(\"property\"===t.expressionContext?Br:zr)(Gr(t.value),t.valueSpec);if(\"error\"===e.result)return e.value.map((e=>new et(`${t.key}${e.key}`,t.value,e.message)));const r=e.value.expression||e.value._styleExpression.expression;if(\"property\"===t.expressionContext&&\"text-font\"===t.propertyKey&&!r.outputDefined())return [new et(t.key,t.value,`Invalid data expression for \"${t.propertyKey}\". Output values must be contained as literals within the expression.`)];if(\"property\"===t.expressionContext&&\"layout\"===t.propertyType&&!Be(r))return [new et(t.key,t.value,'\"feature-state\" data expressions are not supported with layout properties.')];if(\"filter\"===t.expressionContext&&!Be(r))return [new et(t.key,t.value,'\"feature-state\" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf(\"cluster\")){if(!Ce(r,[\"zoom\",\"feature-state\"]))return [new et(t.key,t.value,'\"zoom\" and \"feature-state\" expressions are not supported with cluster properties.')];if(\"cluster-initial\"===t.expressionContext&&!Pe(r))return [new et(t.key,t.value,\"Feature data expressions are not supported with initial expression part of cluster properties.\")]}return []}function Qr(t){const e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?-1===n.values.indexOf(Kr(r))&&i.push(new et(e,r,`expected one of [${n.values.join(\", \")}], ${JSON.stringify(r)} found`)):-1===Object.keys(n.values).indexOf(Kr(r))&&i.push(new et(e,r,`expected one of [${Object.keys(n.values).join(\", \")}], ${JSON.stringify(r)} found`)),i}function tn(t){return Er(Gr(t.value))?Wr(rt({},t,{expressionContext:\"filter\",valueSpec:{value:\"boolean\"}})):en(t)}function en(t){const e=t.value,r=t.key;if(\"array\"!==mr(e))return [new et(r,e,`array expected, ${mr(e)} found`)];const n=t.styleSpec;let i,a=[];if(e.length<1)return [new et(r,e,\"filter array must have at least 1 element\")];switch(a=a.concat(Qr({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),Kr(e[0])){case\"<\":case\"<=\":case\">\":case\">=\":e.length>=2&&\"$type\"===Kr(e[1])&&a.push(new et(r,e,`\"$type\" cannot be use with operator \"${e[0]}\"`));case\"==\":case\"!=\":3!==e.length&&a.push(new et(r,e,`filter array for operator \"${e[0]}\" must have 3 elements`));case\"in\":case\"!in\":e.length>=2&&(i=mr(e[1]),\"string\"!==i&&a.push(new et(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let s=2;s<e.length;s++)i=mr(e[s]),\"$type\"===Kr(e[1])?a=a.concat(Qr({key:`${r}[${s}]`,value:e[s],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):\"string\"!==i&&\"number\"!==i&&\"boolean\"!==i&&a.push(new et(`${r}[${s}]`,e[s],`string, number, or boolean expected, ${i} found`));break;case\"any\":case\"all\":case\"none\":for(let n=1;n<e.length;n++)a=a.concat(en({key:`${r}[${n}]`,value:e[n],style:t.style,styleSpec:t.styleSpec}));break;case\"has\":case\"!has\":i=mr(e[1]),2!==e.length?a.push(new et(r,e,`filter array for \"${e[0]}\" operator must have 2 elements`)):\"string\"!==i&&a.push(new et(`${r}[1]`,e[1],`string expected, ${i} found`));break;case\"within\":i=mr(e[1]),2!==e.length?a.push(new et(r,e,`filter array for \"${e[0]}\" operator must have 2 elements`)):\"object\"!==i&&a.push(new et(`${r}[1]`,e[1],`object expected, ${i} found`));}return a}function rn(t,e){const r=t.key,n=t.validateSpec,i=t.style,a=t.styleSpec,s=t.value,o=t.objectKey,l=a[`${e}_${t.layerType}`];if(!l)return [];const u=o.match(/^(.*)-transition$/);if(\"paint\"===e&&u&&l[u[1]]&&l[u[1]].transition)return n({key:r,value:s,valueSpec:a.transition,style:i,styleSpec:a});const c=t.valueSpec||l[o];if(!c)return [new et(r,s,`unknown property \"${o}\"`)];let h;if(\"string\"===mr(s)&&fr(c)&&!c.tokens&&(h=/^{([^}]+)}$/.exec(s)))return [new et(r,s,`\"${o}\" does not support interpolation syntax\\nUse an identity property function instead: \\`{ \"type\": \"identity\", \"property\": ${JSON.stringify(h[1])} }\\`.`)];const p=[];return \"symbol\"===t.layerType&&(\"text-field\"===o&&i&&!i.glyphs&&p.push(new et(r,s,'use of \"text-field\" requires a style \"glyphs\" property')),\"text-font\"===o&&gr(Gr(s))&&\"identity\"===Kr(s.type)&&p.push(new et(r,s,'\"text-font\" does not support identity functions'))),p.concat(n({key:t.key,value:s,valueSpec:c,style:i,styleSpec:a,expressionContext:\"property\",propertyType:e,propertyKey:o}))}function nn(t){return rn(t,\"paint\")}function an(t){return rn(t,\"layout\")}function sn(t){let e=[];const r=t.value,n=t.key,i=t.style,a=t.styleSpec;r.type||r.ref||e.push(new et(n,r,'either \"type\" or \"ref\" is required'));let s=Kr(r.type);const o=Kr(r.ref);if(r.id){const a=Kr(r.id);for(let s=0;s<t.arrayIndex;s++){const t=i.layers[s];Kr(t.id)===a&&e.push(new et(n,r.id,`duplicate layer id \"${r.id}\", previously used at line ${t.id.__line__}`));}}if(\"ref\"in r){let t;[\"type\",\"source\",\"source-layer\",\"filter\",\"layout\"].forEach((t=>{t in r&&e.push(new et(n,r[t],`\"${t}\" is prohibited for ref layers`));})),i.layers.forEach((e=>{Kr(e.id)===o&&(t=e);})),t?t.ref?e.push(new et(n,r.ref,\"ref cannot reference another ref layer\")):s=Kr(t.type):e.push(new et(n,r.ref,`ref layer \"${o}\" not found`));}else if(\"background\"!==s)if(r.source){const t=i.sources&&i.sources[r.source],a=t&&Kr(t.type);t?\"vector\"===a&&\"raster\"===s?e.push(new et(n,r.source,`layer \"${r.id}\" requires a raster source`)):\"raster\"===a&&\"raster\"!==s?e.push(new et(n,r.source,`layer \"${r.id}\" requires a vector source`)):\"vector\"!==a||r[\"source-layer\"]?\"raster-dem\"===a&&\"hillshade\"!==s?e.push(new et(n,r.source,\"raster-dem source can only be used with layer type 'hillshade'.\")):\"line\"!==s||!r.paint||!r.paint[\"line-gradient\"]||\"geojson\"===a&&t.lineMetrics||e.push(new et(n,r,`layer \"${r.id}\" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):e.push(new et(n,r,`layer \"${r.id}\" must specify a \"source-layer\"`)):e.push(new et(n,r.source,`source \"${r.source}\" not found`));}else e.push(new et(n,r,'missing required property \"source\"'));return e=e.concat(Jr({key:n,value:r,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{\"*\":()=>[],type:()=>t.validateSpec({key:`${n}.type`,value:r.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:\"type\"}),filter:tn,layout:t=>Jr({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{\"*\":t=>an(rt({layerType:s},t))}}),paint:t=>Jr({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{\"*\":t=>nn(rt({layerType:s},t))}})}})),e}function on(t){const e=t.value,r=t.key,n=mr(e);return \"string\"!==n?[new et(r,e,`string expected, ${n} found`)]:[]}const ln={promoteId:function({key:t,value:e}){if(\"string\"===mr(e))return on({key:t,value:e});{const r=[];for(const n in e)r.push(...on({key:`${t}.${n}`,value:e[n]}));return r}}};function un(t){const e=t.value,r=t.key,n=t.styleSpec,i=t.style,a=t.validateSpec;if(!e.type)return [new et(r,e,'\"type\" is required')];const s=Kr(e.type);let o;switch(s){case\"vector\":case\"raster\":case\"raster-dem\":return o=Jr({key:r,value:e,valueSpec:n[`source_${s.replace(\"-\",\"_\")}`],style:t.style,styleSpec:n,objectElementValidators:ln,validateSpec:a}),o;case\"geojson\":if(o=Jr({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:a,objectElementValidators:ln}),e.cluster)for(const t in e.clusterProperties){const[n,i]=e.clusterProperties[t],s=\"string\"==typeof n?[n,[\"accumulated\"],[\"get\",t]]:n;o.push(...Wr({key:`${r}.${t}.map`,value:i,validateSpec:a,expressionContext:\"cluster-map\"})),o.push(...Wr({key:`${r}.${t}.reduce`,value:s,validateSpec:a,expressionContext:\"cluster-reduce\"}));}return o;case\"video\":return Jr({key:r,value:e,valueSpec:n.source_video,style:i,validateSpec:a,styleSpec:n});case\"image\":return Jr({key:r,value:e,valueSpec:n.source_image,style:i,validateSpec:a,styleSpec:n});case\"canvas\":return [new et(r,null,\"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.\",\"source.canvas\")];default:return Qr({key:`${r}.type`,value:e.type,valueSpec:{values:[\"vector\",\"raster\",\"raster-dem\",\"geojson\",\"video\",\"image\"]},style:i,validateSpec:a,styleSpec:n})}}function cn(t){const e=t.value,r=t.styleSpec,n=r.light,i=t.style;let a=[];const s=mr(e);if(void 0===e)return a;if(\"object\"!==s)return a=a.concat([new et(\"light\",e,`object expected, ${s} found`)]),a;for(const s in e){const o=s.match(/^(.*)-transition$/);a=a.concat(o&&n[o[1]]&&n[o[1]].transition?t.validateSpec({key:s,value:e[s],valueSpec:r.transition,validateSpec:t.validateSpec,style:i,styleSpec:r}):n[s]?t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r}):[new et(s,e[s],`unknown property \"${s}\"`)]);}return a}function hn(t){const e=t.value,r=t.styleSpec,n=r.terrain,i=t.style;let a=[];const s=mr(e);if(void 0===e)return a;if(\"object\"!==s)return a=a.concat([new et(\"terrain\",e,`object expected, ${s} found`)]),a;for(const s in e)a=a.concat(n[s]?t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r}):[new et(s,e[s],`unknown property \"${s}\"`)]);return a}function pn(t){let e=[];const r=t.value,n=t.key;if(Array.isArray(r)){const i=[],a=[];for(const s in r)r[s].id&&i.includes(r[s].id)&&e.push(new et(n,r,`all the sprites' ids must be unique, but ${r[s].id} is duplicated`)),i.push(r[s].id),r[s].url&&a.includes(r[s].url)&&e.push(new et(n,r,`all the sprites' URLs must be unique, but ${r[s].url} is duplicated`)),a.push(r[s].url),e=e.concat(Jr({key:`${n}[${s}]`,value:r[s],valueSpec:{id:{type:\"string\",required:!0},url:{type:\"string\",required:!0}},validateSpec:t.validateSpec}));return e}return on({key:n,value:r})}const fn={\"*\":()=>[],array:Xr,boolean:function(t){const e=t.value,r=t.key,n=mr(e);return \"boolean\"!==n?[new et(r,e,`boolean expected, ${n} found`)]:[]},number:Yr,color:function(t){const e=t.key,r=t.value,n=mr(r);return \"string\"!==n?[new et(e,r,`color expected, ${n} found`)]:jt.parse(String(r))?[]:[new et(e,r,`color expected, \"${r}\" found`)]},constants:Zr,enum:Qr,filter:tn,function:Hr,layer:sn,object:Jr,source:un,light:cn,terrain:hn,string:on,formatted:function(t){return 0===on(t).length?[]:Wr(t)},resolvedImage:function(t){return 0===on(t).length?[]:Wr(t)},padding:function(t){const e=t.key,r=t.value;if(\"array\"===mr(r)){if(r.length<1||r.length>4)return [new et(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const n={type:\"number\"};let i=[];for(let a=0;a<r.length;a++)i=i.concat(t.validateSpec({key:`${e}[${a}]`,value:r[a],validateSpec:t.validateSpec,valueSpec:n}));return i}return Yr({key:e,value:r,valueSpec:{}})},sprite:pn};function dn(t){const e=t.value,r=t.valueSpec,n=t.styleSpec;return t.validateSpec=dn,r.expression&&gr(Kr(e))?Hr(t):r.expression&&Ir(Gr(e))?Wr(t):r.type&&fn[r.type]?fn[r.type](t):Jr(rt({},t,{valueSpec:r.type?n[r.type]:r}))}function yn(t){const e=t.value,r=t.key,n=on(t);return n.length||(-1===e.indexOf(\"{fontstack}\")&&n.push(new et(r,e,'\"glyphs\" url must include a \"{fontstack}\" token')),-1===e.indexOf(\"{range}\")&&n.push(new et(r,e,'\"glyphs\" url must include a \"{range}\" token'))),n}function mn(t,e=j){let r=[];return r=r.concat(dn({key:\"\",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:dn,objectElementValidators:{glyphs:yn,\"*\":()=>[]}})),t.constants&&(r=r.concat(Zr({key:\"constants\",value:t.constants,style:t,styleSpec:e,validateSpec:dn}))),xn(r)}function gn(t){return function(e){return t({...e,validateSpec:dn})}}function xn(t){return [].concat(t).sort(((t,e)=>t.line-e.line))}function vn(t){return function(...e){return xn(t.apply(this,e))}}mn.source=vn(gn(un)),mn.sprite=vn(gn(pn)),mn.glyphs=vn(gn(yn)),mn.light=vn(gn(cn)),mn.terrain=vn(gn(hn)),mn.layer=vn(gn(sn)),mn.filter=vn(gn(tn)),mn.paintProperty=vn(gn(nn)),mn.layoutProperty=vn(gn(an));const bn=mn,wn=bn.light,_n=bn.paintProperty,An=bn.layoutProperty;function kn(t,e){let r=!1;if(e&&e.length)for(const n of e)t.fire(new R(new Error(n.message))),r=!0;return r}class Sn{constructor(t,e,r){const n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const i=new Int32Array(this.arrayBuffer);t=i[0],this.d=(e=i[1])+2*(r=i[2]);for(let t=0;t<this.d*this.d;t++){const e=i[3+t],r=i[3+t+1];n.push(e===r?null:i.subarray(e,r));}const a=i[3+n.length+1];this.keys=i.subarray(i[3+n.length],a),this.bboxes=i.subarray(a),this.insert=this._insertReadonly;}else {this.d=e+2*r;for(let t=0;t<this.d*this.d;t++)n.push([]);this.keys=[],this.bboxes=[];}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;const i=r/e*t;this.min=-i,this.max=t+i;}insert(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i);}_insertReadonly(){throw new Error(\"Cannot insert into a GridIndex created from an ArrayBuffer.\")}_insertCell(t,e,r,n,i,a){this.cells[i].push(a);}query(t,e,r,n,i){const a=this.min,s=this.max;if(t<=a&&e<=a&&s<=r&&s<=n&&!i)return Array.prototype.slice.call(this.keys);{const a=[];return this._forEachCell(t,e,r,n,this._queryCell,a,{},i),a}}_queryCell(t,e,r,n,i,a,s,o){const l=this.cells[i];if(null!==l){const i=this.keys,u=this.bboxes;for(let c=0;c<l.length;c++){const h=l[c];if(void 0===s[h]){const l=4*h;(o?o(u[l+0],u[l+1],u[l+2],u[l+3]):t<=u[l+2]&&e<=u[l+3]&&r>=u[l+0]&&n>=u[l+1])?(s[h]=!0,a.push(i[h])):s[h]=!1;}}}}_forEachCell(t,e,r,n,i,a,s,o){const l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),h=this._convertToCellCoord(n);for(let p=l;p<=c;p++)for(let l=u;l<=h;l++){const u=this.d*l+p;if((!o||o(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&i.call(this,t,e,r,n,u,a,s,o))return}}_convertFromCellCoord(t){return (t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,e=3+this.cells.length+1+1;let r=0;for(let t=0;t<this.cells.length;t++)r+=this.cells[t].length;const n=new Int32Array(e+r+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let i=e;for(let e=0;e<t.length;e++){const r=t[e];n[3+e]=i,n.set(r,i),i+=r.length;}return n[3+t.length]=i,n.set(this.keys,i),i+=this.keys.length,n[3+t.length+1]=i,n.set(this.bboxes,i),i+=this.bboxes.length,n.buffer}static serialize(t,e){const r=t.toArrayBuffer();return e&&e.push(r),{buffer:r}}static deserialize(t){return new Sn(t.buffer)}}const In={};function zn(t,e,r={}){if(In[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,\"_classRegistryKey\",{value:t,writeable:!1}),In[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]};}zn(\"Object\",Object),zn(\"TransferableGridIndex\",Sn),zn(\"Color\",jt),zn(\"Error\",Error),zn(\"AJAXError\",C),zn(\"ResolvedImage\",Jt),zn(\"StylePropertyFunction\",Cr),zn(\"StyleExpression\",Sr,{omit:[\"_evaluator\"]}),zn(\"ZoomDependentExpression\",Pr),zn(\"ZoomConstantExpression\",Mr),zn(\"CompoundExpression\",ze,{omit:[\"_evaluate\"]});for(const t in sr)sr[t]._classRegistryKey||zn(`Expression_${t}`,sr[t]);function Mn(t){return t&&\"undefined\"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&\"ArrayBuffer\"===t.constructor.name)}function Pn(t,e){if(null==t||\"boolean\"==typeof t||\"number\"==typeof t||\"string\"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob)return t;if(Mn(t))return e&&e.push(t),t;if(S(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){const r=t;return e&&e.push(r.buffer),r}if(t instanceof ImageData)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){const r=[];for(const n of t)r.push(Pn(n,e));return r}if(\"object\"==typeof t){const r=t.constructor,n=r._classRegistryKey;if(!n)throw new Error(\"can't serialize object of unregistered class\");if(!In[n])throw new Error(`${n} is not registered.`);const i=r.serialize?r.serialize(t,e):{};if(r.serialize){if(e&&i===e[e.length-1])throw new Error(\"statically serialized object won't survive transfer of $name property\")}else {for(const r in t){if(!t.hasOwnProperty(r))continue;if(In[n].omit.indexOf(r)>=0)continue;const a=t[r];i[r]=In[n].shallow.indexOf(r)>=0?a:Pn(a,e);}t instanceof Error&&(i.message=t.message);}if(i.$name)throw new Error(\"$name property is reserved for worker serialization logic.\");return \"Object\"!==n&&(i.$name=n),i}throw new Error(\"can't serialize object of type \"+typeof t)}function Bn(t){if(null==t||\"boolean\"==typeof t||\"number\"==typeof t||\"string\"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||Mn(t)||S(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(Bn);if(\"object\"==typeof t){const e=t.$name||\"Object\";if(!In[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=In[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);const n=Object.create(r.prototype);for(const r of Object.keys(t)){if(\"$name\"===r)continue;const i=t[r];n[r]=In[e].shallow.indexOf(r)>=0?i:Bn(i);}return n}throw new Error(\"can't deserialize object of type \"+typeof t)}class Cn{constructor(){this.first=!0;}update(t,e){const r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=r,!0))}}const Vn={\"Latin-1 Supplement\":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,\"Arabic Supplement\":t=>t>=1872&&t<=1919,\"Arabic Extended-A\":t=>t>=2208&&t<=2303,\"Hangul Jamo\":t=>t>=4352&&t<=4607,\"Unified Canadian Aboriginal Syllabics\":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,\"Unified Canadian Aboriginal Syllabics Extended\":t=>t>=6320&&t<=6399,\"General Punctuation\":t=>t>=8192&&t<=8303,\"Letterlike Symbols\":t=>t>=8448&&t<=8527,\"Number Forms\":t=>t>=8528&&t<=8591,\"Miscellaneous Technical\":t=>t>=8960&&t<=9215,\"Control Pictures\":t=>t>=9216&&t<=9279,\"Optical Character Recognition\":t=>t>=9280&&t<=9311,\"Enclosed Alphanumerics\":t=>t>=9312&&t<=9471,\"Geometric Shapes\":t=>t>=9632&&t<=9727,\"Miscellaneous Symbols\":t=>t>=9728&&t<=9983,\"Miscellaneous Symbols and Arrows\":t=>t>=11008&&t<=11263,\"CJK Radicals Supplement\":t=>t>=11904&&t<=12031,\"Kangxi Radicals\":t=>t>=12032&&t<=12255,\"Ideographic Description Characters\":t=>t>=12272&&t<=12287,\"CJK Symbols and Punctuation\":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,\"Hangul Compatibility Jamo\":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,\"Bopomofo Extended\":t=>t>=12704&&t<=12735,\"CJK Strokes\":t=>t>=12736&&t<=12783,\"Katakana Phonetic Extensions\":t=>t>=12784&&t<=12799,\"Enclosed CJK Letters and Months\":t=>t>=12800&&t<=13055,\"CJK Compatibility\":t=>t>=13056&&t<=13311,\"CJK Unified Ideographs Extension A\":t=>t>=13312&&t<=19903,\"Yijing Hexagram Symbols\":t=>t>=19904&&t<=19967,\"CJK Unified Ideographs\":t=>t>=19968&&t<=40959,\"Yi Syllables\":t=>t>=40960&&t<=42127,\"Yi Radicals\":t=>t>=42128&&t<=42191,\"Hangul Jamo Extended-A\":t=>t>=43360&&t<=43391,\"Hangul Syllables\":t=>t>=44032&&t<=55215,\"Hangul Jamo Extended-B\":t=>t>=55216&&t<=55295,\"Private Use Area\":t=>t>=57344&&t<=63743,\"CJK Compatibility Ideographs\":t=>t>=63744&&t<=64255,\"Arabic Presentation Forms-A\":t=>t>=64336&&t<=65023,\"Vertical Forms\":t=>t>=65040&&t<=65055,\"CJK Compatibility Forms\":t=>t>=65072&&t<=65103,\"Small Form Variants\":t=>t>=65104&&t<=65135,\"Arabic Presentation Forms-B\":t=>t>=65136&&t<=65279,\"Halfwidth and Fullwidth Forms\":t=>t>=65280&&t<=65519};function En(t){for(const e of t)if(Ln(e.charCodeAt(0)))return !0;return !1}function Fn(t){for(const e of t)if(!Tn(e.charCodeAt(0)))return !1;return !0}function Tn(t){return !(Vn.Arabic(t)||Vn[\"Arabic Supplement\"](t)||Vn[\"Arabic Extended-A\"](t)||Vn[\"Arabic Presentation Forms-A\"](t)||Vn[\"Arabic Presentation Forms-B\"](t))}function Ln(t){return !(746!==t&&747!==t&&(t<4352||!(Vn[\"Bopomofo Extended\"](t)||Vn.Bopomofo(t)||Vn[\"CJK Compatibility Forms\"](t)&&!(t>=65097&&t<=65103)||Vn[\"CJK Compatibility Ideographs\"](t)||Vn[\"CJK Compatibility\"](t)||Vn[\"CJK Radicals Supplement\"](t)||Vn[\"CJK Strokes\"](t)||!(!Vn[\"CJK Symbols and Punctuation\"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Vn[\"CJK Unified Ideographs Extension A\"](t)||Vn[\"CJK Unified Ideographs\"](t)||Vn[\"Enclosed CJK Letters and Months\"](t)||Vn[\"Hangul Compatibility Jamo\"](t)||Vn[\"Hangul Jamo Extended-A\"](t)||Vn[\"Hangul Jamo Extended-B\"](t)||Vn[\"Hangul Jamo\"](t)||Vn[\"Hangul Syllables\"](t)||Vn.Hiragana(t)||Vn[\"Ideographic Description Characters\"](t)||Vn.Kanbun(t)||Vn[\"Kangxi Radicals\"](t)||Vn[\"Katakana Phonetic Extensions\"](t)||Vn.Katakana(t)&&12540!==t||!(!Vn[\"Halfwidth and Fullwidth Forms\"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Vn[\"Small Form Variants\"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Vn[\"Unified Canadian Aboriginal Syllabics\"](t)||Vn[\"Unified Canadian Aboriginal Syllabics Extended\"](t)||Vn[\"Vertical Forms\"](t)||Vn[\"Yijing Hexagram Symbols\"](t)||Vn[\"Yi Syllables\"](t)||Vn[\"Yi Radicals\"](t))))}function $n(t){return !(Ln(t)||function(t){return !!(Vn[\"Latin-1 Supplement\"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Vn[\"General Punctuation\"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Vn[\"Letterlike Symbols\"](t)||Vn[\"Number Forms\"](t)||Vn[\"Miscellaneous Technical\"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Vn[\"Control Pictures\"](t)&&9251!==t||Vn[\"Optical Character Recognition\"](t)||Vn[\"Enclosed Alphanumerics\"](t)||Vn[\"Geometric Shapes\"](t)||Vn[\"Miscellaneous Symbols\"](t)&&!(t>=9754&&t<=9759)||Vn[\"Miscellaneous Symbols and Arrows\"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Vn[\"CJK Symbols and Punctuation\"](t)||Vn.Katakana(t)||Vn[\"Private Use Area\"](t)||Vn[\"CJK Compatibility Forms\"](t)||Vn[\"Small Form Variants\"](t)||Vn[\"Halfwidth and Fullwidth Forms\"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Dn(t){return t>=1424&&t<=2303||Vn[\"Arabic Presentation Forms-A\"](t)||Vn[\"Arabic Presentation Forms-B\"](t)}function On(t,e){return !(!e&&Dn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Vn.Khmer(t))}function Un(t){for(const e of t)if(Dn(e.charCodeAt(0)))return !0;return !1}const Rn=\"deferred\",qn=\"loading\",jn=\"loaded\";let Nn=null,Zn=\"unavailable\",Kn=null;const Gn=function(t){t&&\"string\"==typeof t&&t.indexOf(\"NetworkError\")>-1&&(Zn=\"error\"),Nn&&Nn(t);};function Jn(){Xn.fire(new U(\"pluginStateChange\",{pluginStatus:Zn,pluginURL:Kn}));}const Xn=new q,Yn=function(){return Zn},Hn=function(){if(Zn!==Rn||!Kn)throw new Error(\"rtl-text-plugin cannot be downloaded unless a pluginURL is specified\");Zn=qn,Jn(),Kn&&L({url:Kn},(t=>{t?Gn(t):(Zn=jn,Jn());}));},Wn={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Zn===jn||null!=Wn.applyArabicShaping,isLoading:()=>Zn===qn,setState(t){if(!_())throw new Error(\"Cannot set the state of the rtl-text-plugin when not in the web-worker context\");Zn=t.pluginStatus,Kn=t.pluginURL;},isParsed(){if(!_())throw new Error(\"rtl-text-plugin is only parsed on the worker-threads\");return null!=Wn.applyArabicShaping&&null!=Wn.processBidirectionalText&&null!=Wn.processStyledBidirectionalText},getPluginURL(){if(!_())throw new Error(\"rtl-text-plugin url can only be queried from the worker threads\");return Kn}};class Qn{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Cn,this.transition={});}isSupportedScript(t){return function(t,e){for(const r of t)if(!On(r.charCodeAt(0),e))return !1;return !0}(t,Wn.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}}class ti{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(gr(t))return new Cr(t,e);if(Ir(t)){const r=Br(t,e);if(\"error\"===r.result)throw new Error(r.value.map((t=>`${t.key}: ${t.message}`)).join(\", \"));return r.value}{let r=t;return \"color\"===e.type&&\"string\"==typeof t?r=jt.parse(t):\"padding\"!==e.type||\"number\"!=typeof t&&!Array.isArray(t)||(r=Gt.parse(t)),{kind:\"constant\",evaluate:()=>r}}}(void 0===e?t.specification.default:e,t.specification);}isDataDriven(){return \"source\"===this.expression.kind||\"composite\"===this.expression.kind}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}}class ei{constructor(t){this.property=t,this.value=new ti(t,void 0);}transitioned(t,e){return new ni(this.property,this.value,e,p({},t.transition,this.transition),t.now)}untransitioned(){return new ni(this.property,this.value,null,{},0)}}class ri{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues);}getValue(t){return g(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ei(this._values[t].property)),this._values[t].value=new ti(this._values[t].property,null===e?void 0:g(e));}getTransition(t){return g(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new ei(this._values[t].property)),this._values[t].transition=g(e)||void 0;}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);const n=this.getTransition(e);void 0!==n&&(t[`${e}-transition`]=n);}return t}transitioned(t,e){const r=new ii(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].transitioned(t,e._values[n]);return r}untransitioned(){const t=new ii(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class ni{constructor(t,e,r,n,i){this.property=t,this.value=e,this.begin=i+n.delay||0,this.end=this.begin+n.duration||0,t.specification.transition&&(n.delay||n.duration)&&(this.prior=r);}possiblyEvaluate(t,e,r){const n=t.now||0,i=this.value.possiblyEvaluate(t,e,r),a=this.prior;if(a){if(n>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n<this.begin)return a.possiblyEvaluate(t,e,r);{const s=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(t,e,r),i,function(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(s))}}return i}}class ii{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues);}possiblyEvaluate(t,e,r){const n=new oi(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return !0;return !1}}class ai{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues);}getValue(t){return g(this._values[t].value)}setValue(t,e){this._values[t]=new ti(this._values[t].property,null===e?void 0:g(e));}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);}return t}possiblyEvaluate(t,e,r){const n=new oi(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}}class si{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r;}isConstant(){return \"constant\"===this.value.kind}constantOr(t){return \"constant\"===this.value.kind?this.value.value:t}evaluate(t,e,r,n){return this.property.evaluate(this.value,this.parameters,t,e,r,n)}}class oi{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues);}get(t){return this._values[t]}}class li{constructor(t){this.specification=t;}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error(\"Value should not be data driven\");return t.expression.evaluate(e)}interpolate(t,e,r){const n=Le[this.specification.type];return n?n(t,e,r):t}}class ui{constructor(t,e){this.specification=t,this.overrides=e;}possiblyEvaluate(t,e,r,n){return new si(this,\"constant\"===t.expression.kind||\"camera\"===t.expression.kind?{kind:\"constant\",value:t.expression.evaluate(e,null,{},r,n)}:t.expression,e)}interpolate(t,e,r){if(\"constant\"!==t.value.kind||\"constant\"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new si(this,{kind:\"constant\",value:void 0},t.parameters);const n=Le[this.specification.type];if(n){const i=n(t.value.value,e.value.value,r);return new si(this,{kind:\"constant\",value:i},t.parameters)}return t}evaluate(t,e,r,n,i,a){return \"constant\"===t.kind?t.value:t.evaluate(e,r,n,i,a)}}class ci extends ui{possiblyEvaluate(t,e,r,n){if(void 0===t.value)return new si(this,{kind:\"constant\",value:void 0},e);if(\"constant\"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n),a=\"resolvedImage\"===t.property.specification.type&&\"string\"!=typeof i?i.name:i,s=this._calculate(a,a,a,e);return new si(this,{kind:\"constant\",value:s},e)}if(\"camera\"===t.expression.kind){const r=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new si(this,{kind:\"constant\",value:r},e)}return new si(this,t.expression,e)}evaluate(t,e,r,n,i,a){if(\"source\"===t.kind){const s=t.evaluate(e,r,n,i,a);return this._calculate(s,s,s,e)}return \"composite\"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,n),t.evaluate({zoom:Math.floor(e.zoom)},r,n),t.evaluate({zoom:Math.floor(e.zoom)+1},r,n),e):t.value}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class hi{constructor(t){this.specification=t;}possiblyEvaluate(t,e,r,n){if(void 0!==t.value){if(\"constant\"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new Qn(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Qn(Math.floor(e.zoom),e)),t.expression.evaluate(new Qn(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class pi{constructor(t){this.specification=t;}possiblyEvaluate(t,e,r,n){return !!t.expression.evaluate(e,null,{},r,n)}interpolate(){return !1}}class fi{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const r=t[e];r.specification.overridable&&this.overridableProperties.push(e);const n=this.defaultPropertyValues[e]=new ti(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new ei(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({});}}}zn(\"DataDrivenProperty\",ui),zn(\"DataConstantProperty\",li),zn(\"CrossFadedDataDrivenProperty\",ci),zn(\"CrossFadedProperty\",hi),zn(\"ColorRampProperty\",pi);const di=\"-transition\";class yi extends q{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},\"custom\"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,\"background\"!==t.type&&(this.source=t.source,this.sourceLayer=t[\"source-layer\"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new ai(e.layout)),e.paint)){this._transitionablePaint=new ri(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new oi(e.paint);}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return \"visibility\"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,r={}){null!=e&&this._validate(An,`layers.${this.id}.layout.${t}`,t,e,r)||(\"visibility\"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e);}getPaintProperty(t){return t.endsWith(di)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(null!=e&&this._validate(_n,`layers.${this.id}.paint.${t}`,t,e,r))return !1;if(t.endsWith(di))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{const r=this._transitionablePaint._values[t],n=\"cross-faded-data-driven\"===r.property.specification[\"property-type\"],i=r.value.isDataDriven(),a=r.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const s=this._transitionablePaint._values[t].value;return s.isDataDriven()||i||n||this._handleOverridablePaintPropertyUpdate(t,a,s)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,r){return !1}isHidden(t){return !!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||\"none\"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint);}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e);}serialize(){const t={id:this.id,type:this.type,source:this.source,\"source-layer\":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),m(t,((t,e)=>!(void 0===t||\"layout\"===e&&!Object.keys(t).length||\"paint\"===e&&!Object.keys(t).length)))}_validate(t,e,r,n,i={}){return (!i||!1!==i.validate)&&kn(this,t.call(bn,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:j,style:{glyphs:!0,sprite:!0}}))}is3D(){return !1}isTileClipped(){return !1}hasOffscreenPass(){return !1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof si&&fr(e.property.specification)&&(\"source\"===e.value.kind||\"composite\"===e.value.kind)&&e.value.isStateDependent)return !0}return !1}}const mi={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class gi{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8;}}class xi{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0);}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews());}clear(){this.length=0;}resize(t){this.reserve(t),this.length=t;}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e);}}_refreshViews(){throw new Error(\"_refreshViews() must be implemented by each concrete StructArray layout\")}}function vi(t,e=1){let r=0,n=0;return {members:t.map((t=>{const i=mi[t.type].BYTES_PER_ELEMENT,a=r=bi(r,Math.max(e,i)),s=t.components||1;return n=Math.max(n,i),r+=i*s,{name:t.name,type:t.type,components:s,offset:a}})),size:bi(r,Math.max(n,e)),alignment:e}}function bi(t,e){return Math.ceil(t/e)*e}class wi extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t}}wi.prototype.bytesPerElement=4,zn(\"StructArrayLayout2i4\",wi);class _i extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t}}_i.prototype.bytesPerElement=6,zn(\"StructArrayLayout3i6\",_i);class Ai extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const a=4*t;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=n,this.int16[a+3]=i,t}}Ai.prototype.bytesPerElement=8,zn(\"StructArrayLayout4i8\",Ai);class ki extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,a){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i,a)}emplace(t,e,r,n,i,a,s){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=a,this.int16[o+5]=s,t}}ki.prototype.bytesPerElement=12,zn(\"StructArrayLayout2i4i12\",ki);class Si extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,a){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i,a)}emplace(t,e,r,n,i,a,s){const o=4*t,l=8*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.uint8[l+4]=n,this.uint8[l+5]=i,this.uint8[l+6]=a,this.uint8[l+7]=s,t}}Si.prototype.bytesPerElement=8,zn(\"StructArrayLayout2i4ub8\",Si);class Ii extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t}}Ii.prototype.bytesPerElement=8,zn(\"StructArrayLayout2f8\",Ii);class zi extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,a,s,o,l,u){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,i,a,s,o,l,u)}emplace(t,e,r,n,i,a,s,o,l,u,c){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=r,this.uint16[h+2]=n,this.uint16[h+3]=i,this.uint16[h+4]=a,this.uint16[h+5]=s,this.uint16[h+6]=o,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,t}}zi.prototype.bytesPerElement=20,zn(\"StructArrayLayout10ui20\",zi);class Mi extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,a,s,o,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,n,i,a,s,o,l,u,c,h)}emplace(t,e,r,n,i,a,s,o,l,u,c,h,p){const f=12*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.uint16[f+4]=a,this.uint16[f+5]=s,this.uint16[f+6]=o,this.uint16[f+7]=l,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=h,this.int16[f+11]=p,t}}Mi.prototype.bytesPerElement=24,zn(\"StructArrayLayout4i4ui4i24\",Mi);class Pi extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t}}Pi.prototype.bytesPerElement=12,zn(\"StructArrayLayout3f12\",Pi);class Bi extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer);}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}Bi.prototype.bytesPerElement=4,zn(\"StructArrayLayout1ul4\",Bi);class Ci extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,a,s,o,l){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,n,i,a,s,o,l)}emplace(t,e,r,n,i,a,s,o,l,u){const c=10*t,h=5*t;return this.int16[c+0]=e,this.int16[c+1]=r,this.int16[c+2]=n,this.int16[c+3]=i,this.int16[c+4]=a,this.int16[c+5]=s,this.uint32[h+3]=o,this.uint16[c+8]=l,this.uint16[c+9]=u,t}}Ci.prototype.bytesPerElement=20,zn(\"StructArrayLayout6i1ul2ui20\",Ci);class Vi extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,a){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i,a)}emplace(t,e,r,n,i,a,s){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=a,this.int16[o+5]=s,t}}Vi.prototype.bytesPerElement=12,zn(\"StructArrayLayout2i2i2i12\",Vi);class Ei extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i)}emplace(t,e,r,n,i,a){const s=4*t,o=8*t;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=n,this.int16[o+6]=i,this.int16[o+7]=a,t}}Ei.prototype.bytesPerElement=16,zn(\"StructArrayLayout2f1f2i16\",Ei);class Fi extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const a=12*t,s=3*t;return this.uint8[a+0]=e,this.uint8[a+1]=r,this.float32[s+1]=n,this.float32[s+2]=i,t}}Fi.prototype.bytesPerElement=12,zn(\"StructArrayLayout2ub2f12\",Fi);class Ti extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t}}Ti.prototype.bytesPerElement=6,zn(\"StructArrayLayout3ui6\",Ti);class Li extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,a,s,o,l,u,c,h,p,f,d,y,m){const g=this.length;return this.resize(g+1),this.emplace(g,t,e,r,n,i,a,s,o,l,u,c,h,p,f,d,y,m)}emplace(t,e,r,n,i,a,s,o,l,u,c,h,p,f,d,y,m,g){const x=24*t,v=12*t,b=48*t;return this.int16[x+0]=e,this.int16[x+1]=r,this.uint16[x+2]=n,this.uint16[x+3]=i,this.uint32[v+2]=a,this.uint32[v+3]=s,this.uint32[v+4]=o,this.uint16[x+10]=l,this.uint16[x+11]=u,this.uint16[x+12]=c,this.float32[v+7]=h,this.float32[v+8]=p,this.uint8[b+36]=f,this.uint8[b+37]=d,this.uint8[b+38]=y,this.uint32[v+10]=m,this.int16[x+22]=g,t}}Li.prototype.bytesPerElement=48,zn(\"StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48\",Li);class $i extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,a,s,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,k,S,I,z){const M=this.length;return this.resize(M+1),this.emplace(M,t,e,r,n,i,a,s,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,k,S,I,z)}emplace(t,e,r,n,i,a,s,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,k,S,I,z,M){const P=34*t,B=17*t;return this.int16[P+0]=e,this.int16[P+1]=r,this.int16[P+2]=n,this.int16[P+3]=i,this.int16[P+4]=a,this.int16[P+5]=s,this.int16[P+6]=o,this.int16[P+7]=l,this.uint16[P+8]=u,this.uint16[P+9]=c,this.uint16[P+10]=h,this.uint16[P+11]=p,this.uint16[P+12]=f,this.uint16[P+13]=d,this.uint16[P+14]=y,this.uint16[P+15]=m,this.uint16[P+16]=g,this.uint16[P+17]=x,this.uint16[P+18]=v,this.uint16[P+19]=b,this.uint16[P+20]=w,this.uint16[P+21]=_,this.uint16[P+22]=A,this.uint32[B+12]=k,this.float32[B+13]=S,this.float32[B+14]=I,this.float32[B+15]=z,this.float32[B+16]=M,t}}$i.prototype.bytesPerElement=68,zn(\"StructArrayLayout8i15ui1ul4f68\",$i);class Di extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Di.prototype.bytesPerElement=4,zn(\"StructArrayLayout1f4\",Di);class Oi extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=4*t;return this.uint32[2*t+0]=e,this.uint16[i+2]=r,this.uint16[i+3]=n,t}}Oi.prototype.bytesPerElement=8,zn(\"StructArrayLayout1ul2ui8\",Oi);class Ui extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t}}Ui.prototype.bytesPerElement=4,zn(\"StructArrayLayout2ui4\",Ui);class Ri extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Ri.prototype.bytesPerElement=2,zn(\"StructArrayLayout1ui2\",Ri);class qi extends xi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const a=4*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.float32[a+3]=i,t}}qi.prototype.bytesPerElement=16,zn(\"StructArrayLayout4f16\",qi);class ji extends gi{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new i(this.anchorPointX,this.anchorPointY)}}ji.prototype.size=20;class Ni extends Ci{get(t){return new ji(this,t)}}zn(\"CollisionBoxArray\",Ni);class Zi extends gi{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t;}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t;}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t;}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Zi.prototype.size=48;class Ki extends Li{get(t){return new Zi(this,t)}}zn(\"PlacedSymbolArray\",Ki);class Gi extends gi{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t;}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}Gi.prototype.size=68;class Ji extends $i{get(t){return new Gi(this,t)}}zn(\"SymbolInstanceArray\",Ji);class Xi extends Di{getoffsetX(t){return this.float32[1*t+0]}}zn(\"GlyphOffsetArray\",Xi);class Yi extends _i{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}zn(\"SymbolLineVertexArray\",Yi);class Hi extends gi{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}Hi.prototype.size=8;class Wi extends Oi{get(t){return new Hi(this,t)}}zn(\"FeatureIndexArray\",Wi);class Qi extends wi{}class ta extends wi{}class ea extends wi{}class ra extends ki{}class na extends Si{}class ia extends Ii{}class aa extends zi{}class sa extends Mi{}class oa extends Pi{}class la extends Bi{}class ua extends Vi{}class ca extends Fi{}class ha extends Ti{}class pa extends Ui{}const fa=vi([{name:\"a_pos\",components:2,type:\"Int16\"}],4),{members:da}=fa;class ya{constructor(t=[]){this.segments=t;}prepareSegment(t,e,r,n){let i=this.segments[this.segments.length-1];return t>ya.MAX_VERTEX_ARRAY_LENGTH&&v(`Max vertices per segment is ${ya.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!i||i.vertexLength+t>ya.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy();}static simpleSegment(t,e,r,n){return new ya([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}function ma(t,e){return 256*(t=c(Math.floor(t),0,255))+c(Math.floor(e),0,255)}ya.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,zn(\"SegmentVector\",ya);const ga=vi([{name:\"a_pattern_from\",components:4,type:\"Uint16\"},{name:\"a_pattern_to\",components:4,type:\"Uint16\"},{name:\"a_pixel_ratio_from\",components:1,type:\"Uint16\"},{name:\"a_pixel_ratio_to\",components:1,type:\"Uint16\"}]);var xa={exports:{}},va={exports:{}};va.exports=function(t,e){var r,n,i,a,s,o,l,u;for(n=t.length-(r=3&t.length),i=e,s=3432918353,o=461845907,u=0;u<n;)l=255&t.charCodeAt(u)|(255&t.charCodeAt(++u))<<8|(255&t.charCodeAt(++u))<<16|(255&t.charCodeAt(++u))<<24,++u,i=27492+(65535&(a=5*(65535&(i=(i^=l=(65535&(l=(l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295;}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0};var ba=va.exports,wa={exports:{}};wa.exports=function(t,e){for(var r,n=t.length,i=e^n,a=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(a)|(255&t.charCodeAt(++a))<<8|(255&t.charCodeAt(++a))<<16|(255&t.charCodeAt(++a))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++a;switch(n){case 3:i^=(255&t.charCodeAt(a+2))<<16;case 2:i^=(255&t.charCodeAt(a+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(a)))+((1540483477*(i>>>16)&65535)<<16);}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0};var _a=ba,Aa=wa.exports;xa.exports=_a,xa.exports.murmur3=_a,xa.exports.murmur2=Aa;var ka=e(xa.exports);class Sa{constructor(){this.ids=[],this.positions=[],this.indexed=!1;}add(t,e,r,n){this.ids.push(Ia(t)),this.positions.push(e,r,n);}getPositions(t){if(!this.indexed)throw new Error(\"Trying to get index, but feature positions are not indexed\");const e=Ia(t);let r=0,n=this.ids.length-1;for(;r<n;){const t=r+n>>1;this.ids[t]>=e?n=t:r=t+1;}const i=[];for(;this.ids[r]===e;)i.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return i}static serialize(t,e){const r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return za(r,n,0,r.length-1),e&&e.push(r.buffer,n.buffer),{ids:r,positions:n}}static deserialize(t){const e=new Sa;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function Ia(t){const e=+t;return !isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:ka(String(t))}function za(t,e,r,n){for(;r<n;){const i=t[r+n>>1];let a=r-1,s=n+1;for(;;){do{a++;}while(t[a]<i);do{s--;}while(t[s]>i);if(a>=s)break;Ma(t,a,s),Ma(e,3*a,3*s),Ma(e,3*a+1,3*s+1),Ma(e,3*a+2,3*s+2);}s-r<n-s?(za(t,e,r,s),r=s+1):(za(t,e,s+1,n),n=s);}}function Ma(t,e,r){const n=t[e];t[e]=t[r],t[r]=n;}zn(\"FeaturePositionMap\",Sa);class Pa{constructor(t,e){this.gl=t.gl,this.location=e;}}class Ba extends Pa{constructor(t,e){super(t,e),this.current=0;}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t));}}class Ca extends Pa{constructor(t,e){super(t,e),this.current=[0,0,0,0];}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]));}}class Va extends Pa{constructor(t,e){super(t,e),this.current=jt.transparent;}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a));}}const Ea=new Float32Array(16);function Fa(t){return [ma(255*t.r,255*t.g),ma(255*t.b,255*t.a)]}class Ta{constructor(t,e,r){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=r;}setUniform(t,e,r){t.set(r.constantOr(this.value));}getBinding(t,e,r){return \"color\"===this.type?new Va(t,e):new Ba(t,e)}}class La{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1;}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr;}setUniform(t,e,r,n){const i=\"u_pattern_to\"===n?this.patternTo:\"u_pattern_from\"===n?this.patternFrom:\"u_pixel_ratio_to\"===n?this.pixelRatioTo:\"u_pixel_ratio_from\"===n?this.pixelRatioFrom:null;i&&t.set(i);}getBinding(t,e,r){return \"u_pattern\"===r.substr(0,9)?new Ca(t,e):new Ba(t,e)}}class $a{constructor(t,e,r,n){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:\"Float32\",components:\"color\"===r?2:1,offset:0}))),this.paintVertexArray=new n;}populatePaintArray(t,e,r,n,i){const a=this.paintVertexArray.length,s=this.expression.evaluate(new Qn(0),e,{},n,[],i);this.paintVertexArray.resize(t),this._setPaintValue(a,t,s);}updatePaintArray(t,e,r,n){const i=this.expression.evaluate({zoom:0},r,n);this._setPaintValue(t,e,i);}_setPaintValue(t,e,r){if(\"color\"===this.type){const n=Fa(r);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,n[0],n[1]);}else {for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,r);this.maxValue=Math.max(this.maxValue,Math.abs(r));}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent));}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy();}}class Da{constructor(t,e,r,n,i,a){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=r,this.useIntegerZoom=n,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:\"Float32\",components:\"color\"===r?4:2,offset:0}))),this.paintVertexArray=new a;}populatePaintArray(t,e,r,n,i){const a=this.expression.evaluate(new Qn(this.zoom),e,{},n,[],i),s=this.expression.evaluate(new Qn(this.zoom+1),e,{},n,[],i),o=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(o,t,a,s);}updatePaintArray(t,e,r,n){const i=this.expression.evaluate({zoom:this.zoom},r,n),a=this.expression.evaluate({zoom:this.zoom+1},r,n);this._setPaintValue(t,e,i,a);}_setPaintValue(t,e,r,n){if(\"color\"===this.type){const i=Fa(r),a=Fa(n);for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i[0],i[1],a[0],a[1]);}else {for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r,n);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(n));}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent));}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy();}setUniform(t,e){const r=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,n=c(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(n);}getBinding(t,e,r){return new Ba(t,e)}}class Oa{constructor(t,e,r,n,i,a){this.expression=t,this.type=e,this.useIntegerZoom=r,this.zoom=n,this.layerId=a,this.zoomInPaintVertexArray=new i,this.zoomOutPaintVertexArray=new i;}populatePaintArray(t,e,r){const n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(n,t,e.patterns&&e.patterns[this.layerId],r);}updatePaintArray(t,e,r,n,i){this._setPaintValues(t,e,r.patterns&&r.patterns[this.layerId],i);}_setPaintValues(t,e,r,n){if(!n||!r)return;const{min:i,mid:a,max:s}=r,o=n[i],l=n[a],u=n[s];if(o&&l&&u)for(let r=t;r<e;r++)this.zoomInPaintVertexArray.emplace(r,l.tl[0],l.tl[1],l.br[0],l.br[1],o.tl[0],o.tl[1],o.br[0],o.br[1],l.pixelRatio,o.pixelRatio),this.zoomOutPaintVertexArray.emplace(r,l.tl[0],l.tl[1],l.br[0],l.br[1],u.tl[0],u.tl[1],u.br[0],u.br[1],l.pixelRatio,u.pixelRatio);}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,ga.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,ga.members,this.expression.isStateDependent));}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy();}}class Ua{constructor(t,e,r){this.binders={},this._buffers=[];const n=[];for(const i in t.paint._values){if(!r(i))continue;const a=t.paint.get(i);if(!(a instanceof si&&fr(a.property.specification)))continue;const s=qa(i,t.type),o=a.value,l=a.property.specification.type,u=a.property.useIntegerZoom,c=a.property.specification[\"property-type\"],h=\"cross-faded\"===c||\"cross-faded-data-driven\"===c;if(\"constant\"===o.kind)this.binders[i]=h?new La(o.value,s):new Ta(o.value,s,l),n.push(`/u_${i}`);else if(\"source\"===o.kind||h){const r=ja(i,l,\"source\");this.binders[i]=h?new Oa(o,l,u,e,r,t.id):new $a(o,s,l,r),n.push(`/a_${i}`);}else {const t=ja(i,l,\"composite\");this.binders[i]=new Da(o,s,l,u,e,t),n.push(`/z_${i}`);}}this.cacheKey=n.sort().join(\"\");}getMaxValue(t){const e=this.binders[t];return e instanceof $a||e instanceof Da?e.maxValue:0}populatePaintArrays(t,e,r,n,i){for(const a in this.binders){const s=this.binders[a];(s instanceof $a||s instanceof Da||s instanceof Oa)&&s.populatePaintArray(t,e,r,n,i);}}setConstantPatternPositions(t,e){for(const r in this.binders){const n=this.binders[r];n instanceof La&&n.setConstantPatternPositions(t,e);}}updatePaintArrays(t,e,r,n,i){let a=!1;for(const s in t){const o=e.getPositions(s);for(const e of o){const o=r.feature(e.index);for(const r in this.binders){const l=this.binders[r];if((l instanceof $a||l instanceof Da||l instanceof Oa)&&!0===l.expression.isStateDependent){const u=n.paint.get(r);l.expression=u.value,l.updatePaintArray(e.start,e.end,o,t[s],i),a=!0;}}}}return a}defines(){const t=[];for(const e in this.binders){const r=this.binders[e];(r instanceof Ta||r instanceof La)&&t.push(...r.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)));}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof $a||r instanceof Da)for(let e=0;e<r.paintVertexAttributes.length;e++)t.push(r.paintVertexAttributes[e].name);else if(r instanceof Oa)for(let e=0;e<ga.members.length;e++)t.push(ga.members[e].name);}return t}getBinderUniforms(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof Ta||r instanceof La||r instanceof Da)for(const e of r.uniformNames)t.push(e);}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){const r=[];for(const n in this.binders){const i=this.binders[n];if(i instanceof Ta||i instanceof La||i instanceof Da)for(const a of i.uniformNames)if(e[a]){const s=i.getBinding(t,e[a],a);r.push({name:a,property:n,binding:s});}}return r}setUniforms(t,e,r,n){for(const{name:t,property:i,binding:a}of e)this.binders[i].setUniform(a,n,r.get(i),t);}updatePaintBuffers(t){this._buffers=[];for(const e in this.binders){const r=this.binders[e];if(t&&r instanceof Oa){const e=2===t.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;e&&this._buffers.push(e);}else (r instanceof $a||r instanceof Da)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer);}}upload(t){for(const e in this.binders){const r=this.binders[e];(r instanceof $a||r instanceof Da||r instanceof Oa)&&r.upload(t);}this.updatePaintBuffers();}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof $a||e instanceof Da||e instanceof Oa)&&e.destroy();}}}class Ra{constructor(t,e,r=(()=>!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new Ua(n,e,r);this.needsUpload=!1,this._featureMap=new Sa,this._bufferOffset=0;}populatePaintArrays(t,e,r,n,i,a){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,e,n,i,a);void 0!==e.id&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0;}updatePaintArrays(t,e,r,n){for(const i of r)this.needsUpload=this.programConfigurations[i.id].updatePaintArrays(t,this._featureMap,e,i,n)||this.needsUpload;}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1;}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy();}}function qa(t,e){return {\"text-opacity\":[\"opacity\"],\"icon-opacity\":[\"opacity\"],\"text-color\":[\"fill_color\"],\"icon-color\":[\"fill_color\"],\"text-halo-color\":[\"halo_color\"],\"icon-halo-color\":[\"halo_color\"],\"text-halo-blur\":[\"halo_blur\"],\"icon-halo-blur\":[\"halo_blur\"],\"text-halo-width\":[\"halo_width\"],\"icon-halo-width\":[\"halo_width\"],\"line-gap-width\":[\"gapwidth\"],\"line-pattern\":[\"pattern_to\",\"pattern_from\",\"pixel_ratio_to\",\"pixel_ratio_from\"],\"fill-pattern\":[\"pattern_to\",\"pattern_from\",\"pixel_ratio_to\",\"pixel_ratio_from\"],\"fill-extrusion-pattern\":[\"pattern_to\",\"pattern_from\",\"pixel_ratio_to\",\"pixel_ratio_from\"]}[t]||[t.replace(`${e}-`,\"\").replace(/-/g,\"_\")]}function ja(t,e,r){const n={color:{source:Ii,composite:qi},number:{source:Di,composite:Ii}},i=function(t){return {\"line-pattern\":{source:aa,composite:aa},\"fill-pattern\":{source:aa,composite:aa},\"fill-extrusion-pattern\":{source:aa,composite:aa}}[t]}(t);return i&&i[r]||n[e][r]}zn(\"ConstantBinder\",Ta),zn(\"CrossFadedConstantBinder\",La),zn(\"SourceExpressionBinder\",$a),zn(\"CrossFadedCompositeBinder\",Oa),zn(\"CompositeExpressionBinder\",Da),zn(\"ProgramConfiguration\",Ua,{omit:[\"_buffers\"]}),zn(\"ProgramConfigurationSet\",Ra);var Na=8192;const Za=Math.pow(2,14)-1,Ka=-Za-1;function Ga(t){const e=Na/t.extent,r=t.loadGeometry();for(let t=0;t<r.length;t++){const n=r[t];for(let t=0;t<n.length;t++){const r=n[t],i=Math.round(r.x*e),a=Math.round(r.y*e);r.x=c(i,Ka,Za),r.y=c(a,Ka,Za),(i<r.x||i>r.x+1||a<r.y||a>r.y+1)&&v(\"Geometry exceeds allowed extent, reduce your vector tile buffer size\");}}return r}function Ja(t,e){return {type:t.type,id:t.id,properties:t.properties,geometry:e?Ga(t):[]}}function Xa(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2);}class Ya{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ta,this.indexArray=new ha,this.segments=new ya,this.programConfigurations=new Ra(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,r){const n=this.layers[0],i=[];let a=null,s=!1;\"circle\"===n.type&&(a=n.layout.get(\"circle-sort-key\"),s=!a.isConstant());for(const{feature:e,id:n,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Ja(e,t);if(!this.layers[0]._featureFilter.filter(new Qn(this.zoom),u,r))continue;const c=s?a.evaluate(u,{},r):void 0,h={id:n,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Ga(e),patterns:{},sortKey:c};i.push(h);}s&&i.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of i){const{geometry:i,index:a,sourceLayerIndex:s}=n,o=t[a].feature;this.addFeature(n,i,a,r),e.featureIndex.insert(o,i,a,s,this.index);}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,da),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy());}addFeature(t,e,r,n){for(const r of e)for(const e of r){const r=e.x,n=e.y;if(r<0||r>=Na||n<0||n>=Na)continue;const i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),a=i.vertexLength;Xa(this.layoutVertexArray,r,n,-1,-1),Xa(this.layoutVertexArray,r,n,1,-1),Xa(this.layoutVertexArray,r,n,1,1),Xa(this.layoutVertexArray,r,n,-1,1),this.indexArray.emplaceBack(a,a+1,a+2),this.indexArray.emplaceBack(a,a+3,a+2),i.vertexLength+=4,i.primitiveLength+=2;}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n);}}function Ha(t,e){for(let r=0;r<t.length;r++)if(ss(e,t[r]))return !0;for(let r=0;r<e.length;r++)if(ss(t,e[r]))return !0;return !!es(t,e)}function Wa(t,e,r){return !!ss(t,e)||!!ns(e,t,r)}function Qa(t,e){if(1===t.length)return as(e,t[0]);for(let r=0;r<e.length;r++){const n=e[r];for(let e=0;e<n.length;e++)if(ss(t,n[e]))return !0}for(let r=0;r<t.length;r++)if(as(e,t[r]))return !0;for(let r=0;r<e.length;r++)if(es(t,e[r]))return !0;return !1}function ts(t,e,r){if(t.length>1){if(es(t,e))return !0;for(let n=0;n<e.length;n++)if(ns(e[n],t,r))return !0}for(let n=0;n<t.length;n++)if(ns(t[n],e,r))return !0;return !1}function es(t,e){if(0===t.length||0===e.length)return !1;for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1];for(let t=0;t<e.length-1;t++)if(rs(n,i,e[t],e[t+1]))return !0}return !1}function rs(t,e,r,n){return b(t,r,n)!==b(e,r,n)&&b(t,e,r)!==b(t,e,n)}function ns(t,e,r){const n=r*r;if(1===e.length)return t.distSqr(e[0])<n;for(let r=1;r<e.length;r++)if(is(t,e[r-1],e[r])<n)return !0;return !1}function is(t,e,r){const n=e.distSqr(r);if(0===n)return t.distSqr(e);const i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return t.distSqr(i<0?e:i>1?r:r.sub(e)._mult(i)._add(e))}function as(t,e){let r,n,i,a=!1;for(let s=0;s<t.length;s++){r=t[s];for(let t=0,s=r.length-1;t<r.length;s=t++)n=r[t],i=r[s],n.y>e.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(a=!a);}return a}function ss(t,e){let r=!1;for(let n=0,i=t.length-1;n<t.length;i=n++){const a=t[n],s=t[i];a.y>e.y!=s.y>e.y&&e.x<(s.x-a.x)*(e.y-a.y)/(s.y-a.y)+a.x&&(r=!r);}return r}function os(t,e,r){const n=r[0],i=r[2];if(t.x<n.x&&e.x<n.x||t.x>i.x&&e.x>i.x||t.y<n.y&&e.y<n.y||t.y>i.y&&e.y>i.y)return !1;const a=b(t,e,r[0]);return a!==b(t,e,r[1])||a!==b(t,e,r[2])||a!==b(t,e,r[3])}function ls(t,e,r){const n=e.paint.get(t).value;return \"constant\"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function us(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function cs(t,e,r,n,a){if(!e[0]&&!e[1])return t;const s=i.convert(e)._mult(a);\"viewport\"===r&&s._rotate(-n);const o=[];for(let e=0;e<t.length;e++)o.push(t[e].sub(s));return o}let hs,ps;zn(\"CircleBucket\",Ya,{omit:[\"layers\"]});var fs={get paint(){return ps=ps||new fi({\"circle-radius\":new ui(j.paint_circle[\"circle-radius\"]),\"circle-color\":new ui(j.paint_circle[\"circle-color\"]),\"circle-blur\":new ui(j.paint_circle[\"circle-blur\"]),\"circle-opacity\":new ui(j.paint_circle[\"circle-opacity\"]),\"circle-translate\":new li(j.paint_circle[\"circle-translate\"]),\"circle-translate-anchor\":new li(j.paint_circle[\"circle-translate-anchor\"]),\"circle-pitch-scale\":new li(j.paint_circle[\"circle-pitch-scale\"]),\"circle-pitch-alignment\":new li(j.paint_circle[\"circle-pitch-alignment\"]),\"circle-stroke-width\":new ui(j.paint_circle[\"circle-stroke-width\"]),\"circle-stroke-color\":new ui(j.paint_circle[\"circle-stroke-color\"]),\"circle-stroke-opacity\":new ui(j.paint_circle[\"circle-stroke-opacity\"])})},get layout(){return hs=hs||new fi({\"circle-sort-key\":new ui(j.layout_circle[\"circle-sort-key\"])})}},ds=1e-6,ys=\"undefined\"!=typeof Float32Array?Float32Array:Array;function ms(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function gs(t,e,r){var n=e[0],i=e[1],a=e[2],s=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],f=e[10],d=e[11],y=e[12],m=e[13],g=e[14],x=e[15],v=r[0],b=r[1],w=r[2],_=r[3];return t[0]=v*n+b*o+w*h+_*y,t[1]=v*i+b*l+w*p+_*m,t[2]=v*a+b*u+w*f+_*g,t[3]=v*s+b*c+w*d+_*x,t[4]=(v=r[4])*n+(b=r[5])*o+(w=r[6])*h+(_=r[7])*y,t[5]=v*i+b*l+w*p+_*m,t[6]=v*a+b*u+w*f+_*g,t[7]=v*s+b*c+w*d+_*x,t[8]=(v=r[8])*n+(b=r[9])*o+(w=r[10])*h+(_=r[11])*y,t[9]=v*i+b*l+w*p+_*m,t[10]=v*a+b*u+w*f+_*g,t[11]=v*s+b*c+w*d+_*x,t[12]=(v=r[12])*n+(b=r[13])*o+(w=r[14])*h+(_=r[15])*y,t[13]=v*i+b*l+w*p+_*m,t[14]=v*a+b*u+w*f+_*g,t[15]=v*s+b*c+w*d+_*x,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var xs,vs=gs;function bs(t,e,r){var n=e[0],i=e[1],a=e[2],s=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*s,t[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*s,t[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*s,t[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*s,t}function ws(t,e){const r=bs([],[t.x,t.y,0,1],e);return new i(r[0]/r[3],r[1]/r[3])}xs=new ys(4),ys!=Float32Array&&(xs[0]=0,xs[1]=0,xs[2]=0,xs[3]=0);class _s extends Ya{}let As;zn(\"HeatmapBucket\",_s,{omit:[\"layers\"]});var ks={get paint(){return As=As||new fi({\"heatmap-radius\":new ui(j.paint_heatmap[\"heatmap-radius\"]),\"heatmap-weight\":new ui(j.paint_heatmap[\"heatmap-weight\"]),\"heatmap-intensity\":new li(j.paint_heatmap[\"heatmap-intensity\"]),\"heatmap-color\":new pi(j.paint_heatmap[\"heatmap-color\"]),\"heatmap-opacity\":new li(j.paint_heatmap[\"heatmap-opacity\"])})}};function Ss(t,{width:e,height:r},n,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError(`mismatched image size. expected: ${i.length} but got: ${e*r*n}`)}else i=new Uint8Array(e*r*n);return t.width=e,t.height=r,t.data=i,t}function Is(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;const i=Ss({},{width:e,height:r},n);zs(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},n),t.width=e,t.height=r,t.data=i.data;}function zs(t,e,r,n,i,a){if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError(\"out of range source coordinates for image copy\");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError(\"out of range destination coordinates for image copy\");const s=t.data,o=e.data;if(s===o)throw new Error(\"srcData equals dstData, so image is already copied\");for(let l=0;l<i.height;l++){const u=((r.y+l)*t.width+r.x)*a,c=((n.y+l)*e.width+n.x)*a;for(let t=0;t<i.width*a;t++)o[c+t]=s[u+t];}return e}class Ms{constructor(t,e){Ss(this,t,1,e);}resize(t){Is(this,t,1);}clone(){return new Ms({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){zs(t,e,r,n,i,1);}}class Ps{constructor(t,e){Ss(this,t,4,e);}resize(t){Is(this,t,4);}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t;}clone(){return new Ps({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){zs(t,e,r,n,i,4);}}function Bs(t){const e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new Ps({width:r,height:n});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const a=(r,n,a)=>{e[t.evaluationKey]=a;const s=t.expression.evaluate(e);i.data[r+n+0]=Math.floor(255*s.r/s.a),i.data[r+n+1]=Math.floor(255*s.g/s.a),i.data[r+n+2]=Math.floor(255*s.b/s.a),i.data[r+n+3]=Math.floor(255*s.a);};if(t.clips)for(let e=0,i=0;e<n;++e,i+=4*r)for(let n=0,s=0;n<r;n++,s+=4){const o=n/(r-1),{start:l,end:u}=t.clips[e];a(i,s,l*(1-o)+u*o);}else for(let t=0,e=0;t<r;t++,e+=4)a(0,e,t/(r-1));return i}let Cs;zn(\"AlphaImage\",Ms),zn(\"RGBAImage\",Ps);var Vs={get paint(){return Cs=Cs||new fi({\"hillshade-illumination-direction\":new li(j.paint_hillshade[\"hillshade-illumination-direction\"]),\"hillshade-illumination-anchor\":new li(j.paint_hillshade[\"hillshade-illumination-anchor\"]),\"hillshade-exaggeration\":new li(j.paint_hillshade[\"hillshade-exaggeration\"]),\"hillshade-shadow-color\":new li(j.paint_hillshade[\"hillshade-shadow-color\"]),\"hillshade-highlight-color\":new li(j.paint_hillshade[\"hillshade-highlight-color\"]),\"hillshade-accent-color\":new li(j.paint_hillshade[\"hillshade-accent-color\"])})}};const Es=vi([{name:\"a_pos\",components:2,type:\"Int16\"}],4),{members:Fs}=Es;var Ts={exports:{}};function Ls(t,e,r){r=r||2;var n,i,a,s,o,l,u,c=e&&e.length,h=c?e[0]*r:t.length,p=$s(t,0,h,r,!0),f=[];if(!p||p.next===p.prev)return f;if(c&&(p=function(t,e,r,n){var i,a,s,o=[];for(i=0,a=e.length;i<a;i++)(s=$s(t,e[i]*n,i<a-1?e[i+1]*n:t.length,n,!1))===s.next&&(s.steiner=!0),o.push(Js(s));for(o.sort(Ns),i=0;i<o.length;i++)r=Zs(o[i],r);return r}(t,e,p,r)),t.length>80*r){n=a=t[0],i=s=t[1];for(var d=r;d<h;d+=r)(o=t[d])<n&&(n=o),(l=t[d+1])<i&&(i=l),o>a&&(a=o),l>s&&(s=l);u=0!==(u=Math.max(a-n,s-i))?32767/u:0;}return Os(p,f,r,n,i,u,0),f}function $s(t,e,r,n,i){var a,s;if(i===oo(t,e,r,n)>0)for(a=e;a<r;a+=n)s=io(a,t[a],t[a+1],s);else for(a=r-n;a>=e;a-=n)s=io(a,t[a],t[a+1],s);return s&&Ws(s,s.next)&&(ao(s),s=s.next),s}function Ds(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!Ws(n,n.next)&&0!==Hs(n.prev,n,n.next))n=n.next;else {if(ao(n),(n=e=n.prev)===n.next)break;r=!0;}}while(r||n!==e);return e}function Os(t,e,r,n,i,a,s){if(t){!s&&a&&function(t,e,r,n){var i=t;do{0===i.z&&(i.z=Gs(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,a,s,o,l,u=1;do{for(r=t,t=null,a=null,s=0;r;){for(s++,n=r,o=0,e=0;e<u&&(o++,n=n.nextZ);e++);for(l=u;o>0||l>0&&n;)0!==o&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,o--):(i=n,n=n.nextZ,l--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;r=n;}a.nextZ=null,u*=2;}while(s>1)}(i);}(t,n,i,a);for(var o,l,u=t;t.prev!==t.next;)if(o=t.prev,l=t.next,a?Rs(t,n,i,a):Us(t))e.push(o.i/r|0),e.push(t.i/r|0),e.push(l.i/r|0),ao(t),t=l.next,u=l.next;else if((t=l)===u){s?1===s?Os(t=qs(Ds(t),e,r),e,r,n,i,a,2):2===s&&js(t,e,r,n,i,a):Os(Ds(t),e,r,n,i,a,1);break}}}function Us(t){var e=t.prev,r=t,n=t.next;if(Hs(e,r,n)>=0)return !1;for(var i=e.x,a=r.x,s=n.x,o=e.y,l=r.y,u=n.y,c=i<a?i<s?i:s:a<s?a:s,h=o<l?o<u?o:u:l<u?l:u,p=i>a?i>s?i:s:a>s?a:s,f=o>l?o>u?o:u:l>u?l:u,d=n.next;d!==e;){if(d.x>=c&&d.x<=p&&d.y>=h&&d.y<=f&&Xs(i,o,a,l,s,u,d.x,d.y)&&Hs(d.prev,d,d.next)>=0)return !1;d=d.next;}return !0}function Rs(t,e,r,n){var i=t.prev,a=t,s=t.next;if(Hs(i,a,s)>=0)return !1;for(var o=i.x,l=a.x,u=s.x,c=i.y,h=a.y,p=s.y,f=o<l?o<u?o:u:l<u?l:u,d=c<h?c<p?c:p:h<p?h:p,y=o>l?o>u?o:u:l>u?l:u,m=c>h?c>p?c:p:h>p?h:p,g=Gs(f,d,e,r,n),x=Gs(y,m,e,r,n),v=t.prevZ,b=t.nextZ;v&&v.z>=g&&b&&b.z<=x;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==i&&v!==s&&Xs(o,c,l,h,u,p,v.x,v.y)&&Hs(v.prev,v,v.next)>=0)return !1;if(v=v.prevZ,b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==i&&b!==s&&Xs(o,c,l,h,u,p,b.x,b.y)&&Hs(b.prev,b,b.next)>=0)return !1;b=b.nextZ;}for(;v&&v.z>=g;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==i&&v!==s&&Xs(o,c,l,h,u,p,v.x,v.y)&&Hs(v.prev,v,v.next)>=0)return !1;v=v.prevZ;}for(;b&&b.z<=x;){if(b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==i&&b!==s&&Xs(o,c,l,h,u,p,b.x,b.y)&&Hs(b.prev,b,b.next)>=0)return !1;b=b.nextZ;}return !0}function qs(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!Ws(i,a)&&Qs(i,n,n.next,a)&&ro(i,a)&&ro(a,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(a.i/r|0),ao(n),ao(n.next),n=t=a),n=n.next;}while(n!==t);return Ds(n)}function js(t,e,r,n,i,a){var s=t;do{for(var o=s.next.next;o!==s.prev;){if(s.i!==o.i&&Ys(s,o)){var l=no(s,o);return s=Ds(s,s.next),l=Ds(l,l.next),Os(s,e,r,n,i,a,0),void Os(l,e,r,n,i,a,0)}o=o.next;}s=s.next;}while(s!==t)}function Ns(t,e){return t.x-e.x}function Zs(t,e){var r=function(t,e){var r,n=e,i=t.x,a=t.y,s=-1/0;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){var o=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(o<=i&&o>s&&(s=o,r=n.x<n.next.x?n:n.next,o===i))return r}n=n.next;}while(n!==e);if(!r)return null;var l,u=r,c=r.x,h=r.y,p=1/0;n=r;do{i>=n.x&&n.x>=c&&i!==n.x&&Xs(a<h?i:s,a,c,h,a<h?s:i,a,n.x,n.y)&&(l=Math.abs(a-n.y)/(i-n.x),ro(n,t)&&(l<p||l===p&&(n.x>r.x||n.x===r.x&&Ks(r,n)))&&(r=n,p=l)),n=n.next;}while(n!==u);return r}(t,e);if(!r)return e;var n=no(r,t);return Ds(n,n.next),Ds(r,r.next)}function Ks(t,e){return Hs(t.prev,t,e.prev)<0&&Hs(e.next,t,t.next)<0}function Gs(t,e,r,n,i){return (t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Js(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;}while(e!==t);return r}function Xs(t,e,r,n,i,a,s,o){return (i-s)*(e-o)>=(t-s)*(a-o)&&(t-s)*(n-o)>=(r-s)*(e-o)&&(r-s)*(a-o)>=(i-s)*(n-o)}function Ys(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Qs(r,r.next,t,e))return !0;r=r.next;}while(r!==t);return !1}(t,e)&&(ro(t,e)&&ro(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;}while(r!==t);return n}(t,e)&&(Hs(t.prev,t,e.prev)||Hs(t,e.prev,e))||Ws(t,e)&&Hs(t.prev,t,t.next)>0&&Hs(e.prev,e,e.next)>0)}function Hs(t,e,r){return (e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Ws(t,e){return t.x===e.x&&t.y===e.y}function Qs(t,e,r,n){var i=eo(Hs(t,e,r)),a=eo(Hs(t,e,n)),s=eo(Hs(r,n,t)),o=eo(Hs(r,n,e));return i!==a&&s!==o||!(0!==i||!to(t,r,e))||!(0!==a||!to(t,n,e))||!(0!==s||!to(r,t,n))||!(0!==o||!to(r,e,n))}function to(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function eo(t){return t>0?1:t<0?-1:0}function ro(t,e){return Hs(t.prev,t,t.next)<0?Hs(t,e,t.next)>=0&&Hs(t,t.prev,e)>=0:Hs(t,e,t.prev)<0||Hs(t,t.next,e)<0}function no(t,e){var r=new so(t.i,t.x,t.y),n=new so(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function io(t,e,r,n){var i=new so(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ao(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ);}function so(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1;}function oo(t,e,r,n){for(var i=0,a=e,s=r-n;a<r;a+=n)i+=(t[s]-t[a])*(t[a+1]+t[s+1]),s=a;return i}Ts.exports=Ls,Ts.exports.default=Ls,Ls.deviation=function(t,e,r,n){var i=e&&e.length,a=Math.abs(oo(t,0,i?e[0]*r:t.length,r));if(i)for(var s=0,o=e.length;s<o;s++)a-=Math.abs(oo(t,e[s]*r,s<o-1?e[s+1]*r:t.length,r));var l=0;for(s=0;s<n.length;s+=3){var u=n[s]*r,c=n[s+1]*r,h=n[s+2]*r;l+=Math.abs((t[u]-t[h])*(t[c+1]-t[u+1])-(t[u]-t[c])*(t[h+1]-t[u+1]));}return 0===a&&0===l?0:Math.abs((l-a)/a)},Ls.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var a=0;a<t[i].length;a++)for(var s=0;s<e;s++)r.vertices.push(t[i][a][s]);i>0&&r.holes.push(n+=t[i-1].length);}return r};var lo=e(Ts.exports);function uo(t,e,r,n,i){co(t,e,r||0,n||t.length-1,i||po);}function co(t,e,r,n,i){for(;n>r;){if(n-r>600){var a=n-r+1,s=e-r+1,o=Math.log(a),l=.5*Math.exp(2*o/3),u=.5*Math.sqrt(o*l*(a-l)/a)*(s-a/2<0?-1:1);co(t,e,Math.max(r,Math.floor(e-s*l/a+u)),Math.min(n,Math.floor(e+(a-s)*l/a+u)),i);}var c=t[e],h=r,p=n;for(ho(t,r,e),i(t[n],c)>0&&ho(t,r,n);h<p;){for(ho(t,h,p),h++,p--;i(t[h],c)<0;)h++;for(;i(t[p],c)>0;)p--;}0===i(t[r],c)?ho(t,r,p):ho(t,++p,n),p<=e&&(r=p+1),e<=p&&(n=p-1);}}function ho(t,e,r){var n=t[e];t[e]=t[r],t[r]=n;}function po(t,e){return t<e?-1:t>e?1:0}function fo(t,e){const r=t.length;if(r<=1)return [t];const n=[];let i,a;for(let e=0;e<r;e++){const r=w(t[e]);0!==r&&(t[e].area=Math.abs(r),void 0===a&&(a=r<0),a===r<0?(i&&n.push(i),i=[t[e]]):i.push(t[e]));}if(i&&n.push(i),e>1)for(let t=0;t<n.length;t++)n[t].length<=e||(uo(n[t],e,1,n[t].length-1,yo),n[t]=n[t].slice(0,e));return n}function yo(t,e){return e.area-t.area}function mo(t,e,r){const n=r.patternDependencies;let i=!1;for(const r of e){const e=r.paint.get(`${t}-pattern`);e.isConstant()||(i=!0);const a=e.constantOr(null);a&&(i=!0,n[a.to]=!0,n[a.from]=!0);}return i}function go(t,e,r,n,i){const a=i.patternDependencies;for(const s of e){const e=s.paint.get(`${t}-pattern`).value;if(\"constant\"!==e.kind){let t=e.evaluate({zoom:n-1},r,{},i.availableImages),o=e.evaluate({zoom:n},r,{},i.availableImages),l=e.evaluate({zoom:n+1},r,{},i.availableImages);t=t&&t.name?t.name:t,o=o&&o.name?o.name:o,l=l&&l.name?l.name:l,a[t]=!0,a[o]=!0,a[l]=!0,r.patterns[s.id]={min:t,mid:o,max:l};}}return r}class xo{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new ea,this.indexArray=new ha,this.indexArray2=new pa,this.programConfigurations=new Ra(t.layers,t.zoom),this.segments=new ya,this.segments2=new ya,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,r){this.hasPattern=mo(\"fill\",this.layers,e);const n=this.layers[0].layout.get(\"fill-sort-key\"),i=!n.isConstant(),a=[];for(const{feature:s,id:o,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Ja(s,t);if(!this.layers[0]._featureFilter.filter(new Qn(this.zoom),c,r))continue;const h=i?n.evaluate(c,{},r,e.availableImages):void 0,p={id:o,properties:s.properties,type:s.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Ga(s),patterns:{},sortKey:h};a.push(p);}i&&a.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of a){const{geometry:i,index:a,sourceLayerIndex:s}=n;if(this.hasPattern){const t=go(\"fill\",this.layers,n,this.zoom,e);this.patternFeatures.push(t);}else this.addFeature(n,i,a,r,{});e.featureIndex.insert(t[a].feature,i,a,s,this.index);}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r);}addFeatures(t,e,r){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Fs),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy());}addFeature(t,e,r,n,i){for(const t of fo(e,500)){let e=0;for(const r of t)e+=r.length;const r=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),n=r.vertexLength,i=[],a=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&a.push(i.length/2);const r=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),n=r.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(n+e.length-1,n),i.push(e[0].x),i.push(e[0].y);for(let t=1;t<e.length;t++)this.layoutVertexArray.emplaceBack(e[t].x,e[t].y),this.indexArray2.emplaceBack(n+t-1,n+t),i.push(e[t].x),i.push(e[t].y);r.vertexLength+=e.length,r.primitiveLength+=e.length;}const s=lo(i,a);for(let t=0;t<s.length;t+=3)this.indexArray.emplaceBack(n+s[t],n+s[t+1],n+s[t+2]);r.vertexLength+=e,r.primitiveLength+=s.length/3;}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n);}}let vo,bo;zn(\"FillBucket\",xo,{omit:[\"layers\",\"patternFeatures\"]});var wo={get paint(){return bo=bo||new fi({\"fill-antialias\":new li(j.paint_fill[\"fill-antialias\"]),\"fill-opacity\":new ui(j.paint_fill[\"fill-opacity\"]),\"fill-color\":new ui(j.paint_fill[\"fill-color\"]),\"fill-outline-color\":new ui(j.paint_fill[\"fill-outline-color\"]),\"fill-translate\":new li(j.paint_fill[\"fill-translate\"]),\"fill-translate-anchor\":new li(j.paint_fill[\"fill-translate-anchor\"]),\"fill-pattern\":new ci(j.paint_fill[\"fill-pattern\"])})},get layout(){return vo=vo||new fi({\"fill-sort-key\":new ui(j.layout_fill[\"fill-sort-key\"])})}};const _o=vi([{name:\"a_pos\",components:2,type:\"Int16\"},{name:\"a_normal_ed\",components:4,type:\"Int16\"}],4),Ao=vi([{name:\"a_centroid\",components:2,type:\"Int16\"}],4),{members:ko}=_o;var So={},Io=r,zo=Mo;function Mo(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields(Po,this,e);}function Po(t,e,r){1==t?e.id=r.readVarint():2==t?function(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i;}}(r,e):3==t?e.type=r.readVarint():4==t&&(e._geometry=r.pos);}function Bo(t){for(var e,r,n=0,i=0,a=t.length,s=a-1;i<a;s=i++)n+=((r=t[s]).x-(e=t[i]).x)*(e.y+r.y);return n}Mo.types=[\"Unknown\",\"Point\",\"LineString\",\"Polygon\"],Mo.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,r=t.readVarint()+t.pos,n=1,i=0,a=0,s=0,o=[];t.pos<r;){if(i<=0){var l=t.readVarint();n=7&l,i=l>>3;}if(i--,1===n||2===n)a+=t.readSVarint(),s+=t.readSVarint(),1===n&&(e&&o.push(e),e=[]),e.push(new Io(a,s));else {if(7!==n)throw new Error(\"unknown command \"+n);e&&e.push(e[0].clone());}}return e&&o.push(e),o},Mo.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,a=0,s=1/0,o=-1/0,l=1/0,u=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();r=7&c,n=c>>3;}if(n--,1===r||2===r)(i+=t.readSVarint())<s&&(s=i),i>o&&(o=i),(a+=t.readSVarint())<l&&(l=a),a>u&&(u=a);else if(7!==r)throw new Error(\"unknown command \"+r)}return [s,l,o,u]},Mo.prototype.toGeoJSON=function(t,e,r){var n,i,a=this.extent*Math.pow(2,r),s=this.extent*t,o=this.extent*e,l=this.loadGeometry(),u=Mo.types[this.type];function c(t){for(var e=0;e<t.length;e++){var r=t[e];t[e]=[360*(r.x+s)/a-180,360/Math.PI*Math.atan(Math.exp((180-360*(r.y+o)/a)*Math.PI/180))-90];}}switch(this.type){case 1:var h=[];for(n=0;n<l.length;n++)h[n]=l[n][0];c(l=h);break;case 2:for(n=0;n<l.length;n++)c(l[n]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return [t];for(var r,n,i=[],a=0;a<e;a++){var s=Bo(t[a]);0!==s&&(void 0===n&&(n=s<0),n===s<0?(r&&i.push(r),r=[t[a]]):r.push(t[a]));}return r&&i.push(r),i}(l),n=0;n<l.length;n++)for(i=0;i<l[n].length;i++)c(l[n][i]);}1===l.length?l=l[0]:u=\"Multi\"+u;var p={type:\"Feature\",geometry:{type:u,coordinates:l},properties:this.properties};return \"id\"in this&&(p.id=this.id),p};var Co=zo,Vo=Eo;function Eo(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Fo,this,e),this.length=this._features.length;}function Fo(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var n=t.readVarint()>>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null;}return e}(r));}Eo.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error(\"feature index out of bounds\");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new Co(this._pbf,e,this.extent,this._keys,this._values)};var To=Vo;function Lo(t,e,r){if(3===t){var n=new To(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n);}}So.VectorTile=function(t,e){this.layers=t.readFields(Lo,{},e);},So.VectorTileFeature=zo,So.VectorTileLayer=Vo;const $o=So.VectorTileFeature.types,Do=Math.pow(2,13);function Oo(t,e,r,n,i,a,s,o){t.emplaceBack(e,r,2*Math.floor(n*Do)+s,i*Do*2,a*Do*2,Math.round(o));}class Uo{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ra,this.centroidVertexArray=new Qi,this.indexArray=new ha,this.programConfigurations=new Ra(t.layers,t.zoom),this.segments=new ya,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,r){this.features=[],this.hasPattern=mo(\"fill-extrusion\",this.layers,e);for(const{feature:n,id:i,index:a,sourceLayerIndex:s}of t){const t=this.layers[0]._featureFilter.needGeometry,o=Ja(n,t);if(!this.layers[0]._featureFilter.filter(new Qn(this.zoom),o,r))continue;const l={id:i,sourceLayerIndex:s,index:a,geometry:t?o.geometry:Ga(n),properties:n.properties,type:n.type,patterns:{}};this.hasPattern?this.features.push(go(\"fill-extrusion\",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,a,r,{}),e.featureIndex.insert(n,l.geometry,a,s,this.index,!0);}}addFeatures(t,e,r){for(const t of this.features){const{geometry:n}=t;this.addFeature(t,n,t.index,e,r);}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r);}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ko),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Ao.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy());}addFeature(t,e,r,n,i){const a={x:0,y:0,vertexCount:0};for(const r of fo(e,500)){let e=0;for(const t of r)e+=t.length;let n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of r){if(0===t.length)continue;if(qo(t))continue;let e=0;for(let r=0;r<t.length;r++){const i=t[r];if(r>=1){const s=t[r-1];if(!Ro(i,s)){n.vertexLength+4>ya.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=i.sub(s)._perp()._unit(),r=s.dist(i);e+r>32768&&(e=0),Oo(this.layoutVertexArray,i.x,i.y,t.x,t.y,0,0,e),Oo(this.layoutVertexArray,i.x,i.y,t.x,t.y,0,1,e),a.x+=2*i.x,a.y+=2*i.y,a.vertexCount+=2,e+=r,Oo(this.layoutVertexArray,s.x,s.y,t.x,t.y,0,0,e),Oo(this.layoutVertexArray,s.x,s.y,t.x,t.y,0,1,e),a.x+=2*s.x,a.y+=2*s.y,a.vertexCount+=2;const o=n.vertexLength;this.indexArray.emplaceBack(o,o+2,o+1),this.indexArray.emplaceBack(o+1,o+2,o+3),n.vertexLength+=4,n.primitiveLength+=2;}}}}if(n.vertexLength+e>ya.MAX_VERTEX_ARRAY_LENGTH&&(n=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray)),\"Polygon\"!==$o[t.type])continue;const i=[],s=[],o=n.vertexLength;for(const t of r)if(0!==t.length){t!==r[0]&&s.push(i.length/2);for(let e=0;e<t.length;e++){const r=t[e];Oo(this.layoutVertexArray,r.x,r.y,0,0,1,1,0),a.x+=r.x,a.y+=r.y,a.vertexCount+=1,i.push(r.x),i.push(r.y);}}const l=lo(i,s);for(let t=0;t<l.length;t+=3)this.indexArray.emplaceBack(o+l[t],o+l[t+2],o+l[t+1]);n.primitiveLength+=l.length/3,n.vertexLength+=e;}for(let t=0;t<a.vertexCount;t++)this.centroidVertexArray.emplaceBack(Math.floor(a.x/a.vertexCount),Math.floor(a.y/a.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n);}}function Ro(t,e){return t.x===e.x&&(t.x<0||t.x>Na)||t.y===e.y&&(t.y<0||t.y>Na)}function qo(t){return t.every((t=>t.x<0))||t.every((t=>t.x>Na))||t.every((t=>t.y<0))||t.every((t=>t.y>Na))}let jo;zn(\"FillExtrusionBucket\",Uo,{omit:[\"layers\",\"features\"]});var No={get paint(){return jo=jo||new fi({\"fill-extrusion-opacity\":new li(j[\"paint_fill-extrusion\"][\"fill-extrusion-opacity\"]),\"fill-extrusion-color\":new ui(j[\"paint_fill-extrusion\"][\"fill-extrusion-color\"]),\"fill-extrusion-translate\":new li(j[\"paint_fill-extrusion\"][\"fill-extrusion-translate\"]),\"fill-extrusion-translate-anchor\":new li(j[\"paint_fill-extrusion\"][\"fill-extrusion-translate-anchor\"]),\"fill-extrusion-pattern\":new ci(j[\"paint_fill-extrusion\"][\"fill-extrusion-pattern\"]),\"fill-extrusion-height\":new ui(j[\"paint_fill-extrusion\"][\"fill-extrusion-height\"]),\"fill-extrusion-base\":new ui(j[\"paint_fill-extrusion\"][\"fill-extrusion-base\"]),\"fill-extrusion-vertical-gradient\":new li(j[\"paint_fill-extrusion\"][\"fill-extrusion-vertical-gradient\"])})}};function Zo(t,e){return t.x*e.x+t.y*e.y}function Ko(t,e){if(1===t.length){let r=0;const n=e[r++];let i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;r<e.length;r++){const a=e[r],s=t[0],o=i.sub(n),l=a.sub(n),u=s.sub(n),c=Zo(o,o),h=Zo(o,l),p=Zo(l,l),f=Zo(u,o),d=Zo(u,l),y=c*p-h*h,m=(p*f-h*d)/y,g=(c*d-h*f)/y,x=n.z*(1-m-g)+i.z*m+a.z*g;if(isFinite(x))return x}return 1/0}{let t=1/0;for(const r of e)t=Math.min(t,r.z);return t}}const Go=vi([{name:\"a_pos_normal\",components:2,type:\"Int16\"},{name:\"a_data\",components:4,type:\"Uint8\"}],4),{members:Jo}=Go,Xo=vi([{name:\"a_uv_x\",components:1,type:\"Float32\"},{name:\"a_split_index\",components:1,type:\"Float32\"}]),{members:Yo}=Xo,Ho=So.VectorTileFeature.types,Wo=Math.cos(Math.PI/180*37.5),Qo=Math.pow(2,14)/.5;class tl{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={};})),this.layoutVertexArray=new na,this.layoutVertexArray2=new ia,this.indexArray=new ha,this.programConfigurations=new Ra(t.layers,t.zoom),this.segments=new ya,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,r){this.hasPattern=mo(\"line\",this.layers,e);const n=this.layers[0].layout.get(\"line-sort-key\"),i=!n.isConstant(),a=[];for(const{feature:e,id:s,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Ja(e,t);if(!this.layers[0]._featureFilter.filter(new Qn(this.zoom),u,r))continue;const c=i?n.evaluate(u,{},r):void 0,h={id:s,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Ga(e),patterns:{},sortKey:c};a.push(h);}i&&a.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of a){const{geometry:i,index:a,sourceLayerIndex:s}=n;if(this.hasPattern){const t=go(\"line\",this.layers,n,this.zoom,e);this.patternFeatures.push(t);}else this.addFeature(n,i,a,r,{});e.featureIndex.insert(t[a].feature,i,a,s,this.index);}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r);}addFeatures(t,e,r){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Yo)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Jo),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy());}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,\"mapbox_clip_start\")&&Object.prototype.hasOwnProperty.call(t.properties,\"mapbox_clip_end\"))return {start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,r,n,i){const a=this.layers[0].layout,s=a.get(\"line-join\").evaluate(t,{}),o=a.get(\"line-cap\"),l=a.get(\"line-miter-limit\"),u=a.get(\"line-round-limit\");this.lineClips=this.lineFeatureClips(t);for(const r of e)this.addLine(r,t,s,o,l,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n);}addLine(t,e,r,n,i,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance);}const s=\"Polygon\"===Ho[e.type];let o=t.length;for(;o>=2&&t[o-1].equals(t[o-2]);)o--;let l=0;for(;l<o-1&&t[l].equals(t[l+1]);)l++;if(o<(s?3:2))return;\"bevel\"===r&&(i=1.05);const u=this.overscaling<=16?15*Na/(512*this.overscaling):0,c=this.segments.prepareSegment(10*o,this.layoutVertexArray,this.indexArray);let h,p,f,d,y;this.e1=this.e2=-1,s&&(h=t[o-2],y=t[l].sub(h)._unit()._perp());for(let e=l;e<o;e++){if(f=e===o-1?s?t[l+1]:void 0:t[e+1],f&&t[e].equals(f))continue;y&&(d=y),h&&(p=h),h=t[e],y=f?f.sub(h)._unit()._perp():d,d=d||y;let m=d.add(y);0===m.x&&0===m.y||m._unit();const g=d.x*y.x+d.y*y.y,x=m.x*y.x+m.y*y.y,v=0!==x?1/x:1/0,b=2*Math.sqrt(2-2*x),w=x<Wo&&p&&f,_=d.x*y.y-d.y*y.x>0;if(w&&e>l){const t=h.dist(p);if(t>2*u){const e=h.sub(h.sub(p)._mult(u/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,d,0,0,c),p=e;}}const A=p&&f;let k=A?r:s?\"butt\":n;if(A&&\"round\"===k&&(v<a?k=\"miter\":v<=2&&(k=\"fakeround\")),\"miter\"===k&&v>i&&(k=\"bevel\"),\"bevel\"===k&&(v>2&&(k=\"flipbevel\"),v<i&&(k=\"miter\")),p&&this.updateDistance(p,h),\"miter\"===k)m._mult(v),this.addCurrentVertex(h,m,0,0,c);else if(\"flipbevel\"===k){if(v>100)m=y.mult(-1);else {const t=v*d.add(y).mag()/d.sub(y).mag();m._perp()._mult(t*(_?-1:1));}this.addCurrentVertex(h,m,0,0,c),this.addCurrentVertex(h,m.mult(-1),0,0,c);}else if(\"bevel\"===k||\"fakeround\"===k){const t=-Math.sqrt(v*v-1),e=_?t:0,r=_?0:t;if(p&&this.addCurrentVertex(h,d,e,r,c),\"fakeround\"===k){const t=Math.round(180*b/Math.PI/20);for(let e=1;e<t;e++){let r=e/t;if(.5!==r){const t=r-.5;r+=r*t*(r-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*t*t+(.848013+g*(.215638*g-1.06021)));}const n=y.sub(d)._mult(r)._add(d)._unit()._mult(_?-1:1);this.addHalfVertex(h,n.x,n.y,!1,_,0,c);}}f&&this.addCurrentVertex(h,y,-e,-r,c);}else if(\"butt\"===k)this.addCurrentVertex(h,m,0,0,c);else if(\"square\"===k){const t=p?1:-1;this.addCurrentVertex(h,m,t,t,c);}else \"round\"===k&&(p&&(this.addCurrentVertex(h,d,0,0,c),this.addCurrentVertex(h,d,1,1,c,!0)),f&&(this.addCurrentVertex(h,y,-1,-1,c,!0),this.addCurrentVertex(h,y,0,0,c)));if(w&&e<o-1){const t=h.dist(f);if(t>2*u){const e=h.add(f.sub(h)._mult(u/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,y,0,0,c),h=e;}}}}addCurrentVertex(t,e,r,n,i,a=!1){const s=e.y*n-e.x,o=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,a,!1,r,i),this.addHalfVertex(t,s,o,a,!0,-n,i),this.distance>Qo/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,r,n,i,a));}addHalfVertex({x:t,y:e},r,n,i,a,s,o){const l=.5*(this.lineClips?this.scaledDistance*(Qo-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(i?1:0),(e<<1)+(a?1:0),Math.round(63*r)+128,Math.round(63*n)+128,1+(0===s?0:s<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),o.primitiveLength++),a?this.e2=u:this.e1=u;}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance;}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance();}}let el,rl;zn(\"LineBucket\",tl,{omit:[\"layers\",\"patternFeatures\"]});var nl={get paint(){return rl=rl||new fi({\"line-opacity\":new ui(j.paint_line[\"line-opacity\"]),\"line-color\":new ui(j.paint_line[\"line-color\"]),\"line-translate\":new li(j.paint_line[\"line-translate\"]),\"line-translate-anchor\":new li(j.paint_line[\"line-translate-anchor\"]),\"line-width\":new ui(j.paint_line[\"line-width\"]),\"line-gap-width\":new ui(j.paint_line[\"line-gap-width\"]),\"line-offset\":new ui(j.paint_line[\"line-offset\"]),\"line-blur\":new ui(j.paint_line[\"line-blur\"]),\"line-dasharray\":new hi(j.paint_line[\"line-dasharray\"]),\"line-pattern\":new ci(j.paint_line[\"line-pattern\"]),\"line-gradient\":new pi(j.paint_line[\"line-gradient\"])})},get layout(){return el=el||new fi({\"line-cap\":new li(j.layout_line[\"line-cap\"]),\"line-join\":new ui(j.layout_line[\"line-join\"]),\"line-miter-limit\":new li(j.layout_line[\"line-miter-limit\"]),\"line-round-limit\":new li(j.layout_line[\"line-round-limit\"]),\"line-sort-key\":new ui(j.layout_line[\"line-sort-key\"])})}};class il extends ui{possiblyEvaluate(t,e){return e=new Qn(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,n){return e=p({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,n)}}let al;function sl(t,e){return e>0?e+2*t:t}const ol=vi([{name:\"a_pos_offset\",components:4,type:\"Int16\"},{name:\"a_data\",components:4,type:\"Uint16\"},{name:\"a_pixeloffset\",components:4,type:\"Int16\"}],4),ll=vi([{name:\"a_projected_pos\",components:3,type:\"Float32\"}],4);vi([{name:\"a_fade_opacity\",components:1,type:\"Uint32\"}],4);const ul=vi([{name:\"a_placed\",components:2,type:\"Uint8\"},{name:\"a_shift\",components:2,type:\"Float32\"}]);vi([{type:\"Int16\",name:\"anchorPointX\"},{type:\"Int16\",name:\"anchorPointY\"},{type:\"Int16\",name:\"x1\"},{type:\"Int16\",name:\"y1\"},{type:\"Int16\",name:\"x2\"},{type:\"Int16\",name:\"y2\"},{type:\"Uint32\",name:\"featureIndex\"},{type:\"Uint16\",name:\"sourceLayerIndex\"},{type:\"Uint16\",name:\"bucketIndex\"}]);const cl=vi([{name:\"a_pos\",components:2,type:\"Int16\"},{name:\"a_anchor_pos\",components:2,type:\"Int16\"},{name:\"a_extrude\",components:2,type:\"Int16\"}],4),hl=vi([{name:\"a_pos\",components:2,type:\"Float32\"},{name:\"a_radius\",components:1,type:\"Float32\"},{name:\"a_flags\",components:2,type:\"Int16\"}],4);function pl(t,e,r){return t.sections.forEach((t=>{t.text=function(t,e,r){const n=e.layout.get(\"text-transform\").evaluate(r,{});return \"uppercase\"===n?t=t.toLocaleUpperCase():\"lowercase\"===n&&(t=t.toLocaleLowerCase()),Wn.applyArabicShaping&&(t=Wn.applyArabicShaping(t)),t}(t.text,e,r);})),t}vi([{name:\"triangle\",components:3,type:\"Uint16\"}]),vi([{type:\"Int16\",name:\"anchorX\"},{type:\"Int16\",name:\"anchorY\"},{type:\"Uint16\",name:\"glyphStartIndex\"},{type:\"Uint16\",name:\"numGlyphs\"},{type:\"Uint32\",name:\"vertexStartIndex\"},{type:\"Uint32\",name:\"lineStartIndex\"},{type:\"Uint32\",name:\"lineLength\"},{type:\"Uint16\",name:\"segment\"},{type:\"Uint16\",name:\"lowerSize\"},{type:\"Uint16\",name:\"upperSize\"},{type:\"Float32\",name:\"lineOffsetX\"},{type:\"Float32\",name:\"lineOffsetY\"},{type:\"Uint8\",name:\"writingMode\"},{type:\"Uint8\",name:\"placedOrientation\"},{type:\"Uint8\",name:\"hidden\"},{type:\"Uint32\",name:\"crossTileID\"},{type:\"Int16\",name:\"associatedIconIndex\"}]),vi([{type:\"Int16\",name:\"anchorX\"},{type:\"Int16\",name:\"anchorY\"},{type:\"Int16\",name:\"rightJustifiedTextSymbolIndex\"},{type:\"Int16\",name:\"centerJustifiedTextSymbolIndex\"},{type:\"Int16\",name:\"leftJustifiedTextSymbolIndex\"},{type:\"Int16\",name:\"verticalPlacedTextSymbolIndex\"},{type:\"Int16\",name:\"placedIconSymbolIndex\"},{type:\"Int16\",name:\"verticalPlacedIconSymbolIndex\"},{type:\"Uint16\",name:\"key\"},{type:\"Uint16\",name:\"textBoxStartIndex\"},{type:\"Uint16\",name:\"textBoxEndIndex\"},{type:\"Uint16\",name:\"verticalTextBoxStartIndex\"},{type:\"Uint16\",name:\"verticalTextBoxEndIndex\"},{type:\"Uint16\",name:\"iconBoxStartIndex\"},{type:\"Uint16\",name:\"iconBoxEndIndex\"},{type:\"Uint16\",name:\"verticalIconBoxStartIndex\"},{type:\"Uint16\",name:\"verticalIconBoxEndIndex\"},{type:\"Uint16\",name:\"featureIndex\"},{type:\"Uint16\",name:\"numHorizontalGlyphVertices\"},{type:\"Uint16\",name:\"numVerticalGlyphVertices\"},{type:\"Uint16\",name:\"numIconVertices\"},{type:\"Uint16\",name:\"numVerticalIconVertices\"},{type:\"Uint16\",name:\"useRuntimeCollisionCircles\"},{type:\"Uint32\",name:\"crossTileID\"},{type:\"Float32\",name:\"textBoxScale\"},{type:\"Float32\",components:2,name:\"textOffset\"},{type:\"Float32\",name:\"collisionCircleDiameter\"}]),vi([{type:\"Float32\",name:\"offsetX\"}]),vi([{type:\"Int16\",name:\"x\"},{type:\"Int16\",name:\"y\"},{type:\"Int16\",name:\"tileUnitDistanceFromAnchor\"}]);const fl={\"!\":\"︕\",\"#\":\"＃\",$:\"＄\",\"%\":\"％\",\"&\":\"＆\",\"(\":\"︵\",\")\":\"︶\",\"*\":\"＊\",\"+\":\"＋\",\",\":\"︐\",\"-\":\"︲\",\".\":\"・\",\"/\":\"／\",\":\":\"︓\",\";\":\"︔\",\"<\":\"︿\",\"=\":\"＝\",\">\":\"﹀\",\"?\":\"︖\",\"@\":\"＠\",\"[\":\"﹇\",\"\\\\\":\"＼\",\"]\":\"﹈\",\"^\":\"＾\",_:\"︳\",\"`\":\"｀\",\"{\":\"︷\",\"|\":\"―\",\"}\":\"︸\",\"~\":\"～\",\"¢\":\"￠\",\"£\":\"￡\",\"¥\":\"￥\",\"¦\":\"￤\",\"¬\":\"￢\",\"¯\":\"￣\",\"–\":\"︲\",\"—\":\"︱\",\"‘\":\"﹃\",\"’\":\"﹄\",\"“\":\"﹁\",\"”\":\"﹂\",\"…\":\"︙\",\"‧\":\"・\",\"₩\":\"￦\",\"、\":\"︑\",\"。\":\"︒\",\"〈\":\"︿\",\"〉\":\"﹀\",\"《\":\"︽\",\"》\":\"︾\",\"「\":\"﹁\",\"」\":\"﹂\",\"『\":\"﹃\",\"』\":\"﹄\",\"【\":\"︻\",\"】\":\"︼\",\"〔\":\"︹\",\"〕\":\"︺\",\"〖\":\"︗\",\"〗\":\"︘\",\"！\":\"︕\",\"（\":\"︵\",\"）\":\"︶\",\"，\":\"︐\",\"－\":\"︲\",\"．\":\"・\",\"：\":\"︓\",\"；\":\"︔\",\"＜\":\"︿\",\"＞\":\"﹀\",\"？\":\"︖\",\"［\":\"﹇\",\"］\":\"﹈\",\"＿\":\"︳\",\"｛\":\"︷\",\"｜\":\"―\",\"｝\":\"︸\",\"｟\":\"︵\",\"｠\":\"︶\",\"｡\":\"︒\",\"｢\":\"﹁\",\"｣\":\"﹂\"};var dl=24,yl=xl,ml=function(t,e,r,n,i){var a,s,o=8*i-n-1,l=(1<<o)-1,u=l>>1,c=-7,h=r?i-1:0,p=r?-1:1,f=t[e+h];for(h+=p,a=f&(1<<-c)-1,f>>=-c,c+=o;c>0;a=256*a+t[e+h],h+=p,c-=8);for(s=a&(1<<-c)-1,a>>=-c,c+=n;c>0;s=256*s+t[e+h],h+=p,c-=8);if(0===a)a=1-u;else {if(a===l)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),a-=u;}return (f?-1:1)*s*Math.pow(2,a-n)},gl=function(t,e,r,n,i,a){var s,o,l,u=8*a-i-1,c=(1<<u)-1,h=c>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:a-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=c?(o=0,s=c):s+h>=1?(o=(e*l-1)*Math.pow(2,i),s+=h):(o=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[r+f]=255&o,f+=d,o/=256,i-=8);for(s=s<<i|o,u+=i;u>0;t[r+f]=255&s,f+=d,s/=256,u-=8);t[r+f-d]|=128*y;};function xl(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length;}xl.Varint=0,xl.Fixed64=1,xl.Bytes=2,xl.Fixed32=5;var vl=4294967296,bl=1/vl,wl=\"undefined\"==typeof TextDecoder?null:new TextDecoder(\"utf8\");function _l(t){return t.type===xl.Bytes?t.readVarint()+t.pos:t.pos+1}function Al(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function kl(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i];}function Sl(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r]);}function Il(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r]);}function zl(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r]);}function Ml(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r]);}function Pl(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r]);}function Bl(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r]);}function Cl(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r]);}function Vl(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r]);}function El(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r]);}function Fl(t,e){return (t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function Tl(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24;}function Ll(t,e){return (t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}xl.prototype={destroy:function(){this.buf=null;},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,a=this.pos;this.type=7&n,t(i,e,this),this.pos===a&&this.skip(n);}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Fl(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Ll(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Fl(this.buf,this.pos)+Fl(this.buf,this.pos+4)*vl;return this.pos+=8,t},readSFixed64:function(){var t=Fl(this.buf,this.pos)+Ll(this.buf,this.pos+4)*vl;return this.pos+=8,t},readFloat:function(){var t=ml(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=ml(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,a=r.buf;if(n=(112&(i=a[r.pos++]))>>4,i<128)return Al(t,n,e);if(n|=(127&(i=a[r.pos++]))<<3,i<128)return Al(t,n,e);if(n|=(127&(i=a[r.pos++]))<<10,i<128)return Al(t,n,e);if(n|=(127&(i=a[r.pos++]))<<17,i<128)return Al(t,n,e);if(n|=(127&(i=a[r.pos++]))<<24,i<128)return Al(t,n,e);if(n|=(1&(i=a[r.pos++]))<<31,i<128)return Al(t,n,e);throw new Error(\"Expected varint not more than 10 bytes\")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&wl?function(t,e,r){return wl.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n=\"\",i=e;i<r;){var a,s,o,l=t[i],u=null,c=l>239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(a=t[i+1]))&&(u=(31&l)<<6|63&a)<=127&&(u=null):3===c?(s=t[i+2],128==(192&(a=t[i+1]))&&128==(192&s)&&((u=(15&l)<<12|(63&a)<<6|63&s)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(s=t[i+2],o=t[i+3],128==(192&(a=t[i+1]))&&128==(192&s)&&128==(192&o)&&((u=(15&l)<<18|(63&a)<<12|(63&s)<<6|63&o)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c;}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==xl.Bytes)return t.push(this.readVarint(e));var r=_l(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==xl.Bytes)return t.push(this.readSVarint());var e=_l(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==xl.Bytes)return t.push(this.readBoolean());var e=_l(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==xl.Bytes)return t.push(this.readFloat());var e=_l(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==xl.Bytes)return t.push(this.readDouble());var e=_l(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==xl.Bytes)return t.push(this.readFixed32());var e=_l(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==xl.Bytes)return t.push(this.readSFixed32());var e=_l(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==xl.Bytes)return t.push(this.readFixed64());var e=_l(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==xl.Bytes)return t.push(this.readSFixed64());var e=_l(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===xl.Varint)for(;this.buf[this.pos++]>127;);else if(e===xl.Bytes)this.pos=this.readVarint()+this.pos;else if(e===xl.Fixed32)this.pos+=4;else {if(e!==xl.Fixed64)throw new Error(\"Unimplemented type: \"+e);this.pos+=8;}},writeTag:function(t,e){this.writeVarint(t<<3|e);},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e;}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Tl(this.buf,t,this.pos),this.pos+=4;},writeSFixed32:function(t){this.realloc(4),Tl(this.buf,t,this.pos),this.pos+=4;},writeFixed64:function(t){this.realloc(8),Tl(this.buf,-1&t,this.pos),Tl(this.buf,Math.floor(t*bl),this.pos+4),this.pos+=8;},writeSFixed64:function(t){this.realloc(8),Tl(this.buf,-1&t,this.pos),Tl(this.buf,Math.floor(t*bl),this.pos+4),this.pos+=8;},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error(\"Given varint doesn't fit into 10 bytes\");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7);}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))));}(n,e);}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))));},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t);},writeBoolean:function(t){this.writeVarint(Boolean(t));},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,a=0;a<e.length;a++){if((n=e.charCodeAt(a))>55295&&n<57344){if(!i){n>56319||a+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null;}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128);}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&kl(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r;},writeFloat:function(t){this.realloc(4),gl(this.buf,t,this.pos,!0,23,4),this.pos+=4;},writeDouble:function(t){this.realloc(8),gl(this.buf,t,this.pos,!0,52,8),this.pos+=8;},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r];},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&kl(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n;},writeMessage:function(t,e,r){this.writeTag(t,xl.Bytes),this.writeRawMessage(e,r);},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Sl,e);},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Il,e);},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Pl,e);},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,zl,e);},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Ml,e);},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Bl,e);},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Cl,e);},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Vl,e);},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,El,e);},writeBytesField:function(t,e){this.writeTag(t,xl.Bytes),this.writeBytes(e);},writeFixed32Field:function(t,e){this.writeTag(t,xl.Fixed32),this.writeFixed32(e);},writeSFixed32Field:function(t,e){this.writeTag(t,xl.Fixed32),this.writeSFixed32(e);},writeFixed64Field:function(t,e){this.writeTag(t,xl.Fixed64),this.writeFixed64(e);},writeSFixed64Field:function(t,e){this.writeTag(t,xl.Fixed64),this.writeSFixed64(e);},writeVarintField:function(t,e){this.writeTag(t,xl.Varint),this.writeVarint(e);},writeSVarintField:function(t,e){this.writeTag(t,xl.Varint),this.writeSVarint(e);},writeStringField:function(t,e){this.writeTag(t,xl.Bytes),this.writeString(e);},writeFloatField:function(t,e){this.writeTag(t,xl.Fixed32),this.writeFloat(e);},writeDoubleField:function(t,e){this.writeTag(t,xl.Fixed64),this.writeDouble(e);},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e));}};var $l=e(yl);const Dl=3;function Ol(t,e,r){1===t&&r.readMessage(Ul,e);}function Ul(t,e,r){if(3===t){const{id:t,bitmap:n,width:i,height:a,left:s,top:o,advance:l}=r.readMessage(Rl,{});e.push({id:t,bitmap:new Ms({width:i+2*Dl,height:a+2*Dl},n),metrics:{width:i,height:a,left:s,top:o,advance:l}});}}function Rl(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint());}const ql=Dl;function jl(t){let e=0,r=0;for(const n of t)e+=n.w*n.h,r=Math.max(r,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let i=0,a=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const r=n[t];if(!(e.w>r.w||e.h>r.h)){if(e.x=r.x,e.y=r.y,a=Math.max(a,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===r.w&&e.h===r.h){const e=n.pop();t<n.length&&(n[t]=e);}else e.h===r.h?(r.x+=e.w,r.w-=e.w):e.w===r.w?(r.y+=e.h,r.h-=e.h):(n.push({x:r.x+e.w,y:r.y,w:r.w-e.w,h:e.h}),r.y+=e.h,r.h-=e.h);break}}return {w:i,h:a,fill:e/(i*a)||0}}const Nl=1;class Zl{constructor(t,{pixelRatio:e,version:r,stretchX:n,stretchY:i,content:a}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=i,this.content=a,this.version=r;}get tl(){return [this.paddedRect.x+Nl,this.paddedRect.y+Nl]}get br(){return [this.paddedRect.x+this.paddedRect.w-Nl,this.paddedRect.y+this.paddedRect.h-Nl]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return [(this.paddedRect.w-2*Nl)/this.pixelRatio,(this.paddedRect.h-2*Nl)/this.pixelRatio]}}class Kl{constructor(t,e){const r={},n={};this.haveRenderCallbacks=[];const i=[];this.addImages(t,r,i),this.addImages(e,n,i);const{w:a,h:s}=jl(i),o=new Ps({width:a||1,height:s||1});for(const e in t){const n=t[e],i=r[e].paddedRect;Ps.copy(n.data,o,{x:0,y:0},{x:i.x+Nl,y:i.y+Nl},n.data);}for(const t in e){const r=e[t],i=n[t].paddedRect,a=i.x+Nl,s=i.y+Nl,l=r.data.width,u=r.data.height;Ps.copy(r.data,o,{x:0,y:0},{x:a,y:s},r.data),Ps.copy(r.data,o,{x:0,y:u-1},{x:a,y:s-1},{width:l,height:1}),Ps.copy(r.data,o,{x:0,y:0},{x:a,y:s+u},{width:l,height:1}),Ps.copy(r.data,o,{x:l-1,y:0},{x:a-1,y:s},{width:1,height:u}),Ps.copy(r.data,o,{x:0,y:0},{x:a+l,y:s},{width:1,height:u});}this.image=o,this.iconPositions=r,this.patternPositions=n;}addImages(t,e,r){for(const n in t){const i=t[n],a={x:0,y:0,w:i.data.width+2*Nl,h:i.data.height+2*Nl};r.push(a),e[n]=new Zl(a,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n);}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const r in t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e);}patchUpdatedImage(t,e,r){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[n,i]=t.tl;r.update(e.data,void 0,{x:n,y:i});}}var Gl;zn(\"ImagePosition\",Zl),zn(\"ImageAtlas\",Kl),t.WritingMode=void 0,(Gl=t.WritingMode||(t.WritingMode={}))[Gl.none=0]=\"none\",Gl[Gl.horizontal=1]=\"horizontal\",Gl[Gl.vertical=2]=\"vertical\",Gl[Gl.horizontalOnly=3]=\"horizontalOnly\";const Jl=-17;class Xl{constructor(){this.scale=1,this.fontStack=\"\",this.imageName=null;}static forText(t,e){const r=new Xl;return r.scale=t||1,r.fontStack=e,r}static forImage(t){const e=new Xl;return e.imageName=t,e}}class Yl{constructor(){this.text=\"\",this.sectionIndex=[],this.sections=[],this.imageSectionID=null;}static fromFeature(t,e){const r=new Yl;for(let n=0;n<t.sections.length;n++){const i=t.sections[n];i.image?r.addImageSection(i):r.addTextSection(i,e);}return r}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let e=\"\";for(let r=0;r<t.length;r++){const n=t.charCodeAt(r+1)||null,i=t.charCodeAt(r-1)||null;e+=n&&$n(n)&&!fl[t[r+1]]||i&&$n(i)&&!fl[t[r-1]]||!fl[t[r]]?t[r]:fl[t[r]];}return e}(this.text);}trim(){let t=0;for(let e=0;e<this.text.length&&Wl[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let r=this.text.length-1;r>=0&&r>=t&&Wl[this.text.charCodeAt(r)];r--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e);}substring(t,e){const r=new Yl;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(Xl.forText(t.scale,t.fontStack||e));const r=this.sections.length-1;for(let e=0;e<t.text.length;++e)this.sectionIndex.push(r);}addImageSection(t){const e=t.image?t.image.name:\"\";if(0===e.length)return void v(\"Can't add FormattedSection with an empty image.\");const r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push(Xl.forImage(e)),this.sectionIndex.push(this.sections.length-1)):v(\"Reached maximum number of images 6401\");}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Hl(e,r,n,i,a,s,o,l,u,c,h,p,f,d,y,m){const g=Yl.fromFeature(e,a);let x;p===t.WritingMode.vertical&&g.verticalizePunctuation();const{processBidirectionalText:v,processStyledBidirectionalText:b}=Wn;if(v&&1===g.sections.length){x=[];const t=v(g.toString(),au(g,c,s,r,i,d,y));for(const e of t){const t=new Yl;t.text=e,t.sections=g.sections;for(let r=0;r<e.length;r++)t.sectionIndex.push(0);x.push(t);}}else if(b){x=[];const t=b(g.text,g.sectionIndex,au(g,c,s,r,i,d,y));for(const e of t){const t=new Yl;t.text=e[0],t.sectionIndex=e[1],t.sections=g.sections,x.push(t);}}else x=function(t,e){const r=[],n=t.text;let i=0;for(const n of e)r.push(t.substring(i,n)),i=n;return i<n.length&&r.push(t.substring(i,n.length)),r}(g,au(g,c,s,r,i,d,y));const w=[],_={positionedLines:w,text:g.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(e,r,n,i,a,s,o,l,u,c,h,p){let f=0,d=Jl,y=0,m=0;const g=\"right\"===l?1:\"left\"===l?0:.5;let x=0;for(const o of a){o.trim();const a=o.getMaxScale(),l=(a-1)*dl,b={positionedGlyphs:[],lineOffset:0};e.positionedLines[x]=b;const w=b.positionedGlyphs;let _=0;if(!o.length()){d+=s,++x;continue}for(let s=0;s<o.length();s++){const y=o.getSection(s),m=o.getSectionIndex(s),g=o.getCharCode(s);let x=0,b=null,A=null,k=null,S=dl;const I=!(u===t.WritingMode.horizontal||!h&&!Ln(g)||h&&(Wl[g]||(v=g,Vn.Arabic(v)||Vn[\"Arabic Supplement\"](v)||Vn[\"Arabic Extended-A\"](v)||Vn[\"Arabic Presentation Forms-A\"](v)||Vn[\"Arabic Presentation Forms-B\"](v))));if(y.imageName){const t=i[y.imageName];if(!t)continue;k=y.imageName,e.iconsInText=e.iconsInText||!0,A=t.paddedRect;const r=t.displaySize;y.scale=y.scale*dl/p,b={width:r[0],height:r[1],left:Nl,top:-ql,advance:I?r[1]:r[0]},x=l+(dl-r[1]*y.scale),S=b.advance;const n=I?r[0]*y.scale-dl*a:r[1]*y.scale-dl*a;n>0&&n>_&&(_=n);}else {const t=n[y.fontStack],e=t&&t[g];if(e&&e.rect)A=e.rect,b=e.metrics;else {const t=r[y.fontStack],e=t&&t[g];if(!e)continue;b=e.metrics;}x=(a-y.scale)*dl;}I?(e.verticalizable=!0,w.push({glyph:g,imageName:k,x:f,y:d+x,vertical:I,scale:y.scale,fontStack:y.fontStack,sectionIndex:m,metrics:b,rect:A}),f+=S*y.scale+c):(w.push({glyph:g,imageName:k,x:f,y:d+x,vertical:I,scale:y.scale,fontStack:y.fontStack,sectionIndex:m,metrics:b,rect:A}),f+=b.advance*y.scale+c);}0!==w.length&&(y=Math.max(f-c,y),ou(w,0,w.length-1,g,_)),f=0;const A=s*a+_;b.lineOffset=Math.max(_,l),d+=A,m=Math.max(A,m),++x;}var v;const b=d-Jl,{horizontalAlign:w,verticalAlign:_}=su(o);((function(t,e,r,n,i,a,s,o,l){const u=(e-r)*i;let c=0;c=a!==s?-o*n-Jl:(-n*l+.5)*s;for(const e of t)for(const t of e.positionedGlyphs)t.x+=u,t.y+=c;}))(e.positionedLines,g,w,_,y,m,s,b,a.length),e.top+=-_*b,e.bottom=e.top+b,e.left+=-w*y,e.right=e.left+y;}(_,r,n,i,x,o,l,u,p,c,f,m),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return !1;return !0}(w)&&_}const Wl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Ql={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function tu(t,e,r,n,i,a){if(e.imageName){const t=n[e.imageName];return t?t.displaySize[0]*e.scale*dl/a+i:0}{const n=r[e.fontStack],a=n&&n[t];return a?a.metrics.advance*e.scale+i:0}}function eu(t,e,r,n){const i=Math.pow(t-e,2);return n?t<e?i/2:2*i:i+Math.abs(r)*r}function ru(t,e,r){let n=0;return 10===t&&(n-=1e4),r&&(n+=150),40!==t&&65288!==t||(n+=50),41!==e&&65289!==e||(n+=50),n}function nu(t,e,r,n,i,a){let s=null,o=eu(e,r,i,a);for(const t of n){const n=eu(e-t.x,r,i,a)+t.badness;n<=o&&(s=t,o=n);}return {index:t,x:e,priorBreak:s,badness:o}}function iu(t){return t?iu(t.priorBreak).concat(t.index):[]}function au(t,e,r,n,i,a,s){if(\"point\"!==a)return [];if(!t)return [];const o=[],l=function(t,e,r,n,i,a){let s=0;for(let r=0;r<t.length();r++){const o=t.getSection(r);s+=tu(t.getCharCode(r),o,n,i,e,a);}return s/Math.max(1,Math.ceil(s/r))}(t,e,r,n,i,s),u=t.text.indexOf(\"​\")>=0;let c=0;for(let r=0;r<t.length();r++){const a=t.getSection(r),p=t.getCharCode(r);if(Wl[p]||(c+=tu(p,a,n,i,e,s)),r<t.length()-1){const e=!((h=p)<11904||!(Vn[\"Bopomofo Extended\"](h)||Vn.Bopomofo(h)||Vn[\"CJK Compatibility Forms\"](h)||Vn[\"CJK Compatibility Ideographs\"](h)||Vn[\"CJK Compatibility\"](h)||Vn[\"CJK Radicals Supplement\"](h)||Vn[\"CJK Strokes\"](h)||Vn[\"CJK Symbols and Punctuation\"](h)||Vn[\"CJK Unified Ideographs Extension A\"](h)||Vn[\"CJK Unified Ideographs\"](h)||Vn[\"Enclosed CJK Letters and Months\"](h)||Vn[\"Halfwidth and Fullwidth Forms\"](h)||Vn.Hiragana(h)||Vn[\"Ideographic Description Characters\"](h)||Vn[\"Kangxi Radicals\"](h)||Vn[\"Katakana Phonetic Extensions\"](h)||Vn.Katakana(h)||Vn[\"Vertical Forms\"](h)||Vn[\"Yi Radicals\"](h)||Vn[\"Yi Syllables\"](h)));(Ql[p]||e||a.imageName)&&o.push(nu(r+1,c,l,o,ru(p,t.getCharCode(r+1),e&&u),!1));}}var h;return iu(nu(t.length(),c,l,o,0,!0))}function su(t){let e=.5,r=.5;switch(t){case\"right\":case\"top-right\":case\"bottom-right\":e=1;break;case\"left\":case\"top-left\":case\"bottom-left\":e=0;}switch(t){case\"bottom\":case\"bottom-right\":case\"bottom-left\":r=1;break;case\"top\":case\"top-right\":case\"top-left\":r=0;}return {horizontalAlign:e,verticalAlign:r}}function ou(t,e,r,n,i){if(!n&&!i)return;const a=t[r],s=(t[r].x+a.metrics.advance*a.scale)*n;for(let n=e;n<=r;n++)t[n].x-=s,t[n].y+=i;}function lu(t,e,r){const{horizontalAlign:n,verticalAlign:i}=su(r),a=e[0]-t.displaySize[0]*n,s=e[1]-t.displaySize[1]*i;return {image:t,top:s,bottom:s+t.displaySize[1],left:a,right:a+t.displaySize[0]}}function uu(t,e,r,n,i,a){const s=t.image;let o;if(s.content){const t=s.content,e=s.pixelRatio||1;o=[t[0]/e,t[1]/e,s.displaySize[0]-t[2]/e,s.displaySize[1]-t[3]/e];}const l=e.left*a,u=e.right*a;let c,h,p,f;\"width\"===r||\"both\"===r?(f=i[0]+l-n[3],h=i[0]+u+n[1]):(f=i[0]+(l+u-s.displaySize[0])/2,h=f+s.displaySize[0]);const d=e.top*a,y=e.bottom*a;return \"height\"===r||\"both\"===r?(c=i[1]+d-n[0],p=i[1]+y+n[2]):(c=i[1]+(d+y-s.displaySize[1])/2,p=c+s.displaySize[1]),{image:s,top:c,right:h,bottom:p,left:f,collisionPadding:o}}const cu=255,hu=128,pu=cu*hu;function fu(t,e){const{expression:r}=e;if(\"constant\"===r.kind)return {kind:\"constant\",layoutSize:r.evaluate(new Qn(t+1))};if(\"source\"===r.kind)return {kind:\"source\"};{const{zoomStops:e,interpolationType:n}=r;let i=0;for(;i<e.length&&e[i]<=t;)i++;i=Math.max(0,i-1);let a=i;for(;a<e.length&&e[a]<t+1;)a++;a=Math.min(e.length-1,a);const s=e[i],o=e[a];return \"composite\"===r.kind?{kind:\"composite\",minZoom:s,maxZoom:o,interpolationType:n}:{kind:\"camera\",minZoom:s,maxZoom:o,minSize:r.evaluate(new Qn(s)),maxSize:r.evaluate(new Qn(o)),interpolationType:n}}}function du(t,e,r){let n=\"never\";const i=t.get(e);return i?n=i:t.get(r)&&(n=\"always\"),n}const yu=So.VectorTileFeature.types,mu=[{name:\"a_fade_opacity\",components:1,type:\"Uint8\",offset:0}];function gu(t,e,r,n,i,a,s,o,l,u,c,h,p){const f=o?Math.min(pu,Math.round(o[0])):0,d=o?Math.min(pu,Math.round(o[1])):0;t.emplaceBack(e,r,Math.round(32*n),Math.round(32*i),a,s,(f<<1)+(l?1:0),d,16*u,16*c,256*h,256*p);}function xu(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r);}function vu(t){for(const e of t.sections)if(Un(e.text))return !0;return !1}class bu{constructor(t){this.layoutVertexArray=new sa,this.indexArray=new ha,this.programConfigurations=t,this.segments=new ya,this.dynamicLayoutVertexArray=new oa,this.opacityVertexArray=new la,this.hasVisibleVertices=!1,this.placedSymbolArray=new Ki;}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,r,n){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ol.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,ll.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,mu,!0),this.opacityVertexBuffer.itemSize=1),(r||n)&&this.programConfigurations.upload(t));}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy());}}zn(\"SymbolBuffers\",bu);class wu{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new ya,this.collisionVertexArray=new ca;}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,ul.members,!0);}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy());}}zn(\"CollisionBuffers\",wu);class _u{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ms([]),this.placementViewportMatrix=ms([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=fu(this.zoom,r[\"text-size\"]),this.iconSizeData=fu(this.zoom,r[\"icon-size\"]);const n=this.layers[0].layout,i=n.get(\"symbol-sort-key\"),a=n.get(\"symbol-z-order\");this.canOverlap=\"never\"!==du(n,\"text-overlap\",\"text-allow-overlap\")||\"never\"!==du(n,\"icon-overlap\",\"icon-allow-overlap\")||n.get(\"text-ignore-placement\")||n.get(\"icon-ignore-placement\"),this.sortFeaturesByKey=\"viewport-y\"!==a&&!i.isConstant(),this.sortFeaturesByY=(\"viewport-y\"===a||\"auto\"===a&&!this.sortFeaturesByKey)&&this.canOverlap,\"point\"===n.get(\"symbol-placement\")&&(this.writingModes=n.get(\"text-writing-mode\").map((e=>t.WritingMode[e]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=e.sourceID;}createArrays(){this.text=new bu(new Ra(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new bu(new Ra(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new Xi,this.lineVertexArray=new Yi,this.symbolInstances=new Ji;}calculateGlyphDependencies(t,e,r,n,i){for(let a=0;a<t.length;a++)if(e[t.charCodeAt(a)]=!0,(r||n)&&i){const r=fl[t.charAt(a)];r&&(e[r.charCodeAt(0)]=!0);}}populate(e,r,n){const i=this.layers[0],a=i.layout,s=a.get(\"text-font\"),o=a.get(\"text-field\"),l=a.get(\"icon-image\"),u=(\"constant\"!==o.value.kind||o.value.value instanceof Kt&&!o.value.value.isEmpty()||o.value.value.toString().length>0)&&(\"constant\"!==s.value.kind||s.value.value.length>0),c=\"constant\"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=a.get(\"symbol-sort-key\");if(this.features=[],!u&&!c)return;const p=r.iconDependencies,f=r.glyphDependencies,d=r.availableImages,y=new Qn(this.zoom);for(const{feature:r,id:o,index:l,sourceLayerIndex:m}of e){const e=i._featureFilter.needGeometry,g=Ja(r,e);if(!i._featureFilter.filter(y,g,n))continue;let x,v;if(e||(g.geometry=Ga(r)),u){const t=i.getValueAndResolveTokens(\"text-field\",g,n,d),e=Kt.factory(t);vu(e)&&(this.hasRTLText=!0),(!this.hasRTLText||\"unavailable\"===Yn()||this.hasRTLText&&Wn.isParsed())&&(x=pl(e,i,g));}if(c){const t=i.getValueAndResolveTokens(\"icon-image\",g,n,d);v=t instanceof Jt?t:Jt.fromString(t);}if(!x&&!v)continue;const b=this.sortFeaturesByKey?h.evaluate(g,{},n):void 0;if(this.features.push({id:o,text:x,icon:v,index:l,sourceLayerIndex:m,geometry:g.geometry,properties:r.properties,type:yu[r.type],sortKey:b}),v&&(p[v.name]=!0),x){const e=s.evaluate(g,{},n).join(\",\"),r=\"viewport\"!==a.get(\"text-rotation-alignment\")&&\"point\"!==a.get(\"symbol-placement\");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.WritingMode.vertical)>=0;for(const t of x.sections)if(t.image)p[t.image.name]=!0;else {const n=En(x.toString()),i=t.fontStack||e,a=f[i]=f[i]||{};this.calculateGlyphDependencies(t.text,a,r,this.allowVerticalPlacement,n);}}}\"line\"===a.get(\"symbol-placement\")&&(this.features=function(t){const e={},r={},n=[];let i=0;function a(e){n.push(t[e]),i++;}function s(t,e,i){const a=r[t];return delete r[t],r[e]=a,n[a].geometry[0].pop(),n[a].geometry[0]=n[a].geometry[0].concat(i[0]),a}function o(t,r,i){const a=e[r];return delete e[r],e[t]=a,n[a].geometry[0].shift(),n[a].geometry[0]=i[0].concat(n[a].geometry[0]),a}function l(t,e,r){const n=r?e[0][e[0].length-1]:e[0][0];return `${t}:${n.x}:${n.y}`}for(let u=0;u<t.length;u++){const c=t[u],h=c.geometry,p=c.text?c.text.toString():null;if(!p){a(u);continue}const f=l(p,h),d=l(p,h,!0);if(f in r&&d in e&&r[f]!==e[d]){const t=o(f,d,h),i=s(f,d,n[t].geometry);delete e[f],delete r[d],r[l(p,n[i].geometry,!0)]=i,n[t].geometry=null;}else f in r?s(f,d,h):d in e?o(f,d,h):(a(u),e[f]=i-1,r[d]=i-1);}return n.filter((t=>t.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey));}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,r),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,r));}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return !this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0;}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy();}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData();}addToLineVertexArray(t,e){const r=this.lineVertexArray.length;if(void 0!==t.segment){let r=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]);const i={};for(let n=t.segment+1;n<e.length;n++)i[n]={x:e[n].x,y:e[n].y,tileUnitDistanceFromAnchor:r},n<e.length-1&&(r+=e[n+1].dist(e[n]));for(let r=t.segment||0;r>=0;r--)i[r]={x:e[r].x,y:e[r].y,tileUnitDistanceFromAnchor:n},r>0&&(n+=e[r-1].dist(e[r]));for(let t=0;t<e.length;t++){const e=i[t];this.lineVertexArray.emplaceBack(e.x,e.y,e.tileUnitDistanceFromAnchor);}}return {lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(e,r,n,i,a,s,o,l,u,c,h,p){const f=e.indexArray,d=e.layoutVertexArray,y=e.segments.prepareSegment(4*r.length,d,f,this.canOverlap?s.sortKey:void 0),m=this.glyphOffsetArray.length,g=y.vertexLength,x=this.allowVerticalPlacement&&o===t.WritingMode.vertical?Math.PI/2:0,v=s.text&&s.text.sections;for(let t=0;t<r.length;t++){const{tl:i,tr:a,bl:o,br:u,tex:c,pixelOffsetTL:h,pixelOffsetBR:m,minFontScaleX:g,minFontScaleY:b,glyphOffset:w,isSDF:_,sectionIndex:A}=r[t],k=y.vertexLength,S=w[1];gu(d,l.x,l.y,i.x,S+i.y,c.x,c.y,n,_,h.x,h.y,g,b),gu(d,l.x,l.y,a.x,S+a.y,c.x+c.w,c.y,n,_,m.x,h.y,g,b),gu(d,l.x,l.y,o.x,S+o.y,c.x,c.y+c.h,n,_,h.x,m.y,g,b),gu(d,l.x,l.y,u.x,S+u.y,c.x+c.w,c.y+c.h,n,_,m.x,m.y,g,b),xu(e.dynamicLayoutVertexArray,l,x),f.emplaceBack(k,k+1,k+2),f.emplaceBack(k+1,k+2,k+3),y.vertexLength+=4,y.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(w[0]),t!==r.length-1&&A===r[t+1].sectionIndex||e.programConfigurations.populatePaintArrays(d.length,s,s.index,{},p,v&&v[A]);}e.placedSymbolArray.emplaceBack(l.x,l.y,m,this.glyphOffsetArray.length-m,g,u,c,l.segment,n?n[0]:0,n?n[1]:0,i[0],i[1],o,0,!1,0,h);}_addCollisionDebugVertex(t,e,r,n,i,a){return e.emplaceBack(0,0),t.emplaceBack(r.x,r.y,n,i,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(t,e,r,n,a,s,o){const l=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),u=l.vertexLength,c=a.layoutVertexArray,h=a.collisionVertexArray,p=o.anchorX,f=o.anchorY;this._addCollisionDebugVertex(c,h,s,p,f,new i(t,e)),this._addCollisionDebugVertex(c,h,s,p,f,new i(r,e)),this._addCollisionDebugVertex(c,h,s,p,f,new i(r,n)),this._addCollisionDebugVertex(c,h,s,p,f,new i(t,n)),l.vertexLength+=4;const d=a.indexArray;d.emplaceBack(u,u+1),d.emplaceBack(u+1,u+2),d.emplaceBack(u+2,u+3),d.emplaceBack(u+3,u),l.primitiveLength+=4;}addDebugCollisionBoxes(t,e,r,n){for(let i=t;i<e;i++){const t=this.collisionBoxArray.get(i);this.addCollisionDebugVertices(t.x1,t.y1,t.x2,t.y2,n?this.textCollisionBox:this.iconCollisionBox,t.anchorPoint,r);}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new wu(ua,cl.members,pa),this.iconCollisionBox=new wu(ua,cl.members,pa);for(let t=0;t<this.symbolInstances.length;t++){const e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1);}}_deserializeCollisionBoxesForSymbol(t,e,r,n,i,a,s,o,l){const u={};for(let n=e;n<r;n++){const e=t.get(n);u.textBox={x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,anchorPointX:e.anchorPointX,anchorPointY:e.anchorPointY},u.textFeatureIndex=e.featureIndex;break}for(let e=n;e<i;e++){const r=t.get(e);u.verticalTextBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalTextFeatureIndex=r.featureIndex;break}for(let e=a;e<s;e++){const r=t.get(e);u.iconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.iconFeatureIndex=r.featureIndex;break}for(let e=o;e<l;e++){const r=t.get(e);u.verticalIconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalIconFeatureIndex=r.featureIndex;break}return u}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex));}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs;for(let e=r.vertexStartIndex;e<n;e+=4)t.indexArray.emplaceBack(e,e+1,e+2),t.indexArray.emplaceBack(e+1,e+2,e+3);}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),r=Math.cos(t),n=[],i=[],a=[];for(let t=0;t<this.symbolInstances.length;++t){a.push(t);const s=this.symbolInstances.get(t);n.push(0|Math.round(e*s.anchorX+r*s.anchorY)),i.push(s.featureIndex);}return a.sort(((t,e)=>n[t]-n[e]||i[e]-i[t])),a}addToSortKeyRanges(t,e){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1});}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,r)=>{t>=0&&r.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t);})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex);}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray);}}}let Au,ku;zn(\"SymbolBucket\",_u,{omit:[\"layers\",\"collisionBoxArray\",\"features\",\"compareText\"]}),_u.MAX_GLYPHS=65535,_u.addDynamicAttributes=xu;var Su={get paint(){return ku=ku||new fi({\"icon-opacity\":new ui(j.paint_symbol[\"icon-opacity\"]),\"icon-color\":new ui(j.paint_symbol[\"icon-color\"]),\"icon-halo-color\":new ui(j.paint_symbol[\"icon-halo-color\"]),\"icon-halo-width\":new ui(j.paint_symbol[\"icon-halo-width\"]),\"icon-halo-blur\":new ui(j.paint_symbol[\"icon-halo-blur\"]),\"icon-translate\":new li(j.paint_symbol[\"icon-translate\"]),\"icon-translate-anchor\":new li(j.paint_symbol[\"icon-translate-anchor\"]),\"text-opacity\":new ui(j.paint_symbol[\"text-opacity\"]),\"text-color\":new ui(j.paint_symbol[\"text-color\"],{runtimeType:ut,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),\"text-halo-color\":new ui(j.paint_symbol[\"text-halo-color\"]),\"text-halo-width\":new ui(j.paint_symbol[\"text-halo-width\"]),\"text-halo-blur\":new ui(j.paint_symbol[\"text-halo-blur\"]),\"text-translate\":new li(j.paint_symbol[\"text-translate\"]),\"text-translate-anchor\":new li(j.paint_symbol[\"text-translate-anchor\"])})},get layout(){return Au=Au||new fi({\"symbol-placement\":new li(j.layout_symbol[\"symbol-placement\"]),\"symbol-spacing\":new li(j.layout_symbol[\"symbol-spacing\"]),\"symbol-avoid-edges\":new li(j.layout_symbol[\"symbol-avoid-edges\"]),\"symbol-sort-key\":new ui(j.layout_symbol[\"symbol-sort-key\"]),\"symbol-z-order\":new li(j.layout_symbol[\"symbol-z-order\"]),\"icon-allow-overlap\":new li(j.layout_symbol[\"icon-allow-overlap\"]),\"icon-overlap\":new li(j.layout_symbol[\"icon-overlap\"]),\"icon-ignore-placement\":new li(j.layout_symbol[\"icon-ignore-placement\"]),\"icon-optional\":new li(j.layout_symbol[\"icon-optional\"]),\"icon-rotation-alignment\":new li(j.layout_symbol[\"icon-rotation-alignment\"]),\"icon-size\":new ui(j.layout_symbol[\"icon-size\"]),\"icon-text-fit\":new li(j.layout_symbol[\"icon-text-fit\"]),\"icon-text-fit-padding\":new li(j.layout_symbol[\"icon-text-fit-padding\"]),\"icon-image\":new ui(j.layout_symbol[\"icon-image\"]),\"icon-rotate\":new ui(j.layout_symbol[\"icon-rotate\"]),\"icon-padding\":new ui(j.layout_symbol[\"icon-padding\"]),\"icon-keep-upright\":new li(j.layout_symbol[\"icon-keep-upright\"]),\"icon-offset\":new ui(j.layout_symbol[\"icon-offset\"]),\"icon-anchor\":new ui(j.layout_symbol[\"icon-anchor\"]),\"icon-pitch-alignment\":new li(j.layout_symbol[\"icon-pitch-alignment\"]),\"text-pitch-alignment\":new li(j.layout_symbol[\"text-pitch-alignment\"]),\"text-rotation-alignment\":new li(j.layout_symbol[\"text-rotation-alignment\"]),\"text-field\":new ui(j.layout_symbol[\"text-field\"]),\"text-font\":new ui(j.layout_symbol[\"text-font\"]),\"text-size\":new ui(j.layout_symbol[\"text-size\"]),\"text-max-width\":new ui(j.layout_symbol[\"text-max-width\"]),\"text-line-height\":new li(j.layout_symbol[\"text-line-height\"]),\"text-letter-spacing\":new ui(j.layout_symbol[\"text-letter-spacing\"]),\"text-justify\":new ui(j.layout_symbol[\"text-justify\"]),\"text-radial-offset\":new ui(j.layout_symbol[\"text-radial-offset\"]),\"text-variable-anchor\":new li(j.layout_symbol[\"text-variable-anchor\"]),\"text-anchor\":new ui(j.layout_symbol[\"text-anchor\"]),\"text-max-angle\":new li(j.layout_symbol[\"text-max-angle\"]),\"text-writing-mode\":new li(j.layout_symbol[\"text-writing-mode\"]),\"text-rotate\":new ui(j.layout_symbol[\"text-rotate\"]),\"text-padding\":new li(j.layout_symbol[\"text-padding\"]),\"text-keep-upright\":new li(j.layout_symbol[\"text-keep-upright\"]),\"text-transform\":new ui(j.layout_symbol[\"text-transform\"]),\"text-offset\":new ui(j.layout_symbol[\"text-offset\"]),\"text-allow-overlap\":new li(j.layout_symbol[\"text-allow-overlap\"]),\"text-overlap\":new li(j.layout_symbol[\"text-overlap\"]),\"text-ignore-placement\":new li(j.layout_symbol[\"text-ignore-placement\"]),\"text-optional\":new li(j.layout_symbol[\"text-optional\"])})}};class Iu{constructor(t){if(void 0===t.property.overrides)throw new Error(\"overrides must be provided to instantiate FormatSectionOverride class\");this.type=t.property.overrides?t.property.overrides.runtimeType:at,this.defaultValue=t;}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression);}outputDefined(){return !1}serialize(){return null}}zn(\"FormatSectionOverride\",Iu,{omit:[\"defaultValue\"]});class zu extends yi{constructor(t){super(t,Su);}recalculate(t,e){if(super.recalculate(t,e),\"auto\"===this.layout.get(\"icon-rotation-alignment\")&&(this.layout._values[\"icon-rotation-alignment\"]=\"point\"!==this.layout.get(\"symbol-placement\")?\"map\":\"viewport\"),\"auto\"===this.layout.get(\"text-rotation-alignment\")&&(this.layout._values[\"text-rotation-alignment\"]=\"point\"!==this.layout.get(\"symbol-placement\")?\"map\":\"viewport\"),\"auto\"===this.layout.get(\"text-pitch-alignment\")&&(this.layout._values[\"text-pitch-alignment\"]=\"map\"===this.layout.get(\"text-rotation-alignment\")?\"map\":\"viewport\"),\"auto\"===this.layout.get(\"icon-pitch-alignment\")&&(this.layout._values[\"icon-pitch-alignment\"]=this.layout.get(\"icon-rotation-alignment\")),\"point\"===this.layout.get(\"symbol-placement\")){const t=this.layout.get(\"text-writing-mode\");if(t){const e=[];for(const r of t)e.indexOf(r)<0&&e.push(r);this.layout._values[\"text-writing-mode\"]=e;}else this.layout._values[\"text-writing-mode\"]=[\"horizontal\"];}this._setPaintOverrides();}getValueAndResolveTokens(t,e,r,n){const i=this.layout.get(t).evaluate(e,{},r,n),a=this._unevaluatedLayout._values[t];return a.isDataDriven()||Ir(a.value)||!i?i:function(t,e){return e.replace(/{([^{}]+)}/g,((e,r)=>r in t?String(t[r]):\"\"))}(e.properties,i)}createBucket(t){return new _u(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error(\"Should take a different path in FeatureIndex\")}_setPaintOverrides(){for(const t of Su.paint.overridableProperties){if(!zu.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new Iu(e),n=new Sr(r,e.property.specification);let i=null;i=\"constant\"===e.value.kind||\"source\"===e.value.kind?new Mr(\"source\",n):new Pr(\"composite\",n,e.value.zoomStops),this.paint._values[t]=new si(e.property,i,e.parameters);}}_handleOverridablePaintPropertyUpdate(t,e,r){return !(!this.layout||e.isDataDriven()||r.isDataDriven())&&zu.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get(\"text-field\"),n=Su.paint.properties[e];let i=!1;const a=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(i=!0)};if(\"constant\"===r.value.kind&&r.value.value instanceof Kt)a(r.value.value.sections);else if(\"source\"===r.value.kind){const t=e=>{i||(e instanceof Qt&&Ht(e.value)===ft?a(e.value.sections):e instanceof nr?a(e.sections):e.eachChild(t));},e=r.value;e._styleExpression&&t(e._styleExpression.expression);}return i}}let Mu;var Pu={get paint(){return Mu=Mu||new fi({\"background-color\":new li(j.paint_background[\"background-color\"]),\"background-pattern\":new hi(j.paint_background[\"background-pattern\"]),\"background-opacity\":new li(j.paint_background[\"background-opacity\"])})}};let Bu;var Cu={get paint(){return Bu=Bu||new fi({\"raster-opacity\":new li(j.paint_raster[\"raster-opacity\"]),\"raster-hue-rotate\":new li(j.paint_raster[\"raster-hue-rotate\"]),\"raster-brightness-min\":new li(j.paint_raster[\"raster-brightness-min\"]),\"raster-brightness-max\":new li(j.paint_raster[\"raster-brightness-max\"]),\"raster-saturation\":new li(j.paint_raster[\"raster-saturation\"]),\"raster-contrast\":new li(j.paint_raster[\"raster-contrast\"]),\"raster-resampling\":new li(j.paint_raster[\"raster-resampling\"]),\"raster-fade-duration\":new li(j.paint_raster[\"raster-fade-duration\"])})}};class Vu extends yi{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl);},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl);},this.implementation=t;}is3D(){return \"3d\"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return !1}serialize(){throw new Error(\"Custom layers cannot be serialized\")}}const Eu={circle:class extends yi{constructor(t){super(t,fs);}createBucket(t){return new Ya(t)}queryRadius(t){const e=t;return ls(\"circle-radius\",this,e)+ls(\"circle-stroke-width\",this,e)+us(this.paint.get(\"circle-translate\"))}queryIntersectsFeature(t,e,r,n,i,a,s,o){const l=cs(t,this.paint.get(\"circle-translate\"),this.paint.get(\"circle-translate-anchor\"),a.angle,s),u=this.paint.get(\"circle-radius\").evaluate(e,r)+this.paint.get(\"circle-stroke-width\").evaluate(e,r),c=\"map\"===this.paint.get(\"circle-pitch-alignment\"),h=c?l:function(t,e){return t.map((t=>ws(t,e)))}(l,o),p=c?u*s:u;for(const t of n)for(const e of t){const t=c?e:ws(e,o);let r=p;const n=bs([],[e.x,e.y,0,1],o);if(\"viewport\"===this.paint.get(\"circle-pitch-scale\")&&\"map\"===this.paint.get(\"circle-pitch-alignment\")?r*=n[3]/a.cameraToCenterDistance:\"map\"===this.paint.get(\"circle-pitch-scale\")&&\"viewport\"===this.paint.get(\"circle-pitch-alignment\")&&(r*=a.cameraToCenterDistance/n[3]),Wa(h,t,r))return !0}return !1}},heatmap:class extends yi{createBucket(t){return new _s(t)}constructor(t){super(t,ks),this._updateColorRamp();}_handleSpecialPaintPropertyUpdate(t){\"heatmap-color\"===t&&this._updateColorRamp();}_updateColorRamp(){this.colorRamp=Bs({expression:this._transitionablePaint._values[\"heatmap-color\"].value.expression,evaluationKey:\"heatmapDensity\",image:this.colorRamp}),this.colorRampTexture=null;}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null);}queryRadius(){return 0}queryIntersectsFeature(){return !1}hasOffscreenPass(){return 0!==this.paint.get(\"heatmap-opacity\")&&\"none\"!==this.visibility}},hillshade:class extends yi{constructor(t){super(t,Vs);}hasOffscreenPass(){return 0!==this.paint.get(\"hillshade-exaggeration\")&&\"none\"!==this.visibility}},fill:class extends yi{constructor(t){super(t,wo);}recalculate(t,e){super.recalculate(t,e);const r=this.paint._values[\"fill-outline-color\"];\"constant\"===r.value.kind&&void 0===r.value.value&&(this.paint._values[\"fill-outline-color\"]=this.paint._values[\"fill-color\"]);}createBucket(t){return new xo(t)}queryRadius(){return us(this.paint.get(\"fill-translate\"))}queryIntersectsFeature(t,e,r,n,i,a,s){return Qa(cs(t,this.paint.get(\"fill-translate\"),this.paint.get(\"fill-translate-anchor\"),a.angle,s),n)}isTileClipped(){return !0}},\"fill-extrusion\":class extends yi{constructor(t){super(t,No);}createBucket(t){return new Uo(t)}queryRadius(){return us(this.paint.get(\"fill-extrusion-translate\"))}is3D(){return !0}queryIntersectsFeature(t,e,r,n,a,s,o,l){const u=cs(t,this.paint.get(\"fill-extrusion-translate\"),this.paint.get(\"fill-extrusion-translate-anchor\"),s.angle,o),c=this.paint.get(\"fill-extrusion-height\").evaluate(e,r),h=this.paint.get(\"fill-extrusion-base\").evaluate(e,r),p=function(t,e,r,n){const a=[];for(const r of t){const t=[r.x,r.y,0,1];bs(t,t,e),a.push(new i(t[0]/t[3],t[1]/t[3]));}return a}(u,l),f=function(t,e,r,n){const a=[],s=[],o=n[8]*e,l=n[9]*e,u=n[10]*e,c=n[11]*e,h=n[8]*r,p=n[9]*r,f=n[10]*r,d=n[11]*r;for(const e of t){const t=[],r=[];for(const a of e){const e=a.x,s=a.y,y=n[0]*e+n[4]*s+n[12],m=n[1]*e+n[5]*s+n[13],g=n[2]*e+n[6]*s+n[14],x=n[3]*e+n[7]*s+n[15],v=g+u,b=x+c,w=y+h,_=m+p,A=g+f,k=x+d,S=new i((y+o)/b,(m+l)/b);S.z=v/b,t.push(S);const I=new i(w/k,_/k);I.z=A/k,r.push(I);}a.push(t),s.push(r);}return [a,s]}(n,h,c,l);return function(t,e,r){let n=1/0;Qa(r,e)&&(n=Ko(r,e[0]));for(let i=0;i<e.length;i++){const a=e[i],s=t[i];for(let t=0;t<a.length-1;t++){const e=a[t],i=[e,a[t+1],s[t+1],s[t],e];Ha(r,i)&&(n=Math.min(n,Ko(r,i)));}}return n!==1/0&&n}(f[0],f[1],p)}},line:class extends yi{constructor(t){super(t,nl),this.gradientVersion=0,al||(al=new il(nl.paint.properties[\"line-width\"].specification),al.useIntegerZoom=!0);}_handleSpecialPaintPropertyUpdate(t){\"line-gradient\"===t&&(this.stepInterpolant=this._transitionablePaint._values[\"line-gradient\"].value.expression._styleExpression.expression instanceof Ee,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER);}gradientExpression(){return this._transitionablePaint._values[\"line-gradient\"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values[\"line-floorwidth\"]=al.possiblyEvaluate(this._transitioningPaint._values[\"line-width\"].value,t);}createBucket(t){return new tl(t)}queryRadius(t){const e=t,r=sl(ls(\"line-width\",this,e),ls(\"line-gap-width\",this,e)),n=ls(\"line-offset\",this,e);return r/2+Math.abs(n)+us(this.paint.get(\"line-translate\"))}queryIntersectsFeature(t,e,r,n,a,s,o){const l=cs(t,this.paint.get(\"line-translate\"),this.paint.get(\"line-translate-anchor\"),s.angle,o),u=o/2*sl(this.paint.get(\"line-width\").evaluate(e,r),this.paint.get(\"line-gap-width\").evaluate(e,r)),c=this.paint.get(\"line-offset\").evaluate(e,r);return c&&(n=function(t,e){const r=[];for(let n=0;n<t.length;n++){const a=t[n],s=[];for(let t=0;t<a.length;t++){const r=a[t-1],n=a[t],o=a[t+1],l=0===t?new i(0,0):n.sub(r)._unit()._perp(),u=t===a.length-1?new i(0,0):o.sub(n)._unit()._perp(),c=l._add(u)._unit(),h=c.x*u.x+c.y*u.y;0!==h&&c._mult(1/h),s.push(c._mult(e)._add(n));}r.push(s);}return r}(n,c*o)),function(t,e,r){for(let n=0;n<e.length;n++){const i=e[n];if(t.length>=3)for(let e=0;e<i.length;e++)if(ss(t,i[e]))return !0;if(ts(t,i,r))return !0}return !1}(l,n,u)}isTileClipped(){return !0}},symbol:zu,background:class extends yi{constructor(t){super(t,Pu);}},raster:class extends yi{constructor(t){super(t,Cu);}}};class Fu{constructor(t){this._callback=t,this._triggered=!1,\"undefined\"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback();});}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback();}),0));}remove(){delete this._channel,this._callback=()=>{};}}const Tu=6371008.8;class Lu{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error(\"Invalid LngLat latitude value: must be between -90 and 90\")}wrap(){return new Lu(h(this.lng,-180,180),this.lat)}toArray(){return [this.lng,this.lat]}toString(){return `LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return Tu*Math.acos(Math.min(i,1))}static convert(t){if(t instanceof Lu)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Lu(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&\"object\"==typeof t&&null!==t)return new Lu(Number(\"lng\"in t?t.lng:t.lon),Number(t.lat));throw new Error(\"`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]\")}}const $u=2*Math.PI*Tu;function Du(t){return $u*Math.cos(t*Math.PI/180)}function Ou(t){return (180+t)/360}function Uu(t){return (180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Ru(t,e){return t/Du(e)}function qu(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class ju{constructor(t,e,r=0){this.x=+t,this.y=+e,this.z=+r;}static fromLngLat(t,e=0){const r=Lu.convert(t);return new ju(Ou(r.lng),Uu(r.lat),Ru(e,r.lat))}toLngLat(){return new Lu(360*this.x-180,qu(this.y))}toAltitude(){return this.z*Du(qu(this.y))}meterInMercatorCoordinateUnits(){return 1/$u*(t=qu(this.y),1/Math.cos(t*Math.PI/180));var t;}}function Nu(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return [t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}class Zu{constructor(t,e,r){if(t<0||t>25||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))throw new Error(`x=${e}, y=${r}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=e,this.y=r,this.key=Ju(0,t,t,e,r);}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){const n=(a=this.y,s=this.z,o=Nu(256*(i=this.x),256*(a=Math.pow(2,s)-a-1),s),l=Nu(256*(i+1),256*(a+1),s),o[0]+\",\"+o[1]+\",\"+l[0]+\",\"+l[1]);var i,a,s,o,l;const u=function(t,e,r){let n,i=\"\";for(let a=t;a>0;a--)n=1<<a-1,i+=(e&n?1:0)+(r&n?2:0);return i}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(\"tms\"===r?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?\"@2x\":\"\").replace(/{quadkey}/g,u).replace(/{bbox-epsg-3857}/g,n)}isChildOf(t){const e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){const e=Math.pow(2,this.z);return new i((t.x*e-this.x)*Na,(t.y*e-this.y)*Na)}toString(){return `${this.z}/${this.x}/${this.y}`}}class Ku{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Ju(t,e.z,e.z,e.x,e.y);}}class Gu{constructor(t,e,r,n,i){if(t<r)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${r}`);this.overscaledZ=t,this.wrap=e,this.canonical=new Zu(r,+n,+i),this.key=Ju(e,t,r,n,i);}clone(){return new Gu(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const e=this.canonical.z-t;return t>this.canonical.z?new Gu(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Gu(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-t;return t>this.canonical.z?Ju(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):Ju(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap)return !1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return [new Gu(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return [new Gu(e,this.wrap,e,r,n),new Gu(e,this.wrap,e,r+1,n),new Gu(e,this.wrap,e,r,n+1),new Gu(e,this.wrap,e,r+1,n+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Gu(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Gu(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Ku(this.wrap,this.canonical)}toString(){return `${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new ju(t.x-this.wrap,t.y))}}function Ju(t,e,r,n,i){(t*=2)<0&&(t=-1*t-1);const a=1<<r;return (a*a*t+a*i+n).toString(36)+r.toString(36)+e.toString(36)}zn(\"CanonicalTileID\",Zu),zn(\"OverscaledTileID\",Gu,{omit:[\"posMatrix\"]});class Xu{constructor(t,e,r){if(this.uid=t,e.height!==e.width)throw new RangeError(\"DEM tiles must be square\");if(r&&\"mapbox\"!==r&&\"terrarium\"!==r)return void v(`\"${r}\" is not a valid encoding type. Valid types include \"mapbox\" and \"terrarium\".`);this.stride=e.height;const n=this.dim=e.height-2;this.data=new Uint32Array(e.data.buffer),this.encoding=r||\"mapbox\";for(let t=0;t<n;t++)this.data[this._idx(-1,t)]=this.data[this._idx(0,t)],this.data[this._idx(n,t)]=this.data[this._idx(n-1,t)],this.data[this._idx(t,-1)]=this.data[this._idx(t,0)],this.data[this._idx(t,n)]=this.data[this._idx(t,n-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(n,-1)]=this.data[this._idx(n-1,0)],this.data[this._idx(-1,n)]=this.data[this._idx(0,n-1)],this.data[this._idx(n,n)]=this.data[this._idx(n-1,n-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let t=0;t<n;t++)for(let e=0;e<n;e++){const r=this.get(t,e);r>this.max&&(this.max=r),r<this.min&&(this.min=r);}}get(t,e){const r=new Uint8Array(this.data.buffer),n=4*this._idx(t,e);return (\"terrarium\"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(r[n],r[n+1],r[n+2])}getUnpackVector(){return \"terrarium\"===this.encoding?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError(\"out of range source coordinates for DEM data\");return (e+1)*this.stride+(t+1)}_unpackMapbox(t,e,r){return (256*t*256+256*e+r)/10-1e4}_unpackTerrarium(t,e,r){return 256*t+e+r/256-32768}getPixels(){return new Ps({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error(\"dem dimension mismatch\");let n=e*this.dim,i=e*this.dim+this.dim,a=r*this.dim,s=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1;}switch(r){case-1:a=s-1;break;case 1:s=a+1;}const o=-e*this.dim,l=-r*this.dim;for(let e=a;e<s;e++)for(let r=n;r<i;r++)this.data[this._idx(r,e)]=t.data[this._idx(r+o,e+l)];}}zn(\"DEMData\",Xu);class Yu{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r;}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class Hu{constructor(t,e,r,n,i){this.type=\"Feature\",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,this.id=i;}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t;}toJSON(){const t={geometry:this.geometry};for(const e in this)\"_geometry\"!==e&&\"_vectorTileFeature\"!==e&&(t[e]=this[e]);return t}}class Wu{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Sn(Na,16,0),this.grid3D=new Sn(Na,16,0),this.featureIndexArray=new Wi,this.promoteId=e;}insert(t,e,r,n,i,a){const s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,i);const o=a?this.grid3D:this.grid;for(let t=0;t<e.length;t++){const r=e[t],n=[1/0,1/0,-1/0,-1/0];for(let t=0;t<r.length;t++){const e=r[t];n[0]=Math.min(n[0],e.x),n[1]=Math.min(n[1],e.y),n[2]=Math.max(n[2],e.x),n[3]=Math.max(n[3],e.y);}n[0]<Na&&n[1]<Na&&n[2]>=0&&n[3]>=0&&o.insert(s,n[0],n[1],n[2],n[3]);}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new So.VectorTile(new $l(this.rawTileData)).layers,this.sourceLayerCoder=new Yu(this.vtLayers?Object.keys(this.vtLayers).sort():[\"_geojsonTileLayer\"])),this.vtLayers}query(t,e,r,n){this.loadVTLayers();const a=t.params||{},s=Na/t.tileSize/t.scale,o=Tr(a.filter),l=t.queryGeometry,u=t.queryPadding*s,c=tc(l),h=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),p=tc(t.cameraQueryGeometry),f=this.grid3D.query(p.minX-u,p.minY-u,p.maxX+u,p.maxY+u,((e,r,n,a)=>function(t,e,r,n,a){for(const i of t)if(e<=i.x&&r<=i.y&&n>=i.x&&a>=i.y)return !0;const s=[new i(e,r),new i(e,a),new i(n,a),new i(n,r)];if(t.length>2)for(const e of s)if(ss(t,e))return !0;for(let e=0;e<t.length-1;e++)if(os(t[e],t[e+1],s))return !0;return !1}(t.cameraQueryGeometry,e-u,r-u,n+u,a+u)));for(const t of f)h.push(t);h.sort(ec);const d={};let y;for(let i=0;i<h.length;i++){const u=h[i];if(u===y)continue;y=u;const c=this.featureIndexArray.get(u);let p=null;this.loadMatchingFeature(d,c.bucketIndex,c.sourceLayerIndex,c.featureIndex,o,a.layers,a.availableImages,e,r,n,((e,r,n)=>(p||(p=Ga(e)),r.queryIntersectsFeature(l,e,n,p,this.z,t.transform,s,t.pixelPosMatrix))));}return d}loadMatchingFeature(t,e,r,n,i,a,s,o,l,u,c){const h=this.bucketLayerIDs[e];if(a&&!function(t,e){for(let r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return !0;return !1}(a,h))return;const f=this.sourceLayerCoder.decode(r),d=this.vtLayers[f].feature(n);if(i.needGeometry){const t=Ja(d,!0);if(!i.filter(new Qn(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!i.filter(new Qn(this.tileID.overscaledZ),d))return;const y=this.getId(d,f);for(let e=0;e<h.length;e++){const r=h[e];if(a&&a.indexOf(r)<0)continue;const i=o[r];if(!i)continue;let f={};y&&u&&(f=u.getState(i.sourceLayer||\"_geojsonTileLayer\",y));const m=p({},l[r]);m.paint=Qu(m.paint,i.paint,d,f,s),m.layout=Qu(m.layout,i.layout,d,f,s);const g=!c||c(d,i,f);if(!g)continue;const x=new Hu(d,this.z,this.x,this.y,y);x.layer=m;let v=t[r];void 0===v&&(v=t[r]=[]),v.push({featureIndex:n,feature:x,intersectionZ:g});}}lookupSymbolFeatures(t,e,r,n,i,a,s,o){const l={};this.loadVTLayers();const u=Tr(i);for(const i of t)this.loadMatchingFeature(l,r,n,i,u,a,s,o,e);return l}hasLayer(t){for(const e of this.bucketLayerIDs)for(const r of e)if(t===r)return !0;return !1}getId(t,e){let r=t.id;return this.promoteId&&(r=t.properties[\"string\"==typeof this.promoteId?this.promoteId:this.promoteId[e]],\"boolean\"==typeof r&&(r=Number(r))),r}}function Qu(t,e,r,n,i){return y(t,((t,a)=>{const s=e instanceof oi?e.get(a):null;return s&&s.evaluate?s.evaluate(r,n,i):s}))}function tc(t){let e=1/0,r=1/0,n=-1/0,i=-1/0;for(const a of t)e=Math.min(e,a.x),r=Math.min(r,a.y),n=Math.max(n,a.x),i=Math.max(i,a.y);return {minX:e,minY:r,maxX:n,maxY:i}}function ec(t,e){return e-t}function rc(t,e,r,n,a){const s=[];for(let o=0;o<t.length;o++){const l=t[o];let u;for(let t=0;t<l.length-1;t++){let o=l[t],c=l[t+1];o.x<e&&c.x<e||(o.x<e?o=new i(e,o.y+(e-o.x)/(c.x-o.x)*(c.y-o.y))._round():c.x<e&&(c=new i(e,o.y+(e-o.x)/(c.x-o.x)*(c.y-o.y))._round()),o.y<r&&c.y<r||(o.y<r?o=new i(o.x+(r-o.y)/(c.y-o.y)*(c.x-o.x),r)._round():c.y<r&&(c=new i(o.x+(r-o.y)/(c.y-o.y)*(c.x-o.x),r)._round()),o.x>=n&&c.x>=n||(o.x>=n?o=new i(n,o.y+(n-o.x)/(c.x-o.x)*(c.y-o.y))._round():c.x>=n&&(c=new i(n,o.y+(n-o.x)/(c.x-o.x)*(c.y-o.y))._round()),o.y>=a&&c.y>=a||(o.y>=a?o=new i(o.x+(a-o.y)/(c.y-o.y)*(c.x-o.x),a)._round():c.y>=a&&(c=new i(o.x+(a-o.y)/(c.y-o.y)*(c.x-o.x),a)._round()),u&&o.equals(u[u.length-1])||(u=[o],s.push(u)),u.push(c)))));}}return s}zn(\"FeatureIndex\",Wu,{omit:[\"rawTileData\",\"sourceLayerCoder\"]});class nc extends i{constructor(t,e,r,n){super(t,e),this.angle=r,void 0!==n&&(this.segment=n);}clone(){return new nc(this.x,this.y,this.angle,this.segment)}}function ic(t,e,r,n,i){if(void 0===e.segment)return !0;let a=e,s=e.segment+1,o=0;for(;o>-r/2;){if(s--,s<0)return !1;o-=t[s].dist(a),a=t[s];}o+=t[s].dist(t[s+1]),s++;const l=[];let u=0;for(;o<r/2;){const e=t[s],r=t[s+1];if(!r)return !1;let a=t[s-1].angleTo(e)-e.angleTo(r);for(a=Math.abs((a+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:o,angleDelta:a}),u+=a;o-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return !1;s++,o+=e.dist(r);}return !0}function ac(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function sc(t,e,r){return t?.6*e*r:0}function oc(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function lc(t,e,r,n,i,a){const s=sc(r,i,a),o=oc(r,n)*a;let l=0;const u=ac(t)/2;for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1],a=n.dist(i);if(l+a>u){const c=(u-l)/a,h=Le.number(n.x,i.x,c),p=Le.number(n.y,i.y,c),f=new nc(h,p,i.angleTo(n),r);return f._round(),!s||ic(t,f,o,s,e)?f:void 0}l+=a;}}function uc(t,e,r,n,i,a,s,o,l){const u=sc(n,a,s),c=oc(n,i),h=c*s,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h<e/4&&(e=h+e/4),cc(t,p?e/2*o%e:(c/2+2*a)*s*o%e,e,u,r,h,p,!1,l)}function cc(t,e,r,n,i,a,s,o,l){const u=a/2,c=ac(t);let h=0,p=e-r,f=[];for(let e=0;e<t.length-1;e++){const s=t[e],o=t[e+1],d=s.dist(o),y=o.angleTo(s);for(;p+r<h+d;){p+=r;const m=(p-h)/d,g=Le.number(s.x,o.x,m),x=Le.number(s.y,o.y,m);if(g>=0&&g<l&&x>=0&&x<l&&p-u>=0&&p+u<=c){const r=new nc(g,x,y,e);r._round(),n&&!ic(t,r,a,n,i)||f.push(r);}}h+=d;}return o||f.length||s||(f=cc(t,h/2,r,n,i,a,s,!0,l)),f}zn(\"Anchor\",nc);const hc=Nl;function pc(t,e,r,n){const a=[],s=t.image,o=s.pixelRatio,l=s.paddedRect.w-2*hc,u=s.paddedRect.h-2*hc,c=t.right-t.left,h=t.bottom-t.top,p=s.stretchX||[[0,l]],f=s.stretchY||[[0,u]],d=(t,e)=>t+e[1]-e[0],y=p.reduce(d,0),m=f.reduce(d,0),g=l-y,x=u-m;let v=0,b=y,w=0,_=m,A=0,k=g,S=0,I=x;if(s.content&&n){const t=s.content;v=fc(p,0,t[0]),w=fc(f,0,t[1]),b=fc(p,t[0],t[2]),_=fc(f,t[1],t[3]),A=t[0]-v,S=t[1]-w,k=t[2]-t[0]-b,I=t[3]-t[1]-_;}const z=(n,a,l,u)=>{const p=yc(n.stretch-v,b,c,t.left),f=mc(n.fixed-A,k,n.stretch,y),d=yc(a.stretch-w,_,h,t.top),g=mc(a.fixed-S,I,a.stretch,m),x=yc(l.stretch-v,b,c,t.left),z=mc(l.fixed-A,k,l.stretch,y),M=yc(u.stretch-w,_,h,t.top),P=mc(u.fixed-S,I,u.stretch,m),B=new i(p,d),C=new i(x,d),V=new i(x,M),E=new i(p,M),F=new i(f/o,g/o),T=new i(z/o,P/o),L=e*Math.PI/180;if(L){const t=Math.sin(L),e=Math.cos(L),r=[e,-t,t,e];B._matMult(r),C._matMult(r),E._matMult(r),V._matMult(r);}const $=n.stretch+n.fixed,D=a.stretch+a.fixed;return {tl:B,tr:C,bl:E,br:V,tex:{x:s.paddedRect.x+hc+$,y:s.paddedRect.y+hc+D,w:l.stretch+l.fixed-$,h:u.stretch+u.fixed-D},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:F,pixelOffsetBR:T,minFontScaleX:k/o/c,minFontScaleY:I/o/h,isSDF:r}};if(n&&(s.stretchX||s.stretchY)){const t=dc(p,g,y),e=dc(f,x,m);for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1];for(let t=0;t<e.length-1;t++)a.push(z(n,e[t],i,e[t+1]));}}else a.push(z({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:u+1}));return a}function fc(t,e,r){let n=0;for(const i of t)n+=Math.max(e,Math.min(r,i[1]))-Math.max(e,Math.min(r,i[0]));return n}function dc(t,e,r){const n=[{fixed:-hc,stretch:0}];for(const[e,r]of t){const t=n[n.length-1];n.push({fixed:e-t.stretch,stretch:t.stretch}),n.push({fixed:e-t.stretch,stretch:t.stretch+(r-e)});}return n.push({fixed:e+hc,stretch:r}),n}function yc(t,e,r,n){return t/e*r+n}function mc(t,e,r,n){return t-e*r/n}class gc{constructor(t,e,r,n,a,s,o,l,u,c){if(this.boxStartIndex=t.length,u){let t=s.top,e=s.bottom;const r=s.collisionPadding;r&&(t-=r[1],e+=r[3]);let n=e-t;n>0&&(n=Math.max(10,n),this.circleDiameter=n);}else {let u=s.top*o-l[0],h=s.bottom*o+l[2],p=s.left*o-l[3],f=s.right*o+l[1];const d=s.collisionPadding;if(d&&(p-=d[0]*o,u-=d[1]*o,f+=d[2]*o,h+=d[3]*o),c){const t=new i(p,u),e=new i(f,u),r=new i(p,h),n=new i(f,h),a=c*Math.PI/180;t._rotate(a),e._rotate(a),r._rotate(a),n._rotate(a),p=Math.min(t.x,e.x,r.x,n.x),f=Math.max(t.x,e.x,r.x,n.x),u=Math.min(t.y,e.y,r.y,n.y),h=Math.max(t.y,e.y,r.y,n.y);}t.emplaceBack(e.x,e.y,p,u,f,h,r,n,a);}this.boxEndIndex=t.length;}}class xc{constructor(t=[],e=vc){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t);}push(t){this.data.push(t),this.length++,this._up(this.length-1);}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,n=e[t];for(;t>0;){const i=t-1>>1,a=e[i];if(r(n,a)>=0)break;e[t]=a,t=i;}e[t]=n;}_down(t){const{data:e,compare:r}=this,n=this.length>>1,i=e[t];for(;t<n;){let n=1+(t<<1),a=e[n];const s=n+1;if(s<this.length&&r(e[s],a)<0&&(n=s,a=e[s]),r(a,i)>=0)break;e[t]=a,t=n;}e[t]=i;}}function vc(t,e){return t<e?-1:t>e?1:0}function bc(t,e=1,r=!1){let n=1/0,a=1/0,s=-1/0,o=-1/0;const l=t[0];for(let t=0;t<l.length;t++){const e=l[t];(!t||e.x<n)&&(n=e.x),(!t||e.y<a)&&(a=e.y),(!t||e.x>s)&&(s=e.x),(!t||e.y>o)&&(o=e.y);}const u=Math.min(s-n,o-a);let c=u/2;const h=new xc([],wc);if(0===u)return new i(n,a);for(let e=n;e<s;e+=u)for(let r=a;r<o;r+=u)h.push(new _c(e+c,r+c,c,t));let p=function(t){let e=0,r=0,n=0;const i=t[0];for(let t=0,a=i.length,s=a-1;t<a;s=t++){const a=i[t],o=i[s],l=a.x*o.y-o.x*a.y;r+=(a.x+o.x)*l,n+=(a.y+o.y)*l,e+=3*l;}return new _c(r/e,n/e,0,t)}(t),f=h.length;for(;h.length;){const n=h.pop();(n.d>p.d||!p.d)&&(p=n,r&&console.log(\"found best %d after %d probes\",Math.round(1e4*n.d)/1e4,f)),n.max-p.d<=e||(c=n.h/2,h.push(new _c(n.p.x-c,n.p.y-c,c,t)),h.push(new _c(n.p.x+c,n.p.y-c,c,t)),h.push(new _c(n.p.x-c,n.p.y+c,c,t)),h.push(new _c(n.p.x+c,n.p.y+c,c,t)),f+=4);}return r&&(console.log(`num probes: ${f}`),console.log(`best distance: ${p.d}`)),p.p}function wc(t,e){return e.max-t.max}function _c(t,e,r,n){this.p=new i(t,e),this.h=r,this.d=function(t,e){let r=!1,n=1/0;for(let i=0;i<e.length;i++){const a=e[i];for(let e=0,i=a.length,s=i-1;e<i;s=e++){const i=a[e],o=a[s];i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(r=!r),n=Math.min(n,is(t,i,o));}}return (r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2;}const Ac=Number.POSITIVE_INFINITY;function kc(t,e){return e[1]!==Ac?function(t,e,r){let n=0,i=0;switch(e=Math.abs(e),r=Math.abs(r),t){case\"top-right\":case\"top-left\":case\"top\":i=r-7;break;case\"bottom-right\":case\"bottom-left\":case\"bottom\":i=7-r;}switch(t){case\"top-right\":case\"bottom-right\":case\"right\":n=-e;break;case\"top-left\":case\"bottom-left\":case\"left\":n=e;}return [n,i]}(t,e[0],e[1]):function(t,e){let r=0,n=0;e<0&&(e=0);const i=e/Math.sqrt(2);switch(t){case\"top-right\":case\"top-left\":n=i-7;break;case\"bottom-right\":case\"bottom-left\":n=7-i;break;case\"bottom\":n=7-e;break;case\"top\":n=e-7;}switch(t){case\"top-right\":case\"bottom-right\":r=-i;break;case\"top-left\":case\"bottom-left\":r=i;break;case\"left\":r=e;break;case\"right\":r=-e;}return [r,n]}(t,e[0])}function Sc(t){switch(t){case\"right\":case\"top-right\":case\"bottom-right\":return \"right\";case\"left\":case\"top-left\":case\"bottom-left\":return \"left\"}return \"center\"}function Ic(e,r,n,i,a,s,o,l,u,c,h){let p=s.textMaxSize.evaluate(r,{});void 0===p&&(p=o);const f=e.layers[0].layout,d=f.get(\"icon-offset\").evaluate(r,{},h),y=Mc(n.horizontal),m=o/24,g=e.tilePixelRatio*m,x=e.tilePixelRatio*p/24,b=e.tilePixelRatio*l,w=e.tilePixelRatio*f.get(\"symbol-spacing\"),_=f.get(\"text-padding\")*e.tilePixelRatio,A=function(t,e,r,n=1){const i=t.get(\"icon-padding\").evaluate(e,{},r),a=i&&i.values;return [a[0]*n,a[1]*n,a[2]*n,a[3]*n]}(f,r,h,e.tilePixelRatio),k=f.get(\"text-max-angle\")/180*Math.PI,S=\"viewport\"!==f.get(\"text-rotation-alignment\")&&\"point\"!==f.get(\"symbol-placement\"),I=\"map\"===f.get(\"icon-rotation-alignment\")&&\"point\"!==f.get(\"symbol-placement\"),z=f.get(\"symbol-placement\"),M=w/2,P=f.get(\"icon-text-fit\");let B;i&&\"none\"!==P&&(e.allowVerticalPlacement&&n.vertical&&(B=uu(i,n.vertical,P,f.get(\"icon-text-fit-padding\"),d,m)),y&&(i=uu(i,y,P,f.get(\"icon-text-fit-padding\"),d,m)));const C=(l,p)=>{p.x<0||p.x>=Na||p.y<0||p.y>=Na||function(e,r,n,i,a,s,o,l,u,c,h,p,f,d,y,m,g,x,b,w,_,A,k,S,I){const z=e.addToLineVertexArray(r,n);let M,P,B,C,V=0,E=0,F=0,T=0,L=-1,$=-1;const D={};let O=ka(\"\"),U=0,R=0;if(void 0===l._unevaluatedLayout.getValue(\"text-radial-offset\")?[U,R]=l.layout.get(\"text-offset\").evaluate(_,{},S).map((t=>t*dl)):(U=l.layout.get(\"text-radial-offset\").evaluate(_,{},S)*dl,R=Ac),e.allowVerticalPlacement&&i.vertical){const t=l.layout.get(\"text-rotate\").evaluate(_,{},S)+90;B=new gc(u,r,c,h,p,i.vertical,f,d,y,t),o&&(C=new gc(u,r,c,h,p,o,g,x,y,t));}if(a){const n=l.layout.get(\"icon-rotate\").evaluate(_,{}),i=\"none\"!==l.layout.get(\"icon-text-fit\"),s=pc(a,n,k,i),f=o?pc(o,n,k,i):void 0;P=new gc(u,r,c,h,p,a,g,x,!1,n),V=4*s.length;const d=e.iconSizeData;let y=null;\"source\"===d.kind?(y=[hu*l.layout.get(\"icon-size\").evaluate(_,{})],y[0]>pu&&v(`${e.layerIds[0]}: Value for \"icon-size\" is >= ${cu}. Reduce your \"icon-size\".`)):\"composite\"===d.kind&&(y=[hu*A.compositeIconSizes[0].evaluate(_,{},S),hu*A.compositeIconSizes[1].evaluate(_,{},S)],(y[0]>pu||y[1]>pu)&&v(`${e.layerIds[0]}: Value for \"icon-size\" is >= ${cu}. Reduce your \"icon-size\".`)),e.addSymbols(e.icon,s,y,w,b,_,t.WritingMode.none,r,z.lineStartIndex,z.lineLength,-1,S),L=e.icon.placedSymbolArray.length-1,f&&(E=4*f.length,e.addSymbols(e.icon,f,y,w,b,_,t.WritingMode.vertical,r,z.lineStartIndex,z.lineLength,-1,S),$=e.icon.placedSymbolArray.length-1);}const q=Object.keys(i.horizontal);for(const n of q){const a=i.horizontal[n];if(!M){O=ka(a.text);const t=l.layout.get(\"text-rotate\").evaluate(_,{},S);M=new gc(u,r,c,h,p,a,f,d,y,t);}const o=1===a.positionedLines.length;if(F+=zc(e,r,a,s,l,y,_,m,z,i.vertical?t.WritingMode.horizontal:t.WritingMode.horizontalOnly,o?q:[n],D,L,A,S),o)break}i.vertical&&(T+=zc(e,r,i.vertical,s,l,y,_,m,z,t.WritingMode.vertical,[\"vertical\"],D,$,A,S));const j=M?M.boxStartIndex:e.collisionBoxArray.length,N=M?M.boxEndIndex:e.collisionBoxArray.length,Z=B?B.boxStartIndex:e.collisionBoxArray.length,K=B?B.boxEndIndex:e.collisionBoxArray.length,G=P?P.boxStartIndex:e.collisionBoxArray.length,J=P?P.boxEndIndex:e.collisionBoxArray.length,X=C?C.boxStartIndex:e.collisionBoxArray.length,Y=C?C.boxEndIndex:e.collisionBoxArray.length;let H=-1;const W=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;H=W(M,H),H=W(B,H),H=W(P,H),H=W(C,H);const Q=H>-1?1:0;Q&&(H*=I/dl),e.glyphOffsetArray.length>=_u.MAX_GLYPHS&&v(\"Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907\"),void 0!==_.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,_.sortKey),e.symbolInstances.emplaceBack(r.x,r.y,D.right>=0?D.right:-1,D.center>=0?D.center:-1,D.left>=0?D.left:-1,D.vertical||-1,L,$,O,j,N,Z,K,G,J,X,Y,c,F,T,V,E,Q,0,f,U,R,H);}(e,p,l,n,i,a,B,e.layers[0],e.collisionBoxArray,r.index,r.sourceLayerIndex,e.index,g,[_,_,_,_],S,u,b,A,I,d,r,s,c,h,o);};if(\"line\"===z)for(const t of rc(r.geometry,0,0,Na,Na)){const r=uc(t,w,k,n.vertical||y,i,24,x,e.overscaling,Na);for(const n of r)y&&Pc(e,y.text,M,n)||C(t,n);}else if(\"line-center\"===z){for(const t of r.geometry)if(t.length>1){const e=lc(t,k,n.vertical||y,i,24,x);e&&C(t,e);}}else if(\"Polygon\"===r.type)for(const t of fo(r.geometry,0)){const e=bc(t,16);C(t[0],new nc(e.x,e.y,0));}else if(\"LineString\"===r.type)for(const t of r.geometry)C(t,new nc(t[0].x,t[0].y,0));else if(\"Point\"===r.type)for(const t of r.geometry)for(const e of t)C([e],new nc(e.x,e.y,0));}function zc(t,e,r,n,a,s,o,l,u,c,h,p,f,d,y){const m=function(t,e,r,n,a,s,o,l){const u=n.layout.get(\"text-rotate\").evaluate(s,{})*Math.PI/180,c=[];for(const t of e.positionedLines)for(const n of t.positionedGlyphs){if(!n.rect)continue;const s=n.rect||{};let h=ql+1,p=!0,f=1,d=0;const y=(a||l)&&n.vertical,m=n.metrics.advance*n.scale/2;if(l&&e.verticalizable&&(d=t.lineOffset/2-(n.imageName?-(dl-n.metrics.width*n.scale)/2:(n.scale-1)*dl)),n.imageName){const t=o[n.imageName];p=t.sdf,f=t.pixelRatio,h=Nl/f;}const g=a?[n.x+m,n.y]:[0,0];let x=a?[0,0]:[n.x+m+r[0],n.y+r[1]-d],v=[0,0];y&&(v=x,x=[0,0]);const b=(n.metrics.left-h)*n.scale-m+x[0],w=(-n.metrics.top-h)*n.scale+x[1],_=b+s.w*n.scale/f,A=w+s.h*n.scale/f,k=new i(b,w),S=new i(_,w),I=new i(b,A),z=new i(_,A);if(y){const t=new i(-m,m-Jl),e=-Math.PI/2,r=dl/2-m,a=new i(5-Jl-r,-(n.imageName?r:0)),s=new i(...v);k._rotateAround(e,t)._add(a)._add(s),S._rotateAround(e,t)._add(a)._add(s),I._rotateAround(e,t)._add(a)._add(s),z._rotateAround(e,t)._add(a)._add(s);}if(u){const t=Math.sin(u),e=Math.cos(u),r=[e,-t,t,e];k._matMult(r),S._matMult(r),I._matMult(r),z._matMult(r);}const M=new i(0,0),P=new i(0,0);c.push({tl:k,tr:S,bl:I,br:z,tex:s,writingMode:e.writingMode,glyphOffset:g,sectionIndex:n.sectionIndex,isSDF:p,pixelOffsetTL:M,pixelOffsetBR:P,minFontScaleX:0,minFontScaleY:0});}return c}(0,r,l,a,s,o,n,t.allowVerticalPlacement),g=t.textSizeData;let x=null;\"source\"===g.kind?(x=[hu*a.layout.get(\"text-size\").evaluate(o,{})],x[0]>pu&&v(`${t.layerIds[0]}: Value for \"text-size\" is >= ${cu}. Reduce your \"text-size\".`)):\"composite\"===g.kind&&(x=[hu*d.compositeTextSizes[0].evaluate(o,{},y),hu*d.compositeTextSizes[1].evaluate(o,{},y)],(x[0]>pu||x[1]>pu)&&v(`${t.layerIds[0]}: Value for \"text-size\" is >= ${cu}. Reduce your \"text-size\".`)),t.addSymbols(t.text,m,x,l,s,o,c,e,u.lineStartIndex,u.lineLength,f,y);for(const e of h)p[e]=t.text.placedSymbolArray.length-1;return 4*m.length}function Mc(t){for(const e in t)return t[e];return null}function Pc(t,e,r,n){const i=t.compareText;if(e in i){const t=i[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])<r)return !0}else i[e]=[];return i[e].push(n),!1}const Bc=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Cc{static from(t){if(!(t instanceof ArrayBuffer))throw new Error(\"Data must be an instance of ArrayBuffer.\");const[e,r]=new Uint8Array(t,0,2);if(219!==e)throw new Error(\"Data does not appear to be in a KDBush format.\");const n=r>>4;if(1!==n)throw new Error(`Got v${n} data when expected v1.`);const i=Bc[15&r];if(!i)throw new Error(\"Unrecognized array type.\");const[a]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new Cc(s,a,i,t)}constructor(t,e=64,r=Float64Array,n){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=Bc.indexOf(this.ArrayType),a=2*t*this.ArrayType.BYTES_PER_ELEMENT,s=t*this.IndexArrayType.BYTES_PER_ELEMENT,o=(8-s%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+s+o,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+a+s+o),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+s+o,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t);}add(t,e){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=e,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Vc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,r,n){if(!this._finished)throw new Error(\"Data not yet indexed - call index.finish().\");const{ids:i,coords:a,nodeSize:s}=this,o=[0,i.length-1,0],l=[];for(;o.length;){const u=o.pop()||0,c=o.pop()||0,h=o.pop()||0;if(c-h<=s){for(let s=h;s<=c;s++){const o=a[2*s],u=a[2*s+1];o>=t&&o<=r&&u>=e&&u<=n&&l.push(i[s]);}continue}const p=h+c>>1,f=a[2*p],d=a[2*p+1];f>=t&&f<=r&&d>=e&&d<=n&&l.push(i[p]),(0===u?t<=f:e<=d)&&(o.push(h),o.push(p-1),o.push(1-u)),(0===u?r>=f:n>=d)&&(o.push(p+1),o.push(c),o.push(1-u));}return l}within(t,e,r){if(!this._finished)throw new Error(\"Data not yet indexed - call index.finish().\");const{ids:n,coords:i,nodeSize:a}=this,s=[0,n.length-1,0],o=[],l=r*r;for(;s.length;){const u=s.pop()||0,c=s.pop()||0,h=s.pop()||0;if(c-h<=a){for(let r=h;r<=c;r++)Lc(i[2*r],i[2*r+1],t,e)<=l&&o.push(n[r]);continue}const p=h+c>>1,f=i[2*p],d=i[2*p+1];Lc(f,d,t,e)<=l&&o.push(n[p]),(0===u?t-r<=f:e-r<=d)&&(s.push(h),s.push(p-1),s.push(1-u)),(0===u?t+r>=f:e+r>=d)&&(s.push(p+1),s.push(c),s.push(1-u));}return o}}function Vc(t,e,r,n,i,a){if(i-n<=r)return;const s=n+i>>1;Ec(t,e,s,n,i,a),Vc(t,e,r,n,s-1,1-a),Vc(t,e,r,s+1,i,1-a);}function Ec(t,e,r,n,i,a){for(;i>n;){if(i-n>600){const s=i-n+1,o=r-n+1,l=Math.log(s),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(s-u)/s)*(o-s/2<0?-1:1);Ec(t,e,r,Math.max(n,Math.floor(r-o*u/s+c)),Math.min(i,Math.floor(r+(s-o)*u/s+c)),a);}const s=e[2*r+a];let o=n,l=i;for(Fc(t,e,n,r),e[2*i+a]>s&&Fc(t,e,n,i);o<l;){for(Fc(t,e,o,l),o++,l--;e[2*o+a]<s;)o++;for(;e[2*l+a]>s;)l--;}e[2*n+a]===s?Fc(t,e,n,l):(l++,Fc(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1);}}function Fc(t,e,r,n){Tc(t,r,n),Tc(e,2*r,2*n),Tc(e,2*r+1,2*n+1);}function Tc(t,e,r){const n=t[e];t[e]=t[r],t[r]=n;}function Lc(t,e,r,n){const i=t-r,a=e-n;return i*i+a*a}var $c;t.PerformanceMarkers=void 0,($c=t.PerformanceMarkers||(t.PerformanceMarkers={})).create=\"create\",$c.load=\"load\",$c.fullLoad=\"fullLoad\";let Dc=null,Oc=[];const Uc=1e3/60,Rc=\"loadTime\",qc=\"fullLoadTime\",jc={mark(t){performance.mark(t);},frame(t){const e=t;null!=Dc&&Oc.push(e-Dc),Dc=e;},clearMetrics(){Dc=null,Oc=[],performance.clearMeasures(Rc),performance.clearMeasures(qc);for(const e in t.PerformanceMarkers)performance.clearMarks(t.PerformanceMarkers[e]);},getPerformanceMetrics(){performance.measure(Rc,t.PerformanceMarkers.create,t.PerformanceMarkers.load),performance.measure(qc,t.PerformanceMarkers.create,t.PerformanceMarkers.fullLoad);const e=performance.getEntriesByName(Rc)[0].duration,r=performance.getEntriesByName(qc)[0].duration,n=Oc.length,i=1/(Oc.reduce(((t,e)=>t+e),0)/n/1e3),a=Oc.filter((t=>t>Uc)).reduce(((t,e)=>t+(e-Uc)/Uc),0);return {loadTime:e,fullLoadTime:r,fps:i,percentDroppedFrames:a/(n+a)*100,totalFrames:n}}};t.AJAXError=C,t.ARRAY_TYPE=ys,t.Actor=class{constructor(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},d([\"receive\",\"process\"],this),this.invoker=new Fu(this.process),this.target.addEventListener(\"message\",this.receive,!1),this.globalScope=_()?t:window;}send(t,e,r,n,i=!1){const a=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[a]=r);const s=k(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:t,hasCallback:!!r,targetMapId:n,mustQueue:i,sourceMapId:this.mapId,data:Pn(e,s)},s),{cancel:()=>{r&&delete this.callbacks[a],this.target.postMessage({id:a,type:\"<cancel>\",targetMapId:n,sourceMapId:this.mapId});}}}receive(t){const e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(\"<cancel>\"===e.type){delete this.tasks[r];const t=this.cancelCallbacks[r];delete this.cancelCallbacks[r],t&&t();}else _()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e);}process(){if(!this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e);}processTask(t,e){if(\"<response>\"===e.type){const r=this.callbacks[t];delete this.callbacks[t],r&&(e.error?r(Bn(e.error)):r(null,Bn(e.data)));}else {let r=!1;const n=k(this.globalScope)?void 0:[],i=e.hasCallback?(e,i)=>{r=!0,delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:\"<response>\",sourceMapId:this.mapId,error:e?Pn(e):null,data:Pn(i,n)},n);}:t=>{r=!0;};let a=null;const s=Bn(e.data);if(this.parent[e.type])a=this.parent[e.type](e.sourceMapId,s,i);else if(this.parent.getWorkerSource){const t=e.type.split(\".\");a=this.parent.getWorkerSource(e.sourceMapId,t[0],s.source)[t[1]](s,i);}else i(new Error(`Could not find function ${e.type}`));!r&&a&&a.cancel&&(this.cancelCallbacks[t]=a.cancel);}}remove(){this.invoker.remove(),this.target.removeEventListener(\"message\",this.receive,!1);}},t.AlphaImage=Ms,t.CanonicalTileID=Zu,t.CollisionBoxArray=Ni,t.CollisionCircleLayoutArray=class extends Ei{},t.Color=jt,t.DEMData=Xu,t.DataConstantProperty=li,t.DictionaryCoder=Yu,t.EXTENT=Na,t.ErrorEvent=R,t.EvaluationParameters=Qn,t.Event=U,t.Evented=q,t.FeatureIndex=Wu,t.FillBucket=xo,t.FillExtrusionBucket=Uo,t.GeoJSONFeature=Hu,t.ImageAtlas=Kl,t.ImagePosition=Zl,t.KDBush=Cc,t.LineBucket=tl,t.LineStripIndexArray=class extends Ri{},t.LngLat=Lu,t.MercatorCoordinate=ju,t.ONE_EM=dl,t.OverscaledTileID=Gu,t.PerformanceUtils=jc,t.Point=i,t.Pos3dArray=class extends _i{},t.PosArray=Qi,t.Properties=fi,t.Protobuf=$l,t.QuadTriangleArray=class extends Ti{},t.RGBAImage=Ps,t.RasterBoundsArray=class extends Ai{},t.RequestPerformance=class{constructor(t){this._marks={start:[t.url,\"start\"].join(\"#\"),end:[t.url,\"end\"].join(\"#\"),measure:t.url.toString()},performance.mark(this._marks.start);}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return 0===t.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}},t.SegmentVector=ya,t.SymbolBucket=_u,t.Transitionable=ri,t.TriangleIndexArray=ha,t.Uniform1f=Ba,t.Uniform1i=class extends Pa{constructor(t,e){super(t,e),this.current=0;}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t));}},t.Uniform2f=class extends Pa{constructor(t,e){super(t,e),this.current=[0,0];}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]));}},t.Uniform3f=class extends Pa{constructor(t,e){super(t,e),this.current=[0,0,0];}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]));}},t.Uniform4f=Ca,t.UniformColor=Va,t.UniformMatrix4f=class extends Pa{constructor(t,e){super(t,e),this.current=Ea;}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}},t.UnwrappedTileID=Ku,t.ValidationError=et,t.ZoomHistory=Cn,t.addDynamicAttributes=xu,t.arrayBufferToImage=function(t,e){const r=new Image;r.onload=()=>{e(null,r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame((()=>{r.src=I;}));},r.onerror=()=>e(new Error(\"Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.\"));const n=new Blob([new Uint8Array(t)],{type:\"image/png\"});r.src=t.byteLength?URL.createObjectURL(n):I;},t.arrayBufferToImageBitmap=function(t,e){const r=new Blob([new Uint8Array(t)],{type:\"image/png\"});createImageBitmap(r).then((t=>{e(null,t);})).catch((t=>{e(new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`));}));},t.asyncAll=function(t,e,r){if(!t.length)return r(null,[]);let n=t.length;const i=new Array(t.length);let a=null;t.forEach(((t,s)=>{e(t,((t,e)=>{t&&(a=t),i[s]=e,0==--n&&r(a,i);}));}));},t.bezier=l,t.bindAll=d,t.clamp=c,t.clipLine=rc,t.clone=function(t){var e=new ys(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=g,t.collisionCircleLayout=hl,t.config=B,t.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.create=function(){var t=new ys(16);return ys!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.createExpression=zr,t.createFilter=Tr,t.createLayout=vi,t.createStyleLayer=function(t){return \"custom\"===t.type?new Vu(t):new Eu[t.type](t)},t.deepEqual=function t(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return !1;for(let n=0;n<e.length;n++)if(!t(e[n],r[n]))return !1;return !0}if(\"object\"==typeof e&&null!==e&&null!==r){if(\"object\"!=typeof r)return !1;if(Object.keys(e).length!==Object.keys(r).length)return !1;for(const n in e)if(!t(e[n],r[n]))return !1;return !0}return e===r},t.derefLayers=function(t){t=t.slice();const e=Object.create(null);for(let r=0;r<t.length;r++)e[t[r].id]=t[r];for(let r=0;r<t.length;r++)\"ref\"in t[r]&&(t[r]=Z(t[r],e[t[r].ref]));return t},t.diffStyles=function(t,e){if(!t)return [{command:G.setStyle,args:[e]}];let r=[];try{if(!K(t.version,e.version))return [{command:G.setStyle,args:[e]}];K(t.center,e.center)||r.push({command:G.setCenter,args:[e.center]}),K(t.zoom,e.zoom)||r.push({command:G.setZoom,args:[e.zoom]}),K(t.bearing,e.bearing)||r.push({command:G.setBearing,args:[e.bearing]}),K(t.pitch,e.pitch)||r.push({command:G.setPitch,args:[e.pitch]}),K(t.sprite,e.sprite)||r.push({command:G.setSprite,args:[e.sprite]}),K(t.glyphs,e.glyphs)||r.push({command:G.setGlyphs,args:[e.glyphs]}),K(t.transition,e.transition)||r.push({command:G.setTransition,args:[e.transition]}),K(t.light,e.light)||r.push({command:G.setLight,args:[e.light]});const n={},i=[];!function(t,e,r,n){let i;for(i in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)||X(i,r,n));for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)?K(t[i],e[i])||(\"geojson\"===t[i].type&&\"geojson\"===e[i].type&&H(t,e,i)?r.push({command:G.setGeoJSONSourceData,args:[i,e[i].data]}):Y(i,e,r,n)):J(i,e,r));}(t.sources,e.sources,i,n);const a=[];t.layers&&t.layers.forEach((t=>{n[t.source]?r.push({command:G.removeLayer,args:[t.id]}):a.push(t);})),r=r.concat(i),function(t,e,r){e=e||[];const n=(t=t||[]).map(Q),i=e.map(Q),a=t.reduce(tt,{}),s=e.reduce(tt,{}),o=n.slice(),l=Object.create(null);let u,c,h,p,f,d,y;for(u=0,c=0;u<n.length;u++)h=n[u],Object.prototype.hasOwnProperty.call(s,h)?c++:(r.push({command:G.removeLayer,args:[h]}),o.splice(o.indexOf(h,c),1));for(u=0,c=0;u<i.length;u++)h=i[i.length-1-u],o[o.length-1-u]!==h&&(Object.prototype.hasOwnProperty.call(a,h)?(r.push({command:G.removeLayer,args:[h]}),o.splice(o.lastIndexOf(h,o.length-c),1)):c++,d=o[o.length-u],r.push({command:G.addLayer,args:[s[h],d]}),o.splice(o.length-u,0,h),l[h]=!0);for(u=0;u<i.length;u++)if(h=i[u],p=a[h],f=s[h],!l[h]&&!K(p,f))if(K(p.source,f.source)&&K(p[\"source-layer\"],f[\"source-layer\"])&&K(p.type,f.type)){for(y in W(p.layout,f.layout,r,h,null,G.setLayoutProperty),W(p.paint,f.paint,r,h,null,G.setPaintProperty),K(p.filter,f.filter)||r.push({command:G.setFilter,args:[h,f.filter]}),K(p.minzoom,f.minzoom)&&K(p.maxzoom,f.maxzoom)||r.push({command:G.setLayerZoomRange,args:[h,f.minzoom,f.maxzoom]}),p)Object.prototype.hasOwnProperty.call(p,y)&&\"layout\"!==y&&\"paint\"!==y&&\"filter\"!==y&&\"metadata\"!==y&&\"minzoom\"!==y&&\"maxzoom\"!==y&&(0===y.indexOf(\"paint.\")?W(p[y],f[y],r,h,y.slice(6),G.setPaintProperty):K(p[y],f[y])||r.push({command:G.setLayerProperty,args:[h,y,f[y]]}));for(y in f)Object.prototype.hasOwnProperty.call(f,y)&&!Object.prototype.hasOwnProperty.call(p,y)&&\"layout\"!==y&&\"paint\"!==y&&\"filter\"!==y&&\"metadata\"!==y&&\"minzoom\"!==y&&\"maxzoom\"!==y&&(0===y.indexOf(\"paint.\")?W(p[y],f[y],r,h,y.slice(6),G.setPaintProperty):K(p[y],f[y])||r.push({command:G.setLayerProperty,args:[h,y,f[y]]}));}else r.push({command:G.removeLayer,args:[h]}),d=o[o.lastIndexOf(h)+1],r.push({command:G.addLayer,args:[f,d]});}(a,e.layers,r);}catch(t){console.warn(\"Unable to compute style diff:\",t),r=[{command:G.setStyle,args:[e]}];}return r},t.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},t.earthRadius=Tu,t.ease=u,t.emitValidationErrors=kn,t.emptyStyle=function(){const t={},e=j.$version;for(const r in j.$root){const n=j.$root[r];if(n.required){let i=null;i=\"version\"===r?e:\"array\"===n.type?[]:{},null!=i&&(t[r]=i);}}return t},t.equals=function(t,e){var r=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],l=t[6],u=t[7],c=t[8],h=t[9],p=t[10],f=t[11],d=t[12],y=t[13],m=t[14],g=t[15],x=e[0],v=e[1],b=e[2],w=e[3],_=e[4],A=e[5],k=e[6],S=e[7],I=e[8],z=e[9],M=e[10],P=e[11],B=e[12],C=e[13],V=e[14],E=e[15];return Math.abs(r-x)<=ds*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(n-v)<=ds*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(i-b)<=ds*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(a-w)<=ds*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(s-_)<=ds*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(o-A)<=ds*Math.max(1,Math.abs(o),Math.abs(A))&&Math.abs(l-k)<=ds*Math.max(1,Math.abs(l),Math.abs(k))&&Math.abs(u-S)<=ds*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(c-I)<=ds*Math.max(1,Math.abs(c),Math.abs(I))&&Math.abs(h-z)<=ds*Math.max(1,Math.abs(h),Math.abs(z))&&Math.abs(p-M)<=ds*Math.max(1,Math.abs(p),Math.abs(M))&&Math.abs(f-P)<=ds*Math.max(1,Math.abs(f),Math.abs(P))&&Math.abs(d-B)<=ds*Math.max(1,Math.abs(d),Math.abs(B))&&Math.abs(y-C)<=ds*Math.max(1,Math.abs(y),Math.abs(C))&&Math.abs(m-V)<=ds*Math.max(1,Math.abs(m),Math.abs(V))&&Math.abs(g-E)<=ds*Math.max(1,Math.abs(g),Math.abs(E))},t.evaluateSizeForFeature=function(t,{uSize:e,uSizeT:r},{lowerSize:n,upperSize:i}){return \"source\"===t.kind?n/hu:\"composite\"===t.kind?Le.number(n/hu,i/hu,r):e},t.evaluateSizeForZoom=function(t,e){let r=0,n=0;if(\"constant\"===t.kind)n=t.layoutSize;else if(\"source\"!==t.kind){const{interpolationType:i,minZoom:a,maxZoom:s}=t,o=i?c($e.interpolationFactor(i,e,a,s),0,1):0;\"camera\"===t.kind?n=Le.number(t.minSize,t.maxSize,o):r=o;}return {uSizeT:r,uSize:n}},t.evaluateVariableOffset=kc,t.evented=Xn,t.exported=P,t.extend=p,t.filterObject=m,t.findLineIntersection=function(t,e,r,n){const a=e.y-t.y,s=e.x-t.x,o=n.y-r.y,l=n.x-r.x,u=o*s-l*a;if(0===u)return null;const c=(l*(t.y-r.y)-o*(t.x-r.x))/u;return new i(t.x+c*s,t.y+c*a)},t.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.getAnchorAlignment=su,t.getAnchorJustification=Sc,t.getArrayBuffer=L,t.getDefaultExportFromCjs=e,t.getJSON=function(t,e){return T(p(t,{type:\"json\"}),e)},t.getOverlapMode=du,t.getProtocolAction=E,t.getRTLTextPluginStatus=Yn,t.getReferrer=V,t.getVideo=function(t,e){const r=window.document.createElement(\"video\");r.muted=!0,r.onloadstart=function(){e(null,r);};for(let e=0;e<t.length;e++){const n=window.document.createElement(\"source\");$(t[e])||(r.crossOrigin=\"Anonymous\"),n.src=t[e],r.appendChild(n);}return {cancel:()=>{}}},t.groupByLayout=function(t,e){const r={};for(let n=0;n<t.length;n++){const i=e&&e[t[n].id]||Nr(t[n]);e&&(e[t[n].id]=i);let a=r[i];a||(a=r[i]=[]),a.push(t[n]);}const n=[];for(const t in r)n.push(r[t]);return n},t.identity=ms,t.interpolate=Le,t.invert=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],s=e[4],o=e[5],l=e[6],u=e[7],c=e[8],h=e[9],p=e[10],f=e[11],d=e[12],y=e[13],m=e[14],g=e[15],x=r*o-n*s,v=r*l-i*s,b=r*u-a*s,w=n*l-i*o,_=n*u-a*o,A=i*u-a*l,k=c*y-h*d,S=c*m-p*d,I=c*g-f*d,z=h*m-p*y,M=h*g-f*y,P=p*g-f*m,B=x*P-v*M+b*z+w*I-_*S+A*k;return B?(t[0]=(o*P-l*M+u*z)*(B=1/B),t[1]=(i*M-n*P-a*z)*B,t[2]=(y*A-m*_+g*w)*B,t[3]=(p*_-h*A-f*w)*B,t[4]=(l*I-s*P-u*S)*B,t[5]=(r*P-i*I+a*S)*B,t[6]=(m*b-d*A-g*v)*B,t[7]=(c*A-p*b+f*v)*B,t[8]=(s*M-o*I+u*k)*B,t[9]=(n*I-r*M-a*k)*B,t[10]=(d*_-y*b+g*x)*B,t[11]=(h*b-c*_-f*x)*B,t[12]=(o*S-s*z-l*k)*B,t[13]=(r*z-n*S+i*k)*B,t[14]=(y*v-d*w-m*x)*B,t[15]=(c*w-h*v+p*x)*B,t):null},t.isImageBitmap=S,t.isSafari=k,t.isWorker=_,t.keysDifference=function(t,e){const r=[];for(const n in t)n in e||r.push(n);return r},t.lazyLoadRTLTextPlugin=function(){Wn.isLoading()||Wn.isLoaded()||\"deferred\"!==Yn()||Hn();},t.makeRequest=T,t.mapObject=y,t.mercatorXfromLng=Ou,t.mercatorYfromLat=Uu,t.mercatorZfromAltitude=Ru,t.mul=vs,t.mul$1=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t},t.multiply=gs,t.nextPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.operations=G,t.ortho=function(t,e,r,n,i,a,s){var o=1/(e-r),l=1/(n-i),u=1/(a-s);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*o,t[13]=(i+n)*l,t[14]=(s+a)*u,t[15]=1,t},t.parseCacheControl=function(t){const e={};if(t.replace(/(?:^|(?:\\s*\\,\\s*))([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)(?:\\=(?:([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)|(?:\\\"((?:[^\"\\\\]|\\\\.)*)\\\")))?/g,((t,r,n,i)=>{const a=n||i;return e[r]=!a||a.toLowerCase(),\"\"})),e[\"max-age\"]){const t=parseInt(e[\"max-age\"],10);isNaN(t)?delete e[\"max-age\"]:e[\"max-age\"]=t;}return e},t.parseGlyphPbf=function(t){return new $l(t).readFields(Ol,[])},t.pbf=yl,t.performSymbolLayout=function(e){e.bucket.createArrays(),e.bucket.tilePixelRatio=Na/(512*e.bucket.overscaling),e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;const r=e.bucket.layers[0].layout,n=e.bucket.layers[0]._unevaluatedLayout._values,i={layoutIconSize:n[\"icon-size\"].possiblyEvaluate(new Qn(e.bucket.zoom+1),e.canonical),layoutTextSize:n[\"text-size\"].possiblyEvaluate(new Qn(e.bucket.zoom+1),e.canonical),textMaxSize:n[\"text-size\"].possiblyEvaluate(new Qn(18))};if(\"composite\"===e.bucket.textSizeData.kind){const{minZoom:t,maxZoom:r}=e.bucket.textSizeData;i.compositeTextSizes=[n[\"text-size\"].possiblyEvaluate(new Qn(t),e.canonical),n[\"text-size\"].possiblyEvaluate(new Qn(r),e.canonical)];}if(\"composite\"===e.bucket.iconSizeData.kind){const{minZoom:t,maxZoom:r}=e.bucket.iconSizeData;i.compositeIconSizes=[n[\"icon-size\"].possiblyEvaluate(new Qn(t),e.canonical),n[\"icon-size\"].possiblyEvaluate(new Qn(r),e.canonical)];}const a=r.get(\"text-line-height\")*dl,s=\"viewport\"!==r.get(\"text-rotation-alignment\")&&\"point\"!==r.get(\"symbol-placement\"),o=r.get(\"text-keep-upright\"),l=r.get(\"text-size\");for(const n of e.bucket.features){const u=r.get(\"text-font\").evaluate(n,{},e.canonical).join(\",\"),c=l.evaluate(n,{},e.canonical),h=i.layoutTextSize.evaluate(n,{},e.canonical),p=i.layoutIconSize.evaluate(n,{},e.canonical),f={horizontal:{},vertical:void 0},d=n.text;let y,m=[0,0];if(d){const i=d.toString(),l=r.get(\"text-letter-spacing\").evaluate(n,{},e.canonical)*dl,p=Fn(i)?l:0,y=r.get(\"text-anchor\").evaluate(n,{},e.canonical),g=r.get(\"text-variable-anchor\");if(!g){const t=r.get(\"text-radial-offset\").evaluate(n,{},e.canonical);m=t?kc(y,[t*dl,Ac]):r.get(\"text-offset\").evaluate(n,{},e.canonical).map((t=>t*dl));}let x=s?\"center\":r.get(\"text-justify\").evaluate(n,{},e.canonical);const v=r.get(\"symbol-placement\"),b=\"point\"===v?r.get(\"text-max-width\").evaluate(n,{},e.canonical)*dl:0,w=()=>{e.bucket.allowVerticalPlacement&&En(i)&&(f.vertical=Hl(d,e.glyphMap,e.glyphPositions,e.imagePositions,u,b,a,y,\"left\",p,m,t.WritingMode.vertical,!0,v,h,c));};if(!s&&g){const r=\"auto\"===x?g.map((t=>Sc(t))):[x];let n=!1;for(let i=0;i<r.length;i++){const s=r[i];if(!f.horizontal[s])if(n)f.horizontal[s]=f.horizontal[0];else {const r=Hl(d,e.glyphMap,e.glyphPositions,e.imagePositions,u,b,a,\"center\",s,p,m,t.WritingMode.horizontal,!1,v,h,c);r&&(f.horizontal[s]=r,n=1===r.positionedLines.length);}}w();}else {\"auto\"===x&&(x=Sc(y));const r=Hl(d,e.glyphMap,e.glyphPositions,e.imagePositions,u,b,a,y,x,p,m,t.WritingMode.horizontal,!1,v,h,c);r&&(f.horizontal[x]=r),w(),En(i)&&s&&o&&(f.vertical=Hl(d,e.glyphMap,e.glyphPositions,e.imagePositions,u,b,a,y,x,p,m,t.WritingMode.vertical,!1,v,h,c));}}let g=!1;if(n.icon&&n.icon.name){const t=e.imageMap[n.icon.name];t&&(y=lu(e.imagePositions[n.icon.name],r.get(\"icon-offset\").evaluate(n,{},e.canonical),r.get(\"icon-anchor\").evaluate(n,{},e.canonical)),g=!!t.sdf,void 0===e.bucket.sdfIcons?e.bucket.sdfIcons=g:e.bucket.sdfIcons!==g&&v(\"Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer\"),(t.pixelRatio!==e.bucket.pixelRatio||0!==r.get(\"icon-rotate\").constantOr(1))&&(e.bucket.iconsNeedLinear=!0));}const x=Mc(f.horizontal)||f.vertical;e.bucket.iconsInText=!!x&&x.iconsInText,(x||y)&&Ic(e.bucket,n,f,y,e.imageMap,i,h,p,m,g,e.canonical);}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers();},t.perspective=function(t,e,r,n,i){var a,s=1/Math.tan(e/2);return t[0]=s/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(t[10]=(i+n)*(a=1/(n-i)),t[14]=2*i*n*a):(t[10]=-1,t[14]=-2*n),t},t.pick=function(t,e){const r={};for(let n=0;n<e.length;n++){const i=e[n];i in t&&(r[i]=t[i]);}return r},t.plugin=Wn,t.pointGeometry=r,t.polygonIntersectsPolygon=Ha,t.potpack=jl,t.register=zn,t.registerForPluginStateChange=function(t){return t({pluginStatus:Zn,pluginURL:Kn}),Xn.on(\"pluginStateChange\",t),t},t.renderColorRamp=Bs,t.rotateX=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=e[9],h=e[10],p=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=a*i+u*n,t[5]=s*i+c*n,t[6]=o*i+h*n,t[7]=l*i+p*n,t[8]=u*i-a*n,t[9]=c*i-s*n,t[10]=h*i-o*n,t[11]=p*i-l*n,t},t.rotateZ=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),a=e[0],s=e[1],o=e[2],l=e[3],u=e[4],c=e[5],h=e[6],p=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=a*i+u*n,t[1]=s*i+c*n,t[2]=o*i+h*n,t[3]=l*i+p*n,t[4]=u*i-a*n,t[5]=c*i-s*n,t[6]=h*i-o*n,t[7]=p*i-l*n,t},t.sameOrigin=$,t.scale=function(t,e,r){var n=r[0],i=r[1],a=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*a,t[9]=e[9]*a,t[10]=e[10]*a,t[11]=e[11]*a,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.setRTLTextPlugin=function(t,e,r=!1){if(Zn===Rn||Zn===qn||Zn===jn)throw new Error(\"setRTLTextPlugin cannot be called multiple times.\");Kn=P.resolveURL(t),Zn=Rn,Nn=e,Jn(),r||Hn();},t.sphericalToCartesian=function([t,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:t*Math.cos(e)*Math.sin(r),y:t*Math.sin(e)*Math.sin(r),z:t*Math.cos(r)}},t.toEvaluationFeature=Ja,t.transformMat4=bs,t.translate=function(t,e,r){var n,i,a,s,o,l,u,c,h,p,f,d,y=r[0],m=r[1],g=r[2];return e===t?(t[12]=e[0]*y+e[4]*m+e[8]*g+e[12],t[13]=e[1]*y+e[5]*m+e[9]*g+e[13],t[14]=e[2]*y+e[6]*m+e[10]*g+e[14],t[15]=e[3]*y+e[7]*m+e[11]*g+e[15]):(i=e[1],a=e[2],s=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],f=e[10],d=e[11],t[0]=n=e[0],t[1]=i,t[2]=a,t[3]=s,t[4]=o,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=p,t[10]=f,t[11]=d,t[12]=n*y+o*m+h*g+e[12],t[13]=i*y+l*m+p*g+e[13],t[14]=a*y+u*m+f*g+e[14],t[15]=s*y+c*m+d*g+e[15]),t},t.triggerPluginCompletionEvent=Gn,t.unicodeBlockLookup=Vn,t.uniqueId=function(){return f++},t.v8Spec=j,t.validateCustomStyleLayer=function(t){const e=[],r=t.id;return void 0===r&&e.push({message:`layers.${r}: missing required property \"id\"`}),void 0===t.render&&e.push({message:`layers.${r}: missing required method \"render\"`}),t.renderingMode&&\"2d\"!==t.renderingMode&&\"3d\"!==t.renderingMode&&e.push({message:`layers.${r}: property \"renderingMode\" must be either \"2d\" or \"3d\"`}),e},t.validateLight=wn,t.validateStyle=bn,t.vectorTile=So,t.warnOnce=v,t.wrap=h;}));\n\ndefine([\"./shared\"],(function(e){\"use strict\";class t{constructor(e){this.keyCache={},e&&this.replace(e);}replace(e){this._layerConfigs={},this._layers={},this.update(e,[]);}update(t,o){for(const o of t){this._layerConfigs[o.id]=o;const t=this._layers[o.id]=e.createStyleLayer(o);t._featureFilter=e.createFilter(t.filter),this.keyCache[o.id]&&delete this.keyCache[o.id];}for(const e of o)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const i=e.groupByLayout(Object.values(this._layerConfigs),this.keyCache);for(const e of i){const t=e.map((e=>this._layers[e.id])),o=t[0];if(\"none\"===o.visibility)continue;const i=o.source||\"\";let r=this.familiesBySource[i];r||(r=this.familiesBySource[i]={});const s=o.sourceLayer||\"_geojsonTileLayer\";let n=r[s];n||(n=r[s]=[]),n.push(t);}}}class o{constructor(t){const o={},i=[];for(const e in t){const r=t[e],s=o[e]={};for(const e in r){const t=r[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const o={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};i.push(o),s[e]={rect:o,metrics:t.metrics};}}const{w:r,h:s}=e.potpack(i),n=new e.AlphaImage({width:r||1,height:s||1});for(const i in t){const r=t[i];for(const t in r){const s=r[+t];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const a=o[i][t].rect;e.AlphaImage.copy(s.bitmap,n,{x:0,y:0},{x:a.x+1,y:a.y+1},s.bitmap);}}this.image=n,this.positions=o;}}e.register(\"GlyphAtlas\",o);class i{constructor(t){this.tileID=new e.OverscaledTileID(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId;}parse(t,i,s,n,a){this.status=\"parsing\",this.data=t,this.collisionBoxArray=new e.CollisionBoxArray;const l=new e.DictionaryCoder(Object.keys(t.layers).sort()),c=new e.FeatureIndex(this.tileID,this.promoteId);c.bucketLayerIDs=[];const u={},h={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:s},d=i.familiesBySource[this.source];for(const o in d){const i=t.layers[o];if(!i)continue;1===i.version&&e.warnOnce(`Vector tile source \"${this.source}\" layer \"${o}\" does not use vector tile spec v2 and therefore may have some rendering errors.`);const n=l.encode(o),a=[];for(let e=0;e<i.length;e++){const t=i.feature(e),r=c.getId(t,o);a.push({feature:t,id:r,index:e,sourceLayerIndex:n});}for(const t of d[o]){const o=t[0];o.source!==this.source&&e.warnOnce(`layer.source = ${o.source} does not equal this.source = ${this.source}`),o.minzoom&&this.zoom<Math.floor(o.minzoom)||o.maxzoom&&this.zoom>=o.maxzoom||\"none\"!==o.visibility&&(r(t,this.zoom,s),(u[o.id]=o.createBucket({index:c.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:n,sourceID:this.source})).populate(a,h,this.tileID.canonical),c.bucketLayerIDs.push(t.map((e=>e.id))));}}let p,f,g,m;const y=e.mapObject(h.glyphDependencies,(e=>Object.keys(e).map(Number)));Object.keys(y).length?n.send(\"getGlyphs\",{uid:this.uid,stacks:y,source:this.source,tileID:this.tileID,type:\"glyphs\"},((e,t)=>{p||(p=e,f=t,w.call(this));})):f={};const v=Object.keys(h.iconDependencies);v.length?n.send(\"getImages\",{icons:v,source:this.source,tileID:this.tileID,type:\"icons\"},((e,t)=>{p||(p=e,g=t,w.call(this));})):g={};const x=Object.keys(h.patternDependencies);function w(){if(p)return a(p);if(f&&g&&m){const t=new o(f),i=new e.ImageAtlas(g,m);for(const o in u){const n=u[o];n instanceof e.SymbolBucket?(r(n.layers,this.zoom,s),e.performSymbolLayout({bucket:n,glyphMap:f,glyphPositions:t.positions,imageMap:g,imagePositions:i.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):n.hasPattern&&(n instanceof e.LineBucket||n instanceof e.FillBucket||n instanceof e.FillExtrusionBucket)&&(r(n.layers,this.zoom,s),n.addFeatures(h,this.tileID.canonical,i.patternPositions));}this.status=\"done\",a(null,{buckets:Object.values(u).filter((e=>!e.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,imageAtlas:i,glyphMap:this.returnDependencies?f:null,iconMap:this.returnDependencies?g:null,glyphPositions:this.returnDependencies?t.positions:null});}}x.length?n.send(\"getImages\",{icons:x,source:this.source,tileID:this.tileID,type:\"patterns\"},((e,t)=>{p||(p=e,m=t,w.call(this));})):m={},w.call(this);}}function r(t,o,i){const r=new e.EvaluationParameters(o);for(const e of t)e.recalculate(r,i);}function s(t,o){const i=e.getArrayBuffer(t.request,((t,i,r,s)=>{t?o(t):i&&o(null,{vectorTile:new e.vectorTile.VectorTile(new e.Protobuf(i)),rawData:i,cacheControl:r,expires:s});}));return ()=>{i.cancel(),o();}}class n{constructor(e,t,o,i){this.actor=e,this.layerIndex=t,this.availableImages=o,this.loadVectorData=i||s,this.loading={},this.loaded={};}loadTile(t,o){const r=t.uid;this.loading||(this.loading={});const s=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.RequestPerformance(t.request),n=this.loading[r]=new i(t);n.abort=this.loadVectorData(t,((t,i)=>{if(delete this.loading[r],t||!i)return n.status=\"done\",this.loaded[r]=n,o(t);const a=i.rawData,l={};i.expires&&(l.expires=i.expires),i.cacheControl&&(l.cacheControl=i.cacheControl);const c={};if(s){const e=s.finish();e&&(c.resourceTiming=JSON.parse(JSON.stringify(e)));}n.vectorTile=i.vectorTile,n.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,((t,i)=>{if(t||!i)return o(t);o(null,e.extend({rawTileData:a.slice(0)},i,l,c));})),this.loaded=this.loaded||{},this.loaded[r]=n;}));}reloadTile(e,t){const o=this.loaded,i=e.uid,r=this;if(o&&o[i]){const s=o[i];s.showCollisionBoxes=e.showCollisionBoxes;const n=(e,o)=>{const i=s.reloadCallback;i&&(delete s.reloadCallback,s.parse(s.vectorTile,r.layerIndex,this.availableImages,r.actor,i)),t(e,o);};\"parsing\"===s.status?s.reloadCallback=n:\"done\"===s.status&&(s.vectorTile?s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,n):n());}}abortTile(e,t){const o=this.loading,i=e.uid;o&&o[i]&&o[i].abort&&(o[i].abort(),delete o[i]),t();}removeTile(e,t){const o=this.loaded,i=e.uid;o&&o[i]&&delete o[i],t();}}class a{constructor(){this.loaded={};}loadTile(t,o){const{uid:i,encoding:r,rawImageData:s}=t,n=e.isImageBitmap(s)?this.getImageData(s):s,a=new e.DEMData(i,n,r);this.loaded=this.loaded||{},this.loaded[i]=a,o(null,a);}getImageData(t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(t.width,t.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext(\"2d\",{willReadFrequently:!0})),this.offscreenCanvas.width=t.width,this.offscreenCanvas.height=t.height,this.offscreenCanvasContext.drawImage(t,0,0,t.width,t.height);const o=this.offscreenCanvasContext.getImageData(-1,-1,t.width+2,t.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new e.RGBAImage({width:o.width,height:o.height},o.data)}removeTile(e){const t=this.loaded,o=e.uid;t&&t[o]&&delete t[o];}}function l(e,t){if(0!==e.length){c(e[0],t);for(var o=1;o<e.length;o++)c(e[o],!t);}}function c(e,t){for(var o=0,i=0,r=0,s=e.length,n=s-1;r<s;n=r++){var a=(e[r][0]-e[n][0])*(e[n][1]+e[r][1]),l=o+a;i+=Math.abs(o)>=Math.abs(a)?o-l+a:a-l+o,o=l;}o+i>=0!=!!t&&e.reverse();}var u=e.getDefaultExportFromCjs((function e(t,o){var i,r=t&&t.type;if(\"FeatureCollection\"===r)for(i=0;i<t.features.length;i++)e(t.features[i],o);else if(\"GeometryCollection\"===r)for(i=0;i<t.geometries.length;i++)e(t.geometries[i],o);else if(\"Feature\"===r)e(t.geometry,o);else if(\"Polygon\"===r)l(t.coordinates,o);else if(\"MultiPolygon\"===r)for(i=0;i<t.coordinates.length;i++)l(t.coordinates[i],o);return t}));const h=e.vectorTile.VectorTileFeature.prototype.toGeoJSON;var d={exports:{}},p=e.pointGeometry,f=e.vectorTile.VectorTileFeature,g=m;function m(e,t){this.options=t||{},this.features=e,this.length=e.length;}function y(e,t){this.id=\"number\"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096;}m.prototype.feature=function(e){return new y(this.features[e],this.options.extent)},y.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var t=0;t<e.length;t++){for(var o=e[t],i=[],r=0;r<o.length;r++)i.push(new p(o[r][0],o[r][1]));this.geometry.push(i);}return this.geometry},y.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,o=-1/0,i=1/0,r=-1/0,s=0;s<e.length;s++)for(var n=e[s],a=0;a<n.length;a++){var l=n[a];t=Math.min(t,l.x),o=Math.max(o,l.x),i=Math.min(i,l.y),r=Math.max(r,l.y);}return [t,i,o,r]},y.prototype.toGeoJSON=f.prototype.toGeoJSON;var v=e.pbf,x=g;function w(e){var t=new v;return function(e,t){for(var o in e.layers)t.writeMessage(3,S,e.layers[o]);}(e,t),t.finish()}function S(e,t){var o;t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||\"\"),t.writeVarintField(5,e.extent||4096);var i={keys:[],values:[],keycache:{},valuecache:{}};for(o=0;o<e.length;o++)i.feature=e.feature(o),t.writeMessage(2,b,i);var r=i.keys;for(o=0;o<r.length;o++)t.writeStringField(3,r[o]);var s=i.values;for(o=0;o<s.length;o++)t.writeMessage(4,T,s[o]);}function b(e,t){var o=e.feature;void 0!==o.id&&t.writeVarintField(1,o.id),t.writeMessage(2,I,e),t.writeVarintField(3,o.type),t.writeMessage(4,k,o);}function I(e,t){var o=e.feature,i=e.keys,r=e.values,s=e.keycache,n=e.valuecache;for(var a in o.properties){var l=o.properties[a],c=s[a];if(null!==l){void 0===c&&(i.push(a),s[a]=c=i.length-1),t.writeVarint(c);var u=typeof l;\"string\"!==u&&\"boolean\"!==u&&\"number\"!==u&&(l=JSON.stringify(l));var h=u+\":\"+l,d=n[h];void 0===d&&(r.push(l),n[h]=d=r.length-1),t.writeVarint(d);}}}function M(e,t){return (t<<3)+(7&e)}function P(e){return e<<1^e>>31}function k(e,t){for(var o=e.loadGeometry(),i=e.type,r=0,s=0,n=o.length,a=0;a<n;a++){var l=o[a],c=1;1===i&&(c=l.length),t.writeVarint(M(1,c));for(var u=3===i?l.length-1:l.length,h=0;h<u;h++){1===h&&1!==i&&t.writeVarint(M(2,u-1));var d=l[h].x-r,p=l[h].y-s;t.writeVarint(P(d)),t.writeVarint(P(p)),r+=d,s+=p;}3===i&&t.writeVarint(M(7,1));}}function T(e,t){var o=typeof e;\"string\"===o?t.writeStringField(1,e):\"boolean\"===o?t.writeBooleanField(7,e):\"number\"===o&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e));}d.exports=w,d.exports.fromVectorTileJs=w,d.exports.fromGeojsonVt=function(e,t){t=t||{};var o={};for(var i in e)o[i]=new x(e[i].features,t),o[i].name=i,o[i].version=t.version,o[i].extent=t.extent;return w({layers:o})},d.exports.GeoJSONWrapper=x;var C=e.getDefaultExportFromCjs(d.exports);const _={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},D=Math.fround||(O=new Float32Array(1),e=>(O[0]=+e,O[0]));var O;const L=3,F=5,E=6;class z{constructor(e){this.options=Object.assign(Object.create(_),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[];}load(e){const{log:t,minZoom:o,maxZoom:i}=this.options;t&&console.time(\"total time\");const r=`prepare ${e.length} points`;t&&console.time(r),this.points=e;const s=[];for(let t=0;t<e.length;t++){const o=e[t];if(!o.geometry)continue;const[i,r]=o.geometry.coordinates,n=D(B(i)),a=D(Z(r));s.push(n,a,1/0,t,-1,1),this.options.reduce&&s.push(0);}let n=this.trees[i+1]=this._createTree(s);t&&console.timeEnd(r);for(let e=i;e>=o;e--){const o=+Date.now();n=this.trees[e]=this._createTree(this._cluster(n,e)),t&&console.log(\"z%d: %d clusters in %dms\",e,n.numItems,+Date.now()-o);}return t&&console.timeEnd(\"total time\"),this}getClusters(e,t){let o=((e[0]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,e[1]));let r=180===e[2]?180:((e[2]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)o=-180,r=180;else if(o>r){const e=this.getClusters([o,i,180,s],t),n=this.getClusters([-180,i,r,s],t);return e.concat(n)}const n=this.trees[this._limitZoom(t)],a=n.range(B(o),Z(s),B(r),Z(i)),l=n.data,c=[];for(const e of a){const t=this.stride*e;c.push(l[t+F]>1?j(l,t,this.clusterProps):this.points[l[t+L]]);}return c}getChildren(e){const t=this._getOriginId(e),o=this._getOriginZoom(e),i=\"No cluster with the specified id.\",r=this.trees[o];if(!r)throw new Error(i);const s=r.data;if(t*this.stride>=s.length)throw new Error(i);const n=this.options.radius/(this.options.extent*Math.pow(2,o-1)),a=r.within(s[t*this.stride],s[t*this.stride+1],n),l=[];for(const t of a){const o=t*this.stride;s[o+4]===e&&l.push(s[o+F]>1?j(s,o,this.clusterProps):this.points[s[o+L]]);}if(0===l.length)throw new Error(i);return l}getLeaves(e,t,o){const i=[];return this._appendLeaves(i,e,t=t||10,o=o||0,0),i}getTile(e,t,o){const i=this.trees[this._limitZoom(e)],r=Math.pow(2,e),{extent:s,radius:n}=this.options,a=n/s,l=(o-a)/r,c=(o+1+a)/r,u={features:[]};return this._addTileFeatures(i.range((t-a)/r,l,(t+1+a)/r,c),i.data,t,o,r,u),0===t&&this._addTileFeatures(i.range(1-a/r,l,1,c),i.data,r,o,r,u),t===r-1&&this._addTileFeatures(i.range(0,l,a/r,c),i.data,-1,o,r,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const o=this.getChildren(e);if(t++,1!==o.length)break;e=o[0].properties.cluster_id;}return t}_appendLeaves(e,t,o,i,r){const s=this.getChildren(t);for(const t of s){const s=t.properties;if(s&&s.cluster?r+s.point_count<=i?r+=s.point_count:r=this._appendLeaves(e,s.cluster_id,o,i,r):r<i?r++:e.push(t),e.length===o)break}return r}_createTree(t){const o=new e.KDBush(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let e=0;e<t.length;e+=this.stride)o.add(t[e],t[e+1]);return o.finish(),o.data=t,o}_addTileFeatures(e,t,o,i,r,s){for(const n of e){const e=n*this.stride,a=t[e+F]>1;let l,c,u;if(a)l=N(t,e,this.clusterProps),c=t[e],u=t[e+1];else {const o=this.points[t[e+L]];l=o.properties;const[i,r]=o.geometry.coordinates;c=B(i),u=Z(r);}const h={type:1,geometry:[[Math.round(this.options.extent*(c*r-o)),Math.round(this.options.extent*(u*r-i))]],tags:l};let d;d=a||this.options.generateId?t[e+L]:this.points[t[e+L]].id,void 0!==d&&(h.id=d),s.features.push(h);}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:o,extent:i,reduce:r,minPoints:s}=this.options,n=o/(i*Math.pow(2,t)),a=e.data,l=[],c=this.stride;for(let o=0;o<a.length;o+=c){if(a[o+2]<=t)continue;a[o+2]=t;const i=a[o],u=a[o+1],h=e.within(a[o],a[o+1],n),d=a[o+F];let p=d;for(const e of h){const o=e*c;a[o+2]>t&&(p+=a[o+F]);}if(p>d&&p>=s){let e,s=i*d,n=u*d,f=-1;const g=((o/c|0)<<5)+(t+1)+this.points.length;for(const i of h){const l=i*c;if(a[l+2]<=t)continue;a[l+2]=t;const u=a[l+F];s+=a[l]*u,n+=a[l+1]*u,a[l+4]=g,r&&(e||(e=this._map(a,o,!0),f=this.clusterProps.length,this.clusterProps.push(e)),r(e,this._map(a,l)));}a[o+4]=g,l.push(s/p,n/p,1/0,g,-1,p),r&&l.push(f);}else {for(let e=0;e<c;e++)l.push(a[o+e]);if(p>1)for(const e of h){const o=e*c;if(!(a[o+2]<=t)){a[o+2]=t;for(let e=0;e<c;e++)l.push(a[o+e]);}}}}return l}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return (e-this.points.length)%32}_map(e,t,o){if(e[t+F]>1){const i=this.clusterProps[e[t+E]];return o?Object.assign({},i):i}const i=this.points[e[t+L]].properties,r=this.options.map(i);return o&&r===i?Object.assign({},r):r}}function j(e,t,o){return {type:\"Feature\",id:e[t+L],properties:N(e,t,o),geometry:{type:\"Point\",coordinates:[(i=e[t],360*(i-.5)),A(e[t+1])]}};var i;}function N(e,t,o){const i=e[t+F],r=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?Math.round(i/100)/10+\"k\":i,s=e[t+E],n=-1===s?{}:Object.assign({},o[s]);return Object.assign(n,{cluster:!0,cluster_id:e[t+L],point_count:i,point_count_abbreviated:r})}function B(e){return e/360+.5}function Z(e){const t=Math.sin(e*Math.PI/180),o=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return o<0?0:o>1?1:o}function A(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function G(e,t,o,i){for(var r,s=i,n=o-t>>1,a=o-t,l=e[t],c=e[t+1],u=e[o],h=e[o+1],d=t+3;d<o;d+=3){var p=J(e[d],e[d+1],l,c,u,h);if(p>s)r=d,s=p;else if(p===s){var f=Math.abs(d-n);f<a&&(r=d,a=f);}}s>i&&(r-t>3&&G(e,t,r,i),e[r+2]=s,o-r>3&&G(e,r,o,i));}function J(e,t,o,i,r,s){var n=r-o,a=s-i;if(0!==n||0!==a){var l=((e-o)*n+(t-i)*a)/(n*n+a*a);l>1?(o=r,i=s):l>0&&(o+=n*l,i+=a*l);}return (n=e-o)*n+(a=t-i)*a}function Y(e,t,o,i){var r={id:void 0===e?null:e,type:t,geometry:o,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,o=e.type;if(\"Point\"===o||\"MultiPoint\"===o||\"LineString\"===o)R(e,t);else if(\"Polygon\"===o||\"MultiLineString\"===o)for(var i=0;i<t.length;i++)R(e,t[i]);else if(\"MultiPolygon\"===o)for(i=0;i<t.length;i++)for(var r=0;r<t[i].length;r++)R(e,t[i][r]);}(r),r}function R(e,t){for(var o=0;o<t.length;o+=3)e.minX=Math.min(e.minX,t[o]),e.minY=Math.min(e.minY,t[o+1]),e.maxX=Math.max(e.maxX,t[o]),e.maxY=Math.max(e.maxY,t[o+1]);}function V(e,t,o,i){if(t.geometry){var r=t.geometry.coordinates,s=t.geometry.type,n=Math.pow(o.tolerance/((1<<o.maxZoom)*o.extent),2),a=[],l=t.id;if(o.promoteId?l=t.properties[o.promoteId]:o.generateId&&(l=i||0),\"Point\"===s)X(r,a);else if(\"MultiPoint\"===s)for(var c=0;c<r.length;c++)X(r[c],a);else if(\"LineString\"===s)W(r,a,n,!1);else if(\"MultiLineString\"===s){if(o.lineMetrics){for(c=0;c<r.length;c++)W(r[c],a=[],n,!1),e.push(Y(l,\"LineString\",a,t.properties));return}q(r,a,n,!1);}else if(\"Polygon\"===s)q(r,a,n,!0);else {if(\"MultiPolygon\"!==s){if(\"GeometryCollection\"===s){for(c=0;c<t.geometry.geometries.length;c++)V(e,{id:l,geometry:t.geometry.geometries[c],properties:t.properties},o,i);return}throw new Error(\"Input data is not a valid GeoJSON object.\")}for(c=0;c<r.length;c++){var u=[];q(r[c],u,n,!0),a.push(u);}}e.push(Y(l,s,a,t.properties));}}function X(e,t){t.push($(e[0])),t.push(U(e[1])),t.push(0);}function W(e,t,o,i){for(var r,s,n=0,a=0;a<e.length;a++){var l=$(e[a][0]),c=U(e[a][1]);t.push(l),t.push(c),t.push(0),a>0&&(n+=i?(r*c-l*s)/2:Math.sqrt(Math.pow(l-r,2)+Math.pow(c-s,2))),r=l,s=c;}var u=t.length-3;t[2]=1,G(t,0,u,o),t[u+2]=1,t.size=Math.abs(n),t.start=0,t.end=t.size;}function q(e,t,o,i){for(var r=0;r<e.length;r++){var s=[];W(e[r],s,o,i),t.push(s);}}function $(e){return e/360+.5}function U(e){var t=Math.sin(e*Math.PI/180),o=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return o<0?0:o>1?1:o}function K(e,t,o,i,r,s,n,a){if(i/=t,s>=(o/=t)&&n<i)return e;if(n<o||s>=i)return null;for(var l=[],c=0;c<e.length;c++){var u=e[c],h=u.geometry,d=u.type,p=0===r?u.minX:u.minY,f=0===r?u.maxX:u.maxY;if(p>=o&&f<i)l.push(u);else if(!(f<o||p>=i)){var g=[];if(\"Point\"===d||\"MultiPoint\"===d)H(h,g,o,i,r);else if(\"LineString\"===d)Q(h,g,o,i,r,!1,a.lineMetrics);else if(\"MultiLineString\"===d)te(h,g,o,i,r,!1);else if(\"Polygon\"===d)te(h,g,o,i,r,!0);else if(\"MultiPolygon\"===d)for(var m=0;m<h.length;m++){var y=[];te(h[m],y,o,i,r,!0),y.length&&g.push(y);}if(g.length){if(a.lineMetrics&&\"LineString\"===d){for(m=0;m<g.length;m++)l.push(Y(u.id,d,g[m],u.tags));continue}\"LineString\"!==d&&\"MultiLineString\"!==d||(1===g.length?(d=\"LineString\",g=g[0]):d=\"MultiLineString\"),\"Point\"!==d&&\"MultiPoint\"!==d||(d=3===g.length?\"Point\":\"MultiPoint\"),l.push(Y(u.id,d,g,u.tags));}}}return l.length?l:null}function H(e,t,o,i,r){for(var s=0;s<e.length;s+=3){var n=e[s+r];n>=o&&n<=i&&(t.push(e[s]),t.push(e[s+1]),t.push(e[s+2]));}}function Q(e,t,o,i,r,s,n){for(var a,l,c=ee(e),u=0===r?ie:re,h=e.start,d=0;d<e.length-3;d+=3){var p=e[d],f=e[d+1],g=e[d+2],m=e[d+3],y=e[d+4],v=0===r?p:f,x=0===r?m:y,w=!1;n&&(a=Math.sqrt(Math.pow(p-m,2)+Math.pow(f-y,2))),v<o?x>o&&(l=u(c,p,f,m,y,o),n&&(c.start=h+a*l)):v>i?x<i&&(l=u(c,p,f,m,y,i),n&&(c.start=h+a*l)):oe(c,p,f,g),x<o&&v>=o&&(l=u(c,p,f,m,y,o),w=!0),x>i&&v<=i&&(l=u(c,p,f,m,y,i),w=!0),!s&&w&&(n&&(c.end=h+a*l),t.push(c),c=ee(e)),n&&(h+=a);}var S=e.length-3;p=e[S],f=e[S+1],g=e[S+2],(v=0===r?p:f)>=o&&v<=i&&oe(c,p,f,g),S=c.length-3,s&&S>=3&&(c[S]!==c[0]||c[S+1]!==c[1])&&oe(c,c[0],c[1],c[2]),c.length&&t.push(c);}function ee(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function te(e,t,o,i,r,s){for(var n=0;n<e.length;n++)Q(e[n],t,o,i,r,s,!1);}function oe(e,t,o,i){e.push(t),e.push(o),e.push(i);}function ie(e,t,o,i,r,s){var n=(s-t)/(i-t);return e.push(s),e.push(o+(r-o)*n),e.push(1),n}function re(e,t,o,i,r,s){var n=(s-o)/(r-o);return e.push(t+(i-t)*n),e.push(s),e.push(1),n}function se(e,t){for(var o=[],i=0;i<e.length;i++){var r,s=e[i],n=s.type;if(\"Point\"===n||\"MultiPoint\"===n||\"LineString\"===n)r=ne(s.geometry,t);else if(\"MultiLineString\"===n||\"Polygon\"===n){r=[];for(var a=0;a<s.geometry.length;a++)r.push(ne(s.geometry[a],t));}else if(\"MultiPolygon\"===n)for(r=[],a=0;a<s.geometry.length;a++){for(var l=[],c=0;c<s.geometry[a].length;c++)l.push(ne(s.geometry[a][c],t));r.push(l);}o.push(Y(s.id,n,r,s.tags));}return o}function ne(e,t){var o=[];o.size=e.size,void 0!==e.start&&(o.start=e.start,o.end=e.end);for(var i=0;i<e.length;i+=3)o.push(e[i]+t,e[i+1],e[i+2]);return o}function ae(e,t){if(e.transformed)return e;var o,i,r,s=1<<e.z,n=e.x,a=e.y;for(o=0;o<e.features.length;o++){var l=e.features[o],c=l.geometry,u=l.type;if(l.geometry=[],1===u)for(i=0;i<c.length;i+=2)l.geometry.push(le(c[i],c[i+1],t,s,n,a));else for(i=0;i<c.length;i++){var h=[];for(r=0;r<c[i].length;r+=2)h.push(le(c[i][r],c[i][r+1],t,s,n,a));l.geometry.push(h);}}return e.transformed=!0,e}function le(e,t,o,i,r,s){return [Math.round(o*(e*i-r)),Math.round(o*(t*i-s))]}function ce(e,t,o,i,r){for(var s=t===r.maxZoom?0:r.tolerance/((1<<t)*r.extent),n={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:o,y:i,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<e.length;a++){n.numFeatures++,ue(n,e[a],s,r);var l=e[a].minX,c=e[a].minY,u=e[a].maxX,h=e[a].maxY;l<n.minX&&(n.minX=l),c<n.minY&&(n.minY=c),u>n.maxX&&(n.maxX=u),h>n.maxY&&(n.maxY=h);}return n}function ue(e,t,o,i){var r=t.geometry,s=t.type,n=[];if(\"Point\"===s||\"MultiPoint\"===s)for(var a=0;a<r.length;a+=3)n.push(r[a]),n.push(r[a+1]),e.numPoints++,e.numSimplified++;else if(\"LineString\"===s)he(n,r,e,o,!1,!1);else if(\"MultiLineString\"===s||\"Polygon\"===s)for(a=0;a<r.length;a++)he(n,r[a],e,o,\"Polygon\"===s,0===a);else if(\"MultiPolygon\"===s)for(var l=0;l<r.length;l++){var c=r[l];for(a=0;a<c.length;a++)he(n,c[a],e,o,!0,0===a);}if(n.length){var u=t.tags||null;if(\"LineString\"===s&&i.lineMetrics){for(var h in u={},t.tags)u[h]=t.tags[h];u.mapbox_clip_start=r.start/r.size,u.mapbox_clip_end=r.end/r.size;}var d={geometry:n,type:\"Polygon\"===s||\"MultiPolygon\"===s?3:\"LineString\"===s||\"MultiLineString\"===s?2:1,tags:u};null!==t.id&&(d.id=t.id),e.features.push(d);}}function he(e,t,o,i,r,s){var n=i*i;if(i>0&&t.size<(r?n:i))o.numPoints+=t.length/3;else {for(var a=[],l=0;l<t.length;l+=3)(0===i||t[l+2]>n)&&(o.numSimplified++,a.push(t[l]),a.push(t[l+1])),o.numPoints++;r&&function(e,t){for(var o=0,i=0,r=e.length,s=r-2;i<r;s=i,i+=2)o+=(e[i]-e[s])*(e[i+1]+e[s+1]);if(o>0===t)for(i=0,r=e.length;i<r/2;i+=2){var n=e[i],a=e[i+1];e[i]=e[r-2-i],e[i+1]=e[r-1-i],e[r-2-i]=n,e[r-1-i]=a;}}(a,s),e.push(a);}}function de(e,t){var o=(t=this.options=function(e,t){for(var o in t)e[o]=t[o];return e}(Object.create(this.options),t)).debug;if(o&&console.time(\"preprocess data\"),t.maxZoom<0||t.maxZoom>24)throw new Error(\"maxZoom should be in the 0-24 range\");if(t.promoteId&&t.generateId)throw new Error(\"promoteId and generateId cannot be used together.\");var i=function(e,t){var o=[];if(\"FeatureCollection\"===e.type)for(var i=0;i<e.features.length;i++)V(o,e.features[i],t,i);else V(o,\"Feature\"===e.type?e:{geometry:e},t);return o}(e,t);this.tiles={},this.tileCoords=[],o&&(console.timeEnd(\"preprocess data\"),console.log(\"index: maxZoom: %d, maxPoints: %d\",t.indexMaxZoom,t.indexMaxPoints),console.time(\"generate tiles\"),this.stats={},this.total=0),i=function(e,t){var o=t.buffer/t.extent,i=e,r=K(e,1,-1-o,o,0,-1,2,t),s=K(e,1,1-o,2+o,0,-1,2,t);return (r||s)&&(i=K(e,1,-o,1+o,0,-1,2,t)||[],r&&(i=se(r,1).concat(i)),s&&(i=i.concat(se(s,-1)))),i}(i,t),i.length&&this.splitTile(i,0,0,0),o&&(i.length&&console.log(\"features: %d, points: %d\",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd(\"generate tiles\"),console.log(\"tiles generated:\",this.total,JSON.stringify(this.stats)));}function pe(e,t,o){return 32*((1<<e)*o+t)+e}function fe(e,t){return t?e.properties[t]:e.id}function ge(e,t){if(null==e)return !0;if(\"Feature\"===e.type)return null!=fe(e,t);if(\"FeatureCollection\"===e.type){const o=new Set;for(const i of e.features){const e=fe(i,t);if(null==e)return !1;if(o.has(e))return !1;o.add(e);}return !0}return !1}function me(e,t){const o=new Map;if(null==e);else if(\"Feature\"===e.type)o.set(fe(e,t),e);else for(const i of e.features)o.set(fe(i,t),i);return o}function ye(t,o){const i=t.tileID.canonical;if(!this._geoJSONIndex)return o(null,null);const r=this._geoJSONIndex.getTile(i.z,i.x,i.y);if(!r)return o(null,null);const s=new class{constructor(t){this.layers={_geojsonTileLayer:this},this.name=\"_geojsonTileLayer\",this.extent=e.EXTENT,this.length=t.length,this._features=t;}feature(t){return new class{constructor(t){this._feature=t,this.extent=e.EXTENT,this.type=t.type,this.properties=t.tags,\"id\"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10));}loadGeometry(){if(1===this._feature.type){const t=[];for(const o of this._feature.geometry)t.push([new e.Point(o[0],o[1])]);return t}{const t=[];for(const o of this._feature.geometry){const i=[];for(const t of o)i.push(new e.Point(t[0],t[1]));t.push(i);}return t}}toGeoJSON(e,t,o){return h.call(this,e,t,o)}}(this._features[t])}}(r.features);let n=C(s);0===n.byteOffset&&n.byteLength===n.buffer.byteLength||(n=new Uint8Array(n)),o(null,{vectorTile:s,rawData:n.buffer});}de.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},de.prototype.splitTile=function(e,t,o,i,r,s,n){for(var a=[e,t,o,i],l=this.options,c=l.debug;a.length;){i=a.pop(),o=a.pop(),t=a.pop(),e=a.pop();var u=1<<t,h=pe(t,o,i),d=this.tiles[h];if(!d&&(c>1&&console.time(\"creation\"),d=this.tiles[h]=ce(e,t,o,i,l),this.tileCoords.push({z:t,x:o,y:i}),c)){c>1&&(console.log(\"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)\",t,o,i,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd(\"creation\"));var p=\"z\"+t;this.stats[p]=(this.stats[p]||0)+1,this.total++;}if(d.source=e,r){if(t===l.maxZoom||t===r)continue;var f=1<<r-t;if(o!==Math.floor(s/f)||i!==Math.floor(n/f))continue}else if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue;if(d.source=null,0!==e.length){c>1&&console.time(\"clipping\");var g,m,y,v,x,w,S=.5*l.buffer/l.extent,b=.5-S,I=.5+S,M=1+S;g=m=y=v=null,x=K(e,u,o-S,o+I,0,d.minX,d.maxX,l),w=K(e,u,o+b,o+M,0,d.minX,d.maxX,l),e=null,x&&(g=K(x,u,i-S,i+I,1,d.minY,d.maxY,l),m=K(x,u,i+b,i+M,1,d.minY,d.maxY,l),x=null),w&&(y=K(w,u,i-S,i+I,1,d.minY,d.maxY,l),v=K(w,u,i+b,i+M,1,d.minY,d.maxY,l),w=null),c>1&&console.timeEnd(\"clipping\"),a.push(g||[],t+1,2*o,2*i),a.push(m||[],t+1,2*o,2*i+1),a.push(y||[],t+1,2*o+1,2*i),a.push(v||[],t+1,2*o+1,2*i+1);}}},de.prototype.getTile=function(e,t,o){var i=this.options,r=i.extent,s=i.debug;if(e<0||e>24)return null;var n=1<<e,a=pe(e,t=(t%n+n)%n,o);if(this.tiles[a])return ae(this.tiles[a],r);s>1&&console.log(\"drilling down to z%d-%d-%d\",e,t,o);for(var l,c=e,u=t,h=o;!l&&c>0;)c--,u=Math.floor(u/2),h=Math.floor(h/2),l=this.tiles[pe(c,u,h)];return l&&l.source?(s>1&&console.log(\"found parent tile z%d-%d-%d\",c,u,h),s>1&&console.time(\"drilling down\"),this.splitTile(l.source,c,u,h,e,t,o),s>1&&console.timeEnd(\"drilling down\"),this.tiles[a]?ae(this.tiles[a],r):null):null};class ve extends n{constructor(t,o,i,r){super(t,o,i,ye),this._dataUpdateable=new Map,this.loadGeoJSON=(t,o)=>{const{promoteId:i}=t;if(t.request)return e.getJSON(t.request,((e,t,r,s)=>{this._dataUpdateable=ge(t,i)?me(t,i):void 0,o(e,t,r,s);}));if(\"string\"==typeof t.data)try{const e=JSON.parse(t.data);this._dataUpdateable=ge(e,i)?me(e,i):void 0,o(null,e);}catch(e){o(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));}else t.dataDiff?this._dataUpdateable?(function(e,t,o){var i,r,s,n;if(t.removeAll&&e.clear(),t.remove)for(const o of t.remove)e.delete(o);if(t.add)for(const i of t.add){const t=fe(i,o);null!=t&&e.set(t,i);}if(t.update)for(const o of t.update){let t=e.get(o.id);if(null==t)continue;const a=!o.removeAllProperties&&((null===(i=o.removeProperties)||void 0===i?void 0:i.length)>0||(null===(r=o.addOrUpdateProperties)||void 0===r?void 0:r.length)>0);if((o.newGeometry||o.removeAllProperties||a)&&(t={...t},e.set(o.id,t),a&&(t.properties={...t.properties})),o.newGeometry&&(t.geometry=o.newGeometry),o.removeAllProperties)t.properties={};else if((null===(s=o.removeProperties)||void 0===s?void 0:s.length)>0)for(const e of o.removeProperties)Object.prototype.hasOwnProperty.call(t.properties,e)&&delete t.properties[e];if((null===(n=o.addOrUpdateProperties)||void 0===n?void 0:n.length)>0)for(const{key:e,value:i}of o.addOrUpdateProperties)t.properties[e]=i;}}(this._dataUpdateable,t.dataDiff,i),o(null,{type:\"FeatureCollection\",features:Array.from(this._dataUpdateable.values())})):o(new Error(`Cannot update existing geojson data in ${t.source}`)):o(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));return {cancel:()=>{}}},r&&(this.loadGeoJSON=r);}loadData(t,o){var i;null===(i=this._pendingRequest)||void 0===i||i.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const r=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.RequestPerformance(t.request);this._pendingCallback=o,this._pendingRequest=this.loadGeoJSON(t,((i,s)=>{if(delete this._pendingCallback,delete this._pendingRequest,i||!s)return o(i);if(\"object\"!=typeof s)return o(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));{u(s,!0);try{if(t.filter){const o=e.createExpression(t.filter,{type:\"boolean\",\"property-type\":\"data-driven\",overridable:!1,transition:!1});if(\"error\"===o.result)throw new Error(o.value.map((e=>`${e.key}: ${e.message}`)).join(\", \"));const i=s.features.filter((e=>o.value.evaluate({zoom:0},e)));s={type:\"FeatureCollection\",features:i};}this._geoJSONIndex=t.cluster?new z(function({superclusterOptions:t,clusterProperties:o}){if(!o||!t)return t;const i={},r={},s={accumulated:null,zoom:0},n={properties:null},a=Object.keys(o);for(const t of a){const[s,n]=o[t],a=e.createExpression(n),l=e.createExpression(\"string\"==typeof s?[s,[\"accumulated\"],[\"get\",t]]:s);i[t]=a.value,r[t]=l.value;}return t.map=e=>{n.properties=e;const t={};for(const e of a)t[e]=i[e].evaluate(s,n);return t},t.reduce=(e,t)=>{n.properties=t;for(const t of a)s.accumulated=e[t],e[t]=r[t].evaluate(s,n);},t}(t)).load(s.features):function(e,t){return new de(e,t)}(s,t.geojsonVtOptions);}catch(i){return o(i)}this.loaded={};const n={};if(r){const e=r.finish();e&&(n.resourceTiming={},n.resourceTiming[t.source]=JSON.parse(JSON.stringify(e)));}o(null,n);}}));}reloadTile(e,t){const o=this.loaded;return o&&o[e.uid]?super.reloadTile(e,t):this.loadTile(e,t)}removeSource(e,t){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),t();}getClusterExpansionZoom(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId));}catch(e){t(e);}}getClusterChildren(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId));}catch(e){t(e);}}getClusterLeaves(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset));}catch(e){t(e);}}}class xe{constructor(t){this.self=t,this.actor=new e.Actor(t,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:n,geojson:ve},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(e,t)=>{if(this.workerSourceTypes[e])throw new Error(`Worker source with name \"${e}\" already registered.`);this.workerSourceTypes[e]=t;},this.self.registerRTLTextPlugin=t=>{if(e.plugin.isParsed())throw new Error(\"RTL text plugin already registered.\");e.plugin.applyArabicShaping=t.applyArabicShaping,e.plugin.processBidirectionalText=t.processBidirectionalText,e.plugin.processStyledBidirectionalText=t.processStyledBidirectionalText;};}setReferrer(e,t){this.referrer=t;}setImages(e,t,o){this.availableImages[e]=t;for(const o in this.workerSources[e]){const i=this.workerSources[e][o];for(const e in i)i[e].availableImages=t;}o();}setLayers(e,t,o){this.getLayerIndex(e).replace(t),o();}updateLayers(e,t,o){this.getLayerIndex(e).update(t.layers,t.removedIds),o();}loadTile(e,t,o){this.getWorkerSource(e,t.type,t.source).loadTile(t,o);}loadDEMTile(e,t,o){this.getDEMWorkerSource(e,t.source).loadTile(t,o);}reloadTile(e,t,o){this.getWorkerSource(e,t.type,t.source).reloadTile(t,o);}abortTile(e,t,o){this.getWorkerSource(e,t.type,t.source).abortTile(t,o);}removeTile(e,t,o){this.getWorkerSource(e,t.type,t.source).removeTile(t,o);}removeDEMTile(e,t){this.getDEMWorkerSource(e,t.source).removeTile(t);}removeSource(e,t,o){if(!this.workerSources[e]||!this.workerSources[e][t.type]||!this.workerSources[e][t.type][t.source])return;const i=this.workerSources[e][t.type][t.source];delete this.workerSources[e][t.type][t.source],void 0!==i.removeSource?i.removeSource(t,o):o();}loadWorkerSource(e,t,o){try{this.self.importScripts(t.url),o();}catch(e){o(e.toString());}}syncRTLPluginState(t,o,i){try{e.plugin.setState(o);const t=e.plugin.getPluginURL();if(e.plugin.isLoaded()&&!e.plugin.isParsed()&&null!=t){this.self.importScripts(t);const o=e.plugin.isParsed();i(o?void 0:new Error(`RTL Text Plugin failed to import scripts from ${t}`),o);}}catch(e){i(e.toString());}}getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}getLayerIndex(e){let o=this.layerIndexes[e];return o||(o=this.layerIndexes[e]=new t),o}getWorkerSource(e,t,o){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][o]){const i={send:(t,o,i)=>{this.actor.send(t,o,i,e);}};this.workerSources[e][t][o]=new this.workerSourceTypes[t](i,this.getLayerIndex(e),this.getAvailableImages(e));}return this.workerSources[e][t][o]}getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new a),this.demWorkerSources[e][t]}}return e.isWorker()&&(self.worker=new xe(self)),xe}));\n\ndefine([\"./shared\"],(function(t){\"use strict\";var e=\"3.1.0\";class i{static testProp(t){if(!i.docStyle)return t[0];for(let e=0;e<t.length;e++)if(t[e]in i.docStyle)return t[e];return t[0]}static create(t,e,i){const s=window.document.createElement(t);return void 0!==e&&(s.className=e),i&&i.appendChild(s),s}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){i.docStyle&&i.selectProp&&(i.userSelect=i.docStyle[i.selectProp],i.docStyle[i.selectProp]=\"none\");}static enableDrag(){i.docStyle&&i.selectProp&&(i.docStyle[i.selectProp]=i.userSelect);}static setTransform(t,e){t.style[i.transformProp]=e;}static addEventListener(t,e,i,s={}){t.addEventListener(e,i,\"passive\"in s?s:s.capture);}static removeEventListener(t,e,i,s={}){t.removeEventListener(e,i,\"passive\"in s?s:s.capture);}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener(\"click\",i.suppressClickInternal,!0);}static suppressClick(){window.addEventListener(\"click\",i.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener(\"click\",i.suppressClickInternal,!0);}),0);}static mousePos(e,i){const s=e.getBoundingClientRect();return new t.Point(i.clientX-s.left-e.clientLeft,i.clientY-s.top-e.clientTop)}static touchPos(e,i){const s=e.getBoundingClientRect(),a=[];for(let o=0;o<i.length;o++)a.push(new t.Point(i[o].clientX-s.left-e.clientLeft,i[o].clientY-s.top-e.clientTop));return a}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t);}}i.docStyle=\"undefined\"!=typeof window&&window.document&&window.document.documentElement.style,i.selectProp=i.testProp([\"userSelect\",\"MozUserSelect\",\"WebkitUserSelect\",\"msUserSelect\"]),i.transformProp=i.testProp([\"transform\",\"WebkitTransform\"]);const s={supported:!1,testSupport:function(t){!r&&o&&(n?l(t):a=t);}};let a,o,r=!1,n=!1;function l(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,o),t.isContextLost())return;s.supported=!0;}catch(t){}t.deleteTexture(e),r=!0;}var c;\"undefined\"!=typeof document&&(o=document.createElement(\"img\"),o.onload=function(){a&&l(a),a=null,n=!0;},o.onerror=function(){r=!0,a=null;},o.src=\"data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=\"),function(e){let i,a,o,r;e.resetRequestQueue=()=>{i=[],a=0,o=0,r={};},e.addThrottleControl=t=>{const e=o++;return r[e]=t,e},e.removeThrottleControl=t=>{delete r[t],c();},e.getImage=(t,e,o=!0)=>{s.supported&&(t.headers||(t.headers={}),t.headers.accept=\"image/webp,*/*\");const r={requestParameters:t,supportImageRefresh:o,callback:e,cancelled:!1,completed:!1,cancel:()=>{r.completed||r.cancelled||(r.cancelled=!0,r.innerRequest&&(r.innerRequest.cancel(),a--),c());}};return i.push(r),c(),r};const n=e=>{const{requestParameters:i,supportImageRefresh:s,callback:a}=e;return t.extend(i,{type:\"image\"}),(!1!==s||t.isWorker()||t.getProtocolAction(i.url)||i.headers&&!Object.keys(i.headers).reduce(((t,e)=>t&&\"accept\"===e),!0)?t.makeRequest:h)(i,((t,i,s,o)=>{l(e,a,t,i,s,o);}))},l=(e,i,s,o,r,n)=>{s?i(s):o instanceof HTMLImageElement||o instanceof ImageBitmap?i(null,o):o&&((e,i)=>{\"function\"==typeof createImageBitmap?t.arrayBufferToImageBitmap(e,i):t.arrayBufferToImage(e,i);})(o,((t,e)=>{null!=t?i(t):null!=e&&i(null,e,{cacheControl:r,expires:n});})),e.cancelled||(e.completed=!0,a--,c());},c=()=>{const e=(()=>{const t=Object.keys(r);let e=!1;if(t.length>0)for(const i of t)if(e=r[i](),e)break;return e})()?t.config.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.config.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=a;t<e&&i.length>0;t++){const e=i.shift();if(e.cancelled){t--;continue}const s=n(e);a++,e.innerRequest=s;}},h=(e,i)=>{const s=new Image,a=e.url;let o=!1;const r=e.credentials;return r&&\"include\"===r?s.crossOrigin=\"use-credentials\":(r&&\"same-origin\"===r||!t.sameOrigin(a))&&(s.crossOrigin=\"anonymous\"),s.fetchPriority=\"high\",s.onload=()=>{i(null,s),s.onerror=s.onload=null;},s.onerror=()=>{o||i(new Error(\"Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.\")),s.onerror=s.onload=null;},s.src=a,{cancel:()=>{o=!0,s.src=\"\";}}};}(c||(c={})),c.resetRequestQueue();var h,u=c;!function(t){t.Glyphs=\"Glyphs\",t.Image=\"Image\",t.Source=\"Source\",t.SpriteImage=\"SpriteImage\",t.SpriteJSON=\"SpriteJSON\",t.Style=\"Style\",t.Tile=\"Tile\",t.Unknown=\"Unknown\";}(h||(h={}));class d{constructor(t){this._transformRequestFn=t;}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeSpriteURL(t,e,i){const s=function(t){const e=t.match(_);if(!e)throw new Error(`Unable to parse URL \"${t}\"`);return {protocol:e[1],authority:e[2],path:e[3]||\"/\",params:e[4]?e[4].split(\"&\"):[]}}(t);return s.path+=`${e}${i}`,function(t){const e=t.params.length?`?${t.params.join(\"&\")}`:\"\";return `${t.protocol}://${t.authority}${t.path}${e}`}(s)}setTransformRequest(t){this._transformRequestFn=t;}}const _=/^(\\w+):\\/\\/([^/?]*)(\\/[^?]+)?\\??(.+)?/;function m(e){var i=new t.ARRAY_TYPE(3);return i[0]=e[0],i[1]=e[1],i[2]=e[2],i}var p,f=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t};p=new t.ARRAY_TYPE(3),t.ARRAY_TYPE!=Float32Array&&(p[0]=0,p[1]=0,p[2]=0);var g=function(t){var e=t[0],i=t[1];return e*e+i*i};function v(t){const e=[];if(\"string\"==typeof t)e.push({id:\"default\",url:t});else if(t&&t.length>0){const i=[];for(const{id:s,url:a}of t){const t=`${s}${a}`;-1===i.indexOf(t)&&(i.push(t),e.push({id:s,url:a}));}}return e}function x(e,i,s,a,o){if(a)return void e(a);if(o!==Object.values(i).length||o!==Object.values(s).length)return;const r={};for(const e in i){r[e]={};const a=t.exported.getImageCanvasContext(s[e]),o=i[e];for(const t in o){const{width:i,height:s,x:n,y:l,sdf:c,pixelRatio:h,stretchX:u,stretchY:d,content:_}=o[t];r[e][t]={data:null,pixelRatio:h,sdf:c,stretchX:u,stretchY:d,content:_,spriteData:{width:i,height:s,x:n,y:l,context:a}};}}e(null,r);}!function(){var e=new t.ARRAY_TYPE(2);t.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0);}();class y{constructor(t,e,i,s){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this.update(e,s);}update(e,i,s){const{width:a,height:o}=e,r=!(this.size&&this.size[0]===a&&this.size[1]===o||s),{context:n}=this,{gl:l}=n;if(this.useMipmap=Boolean(i&&i.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),n.pixelStoreUnpackFlipY.set(!1),n.pixelStoreUnpack.set(1),n.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!i||!1!==i.premultiply)),r)this.size=[a,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.isImageBitmap(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,a,o,0,this.format,l.UNSIGNED_BYTE,e.data);else {const{x:i,y:r}=s||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.isImageBitmap(e)?l.texSubImage2D(l.TEXTURE_2D,0,i,r,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,i,r,a,o,l.RGBA,l.UNSIGNED_BYTE,e.data);}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D);}bind(t,e,i){const{context:s}=this,{gl:a}=s;a.bindTexture(a.TEXTURE_2D,this.texture),i!==a.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=a.LINEAR),t!==this.filter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,t),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,i||t),this.filter=t),e!==this.wrap&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,e),this.wrap=e);}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null;}}function b(t){const{userImage:e}=t;return !!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class w extends t.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0;}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,callback:e}of this.requestors)this._notify(t,e);this.requestors=[];}}getImage(e){const i=this.images[e];if(i&&!i.data&&i.spriteData){const e=i.spriteData;i.data=new t.RGBAImage({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),i.spriteData=null;}return i}addImage(t,e){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,e)&&(this.images[t]=e);}_validate(e,i){let s=!0;const a=i.data||i.spriteData;return this._validateStretch(i.stretchX,a&&a.width)||(this.fire(new t.ErrorEvent(new Error(`Image \"${e}\" has invalid \"stretchX\" value`))),s=!1),this._validateStretch(i.stretchY,a&&a.height)||(this.fire(new t.ErrorEvent(new Error(`Image \"${e}\" has invalid \"stretchY\" value`))),s=!1),this._validateContent(i.content,i)||(this.fire(new t.ErrorEvent(new Error(`Image \"${e}\" has invalid \"content\" value`))),s=!1),s}_validateStretch(t,e){if(!t)return !0;let i=0;for(const s of t){if(s[0]<i||s[1]<s[0]||e<s[1])return !1;i=s[1];}return !0}_validateContent(t,e){if(!t)return !0;if(4!==t.length)return !1;const i=e.spriteData,s=i&&i.width||e.data.width,a=i&&i.height||e.data.height;return !(t[0]<0||s<t[0]||t[1]<0||a<t[1]||t[2]<0||s<t[2]||t[3]<0||a<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,e,i=!0){const s=this.getImage(t);if(i&&(s.data.width!==e.data.width||s.data.height!==e.data.height))throw new Error(`size mismatch between old image (${s.data.width}x${s.data.height}) and new image (${e.data.width}x${e.data.height}).`);e.version=s.version+1,this.images[t]=e,this.updatedImages[t]=!0;}removeImage(t){const e=this.images[t];delete this.images[t],delete this.patterns[t],e.userImage&&e.userImage.onRemove&&e.userImage.onRemove();}listImages(){return Object.keys(this.images)}getImages(t,e){let i=!0;if(!this.isLoaded())for(const e of t)this.images[e]||(i=!1);this.isLoaded()||i?this._notify(t,e):this.requestors.push({ids:t,callback:e});}_notify(e,i){const s={};for(const i of e){let e=this.getImage(i);e||(this.fire(new t.Event(\"styleimagemissing\",{id:i})),e=this.getImage(i)),e?s[i]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,hasRenderCallback:Boolean(e.userImage&&e.userImage.render)}:t.warnOnce(`Image \"${i}\" could not be loaded. Please make sure you have added the image with map.addImage() or a \"sprite\" property in your style. You can provide missing images by listening for the \"styleimagemissing\" map event.`);}i(null,s);}getPixelSize(){const{width:t,height:e}=this.atlasImage;return {width:t,height:e}}getPattern(e){const i=this.patterns[e],s=this.getImage(e);if(!s)return null;if(i&&i.position.version===s.version)return i.position;if(i)i.position.version=s.version;else {const i={w:s.data.width+2,h:s.data.height+2,x:0,y:0},a=new t.ImagePosition(i,s);this.patterns[e]={bin:i,position:a};}return this._updatePatternAtlas(),this.patterns[e].position}bind(t){const e=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new y(t,this.atlasImage,e.RGBA),this.atlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE);}_updatePatternAtlas(){const e=[];for(const t in this.patterns)e.push(this.patterns[t].bin);const{w:i,h:s}=t.potpack(e),a=this.atlasImage;a.resize({width:i||1,height:s||1});for(const e in this.patterns){const{bin:i}=this.patterns[e],s=i.x+1,o=i.y+1,r=this.getImage(e).data,n=r.width,l=r.height;t.RGBAImage.copy(r,a,{x:0,y:0},{x:s,y:o},{width:n,height:l}),t.RGBAImage.copy(r,a,{x:0,y:l-1},{x:s,y:o-1},{width:n,height:1}),t.RGBAImage.copy(r,a,{x:0,y:0},{x:s,y:o+l},{width:n,height:1}),t.RGBAImage.copy(r,a,{x:n-1,y:0},{x:s-1,y:o},{width:1,height:l}),t.RGBAImage.copy(r,a,{x:0,y:0},{x:s+n,y:o},{width:1,height:l});}this.dirty=!0;}beginFrame(){this.callbackDispatchedThisFrame={};}dispatchRenderCallbacks(e){for(const i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const e=this.getImage(i);e||t.warnOnce(`Image with ID: \"${i}\" was not found`),b(e)&&this.updateImage(i,e);}}}const T=1e20;function E(t,e,i,s,a,o,r,n,l){for(let c=e;c<e+s;c++)I(t,i*o+c,o,a,r,n,l);for(let c=i;c<i+a;c++)I(t,c*o+e,1,s,r,n,l);}function I(t,e,i,s,a,o,r){o[0]=0,r[0]=-T,r[1]=T,a[0]=t[e];for(let n=1,l=0,c=0;n<s;n++){a[n]=t[e+n*i];const s=n*n;do{const t=o[l];c=(a[n]-a[t]+s-t*t)/(n-t)/2;}while(c<=r[l]&&--l>-1);l++,o[l]=n,r[l]=c,r[l+1]=T;}for(let n=0,l=0;n<s;n++){for(;r[l+1]<n;)l++;const s=o[l],c=n-s;t[e+n*i]=a[s]+c*c;}}class S{constructor(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={};}setURL(t){this.url=t;}getGlyphs(e,i){const s=[];for(const t in e)for(const i of e[t])s.push({stack:t,id:i});t.asyncAll(s,(({stack:t,id:e},i)=>{let s=this.entries[t];s||(s=this.entries[t]={glyphs:{},requests:{},ranges:{}});let a=s.glyphs[e];if(void 0!==a)return void i(null,{stack:t,id:e,glyph:a});if(a=this._tinySDF(s,t,e),a)return s.glyphs[e]=a,void i(null,{stack:t,id:e,glyph:a});const o=Math.floor(e/256);if(256*o>65535)return void i(new Error(\"glyphs > 65535 not supported\"));if(s.ranges[o])return void i(null,{stack:t,id:e,glyph:a});if(!this.url)return void i(new Error(\"glyphsUrl is not set\"));let r=s.requests[o];r||(r=s.requests[o]=[],S.loadGlyphRange(t,o,this.url,this.requestManager,((t,e)=>{if(e){for(const t in e)this._doesCharSupportLocalGlyph(+t)||(s.glyphs[+t]=e[+t]);s.ranges[o]=!0;}for(const i of r)i(t,e);delete s.requests[o];}))),r.push(((s,a)=>{s?i(s):a&&i(null,{stack:t,id:e,glyph:a[e]||null});}));}),((t,e)=>{if(t)i(t);else if(e){const t={};for(const{stack:i,id:s,glyph:a}of e)(t[i]||(t[i]={}))[s]=a&&{id:a.id,bitmap:a.bitmap.clone(),metrics:a.metrics};i(null,t);}}));}_doesCharSupportLocalGlyph(e){return !!this.localIdeographFontFamily&&(t.unicodeBlockLookup[\"CJK Unified Ideographs\"](e)||t.unicodeBlockLookup[\"Hangul Syllables\"](e)||t.unicodeBlockLookup.Hiragana(e)||t.unicodeBlockLookup.Katakana(e))}_tinySDF(e,i,s){const a=this.localIdeographFontFamily;if(!a)return;if(!this._doesCharSupportLocalGlyph(s))return;let o=e.tinySDF;if(!o){let t=\"400\";/bold/i.test(i)?t=\"900\":/medium/i.test(i)?t=\"500\":/light/i.test(i)&&(t=\"200\"),o=e.tinySDF=new S.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:a,fontWeight:t});}const r=o.draw(String.fromCharCode(s));return {id:s,bitmap:new t.AlphaImage({width:r.width||30,height:r.height||30},r.data),metrics:{width:r.glyphWidth||24,height:r.glyphHeight||24,left:r.glyphLeft||0,top:r.glyphTop-27||-8,advance:r.glyphAdvance||24}}}}S.loadGlyphRange=function(e,i,s,a,o){const r=256*i,n=r+255,l=a.transformRequest(s.replace(\"{fontstack}\",e).replace(\"{range}\",`${r}-${n}`),h.Glyphs);t.getArrayBuffer(l,((e,i)=>{if(e)o(e);else if(i){const e={};for(const s of t.parseGlyphPbf(i))e[s.id]=s;o(null,e);}}));},S.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:s=.25,fontFamily:a=\"sans-serif\",fontWeight:o=\"normal\",fontStyle:r=\"normal\"}={}){this.buffer=e,this.cutoff=s,this.radius=i;const n=this.size=t+4*e,l=this._createCanvas(n),c=this.ctx=l.getContext(\"2d\",{willReadFrequently:!0});c.font=`${r} ${o} ${t}px ${a}`,c.textBaseline=\"alphabetic\",c.textAlign=\"left\",c.fillStyle=\"black\",this.gridOuter=new Float64Array(n*n),this.gridInner=new Float64Array(n*n),this.f=new Float64Array(n),this.z=new Float64Array(n+1),this.v=new Uint16Array(n);}_createCanvas(t){const e=document.createElement(\"canvas\");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:s,actualBoundingBoxLeft:a,actualBoundingBoxRight:o}=this.ctx.measureText(t),r=Math.ceil(i),n=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-a))),l=Math.min(this.size-this.buffer,r+Math.ceil(s)),c=n+2*this.buffer,h=l+2*this.buffer,u=Math.max(c*h,0),d=new Uint8ClampedArray(u),_={data:d,width:c,height:h,glyphWidth:n,glyphHeight:l,glyphTop:r,glyphLeft:0,glyphAdvance:e};if(0===n||0===l)return _;const{ctx:m,buffer:p,gridInner:f,gridOuter:g}=this;m.clearRect(p,p,n,l),m.fillText(t,p,p+r);const v=m.getImageData(p,p,n,l);g.fill(T,0,u),f.fill(0,0,u);for(let t=0;t<l;t++)for(let e=0;e<n;e++){const i=v.data[4*(t*n+e)+3]/255;if(0===i)continue;const s=(t+p)*c+e+p;if(1===i)g[s]=0,f[s]=T;else {const t=.5-i;g[s]=t>0?t*t:0,f[s]=t<0?t*t:0;}}E(g,0,0,c,h,c,this.f,this.v,this.z),E(f,p,p,n,l,c,this.f,this.v,this.z);for(let t=0;t<u;t++){const e=Math.sqrt(g[t])-Math.sqrt(f[t]);d[t]=Math.round(255-255*(e/this.radius+this.cutoff));}return _}};class C{constructor(){this.specification=t.v8Spec.light.position;}possiblyEvaluate(e,i){return t.sphericalToCartesian(e.expression.evaluate(i))}interpolate(e,i,s){return {x:t.interpolate.number(e.x,i.x,s),y:t.interpolate.number(e.y,i.y,s),z:t.interpolate.number(e.z,i.z,s)}}}let P,D;class z extends t.Evented{constructor(e){super(),P=P||new t.Properties({anchor:new t.DataConstantProperty(t.v8Spec.light.anchor),position:new C,color:new t.DataConstantProperty(t.v8Spec.light.color),intensity:new t.DataConstantProperty(t.v8Spec.light.intensity)}),this._transitionable=new t.Transitionable(P),this.setLight(e),this._transitioning=this._transitionable.untransitioned();}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(t.validateLight,e,i))for(const t in e){const i=e[t];t.endsWith(\"-transition\")?this._transitionable.setTransition(t.slice(0,-11),i):this._transitionable.setValue(t,i);}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning);}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t);}_validate(e,i,s){return (!s||!1!==s.validate)&&t.emitValidationErrors(this,e.call(t.validateStyle,t.extend({value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.v8Spec})))}}class M{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={};}getDash(t,e){const i=t.join(\",\")+String(e);return this.dashEntry[i]||(this.dashEntry[i]=this.addDash(t,e)),this.dashEntry[i]}getDashRanges(t,e,i){const s=[];let a=t.length%2==1?-t[t.length-1]*i:0,o=t[0]*i,r=!0;s.push({left:a,right:o,isDash:r,zeroLength:0===t[0]});let n=t[0];for(let e=1;e<t.length;e++){r=!r;const l=t[e];a=n*i,n+=l,o=n*i,s.push({left:a,right:o,isDash:r,zeroLength:0===l});}return s}addRoundDash(t,e,i){const s=e/2;for(let e=-i;e<=i;e++){const a=this.width*(this.nextRow+i+e);let o=0,r=t[o];for(let n=0;n<this.width;n++){n/r.right>1&&(r=t[++o]);const l=Math.abs(n-r.left),c=Math.abs(n-r.right),h=Math.min(l,c);let u;const d=e/i*(s+1);if(r.isDash){const t=s-Math.abs(d);u=Math.sqrt(h*h+t*t);}else u=s-Math.sqrt(h*h+d*d);this.data[a+n]=Math.max(0,Math.min(255,u+128));}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const i=t[e],s=t[e+1];i.zeroLength?t.splice(e,1):s&&s.isDash===i.isDash&&(s.left=i.left,t.splice(e,1));}const e=t[0],i=t[t.length-1];e.isDash===i.isDash&&(e.left=i.left-this.width,i.right=e.right+this.width);const s=this.width*this.nextRow;let a=0,o=t[a];for(let e=0;e<this.width;e++){e/o.right>1&&(o=t[++a]);const i=Math.abs(e-o.left),r=Math.abs(e-o.right),n=Math.min(i,r);this.data[s+e]=Math.max(0,Math.min(255,(o.isDash?n:-n)+128));}}addDash(e,i){const s=i?7:0,a=2*s+1;if(this.nextRow+a>this.height)return t.warnOnce(\"LineAtlas out of space\"),null;let o=0;for(let t=0;t<e.length;t++)o+=e[t];if(0!==o){const t=this.width/o,a=this.getDashRanges(e,this.width,t);i?this.addRoundDash(a,t,s):this.addRegularDash(a);}const r={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:o};return this.nextRow+=a,this.dirty=!0,r}bind(t){const e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data));}}class A{constructor(t,e,i){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=i;const s=this.workerPool.acquire(i);for(let t=0;t<s.length;t++){const a=new A.Actor(s[t],e,i);a.name=`Worker ${t}`,this.actors.push(a);}if(!this.actors.length)throw new Error(\"No actors found\")}broadcast(e,i,s){t.asyncAll(this.actors,((t,s)=>{t.send(e,i,s);}),s=s||function(){});}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach((t=>{t.remove();})),this.actors=[],t&&this.workerPool.release(this.id);}}function L(e,i,s){const a=function(i,a){if(i)return s(i);if(a){const i=t.pick(t.extend(a,e),[\"tiles\",\"minzoom\",\"maxzoom\",\"attribution\",\"bounds\",\"scheme\",\"tileSize\",\"encoding\"]);a.vector_layers&&(i.vectorLayers=a.vector_layers,i.vectorLayerIds=i.vectorLayers.map((t=>t.id))),s(null,i);}};return e.url?t.getJSON(i.transformRequest(e.url,h.Source),a):t.exported.frame((()=>a(null,e)))}A.Actor=t.Actor;class R{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])));}setNorthEast(e){return this._ne=e instanceof t.LngLat?new t.LngLat(e.lng,e.lat):t.LngLat.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.LngLat?new t.LngLat(e.lng,e.lat):t.LngLat.convert(e),this}extend(e){const i=this._sw,s=this._ne;let a,o;if(e instanceof t.LngLat)a=e,o=e;else {if(!(e instanceof R))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(R.convert(e)):this.extend(t.LngLat.convert(e)):e&&(\"lng\"in e||\"lon\"in e)&&\"lat\"in e?this.extend(t.LngLat.convert(e)):this;if(a=e._sw,o=e._ne,!a||!o)return this}return i||s?(i.lng=Math.min(a.lng,i.lng),i.lat=Math.min(a.lat,i.lat),s.lng=Math.max(o.lng,s.lng),s.lat=Math.max(o.lat,s.lat)):(this._sw=new t.LngLat(a.lng,a.lat),this._ne=new t.LngLat(o.lng,o.lat)),this}getCenter(){return new t.LngLat((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new t.LngLat(this.getWest(),this.getNorth())}getSouthEast(){return new t.LngLat(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return [this._sw.toArray(),this._ne.toArray()]}toString(){return `LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return !(this._sw&&this._ne)}contains(e){const{lng:i,lat:s}=t.LngLat.convert(e);let a=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&a}static convert(t){return t instanceof R?t:t?new R(t):t}static fromLngLat(e,i=0){const s=360*i/40075017,a=s/Math.cos(Math.PI/180*e.lat);return new R(new t.LngLat(e.lng-a,e.lat-s),new t.LngLat(e.lng+a,e.lat+s))}}class k{constructor(t,e,i){this.bounds=R.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=i||24;}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),s=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*i),a=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*i),o=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*i),r=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*i);return e.x>=s&&e.x<o&&e.y>=a&&e.y<r}}class B extends t.Evented{constructor(e,i,s,a){if(super(),this.id=e,this.dispatcher=s,this.type=\"vector\",this.minzoom=0,this.maxzoom=22,this.scheme=\"xyz\",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.extend(this,t.pick(i,[\"url\",\"scheme\",\"tileSize\",\"promoteId\"])),this._options=t.extend({type:\"vector\"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error(\"vector tile sources must have a tileSize of 512\");this.setEventedParent(a);}load(){this._loaded=!1,this.fire(new t.Event(\"dataloading\",{dataType:\"source\"})),this._tileJSONRequest=L(this._options,this.map._requestManager,((e,i)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new k(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event(\"data\",{dataType:\"source\",sourceDataType:\"metadata\"})),this.fire(new t.Event(\"data\",{dataType:\"source\",sourceDataType:\"content\"})));}));}loaded(){return this._loaded}hasTile(t){return !this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load();}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load();}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t;})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t;})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null);}serialize(){return t.extend({},this._options)}loadTile(t,e){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s={request:this.map._requestManager.transformRequest(i,h.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function a(i,s){return delete t.request,t.aborted?e(null):i&&404!==i.status?e(i):(s&&s.resourceTiming&&(t.resourceTiming=s.resourceTiming),this.map._refreshExpiredTiles&&s&&t.setExpiryData(s),t.loadVectorData(s,this.map.painter),e(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}s.request.collectResourceTiming=this._collectResourceTiming,t.actor&&\"expired\"!==t.state?\"loading\"===t.state?t.reloadCallback=e:t.request=t.actor.send(\"reloadTile\",s,a.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send(\"loadTile\",s,a.bind(this)));}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send(\"abortTile\",{uid:t.uid,type:this.type,source:this.id},void 0);}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send(\"removeTile\",{uid:t.uid,type:this.type,source:this.id},void 0);}hasTransition(){return !1}}class F extends t.Evented{constructor(e,i,s,a){super(),this.id=e,this.dispatcher=s,this.setEventedParent(a),this.type=\"raster\",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme=\"xyz\",this.tileSize=512,this._loaded=!1,this._options=t.extend({type:\"raster\"},i),t.extend(this,t.pick(i,[\"url\",\"scheme\",\"tileSize\"]));}load(){this._loaded=!1,this.fire(new t.Event(\"dataloading\",{dataType:\"source\"})),this._tileJSONRequest=L(this._options,this.map._requestManager,((e,i)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(t.extend(this,i),i.bounds&&(this.tileBounds=new k(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.Event(\"data\",{dataType:\"source\",sourceDataType:\"metadata\"})),this.fire(new t.Event(\"data\",{dataType:\"source\",sourceDataType:\"content\"})));}));}loaded(){return this._loaded}onAdd(t){this.map=t,this.load();}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null);}serialize(){return t.extend({},this._options)}hasTile(t){return !this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,e){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=u.getImage(this.map._requestManager.transformRequest(i,h.Tile),((i,s,a)=>{if(delete t.request,t.aborted)t.state=\"unloaded\",e(null);else if(i)t.state=\"errored\",e(i);else if(s){this.map._refreshExpiredTiles&&a&&t.setExpiryData(a);const i=this.map.painter.context,o=i.gl;t.texture=this.map.painter.getTileTexture(s.width),t.texture?t.texture.update(s,{useMipmap:!0}):(t.texture=new y(i,s,o.RGBA,{useMipmap:!0}),t.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),i.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,i.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,i.extTextureFilterAnisotropicMax)),t.state=\"loaded\",e(null);}}),this.map._refreshExpiredTiles);}abortTile(t,e){t.request&&(t.request.cancel(),delete t.request),e();}unloadTile(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e();}hasTransition(){return !1}}class U extends F{constructor(e,i,s,a){super(e,i,s,a),this.type=\"raster-dem\",this.maxzoom=22,this._options=t.extend({type:\"raster-dem\"},i),this.encoding=i.encoding||\"mapbox\";}serialize(){return {type:\"raster-dem\",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(e,i){const s=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function a(t,s){t&&(e.state=\"errored\",i(t)),s&&(e.dem=s,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state=\"loaded\",i(null));}e.request=u.getImage(this.map._requestManager.transformRequest(s,h.Tile),function(s,o){if(delete e.request,e.aborted)e.state=\"unloaded\",i(null);else if(s)e.state=\"errored\",i(s);else if(o){this.map._refreshExpiredTiles&&e.setExpiryData(o),delete o.cacheControl,delete o.expires;const i=t.isImageBitmap(o)&&(null==D&&(D=\"undefined\"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext(\"2d\")&&\"function\"==typeof createImageBitmap),D)?o:t.exported.getImageData(o,1),s={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:i,encoding:this.encoding};e.actor&&\"expired\"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send(\"loadDEMTile\",s,a.bind(this)));}}.bind(this),this.map._refreshExpiredTiles),e.neighboringTiles=this._getNeighboringTiles(e.tileID);}_getNeighboringTiles(e){const i=e.canonical,s=Math.pow(2,i.z),a=(i.x-1+s)%s,o=0===i.x?e.wrap-1:e.wrap,r=(i.x+1+s)%s,n=i.x+1===s?e.wrap+1:e.wrap,l={};return l[new t.OverscaledTileID(e.overscaledZ,o,i.z,a,i.y).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,n,i.z,r,i.y).key]={backfilled:!1},i.y>0&&(l[new t.OverscaledTileID(e.overscaledZ,o,i.z,a,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,n,i.z,r,i.y-1).key]={backfilled:!1}),i.y+1<s&&(l[new t.OverscaledTileID(e.overscaledZ,o,i.z,a,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,n,i.z,r,i.y+1).key]={backfilled:!1}),l}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state=\"unloaded\",t.actor&&t.actor.send(\"removeDEMTile\",{uid:t.uid,source:this.id});}}class O extends t.Evented{constructor(e,i,s,a){super(),this.id=e,this.type=\"geojson\",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(a),this._data=i.data,this._options=t.extend({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId;const o=t.EXTENT/this.tileSize;this.workerOptions=t.extend({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:(void 0!==i.buffer?i.buffer:128)*o,tolerance:(void 0!==i.tolerance?i.tolerance:.375)*o,extent:t.EXTENT,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:void 0!==i.clusterMaxZoom?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:t.EXTENT,radius:(i.clusterRadius||50)*o,log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),\"string\"==typeof this.promoteId&&(this.workerOptions.promoteId=this.promoteId);}load(){this._updateWorkerData();}onAdd(t){this.map=t,this.load();}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(void 0!==t.clusterRadius&&(this.workerOptions.superclusterOptions.radius=t.clusterRadius),void 0!==t.clusterMaxZoom&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t,e){return this.actor.send(\"geojson.getClusterExpansionZoom\",{clusterId:t,source:this.id},e),this}getClusterChildren(t,e){return this.actor.send(\"geojson.getClusterChildren\",{clusterId:t,source:this.id},e),this}getClusterLeaves(t,e,i,s){return this.actor.send(\"geojson.getClusterLeaves\",{source:this.id,clusterId:t,limit:e,offset:i},s),this}_updateWorkerData(e){const i=t.extend({},this.workerOptions);e?i.dataDiff=e:\"string\"==typeof this._data?(i.request=this.map._requestManager.transformRequest(t.exported.resolveURL(this._data),h.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new t.Event(\"dataloading\",{dataType:\"source\"})),this.actor.send(`${this.type}.loadData`,i,((e,i)=>{if(this._pendingLoads--,this._removed||i&&i.abandoned)return void this.fire(new t.Event(\"dataabort\",{dataType:\"source\"}));let s=null;if(i&&i.resourceTiming&&i.resourceTiming[this.id]&&(s=i.resourceTiming[this.id].slice(0)),e)return void this.fire(new t.ErrorEvent(e));const a={dataType:\"source\"};this._collectResourceTiming&&s&&s.length>0&&t.extend(a,{resourceTiming:s}),this.fire(new t.Event(\"data\",{...a,sourceDataType:\"metadata\"})),this.fire(new t.Event(\"data\",{...a,sourceDataType:\"content\"}));}));}loaded(){return 0===this._pendingLoads}loadTile(t,e){const i=t.actor?\"reloadTile\":\"loadTile\";t.actor=this.actor;const s={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(i,s,((s,a)=>(delete t.request,t.unloadVectorData(),t.aborted?e(null):s?e(s):(t.loadVectorData(a,this.map.painter,\"reloadTile\"===i),e(null)))));}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0;}unloadTile(t){t.unloadVectorData(),this.actor.send(\"removeTile\",{uid:t.uid,type:this.type,source:this.id});}onRemove(){this._removed=!0,this.actor.send(\"removeSource\",{type:this.type,source:this.id});}serialize(){return t.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return !1}}var N=t.createLayout([{name:\"a_pos\",type:\"Int16\",components:2},{name:\"a_texture_pos\",type:\"Int16\",components:2}]);class G extends t.Evented{constructor(t,e,i,s){super(),this.id=t,this.dispatcher=i,this.coordinates=e.coordinates,this.type=\"image\",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(s),this.options=e;}load(e,i){this._loaded=!1,this.fire(new t.Event(\"dataloading\",{dataType:\"source\"})),this.url=this.options.url,this._request=u.getImage(this.map._requestManager.transformRequest(this.url,h.Image),((s,a)=>{this._request=null,this._loaded=!0,s?this.fire(new t.ErrorEvent(s)):a&&(this.image=a,e&&(this.coordinates=e),i&&i(),this._finishLoading());}));}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,(()=>{this.texture=null;})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event(\"data\",{dataType:\"source\",sourceDataType:\"metadata\"})));}onAdd(t){this.map=t,this.load();}onRemove(){this._request&&(this._request.cancel(),this._request=null);}setCoordinates(e){this.coordinates=e;const i=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){let i=1/0,s=1/0,a=-1/0,o=-1/0;for(const t of e)i=Math.min(i,t.x),s=Math.min(s,t.y),a=Math.max(a,t.x),o=Math.max(o,t.y);const r=Math.max(a-i,o-s),n=Math.max(0,Math.floor(-Math.log(r)/Math.LN2)),l=Math.pow(2,n);return new t.CanonicalTileID(n,Math.floor((i+a)/2*l),Math.floor((s+o)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z;const s=i.map((t=>this.tileID.getTilePoint(t)._round()));return this._boundsArray=new t.RasterBoundsArray,this._boundsArray.emplaceBack(s[0].x,s[0].y,0,0),this._boundsArray.emplaceBack(s[1].x,s[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(s[3].x,s[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(s[2].x,s[2].y,t.EXTENT,t.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.Event(\"data\",{dataType:\"source\",sourceDataType:\"content\"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const e=this.map.painter.context,i=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,N.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new y(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let s=!1;for(const t in this.tiles){const e=this.tiles[t];\"loaded\"!==e.state&&(e.state=\"loaded\",e.texture=this.texture,s=!0);}s&&this.fire(new t.Event(\"data\",{dataType:\"source\",sourceDataType:\"idle\",sourceId:this.id}));}loadTile(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state=\"errored\",e(null));}serialize(){return {type:\"image\",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return !1}}class Z extends G{constructor(t,e,i,s){super(t,e,i,s),this.roundZoom=!0,this.type=\"video\",this.options=e;}load(){this._loaded=!1;const e=this.options;this.urls=[];for(const t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,h.Source).url);t.getVideo(this.urls,((e,i)=>{this._loaded=!0,e?this.fire(new t.ErrorEvent(e)):i&&(this.video=i,this.video.loop=!0,this.video.addEventListener(\"playing\",(()=>{this.map.triggerRepaint();})),this.map&&this.video.play(),this._finishLoading());}));}pause(){this.video&&this.video.pause();}play(){this.video&&this.video.play();}seek(e){if(this.video){const i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e;}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)));}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,N.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new y(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let s=!1;for(const t in this.tiles){const e=this.tiles[t];\"loaded\"!==e.state&&(e.state=\"loaded\",e.texture=this.texture,s=!0);}s&&this.fire(new t.Event(\"data\",{dataType:\"source\",sourceDataType:\"idle\",sourceId:this.id}));}serialize(){return {type:\"video\",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class V extends G{constructor(e,i,s,a){super(e,i,s,a),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((t=>!Array.isArray(t)||2!==t.length||t.some((t=>\"number\"!=typeof t))))||this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'\"coordinates\" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'missing required property \"coordinates\"'))),i.animate&&\"boolean\"!=typeof i.animate&&this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'optional \"animate\" property must be a boolean value'))),i.canvas?\"string\"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'\"canvas\" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError(`sources.${e}`,null,'missing required property \"canvas\"'))),this.options=i,this.animate=void 0===i.animate||i.animate;}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(new Error(\"Canvas dimensions cannot be less than or equal to zero.\"))):(this.play=function(){this._playing=!0,this.map.triggerRepaint();},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1);},this._finishLoading());}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play();}onRemove(){this.pause();}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context,s=i.gl;this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,N.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new y(i,this.canvas,s.RGBA,{premultiply:!0});let a=!1;for(const t in this.tiles){const e=this.tiles[t];\"loaded\"!==e.state&&(e.state=\"loaded\",e.texture=this.texture,a=!0);}a&&this.fire(new t.Event(\"data\",{dataType:\"source\",sourceDataType:\"idle\",sourceId:this.id}));}serialize(){return {type:\"canvas\",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of [this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return !0;return !1}}const q={vector:B,raster:F,\"raster-dem\":U,geojson:O,video:Z,image:G,canvas:V};function j(e,i){const s=t.create();return t.translate(s,s,[1,1,0]),t.scale(s,s,[.5*e.width,.5*e.height,1]),t.multiply(s,s,e.calculatePosMatrix(i.toUnwrapped()))}function $(t,e,i,s,a,o){const r=function(t,e,i){if(t)for(const s of t){const t=e[s];if(t&&t.source===i&&\"fill-extrusion\"===t.type)return !0}else for(const t in e){const s=e[t];if(s.source===i&&\"fill-extrusion\"===s.type)return !0}return !1}(a&&a.layers,e,t.id),n=o.maxPitchScaleFactor(),l=t.tilesIn(s,n,r);l.sort(X);const c=[];for(const s of l)c.push({wrappedTileID:s.tileID.wrapped().key,queryResults:s.tile.queryRenderedFeatures(e,i,t._state,s.queryGeometry,s.cameraQueryGeometry,s.scale,a,o,n,j(t.transform,s.tileID))});const h=function(t){const e={},i={};for(const s of t){const t=s.queryResults,a=s.wrappedTileID,o=i[a]=i[a]||{};for(const i in t){const s=t[i],a=o[i]=o[i]||{},r=e[i]=e[i]||[];for(const t of s)a[t.featureIndex]||(a[t.featureIndex]=!0,r.push(t));}}return e}(c);for(const e in h)h[e].forEach((e=>{const i=e.feature,s=t.getFeatureState(i.layer[\"source-layer\"],i.id);i.source=i.layer.source,i.layer[\"source-layer\"]&&(i.sourceLayer=i.layer[\"source-layer\"]),i.state=s;}));return h}function X(t,e){const i=t.tileID,s=e.tileID;return i.overscaledZ-s.overscaledZ||i.canonical.y-s.canonical.y||i.wrap-s.wrap||i.canonical.x-s.canonical.x}class W{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=t.uniqueId(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state=\"loading\";}registerFadeDuration(t){const e=t+this.timeAdded;e<this.fadeEndTime||(this.fadeEndTime=e);}wasRequested(){return \"errored\"===this.state||\"loaded\"===this.state||\"reloading\"===this.state}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null;}loadVectorData(e,i,s){if(this.hasData()&&this.unloadVectorData(),this.state=\"loaded\",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(t,e){const i={};if(!e)return i;for(const s of t){const t=s.layerIds.map((t=>e.getLayer(t))).filter(Boolean);if(0!==t.length){s.layers=t,s.stateDependentLayerIds&&(s.stateDependentLayers=s.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)i[e.id]=s;}}return i}(e.buckets,i.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.SymbolBucket){if(this.hasSymbolBuckets=!0,!s)break;i.justReloaded=!0;}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.SymbolBucket&&i.hasRTLText){this.hasRTLText=!0,t.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const t in this.buckets){const e=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(t).queryRadius(e));}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage);}else this.collisionBoxArray=new t.CollisionBoxArray;}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state=\"unloaded\";}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const i=this.buckets[e];i.uploadPending()&&i.upload(t);}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new y(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new y(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null);}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture);}queryRenderedFeatures(t,e,i,s,a,o,r,n,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:s,cameraQueryGeometry:a,scale:o,tileSize:this.tileSize,pixelPosMatrix:c,transform:n,params:r,queryPadding:this.queryPadding*l},t,e,i):{}}querySourceFeatures(e,i){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const a=s.loadVTLayers(),o=i&&i.sourceLayer?i.sourceLayer:\"\",r=a._geojsonTileLayer||a[o];if(!r)return;const n=t.createFilter(i&&i.filter),{z:l,x:c,y:h}=this.tileID.canonical,u={z:l,x:c,y:h};for(let i=0;i<r.length;i++){const a=r.feature(i);if(n.needGeometry){const e=t.toEvaluationFeature(a,!0);if(!n.filter(new t.EvaluationParameters(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!n.filter(new t.EvaluationParameters(this.tileID.overscaledZ),a))continue;const d=s.getId(a,o),_=new t.GeoJSONFeature(a,l,c,h,d);_.tile=u,e.push(_);}}hasData(){return \"loaded\"===this.state||\"reloading\"===this.state||\"expired\"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const i=this.expirationTime;if(e.cacheControl){const i=t.parseCacheControl(e.cacheControl);i[\"max-age\"]&&(this.expirationTime=Date.now()+1e3*i[\"max-age\"]);}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const t=Date.now();let e=!1;if(this.expirationTime>t)e=!1;else if(i)if(this.expirationTime<i)e=!0;else {const s=this.expirationTime-i;s?this.expirationTime=t+Math.max(s,3e4):e=!0;}else e=!0;e?(this.expiredRequestCount++,this.state=\"expired\"):this.expiredRequestCount=0;}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(t,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(t).length)return;const i=this.latestFeatureIndex.loadVTLayers();for(const s in this.buckets){if(!e.style.hasLayer(s))continue;const a=this.buckets[s],o=a.layers[0].sourceLayer||\"_geojsonTileLayer\",r=i[o],n=t[o];if(!r||!n||0===Object.keys(n).length)continue;a.update(n,r,this.imageAtlas&&this.imageAtlas.patternPositions||{});const l=e&&e.style&&e.style.getLayer(s);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(a)));}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return !this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<t.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0;}setHoldDuration(e){this.symbolFadeHoldUntil=t.exported.now()+e;}setDependencies(t,e){const i={};for(const t of e)i[t]=!0;this.dependencies[t]=i;}hasDependency(t,e){for(const i of t){const t=this.dependencies[i];if(t)for(const i of e)if(t[i])return !0}return !1}}class H{constructor(t,e){this.max=t,this.onRemove=e,this.reset();}reset(){for(const t in this.data)for(const e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,i){const s=t.wrapped().key;void 0===this.data[s]&&(this.data[s]=[]);const a={value:e,timeout:void 0};if(void 0!==i&&(a.timeout=setTimeout((()=>{this.remove(t,a);}),i)),this.data[s].push(a),this.order.push(s),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t);}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const i=t.wrapped().key,s=void 0===e?0:this.data[i].indexOf(e),a=this.data[i][s];return this.data[i].splice(s,1),a.timeout&&clearTimeout(a.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(a.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t);}return this}filter(t){const e=[];for(const i in this.data)for(const s of this.data[i])t(s.value)||e.push(s);for(const t of e)this.remove(t.value.tileID,t);}}class K{constructor(){this.state={},this.stateChanges={},this.deletedStates={};}updateState(e,i,s){const a=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][a]=this.stateChanges[e][a]||{},t.extend(this.stateChanges[e][a],s),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==a&&(this.deletedStates[e][t]=null);}else if(this.deletedStates[e]&&null===this.deletedStates[e][a]){this.deletedStates[e][a]={};for(const t in this.state[e][a])s[t]||(this.deletedStates[e][a][t]=null);}else for(const t in s)this.deletedStates[e]&&this.deletedStates[e][a]&&null===this.deletedStates[e][a][t]&&delete this.deletedStates[e][a][t];}removeFeatureState(t,e,i){if(null===this.deletedStates[t])return;const s=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][s]&&(this.deletedStates[t][s]=this.deletedStates[t][s]||{},this.deletedStates[t][s][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][s])for(i in this.deletedStates[t][s]={},this.stateChanges[t][s])this.deletedStates[t][s][i]=null;else this.deletedStates[t][s]=null;else this.deletedStates[t]=null;}getState(e,i){const s=String(i),a=t.extend({},(this.state[e]||{})[s],(this.stateChanges[e]||{})[s]);if(null===this.deletedStates[e])return {};if(this.deletedStates[e]){const t=this.deletedStates[e][i];if(null===t)return {};for(const e in t)delete a[e];}return a}initializeTileState(t,e){t.setFeatureState(this.state,e);}coalesceChanges(e,i){const s={};for(const e in this.stateChanges){this.state[e]=this.state[e]||{};const i={};for(const s in this.stateChanges[e])this.state[e][s]||(this.state[e][s]={}),t.extend(this.state[e][s],this.stateChanges[e][s]),i[s]=this.state[e][s];s[e]=i;}for(const e in this.deletedStates){this.state[e]=this.state[e]||{};const i={};if(null===this.deletedStates[e])for(const t in this.state[e])i[t]={},this.state[e][t]={};else for(const t in this.deletedStates[e]){if(null===this.deletedStates[e][t])this.state[e][t]={};else for(const i of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][i];i[t]=this.state[e][t];}s[e]=s[e]||{},t.extend(s[e],i);}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(s).length)for(const t in e)e[t].setFeatureState(s,i);}}class Y extends t.Evented{constructor(e,i,s){super(),this.id=e,this.dispatcher=s,this.on(\"data\",(t=>{\"source\"===t.dataType&&\"metadata\"===t.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&\"source\"===t.dataType&&\"content\"===t.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0);})),this.on(\"dataloading\",(()=>{this._sourceErrored=!1;})),this.on(\"error\",(()=>{this._sourceErrored=this._source.loaded();})),this._source=function(e,i,s,a){const o=new q[i.type](e,i,s,a);if(o.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${o.id}`);return t.bindAll([\"load\",\"abort\",\"unload\",\"serialize\",\"prepare\"],o),o}(e,i,s,this),this._tiles={},this._cache=new H(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new K,this._didEmitContent=!1,this._updated=!1;}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t);}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t);}loaded(){if(this._sourceErrored)return !0;if(!this._sourceLoaded)return !1;if(!this._source.loaded())return !1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return !0;if(!this._updated)return !1;for(const t in this._tiles){const e=this._tiles[t];if(\"loaded\"!==e.state&&\"errored\"!==e.state)return !1}return !0}getSource(){return this._source}pause(){this._paused=!0;}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain);}_loadTile(t,e){return this._source.loadTile(t,e)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,(()=>{}))}_abortTile(e){this._source.abortTile&&this._source.abortTile(e,(()=>{})),this._source.fire(new t.Event(\"dataabort\",{tile:e,coord:e.tileID,dataType:\"source\"}));}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const i=this._tiles[e];i.upload(t),i.prepare(this.map.style.imageManager);}}getIds(){return Object.values(this._tiles).map((t=>t.tileID)).sort(J).map((t=>t.key))}getRenderableIds(e){const i=[];for(const t in this._tiles)this._isIdRenderable(t,e)&&i.push(this._tiles[t]);return e?i.sort(((e,i)=>{const s=e.tileID,a=i.tileID,o=new t.Point(s.canonical.x,s.canonical.y)._rotate(this.transform.angle),r=new t.Point(a.canonical.x,a.canonical.y)._rotate(this.transform.angle);return s.overscaledZ-a.overscaledZ||r.y-o.y||r.x-o.x})).map((t=>t.tileID.key)):i.map((t=>t.tileID)).sort(J).map((t=>t.key))}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return !!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else {this._cache.reset();for(const t in this._tiles)\"errored\"!==this._tiles[t].state&&this._reloadTile(t,\"reloading\");}}_reloadTile(t,e){const i=this._tiles[t];i&&(\"loading\"!==i.state&&(i.state=e),this._loadTile(i,this._tileLoaded.bind(this,i,t,e)));}_tileLoaded(e,i,s,a){if(a)return e.state=\"errored\",void(404!==a.status?this._source.fire(new t.ErrorEvent(a,{tile:e})):this.update(this.transform,this.terrain));e.timeAdded=t.exported.now(),\"expired\"===s&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),\"raster-dem\"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.Event(\"data\",{dataType:\"source\",tile:e,coord:e.tileID}));}_backfillDEM(t){const e=this.getRenderableIds();for(let s=0;s<e.length;s++){const a=e[s];if(t.neighboringTiles&&t.neighboringTiles[a]){const e=this.getTileByID(a);i(t,e),i(e,t);}}function i(t,e){t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0;let i=e.tileID.canonical.x-t.tileID.canonical.x;const s=e.tileID.canonical.y-t.tileID.canonical.y,a=Math.pow(2,t.tileID.canonical.z),o=e.tileID.key;0===i&&0===s||Math.abs(s)>1||(Math.abs(i)>1&&(1===Math.abs(i+a)?i+=a:1===Math.abs(i-a)&&(i-=a)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,s),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)));}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,i,s){for(const a in this._tiles){let o=this._tiles[a];if(s[a]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>i)continue;let r=o.tileID;for(;o&&o.tileID.overscaledZ>e+1;){const t=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[t.key],o&&o.hasData()&&(r=t);}let n=r;for(;n.overscaledZ>e;)if(n=n.scaledTo(n.overscaledZ-1),t[n.key]){s[r.key]=r;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(let i=t.overscaledZ-1;i>=e;i--){const e=t.scaledTo(i),s=this._getLoadedTile(e);if(s)return s}}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)}updateCacheSize(e){const i=Math.ceil(e.width/this._source.tileSize)+1,s=Math.ceil(e.height/this._source.tileSize)+1,a=Math.floor(i*s*(null===this._maxTileCacheZoomLevels?t.config.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),o=\"number\"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(o);}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const i in this._tiles){const s=this._tiles[i];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+e),t[s.tileID.key]=s;}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(t,this._tiles[t]);}}update(e,i){if(this.transform=e,this.terrain=i,!this._sourceLoaded||this._paused)return;let s;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(s=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i}),this._source.hasTile&&(s=s.filter((t=>this._source.hasTile(t))))):s=[];const a=e.coveringZoomLevel(this._source),o=Math.max(a-Y.maxOverzooming,this._source.minzoom),r=Math.max(a+Y.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const t={};for(const e of s)if(e.canonical.z>this._source.minzoom){const i=e.scaledTo(e.canonical.z-1);t[i.key]=i;const s=e.scaledTo(Math.max(this._source.minzoom,Math.min(e.canonical.z,5)));t[s.key]=s;}s=s.concat(Object.values(t));}const n=0===s.length&&!this._updated&&this._didEmitContent;this._updated=!0,n&&this.fire(new t.Event(\"data\",{sourceDataType:\"idle\",dataType:\"source\",sourceId:this.id}));const l=this._updateRetainedTiles(s,a);if(Q(this._source.type)){const e={},n={},c=Object.keys(l),h=t.exported.now();for(const t of c){const i=l[t],s=this._tiles[t];if(!s||0!==s.fadeEndTime&&s.fadeEndTime<=h)continue;const a=this.findLoadedParent(i,o);a&&(this._addTile(a.tileID),e[a.tileID.key]=a.tileID),n[t]=i;}this._retainLoadedChildren(n,a,r,l);for(const t in e)l[t]||(this._coveredTiles[t]=!0,l[t]=e[t]);if(i){const t={},e={};for(const i of s)this._tiles[i.key].hasData()?t[i.key]=i:e[i.key]=i;for(const i in e){const s=e[i].children(this._source.maxzoom);this._tiles[s[0].key]&&this._tiles[s[1].key]&&this._tiles[s[2].key]&&this._tiles[s[3].key]&&(t[s[0].key]=l[s[0].key]=s[0],t[s[1].key]=l[s[1].key]=s[1],t[s[2].key]=l[s[2].key]=s[2],t[s[3].key]=l[s[3].key]=s[3],delete e[i]);}for(const i in e){const s=this.findLoadedParent(e[i],this._source.minzoom);if(s){t[s.tileID.key]=l[s.tileID.key]=s.tileID;for(const e in t)t[e].isChildOf(s.tileID)&&delete t[e];}}for(const e in this._tiles)t[e]||(this._coveredTiles[e]=!0);}}for(const t in l)this._tiles[t].clearFadeHold();const c=t.keysDifference(this._tiles,l);for(const t of c){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(t);}this._updateLoadedParentTileCache();}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t);}_updateRetainedTiles(t,e){const i={},s={},a=Math.max(e-Y.maxOverzooming,this._source.minzoom),o=Math.max(e+Y.maxUnderzooming,this._source.minzoom),r={};for(const s of t){const t=this._addTile(s);i[s.key]=s,t.hasData()||e<this._source.maxzoom&&(r[s.key]=s);}this._retainLoadedChildren(r,e,o,i);for(const o of t){let t=this._tiles[o.key];if(t.hasData())continue;if(e+1>this._source.maxzoom){const t=o.children(this._source.maxzoom)[0],e=this.getTile(t);if(e&&e.hasData()){i[t.key]=t;continue}}else {const t=o.children(this._source.maxzoom);if(i[t[0].key]&&i[t[1].key]&&i[t[2].key]&&i[t[3].key])continue}let r=t.wasRequested();for(let e=o.overscaledZ-1;e>=a;--e){const a=o.scaledTo(e);if(s[a.key])break;if(s[a.key]=!0,t=this.getTile(a),!t&&r&&(t=this._addTile(a)),t){const e=t.hasData();if((r||e)&&(i[a.key]=a),r=t.wasRequested(),e)break}}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let i,s=this._tiles[t].tileID;for(;s.overscaledZ>0;){if(s.key in this._loadedParentTiles){i=this._loadedParentTiles[s.key];break}e.push(s.key);const t=s.scaledTo(s.overscaledZ-1);if(i=this._getLoadedTile(t),i)break;s=t;}for(const t of e)this._loadedParentTiles[t]=i;}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const s=i;return i||(i=new W(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,this._tileLoaded.bind(this,i,e.key,i.state))),i.uses++,this._tiles[e.key]=i,s||this._source.fire(new t.Event(\"dataloading\",{tile:i,coord:i.tileID,dataType:\"source\"})),i}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,\"expired\"),delete this._timers[t];}),i));}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&\"reloading\"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))));}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset();}tilesIn(e,i,s){const a=[],o=this.transform;if(!o)return a;const r=s?o.getCameraQueryGeometry(e):e,n=e.map((t=>o.pointCoordinate(t,this.terrain))),l=r.map((t=>o.pointCoordinate(t,this.terrain))),c=this.getIds();let h=1/0,u=1/0,d=-1/0,_=-1/0;for(const t of l)h=Math.min(h,t.x),u=Math.min(u,t.y),d=Math.max(d,t.x),_=Math.max(_,t.y);for(let e=0;e<c.length;e++){const s=this._tiles[c[e]];if(s.holdingForFade())continue;const r=s.tileID,m=Math.pow(2,o.zoom-s.tileID.overscaledZ),p=i*s.queryPadding*t.EXTENT/s.tileSize/m,f=[r.getTilePoint(new t.MercatorCoordinate(h,u)),r.getTilePoint(new t.MercatorCoordinate(d,_))];if(f[0].x-p<t.EXTENT&&f[0].y-p<t.EXTENT&&f[1].x+p>=0&&f[1].y+p>=0){const t=n.map((t=>r.getTilePoint(t))),e=l.map((t=>r.getTilePoint(t)));a.push({tile:s,tileID:r,queryGeometry:t,cameraQueryGeometry:e,scale:m});}}return a}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._tiles[t].tileID));for(const t of e)t.posMatrix=this.transform.calculatePosMatrix(t.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return !0;if(Q(this._source.type)){const e=t.exported.now();for(const t in this._tiles)if(this._tiles[t].fadeEndTime>=e)return !0}return !1}setFeatureState(t,e,i){this._state.updateState(t=t||\"_geojsonTileLayer\",e,i);}removeFeatureState(t,e,i){this._state.removeFeatureState(t=t||\"_geojsonTileLayer\",e,i);}getFeatureState(t,e){return this._state.getState(t=t||\"_geojsonTileLayer\",e)}setDependencies(t,e,i){const s=this._tiles[t];s&&s.setDependencies(e,i);}reloadTilesForDependencies(t,e){for(const i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(i,\"reloading\");this._cache.filter((i=>!i.hasDependency(t,e)));}}function J(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),s=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||s-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function Q(t){return \"raster\"===t||\"image\"===t||\"video\"===t}Y.maxOverzooming=10,Y.maxUnderzooming=3;const tt=\"mapboxgl_preloaded_worker_pool\";class et{constructor(){this.active={};}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<et.workerCount;)this.workers.push(new Worker(t.config.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach((t=>{t.terminate();})),this.workers=null);}isPreloaded(){return !!this.active[tt]}numActive(){return Object.keys(this.active).length}}const it=Math.floor(t.exported.hardwareConcurrency/2);let st;function at(){return st||(st=new et),st}et.workerCount=t.isSafari(globalThis)?Math.max(Math.min(it,3),1):1;class ot{constructor(t,e){this.reset(t,e);}reset(t,e){this.points=t||[],this._distances=[0];for(let t=1;t<this.points.length;t++)this._distances[t]=this._distances[t-1]+this.points[t].dist(this.points[t-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding;}lerp(e){if(1===this.points.length)return this.points[0];e=t.clamp(e,0,1);let i=1,s=this._distances[i];const a=e*this.paddedLength+this.padding;for(;s<a&&i<this._distances.length;)s=this._distances[++i];const o=i-1,r=this._distances[o],n=s-r,l=n>0?(a-r)/n:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}function rt(t,e){let i=!0;return \"always\"===t||\"never\"!==t&&\"never\"!==e||(i=!1),i}class nt{constructor(t,e,i){const s=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let t=0;t<this.xCellCount*this.yCellCount;t++)s.push([]),a.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0;}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,i,s,a){this._forEachCell(e,i,s,a,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(s),this.bboxes.push(a);}insertCircle(t,e,i,s){this._forEachCell(e-s,i-s,e+s,i+s,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(s);}_insertBoxCell(t,e,i,s,a,o){this.boxCells[a].push(o);}_insertCircleCell(t,e,i,s,a,o){this.circleCells[a].push(o);}_query(t,e,i,s,a,o,r){if(i<0||t>this.width||s<0||e>this.height)return [];const n=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=s){if(a)return [{key:null,x1:t,y1:e,x2:i,y2:s}];for(let t=0;t<this.boxKeys.length;t++)n.push({key:this.boxKeys[t],x1:this.bboxes[4*t],y1:this.bboxes[4*t+1],x2:this.bboxes[4*t+2],y2:this.bboxes[4*t+3]});for(let t=0;t<this.circleKeys.length;t++){const e=this.circles[3*t],i=this.circles[3*t+1],s=this.circles[3*t+2];n.push({key:this.circleKeys[t],x1:e-s,y1:i-s,x2:e+s,y2:i+s});}}else this._forEachCell(t,e,i,s,this._queryCell,n,{hitTest:a,overlapMode:o,seenUids:{box:{},circle:{}}},r);return n}query(t,e,i,s){return this._query(t,e,i,s,!1,null)}hitTest(t,e,i,s,a,o){return this._query(t,e,i,s,!0,a,o).length>0}hitTestCircle(t,e,i,s,a){const o=t-i,r=t+i,n=e-i,l=e+i;if(r<0||o>this.width||l<0||n>this.height)return !1;const c=[];return this._forEachCell(o,n,r,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:s,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},a),c.length>0}_queryCell(t,e,i,s,a,o,r,n){const{seenUids:l,hitTest:c,overlapMode:h}=r,u=this.boxCells[a];if(null!==u){const a=this.bboxes;for(const r of u)if(!l.box[r]){l.box[r]=!0;const u=4*r,d=this.boxKeys[r];if(t<=a[u+2]&&e<=a[u+3]&&i>=a[u+0]&&s>=a[u+1]&&(!n||n(d))&&(!c||!rt(h,d.overlapMode))&&(o.push({key:d,x1:a[u],y1:a[u+1],x2:a[u+2],y2:a[u+3]}),c))return !0}}const d=this.circleCells[a];if(null!==d){const a=this.circles;for(const r of d)if(!l.circle[r]){l.circle[r]=!0;const u=3*r,d=this.circleKeys[r];if(this._circleAndRectCollide(a[u],a[u+1],a[u+2],t,e,i,s)&&(!n||n(d))&&(!c||!rt(h,d.overlapMode))){const t=a[u],e=a[u+1],i=a[u+2];if(o.push({key:d,x1:t-i,y1:e-i,x2:t+i,y2:e+i}),c)return !0}}}return !1}_queryCellCircle(t,e,i,s,a,o,r,n){const{circle:l,seenUids:c,overlapMode:h}=r,u=this.boxCells[a];if(null!==u){const t=this.bboxes;for(const e of u)if(!c.box[e]){c.box[e]=!0;const i=4*e,s=this.boxKeys[e];if(this._circleAndRectCollide(l.x,l.y,l.radius,t[i+0],t[i+1],t[i+2],t[i+3])&&(!n||n(s))&&!rt(h,s.overlapMode))return o.push(!0),!0}}const d=this.circleCells[a];if(null!==d){const t=this.circles;for(const e of d)if(!c.circle[e]){c.circle[e]=!0;const i=3*e,s=this.circleKeys[e];if(this._circlesCollide(t[i],t[i+1],t[i+2],l.x,l.y,l.radius)&&(!n||n(s))&&!rt(h,s.overlapMode))return o.push(!0),!0}}}_forEachCell(t,e,i,s,a,o,r,n){const l=this._convertToXCellCoord(t),c=this._convertToYCellCoord(e),h=this._convertToXCellCoord(i),u=this._convertToYCellCoord(s);for(let d=l;d<=h;d++)for(let l=c;l<=u;l++)if(a.call(this,t,e,i,s,this.xCellCount*l+d,o,r,n))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,i,s,a,o){const r=s-t,n=a-e,l=i+o;return l*l>r*r+n*n}_circleAndRectCollide(t,e,i,s,a,o,r){const n=(o-s)/2,l=Math.abs(t-(s+n));if(l>n+i)return !1;const c=(r-a)/2,h=Math.abs(e-(a+c));if(h>c+i)return !1;if(l<=n||h<=c)return !0;const u=l-n,d=h-c;return u*u+d*d<=i*i}}function lt(e,i,s,a,o){const r=t.create();return i?(t.scale(r,r,[1/o,1/o,1]),s||t.rotateZ(r,r,a.angle)):t.multiply(r,a.labelPlaneMatrix,e),r}function ct(e,i,s,a,o){if(i){const i=t.clone(e);return t.scale(i,i,[o,o,1]),s||t.rotateZ(i,i,-a.angle),i}return a.glCoordMatrix}function ht(e,i,s){let a;s?(a=[e.x,e.y,s(e.x,e.y),1],t.transformMat4(a,a,i)):(a=[e.x,e.y,0,1],Et(a,a,i));const o=a[3];return {point:new t.Point(a[0]/o,a[1]/o),signedDistanceFromCamera:o}}function ut(t,e){return .5+t/e*.5}function dt(t,e){const i=t[0]/t[3],s=t[1]/t[3];return i>=-e[0]&&i<=e[0]&&s>=-e[1]&&s<=e[1]}function _t(e,i,s,a,o,r,n,l,c,h){const u=a?e.textSizeData:e.iconSizeData,d=t.evaluateSizeForZoom(u,s.transform.zoom),_=[256/s.width*2+1,256/s.height*2+1],m=a?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;m.clear();const p=e.lineVertexArray,f=a?e.text.placedSymbolArray:e.icon.placedSymbolArray,g=s.transform.width/s.transform.height;let v=!1;for(let a=0;a<f.length;a++){const x=f.get(a);if(x.hidden||x.writingMode===t.WritingMode.vertical&&!v){Tt(x.numGlyphs,m);continue}let y;if(v=!1,h?(y=[x.anchorX,x.anchorY,h(x.anchorX,x.anchorY),1],t.transformMat4(y,y,i)):(y=[x.anchorX,x.anchorY,0,1],Et(y,y,i)),!dt(y,_)){Tt(x.numGlyphs,m);continue}const b=ut(s.transform.cameraToCenterDistance,y[3]),w=t.evaluateSizeForFeature(u,d,x),T=n?w/b:w*b,E=new t.Point(x.anchorX,x.anchorY),I=ht(E,o,h).point,S={projections:{},offsets:{}},C=ft(x,T,!1,l,i,o,r,e.glyphOffsetArray,p,m,I,E,S,g,c,h);v=C.useVertical,(C.notEnoughRoom||v||C.needsFlipping&&ft(x,T,!0,l,i,o,r,e.glyphOffsetArray,p,m,I,E,S,g,c,h).notEnoughRoom)&&Tt(x.numGlyphs,m);}a?e.text.dynamicLayoutVertexBuffer.updateData(m):e.icon.dynamicLayoutVertexBuffer.updateData(m);}function mt(t,e,i,s,a,o,r,n,l,c,h,u,d){const _=n.glyphStartIndex+n.numGlyphs,m=n.lineStartIndex,p=n.lineStartIndex+n.lineLength,f=e.getoffsetX(n.glyphStartIndex),g=e.getoffsetX(_-1),v=bt(t*f,i,s,a,o,r,n.segment,m,p,l,c,h,u,d);if(!v)return null;const x=bt(t*g,i,s,a,o,r,n.segment,m,p,l,c,h,u,d);return x?{first:v,last:x}:null}function pt(e,i,s,a){return e===t.WritingMode.horizontal&&Math.abs(s.y-i.y)>Math.abs(s.x-i.x)*a?{useVertical:!0}:(e===t.WritingMode.vertical?i.y<s.y:i.x>s.x)?{needsFlipping:!0}:null}function ft(e,i,s,a,o,r,n,l,c,h,u,d,_,m,p,f){const g=i/24,v=e.lineOffsetX*g,x=e.lineOffsetY*g;let y;if(e.numGlyphs>1){const t=e.glyphStartIndex+e.numGlyphs,i=e.lineStartIndex,o=e.lineStartIndex+e.lineLength,h=mt(g,l,v,x,s,u,d,e,c,r,_,p,f);if(!h)return {notEnoughRoom:!0};const b=ht(h.first.point,n,f).point,w=ht(h.last.point,n,f).point;if(a&&!s){const t=pt(e.writingMode,b,w,m);if(t)return t}y=[h.first];for(let a=e.glyphStartIndex+1;a<t-1;a++)y.push(bt(g*l.getoffsetX(a),v,x,s,u,d,e.segment,i,o,c,r,_,p,f));y.push(h.last);}else {if(a&&!s){const i=ht(d,o,f).point,s=e.lineStartIndex+e.segment+1,a=new t.Point(c.getx(s),c.gety(s)),r=ht(a,o,f),n=r.signedDistanceFromCamera>0?r.point:gt(d,a,i,1,o,f),l=pt(e.writingMode,i,n,m);if(l)return l}const i=bt(g*l.getoffsetX(e.glyphStartIndex),v,x,s,u,d,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,c,r,_,p,f);if(!i)return {notEnoughRoom:!0};y=[i];}for(const e of y)t.addDynamicAttributes(h,e.point,e.angle);return {}}function gt(t,e,i,s,a,o){const r=ht(t.add(t.sub(e)._unit()),a,o).point,n=i.sub(r);return i.add(n._mult(s/n.mag()))}function vt(e,i){const{projectionCache:s,lineVertexArray:a,labelPlaneMatrix:o,tileAnchorPoint:r,distanceFromAnchor:n,getElevation:l,previousVertex:c,direction:h,absOffsetX:u}=i;if(s.projections[e])return s.projections[e];const d=new t.Point(a.getx(e),a.gety(e)),_=ht(d,o,l);if(_.signedDistanceFromCamera>0)return s.projections[e]=_.point,_.point;const m=e-h;return gt(0===n?r:new t.Point(a.getx(m),a.gety(m)),d,c,u-n+1,o,l)}function xt(t,e,i){return t._unit()._perp()._mult(e*i)}function yt(e,i,s,a,o,r,n,l){const{projectionCache:c,direction:h}=l;if(c.offsets[e])return c.offsets[e];const u=s.add(i);if(e+h<a||e+h>=o)return c.offsets[e]=u,u;const d=vt(e+h,l),_=xt(d.sub(s),n,h),m=s.add(_),p=d.add(_);return c.offsets[e]=t.findLineIntersection(r,u,m,p)||u,c.offsets[e]}function bt(t,e,i,s,a,o,r,n,l,c,h,u,d,_){const m=s?t-e:t+e;let p=m>0?1:-1,f=0;s&&(p*=-1,f=Math.PI),p<0&&(f+=Math.PI);let g,v,x=p>0?n+r:n+r+1,y=a,b=a,w=0,T=0;const E=Math.abs(m),I=[];let S;for(;w+T<=E;){if(x+=p,x<n||x>=l)return null;w+=T,b=y,v=g;const t={projectionCache:u,lineVertexArray:c,labelPlaneMatrix:h,tileAnchorPoint:o,distanceFromAnchor:w,getElevation:_,previousVertex:b,direction:p,absOffsetX:E};if(y=vt(x,t),0===i)I.push(b),S=y.sub(b);else {let e;const s=y.sub(b);e=0===s.mag()?xt(vt(x+p,t).sub(y),i,p):xt(s,i,p),v||(v=b.add(e)),g=yt(x,e,y,n,l,v,i,t),I.push(v),S=g.sub(v);}T=S.mag();}const C=S._mult((E-w)/T)._add(v||b),P=f+Math.atan2(y.y-b.y,y.x-b.x);return I.push(C),{point:C,angle:d?P:0,path:I}}const wt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Tt(t,e){for(let i=0;i<t;i++){const t=e.length;e.resize(t+4),e.float32.set(wt,3*t);}}function Et(t,e,i){const s=e[0],a=e[1];return t[0]=i[0]*s+i[4]*a+i[12],t[1]=i[1]*s+i[5]*a+i[13],t[3]=i[3]*s+i[7]*a+i[15],t}const It=100;class St{constructor(t,e=new nt(t.width+200,t.height+200,25),i=new nt(t.width+200,t.height+200,25)){this.transform=t,this.grid=e,this.ignoredGrid=i,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+It,this.screenBottomBoundary=t.height+It,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6;}placeCollisionBox(t,e,i,s,a,o){const r=this.projectAndGetPerspectiveRatio(s,t.anchorPointX,t.anchorPointY,o),n=i*r.perspectiveRatio,l=t.x1*n+r.point.x,c=t.y1*n+r.point.y,h=t.x2*n+r.point.x,u=t.y2*n+r.point.y;return !this.isInsideGrid(l,c,h,u)||\"always\"!==e&&this.grid.hitTest(l,c,h,u,e,a)||r.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[l,c,h,u],offscreen:this.isOffscreen(l,c,h,u)}}placeCollisionCircles(e,i,s,a,o,r,n,l,c,h,u,d,_,m){const p=[],f=new t.Point(i.anchorX,i.anchorY),g=ht(f,r,m),v=ut(this.transform.cameraToCenterDistance,g.signedDistanceFromCamera),x=(h?o/v:o*v)/t.ONE_EM,y=ht(f,n,m).point,b=mt(x,a,i.lineOffsetX*x,i.lineOffsetY*x,!1,y,f,i,s,n,{projections:{},offsets:{}},!1,m);let w=!1,T=!1,E=!0;if(b){const i=.5*d*v+_,s=new t.Point(-100,-100),a=new t.Point(this.screenRightBoundary,this.screenBottomBoundary),o=new ot,r=b.first,n=b.last;let h=[];for(let t=r.path.length-1;t>=1;t--)h.push(r.path[t]);for(let t=1;t<n.path.length;t++)h.push(n.path[t]);const f=2.5*i;if(l){const t=h.map((t=>ht(t,l,m)));h=t.some((t=>t.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point));}let g=[];if(h.length>0){const e=h[0].clone(),i=h[0].clone();for(let t=1;t<h.length;t++)e.x=Math.min(e.x,h[t].x),e.y=Math.min(e.y,h[t].y),i.x=Math.max(i.x,h[t].x),i.y=Math.max(i.y,h[t].y);g=e.x>=s.x&&i.x<=a.x&&e.y>=s.y&&i.y<=a.y?[h]:i.x<s.x||e.x>a.x||i.y<s.y||e.y>a.y?[]:t.clipLine([h],s.x,s.y,a.x,a.y);}for(const t of g){o.reset(t,.25*i);let s=0;s=o.length<=.5*i?1:Math.ceil(o.paddedLength/f)+1;for(let t=0;t<s;t++){const a=t/Math.max(s-1,1),r=o.lerp(a),n=r.x+It,l=r.y+It;p.push(n,l,i,0);const h=n-i,d=l-i,_=n+i,m=l+i;if(E=E&&this.isOffscreen(h,d,_,m),T=T||this.isInsideGrid(h,d,_,m),\"always\"!==e&&this.grid.hitTestCircle(n,l,i,e,u)&&(w=!0,!c))return {circles:[],offscreen:!1,collisionDetected:w}}}}return {circles:!c&&w||!T||v<this.perspectiveRatioCutoff?[]:p,offscreen:E,collisionDetected:w}}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return {};const i=[];let s=1/0,a=1/0,o=-1/0,r=-1/0;for(const n of e){const e=new t.Point(n.x+It,n.y+It);s=Math.min(s,e.x),a=Math.min(a,e.y),o=Math.max(o,e.x),r=Math.max(r,e.y),i.push(e);}const n=this.grid.query(s,a,o,r).concat(this.ignoredGrid.query(s,a,o,r)),l={},c={};for(const e of n){const s=e.key;if(void 0===l[s.bucketInstanceId]&&(l[s.bucketInstanceId]={}),l[s.bucketInstanceId][s.featureIndex])continue;const a=[new t.Point(e.x1,e.y1),new t.Point(e.x2,e.y1),new t.Point(e.x2,e.y2),new t.Point(e.x1,e.y2)];t.polygonIntersectsPolygon(i,a)&&(l[s.bucketInstanceId][s.featureIndex]=!0,void 0===c[s.bucketInstanceId]&&(c[s.bucketInstanceId]=[]),c[s.bucketInstanceId].push(s.featureIndex));}return c}insertCollisionBox(t,e,i,s,a,o){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:s,featureIndex:a,collisionGroupID:o,overlapMode:e},t[0],t[1],t[2],t[3]);}insertCollisionCircles(t,e,i,s,a,o){const r=i?this.ignoredGrid:this.grid,n={bucketInstanceId:s,featureIndex:a,collisionGroupID:o,overlapMode:e};for(let e=0;e<t.length;e+=4)r.insertCircle(n,t[e],t[e+1],t[e+2]);}projectAndGetPerspectiveRatio(e,i,s,a){let o;return a?(o=[i,s,a(i,s),1],t.transformMat4(o,o,e)):(o=[i,s,0,1],Et(o,o,e)),{point:new t.Point((o[0]/o[3]+1)/2*this.transform.width+It,(-o[1]/o[3]+1)/2*this.transform.height+It),perspectiveRatio:.5+this.transform.cameraToCenterDistance/o[3]*.5}}isOffscreen(t,e,i,s){return i<It||t>=this.screenRightBoundary||s<It||e>this.screenBottomBoundary}isInsideGrid(t,e,i,s){return i>=0&&t<this.gridRightBoundary&&s>=0&&e<this.gridBottomBoundary}getViewportMatrix(){const e=t.identity([]);return t.translate(e,e,[-100,-100,0]),e}}function Ct(e,i,s){return i*(t.EXTENT/(e.tileSize*Math.pow(2,s-e.tileID.overscaledZ)))}class Pt{constructor(t,e,i,s){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):s&&i?1:0,this.placed=i;}isHidden(){return 0===this.opacity&&!this.placed}}class Dt{constructor(t,e,i,s,a){this.text=new Pt(t?t.text:null,e,i,a),this.icon=new Pt(t?t.icon:null,e,s,a);}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class zt{constructor(t,e,i){this.text=t,this.icon=e,this.skipFade=i;}}class Mt{constructor(){this.invProjMatrix=t.create(),this.viewportMatrix=t.create(),this.circles=[];}}class At{constructor(t,e,i,s,a){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=s,this.tileID=a;}}class Lt{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={};}get(t){if(this.crossSourceCollisions)return {ID:0,predicate:null};if(!this.collisionGroups[t]){const e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:t=>t.collisionGroupID===e};}return this.collisionGroups[t]}}function Rt(e,i,s,a,o){const{horizontalAlign:r,verticalAlign:n}=t.getAnchorAlignment(e),l=-(r-.5)*i,c=-(n-.5)*s,h=t.evaluateVariableOffset(e,a);return new t.Point(l+h[0]*o,c+h[1]*o)}function kt(e,i,s,a,o,r){const{x1:n,x2:l,y1:c,y2:h,anchorPointX:u,anchorPointY:d}=e,_=new t.Point(i,s);return a&&_._rotate(o?r:-r),{x1:n+_.x,y1:c+_.y,x2:l+_.x,y2:h+_.y,anchorPointX:u,anchorPointY:d}}class Bt{constructor(t,e,i,s,a){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new St(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new Lt(s),this.collisionCircleArrays={},this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={};}getBucketParts(e,i,s,a){const o=s.getBucket(i),r=s.latestFeatureIndex;if(!o||!r||i.id!==o.layerIds[0])return;const n=s.collisionBoxArray,l=o.layers[0].layout,c=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),h=s.tileSize/t.EXTENT,u=this.transform.calculatePosMatrix(s.tileID.toUnwrapped()),d=\"map\"===l.get(\"text-pitch-alignment\"),_=\"map\"===l.get(\"text-rotation-alignment\"),m=Ct(s,1,this.transform.zoom),p=lt(u,d,_,this.transform,m);let f=null;if(d){const e=ct(u,d,_,this.transform,m);f=t.multiply([],this.transform.labelPlaneMatrix,e);}this.retainedQueryData[o.bucketInstanceId]=new At(o.bucketInstanceId,r,o.sourceLayerIndex,o.index,s.tileID);const g={bucket:o,layout:l,posMatrix:u,textLabelPlaneMatrix:p,labelToScreenMatrix:f,scale:c,textPixelRatio:h,holdingForFade:s.holdingForFade(),collisionBoxArray:n,partiallyEvaluatedTextSize:t.evaluateSizeForZoom(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(a)for(const t of o.sortKeyRanges){const{sortKey:i,symbolInstanceStart:s,symbolInstanceEnd:a}=t;e.push({sortKey:i,symbolInstanceStart:s,symbolInstanceEnd:a,parameters:g});}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:g});}attemptAnchorPlacement(t,e,i,s,a,o,r,n,l,c,h,u,d,_,m,p){const f=[u.textOffset0,u.textOffset1],g=Rt(t,i,s,f,a),v=this.collisionIndex.placeCollisionBox(kt(e,g.x,g.y,o,r,this.transform.angle),h,n,l,c.predicate,p);if((!m||0!==this.collisionIndex.placeCollisionBox(kt(m,g.x,g.y,o,r,this.transform.angle),h,n,l,c.predicate,p).box.length)&&v.box.length>0){let e;if(this.prevPlacement&&this.prevPlacement.variableOffsets[u.crossTileID]&&this.prevPlacement.placements[u.crossTileID]&&this.prevPlacement.placements[u.crossTileID].text&&(e=this.prevPlacement.variableOffsets[u.crossTileID].anchor),0===u.crossTileID)throw new Error(\"symbolInstance.crossTileID can't be 0\");return this.variableOffsets[u.crossTileID]={textOffset:f,width:i,height:s,anchor:t,textBoxScale:a,prevAnchor:e},this.markUsedJustification(d,t,u,_),d.allowVerticalPlacement&&(this.markUsedOrientation(d,_,u),this.placedOrientations[u.crossTileID]=_),{shift:g,placedGlyphBoxes:v}}}placeLayerBucketPart(e,i,s){const{bucket:a,layout:o,posMatrix:r,textLabelPlaneMatrix:n,labelToScreenMatrix:l,textPixelRatio:c,holdingForFade:h,collisionBoxArray:u,partiallyEvaluatedTextSize:d,collisionGroup:_}=e.parameters,m=o.get(\"text-optional\"),p=o.get(\"icon-optional\"),f=t.getOverlapMode(o,\"text-overlap\",\"text-allow-overlap\"),g=\"always\"===f,v=t.getOverlapMode(o,\"icon-overlap\",\"icon-allow-overlap\"),x=\"always\"===v,y=\"map\"===o.get(\"text-rotation-alignment\"),b=\"map\"===o.get(\"text-pitch-alignment\"),w=\"none\"!==o.get(\"icon-text-fit\"),T=\"viewport-y\"===o.get(\"symbol-z-order\"),E=g&&(x||!a.hasIconData()||p),I=x&&(g||!a.hasTextData()||m);!a.collisionArrays&&u&&a.deserializeCollisionBoxes(u);const S=this.retainedQueryData[a.bucketInstanceId].tileID,C=this.terrain?(t,e)=>this.terrain.getElevation(S,t,e):null,P=(e,u)=>{if(i[e.crossTileID])return;if(h)return void(this.placements[e.crossTileID]=new zt(!1,!1,!1));let x=!1,T=!1,S=!0,P=null,D={box:null,offscreen:null},z={box:null,offscreen:null},M=null,A=null,L=null,R=0,k=0,B=0;u.textFeatureIndex?R=u.textFeatureIndex:e.useRuntimeCollisionCircles&&(R=e.featureIndex),u.verticalTextFeatureIndex&&(k=u.verticalTextFeatureIndex);const F=u.textBox;if(F){const i=i=>{let s=t.WritingMode.horizontal;if(a.allowVerticalPlacement&&!i&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,s=t,this.markUsedOrientation(a,s,e));}return s},s=(i,s)=>{if(a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&u.verticalTextBox){for(const e of a.writingModes)if(e===t.WritingMode.vertical?(D=s(),z=D):D=i(),D&&D.box&&D.box.length)break}else D=i();};if(o.get(\"text-variable-anchor\")){let n=o.get(\"text-variable-anchor\");if(this.prevPlacement&&this.prevPlacement.variableOffsets[e.crossTileID]){const t=this.prevPlacement.variableOffsets[e.crossTileID];n.indexOf(t.anchor)>0&&(n=n.filter((e=>e!==t.anchor)),n.unshift(t.anchor));}const l=(t,i,s)=>{const o=t.x2-t.x1,l=t.y2-t.y1,h=e.textBoxScale,u=w&&\"never\"===v?i:null;let d={box:[],offscreen:!1};const m=\"never\"!==f?2*n.length:n.length;for(let i=0;i<m;++i){const m=this.attemptAnchorPlacement(n[i%n.length],t,o,l,h,y,b,c,r,_,i>=n.length?f:\"never\",e,a,s,u,C);if(m&&(d=m.placedGlyphBoxes,d&&d.box&&d.box.length)){x=!0,P=m.shift;break}}return d};s((()=>l(F,u.iconBox,t.WritingMode.horizontal)),(()=>{const i=u.verticalTextBox;return a.allowVerticalPlacement&&!(D&&D.box&&D.box.length)&&e.numVerticalGlyphVertices>0&&i?l(i,u.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),D&&(x=D.box,S=D.offscreen);const h=i(D&&D.box);if(!x&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(a,t.anchor,e,h));}}else {const o=(t,i)=>{const s=this.collisionIndex.placeCollisionBox(t,f,c,r,_.predicate,C);return s&&s.box&&s.box.length&&(this.markUsedOrientation(a,i,e),this.placedOrientations[e.crossTileID]=i),s};s((()=>o(F,t.WritingMode.horizontal)),(()=>{const i=u.verticalTextBox;return a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?o(i,t.WritingMode.vertical):{box:null,offscreen:null}})),i(D&&D.box&&D.box.length);}}if(M=D,x=M&&M.box&&M.box.length>0,S=M&&M.offscreen,e.useRuntimeCollisionCircles){const i=a.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),c=t.evaluateSizeForFeature(a.textSizeData,d,i),h=o.get(\"text-padding\");A=this.collisionIndex.placeCollisionCircles(f,i,a.lineVertexArray,a.glyphOffsetArray,c,r,n,l,s,b,_.predicate,e.collisionCircleDiameter,h,C),A.circles.length&&A.collisionDetected&&!s&&t.warnOnce(\"Collisions detected, but collision boxes are not shown\"),x=g||A.circles.length>0&&!A.collisionDetected,S=S&&A.offscreen;}if(u.iconFeatureIndex&&(B=u.iconFeatureIndex),u.iconBox){const t=t=>{const e=w&&P?kt(t,P.x,P.y,y,b,this.transform.angle):t;return this.collisionIndex.placeCollisionBox(e,v,c,r,_.predicate,C)};z&&z.box&&z.box.length&&u.verticalIconBox?(L=t(u.verticalIconBox),T=L.box.length>0):(L=t(u.iconBox),T=L.box.length>0),S=S&&L.offscreen;}const U=m||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,O=p||0===e.numIconVertices;if(U||O?O?U||(T=T&&x):x=T&&x:T=x=T&&x,x&&M&&M.box&&this.collisionIndex.insertCollisionBox(M.box,f,o.get(\"text-ignore-placement\"),a.bucketInstanceId,z&&z.box&&k?k:R,_.ID),T&&L&&this.collisionIndex.insertCollisionBox(L.box,v,o.get(\"icon-ignore-placement\"),a.bucketInstanceId,B,_.ID),A&&(x&&this.collisionIndex.insertCollisionCircles(A.circles,f,o.get(\"text-ignore-placement\"),a.bucketInstanceId,R,_.ID),s)){const t=a.bucketInstanceId;let e=this.collisionCircleArrays[t];void 0===e&&(e=this.collisionCircleArrays[t]=new Mt);for(let t=0;t<A.circles.length;t+=4)e.circles.push(A.circles[t+0]),e.circles.push(A.circles[t+1]),e.circles.push(A.circles[t+2]),e.circles.push(A.collisionDetected?1:0);}if(0===e.crossTileID)throw new Error(\"symbolInstance.crossTileID can't be 0\");if(0===a.bucketInstanceId)throw new Error(\"bucket.bucketInstanceId can't be 0\");this.placements[e.crossTileID]=new zt(x||E,T||I,S||a.justReloaded),i[e.crossTileID]=!0;};if(T){if(0!==e.symbolInstanceStart)throw new Error(\"bucket.bucketInstanceId should be 0\");const t=a.getSortedSymbolIndexes(this.transform.angle);for(let e=t.length-1;e>=0;--e){const i=t[e];P(a.symbolInstances.get(i),a.collisionArrays[i]);}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)P(a.symbolInstances.get(t),a.collisionArrays[t]);if(s&&a.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[a.bucketInstanceId];t.invert(e.invProjMatrix,r),e.viewportMatrix=this.collisionIndex.getViewportMatrix();}a.justReloaded=!1;}markUsedJustification(e,i,s,a){let o;o=a===t.WritingMode.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[t.getAnchorJustification(i)];const r=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const t of r)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=o>=0&&t!==o?0:s.crossTileID);}markUsedOrientation(e,i,s){const a=i===t.WritingMode.horizontal||i===t.WritingMode.horizontalOnly?i:0,o=i===t.WritingMode.vertical?i:0,r=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const t of r)e.text.placedSymbolArray.get(t).placedOrientation=a;s.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=o);}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const s=e?e.symbolFadeChange(t):1,a=e?e.opacities:{},o=e?e.variableOffsets:{},r=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],o=a[t];o?(this.opacities[t]=new Dt(o,s,e.text,e.icon),i=i||e.text!==o.text.placed||e.icon!==o.icon.placed):(this.opacities[t]=new Dt(null,s,e.text,e.icon,e.skipFade),i=i||e.text||e.icon);}for(const t in a){const e=a[t];if(!this.opacities[t]){const a=new Dt(e,s,!1,!1);a.isHidden()||(this.opacities[t]=a,i=i||e.text.placed||e.icon.placed);}}for(const t in o)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=o[t]);for(const t in r)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=r[t]);if(e&&void 0===e.lastPlacementChangeTime)throw new Error(\"Last placement time for previous placement is not defined\");i?this.lastPlacementChangeTime=t:\"number\"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t);}updateLayerOpacities(t,e){const i={};for(const s of e){const e=s.getBucket(t);e&&s.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,i,s.collisionBoxArray);}}updateBucketOpacities(e,i,s){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const a=e.layers[0].layout,o=new Dt(null,0,!1,!1,!0),r=a.get(\"text-allow-overlap\"),n=a.get(\"icon-allow-overlap\"),l=a.get(\"text-variable-anchor\"),c=\"map\"===a.get(\"text-rotation-alignment\"),h=\"map\"===a.get(\"text-pitch-alignment\"),u=\"none\"!==a.get(\"icon-text-fit\"),d=new Dt(null,0,r&&(n||!e.hasIconData()||a.get(\"icon-optional\")),n&&(r||!e.hasTextData()||a.get(\"text-optional\")),!0);!e.collisionArrays&&s&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(s);const _=(t,e,i)=>{for(let s=0;s<e/4;s++)t.opacityVertexArray.emplaceBack(i);t.hasVisibleVertices=t.hasVisibleVertices||i!==$t;};for(let s=0;s<e.symbolInstances.length;s++){const a=e.symbolInstances.get(s),{numHorizontalGlyphVertices:r,numVerticalGlyphVertices:n,crossTileID:m}=a;let p=this.opacities[m];i[m]?p=o:p||(p=d,this.opacities[m]=p),i[m]=!0;const f=a.numIconVertices>0,g=this.placedOrientations[a.crossTileID],v=g===t.WritingMode.vertical,x=g===t.WritingMode.horizontal||g===t.WritingMode.horizontalOnly;if(r>0||n>0){const t=jt(p.text);_(e.text,r,v?$t:t),_(e.text,n,x?$t:t);const i=p.text.isHidden();[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||v?1:0);})),a.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).hidden=i||x?1:0);const s=this.variableOffsets[a.crossTileID];s&&this.markUsedJustification(e,s.anchor,a,g);const o=this.placedOrientations[a.crossTileID];o&&(this.markUsedJustification(e,\"left\",a,o),this.markUsedOrientation(e,o,a));}if(f){const t=jt(p.icon),i=!(u&&a.verticalPlacedIconSymbolIndex&&v);a.placedIconSymbolIndex>=0&&(_(e.icon,a.numIconVertices,i?t:$t),e.icon.placedSymbolArray.get(a.placedIconSymbolIndex).hidden=p.icon.isHidden()),a.verticalPlacedIconSymbolIndex>=0&&(_(e.icon,a.numVerticalIconVertices,i?$t:t),e.icon.placedSymbolArray.get(a.verticalPlacedIconSymbolIndex).hidden=p.icon.isHidden());}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const i=e.collisionArrays[s];if(i){let s=new t.Point(0,0);if(i.textBox||i.verticalTextBox){let t=!0;if(l){const e=this.variableOffsets[m];e?(s=Rt(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),c&&s._rotate(h?this.transform.angle:-this.transform.angle)):t=!1;}i.textBox&&Ft(e.textCollisionBox.collisionVertexArray,p.text.placed,!t||v,s.x,s.y),i.verticalTextBox&&Ft(e.textCollisionBox.collisionVertexArray,p.text.placed,!t||x,s.x,s.y);}const a=Boolean(!x&&i.verticalIconBox);i.iconBox&&Ft(e.iconCollisionBox.collisionVertexArray,p.icon.placed,a,u?s.x:0,u?s.y:0),i.verticalIconBox&&Ft(e.iconCollisionBox.collisionVertexArray,p.icon.placed,!a,u?s.x:0,u?s.y:0);}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=t.invProjMatrix,e.placementViewportMatrix=t.viewportMatrix,e.collisionCircleArray=t.circles,delete this.collisionCircleArrays[e.bucketInstanceId];}}symbolFadeChange(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){const i=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*i>t}setStale(){this.stale=!0;}}function Ft(t,e,i,s,a){t.emplaceBack(e?1:0,i?1:0,s||0,a||0),t.emplaceBack(e?1:0,i?1:0,s||0,a||0),t.emplaceBack(e?1:0,i?1:0,s||0,a||0),t.emplaceBack(e?1:0,i?1:0,s||0,a||0);}const Ut=Math.pow(2,25),Ot=Math.pow(2,24),Nt=Math.pow(2,17),Gt=Math.pow(2,16),Zt=Math.pow(2,9),Vt=Math.pow(2,8),qt=Math.pow(2,1);function jt(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*Ut+e*Ot+i*Nt+e*Gt+i*Zt+e*Vt+i*qt+e}const $t=0;class Xt{constructor(t){this._sortAcrossTiles=\"viewport-y\"!==t.layout.get(\"symbol-z-order\")&&!t.layout.get(\"symbol-sort-key\").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[];}continuePlacement(t,e,i,s,a){const o=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(o,s,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,a())return !0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort(((t,e)=>t.sortKey-e.sortKey)));this._currentPartIndex<o.length;)if(e.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,a())return !0;return !1}}class Wt{constructor(t,e,i,s,a,o,r,n){this.placement=new Bt(t,e,o,r,n),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=s,this._showCollisionBoxes=a,this._done=!1;}isDone(){return this._done}continuePlacement(e,i,s){const a=t.exported.now(),o=()=>!this._forceFullPlacement&&t.exported.now()-a>2;for(;this._currentPlacementIndex>=0;){const t=i[e[this._currentPlacementIndex]],a=this.placement.collisionIndex.transform.zoom;if(\"symbol\"===t.type&&(!t.minzoom||t.minzoom<=a)&&(!t.maxzoom||t.maxzoom>a)){if(this._inProgressLayer||(this._inProgressLayer=new Xt(t)),this._inProgressLayer.continuePlacement(s[t.source],this.placement,this._showCollisionBoxes,t,o))return;delete this._inProgressLayer;}this._currentPlacementIndex--;}this._done=!0;}commit(t){return this.placement.commit(t),this.placement}}const Ht=512/t.EXTENT/2;class Kt{constructor(e,i,s){this.tileID=e,this.bucketInstanceId=s,this._symbolsByKey={};const a=new Map;for(let t=0;t<i.length;t++){const e=i.get(t),s=e.key,o=a.get(s);o?o.push(e):a.set(s,[e]);}for(const[e,i]of a){const s={positions:i.map((t=>({x:Math.floor(t.anchorX*Ht),y:Math.floor(t.anchorY*Ht)}))),crossTileIDs:i.map((t=>t.crossTileID))};if(s.positions.length>128){const e=new t.KDBush(s.positions.length,16,Uint16Array);for(const{x:t,y:i}of s.positions)e.add(t,i);e.finish(),delete s.positions,s.index=e;}this._symbolsByKey[e]=s;}}getScaledCoordinates(e,i){const{x:s,y:a,z:o}=this.tileID.canonical,{x:r,y:n,z:l}=i.canonical,c=Ht/Math.pow(2,l-o),h=(n*t.EXTENT+e.anchorY)*c,u=a*t.EXTENT*Ht;return {x:Math.floor((r*t.EXTENT+e.anchorX)*c-s*t.EXTENT*Ht),y:Math.floor(h-u)}}findMatches(t,e,i){const s=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let a=0;a<t.length;a++){const o=t.get(a);if(o.crossTileID)continue;const r=this._symbolsByKey[o.key];if(!r)continue;const n=this.getScaledCoordinates(o,e);if(r.index){const t=r.index.range(n.x-s,n.y-s,n.x+s,n.y+s).sort();for(const e of t){const t=r.crossTileIDs[e];if(!i[t]){i[t]=!0,o.crossTileID=t;break}}}else if(r.positions)for(let t=0;t<r.positions.length;t++){const e=r.positions[t],a=r.crossTileIDs[t];if(Math.abs(e.x-n.x)<=s&&Math.abs(e.y-n.y)<=s&&!i[a]){i[a]=!0,o.crossTileID=a;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class Yt{constructor(){this.maxCrossTileID=0;}generate(){return ++this.maxCrossTileID}}class Jt{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0;}handleWrapJump(t){const e=Math.round((t-this.lng)/360);if(0!==e)for(const t in this.indexes){const i=this.indexes[t],s={};for(const t in i){const a=i[t];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+e),s[a.tileID.key]=a;}this.indexes[t]=s;}this.lng=t;}addBucket(t,e,i){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return !1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key]);}for(let t=0;t<e.symbolInstances.length;t++)e.symbolInstances.get(t).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const s=this.usedCrossTileIDs[t.overscaledZ];for(const i in this.indexes){const a=this.indexes[i];if(Number(i)>t.overscaledZ)for(const i in a){const o=a[i];o.tileID.isChildOf(t)&&o.findMatches(e.symbolInstances,t,s);}else {const o=a[t.scaledTo(Number(i)).key];o&&o.findMatches(e.symbolInstances,t,s);}}for(let t=0;t<e.symbolInstances.length;t++){const a=e.symbolInstances.get(t);a.crossTileID||(a.crossTileID=i.generate(),s[a.crossTileID]=!0);}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Kt(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(const i of e.getCrossTileIDsLists())for(const e of i)delete this.usedCrossTileIDs[t][e];}removeStaleBuckets(t){let e=!1;for(const i in this.indexes){const s=this.indexes[i];for(const a in s)t[s[a].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,s[a]),delete s[a],e=!0);}return e}}class Qt{constructor(){this.layerIndexes={},this.crossTileIDs=new Yt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={};}addLayer(t,e,i){let s=this.layerIndexes[t.id];void 0===s&&(s=this.layerIndexes[t.id]=new Jt);let a=!1;const o={};s.handleWrapJump(i);for(const i of e){const e=i.getBucket(t);e&&t.id===e.layerIds[0]&&(e.bucketInstanceId||(e.bucketInstanceId=++this.maxBucketInstanceId),s.addBucket(i.tileID,e,this.crossTileIDs)&&(a=!0),o[e.bucketInstanceId]=!0);}return s.removeStaleBuckets(o)&&(a=!0),a}pruneUnusedLayers(t){const e={};t.forEach((t=>{e[t]=!0;}));for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t];}}const te=(e,i)=>t.emitValidationErrors(e,i&&i.filter((t=>\"source.canvas\"!==t.identifier))),ee=t.pick(t.operations,[\"addLayer\",\"removeLayer\",\"setPaintProperty\",\"setLayoutProperty\",\"setFilter\",\"addSource\",\"removeSource\",\"setLayerZoomRange\",\"setLight\",\"setTransition\",\"setGeoJSONSourceData\",\"setGlyphs\",\"setSprite\"]),ie=t.pick(t.operations,[\"setCenter\",\"setZoom\",\"setBearing\",\"setPitch\"]),se=t.emptyStyle();class ae extends t.Evented{constructor(e,i={}){super(),this.map=e,this.dispatcher=new A(at(),this,e._getMapId()),this.imageManager=new w,this.imageManager.setEventedParent(this),this.glyphManager=new S(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new M(256,512),this.crossTileSymbolIndex=new Qt,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast(\"setReferrer\",t.getReferrer());const s=this;this._rtlTextPluginCallback=ae.registerForPluginStateChange((e=>{s.dispatcher.broadcast(\"syncRTLPluginState\",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},((e,i)=>{if(t.triggerPluginCompletionEvent(e),i&&i.every((t=>t)))for(const t in s.sourceCaches){const e=s.sourceCaches[t].getSource().type;\"vector\"!==e&&\"geojson\"!==e||s.sourceCaches[t].reload();}}));})),this.on(\"data\",(t=>{if(\"source\"!==t.dataType||\"metadata\"!==t.sourceDataType)return;const e=this.sourceCaches[t.sourceId];if(!e)return;const i=e.getSource();if(i&&i.vectorLayerIds)for(const t in this._layers){const e=this._layers[t];e.source===i.id&&this._validateLayer(e);}}));}loadURL(e,i={},s){this.fire(new t.Event(\"dataloading\",{dataType:\"style\"})),i.validate=\"boolean\"!=typeof i.validate||i.validate;const a=this.map._requestManager.transformRequest(e,h.Style);this._request=t.getJSON(a,((e,a)=>{this._request=null,e?this.fire(new t.ErrorEvent(e)):a&&this._load(a,i,s);}));}loadJSON(e,i={},s){this.fire(new t.Event(\"dataloading\",{dataType:\"style\"})),this._request=t.exported.frame((()=>{this._request=null,i.validate=!1!==i.validate,this._load(e,i,s);}));}loadEmpty(){this.fire(new t.Event(\"dataloading\",{dataType:\"style\"})),this._load(se,{validate:!1});}_load(e,i,s){const a=i.transformStyle?i.transformStyle(s,e):e;if(!i.validate||!te(this,t.validateStyle(a))){this._loaded=!0,this.stylesheet=a;for(const t in a.sources)this.addSource(t,a.sources[t],{validate:!1});a.sprite?this._loadSprite(a.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(a.glyphs),this._createLayers(),this.light=new z(this.stylesheet.light),this.map.setTerrain(this.stylesheet.terrain),this.fire(new t.Event(\"data\",{dataType:\"style\"})),this.fire(new t.Event(\"style.load\"));}}_createLayers(){const e=t.derefLayers(this.stylesheet.layers);this.dispatcher.broadcast(\"setLayers\",e),this._order=e.map((t=>t.id)),this._layers={},this._serializedLayers=null;for(const i of e){const e=t.createStyleLayer(i);e.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=e;}}_loadSprite(e,i=!1,s=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(e,i,s,a){const o=v(e),r=o.length,n=s>1?\"@2x\":\"\",l={},c={},d={};for(const{id:e,url:s}of o){const o=i.transformRequest(i.normalizeSpriteURL(s,n,\".json\"),h.SpriteJSON),_=`${e}_${o.url}`;l[_]=t.getJSON(o,((t,i)=>{delete l[_],c[e]=i,x(a,c,d,t,r);}));const m=i.transformRequest(i.normalizeSpriteURL(s,n,\".png\"),h.SpriteImage),p=`${e}_${m.url}`;l[p]=u.getImage(m,((t,i)=>{delete l[p],d[e]=i,x(a,c,d,t,r);}));}return {cancel(){for(const t of Object.values(l))t.cancel();}}}(e,this.map._requestManager,this.map.getPixelRatio(),((e,a)=>{if(this._spriteRequest=null,e)this.fire(new t.ErrorEvent(e));else if(a)for(const t in a){this._spritesImagesIds[t]=[];const e=this._spritesImagesIds[t]?this._spritesImagesIds[t].filter((t=>!(t in a))):[];for(const t of e)this.imageManager.removeImage(t),this._changedImages[t]=!0;for(const e in a[t]){const s=\"default\"===t?e:`${t}:${e}`;this._spritesImagesIds[t].push(s),s in this.imageManager.images?this.imageManager.updateImage(s,a[t][e],!1):this.imageManager.addImage(s,a[t][e]),i&&(this._changedImages[s]=!0);}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast(\"setImages\",this._availableImages),this.fire(new t.Event(\"data\",{dataType:\"style\"})),s&&s(e);}));}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast(\"setImages\",this._availableImages),this.fire(new t.Event(\"data\",{dataType:\"style\"}));}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const s=e.sourceLayer;if(!s)return;const a=i.getSource();(\"geojson\"===a.type||a.vectorLayerIds&&-1===a.vectorLayerIds.indexOf(s))&&this.fire(new t.ErrorEvent(new Error(`Source layer \"${s}\" does not exist on source \"${a.id}\" as specified by style layer \"${e.id}\".`)));}loaded(){if(!this._loaded)return !1;if(Object.keys(this._updatedSources).length)return !1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return !1;return !!this.imageManager.isLoaded()}_serializeByIds(t){const e=this._serializedAllLayers();if(!t||0===t.length)return Object.values(e);const i=[];for(const s of t)e[s]&&i.push(e[s]);return i}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const e=Object.keys(this._layers);for(const i of e){const e=this._layers[i];\"custom\"!==e.type&&(t[i]=e.serialize());}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return !0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return !0;for(const t in this._layers)if(this._layers[t].hasTransition())return !0;return !1}_checkLoaded(){if(!this._loaded)throw new Error(\"Style is not done loading.\")}update(e){if(!this._loaded)return;const i=this._changed;if(this._changed){const t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(t.length||i.length)&&this._updateWorkerLayers(t,i);for(const t in this._updatedSources){const e=this._updatedSources[t];if(\"reload\"===e)this._reloadSource(t);else {if(\"clear\"!==e)throw new Error(`Invalid action ${e}`);this._clearSource(t);}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates();}const s={};for(const t in this.sourceCaches){const e=this.sourceCaches[t];s[t]=e.used,e.used=!1;}for(const t of this._order){const i=this._layers[t];i.recalculate(e,this._availableImages),!i.isHidden(e.zoom)&&i.source&&(this.sourceCaches[i.source].used=!0);}for(const e in s){const i=this.sourceCaches[e];s[e]!==i.used&&i.fire(new t.Event(\"data\",{sourceDataType:\"visibility\",dataType:\"source\",sourceId:e}));}this.light.recalculate(e),this.z=e.zoom,i&&this.fire(new t.Event(\"data\",{dataType:\"style\"}));}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies([\"icons\",\"patterns\"],t);this._changedImages={};}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies([\"glyphs\"],[\"\"]);this._glyphsDidChange=!1;}}_updateWorkerLayers(t,e){this.dispatcher.broadcast(\"updateLayers\",{layers:this._serializeByIds(t),removedIds:e});}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1;}setState(e,i={}){this._checkLoaded();const s=this.serialize();if(e=i.transformStyle?i.transformStyle(s,e):e,te(this,t.validateStyle(e)))return !1;(e=t.clone$1(e)).layers=t.derefLayers(e.layers);const a=t.diffStyles(s,e).filter((t=>!(t.command in ie)));if(0===a.length)return !1;const o=a.filter((t=>!(t.command in ee)));if(o.length>0)throw new Error(`Unimplemented: ${o.map((t=>t.command)).join(\", \")}.`);for(const t of a)\"setTransition\"!==t.command&&this[t.command].apply(this,t.args);return this.stylesheet=e,!0}addImage(e,i){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error(`An image named \"${e}\" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e);}updateImage(t,e){this.imageManager.updateImage(t,e);}getImage(t){return this.imageManager.getImage(t)}removeImage(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error(`An image named \"${e}\" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e);}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast(\"setImages\",this._availableImages),this.fire(new t.Event(\"data\",{dataType:\"style\"}));}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,s={}){if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error(`Source \"${e}\" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(\", \")}.`);if([\"vector\",\"raster\",\"geojson\",\"video\",\"image\"].indexOf(i.type)>=0&&this._validate(t.validateStyle.source,`sources.${e}`,i,null,s))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const a=this.sourceCaches[e]=new Y(e,i,this.dispatcher);a.style=this,a.setEventedParent(this,(()=>({isSourceLoaded:a.loaded(),source:a.serialize(),sourceId:e}))),a.onAdd(this.map),this._changed=!0;}removeSource(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error(\"There is no source with this ID\");for(const i in this._layers)if(this._layers[i].source===e)return this.fire(new t.ErrorEvent(new Error(`Source \"${e}\" cannot be removed while layer \"${i}\" is using it.`)));const i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new t.Event(\"data\",{sourceDataType:\"metadata\",dataType:\"source\",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0;}setGeoJSONSourceData(t,e){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error(`There is no source with this ID=${t}`);const i=this.sourceCaches[t].getSource();if(\"geojson\"!==i.type)throw new Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(e),this._changed=!0;}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(e,i,s={}){this._checkLoaded();const a=e.id;if(this.getLayer(a))return void this.fire(new t.ErrorEvent(new Error(`Layer \"${a}\" already exists on this map.`)));let o;if(\"custom\"===e.type){if(te(this,t.validateCustomStyleLayer(e)))return;o=t.createStyleLayer(e);}else {if(\"object\"==typeof e.source&&(this.addSource(a,e.source),e=t.clone$1(e),e=t.extend(e,{source:a})),this._validate(t.validateStyle.layer,`layers.${a}`,e,{arrayIndex:-1},s))return;o=t.createStyleLayer(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:a}});}const r=i?this._order.indexOf(i):this._order.length;if(i&&-1===r)this.fire(new t.ErrorEvent(new Error(`Cannot add layer \"${a}\" before non-existing layer \"${i}\".`)));else {if(this._order.splice(r,0,a),this._layerOrderChanged=!0,this._layers[a]=o,this._removedLayers[a]&&o.source&&\"custom\"!==o.type){const t=this._removedLayers[a];delete this._removedLayers[a],t.type!==o.type?this._updatedSources[o.source]=\"clear\":(this._updatedSources[o.source]=\"reload\",this.sourceCaches[o.source].pause());}this._updateLayer(o),o.onAdd&&o.onAdd(this.map);}}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const s=this._order.indexOf(e);this._order.splice(s,1);const a=i?this._order.indexOf(i):this._order.length;i&&-1===a?this.fire(new t.ErrorEvent(new Error(`Cannot move layer \"${e}\" before non-existing layer \"${i}\".`))):(this._order.splice(a,0,e),this._layerOrderChanged=!0);}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new t.ErrorEvent(new Error(`Cannot remove non-existing layer \"${e}\".`)));i.setEventedParent(null);const s=this._order.indexOf(e);this._order.splice(s,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map);}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(e,i,s){this._checkLoaded();const a=this.getLayer(e);a?a.minzoom===i&&a.maxzoom===s||(null!=i&&(a.minzoom=i),null!=s&&(a.maxzoom=s),this._updateLayer(a)):this.fire(new t.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer \"${e}\".`)));}setFilter(e,i,s={}){this._checkLoaded();const a=this.getLayer(e);if(a){if(!t.deepEqual(a.filter,i))return null==i?(a.filter=void 0,void this._updateLayer(a)):void(this._validate(t.validateStyle.filter,`layers.${a.id}.filter`,i,null,s)||(a.filter=t.clone$1(i),this._updateLayer(a)))}else this.fire(new t.ErrorEvent(new Error(`Cannot filter non-existing layer \"${e}\".`)));}getFilter(e){return t.clone$1(this.getLayer(e).filter)}setLayoutProperty(e,i,s,a={}){this._checkLoaded();const o=this.getLayer(e);o?t.deepEqual(o.getLayoutProperty(i),s)||(o.setLayoutProperty(i,s,a),this._updateLayer(o)):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer \"${e}\".`)));}getLayoutProperty(e,i){const s=this.getLayer(e);if(s)return s.getLayoutProperty(i);this.fire(new t.ErrorEvent(new Error(`Cannot get style of non-existing layer \"${e}\".`)));}setPaintProperty(e,i,s,a={}){this._checkLoaded();const o=this.getLayer(e);o?t.deepEqual(o.getPaintProperty(i),s)||(o.setPaintProperty(i,s,a)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error(`Cannot style non-existing layer \"${e}\".`)));}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(e,i){this._checkLoaded();const s=e.source,a=e.sourceLayer,o=this.sourceCaches[s];if(void 0===o)return void this.fire(new t.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)));const r=o.getSource().type;\"geojson\"===r&&a?this.fire(new t.ErrorEvent(new Error(\"GeoJSON sources cannot have a sourceLayer parameter.\"))):\"vector\"!==r||a?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error(\"The feature id parameter must be provided.\"))),o.setFeatureState(a,e.id,i)):this.fire(new t.ErrorEvent(new Error(\"The sourceLayer parameter must be provided for vector source types.\")));}removeFeatureState(e,i){this._checkLoaded();const s=e.source,a=this.sourceCaches[s];if(void 0===a)return void this.fire(new t.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)));const o=a.getSource().type,r=\"vector\"===o?e.sourceLayer:void 0;\"vector\"!==o||r?i&&\"string\"!=typeof e.id&&\"number\"!=typeof e.id?this.fire(new t.ErrorEvent(new Error(\"A feature id is required to remove its specific state property.\"))):a.removeFeatureState(r,e.id,i):this.fire(new t.ErrorEvent(new Error(\"The sourceLayer parameter must be provided for vector source types.\")));}getFeatureState(e){this._checkLoaded();const i=e.source,s=e.sourceLayer,a=this.sourceCaches[i];if(void 0!==a)return \"vector\"!==a.getSource().type||s?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error(\"The feature id parameter must be provided.\"))),a.getFeatureState(s,e.id)):void this.fire(new t.ErrorEvent(new Error(\"The sourceLayer parameter must be provided for vector source types.\")));this.fire(new t.ErrorEvent(new Error(`The source '${i}' does not exist in the map's style.`)));}getTransition(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const e=t.mapObject(this.sourceCaches,(t=>t.serialize())),i=this._serializeByIds(this._order),s=this.stylesheet;return t.filterObject({version:s.version,name:s.name,metadata:s.metadata,light:s.light,center:s.center,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch,sprite:s.sprite,glyphs:s.glyphs,transition:s.transition,sources:e,layers:i},(t=>void 0!==t))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&\"raster\"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]=\"reload\",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0;}_flattenAndSortRenderedFeatures(t){const e=t=>\"fill-extrusion\"===this._layers[t].type,i={},s=[];for(let a=this._order.length-1;a>=0;a--){const o=this._order[a];if(e(o)){i[o]=a;for(const e of t){const t=e[o];if(t)for(const e of t)s.push(e);}}}s.sort(((t,e)=>e.intersectionZ-t.intersectionZ));const a=[];for(let o=this._order.length-1;o>=0;o--){const r=this._order[o];if(e(r))for(let t=s.length-1;t>=0;t--){const e=s[t].feature;if(i[e.layer.id]<o)break;a.push(e),s.pop();}else for(const e of t){const t=e[r];if(t)for(const e of t)a.push(e.feature);}}return a}queryRenderedFeatures(e,i,s){i&&i.filter&&this._validate(t.validateStyle.filter,\"queryRenderedFeatures.filter\",i.filter,null,i);const a={};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new t.ErrorEvent(new Error(\"parameters.layers must be an Array.\"))),[];for(const e of i.layers){const i=this._layers[e];if(!i)return this.fire(new t.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];a[i.source]=!0;}}const o=[];i.availableImages=this._availableImages;const r=this._serializedAllLayers();for(const t in this.sourceCaches)i.layers&&!a[t]||o.push($(this.sourceCaches[t],this._layers,r,e,i,s));return this.placement&&o.push(function(t,e,i,s,a,o,r){const n={},l=o.queryRenderedSymbols(s),c=[];for(const t of Object.keys(l).map(Number))c.push(r[t]);c.sort(X);for(const i of c){const s=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],e,i.bucketIndex,i.sourceLayerIndex,a.filter,a.layers,a.availableImages,t);for(const t in s){const e=n[t]=n[t]||[],a=s[t];a.sort(((t,e)=>{const s=i.featureSortOrder;if(s){const i=s.indexOf(t.featureIndex);return s.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex}));for(const t of a)e.push(t);}}for(const e in n)n[e].forEach((s=>{const a=s.feature,o=i[t[e].source].getFeatureState(a.layer[\"source-layer\"],a.id);a.source=a.layer.source,a.layer[\"source-layer\"]&&(a.sourceLayer=a.layer[\"source-layer\"]),a.state=o;}));return n}(this._layers,r,this.sourceCaches,e,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,i){i&&i.filter&&this._validate(t.validateStyle.filter,\"querySourceFeatures.filter\",i.filter,null,i);const s=this.sourceCaches[e];return s?function(t,e){const i=t.getRenderableIds().map((e=>t.getTileByID(e))),s=[],a={};for(let t=0;t<i.length;t++){const o=i[t],r=o.tileID.canonical.key;a[r]||(a[r]=!0,o.querySourceFeatures(s,e));}return s}(s,i):[]}addSourceType(t,e,i){return ae.getSourceType(t)?i(new Error(`A source type called \"${t}\" already exists.`)):(ae.setSourceType(t,e),e.workerSourceURL?void this.dispatcher.broadcast(\"loadWorkerSource\",{name:t,url:e.workerSourceURL},i):i(null,null))}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();const s=this.light.getLight();let a=!1;for(const i in e)if(!t.deepEqual(e[i],s[i])){a=!0;break}if(!a)return;const o={now:t.exported.now(),transition:t.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(o);}_validate(e,i,s,a,o={}){return (!o||!1!==o.validate)&&te(this,e.call(t.validateStyle,t.extend({key:i,style:this.serialize(),value:s,styleSpec:t.v8Spec},a)))}_remove(e=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),t.evented.off(\"pluginStateChange\",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const e=this.sourceCaches[t];e.setEventedParent(null),e.onRemove(this.map);}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(e);}_clearSource(t){this.sourceCaches[t].clearTiles();}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload();}_updateSources(t){for(const e in this.sourceCaches)this.sourceCaches[e].update(t,this.map.terrain);}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t);}_updatePlacement(e,i,s,a,o=!1){let r=!1,n=!1;const l={};for(const t of this._order){const i=this._layers[t];if(\"symbol\"!==i.type)continue;if(!l[i.source]){const t=this.sourceCaches[i.source];l[i.source]=t.getRenderableIds(!0).map((e=>t.getTileByID(e))).sort(((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)));}const s=this.crossTileSymbolIndex.addLayer(i,l[i.source],e.center.lng);r=r||s;}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((o=o||this._layerOrderChanged||0===s)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.exported.now(),e.zoom))&&(this.pauseablePlacement=new Wt(e,this.map.terrain,this._order,o,i,s,a,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(t.exported.now()),n=!0),r&&this.pauseablePlacement.placement.setStale()),n||r)for(const t of this._order){const e=this._layers[t];\"symbol\"===e.type&&this.placement.updateLayerOpacities(e,l[e.source]);}return !this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles();}getImages(t,e,i){this.imageManager.getImages(e.icons,i),this._updateTilesForChangedImages();const s=this.sourceCaches[e.source];s&&s.setDependencies(e.tileID.key,e.type,e.icons);}getGlyphs(t,e,i){this.glyphManager.getGlyphs(e.stacks,i);const s=this.sourceCaches[e.source];s&&s.setDependencies(e.tileID.key,e.type,[\"\"]);}getResource(e,i,s){return t.makeRequest(i,s)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,i={}){this._checkLoaded(),e&&this._validate(t.validateStyle.glyphs,\"glyphs\",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e));}addSprite(e,i,s={},a){this._checkLoaded();const o=[{id:e,url:i}],r=[...v(this.stylesheet.sprite),...o];this._validate(t.validateStyle.sprite,\"sprite\",r,null,s)||(this.stylesheet.sprite=r,this._loadSprite(o,!0,a));}removeSprite(e){this._checkLoaded();const i=v(this.stylesheet.sprite);if(i.find((t=>t.id===e))){if(this._spritesImagesIds[e])for(const t of this._spritesImagesIds[e])this.imageManager.removeImage(t),this._changedImages[t]=!0;i.splice(i.findIndex((t=>t.id===e)),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast(\"setImages\",this._availableImages),this.fire(new t.Event(\"data\",{dataType:\"style\"}));}else this.fire(new t.ErrorEvent(new Error(`Sprite \"${e}\" doesn't exists on this map.`)));}getSprite(){return v(this.stylesheet.sprite)}setSprite(e,i={},s){this._checkLoaded(),e&&this._validate(t.validateStyle.sprite,\"sprite\",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,s):(this._unloadSprite(),s&&s(null)));}}ae.getSourceType=function(t){return q[t]},ae.setSourceType=function(t,e){q[t]=e;},ae.registerForPluginStateChange=t.registerForPluginStateChange;var oe=t.createLayout([{name:\"a_pos\",type:\"Int16\",components:2}]),re=\"attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}\";const ne={prelude:le(\"#ifdef GL_ES\\nprecision mediump float;\\n#else\\n#if !defined(lowp)\\n#define lowp\\n#endif\\n#if !defined(mediump)\\n#define mediump\\n#endif\\n#if !defined(highp)\\n#define highp\\n#endif\\n#endif\\n\",\"#ifdef GL_ES\\nprecision highp float;\\n#else\\n#if !defined(lowp)\\n#define lowp\\n#endif\\n#if !defined(mediump)\\n#define mediump\\n#endif\\n#if !defined(highp)\\n#define highp\\n#endif\\n#endif\\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}\\n#ifdef TERRAIN3D\\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\\n#endif\\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\\n#ifdef TERRAIN3D\\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\\n#else\\nreturn 1.0;\\n#endif\\n}float calculate_visibility(vec4 pos) {\\n#ifdef TERRAIN3D\\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\\n#else\\nreturn 1.0;\\n#endif\\n}float ele(vec2 pos) {\\n#ifdef TERRAIN3D\\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\\n#else\\nreturn 0.0;\\n#endif\\n}float get_elevation(vec2 pos) {\\n#ifdef TERRAIN3D\\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\\n#else\\nreturn 0.0;\\n#endif\\n}\"),background:le(\"uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}\"),backgroundPattern:le(\"uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}\"),circle:le(\"varying vec3 v_data;varying float v_visibility;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define mediump float radius\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define highp vec4 stroke_color\\n#pragma mapbox: define mediump float stroke_width\\n#pragma mapbox: define lowp float stroke_opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize mediump float radius\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize highp vec4 stroke_color\\n#pragma mapbox: initialize mediump float stroke_width\\n#pragma mapbox: initialize lowp float stroke_opacity\\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define mediump float radius\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define highp vec4 stroke_color\\n#pragma mapbox: define mediump float stroke_width\\n#pragma mapbox: define lowp float stroke_opacity\\nvoid main(void) {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize mediump float radius\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize highp vec4 stroke_color\\n#pragma mapbox: initialize mediump float stroke_width\\n#pragma mapbox: initialize lowp float stroke_opacity\\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}\"),clippingMask:le(\"void main() {gl_FragColor=vec4(1.0);}\",\"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}\"),heatmap:le(\"uniform highp float u_intensity;varying vec2 v_extrude;\\n#pragma mapbox: define highp float weight\\n#define GAUSS_COEF 0.3989422804014327\\nvoid main() {\\n#pragma mapbox: initialize highp float weight\\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\\n#pragma mapbox: define highp float weight\\n#pragma mapbox: define mediump float radius\\nconst highp float ZERO=1.0/255.0/16.0;\\n#define GAUSS_COEF 0.3989422804014327\\nvoid main(void) {\\n#pragma mapbox: initialize highp float weight\\n#pragma mapbox: initialize mediump float radius\\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}\"),heatmapTexture:le(\"uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(0.0);\\n#endif\\n}\",\"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}\"),collisionBox:le(\"varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}\",\"attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}\"),collisionCircle:le(\"varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}\",\"attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd  =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz  /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}\"),debug:le(\"uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}\",\"attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}\"),fill:le(\"#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float opacity\\ngl_FragColor=color*opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"attribute vec2 a_pos;uniform mat4 u_matrix;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float opacity\\ngl_Position=u_matrix*vec4(a_pos,0,1);}\"),fillOutline:le(\"varying vec2 v_pos;\\n#pragma mapbox: define highp vec4 outline_color\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 outline_color\\n#pragma mapbox: initialize lowp float opacity\\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\\n#pragma mapbox: define highp vec4 outline_color\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 outline_color\\n#pragma mapbox: initialize lowp float opacity\\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}\"),fillOutlinePattern:le(\"uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\n#pragma mapbox: define lowp float pixel_ratio_from\\n#pragma mapbox: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\n#pragma mapbox: initialize lowp float pixel_ratio_from\\n#pragma mapbox: initialize lowp float pixel_ratio_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}\"),fillPattern:le(\"#ifdef GL_ES\\nprecision highp float;\\n#endif\\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\n#pragma mapbox: define lowp float pixel_ratio_from\\n#pragma mapbox: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\n#pragma mapbox: initialize lowp float pixel_ratio_from\\n#pragma mapbox: initialize lowp float pixel_ratio_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}\"),fillExtrusion:le(\"varying vec4 v_color;void main() {gl_FragColor=v_color;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\\n#ifdef TERRAIN3D\\nattribute vec2 a_centroid;\\n#endif\\nvarying vec4 v_color;\\n#pragma mapbox: define highp float base\\n#pragma mapbox: define highp float height\\n#pragma mapbox: define highp vec4 color\\nvoid main() {\\n#pragma mapbox: initialize highp float base\\n#pragma mapbox: initialize highp float height\\n#pragma mapbox: initialize highp vec4 color\\nvec3 normal=a_normal_ed.xyz;\\n#ifdef TERRAIN3D\\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\\n#else\\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\\n#endif\\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}\"),fillExtrusionPattern:le(\"uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\\n#pragma mapbox: define lowp float base\\n#pragma mapbox: define lowp float height\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\n#pragma mapbox: define lowp float pixel_ratio_from\\n#pragma mapbox: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float base\\n#pragma mapbox: initialize lowp float height\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\n#pragma mapbox: initialize lowp float pixel_ratio_from\\n#pragma mapbox: initialize lowp float pixel_ratio_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\\n#ifdef TERRAIN3D\\nattribute vec2 a_centroid;\\n#endif\\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\\n#pragma mapbox: define lowp float base\\n#pragma mapbox: define lowp float height\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\n#pragma mapbox: define lowp float pixel_ratio_from\\n#pragma mapbox: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float base\\n#pragma mapbox: initialize lowp float height\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\n#pragma mapbox: initialize lowp float pixel_ratio_from\\n#pragma mapbox: initialize lowp float pixel_ratio_to\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\\n#ifdef TERRAIN3D\\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\\n#else\\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\\n#endif\\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\\n? a_pos\\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}\"),hillshadePrepare:le(\"#ifdef GL_ES\\nprecision highp float;\\n#endif\\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}\"),hillshade:le(\"uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\\n#define PI 3.141592653589793\\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}\"),line:le(\"uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"\\n#define scale 0.015873016\\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define mediump float gapwidth\\n#pragma mapbox: define lowp float offset\\n#pragma mapbox: define mediump float width\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump float gapwidth\\n#pragma mapbox: initialize lowp float offset\\n#pragma mapbox: initialize mediump float width\\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\\n#ifdef TERRAIN3D\\nv_gamma_scale=1.0;\\n#else\\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\\n#endif\\nv_width2=vec2(outset,inset);}\"),lineGradient:le(\"uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"\\n#define scale 0.015873016\\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define mediump float gapwidth\\n#pragma mapbox: define lowp float offset\\n#pragma mapbox: define mediump float width\\nvoid main() {\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump float gapwidth\\n#pragma mapbox: initialize lowp float offset\\n#pragma mapbox: initialize mediump float width\\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\\n#ifdef TERRAIN3D\\nv_gamma_scale=1.0;\\n#else\\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\\n#endif\\nv_width2=vec2(outset,inset);}\"),linePattern:le(\"#ifdef GL_ES\\nprecision highp float;\\n#endif\\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\n#pragma mapbox: define lowp float pixel_ratio_from\\n#pragma mapbox: define lowp float pixel_ratio_to\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\n#pragma mapbox: initialize lowp float pixel_ratio_from\\n#pragma mapbox: initialize lowp float pixel_ratio_to\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"\\n#define scale 0.015873016\\n#define LINE_DISTANCE_SCALE 2.0\\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float offset\\n#pragma mapbox: define mediump float gapwidth\\n#pragma mapbox: define mediump float width\\n#pragma mapbox: define lowp float floorwidth\\n#pragma mapbox: define lowp vec4 pattern_from\\n#pragma mapbox: define lowp vec4 pattern_to\\n#pragma mapbox: define lowp float pixel_ratio_from\\n#pragma mapbox: define lowp float pixel_ratio_to\\nvoid main() {\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float offset\\n#pragma mapbox: initialize mediump float gapwidth\\n#pragma mapbox: initialize mediump float width\\n#pragma mapbox: initialize lowp float floorwidth\\n#pragma mapbox: initialize mediump vec4 pattern_from\\n#pragma mapbox: initialize mediump vec4 pattern_to\\n#pragma mapbox: initialize lowp float pixel_ratio_from\\n#pragma mapbox: initialize lowp float pixel_ratio_to\\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\\n#ifdef TERRAIN3D\\nv_gamma_scale=1.0;\\n#else\\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\\n#endif\\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}\"),lineSDF:le(\"uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define mediump float width\\n#pragma mapbox: define lowp float floorwidth\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump float width\\n#pragma mapbox: initialize lowp float floorwidth\\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"\\n#define scale 0.015873016\\n#define LINE_DISTANCE_SCALE 2.0\\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\\n#pragma mapbox: define highp vec4 color\\n#pragma mapbox: define lowp float blur\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define mediump float gapwidth\\n#pragma mapbox: define lowp float offset\\n#pragma mapbox: define mediump float width\\n#pragma mapbox: define lowp float floorwidth\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 color\\n#pragma mapbox: initialize lowp float blur\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize mediump float gapwidth\\n#pragma mapbox: initialize lowp float offset\\n#pragma mapbox: initialize mediump float width\\n#pragma mapbox: initialize lowp float floorwidth\\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\\n#ifdef TERRAIN3D\\nv_gamma_scale=1.0;\\n#else\\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\\n#endif\\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}\"),raster:le(\"uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}\"),symbolIcon:le(\"uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\\ncamera_to_anchor_distance/u_camera_to_center_distance :\\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}\"),symbolSDF:le(\"#define SDF_PX 8.0\\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\\n#pragma mapbox: define highp vec4 fill_color\\n#pragma mapbox: define highp vec4 halo_color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float halo_width\\n#pragma mapbox: define lowp float halo_blur\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 fill_color\\n#pragma mapbox: initialize highp vec4 halo_color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float halo_width\\n#pragma mapbox: initialize lowp float halo_blur\\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\\n#pragma mapbox: define highp vec4 fill_color\\n#pragma mapbox: define highp vec4 halo_color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float halo_width\\n#pragma mapbox: define lowp float halo_blur\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 fill_color\\n#pragma mapbox: initialize highp vec4 halo_color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float halo_width\\n#pragma mapbox: initialize lowp float halo_blur\\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\\ncamera_to_anchor_distance/u_camera_to_center_distance :\\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}\"),symbolTextAndIcon:le(\"#define SDF_PX 8.0\\n#define SDF 1.0\\n#define ICON 0.0\\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\\n#pragma mapbox: define highp vec4 fill_color\\n#pragma mapbox: define highp vec4 halo_color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float halo_width\\n#pragma mapbox: define lowp float halo_blur\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 fill_color\\n#pragma mapbox: initialize highp vec4 halo_color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float halo_width\\n#pragma mapbox: initialize lowp float halo_blur\\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\\n#pragma mapbox: define highp vec4 fill_color\\n#pragma mapbox: define highp vec4 halo_color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float halo_width\\n#pragma mapbox: define lowp float halo_blur\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 fill_color\\n#pragma mapbox: initialize highp vec4 halo_color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float halo_width\\n#pragma mapbox: initialize lowp float halo_blur\\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\\ncamera_to_anchor_distance/u_camera_to_center_distance :\\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}\"),terrain:le(\"uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}\",re),terrainDepth:le(\"varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}\",re),terrainCoords:le(\"precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}\",re)};function le(t,e){const i=/#pragma mapbox: ([\\w]+) ([\\w]+) ([\\w]+) ([\\w]+)/g,s=e.match(/attribute ([\\w]+) ([\\w]+)/g),a=t.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g),o=e.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g),r=o?o.concat(a):a,n={};return {fragmentSource:t=t.replace(i,((t,e,i,s,a)=>(n[a]=!0,\"define\"===e?`\\n#ifndef HAS_UNIFORM_u_${a}\\nvarying ${i} ${s} ${a};\\n#else\\nuniform ${i} ${s} u_${a};\\n#endif\\n`:`\\n#ifdef HAS_UNIFORM_u_${a}\\n    ${i} ${s} ${a} = u_${a};\\n#endif\\n`))),vertexSource:e=e.replace(i,((t,e,i,s,a)=>{const o=\"float\"===s?\"vec2\":\"vec4\",r=a.match(/color/)?\"color\":o;return n[a]?\"define\"===e?`\\n#ifndef HAS_UNIFORM_u_${a}\\nuniform lowp float u_${a}_t;\\nattribute ${i} ${o} a_${a};\\nvarying ${i} ${s} ${a};\\n#else\\nuniform ${i} ${s} u_${a};\\n#endif\\n`:\"vec4\"===r?`\\n#ifndef HAS_UNIFORM_u_${a}\\n    ${a} = a_${a};\\n#else\\n    ${i} ${s} ${a} = u_${a};\\n#endif\\n`:`\\n#ifndef HAS_UNIFORM_u_${a}\\n    ${a} = unpack_mix_${r}(a_${a}, u_${a}_t);\\n#else\\n    ${i} ${s} ${a} = u_${a};\\n#endif\\n`:\"define\"===e?`\\n#ifndef HAS_UNIFORM_u_${a}\\nuniform lowp float u_${a}_t;\\nattribute ${i} ${o} a_${a};\\n#else\\nuniform ${i} ${s} u_${a};\\n#endif\\n`:\"vec4\"===r?`\\n#ifndef HAS_UNIFORM_u_${a}\\n    ${i} ${s} ${a} = a_${a};\\n#else\\n    ${i} ${s} ${a} = u_${a};\\n#endif\\n`:`\\n#ifndef HAS_UNIFORM_u_${a}\\n    ${i} ${s} ${a} = unpack_mix_${r}(a_${a}, u_${a}_t);\\n#else\\n    ${i} ${s} ${a} = u_${a};\\n#endif\\n`})),staticAttributes:s,staticUniforms:r}}class ce{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null;}bind(t,e,i,s,a,o,r,n,l){this.context=t;let c=this.boundPaintVertexBuffers.length!==s.length;for(let t=0;!c&&t<s.length;t++)this.boundPaintVertexBuffers[t]!==s[t]&&(c=!0);!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==i||c||this.boundIndexBuffer!==a||this.boundVertexOffset!==o||this.boundDynamicVertexBuffer!==r||this.boundDynamicVertexBuffer2!==n||this.boundDynamicVertexBuffer3!==l?this.freshBind(e,i,s,a,o,r,n,l):(t.bindVertexArray.set(this.vao),r&&r.bind(),a&&a.dynamicDraw&&a.bind(),n&&n.bind(),l&&l.bind());}freshBind(t,e,i,s,a,o,r,n){const l=t.numAttributes,c=this.context,h=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=s,this.boundVertexOffset=a,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=r,this.boundDynamicVertexBuffer3=n,e.enableAttributes(h,t);for(const e of i)e.enableAttributes(h,t);o&&o.enableAttributes(h,t),r&&r.enableAttributes(h,t),n&&n.enableAttributes(h,t),e.bind(),e.setVertexAttribPointers(h,t,a);for(const e of i)e.bind(),e.setVertexAttribPointers(h,t,a);o&&(o.bind(),o.setVertexAttribPointers(h,t,a)),s&&s.bind(),r&&(r.bind(),r.setVertexAttribPointers(h,t,a)),n&&(n.bind(),n.setVertexAttribPointers(h,t,a)),c.currentNumAttributes=l;}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null);}}function he(t){const e=[];for(let i=0;i<t.length;i++){if(null===t[i])continue;const s=t[i].split(\" \");e.push(s.pop());}return e}class ue{constructor(e,i,s,a,o,r,n){const l=e.gl;this.program=l.createProgram();const c=he(s.staticAttributes),h=a?a.getBinderAttributes():[],u=c.concat(h),d=ne.prelude.staticUniforms?he(ne.prelude.staticUniforms):[],_=s.staticUniforms?he(s.staticUniforms):[],m=a?a.getBinderUniforms():[],p=d.concat(_).concat(m),f=[];for(const t of p)f.indexOf(t)<0&&f.push(t);const g=a?a.defines():[];r&&g.push(\"#define OVERDRAW_INSPECTOR;\"),n&&g.push(\"#define TERRAIN3D;\");const v=g.concat(ne.prelude.fragmentSource,s.fragmentSource).join(\"\\n\"),x=g.concat(ne.prelude.vertexSource,s.vertexSource).join(\"\\n\"),y=l.createShader(l.FRAGMENT_SHADER);if(l.isContextLost())return void(this.failedToCreate=!0);l.shaderSource(y,v),l.compileShader(y),l.attachShader(this.program,y);const b=l.createShader(l.VERTEX_SHADER);if(l.isContextLost())return void(this.failedToCreate=!0);l.shaderSource(b,x),l.compileShader(b),l.attachShader(this.program,b),this.attributes={};const w={};this.numAttributes=u.length;for(let t=0;t<this.numAttributes;t++)u[t]&&(l.bindAttribLocation(this.program,t,u[t]),this.attributes[u[t]]=t);l.linkProgram(this.program),l.deleteShader(b),l.deleteShader(y);for(let t=0;t<f.length;t++){const e=f[t];if(e&&!w[e]){const t=l.getUniformLocation(this.program,e);t&&(w[e]=t);}}this.fixedUniforms=o(e,w),this.terrainUniforms=((e,i)=>({u_depth:new t.Uniform1i(e,i.u_depth),u_terrain:new t.Uniform1i(e,i.u_terrain),u_terrain_dim:new t.Uniform1f(e,i.u_terrain_dim),u_terrain_matrix:new t.UniformMatrix4f(e,i.u_terrain_matrix),u_terrain_unpack:new t.Uniform4f(e,i.u_terrain_unpack),u_terrain_exaggeration:new t.Uniform1f(e,i.u_terrain_exaggeration)}))(e,w),this.binderUniforms=a?a.getUniforms(e,w):[];}draw(t,e,i,s,a,o,r,n,l,c,h,u,d,_,m,p,f,g){const v=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(s),t.setColorMode(a),t.setCullFace(o),n){t.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,n.depthTexture),t.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,n.texture);for(const t in this.terrainUniforms)this.terrainUniforms[t].set(n[t]);}for(const t in this.fixedUniforms)this.fixedUniforms[t].set(r[t]);m&&m.setUniforms(t,this.binderUniforms,d,{zoom:_});let x=0;switch(e){case v.LINES:x=2;break;case v.TRIANGLES:x=3;break;case v.LINE_STRIP:x=1;}for(const i of u.get()){const s=i.vaos||(i.vaos={});(s[l]||(s[l]=new ce)).bind(t,this,c,m?m.getPaintVertexBuffers():[],h,i.vertexOffset,p,f,g),v.drawElements(e,i.primitiveLength*x,v.UNSIGNED_SHORT,i.primitiveOffset*x*2);}}}function de(t,e,i){const s=1/Ct(i,1,e.transform.tileZoom),a=Math.pow(2,i.tileID.overscaledZ),o=i.tileSize*Math.pow(2,e.transform.tileZoom)/a,r=o*(i.tileID.canonical.x+i.tileID.wrap*a),n=o*i.tileID.canonical.y;return {u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[s,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[r>>16,n>>16],u_pixel_coord_lower:[65535&r,65535&n]}}const _e=(e,i,s,a)=>{const o=i.style.light,r=o.properties.get(\"position\"),n=[r.x,r.y,r.z],l=function(){var e=new t.ARRAY_TYPE(9);return t.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}();\"viewport\"===o.properties.get(\"anchor\")&&function(t,e){var i=Math.sin(e),s=Math.cos(e);t[0]=s,t[1]=i,t[2]=0,t[3]=-i,t[4]=s,t[5]=0,t[6]=0,t[7]=0,t[8]=1;}(l,-i.transform.angle),function(t,e,i){var s=e[0],a=e[1],o=e[2];t[0]=s*i[0]+a*i[3]+o*i[6],t[1]=s*i[1]+a*i[4]+o*i[7],t[2]=s*i[2]+a*i[5]+o*i[8];}(n,n,l);const c=o.properties.get(\"color\");return {u_matrix:e,u_lightpos:n,u_lightintensity:o.properties.get(\"intensity\"),u_lightcolor:[c.r,c.g,c.b],u_vertical_gradient:+s,u_opacity:a}},me=(e,i,s,a,o,r,n)=>t.extend(_e(e,i,s,a),de(r,i,n),{u_height_factor:-Math.pow(2,o.overscaledZ)/n.tileSize/8}),pe=t=>({u_matrix:t}),fe=(e,i,s,a)=>t.extend(pe(e),de(s,i,a)),ge=(t,e)=>({u_matrix:t,u_world:e}),ve=(e,i,s,a,o)=>t.extend(fe(e,i,s,a),{u_world:o}),xe=(t,e,i,s)=>{const a=t.transform;let o,r;if(\"map\"===s.paint.get(\"circle-pitch-alignment\")){const t=Ct(i,1,a.zoom);o=!0,r=[t,t];}else o=!1,r=a.pixelsToGLUnits;return {u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+(\"map\"===s.paint.get(\"circle-pitch-scale\")),u_matrix:t.translatePosMatrix(e.posMatrix,i,s.paint.get(\"circle-translate\"),s.paint.get(\"circle-translate-anchor\")),u_pitch_with_map:+o,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:r}},ye=(t,e,i)=>{const s=Ct(i,1,e.zoom),a=Math.pow(2,e.zoom-i.tileID.overscaledZ),o=i.tileID.overscaleFactor();return {u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:s,u_extrude_scale:[e.pixelsToGLUnits[0]/(s*a),e.pixelsToGLUnits[1]/(s*a)],u_overscale_factor:o}},be=(t,e,i=1)=>({u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:i}),we=t=>({u_matrix:t}),Te=(t,e,i,s)=>({u_matrix:t,u_extrude_scale:Ct(e,1,i),u_intensity:s});function Ee(e,i){const s=Math.pow(2,i.canonical.z),a=i.canonical.y;return [new t.MercatorCoordinate(0,a/s).toLngLat().lat,new t.MercatorCoordinate(0,(a+1)/s).toLngLat().lat]}const Ie=(t,e,i,s)=>{const a=t.transform;return {u_matrix:ze(t,e,i,s),u_ratio:1/Ct(e,1,a.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},Se=(e,i,s,a,o)=>t.extend(Ie(e,i,s,o),{u_image:0,u_image_height:a}),Ce=(t,e,i,s,a)=>{const o=t.transform,r=De(e,o);return {u_matrix:ze(t,e,i,a),u_texsize:e.imageAtlasTexture.size,u_ratio:1/Ct(e,1,o.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[r,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Pe=(e,i,s,a,o,r)=>{const n=e.lineAtlas,l=De(i,e.transform),c=\"round\"===s.layout.get(\"line-cap\"),h=n.getDash(a.from,c),u=n.getDash(a.to,c),d=h.width*o.fromScale,_=u.width*o.toScale;return t.extend(Ie(e,i,s,r),{u_patternscale_a:[l/d,-h.height/2],u_patternscale_b:[l/_,-u.height/2],u_sdfgamma:n.width/(256*Math.min(d,_)*e.pixelRatio)/2,u_image:0,u_tex_y_a:h.y,u_tex_y_b:u.y,u_mix:o.t})};function De(t,e){return 1/Ct(t,1,e.tileZoom)}function ze(t,e,i,s){return t.translatePosMatrix(s?s.posMatrix:e.tileID.posMatrix,e,i.paint.get(\"line-translate\"),i.paint.get(\"line-translate-anchor\"))}const Me=(t,e,i,s,a)=>{return {u_matrix:t,u_tl_parent:e,u_scale_parent:i,u_buffer_scale:1,u_fade_t:s.mix,u_opacity:s.opacity*a.paint.get(\"raster-opacity\"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get(\"raster-brightness-min\"),u_brightness_high:a.paint.get(\"raster-brightness-max\"),u_saturation_factor:(r=a.paint.get(\"raster-saturation\"),r>0?1-1/(1.001-r):-r),u_contrast_factor:(o=a.paint.get(\"raster-contrast\"),o>0?1/(1-o):1+o),u_spin_weights:Ae(a.paint.get(\"raster-hue-rotate\"))};var o,r;};function Ae(t){t*=Math.PI/180;const e=Math.sin(t),i=Math.cos(t);return [(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const Le=(t,e,i,s,a,o,r,n,l,c)=>{const h=a.transform;return {u_is_size_zoom_constant:+(\"constant\"===t||\"source\"===t),u_is_size_feature_constant:+(\"constant\"===t||\"camera\"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:h.cameraToCenterDistance,u_pitch:h.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:h.width/h.height,u_fade_change:a.options.fadeDuration?a.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:r,u_coord_matrix:n,u_is_text:+l,u_pitch_with_map:+s,u_texsize:c,u_texture:0}},Re=(e,i,s,a,o,r,n,l,c,h,u)=>{const d=o.transform;return t.extend(Le(e,i,s,a,o,r,n,l,c,h),{u_gamma_scale:a?Math.cos(d._pitch)*d.cameraToCenterDistance:1,u_device_pixel_ratio:o.pixelRatio,u_is_halo:+u})},ke=(e,i,s,a,o,r,n,l,c,h)=>t.extend(Re(e,i,s,a,o,r,n,l,!0,c,!0),{u_texsize_icon:h,u_texture_icon:1}),Be=(t,e,i)=>({u_matrix:t,u_opacity:e,u_color:i}),Fe=(e,i,s,a,o,r)=>t.extend(function(t,e,i,s){const a=i.imageManager.getPattern(t.from.toString()),o=i.imageManager.getPattern(t.to.toString()),{width:r,height:n}=i.imageManager.getPixelSize(),l=Math.pow(2,s.tileID.overscaledZ),c=s.tileSize*Math.pow(2,i.transform.tileZoom)/l,h=c*(s.tileID.canonical.x+s.tileID.wrap*l),u=c*s.tileID.canonical.y;return {u_image:0,u_pattern_tl_a:a.tl,u_pattern_br_a:a.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[r,n],u_mix:e.t,u_pattern_size_a:a.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/Ct(s,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,u>>16],u_pixel_coord_lower:[65535&h,65535&u]}}(a,r,s,o),{u_matrix:e,u_opacity:i}),Ue={fillExtrusion:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fillExtrusionPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_lightpos:new t.Uniform3f(e,i.u_lightpos),u_lightintensity:new t.Uniform1f(e,i.u_lightintensity),u_lightcolor:new t.Uniform3f(e,i.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,i.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,i.u_height_factor),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade),u_opacity:new t.Uniform1f(e,i.u_opacity)}),fill:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),fillPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),fillOutline:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world)}),fillOutlinePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_texsize:new t.Uniform2f(e,i.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),circle:(e,i)=>({u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,i.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),collisionBox:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,i.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,i.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,i.u_overscale_factor)}),collisionCircle:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,i.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,i.u_viewport_size)}),debug:(e,i)=>({u_color:new t.UniformColor(e,i.u_color),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_overlay:new t.Uniform1i(e,i.u_overlay),u_overlay_scale:new t.Uniform1f(e,i.u_overlay_scale)}),clippingMask:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmap:(e,i)=>({u_extrude_scale:new t.Uniform1f(e,i.u_extrude_scale),u_intensity:new t.Uniform1f(e,i.u_intensity),u_matrix:new t.UniformMatrix4f(e,i.u_matrix)}),heatmapTexture:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_world:new t.Uniform2f(e,i.u_world),u_image:new t.Uniform1i(e,i.u_image),u_color_ramp:new t.Uniform1i(e,i.u_color_ramp),u_opacity:new t.Uniform1f(e,i.u_opacity)}),hillshade:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_latrange:new t.Uniform2f(e,i.u_latrange),u_light:new t.Uniform2f(e,i.u_light),u_shadow:new t.UniformColor(e,i.u_shadow),u_highlight:new t.UniformColor(e,i.u_highlight),u_accent:new t.UniformColor(e,i.u_accent)}),hillshadePrepare:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_image:new t.Uniform1i(e,i.u_image),u_dimension:new t.Uniform2f(e,i.u_dimension),u_zoom:new t.Uniform1f(e,i.u_zoom),u_unpack:new t.Uniform4f(e,i.u_unpack)}),line:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels)}),lineGradient:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_image:new t.Uniform1i(e,i.u_image),u_image_height:new t.Uniform1f(e,i.u_image_height)}),linePattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texsize:new t.Uniform2f(e,i.u_texsize),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_image:new t.Uniform1i(e,i.u_image),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_scale:new t.Uniform3f(e,i.u_scale),u_fade:new t.Uniform1f(e,i.u_fade)}),lineSDF:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ratio:new t.Uniform1f(e,i.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,i.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,i.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,i.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,i.u_sdfgamma),u_image:new t.Uniform1i(e,i.u_image),u_tex_y_a:new t.Uniform1f(e,i.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,i.u_tex_y_b),u_mix:new t.Uniform1f(e,i.u_mix)}),raster:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_tl_parent:new t.Uniform2f(e,i.u_tl_parent),u_scale_parent:new t.Uniform1f(e,i.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,i.u_buffer_scale),u_fade_t:new t.Uniform1f(e,i.u_fade_t),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image0:new t.Uniform1i(e,i.u_image0),u_image1:new t.Uniform1i(e,i.u_image1),u_brightness_low:new t.Uniform1f(e,i.u_brightness_low),u_brightness_high:new t.Uniform1f(e,i.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,i.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,i.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,i.u_spin_weights)}),symbolIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture)}),symbolSDF:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texture:new t.Uniform1i(e,i.u_texture),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),symbolTextAndIcon:(e,i)=>({u_is_size_zoom_constant:new t.Uniform1i(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,i.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,i.u_size_t),u_size:new t.Uniform1f(e,i.u_size),u_camera_to_center_distance:new t.Uniform1f(e,i.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,i.u_pitch),u_rotate_symbol:new t.Uniform1i(e,i.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,i.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,i.u_fade_change),u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,i.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,i.u_coord_matrix),u_is_text:new t.Uniform1i(e,i.u_is_text),u_pitch_with_map:new t.Uniform1i(e,i.u_pitch_with_map),u_texsize:new t.Uniform2f(e,i.u_texsize),u_texsize_icon:new t.Uniform2f(e,i.u_texsize_icon),u_texture:new t.Uniform1i(e,i.u_texture),u_texture_icon:new t.Uniform1i(e,i.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,i.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,i.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,i.u_is_halo)}),background:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_color:new t.UniformColor(e,i.u_color)}),backgroundPattern:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_opacity:new t.Uniform1f(e,i.u_opacity),u_image:new t.Uniform1i(e,i.u_image),u_pattern_tl_a:new t.Uniform2f(e,i.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,i.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,i.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,i.u_pattern_br_b),u_texsize:new t.Uniform2f(e,i.u_texsize),u_mix:new t.Uniform1f(e,i.u_mix),u_pattern_size_a:new t.Uniform2f(e,i.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,i.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,i.u_scale_a),u_scale_b:new t.Uniform1f(e,i.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,i.u_tile_units_to_pixels)}),terrain:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texture:new t.Uniform1i(e,i.u_texture),u_ele_delta:new t.Uniform1f(e,i.u_ele_delta)}),terrainDepth:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_ele_delta:new t.Uniform1f(e,i.u_ele_delta)}),terrainCoords:(e,i)=>({u_matrix:new t.UniformMatrix4f(e,i.u_matrix),u_texture:new t.Uniform1i(e,i.u_texture),u_terrain_coords_id:new t.Uniform1f(e,i.u_terrain_coords_id),u_ele_delta:new t.Uniform1f(e,i.u_ele_delta)})};class Oe{constructor(t,e,i){this.context=t;const s=t.gl;this.buffer=s.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),s.bufferData(s.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?s.DYNAMIC_DRAW:s.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer;}bind(){this.context.bindElementBuffer.set(this.buffer);}updateData(t){const e=this.context.gl;if(!this.dynamicDraw)throw new Error(\"Attempted to update data while not in dynamic mode.\");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer);}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer);}}const Ne={Int8:\"BYTE\",Uint8:\"UNSIGNED_BYTE\",Int16:\"SHORT\",Uint16:\"UNSIGNED_SHORT\",Int32:\"INT\",Uint32:\"UNSIGNED_INT\",Float32:\"FLOAT\"};class Ge{constructor(t,e,i,s){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=s,this.context=t;const a=t.gl;this.buffer=a.createBuffer(),t.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer;}bind(){this.context.bindVertexBuffer.set(this.buffer);}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer);}enableAttributes(t,e){for(let i=0;i<this.attributes.length;i++){const s=e.attributes[this.attributes[i].name];void 0!==s&&t.enableVertexAttribArray(s);}}setVertexAttribPointers(t,e,i){for(let s=0;s<this.attributes.length;s++){const a=this.attributes[s],o=e.attributes[a.name];void 0!==o&&t.vertexAttribPointer(o,a.components,t[Ne[a.type]],!1,this.itemSize,a.offset+this.itemSize*(i||0));}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer);}}const Ze=new WeakMap;function Ve(t){if(Ze.has(t))return Ze.get(t);{const e=t.getParameter(t.VERSION).startsWith(\"WebGL 2.0\");return Ze.set(t,e),e}}class qe{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1;}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default);}}class je extends qe{getDefault(){return t.Color.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1);}}class $e extends qe{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1);}}class Xe extends qe{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1);}}class We extends qe{getDefault(){return [!0,!0,!0,!0]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1);}}class He extends qe{getDefault(){return !0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1);}}class Ke extends qe{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1);}}class Ye extends qe{getDefault(){return {func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1);}}class Je extends qe{getDefault(){const t=this.gl;return [t.KEEP,t.KEEP,t.KEEP]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1);}}class Qe extends qe{getDefault(){return !1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1;}}class ti extends qe{getDefault(){return [0,1]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1);}}class ei extends qe{getDefault(){return !1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1;}}class ii extends qe{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1);}}class si extends qe{getDefault(){return !1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1;}}class ai extends qe{getDefault(){const t=this.gl;return [t.ONE,t.ZERO]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1);}}class oi extends qe{getDefault(){return t.Color.transparent}set(t){const e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1);}}class ri extends qe{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1);}}class ni extends qe{getDefault(){return !1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1;}}class li extends qe{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1);}}class ci extends qe{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1);}}class hi extends qe{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1);}}class ui extends qe{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1);}}class di extends qe{getDefault(){const t=this.gl;return [0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1);}}class _i extends qe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1;}}class mi extends qe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1;}}class pi extends qe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1;}}class fi extends qe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1;}}class gi extends qe{getDefault(){return null}set(t){const e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1;}}class vi extends qe{getDefault(){return null}set(t){var e;if(t===this.current&&!this.dirty)return;const i=this.gl;Ve(i)?i.bindVertexArray(t):null===(e=i.getExtension(\"OES_vertex_array_object\"))||void 0===e||e.bindVertexArrayOES(t),this.current=t,this.dirty=!1;}}class xi extends qe{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1;}}class yi extends qe{getDefault(){return !1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1;}}class bi extends qe{getDefault(){return !1}set(t){if(t===this.current&&!this.dirty)return;const e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1;}}class wi extends qe{constructor(t,e){super(t),this.context=t,this.parent=e;}getDefault(){return null}}class Ti extends wi{setDirty(){this.dirty=!0;}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1;}}class Ei extends wi{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1;}}class Ii extends wi{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1;}}class Si{constructor(t,e,i,s,a){this.context=t,this.width=e,this.height=i;const o=t.gl,r=this.framebuffer=o.createFramebuffer();if(this.colorAttachment=new Ti(t,r),s)this.depthAttachment=a?new Ii(t,r):new Ei(t,r);else if(a)throw new Error(\"Stencil cannot be setted without depth\");if(o.checkFramebufferStatus(o.FRAMEBUFFER)!==o.FRAMEBUFFER_COMPLETE)throw new Error(\"Framebuffer is not complete\")}destroy(){const t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){const e=this.depthAttachment.get();e&&t.deleteRenderbuffer(e);}t.deleteFramebuffer(this.framebuffer);}}class Ci{constructor(t,e,i){this.blendFunction=t,this.blendColor=e,this.mask=i;}}Ci.Replace=[1,0],Ci.disabled=new Ci(Ci.Replace,t.Color.transparent,[!1,!1,!1,!1]),Ci.unblended=new Ci(Ci.Replace,t.Color.transparent,[!0,!0,!0,!0]),Ci.alphaBlended=new Ci([1,771],t.Color.transparent,[!0,!0,!0,!0]);class Pi{constructor(t){var e,i;if(this.gl=t,this.clearColor=new je(this),this.clearDepth=new $e(this),this.clearStencil=new Xe(this),this.colorMask=new We(this),this.depthMask=new He(this),this.stencilMask=new Ke(this),this.stencilFunc=new Ye(this),this.stencilOp=new Je(this),this.stencilTest=new Qe(this),this.depthRange=new ti(this),this.depthTest=new ei(this),this.depthFunc=new ii(this),this.blend=new si(this),this.blendFunc=new ai(this),this.blendColor=new oi(this),this.blendEquation=new ri(this),this.cullFace=new ni(this),this.cullFaceSide=new li(this),this.frontFace=new ci(this),this.program=new hi(this),this.activeTexture=new ui(this),this.viewport=new di(this),this.bindFramebuffer=new _i(this),this.bindRenderbuffer=new mi(this),this.bindTexture=new pi(this),this.bindVertexBuffer=new fi(this),this.bindElementBuffer=new gi(this),this.bindVertexArray=new vi(this),this.pixelStoreUnpack=new xi(this),this.pixelStoreUnpackPremultiplyAlpha=new yi(this),this.pixelStoreUnpackFlipY=new bi(this),this.extTextureFilterAnisotropic=t.getExtension(\"EXT_texture_filter_anisotropic\")||t.getExtension(\"MOZ_EXT_texture_filter_anisotropic\")||t.getExtension(\"WEBKIT_EXT_texture_filter_anisotropic\"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),Ve(t)){this.HALF_FLOAT=t.HALF_FLOAT;const s=t.getExtension(\"EXT_color_buffer_half_float\");this.RGBA16F=null!==(e=t.RGBA16F)&&void 0!==e?e:null==s?void 0:s.RGBA16F_EXT,this.RGB16F=null!==(i=t.RGB16F)&&void 0!==i?i:null==s?void 0:s.RGB16F_EXT,t.getExtension(\"EXT_color_buffer_float\");}else {t.getExtension(\"EXT_color_buffer_half_float\"),t.getExtension(\"OES_texture_half_float_linear\");const e=t.getExtension(\"OES_texture_half_float\");this.HALF_FLOAT=null==e?void 0:e.HALF_FLOAT_OES;}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault();}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0;}createIndexBuffer(t,e){return new Oe(this,t,e)}createVertexBuffer(t,e,i){return new Ge(this,t,e,i)}createRenderbuffer(t,e,i){const s=this.gl,a=s.createRenderbuffer();return this.bindRenderbuffer.set(a),s.renderbufferStorage(s.RENDERBUFFER,t,e,i),this.bindRenderbuffer.set(null),a}createFramebuffer(t,e,i,s){return new Si(this,t,e,i,s)}clear({color:t,depth:e,stencil:i}){const s=this.gl;let a=0;t&&(a|=s.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==e&&(a|=s.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),void 0!==i&&(a|=s.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),s.clear(a);}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace));}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1);}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1);}setColorMode(e){t.deepEqual(e.blendFunction,Ci.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask);}createVertexArray(){var t;return Ve(this.gl)?this.gl.createVertexArray():null===(t=this.gl.getExtension(\"OES_vertex_array_object\"))||void 0===t?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var e;return Ve(this.gl)?this.gl.deleteVertexArray(t):null===(e=this.gl.getExtension(\"OES_vertex_array_object\"))||void 0===e?void 0:e.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null);}}class Di{constructor(t,e,i){this.func=t,this.mask=e,this.range=i;}}Di.ReadOnly=!1,Di.ReadWrite=!0,Di.disabled=new Di(519,Di.ReadOnly,[0,1]);const zi=7680;class Mi{constructor(t,e,i,s,a,o){this.test=t,this.ref=e,this.mask=i,this.fail=s,this.depthFail=a,this.pass=o;}}Mi.disabled=new Mi({func:519,mask:0},0,0,zi,zi,zi);class Ai{constructor(t,e,i){this.enable=t,this.mode=e,this.frontFace=i;}}let Li;function Ri(e,i,s,a,o,r,n){const l=e.context,c=l.gl,h=e.useProgram(\"collisionBox\"),u=[];let d=0,_=0;for(let m=0;m<a.length;m++){const p=a[m],f=i.getTile(p),g=f.getBucket(s);if(!g)continue;let v=p.posMatrix;0===o[0]&&0===o[1]||(v=e.translatePosMatrix(p.posMatrix,f,o,r));const x=n?g.textCollisionBox:g.iconCollisionBox,y=g.collisionCircleArray;if(y.length>0){const i=t.create(),s=v;t.mul(i,g.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(i,i,g.placementViewportMatrix),u.push({circleArray:y,circleOffset:_,transform:s,invTransform:i,coord:p}),d+=y.length/4,_=d;}x&&h.draw(l,c.LINES,Di.disabled,Mi.disabled,e.colorModeForRenderPass(),Ai.disabled,ye(v,e.transform,f),e.style.map.terrain&&e.style.map.terrain.getTerrainData(p),s.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,null,e.transform.zoom,null,null,x.collisionVertexBuffer);}if(!n||!u.length)return;const m=e.useProgram(\"collisionCircle\"),p=new t.CollisionCircleLayoutArray;p.resize(4*d),p._trim();let f=0;for(const t of u)for(let e=0;e<t.circleArray.length/4;e++){const i=4*e,s=t.circleArray[i+0],a=t.circleArray[i+1],o=t.circleArray[i+2],r=t.circleArray[i+3];p.emplace(f++,s,a,o,r,0),p.emplace(f++,s,a,o,r,1),p.emplace(f++,s,a,o,r,2),p.emplace(f++,s,a,o,r,3);}(!Li||Li.length<2*d)&&(Li=function(e){const i=2*e,s=new t.QuadTriangleArray;s.resize(i),s._trim();for(let t=0;t<i;t++){const e=6*t;s.uint16[e+0]=4*t+0,s.uint16[e+1]=4*t+1,s.uint16[e+2]=4*t+2,s.uint16[e+3]=4*t+2,s.uint16[e+4]=4*t+3,s.uint16[e+5]=4*t+0;}return s}(d));const g=l.createIndexBuffer(Li,!0),v=l.createVertexBuffer(p,t.collisionCircleLayout.members,!0);for(const i of u){const a={u_matrix:i.transform,u_inv_matrix:i.invTransform,u_camera_to_center_distance:(x=e.transform).cameraToCenterDistance,u_viewport_size:[x.width,x.height]};m.draw(l,c.TRIANGLES,Di.disabled,Mi.disabled,e.colorModeForRenderPass(),Ai.disabled,a,e.style.map.terrain&&e.style.map.terrain.getTerrainData(i.coord),s.id,v,g,t.SegmentVector.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,e.transform.zoom,null,null,null);}var x;v.destroy(),g.destroy();}Ai.disabled=new Ai(!1,1029,2305),Ai.backCCW=new Ai(!0,1029,2305);const ki=t.identity(new Float32Array(16));function Bi(e,i,s,a,o,r){const{horizontalAlign:n,verticalAlign:l}=t.getAnchorAlignment(e),c=-(n-.5)*i,h=-(l-.5)*s,u=t.evaluateVariableOffset(e,a);return new t.Point((c/o+u[0])*r,(h/o+u[1])*r)}function Fi(e,i,s,a,o,r,n,l,c,h,u){const d=e.text.placedSymbolArray,_=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,p={};_.clear();for(let m=0;m<d.length;m++){const f=d.get(m),g=f.hidden||!f.crossTileID||e.allowVerticalPlacement&&!f.placedOrientation?null:a[f.crossTileID];if(g){const a=new t.Point(f.anchorX,f.anchorY),d=ht(a,s?n:r,u),m=ut(o.cameraToCenterDistance,d.signedDistanceFromCamera);let v=t.evaluateSizeForFeature(e.textSizeData,c,f)*m/t.ONE_EM;s&&(v*=e.tilePixelRatio/l);const{width:x,height:y,anchor:b,textOffset:w,textBoxScale:T}=g,E=Bi(b,x,y,w,T,v),I=s?ht(a.add(E),r,u).point:d.point.add(i?E.rotate(-o.angle):E),S=e.allowVerticalPlacement&&f.placedOrientation===t.WritingMode.vertical?Math.PI/2:0;for(let e=0;e<f.numGlyphs;e++)t.addDynamicAttributes(_,I,S);h&&f.associatedIconIndex>=0&&(p[f.associatedIconIndex]={shiftedAnchor:I,angle:S});}else Tt(f.numGlyphs,_);}if(h){m.clear();const i=e.icon.placedSymbolArray;for(let e=0;e<i.length;e++){const s=i.get(e);if(s.hidden)Tt(s.numGlyphs,m);else {const i=p[e];if(i)for(let e=0;e<s.numGlyphs;e++)t.addDynamicAttributes(m,i.shiftedAnchor,i.angle);else Tt(s.numGlyphs,m);}}e.icon.dynamicLayoutVertexBuffer.updateData(m);}e.text.dynamicLayoutVertexBuffer.updateData(_);}function Ui(t,e,i){return i.iconsInText&&e?\"symbolTextAndIcon\":t?\"symbolSDF\":\"symbolIcon\"}function Oi(e,i,s,a,o,r,n,l,c,h,u,d){const _=e.context,m=_.gl,p=e.transform,f=\"map\"===l,g=\"map\"===c,v=\"viewport\"!==l&&\"point\"!==s.layout.get(\"symbol-placement\"),x=f&&!g&&!v,y=!s.layout.get(\"symbol-sort-key\").isConstant();let b=!1;const w=e.depthModeForSublayer(0,Di.ReadOnly),T=s.layout.get(\"text-variable-anchor\"),E=[];for(const l of a){const a=i.getTile(l),c=a.getBucket(s);if(!c)continue;const u=o?c.text:c.icon;if(!u||!u.segments.get().length||!u.hasVisibleVertices)continue;const d=u.programConfigurations.get(s.id),_=o||c.sdfIcons,w=o?c.textSizeData:c.iconSizeData,I=g||0!==p.pitch,S=e.useProgram(Ui(_,o,c),d),C=t.evaluateSizeForZoom(w,p.zoom),P=e.style.map.terrain&&e.style.map.terrain.getTerrainData(l);let D,z,M,A,L=[0,0],R=null;if(o)z=a.glyphAtlasTexture,M=m.LINEAR,D=a.glyphAtlasTexture.size,c.iconsInText&&(L=a.imageAtlasTexture.size,R=a.imageAtlasTexture,A=I||e.options.rotating||e.options.zooming||\"composite\"===w.kind||\"camera\"===w.kind?m.LINEAR:m.NEAREST);else {const t=1!==s.layout.get(\"icon-size\").constantOr(0)||c.iconsNeedLinear;z=a.imageAtlasTexture,M=_||e.options.rotating||e.options.zooming||t||I?m.LINEAR:m.NEAREST,D=a.imageAtlasTexture.size;}const k=Ct(a,1,e.transform.zoom),B=lt(l.posMatrix,g,f,e.transform,k),F=ct(l.posMatrix,g,f,e.transform,k),U=T&&c.hasTextData(),O=\"none\"!==s.layout.get(\"icon-text-fit\")&&U&&c.hasIconData();if(v){const t=e.style.map.terrain?(t,i)=>e.style.map.terrain.getElevation(l,t,i):null,i=\"map\"===s.layout.get(\"text-rotation-alignment\");_t(c,l.posMatrix,e,o,B,F,g,h,i,t);}const N=e.translatePosMatrix(l.posMatrix,a,r,n),G=v||o&&T||O?ki:B,Z=e.translatePosMatrix(F,a,r,n,!0),V=_&&0!==s.paint.get(o?\"text-halo-width\":\"icon-halo-width\").constantOr(1);let q;q=_?c.iconsInText?ke(w.kind,C,x,g,e,N,G,Z,D,L):Re(w.kind,C,x,g,e,N,G,Z,o,D,!0):Le(w.kind,C,x,g,e,N,G,Z,o,D);const j={program:S,buffers:u,uniformValues:q,atlasTexture:z,atlasTextureIcon:R,atlasInterpolation:M,atlasInterpolationIcon:A,isSDF:_,hasHalo:V};if(y&&c.canOverlap){b=!0;const e=u.segments.get();for(const i of e)E.push({segments:new t.SegmentVector([i]),sortKey:i.sortKey,state:j,terrainData:P});}else E.push({segments:u.segments,sortKey:0,state:j,terrainData:P});}b&&E.sort(((t,e)=>t.sortKey-e.sortKey));for(const t of E){const i=t.state;if(_.activeTexture.set(m.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,m.CLAMP_TO_EDGE),i.atlasTextureIcon&&(_.activeTexture.set(m.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,m.CLAMP_TO_EDGE)),i.isSDF){const a=i.uniformValues;i.hasHalo&&(a.u_is_halo=1,Ni(i.buffers,t.segments,s,e,i.program,w,u,d,a,t.terrainData)),a.u_is_halo=0;}Ni(i.buffers,t.segments,s,e,i.program,w,u,d,i.uniformValues,t.terrainData);}}function Ni(t,e,i,s,a,o,r,n,l,c){const h=s.context;a.draw(h,h.gl.TRIANGLES,o,r,n,Ai.disabled,l,c,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,s.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer);}function Gi(t,e,i,s,a){if(!i||!s||!s.imageAtlas)return;const o=s.imageAtlas.patternPositions;let r=o[i.to.toString()],n=o[i.from.toString()];if(!r||!n){const t=a.getPaintProperty(e);r=o[t],n=o[t];}r&&n&&t.setConstantPatternPositions(r,n);}function Zi(t,e,i,s,a,o,r){const n=t.context.gl,l=\"fill-pattern\",c=i.paint.get(l),h=c&&c.constantOr(1),u=i.getCrossfadeParameters();let d,_,m,p,f;r?(_=h&&!i.getPaintProperty(\"fill-outline-color\")?\"fillOutlinePattern\":\"fillOutline\",d=n.LINES):(_=h?\"fillPattern\":\"fill\",d=n.TRIANGLES);const g=c.constantOr(null);for(const c of s){const s=e.getTile(c);if(h&&!s.patternsLoaded())continue;const v=s.getBucket(i);if(!v)continue;const x=v.programConfigurations.get(i.id),y=t.useProgram(_,x),b=t.style.map.terrain&&t.style.map.terrain.getTerrainData(c);h&&(t.context.activeTexture.set(n.TEXTURE0),s.imageAtlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE),x.updatePaintBuffers(u)),Gi(x,l,g,s,i);const w=b?c:null,T=t.translatePosMatrix(w?w.posMatrix:c.posMatrix,s,i.paint.get(\"fill-translate\"),i.paint.get(\"fill-translate-anchor\"));if(r){p=v.indexBuffer2,f=v.segments2;const e=[n.drawingBufferWidth,n.drawingBufferHeight];m=\"fillOutlinePattern\"===_&&h?ve(T,t,u,s,e):ge(T,e);}else p=v.indexBuffer,f=v.segments,m=h?fe(T,t,u,s):pe(T);y.draw(t.context,d,a,t.stencilModeForClipping(c),o,Ai.disabled,m,b,i.id,v.layoutVertexBuffer,p,f,i.paint,t.transform.zoom,x);}}function Vi(t,e,i,s,a,o,r){const n=t.context,l=n.gl,c=\"fill-extrusion-pattern\",h=i.paint.get(c),u=h.constantOr(1),d=i.getCrossfadeParameters(),_=i.paint.get(\"fill-extrusion-opacity\"),m=h.constantOr(null);for(const h of s){const s=e.getTile(h),p=s.getBucket(i);if(!p)continue;const f=t.style.map.terrain&&t.style.map.terrain.getTerrainData(h),g=p.programConfigurations.get(i.id),v=t.useProgram(u?\"fillExtrusionPattern\":\"fillExtrusion\",g);u&&(t.context.activeTexture.set(l.TEXTURE0),s.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),g.updatePaintBuffers(d)),Gi(g,c,m,s,i);const x=t.translatePosMatrix(h.posMatrix,s,i.paint.get(\"fill-extrusion-translate\"),i.paint.get(\"fill-extrusion-translate-anchor\")),y=i.paint.get(\"fill-extrusion-vertical-gradient\"),b=u?me(x,t,y,_,h,d,s):_e(x,t,y,_);v.draw(n,n.gl.TRIANGLES,a,o,r,Ai.backCCW,b,f,i.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,i.paint,t.transform.zoom,g,t.style.map.terrain&&p.centroidVertexBuffer);}}function qi(t,e,i,s,a,o,r){const n=t.context,l=n.gl,c=i.fbo;if(!c)return;const h=t.useProgram(\"hillshade\"),u=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);n.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,c.colorAttachment.get()),h.draw(n,l.TRIANGLES,a,o,r,Ai.disabled,((t,e,i,s)=>{const a=i.paint.get(\"hillshade-shadow-color\"),o=i.paint.get(\"hillshade-highlight-color\"),r=i.paint.get(\"hillshade-accent-color\");let n=i.paint.get(\"hillshade-illumination-direction\")*(Math.PI/180);\"viewport\"===i.paint.get(\"hillshade-illumination-anchor\")&&(n-=t.transform.angle);const l=!t.options.moving;return {u_matrix:s?s.posMatrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped(),l),u_image:0,u_latrange:Ee(0,e.tileID),u_light:[i.paint.get(\"hillshade-exaggeration\"),n],u_shadow:a,u_highlight:o,u_accent:r}})(t,i,s,u?e:null),u,s.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments);}function ji(e,i,s,a,o,r){const n=e.context,l=n.gl,c=i.dem;if(c&&c.data){const h=c.dim,u=c.stride,d=c.getPixels();if(n.activeTexture.set(l.TEXTURE1),n.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||e.getTileTexture(u),i.demTexture){const t=i.demTexture;t.update(d,{premultiply:!1}),t.bind(l.NEAREST,l.CLAMP_TO_EDGE);}else i.demTexture=new y(n,d,l.RGBA,{premultiply:!1}),i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);n.activeTexture.set(l.TEXTURE0);let _=i.fbo;if(!_){const t=new y(n,{width:h,height:h,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),_=i.fbo=n.createFramebuffer(h,h,!0,!1),_.colorAttachment.set(t.texture);}n.bindFramebuffer.set(_.framebuffer),n.viewport.set([0,0,h,h]),e.useProgram(\"hillshadePrepare\").draw(n,l.TRIANGLES,a,o,r,Ai.disabled,((e,i)=>{const s=i.stride,a=t.create();return t.ortho(a,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(a,a,[0,-t.EXTENT,0]),{u_matrix:a,u_image:1,u_dimension:[s,s],u_zoom:e.overscaledZ,u_unpack:i.getUnpackVector()}})(i.tileID,c),null,s.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),i.needsHillshadePrepare=!1;}}function $i(e,i,s,a,o,r){const n=a.paint.get(\"raster-fade-duration\");if(!r&&n>0){const a=t.exported.now(),r=(a-e.timeAdded)/n,l=i?(a-i.timeAdded)/n:-1,c=s.getSource(),h=o.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),u=!i||Math.abs(i.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),d=u&&e.refreshedUponExpiration?1:t.clamp(u?r:1-l,0,1);return e.refreshedUponExpiration&&r>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return {opacity:1,mix:0}}const Xi=new t.Color(1,0,0,1),Wi=new t.Color(0,1,0,1),Hi=new t.Color(0,0,1,1),Ki=new t.Color(1,0,1,1),Yi=new t.Color(0,1,1,1);function Ji(t,e,i,s){ts(t,0,e+i/2,t.transform.width,i,s);}function Qi(t,e,i,s){ts(t,e-i/2,0,i,t.transform.height,s);}function ts(t,e,i,s,a,o){const r=t.context,n=r.gl;n.enable(n.SCISSOR_TEST),n.scissor(e*t.pixelRatio,i*t.pixelRatio,s*t.pixelRatio,a*t.pixelRatio),r.clear({color:o}),n.disable(n.SCISSOR_TEST);}function es(e,i,s){const a=e.context,o=a.gl,r=s.posMatrix,n=e.useProgram(\"debug\"),l=Di.disabled,c=Mi.disabled,h=e.colorModeForRenderPass(),u=\"$debug\",d=e.style.map.terrain&&e.style.map.terrain.getTerrainData(s);a.activeTexture.set(o.TEXTURE0);const _=i.getTileByID(s.key).latestRawTileData,m=Math.floor((_&&_.byteLength||0)/1024),p=i.getTile(s).tileSize,f=512/Math.min(p,512)*(s.overscaledZ/e.transform.zoom)*.5;let g=s.canonical.toString();s.overscaledZ!==s.canonical.z&&(g+=` => ${s.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const i=t.debugOverlayCanvas,s=t.context.gl,a=t.debugOverlayCanvas.getContext(\"2d\");a.clearRect(0,0,i.width,i.height),a.shadowColor=\"white\",a.shadowBlur=2,a.lineWidth=1.5,a.strokeStyle=\"white\",a.textBaseline=\"top\",a.font=\"bold 36px Open Sans, sans-serif\",a.fillText(e,5,5),a.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE);}(e,`${g} ${m}kB`),n.draw(a,o.TRIANGLES,l,c,Ci.alphaBlended,Ai.disabled,be(r,t.Color.transparent,f),null,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),n.draw(a,o.LINE_STRIP,l,c,h,Ai.disabled,be(r,t.Color.red),d,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);}function is(t,e,i){const s=t.context,a=s.gl,o=t.colorModeForRenderPass(),r=new Di(a.LEQUAL,Di.ReadWrite,t.depthRangeFor3D),n=t.useProgram(\"terrain\"),l=e.getTerrainMesh();s.bindFramebuffer.set(null),s.viewport.set([0,0,t.width,t.height]);for(const c of i){const i=t.renderToTexture.getTexture(c),h=e.getTerrainData(c.tileID);s.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,i.texture);const u={u_matrix:t.transform.calculatePosMatrix(c.tileID.toUnwrapped()),u_texture:0,u_ele_delta:e.getMeshFrameDelta(t.transform.zoom)};n.draw(s,a.TRIANGLES,r,Mi.disabled,o,Ai.backCCW,u,h,\"terrain\",l.vertexBuffer,l.indexBuffer,l.segments);}}const ss={symbol:function(e,i,s,a,o){if(\"translucent\"!==e.renderPass)return;const r=Mi.disabled,n=e.colorModeForRenderPass();s.layout.get(\"text-variable-anchor\")&&function(e,i,s,a,o,r,n){const l=i.transform,c=\"map\"===o,h=\"map\"===r;for(const o of e){const e=a.getTile(o),r=e.getBucket(s);if(!r||!r.text||!r.text.segments.get().length)continue;const u=t.evaluateSizeForZoom(r.textSizeData,l.zoom),d=Ct(e,1,i.transform.zoom),_=lt(o.posMatrix,h,c,i.transform,d),m=\"none\"!==s.layout.get(\"icon-text-fit\")&&r.hasIconData();if(u){const t=Math.pow(2,l.zoom-e.tileID.overscaledZ);Fi(r,c,h,n,l,_,o.posMatrix,t,u,m,i.style.map.terrain?(t,e)=>i.style.map.terrain.getElevation(o,t,e):null);}}}(a,e,s,i,s.layout.get(\"text-rotation-alignment\"),s.layout.get(\"text-pitch-alignment\"),o),0!==s.paint.get(\"icon-opacity\").constantOr(1)&&Oi(e,i,s,a,!1,s.paint.get(\"icon-translate\"),s.paint.get(\"icon-translate-anchor\"),s.layout.get(\"icon-rotation-alignment\"),s.layout.get(\"icon-pitch-alignment\"),s.layout.get(\"icon-keep-upright\"),r,n),0!==s.paint.get(\"text-opacity\").constantOr(1)&&Oi(e,i,s,a,!0,s.paint.get(\"text-translate\"),s.paint.get(\"text-translate-anchor\"),s.layout.get(\"text-rotation-alignment\"),s.layout.get(\"text-pitch-alignment\"),s.layout.get(\"text-keep-upright\"),r,n),i.map.showCollisionBoxes&&(Ri(e,i,s,a,s.paint.get(\"text-translate\"),s.paint.get(\"text-translate-anchor\"),!0),Ri(e,i,s,a,s.paint.get(\"icon-translate\"),s.paint.get(\"icon-translate-anchor\"),!1));},circle:function(e,i,s,a){if(\"translucent\"!==e.renderPass)return;const o=s.paint.get(\"circle-opacity\"),r=s.paint.get(\"circle-stroke-width\"),n=s.paint.get(\"circle-stroke-opacity\"),l=!s.layout.get(\"circle-sort-key\").isConstant();if(0===o.constantOr(1)&&(0===r.constantOr(1)||0===n.constantOr(1)))return;const c=e.context,h=c.gl,u=e.depthModeForSublayer(0,Di.ReadOnly),d=Mi.disabled,_=e.colorModeForRenderPass(),m=[];for(let o=0;o<a.length;o++){const r=a[o],n=i.getTile(r),c=n.getBucket(s);if(!c)continue;const h=c.programConfigurations.get(s.id),u=e.useProgram(\"circle\",h),d=c.layoutVertexBuffer,_=c.indexBuffer,p=e.style.map.terrain&&e.style.map.terrain.getTerrainData(r),f={programConfiguration:h,program:u,layoutVertexBuffer:d,indexBuffer:_,uniformValues:xe(e,r,n,s),terrainData:p};if(l){const e=c.segments.get();for(const i of e)m.push({segments:new t.SegmentVector([i]),sortKey:i.sortKey,state:f});}else m.push({segments:c.segments,sortKey:0,state:f});}l&&m.sort(((t,e)=>t.sortKey-e.sortKey));for(const t of m){const{programConfiguration:i,program:a,layoutVertexBuffer:o,indexBuffer:r,uniformValues:n,terrainData:l}=t.state;a.draw(c,h.TRIANGLES,u,d,_,Ai.disabled,n,l,s.id,o,r,t.segments,s.paint,e.transform.zoom,i);}},heatmap:function(e,i,s,a){if(0!==s.paint.get(\"heatmap-opacity\"))if(\"offscreen\"===e.renderPass){const o=e.context,r=o.gl,n=Mi.disabled,l=new Ci([r.ONE,r.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,i){const s=t.gl;t.activeTexture.set(s.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);let a=i.heatmapFbo;if(a)s.bindTexture(s.TEXTURE_2D,a.colorAttachment.get()),t.bindFramebuffer.set(a.framebuffer);else {const o=s.createTexture();s.bindTexture(s.TEXTURE_2D,o),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),a=i.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1,!1),function(t,e,i,s){var a,o;const r=t.gl,n=null!==(a=t.HALF_FLOAT)&&void 0!==a?a:r.UNSIGNED_BYTE,l=null!==(o=t.RGBA16F)&&void 0!==o?o:r.RGBA;r.texImage2D(r.TEXTURE_2D,0,l,e.width/4,e.height/4,0,r.RGBA,n,null),s.colorAttachment.set(i);}(t,e,o,a);}}(o,e,s),o.clear({color:t.Color.transparent});for(let t=0;t<a.length;t++){const c=a[t];if(i.hasRenderableParent(c))continue;const h=i.getTile(c),u=h.getBucket(s);if(!u)continue;const d=u.programConfigurations.get(s.id),_=e.useProgram(\"heatmap\",d),{zoom:m}=e.transform;_.draw(o,r.TRIANGLES,Di.disabled,n,l,Ai.disabled,Te(c.posMatrix,h,m,s.paint.get(\"heatmap-intensity\")),null,s.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,s.paint,e.transform.zoom,d);}o.viewport.set([0,0,e.width,e.height]);}else \"translucent\"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,i){const s=e.context,a=s.gl,o=i.heatmapFbo;if(!o)return;s.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,o.colorAttachment.get()),s.activeTexture.set(a.TEXTURE1);let r=i.colorRampTexture;r||(r=i.colorRampTexture=new y(s,i.colorRamp,a.RGBA)),r.bind(a.LINEAR,a.CLAMP_TO_EDGE),e.useProgram(\"heatmapTexture\").draw(s,a.TRIANGLES,Di.disabled,Mi.disabled,e.colorModeForRenderPass(),Ai.disabled,((e,i,s,a)=>{const o=t.create();t.ortho(o,0,e.width,e.height,0,0,1);const r=e.context.gl;return {u_matrix:o,u_world:[r.drawingBufferWidth,r.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:i.paint.get(\"heatmap-opacity\")}})(e,i),null,i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom);}(e,s));},line:function(e,i,s,a){if(\"translucent\"!==e.renderPass)return;const o=s.paint.get(\"line-opacity\"),r=s.paint.get(\"line-width\");if(0===o.constantOr(1)||0===r.constantOr(1))return;const n=e.depthModeForSublayer(0,Di.ReadOnly),l=e.colorModeForRenderPass(),c=s.paint.get(\"line-dasharray\"),h=s.paint.get(\"line-pattern\"),u=h.constantOr(1),d=s.paint.get(\"line-gradient\"),_=s.getCrossfadeParameters(),m=u?\"linePattern\":c?\"lineSDF\":d?\"lineGradient\":\"line\",p=e.context,f=p.gl;let g=!0;for(const o of a){const a=i.getTile(o);if(u&&!a.patternsLoaded())continue;const r=a.getBucket(s);if(!r)continue;const v=r.programConfigurations.get(s.id),x=e.context.program.get(),b=e.useProgram(m,v),w=g||b.program!==x,T=e.style.map.terrain&&e.style.map.terrain.getTerrainData(o),E=h.constantOr(null);if(E&&a.imageAtlas){const t=a.imageAtlas,e=t.patternPositions[E.to.toString()],i=t.patternPositions[E.from.toString()];e&&i&&v.setConstantPatternPositions(e,i);}const I=T?o:null,S=u?Ce(e,a,s,_,I):c?Pe(e,a,s,c,_,I):d?Se(e,a,s,r.lineClipsArray.length,I):Ie(e,a,s,I);if(u)p.activeTexture.set(f.TEXTURE0),a.imageAtlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE),v.updatePaintBuffers(_);else if(c&&(w||e.lineAtlas.dirty))p.activeTexture.set(f.TEXTURE0),e.lineAtlas.bind(p);else if(d){const a=r.gradients[s.id];let n=a.texture;if(s.gradientVersion!==a.version){let l=256;if(s.stepInterpolant){const s=i.getSource().maxzoom,a=o.canonical.z===s?Math.ceil(1<<e.transform.maxZoom-o.canonical.z):1;l=t.clamp(t.nextPowerOfTwo(r.maxLineLength/t.EXTENT*1024*a),256,p.maxTextureSize);}a.gradient=t.renderColorRamp({expression:s.gradientExpression(),evaluationKey:\"lineProgress\",resolution:l,image:a.gradient||void 0,clips:r.lineClipsArray}),a.texture?a.texture.update(a.gradient):a.texture=new y(p,a.gradient,f.RGBA),a.version=s.gradientVersion,n=a.texture;}p.activeTexture.set(f.TEXTURE0),n.bind(s.stepInterpolant?f.NEAREST:f.LINEAR,f.CLAMP_TO_EDGE);}b.draw(p,f.TRIANGLES,n,e.stencilModeForClipping(o),l,Ai.disabled,S,T,s.id,r.layoutVertexBuffer,r.indexBuffer,r.segments,s.paint,e.transform.zoom,v,r.layoutVertexBuffer2),g=!1;}},fill:function(e,i,s,a){const o=s.paint.get(\"fill-color\"),r=s.paint.get(\"fill-opacity\");if(0===r.constantOr(1))return;const n=e.colorModeForRenderPass(),l=s.paint.get(\"fill-pattern\"),c=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===o.constantOr(t.Color.transparent).a&&1===r.constantOr(0)?\"opaque\":\"translucent\";if(e.renderPass===c){const t=e.depthModeForSublayer(1,\"opaque\"===e.renderPass?Di.ReadWrite:Di.ReadOnly);Zi(e,i,s,a,t,n,!1);}if(\"translucent\"===e.renderPass&&s.paint.get(\"fill-antialias\")){const t=e.depthModeForSublayer(s.getPaintProperty(\"fill-outline-color\")?2:0,Di.ReadOnly);Zi(e,i,s,a,t,n,!0);}},\"fill-extrusion\":function(t,e,i,s){const a=i.paint.get(\"fill-extrusion-opacity\");if(0!==a&&\"translucent\"===t.renderPass){const o=new Di(t.context.gl.LEQUAL,Di.ReadWrite,t.depthRangeFor3D);if(1!==a||i.paint.get(\"fill-extrusion-pattern\").constantOr(1))Vi(t,e,i,s,o,Mi.disabled,Ci.disabled),Vi(t,e,i,s,o,t.stencilModeFor3D(),t.colorModeForRenderPass());else {const a=t.colorModeForRenderPass();Vi(t,e,i,s,o,Mi.disabled,a);}}},hillshade:function(t,e,i,s){if(\"offscreen\"!==t.renderPass&&\"translucent\"!==t.renderPass)return;const a=t.context,o=t.depthModeForSublayer(0,Di.ReadOnly),r=t.colorModeForRenderPass(),[n,l]=\"translucent\"===t.renderPass?t.stencilConfigForOverlap(s):[{},s];for(const s of l){const a=e.getTile(s);void 0!==a.needsHillshadePrepare&&a.needsHillshadePrepare&&\"offscreen\"===t.renderPass?ji(t,a,i,o,Mi.disabled,r):\"translucent\"===t.renderPass&&qi(t,s,a,i,o,n[s.overscaledZ],r);}a.viewport.set([0,0,t.width,t.height]);},raster:function(t,e,i,s){if(\"translucent\"!==t.renderPass)return;if(0===i.paint.get(\"raster-opacity\"))return;if(!s.length)return;const a=t.context,o=a.gl,r=e.getSource(),n=t.useProgram(\"raster\"),l=t.colorModeForRenderPass(),[c,h]=r instanceof G?[{},s]:t.stencilConfigForOverlap(s),u=h[h.length-1].overscaledZ,d=!t.options.moving;for(const s of h){const h=t.depthModeForSublayer(s.overscaledZ-u,1===i.paint.get(\"raster-opacity\")?Di.ReadWrite:Di.ReadOnly,o.LESS),_=e.getTile(s);_.registerFadeDuration(i.paint.get(\"raster-fade-duration\"));const m=e.findLoadedParent(s,0),p=$i(_,m,e,i,t.transform,t.style.map.terrain);let f,g;const v=\"nearest\"===i.paint.get(\"raster-resampling\")?o.NEAREST:o.LINEAR;a.activeTexture.set(o.TEXTURE0),_.texture.bind(v,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),a.activeTexture.set(o.TEXTURE1),m?(m.texture.bind(v,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),f=Math.pow(2,m.tileID.overscaledZ-_.tileID.overscaledZ),g=[_.tileID.canonical.x*f%1,_.tileID.canonical.y*f%1]):_.texture.bind(v,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST);const x=t.style.map.terrain&&t.style.map.terrain.getTerrainData(s),y=x?s:null,b=y?y.posMatrix:t.transform.calculatePosMatrix(s.toUnwrapped(),d),w=Me(b,g||[0,0],f||1,p,i);r instanceof G?n.draw(a,o.TRIANGLES,h,Mi.disabled,l,Ai.disabled,w,x,i.id,r.boundsBuffer,t.quadTriangleIndexBuffer,r.boundsSegments):n.draw(a,o.TRIANGLES,h,c[s.overscaledZ],l,Ai.disabled,w,x,i.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments);}},background:function(t,e,i,s){const a=i.paint.get(\"background-color\"),o=i.paint.get(\"background-opacity\");if(0===o)return;const r=t.context,n=r.gl,l=t.transform,c=l.tileSize,h=i.paint.get(\"background-pattern\");if(t.isPatternMissing(h))return;const u=!h&&1===a.a&&1===o&&t.opaquePassEnabledForLayer()?\"opaque\":\"translucent\";if(t.renderPass!==u)return;const d=Mi.disabled,_=t.depthModeForSublayer(0,\"opaque\"===u?Di.ReadWrite:Di.ReadOnly),m=t.colorModeForRenderPass(),p=t.useProgram(h?\"backgroundPattern\":\"background\"),f=s||l.coveringTiles({tileSize:c,terrain:t.style.map.terrain});h&&(r.activeTexture.set(n.TEXTURE0),t.imageManager.bind(t.context));const g=i.getCrossfadeParameters();for(const e of f){const l=s?e.posMatrix:t.transform.calculatePosMatrix(e.toUnwrapped()),u=h?Fe(l,o,t,h,{tileID:e,tileSize:c},g):Be(l,o,a),f=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);p.draw(r,n.TRIANGLES,_,d,m,Ai.disabled,u,f,i.id,t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments);}},debug:function(t,e,i){for(let s=0;s<i.length;s++)es(t,e,i[s]);},custom:function(t,e,i){const s=t.context,a=i.implementation;if(\"offscreen\"===t.renderPass){const e=a.prerender;e&&(t.setCustomLayerDefaults(),s.setColorMode(t.colorModeForRenderPass()),e.call(a,s.gl,t.transform.customLayerMatrix()),s.setDirty(),t.setBaseState());}else if(\"translucent\"===t.renderPass){t.setCustomLayerDefaults(),s.setColorMode(t.colorModeForRenderPass()),s.setStencilMode(Mi.disabled);const e=\"3d\"===a.renderingMode?new Di(t.context.gl.LEQUAL,Di.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,Di.ReadOnly);s.setDepthMode(e),a.render(s.gl,t.transform.customLayerMatrix()),s.setDirty(),t.setBaseState(),s.bindFramebuffer.set(null);}}};class as{constructor(e,i){this.context=new Pi(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:t.create(),renderTime:0},this.setup(),this.numSublayers=Y.maxUnderzooming+Y.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Qt;}resize(t,e,i){if(this.width=t*i,this.height=e*i,this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const t of this.style._order)this.style._layers[t].resize();}setup(){const e=this.context,i=new t.PosArray;i.emplaceBack(0,0),i.emplaceBack(t.EXTENT,0),i.emplaceBack(0,t.EXTENT),i.emplaceBack(t.EXTENT,t.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(i,oe.members),this.tileExtentSegments=t.SegmentVector.simpleSegment(0,0,4,2);const s=new t.PosArray;s.emplaceBack(0,0),s.emplaceBack(t.EXTENT,0),s.emplaceBack(0,t.EXTENT),s.emplaceBack(t.EXTENT,t.EXTENT),this.debugBuffer=e.createVertexBuffer(s,oe.members),this.debugSegments=t.SegmentVector.simpleSegment(0,0,4,5);const a=new t.RasterBoundsArray;a.emplaceBack(0,0,0,0),a.emplaceBack(t.EXTENT,0,t.EXTENT,0),a.emplaceBack(0,t.EXTENT,0,t.EXTENT),a.emplaceBack(t.EXTENT,t.EXTENT,t.EXTENT,t.EXTENT),this.rasterBoundsBuffer=e.createVertexBuffer(a,N.members),this.rasterBoundsSegments=t.SegmentVector.simpleSegment(0,0,4,2);const o=new t.PosArray;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,oe.members),this.viewportSegments=t.SegmentVector.simpleSegment(0,0,4,2);const r=new t.LineStripIndexArray;r.emplaceBack(0),r.emplaceBack(1),r.emplaceBack(3),r.emplaceBack(2),r.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(r);const n=new t.TriangleIndexArray;n.emplaceBack(0,1,2),n.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(n);const l=this.context.gl;this.stencilClearMode=new Mi({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO);}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=t.create();t.ortho(s,0,this.width,this.height,0,0,1),t.scale(s,s,[i.drawingBufferWidth,i.drawingBufferHeight,0]),this.useProgram(\"clippingMask\").draw(e,i.TRIANGLES,Di.disabled,this.stencilClearMode,Ci.disabled,Ai.disabled,we(s),null,\"$clipping\",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments);}_renderTileClippingMasks(t,e){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source;const i=this.context,s=i.gl;this.nextStencilID+e.length>256&&this.clearStencil(),i.setColorMode(Ci.disabled),i.setDepthMode(Di.disabled);const a=this.useProgram(\"clippingMask\");this._tileClippingMaskIDs={};for(const t of e){const e=this._tileClippingMaskIDs[t.key]=this.nextStencilID++,o=this.style.map.terrain&&this.style.map.terrain.getTerrainData(t);a.draw(i,s.TRIANGLES,Di.disabled,new Mi({func:s.ALWAYS,mask:0},e,255,s.KEEP,s.KEEP,s.REPLACE),Ci.disabled,Ai.disabled,we(t.posMatrix),o,\"$clipping\",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments);}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new Mi({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new Mi({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}stencilConfigForOverlap(t){const e=this.context.gl,i=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),s=i[i.length-1].overscaledZ,a=i[0].overscaledZ-s+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();const t={};for(let i=0;i<a;i++)t[i+s]=new Mi({func:e.GEQUAL,mask:255},i+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=a,[t,i]}return [{[s]:Mi.disabled},i]}colorModeForRenderPass(){const e=this.context.gl;if(this._showOverdrawInspector){const i=1/8;return new Ci([e.CONSTANT_COLOR,e.ONE],new t.Color(i,i,i,0),[!0,!0,!0,!0])}return \"opaque\"===this.renderPass?Ci.unblended:Ci.alphaBlended}depthModeForSublayer(t,e,i){if(!this.opaquePassEnabledForLayer())return Di.disabled;const s=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Di(i||this.context.gl.LEQUAL,e,[s,s])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(t.exported.now()),this.imageManager.beginFrame();const s=this.style._order,a=this.style.sourceCaches,o={},r={},n={};for(const t in a){const e=a[t];e.used&&e.prepare(this.context),o[t]=e.getVisibleCoordinates(),r[t]=o[t].slice().reverse(),n[t]=e.getVisibleCoordinates(!0).reverse();}this.opaquePassCutoff=1/0;for(let t=0;t<s.length;t++)if(this.style._layers[s[t]].is3D()){this.opaquePassCutoff=t;break}if(this.renderToTexture){this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0;const e=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!t.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||e.length)&&(t.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(e,i){const s=e.context,a=s.gl,o=Ci.unblended,r=new Di(a.LEQUAL,Di.ReadWrite,[0,1]),n=i.getTerrainMesh(),l=i.sourceCache.getRenderableTiles(),c=e.useProgram(\"terrainDepth\");s.bindFramebuffer.set(i.getFramebuffer(\"depth\").framebuffer),s.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),s.clear({color:t.Color.transparent,depth:1});for(const t of l){const l=i.getTerrainData(t.tileID),h={u_matrix:e.transform.calculatePosMatrix(t.tileID.toUnwrapped()),u_ele_delta:i.getMeshFrameDelta(e.transform.zoom)};c.draw(s,a.TRIANGLES,r,Mi.disabled,o,Ai.backCCW,h,l,\"terrain\",n.vertexBuffer,n.indexBuffer,n.segments);}s.bindFramebuffer.set(null),s.viewport.set([0,0,e.width,e.height]);}(this,this.style.map.terrain),function(e,i){const s=e.context,a=s.gl,o=Ci.unblended,r=new Di(a.LEQUAL,Di.ReadWrite,[0,1]),n=i.getTerrainMesh(),l=i.getCoordsTexture(),c=i.sourceCache.getRenderableTiles(),h=e.useProgram(\"terrainCoords\");s.bindFramebuffer.set(i.getFramebuffer(\"coords\").framebuffer),s.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),s.clear({color:t.Color.transparent,depth:1}),i.coordsIndex=[];for(const t of c){const c=i.getTerrainData(t.tileID);s.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,l.texture);const u={u_matrix:e.transform.calculatePosMatrix(t.tileID.toUnwrapped()),u_terrain_coords_id:(255-i.coordsIndex.length)/255,u_texture:0,u_ele_delta:i.getMeshFrameDelta(e.transform.zoom)};h.draw(s,a.TRIANGLES,r,Mi.disabled,o,Ai.backCCW,u,c,\"terrain\",n.vertexBuffer,n.indexBuffer,n.segments),i.coordsIndex.push(t.tileID.key);}s.bindFramebuffer.set(null),s.viewport.set([0,0,e.width,e.height]);}(this,this.style.map.terrain));}this.renderPass=\"offscreen\";for(const t of s){const e=this.style._layers[t];if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const i=r[e.source];(\"custom\"===e.type||i.length)&&this.renderLayer(this,a[e.source],e,i);}if(this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?t.Color.black:t.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass=\"opaque\",this.currentLayer=s.length-1;this.currentLayer>=0;this.currentLayer--){const t=this.style._layers[s[this.currentLayer]],e=a[t.source],i=o[t.source];this._renderTileClippingMasks(t,i),this.renderLayer(this,e,t,i);}for(this.renderPass=\"translucent\",this.currentLayer=0;this.currentLayer<s.length;this.currentLayer++){const t=this.style._layers[s[this.currentLayer]],e=a[t.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(t))continue;const i=(\"symbol\"===t.type?n:r)[t.source];this._renderTileClippingMasks(t,o[t.source]),this.renderLayer(this,e,t,i);}if(this.options.showTileBoundaries){const t=function(t,e){let i=null;const s=Object.values(t._layers).flatMap((i=>i.source&&!i.isHidden(e)?[t.sourceCaches[i.source]]:[])),a=s.filter((t=>\"vector\"===t.getSource().type)),o=s.filter((t=>\"vector\"!==t.getSource().type)),r=t=>{(!i||i.getSource().maxzoom<t.getSource().maxzoom)&&(i=t);};return a.forEach((t=>r(t))),i||o.forEach((t=>r(t))),i}(this.style,this.transform.zoom);t&&ss.debug(this,t,t.getVisibleCoordinates());}this.options.showPadding&&function(t){const e=t.transform.padding;Ji(t,t.transform.height-(e.top||0),3,Xi),Ji(t,e.bottom||0,3,Wi),Qi(t,e.left||0,3,Hi),Qi(t,t.transform.width-(e.right||0),3,Ki);const i=t.transform.centerPoint;!function(t,e,i,s){ts(t,e-1,i-10,2,20,s),ts(t,e-10,i-1,20,2,s);}(t,i.x,t.transform.height-i.y,Yi);}(this),this.context.setDefault();}renderLayer(t,e,i,s){i.isHidden(this.transform.zoom)||(\"background\"===i.type||\"custom\"===i.type||(s||[]).length)&&(this.id=i.id,ss[i.type](t,e,i,s,this.style.placement.variableOffsets));}translatePosMatrix(e,i,s,a,o){if(!s[0]&&!s[1])return e;const r=o?\"map\"===a?this.transform.angle:0:\"viewport\"===a?-this.transform.angle:0;if(r){const t=Math.sin(r),e=Math.cos(r);s=[s[0]*e-s[1]*t,s[0]*t+s[1]*e];}const n=[o?s[0]:Ct(i,s[0],this.transform.zoom),o?s[1]:Ct(i,s[1],this.transform.zoom),0],l=new Float32Array(16);return t.translate(l,e,n),l}saveTileTexture(t){const e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t];}getTileTexture(t){const e=this._tileTextures[t];return e&&e.length>0?e.pop():null}isPatternMissing(t){if(!t)return !1;if(!t.from||!t.to)return !0;const e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return !e||!i}useProgram(t,e){this.cache=this.cache||{};const i=t+(e?e.cacheKey:\"\")+(this._showOverdrawInspector?\"/overdraw\":\"\")+(this.style.map.terrain?\"/terrain\":\"\");return this.cache[i]||(this.cache[i]=new ue(this.context,t,ne[t],e,Ue[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[i]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault();}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD);}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement(\"canvas\"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new y(this.context,this.debugOverlayCanvas,this.context.gl.RGBA));}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy();}}class os{constructor(t,e){this.points=t,this.planes=e;}static fromInvProjectionMatrix(e,i,s){const a=Math.pow(2,s),o=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((s=>{const o=1/(s=t.transformMat4([],s,e))[3]/i*a;return t.mul$1(s,s,[o,o,1/s[3],o])})),r=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((t=>{const e=function(t,e){var i=e[0],s=e[1],a=e[2],o=i*i+s*s+a*a;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}([],function(t,e,i){var s=e[0],a=e[1],o=e[2],r=i[0],n=i[1],l=i[2];return t[0]=a*l-o*n,t[1]=o*r-s*l,t[2]=s*n-a*r,t}([],f([],o[t[0]],o[t[1]]),f([],o[t[2]],o[t[1]]))),i=-((s=e)[0]*(a=o[t[1]])[0]+s[1]*a[1]+s[2]*a[2]);var s,a;return e.concat(i)}));return new os(o,r)}}class rs{constructor(t,e){this.min=t,this.max=e,this.center=function(t,e,i){return t[0]=.5*e[0],t[1]=.5*e[1],t[2]=.5*e[2],t}([],function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}([],this.min,this.max));}quadrant(t){const e=[t%2==0,t<2],i=m(this.min),s=m(this.max);for(let t=0;t<e.length;t++)i[t]=e[t]?this.min[t]:this.center[t],s[t]=e[t]?this.center[t]:this.max[t];return s[2]=this.max[2],new rs(i,s)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(e){const i=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let s=!0;for(let a=0;a<e.planes.length;a++){const o=e.planes[a];let r=0;for(let e=0;e<i.length;e++)t.dot(o,i[e])>=0&&r++;if(0===r)return 0;r!==i.length&&(s=!1);}if(s)return 2;for(let t=0;t<3;t++){let i=Number.MAX_VALUE,s=-Number.MAX_VALUE;for(let a=0;a<e.points.length;a++){const o=e.points[a][t]-this.min[t];i=Math.min(i,o),s=Math.max(s,o);}if(s<0||i>this.max[t]-this.min[t])return 0}return 1}}class ns{constructor(t=0,e=0,i=0,s=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(s)||s<0)throw new Error(\"Invalid value for edge-insets, top, bottom, left and right must all be numbers\");this.top=t,this.bottom=e,this.left=i,this.right=s;}interpolate(e,i,s){return null!=i.top&&null!=e.top&&(this.top=t.interpolate.number(e.top,i.top,s)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.interpolate.number(e.bottom,i.bottom,s)),null!=i.left&&null!=e.left&&(this.left=t.interpolate.number(e.left,i.left,s)),null!=i.right&&null!=e.right&&(this.right=t.interpolate.number(e.right,i.right,s)),this}getCenter(e,i){const s=t.clamp((this.left+e-this.right)/2,0,e),a=t.clamp((this.top+i-this.bottom)/2,0,i);return new t.Point(s,a)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new ns(this.top,this.bottom,this.left,this.right)}toJSON(){return {top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class ls{constructor(e,i,s,a,o){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=void 0===o||!!o,this._minZoom=e||0,this._maxZoom=i||22,this._minPitch=null==s?0:s,this._maxPitch=null==a?60:a,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new ns,this._posMatrixCache={},this._alignedPosMatrixCache={};}clone(){const t=new ls(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices();}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t));}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t));}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t));}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t));}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t;}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.Point(this.width,this.height)}get bearing(){return -this.angle/Math.PI*180}set bearing(e){const i=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=function(){var e=new t.ARRAY_TYPE(4);return t.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}(),function(t,e,i){var s=e[0],a=e[1],o=e[2],r=e[3],n=Math.sin(i),l=Math.cos(i);t[0]=s*l+o*n,t[1]=a*l+r*n,t[2]=s*-n+o*l,t[3]=a*-n+r*l;}(this.rotationMatrix,this.rotationMatrix,this.angle));}get pitch(){return this._pitch/Math.PI*180}set pitch(e){const i=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices());}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices());}get zoom(){return this._zoom}set zoom(t){const e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.tileZoom=Math.max(0,Math.floor(e)),this.scale=this.zoomScale(e),this._constrain(),this._calcMatrices());}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices());}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices());}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices());}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices();}coveringZoomLevel(t){const e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)}getVisibleUnwrappedCoordinates(e){const i=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies){const s=this.pointCoordinate(new t.Point(0,0)),a=this.pointCoordinate(new t.Point(this.width,0)),o=this.pointCoordinate(new t.Point(this.width,this.height)),r=this.pointCoordinate(new t.Point(0,this.height)),n=Math.floor(Math.min(s.x,a.x,o.x,r.x)),l=Math.floor(Math.max(s.x,a.x,o.x,r.x)),c=1;for(let s=n-c;s<=l+c;s++)0!==s&&i.push(new t.UnwrappedTileID(s,e));}return i}coveringTiles(e){var i,s;let a=this.coveringZoomLevel(e);const o=a;if(void 0!==e.minzoom&&a<e.minzoom)return [];void 0!==e.maxzoom&&a>e.maxzoom&&(a=e.maxzoom);const r=this.pointCoordinate(this.getCameraPoint()),n=t.MercatorCoordinate.fromLngLat(this.center),l=Math.pow(2,a),c=[l*r.x,l*r.y,0],h=[l*n.x,l*n.y,0],u=os.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,a);let d=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(d=a);const _=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,m=t=>({aabb:new rs([t*l,0,0],[(t+1)*l,l,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),p=[],f=[],v=a,x=e.reparseOverscaled?o:a;if(this._renderWorldCopies)for(let t=1;t<=3;t++)p.push(m(-t)),p.push(m(t));for(p.push(m(0));p.length>0;){const a=p.pop(),o=a.x,r=a.y;let n=a.fullyVisible;if(!n){const t=a.aabb.intersects(u);if(0===t)continue;n=2===t;}const l=e.terrain?c:h,m=a.aabb.distanceX(l),y=a.aabb.distanceY(l),b=Math.max(Math.abs(m),Math.abs(y));if(a.zoom===v||b>_+(1<<v-a.zoom)-2&&a.zoom>=d){const e=v-a.zoom,i=c[0]-.5-(o<<e),s=c[1]-.5-(r<<e);f.push({tileID:new t.OverscaledTileID(a.zoom===v?x:a.zoom,a.wrap,a.zoom,o,r),distanceSq:g([h[0]-.5-o,h[1]-.5-r]),tileDistanceToCamera:Math.sqrt(i*i+s*s)});}else for(let l=0;l<4;l++){const c=(o<<1)+l%2,h=(r<<1)+(l>>1),u=a.zoom+1;let d=a.aabb.quadrant(l);if(e.terrain){const o=new t.OverscaledTileID(u,a.wrap,u,c,h),r=e.terrain.getMinMaxElevation(o),n=null!==(i=r.minElevation)&&void 0!==i?i:this.elevation,l=null!==(s=r.maxElevation)&&void 0!==s?s:this.elevation;d=new rs([d.min[0],d.min[1],n],[d.max[0],d.max[1],l]);}p.push({aabb:d,zoom:u,x:c,y:h,wrap:a.wrap,fullyVisible:n});}}return f.sort(((t,e)=>t.distanceSq-e.distanceSq)).map((t=>t.tileID))}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices();}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(e){const i=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(i)*this.worldSize)}unproject(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0);}getElevation(e,i){const s=t.MercatorCoordinate.fromLngLat(e.wrap()),a=(1<<this.tileZoom)*t.EXTENT,o=s.x*a,r=s.y*a,n=Math.floor(o/t.EXTENT),l=Math.floor(r/t.EXTENT),c=new t.OverscaledTileID(this.tileZoom,0,this.tileZoom,n,l);return i.getElevation(c,o%t.EXTENT,r%t.EXTENT,t.EXTENT)}getCameraPosition(){return {lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(e){const i=this.pointLocation(this.centerPoint,e),s=this.getElevation(i,e);if(!(this.elevation-s))return;const a=this.getCameraPosition(),o=t.MercatorCoordinate.fromLngLat(a.lngLat,a.altitude),r=t.MercatorCoordinate.fromLngLat(i,s),n=o.x-r.x,l=o.y-r.y,c=o.z-r.z,h=Math.sqrt(n*n+l*l+c*c),u=this.scaleZoom(this.cameraToCenterDistance/h/this.tileSize);this._elevation=s,this._center=i,this.zoom=u;}setLocationAtPoint(e,i){const s=this.pointCoordinate(i),a=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),r=new t.MercatorCoordinate(o.x-(s.x-a.x),o.y-(s.y-a.y));this.center=this.coordinateLocation(r),this._renderWorldCopies&&(this.center=this.center.wrap());}locationPoint(t,e){return e?this.coordinatePoint(this.locationCoordinate(t),this.getElevation(t,e),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,e){return this.coordinateLocation(this.pointCoordinate(t,e))}locationCoordinate(e){return t.MercatorCoordinate.fromLngLat(e)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(e,i){if(i){const t=i.pointCoordinate(e);if(null!=t)return t}const s=[e.x,e.y,0,1],a=[e.x,e.y,1,1];t.transformMat4(s,s,this.pixelMatrixInverse),t.transformMat4(a,a,this.pixelMatrixInverse);const o=s[3],r=a[3],n=s[1]/o,l=a[1]/r,c=s[2]/o,h=a[2]/r,u=c===h?0:(0-c)/(h-c);return new t.MercatorCoordinate(t.interpolate.number(s[0]/o,a[0]/r,u)/this.worldSize,t.interpolate.number(n,l,u)/this.worldSize)}coordinatePoint(e,i=0,s=this.pixelMatrix){const a=[e.x*this.worldSize,e.y*this.worldSize,i,1];return t.transformMat4(a,a,s),new t.Point(a[0]/a[3],a[1]/a[3])}getBounds(){const e=Math.max(0,this.height/2-this.getHorizon());return (new R).extend(this.pointLocation(new t.Point(0,e))).extend(this.pointLocation(new t.Point(this.width,e))).extend(this.pointLocation(new t.Point(this.width,this.height))).extend(this.pointLocation(new t.Point(0,this.height)))}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new R([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude]);}calculatePosMatrix(e,i=!1){const s=e.key,a=i?this._alignedPosMatrixCache:this._posMatrixCache;if(a[s])return a[s];const o=e.canonical,r=this.worldSize/this.zoomScale(o.z),n=o.x+Math.pow(2,o.z)*e.wrap,l=t.identity(new Float64Array(16));return t.translate(l,l,[n*r,o.y*r,0]),t.scale(l,l,[r/t.EXTENT,r/t.EXTENT,1]),t.multiply(l,i?this.alignedProjMatrix:this.projMatrix,l),a[s]=new Float32Array(l),a[s]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e,i,s,a,o=-90,r=90,n=-180,l=180;const c=this.size,h=this._unmodified;if(this.latRange){const i=this.latRange;o=t.mercatorYfromLat(i[1])*this.worldSize,r=t.mercatorYfromLat(i[0])*this.worldSize,e=r-o<c.y?c.y/(r-o):0;}if(this.lngRange){const e=this.lngRange;n=t.wrap(t.mercatorXfromLng(e[0])*this.worldSize,0,this.worldSize),l=t.wrap(t.mercatorXfromLng(e[1])*this.worldSize,0,this.worldSize),l<n&&(l+=this.worldSize),i=l-n<c.x?c.x/(l-n):0;}const u=this.point,d=Math.max(i||0,e||0);if(d)return this.center=this.unproject(new t.Point(i?(l+n)/2:u.x,e?(r+o)/2:u.y)),this.zoom+=this.scaleZoom(d),this._unmodified=h,void(this._constraining=!1);if(this.latRange){const t=u.y,e=c.y/2;t-e<o&&(a=o+e),t+e>r&&(a=r-e);}if(this.lngRange){const e=(n+l)/2,i=t.wrap(u.x,e-this.worldSize/2,e+this.worldSize/2),a=c.x/2;i-a<n&&(s=n+a),i+a>l&&(s=l-a);}void 0===s&&void 0===a||(this.center=this.unproject(new t.Point(void 0!==s?s:u.x,void 0!==a?a:u.y)).wrap()),this._unmodified=h,this._constraining=!1;}_calcMatrices(){if(!this.height)return;const e=this.centerOffset,i=this.point.x,s=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let a=t.identity(new Float64Array(16));t.scale(a,a,[this.width/2,-this.height/2,1]),t.translate(a,a,[1,-1,0]),this.labelPlaneMatrix=a,a=t.identity(new Float64Array(16)),t.scale(a,a,[1,-1,1]),t.translate(a,a,[-1,-1,0]),t.scale(a,a,[2/this.width,2/this.height,1]),this.glCoordMatrix=a,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const o=this._elevation<0?this.cameraToCenterDistance:this.cameraToSeaLevelDistance,r=Math.PI/2+this._pitch,n=this._fov*(.5+e.y/this.height),l=Math.sin(n)*o/Math.sin(t.clamp(Math.PI-r-n,.01,Math.PI-.01)),c=this.getHorizon(),h=2*Math.atan(c/this.cameraToCenterDistance)*(.5+e.y/(2*c)),u=Math.sin(h)*o/Math.sin(t.clamp(Math.PI-r-h,.01,Math.PI-.01)),d=Math.min(l,u),_=1.01*(Math.cos(Math.PI/2-this._pitch)*d+o),m=this.height/50;a=new Float64Array(16),t.perspective(a,this._fov,this.width/this.height,m,_),a[8]=2*-e.x/this.width,a[9]=2*e.y/this.height,t.scale(a,a,[1,-1,1]),t.translate(a,a,[0,0,-this.cameraToCenterDistance]),t.rotateX(a,a,this._pitch),t.rotateZ(a,a,this.angle),t.translate(a,a,[-i,-s,0]),this.mercatorMatrix=t.scale([],a,[this.worldSize,this.worldSize,this.worldSize]),t.scale(a,a,[1,1,this._pixelPerMeter]),this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,a),t.translate(a,a,[0,0,-this.elevation]),this.projMatrix=a,this.invProjMatrix=t.invert([],a),this.pixelMatrix3D=t.multiply(new Float64Array(16),this.labelPlaneMatrix,a);const p=this.width%2/2,f=this.height%2/2,g=Math.cos(this.angle),v=Math.sin(this.angle),x=i-Math.round(i)+g*p+v*f,y=s-Math.round(s)+g*f+v*p,b=new Float64Array(a);if(t.translate(b,b,[x>.5?x-1:x,y>.5?y-1:y,0]),this.alignedProjMatrix=b,a=t.invert(new Float64Array(16),this.pixelMatrix),!a)throw new Error(\"failed to invert matrix\");this.pixelMatrixInverse=a,this._posMatrixCache={},this._alignedPosMatrixCache={};}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const e=this.pointCoordinate(new t.Point(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(i,i,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,e))}getCameraQueryGeometry(e){const i=this.getCameraPoint();if(1===e.length)return [e[0],i];{let s=i.x,a=i.y,o=i.x,r=i.y;for(const t of e)s=Math.min(s,t.x),a=Math.min(a,t.y),o=Math.max(o,t.x),r=Math.max(r,t.y);return [new t.Point(s,a),new t.Point(o,a),new t.Point(o,r),new t.Point(s,r),new t.Point(s,a)]}}}class cs{constructor(e){this._hashName=e&&encodeURIComponent(e),t.bindAll([\"_getCurrentHash\",\"_onHashChange\",\"_updateHash\"],this),this._updateHash=function(t,e){let i=!1,s=null;const a=()=>{s=null,i&&(t(),s=setTimeout(a,300),i=!1);};return ()=>(i=!0,s||a(),s)}(this._updateHashUnthrottled.bind(this));}addTo(t){return this._map=t,addEventListener(\"hashchange\",this._onHashChange,!1),this._map.on(\"moveend\",this._updateHash),this}remove(){return removeEventListener(\"hashchange\",this._onHashChange,!1),this._map.off(\"moveend\",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,s=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.pow(10,s),o=Math.round(e.lng*a)/a,r=Math.round(e.lat*a)/a,n=this._map.getBearing(),l=this._map.getPitch();let c=\"\";if(c+=t?`/${o}/${r}/${i}`:`${i}/${r}/${o}`,(n||l)&&(c+=\"/\"+Math.round(10*n)/10),l&&(c+=`/${Math.round(l)}`),this._hashName){const t=this._hashName;let e=!1;const i=window.location.hash.slice(1).split(\"&\").map((i=>{const s=i.split(\"=\")[0];return s===t?(e=!0,`${s}=${c}`):i})).filter((t=>t));return e||i.push(`${t}=${c}`),`#${i.join(\"&\")}`}return `#${c}`}_getCurrentHash(){const t=window.location.hash.replace(\"#\",\"\");if(this._hashName){let e;return t.split(\"&\").map((t=>t.split(\"=\"))).forEach((t=>{t[0]===this._hashName&&(e=t);})),(e&&e[1]||\"\").split(\"/\")}return t.split(\"/\")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some((t=>isNaN(t)))){const e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return !1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t);}catch(t){}}}const hs={linearity:.3,easing:t.bezier(0,0,.3,1)},us=t.extend({deceleration:2500,maxSpeed:1400},hs),ds=t.extend({deceleration:20,maxSpeed:1400},hs),_s=t.extend({deceleration:1e3,maxSpeed:360},hs),ms=t.extend({deceleration:1e3,maxSpeed:90},hs);class ps{constructor(t){this._map=t,this.clear();}clear(){this._inertiaBuffer=[];}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.exported.now(),settings:e});}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=t.exported.now();for(;e.length>0&&i-e[0].time>160;)e.shift();}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new t.Point(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,t.panDelta&&i.pan._add(t.panDelta),t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(i.pan.mag()){const o=gs(i.pan.mag(),s,t.extend({},us,e||{}));a.offset=i.pan.mult(o.amount/i.pan.mag()),a.center=this._map.transform.center,fs(a,o);}if(i.zoom){const t=gs(i.zoom,s,ds);a.zoom=this._map.transform.zoom+t.amount,fs(a,t);}if(i.bearing){const e=gs(i.bearing,s,_s);a.bearing=this._map.transform.bearing+t.clamp(e.amount,-179,179),fs(a,e);}if(i.pitch){const t=gs(i.pitch,s,ms);a.pitch=this._map.transform.pitch+t.amount,fs(a,t);}if(a.zoom||a.bearing){const t=void 0===i.pinchAround?i.around:i.pinchAround;a.around=t?this._map.unproject(t):this._map.getCenter();}return this.clear(),t.extend(a,{noMoveStart:!0})}}function fs(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing);}function gs(e,i,s){const{maxSpeed:a,linearity:o,deceleration:r}=s,n=t.clamp(e*o/(i/1e3),-a,a),l=Math.abs(n)/(r*o);return {easing:s.easing,duration:1e3*l,amount:n*(l/2)}}class vs extends t.Event{preventDefault(){this._defaultPrevented=!0;}get defaultPrevented(){return this._defaultPrevented}constructor(e,s,a,o={}){const r=i.mousePos(s.getCanvasContainer(),a),n=s.unproject(r);super(e,t.extend({point:r,lngLat:n,originalEvent:a},o)),this._defaultPrevented=!1,this.target=s;}}class xs extends t.Event{preventDefault(){this._defaultPrevented=!0;}get defaultPrevented(){return this._defaultPrevented}constructor(e,s,a){const o=\"touchend\"===e?a.changedTouches:a.touches,r=i.touchPos(s.getCanvasContainer(),o),n=r.map((t=>s.unproject(t))),l=r.reduce(((t,e,i,s)=>t.add(e.div(s.length))),new t.Point(0,0));super(e,{points:r,point:l,lngLats:n,lngLat:s.unproject(l),originalEvent:a}),this._defaultPrevented=!1;}}class ys extends t.Event{preventDefault(){this._defaultPrevented=!0;}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1;}}class bs{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance;}reset(){delete this._mousedownPos;}wheel(t){return this._firePreventable(new ys(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new vs(t.type,this._map,t))}mouseup(t){this._map.fire(new vs(t.type,this._map,t));}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new vs(t.type,this._map,t));}dblclick(t){return this._firePreventable(new vs(t.type,this._map,t))}mouseover(t){this._map.fire(new vs(t.type,this._map,t));}mouseout(t){this._map.fire(new vs(t.type,this._map,t));}touchstart(t){return this._firePreventable(new xs(t.type,this._map,t))}touchmove(t){this._map.fire(new xs(t.type,this._map,t));}touchend(t){this._map.fire(new xs(t.type,this._map,t));}touchcancel(t){this._map.fire(new xs(t.type,this._map,t));}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return {}}isEnabled(){return !0}isActive(){return !1}enable(){}disable(){}}class ws{constructor(t){this._map=t;}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent;}mousemove(t){this._map.fire(new vs(t.type,this._map,t));}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1;}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new vs(\"contextmenu\",this._map,this._contextMenuEvent)),delete this._contextMenuEvent);}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new vs(t.type,this._map,t)),this._map.listens(\"contextmenu\")&&t.preventDefault();}isEnabled(){return !0}isActive(){return !1}enable(){}disable(){}}class Ts{constructor(t){this._map=t;}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return {lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.pointLocation(t.Point.convert(e),this._map.terrain)}}class Es{constructor(t,e){this._map=t,this._tr=new Ts(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1;}isEnabled(){return !!this._enabled}isActive(){return !!this._active}enable(){this.isEnabled()||(this._enabled=!0);}disable(){this.isEnabled()&&(this._enabled=!1);}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(i.disableDrag(),this._startPos=this._lastPos=e,this._active=!0);}mousemoveWindow(t,e){if(!this._active)return;const s=e;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const a=this._startPos;this._lastPos=s,this._box||(this._box=i.create(\"div\",\"maplibregl-boxzoom\",this._container),this._container.classList.add(\"maplibregl-crosshair\"),this._fireEvent(\"boxzoomstart\",t));const o=Math.min(a.x,s.x),r=Math.max(a.x,s.x),n=Math.min(a.y,s.y),l=Math.max(a.y,s.y);i.setTransform(this._box,`translate(${o}px,${n}px)`),this._box.style.width=r-o+\"px\",this._box.style.height=l-n+\"px\";}mouseupWindow(e,s){if(!this._active)return;if(0!==e.button)return;const a=this._startPos,o=s;if(this.reset(),i.suppressClick(),a.x!==o.x||a.y!==o.y)return this._map.fire(new t.Event(\"boxzoomend\",{originalEvent:e})),{cameraAnimation:t=>t.fitScreenCoordinates(a,o,this._tr.bearing,{linear:!0})};this._fireEvent(\"boxzoomcancel\",e);}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent(\"boxzoomcancel\",t));}reset(){this._active=!1,this._container.classList.remove(\"maplibregl-crosshair\"),this._box&&(i.remove(this._box),this._box=null),i.enableDrag(),delete this._startPos,delete this._lastPos;}_fireEvent(e,i){return this._map.fire(new t.Event(e,{originalEvent:i}))}}function Is(t,e){if(t.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${t.length}, points ${e.length}`);const i={};for(let s=0;s<t.length;s++)i[t[s].identifier]=e[s];return i}class Ss{constructor(t){this.reset(),this.numTouches=t.numTouches;}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1;}touchstart(e,i,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),s.length===this.numTouches&&(this.centroid=function(e){const i=new t.Point(0,0);for(const t of e)i._add(t);return i.div(e.length)}(i),this.touches=Is(s,i)));}touchmove(t,e,i){if(this.aborted||!this.centroid)return;const s=Is(i,e);for(const t in this.touches){const e=s[t];(!e||e.dist(this.touches[t])>30)&&(this.aborted=!0);}}touchend(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class Cs{constructor(t){this.singleTap=new Ss(t),this.numTaps=t.numTaps,this.reset();}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset();}touchstart(t,e,i){this.singleTap.touchstart(t,e,i);}touchmove(t,e,i){this.singleTap.touchmove(t,e,i);}touchend(t,e,i){const s=this.singleTap.touchend(t,e,i);if(s){const e=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(s)<30;if(e&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=s,this.count===this.numTaps)return this.reset(),s}}}class Ps{constructor(t){this._tr=new Ts(t),this._zoomIn=new Cs({numTouches:1,numTaps:2}),this._zoomOut=new Cs({numTouches:2,numTaps:1}),this.reset();}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset();}touchstart(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i);}touchmove(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i);}touchend(t,e,i){const s=this._zoomIn.touchend(t,e,i),a=this._zoomOut.touchend(t,e,i),o=this._tr;return s?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:o.zoom+1,around:o.unproject(s)},{originalEvent:t})}):a?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:o.zoom-1,around:o.unproject(a)},{originalEvent:t})}):void 0}touchcancel(){this.reset();}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}class Ds{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset();}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t);}_move(...t){const e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=e.length?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0));}dragMove(t,e){if(!this.isEnabled())return;const i=this._lastPoint;if(!i)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const s=e.length?e[0]:e;return !this._moved&&s.dist(i)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=s,this._move(i,s))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&i.suppressClick(),this.reset(t));}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const zs={0:1,2:2};class Ms{constructor(t){this._correctEvent=t.checkCorrectEvent;}startMove(t){const e=i.mouseButton(t);this._eventButton=e;}endMove(t){delete this._eventButton;}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return !function(t,e){const i=zs[e];return void 0===t.buttons||(t.buttons&i)!==i}(t,this._eventButton)}isValidEndEvent(t){return i.mouseButton(t)===this._eventButton}}class As{constructor(){this._firstTouch=void 0;}_isOneFingerTouch(t){return 1===t.targetTouches.length}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier;}endMove(t){delete this._firstTouch;}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}const Ls=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=function(t){t.preventDefault();};},Rs=({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:s=.8})=>{const a=new Ms({checkCorrectEvent:t=>0===i.mouseButton(t)&&t.ctrlKey||2===i.mouseButton(t)});return new Ds({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*s}),moveStateManager:a,enable:t,assignEvents:Ls})},ks=({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:s=-.5})=>{const a=new Ms({checkCorrectEvent:t=>0===i.mouseButton(t)&&t.ctrlKey||2===i.mouseButton(t)});return new Ds({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*s}),moveStateManager:a,enable:t,assignEvents:Ls})};class Bs{constructor(t,e){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset();}reset(){this._active=!1,this._touches={},this._sum=new t.Point(0,0),setTimeout((()=>{this._cancelCooperativeMessage=!1;}),200);}touchstart(t,e,i){return this._calculateTransform(t,e,i)}touchmove(t,e,i){if(this._map._cooperativeGestures&&(2===this._minTouches&&i.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,i.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(i.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,e,i)}touchend(t,e,i){this._calculateTransform(t,e,i),this._active&&i.length<this._minTouches&&this.reset();}touchcancel(){this.reset();}_calculateTransform(e,i,s){s.length>0&&(this._active=!0);const a=Is(s,i),o=new t.Point(0,0),r=new t.Point(0,0);let n=0;for(const t in a){const e=a[t],i=this._touches[t];i&&(o._add(e),r._add(e.sub(i)),n++,a[t]=e);}if(this._touches=a,n<this._minTouches||!r.mag())return;const l=r.div(n);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(n),panDelta:l}}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}class Fs{constructor(){this.reset();}reset(){this._active=!1,delete this._firstTwoTouches;}_start(t){}_move(t,e,i){return {}}touchstart(t,e,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([e[0],e[1]]));}touchmove(t,e,i){if(!this._firstTwoTouches)return;t.preventDefault();const[s,a]=this._firstTwoTouches,o=Us(i,e,s),r=Us(i,e,a);if(!o||!r)return;const n=this._aroundCenter?null:o.add(r).div(2);return this._move([o,r],n,t)}touchend(t,e,s){if(!this._firstTwoTouches)return;const[a,o]=this._firstTwoTouches,r=Us(s,e,a),n=Us(s,e,o);r&&n||(this._active&&i.suppressClick(),this.reset());}touchcancel(){this.reset();}enable(t){this._enabled=!0,this._aroundCenter=!!t&&\"center\"===t.around;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}function Us(t,e,i){for(let s=0;s<t.length;s++)if(t[s].identifier===i)return e[s]}function Os(t,e){return Math.log(t/e)/Math.LN2}class Ns extends Fs{reset(){super.reset(),delete this._distance,delete this._startDistance;}_start(t){this._startDistance=this._distance=t[0].dist(t[1]);}_move(t,e){const i=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Os(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Os(this._distance,i),pinchAround:e}}}function Gs(t,e){return 180*t.angleWith(e)/Math.PI}class Zs extends Fs{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector;}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1]);}_move(t,e){const i=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Gs(this._vector,i),pinchAround:e}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const e=25/(Math.PI*this._minDiameter)*360,i=Gs(t,this._startVector);return Math.abs(i)<e}}function Vs(t){return Math.abs(t.y)>Math.abs(t.x)}class qs extends Fs{constructor(t){super(),this._map=t;}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints;}touchstart(t,e,i){super.touchstart(t,e,i),this._currentTouchCount=i.length;}_start(t){this._lastPoints=t,Vs(t[0].sub(t[1]))&&(this._valid=!1);}_move(t,e,i){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const s=t[0].sub(this._lastPoints[0]),a=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(s,a,i.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(s.y+a.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;const s=t.mag()>=2,a=e.mag()>=2;if(!s&&!a)return;if(!s||!a)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=t.y>0==e.y>0;return Vs(t)&&Vs(e)&&o}}const js={panStep:100,bearingStep:15,pitchStep:10};class $s{constructor(t){this._tr=new Ts(t);const e=js;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1;}reset(){this._active=!1;}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,i=0,s=0,a=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),a=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),a=1);break;case 38:t.shiftKey?s=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?s=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,s=0),{cameraAnimation:r=>{const n=this._tr;r.easeTo({duration:300,easeId:\"keyboardHandler\",easing:Xs,zoom:e?Math.round(n.zoom)+e*(t.shiftKey?2:1):n.zoom,bearing:n.bearing+i*this._bearingStep,pitch:n.pitch+s*this._pitchStep,offset:[-a*this._panStep,-o*this._panStep],center:n.center},{originalEvent:t});}}}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0;}enableRotation(){this._rotationDisabled=!1;}}function Xs(t){return t*(2-t)}const Ws=4.000244140625;class Hs{constructor(e,i){this._map=e,this._tr=new Ts(e),this._el=e.getCanvasContainer(),this._handler=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,t.bindAll([\"_onTimeout\"],this);}setZoomRate(t){this._defaultZoomRate=t;}setWheelZoomRate(t){this._wheelZoomRate=t;}isEnabled(){return !!this._enabled}isActive(){return !!this._active||void 0!==this._finishTimeout}isZooming(){return !!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&\"center\"===t.around);}disable(){this.isEnabled()&&(this._enabled=!1);}wheel(e){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!e[this._map._metaKey])return;e.preventDefault();}let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const s=t.exported.now(),a=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,0!==i&&i%Ws==0?this._type=\"wheel\":0!==i&&Math.abs(i)<4?this._type=\"trackpad\":a>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(a*i)<200?\"trackpad\":\"wheel\",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault();}_onTimeout(t){this._type=\"wheel\",this._delta-=this._lastValue,this._active||this._start(t);}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const s=i.mousePos(this._el,e),a=this._tr;this._around=t.LngLat.convert(this._aroundCenter?a.center:a.unproject(s)),this._aroundPoint=a.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame());}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const e=this._tr.transform;if(0!==this._delta){const t=\"wheel\"===this._type&&Math.abs(this._delta)>Ws?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&0!==i&&(i=1/i);const s=\"number\"==typeof this._targetZoom?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(s*i))),\"wheel\"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0;}const i=\"number\"==typeof this._targetZoom?this._targetZoom:e.zoom,s=this._startZoom,a=this._easing;let o,r=!1;if(\"wheel\"===this._type&&s&&a){const e=Math.min((t.exported.now()-this._lastWheelEventTime)/200,1),n=a(e);o=t.interpolate.number(s,i,n),e<1?this._frameId||(this._frameId=!0):r=!0;}else o=i,r=!0;return this._active=!0,r&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout;}),200)),{noInertia:!0,needsRenderFrame:!r,zoomDelta:o-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=t.ease;if(this._prevEase){const e=this._prevEase,s=(t.exported.now()-e.start)/e.duration,a=e.easing(s+.01)-e.easing(s),o=.27/Math.sqrt(a*a+1e-4)*.01,r=Math.sqrt(.0729-o*o);i=t.bezier(o,r,.25,1);}return this._prevEase={start:t.exported.now(),duration:e,easing:i},i}reset(){this._active=!1;}}class Ks{constructor(t,e){this._clickZoom=t,this._tapZoom=e;}enable(){this._clickZoom.enable(),this._tapZoom.enable();}disable(){this._clickZoom.disable(),this._tapZoom.disable();}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Ys{constructor(t){this._tr=new Ts(t),this.reset();}reset(){this._active=!1;}dblclick(t,e){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(e)},{originalEvent:t});}}}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}class Js{constructor(){this._tap=new Cs({numTouches:1,numTaps:1}),this.reset();}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset();}touchstart(t,e,i){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=e[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(t,e,i));}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const s=e[0],a=s.y-this._swipePoint.y;return this._swipePoint=s,t.preventDefault(),this._active=!0,{zoomDelta:a/128}}}else this._tap.touchmove(t,e,i);}touchend(t,e,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(t,e,i)&&(this._tapTime=t.timeStamp);}touchcancel(){this.reset();}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}class Qs{constructor(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i;}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add(\"maplibregl-touch-drag-pan\");}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove(\"maplibregl-touch-drag-pan\");}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ta{constructor(t,e,i){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=i;}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable();}disable(){this._mouseRotate.disable(),this._mousePitch.disable();}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class ea{constructor(t,e,i,s){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=s,this._rotationDisabled=!1,this._enabled=!0;}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add(\"maplibregl-touch-zoom-rotate\");}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove(\"maplibregl-touch-zoom-rotate\");}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable();}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable();}}const ia=t=>t.zoom||t.drag||t.pitch||t.rotate;class sa extends t.Event{}function aa(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}class oa{constructor(e,s){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ps(e),this._bearingSnap=s.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(s),t.bindAll([\"handleEvent\",\"handleWindowEvent\"],this);const a=this._el;this._listeners=[[a,\"touchstart\",{passive:!0}],[a,\"touchmove\",{passive:!1}],[a,\"touchend\",void 0],[a,\"touchcancel\",void 0],[a,\"mousedown\",void 0],[a,\"mousemove\",void 0],[a,\"mouseup\",void 0],[document,\"mousemove\",{capture:!0}],[document,\"mouseup\",void 0],[a,\"mouseover\",void 0],[a,\"mouseout\",void 0],[a,\"dblclick\",void 0],[a,\"click\",void 0],[a,\"keydown\",{capture:!1}],[a,\"keyup\",void 0],[a,\"wheel\",{passive:!1}],[a,\"contextmenu\",void 0],[window,\"blur\",void 0]];for(const[t,e,s]of this._listeners)i.addEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,s);}destroy(){for(const[t,e,s]of this._listeners)i.removeEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,s);}_addDefaultHandlers(t){const e=this._map,s=e.getCanvasContainer();this._add(\"mapEvent\",new bs(e,t));const a=e.boxZoom=new Es(e,t);this._add(\"boxZoom\",a);const o=new Ps(e),r=new Ys(e);e.doubleClickZoom=new Ks(r,o),this._add(\"tapZoom\",o),this._add(\"clickZoom\",r);const n=new Js;this._add(\"tapDragZoom\",n);const l=e.touchPitch=new qs(e);this._add(\"touchPitch\",l);const c=Rs(t),h=ks(t);e.dragRotate=new ta(t,c,h),this._add(\"mouseRotate\",c,[\"mousePitch\"]),this._add(\"mousePitch\",h,[\"mouseRotate\"]);const u=(({enable:t,clickTolerance:e})=>{const s=new Ms({checkCorrectEvent:t=>0===i.mouseButton(t)&&!t.ctrlKey});return new Ds({clickTolerance:e,move:(t,e)=>({around:e,panDelta:e.sub(t)}),activateOnStart:!0,moveStateManager:s,enable:t,assignEvents:Ls})})(t),d=new Bs(t,e);e.dragPan=new Qs(s,u,d),this._add(\"mousePan\",u),this._add(\"touchPan\",d,[\"touchZoom\",\"touchRotate\"]);const _=new Zs,m=new Ns;e.touchZoomRotate=new ea(s,m,_,n),this._add(\"touchRotate\",_,[\"touchPan\",\"touchZoom\"]),this._add(\"touchZoom\",m,[\"touchPan\",\"touchRotate\"]);const p=e.scrollZoom=new Hs(e,this);this._add(\"scrollZoom\",p,[\"mousePan\"]);const f=e.keyboard=new $s(e);this._add(\"keyboard\",f),this._add(\"blockableMapEvent\",new ws(e));for(const i of [\"boxZoom\",\"doubleClickZoom\",\"tapDragZoom\",\"touchPitch\",\"dragRotate\",\"dragPan\",\"touchZoomRotate\",\"scrollZoom\",\"keyboard\"])t.interactive&&t[i]&&e[i].enable(t[i]);}_add(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e;}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[];}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return !0;return !1}isZooming(){return !!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return !!this._eventsInProgress.rotate}isMoving(){return Boolean(ia(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,i){for(const s in t)if(s!==i&&(!e||e.indexOf(s)<0))return !0;return !1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`);}_getMapTouches(t){const e=[];for(const i of t)this._el.contains(i.target)&&e.push(i);return e}handleEvent(t,e){if(\"blur\"===t.type)return void this.stop(!0);this._updatingCamera=!0;const s=\"renderFrame\"===t.type?void 0:t,a={needsRenderFrame:!1},o={},r={},n=t.touches,l=n?this._getMapTouches(n):void 0,c=l?i.touchPos(this._el,l):i.mousePos(this._el,t);for(const{handlerName:i,handler:n,allowed:h}of this._handlers){if(!n.isEnabled())continue;let u;this._blockedByActive(r,h,i)?n.reset():n[e||t.type]&&(u=n[e||t.type](t,c,l),this.mergeHandlerResult(a,o,u,i,s),u&&u.needsRenderFrame&&this._triggerRenderFrame()),(u||n.isActive())&&(r[i]=n);}const h={};for(const t in this._previousActiveHandlers)r[t]||(h[t]=s);this._previousActiveHandlers=r,(Object.keys(h).length||aa(a))&&(this._changes.push([a,o,h]),this._triggerRenderFrame()),(Object.keys(r).length||aa(a))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:u}=a;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map));}mergeHandlerResult(e,i,s,a,o){if(!s)return;t.extend(e,s);const r={handlerName:a,originalEvent:s.originalEvent||o};void 0!==s.zoomDelta&&(i.zoom=r),void 0!==s.panDelta&&(i.drag=r),void 0!==s.pitchDelta&&(i.pitch=r),void 0!==s.bearingDelta&&(i.rotate=r);}_applyChanges(){const e={},i={},s={};for(const[a,o,r]of this._changes)a.panDelta&&(e.panDelta=(e.panDelta||new t.Point(0,0))._add(a.panDelta)),a.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+a.zoomDelta),a.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+a.bearingDelta),a.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+a.pitchDelta),void 0!==a.around&&(e.around=a.around),void 0!==a.pinchAround&&(e.pinchAround=a.pinchAround),a.noInertia&&(e.noInertia=a.noInertia),t.extend(i,o),t.extend(s,r);this._updateMapTransform(e,i,s),this._changes=[];}_updateMapTransform(t,e,i){const s=this._map,a=s._getTransformForUpdate(),o=s.terrain;if(!(aa(t)||o&&this._terrainMovement))return this._fireEvents(e,i,!0);let{panDelta:r,zoomDelta:n,bearingDelta:l,pitchDelta:c,around:h,pinchAround:u}=t;void 0!==u&&(h=u),s._stop(!0),h=h||s.transform.centerPoint;const d=a.pointLocation(r?h.sub(r):h);l&&(a.bearing+=l),c&&(a.pitch+=c),n&&(a.zoom+=n),o?this._terrainMovement||!e.drag&&!e.zoom?e.drag&&this._terrainMovement?a.center=a.pointLocation(a.centerPoint.sub(r)):a.setLocationAtPoint(d,h):(this._terrainMovement=!0,a.freezeElevation=!0,a.setLocationAtPoint(d,h),this._map.once(\"moveend\",(()=>{a.freezeElevation=!1,this._terrainMovement=!1,a.recalculateZoom(s.terrain);}))):a.setLocationAtPoint(d,h),s._applyUpdatedTransform(a),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,i,!0);}_fireEvents(e,i,s){const a=ia(this._eventsInProgress),o=ia(e),r={};for(const t in e){const{originalEvent:i}=e[t];this._eventsInProgress[t]||(r[`${t}start`]=i),this._eventsInProgress[t]=e[t];}!a&&o&&this._fireEvent(\"movestart\",o.originalEvent);for(const t in r)this._fireEvent(t,r[t]);o&&this._fireEvent(\"move\",o.originalEvent);for(const t in e){const{originalEvent:i}=e[t];this._fireEvent(t,i);}const n={};let l;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:s}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],l=i[e]||s,n[`${t}end`]=l);}for(const t in n)this._fireEvent(t,n[t]);const c=ia(this._eventsInProgress);if(s&&(a||o)&&!c){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap<t&&t<this._bearingSnap;e?(i(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:l})):(this._map.fire(new t.Event(\"moveend\",{originalEvent:l})),i(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1;}}_fireEvent(e,i){this._map.fire(new t.Event(e,i?{originalEvent:i}:{}));}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new sa(\"renderFrame\",{timeStamp:t})),this._applyChanges();}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame());}}const ra={extend:(e,...i)=>t.extend(e,...i),run(t){t();},logToElement(t,e=!1,i=\"log\"){const s=window.document.getElementById(i);s&&(e&&(s.innerHTML=\"\"),s.innerHTML+=`<br>${t}`);}};class na extends t.Evented{constructor(e,i){super(),this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,t.bindAll([\"_renderFrameCallback\"],this),this.on(\"moveend\",(()=>{delete this._requestedCameraState;}));}getCenter(){return new t.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}panBy(e,i,s){return e=t.Point.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},i),s)}panTo(e,i,s){return this.easeTo(t.extend({center:e},i),s)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(e,i,s){return this.easeTo(t.extend({zoom:e},i),s)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(e,i,s){return this.easeTo(t.extend({bearing:e},i),s)}resetNorth(e,i){return this.rotateTo(0,t.extend({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),i),this}snapToNorth(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this}getPitch(){return this.transform.pitch}setPitch(t,e){return this.jumpTo({pitch:t},e),this}cameraForBounds(t,e){t=R.convert(t);const i=e&&e.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),i,e)}_cameraForBoxAndBearing(e,i,s,a){const o={top:0,bottom:0,right:0,left:0};if(\"number\"==typeof(a=t.extend({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},a)).padding){const t=a.padding;a.padding={top:t,bottom:t,right:t,left:t};}a.padding=t.extend(o,a.padding);const r=this.transform,n=r.padding,l=r.project(t.LngLat.convert(e)),c=r.project(t.LngLat.convert(i)),h=l.rotate(-s*Math.PI/180),u=c.rotate(-s*Math.PI/180),d=new t.Point(Math.max(h.x,u.x),Math.max(h.y,u.y)),_=new t.Point(Math.min(h.x,u.x),Math.min(h.y,u.y)),m=d.sub(_),p=(r.width-(n.left+n.right+a.padding.left+a.padding.right))/m.x,f=(r.height-(n.top+n.bottom+a.padding.top+a.padding.bottom))/m.y;if(f<0||p<0)return void t.warnOnce(\"Map cannot fit within canvas with the given bounds, padding, and/or offset.\");const g=Math.min(r.scaleZoom(r.scale*Math.min(p,f)),a.maxZoom),v=t.Point.convert(a.offset),x=new t.Point((a.padding.left-a.padding.right)/2,(a.padding.top-a.padding.bottom)/2).rotate(s*Math.PI/180),y=v.add(x).mult(r.scale/r.zoomScale(g));return {center:r.unproject(l.add(c).div(2).sub(y)),zoom:g,bearing:s}}fitBounds(t,e,i){return this._fitInternal(this.cameraForBounds(t,e),e,i)}fitScreenCoordinates(e,i,s,a,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(t.Point.convert(e)),this.transform.pointLocation(t.Point.convert(i)),s,a),a,o)}_fitInternal(e,i,s){return e?(delete(i=t.extend(e,i)).padding,i.linear?this.easeTo(i,s):this.flyTo(i,s)):this}jumpTo(e,i){this.stop();const s=this._getTransformForUpdate();let a=!1,o=!1,r=!1;return \"zoom\"in e&&s.zoom!==+e.zoom&&(a=!0,s.zoom=+e.zoom),void 0!==e.center&&(s.center=t.LngLat.convert(e.center)),\"bearing\"in e&&s.bearing!==+e.bearing&&(o=!0,s.bearing=+e.bearing),\"pitch\"in e&&s.pitch!==+e.pitch&&(r=!0,s.pitch=+e.pitch),null==e.padding||s.isPaddingEqual(e.padding)||(s.padding=e.padding),this._applyUpdatedTransform(s),this.fire(new t.Event(\"movestart\",i)).fire(new t.Event(\"move\",i)),a&&this.fire(new t.Event(\"zoomstart\",i)).fire(new t.Event(\"zoom\",i)).fire(new t.Event(\"zoomend\",i)),o&&this.fire(new t.Event(\"rotatestart\",i)).fire(new t.Event(\"rotate\",i)).fire(new t.Event(\"rotateend\",i)),r&&this.fire(new t.Event(\"pitchstart\",i)).fire(new t.Event(\"pitch\",i)).fire(new t.Event(\"pitchend\",i)),this.fire(new t.Event(\"moveend\",i))}calculateCameraOptionsFromTo(e,i,s,a=0){const o=t.MercatorCoordinate.fromLngLat(e,i),r=t.MercatorCoordinate.fromLngLat(s,a),n=r.x-o.x,l=r.y-o.y,c=r.z-o.z,h=Math.hypot(n,l,c);if(0===h)throw new Error(\"Can't calculate camera options with same From and To\");const u=Math.hypot(n,l),d=this.transform.scaleZoom(this.transform.cameraToCenterDistance/h/this.transform.tileSize),_=180*Math.atan2(n,-l)/Math.PI;let m=180*Math.acos(u/h)/Math.PI;return m=c<0?90-m:90+m,{center:r.toLngLat(),zoom:d,pitch:m,bearing:_}}easeTo(e,i){this._stop(!1,e.easeId),(!1===(e=t.extend({offset:[0,0],duration:500,easing:t.ease},e)).animate||!e.essential&&t.exported.prefersReducedMotion)&&(e.duration=0);const s=this._getTransformForUpdate(),a=this.getZoom(),o=this.getBearing(),r=this.getPitch(),n=this.getPadding(),l=\"zoom\"in e?+e.zoom:a,c=\"bearing\"in e?this._normalizeBearing(e.bearing,o):o,h=\"pitch\"in e?+e.pitch:r,u=\"padding\"in e?e.padding:s.padding,d=t.Point.convert(e.offset);let _=s.centerPoint.add(d);const m=s.pointLocation(_),p=t.LngLat.convert(e.center||m);this._normalizeCenter(p);const f=s.project(m),g=s.project(p).sub(f),v=s.zoomScale(l-a);let x,y;e.around&&(x=t.LngLat.convert(e.around),y=s.locationPoint(x));const b={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||l!==a,this._rotating=this._rotating||o!==c,this._pitching=this._pitching||h!==r,this._padding=!s.isPaddingEqual(u),this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,b),this.terrain&&this._prepareElevation(p),this._ease((m=>{if(this._zooming&&(s.zoom=t.interpolate.number(a,l,m)),this._rotating&&(s.bearing=t.interpolate.number(o,c,m)),this._pitching&&(s.pitch=t.interpolate.number(r,h,m)),this._padding&&(s.interpolatePadding(n,u,m),_=s.centerPoint.add(d)),this.terrain&&!e.freezeElevation&&this._updateElevation(m),x)s.setLocationAtPoint(x,y);else {const t=s.zoomScale(s.zoom-a),e=l>a?Math.min(2,v):Math.max(.5,v),i=Math.pow(e,1-m),o=s.unproject(f.add(g.mult(m*i)).mult(t));s.setLocationAtPoint(s.renderWorldCopies?o.wrap():o,_);}this._applyUpdatedTransform(s),this._fireMoveEvents(i);}),(t=>{this.terrain&&this._finalizeElevation(),this._afterEase(i,t);}),e),this}_prepareEase(e,i,s={}){this._moving=!0,i||s.moving||this.fire(new t.Event(\"movestart\",e)),this._zooming&&!s.zooming&&this.fire(new t.Event(\"zoomstart\",e)),this._rotating&&!s.rotating&&this.fire(new t.Event(\"rotatestart\",e)),this._pitching&&!s.pitching&&this.fire(new t.Event(\"pitchstart\",e));}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.transform.getElevation(t,this.terrain),this.transform.freezeElevation=!0;}_updateElevation(e){const i=this.transform.getElevation(this._elevationCenter,this.terrain);if(e<1&&i!==this._elevationTarget){const t=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(t-(i-(t*e+this._elevationStart))/(1-e)),this._elevationTarget=i;}this.transform.elevation=t.interpolate.number(this._elevationStart,this._elevationTarget,e);}_finalizeElevation(){this.transform.freezeElevation=!1,this.transform.recalculateZoom(this.terrain);}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const e=t.clone(),{center:i,zoom:s,pitch:a,bearing:o,elevation:r}=this.transformCameraUpdate(e);i&&(e.center=i),void 0!==s&&(e.zoom=s),void 0!==a&&(e.pitch=a),void 0!==o&&(e.bearing=o),void 0!==r&&(e.elevation=r),this.transform.apply(e);}_fireMoveEvents(e){this.fire(new t.Event(\"move\",e)),this._zooming&&this.fire(new t.Event(\"zoom\",e)),this._rotating&&this.fire(new t.Event(\"rotate\",e)),this._pitching&&this.fire(new t.Event(\"pitch\",e));}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const s=this._zooming,a=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,s&&this.fire(new t.Event(\"zoomend\",e)),a&&this.fire(new t.Event(\"rotateend\",e)),o&&this.fire(new t.Event(\"pitchend\",e)),this.fire(new t.Event(\"moveend\",e));}flyTo(e,i){if(!e.essential&&t.exported.prefersReducedMotion){const s=t.pick(e,[\"center\",\"zoom\",\"bearing\",\"pitch\",\"around\"]);return this.jumpTo(s,i)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);const s=this._getTransformForUpdate(),a=this.getZoom(),o=this.getBearing(),r=this.getPitch(),n=this.getPadding(),l=\"zoom\"in e?t.clamp(+e.zoom,s.minZoom,s.maxZoom):a,c=\"bearing\"in e?this._normalizeBearing(e.bearing,o):o,h=\"pitch\"in e?+e.pitch:r,u=\"padding\"in e?e.padding:s.padding,d=s.zoomScale(l-a),_=t.Point.convert(e.offset);let m=s.centerPoint.add(_);const p=s.pointLocation(m),f=t.LngLat.convert(e.center||p);this._normalizeCenter(f);const g=s.project(p),v=s.project(f).sub(g);let x=e.curve;const y=Math.max(s.width,s.height),b=y/d,w=v.mag();if(\"minZoom\"in e){const i=t.clamp(Math.min(e.minZoom,a,l),s.minZoom,s.maxZoom),o=y/s.zoomScale(i-a);x=Math.sqrt(o/w*2);}const T=x*x;function E(t){const e=(b*b-y*y+(t?-1:1)*T*T*w*w)/(2*(t?b:y)*T*w);return Math.log(Math.sqrt(e*e+1)-e)}function I(t){return (Math.exp(t)-Math.exp(-t))/2}function S(t){return (Math.exp(t)+Math.exp(-t))/2}const C=E(0);let P=function(t){return S(C)/S(C+x*t)},D=function(t){return y*((S(C)*(I(e=C+x*t)/S(e))-I(C))/T)/w;var e;},z=(E(1)-C)/x;if(Math.abs(w)<1e-6||!isFinite(z)){if(Math.abs(y-b)<1e-6)return this.easeTo(e,i);const t=b<y?-1:1;z=Math.abs(Math.log(b/y))/x,D=function(){return 0},P=function(e){return Math.exp(t*x*e)};}return e.duration=\"duration\"in e?+e.duration:1e3*z/(\"screenSpeed\"in e?+e.screenSpeed/x:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=o!==c,this._pitching=h!==r,this._padding=!s.isPaddingEqual(u),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(f),this._ease((d=>{const p=d*z,x=1/P(p);s.zoom=1===d?l:a+s.scaleZoom(x),this._rotating&&(s.bearing=t.interpolate.number(o,c,d)),this._pitching&&(s.pitch=t.interpolate.number(r,h,d)),this._padding&&(s.interpolatePadding(n,u,d),m=s.centerPoint.add(_)),this.terrain&&!e.freezeElevation&&this._updateElevation(d);const y=1===d?f:s.unproject(g.add(v.mult(D(p))).mult(x));s.setLocationAtPoint(s.renderWorldCopies?y.wrap():y,m),this._applyUpdatedTransform(s),this._fireMoveEvents(i);}),(()=>{this.terrain&&this._finalizeElevation(),this._afterEase(i);}),e),this}isEasing(){return !!this._easeFrameId}stop(){return this._stop()}_stop(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e);}if(!t){const t=this.handlers;t&&t.stop(!1);}return this}_ease(e,i,s){!1===s.animate||0===s.duration?(e(1),i()):(this._easeStart=t.exported.now(),this._easeOptions=s,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback));}_renderFrameCallback(){const e=Math.min((t.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop();}_normalizeBearing(e,i){e=t.wrap(e,-180,180);const s=Math.abs(e-i);return Math.abs(e-360-i)<s&&(e-=360),Math.abs(e+360-i)<s&&(e+=360),e}_normalizeCenter(t){const e=this.transform;if(!e.renderWorldCopies||e.lngRange)return;const i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0;}queryTerrainElevation(e){return this.terrain?this.transform.getElevation(t.LngLat.convert(e),this.terrain)-this.transform.elevation:null}}class la{constructor(e={}){this.options=e,t.bindAll([\"_toggleAttribution\",\"_updateData\",\"_updateCompact\",\"_updateCompactMinimize\"],this);}getDefaultPosition(){return \"bottom-right\"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=i.create(\"details\",\"maplibregl-ctrl maplibregl-ctrl-attrib\"),this._compactButton=i.create(\"summary\",\"maplibregl-ctrl-attrib-button\",this._container),this._compactButton.addEventListener(\"click\",this._toggleAttribution),this._setElementTitle(this._compactButton,\"ToggleAttribution\"),this._innerContainer=i.create(\"div\",\"maplibregl-ctrl-attrib-inner\",this._container),this._updateAttributions(),this._updateCompact(),this._map.on(\"styledata\",this._updateData),this._map.on(\"sourcedata\",this._updateData),this._map.on(\"terrain\",this._updateData),this._map.on(\"resize\",this._updateCompact),this._map.on(\"drag\",this._updateCompactMinimize),this._container}onRemove(){i.remove(this._container),this._map.off(\"styledata\",this._updateData),this._map.off(\"sourcedata\",this._updateData),this._map.off(\"terrain\",this._updateData),this._map.off(\"resize\",this._updateCompact),this._map.off(\"drag\",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0;}_setElementTitle(t,e){const i=this._map._getUIString(`AttributionControl.${e}`);t.title=i,t.setAttribute(\"aria-label\",i);}_toggleAttribution(){this._container.classList.contains(\"maplibregl-compact\")&&(this._container.classList.contains(\"maplibregl-compact-show\")?(this._container.setAttribute(\"open\",\"\"),this._container.classList.remove(\"maplibregl-compact-show\")):(this._container.classList.add(\"maplibregl-compact-show\"),this._container.removeAttribute(\"open\")));}_updateData(t){!t||\"metadata\"!==t.sourceDataType&&\"visibility\"!==t.sourceDataType&&\"style\"!==t.dataType&&\"terrain\"!==t.type||this._updateAttributions();}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((t=>\"string\"!=typeof t?\"\":t))):\"string\"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id;}const e=this._map.style.sourceCaches;for(const i in e){const s=e[i];if(s.used||s.usedForTerrain){const e=s.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution);}}t=t.filter((t=>String(t).trim())),t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,i)=>{for(let s=i+1;s<t.length;s++)if(t[s].indexOf(e)>=0)return !1;return !0}));const i=t.join(\" | \");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.innerHTML=i,this._container.classList.remove(\"maplibregl-attrib-empty\")):this._container.classList.add(\"maplibregl-attrib-empty\"),this._updateCompact(),this._editLink=null);}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute(\"open\",\"\"):this._container.classList.contains(\"maplibregl-compact\")||this._container.classList.contains(\"maplibregl-attrib-empty\")||(this._container.setAttribute(\"open\",\"\"),this._container.classList.add(\"maplibregl-compact\",\"maplibregl-compact-show\")):(this._container.setAttribute(\"open\",\"\"),this._container.classList.contains(\"maplibregl-compact\")&&this._container.classList.remove(\"maplibregl-compact\",\"maplibregl-compact-show\"));}_updateCompactMinimize(){this._container.classList.contains(\"maplibregl-compact\")&&this._container.classList.contains(\"maplibregl-compact-show\")&&this._container.classList.remove(\"maplibregl-compact-show\");}}class ca{constructor(e={}){this.options=e,t.bindAll([\"_updateCompact\"],this);}getDefaultPosition(){return \"bottom-left\"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=i.create(\"div\",\"maplibregl-ctrl\");const e=i.create(\"a\",\"maplibregl-ctrl-logo\");return e.target=\"_blank\",e.rel=\"noopener nofollow\",e.href=\"https://maplibre.org/\",e.setAttribute(\"aria-label\",this._map._getUIString(\"LogoControl.Title\")),e.setAttribute(\"rel\",\"noopener nofollow\"),this._container.appendChild(e),this._container.style.display=\"block\",this._map.on(\"resize\",this._updateCompact),this._updateCompact(),this._container}onRemove(){i.remove(this._container),this._map.off(\"resize\",this._updateCompact),this._map=void 0,this._compact=void 0;}_updateCompact(){const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add(\"maplibregl-compact\"):e.classList.remove(\"maplibregl-compact\");}}}class ha{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1;}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,i=e?this._queue.concat(e):this._queue;for(const e of i)if(e.id===t)return void(e.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error(\"Attempting to run(), but is already running.\");const e=this._currentlyRunning=this._queue;this._queue=[];for(const i of e)if(!i.cancelled&&(i.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1;}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[];}}const ua={\"AttributionControl.ToggleAttribution\":\"Toggle attribution\",\"AttributionControl.MapFeedback\":\"Map feedback\",\"FullscreenControl.Enter\":\"Enter fullscreen\",\"FullscreenControl.Exit\":\"Exit fullscreen\",\"GeolocateControl.FindMyLocation\":\"Find my location\",\"GeolocateControl.LocationNotAvailable\":\"Location not available\",\"LogoControl.Title\":\"Mapbox logo\",\"NavigationControl.ResetBearing\":\"Reset bearing to north\",\"NavigationControl.ZoomIn\":\"Zoom in\",\"NavigationControl.ZoomOut\":\"Zoom out\",\"ScaleControl.Feet\":\"ft\",\"ScaleControl.Meters\":\"m\",\"ScaleControl.Kilometers\":\"km\",\"ScaleControl.Miles\":\"mi\",\"ScaleControl.NauticalMiles\":\"nm\",\"TerrainControl.enableTerrain\":\"Enable terrain\",\"TerrainControl.disableTerrain\":\"Disable terrain\"};var da=t.createLayout([{name:\"a_pos3d\",type:\"Int16\",components:3}]);class _a extends t.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom;}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null;}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const s={};for(const a of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i}))s[a.key]=!0,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.posMatrix=new Float64Array(16),t.ortho(a.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),this._tiles[a.key]=new W(a,this.tileSize));for(const t in this._tiles)s[t]||delete this._tiles[t];}freeRtt(t){for(const e in this._tiles){const i=this._tiles[e];(!t||i.tileID.equals(t)||i.tileID.isChildOf(t)||t.isChildOf(i.tileID))&&(i.rtt=[]);}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(e){const i={};for(const s of this._renderableTilesKeys){const a=this._tiles[s].tileID;if(a.canonical.equals(e.canonical)){const a=e.clone();a.posMatrix=new Float64Array(16),t.ortho(a.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),i[s]=a;}else if(a.canonical.isChildOf(e.canonical)){const o=e.clone();o.posMatrix=new Float64Array(16);const r=a.canonical.z-e.canonical.z,n=a.canonical.x-(a.canonical.x>>r<<r),l=a.canonical.y-(a.canonical.y>>r<<r),c=t.EXTENT>>r;t.ortho(o.posMatrix,0,c,0,c,0,1),t.translate(o.posMatrix,o.posMatrix,[-n*c,-l*c,0]),i[s]=o;}else if(e.canonical.isChildOf(a.canonical)){const o=e.clone();o.posMatrix=new Float64Array(16);const r=e.canonical.z-a.canonical.z,n=e.canonical.x-(e.canonical.x>>r<<r),l=e.canonical.y-(e.canonical.y>>r<<r),c=t.EXTENT>>r;t.ortho(o.posMatrix,0,t.EXTENT,0,t.EXTENT,0,1),t.translate(o.posMatrix,o.posMatrix,[n*c,l*c,0]),t.scale(o.posMatrix,o.posMatrix,[1/2**r,1/2**r,0]),i[s]=o;}}return i}getSourceTile(t,e){const i=this.sourceCache._source;let s=t.overscaledZ-this.deltaZoom;if(s>i.maxzoom&&(s=i.maxzoom),s<i.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(s).key);let a=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!a||!a.dem)&&e)for(;s>=i.minzoom&&(!a||!a.dem);)a=this.sourceCache.getTileByID(t.scaledTo(s--).key);return a}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter((e=>e.timeAdded>=t))}}class ma{constructor(t,e,i){this.painter=t,this.sourceCache=new _a(e),this.options=i,this.exaggeration=\"number\"==typeof i.exaggeration?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024;}getDEMElevation(e,i,s,a=t.EXTENT){if(!(i>=0&&i<a&&s>=0&&s<a))return 0;let o=0;const r=this.getTerrainData(e);if(r.tile&&r.tile.dem){const e=function(t,e,i){var s=e[0],a=e[1];return t[0]=i[0]*s+i[4]*a+i[12],t[1]=i[1]*s+i[5]*a+i[13],t}([],[i/a*t.EXTENT,s/a*t.EXTENT],r.u_terrain_matrix),n=[e[0]*r.tile.dem.dim,e[1]*r.tile.dem.dim],l=[Math.floor(n[0]),Math.floor(n[1])],c=r.tile.dem.get(l[0],l[1]),h=r.tile.dem.get(l[0],l[1]+1),u=r.tile.dem.get(l[0]+1,l[1]),d=r.tile.dem.get(l[0]+1,l[1]+1);o=t.interpolate.number(t.interpolate.number(c,h,n[0]-l[0]),t.interpolate.number(u,d,n[0]-l[0]),n[1]-l[1]);}return o}getElevation(e,i,s,a=t.EXTENT){return this.getDEMElevation(e,i,s,a)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const e=this.painter.context,i=new t.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new y(e,i,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new y(e,new t.RGBAImage({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=t.identity([]);}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const t=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new y(t,i.dem.getPixels(),t.gl.RGBA,{premultiply:!1}),i.demTexture.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1;}const s=i&&i+i.tileID.key+e.key;if(s&&!this._demMatrixCache[s]){const s=this.sourceCache.sourceCache._source.maxzoom;let a=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=s?a=e.canonical.z-s:t.warnOnce(\"cannot calculate elevation if elevation maxzoom > source.maxzoom\"));const o=e.canonical.x-(e.canonical.x>>a<<a),r=e.canonical.y-(e.canonical.y>>a<<a),n=t.fromScaling(new Float64Array(16),[1/(t.EXTENT<<a),1/(t.EXTENT<<a),0]);t.translate(n,n,[o*t.EXTENT,r*t.EXTENT,0]),this._demMatrixCache[e.key]={matrix:n,coord:e};}return {u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(t){const e=this.painter,i=e.width/devicePixelRatio,s=e.height/devicePixelRatio;return !this._fbo||this._fbo.width===i&&this._fbo.height===s||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new y(e.context,{width:i,height:s,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new y(e.context,{width:i,height:s,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(i,s,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,i,s))),this._fbo.colorAttachment.set(\"coords\"===t?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let t=0,e=0;t<this._coordsTextureSize;t++)for(let s=0;s<this._coordsTextureSize;s++,e+=4)i[e+0]=255&s,i[e+1]=255&t,i[e+2]=s>>8<<4|t>>8,i[e+3]=0;const s=new t.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),a=new y(e,s,e.gl.RGBA,{premultiply:!1});return a.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=a,a}pointCoordinate(e){const i=new Uint8Array(4),s=this.painter.context,a=s.gl;s.bindFramebuffer.set(this.getFramebuffer(\"coords\").framebuffer),a.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,a.RGBA,a.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null);const o=i[0]+(i[2]>>4<<8),r=i[1]+((15&i[2])<<8),n=this.coordsIndex[255-i[3]],l=n&&this.sourceCache.getTileByID(n);if(!l)return null;const c=this._coordsTextureSize,h=(1<<l.tileID.canonical.z)*c;return new t.MercatorCoordinate((l.tileID.canonical.x*c+o)/h,(l.tileID.canonical.y*c+r)/h,this.getElevation(l.tileID,o,r,c))}getTerrainMesh(){if(this._mesh)return this._mesh;const e=this.painter.context,i=new t.Pos3dArray,s=new t.TriangleIndexArray,a=this.meshSize,o=t.EXTENT/a,r=a*a;for(let t=0;t<=a;t++)for(let e=0;e<=a;e++)i.emplaceBack(e*o,t*o,0);for(let t=0;t<r;t+=a+1)for(let e=0;e<a;e++)s.emplaceBack(e+t,a+e+t+1,a+e+t+2),s.emplaceBack(e+t,a+e+t+2,e+t+1);const n=i.length,l=n+2*(a+1);for(const e of [0,1])for(let s=0;s<=a;s++)for(const a of [0,1])i.emplaceBack(s*o,e*t.EXTENT,a);for(let t=0;t<2*a;t+=2)s.emplaceBack(l+t,l+t+1,l+t+3),s.emplaceBack(l+t,l+t+3,l+t+2),s.emplaceBack(n+t,n+t+3,n+t+1),s.emplaceBack(n+t,n+t+2,n+t+3);const c=i.length,h=c+2*(a+1);for(const e of [0,1])for(let s=0;s<=a;s++)for(const a of [0,1])i.emplaceBack(e*t.EXTENT,s*o,a);for(let t=0;t<2*a;t+=2)s.emplaceBack(c+t,c+t+1,c+t+3),s.emplaceBack(c+t,c+t+3,c+t+2),s.emplaceBack(h+t,h+t+3,h+t+1),s.emplaceBack(h+t,h+t+2,h+t+3);return this._mesh={indexBuffer:e.createIndexBuffer(s),vertexBuffer:e.createVertexBuffer(i,da.members),segments:t.SegmentVector.simpleSegment(0,0,i.length,s.length)},this._mesh}getMeshFrameDelta(e){return 2*Math.PI*t.earthRadius/Math.pow(2,e)/5}getMinMaxElevation(t){const e=this.getTerrainData(t).tile,i={minElevation:null,maxElevation:null};return e&&e.dem&&(i.minElevation=e.dem.min*this.exaggeration,i.maxElevation=e.dem.max*this.exaggeration),i}}class pa{constructor(t,e,i){this._context=t,this._size=e,this._tileSize=i,this._objects=[],this._recentlyUsed=[],this._stamp=0;}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy();}_createObject(t){const e=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),i=new y(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return i.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),e.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),e.colorAttachment.set(i.texture),{id:t,fbo:e,texture:i,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((e=>t.id!==e)),this._recentlyUsed.push(t.id);}stampObject(t){t.stamp=++this._stamp;}getOrCreateFreeObject(){for(const t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error(\"No free RenderPool available, call freeAllObjects() required!\");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1;}freeAllObjects(){for(const t of this._objects)this.freeObject(t);}isFull(){return !(this._objects.length<this._size)&&!1===this._objects.some((t=>!t.inUse))}}const fa={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class ga{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new pa(t.context,30,e.sourceCache.tileSize*e.qualityFactor);}destruct(){this.pool.destruct();}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,e){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter((i=>!t._layers[i].isHidden(e))),this._coordsDescendingInv={};for(const e in t.sourceCaches){this._coordsDescendingInv[e]={};const i=t.sourceCaches[e].getVisibleCoordinates();for(const t of i){const i=this.terrain.sourceCache.getTerrainCoords(t);for(const t in i)this._coordsDescendingInv[e][t]||(this._coordsDescendingInv[e][t]=[]),this._coordsDescendingInv[e][t].push(i[t]);}}this._coordsDescendingInvStr={};for(const e of t._order){const i=t._layers[e],s=i.source;if(fa[i.type]&&!this._coordsDescendingInvStr[s]){this._coordsDescendingInvStr[s]={};for(const t in this._coordsDescendingInv[s])this._coordsDescendingInvStr[s][t]=this._coordsDescendingInv[s][t].map((t=>t.key)).sort().join();}}for(const t of this._renderableTiles)for(const e in this._coordsDescendingInvStr){const i=this._coordsDescendingInvStr[e][t.tileID.key];i&&i!==t.rttCoords[e]&&(t.rtt=[]);}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return !1;const i=e.type,s=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(fa[i]&&(this._prevType&&fa[this._prevType]||this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(e.id),!a))return !0;if(fa[this._prevType]||fa[i]&&a){this._prevType=i;const e=this._stacks.length-1,a=this._stacks[e]||[];for(const i of this._renderableTiles){if(this.pool.isFull()&&(is(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(i),i.rtt[e]){const t=this.pool.getObjectForId(i.rtt[e].id);if(t.stamp===i.rtt[e].stamp){this.pool.useObject(t);continue}}const o=this.pool.getOrCreateFreeObject();this.pool.useObject(o),this.pool.stampObject(o),i.rtt[e]={id:o.id,stamp:o.stamp},s.context.bindFramebuffer.set(o.fbo.framebuffer),s.context.clear({color:t.Color.transparent,stencil:0}),s.currentStencilSource=void 0;for(let t=0;t<a.length;t++){const e=s.style._layers[a[t]],r=e.source?this._coordsDescendingInv[e.source][i.tileID.key]:[i.tileID];s.context.viewport.set([0,0,o.fbo.width,o.fbo.height]),s._renderTileClippingMasks(e,r),s.renderLayer(s,s.style.sourceCaches[e.source],e,r),e.source&&(i.rttCoords[e.source]=this._coordsDescendingInvStr[e.source][i.tileID.key]);}}return is(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),fa[i]}return !1}}const va=e,xa={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:t.config.MAX_TILE_CACHE_ZOOM_LEVELS,localIdeographFontFamily:\"sans-serif\",transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,validateStyle:!0},ya=t=>{t.touchstart=t.dragStart,t.touchmoveWindow=t.dragMove,t.touchend=t.dragEnd;},ba={showCompass:!0,showZoom:!0,visualizePitch:!1};class wa{constructor(e,s,a=!1){this._clickTolerance=10;const o=e.dragRotate._mouseRotate.getClickTolerance(),r=e.dragRotate._mousePitch.getClickTolerance();this.element=s,this.mouseRotate=Rs({clickTolerance:o,enable:!0}),this.touchRotate=(({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:i=.8})=>{const s=new As;return new Ds({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*i}),moveStateManager:s,enable:t,assignEvents:ya})})({clickTolerance:o,enable:!0}),this.map=e,a&&(this.mousePitch=ks({clickTolerance:r,enable:!0}),this.touchPitch=(({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:i=-.5})=>{const s=new As;return new Ds({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*i}),moveStateManager:s,enable:t,assignEvents:ya})})({clickTolerance:r,enable:!0})),t.bindAll([\"mousedown\",\"mousemove\",\"mouseup\",\"touchstart\",\"touchmove\",\"touchend\",\"reset\"],this),i.addEventListener(s,\"mousedown\",this.mousedown),i.addEventListener(s,\"touchstart\",this.touchstart,{passive:!1}),i.addEventListener(s,\"touchcancel\",this.reset);}startMouse(t,e){this.mouseRotate.dragStart(t,e),this.mousePitch&&this.mousePitch.dragStart(t,e),i.disableDrag();}startTouch(t,e){this.touchRotate.dragStart(t,e),this.touchPitch&&this.touchPitch.dragStart(t,e),i.disableDrag();}moveMouse(t,e){const i=this.map,{bearingDelta:s}=this.mouseRotate.dragMove(t,e)||{};if(s&&i.setBearing(i.getBearing()+s),this.mousePitch){const{pitchDelta:s}=this.mousePitch.dragMove(t,e)||{};s&&i.setPitch(i.getPitch()+s);}}moveTouch(t,e){const i=this.map,{bearingDelta:s}=this.touchRotate.dragMove(t,e)||{};if(s&&i.setBearing(i.getBearing()+s),this.touchPitch){const{pitchDelta:s}=this.touchPitch.dragMove(t,e)||{};s&&i.setPitch(i.getPitch()+s);}}off(){const t=this.element;i.removeEventListener(t,\"mousedown\",this.mousedown),i.removeEventListener(t,\"touchstart\",this.touchstart,{passive:!1}),i.removeEventListener(window,\"touchmove\",this.touchmove,{passive:!1}),i.removeEventListener(window,\"touchend\",this.touchend),i.removeEventListener(t,\"touchcancel\",this.reset),this.offTemp();}offTemp(){i.enableDrag(),i.removeEventListener(window,\"mousemove\",this.mousemove),i.removeEventListener(window,\"mouseup\",this.mouseup),i.removeEventListener(window,\"touchmove\",this.touchmove,{passive:!1}),i.removeEventListener(window,\"touchend\",this.touchend);}mousedown(e){this.startMouse(t.extend({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),i.mousePos(this.element,e)),i.addEventListener(window,\"mousemove\",this.mousemove),i.addEventListener(window,\"mouseup\",this.mouseup);}mousemove(t){this.moveMouse(t,i.mousePos(this.element,t));}mouseup(t){this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp();}touchstart(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=i.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),i.addEventListener(window,\"touchmove\",this.touchmove,{passive:!1}),i.addEventListener(window,\"touchend\",this.touchend));}touchmove(t){1!==t.targetTouches.length?this.reset():(this._lastPos=i.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos));}touchend(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp();}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp();}}let Ta;function Ea(e,i,s){if(e=new t.LngLat(e.lng,e.lat),i){const a=new t.LngLat(e.lng-360,e.lat),o=new t.LngLat(e.lng+360,e.lat),r=s.locationPoint(e).distSqr(i);s.locationPoint(a).distSqr(i)<r?e=a:s.locationPoint(o).distSqr(i)<r&&(e=o);}for(;Math.abs(e.lng-s.center.lng)>180;){const t=s.locationPoint(e);if(t.x>=0&&t.y>=0&&t.x<=s.width&&t.y<=s.height)break;e.lng>s.center.lng?e.lng-=360:e.lng+=360;}return e}const Ia={center:\"translate(-50%,-50%)\",top:\"translate(-50%,0)\",\"top-left\":\"translate(0,0)\",\"top-right\":\"translate(-100%,0)\",bottom:\"translate(-50%,-100%)\",\"bottom-left\":\"translate(0,-100%)\",\"bottom-right\":\"translate(-100%,-100%)\",left:\"translate(0,-50%)\",right:\"translate(-100%,-50%)\"};function Sa(t,e,i){const s=t.classList;for(const t in Ia)s.remove(`maplibregl-${i}-anchor-${t}`);s.add(`maplibregl-${i}-anchor-${e}`);}class Ca extends t.Evented{constructor(e,s){if(super(),(e instanceof HTMLElement||s)&&(e=t.extend({element:e},s)),t.bindAll([\"_update\",\"_onMove\",\"_onUp\",\"_addDragHandler\",\"_onMapClick\",\"_onKeyPress\"],this),this._anchor=e&&e.anchor||\"center\",this._color=e&&e.color||\"#3FB1CE\",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._isDragging=!1,this._state=\"inactive\",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||\"auto\",this._pitchAlignment=e&&e.pitchAlignment&&\"auto\"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,e&&e.element)this._element=e.element,this._offset=t.Point.convert(e&&e.offset||[0,0]);else {this._defaultMarker=!0,this._element=i.create(\"div\"),this._element.setAttribute(\"aria-label\",\"Map marker\");const s=i.createNS(\"http://www.w3.org/2000/svg\",\"svg\"),a=41,o=27;s.setAttributeNS(null,\"display\",\"block\"),s.setAttributeNS(null,\"height\",`${a}px`),s.setAttributeNS(null,\"width\",`${o}px`),s.setAttributeNS(null,\"viewBox\",`0 0 ${o} ${a}`);const r=i.createNS(\"http://www.w3.org/2000/svg\",\"g\");r.setAttributeNS(null,\"stroke\",\"none\"),r.setAttributeNS(null,\"stroke-width\",\"1\"),r.setAttributeNS(null,\"fill\",\"none\"),r.setAttributeNS(null,\"fill-rule\",\"evenodd\");const n=i.createNS(\"http://www.w3.org/2000/svg\",\"g\");n.setAttributeNS(null,\"fill-rule\",\"nonzero\");const l=i.createNS(\"http://www.w3.org/2000/svg\",\"g\");l.setAttributeNS(null,\"transform\",\"translate(3.0, 29.0)\"),l.setAttributeNS(null,\"fill\",\"#000000\");const c=[{rx:\"10.5\",ry:\"5.25002273\"},{rx:\"10.5\",ry:\"5.25002273\"},{rx:\"9.5\",ry:\"4.77275007\"},{rx:\"8.5\",ry:\"4.29549936\"},{rx:\"7.5\",ry:\"3.81822308\"},{rx:\"6.5\",ry:\"3.34094679\"},{rx:\"5.5\",ry:\"2.86367051\"},{rx:\"4.5\",ry:\"2.38636864\"}];for(const t of c){const e=i.createNS(\"http://www.w3.org/2000/svg\",\"ellipse\");e.setAttributeNS(null,\"opacity\",\"0.04\"),e.setAttributeNS(null,\"cx\",\"10.5\"),e.setAttributeNS(null,\"cy\",\"5.80029008\"),e.setAttributeNS(null,\"rx\",t.rx),e.setAttributeNS(null,\"ry\",t.ry),l.appendChild(e);}const h=i.createNS(\"http://www.w3.org/2000/svg\",\"g\");h.setAttributeNS(null,\"fill\",this._color);const u=i.createNS(\"http://www.w3.org/2000/svg\",\"path\");u.setAttributeNS(null,\"d\",\"M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z\"),h.appendChild(u);const d=i.createNS(\"http://www.w3.org/2000/svg\",\"g\");d.setAttributeNS(null,\"opacity\",\"0.25\"),d.setAttributeNS(null,\"fill\",\"#000000\");const _=i.createNS(\"http://www.w3.org/2000/svg\",\"path\");_.setAttributeNS(null,\"d\",\"M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z\"),d.appendChild(_);const m=i.createNS(\"http://www.w3.org/2000/svg\",\"g\");m.setAttributeNS(null,\"transform\",\"translate(6.0, 7.0)\"),m.setAttributeNS(null,\"fill\",\"#FFFFFF\");const p=i.createNS(\"http://www.w3.org/2000/svg\",\"g\");p.setAttributeNS(null,\"transform\",\"translate(8.0, 8.0)\");const f=i.createNS(\"http://www.w3.org/2000/svg\",\"circle\");f.setAttributeNS(null,\"fill\",\"#000000\"),f.setAttributeNS(null,\"opacity\",\"0.25\"),f.setAttributeNS(null,\"cx\",\"5.5\"),f.setAttributeNS(null,\"cy\",\"5.5\"),f.setAttributeNS(null,\"r\",\"5.4999962\");const g=i.createNS(\"http://www.w3.org/2000/svg\",\"circle\");g.setAttributeNS(null,\"fill\",\"#FFFFFF\"),g.setAttributeNS(null,\"cx\",\"5.5\"),g.setAttributeNS(null,\"cy\",\"5.5\"),g.setAttributeNS(null,\"r\",\"5.4999962\"),p.appendChild(f),p.appendChild(g),n.appendChild(l),n.appendChild(h),n.appendChild(d),n.appendChild(m),n.appendChild(p),s.appendChild(n),s.setAttributeNS(null,\"height\",a*this._scale+\"px\"),s.setAttributeNS(null,\"width\",o*this._scale+\"px\"),this._element.appendChild(s),this._offset=t.Point.convert(e&&e.offset||[0,-14]);}this._element.classList.add(\"maplibregl-marker\"),this._element.addEventListener(\"dragstart\",(t=>{t.preventDefault();})),this._element.addEventListener(\"mousedown\",(t=>{t.preventDefault();})),Sa(this._element,this._anchor,\"marker\"),this._popup=null;}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on(\"move\",this._update),t.on(\"moveend\",this._update),this.setDraggable(this._draggable),this._update(),this._map.on(\"click\",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off(\"click\",this._onMapClick),this._map.off(\"move\",this._update),this._map.off(\"moveend\",this._update),this._map.off(\"mousedown\",this._addDragHandler),this._map.off(\"touchstart\",this._addDragHandler),this._map.off(\"mouseup\",this._onUp),this._map.off(\"touchend\",this._onUp),this._map.off(\"mousemove\",this._onMove),this._map.off(\"touchmove\",this._onMove),delete this._map),i.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener(\"keypress\",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute(\"tabindex\")),t){if(!(\"offset\"in t.options)){const e=38.1,i=13.5,s=Math.sqrt(Math.pow(i,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],\"top-left\":[0,0],\"top-right\":[0,0],bottom:[0,-e],\"bottom-left\":[s,-1*(e-i+s)],\"bottom-right\":[-s,-1*(e-i+s)],left:[i,-1*(e-i)],right:[-i,-1*(e-i)]}:this._offset;}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute(\"tabindex\"),this._originalTabIndex||this._element.setAttribute(\"tabindex\",\"0\"),this._element.addEventListener(\"keypress\",this._onKeyPress);}return this}_onKeyPress(t){const e=t.code,i=t.charCode||t.keyCode;\"Space\"!==e&&\"Enter\"!==e&&32!==i&&13!==i||this.togglePopup();}_onMapClick(t){const e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup();}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=Ea(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let e=\"\";\"viewport\"===this._rotationAlignment||\"auto\"===this._rotationAlignment?e=`rotateZ(${this._rotation}deg)`:\"map\"===this._rotationAlignment&&(e=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let s=\"\";\"viewport\"===this._pitchAlignment||\"auto\"===this._pitchAlignment?s=\"rotateX(0deg)\":\"map\"===this._pitchAlignment&&(s=`rotateX(${this._map.getPitch()}deg)`),t&&\"moveend\"!==t.type||(this._pos=this._pos.round()),i.setTransform(this._element,`${Ia[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${s} ${e}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout((()=>{const t=this._map.unproject(this._pos),e=40075016.686*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=t.distanceTo(this._lngLat)>20*e?\"0.2\":\"1.0\",this._opacityTimeout=null;}),100));}getOffset(){return this._offset}setOffset(e){return this._offset=t.Point.convert(e),this._update(),this}_onMove(e){if(!this._isDragging){const t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t;}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents=\"none\",\"pending\"===this._state&&(this._state=\"active\",this.fire(new t.Event(\"dragstart\"))),this.fire(new t.Event(\"drag\")));}_onUp(){this._element.style.pointerEvents=\"auto\",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off(\"mousemove\",this._onMove),this._map.off(\"touchmove\",this._onMove),\"active\"===this._state&&this.fire(new t.Event(\"dragend\")),this._state=\"inactive\";}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state=\"pending\",this._map.on(\"mousemove\",this._onMove),this._map.on(\"touchmove\",this._onMove),this._map.once(\"mouseup\",this._onUp),this._map.once(\"touchend\",this._onUp));}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on(\"mousedown\",this._addDragHandler),this._map.on(\"touchstart\",this._addDragHandler)):(this._map.off(\"mousedown\",this._addDragHandler),this._map.off(\"touchstart\",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||\"auto\",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&\"auto\"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const Pa={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Da=0,za=!1;const Ma={maxWidth:100,unit:\"metric\"};function Aa(t,e,i){const s=i&&i.maxWidth||100,a=t._container.clientHeight/2,o=t.unproject([0,a]),r=t.unproject([s,a]),n=o.distanceTo(r);if(i&&\"imperial\"===i.unit){const i=3.2808*n;i>5280?La(e,s,i/5280,t._getUIString(\"ScaleControl.Miles\")):La(e,s,i,t._getUIString(\"ScaleControl.Feet\"));}else i&&\"nautical\"===i.unit?La(e,s,n/1852,t._getUIString(\"ScaleControl.NauticalMiles\")):n>=1e3?La(e,s,n/1e3,t._getUIString(\"ScaleControl.Kilometers\")):La(e,s,n,t._getUIString(\"ScaleControl.Meters\"));}function La(t,e,i,s){const a=function(t){const e=Math.pow(10,`${Math.floor(t)}`.length-1);let i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(i),e*i}(i);t.style.width=e*(a/i)+\"px\",t.innerHTML=`${a}&nbsp;${s}`;}const Ra={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:\"\",maxWidth:\"240px\"},ka=[\"a[href]\",\"[tabindex]:not([tabindex='-1'])\",\"[contenteditable]:not([contenteditable='false'])\",\"button:not([disabled])\",\"input:not([disabled])\",\"select:not([disabled])\",\"textarea:not([disabled])\"].join(\", \");function Ba(e){if(e){if(\"number\"==typeof e){const i=Math.round(Math.sqrt(.5*Math.pow(e,2)));return {center:new t.Point(0,0),top:new t.Point(0,e),\"top-left\":new t.Point(i,i),\"top-right\":new t.Point(-i,i),bottom:new t.Point(0,-e),\"bottom-left\":new t.Point(i,-i),\"bottom-right\":new t.Point(-i,-i),left:new t.Point(e,0),right:new t.Point(-e,0)}}if(e instanceof t.Point||Array.isArray(e)){const i=t.Point.convert(e);return {center:i,top:i,\"top-left\":i,\"top-right\":i,bottom:i,\"bottom-left\":i,\"bottom-right\":i,left:i,right:i}}return {center:t.Point.convert(e.center||[0,0]),top:t.Point.convert(e.top||[0,0]),\"top-left\":t.Point.convert(e[\"top-left\"]||[0,0]),\"top-right\":t.Point.convert(e[\"top-right\"]||[0,0]),bottom:t.Point.convert(e.bottom||[0,0]),\"bottom-left\":t.Point.convert(e[\"bottom-left\"]||[0,0]),\"bottom-right\":t.Point.convert(e[\"bottom-right\"]||[0,0]),left:t.Point.convert(e.left||[0,0]),right:t.Point.convert(e.right||[0,0])}}return Ba(new t.Point(0,0))}const Fa=e,Ua={setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:class extends na{constructor(e){var i;if(t.PerformanceUtils.mark(t.PerformanceMarkers.create),null!=(e=t.extend({},xa,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error(\"maxZoom must be greater than or equal to minZoom\");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error(\"maxPitch must be greater than or equal to minPitch\");if(null!=e.minPitch&&e.minPitch<0)throw new Error(\"minPitch must be greater than or equal to 0\");if(null!=e.maxPitch&&e.maxPitch>85)throw new Error(\"maxPitch must be less than or equal to 85\");if(super(new ls(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._interactive=e.interactive,this._cooperativeGestures=e.cooperativeGestures,this._metaKey=0===navigator.platform.indexOf(\"Mac\")?\"metaKey\":\"ctrlKey\",this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new ha,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},ua,e.locale),this._clickTolerance=e.clickTolerance,this._pixelRatio=null!==(i=e.pixelRatio)&&void 0!==i?i:devicePixelRatio,this.transformCameraUpdate=e.transformCameraUpdate,this._imageQueueHandle=u.addThrottleControl((()=>this.isMoving())),this._requestManager=new d(e.transformRequest),\"string\"==typeof e.container){if(this._container=document.getElementById(e.container),!this._container)throw new Error(`Container '${e.container}' not found.`)}else {if(!(e.container instanceof HTMLElement))throw new Error(\"Invalid type: 'container' must be a String or HTMLElement.\");this._container=e.container;}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll([\"_onWindowOnline\",\"_onMapScroll\",\"_cooperativeGesturesOnWheel\",\"_contextLost\",\"_contextRestored\"],this),this._setupContainer(),this._setupPainter(),this.on(\"move\",(()=>this._update(!1))),this.on(\"moveend\",(()=>this._update(!1))),this.on(\"zoom\",(()=>this._update(!0))),this.on(\"terrain\",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0);})),this.once(\"idle\",(()=>{this._idleTriggered=!0;})),\"undefined\"!=typeof window){addEventListener(\"online\",this._onWindowOnline,!1);let t=!1;this._resizeObserver=new ResizeObserver((e=>{t?this._trackResize&&this.resize(e)._update():t=!0;})),this._resizeObserver.observe(this._container);}this.handlers=new oa(this,e),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=e.hash&&new cs(\"string\"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new la({customAttribution:e.customAttribution})),e.maplibreLogo&&this.addControl(new ca,e.logoPosition),this.on(\"style.load\",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet);})),this.on(\"data\",(e=>{this._update(\"style\"===e.dataType),this.fire(new t.Event(`${e.dataType}data`,e));})),this.on(\"dataloading\",(e=>{this.fire(new t.Event(`${e.dataType}dataloading`,e));})),this.on(\"dataabort\",(e=>{this.fire(new t.Event(\"sourcedataabort\",e));}));}_getMapId(){return this._mapId}addControl(e,i){if(void 0===i&&(i=e.getDefaultPosition?e.getDefaultPosition():\"top-right\"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error(\"Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.\")));const s=e.onAdd(this);this._controls.push(e);const a=this._controlPositions[i];return -1!==i.indexOf(\"bottom\")?a.insertBefore(s,a.firstChild):a.appendChild(s),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error(\"Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.\")));const i=this._controls.indexOf(e);return i>-1&&this._controls.splice(i,1),e.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,e,i,s){return null==s&&this.terrain&&(s=this.transform.getElevation(i,this.terrain)),super.calculateCameraOptionsFromTo(t,e,i,s)}resize(e){var i;const s=this._containerDimensions(),a=s[0],o=s[1];this._resizeCanvas(a,o,this.getPixelRatio()),this.transform.resize(a,o),null===(i=this._requestedCameraState)||void 0===i||i.resize(a,o),this.painter.resize(a,o,this.getPixelRatio());const r=!this._moving;return r&&(this.stop(),this.fire(new t.Event(\"movestart\",e)).fire(new t.Event(\"move\",e))),this.fire(new t.Event(\"resize\",e)),r&&this.fire(new t.Event(\"moveend\",e)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(t){const[e,i]=this._containerDimensions();this._pixelRatio=t,this._resizeCanvas(e,i,t),this.painter.resize(e,i,t);}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(R.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error(\"minZoom must be between -2 and the current maxZoom, inclusive\")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error(\"maxZoom must be greater than the current minZoom\")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error(\"minPitch must be greater than or equal to 0\");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error(\"minPitch must be between 0 and the current maxPitch, inclusive\")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=null==t?60:t)>85)throw new Error(\"maxPitch must be less than or equal to 85\");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error(\"maxPitch must be greater than the current minPitch\")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(t){return this._cooperativeGestures=t,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(e){return this.transform.locationPoint(t.LngLat.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.pointLocation(t.Point.convert(e),this.terrain)}isMoving(){var t;return this._moving||(null===(t=this.handlers)||void 0===t?void 0:t.isMoving())}isZooming(){var t;return this._zooming||(null===(t=this.handlers)||void 0===t?void 0:t.isZooming())}isRotating(){var t;return this._rotating||(null===(t=this.handlers)||void 0===t?void 0:t.isRotating())}_createDelegatedListener(t,e,i){if(\"mouseenter\"===t||\"mouseover\"===t){let s=!1;const a=a=>{const o=this.getLayer(e)?this.queryRenderedFeatures(a.point,{layers:[e]}):[];o.length?s||(s=!0,i.call(this,new vs(t,this,a.originalEvent,{features:o}))):s=!1;};return {layer:e,listener:i,delegates:{mousemove:a,mouseout:()=>{s=!1;}}}}if(\"mouseleave\"===t||\"mouseout\"===t){let s=!1;const a=a=>{(this.getLayer(e)?this.queryRenderedFeatures(a.point,{layers:[e]}):[]).length?s=!0:s&&(s=!1,i.call(this,new vs(t,this,a.originalEvent)));},o=e=>{s&&(s=!1,i.call(this,new vs(t,this,e.originalEvent)));};return {layer:e,listener:i,delegates:{mousemove:a,mouseout:o}}}{const s=t=>{const s=this.getLayer(e)?this.queryRenderedFeatures(t.point,{layers:[e]}):[];s.length&&(t.features=s,i.call(this,t),delete t.features);};return {layer:e,listener:i,delegates:{[t]:s}}}}on(t,e,i){if(void 0===i)return super.on(t,e);const s=this._createDelegatedListener(t,e,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(s);for(const t in s.delegates)this.on(t,s.delegates[t]);return this}once(t,e,i){if(void 0===i)return super.once(t,e);const s=this._createDelegatedListener(t,e,i);for(const t in s.delegates)this.once(t,s.delegates[t]);return this}off(t,e,i){return void 0===i?super.off(t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&(s=>{const a=this._delegatedListeners[t];for(let t=0;t<a.length;t++){const s=a[t];if(s.layer===e&&s.listener===i){for(const t in s.delegates)this.off(t,s.delegates[t]);return a.splice(t,1),this}}})(),this)}queryRenderedFeatures(e,i){if(!this.style)return [];let s;const a=e instanceof t.Point||Array.isArray(e),o=a?e:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(a?{}:e)||{},o instanceof t.Point||\"number\"==typeof o[0])s=[t.Point.convert(o)];else {const e=t.Point.convert(o[0]),i=t.Point.convert(o[1]);s=[e,new t.Point(i.x,e.y),i,new t.Point(e.x,i.y),e];}return this.style.queryRenderedFeatures(s,i,this.transform)}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}setStyle(e,i){return !1!==(i=t.extend({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(e,i))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){const e=this._locale[t];if(null==e)throw new Error(`Missing UI string '${t}'`);return e}_updateStyle(t,e){if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once(\"style.load\",(()=>this._updateStyle(t,e)));const i=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new ae(this,e||{}),this.style.setEventedParent(this,{style:this.style}),\"string\"==typeof t?this.style.loadURL(t,e,i):this.style.loadJSON(t,e,i),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new ae(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty());}_diffStyle(e,i){if(\"string\"==typeof e){const s=this._requestManager.transformRequest(e,h.Style);t.getJSON(s,((e,s)=>{e?this.fire(new t.ErrorEvent(e)):s&&this._updateDiff(s,i);}));}else \"object\"==typeof e&&this._updateDiff(e,i);}_updateDiff(e,i){try{this.style.setState(e,i)&&this._update(!0);}catch(s){t.warnOnce(`Unable to perform style diff: ${s.message||s.error||s}.  Rebuilding the style from scratch.`),this._updateStyle(e,i);}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():t.warnOnce(\"There is no style added to the map.\")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(e){const i=this.style&&this.style.sourceCaches[e];if(void 0!==i)return i.loaded();this.fire(new t.ErrorEvent(new Error(`There is no source with ID '${e}'`)));}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off(\"data\",this._terrainDataCallback),e){const i=this.style.sourceCaches[e.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);for(const i in this.style._layers){const s=this.style._layers[i];\"hillshade\"===s.type&&s.source===e.source&&t.warnOnce(\"You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.\");}this.terrain=new ma(this.painter,i,e),this.painter.renderToTexture=new ga(this.painter,this.terrain),this.transform.updateElevation(this.terrain),this._terrainDataCallback=t=>{\"style\"===t.dataType?this.terrain.sourceCache.freeRtt():\"source\"===t.dataType&&t.tile&&(t.sourceId===e.source&&this.transform.updateElevation(this.terrain),this.terrain.sourceCache.freeRtt(t.tile.tileID));},this.style.on(\"data\",this._terrainDataCallback);}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.updateElevation(this.terrain);return this.fire(new t.Event(\"terrain\",{terrain:e})),this}getTerrain(){return this.terrain&&this.terrain.options}areTilesLoaded(){const t=this.style&&this.style.sourceCaches;for(const e in t){const i=t[e]._tiles;for(const t in i){const e=i[t];if(\"loaded\"!==e.state&&\"errored\"!==e.state)return !1}}return !0}addSourceType(t,e,i){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,i)}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(e,i,{pixelRatio:s=1,sdf:a=!1,stretchX:o,stretchY:r,content:n}={}){if(this._lazyInitEmptyStyle(),i instanceof HTMLImageElement||t.isImageBitmap(i)){const{width:l,height:c,data:h}=t.exported.getImageData(i);this.style.addImage(e,{data:new t.RGBAImage({width:l,height:c},h),pixelRatio:s,stretchX:o,stretchY:r,content:n,sdf:a,version:0});}else {if(void 0===i.width||void 0===i.height)return this.fire(new t.ErrorEvent(new Error(\"Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`\")));{const{width:l,height:c,data:h}=i,u=i;this.style.addImage(e,{data:new t.RGBAImage({width:l,height:c},new Uint8Array(h)),pixelRatio:s,stretchX:o,stretchY:r,content:n,sdf:a,version:0,userImage:u}),u.onAdd&&u.onAdd(this,e);}}}updateImage(e,i){const s=this.style.getImage(e);if(!s)return this.fire(new t.ErrorEvent(new Error(\"The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.\")));const a=i instanceof HTMLImageElement||t.isImageBitmap(i)?t.exported.getImageData(i):i,{width:o,height:r,data:n}=a;if(void 0===o||void 0===r)return this.fire(new t.ErrorEvent(new Error(\"Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`\")));if(o!==s.data.width||r!==s.data.height)return this.fire(new t.ErrorEvent(new Error(\"The width and height of the updated image must be that same as the previous version of the image\")));const l=!(i instanceof HTMLImageElement||t.isImageBitmap(i));s.data.replace(n,l),this.style.updateImage(e,s);}getImage(t){return this.style.getImage(t)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error(\"Missing required image id\"))),!1)}removeImage(t){this.style.removeImage(t);}loadImage(t,e){u.getImage(this._requestManager.transformRequest(t,h.Image),e);}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}setLayerZoomRange(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)}setFilter(t,e,i={}){return this.style.setFilter(t,e,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,i,s={}){return this.style.setPaintProperty(t,e,i,s),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i,s={}){return this.style.setLayoutProperty(t,e,i,s),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setGlyphs(t,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,e,i,(t=>{t||this._update(!0);})),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,e,(t=>{t||this._update(!0);})),this}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupContainer(){const t=this._container;t.classList.add(\"maplibregl-map\");const e=this._canvasContainer=i.create(\"div\",\"maplibregl-canvas-container\",t);this._interactive&&e.classList.add(\"maplibregl-interactive\"),this._canvas=i.create(\"canvas\",\"maplibregl-canvas\",e),this._canvas.addEventListener(\"webglcontextlost\",this._contextLost,!1),this._canvas.addEventListener(\"webglcontextrestored\",this._contextRestored,!1),this._canvas.setAttribute(\"tabindex\",\"0\"),this._canvas.setAttribute(\"aria-label\",\"Map\"),this._canvas.setAttribute(\"role\",\"region\");const s=this._containerDimensions();this._resizeCanvas(s[0],s[1],this.getPixelRatio());const a=this._controlContainer=i.create(\"div\",\"maplibregl-control-container\",t),o=this._controlPositions={};[\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\"].forEach((t=>{o[t]=i.create(\"div\",`maplibregl-ctrl-${t} `,a);})),this._container.addEventListener(\"scroll\",this._onMapScroll,!1);}_cooperativeGesturesOnWheel(t){this._onCooperativeGesture(t,t[this._metaKey],1);}_setupCooperativeGestures(){this._cooperativeGesturesScreen=i.create(\"div\",\"maplibregl-cooperative-gesture-screen\",this._container);let t=\"boolean\"!=typeof this._cooperativeGestures&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:\"Use Ctrl + scroll to zoom the map\";0===navigator.platform.indexOf(\"Mac\")&&(t=\"boolean\"!=typeof this._cooperativeGestures&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:\"Use ⌘ + scroll to zoom the map\"),this._cooperativeGesturesScreen.innerHTML=`\\n            <div class=\"maplibregl-desktop-message\">${t}</div>\\n            <div class=\"maplibregl-mobile-message\">${\"boolean\"!=typeof this._cooperativeGestures&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:\"Use two fingers to move the map\"}</div>\\n        `,this._canvasContainer.addEventListener(\"wheel\",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add(\"maplibregl-cooperative-gestures\");}_destroyCooperativeGestures(){i.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener(\"wheel\",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove(\"maplibregl-cooperative-gestures\");}_resizeCanvas(t,e,i){this._canvas.width=i*t,this._canvas.height=i*e,this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`;}_setupPainter(){const t={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let e=null;this._canvas.addEventListener(\"webglcontextcreationerror\",(i=>{e={requestedAttributes:t},i&&(e.statusMessage=i.statusMessage,e.type=i.type);}),{once:!0});const i=this._canvas.getContext(\"webgl2\",t)||this._canvas.getContext(\"webgl\",t);if(!i){const t=\"Failed to initialize WebGL\";throw e?(e.message=t,new Error(JSON.stringify(e))):new Error(t)}this.painter=new as(i,this.transform),s.testSupport(i);}_contextLost(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event(\"webglcontextlost\",{originalEvent:e}));}_contextRestored(e){this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event(\"webglcontextrestored\",{originalEvent:e}));}_onMapScroll(t){if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(t,e,i){return !e&&i<2&&(this._cooperativeGesturesScreen.classList.add(\"maplibregl-show\"),setTimeout((()=>{this._cooperativeGesturesScreen.classList.remove(\"maplibregl-show\");}),100)),!1}loaded(){return !this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t);}_render(e){const i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let s=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,a=t.exported.now();this.style.zoomHistory.update(e,a);const o=new t.EvaluationParameters(e,{now:a,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),r=o.crossFadingFactor();1===r&&r===this._crossFadingFactor||(s=!0,this._crossFadingFactor=r),this.style.update(o);}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain&&this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.updateElevation(this.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new t.Event(\"render\")),this.loaded()&&!this._loaded&&(this._loaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.load),this.fire(new t.Event(\"load\"))),this.style&&(this.style.hasTransitions()||s)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.Event(\"idle\")),!this._loaded||this._fullyLoaded||a||(this._fullyLoaded=!0,t.PerformanceUtils.mark(t.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var e;this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),\"undefined\"!=typeof window&&removeEventListener(\"online\",this._onWindowOnline,!1),u.removeThrottleControl(this._imageQueueHandle),null===(e=this._resizeObserver)||void 0===e||e.disconnect();const s=this.painter.context.gl.getExtension(\"WEBGL_lose_context\");s&&s.loseContext(),this._canvas.removeEventListener(\"webglcontextrestored\",this._contextRestored,!1),this._canvas.removeEventListener(\"webglcontextlost\",this._contextLost,!1),i.remove(this._canvasContainer),i.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove(\"maplibregl-map\"),t.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new t.Event(\"remove\"));}triggerRepaint(){this.style&&!this._frame&&(this._frame=t.exported.frame((e=>{t.PerformanceUtils.frame(e),this._frame=null,this._render(e);})));}_onWindowOnline(){this._update();}get showTileBoundaries(){return !!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update());}get showPadding(){return !!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update());}get showCollisionBoxes(){return !!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update());}get showOverdrawInspector(){return !!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update());}get repaint(){return !!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint());}get vertices(){return !!this._vertices}set vertices(t){this._vertices=t,this._update();}get version(){return va}getCameraTargetElevation(){return this.transform.elevation}},NavigationControl:class{constructor(e){this.options=t.extend({},ba,e),this._container=i.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),this._container.addEventListener(\"contextmenu\",(t=>t.preventDefault())),this.options.showZoom&&(t.bindAll([\"_setButtonTitle\",\"_updateZoomButtons\"],this),this._zoomInButton=this._createButton(\"maplibregl-ctrl-zoom-in\",(t=>this._map.zoomIn({},{originalEvent:t}))),i.create(\"span\",\"maplibregl-ctrl-icon\",this._zoomInButton).setAttribute(\"aria-hidden\",\"true\"),this._zoomOutButton=this._createButton(\"maplibregl-ctrl-zoom-out\",(t=>this._map.zoomOut({},{originalEvent:t}))),i.create(\"span\",\"maplibregl-ctrl-icon\",this._zoomOutButton).setAttribute(\"aria-hidden\",\"true\")),this.options.showCompass&&(t.bindAll([\"_rotateCompassArrow\"],this),this._compass=this._createButton(\"maplibregl-ctrl-compass\",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t});})),this._compassIcon=i.create(\"span\",\"maplibregl-ctrl-icon\",this._compass),this._compassIcon.setAttribute(\"aria-hidden\",\"true\"));}_updateZoomButtons(){const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute(\"aria-disabled\",e.toString()),this._zoomOutButton.setAttribute(\"aria-disabled\",i.toString());}_rotateCompassArrow(){const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t;}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,\"ZoomIn\"),this._setButtonTitle(this._zoomOutButton,\"ZoomOut\"),this._map.on(\"zoom\",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,\"ResetBearing\"),this.options.visualizePitch&&this._map.on(\"pitch\",this._rotateCompassArrow),this._map.on(\"rotate\",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new wa(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){i.remove(this._container),this.options.showZoom&&this._map.off(\"zoom\",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off(\"pitch\",this._rotateCompassArrow),this._map.off(\"rotate\",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map;}_createButton(t,e){const s=i.create(\"button\",t,this._container);return s.type=\"button\",s.addEventListener(\"click\",e),s}_setButtonTitle(t,e){const i=this._map._getUIString(`NavigationControl.${e}`);t.title=i,t.setAttribute(\"aria-label\",i);}},GeolocateControl:class extends t.Evented{constructor(e){super(),this.options=t.extend({},Pa,e),t.bindAll([\"_onSuccess\",\"_onError\",\"_onZoom\",\"_finish\",\"_setupUI\",\"_updateCamera\",\"_updateMarker\"],this);}onAdd(t){return this._map=t,this._container=i.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),function(t,e=!1){void 0===Ta||e?void 0!==window.navigator.permissions?window.navigator.permissions.query({name:\"geolocation\"}).then((e=>{Ta=\"denied\"!==e.state,t(Ta);})).catch((()=>{Ta=!!window.navigator.geolocation,t(Ta);})):(Ta=!!window.navigator.geolocation,t(Ta)):t(Ta);}(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),i.remove(this._container),this._map.off(\"zoom\",this._onZoom),this._map=void 0,Da=0,za=!1;}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case\"WAITING_ACTIVE\":this._watchState=\"ACTIVE_ERROR\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active-error\");break;case\"ACTIVE_LOCK\":this._watchState=\"ACTIVE_ERROR\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active-error\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\");break;case\"BACKGROUND\":this._watchState=\"BACKGROUND_ERROR\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-background-error\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\");break;case\"ACTIVE_ERROR\":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event(\"outofmaxbounds\",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case\"WAITING_ACTIVE\":case\"ACTIVE_LOCK\":case\"ACTIVE_ERROR\":this._watchState=\"ACTIVE_LOCK\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active-error\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active\");break;case\"BACKGROUND\":case\"BACKGROUND_ERROR\":this._watchState=\"BACKGROUND\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background-error\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-background\");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&\"OFF\"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&\"ACTIVE_LOCK\"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove(\"maplibregl-user-location-dot-stale\"),this.fire(new t.Event(\"geolocate\",e)),this._finish();}}_updateCamera(e){const i=new t.LngLat(e.coords.longitude,e.coords.latitude),s=e.coords.accuracy,a=this._map.getBearing(),o=t.extend({bearing:a},this.options.fitBoundsOptions),r=R.fromLngLat(i,s);this._map.fitBounds(r,o,{geolocateSource:!0});}_updateMarker(e){if(e){const i=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius();}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove();}_updateCircleRadius(){const t=this._map.getBounds(),e=t.getSouthEast(),i=t.getNorthEast(),s=e.distanceTo(i),a=Math.ceil(this._accuracy/(s/this._map._container.clientHeight)*2);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`;}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius();}_onError(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState=\"OFF\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active-error\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background-error\"),this._geolocateButton.disabled=!0;const t=this._map._getUIString(\"GeolocateControl.LocationNotAvailable\");this._geolocateButton.title=t,this._geolocateButton.setAttribute(\"aria-label\",t),void 0!==this._geolocationWatchID&&this._clearWatch();}else {if(3===e.code&&za)return;this._setErrorState();}\"OFF\"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add(\"maplibregl-user-location-dot-stale\"),this.fire(new t.Event(\"error\",e)),this._finish();}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0;}_setupUI(e){if(this._map){if(this._container.addEventListener(\"contextmenu\",(t=>t.preventDefault())),this._geolocateButton=i.create(\"button\",\"maplibregl-ctrl-geolocate\",this._container),i.create(\"span\",\"maplibregl-ctrl-icon\",this._geolocateButton).setAttribute(\"aria-hidden\",\"true\"),this._geolocateButton.type=\"button\",!1===e){t.warnOnce(\"Geolocation support is not available so the GeolocateControl will be disabled.\");const e=this._map._getUIString(\"GeolocateControl.LocationNotAvailable\");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute(\"aria-label\",e);}else {const t=this._map._getUIString(\"GeolocateControl.FindMyLocation\");this._geolocateButton.title=t,this._geolocateButton.setAttribute(\"aria-label\",t);}this.options.trackUserLocation&&(this._geolocateButton.setAttribute(\"aria-pressed\",\"false\"),this._watchState=\"OFF\"),this.options.showUserLocation&&(this._dotElement=i.create(\"div\",\"maplibregl-user-location-dot\"),this._userLocationDotMarker=new Ca(this._dotElement),this._circleElement=i.create(\"div\",\"maplibregl-user-location-accuracy-circle\"),this._accuracyCircleMarker=new Ca({element:this._circleElement,pitchAlignment:\"map\"}),this.options.trackUserLocation&&(this._watchState=\"OFF\"),this._map.on(\"zoom\",this._onZoom)),this._geolocateButton.addEventListener(\"click\",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on(\"movestart\",(e=>{e.geolocateSource||\"ACTIVE_LOCK\"!==this._watchState||e.originalEvent&&\"resize\"===e.originalEvent.type||(this._watchState=\"BACKGROUND\",this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-background\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"),this.fire(new t.Event(\"trackuserlocationend\")));}));}}trigger(){if(!this._setup)return t.warnOnce(\"Geolocate control triggered before added to a map\"),!1;if(this.options.trackUserLocation){switch(this._watchState){case\"OFF\":this._watchState=\"WAITING_ACTIVE\",this.fire(new t.Event(\"trackuserlocationstart\"));break;case\"WAITING_ACTIVE\":case\"ACTIVE_LOCK\":case\"ACTIVE_ERROR\":case\"BACKGROUND_ERROR\":Da--,za=!1,this._watchState=\"OFF\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active-error\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background-error\"),this.fire(new t.Event(\"trackuserlocationend\"));break;case\"BACKGROUND\":this._watchState=\"ACTIVE_LOCK\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background\"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event(\"trackuserlocationstart\"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case\"WAITING_ACTIVE\":this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active\");break;case\"ACTIVE_LOCK\":this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active\");break;case\"OFF\":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(\"OFF\"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.setAttribute(\"aria-pressed\",\"true\"),Da++,Da>1?(t={maximumAge:6e5,timeout:0},za=!0):(t=this.options.positionOptions,za=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t);}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return !0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.setAttribute(\"aria-pressed\",\"false\"),this.options.showUserLocation&&this._updateMarker(null);}},AttributionControl:la,LogoControl:ca,ScaleControl:class{constructor(e){this.options=t.extend({},Ma,e),t.bindAll([\"_onMove\",\"setUnit\"],this);}getDefaultPosition(){return \"bottom-left\"}_onMove(){Aa(this._map,this._container,this.options);}onAdd(t){return this._map=t,this._container=i.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-scale\",t.getContainer()),this._map.on(\"move\",this._onMove),this._onMove(),this._container}onRemove(){i.remove(this._container),this._map.off(\"move\",this._onMove),this._map=void 0;}setUnit(t){this.options.unit=t,Aa(this._map,this._container,this.options);}},FullscreenControl:class extends t.Evented{constructor(e={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange();},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen();},this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:t.warnOnce(\"Full screen control 'container' must be a DOM element.\")),\"onfullscreenchange\"in document?this._fullscreenchange=\"fullscreenchange\":\"onmozfullscreenchange\"in document?this._fullscreenchange=\"mozfullscreenchange\":\"onwebkitfullscreenchange\"in document?this._fullscreenchange=\"webkitfullscreenchange\":\"onmsfullscreenchange\"in document&&(this._fullscreenchange=\"MSFullscreenChange\");}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=i.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),this._setupUI(),this._controlContainer}onRemove(){i.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange);}_setupUI(){const t=this._fullscreenButton=i.create(\"button\",\"maplibregl-ctrl-fullscreen\",this._controlContainer);i.create(\"span\",\"maplibregl-ctrl-icon\",t).setAttribute(\"aria-hidden\",\"true\"),t.type=\"button\",this._updateTitle(),this._fullscreenButton.addEventListener(\"click\",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange);}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute(\"aria-label\",t),this._fullscreenButton.title=t;}_getTitle(){return this._map._getUIString(this._isFullscreen()?\"FullscreenControl.Exit\":\"FullscreenControl.Enter\")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle(\"maplibregl-ctrl-shrink\"),this._fullscreenButton.classList.toggle(\"maplibregl-ctrl-fullscreen\"),this._updateTitle(),this._fullscreen?(this.fire(new t.Event(\"fullscreenstart\")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new t.Event(\"fullscreenend\")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures));}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen();}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen();}_togglePseudoFullScreen(){this._container.classList.toggle(\"maplibregl-pseudo-fullscreen\"),this._handleFullscreenChange(),this._map.resize();}},TerrainControl:class{constructor(e){this.options=e,t.bindAll([\"_toggleTerrain\",\"_updateTerrainIcon\"],this);}onAdd(t){return this._map=t,this._container=i.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),this._terrainButton=i.create(\"button\",\"maplibregl-ctrl-terrain\",this._container),i.create(\"span\",\"maplibregl-ctrl-icon\",this._terrainButton).setAttribute(\"aria-hidden\",\"true\"),this._terrainButton.type=\"button\",this._terrainButton.addEventListener(\"click\",this._toggleTerrain),this._updateTerrainIcon(),this._map.on(\"terrain\",this._updateTerrainIcon),this._container}onRemove(){i.remove(this._container),this._map.off(\"terrain\",this._updateTerrainIcon),this._map=void 0;}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon();}_updateTerrainIcon(){this._terrainButton.classList.remove(\"maplibregl-ctrl-terrain\"),this._terrainButton.classList.remove(\"maplibregl-ctrl-terrain-enabled\"),this._map.terrain?(this._terrainButton.classList.add(\"maplibregl-ctrl-terrain-enabled\"),this._terrainButton.title=this._map._getUIString(\"TerrainControl.disableTerrain\")):(this._terrainButton.classList.add(\"maplibregl-ctrl-terrain\"),this._terrainButton.title=this._map._getUIString(\"TerrainControl.enableTerrain\"));}},Popup:class extends t.Evented{constructor(e){super(),this.options=t.extend(Object.create(Ra),e),t.bindAll([\"_update\",\"_onClose\",\"remove\",\"_onMouseMove\",\"_onMouseUp\",\"_onDrag\"],this);}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on(\"click\",this._onClose),this.options.closeOnMove&&this._map.on(\"move\",this._onClose),this._map.on(\"remove\",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on(\"mousemove\",this._onMouseMove),this._map.on(\"mouseup\",this._onMouseUp),this._container&&this._container.classList.add(\"maplibregl-popup-track-pointer\"),this._map._canvasContainer.classList.add(\"maplibregl-track-pointer\")):this._map.on(\"move\",this._update),this.fire(new t.Event(\"open\")),this}isOpen(){return !!this._map}remove(){return this._content&&i.remove(this._content),this._container&&(i.remove(this._container),delete this._container),this._map&&(this._map.off(\"move\",this._update),this._map.off(\"move\",this._onClose),this._map.off(\"click\",this._onClose),this._map.off(\"remove\",this.remove),this._map.off(\"mousemove\",this._onMouseMove),this._map.off(\"mouseup\",this._onMouseUp),this._map.off(\"drag\",this._onDrag),delete this._map),this.fire(new t.Event(\"close\")),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on(\"move\",this._update),this._map.off(\"mousemove\",this._onMouseMove),this._container&&this._container.classList.remove(\"maplibregl-popup-track-pointer\"),this._map._canvasContainer.classList.remove(\"maplibregl-track-pointer\")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off(\"move\",this._update),this._map.on(\"mousemove\",this._onMouseMove),this._map.on(\"drag\",this._onDrag),this._container&&this._container.classList.add(\"maplibregl-popup-track-pointer\"),this._map._canvasContainer.classList.add(\"maplibregl-track-pointer\")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){const e=document.createDocumentFragment(),i=document.createElement(\"body\");let s;for(i.innerHTML=t;s=i.firstChild,s;)e.appendChild(s);return this.setDOMContent(e)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=i.create(\"div\",\"maplibregl-popup-content\",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){this._container&&this._container.classList.add(t);}removeClassName(t){this._container&&this._container.classList.remove(t);}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}_createCloseButton(){this.options.closeButton&&(this._closeButton=i.create(\"button\",\"maplibregl-popup-close-button\",this._content),this._closeButton.type=\"button\",this._closeButton.setAttribute(\"aria-label\",\"Close popup\"),this._closeButton.innerHTML=\"&#215;\",this._closeButton.addEventListener(\"click\",this._onClose));}_onMouseUp(t){this._update(t.point);}_onMouseMove(t){this._update(t.point);}_onDrag(t){this._update(t.point);}_update(t){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(this._container||(this._container=i.create(\"div\",\"maplibregl-popup\",this._map.getContainer()),this._tip=i.create(\"div\",\"maplibregl-popup-tip\",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(\" \").forEach((t=>this._container.classList.add(t))),this._trackPointer&&this._container.classList.add(\"maplibregl-popup-track-pointer\")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ea(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const e=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let s=this.options.anchor;const a=Ba(this.options.offset);if(!s){const t=this._container.offsetWidth,i=this._container.offsetHeight;let o;o=e.y+a.bottom.y<i?[\"top\"]:e.y>this._map.transform.height-i?[\"bottom\"]:[],e.x<t/2?o.push(\"left\"):e.x>this._map.transform.width-t/2&&o.push(\"right\"),s=0===o.length?\"bottom\":o.join(\"-\");}const o=e.add(a[s]).round();i.setTransform(this._container,`${Ia[s]} translate(${o.x}px,${o.y}px)`),Sa(this._container,s,\"popup\");}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(ka);t&&t.focus();}_onClose(){this.remove();}},Marker:Ca,Style:ae,LngLat:t.LngLat,LngLatBounds:R,Point:t.Point,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,AJAXError:t.AJAXError,config:t.config,CanvasSource:V,GeoJSONSource:O,ImageSource:G,RasterDEMTileSource:U,RasterTileSource:F,VectorTileSource:B,VideoSource:Z,prewarm:function(){at().acquire(tt);},clearPrewarmedResources:function(){const t=st;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(tt),st=null):console.warn(\"Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()\"));},get version(){return Fa},get workerCount(){return et.workerCount},set workerCount(t){et.workerCount=t;},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e;},get workerUrl(){return t.config.WORKER_URL},set workerUrl(e){t.config.WORKER_URL=e;},addProtocol(e,i){t.config.REGISTERED_PROTOCOLS[e]=i;},removeProtocol(e){delete t.config.REGISTERED_PROTOCOLS[e];}};return ra.extend(Ua,{isSafari:t.isSafari,getPerformanceMetrics:t.PerformanceUtils.getPerformanceMetrics}),Ua}));\n\n//\n// Our custom intro provides a specialized \"define()\" function, called by the\n// AMD modules below, that sets up the worker blob URL and then executes the\n// main module, storing its exported value as 'maplibregl'\n\n\nvar maplibregl$1 = maplibregl;\n\nreturn maplibregl$1;\n\n}));\n//# sourceMappingURL=maplibre-gl.js.map\n"
  },
  {
    "path": "test/terrain_mapbox.html",
    "content": "<!DOCTYPE html>\n<html>\n\n<head>\n  <meta charset=\"utf-8\">\n  <title>Query terrain elevation</title>\n  <meta name=\"viewport\" content=\"initial-scale=1,maximum-scale=1,user-scalable=no\">\n  <link href=\"./mapbox-gl.css\" rel=\"stylesheet\">\n  <script src=\"./mapbox-gl.js\"></script>\n  <style>\n    body {\n      margin: 0;\n      padding: 0;\n    }\n\n    #map {\n      position: absolute;\n      top: 0;\n      bottom: 0;\n      width: 100%;\n    }\n  </style>\n</head>\n\n<body>\n  <div id=\"map\"></div>\n  <script>\n    // 注意，请写自己的token运行\n    mapboxgl.accessToken = 'pk.eyJ1IjoiYm9ibzlvayIsImEiOiJja3cxZjU1Z2UwMnFnMzBvajh4Y29iZTBiIn0.NcOkYbGRCj-C-gm1my6NZg';\n\n    const map = new mapboxgl.Map({\n      container: 'map',\n      zoom: 8,\n      center: [103.98464635299729, 30.69244825172305],\n      pitch: 76,\n      // Choose from Mapbox's core styles, or make your own style with Mapbox Studio\n      style: 'mapbox://styles/mapbox/satellite-streets-v12',\n      hash: false\n    });\n\n    map.on('load', (e) => {\n      // Set custom fog\n      map.setFog({\n        'range': [-0.5, 2],\n        'color': '#def',\n        'high-color': '#def',\n        'space-color': '#def'\n      });\n\n      // Add terrain source, with slight exaggeration\n      map.addSource('mapbox-dem', {\n        'type': 'raster-dem',\n        'tiles': ['./terrain/{z}/{x}/{y}.png'],\n        tileSize: 256,\n        'maxzoom': 14,\n        'minzoom': 5\n      });\n      map.setTerrain({ 'source': 'mapbox-dem', 'exaggeration': 1.5 });\n    });\n    map.on('click', function (e) {\n      console.log(e);\n    })\n\n\n\n  </script>\n\n</body>\n\n</html>"
  }
]