The smokesignal.events web application

feature: initial pass of breaking out site js/css as bundle

+6841 -1122
+5
.gitignore
··· 38 38 dist/ 39 39 localdev/calendars-data/ 40 40 41 + # Frontend build 42 + src-js/node_modules/ 43 + static/js/bundle.js 44 + static/css/bundle.css 45 + 41 46 **/.claude/settings.local.json 42 47 CLAUDE.local.md 43 48 Cargo.lock
+42 -1
CLAUDE.md
··· 15 15 - **Search**: OpenSearch for full-text event search 16 16 - **Storage**: Filesystem (default) or S3-compatible object storage 17 17 - **Templates**: MiniJinja (server-side rendering with optional reloading, localized structure) 18 - - **Frontend**: HTMX + Bulma CSS + FontAwesome 18 + - **Frontend**: HTMX + Alpine.js + Bulma CSS + FontAwesome 19 + - **Frontend Build**: Vite 6 + TypeScript 5.7 + Biome 2 + LightningCSS 19 20 - **Authentication**: AT Protocol OAuth with JOSE/JWT (P-256 ECDSA) 20 21 - **Internationalization**: Fluent for i18n support 21 22 - **Static Assets**: Rust Embed for production builds ··· 66 67 sqlx database reset 67 68 ``` 68 69 70 + ### Frontend Development 71 + ```bash 72 + # Install dependencies (from src-js directory) 73 + cd src-js && npm install 74 + 75 + # Build frontend assets (outputs to static/js/bundle.js and static/css/bundle.css) 76 + npm run build 77 + 78 + # Watch mode for development (rebuilds on file changes) 79 + npm run dev 80 + 81 + # Format code 82 + npm run format 83 + 84 + # Lint code 85 + npm run lint 86 + 87 + # Type check 88 + npm run typecheck 89 + 90 + # Run all checks 91 + npm run check 92 + ``` 93 + 69 94 ## Architecture Overview 70 95 71 96 ### Core Structure 72 97 ``` 98 + /src-js/ # Frontend source (TypeScript, CSS) 99 + ├── src/ # TypeScript source files 100 + │ ├── main.ts # Entry point 101 + │ ├── types.ts # Shared TypeScript types 102 + │ ├── components/ # Reusable UI components 103 + │ └── features/ # Feature-specific code (maps, events, lfg) 104 + ├── styles/ # CSS source files 105 + │ ├── main.css # CSS entry point 106 + │ ├── base/ # Variables, utilities 107 + │ ├── components/ # Component styles 108 + │ └── features/ # Feature styles 109 + ├── package.json 110 + ├── vite.config.ts 111 + ├── tsconfig.json 112 + └── biome.json 113 + 73 114 /src/ 74 115 ├── atproto/ # AT Protocol integration 75 116 │ ├── auth.rs # Authentication utilities
+1
Cargo.toml
··· 22 22 23 23 [build-dependencies] 24 24 minijinja-embed = {version = "2.7"} 25 + serde_json = "1.0" 25 26 26 27 [dependencies] 27 28 atproto-client = { git = "https://tangled.org/@smokesignal.events/atproto-identity-rs" }
+55
build.rs
··· 1 1 fn main() { 2 + println!("cargo:rerun-if-changed=templates"); 3 + println!("cargo:rerun-if-changed=static/js"); 4 + println!("cargo:rerun-if-changed=static/css"); 5 + println!("cargo:rerun-if-changed=static/.vite/manifest.json"); 6 + 7 + // Read Vite manifest to get hashed asset filenames 8 + let manifest_path = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")) 9 + .join("static/.vite/manifest.json"); 10 + 11 + let (bundle_js, bundle_css) = if manifest_path.exists() { 12 + let manifest_content = std::fs::read_to_string(&manifest_path) 13 + .expect("Failed to read Vite manifest"); 14 + let manifest: serde_json::Value = serde_json::from_str(&manifest_content) 15 + .expect("Failed to parse Vite manifest"); 16 + 17 + // Extract main entry point 18 + let main_entry = manifest.get("src/main.ts") 19 + .expect("Missing src/main.ts in manifest"); 20 + 21 + let js_file = main_entry.get("file") 22 + .and_then(|v| v.as_str()) 23 + .expect("Missing file in main entry"); 24 + 25 + let css_file = main_entry.get("css") 26 + .and_then(|v| v.as_array()) 27 + .and_then(|arr| arr.first()) 28 + .and_then(|v| v.as_str()) 29 + .unwrap_or("css/main.css"); 30 + 31 + (js_file.to_string(), css_file.to_string()) 32 + } else { 33 + // Fallback for development without manifest 34 + ("js/main.js".to_string(), "css/main.css".to_string()) 35 + }; 36 + 37 + println!("cargo:rustc-env=BUNDLE_JS={}", bundle_js); 38 + println!("cargo:rustc-env=BUNDLE_CSS={}", bundle_css); 39 + 40 + // Generate build revision (still useful for other assets like vendor CSS) 41 + use std::collections::hash_map::DefaultHasher; 42 + use std::hash::{Hash, Hasher}; 43 + use std::time::{SystemTime, UNIX_EPOCH}; 44 + 45 + let timestamp = SystemTime::now() 46 + .duration_since(UNIX_EPOCH) 47 + .unwrap() 48 + .as_nanos(); 49 + 50 + let mut hasher = DefaultHasher::new(); 51 + timestamp.hash(&mut hasher); 52 + let hash = hasher.finish(); 53 + let rev = format!("{:012x}", hash & 0xffffffffffff); 54 + 55 + println!("cargo:rustc-env=BUILD_REV={}", rev); 56 + 2 57 #[cfg(feature = "embed")] 3 58 { 4 59 use std::env;
+136
src-js/README.md
··· 1 + # Smokesignal Frontend 2 + 3 + This directory contains the frontend JavaScript and CSS source code for Smokesignal. 4 + 5 + ## Prerequisites 6 + 7 + - Node.js 20+ (LTS recommended) 8 + - npm 10+ 9 + 10 + ## Setup 11 + 12 + Install dependencies: 13 + 14 + ```bash 15 + npm install 16 + ``` 17 + 18 + ## Development 19 + 20 + Build frontend assets (outputs to `../static/js/bundle.js` and `../static/css/bundle.css`): 21 + 22 + ```bash 23 + npm run build 24 + ``` 25 + 26 + Watch mode for development (rebuilds on file changes): 27 + 28 + ```bash 29 + npm run dev 30 + ``` 31 + 32 + ## Code Quality 33 + 34 + Format code: 35 + 36 + ```bash 37 + npm run format 38 + ``` 39 + 40 + Check formatting without modifying: 41 + 42 + ```bash 43 + npm run format:check 44 + ``` 45 + 46 + Lint code: 47 + 48 + ```bash 49 + npm run lint 50 + ``` 51 + 52 + Fix lint issues: 53 + 54 + ```bash 55 + npm run lint:fix 56 + ``` 57 + 58 + Type check: 59 + 60 + ```bash 61 + npm run typecheck 62 + ``` 63 + 64 + Run all checks: 65 + 66 + ```bash 67 + npm run check 68 + ``` 69 + 70 + ## Project Structure 71 + 72 + ``` 73 + src-js/ 74 + ├── src/ 75 + │ ├── main.ts # Entry point 76 + │ ├── types.ts # Shared TypeScript types 77 + │ ├── core/ # Core utilities 78 + │ ├── components/ # Reusable UI components 79 + │ │ └── navigation.ts # Navbar toggle 80 + │ └── features/ # Feature-specific code 81 + │ ├── maps/ 82 + │ │ ├── event-map.ts # Event page map 83 + │ │ ├── globe-map.ts # Homepage globe 84 + │ │ └── location-heatmap.ts # Location page heatmap 85 + │ ├── events/ 86 + │ │ ├── create.ts # Event form Alpine.js component 87 + │ │ └── quick-create.ts # Quick event form 88 + │ └── lfg/ 89 + │ └── form.ts # LFG form Alpine.js component 90 + ├── styles/ 91 + │ ├── main.css # CSS entry point 92 + │ ├── base/ # Variables, utilities 93 + │ ├── components/ # Component styles 94 + │ └── features/ # Feature styles 95 + ├── package.json 96 + ├── tsconfig.json 97 + ├── vite.config.ts 98 + └── biome.json 99 + ``` 100 + 101 + ## Build Output 102 + 103 + The build produces: 104 + - `../static/js/bundle.js` - JavaScript bundle 105 + - `../static/css/bundle.css` - CSS bundle 106 + 107 + These are referenced in templates with cache-busting query parameters using `?rev={{ build_rev }}`. 108 + 109 + ## Integration with Rust 110 + 111 + The `BUILD_REV` environment variable is generated at Rust compile time in `build.rs` and made available to templates via `templates.rs`. This ensures browser caches are invalidated on each deploy. 112 + 113 + ## Alpine.js Components 114 + 115 + Some features use Alpine.js components that are exposed on the global `SmokesignalApp` namespace: 116 + 117 + - `SmokesignalApp.eventForm()` - Event creation/editing form 118 + - `SmokesignalApp.lfgForm()` - LFG (Looking For Group) form 119 + 120 + Templates can use these directly: 121 + 122 + ```html 123 + <div x-data="SmokesignalApp.eventForm()"> 124 + <!-- form content --> 125 + </div> 126 + ``` 127 + 128 + ## Map Features 129 + 130 + Map features auto-initialize based on DOM element presence: 131 + 132 + - `#event-map` with `data-geo-locations` - Event page map 133 + - `#globe-map` - Homepage globe (fetches data from API) 134 + - `#location-heatmap` with `data-geo-buckets` - Location page heatmap 135 + 136 + Vendor libraries (Leaflet, MapLibre, H3) are loaded separately in templates.
+36
src-js/biome.json
··· 1 + { 2 + "$schema": "https://biomejs.dev/schemas/2.0.0/schema.json", 3 + "assist": { 4 + "actions": { 5 + "source": { 6 + "organizeImports": "on" 7 + } 8 + } 9 + }, 10 + "formatter": { 11 + "enabled": true, 12 + "indentStyle": "space", 13 + "indentWidth": 2, 14 + "lineWidth": 100 15 + }, 16 + "javascript": { 17 + "formatter": { 18 + "quoteStyle": "single", 19 + "semicolons": "asNeeded", 20 + "trailingCommas": "es5", 21 + "arrowParentheses": "always" 22 + } 23 + }, 24 + "css": { 25 + "formatter": { 26 + "enabled": true, 27 + "indentStyle": "space", 28 + "indentWidth": 2, 29 + "lineWidth": 100 30 + } 31 + }, 32 + "linter": { "enabled": false }, 33 + "files": { 34 + "includes": ["src/**/*.ts", "styles/**/*.css"] 35 + } 36 + }
+8
src-js/oxlint.json
··· 1 + { 2 + "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json", 3 + "rules": { 4 + "no-unused-vars": "warn", 5 + "no-console": "off", 6 + "eqeqeq": "error" 7 + } 8 + }
+2074
src-js/package-lock.json
··· 1 + { 2 + "name": "smokesignal-frontend", 3 + "version": "1.0.0", 4 + "lockfileVersion": 3, 5 + "requires": true, 6 + "packages": { 7 + "": { 8 + "name": "smokesignal-frontend", 9 + "version": "1.0.0", 10 + "dependencies": { 11 + "alpinejs": "^3.15.4", 12 + "cropperjs": "^1.6.2", 13 + "h3-js": "^4.4.0", 14 + "htmx.org": "^2.0.8", 15 + "leaflet": "^1.9.4", 16 + "maplibre-gl": "^5.16.0" 17 + }, 18 + "devDependencies": { 19 + "@biomejs/biome": "^2.0.0", 20 + "@types/leaflet": "^1.9.21", 21 + "@types/node": "^22.0.0", 22 + "lightningcss": "^1.28.0", 23 + "oxlint": "^1.0.0", 24 + "typescript": "^5.7.0", 25 + "vite": "^6.0.0" 26 + } 27 + }, 28 + "node_modules/@biomejs/biome": { 29 + "version": "2.3.11", 30 + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.3.11.tgz", 31 + "integrity": "sha512-/zt+6qazBWguPG6+eWmiELqO+9jRsMZ/DBU3lfuU2ngtIQYzymocHhKiZRyrbra4aCOoyTg/BmY+6WH5mv9xmQ==", 32 + "dev": true, 33 + "license": "MIT OR Apache-2.0", 34 + "bin": { 35 + "biome": "bin/biome" 36 + }, 37 + "engines": { 38 + "node": ">=14.21.3" 39 + }, 40 + "funding": { 41 + "type": "opencollective", 42 + "url": "https://opencollective.com/biome" 43 + }, 44 + "optionalDependencies": { 45 + "@biomejs/cli-darwin-arm64": "2.3.11", 46 + "@biomejs/cli-darwin-x64": "2.3.11", 47 + "@biomejs/cli-linux-arm64": "2.3.11", 48 + "@biomejs/cli-linux-arm64-musl": "2.3.11", 49 + "@biomejs/cli-linux-x64": "2.3.11", 50 + "@biomejs/cli-linux-x64-musl": "2.3.11", 51 + "@biomejs/cli-win32-arm64": "2.3.11", 52 + "@biomejs/cli-win32-x64": "2.3.11" 53 + } 54 + }, 55 + "node_modules/@biomejs/cli-darwin-arm64": { 56 + "version": "2.3.11", 57 + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.3.11.tgz", 58 + "integrity": "sha512-/uXXkBcPKVQY7rc9Ys2CrlirBJYbpESEDme7RKiBD6MmqR2w3j0+ZZXRIL2xiaNPsIMMNhP1YnA+jRRxoOAFrA==", 59 + "cpu": [ 60 + "arm64" 61 + ], 62 + "dev": true, 63 + "license": "MIT OR Apache-2.0", 64 + "optional": true, 65 + "os": [ 66 + "darwin" 67 + ], 68 + "engines": { 69 + "node": ">=14.21.3" 70 + } 71 + }, 72 + "node_modules/@biomejs/cli-darwin-x64": { 73 + "version": "2.3.11", 74 + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.3.11.tgz", 75 + "integrity": "sha512-fh7nnvbweDPm2xEmFjfmq7zSUiox88plgdHF9OIW4i99WnXrAC3o2P3ag9judoUMv8FCSUnlwJCM1B64nO5Fbg==", 76 + "cpu": [ 77 + "x64" 78 + ], 79 + "dev": true, 80 + "license": "MIT OR Apache-2.0", 81 + "optional": true, 82 + "os": [ 83 + "darwin" 84 + ], 85 + "engines": { 86 + "node": ">=14.21.3" 87 + } 88 + }, 89 + "node_modules/@biomejs/cli-linux-arm64": { 90 + "version": "2.3.11", 91 + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.3.11.tgz", 92 + "integrity": "sha512-l4xkGa9E7Uc0/05qU2lMYfN1H+fzzkHgaJoy98wO+b/7Gl78srbCRRgwYSW+BTLixTBrM6Ede5NSBwt7rd/i6g==", 93 + "cpu": [ 94 + "arm64" 95 + ], 96 + "dev": true, 97 + "license": "MIT OR Apache-2.0", 98 + "optional": true, 99 + "os": [ 100 + "linux" 101 + ], 102 + "engines": { 103 + "node": ">=14.21.3" 104 + } 105 + }, 106 + "node_modules/@biomejs/cli-linux-arm64-musl": { 107 + "version": "2.3.11", 108 + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.3.11.tgz", 109 + "integrity": "sha512-XPSQ+XIPZMLaZ6zveQdwNjbX+QdROEd1zPgMwD47zvHV+tCGB88VH+aynyGxAHdzL+Tm/+DtKST5SECs4iwCLg==", 110 + "cpu": [ 111 + "arm64" 112 + ], 113 + "dev": true, 114 + "license": "MIT OR Apache-2.0", 115 + "optional": true, 116 + "os": [ 117 + "linux" 118 + ], 119 + "engines": { 120 + "node": ">=14.21.3" 121 + } 122 + }, 123 + "node_modules/@biomejs/cli-linux-x64": { 124 + "version": "2.3.11", 125 + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.3.11.tgz", 126 + "integrity": "sha512-/1s9V/H3cSe0r0Mv/Z8JryF5x9ywRxywomqZVLHAoa/uN0eY7F8gEngWKNS5vbbN/BsfpCG5yeBT5ENh50Frxg==", 127 + "cpu": [ 128 + "x64" 129 + ], 130 + "dev": true, 131 + "license": "MIT OR Apache-2.0", 132 + "optional": true, 133 + "os": [ 134 + "linux" 135 + ], 136 + "engines": { 137 + "node": ">=14.21.3" 138 + } 139 + }, 140 + "node_modules/@biomejs/cli-linux-x64-musl": { 141 + "version": "2.3.11", 142 + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.3.11.tgz", 143 + "integrity": "sha512-vU7a8wLs5C9yJ4CB8a44r12aXYb8yYgBn+WeyzbMjaCMklzCv1oXr8x+VEyWodgJt9bDmhiaW/I0RHbn7rsNmw==", 144 + "cpu": [ 145 + "x64" 146 + ], 147 + "dev": true, 148 + "license": "MIT OR Apache-2.0", 149 + "optional": true, 150 + "os": [ 151 + "linux" 152 + ], 153 + "engines": { 154 + "node": ">=14.21.3" 155 + } 156 + }, 157 + "node_modules/@biomejs/cli-win32-arm64": { 158 + "version": "2.3.11", 159 + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.3.11.tgz", 160 + "integrity": "sha512-PZQ6ElCOnkYapSsysiTy0+fYX+agXPlWugh6+eQ6uPKI3vKAqNp6TnMhoM3oY2NltSB89hz59o8xIfOdyhi9Iw==", 161 + "cpu": [ 162 + "arm64" 163 + ], 164 + "dev": true, 165 + "license": "MIT OR Apache-2.0", 166 + "optional": true, 167 + "os": [ 168 + "win32" 169 + ], 170 + "engines": { 171 + "node": ">=14.21.3" 172 + } 173 + }, 174 + "node_modules/@biomejs/cli-win32-x64": { 175 + "version": "2.3.11", 176 + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.3.11.tgz", 177 + "integrity": "sha512-43VrG813EW+b5+YbDbz31uUsheX+qFKCpXeY9kfdAx+ww3naKxeVkTD9zLIWxUPfJquANMHrmW3wbe/037G0Qg==", 178 + "cpu": [ 179 + "x64" 180 + ], 181 + "dev": true, 182 + "license": "MIT OR Apache-2.0", 183 + "optional": true, 184 + "os": [ 185 + "win32" 186 + ], 187 + "engines": { 188 + "node": ">=14.21.3" 189 + } 190 + }, 191 + "node_modules/@esbuild/aix-ppc64": { 192 + "version": "0.25.12", 193 + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", 194 + "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", 195 + "cpu": [ 196 + "ppc64" 197 + ], 198 + "dev": true, 199 + "license": "MIT", 200 + "optional": true, 201 + "os": [ 202 + "aix" 203 + ], 204 + "engines": { 205 + "node": ">=18" 206 + } 207 + }, 208 + "node_modules/@esbuild/android-arm": { 209 + "version": "0.25.12", 210 + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", 211 + "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", 212 + "cpu": [ 213 + "arm" 214 + ], 215 + "dev": true, 216 + "license": "MIT", 217 + "optional": true, 218 + "os": [ 219 + "android" 220 + ], 221 + "engines": { 222 + "node": ">=18" 223 + } 224 + }, 225 + "node_modules/@esbuild/android-arm64": { 226 + "version": "0.25.12", 227 + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", 228 + "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", 229 + "cpu": [ 230 + "arm64" 231 + ], 232 + "dev": true, 233 + "license": "MIT", 234 + "optional": true, 235 + "os": [ 236 + "android" 237 + ], 238 + "engines": { 239 + "node": ">=18" 240 + } 241 + }, 242 + "node_modules/@esbuild/android-x64": { 243 + "version": "0.25.12", 244 + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", 245 + "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", 246 + "cpu": [ 247 + "x64" 248 + ], 249 + "dev": true, 250 + "license": "MIT", 251 + "optional": true, 252 + "os": [ 253 + "android" 254 + ], 255 + "engines": { 256 + "node": ">=18" 257 + } 258 + }, 259 + "node_modules/@esbuild/darwin-arm64": { 260 + "version": "0.25.12", 261 + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", 262 + "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", 263 + "cpu": [ 264 + "arm64" 265 + ], 266 + "dev": true, 267 + "license": "MIT", 268 + "optional": true, 269 + "os": [ 270 + "darwin" 271 + ], 272 + "engines": { 273 + "node": ">=18" 274 + } 275 + }, 276 + "node_modules/@esbuild/darwin-x64": { 277 + "version": "0.25.12", 278 + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", 279 + "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", 280 + "cpu": [ 281 + "x64" 282 + ], 283 + "dev": true, 284 + "license": "MIT", 285 + "optional": true, 286 + "os": [ 287 + "darwin" 288 + ], 289 + "engines": { 290 + "node": ">=18" 291 + } 292 + }, 293 + "node_modules/@esbuild/freebsd-arm64": { 294 + "version": "0.25.12", 295 + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", 296 + "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", 297 + "cpu": [ 298 + "arm64" 299 + ], 300 + "dev": true, 301 + "license": "MIT", 302 + "optional": true, 303 + "os": [ 304 + "freebsd" 305 + ], 306 + "engines": { 307 + "node": ">=18" 308 + } 309 + }, 310 + "node_modules/@esbuild/freebsd-x64": { 311 + "version": "0.25.12", 312 + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", 313 + "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", 314 + "cpu": [ 315 + "x64" 316 + ], 317 + "dev": true, 318 + "license": "MIT", 319 + "optional": true, 320 + "os": [ 321 + "freebsd" 322 + ], 323 + "engines": { 324 + "node": ">=18" 325 + } 326 + }, 327 + "node_modules/@esbuild/linux-arm": { 328 + "version": "0.25.12", 329 + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", 330 + "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", 331 + "cpu": [ 332 + "arm" 333 + ], 334 + "dev": true, 335 + "license": "MIT", 336 + "optional": true, 337 + "os": [ 338 + "linux" 339 + ], 340 + "engines": { 341 + "node": ">=18" 342 + } 343 + }, 344 + "node_modules/@esbuild/linux-arm64": { 345 + "version": "0.25.12", 346 + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", 347 + "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", 348 + "cpu": [ 349 + "arm64" 350 + ], 351 + "dev": true, 352 + "license": "MIT", 353 + "optional": true, 354 + "os": [ 355 + "linux" 356 + ], 357 + "engines": { 358 + "node": ">=18" 359 + } 360 + }, 361 + "node_modules/@esbuild/linux-ia32": { 362 + "version": "0.25.12", 363 + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", 364 + "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", 365 + "cpu": [ 366 + "ia32" 367 + ], 368 + "dev": true, 369 + "license": "MIT", 370 + "optional": true, 371 + "os": [ 372 + "linux" 373 + ], 374 + "engines": { 375 + "node": ">=18" 376 + } 377 + }, 378 + "node_modules/@esbuild/linux-loong64": { 379 + "version": "0.25.12", 380 + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", 381 + "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", 382 + "cpu": [ 383 + "loong64" 384 + ], 385 + "dev": true, 386 + "license": "MIT", 387 + "optional": true, 388 + "os": [ 389 + "linux" 390 + ], 391 + "engines": { 392 + "node": ">=18" 393 + } 394 + }, 395 + "node_modules/@esbuild/linux-mips64el": { 396 + "version": "0.25.12", 397 + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", 398 + "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", 399 + "cpu": [ 400 + "mips64el" 401 + ], 402 + "dev": true, 403 + "license": "MIT", 404 + "optional": true, 405 + "os": [ 406 + "linux" 407 + ], 408 + "engines": { 409 + "node": ">=18" 410 + } 411 + }, 412 + "node_modules/@esbuild/linux-ppc64": { 413 + "version": "0.25.12", 414 + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", 415 + "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", 416 + "cpu": [ 417 + "ppc64" 418 + ], 419 + "dev": true, 420 + "license": "MIT", 421 + "optional": true, 422 + "os": [ 423 + "linux" 424 + ], 425 + "engines": { 426 + "node": ">=18" 427 + } 428 + }, 429 + "node_modules/@esbuild/linux-riscv64": { 430 + "version": "0.25.12", 431 + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", 432 + "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", 433 + "cpu": [ 434 + "riscv64" 435 + ], 436 + "dev": true, 437 + "license": "MIT", 438 + "optional": true, 439 + "os": [ 440 + "linux" 441 + ], 442 + "engines": { 443 + "node": ">=18" 444 + } 445 + }, 446 + "node_modules/@esbuild/linux-s390x": { 447 + "version": "0.25.12", 448 + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", 449 + "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", 450 + "cpu": [ 451 + "s390x" 452 + ], 453 + "dev": true, 454 + "license": "MIT", 455 + "optional": true, 456 + "os": [ 457 + "linux" 458 + ], 459 + "engines": { 460 + "node": ">=18" 461 + } 462 + }, 463 + "node_modules/@esbuild/linux-x64": { 464 + "version": "0.25.12", 465 + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", 466 + "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", 467 + "cpu": [ 468 + "x64" 469 + ], 470 + "dev": true, 471 + "license": "MIT", 472 + "optional": true, 473 + "os": [ 474 + "linux" 475 + ], 476 + "engines": { 477 + "node": ">=18" 478 + } 479 + }, 480 + "node_modules/@esbuild/netbsd-arm64": { 481 + "version": "0.25.12", 482 + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", 483 + "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", 484 + "cpu": [ 485 + "arm64" 486 + ], 487 + "dev": true, 488 + "license": "MIT", 489 + "optional": true, 490 + "os": [ 491 + "netbsd" 492 + ], 493 + "engines": { 494 + "node": ">=18" 495 + } 496 + }, 497 + "node_modules/@esbuild/netbsd-x64": { 498 + "version": "0.25.12", 499 + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", 500 + "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", 501 + "cpu": [ 502 + "x64" 503 + ], 504 + "dev": true, 505 + "license": "MIT", 506 + "optional": true, 507 + "os": [ 508 + "netbsd" 509 + ], 510 + "engines": { 511 + "node": ">=18" 512 + } 513 + }, 514 + "node_modules/@esbuild/openbsd-arm64": { 515 + "version": "0.25.12", 516 + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", 517 + "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", 518 + "cpu": [ 519 + "arm64" 520 + ], 521 + "dev": true, 522 + "license": "MIT", 523 + "optional": true, 524 + "os": [ 525 + "openbsd" 526 + ], 527 + "engines": { 528 + "node": ">=18" 529 + } 530 + }, 531 + "node_modules/@esbuild/openbsd-x64": { 532 + "version": "0.25.12", 533 + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", 534 + "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", 535 + "cpu": [ 536 + "x64" 537 + ], 538 + "dev": true, 539 + "license": "MIT", 540 + "optional": true, 541 + "os": [ 542 + "openbsd" 543 + ], 544 + "engines": { 545 + "node": ">=18" 546 + } 547 + }, 548 + "node_modules/@esbuild/openharmony-arm64": { 549 + "version": "0.25.12", 550 + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", 551 + "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", 552 + "cpu": [ 553 + "arm64" 554 + ], 555 + "dev": true, 556 + "license": "MIT", 557 + "optional": true, 558 + "os": [ 559 + "openharmony" 560 + ], 561 + "engines": { 562 + "node": ">=18" 563 + } 564 + }, 565 + "node_modules/@esbuild/sunos-x64": { 566 + "version": "0.25.12", 567 + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", 568 + "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", 569 + "cpu": [ 570 + "x64" 571 + ], 572 + "dev": true, 573 + "license": "MIT", 574 + "optional": true, 575 + "os": [ 576 + "sunos" 577 + ], 578 + "engines": { 579 + "node": ">=18" 580 + } 581 + }, 582 + "node_modules/@esbuild/win32-arm64": { 583 + "version": "0.25.12", 584 + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", 585 + "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", 586 + "cpu": [ 587 + "arm64" 588 + ], 589 + "dev": true, 590 + "license": "MIT", 591 + "optional": true, 592 + "os": [ 593 + "win32" 594 + ], 595 + "engines": { 596 + "node": ">=18" 597 + } 598 + }, 599 + "node_modules/@esbuild/win32-ia32": { 600 + "version": "0.25.12", 601 + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", 602 + "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", 603 + "cpu": [ 604 + "ia32" 605 + ], 606 + "dev": true, 607 + "license": "MIT", 608 + "optional": true, 609 + "os": [ 610 + "win32" 611 + ], 612 + "engines": { 613 + "node": ">=18" 614 + } 615 + }, 616 + "node_modules/@esbuild/win32-x64": { 617 + "version": "0.25.12", 618 + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", 619 + "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", 620 + "cpu": [ 621 + "x64" 622 + ], 623 + "dev": true, 624 + "license": "MIT", 625 + "optional": true, 626 + "os": [ 627 + "win32" 628 + ], 629 + "engines": { 630 + "node": ">=18" 631 + } 632 + }, 633 + "node_modules/@mapbox/geojson-rewind": { 634 + "version": "0.5.2", 635 + "resolved": "https://registry.npmjs.org/@mapbox/geojson-rewind/-/geojson-rewind-0.5.2.tgz", 636 + "integrity": "sha512-tJaT+RbYGJYStt7wI3cq4Nl4SXxG8W7JDG5DMJu97V25RnbNg3QtQtf+KD+VLjNpWKYsRvXDNmNrBgEETr1ifA==", 637 + "license": "ISC", 638 + "dependencies": { 639 + "get-stream": "^6.0.1", 640 + "minimist": "^1.2.6" 641 + }, 642 + "bin": { 643 + "geojson-rewind": "geojson-rewind" 644 + } 645 + }, 646 + "node_modules/@mapbox/jsonlint-lines-primitives": { 647 + "version": "2.0.2", 648 + "resolved": "https://registry.npmjs.org/@mapbox/jsonlint-lines-primitives/-/jsonlint-lines-primitives-2.0.2.tgz", 649 + "integrity": "sha512-rY0o9A5ECsTQRVhv7tL/OyDpGAoUB4tTvLiW1DSzQGq4bvTPhNw1VpSNjDJc5GFZ2XuyOtSWSVN05qOtcD71qQ==", 650 + "engines": { 651 + "node": ">= 0.6" 652 + } 653 + }, 654 + "node_modules/@mapbox/point-geometry": { 655 + "version": "1.1.0", 656 + "resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-1.1.0.tgz", 657 + "integrity": "sha512-YGcBz1cg4ATXDCM/71L9xveh4dynfGmcLDqufR+nQQy3fKwsAZsWd/x4621/6uJaeB9mwOHE6hPeDgXz9uViUQ==", 658 + "license": "ISC" 659 + }, 660 + "node_modules/@mapbox/tiny-sdf": { 661 + "version": "2.0.7", 662 + "resolved": "https://registry.npmjs.org/@mapbox/tiny-sdf/-/tiny-sdf-2.0.7.tgz", 663 + "integrity": "sha512-25gQLQMcpivjOSA40g3gO6qgiFPDpWRoMfd+G/GoppPIeP6JDaMMkMrEJnMZhKyyS6iKwVt5YKu02vCUyJM3Ug==", 664 + "license": "BSD-2-Clause" 665 + }, 666 + "node_modules/@mapbox/unitbezier": { 667 + "version": "0.0.1", 668 + "resolved": "https://registry.npmjs.org/@mapbox/unitbezier/-/unitbezier-0.0.1.tgz", 669 + "integrity": "sha512-nMkuDXFv60aBr9soUG5q+GvZYL+2KZHVvsqFCzqnkGEf46U2fvmytHaEVc1/YZbiLn8X+eR3QzX1+dwDO1lxlw==", 670 + "license": "BSD-2-Clause" 671 + }, 672 + "node_modules/@mapbox/vector-tile": { 673 + "version": "2.0.4", 674 + "resolved": "https://registry.npmjs.org/@mapbox/vector-tile/-/vector-tile-2.0.4.tgz", 675 + "integrity": "sha512-AkOLcbgGTdXScosBWwmmD7cDlvOjkg/DetGva26pIRiZPdeJYjYKarIlb4uxVzi6bwHO6EWH82eZ5Nuv4T5DUg==", 676 + "license": "BSD-3-Clause", 677 + "dependencies": { 678 + "@mapbox/point-geometry": "~1.1.0", 679 + "@types/geojson": "^7946.0.16", 680 + "pbf": "^4.0.1" 681 + } 682 + }, 683 + "node_modules/@mapbox/whoots-js": { 684 + "version": "3.1.0", 685 + "resolved": "https://registry.npmjs.org/@mapbox/whoots-js/-/whoots-js-3.1.0.tgz", 686 + "integrity": "sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q==", 687 + "license": "ISC", 688 + "engines": { 689 + "node": ">=6.0.0" 690 + } 691 + }, 692 + "node_modules/@maplibre/maplibre-gl-style-spec": { 693 + "version": "24.4.1", 694 + "resolved": "https://registry.npmjs.org/@maplibre/maplibre-gl-style-spec/-/maplibre-gl-style-spec-24.4.1.tgz", 695 + "integrity": "sha512-UKhA4qv1h30XT768ccSv5NjNCX+dgfoq2qlLVmKejspPcSQTYD4SrVucgqegmYcKcmwf06wcNAa/kRd0NHWbUg==", 696 + "license": "ISC", 697 + "dependencies": { 698 + "@mapbox/jsonlint-lines-primitives": "~2.0.2", 699 + "@mapbox/unitbezier": "^0.0.1", 700 + "json-stringify-pretty-compact": "^4.0.0", 701 + "minimist": "^1.2.8", 702 + "quickselect": "^3.0.0", 703 + "rw": "^1.3.3", 704 + "tinyqueue": "^3.0.0" 705 + }, 706 + "bin": { 707 + "gl-style-format": "dist/gl-style-format.mjs", 708 + "gl-style-migrate": "dist/gl-style-migrate.mjs", 709 + "gl-style-validate": "dist/gl-style-validate.mjs" 710 + } 711 + }, 712 + "node_modules/@maplibre/mlt": { 713 + "version": "1.1.2", 714 + "resolved": "https://registry.npmjs.org/@maplibre/mlt/-/mlt-1.1.2.tgz", 715 + "integrity": "sha512-SQKdJ909VGROkA6ovJgtHNs9YXV4YXUPS+VaZ50I2Mt951SLlUm2Cv34x5Xwc1HiFlsd3h2Yrs5cn7xzqBmENw==", 716 + "license": "(MIT OR Apache-2.0)", 717 + "dependencies": { 718 + "@mapbox/point-geometry": "^1.1.0" 719 + } 720 + }, 721 + "node_modules/@maplibre/vt-pbf": { 722 + "version": "4.2.0", 723 + "resolved": "https://registry.npmjs.org/@maplibre/vt-pbf/-/vt-pbf-4.2.0.tgz", 724 + "integrity": "sha512-bxrk/kQUwWXZgmqYgwOCnZCMONCRi3MJMqJdza4T3E4AeR5i+VyMnaJ8iDWtWxdfEAJRtrzIOeJtxZSy5mFrFA==", 725 + "license": "MIT", 726 + "dependencies": { 727 + "@mapbox/point-geometry": "^1.1.0", 728 + "@mapbox/vector-tile": "^2.0.4", 729 + "@types/geojson-vt": "3.2.5", 730 + "@types/supercluster": "^7.1.3", 731 + "geojson-vt": "^4.0.2", 732 + "pbf": "^4.0.1", 733 + "supercluster": "^8.0.1" 734 + } 735 + }, 736 + "node_modules/@oxlint/darwin-arm64": { 737 + "version": "1.39.0", 738 + "resolved": "https://registry.npmjs.org/@oxlint/darwin-arm64/-/darwin-arm64-1.39.0.tgz", 739 + "integrity": "sha512-lT3hNhIa02xCujI6YGgjmYGg3Ht/X9ag5ipUVETaMpx5Rd4BbTNWUPif1WN1YZHxt3KLCIqaAe7zVhatv83HOQ==", 740 + "cpu": [ 741 + "arm64" 742 + ], 743 + "dev": true, 744 + "license": "MIT", 745 + "optional": true, 746 + "os": [ 747 + "darwin" 748 + ] 749 + }, 750 + "node_modules/@oxlint/darwin-x64": { 751 + "version": "1.39.0", 752 + "resolved": "https://registry.npmjs.org/@oxlint/darwin-x64/-/darwin-x64-1.39.0.tgz", 753 + "integrity": "sha512-UT+rfTWd+Yr7iJeSLd/7nF8X4gTYssKh+n77hxl6Oilp3NnG1CKRHxZDy3o3lIBnwgzJkdyUAiYWO1bTMXQ1lA==", 754 + "cpu": [ 755 + "x64" 756 + ], 757 + "dev": true, 758 + "license": "MIT", 759 + "optional": true, 760 + "os": [ 761 + "darwin" 762 + ] 763 + }, 764 + "node_modules/@oxlint/linux-arm64-gnu": { 765 + "version": "1.39.0", 766 + "resolved": "https://registry.npmjs.org/@oxlint/linux-arm64-gnu/-/linux-arm64-gnu-1.39.0.tgz", 767 + "integrity": "sha512-qocBkvS2V6rH0t9AT3DfQunMnj3xkM7srs5/Ycj2j5ZqMoaWd/FxHNVJDFP++35roKSvsRJoS0mtA8/77jqm6Q==", 768 + "cpu": [ 769 + "arm64" 770 + ], 771 + "dev": true, 772 + "license": "MIT", 773 + "optional": true, 774 + "os": [ 775 + "linux" 776 + ] 777 + }, 778 + "node_modules/@oxlint/linux-arm64-musl": { 779 + "version": "1.39.0", 780 + "resolved": "https://registry.npmjs.org/@oxlint/linux-arm64-musl/-/linux-arm64-musl-1.39.0.tgz", 781 + "integrity": "sha512-arZzAc1PPcz9epvGBBCMHICeyQloKtHX3eoOe62B3Dskn7gf6Q14wnDHr1r9Vp4vtcBATNq6HlKV14smdlC/qA==", 782 + "cpu": [ 783 + "arm64" 784 + ], 785 + "dev": true, 786 + "license": "MIT", 787 + "optional": true, 788 + "os": [ 789 + "linux" 790 + ] 791 + }, 792 + "node_modules/@oxlint/linux-x64-gnu": { 793 + "version": "1.39.0", 794 + "resolved": "https://registry.npmjs.org/@oxlint/linux-x64-gnu/-/linux-x64-gnu-1.39.0.tgz", 795 + "integrity": "sha512-ZVt5qsECpuNprdWxAPpDBwoixr1VTcZ4qAEQA2l/wmFyVPDYFD3oBY/SWACNnWBddMrswjTg9O8ALxYWoEpmXw==", 796 + "cpu": [ 797 + "x64" 798 + ], 799 + "dev": true, 800 + "license": "MIT", 801 + "optional": true, 802 + "os": [ 803 + "linux" 804 + ] 805 + }, 806 + "node_modules/@oxlint/linux-x64-musl": { 807 + "version": "1.39.0", 808 + "resolved": "https://registry.npmjs.org/@oxlint/linux-x64-musl/-/linux-x64-musl-1.39.0.tgz", 809 + "integrity": "sha512-pB0hlGyKPbxr9NMIV783lD6cWL3MpaqnZRM9MWni4yBdHPTKyFNYdg5hGD0Bwg+UP4S2rOevq/+OO9x9Bi7E6g==", 810 + "cpu": [ 811 + "x64" 812 + ], 813 + "dev": true, 814 + "license": "MIT", 815 + "optional": true, 816 + "os": [ 817 + "linux" 818 + ] 819 + }, 820 + "node_modules/@oxlint/win32-arm64": { 821 + "version": "1.39.0", 822 + "resolved": "https://registry.npmjs.org/@oxlint/win32-arm64/-/win32-arm64-1.39.0.tgz", 823 + "integrity": "sha512-Gg2SFaJohI9+tIQVKXlPw3FsPQFi/eCSWiCgwPtPn5uzQxHRTeQEZKuluz1fuzR5U70TXubb2liZi4Dgl8LJQA==", 824 + "cpu": [ 825 + "arm64" 826 + ], 827 + "dev": true, 828 + "license": "MIT", 829 + "optional": true, 830 + "os": [ 831 + "win32" 832 + ] 833 + }, 834 + "node_modules/@oxlint/win32-x64": { 835 + "version": "1.39.0", 836 + "resolved": "https://registry.npmjs.org/@oxlint/win32-x64/-/win32-x64-1.39.0.tgz", 837 + "integrity": "sha512-sbi25lfj74hH+6qQtb7s1wEvd1j8OQbTaH8v3xTcDjrwm579Cyh0HBv1YSZ2+gsnVwfVDiCTL1D0JsNqYXszVA==", 838 + "cpu": [ 839 + "x64" 840 + ], 841 + "dev": true, 842 + "license": "MIT", 843 + "optional": true, 844 + "os": [ 845 + "win32" 846 + ] 847 + }, 848 + "node_modules/@rollup/rollup-android-arm-eabi": { 849 + "version": "4.55.1", 850 + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.55.1.tgz", 851 + "integrity": "sha512-9R0DM/ykwfGIlNu6+2U09ga0WXeZ9MRC2Ter8jnz8415VbuIykVuc6bhdrbORFZANDmTDvq26mJrEVTl8TdnDg==", 852 + "cpu": [ 853 + "arm" 854 + ], 855 + "dev": true, 856 + "license": "MIT", 857 + "optional": true, 858 + "os": [ 859 + "android" 860 + ] 861 + }, 862 + "node_modules/@rollup/rollup-android-arm64": { 863 + "version": "4.55.1", 864 + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.55.1.tgz", 865 + "integrity": "sha512-eFZCb1YUqhTysgW3sj/55du5cG57S7UTNtdMjCW7LwVcj3dTTcowCsC8p7uBdzKsZYa8J7IDE8lhMI+HX1vQvg==", 866 + "cpu": [ 867 + "arm64" 868 + ], 869 + "dev": true, 870 + "license": "MIT", 871 + "optional": true, 872 + "os": [ 873 + "android" 874 + ] 875 + }, 876 + "node_modules/@rollup/rollup-darwin-arm64": { 877 + "version": "4.55.1", 878 + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.55.1.tgz", 879 + "integrity": "sha512-p3grE2PHcQm2e8PSGZdzIhCKbMCw/xi9XvMPErPhwO17vxtvCN5FEA2mSLgmKlCjHGMQTP6phuQTYWUnKewwGg==", 880 + "cpu": [ 881 + "arm64" 882 + ], 883 + "dev": true, 884 + "license": "MIT", 885 + "optional": true, 886 + "os": [ 887 + "darwin" 888 + ] 889 + }, 890 + "node_modules/@rollup/rollup-darwin-x64": { 891 + "version": "4.55.1", 892 + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.55.1.tgz", 893 + "integrity": "sha512-rDUjG25C9qoTm+e02Esi+aqTKSBYwVTaoS1wxcN47/Luqef57Vgp96xNANwt5npq9GDxsH7kXxNkJVEsWEOEaQ==", 894 + "cpu": [ 895 + "x64" 896 + ], 897 + "dev": true, 898 + "license": "MIT", 899 + "optional": true, 900 + "os": [ 901 + "darwin" 902 + ] 903 + }, 904 + "node_modules/@rollup/rollup-freebsd-arm64": { 905 + "version": "4.55.1", 906 + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.55.1.tgz", 907 + "integrity": "sha512-+JiU7Jbp5cdxekIgdte0jfcu5oqw4GCKr6i3PJTlXTCU5H5Fvtkpbs4XJHRmWNXF+hKmn4v7ogI5OQPaupJgOg==", 908 + "cpu": [ 909 + "arm64" 910 + ], 911 + "dev": true, 912 + "license": "MIT", 913 + "optional": true, 914 + "os": [ 915 + "freebsd" 916 + ] 917 + }, 918 + "node_modules/@rollup/rollup-freebsd-x64": { 919 + "version": "4.55.1", 920 + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.55.1.tgz", 921 + "integrity": "sha512-V5xC1tOVWtLLmr3YUk2f6EJK4qksksOYiz/TCsFHu/R+woubcLWdC9nZQmwjOAbmExBIVKsm1/wKmEy4z4u4Bw==", 922 + "cpu": [ 923 + "x64" 924 + ], 925 + "dev": true, 926 + "license": "MIT", 927 + "optional": true, 928 + "os": [ 929 + "freebsd" 930 + ] 931 + }, 932 + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { 933 + "version": "4.55.1", 934 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.55.1.tgz", 935 + "integrity": "sha512-Rn3n+FUk2J5VWx+ywrG/HGPTD9jXNbicRtTM11e/uorplArnXZYsVifnPPqNNP5BsO3roI4n8332ukpY/zN7rQ==", 936 + "cpu": [ 937 + "arm" 938 + ], 939 + "dev": true, 940 + "license": "MIT", 941 + "optional": true, 942 + "os": [ 943 + "linux" 944 + ] 945 + }, 946 + "node_modules/@rollup/rollup-linux-arm-musleabihf": { 947 + "version": "4.55.1", 948 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.55.1.tgz", 949 + "integrity": "sha512-grPNWydeKtc1aEdrJDWk4opD7nFtQbMmV7769hiAaYyUKCT1faPRm2av8CX1YJsZ4TLAZcg9gTR1KvEzoLjXkg==", 950 + "cpu": [ 951 + "arm" 952 + ], 953 + "dev": true, 954 + "license": "MIT", 955 + "optional": true, 956 + "os": [ 957 + "linux" 958 + ] 959 + }, 960 + "node_modules/@rollup/rollup-linux-arm64-gnu": { 961 + "version": "4.55.1", 962 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.55.1.tgz", 963 + "integrity": "sha512-a59mwd1k6x8tXKcUxSyISiquLwB5pX+fJW9TkWU46lCqD/GRDe9uDN31jrMmVP3feI3mhAdvcCClhV8V5MhJFQ==", 964 + "cpu": [ 965 + "arm64" 966 + ], 967 + "dev": true, 968 + "license": "MIT", 969 + "optional": true, 970 + "os": [ 971 + "linux" 972 + ] 973 + }, 974 + "node_modules/@rollup/rollup-linux-arm64-musl": { 975 + "version": "4.55.1", 976 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.55.1.tgz", 977 + "integrity": "sha512-puS1MEgWX5GsHSoiAsF0TYrpomdvkaXm0CofIMG5uVkP6IBV+ZO9xhC5YEN49nsgYo1DuuMquF9+7EDBVYu4uA==", 978 + "cpu": [ 979 + "arm64" 980 + ], 981 + "dev": true, 982 + "license": "MIT", 983 + "optional": true, 984 + "os": [ 985 + "linux" 986 + ] 987 + }, 988 + "node_modules/@rollup/rollup-linux-loong64-gnu": { 989 + "version": "4.55.1", 990 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.55.1.tgz", 991 + "integrity": "sha512-r3Wv40in+lTsULSb6nnoudVbARdOwb2u5fpeoOAZjFLznp6tDU8kd+GTHmJoqZ9lt6/Sys33KdIHUaQihFcu7g==", 992 + "cpu": [ 993 + "loong64" 994 + ], 995 + "dev": true, 996 + "license": "MIT", 997 + "optional": true, 998 + "os": [ 999 + "linux" 1000 + ] 1001 + }, 1002 + "node_modules/@rollup/rollup-linux-loong64-musl": { 1003 + "version": "4.55.1", 1004 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.55.1.tgz", 1005 + "integrity": "sha512-MR8c0+UxAlB22Fq4R+aQSPBayvYa3+9DrwG/i1TKQXFYEaoW3B5b/rkSRIypcZDdWjWnpcvxbNaAJDcSbJU3Lw==", 1006 + "cpu": [ 1007 + "loong64" 1008 + ], 1009 + "dev": true, 1010 + "license": "MIT", 1011 + "optional": true, 1012 + "os": [ 1013 + "linux" 1014 + ] 1015 + }, 1016 + "node_modules/@rollup/rollup-linux-ppc64-gnu": { 1017 + "version": "4.55.1", 1018 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.55.1.tgz", 1019 + "integrity": "sha512-3KhoECe1BRlSYpMTeVrD4sh2Pw2xgt4jzNSZIIPLFEsnQn9gAnZagW9+VqDqAHgm1Xc77LzJOo2LdigS5qZ+gw==", 1020 + "cpu": [ 1021 + "ppc64" 1022 + ], 1023 + "dev": true, 1024 + "license": "MIT", 1025 + "optional": true, 1026 + "os": [ 1027 + "linux" 1028 + ] 1029 + }, 1030 + "node_modules/@rollup/rollup-linux-ppc64-musl": { 1031 + "version": "4.55.1", 1032 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.55.1.tgz", 1033 + "integrity": "sha512-ziR1OuZx0vdYZZ30vueNZTg73alF59DicYrPViG0NEgDVN8/Jl87zkAPu4u6VjZST2llgEUjaiNl9JM6HH1Vdw==", 1034 + "cpu": [ 1035 + "ppc64" 1036 + ], 1037 + "dev": true, 1038 + "license": "MIT", 1039 + "optional": true, 1040 + "os": [ 1041 + "linux" 1042 + ] 1043 + }, 1044 + "node_modules/@rollup/rollup-linux-riscv64-gnu": { 1045 + "version": "4.55.1", 1046 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.55.1.tgz", 1047 + "integrity": "sha512-uW0Y12ih2XJRERZ4jAfKamTyIHVMPQnTZcQjme2HMVDAHY4amf5u414OqNYC+x+LzRdRcnIG1YodLrrtA8xsxw==", 1048 + "cpu": [ 1049 + "riscv64" 1050 + ], 1051 + "dev": true, 1052 + "license": "MIT", 1053 + "optional": true, 1054 + "os": [ 1055 + "linux" 1056 + ] 1057 + }, 1058 + "node_modules/@rollup/rollup-linux-riscv64-musl": { 1059 + "version": "4.55.1", 1060 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.55.1.tgz", 1061 + "integrity": "sha512-u9yZ0jUkOED1BFrqu3BwMQoixvGHGZ+JhJNkNKY/hyoEgOwlqKb62qu+7UjbPSHYjiVy8kKJHvXKv5coH4wDeg==", 1062 + "cpu": [ 1063 + "riscv64" 1064 + ], 1065 + "dev": true, 1066 + "license": "MIT", 1067 + "optional": true, 1068 + "os": [ 1069 + "linux" 1070 + ] 1071 + }, 1072 + "node_modules/@rollup/rollup-linux-s390x-gnu": { 1073 + "version": "4.55.1", 1074 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.55.1.tgz", 1075 + "integrity": "sha512-/0PenBCmqM4ZUd0190j7J0UsQ/1nsi735iPRakO8iPciE7BQ495Y6msPzaOmvx0/pn+eJVVlZrNrSh4WSYLxNg==", 1076 + "cpu": [ 1077 + "s390x" 1078 + ], 1079 + "dev": true, 1080 + "license": "MIT", 1081 + "optional": true, 1082 + "os": [ 1083 + "linux" 1084 + ] 1085 + }, 1086 + "node_modules/@rollup/rollup-linux-x64-gnu": { 1087 + "version": "4.55.1", 1088 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.55.1.tgz", 1089 + "integrity": "sha512-a8G4wiQxQG2BAvo+gU6XrReRRqj+pLS2NGXKm8io19goR+K8lw269eTrPkSdDTALwMmJp4th2Uh0D8J9bEV1vg==", 1090 + "cpu": [ 1091 + "x64" 1092 + ], 1093 + "dev": true, 1094 + "license": "MIT", 1095 + "optional": true, 1096 + "os": [ 1097 + "linux" 1098 + ] 1099 + }, 1100 + "node_modules/@rollup/rollup-linux-x64-musl": { 1101 + "version": "4.55.1", 1102 + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.55.1.tgz", 1103 + "integrity": "sha512-bD+zjpFrMpP/hqkfEcnjXWHMw5BIghGisOKPj+2NaNDuVT+8Ds4mPf3XcPHuat1tz89WRL+1wbcxKY3WSbiT7w==", 1104 + "cpu": [ 1105 + "x64" 1106 + ], 1107 + "dev": true, 1108 + "license": "MIT", 1109 + "optional": true, 1110 + "os": [ 1111 + "linux" 1112 + ] 1113 + }, 1114 + "node_modules/@rollup/rollup-openbsd-x64": { 1115 + "version": "4.55.1", 1116 + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.55.1.tgz", 1117 + "integrity": "sha512-eLXw0dOiqE4QmvikfQ6yjgkg/xDM+MdU9YJuP4ySTibXU0oAvnEWXt7UDJmD4UkYialMfOGFPJnIHSe/kdzPxg==", 1118 + "cpu": [ 1119 + "x64" 1120 + ], 1121 + "dev": true, 1122 + "license": "MIT", 1123 + "optional": true, 1124 + "os": [ 1125 + "openbsd" 1126 + ] 1127 + }, 1128 + "node_modules/@rollup/rollup-openharmony-arm64": { 1129 + "version": "4.55.1", 1130 + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.55.1.tgz", 1131 + "integrity": "sha512-xzm44KgEP11te3S2HCSyYf5zIzWmx3n8HDCc7EE59+lTcswEWNpvMLfd9uJvVX8LCg9QWG67Xt75AuHn4vgsXw==", 1132 + "cpu": [ 1133 + "arm64" 1134 + ], 1135 + "dev": true, 1136 + "license": "MIT", 1137 + "optional": true, 1138 + "os": [ 1139 + "openharmony" 1140 + ] 1141 + }, 1142 + "node_modules/@rollup/rollup-win32-arm64-msvc": { 1143 + "version": "4.55.1", 1144 + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.55.1.tgz", 1145 + "integrity": "sha512-yR6Bl3tMC/gBok5cz/Qi0xYnVbIxGx5Fcf/ca0eB6/6JwOY+SRUcJfI0OpeTpPls7f194as62thCt/2BjxYN8g==", 1146 + "cpu": [ 1147 + "arm64" 1148 + ], 1149 + "dev": true, 1150 + "license": "MIT", 1151 + "optional": true, 1152 + "os": [ 1153 + "win32" 1154 + ] 1155 + }, 1156 + "node_modules/@rollup/rollup-win32-ia32-msvc": { 1157 + "version": "4.55.1", 1158 + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.55.1.tgz", 1159 + "integrity": "sha512-3fZBidchE0eY0oFZBnekYCfg+5wAB0mbpCBuofh5mZuzIU/4jIVkbESmd2dOsFNS78b53CYv3OAtwqkZZmU5nA==", 1160 + "cpu": [ 1161 + "ia32" 1162 + ], 1163 + "dev": true, 1164 + "license": "MIT", 1165 + "optional": true, 1166 + "os": [ 1167 + "win32" 1168 + ] 1169 + }, 1170 + "node_modules/@rollup/rollup-win32-x64-gnu": { 1171 + "version": "4.55.1", 1172 + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.55.1.tgz", 1173 + "integrity": "sha512-xGGY5pXj69IxKb4yv/POoocPy/qmEGhimy/FoTpTSVju3FYXUQQMFCaZZXJVidsmGxRioZAwpThl/4zX41gRKg==", 1174 + "cpu": [ 1175 + "x64" 1176 + ], 1177 + "dev": true, 1178 + "license": "MIT", 1179 + "optional": true, 1180 + "os": [ 1181 + "win32" 1182 + ] 1183 + }, 1184 + "node_modules/@rollup/rollup-win32-x64-msvc": { 1185 + "version": "4.55.1", 1186 + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.55.1.tgz", 1187 + "integrity": "sha512-SPEpaL6DX4rmcXtnhdrQYgzQ5W2uW3SCJch88lB2zImhJRhIIK44fkUrgIV/Q8yUNfw5oyZ5vkeQsZLhCb06lw==", 1188 + "cpu": [ 1189 + "x64" 1190 + ], 1191 + "dev": true, 1192 + "license": "MIT", 1193 + "optional": true, 1194 + "os": [ 1195 + "win32" 1196 + ] 1197 + }, 1198 + "node_modules/@types/estree": { 1199 + "version": "1.0.8", 1200 + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", 1201 + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", 1202 + "dev": true, 1203 + "license": "MIT" 1204 + }, 1205 + "node_modules/@types/geojson": { 1206 + "version": "7946.0.16", 1207 + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.16.tgz", 1208 + "integrity": "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==", 1209 + "license": "MIT" 1210 + }, 1211 + "node_modules/@types/geojson-vt": { 1212 + "version": "3.2.5", 1213 + "resolved": "https://registry.npmjs.org/@types/geojson-vt/-/geojson-vt-3.2.5.tgz", 1214 + "integrity": "sha512-qDO7wqtprzlpe8FfQ//ClPV9xiuoh2nkIgiouIptON9w5jvD/fA4szvP9GBlDVdJ5dldAl0kX/sy3URbWwLx0g==", 1215 + "license": "MIT", 1216 + "dependencies": { 1217 + "@types/geojson": "*" 1218 + } 1219 + }, 1220 + "node_modules/@types/leaflet": { 1221 + "version": "1.9.21", 1222 + "resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.9.21.tgz", 1223 + "integrity": "sha512-TbAd9DaPGSnzp6QvtYngntMZgcRk+igFELwR2N99XZn7RXUdKgsXMR+28bUO0rPsWp8MIu/f47luLIQuSLYv/w==", 1224 + "dev": true, 1225 + "license": "MIT", 1226 + "dependencies": { 1227 + "@types/geojson": "*" 1228 + } 1229 + }, 1230 + "node_modules/@types/node": { 1231 + "version": "22.19.7", 1232 + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.7.tgz", 1233 + "integrity": "sha512-MciR4AKGHWl7xwxkBa6xUGxQJ4VBOmPTF7sL+iGzuahOFaO0jHCsuEfS80pan1ef4gWId1oWOweIhrDEYLuaOw==", 1234 + "dev": true, 1235 + "license": "MIT", 1236 + "dependencies": { 1237 + "undici-types": "~6.21.0" 1238 + } 1239 + }, 1240 + "node_modules/@types/supercluster": { 1241 + "version": "7.1.3", 1242 + "resolved": "https://registry.npmjs.org/@types/supercluster/-/supercluster-7.1.3.tgz", 1243 + "integrity": "sha512-Z0pOY34GDFl3Q6hUFYf3HkTwKEE02e7QgtJppBt+beEAxnyOpJua+voGFvxINBHa06GwLFFym7gRPY2SiKIfIA==", 1244 + "license": "MIT", 1245 + "dependencies": { 1246 + "@types/geojson": "*" 1247 + } 1248 + }, 1249 + "node_modules/@vue/reactivity": { 1250 + "version": "3.1.5", 1251 + "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.1.5.tgz", 1252 + "integrity": "sha512-1tdfLmNjWG6t/CsPldh+foumYFo3cpyCHgBYQ34ylaMsJ+SNHQ1kApMIa8jN+i593zQuaw3AdWH0nJTARzCFhg==", 1253 + "license": "MIT", 1254 + "dependencies": { 1255 + "@vue/shared": "3.1.5" 1256 + } 1257 + }, 1258 + "node_modules/@vue/shared": { 1259 + "version": "3.1.5", 1260 + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.1.5.tgz", 1261 + "integrity": "sha512-oJ4F3TnvpXaQwZJNF3ZK+kLPHKarDmJjJ6jyzVNDKH9md1dptjC7lWR//jrGuLdek/U6iltWxqAnYOu8gCiOvA==", 1262 + "license": "MIT" 1263 + }, 1264 + "node_modules/alpinejs": { 1265 + "version": "3.15.4", 1266 + "resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.15.4.tgz", 1267 + "integrity": "sha512-lDpOdoVo0bhFjgl310k1qw3kbpUYwM/v0WByvAchsO93bl3o1rrgr0P/ssx3CimwEtNfXbmwKbtHbqTRCTTH9g==", 1268 + "license": "MIT", 1269 + "dependencies": { 1270 + "@vue/reactivity": "~3.1.1" 1271 + } 1272 + }, 1273 + "node_modules/cropperjs": { 1274 + "version": "1.6.2", 1275 + "resolved": "https://registry.npmjs.org/cropperjs/-/cropperjs-1.6.2.tgz", 1276 + "integrity": "sha512-nhymn9GdnV3CqiEHJVai54TULFAE3VshJTXSqSJKa8yXAKyBKDWdhHarnlIPrshJ0WMFTGuFvG02YjLXfPiuOA==", 1277 + "license": "MIT" 1278 + }, 1279 + "node_modules/detect-libc": { 1280 + "version": "2.1.2", 1281 + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", 1282 + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", 1283 + "dev": true, 1284 + "license": "Apache-2.0", 1285 + "engines": { 1286 + "node": ">=8" 1287 + } 1288 + }, 1289 + "node_modules/earcut": { 1290 + "version": "3.0.2", 1291 + "resolved": "https://registry.npmjs.org/earcut/-/earcut-3.0.2.tgz", 1292 + "integrity": "sha512-X7hshQbLyMJ/3RPhyObLARM2sNxxmRALLKx1+NVFFnQ9gKzmCrxm9+uLIAdBcvc8FNLpctqlQ2V6AE92Ol9UDQ==", 1293 + "license": "ISC" 1294 + }, 1295 + "node_modules/esbuild": { 1296 + "version": "0.25.12", 1297 + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", 1298 + "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", 1299 + "dev": true, 1300 + "hasInstallScript": true, 1301 + "license": "MIT", 1302 + "bin": { 1303 + "esbuild": "bin/esbuild" 1304 + }, 1305 + "engines": { 1306 + "node": ">=18" 1307 + }, 1308 + "optionalDependencies": { 1309 + "@esbuild/aix-ppc64": "0.25.12", 1310 + "@esbuild/android-arm": "0.25.12", 1311 + "@esbuild/android-arm64": "0.25.12", 1312 + "@esbuild/android-x64": "0.25.12", 1313 + "@esbuild/darwin-arm64": "0.25.12", 1314 + "@esbuild/darwin-x64": "0.25.12", 1315 + "@esbuild/freebsd-arm64": "0.25.12", 1316 + "@esbuild/freebsd-x64": "0.25.12", 1317 + "@esbuild/linux-arm": "0.25.12", 1318 + "@esbuild/linux-arm64": "0.25.12", 1319 + "@esbuild/linux-ia32": "0.25.12", 1320 + "@esbuild/linux-loong64": "0.25.12", 1321 + "@esbuild/linux-mips64el": "0.25.12", 1322 + "@esbuild/linux-ppc64": "0.25.12", 1323 + "@esbuild/linux-riscv64": "0.25.12", 1324 + "@esbuild/linux-s390x": "0.25.12", 1325 + "@esbuild/linux-x64": "0.25.12", 1326 + "@esbuild/netbsd-arm64": "0.25.12", 1327 + "@esbuild/netbsd-x64": "0.25.12", 1328 + "@esbuild/openbsd-arm64": "0.25.12", 1329 + "@esbuild/openbsd-x64": "0.25.12", 1330 + "@esbuild/openharmony-arm64": "0.25.12", 1331 + "@esbuild/sunos-x64": "0.25.12", 1332 + "@esbuild/win32-arm64": "0.25.12", 1333 + "@esbuild/win32-ia32": "0.25.12", 1334 + "@esbuild/win32-x64": "0.25.12" 1335 + } 1336 + }, 1337 + "node_modules/fdir": { 1338 + "version": "6.5.0", 1339 + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", 1340 + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", 1341 + "dev": true, 1342 + "license": "MIT", 1343 + "engines": { 1344 + "node": ">=12.0.0" 1345 + }, 1346 + "peerDependencies": { 1347 + "picomatch": "^3 || ^4" 1348 + }, 1349 + "peerDependenciesMeta": { 1350 + "picomatch": { 1351 + "optional": true 1352 + } 1353 + } 1354 + }, 1355 + "node_modules/fsevents": { 1356 + "version": "2.3.3", 1357 + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", 1358 + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", 1359 + "dev": true, 1360 + "hasInstallScript": true, 1361 + "license": "MIT", 1362 + "optional": true, 1363 + "os": [ 1364 + "darwin" 1365 + ], 1366 + "engines": { 1367 + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" 1368 + } 1369 + }, 1370 + "node_modules/geojson-vt": { 1371 + "version": "4.0.2", 1372 + "resolved": "https://registry.npmjs.org/geojson-vt/-/geojson-vt-4.0.2.tgz", 1373 + "integrity": "sha512-AV9ROqlNqoZEIJGfm1ncNjEXfkz2hdFlZf0qkVfmkwdKa8vj7H16YUOT81rJw1rdFhyEDlN2Tds91p/glzbl5A==", 1374 + "license": "ISC" 1375 + }, 1376 + "node_modules/get-stream": { 1377 + "version": "6.0.1", 1378 + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", 1379 + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", 1380 + "license": "MIT", 1381 + "engines": { 1382 + "node": ">=10" 1383 + }, 1384 + "funding": { 1385 + "url": "https://github.com/sponsors/sindresorhus" 1386 + } 1387 + }, 1388 + "node_modules/gl-matrix": { 1389 + "version": "3.4.4", 1390 + "resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.4.4.tgz", 1391 + "integrity": "sha512-latSnyDNt/8zYUB6VIJ6PCh2jBjJX6gnDsoCZ7LyW7GkqrD51EWwa9qCoGixj8YqBtETQK/xY7OmpTF8xz1DdQ==", 1392 + "license": "MIT" 1393 + }, 1394 + "node_modules/h3-js": { 1395 + "version": "4.4.0", 1396 + "resolved": "https://registry.npmjs.org/h3-js/-/h3-js-4.4.0.tgz", 1397 + "integrity": "sha512-DvJh07MhGgY2KcC4OeZc8SSyA+ZXpdvoh6uCzGpoKvWtZxJB+g6VXXC1+eWYkaMIsLz7J/ErhOalHCpcs1KYog==", 1398 + "license": "Apache-2.0", 1399 + "engines": { 1400 + "node": ">=4", 1401 + "npm": ">=3", 1402 + "yarn": ">=1.3.0" 1403 + } 1404 + }, 1405 + "node_modules/htmx.org": { 1406 + "version": "2.0.8", 1407 + "resolved": "https://registry.npmjs.org/htmx.org/-/htmx.org-2.0.8.tgz", 1408 + "integrity": "sha512-fm297iru0iWsNJlBrjvtN7V9zjaxd+69Oqjh4F/Vq9Wwi2kFisLcrLCiv5oBX0KLfOX/zG8AUo9ROMU5XUB44Q==", 1409 + "license": "0BSD" 1410 + }, 1411 + "node_modules/json-stringify-pretty-compact": { 1412 + "version": "4.0.0", 1413 + "resolved": "https://registry.npmjs.org/json-stringify-pretty-compact/-/json-stringify-pretty-compact-4.0.0.tgz", 1414 + "integrity": "sha512-3CNZ2DnrpByG9Nqj6Xo8vqbjT4F6N+tb4Gb28ESAZjYZ5yqvmc56J+/kuIwkaAMOyblTQhUW7PxMkUb8Q36N3Q==", 1415 + "license": "MIT" 1416 + }, 1417 + "node_modules/kdbush": { 1418 + "version": "4.0.2", 1419 + "resolved": "https://registry.npmjs.org/kdbush/-/kdbush-4.0.2.tgz", 1420 + "integrity": "sha512-WbCVYJ27Sz8zi9Q7Q0xHC+05iwkm3Znipc2XTlrnJbsHMYktW4hPhXUE8Ys1engBrvffoSCqbil1JQAa7clRpA==", 1421 + "license": "ISC" 1422 + }, 1423 + "node_modules/leaflet": { 1424 + "version": "1.9.4", 1425 + "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.9.4.tgz", 1426 + "integrity": "sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA==", 1427 + "license": "BSD-2-Clause" 1428 + }, 1429 + "node_modules/lightningcss": { 1430 + "version": "1.30.2", 1431 + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.30.2.tgz", 1432 + "integrity": "sha512-utfs7Pr5uJyyvDETitgsaqSyjCb2qNRAtuqUeWIAKztsOYdcACf2KtARYXg2pSvhkt+9NfoaNY7fxjl6nuMjIQ==", 1433 + "dev": true, 1434 + "license": "MPL-2.0", 1435 + "dependencies": { 1436 + "detect-libc": "^2.0.3" 1437 + }, 1438 + "engines": { 1439 + "node": ">= 12.0.0" 1440 + }, 1441 + "funding": { 1442 + "type": "opencollective", 1443 + "url": "https://opencollective.com/parcel" 1444 + }, 1445 + "optionalDependencies": { 1446 + "lightningcss-android-arm64": "1.30.2", 1447 + "lightningcss-darwin-arm64": "1.30.2", 1448 + "lightningcss-darwin-x64": "1.30.2", 1449 + "lightningcss-freebsd-x64": "1.30.2", 1450 + "lightningcss-linux-arm-gnueabihf": "1.30.2", 1451 + "lightningcss-linux-arm64-gnu": "1.30.2", 1452 + "lightningcss-linux-arm64-musl": "1.30.2", 1453 + "lightningcss-linux-x64-gnu": "1.30.2", 1454 + "lightningcss-linux-x64-musl": "1.30.2", 1455 + "lightningcss-win32-arm64-msvc": "1.30.2", 1456 + "lightningcss-win32-x64-msvc": "1.30.2" 1457 + } 1458 + }, 1459 + "node_modules/lightningcss-android-arm64": { 1460 + "version": "1.30.2", 1461 + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.30.2.tgz", 1462 + "integrity": "sha512-BH9sEdOCahSgmkVhBLeU7Hc9DWeZ1Eb6wNS6Da8igvUwAe0sqROHddIlvU06q3WyXVEOYDZ6ykBZQnjTbmo4+A==", 1463 + "cpu": [ 1464 + "arm64" 1465 + ], 1466 + "dev": true, 1467 + "license": "MPL-2.0", 1468 + "optional": true, 1469 + "os": [ 1470 + "android" 1471 + ], 1472 + "engines": { 1473 + "node": ">= 12.0.0" 1474 + }, 1475 + "funding": { 1476 + "type": "opencollective", 1477 + "url": "https://opencollective.com/parcel" 1478 + } 1479 + }, 1480 + "node_modules/lightningcss-darwin-arm64": { 1481 + "version": "1.30.2", 1482 + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.30.2.tgz", 1483 + "integrity": "sha512-ylTcDJBN3Hp21TdhRT5zBOIi73P6/W0qwvlFEk22fkdXchtNTOU4Qc37SkzV+EKYxLouZ6M4LG9NfZ1qkhhBWA==", 1484 + "cpu": [ 1485 + "arm64" 1486 + ], 1487 + "dev": true, 1488 + "license": "MPL-2.0", 1489 + "optional": true, 1490 + "os": [ 1491 + "darwin" 1492 + ], 1493 + "engines": { 1494 + "node": ">= 12.0.0" 1495 + }, 1496 + "funding": { 1497 + "type": "opencollective", 1498 + "url": "https://opencollective.com/parcel" 1499 + } 1500 + }, 1501 + "node_modules/lightningcss-darwin-x64": { 1502 + "version": "1.30.2", 1503 + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.30.2.tgz", 1504 + "integrity": "sha512-oBZgKchomuDYxr7ilwLcyms6BCyLn0z8J0+ZZmfpjwg9fRVZIR5/GMXd7r9RH94iDhld3UmSjBM6nXWM2TfZTQ==", 1505 + "cpu": [ 1506 + "x64" 1507 + ], 1508 + "dev": true, 1509 + "license": "MPL-2.0", 1510 + "optional": true, 1511 + "os": [ 1512 + "darwin" 1513 + ], 1514 + "engines": { 1515 + "node": ">= 12.0.0" 1516 + }, 1517 + "funding": { 1518 + "type": "opencollective", 1519 + "url": "https://opencollective.com/parcel" 1520 + } 1521 + }, 1522 + "node_modules/lightningcss-freebsd-x64": { 1523 + "version": "1.30.2", 1524 + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.30.2.tgz", 1525 + "integrity": "sha512-c2bH6xTrf4BDpK8MoGG4Bd6zAMZDAXS569UxCAGcA7IKbHNMlhGQ89eRmvpIUGfKWNVdbhSbkQaWhEoMGmGslA==", 1526 + "cpu": [ 1527 + "x64" 1528 + ], 1529 + "dev": true, 1530 + "license": "MPL-2.0", 1531 + "optional": true, 1532 + "os": [ 1533 + "freebsd" 1534 + ], 1535 + "engines": { 1536 + "node": ">= 12.0.0" 1537 + }, 1538 + "funding": { 1539 + "type": "opencollective", 1540 + "url": "https://opencollective.com/parcel" 1541 + } 1542 + }, 1543 + "node_modules/lightningcss-linux-arm-gnueabihf": { 1544 + "version": "1.30.2", 1545 + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.30.2.tgz", 1546 + "integrity": "sha512-eVdpxh4wYcm0PofJIZVuYuLiqBIakQ9uFZmipf6LF/HRj5Bgm0eb3qL/mr1smyXIS1twwOxNWndd8z0E374hiA==", 1547 + "cpu": [ 1548 + "arm" 1549 + ], 1550 + "dev": true, 1551 + "license": "MPL-2.0", 1552 + "optional": true, 1553 + "os": [ 1554 + "linux" 1555 + ], 1556 + "engines": { 1557 + "node": ">= 12.0.0" 1558 + }, 1559 + "funding": { 1560 + "type": "opencollective", 1561 + "url": "https://opencollective.com/parcel" 1562 + } 1563 + }, 1564 + "node_modules/lightningcss-linux-arm64-gnu": { 1565 + "version": "1.30.2", 1566 + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.30.2.tgz", 1567 + "integrity": "sha512-UK65WJAbwIJbiBFXpxrbTNArtfuznvxAJw4Q2ZGlU8kPeDIWEX1dg3rn2veBVUylA2Ezg89ktszWbaQnxD/e3A==", 1568 + "cpu": [ 1569 + "arm64" 1570 + ], 1571 + "dev": true, 1572 + "license": "MPL-2.0", 1573 + "optional": true, 1574 + "os": [ 1575 + "linux" 1576 + ], 1577 + "engines": { 1578 + "node": ">= 12.0.0" 1579 + }, 1580 + "funding": { 1581 + "type": "opencollective", 1582 + "url": "https://opencollective.com/parcel" 1583 + } 1584 + }, 1585 + "node_modules/lightningcss-linux-arm64-musl": { 1586 + "version": "1.30.2", 1587 + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.30.2.tgz", 1588 + "integrity": "sha512-5Vh9dGeblpTxWHpOx8iauV02popZDsCYMPIgiuw97OJ5uaDsL86cnqSFs5LZkG3ghHoX5isLgWzMs+eD1YzrnA==", 1589 + "cpu": [ 1590 + "arm64" 1591 + ], 1592 + "dev": true, 1593 + "license": "MPL-2.0", 1594 + "optional": true, 1595 + "os": [ 1596 + "linux" 1597 + ], 1598 + "engines": { 1599 + "node": ">= 12.0.0" 1600 + }, 1601 + "funding": { 1602 + "type": "opencollective", 1603 + "url": "https://opencollective.com/parcel" 1604 + } 1605 + }, 1606 + "node_modules/lightningcss-linux-x64-gnu": { 1607 + "version": "1.30.2", 1608 + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.30.2.tgz", 1609 + "integrity": "sha512-Cfd46gdmj1vQ+lR6VRTTadNHu6ALuw2pKR9lYq4FnhvgBc4zWY1EtZcAc6EffShbb1MFrIPfLDXD6Xprbnni4w==", 1610 + "cpu": [ 1611 + "x64" 1612 + ], 1613 + "dev": true, 1614 + "license": "MPL-2.0", 1615 + "optional": true, 1616 + "os": [ 1617 + "linux" 1618 + ], 1619 + "engines": { 1620 + "node": ">= 12.0.0" 1621 + }, 1622 + "funding": { 1623 + "type": "opencollective", 1624 + "url": "https://opencollective.com/parcel" 1625 + } 1626 + }, 1627 + "node_modules/lightningcss-linux-x64-musl": { 1628 + "version": "1.30.2", 1629 + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.30.2.tgz", 1630 + "integrity": "sha512-XJaLUUFXb6/QG2lGIW6aIk6jKdtjtcffUT0NKvIqhSBY3hh9Ch+1LCeH80dR9q9LBjG3ewbDjnumefsLsP6aiA==", 1631 + "cpu": [ 1632 + "x64" 1633 + ], 1634 + "dev": true, 1635 + "license": "MPL-2.0", 1636 + "optional": true, 1637 + "os": [ 1638 + "linux" 1639 + ], 1640 + "engines": { 1641 + "node": ">= 12.0.0" 1642 + }, 1643 + "funding": { 1644 + "type": "opencollective", 1645 + "url": "https://opencollective.com/parcel" 1646 + } 1647 + }, 1648 + "node_modules/lightningcss-win32-arm64-msvc": { 1649 + "version": "1.30.2", 1650 + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.30.2.tgz", 1651 + "integrity": "sha512-FZn+vaj7zLv//D/192WFFVA0RgHawIcHqLX9xuWiQt7P0PtdFEVaxgF9rjM/IRYHQXNnk61/H/gb2Ei+kUQ4xQ==", 1652 + "cpu": [ 1653 + "arm64" 1654 + ], 1655 + "dev": true, 1656 + "license": "MPL-2.0", 1657 + "optional": true, 1658 + "os": [ 1659 + "win32" 1660 + ], 1661 + "engines": { 1662 + "node": ">= 12.0.0" 1663 + }, 1664 + "funding": { 1665 + "type": "opencollective", 1666 + "url": "https://opencollective.com/parcel" 1667 + } 1668 + }, 1669 + "node_modules/lightningcss-win32-x64-msvc": { 1670 + "version": "1.30.2", 1671 + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.30.2.tgz", 1672 + "integrity": "sha512-5g1yc73p+iAkid5phb4oVFMB45417DkRevRbt/El/gKXJk4jid+vPFF/AXbxn05Aky8PapwzZrdJShv5C0avjw==", 1673 + "cpu": [ 1674 + "x64" 1675 + ], 1676 + "dev": true, 1677 + "license": "MPL-2.0", 1678 + "optional": true, 1679 + "os": [ 1680 + "win32" 1681 + ], 1682 + "engines": { 1683 + "node": ">= 12.0.0" 1684 + }, 1685 + "funding": { 1686 + "type": "opencollective", 1687 + "url": "https://opencollective.com/parcel" 1688 + } 1689 + }, 1690 + "node_modules/maplibre-gl": { 1691 + "version": "5.16.0", 1692 + "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-5.16.0.tgz", 1693 + "integrity": "sha512-/VDY89nr4jgLJyzmhy325cG6VUI02WkZ/UfVuDbG/piXzo6ODnM+omDFIwWY8tsEsBG26DNDmNMn3Y2ikHsBiA==", 1694 + "license": "BSD-3-Clause", 1695 + "dependencies": { 1696 + "@mapbox/geojson-rewind": "^0.5.2", 1697 + "@mapbox/jsonlint-lines-primitives": "^2.0.2", 1698 + "@mapbox/point-geometry": "^1.1.0", 1699 + "@mapbox/tiny-sdf": "^2.0.7", 1700 + "@mapbox/unitbezier": "^0.0.1", 1701 + "@mapbox/vector-tile": "^2.0.4", 1702 + "@mapbox/whoots-js": "^3.1.0", 1703 + "@maplibre/maplibre-gl-style-spec": "^24.4.1", 1704 + "@maplibre/mlt": "^1.1.2", 1705 + "@maplibre/vt-pbf": "^4.2.0", 1706 + "@types/geojson": "^7946.0.16", 1707 + "@types/geojson-vt": "3.2.5", 1708 + "@types/supercluster": "^7.1.3", 1709 + "earcut": "^3.0.2", 1710 + "geojson-vt": "^4.0.2", 1711 + "gl-matrix": "^3.4.4", 1712 + "kdbush": "^4.0.2", 1713 + "murmurhash-js": "^1.0.0", 1714 + "pbf": "^4.0.1", 1715 + "potpack": "^2.1.0", 1716 + "quickselect": "^3.0.0", 1717 + "supercluster": "^8.0.1", 1718 + "tinyqueue": "^3.0.0" 1719 + }, 1720 + "engines": { 1721 + "node": ">=16.14.0", 1722 + "npm": ">=8.1.0" 1723 + }, 1724 + "funding": { 1725 + "url": "https://github.com/maplibre/maplibre-gl-js?sponsor=1" 1726 + } 1727 + }, 1728 + "node_modules/minimist": { 1729 + "version": "1.2.8", 1730 + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", 1731 + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", 1732 + "license": "MIT", 1733 + "funding": { 1734 + "url": "https://github.com/sponsors/ljharb" 1735 + } 1736 + }, 1737 + "node_modules/murmurhash-js": { 1738 + "version": "1.0.0", 1739 + "resolved": "https://registry.npmjs.org/murmurhash-js/-/murmurhash-js-1.0.0.tgz", 1740 + "integrity": "sha512-TvmkNhkv8yct0SVBSy+o8wYzXjE4Zz3PCesbfs8HiCXXdcTuocApFv11UWlNFWKYsP2okqrhb7JNlSm9InBhIw==", 1741 + "license": "MIT" 1742 + }, 1743 + "node_modules/nanoid": { 1744 + "version": "3.3.11", 1745 + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", 1746 + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", 1747 + "dev": true, 1748 + "funding": [ 1749 + { 1750 + "type": "github", 1751 + "url": "https://github.com/sponsors/ai" 1752 + } 1753 + ], 1754 + "license": "MIT", 1755 + "bin": { 1756 + "nanoid": "bin/nanoid.cjs" 1757 + }, 1758 + "engines": { 1759 + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" 1760 + } 1761 + }, 1762 + "node_modules/oxlint": { 1763 + "version": "1.39.0", 1764 + "resolved": "https://registry.npmjs.org/oxlint/-/oxlint-1.39.0.tgz", 1765 + "integrity": "sha512-wSiLr0wjG+KTU6c1LpVoQk7JZ7l8HCKlAkVDVTJKWmCGazsNxexxnOXl7dsar92mQcRnzko5g077ggP3RINSjA==", 1766 + "dev": true, 1767 + "license": "MIT", 1768 + "bin": { 1769 + "oxlint": "bin/oxlint" 1770 + }, 1771 + "engines": { 1772 + "node": "^20.19.0 || >=22.12.0" 1773 + }, 1774 + "funding": { 1775 + "url": "https://github.com/sponsors/Boshen" 1776 + }, 1777 + "optionalDependencies": { 1778 + "@oxlint/darwin-arm64": "1.39.0", 1779 + "@oxlint/darwin-x64": "1.39.0", 1780 + "@oxlint/linux-arm64-gnu": "1.39.0", 1781 + "@oxlint/linux-arm64-musl": "1.39.0", 1782 + "@oxlint/linux-x64-gnu": "1.39.0", 1783 + "@oxlint/linux-x64-musl": "1.39.0", 1784 + "@oxlint/win32-arm64": "1.39.0", 1785 + "@oxlint/win32-x64": "1.39.0" 1786 + }, 1787 + "peerDependencies": { 1788 + "oxlint-tsgolint": ">=0.10.0" 1789 + }, 1790 + "peerDependenciesMeta": { 1791 + "oxlint-tsgolint": { 1792 + "optional": true 1793 + } 1794 + } 1795 + }, 1796 + "node_modules/pbf": { 1797 + "version": "4.0.1", 1798 + "resolved": "https://registry.npmjs.org/pbf/-/pbf-4.0.1.tgz", 1799 + "integrity": "sha512-SuLdBvS42z33m8ejRbInMapQe8n0D3vN/Xd5fmWM3tufNgRQFBpaW2YVJxQZV4iPNqb0vEFvssMEo5w9c6BTIA==", 1800 + "license": "BSD-3-Clause", 1801 + "dependencies": { 1802 + "resolve-protobuf-schema": "^2.1.0" 1803 + }, 1804 + "bin": { 1805 + "pbf": "bin/pbf" 1806 + } 1807 + }, 1808 + "node_modules/picocolors": { 1809 + "version": "1.1.1", 1810 + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", 1811 + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", 1812 + "dev": true, 1813 + "license": "ISC" 1814 + }, 1815 + "node_modules/picomatch": { 1816 + "version": "4.0.3", 1817 + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", 1818 + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", 1819 + "dev": true, 1820 + "license": "MIT", 1821 + "engines": { 1822 + "node": ">=12" 1823 + }, 1824 + "funding": { 1825 + "url": "https://github.com/sponsors/jonschlinkert" 1826 + } 1827 + }, 1828 + "node_modules/postcss": { 1829 + "version": "8.5.6", 1830 + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", 1831 + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", 1832 + "dev": true, 1833 + "funding": [ 1834 + { 1835 + "type": "opencollective", 1836 + "url": "https://opencollective.com/postcss/" 1837 + }, 1838 + { 1839 + "type": "tidelift", 1840 + "url": "https://tidelift.com/funding/github/npm/postcss" 1841 + }, 1842 + { 1843 + "type": "github", 1844 + "url": "https://github.com/sponsors/ai" 1845 + } 1846 + ], 1847 + "license": "MIT", 1848 + "dependencies": { 1849 + "nanoid": "^3.3.11", 1850 + "picocolors": "^1.1.1", 1851 + "source-map-js": "^1.2.1" 1852 + }, 1853 + "engines": { 1854 + "node": "^10 || ^12 || >=14" 1855 + } 1856 + }, 1857 + "node_modules/potpack": { 1858 + "version": "2.1.0", 1859 + "resolved": "https://registry.npmjs.org/potpack/-/potpack-2.1.0.tgz", 1860 + "integrity": "sha512-pcaShQc1Shq0y+E7GqJqvZj8DTthWV1KeHGdi0Z6IAin2Oi3JnLCOfwnCo84qc+HAp52wT9nK9H7FAJp5a44GQ==", 1861 + "license": "ISC" 1862 + }, 1863 + "node_modules/protocol-buffers-schema": { 1864 + "version": "3.6.0", 1865 + "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz", 1866 + "integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==", 1867 + "license": "MIT" 1868 + }, 1869 + "node_modules/quickselect": { 1870 + "version": "3.0.0", 1871 + "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-3.0.0.tgz", 1872 + "integrity": "sha512-XdjUArbK4Bm5fLLvlm5KpTFOiOThgfWWI4axAZDWg4E/0mKdZyI9tNEfds27qCi1ze/vwTR16kvmmGhRra3c2g==", 1873 + "license": "ISC" 1874 + }, 1875 + "node_modules/resolve-protobuf-schema": { 1876 + "version": "2.1.0", 1877 + "resolved": "https://registry.npmjs.org/resolve-protobuf-schema/-/resolve-protobuf-schema-2.1.0.tgz", 1878 + "integrity": "sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==", 1879 + "license": "MIT", 1880 + "dependencies": { 1881 + "protocol-buffers-schema": "^3.3.1" 1882 + } 1883 + }, 1884 + "node_modules/rollup": { 1885 + "version": "4.55.1", 1886 + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.55.1.tgz", 1887 + "integrity": "sha512-wDv/Ht1BNHB4upNbK74s9usvl7hObDnvVzknxqY/E/O3X6rW1U1rV1aENEfJ54eFZDTNo7zv1f5N4edCluH7+A==", 1888 + "dev": true, 1889 + "license": "MIT", 1890 + "dependencies": { 1891 + "@types/estree": "1.0.8" 1892 + }, 1893 + "bin": { 1894 + "rollup": "dist/bin/rollup" 1895 + }, 1896 + "engines": { 1897 + "node": ">=18.0.0", 1898 + "npm": ">=8.0.0" 1899 + }, 1900 + "optionalDependencies": { 1901 + "@rollup/rollup-android-arm-eabi": "4.55.1", 1902 + "@rollup/rollup-android-arm64": "4.55.1", 1903 + "@rollup/rollup-darwin-arm64": "4.55.1", 1904 + "@rollup/rollup-darwin-x64": "4.55.1", 1905 + "@rollup/rollup-freebsd-arm64": "4.55.1", 1906 + "@rollup/rollup-freebsd-x64": "4.55.1", 1907 + "@rollup/rollup-linux-arm-gnueabihf": "4.55.1", 1908 + "@rollup/rollup-linux-arm-musleabihf": "4.55.1", 1909 + "@rollup/rollup-linux-arm64-gnu": "4.55.1", 1910 + "@rollup/rollup-linux-arm64-musl": "4.55.1", 1911 + "@rollup/rollup-linux-loong64-gnu": "4.55.1", 1912 + "@rollup/rollup-linux-loong64-musl": "4.55.1", 1913 + "@rollup/rollup-linux-ppc64-gnu": "4.55.1", 1914 + "@rollup/rollup-linux-ppc64-musl": "4.55.1", 1915 + "@rollup/rollup-linux-riscv64-gnu": "4.55.1", 1916 + "@rollup/rollup-linux-riscv64-musl": "4.55.1", 1917 + "@rollup/rollup-linux-s390x-gnu": "4.55.1", 1918 + "@rollup/rollup-linux-x64-gnu": "4.55.1", 1919 + "@rollup/rollup-linux-x64-musl": "4.55.1", 1920 + "@rollup/rollup-openbsd-x64": "4.55.1", 1921 + "@rollup/rollup-openharmony-arm64": "4.55.1", 1922 + "@rollup/rollup-win32-arm64-msvc": "4.55.1", 1923 + "@rollup/rollup-win32-ia32-msvc": "4.55.1", 1924 + "@rollup/rollup-win32-x64-gnu": "4.55.1", 1925 + "@rollup/rollup-win32-x64-msvc": "4.55.1", 1926 + "fsevents": "~2.3.2" 1927 + } 1928 + }, 1929 + "node_modules/rw": { 1930 + "version": "1.3.3", 1931 + "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", 1932 + "integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==", 1933 + "license": "BSD-3-Clause" 1934 + }, 1935 + "node_modules/source-map-js": { 1936 + "version": "1.2.1", 1937 + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", 1938 + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", 1939 + "dev": true, 1940 + "license": "BSD-3-Clause", 1941 + "engines": { 1942 + "node": ">=0.10.0" 1943 + } 1944 + }, 1945 + "node_modules/supercluster": { 1946 + "version": "8.0.1", 1947 + "resolved": "https://registry.npmjs.org/supercluster/-/supercluster-8.0.1.tgz", 1948 + "integrity": "sha512-IiOea5kJ9iqzD2t7QJq/cREyLHTtSmUT6gQsweojg9WH2sYJqZK9SswTu6jrscO6D1G5v5vYZ9ru/eq85lXeZQ==", 1949 + "license": "ISC", 1950 + "dependencies": { 1951 + "kdbush": "^4.0.2" 1952 + } 1953 + }, 1954 + "node_modules/tinyglobby": { 1955 + "version": "0.2.15", 1956 + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", 1957 + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", 1958 + "dev": true, 1959 + "license": "MIT", 1960 + "dependencies": { 1961 + "fdir": "^6.5.0", 1962 + "picomatch": "^4.0.3" 1963 + }, 1964 + "engines": { 1965 + "node": ">=12.0.0" 1966 + }, 1967 + "funding": { 1968 + "url": "https://github.com/sponsors/SuperchupuDev" 1969 + } 1970 + }, 1971 + "node_modules/tinyqueue": { 1972 + "version": "3.0.0", 1973 + "resolved": "https://registry.npmjs.org/tinyqueue/-/tinyqueue-3.0.0.tgz", 1974 + "integrity": "sha512-gRa9gwYU3ECmQYv3lslts5hxuIa90veaEcxDYuu3QGOIAEM2mOZkVHp48ANJuu1CURtRdHKUBY5Lm1tHV+sD4g==", 1975 + "license": "ISC" 1976 + }, 1977 + "node_modules/typescript": { 1978 + "version": "5.9.3", 1979 + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", 1980 + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", 1981 + "dev": true, 1982 + "license": "Apache-2.0", 1983 + "bin": { 1984 + "tsc": "bin/tsc", 1985 + "tsserver": "bin/tsserver" 1986 + }, 1987 + "engines": { 1988 + "node": ">=14.17" 1989 + } 1990 + }, 1991 + "node_modules/undici-types": { 1992 + "version": "6.21.0", 1993 + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", 1994 + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", 1995 + "dev": true, 1996 + "license": "MIT" 1997 + }, 1998 + "node_modules/vite": { 1999 + "version": "6.4.1", 2000 + "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.1.tgz", 2001 + "integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==", 2002 + "dev": true, 2003 + "license": "MIT", 2004 + "dependencies": { 2005 + "esbuild": "^0.25.0", 2006 + "fdir": "^6.4.4", 2007 + "picomatch": "^4.0.2", 2008 + "postcss": "^8.5.3", 2009 + "rollup": "^4.34.9", 2010 + "tinyglobby": "^0.2.13" 2011 + }, 2012 + "bin": { 2013 + "vite": "bin/vite.js" 2014 + }, 2015 + "engines": { 2016 + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" 2017 + }, 2018 + "funding": { 2019 + "url": "https://github.com/vitejs/vite?sponsor=1" 2020 + }, 2021 + "optionalDependencies": { 2022 + "fsevents": "~2.3.3" 2023 + }, 2024 + "peerDependencies": { 2025 + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", 2026 + "jiti": ">=1.21.0", 2027 + "less": "*", 2028 + "lightningcss": "^1.21.0", 2029 + "sass": "*", 2030 + "sass-embedded": "*", 2031 + "stylus": "*", 2032 + "sugarss": "*", 2033 + "terser": "^5.16.0", 2034 + "tsx": "^4.8.1", 2035 + "yaml": "^2.4.2" 2036 + }, 2037 + "peerDependenciesMeta": { 2038 + "@types/node": { 2039 + "optional": true 2040 + }, 2041 + "jiti": { 2042 + "optional": true 2043 + }, 2044 + "less": { 2045 + "optional": true 2046 + }, 2047 + "lightningcss": { 2048 + "optional": true 2049 + }, 2050 + "sass": { 2051 + "optional": true 2052 + }, 2053 + "sass-embedded": { 2054 + "optional": true 2055 + }, 2056 + "stylus": { 2057 + "optional": true 2058 + }, 2059 + "sugarss": { 2060 + "optional": true 2061 + }, 2062 + "terser": { 2063 + "optional": true 2064 + }, 2065 + "tsx": { 2066 + "optional": true 2067 + }, 2068 + "yaml": { 2069 + "optional": true 2070 + } 2071 + } 2072 + } 2073 + } 2074 + }
+33
src-js/package.json
··· 1 + { 2 + "name": "smokesignal-frontend", 3 + "version": "1.0.0", 4 + "type": "module", 5 + "scripts": { 6 + "dev": "vite build --watch", 7 + "build": "vite build", 8 + "preview": "vite preview", 9 + "lint": "oxlint src/", 10 + "lint:fix": "oxlint src/ --fix", 11 + "format": "biome format --write src/ styles/", 12 + "format:check": "biome format src/ styles/", 13 + "check": "biome check src/ styles/", 14 + "typecheck": "tsc --noEmit" 15 + }, 16 + "devDependencies": { 17 + "@biomejs/biome": "^2.0.0", 18 + "@types/leaflet": "^1.9.21", 19 + "@types/node": "^22.0.0", 20 + "lightningcss": "^1.28.0", 21 + "oxlint": "^1.0.0", 22 + "typescript": "^5.7.0", 23 + "vite": "^6.0.0" 24 + }, 25 + "dependencies": { 26 + "alpinejs": "^3.15.4", 27 + "cropperjs": "^1.6.2", 28 + "h3-js": "^4.4.0", 29 + "htmx.org": "^2.0.8", 30 + "leaflet": "^1.9.4", 31 + "maplibre-gl": "^5.16.0" 32 + } 33 + }
+23
src-js/src/components/navigation.ts
··· 1 + /** 2 + * Navigation component 3 + * 4 + * Handles navbar burger toggle for mobile navigation. 5 + * Migrated from static/site.js 6 + */ 7 + 8 + export function initNavigation(): void { 9 + const navbarBurgers = document.querySelectorAll<HTMLElement>('.navbar-burger') 10 + 11 + navbarBurgers.forEach((el) => { 12 + el.addEventListener('click', () => { 13 + const targetId = el.dataset.target 14 + if (!targetId) return 15 + 16 + const target = document.getElementById(targetId) 17 + if (!target) return 18 + 19 + el.classList.toggle('is-active') 20 + target.classList.toggle('is-active') 21 + }) 22 + }) 23 + }
+189
src-js/src/core/htmx-extensions/loading-states.ts
··· 1 + /** 2 + * htmx Loading States Extension 3 + * 4 + * Provides loading state management for htmx requests. 5 + * Ported from the original IIFE extension for ES module bundling. 6 + */ 7 + 8 + import type { HtmxApi } from '../types' 9 + 10 + export function initLoadingStatesExtension(htmx: HtmxApi): void { 11 + const loadingStatesUndoQueue: Array<() => void> = [] 12 + 13 + function loadingStateContainer(target: Element): Element { 14 + return htmx.closest(target, '[data-loading-states]') || document.body 15 + } 16 + 17 + function mayProcessUndoCallback(target: Element, callback: () => void): void { 18 + if (document.body.contains(target)) { 19 + callback() 20 + } 21 + } 22 + 23 + function mayProcessLoadingStateByPath(elt: Element, requestPath: string): boolean { 24 + const pathElt = htmx.closest(elt, '[data-loading-path]') 25 + if (!pathElt) { 26 + return true 27 + } 28 + return pathElt.getAttribute('data-loading-path') === requestPath 29 + } 30 + 31 + function queueLoadingState( 32 + sourceElt: Element, 33 + targetElt: HTMLElement, 34 + doCallback: () => void, 35 + undoCallback: () => void 36 + ): void { 37 + const delayElt = htmx.closest(sourceElt, '[data-loading-delay]') 38 + if (delayElt) { 39 + const delayInMilliseconds = Number.parseInt( 40 + delayElt.getAttribute('data-loading-delay') || '200', 41 + 10 42 + ) 43 + const timeout = setTimeout(() => { 44 + doCallback() 45 + loadingStatesUndoQueue.push(() => { 46 + mayProcessUndoCallback(targetElt, undoCallback) 47 + }) 48 + }, delayInMilliseconds) 49 + 50 + loadingStatesUndoQueue.push(() => { 51 + mayProcessUndoCallback(targetElt, () => clearTimeout(timeout)) 52 + }) 53 + } else { 54 + doCallback() 55 + loadingStatesUndoQueue.push(() => { 56 + mayProcessUndoCallback(targetElt, undoCallback) 57 + }) 58 + } 59 + } 60 + 61 + function getLoadingStateElts(loadingScope: Element, type: string, path: string): Element[] { 62 + return Array.from(htmx.findAll(loadingScope, `[${type}]`)).filter((elt) => 63 + mayProcessLoadingStateByPath(elt, path) 64 + ) 65 + } 66 + 67 + function getLoadingTarget(elt: Element): HTMLElement[] { 68 + const targetSelector = elt.getAttribute('data-loading-target') 69 + if (targetSelector) { 70 + return Array.from(htmx.findAll(targetSelector)) as HTMLElement[] 71 + } 72 + return [elt as HTMLElement] 73 + } 74 + 75 + htmx.defineExtension('loading-states', { 76 + onEvent(name: string, evt: CustomEvent) { 77 + if (name === 'htmx:beforeRequest') { 78 + const container = loadingStateContainer(evt.target as Element) 79 + const requestPath = evt.detail?.pathInfo?.requestPath || '' 80 + 81 + const loadingStateTypes = [ 82 + 'data-loading', 83 + 'data-loading-class', 84 + 'data-loading-class-remove', 85 + 'data-loading-disable', 86 + 'data-loading-aria-busy', 87 + ] 88 + 89 + const loadingStateEltsByType: Record<string, Element[]> = {} 90 + 91 + for (const type of loadingStateTypes) { 92 + loadingStateEltsByType[type] = getLoadingStateElts(container, type, requestPath) 93 + } 94 + 95 + for (const sourceElt of loadingStateEltsByType['data-loading']) { 96 + for (const targetElt of getLoadingTarget(sourceElt)) { 97 + queueLoadingState( 98 + sourceElt, 99 + targetElt, 100 + () => { 101 + targetElt.style.display = sourceElt.getAttribute('data-loading') || 'inline-block' 102 + }, 103 + () => { 104 + targetElt.style.display = 'none' 105 + } 106 + ) 107 + } 108 + } 109 + 110 + for (const sourceElt of loadingStateEltsByType['data-loading-class']) { 111 + const classNames = (sourceElt.getAttribute('data-loading-class') || '').split(' ') 112 + for (const targetElt of getLoadingTarget(sourceElt)) { 113 + queueLoadingState( 114 + sourceElt, 115 + targetElt, 116 + () => { 117 + for (const className of classNames) { 118 + targetElt.classList.add(className) 119 + } 120 + }, 121 + () => { 122 + for (const className of classNames) { 123 + targetElt.classList.remove(className) 124 + } 125 + } 126 + ) 127 + } 128 + } 129 + 130 + for (const sourceElt of loadingStateEltsByType['data-loading-class-remove']) { 131 + const classNames = (sourceElt.getAttribute('data-loading-class-remove') || '').split(' ') 132 + for (const targetElt of getLoadingTarget(sourceElt)) { 133 + queueLoadingState( 134 + sourceElt, 135 + targetElt, 136 + () => { 137 + for (const className of classNames) { 138 + targetElt.classList.remove(className) 139 + } 140 + }, 141 + () => { 142 + for (const className of classNames) { 143 + targetElt.classList.add(className) 144 + } 145 + } 146 + ) 147 + } 148 + } 149 + 150 + for (const sourceElt of loadingStateEltsByType['data-loading-disable']) { 151 + for (const targetElt of getLoadingTarget(sourceElt)) { 152 + queueLoadingState( 153 + sourceElt, 154 + targetElt, 155 + () => { 156 + ;(targetElt as HTMLButtonElement | HTMLInputElement).disabled = true 157 + }, 158 + () => { 159 + ;(targetElt as HTMLButtonElement | HTMLInputElement).disabled = false 160 + } 161 + ) 162 + } 163 + } 164 + 165 + for (const sourceElt of loadingStateEltsByType['data-loading-aria-busy']) { 166 + for (const targetElt of getLoadingTarget(sourceElt)) { 167 + queueLoadingState( 168 + sourceElt, 169 + targetElt, 170 + () => { 171 + targetElt.setAttribute('aria-busy', 'true') 172 + }, 173 + () => { 174 + targetElt.removeAttribute('aria-busy') 175 + } 176 + ) 177 + } 178 + } 179 + } 180 + 181 + if (name === 'htmx:beforeOnLoad') { 182 + while (loadingStatesUndoQueue.length > 0) { 183 + const callback = loadingStatesUndoQueue.shift() 184 + callback?.() 185 + } 186 + } 187 + }, 188 + }) 189 + }
+221
src-js/src/core/htmx-extensions/sse.ts
··· 1 + /** 2 + * htmx Server-Sent Events Extension 3 + * 4 + * Adds support for Server Sent Events to htmx. 5 + * Ported from the original IIFE extension for ES module bundling. 6 + */ 7 + 8 + import type { HtmxApi, HtmxInternalApi } from '../types' 9 + 10 + export function initSSEExtension(htmx: HtmxApi): void { 11 + let api: HtmxInternalApi 12 + 13 + function createEventSource(url: string): EventSource { 14 + return new EventSource(url, { withCredentials: true }) 15 + } 16 + 17 + function hasEventSource(node: Element): boolean { 18 + return api.getInternalData(node).sseEventSource != null 19 + } 20 + 21 + function maybeCloseSSESource(elt: Element): boolean { 22 + if (!api.bodyContains(elt)) { 23 + const internalData = api.getInternalData(elt) 24 + const source = internalData.sseEventSource as EventSource | undefined 25 + if (source != null) { 26 + api.triggerEvent(elt, 'htmx:sseClose', { 27 + source, 28 + type: 'nodeMissing', 29 + }) 30 + source.close() 31 + return true 32 + } 33 + } 34 + return false 35 + } 36 + 37 + function swap(elt: Element, content: string): void { 38 + let transformedContent = content 39 + api.withExtensions(elt, (extension) => { 40 + if (extension.transformResponse) { 41 + transformedContent = extension.transformResponse(transformedContent, null, elt) 42 + } 43 + }) 44 + 45 + const swapSpec = api.getSwapSpecification(elt) 46 + const target = api.getTarget(elt) 47 + if (target) { 48 + api.swap(target, transformedContent, swapSpec) 49 + } 50 + } 51 + 52 + function registerSSE(elt: Element): void { 53 + // Add message handlers for every `sse-swap` attribute 54 + const sseSwapAttr = api.getAttributeValue(elt, 'sse-swap') 55 + if (sseSwapAttr) { 56 + const sourceElement = api.getClosestMatch(elt, hasEventSource) 57 + if (sourceElement == null) { 58 + return 59 + } 60 + 61 + const internalData = api.getInternalData(sourceElement) 62 + const source = internalData.sseEventSource as EventSource 63 + 64 + const sseEventNames = sseSwapAttr.split(',') 65 + 66 + for (const sseEventName of sseEventNames) { 67 + const eventName = sseEventName.trim() 68 + const listener = (event: Event) => { 69 + const messageEvent = event as MessageEvent 70 + if (maybeCloseSSESource(sourceElement)) { 71 + return 72 + } 73 + 74 + if (!api.bodyContains(elt)) { 75 + source.removeEventListener(eventName, listener) 76 + return 77 + } 78 + 79 + if (!api.triggerEvent(elt, 'htmx:sseBeforeMessage', event)) { 80 + return 81 + } 82 + swap(elt, messageEvent.data) 83 + api.triggerEvent(elt, 'htmx:sseMessage', event) 84 + } 85 + 86 + api.getInternalData(elt).sseEventListener = listener 87 + source.addEventListener(eventName, listener) 88 + } 89 + } 90 + 91 + // Add message handlers for every `hx-trigger="sse:*"` attribute 92 + const hxTrigger = api.getAttributeValue(elt, 'hx-trigger') 93 + if (hxTrigger) { 94 + const sourceElement = api.getClosestMatch(elt, hasEventSource) 95 + if (sourceElement == null) { 96 + return 97 + } 98 + 99 + const internalData = api.getInternalData(sourceElement) 100 + const source = internalData.sseEventSource as EventSource 101 + 102 + const triggerSpecs = api.getTriggerSpecs(elt) 103 + for (const ts of triggerSpecs) { 104 + if (!ts.trigger.startsWith('sse:')) { 105 + continue 106 + } 107 + 108 + const eventName = ts.trigger.slice(4) 109 + const listener = (event: Event) => { 110 + if (maybeCloseSSESource(sourceElement)) { 111 + return 112 + } 113 + if (!api.bodyContains(elt)) { 114 + source.removeEventListener(eventName, listener) 115 + } 116 + htmx.trigger(elt, ts.trigger, event) 117 + htmx.trigger(elt, 'htmx:sseMessage', event) 118 + } 119 + 120 + api.getInternalData(elt).sseEventListener = listener 121 + source.addEventListener(eventName, listener) 122 + } 123 + } 124 + } 125 + 126 + function ensureEventSource(elt: Element, url: string, retryCount?: number): void { 127 + const source = htmx.createEventSource!(url) 128 + 129 + source.onerror = (err) => { 130 + api.triggerErrorEvent(elt, 'htmx:sseError', { error: err, source }) 131 + 132 + if (maybeCloseSSESource(elt)) { 133 + return 134 + } 135 + 136 + if (source.readyState === EventSource.CLOSED) { 137 + let count = retryCount || 0 138 + count = Math.max(Math.min(count * 2, 128), 1) 139 + const timeout = count * 500 140 + window.setTimeout(() => { 141 + ensureEventSourceOnElement(elt, count) 142 + }, timeout) 143 + } 144 + } 145 + 146 + source.onopen = () => { 147 + api.triggerEvent(elt, 'htmx:sseOpen', { source }) 148 + 149 + if (retryCount && retryCount > 0) { 150 + const childrenToFix = elt.querySelectorAll( 151 + '[sse-swap], [data-sse-swap], [hx-trigger], [data-hx-trigger]' 152 + ) 153 + for (const child of childrenToFix) { 154 + registerSSE(child) 155 + } 156 + } 157 + } 158 + 159 + api.getInternalData(elt).sseEventSource = source 160 + 161 + const closeAttribute = api.getAttributeValue(elt, 'sse-close') 162 + if (closeAttribute) { 163 + source.addEventListener(closeAttribute, () => { 164 + api.triggerEvent(elt, 'htmx:sseClose', { 165 + source, 166 + type: 'message', 167 + }) 168 + source.close() 169 + }) 170 + } 171 + } 172 + 173 + function ensureEventSourceOnElement(elt: Element | null, retryCount?: number): void { 174 + if (elt == null) { 175 + return 176 + } 177 + 178 + const sseURL = api.getAttributeValue(elt, 'sse-connect') 179 + if (sseURL) { 180 + ensureEventSource(elt, sseURL, retryCount) 181 + } 182 + 183 + registerSSE(elt) 184 + } 185 + 186 + htmx.defineExtension('sse', { 187 + init(apiRef: HtmxInternalApi) { 188 + api = apiRef 189 + 190 + if (htmx.createEventSource == null) { 191 + htmx.createEventSource = createEventSource 192 + } 193 + }, 194 + 195 + getSelectors() { 196 + return ['[sse-connect]', '[data-sse-connect]', '[sse-swap]', '[data-sse-swap]'] 197 + }, 198 + 199 + onEvent(name: string, evt: CustomEvent) { 200 + const parent = (evt.target || evt.detail?.elt) as Element 201 + switch (name) { 202 + case 'htmx:beforeCleanupElement': { 203 + const internalData = api.getInternalData(parent) 204 + const source = internalData.sseEventSource as EventSource | undefined 205 + if (source) { 206 + api.triggerEvent(parent, 'htmx:sseClose', { 207 + source, 208 + type: 'nodeReplaced', 209 + }) 210 + source.close() 211 + } 212 + return 213 + } 214 + 215 + case 'htmx:afterProcessNode': 216 + ensureEventSourceOnElement(parent) 217 + break 218 + } 219 + }, 220 + }) 221 + }
+52
src-js/src/core/index.ts
··· 1 + /** 2 + * Core module - initializes htmx, extensions, and Alpine.js 3 + * 4 + * This module bundles all core libraries that are needed on every page: 5 + * - htmx for hypermedia-driven interactions 6 + * - htmx extensions (loading-states, sse) 7 + * - Alpine.js for declarative reactivity 8 + * 9 + * Heavy libraries (maps, cropper) are NOT loaded here - they are lazy-loaded 10 + * only when needed via the features modules. 11 + */ 12 + 13 + // Import Alpine.js 14 + import Alpine from 'alpinejs' 15 + // Import htmx 16 + import htmx from 'htmx.org' 17 + // Import htmx extensions 18 + import { initLoadingStatesExtension } from './htmx-extensions/loading-states' 19 + import { initSSEExtension } from './htmx-extensions/sse' 20 + 21 + // Import types 22 + import type { HtmxApi } from './types' 23 + 24 + // Expose htmx globally (required for some inline attributes) 25 + declare global { 26 + interface Window { 27 + htmx: HtmxApi 28 + Alpine: typeof Alpine 29 + } 30 + } 31 + 32 + // Cast and expose htmx globally 33 + const htmxApi = htmx as unknown as HtmxApi 34 + window.htmx = htmxApi 35 + 36 + // Initialize htmx extensions 37 + initLoadingStatesExtension(htmxApi) 38 + initSSEExtension(htmxApi) 39 + 40 + // Expose Alpine globally 41 + window.Alpine = Alpine 42 + 43 + // Start Alpine when DOM is ready 44 + if (document.readyState === 'loading') { 45 + document.addEventListener('DOMContentLoaded', () => { 46 + Alpine.start() 47 + }) 48 + } else { 49 + Alpine.start() 50 + } 51 + 52 + export { htmxApi as htmx, Alpine }
+102
src-js/src/core/types.ts
··· 1 + /** 2 + * htmx Type Definitions 3 + * 4 + * Types for htmx API used by extensions. 5 + */ 6 + 7 + export interface HtmxExtension { 8 + init?: (api: HtmxInternalApi) => void 9 + getSelectors?: () => string[] 10 + onEvent?: (name: string, evt: CustomEvent) => void | boolean 11 + transformResponse?: (text: string, xhr: XMLHttpRequest | null, elt: Element) => string 12 + isInlineSwap?: (swapStyle: string) => boolean 13 + handleSwap?: ( 14 + swapStyle: string, 15 + target: Element, 16 + fragment: DocumentFragment, 17 + settleInfo: unknown 18 + ) => boolean 19 + encodeParameters?: (xhr: XMLHttpRequest, parameters: FormData, elt: Element) => unknown 20 + } 21 + 22 + export interface HtmxInternalData { 23 + sseEventSource?: EventSource 24 + sseEventListener?: EventListener 25 + [key: string]: unknown 26 + } 27 + 28 + export interface HtmxTriggerSpec { 29 + trigger: string 30 + pollInterval?: number 31 + eventFilter?: (evt: Event) => boolean 32 + changed?: boolean 33 + once?: boolean 34 + consume?: boolean 35 + delay?: number 36 + from?: string 37 + target?: string 38 + throttle?: number 39 + queue?: string 40 + root?: string 41 + threshold?: string 42 + } 43 + 44 + export interface HtmxSwapSpecification { 45 + swapStyle: string 46 + swapDelay: number 47 + settleDelay: number 48 + transition: boolean 49 + ignoreTitle: boolean 50 + head: string 51 + scroll?: string 52 + scrollTarget?: string 53 + show?: string 54 + showTarget?: string 55 + focusScroll?: boolean 56 + } 57 + 58 + export interface HtmxInternalApi { 59 + getInternalData(elt: Element): HtmxInternalData 60 + bodyContains(elt: Element): boolean 61 + getAttributeValue(elt: Element, name: string): string | null 62 + getClosestMatch(elt: Element, condition: (elt: Element) => boolean): Element | null 63 + triggerEvent(elt: Element, name: string, detail?: unknown): boolean 64 + triggerErrorEvent(elt: Element, name: string, detail?: unknown): boolean 65 + getTriggerSpecs(elt: Element): HtmxTriggerSpec[] 66 + getSwapSpecification(elt: Element): HtmxSwapSpecification 67 + getTarget(elt: Element): Element | null 68 + swap(target: Element, content: string, swapSpec: HtmxSwapSpecification): void 69 + withExtensions(elt: Element, callback: (extension: HtmxExtension) => void): void 70 + } 71 + 72 + export interface HtmxApi { 73 + version: string 74 + config: Record<string, unknown> 75 + process(elt: Element): void 76 + on(eventName: string, handler: (evt: Event) => void): void 77 + off(eventName: string, handler: (evt: Event) => void): void 78 + trigger(elt: Element, eventName: string, detail?: unknown): boolean 79 + ajax(verb: string, path: string, context?: unknown): void 80 + find(selector: string): Element | null 81 + findAll(selectorOrElt: string | Element, selector?: string): Element[] 82 + closest(elt: Element, selector: string): Element | null 83 + remove(elt: Element): void 84 + addClass(elt: Element, className: string): void 85 + removeClass(elt: Element, className: string): void 86 + toggleClass(elt: Element, className: string): void 87 + takeClass(elt: Element, className: string): void 88 + swap(target: Element, content: string, swapSpec?: Partial<HtmxSwapSpecification>): void 89 + defineExtension(name: string, extension: HtmxExtension): void 90 + removeExtension(name: string): void 91 + logAll(): void 92 + logNone(): void 93 + parseInterval(str: string): number 94 + createEventSource?: (url: string) => EventSource 95 + } 96 + 97 + declare global { 98 + interface Window { 99 + htmx: HtmxApi 100 + } 101 + const htmx: HtmxApi 102 + }
+58
src-js/src/features/cropper/index.ts
··· 1 + /** 2 + * Cropper Feature - Lazy Loading 3 + * 4 + * Provides lazy loading for Cropper.js, used for image cropping 5 + * in the event creation form. 6 + */ 7 + 8 + import type Cropper from 'cropperjs' 9 + 10 + // Track loading state to avoid duplicate loads 11 + let loadPromise: Promise<typeof Cropper> | null = null 12 + 13 + /** 14 + * Lazy load Cropper.js and its CSS. 15 + * Returns the Cropper constructor. 16 + */ 17 + export async function loadCropper(): Promise<typeof Cropper> { 18 + if (loadPromise) { 19 + return loadPromise 20 + } 21 + 22 + loadPromise = (async () => { 23 + // Import Cropper.js and its CSS 24 + const [CropperModule] = await Promise.all([ 25 + import('cropperjs'), 26 + import('cropperjs/dist/cropper.css'), 27 + ]) 28 + 29 + const CropperClass = CropperModule.default 30 + 31 + // Expose globally for inline scripts in templates 32 + ;(window as Window & { Cropper?: typeof Cropper }).Cropper = CropperClass 33 + 34 + return CropperClass 35 + })() 36 + 37 + return loadPromise 38 + } 39 + 40 + /** 41 + * Initialize cropper on pages that need it. 42 + * Detects the presence of cropper-related elements. 43 + */ 44 + export async function initCropper(): Promise<void> { 45 + // Check if any cropper-related elements exist 46 + const headerCanvas = document.getElementById('headerCanvas') 47 + const thumbnailCanvas = document.getElementById('thumbnailCanvas') 48 + 49 + if (!headerCanvas && !thumbnailCanvas) { 50 + return 51 + } 52 + 53 + // Preload Cropper.js so it's available when user selects an image 54 + await loadCropper() 55 + } 56 + 57 + // Export types for consumers 58 + export type { Cropper }
+192
src-js/src/features/cropper/profile-cropper.ts
··· 1 + /** 2 + * Profile Cropper - Avatar and Banner image cropping 3 + * 4 + * Handles lazy loading of Cropper.js and managing avatar/banner 5 + * image uploads with cropping on the profile settings page. 6 + */ 7 + 8 + import type Cropper from 'cropperjs' 9 + import { loadCropper } from './index' 10 + 11 + // Store cropper instances 12 + let avatarCropper: Cropper | null = null 13 + let bannerCropper: Cropper | null = null 14 + let initialized = false 15 + 16 + /** 17 + * Initialize profile cropper functionality. 18 + * Sets up event listeners for avatar and banner file inputs. 19 + */ 20 + export async function initProfileCropper(): Promise<void> { 21 + const avatarInput = document.getElementById('avatar-input') as HTMLInputElement | null 22 + const bannerInput = document.getElementById('banner-input') as HTMLInputElement | null 23 + 24 + if (!avatarInput && !bannerInput) { 25 + return 26 + } 27 + 28 + // Prevent double initialization 29 + if (initialized) { 30 + return 31 + } 32 + initialized = true 33 + 34 + // Preload Cropper.js 35 + const CropperClass = await loadCropper() 36 + 37 + if (avatarInput) { 38 + setupAvatarCropper(avatarInput, CropperClass) 39 + } 40 + 41 + if (bannerInput) { 42 + setupBannerCropper(bannerInput, CropperClass) 43 + } 44 + } 45 + 46 + function setupAvatarCropper(input: HTMLInputElement, CropperClass: typeof Cropper): void { 47 + const canvas = document.getElementById('avatar-canvas') as HTMLCanvasElement | null 48 + const cropButton = document.getElementById('avatar-crop') as HTMLButtonElement | null 49 + 50 + if (!canvas || !cropButton) { 51 + return 52 + } 53 + 54 + input.addEventListener('change', (e: Event) => { 55 + const target = e.target as HTMLInputElement 56 + const file = target.files?.[0] 57 + if (!file) return 58 + 59 + const reader = new FileReader() 60 + reader.onload = (event: ProgressEvent<FileReader>) => { 61 + const img = new Image() 62 + img.onload = () => { 63 + canvas.width = img.width 64 + canvas.height = img.height 65 + canvas.style.display = 'block' 66 + cropButton.style.display = 'inline-block' 67 + 68 + const ctx = canvas.getContext('2d') 69 + if (ctx) { 70 + ctx.drawImage(img, 0, 0) 71 + } 72 + 73 + if (avatarCropper) { 74 + avatarCropper.destroy() 75 + } 76 + avatarCropper = new CropperClass(canvas, { 77 + aspectRatio: 1, 78 + viewMode: 1, 79 + }) 80 + } 81 + img.src = event.target?.result as string 82 + } 83 + reader.readAsDataURL(file) 84 + }) 85 + 86 + cropButton.addEventListener('click', () => { 87 + if (!avatarCropper) return 88 + 89 + avatarCropper 90 + .getCroppedCanvas({ 91 + width: 400, 92 + height: 400, 93 + }) 94 + .toBlob((blob) => { 95 + if (!blob) return 96 + 97 + const formData = new FormData() 98 + formData.append('avatar', blob, 'avatar.png') 99 + 100 + fetch('/settings/avatar', { 101 + method: 'POST', 102 + body: formData, 103 + }).then((response) => { 104 + if (response.ok) { 105 + window.location.reload() 106 + } 107 + }) 108 + }, 'image/png') 109 + }) 110 + } 111 + 112 + function setupBannerCropper(input: HTMLInputElement, CropperClass: typeof Cropper): void { 113 + const canvas = document.getElementById('banner-canvas') as HTMLCanvasElement | null 114 + const cropButton = document.getElementById('banner-crop') as HTMLButtonElement | null 115 + 116 + if (!canvas || !cropButton) { 117 + return 118 + } 119 + 120 + input.addEventListener('change', (e: Event) => { 121 + const target = e.target as HTMLInputElement 122 + const file = target.files?.[0] 123 + if (!file) return 124 + 125 + const reader = new FileReader() 126 + reader.onload = (event: ProgressEvent<FileReader>) => { 127 + const img = new Image() 128 + img.onload = () => { 129 + canvas.width = img.width 130 + canvas.height = img.height 131 + canvas.style.display = 'block' 132 + cropButton.style.display = 'inline-block' 133 + 134 + const ctx = canvas.getContext('2d') 135 + if (ctx) { 136 + ctx.drawImage(img, 0, 0) 137 + } 138 + 139 + if (bannerCropper) { 140 + bannerCropper.destroy() 141 + } 142 + bannerCropper = new CropperClass(canvas, { 143 + aspectRatio: 16 / 9, 144 + viewMode: 1, 145 + }) 146 + } 147 + img.src = event.target?.result as string 148 + } 149 + reader.readAsDataURL(file) 150 + }) 151 + 152 + cropButton.addEventListener('click', () => { 153 + if (!bannerCropper) return 154 + 155 + bannerCropper 156 + .getCroppedCanvas({ 157 + width: 1600, 158 + height: 900, 159 + }) 160 + .toBlob((blob) => { 161 + if (!blob) return 162 + 163 + const formData = new FormData() 164 + formData.append('banner', blob, 'banner.png') 165 + 166 + fetch('/settings/banner', { 167 + method: 'POST', 168 + body: formData, 169 + }).then((response) => { 170 + if (response.ok) { 171 + window.location.reload() 172 + } 173 + }) 174 + }, 'image/png') 175 + }) 176 + } 177 + 178 + /** 179 + * Clean up cropper instances. 180 + * Call this when navigating away from the profile page. 181 + */ 182 + export function destroyProfileCropper(): void { 183 + if (avatarCropper) { 184 + avatarCropper.destroy() 185 + avatarCropper = null 186 + } 187 + if (bannerCropper) { 188 + bannerCropper.destroy() 189 + bannerCropper = null 190 + } 191 + initialized = false 192 + }
+625
src-js/src/features/events/create.ts
··· 1 + /** 2 + * Event Form Alpine.js Component 3 + * 4 + * Full event creation/editing form with Alpine.js. 5 + * This is an Alpine.js component factory that returns the component definition. 6 + */ 7 + 8 + import type { EventFormData, FormLink, FormLocation, LocationSuggestion } from '../../types' 9 + 10 + interface EventFormState { 11 + submitUrl: string 12 + isEditMode: boolean 13 + formData: EventFormData 14 + startDateTimeLocal: string 15 + endDateTimeLocal: string 16 + submitting: boolean 17 + submitted: boolean 18 + uploading: boolean 19 + uploadingThumbnail: boolean 20 + errorMessage: string | null 21 + eventUrl: string | null 22 + headerCropper: unknown | null 23 + thumbnailCropper: unknown | null 24 + showCropper: boolean 25 + showThumbnailCropper: boolean 26 + showDescriptionPreview: boolean 27 + descriptionPreviewHtml: string 28 + loadingPreview: boolean 29 + locationSuggestions: LocationSuggestion[] 30 + loadingSuggestions: boolean 31 + showLocationSuggestions: boolean 32 + locationFeedback: string | null 33 + locationFilter: string 34 + // Computed properties 35 + readonly addressLocations: FormLocation[] 36 + readonly geoLocations: FormLocation[] 37 + // Methods 38 + formatDateTimeLocal(date: Date): string 39 + findAddressLocationIndex(filteredIndex: number): number 40 + findGeoLocationIndex(filteredIndex: number): number 41 + addLocation(): void 42 + removeAddressLocation(filteredIndex: number): void 43 + addGeoLocation(): void 44 + removeGeoLocation(filteredIndex: number): void 45 + addLink(): void 46 + removeLink(index: number): void 47 + clearStartDateTime(): void 48 + clearEndDateTime(): void 49 + applyLocationSuggestion(suggestion: LocationSuggestion): void 50 + handleHeaderImageSelect(event: Event): void 51 + handleThumbnailImageSelect(event: Event): void 52 + removeHeader(): void 53 + removeThumbnail(): void 54 + resetForm(): void 55 + } 56 + 57 + /** 58 + * Event form Alpine.js component factory 59 + * 60 + * This function is called by Alpine.js to create the component. 61 + * Template data is passed via data attributes on the component root element. 62 + */ 63 + export function eventForm(): EventFormState & Record<string, unknown> { 64 + return { 65 + submitUrl: '/event', 66 + isEditMode: false, 67 + formData: { 68 + name: '', 69 + description: '', 70 + status: 'scheduled', 71 + mode: 'inperson', 72 + tz: 'America/New_York', 73 + startsAt: null, 74 + endsAt: null, 75 + locations: [], 76 + links: [], 77 + headerCid: null, 78 + headerAlt: null, 79 + headerSize: null, 80 + thumbnailCid: null, 81 + thumbnailAlt: null, 82 + requireConfirmedEmail: false, 83 + sendNotifications: false, 84 + }, 85 + startDateTimeLocal: '', 86 + endDateTimeLocal: '', 87 + submitting: false, 88 + submitted: false, 89 + uploading: false, 90 + uploadingThumbnail: false, 91 + errorMessage: null, 92 + eventUrl: null, 93 + headerCropper: null, 94 + thumbnailCropper: null, 95 + showCropper: false, 96 + showThumbnailCropper: false, 97 + showDescriptionPreview: false, 98 + descriptionPreviewHtml: '', 99 + loadingPreview: false, 100 + locationSuggestions: [], 101 + loadingSuggestions: false, 102 + showLocationSuggestions: false, 103 + locationFeedback: null, 104 + locationFilter: '', 105 + 106 + init( 107 + this: EventFormState & { 108 + $el: HTMLElement 109 + $watch: (prop: string, handler: (value: unknown) => void) => void 110 + } 111 + ) { 112 + // Read configuration from data attributes 113 + const el = this.$el 114 + if (el.dataset.submitUrl) { 115 + this.submitUrl = el.dataset.submitUrl 116 + } 117 + if (el.dataset.editMode === 'true') { 118 + this.isEditMode = true 119 + } 120 + if (el.dataset.eventData) { 121 + try { 122 + this.formData = JSON.parse(el.dataset.eventData) 123 + } catch (e) { 124 + console.error('Failed to parse event data:', e) 125 + } 126 + } 127 + if (el.dataset.defaultTz) { 128 + this.formData.tz = el.dataset.defaultTz 129 + } 130 + 131 + // Convert ISO datetime to datetime-local format if we have existing data 132 + if (this.formData.startsAt) { 133 + const startDate = new Date(this.formData.startsAt) 134 + this.startDateTimeLocal = this.formatDateTimeLocal(startDate) 135 + } else { 136 + // Set default start time to next 6 PM after 3 hours from now 137 + const now = new Date() 138 + now.setHours(now.getHours() + 3) 139 + 140 + const targetDate = new Date(now) 141 + if (now.getHours() >= 18) { 142 + targetDate.setDate(targetDate.getDate() + 1) 143 + } 144 + targetDate.setHours(18, 0, 0, 0) 145 + 146 + this.startDateTimeLocal = this.formatDateTimeLocal(targetDate) 147 + } 148 + 149 + if (this.formData.endsAt) { 150 + const endDate = new Date(this.formData.endsAt) 151 + this.endDateTimeLocal = this.formatDateTimeLocal(endDate) 152 + } 153 + 154 + // Watch datetime-local inputs and update formData 155 + this.$watch('startDateTimeLocal', (value: unknown) => { 156 + if (value) { 157 + const date = new Date(value as string) 158 + this.formData.startsAt = date.toISOString() 159 + } else { 160 + this.formData.startsAt = null 161 + } 162 + }) 163 + 164 + this.$watch('endDateTimeLocal', (value: unknown) => { 165 + if (value) { 166 + const date = new Date(value as string) 167 + this.formData.endsAt = date.toISOString() 168 + } else { 169 + this.formData.endsAt = null 170 + } 171 + }) 172 + }, 173 + 174 + // Computed properties to filter locations by type 175 + get addressLocations(): FormLocation[] { 176 + return this.formData.locations.filter((loc): loc is FormLocation => loc.type === 'address') 177 + }, 178 + 179 + get geoLocations(): FormLocation[] { 180 + return this.formData.locations.filter((loc): loc is FormLocation => loc.type === 'geo') 181 + }, 182 + 183 + // Get the actual index within the filtered array 184 + addressLocationIndex(_filteredIndex: number): number { 185 + return _filteredIndex 186 + }, 187 + 188 + geoLocationIndex(_filteredIndex: number): number { 189 + return _filteredIndex 190 + }, 191 + 192 + // Find the original array index for an address location 193 + findAddressLocationIndex(filteredIndex: number): number { 194 + let count = 0 195 + for (let i = 0; i < this.formData.locations.length; i++) { 196 + if (this.formData.locations[i].type === 'address') { 197 + if (count === filteredIndex) return i 198 + count++ 199 + } 200 + } 201 + return -1 202 + }, 203 + 204 + // Find the original array index for a geo location 205 + findGeoLocationIndex(filteredIndex: number): number { 206 + let count = 0 207 + for (let i = 0; i < this.formData.locations.length; i++) { 208 + if (this.formData.locations[i].type === 'geo') { 209 + if (count === filteredIndex) return i 210 + count++ 211 + } 212 + } 213 + return -1 214 + }, 215 + 216 + formatDateTimeLocal(date: Date): string { 217 + const year = date.getFullYear() 218 + const month = String(date.getMonth() + 1).padStart(2, '0') 219 + const day = String(date.getDate()).padStart(2, '0') 220 + const hours = String(date.getHours()).padStart(2, '0') 221 + const minutes = String(date.getMinutes()).padStart(2, '0') 222 + return `${year}-${month}-${day}T${hours}:${minutes}` 223 + }, 224 + 225 + get headerPreviewUrl(): string | null { 226 + return this.formData.headerCid ? `/content/${this.formData.headerCid}.png` : null 227 + }, 228 + 229 + get thumbnailPreviewUrl(): string | null { 230 + return this.formData.thumbnailCid ? `/content/${this.formData.thumbnailCid}.png` : null 231 + }, 232 + 233 + get filteredLocationSuggestions(): LocationSuggestion[] { 234 + if (!this.locationFilter.trim()) { 235 + return this.locationSuggestions 236 + } 237 + const query = this.locationFilter.toLowerCase().trim() 238 + return this.locationSuggestions.filter((suggestion) => { 239 + const searchFields = [ 240 + suggestion.name, 241 + suggestion.street, 242 + suggestion.locality, 243 + suggestion.region, 244 + suggestion.postal_code, 245 + suggestion.country, 246 + ] 247 + .filter(Boolean) 248 + .map((f) => f!.toLowerCase()) 249 + 250 + const queryTerms = query.split(/\s+/) 251 + return queryTerms.every((term) => searchFields.some((field) => field.includes(term))) 252 + }) 253 + }, 254 + 255 + addLocation(): void { 256 + this.formData.locations.push({ 257 + type: 'address', 258 + country: '', 259 + postalCode: null, 260 + region: null, 261 + locality: null, 262 + street: null, 263 + name: null, 264 + }) 265 + }, 266 + 267 + removeAddressLocation(filteredIndex: number): void { 268 + const actualIndex = this.findAddressLocationIndex(filteredIndex) 269 + if (actualIndex !== -1) { 270 + this.formData.locations.splice(actualIndex, 1) 271 + } 272 + }, 273 + 274 + addGeoLocation(): void { 275 + this.formData.locations.push({ 276 + type: 'geo', 277 + latitude: '', 278 + longitude: '', 279 + name: null, 280 + }) 281 + }, 282 + 283 + removeGeoLocation(filteredIndex: number): void { 284 + const actualIndex = this.findGeoLocationIndex(filteredIndex) 285 + if (actualIndex !== -1) { 286 + this.formData.locations.splice(actualIndex, 1) 287 + } 288 + }, 289 + 290 + addLink(): void { 291 + this.formData.links.push({ 292 + url: '', 293 + label: null, 294 + }) 295 + }, 296 + 297 + removeLink(index: number): void { 298 + this.formData.links.splice(index, 1) 299 + }, 300 + 301 + clearStartDateTime(): void { 302 + const input = document.getElementById('eventStartDateTime') as HTMLInputElement | null 303 + if (input) { 304 + input.value = '' 305 + } 306 + this.startDateTimeLocal = '' 307 + this.formData.startsAt = null 308 + }, 309 + 310 + clearEndDateTime(): void { 311 + const input = document.getElementById('eventEndDateTime') as HTMLInputElement | null 312 + if (input) { 313 + input.value = '' 314 + } 315 + this.endDateTimeLocal = '' 316 + this.formData.endsAt = null 317 + }, 318 + 319 + async fetchLocationSuggestions(): Promise<void> { 320 + if (this.loadingSuggestions || this.locationSuggestions.length > 0) { 321 + this.showLocationSuggestions = true 322 + return 323 + } 324 + this.loadingSuggestions = true 325 + try { 326 + const response = await fetch('/event/location-suggestions') 327 + const data = await response.json() 328 + if (response.ok && data.suggestions) { 329 + this.locationSuggestions = data.suggestions 330 + } 331 + } catch (error) { 332 + console.error('Failed to fetch location suggestions:', error) 333 + } finally { 334 + this.loadingSuggestions = false 335 + this.showLocationSuggestions = true 336 + } 337 + }, 338 + 339 + applyLocationSuggestion(suggestion: LocationSuggestion): void { 340 + const hasAddress = !!suggestion.country 341 + const hasGeo = !!(suggestion.latitude && suggestion.longitude) 342 + 343 + // Add address location if country is available 344 + if (hasAddress) { 345 + this.formData.locations.push({ 346 + type: 'address', 347 + country: suggestion.country || '', 348 + postalCode: suggestion.postal_code || null, 349 + region: suggestion.region || null, 350 + locality: suggestion.locality || null, 351 + street: suggestion.street || null, 352 + name: suggestion.name || null, 353 + }) 354 + } 355 + // Also add geo coordinates if available 356 + if (hasGeo) { 357 + this.formData.locations.push({ 358 + type: 'geo', 359 + latitude: String(suggestion.latitude), 360 + longitude: String(suggestion.longitude), 361 + name: suggestion.name || null, 362 + }) 363 + } 364 + 365 + // Show feedback about what was added 366 + if (hasAddress && hasGeo) { 367 + this.locationFeedback = 'Added address and coordinates' 368 + } else if (hasAddress) { 369 + this.locationFeedback = 'Added address' 370 + } else if (hasGeo) { 371 + this.locationFeedback = 'Added coordinates' 372 + } 373 + 374 + if (this.locationFeedback) { 375 + setTimeout(() => { 376 + this.locationFeedback = null 377 + }, 3000) 378 + } 379 + 380 + this.showLocationSuggestions = false 381 + this.locationFilter = '' 382 + }, 383 + 384 + async toggleDescriptionPreview(): Promise<void> { 385 + if (this.showDescriptionPreview) { 386 + this.showDescriptionPreview = false 387 + return 388 + } 389 + 390 + if (!this.formData.description || this.formData.description.trim().length < 10) { 391 + alert('Description must be at least 10 characters to preview') 392 + return 393 + } 394 + 395 + this.showDescriptionPreview = true 396 + this.loadingPreview = true 397 + this.descriptionPreviewHtml = '' 398 + 399 + try { 400 + const response = await fetch('/event/preview-description', { 401 + method: 'POST', 402 + headers: { 403 + 'Content-Type': 'application/json', 404 + }, 405 + body: JSON.stringify({ 406 + description: this.formData.description, 407 + }), 408 + }) 409 + 410 + const data = await response.json() 411 + 412 + if (response.ok) { 413 + this.descriptionPreviewHtml = data.html 414 + } else { 415 + this.errorMessage = data.error || 'Failed to load preview' 416 + this.showDescriptionPreview = false 417 + } 418 + } catch (error) { 419 + console.error('Preview error:', error) 420 + this.errorMessage = 'Failed to load preview. Please try again.' 421 + this.showDescriptionPreview = false 422 + } finally { 423 + this.loadingPreview = false 424 + } 425 + }, 426 + 427 + // Image upload methods are kept but simplified - they rely on Cropper.js 428 + // which is loaded from CDN in the template 429 + handleHeaderImageSelect(event: Event): void { 430 + const input = event.target as HTMLInputElement 431 + const file = input.files?.[0] 432 + if (!file) return 433 + 434 + if (file.size > 3000000) { 435 + alert('Image must be smaller than 3MB') 436 + input.value = '' 437 + return 438 + } 439 + 440 + // Image cropping logic handled inline due to Cropper.js dependency 441 + console.log('Header image selected, size:', file.size) 442 + }, 443 + 444 + handleThumbnailImageSelect(event: Event): void { 445 + const input = event.target as HTMLInputElement 446 + const file = input.files?.[0] 447 + if (!file) return 448 + 449 + if (file.size > 3000000) { 450 + alert('Image must be smaller than 3MB') 451 + input.value = '' 452 + return 453 + } 454 + 455 + console.log('Thumbnail image selected, size:', file.size) 456 + }, 457 + 458 + removeHeader(): void { 459 + this.formData.headerCid = null 460 + this.formData.headerAlt = null 461 + this.formData.headerSize = null 462 + this.showCropper = false 463 + }, 464 + 465 + removeThumbnail(): void { 466 + this.formData.thumbnailCid = null 467 + this.formData.thumbnailAlt = null 468 + this.showThumbnailCropper = false 469 + }, 470 + 471 + async submitForm(): Promise<void> { 472 + this.errorMessage = null 473 + 474 + // Validate name 475 + if (!this.formData.name || this.formData.name.trim().length < 10) { 476 + this.errorMessage = 'Event name must be at least 10 characters.' 477 + return 478 + } 479 + if (this.formData.name.trim().length > 500) { 480 + this.errorMessage = 'Event name must be no more than 500 characters.' 481 + return 482 + } 483 + 484 + // Validate description 485 + if (!this.formData.description || this.formData.description.trim().length < 10) { 486 + this.errorMessage = 'Description must be at least 10 characters.' 487 + return 488 + } 489 + if (this.formData.description.trim().length > 3000) { 490 + this.errorMessage = 'Description must be no more than 3000 characters.' 491 + return 492 + } 493 + 494 + // Validate address locations 495 + const invalidAddresses = this.addressLocations.filter( 496 + (loc) => loc.type === 'address' && (!loc.country || loc.country.trim() === '') 497 + ) 498 + if (invalidAddresses.length > 0) { 499 + this.errorMessage = 500 + 'All locations must have a country selected. Please select a country or remove the location.' 501 + return 502 + } 503 + 504 + // Validate geo locations 505 + for (let i = 0; i < this.geoLocations.length; i++) { 506 + const geo = this.geoLocations[i] 507 + if (geo.type === 'geo') { 508 + if (!geo.latitude || !geo.longitude) { 509 + this.errorMessage = `Coordinates ${i + 1} must have both latitude and longitude.` 510 + return 511 + } 512 + const lat = parseFloat(geo.latitude) 513 + const lon = parseFloat(geo.longitude) 514 + if (isNaN(lat) || lat < -90 || lat > 90) { 515 + this.errorMessage = `Coordinates ${i + 1} has invalid latitude. Must be between -90 and 90.` 516 + return 517 + } 518 + if (isNaN(lon) || lon < -180 || lon > 180) { 519 + this.errorMessage = `Coordinates ${i + 1} has invalid longitude. Must be between -180 and 180.` 520 + return 521 + } 522 + } 523 + } 524 + 525 + // Validate links 526 + const invalidLinks: string[] = [] 527 + for (let i = 0; i < this.formData.links.length; i++) { 528 + const link = this.formData.links[i] 529 + 530 + if (!link.url || link.url.trim() === '') { 531 + invalidLinks.push(`Link ${i + 1} must have a URL or be removed.`) 532 + continue 533 + } 534 + 535 + if (!link.url.startsWith('https://')) { 536 + invalidLinks.push(`Link ${i + 1} must be an HTTPS URL (starting with https://).`) 537 + continue 538 + } 539 + 540 + try { 541 + new URL(link.url) 542 + } catch (e) { 543 + invalidLinks.push(`Link ${i + 1} has an invalid URL format.`) 544 + } 545 + } 546 + 547 + if (invalidLinks.length > 0) { 548 + this.errorMessage = invalidLinks.join(' ') 549 + return 550 + } 551 + 552 + this.submitting = true 553 + 554 + // Clean up locations 555 + this.formData.locations = this.formData.locations.filter((loc) => { 556 + if (loc.type === 'address') { 557 + return loc.country && loc.country.trim() !== '' 558 + } else if (loc.type === 'geo') { 559 + return loc.latitude && loc.longitude 560 + } 561 + return false 562 + }) 563 + 564 + // Clean up links 565 + this.formData.links = this.formData.links.filter((link) => link.url) 566 + 567 + // Ensure empty string end dates are converted to null 568 + if (this.formData.endsAt === '') { 569 + this.formData.endsAt = null 570 + } 571 + 572 + try { 573 + const response = await fetch(this.submitUrl, { 574 + method: 'POST', 575 + headers: { 576 + 'Content-Type': 'application/json', 577 + }, 578 + body: JSON.stringify(this.formData), 579 + }) 580 + 581 + const data = await response.json() 582 + 583 + if (response.ok) { 584 + this.submitted = true 585 + this.eventUrl = data.url 586 + } else { 587 + this.errorMessage = 588 + data.error || 589 + 'Failed to ' + (this.isEditMode ? 'update' : 'create') + ' event. Please try again.' 590 + } 591 + } catch (error) { 592 + console.error('Submit error:', error) 593 + this.errorMessage = 'Network error. Please check your connection and try again.' 594 + } finally { 595 + this.submitting = false 596 + } 597 + }, 598 + 599 + resetForm(): void { 600 + this.formData = { 601 + name: '', 602 + description: '', 603 + status: 'scheduled', 604 + mode: 'inperson', 605 + tz: this.formData.tz, 606 + startsAt: null, 607 + endsAt: null, 608 + locations: [], 609 + links: [], 610 + headerCid: null, 611 + headerAlt: null, 612 + headerSize: null, 613 + thumbnailCid: null, 614 + thumbnailAlt: null, 615 + requireConfirmedEmail: false, 616 + sendNotifications: false, 617 + } 618 + this.startDateTimeLocal = '' 619 + this.endDateTimeLocal = '' 620 + this.submitted = false 621 + this.eventUrl = null 622 + this.errorMessage = null 623 + }, 624 + } 625 + }
+103
src-js/src/features/events/quick-create.ts
··· 1 + /** 2 + * Quick Event Form Feature 3 + * 4 + * Handles the quick event creation form on the homepage. 5 + * Supports both authenticated (direct API) and unauthenticated (localStorage) flows. 6 + */ 7 + 8 + const STORAGE_KEY = 'smokesignal_quick_event' 9 + 10 + export function initQuickEventForm(): void { 11 + const form = document.getElementById('quick-event-form') as HTMLFormElement | null 12 + if (!form) return 13 + 14 + // Check authentication status from data attribute 15 + const isAuthenticated = form.dataset.authenticated === 'true' 16 + 17 + form.addEventListener('submit', (e) => { 18 + e.preventDefault() 19 + 20 + const titleInput = document.getElementById('home-quick-event-title') as HTMLInputElement | null 21 + const descriptionInput = document.getElementById( 22 + 'home-quick-event-description' 23 + ) as HTMLTextAreaElement | null 24 + const startsInput = document.getElementById( 25 + 'home-quick-event-starts' 26 + ) as HTMLInputElement | null 27 + 28 + if (!titleInput || !descriptionInput || !startsInput) return 29 + 30 + if (isAuthenticated) { 31 + // Get the datetime-local value and convert to UTC 32 + const localDateTime = startsInput.value 33 + if (!localDateTime) { 34 + alert('Please select a start time') 35 + return 36 + } 37 + 38 + // Convert datetime-local to UTC ISO string 39 + const localDate = new Date(localDateTime) 40 + const utcISOString = localDate.toISOString() 41 + 42 + // Create JSON payload for the API 43 + const eventData = { 44 + name: titleInput.value, 45 + description: descriptionInput.value, 46 + starts_at: utcISOString, 47 + status: 'scheduled', 48 + mode: 'inperson', 49 + locations: [], 50 + links: [], 51 + require_confirmed_email: false, 52 + send_notifications: true, 53 + } 54 + 55 + // Disable submit button 56 + const submitButton = form.querySelector('button[type="submit"]') as HTMLButtonElement | null 57 + if (submitButton) { 58 + submitButton.disabled = true 59 + submitButton.innerHTML = 60 + '<span class="icon"><i class="fas fa-spinner fa-pulse"></i></span><span>Creating...</span>' 61 + } 62 + 63 + fetch('/event', { 64 + method: 'POST', 65 + headers: { 66 + 'Content-Type': 'application/json', 67 + }, 68 + body: JSON.stringify(eventData), 69 + }) 70 + .then(async (response) => { 71 + const data = await response.json() 72 + if (response.ok && data.url) { 73 + // Redirect to the created event 74 + window.location.href = data.url 75 + } else { 76 + // Show error 77 + alert(data.error || 'Failed to create event. Please try again.') 78 + if (submitButton) { 79 + submitButton.disabled = false 80 + submitButton.innerHTML = '<strong>Create Event</strong>' 81 + } 82 + } 83 + }) 84 + .catch((error) => { 85 + console.error('Error creating event:', error) 86 + alert('Failed to create event. Please try again.') 87 + if (submitButton) { 88 + submitButton.disabled = false 89 + submitButton.innerHTML = '<strong>Create Event</strong>' 90 + } 91 + }) 92 + } else { 93 + // User is not authenticated, save to localStorage and redirect 94 + const data = { 95 + name: titleInput.value, 96 + description: descriptionInput.value, 97 + starts_at: startsInput.value, 98 + } 99 + localStorage.setItem(STORAGE_KEY, JSON.stringify(data)) 100 + window.location.href = '/quick-event' 101 + } 102 + }) 103 + }
+305
src-js/src/features/lfg/form.ts
··· 1 + /** 2 + * LFG Form Alpine.js Component 3 + * 4 + * Looking For Group form with map location selection. 5 + * This is an Alpine.js component factory that returns the component definition. 6 + */ 7 + 8 + import type * as h3Lib from 'h3-js' 9 + import type * as L from 'leaflet' 10 + 11 + // H3 resolution 7 gives ~5 km² area (roughly 1.2km edge) 12 + const H3_RESOLUTION = 7 13 + 14 + // Module-level cache for lazy-loaded libraries 15 + let leafletModule: typeof L | null = null 16 + let h3Module: typeof h3Lib | null = null 17 + 18 + /** 19 + * Lazy load Leaflet and H3 libraries 20 + */ 21 + async function loadMapLibraries(): Promise<{ L: typeof L; h3: typeof h3Lib }> { 22 + if (!leafletModule || !h3Module) { 23 + const [leaflet, h3] = await Promise.all([import('leaflet'), import('h3-js')]) 24 + 25 + // Import Leaflet CSS 26 + await import('leaflet/dist/leaflet.css') 27 + 28 + leafletModule = leaflet.default as unknown as typeof L 29 + h3Module = h3 30 + } 31 + 32 + return { L: leafletModule, h3: h3Module } 33 + } 34 + 35 + interface LfgFormState { 36 + latitude: string 37 + longitude: string 38 + h3Index: string 39 + tags: string[] 40 + tagInput: string 41 + durationHours: string 42 + map: L.Map | null 43 + hexLayer: L.Polygon | null 44 + submitting: boolean 45 + errors: { 46 + location: string | null 47 + tags: string | null 48 + duration: string | null 49 + general: string | null 50 + } 51 + // Methods 52 + init(): void 53 + initMap(): Promise<void> 54 + handleMapClick(lat: number, lon: number): void 55 + selectLocation(h3Index: string): void 56 + clearLocation(): void 57 + addTag(): void 58 + addTagFromSuggestion(tag: string): void 59 + removeTag(index: number): void 60 + canSubmit(): boolean 61 + clearErrors(): void 62 + submitForm(): Promise<void> 63 + } 64 + 65 + type AlpineThis = LfgFormState & { 66 + $el: HTMLElement 67 + $nextTick: (fn: () => void) => void 68 + } 69 + 70 + /** 71 + * LFG form Alpine.js component factory 72 + * 73 + * This function is called by Alpine.js to create the component. 74 + */ 75 + export function lfgForm(): LfgFormState { 76 + return { 77 + latitude: '', 78 + longitude: '', 79 + h3Index: '', 80 + tags: [], 81 + tagInput: '', 82 + durationHours: '48', 83 + map: null, 84 + hexLayer: null, 85 + submitting: false, 86 + errors: { 87 + location: null, 88 + tags: null, 89 + duration: null, 90 + general: null, 91 + }, 92 + 93 + init(this: AlpineThis) { 94 + // Read default duration from data attribute 95 + const el = this.$el 96 + if (el.dataset.defaultDuration) { 97 + this.durationHours = el.dataset.defaultDuration 98 + } 99 + 100 + this.$nextTick(() => { 101 + this.initMap() 102 + }) 103 + }, 104 + 105 + async initMap(this: LfgFormState): Promise<void> { 106 + try { 107 + const { L } = await loadMapLibraries() 108 + 109 + // Initialize map centered on default location 110 + const defaultLat = 40.7128 111 + const defaultLon = -74.006 112 + 113 + this.map = L.map('lfg-map').setView([defaultLat, defaultLon], 12) 114 + 115 + L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { 116 + attribution: '&copy; OpenStreetMap contributors', 117 + }).addTo(this.map) 118 + 119 + // Handle map clicks 120 + this.map.on('click', (e: L.LeafletMouseEvent) => { 121 + this.handleMapClick(e.latlng.lat, e.latlng.lng) 122 + }) 123 + 124 + // Try to get user's location 125 + if (navigator.geolocation) { 126 + navigator.geolocation.getCurrentPosition( 127 + (position) => { 128 + const lat = position.coords.latitude 129 + const lon = position.coords.longitude 130 + this.map?.setView([lat, lon], 12) 131 + }, 132 + () => { 133 + // Geolocation denied or failed, use default 134 + } 135 + ) 136 + } 137 + } catch (err) { 138 + console.error('Failed to load map libraries:', err) 139 + } 140 + }, 141 + 142 + handleMapClick(this: LfgFormState, lat: number, lon: number): void { 143 + if (!h3Module) { 144 + console.warn('H3 not loaded') 145 + return 146 + } 147 + 148 + // Get H3 cell at resolution 149 + const clickedH3Index = h3Module.latLngToCell(lat, lon, H3_RESOLUTION) 150 + 151 + // Check if clicking on already selected cell - toggle off 152 + if (this.h3Index === clickedH3Index) { 153 + this.clearLocation() 154 + return 155 + } 156 + 157 + // Select new location 158 + this.selectLocation(clickedH3Index) 159 + this.errors.location = null 160 + }, 161 + 162 + selectLocation(this: LfgFormState, h3Index: string): void { 163 + if (!this.map || !leafletModule || !h3Module) return 164 + 165 + // Remove existing hex layer 166 + if (this.hexLayer) { 167 + this.map.removeLayer(this.hexLayer) 168 + } 169 + 170 + this.h3Index = h3Index 171 + 172 + // Get boundary for drawing - h3.cellToBoundary returns [lat, lng] pairs 173 + const boundary = h3Module.cellToBoundary(h3Index) 174 + const latLngs: [number, number][] = boundary.map((coord: [number, number]) => [ 175 + coord[0], 176 + coord[1], 177 + ]) 178 + 179 + // Draw the hex with tooltip 180 + this.hexLayer = leafletModule 181 + .polygon(latLngs, { 182 + color: '#00d1b2', 183 + fillColor: '#00d1b2', 184 + fillOpacity: 0.3, 185 + weight: 3, 186 + }) 187 + .addTo(this.map) 188 + 189 + // Add tooltip to indicate it can be clicked to unselect 190 + this.hexLayer.bindTooltip('Click to unselect', { 191 + permanent: false, 192 + direction: 'center', 193 + }) 194 + 195 + // Handle click on the polygon to unselect 196 + this.hexLayer.on('click', () => { 197 + this.clearLocation() 198 + }) 199 + 200 + // Get center coordinates for the API 201 + const center = h3Module.cellToLatLng(h3Index) 202 + this.latitude = center[0].toString() 203 + this.longitude = center[1].toString() 204 + }, 205 + 206 + clearLocation(this: LfgFormState): void { 207 + if (this.hexLayer && this.map) { 208 + this.map.removeLayer(this.hexLayer) 209 + this.hexLayer = null 210 + } 211 + this.h3Index = '' 212 + this.latitude = '' 213 + this.longitude = '' 214 + }, 215 + 216 + addTag(this: LfgFormState): void { 217 + const tag = this.tagInput.trim().replace(/[^a-zA-Z0-9-]/g, '') 218 + // Check for duplicates case-insensitively 219 + const tagLower = tag.toLowerCase() 220 + const isDuplicate = this.tags.some((t) => t.toLowerCase() === tagLower) 221 + if (tag && !isDuplicate && this.tags.length < 10) { 222 + this.tags.push(tag) 223 + this.errors.tags = null 224 + } 225 + this.tagInput = '' 226 + }, 227 + 228 + addTagFromSuggestion(this: LfgFormState, tag: string): void { 229 + // Check for duplicates case-insensitively 230 + const tagLower = tag.toLowerCase() 231 + const isDuplicate = this.tags.some((t) => t.toLowerCase() === tagLower) 232 + if (!isDuplicate && this.tags.length < 10) { 233 + this.tags.push(tag) 234 + this.errors.tags = null 235 + } 236 + }, 237 + 238 + removeTag(this: LfgFormState, index: number): void { 239 + this.tags.splice(index, 1) 240 + }, 241 + 242 + canSubmit(this: LfgFormState): boolean { 243 + return !!this.h3Index && this.tags.length >= 1 244 + }, 245 + 246 + clearErrors(this: LfgFormState): void { 247 + this.errors = { 248 + location: null, 249 + tags: null, 250 + duration: null, 251 + general: null, 252 + } 253 + }, 254 + 255 + async submitForm(this: LfgFormState): Promise<void> { 256 + if (!this.canSubmit() || this.submitting) return 257 + 258 + this.clearErrors() 259 + this.submitting = true 260 + 261 + const payload = { 262 + latitude: parseFloat(this.latitude), 263 + longitude: parseFloat(this.longitude), 264 + tags: this.tags, 265 + duration_hours: parseInt(this.durationHours, 10), 266 + } 267 + 268 + try { 269 + const response = await fetch('/lfg', { 270 + method: 'POST', 271 + headers: { 272 + 'Content-Type': 'application/json', 273 + }, 274 + body: JSON.stringify(payload), 275 + }) 276 + 277 + if (response.ok) { 278 + // Success - redirect to LFG page which will show matches view 279 + window.location.href = '/lfg' 280 + } else { 281 + const data = (await response.json()) as { error?: string; message?: string } 282 + if (data.error) { 283 + // Map error codes to fields 284 + if (data.error.includes('location') || data.error.includes('coordinate')) { 285 + this.errors.location = data.message || 'Invalid location' 286 + } else if (data.error.includes('tag')) { 287 + this.errors.tags = data.message || 'Invalid tags' 288 + } else if (data.error.includes('duration')) { 289 + this.errors.duration = data.message || 'Invalid duration' 290 + } else { 291 + this.errors.general = data.message || 'An error occurred' 292 + } 293 + } else { 294 + this.errors.general = 'An error occurred. Please try again.' 295 + } 296 + } 297 + } catch (err) { 298 + console.error('LFG submission error:', err) 299 + this.errors.general = 'Network error. Please check your connection and try again.' 300 + } finally { 301 + this.submitting = false 302 + } 303 + }, 304 + } 305 + }
+117
src-js/src/features/lfg/heatmap.ts
··· 1 + /** 2 + * LFG Heatmap Feature 3 + * 4 + * Renders the LFG activity heatmap showing event and people distribution. 5 + * Uses Leaflet for map rendering and H3 for hexagon visualization. 6 + */ 7 + 8 + interface HeatmapBucket { 9 + key: string 10 + count: number 11 + } 12 + 13 + export async function initLfgHeatmap(): Promise<void> { 14 + const mapContainer = document.getElementById('lfg-heatmap') 15 + if (!mapContainer) return 16 + 17 + // Skip if already initialized or currently initializing 18 + if ( 19 + mapContainer.dataset.mapInitialized === 'true' || 20 + mapContainer.dataset.mapInitializing === 'true' 21 + ) 22 + return 23 + mapContainer.dataset.mapInitializing = 'true' 24 + 25 + try { 26 + // Parse data from data attributes 27 + const centerLat = parseFloat(mapContainer.dataset.lat ?? '40.7128') 28 + const centerLon = parseFloat(mapContainer.dataset.lon ?? '-74.006') 29 + const eventBucketsData = mapContainer.dataset.eventBuckets 30 + const profileBucketsData = mapContainer.dataset.profileBuckets 31 + 32 + // Lazy load Leaflet and H3 33 + const [L, h3] = await Promise.all([import('leaflet').then((m) => m.default), import('h3-js')]) 34 + 35 + // Import Leaflet CSS 36 + await import('leaflet/dist/leaflet.css') 37 + 38 + // Create map 39 + const map = L.map('lfg-heatmap').setView([centerLat, centerLon], 12) 40 + 41 + L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { 42 + attribution: '&copy; OpenStreetMap contributors', 43 + }).addTo(map) 44 + 45 + // Parse bucket data 46 + let eventBuckets: HeatmapBucket[] = [] 47 + let profileBuckets: HeatmapBucket[] = [] 48 + 49 + try { 50 + if (eventBucketsData) { 51 + eventBuckets = JSON.parse(eventBucketsData) 52 + } 53 + if (profileBucketsData) { 54 + profileBuckets = JSON.parse(profileBucketsData) 55 + } 56 + } catch (e) { 57 + console.warn('Failed to parse heatmap buckets:', e) 58 + } 59 + 60 + // Merge buckets by H3 key 61 + const combinedBuckets = new Map<string, { events: number; people: number }>() 62 + 63 + for (const bucket of eventBuckets) { 64 + const existing = combinedBuckets.get(bucket.key) || { events: 0, people: 0 } 65 + existing.events = bucket.count 66 + combinedBuckets.set(bucket.key, existing) 67 + } 68 + 69 + for (const bucket of profileBuckets) { 70 + const existing = combinedBuckets.get(bucket.key) || { events: 0, people: 0 } 71 + existing.people = bucket.count 72 + combinedBuckets.set(bucket.key, existing) 73 + } 74 + 75 + // Calculate max combined count for intensity scaling 76 + let maxCount = 0 77 + combinedBuckets.forEach((value) => { 78 + const total = value.events + value.people 79 + if (total > maxCount) maxCount = total 80 + }) 81 + 82 + // Draw combined heatmap hexes 83 + combinedBuckets.forEach((value, key) => { 84 + try { 85 + const boundary = h3.cellToBoundary(key) 86 + const latLngs: [number, number][] = boundary.map((coord) => [coord[0], coord[1]]) 87 + const total = value.events + value.people 88 + const intensity = Math.min(total / Math.max(maxCount, 1), 1) 89 + const opacity = 0.2 + intensity * 0.5 90 + 91 + // Build tooltip text 92 + const parts: string[] = [] 93 + if (value.events > 0) parts.push(`${value.events} event${value.events !== 1 ? 's' : ''}`) 94 + if (value.people > 0) 95 + parts.push(`${value.people} ${value.people !== 1 ? 'people' : 'person'}`) 96 + const tooltipText = parts.join(', ') 97 + 98 + L.polygon(latLngs, { 99 + color: '#3273dc', 100 + fillColor: '#3273dc', 101 + fillOpacity: opacity, 102 + weight: 1, 103 + }) 104 + .addTo(map) 105 + .bindTooltip(tooltipText, { direction: 'center' }) 106 + } catch (e) { 107 + console.warn('Invalid H3 cell:', key) 108 + } 109 + }) 110 + 111 + mapContainer.dataset.mapInitialized = 'true' 112 + } catch (err) { 113 + console.error('Failed to initialize LFG heatmap:', err) 114 + } finally { 115 + mapContainer.dataset.mapInitializing = 'false' 116 + } 117 + }
+127
src-js/src/features/maps/event-map.ts
··· 1 + /** 2 + * Event Map Feature 3 + * 4 + * Renders an event location map with H3 hexagons. 5 + * Used on the event view page. 6 + */ 7 + 8 + import type { GeoLocation } from '../../types' 9 + 10 + const H3_RESOLUTION = 9 11 + 12 + export async function initEventMap(): Promise<void> { 13 + const container = document.getElementById('event-map') 14 + if (!container) return 15 + 16 + // Skip if already initialized or currently initializing 17 + if (container.dataset.mapInitialized === 'true' || container.dataset.mapInitializing === 'true') 18 + return 19 + 20 + // Mark as initializing immediately to prevent race conditions 21 + container.dataset.mapInitializing = 'true' 22 + 23 + try { 24 + // Parse geo locations from data attribute 25 + const geoLocationsData = container.dataset.geoLocations 26 + if (!geoLocationsData) { 27 + container.dataset.mapInitializing = 'false' 28 + return 29 + } 30 + 31 + let geoLocations: GeoLocation[] 32 + try { 33 + geoLocations = JSON.parse(geoLocationsData) 34 + } catch (e) { 35 + console.error('Failed to parse geo locations:', e) 36 + container.dataset.mapInitializing = 'false' 37 + return 38 + } 39 + 40 + // Parse and filter locations - coordinates may be strings from backend 41 + const parsedLocations = geoLocations 42 + .filter((loc) => loc != null) 43 + .map((loc) => ({ 44 + latitude: typeof loc.latitude === 'string' ? parseFloat(loc.latitude) : loc.latitude, 45 + longitude: typeof loc.longitude === 'string' ? parseFloat(loc.longitude) : loc.longitude, 46 + name: loc.name, 47 + })) 48 + .filter((loc) => Number.isFinite(loc.latitude) && Number.isFinite(loc.longitude)) 49 + 50 + if (parsedLocations.length === 0) { 51 + container.dataset.mapInitializing = 'false' 52 + return 53 + } 54 + 55 + // Lazy load Leaflet and H3 56 + const [L, h3] = await Promise.all([import('leaflet').then((m) => m.default), import('h3-js')]) 57 + 58 + // Import Leaflet CSS 59 + await import('leaflet/dist/leaflet.css') 60 + 61 + // Double-check we haven't been initialized while loading 62 + if (container.dataset.mapInitialized === 'true') { 63 + container.dataset.mapInitializing = 'false' 64 + return 65 + } 66 + 67 + // Calculate center of all locations for initial map view 68 + const avgLat = 69 + parsedLocations.reduce((sum, loc) => sum + loc.latitude, 0) / parsedLocations.length 70 + const avgLng = 71 + parsedLocations.reduce((sum, loc) => sum + loc.longitude, 0) / parsedLocations.length 72 + 73 + // Final validation before creating map 74 + if (!Number.isFinite(avgLat) || !Number.isFinite(avgLng)) { 75 + container.dataset.mapInitializing = 'false' 76 + return 77 + } 78 + 79 + // Initialize map 80 + const map = L.map('event-map', { 81 + zoomControl: true, 82 + scrollWheelZoom: false, 83 + dragging: true, 84 + }).setView([avgLat, avgLng], 16) 85 + 86 + // Add OpenStreetMap tiles 87 + L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { 88 + attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>', 89 + maxZoom: 19, 90 + }).addTo(map) 91 + 92 + // Collect all boundaries for fitting map bounds 93 + const allBounds: [number, number][] = [] 94 + 95 + // Draw H3 hexagon for each geo location 96 + parsedLocations.forEach((loc) => { 97 + const h3Index = h3.latLngToCell(loc.latitude, loc.longitude, H3_RESOLUTION) 98 + const boundary = h3.cellToBoundary(h3Index) 99 + const latLngs: [number, number][] = boundary.map((coord) => [coord[0], coord[1]]) 100 + 101 + // Add to bounds 102 + latLngs.forEach((coord) => allBounds.push(coord)) 103 + 104 + // Draw H3 hexagon 105 + L.polygon(latLngs, { 106 + color: '#3273dc', 107 + fillColor: '#3273dc', 108 + fillOpacity: 0.2, 109 + weight: 2, 110 + className: 'h3-hex', 111 + }).addTo(map) 112 + }) 113 + 114 + // Fit map to show all hexagons if there are multiple locations 115 + if (allBounds.length > 0) { 116 + const bounds = L.latLngBounds(allBounds) 117 + map.fitBounds(bounds, { padding: [20, 20] }) 118 + } 119 + 120 + // Mark as successfully initialized 121 + container.dataset.mapInitialized = 'true' 122 + } catch (e) { 123 + console.error('Failed to initialize event map:', e) 124 + } finally { 125 + container.dataset.mapInitializing = 'false' 126 + } 127 + }
+296
src-js/src/features/maps/globe-map.ts
··· 1 + /** 2 + * Globe Map Feature 3 + * 4 + * Renders the interactive globe map on the homepage showing global activity. 5 + * Uses MapLibre GL for 3D globe rendering and H3 for hexagon visualization. 6 + */ 7 + 8 + import type { Feature, Polygon } from 'geojson' 9 + import type { 10 + GeoJSONSource, 11 + Map as MaplibreMap, 12 + Popup as MaplibrePopup, 13 + MapMouseEvent, 14 + } from 'maplibre-gl' 15 + import type { H3Bucket } from '../../types' 16 + 17 + interface GlobeMapOptions { 18 + containerId: string 19 + statusElementId: string 20 + } 21 + 22 + export async function initGlobeMap(options?: GlobeMapOptions): Promise<void> { 23 + const containerId = options?.containerId ?? 'globe-map' 24 + const statusElementId = options?.statusElementId ?? 'globe-status' 25 + 26 + const mapContainer = document.getElementById(containerId) 27 + const statusEl = document.getElementById(statusElementId) 28 + if (!mapContainer) return 29 + 30 + // Skip if already initialized or currently initializing 31 + if ( 32 + mapContainer.dataset.mapInitialized === 'true' || 33 + mapContainer.dataset.mapInitializing === 'true' 34 + ) 35 + return 36 + mapContainer.dataset.mapInitializing = 'true' 37 + 38 + try { 39 + // Lazy load MapLibre GL and H3 40 + const [maplibregl, h3] = await Promise.all([import('maplibre-gl'), import('h3-js')]) 41 + 42 + // Import MapLibre GL CSS 43 + await import('maplibre-gl/dist/maplibre-gl.css') 44 + 45 + let map: MaplibreMap | null = null 46 + let popup: MaplibrePopup | null = null 47 + 48 + // Convert value to HSL color (blue to yellow gradient) 49 + function valueToColor(value: number, maxValue: number): string { 50 + if (maxValue === 0) return 'hsl(240, 70%, 50%)' 51 + const ratio = value / maxValue 52 + const hue = 240 - ratio * 180 // 240 (blue) to 60 (yellow) 53 + return `hsl(${hue}, 70%, 50%)` 54 + } 55 + 56 + // Convert H3 cell to GeoJSON Feature 57 + function h3ToGeoJsonFeature(bucket: H3Bucket, maxTotal: number): Feature<Polygon> { 58 + const boundary = h3.cellToBoundary(bucket.key) 59 + const center = h3.cellToLatLng(bucket.key) 60 + 61 + // Convert H3 [lat, lng] to GeoJSON [lng, lat] 62 + const coordinates: [number, number][] = boundary.map(([lat, lng]) => [lng, lat]) 63 + coordinates.push(coordinates[0]) // Close the ring 64 + 65 + return { 66 + type: 'Feature', 67 + properties: { 68 + id: bucket.key, 69 + event_count: bucket.event_count ?? 0, 70 + lfg_count: bucket.lfg_count ?? 0, 71 + total: bucket.total ?? 0, 72 + centerLat: center[0], 73 + centerLng: center[1], 74 + color: valueToColor(bucket.total ?? 0, maxTotal), 75 + }, 76 + geometry: { 77 + type: 'Polygon', 78 + coordinates: [coordinates], 79 + }, 80 + } 81 + } 82 + 83 + function initGlobe(): void { 84 + map = new maplibregl.Map({ 85 + container: containerId, 86 + style: { 87 + version: 8, 88 + projection: { type: 'globe' }, 89 + sources: { 90 + 'carto-voyager': { 91 + type: 'raster', 92 + tiles: [ 93 + 'https://a.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png', 94 + 'https://b.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png', 95 + 'https://c.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png', 96 + ], 97 + tileSize: 256, 98 + attribution: '&copy; <a href="https://carto.com/attributions">CARTO</a>', 99 + }, 100 + }, 101 + layers: [ 102 + { 103 + id: 'background', 104 + type: 'background', 105 + paint: { 106 + 'background-color': '#e8e8e8', 107 + }, 108 + }, 109 + { 110 + id: 'carto-voyager', 111 + type: 'raster', 112 + source: 'carto-voyager', 113 + }, 114 + ], 115 + }, 116 + center: [-100, 40], 117 + zoom: 4, 118 + maxZoom: 8, 119 + minZoom: 1, 120 + }) 121 + 122 + map.on('load', () => { 123 + if (!map) return 124 + 125 + // Add empty source for hex data 126 + map.addSource('hexagons', { 127 + type: 'geojson', 128 + data: { type: 'FeatureCollection', features: [] }, 129 + }) 130 + 131 + // Add flat fill layer for hexagons 132 + map.addLayer({ 133 + id: 'hexagons-fill', 134 + type: 'fill', 135 + source: 'hexagons', 136 + paint: { 137 + 'fill-color': ['get', 'color'], 138 + 'fill-opacity': 0.4, 139 + }, 140 + }) 141 + 142 + // Add outline layer 143 + map.addLayer({ 144 + id: 'hexagons-outline', 145 + type: 'line', 146 + source: 'hexagons', 147 + paint: { 148 + 'line-color': '#333', 149 + 'line-width': 0.5, 150 + 'line-opacity': 0.4, 151 + }, 152 + }) 153 + 154 + // Initialize popup 155 + popup = new maplibregl.Popup({ 156 + closeButton: true, 157 + closeOnClick: false, 158 + }) 159 + 160 + // Click handler for hexagons 161 + map.on('click', 'hexagons-fill', (e: MapMouseEvent & { features?: Feature[] }) => { 162 + const features = e.features 163 + if (features && features.length > 0) { 164 + const props = features[0].properties as Record<string, unknown> 165 + 166 + let content = `<strong>Activity:</strong> ${props.total} total<br/>` 167 + if ((props.event_count as number) > 0) { 168 + content += `${props.event_count} event${props.event_count === 1 ? '' : 's'}<br/>` 169 + } 170 + if ((props.lfg_count as number) > 0) { 171 + content += `${props.lfg_count} ${props.lfg_count === 1 ? 'person' : 'people'} LFG` 172 + } 173 + 174 + popup 175 + ?.setLngLat([props.centerLng as number, props.centerLat as number]) 176 + .setHTML(content) 177 + .addTo(map!) 178 + } 179 + }) 180 + 181 + // Cursor style 182 + map.on('mouseenter', 'hexagons-fill', () => { 183 + map!.getCanvas().style.cursor = 'pointer' 184 + }) 185 + map.on('mouseleave', 'hexagons-fill', () => { 186 + map!.getCanvas().style.cursor = '' 187 + }) 188 + 189 + // Fetch globe aggregation data 190 + loadGlobeData() 191 + }) 192 + 193 + // Focus button handlers 194 + setupFocusButtons() 195 + } 196 + 197 + function setupFocusButtons(): void { 198 + document.getElementById('focus-north-america')?.addEventListener('click', () => { 199 + map?.flyTo({ center: [-100, 40], zoom: 4, duration: 1500 }) 200 + }) 201 + 202 + document.getElementById('focus-europe')?.addEventListener('click', () => { 203 + map?.flyTo({ center: [10, 50], zoom: 4, duration: 1500 }) 204 + }) 205 + 206 + document.getElementById('focus-world')?.addEventListener('click', () => { 207 + map?.flyTo({ center: [0, 20], zoom: 2, duration: 1500 }) 208 + }) 209 + 210 + document.getElementById('focus-my-location')?.addEventListener('click', () => { 211 + const btn = document.getElementById('focus-my-location') as HTMLButtonElement | null 212 + if (!btn) return 213 + 214 + const originalHtml = btn.innerHTML 215 + btn.innerHTML = 216 + '<span class="icon is-small"><i class="fas fa-spinner fa-pulse"></i></span><span>Locating...</span>' 217 + btn.disabled = true 218 + 219 + if (navigator.geolocation) { 220 + navigator.geolocation.getCurrentPosition( 221 + (position) => { 222 + map?.flyTo({ 223 + center: [position.coords.longitude, position.coords.latitude], 224 + zoom: 8, 225 + duration: 1500, 226 + }) 227 + btn.innerHTML = originalHtml 228 + btn.disabled = false 229 + }, 230 + (error) => { 231 + console.warn('Geolocation failed:', error.message) 232 + if (statusEl) statusEl.textContent = 'Could not get your location.' 233 + btn.innerHTML = originalHtml 234 + btn.disabled = false 235 + }, 236 + { timeout: 10000, maximumAge: 300000 } 237 + ) 238 + } else { 239 + if (statusEl) statusEl.textContent = 'Geolocation not supported.' 240 + btn.innerHTML = originalHtml 241 + btn.disabled = false 242 + } 243 + }) 244 + } 245 + 246 + function loadGlobeData(): void { 247 + fetch('/api/globe-aggregation?resolution=5') 248 + .then((response) => response.json()) 249 + .then((data: { buckets?: H3Bucket[] }) => { 250 + if (!data.buckets || data.buckets.length === 0) { 251 + if (statusEl) statusEl.textContent = 'No activity found.' 252 + return 253 + } 254 + 255 + // Find max total for color scaling 256 + const maxTotal = Math.max(...data.buckets.map((b) => b.total ?? 0)) 257 + 258 + // Convert buckets to GeoJSON features 259 + const features: Feature<Polygon>[] = [] 260 + data.buckets.forEach((bucket) => { 261 + try { 262 + features.push(h3ToGeoJsonFeature(bucket, maxTotal)) 263 + } catch (e) { 264 + console.warn('Failed to process hex:', bucket.key, e) 265 + } 266 + }) 267 + 268 + // Update map source 269 + const source = map?.getSource('hexagons') as GeoJSONSource | undefined 270 + source?.setData({ 271 + type: 'FeatureCollection', 272 + features: features, 273 + }) 274 + 275 + const totalEvents = data.buckets.reduce((sum, b) => sum + (b.event_count ?? 0), 0) 276 + const totalLfg = data.buckets.reduce((sum, b) => sum + (b.lfg_count ?? 0), 0) 277 + if (statusEl) { 278 + statusEl.textContent = `${data.buckets.length} active regions: ${totalEvents} events, ${totalLfg} people LFG` 279 + } 280 + }) 281 + .catch((err) => { 282 + console.error('Failed to load globe aggregation:', err) 283 + if (statusEl) statusEl.textContent = 'Failed to load activity data.' 284 + }) 285 + } 286 + 287 + // Initialize the globe 288 + initGlobe() 289 + mapContainer.dataset.mapInitialized = 'true' 290 + } catch (err) { 291 + console.error('Failed to initialize globe map:', err) 292 + if (statusEl) statusEl.textContent = 'Failed to load map.' 293 + } finally { 294 + mapContainer.dataset.mapInitializing = 'false' 295 + } 296 + }
+50
src-js/src/features/maps/index.ts
··· 1 + /** 2 + * Maps Feature - Lazy Loading Entry Point 3 + * 4 + * This module handles lazy loading of map-related libraries (Leaflet, MapLibre GL, H3). 5 + * These libraries are large (~1MB combined) so we only load them when needed. 6 + */ 7 + 8 + /** 9 + * Initialize the event map if its container exists. 10 + */ 11 + export async function initEventMap(): Promise<void> { 12 + const container = document.getElementById('event-map') 13 + if (!container) return 14 + 15 + const { initEventMap: init } = await import('./event-map') 16 + await init() 17 + } 18 + 19 + /** 20 + * Initialize the globe map if its container exists. 21 + */ 22 + export async function initGlobeMap(): Promise<void> { 23 + const container = document.getElementById('globe-map') 24 + if (!container) return 25 + 26 + const { initGlobeMap: init } = await import('./globe-map') 27 + await init() 28 + } 29 + 30 + /** 31 + * Initialize the location heatmap if its container exists. 32 + */ 33 + export async function initLocationHeatmap(): Promise<void> { 34 + const container = document.getElementById('location-heatmap') 35 + if (!container) return 36 + 37 + const { initLocationHeatmap: init } = await import('./location-heatmap') 38 + await init() 39 + } 40 + 41 + /** 42 + * Initialize all maps on the page. 43 + * Call this when map containers exist on the page. 44 + */ 45 + export function initMaps(): void { 46 + // These functions check for their container elements internally 47 + initEventMap() 48 + initGlobeMap() 49 + initLocationHeatmap() 50 + }
+149
src-js/src/features/maps/location-heatmap.ts
··· 1 + /** 2 + * Location Heatmap Feature 3 + * 4 + * Renders the location heatmap on the location page showing event distribution. 5 + * Uses Leaflet for map rendering and H3 for hexagon visualization. 6 + */ 7 + 8 + import type { H3Bucket } from '../../types' 9 + 10 + export async function initLocationHeatmap(): Promise<void> { 11 + const mapContainer = document.getElementById('location-heatmap') 12 + if (!mapContainer) return 13 + 14 + // Skip if already initialized or currently initializing 15 + if ( 16 + mapContainer.dataset.mapInitialized === 'true' || 17 + mapContainer.dataset.mapInitializing === 'true' 18 + ) 19 + return 20 + mapContainer.dataset.mapInitializing = 'true' 21 + 22 + try { 23 + // Parse data from data attributes 24 + const centerLat = parseFloat(mapContainer.dataset.centerLat ?? '0') 25 + const centerLon = parseFloat(mapContainer.dataset.centerLon ?? '0') 26 + const centerCell = mapContainer.dataset.centerCell ?? '' 27 + const geoBucketsData = mapContainer.dataset.geoBuckets 28 + 29 + if (!geoBucketsData) return 30 + 31 + let geoBuckets: H3Bucket[] 32 + try { 33 + geoBuckets = JSON.parse(geoBucketsData) 34 + } catch (e) { 35 + console.error('Failed to parse geo buckets:', e) 36 + return 37 + } 38 + 39 + // Lazy load Leaflet and H3 40 + const [L, h3] = await Promise.all([import('leaflet').then((m) => m.default), import('h3-js')]) 41 + 42 + // Import Leaflet CSS 43 + await import('leaflet/dist/leaflet.css') 44 + 45 + // Create map centered on the H3 cell 46 + const map = L.map('location-heatmap', { 47 + center: [centerLat, centerLon], 48 + zoom: 9, 49 + zoomControl: false, 50 + dragging: false, 51 + touchZoom: false, 52 + scrollWheelZoom: false, 53 + doubleClickZoom: false, 54 + boxZoom: false, 55 + keyboard: false, 56 + attributionControl: true, 57 + }) 58 + 59 + // Add OpenStreetMap tiles 60 + L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { 61 + attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>', 62 + maxZoom: 19, 63 + }).addTo(map) 64 + 65 + // Heatmap color scale from low (blue) to high (red) 66 + function getHeatmapColor(value: number, min: number, max: number): string { 67 + if (max === min) return '#3273dc' 68 + const ratio = (value - min) / (max - min) 69 + // Blue (#3273dc) -> Purple (#8957e5) -> Orange (#f39c12) -> Red (#e74c3c) 70 + if (ratio < 0.33) { 71 + const t = ratio / 0.33 72 + return lerpColor('#3273dc', '#8957e5', t) 73 + } else if (ratio < 0.66) { 74 + const t = (ratio - 0.33) / 0.33 75 + return lerpColor('#8957e5', '#f39c12', t) 76 + } else { 77 + const t = (ratio - 0.66) / 0.34 78 + return lerpColor('#f39c12', '#e74c3c', t) 79 + } 80 + } 81 + 82 + function lerpColor(a: string, b: string, t: number): string { 83 + const ah = parseInt(a.replace('#', ''), 16) 84 + const bh = parseInt(b.replace('#', ''), 16) 85 + const ar = ah >> 16, 86 + ag = (ah >> 8) & 0xff, 87 + ab = ah & 0xff 88 + const br = bh >> 16, 89 + bg = (bh >> 8) & 0xff, 90 + bb = bh & 0xff 91 + const rr = Math.round(ar + (br - ar) * t) 92 + const rg = Math.round(ag + (bg - ag) * t) 93 + const rb = Math.round(ab + (bb - ab) * t) 94 + return '#' + ((1 << 24) + (rr << 16) + (rg << 8) + rb).toString(16).slice(1) 95 + } 96 + 97 + // Only draw hexes with events 98 + if (geoBuckets && geoBuckets.length > 0) { 99 + const counts = geoBuckets.map((b) => b.doc_count ?? 0) 100 + const minCount = Math.min(...counts) 101 + const maxCount = Math.max(...counts) 102 + 103 + geoBuckets.forEach((bucket) => { 104 + try { 105 + const cellIndex = bucket.key 106 + const count = bucket.doc_count ?? 0 107 + const boundary = h3.cellToBoundary(cellIndex) 108 + const latLngs: [number, number][] = boundary.map((coord) => [coord[0], coord[1]]) 109 + 110 + const isCenter = cellIndex === centerCell 111 + const color = getHeatmapColor(count, minCount, maxCount) 112 + 113 + L.polygon(latLngs, { 114 + color: isCenter ? '#1a1a1a' : color, 115 + fillColor: color, 116 + fillOpacity: 0.5, 117 + weight: isCenter ? 3 : 2, 118 + className: isCenter ? 'h3-hex-center' : 'h3-hex', 119 + }).addTo(map) 120 + } catch (e) { 121 + console.warn('Failed to draw hex:', bucket.key, e) 122 + } 123 + }) 124 + 125 + // Fit bounds to show all hexes 126 + const allCoords: [number, number][] = geoBuckets.flatMap((bucket) => { 127 + try { 128 + return h3 129 + .cellToBoundary(bucket.key) 130 + .map((coord): [number, number] => [coord[0], coord[1]]) 131 + } catch (e) { 132 + return [] 133 + } 134 + }) 135 + if (allCoords.length > 0) { 136 + map.fitBounds(allCoords, { padding: [10, 10] }) 137 + } 138 + } else { 139 + // No events - just show center marker 140 + L.marker([centerLat, centerLon]).addTo(map) 141 + } 142 + 143 + mapContainer.dataset.mapInitialized = 'true' 144 + } catch (err) { 145 + console.error('Failed to initialize location heatmap:', err) 146 + } finally { 147 + mapContainer.dataset.mapInitializing = 'false' 148 + } 149 + }
+221
src-js/src/main.ts
··· 1 + /** 2 + * Main entry point for Smokesignal frontend 3 + * 4 + * This file initializes all core functionality that runs on every page. 5 + * Heavy libraries (maps, cropper) are lazy-loaded only when needed. 6 + * 7 + * The SmokesignalApp global provides methods that can be called multiple times 8 + * safely from both initial page load and htmx-swapped content. 9 + */ 10 + 11 + // Import styles (Vite will bundle into site.css) 12 + import '../styles/main.css' 13 + 14 + // Core libraries - htmx, extensions, and Alpine (loaded on every page) 15 + import './core' 16 + 17 + // Core utilities 18 + import { initNavigation } from './components/navigation' 19 + import { eventForm } from './features/events/create' 20 + import { initQuickEventForm } from './features/events/quick-create' 21 + // Features - Alpine.js components for page-specific functionality 22 + import { lfgForm } from './features/lfg/form' 23 + 24 + /** 25 + * Lazy loading state tracking 26 + * Ensures each library is only loaded once even if init is called multiple times 27 + */ 28 + const loadingState = { 29 + maps: null as Promise<typeof import('./features/maps')> | null, 30 + cropper: null as Promise<typeof import('./features/cropper')> | null, 31 + profileCropper: null as Promise<typeof import('./features/cropper/profile-cropper')> | null, 32 + lfgHeatmap: null as Promise<typeof import('./features/lfg/heatmap')> | null, 33 + } 34 + 35 + /** 36 + * Initialize the event map if the container exists 37 + * Safe to call multiple times - will only initialize once per container 38 + */ 39 + async function initEventMap(): Promise<void> { 40 + if (!document.getElementById('event-map')) return 41 + 42 + if (!loadingState.maps) { 43 + loadingState.maps = import('./features/maps') 44 + } 45 + const { initEventMap } = await loadingState.maps 46 + await initEventMap() 47 + } 48 + 49 + /** 50 + * Initialize the globe map if the container exists 51 + * Safe to call multiple times - will only initialize once per container 52 + */ 53 + async function initGlobeMap(): Promise<void> { 54 + if (!document.getElementById('globe-map')) return 55 + 56 + if (!loadingState.maps) { 57 + loadingState.maps = import('./features/maps') 58 + } 59 + const { initGlobeMap } = await loadingState.maps 60 + await initGlobeMap() 61 + } 62 + 63 + /** 64 + * Initialize the location heatmap if the container exists 65 + * Safe to call multiple times - will only initialize once per container 66 + */ 67 + async function initLocationHeatmap(): Promise<void> { 68 + if (!document.getElementById('location-heatmap')) return 69 + 70 + if (!loadingState.maps) { 71 + loadingState.maps = import('./features/maps') 72 + } 73 + const { initLocationHeatmap } = await loadingState.maps 74 + await initLocationHeatmap() 75 + } 76 + 77 + /** 78 + * Initialize all maps - convenience method for pages with multiple map types 79 + * Safe to call multiple times 80 + */ 81 + async function initMaps(): Promise<void> { 82 + await Promise.all([initEventMap(), initGlobeMap(), initLocationHeatmap()]) 83 + } 84 + 85 + /** 86 + * Initialize the image cropper if canvas containers exist 87 + * Safe to call multiple times - will only initialize once per container 88 + */ 89 + async function initCropper(): Promise<void> { 90 + if (!document.getElementById('headerCanvas') && !document.getElementById('thumbnailCanvas')) { 91 + return 92 + } 93 + 94 + if (!loadingState.cropper) { 95 + loadingState.cropper = import('./features/cropper') 96 + } 97 + const { initCropper } = await loadingState.cropper 98 + await initCropper() 99 + } 100 + 101 + /** 102 + * Initialize the profile image cropper if avatar/banner elements exist 103 + * Safe to call multiple times - will only initialize once 104 + */ 105 + async function initProfileCropper(): Promise<void> { 106 + if (!document.getElementById('avatar-input') && !document.getElementById('banner-input')) { 107 + return 108 + } 109 + 110 + if (!loadingState.profileCropper) { 111 + loadingState.profileCropper = import('./features/cropper/profile-cropper') 112 + } 113 + const { initProfileCropper } = await loadingState.profileCropper 114 + await initProfileCropper() 115 + } 116 + 117 + /** 118 + * Initialize the LFG heatmap if its container exists 119 + * Safe to call multiple times - will only initialize once per container 120 + */ 121 + async function initLfgHeatmap(): Promise<void> { 122 + if (!document.getElementById('lfg-heatmap')) return 123 + 124 + if (!loadingState.lfgHeatmap) { 125 + loadingState.lfgHeatmap = import('./features/lfg/heatmap') 126 + } 127 + const { initLfgHeatmap } = await loadingState.lfgHeatmap 128 + await initLfgHeatmap() 129 + } 130 + 131 + /** 132 + * Initialize all page functionality 133 + * Called on DOMContentLoaded and can be called after htmx swaps 134 + */ 135 + function initPage(): void { 136 + // Components that run on every page 137 + initNavigation() 138 + 139 + // Initialize quick event form (lightweight, no lazy loading needed) 140 + initQuickEventForm() 141 + 142 + // Auto-initialize maps if containers exist 143 + initMaps() 144 + 145 + // Auto-initialize cropper if containers exist 146 + initCropper() 147 + 148 + // Auto-initialize profile cropper if containers exist 149 + initProfileCropper() 150 + 151 + // Auto-initialize LFG heatmap if container exists 152 + initLfgHeatmap() 153 + } 154 + 155 + // Initialize on DOMContentLoaded 156 + if (document.readyState === 'loading') { 157 + document.addEventListener('DOMContentLoaded', initPage) 158 + } else { 159 + initPage() 160 + } 161 + 162 + // Re-initialize after HTMX swaps (for SPA-like navigation) 163 + document.body.addEventListener('htmx:afterSettle', () => { 164 + // Re-check for new containers after HTMX content swap 165 + initMaps() 166 + initCropper() 167 + initProfileCropper() 168 + initLfgHeatmap() 169 + }) 170 + 171 + /** 172 + * SmokesignalApp - Global namespace for template integration 173 + * 174 + * Provides: 175 + * - Alpine.js component factories (lfgForm, eventForm) 176 + * - Lazy-loading initializers (initEventMap, initGlobeMap, etc.) 177 + * 178 + * Usage in templates: 179 + * <div x-data="SmokesignalApp.lfgForm()">...</div> 180 + * <script>SmokesignalApp.initEventMap()</script> 181 + */ 182 + const SmokesignalApp = { 183 + // Alpine.js component factories 184 + lfgForm, 185 + eventForm, 186 + 187 + // Lazy-loading initializers (safe to call multiple times) 188 + initEventMap, 189 + initGlobeMap, 190 + initLocationHeatmap, 191 + initMaps, 192 + initCropper, 193 + initProfileCropper, 194 + initLfgHeatmap, 195 + 196 + // Re-initialize page (useful after major DOM changes) 197 + initPage, 198 + } 199 + 200 + // Expose SmokesignalApp namespace for inline scripts 201 + declare global { 202 + interface Window { 203 + SmokesignalApp: typeof SmokesignalApp 204 + } 205 + } 206 + 207 + window.SmokesignalApp = SmokesignalApp 208 + 209 + // Re-export for ES module consumers 210 + export { 211 + lfgForm, 212 + eventForm, 213 + initEventMap, 214 + initGlobeMap, 215 + initLocationHeatmap, 216 + initMaps, 217 + initCropper, 218 + initProfileCropper, 219 + initLfgHeatmap, 220 + initPage, 221 + }
+79
src-js/src/types.ts
··· 1 + /** 2 + * Shared TypeScript types for Smokesignal frontend 3 + */ 4 + 5 + // Geo location from template (coordinates come as strings from backend) 6 + export interface GeoLocation { 7 + latitude: string | number 8 + longitude: string | number 9 + name?: string | null 10 + } 11 + 12 + // H3 bucket for map aggregation 13 + export interface H3Bucket { 14 + key: string 15 + doc_count?: number 16 + event_count?: number 17 + lfg_count?: number 18 + total?: number 19 + } 20 + 21 + // Location suggestion from API 22 + export interface LocationSuggestion { 23 + source?: string 24 + name?: string 25 + street?: string 26 + locality?: string 27 + region?: string 28 + postal_code?: string 29 + country?: string 30 + latitude?: number 31 + longitude?: number 32 + } 33 + 34 + // Event form location (address type) 35 + export interface AddressLocation { 36 + type: 'address' 37 + country: string 38 + postalCode?: string | null 39 + region?: string | null 40 + locality?: string | null 41 + street?: string | null 42 + name?: string | null 43 + } 44 + 45 + // Event form location (geo type) 46 + export interface GeoFormLocation { 47 + type: 'geo' 48 + latitude: string 49 + longitude: string 50 + name?: string | null 51 + } 52 + 53 + export type FormLocation = AddressLocation | GeoFormLocation 54 + 55 + // Event form link 56 + export interface FormLink { 57 + url: string 58 + label?: string | null 59 + } 60 + 61 + // Event form data 62 + export interface EventFormData { 63 + name: string 64 + description: string 65 + status: string 66 + mode: string 67 + tz: string 68 + startsAt: string | null 69 + endsAt: string | null 70 + locations: FormLocation[] 71 + links: FormLink[] 72 + headerCid?: string | null 73 + headerAlt?: string | null 74 + headerSize?: number | null 75 + thumbnailCid?: string | null 76 + thumbnailAlt?: string | null 77 + requireConfirmedEmail: boolean 78 + sendNotifications: boolean 79 + }
+15
src-js/src/types/alpinejs.d.ts
··· 1 + /** 2 + * Alpine.js type declarations 3 + */ 4 + 5 + declare module 'alpinejs' { 6 + interface Alpine { 7 + start(): void 8 + data(name: string, callback: () => object): void 9 + store(name: string, value?: unknown): unknown 10 + plugin(plugin: (Alpine: Alpine) => void): void 11 + } 12 + 13 + const Alpine: Alpine 14 + export default Alpine 15 + }
+32
src-js/styles/base/utilities.css
··· 1 + /** 2 + * Utility Classes 3 + * 4 + * Generic utility classes that complement Bulma. 5 + */ 6 + 7 + /* Alpine.js cloak - hide until Alpine initializes */ 8 + [x-cloak] { 9 + display: none !important; 10 + } 11 + 12 + /* Smooth transitions for hover effects */ 13 + .transition-all { 14 + transition: all 0.2s ease; 15 + } 16 + 17 + /* Map container base styles */ 18 + .map-container { 19 + z-index: 1; 20 + border-radius: 6px; 21 + overflow: hidden; 22 + } 23 + 24 + /* H3 hexagon base styles */ 25 + .h3-hex { 26 + fill-opacity: var(--smokesignal-map-hex-fill-opacity); 27 + stroke-width: var(--smokesignal-map-hex-stroke-width); 28 + } 29 + 30 + .h3-hex-center { 31 + stroke-width: 3px; 32 + }
+22
src-js/styles/base/variables.css
··· 1 + /** 2 + * CSS Variables 3 + * 4 + * Custom CSS properties that extend Bulma's theming. 5 + * These work with Bulma's dark mode support. 6 + */ 7 + 8 + :root { 9 + /* Map colors */ 10 + --smokesignal-map-hex-color: #3273dc; 11 + --smokesignal-map-hex-fill-opacity: 0.2; 12 + --smokesignal-map-hex-stroke-width: 2px; 13 + 14 + /* LFG colors */ 15 + --smokesignal-lfg-hex-color: #00d1b2; 16 + --smokesignal-lfg-hex-fill-opacity: 0.3; 17 + 18 + /* Heatmap color scale */ 19 + --smokesignal-heatmap-color-low: #3273dc; 20 + --smokesignal-heatmap-color-mid: #8957e5; 21 + --smokesignal-heatmap-color-high: #e74c3c; 22 + }
+8
src-js/styles/components/navigation.css
··· 1 + /** 2 + * Navigation Component Styles 3 + * 4 + * Styles for the navbar and navigation elements. 5 + * Most styling is handled by Bulma's navbar component. 6 + */ 7 + 8 + /* Additional navbar customizations if needed */
+194
src-js/styles/features/event-page.css
··· 1 + /** 2 + * Event Page Styles 3 + * 4 + * Styles for the event view page. 5 + * Uses Bulma CSS 1.0+ utilities and variables for dark mode support. 6 + */ 7 + 8 + /* Header Image - 16:9 Aspect Ratio */ 9 + .event-header-image { 10 + aspect-ratio: 16 / 9; 11 + overflow: hidden; 12 + } 13 + 14 + .event-header-image img { 15 + width: 100%; 16 + height: 100%; 17 + object-fit: cover; 18 + } 19 + 20 + /* Organizer Avatar */ 21 + .organizer-avatar { 22 + width: 80px; 23 + height: 80px; 24 + border-radius: 50%; 25 + object-fit: cover; 26 + flex-shrink: 0; 27 + border: 3px solid hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-border-l)); 28 + } 29 + 30 + /* RSVP Section - Uses Bulma scheme colors */ 31 + .rsvp-section { 32 + background: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-scheme-main-bis-l)); 33 + } 34 + 35 + /* RSVP State Colors - Border-left indicators with proper dark mode support */ 36 + .rsvp-message { 37 + border-left: 4px solid hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-border-l)); 38 + background-color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-background-l)); 39 + } 40 + 41 + .rsvp-message.is-success { 42 + border-left-color: hsl(var(--bulma-success-h), var(--bulma-success-s), var(--bulma-success-l)); 43 + } 44 + 45 + .rsvp-message.is-info { 46 + border-left-color: hsl(var(--bulma-info-h), var(--bulma-info-s), var(--bulma-info-l)); 47 + } 48 + 49 + .rsvp-message.is-warning { 50 + border-left-color: hsl(var(--bulma-warning-h), var(--bulma-warning-s), var(--bulma-warning-l)); 51 + } 52 + 53 + .rsvp-message.is-danger { 54 + border-left-color: hsl(var(--bulma-danger-h), var(--bulma-danger-s), var(--bulma-danger-l)); 55 + } 56 + 57 + .rsvp-message.is-neutral { 58 + border-left-color: hsl(var(--bulma-link-h), var(--bulma-link-s), var(--bulma-link-l)); 59 + } 60 + 61 + /* Location Badge Colors - Using Bulma color system with semantic colors */ 62 + .location-badge.is-virtual { 63 + background: hsl(var(--bulma-info-h), var(--bulma-info-s), var(--bulma-info-90-l)); 64 + color: hsl(var(--bulma-info-h), var(--bulma-info-s), var(--bulma-info-20-l)); 65 + } 66 + 67 + .location-badge.is-in-person { 68 + background: hsl(var(--bulma-warning-h), var(--bulma-warning-s), var(--bulma-warning-90-l)); 69 + color: hsl(var(--bulma-warning-h), var(--bulma-warning-s), var(--bulma-warning-20-l)); 70 + } 71 + 72 + .location-badge.is-hybrid { 73 + background: hsl(var(--bulma-link-h), var(--bulma-link-s), var(--bulma-link-90-l)); 74 + color: hsl(var(--bulma-link-h), var(--bulma-link-s), var(--bulma-link-20-l)); 75 + } 76 + 77 + /* Link Hover Effect - Uses scheme colors for dark mode compatibility */ 78 + .event-link { 79 + transition: all 0.2s; 80 + } 81 + 82 + .event-link:hover { 83 + background: hsl( 84 + var(--bulma-scheme-h), 85 + var(--bulma-scheme-s), 86 + calc(var(--bulma-scheme-main-l) + var(--bulma-hover-background-l-delta)) 87 + ); 88 + border-color: hsl(var(--bulma-link-h), var(--bulma-link-s), var(--bulma-link-l)); 89 + transform: translateX(2px); 90 + } 91 + 92 + /* Address Link Brand Colors - Adjusted for dark mode */ 93 + .address-link .fa-apple { 94 + color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-text-strong-l)); 95 + } 96 + 97 + .address-link .fa-google { 98 + color: #4285f4; /* Google brand color - keep consistent */ 99 + } 100 + 101 + /* Link Icon Background - Uses scheme colors */ 102 + .link-icon-bg { 103 + background: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-scheme-main-l)); 104 + } 105 + 106 + /* Section Divider - Uses Bulma border color */ 107 + .section-divider { 108 + border-color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-border-l)); 109 + } 110 + 111 + /* Address Box Border - Uses link color for emphasis */ 112 + .address-box-border { 113 + border-left-color: hsl(var(--bulma-link-h), var(--bulma-link-s), var(--bulma-link-l)); 114 + } 115 + 116 + /* Address Box - Better contrast for dark mode */ 117 + .address-box { 118 + background: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-scheme-main-bis-l)); 119 + } 120 + 121 + /* Event Details Box - Better contrast for dark mode */ 122 + .event-detail-box { 123 + background: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-background-l)); 124 + border-radius: 6px; 125 + } 126 + 127 + .event-detail-label { 128 + color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-text-weak-l)); 129 + } 130 + 131 + .event-detail-time { 132 + color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-text-l)); 133 + } 134 + 135 + .event-detail-icon { 136 + color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-text-weak-l)); 137 + } 138 + 139 + /* RSVP Message Secondary Text - Adapts to dark mode */ 140 + .rsvp-secondary-text { 141 + color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-text-weak-l)); 142 + opacity: 0.9; 143 + } 144 + 145 + /* Event Header */ 146 + .event-header-flex { 147 + display: flex; 148 + gap: 1.5rem; 149 + align-items: start; 150 + } 151 + 152 + /* Event Map Styles */ 153 + #event-map { 154 + z-index: 1; 155 + border-radius: 6px; 156 + overflow: hidden; 157 + } 158 + 159 + /* Responsive adjustments */ 160 + @media (max-width: 768px) { 161 + .rsvp-controls { 162 + flex-direction: column; 163 + } 164 + 165 + .rsvp-controls .select, 166 + .rsvp-controls .button { 167 + width: 100%; 168 + } 169 + 170 + .organizer-avatar { 171 + width: 60px; 172 + height: 60px; 173 + } 174 + 175 + .event-header-flex { 176 + flex-wrap: wrap; 177 + margin-bottom: 1.5rem; 178 + } 179 + 180 + .event-header-flex > div:last-child { 181 + width: 100%; 182 + flex-direction: column; 183 + margin-top: 1rem; 184 + } 185 + 186 + .event-header-flex .button { 187 + width: 100%; 188 + } 189 + 190 + /* Add spacing after buttons on mobile */ 191 + .event-header-flex + .notification { 192 + margin-top: 1.5rem; 193 + } 194 + }
+58
src-js/styles/features/globe-map.css
··· 1 + /** 2 + * Globe Map Styles 3 + * 4 + * Styles for the interactive globe map on the homepage. 5 + */ 6 + 7 + #globe-map { 8 + height: 400px; 9 + border-radius: 8px; 10 + overflow: hidden; 11 + z-index: 1; 12 + } 13 + 14 + .globe-controls { 15 + display: flex; 16 + gap: 0.5rem; 17 + flex-wrap: wrap; 18 + margin-top: 0.75rem; 19 + } 20 + 21 + .globe-controls .button { 22 + font-size: 0.75rem; 23 + } 24 + 25 + #globe-status { 26 + margin-top: 0.5rem; 27 + font-size: 0.875rem; 28 + color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-text-weak-l)); 29 + } 30 + 31 + /* MapLibre popup styles */ 32 + .maplibregl-popup-content { 33 + background: rgba(22, 33, 62, 0.95); 34 + color: white; 35 + padding: 10px 14px; 36 + border-radius: 6px; 37 + font-size: 13px; 38 + } 39 + 40 + .maplibregl-popup-anchor-bottom .maplibregl-popup-tip { 41 + border-top-color: rgba(22, 33, 62, 0.95); 42 + } 43 + 44 + .maplibregl-popup-close-button { 45 + color: white; 46 + font-size: 16px; 47 + } 48 + 49 + /* Responsive adjustments */ 50 + @media (max-width: 768px) { 51 + #globe-map { 52 + height: 300px; 53 + } 54 + 55 + .globe-controls { 56 + justify-content: center; 57 + } 58 + }
+18
src-js/styles/features/lfg.css
··· 1 + /** 2 + * LFG (Looking For Group) Styles 3 + * 4 + * Styles for the LFG form and matches pages. 5 + */ 6 + 7 + #lfg-map { 8 + height: 300px; 9 + border-radius: 6px; 10 + border: 1px solid #dbdbdb; 11 + } 12 + 13 + /* Dark mode support for LFG map border */ 14 + @media (prefers-color-scheme: dark) { 15 + #lfg-map { 16 + border-color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-border-l)); 17 + } 18 + }
+20
src-js/styles/features/location-heatmap.css
··· 1 + /** 2 + * Location Heatmap Styles 3 + * 4 + * Styles for the location page heatmap showing event distribution. 5 + */ 6 + 7 + #location-heatmap { 8 + height: 250px; 9 + border-radius: 8px; 10 + overflow: hidden; 11 + z-index: 1; 12 + } 13 + 14 + .h3-hex { 15 + stroke-width: 2; 16 + } 17 + 18 + .h3-hex-center { 19 + stroke-width: 2; 20 + }
+19
src-js/styles/main.css
··· 1 + /** 2 + * Smokesignal CSS Entry Point 3 + * 4 + * Bulma CSS and FontAwesome are loaded separately as vendor styles. 5 + * This file imports all custom styles for the application. 6 + */ 7 + 8 + /* Base styles */ 9 + @import "./base/variables.css"; 10 + @import "./base/utilities.css"; 11 + 12 + /* Component styles */ 13 + @import "./components/navigation.css"; 14 + 15 + /* Feature styles */ 16 + @import "./features/event-page.css"; 17 + @import "./features/globe-map.css"; 18 + @import "./features/location-heatmap.css"; 19 + @import "./features/lfg.css";
+23
src-js/tsconfig.json
··· 1 + { 2 + "compilerOptions": { 3 + "target": "ES2022", 4 + "module": "ESNext", 5 + "moduleResolution": "bundler", 6 + "strict": true, 7 + "noEmit": true, 8 + "skipLibCheck": true, 9 + "esModuleInterop": true, 10 + "allowImportingTsExtensions": true, 11 + "resolveJsonModule": true, 12 + "isolatedModules": true, 13 + "lib": ["ES2022", "DOM", "DOM.Iterable"], 14 + "types": ["vite/client", "node"], 15 + "baseUrl": ".", 16 + "paths": { 17 + "@/*": ["src/*"], 18 + "@styles/*": ["styles/*"] 19 + } 20 + }, 21 + "include": ["src/**/*", "vite.config.ts"], 22 + "exclude": ["node_modules"] 23 + }
+72
src-js/vite.config.ts
··· 1 + import { defineConfig } from 'vite' 2 + import { resolve } from 'path' 3 + 4 + export default defineConfig({ 5 + root: '.', 6 + publicDir: false, 7 + base: '/static/', 8 + build: { 9 + outDir: '../static', 10 + emptyOutDir: false, 11 + sourcemap: false, 12 + // Generate manifest.json for Rust backend to resolve hashed filenames 13 + manifest: true, 14 + rollupOptions: { 15 + input: { 16 + main: resolve(__dirname, 'src/main.ts'), 17 + }, 18 + output: { 19 + // All files get content hashes for proper cache invalidation 20 + entryFileNames: 'js/[name]-[hash].js', 21 + chunkFileNames: 'js/[name]-[hash].js', 22 + assetFileNames: (assetInfo) => { 23 + if (assetInfo.name?.endsWith('.css')) { 24 + return 'css/[name]-[hash].css' 25 + } 26 + return 'assets/[name]-[hash][extname]' 27 + }, 28 + // Manual chunk splitting for better caching 29 + // htmx and Alpine are bundled in the main bundle for immediate availability 30 + manualChunks: (id) => { 31 + // Map libraries - lazy loaded together 32 + if ( 33 + id.includes('leaflet') || 34 + id.includes('maplibre-gl') || 35 + id.includes('h3-js') 36 + ) { 37 + return 'maps' 38 + } 39 + // Cropper - lazy loaded separately 40 + if (id.includes('cropperjs')) { 41 + return 'cropper' 42 + } 43 + }, 44 + }, 45 + }, 46 + minify: 'esbuild', 47 + cssMinify: 'lightningcss', 48 + }, 49 + css: { 50 + transformer: 'lightningcss', 51 + lightningcss: { 52 + targets: { 53 + chrome: 110, 54 + firefox: 110, 55 + safari: 16, 56 + }, 57 + drafts: { 58 + customMedia: true, 59 + }, 60 + }, 61 + }, 62 + resolve: { 63 + alias: { 64 + '@': resolve(__dirname, 'src'), 65 + '@styles': resolve(__dirname, 'styles'), 66 + }, 67 + }, 68 + // Ensure dynamic CSS imports work 69 + optimizeDeps: { 70 + include: ['alpinejs'], 71 + }, 72 + })
+12 -4
src/http/auth_utils.rs
··· 46 46 Ok(auth) => auth, 47 47 Err(e) => { 48 48 let error_str = e.to_string(); 49 - if error_str.contains("401") || error_str.contains("Unauthorized") { 50 - tracing::debug!("AIP session exchange returned 401 - session is stale"); 49 + if error_str.contains("401") 50 + || error_str.contains("Unauthorized") 51 + || error_str.contains("invalid_token") 52 + || error_str.contains("expired") 53 + { 54 + tracing::debug!("AIP session exchange returned stale token - session is stale"); 51 55 return Ok(false); 52 56 } 53 57 return Err(e); ··· 74 78 } 75 79 Err(e) => { 76 80 let error_str = e.to_string(); 77 - if error_str.contains("401") || error_str.contains("Unauthorized") { 78 - tracing::debug!("PDS getServiceAuth returned 401 - session is stale"); 81 + if error_str.contains("401") 82 + || error_str.contains("Unauthorized") 83 + || error_str.contains("invalid_token") 84 + || error_str.contains("expired") 85 + { 86 + tracing::debug!("PDS getServiceAuth returned stale token - session is stale"); 79 87 Ok(false) 80 88 } else { 81 89 Err(anyhow::anyhow!(
+11 -4
src/http/errors/web_error.rs
··· 163 163 /// 164 164 /// This error occurs when an AT Protocol operation is attempted with a stale 165 165 /// AIP session token. The user should be redirected to the login page. 166 + /// The contained string is the destination URL to redirect to after re-authentication. 166 167 /// 167 168 /// **Error Code:** `error-smokesignal-web-3` 168 - #[error("error-smokesignal-web-3 Session expired, re-authentication required")] 169 - SessionStale, 169 + #[error("error-smokesignal-web-3 Session expired, re-authentication required (destination: {0})")] 170 + SessionStale(String), 170 171 171 172 /// An internal server error occurred. 172 173 /// ··· 187 188 fn into_response(self) -> Response { 188 189 match self { 189 190 WebError::MiddlewareAuthError(err) => err.into_response(), 190 - WebError::SessionStale => { 191 + WebError::SessionStale(destination) => { 191 192 // For HTMX requests, use HX-Redirect to force a full page navigation to login 192 193 // For regular requests, this will also work as the browser follows the redirect 194 + // Include the destination so users return to where they were after re-authenticating 195 + let encoded_destination = urlencoding::encode(&destination); 196 + let redirect_url = format!( 197 + "/oauth/login?reason=session_expired&destination={}", 198 + encoded_destination 199 + ); 193 200 ( 194 201 StatusCode::UNAUTHORIZED, 195 - [("HX-Redirect", "/oauth/login?reason=session_expired")], 202 + [("HX-Redirect", redirect_url)], 196 203 "Session expired. Please log in again.", 197 204 ) 198 205 .into_response()
+1 -1
src/http/handle_accept_rsvp.rs
··· 115 115 116 116 // Check AIP session validity before attempting AT Protocol operation 117 117 if let AipSessionStatus::Stale = require_valid_aip_session(&web_context, &auth).await? { 118 - return Err(WebError::SessionStale); 118 + return Err(WebError::SessionStale("/".to_string())); 119 119 } 120 120 121 121 // Create DPoP auth based on OAuth backend type
+5 -5
src/http/handle_blob.rs
··· 328 328 329 329 // Check AIP session validity before attempting AT Protocol operation 330 330 if let AipSessionStatus::Stale = require_valid_aip_session(&web_context, &auth).await? { 331 - return Err(WebError::SessionStale); 331 + return Err(WebError::SessionStale("/settings".to_string())); 332 332 } 333 333 334 334 let dpop_auth = match (&auth, &web_context.config.oauth_backend) { ··· 503 503 504 504 // Check AIP session validity before attempting AT Protocol operation 505 505 if let AipSessionStatus::Stale = require_valid_aip_session(&web_context, &auth).await? { 506 - return Err(WebError::SessionStale); 506 + return Err(WebError::SessionStale("/settings".to_string())); 507 507 } 508 508 509 509 let dpop_auth = match (&auth, &web_context.config.oauth_backend) { ··· 619 619 620 620 // Check AIP session validity before attempting AT Protocol operation 621 621 if let AipSessionStatus::Stale = require_valid_aip_session(&web_context, &auth).await? { 622 - return Err(WebError::SessionStale); 622 + return Err(WebError::SessionStale("/settings".to_string())); 623 623 } 624 624 625 625 let dpop_auth = match (&auth, &web_context.config.oauth_backend) { ··· 734 734 735 735 // Check AIP session validity before attempting AT Protocol operation 736 736 if let AipSessionStatus::Stale = require_valid_aip_session(&web_context, &auth).await? { 737 - return Err(WebError::SessionStale); 737 + return Err(WebError::SessionStale("/event".to_string())); 738 738 } 739 739 740 740 // Create DPoP authentication based on backend type ··· 942 942 943 943 // Check AIP session validity before attempting AT Protocol operation 944 944 if let AipSessionStatus::Stale = require_valid_aip_session(&web_context, &auth).await? { 945 - return Err(WebError::SessionStale); 945 + return Err(WebError::SessionStale("/event".to_string())); 946 946 } 947 947 948 948 // Create DPoP authentication based on backend type
+2 -2
src/http/handle_create_event.rs
··· 133 133 134 134 // Check AIP session validity 135 135 if let AipSessionStatus::Stale = require_valid_aip_session(&web_context, &auth).await? { 136 - return Err(WebError::SessionStale); 136 + return Err(WebError::SessionStale("/event".to_string())); 137 137 } 138 138 139 139 let is_development = cfg!(debug_assertions); ··· 265 265 266 266 // Check AIP session validity before attempting AT Protocol operation 267 267 if let AipSessionStatus::Stale = require_valid_aip_session(&web_context, &auth).await? { 268 - return Err(WebError::SessionStale); 268 + return Err(WebError::SessionStale("/event".to_string())); 269 269 } 270 270 271 271 // Create DPoP auth
+2 -2
src/http/handle_create_rsvp.rs
··· 47 47 // Check AIP session validity before displaying RSVP form 48 48 // This prevents users from filling out forms with stale sessions 49 49 if let AipSessionStatus::Stale = require_valid_aip_session(&web_context, &auth).await? { 50 - return Err(WebError::SessionStale); 50 + return Err(WebError::SessionStale("/rsvp".to_string())); 51 51 } 52 52 53 53 let default_context = template_context! { ··· 151 151 152 152 // Check AIP session validity before attempting AT Protocol operation 153 153 if let AipSessionStatus::Stale = require_valid_aip_session(&web_context, &auth).await? { 154 - return Err(WebError::SessionStale); 154 + return Err(WebError::SessionStale("/rsvp".to_string())); 155 155 } 156 156 157 157 // Create DPoP auth based on OAuth backend type
+1 -1
src/http/handle_delete_event.rs
··· 83 83 if form.confirm.as_deref() == Some("true") { 84 84 // Check AIP session validity before attempting AT Protocol operation 85 85 if let AipSessionStatus::Stale = require_valid_aip_session(&ctx.web_context, &ctx.auth).await? { 86 - return Err(WebError::SessionStale); 86 + return Err(WebError::SessionStale("/".to_string())); 87 87 } 88 88 89 89 // Create DPoP authentication based on auth type
+1 -1
src/http/handle_edit_event.rs
··· 111 111 112 112 // Check AIP session validity before attempting AT Protocol operation 113 113 if let AipSessionStatus::Stale = require_valid_aip_session(&ctx.web_context, &ctx.auth).await? { 114 - return Err(WebError::SessionStale); 114 + return Err(WebError::SessionStale("/event".to_string())); 115 115 } 116 116 117 117 // Create DPoP auth
+1 -1
src/http/handle_finalize_acceptance.rs
··· 237 237 238 238 // Check AIP session validity before attempting AT Protocol operation 239 239 if let AipSessionStatus::Stale = require_valid_aip_session(&web_context, &auth).await? { 240 - return Err(WebError::SessionStale); 240 + return Err(WebError::SessionStale("/".to_string())); 241 241 } 242 242 243 243 // Create DPoP auth based on OAuth backend type
+2 -2
src/http/handle_lfg.rs
··· 490 490 491 491 // Check AIP session validity before attempting AT Protocol operation 492 492 if let AipSessionStatus::Stale = require_valid_aip_session(&web_context, &auth).await? { 493 - return Err(WebError::SessionStale); 493 + return Err(WebError::SessionStale("/lfg".to_string())); 494 494 } 495 495 496 496 // Validate the request ··· 641 641 642 642 // Check AIP session validity 643 643 if let AipSessionStatus::Stale = require_valid_aip_session(&web_context, &auth).await? { 644 - return Err(WebError::SessionStale); 644 + return Err(WebError::SessionStale("/lfg".to_string())); 645 645 } 646 646 647 647 // Get the active LFG record
+1 -1
src/http/handle_quick_event.rs
··· 25 25 // Check AIP session validity before displaying quick event form 26 26 // This prevents users from filling out forms with stale sessions 27 27 if let AipSessionStatus::Stale = require_valid_aip_session(&web_context, &auth).await? { 28 - return Err(WebError::SessionStale); 28 + return Err(WebError::SessionStale("/quick-event".to_string())); 29 29 } 30 30 31 31 let render_template = select_template!("quick_event", hx_boosted, false, language);
+2 -2
src/http/handle_settings.rs
··· 83 83 // Check AIP session validity before displaying settings form 84 84 // This prevents users from filling out forms with stale sessions 85 85 if let AipSessionStatus::Stale = require_valid_aip_session(&web_context, &auth).await? { 86 - return Err(WebError::SessionStale); 86 + return Err(WebError::SessionStale("/settings".to_string())); 87 87 } 88 88 89 89 let default_context = template_context! { ··· 521 521 522 522 // Check AIP session validity before attempting AT Protocol operation 523 523 if let AipSessionStatus::Stale = require_valid_aip_session(&web_context, &auth).await? { 524 - return Err(WebError::SessionStale); 524 + return Err(WebError::SessionStale("/settings".to_string())); 525 525 } 526 526 527 527 // Create DPoP authentication based on backend type
+1 -1
src/http/handle_unaccept_rsvp.rs
··· 80 80 81 81 // Check AIP session validity before attempting AT Protocol operation 82 82 if let AipSessionStatus::Stale = require_valid_aip_session(&web_context, &auth).await? { 83 - return Err(WebError::SessionStale); 83 + return Err(WebError::SessionStale("/".to_string())); 84 84 } 85 85 86 86 // Create DPoP auth based on OAuth backend type
+6
src/http/templates.rs
··· 45 45 env.set_lstrip_blocks(true); 46 46 env.add_global("base", format!("https://{}", http_external)); 47 47 env.add_global("version", version.clone()); 48 + env.add_global("build_rev", env!("BUILD_REV")); 49 + env.add_global("bundle_js", env!("BUNDLE_JS")); 50 + env.add_global("bundle_css", env!("BUNDLE_CSS")); 48 51 env.add_function("external_profile_url", super::external_profile_url); 49 52 env.set_loader(path_loader(&template_path)); 50 53 notifier.set_fast_reload(true); ··· 64 67 env.set_lstrip_blocks(true); 65 68 env.add_global("base", format!("https://{}", http_external)); 66 69 env.add_global("version", version.clone()); 70 + env.add_global("build_rev", env!("BUILD_REV")); 71 + env.add_global("bundle_js", env!("BUNDLE_JS")); 72 + env.add_global("bundle_css", env!("BUNDLE_CSS")); 67 73 env.add_function("external_profile_url", super::external_profile_url); 68 74 minijinja_embed::load_templates!(&mut env); 69 75 env
+139
static/.vite/manifest.json
··· 1 + { 2 + "_cropper-BJgXXBRK.css": { 3 + "file": "css/cropper-BJgXXBRK.css", 4 + "src": "_cropper-BJgXXBRK.css" 5 + }, 6 + "_cropper-DyNc_82c.js": { 7 + "file": "js/cropper-DyNc_82c.js", 8 + "name": "cropper", 9 + "isDynamicEntry": true, 10 + "css": [ 11 + "css/cropper-BJgXXBRK.css" 12 + ] 13 + }, 14 + "_maps-CpDLi3o_.css": { 15 + "file": "css/maps-CpDLi3o_.css", 16 + "src": "_maps-CpDLi3o_.css" 17 + }, 18 + "_maps-GDfHpVyJ.js": { 19 + "file": "js/maps-GDfHpVyJ.js", 20 + "name": "maps", 21 + "isDynamicEntry": true, 22 + "css": [ 23 + "css/maps-CpDLi3o_.css" 24 + ] 25 + }, 26 + "src/features/cropper/index.ts": { 27 + "file": "js/index-Bcnf8oUZ.js", 28 + "name": "index", 29 + "src": "src/features/cropper/index.ts", 30 + "isDynamicEntry": true, 31 + "imports": [ 32 + "src/main.ts" 33 + ], 34 + "dynamicImports": [ 35 + "_cropper-DyNc_82c.js", 36 + "_cropper-DyNc_82c.js" 37 + ] 38 + }, 39 + "src/features/cropper/profile-cropper.ts": { 40 + "file": "js/profile-cropper-DwPaCPSP.js", 41 + "name": "profile-cropper", 42 + "src": "src/features/cropper/profile-cropper.ts", 43 + "isDynamicEntry": true, 44 + "imports": [ 45 + "src/features/cropper/index.ts", 46 + "src/main.ts" 47 + ] 48 + }, 49 + "src/features/lfg/heatmap.ts": { 50 + "file": "js/heatmap-CJsCFdcC.js", 51 + "name": "heatmap", 52 + "src": "src/features/lfg/heatmap.ts", 53 + "isDynamicEntry": true, 54 + "imports": [ 55 + "src/main.ts" 56 + ], 57 + "dynamicImports": [ 58 + "_maps-GDfHpVyJ.js", 59 + "_maps-GDfHpVyJ.js", 60 + "_maps-GDfHpVyJ.js" 61 + ] 62 + }, 63 + "src/features/maps/event-map.ts": { 64 + "file": "js/event-map-BMN8EESL.js", 65 + "name": "event-map", 66 + "src": "src/features/maps/event-map.ts", 67 + "isDynamicEntry": true, 68 + "imports": [ 69 + "src/main.ts" 70 + ], 71 + "dynamicImports": [ 72 + "_maps-GDfHpVyJ.js", 73 + "_maps-GDfHpVyJ.js", 74 + "_maps-GDfHpVyJ.js" 75 + ] 76 + }, 77 + "src/features/maps/globe-map.ts": { 78 + "file": "js/globe-map-v0wYAEFW.js", 79 + "name": "globe-map", 80 + "src": "src/features/maps/globe-map.ts", 81 + "isDynamicEntry": true, 82 + "imports": [ 83 + "src/main.ts" 84 + ], 85 + "dynamicImports": [ 86 + "_maps-GDfHpVyJ.js", 87 + "_maps-GDfHpVyJ.js", 88 + "_maps-GDfHpVyJ.js" 89 + ] 90 + }, 91 + "src/features/maps/index.ts": { 92 + "file": "js/index-BP1lDIcH.js", 93 + "name": "index", 94 + "src": "src/features/maps/index.ts", 95 + "isDynamicEntry": true, 96 + "imports": [ 97 + "src/main.ts" 98 + ], 99 + "dynamicImports": [ 100 + "src/features/maps/event-map.ts", 101 + "src/features/maps/globe-map.ts", 102 + "src/features/maps/location-heatmap.ts" 103 + ] 104 + }, 105 + "src/features/maps/location-heatmap.ts": { 106 + "file": "js/location-heatmap-qsLOB3hq.js", 107 + "name": "location-heatmap", 108 + "src": "src/features/maps/location-heatmap.ts", 109 + "isDynamicEntry": true, 110 + "imports": [ 111 + "src/main.ts" 112 + ], 113 + "dynamicImports": [ 114 + "_maps-GDfHpVyJ.js", 115 + "_maps-GDfHpVyJ.js", 116 + "_maps-GDfHpVyJ.js" 117 + ] 118 + }, 119 + "src/main.ts": { 120 + "file": "js/main-CuQd5Sql.js", 121 + "name": "main", 122 + "src": "src/main.ts", 123 + "isEntry": true, 124 + "dynamicImports": [ 125 + "_maps-GDfHpVyJ.js", 126 + "_maps-GDfHpVyJ.js", 127 + "_maps-GDfHpVyJ.js", 128 + "src/features/maps/index.ts", 129 + "src/features/maps/index.ts", 130 + "src/features/maps/index.ts", 131 + "src/features/cropper/index.ts", 132 + "src/features/cropper/profile-cropper.ts", 133 + "src/features/lfg/heatmap.ts" 134 + ], 135 + "css": [ 136 + "css/main-DsS_JPFh.css" 137 + ] 138 + } 139 + }
+10
static/css/cropper-BJgXXBRK.css
··· 1 + /*! 2 + * Cropper.js v1.6.2 3 + * https://fengyuanchen.github.io/cropperjs 4 + * 5 + * Copyright 2015-present Chen Fengyuan 6 + * Released under the MIT license 7 + * 8 + * Date: 2024-04-21T07:43:02.731Z 9 + */ 10 + .cropper-container{-ms-touch-action:none;touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;direction:ltr;font-size:0;line-height:0;position:relative}.cropper-container img{-webkit-backface-visibility:hidden;backface-visibility:hidden;image-orientation:0deg;width:100%;height:100%;display:block;min-width:0!important;max-width:none!important;min-height:0!important;max-height:none!important}.cropper-wrap-box,.cropper-canvas,.cropper-drag-box,.cropper-crop-box,.cropper-modal{position:absolute;top:0;bottom:0;left:0;right:0}.cropper-wrap-box,.cropper-canvas{overflow:hidden}.cropper-drag-box{opacity:0;background-color:#fff}.cropper-modal{opacity:.5;background-color:#000}.cropper-view-box{outline:1px solid #3399ffbf;width:100%;height:100%;display:block;overflow:hidden}.cropper-dashed{opacity:.5;border:0 dashed #eee;display:block;position:absolute}.cropper-dashed.dashed-h{border-top-width:1px;border-bottom-width:1px;width:100%;height:33.3333%;top:33.3333%;left:0}.cropper-dashed.dashed-v{border-left-width:1px;border-right-width:1px;width:33.3333%;height:100%;top:0;left:33.3333%}.cropper-center{opacity:.75;width:0;height:0;display:block;position:absolute;top:50%;left:50%}.cropper-center:before,.cropper-center:after{content:" ";background-color:#eee;display:block;position:absolute}.cropper-center:before{width:7px;height:1px;top:0;left:-3px}.cropper-center:after{width:1px;height:7px;top:-3px;left:0}.cropper-face,.cropper-line,.cropper-point{opacity:.1;width:100%;height:100%;display:block;position:absolute}.cropper-face{background-color:#fff;top:0;left:0}.cropper-line{background-color:#39f}.cropper-line.line-e{cursor:ew-resize;width:5px;top:0;right:-3px}.cropper-line.line-n{cursor:ns-resize;height:5px;top:-3px;left:0}.cropper-line.line-w{cursor:ew-resize;width:5px;top:0;left:-3px}.cropper-line.line-s{cursor:ns-resize;height:5px;bottom:-3px;left:0}.cropper-point{opacity:.75;background-color:#39f;width:5px;height:5px}.cropper-point.point-e{cursor:ew-resize;margin-top:-3px;top:50%;right:-3px}.cropper-point.point-n{cursor:ns-resize;margin-left:-3px;top:-3px;left:50%}.cropper-point.point-w{cursor:ew-resize;margin-top:-3px;top:50%;left:-3px}.cropper-point.point-s{cursor:s-resize;margin-left:-3px;bottom:-3px;left:50%}.cropper-point.point-ne{cursor:nesw-resize;top:-3px;right:-3px}.cropper-point.point-nw{cursor:nwse-resize;top:-3px;left:-3px}.cropper-point.point-sw{cursor:nesw-resize;bottom:-3px;left:-3px}.cropper-point.point-se{cursor:nwse-resize;opacity:1;width:20px;height:20px;bottom:-3px;right:-3px}@media (min-width:768px){.cropper-point.point-se{width:15px;height:15px}}@media (min-width:992px){.cropper-point.point-se{width:10px;height:10px}}@media (min-width:1200px){.cropper-point.point-se{opacity:.75;width:5px;height:5px}}.cropper-point.point-se:before{content:" ";opacity:0;background-color:#39f;width:200%;height:200%;display:block;position:absolute;bottom:-50%;right:-50%}.cropper-invisible{opacity:0}.cropper-bg{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.cropper-hide{width:0;height:0;display:block;position:absolute}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-drag-box,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed}
+1
static/css/main-DsS_JPFh.css
··· 1 + :root{--smokesignal-map-hex-color:#3273dc;--smokesignal-map-hex-fill-opacity:.2;--smokesignal-map-hex-stroke-width:2px;--smokesignal-lfg-hex-color:#00d1b2;--smokesignal-lfg-hex-fill-opacity:.3;--smokesignal-heatmap-color-low:#3273dc;--smokesignal-heatmap-color-mid:#8957e5;--smokesignal-heatmap-color-high:#e74c3c}[x-cloak]{display:none!important}.transition-all{transition:all .2s}.map-container{z-index:1;border-radius:6px;overflow:hidden}.h3-hex{fill-opacity:var(--smokesignal-map-hex-fill-opacity);stroke-width:var(--smokesignal-map-hex-stroke-width)}.h3-hex-center{stroke-width:3px}.event-header-image{aspect-ratio:16/9;overflow:hidden}.event-header-image img{object-fit:cover;width:100%;height:100%}.organizer-avatar{object-fit:cover;border:3px solid hsl(var(--bulma-scheme-h),var(--bulma-scheme-s),var(--bulma-border-l));border-radius:50%;flex-shrink:0;width:80px;height:80px}.rsvp-section{background:hsl(var(--bulma-scheme-h),var(--bulma-scheme-s),var(--bulma-scheme-main-bis-l))}.rsvp-message{border-left:4px solid hsl(var(--bulma-scheme-h),var(--bulma-scheme-s),var(--bulma-border-l));background-color:hsl(var(--bulma-scheme-h),var(--bulma-scheme-s),var(--bulma-background-l))}.rsvp-message.is-success{border-left-color:hsl(var(--bulma-success-h),var(--bulma-success-s),var(--bulma-success-l))}.rsvp-message.is-info{border-left-color:hsl(var(--bulma-info-h),var(--bulma-info-s),var(--bulma-info-l))}.rsvp-message.is-warning{border-left-color:hsl(var(--bulma-warning-h),var(--bulma-warning-s),var(--bulma-warning-l))}.rsvp-message.is-danger{border-left-color:hsl(var(--bulma-danger-h),var(--bulma-danger-s),var(--bulma-danger-l))}.rsvp-message.is-neutral{border-left-color:hsl(var(--bulma-link-h),var(--bulma-link-s),var(--bulma-link-l))}.location-badge.is-virtual{background:hsl(var(--bulma-info-h),var(--bulma-info-s),var(--bulma-info-90-l));color:hsl(var(--bulma-info-h),var(--bulma-info-s),var(--bulma-info-20-l))}.location-badge.is-in-person{background:hsl(var(--bulma-warning-h),var(--bulma-warning-s),var(--bulma-warning-90-l));color:hsl(var(--bulma-warning-h),var(--bulma-warning-s),var(--bulma-warning-20-l))}.location-badge.is-hybrid{background:hsl(var(--bulma-link-h),var(--bulma-link-s),var(--bulma-link-90-l));color:hsl(var(--bulma-link-h),var(--bulma-link-s),var(--bulma-link-20-l))}.event-link{transition:all .2s}.event-link:hover{background:hsl(var(--bulma-scheme-h),var(--bulma-scheme-s),calc(var(--bulma-scheme-main-l) + var(--bulma-hover-background-l-delta)));border-color:hsl(var(--bulma-link-h),var(--bulma-link-s),var(--bulma-link-l));transform:translate(2px)}.address-link .fa-apple{color:hsl(var(--bulma-scheme-h),var(--bulma-scheme-s),var(--bulma-text-strong-l))}.address-link .fa-google{color:#4285f4}.link-icon-bg{background:hsl(var(--bulma-scheme-h),var(--bulma-scheme-s),var(--bulma-scheme-main-l))}.section-divider{border-color:hsl(var(--bulma-scheme-h),var(--bulma-scheme-s),var(--bulma-border-l))}.address-box-border{border-left-color:hsl(var(--bulma-link-h),var(--bulma-link-s),var(--bulma-link-l))}.address-box{background:hsl(var(--bulma-scheme-h),var(--bulma-scheme-s),var(--bulma-scheme-main-bis-l))}.event-detail-box{background:hsl(var(--bulma-scheme-h),var(--bulma-scheme-s),var(--bulma-background-l));border-radius:6px}.event-detail-label{color:hsl(var(--bulma-scheme-h),var(--bulma-scheme-s),var(--bulma-text-weak-l))}.event-detail-time{color:hsl(var(--bulma-scheme-h),var(--bulma-scheme-s),var(--bulma-text-l))}.event-detail-icon{color:hsl(var(--bulma-scheme-h),var(--bulma-scheme-s),var(--bulma-text-weak-l))}.rsvp-secondary-text{color:hsl(var(--bulma-scheme-h),var(--bulma-scheme-s),var(--bulma-text-weak-l));opacity:.9}.event-header-flex{align-items:start;gap:1.5rem;display:flex}#event-map{z-index:1;border-radius:6px;overflow:hidden}@media (max-width:768px){.rsvp-controls{flex-direction:column}.rsvp-controls .select,.rsvp-controls .button{width:100%}.organizer-avatar{width:60px;height:60px}.event-header-flex{flex-wrap:wrap;margin-bottom:1.5rem}.event-header-flex>div:last-child{flex-direction:column;width:100%;margin-top:1rem}.event-header-flex .button{width:100%}.event-header-flex+.notification{margin-top:1.5rem}}#globe-map{z-index:1;border-radius:8px;height:400px;overflow:hidden}.globe-controls{flex-wrap:wrap;gap:.5rem;margin-top:.75rem;display:flex}.globe-controls .button{font-size:.75rem}#globe-status{color:hsl(var(--bulma-scheme-h),var(--bulma-scheme-s),var(--bulma-text-weak-l));margin-top:.5rem;font-size:.875rem}.maplibregl-popup-content{color:#fff;background:#16213ef2;border-radius:6px;padding:10px 14px;font-size:13px}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{border-top-color:#16213ef2}.maplibregl-popup-close-button{color:#fff;font-size:16px}@media (max-width:768px){#globe-map{height:300px}.globe-controls{justify-content:center}}#location-heatmap{z-index:1;border-radius:8px;height:250px;overflow:hidden}.h3-hex,.h3-hex-center{stroke-width:2px}#lfg-map{border:1px solid #dbdbdb;border-radius:6px;height:300px}@media (prefers-color-scheme:dark){#lfg-map{border-color:hsl(var(--bulma-scheme-h),var(--bulma-scheme-s),var(--bulma-border-l))}}
+1
static/css/maps-CpDLi3o_.css
··· 1 + .leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer,.leaflet-pane>svg,.leaflet-pane>canvas{position:absolute;top:0;left:0}.leaflet-container{overflow:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::selection{background:0 0}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{-webkit-transform-origin:0 0;width:1600px;height:1600px}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{width:auto;padding:0;max-width:none!important;max-height:none!important}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:#33b5e566}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{box-sizing:border-box;z-index:800;width:0;height:0}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{z-index:800;pointer-events:visiblePainted;pointer-events:auto;position:relative}.leaflet-top,.leaflet-bottom{z-index:1000;pointer-events:none;position:absolute}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);-moz-transition:-moz-transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-tile-container,.leaflet-pane>svg path{pointer-events:none}.leaflet-marker-icon.leaflet-interactive,.leaflet-image-layer.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path,.leaflet-pane>svg path.leaflet-interactive{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{outline-offset:1px;background:#ddd}.leaflet-container a{color:#0078a8}.leaflet-zoom-box{background:#ffffff80;border:2px dotted #38f}.leaflet-container{font-family:Helvetica Neue,Arial,Helvetica,sans-serif;font-size:.75rem;line-height:1.5}.leaflet-bar{border-radius:4px;box-shadow:0 1px 5px #000000a6}.leaflet-bar a{text-align:center;color:#000;background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;text-decoration:none;display:block}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover,.leaflet-bar a:focus{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom:none;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.leaflet-bar a.leaflet-disabled{cursor:default;color:#bbb;background-color:#f4f4f4}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-right-radius:2px;border-bottom-left-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{text-indent:1px;font:700 18px Lucida Console,Monaco,monospace}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{background:#fff;border-radius:5px;box-shadow:0 1px 5px #0006}.leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAQAAAADQ4RFAAACf0lEQVR4AY1UM3gkARTePdvdoTxXKc+qTl3aU5U6b2Kbkz3Gtq3Zw6ziLGNPzrYx7946Tr6/ee/XeCQ4D3ykPtL5tHno4n0d/h3+xfuWHGLX81cn7r0iTNzjr7LrlxCqPtkbTQEHeqOrTy4Yyt3VCi/IOB0v7rVC7q45Q3Gr5K6jt+3Gl5nCoDD4MtO+j96Wu8atmhGqcNGHObuf8OM/x3AMx38+4Z2sPqzCxRFK2aF2e5Jol56XTLyggAMTL56XOMoS1W4pOyjUcGGQdZxU6qRh7B9Zp+PfpOFlqt0zyDZckPi1ttmIp03jX8gyJ8a/PG2yutpS/Vol7peZIbZcKBAEEheEIAgFbDkz5H6Zrkm2hVWGiXKiF4Ycw0RWKdtC16Q7qe3X4iOMxruonzegJzWaXFrU9utOSsLUmrc0YjeWYjCW4PDMADElpJSSQ0vQvA1Tm6/JlKnqFs1EGyZiFCqnRZTEJJJiKRYzVYzJck2Rm6P4iH+cmSY0YzimYa8l0EtTODFWhcMIMVqdsI2uiTvKmTisIDHJ3od5GILVhBCarCfVRmo4uTjkhrhzkiBV7SsaqS+TzrzM1qpGGUFt28pIySQHR6h7F6KSwGWm97ay+Z+ZqMcEjEWebE7wxCSQwpkhJqoZA5ivCdZDjJepuJ9IQjGGUmuXJdBFUygxVqVsxFsLMbDe8ZbDYVCGKxs+W080max1hFCarCfV+C1KATwcnvE9gRRuMP2prdbWGowm1KB1y+zwMMENkM755cJ2yPDtqhTI6ED1M/82yIDtC/4j4BijjeObflpO9I9MwXTCsSX8jWAFeHr05WoLTJ5G8IQVS/7vwR6ohirYM7f6HzYpogfS3R2OAAAAAElFTkSuQmCC);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAQAAABvcdNgAAAEsklEQVR4AWL4TydIhpZK1kpWOlg0w3ZXP6D2soBtG42jeI6ZmQTHzAxiTbSJsYLjO9HhP+WOmcuhciVnmHVQcJnp7DFvScowZorad/+V/fVzMdMT2g9Cv9guXGv/7pYOrXh2U+RRR3dSd9JRx6bIFc/ekqHI29JC6pJ5ZEh1yWkhkbcFeSjxgx3L2m1cb1C7bceyxA+CNjT/Ifff+/kDk2u/w/33/IeCMOSaWZ4glosqT3DNnNZQ7Cs58/3Ce5HL78iZH/vKVIaYlqzfdLu8Vi7dnvUbEza5Idt36tquZFldl6N5Z/POLof0XLK61mZCmJSWjVF9tEjUluu74IUXvgttuVIHE7YxSkaYhJZam7yiM9Pv82JYfl9nptxZaxMJE4YSPty+vF0+Y2up9d3wwijfjZbabqm/3bZ9ecKHsiGmRflnn1MW4pjHf9oLufyn2z3y1D6n8g8TZhxyzipLNPnAUpsOiuWimg52psrTZYnOWYNDTMuWBWa0tJb4rgq1UvmutpaYEbZlwU3CLJm/ayYjHW5/h7xWLn9Hh1vepDkyf7dE7MtT5LR4e7yYpHrkhOUpEfssBLq2pPhAqoSWKUkk7EDqkmK6RrCEzqDjhNDWNE+XSMvkJRDWlZTmCW0l0PHQGRZY5t1L83kT0Y3l2SItk5JAWHl2dCOBm+fPu3fo5/3v61RMCO9Jx2EEYYhb0rmNQMX/vm7gqOEJLcXTGw3CAuRNeyaPWwjR8PRqKQ1PDA/dpv+on9Shox52WFnx0KY8onHayrJzm87i5h9xGw/tfkev0jGsQizqezUKjk12hBMKJ4kbCqGPVNXudyyrShovGw5CgxsRICxF6aRmSjlBnHRzg7Gx8fKqEubI2rahQYdR1YgDIRQO7JvQyD52hoIQx0mxa0ODtW2Iozn1le2iIRdzwWewedyZzewidueOGqlsn1MvcnQpuVwLGG3/IR1hIKxCjelIDZ8ldqWz25jWAsnldEnK0Zxro19TGVb2ffIZEsIO89EIEDvKMPrzmBOQcKQ+rroye6NgRRxqR4U8EAkz0CL6uSGOm6KQCdWjvjRiSP1BPalCRS5iQYiEIvxuBMJEWgzSoHADcVMuN7IuqqTeyUPq22qFimFtxDyBBJEwNyt6TM88blFHao/6tWWhuuOM4SAK4EI4QmFHA+SEyWlp4EQoJ13cYGzMu7yszEIBOm2rVmHUNqwAIQabISNMRstmdhNWcFLsSm+0tjJH1MdRxO5Nx0WDMhCtgD6OKgZeljJqJKc9po8juskR9XN0Y1lZ3mWjLR9JCO1jRDMd0fpYC2VnvjBSEFg7wBENc0R9HFlb0xvF1+TBEpF68d+DHR6IOWVv2BECtxo46hOFUBd/APU57WIoEwJhIi2CdpyZX0m93BZicktMj1AS9dClteUFAUNUIEygRZCtik5zSxI9MubTBH1GOiHsiLJ3OCoSZkILa9PxiN0EbvhsAo8tdAf9Seepd36lGWHmtNANTv5Jd0z4QYyeo/UEJqxKRpg5LZx6btLPsOaEmdMyxYdlc8LMaJnikDlhclqmPiQnTEpLUIZEwkRagjYkEibQErwhkTAKCLQEbUgkzJQWc/0PstHHcfEdQ+UAAAAASUVORK5CYII=);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{color:#333;background:#fff;padding:6px 10px 6px 6px}.leaflet-control-layers-scrollbar{padding-right:5px;overflow:hidden scroll}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{font-size:1.08333em;display:block}.leaflet-control-layers-separator{border-top:1px solid #ddd;height:0;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=)}.leaflet-container .leaflet-control-attribution{background:#fffc;margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{color:#333;padding:0 5px;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover,.leaflet-control-attribution a:focus{text-decoration:underline}.leaflet-attribution-flag{width:1em;height:.6669em;vertical-align:baseline!important;display:inline!important}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{white-space:nowrap;box-sizing:border-box;text-shadow:1px 1px #fff;background:#fffc;border:2px solid #777;border-top:none;padding:2px 5px 1px;line-height:1.1}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{box-shadow:none}.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{background-clip:padding-box;border:2px solid #0003}.leaflet-popup{text-align:center;margin-bottom:20px;position:absolute}.leaflet-popup-content-wrapper{text-align:left;border-radius:12px;padding:1px}.leaflet-popup-content{min-height:1px;margin:13px 24px 13px 20px;font-size:1.08333em;line-height:1.3}.leaflet-popup-content p{margin:1.3em 0}.leaflet-popup-tip-container{pointer-events:none;width:40px;height:20px;margin-top:-1px;margin-left:-20px;position:absolute;left:50%;overflow:hidden}.leaflet-popup-tip{pointer-events:auto;width:17px;height:17px;margin:-10px auto 0;padding:1px;transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{color:#333;background:#fff;box-shadow:0 3px 14px #0006}.leaflet-container a.leaflet-popup-close-button{text-align:center;color:#757575;background:0 0;border:none;width:24px;height:24px;font:16px/24px Tahoma,Verdana,sans-serif;text-decoration:none;position:absolute;top:0;right:0}.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-container a.leaflet-popup-close-button:focus{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";width:24px;filter:progid:DXImageTransform.Microsoft.Matrix(M11=.707107,M12=.707107,M21=-.707107,M22=.707107);margin:0 auto}.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{color:#222;white-space:nowrap;-webkit-user-select:none;user-select:none;pointer-events:none;background-color:#fff;border:1px solid #fff;border-radius:3px;padding:6px;position:absolute;box-shadow:0 1px 3px #0006}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-top:before,.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{pointer-events:none;content:"";background:0 0;border:6px solid #0000;position:absolute}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{margin-left:-6px;left:50%}.leaflet-tooltip-top:before{border-top-color:#fff;margin-bottom:-12px;bottom:0}.leaflet-tooltip-bottom:before{border-bottom-color:#fff;margin-top:-12px;margin-left:-6px;top:0}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{margin-top:-6px;top:50%}.leaflet-tooltip-left:before{border-left-color:#fff;margin-right:-12px;right:0}.leaflet-tooltip-right:before{border-right-color:#fff;margin-left:-12px;left:0}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}.maplibregl-map{-webkit-tap-highlight-color:transparent;font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;position:relative;overflow:hidden}.maplibregl-canvas{position:absolute;top:0;left:0}.maplibregl-map:-webkit-full-screen{width:100%;height:100%}.maplibregl-map:fullscreen{width:100%;height: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;-webkit-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;z-index:2;position:absolute}.maplibregl-ctrl-top-left{top:0;left:0}.maplibregl-ctrl-top-right{top:0;right: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 #0000001a}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px buttontext}}.maplibregl-ctrl-group button{box-sizing:border-box;cursor:pointer;background-color:#0000;border:0;outline:none;width:29px;height:29px;padding:0;display:block}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;width:100%;height:100%;display:block}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:#0000}.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}@media (hover:hover){.maplibregl-ctrl button:not(:disabled):hover{background-color:#0000000d}}.maplibregl-ctrl button:not(:disabled):active{background-color:#0000000d}.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{-webkit-border-radius:inherit;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 13z'/%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.5'/%3E%3C/svg%3E")}@media (forced-colors: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 13z'/%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.5'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.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 13z'/%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.5'/%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-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%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-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}@media (forced-colors: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-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%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-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.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-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%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-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%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 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}@media (forced-colors: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 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.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 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-globe .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='none' stroke='%23333' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='8.5'/%3E%3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E%3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E%3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-globe-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='none' stroke='%2333b5e5' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='8.5'/%3E%3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E%3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E%3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z'/%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:2s linear infinite maplibregl-spin}@media (forced-colors: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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%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-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{cursor:pointer;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.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 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.4q.47.48.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.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.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.8 4.8 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.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 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.528q-.001.515-.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.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 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.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 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.7 4.7 0 0 1-1.782 1.884 4.77 4.77 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.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 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.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 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.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 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-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.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.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.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.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 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.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;width:88px;height:23px;margin:0 0 -4px -4px;display:block;overflow:hidden}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:#0000;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.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 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.4q.47.48.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.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.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.8 4.8 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.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 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.528q-.001.515-.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.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 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.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 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.7 4.7 0 0 1-1.782 1.884 4.77 4.77 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.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 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.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 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.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 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-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.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.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.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.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 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.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){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.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 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.4q.47.48.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.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.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.8 4.8 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.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 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.528q-.001.515-.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.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 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.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 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.7 4.7 0 0 1-1.782 1.884 4.77 4.77 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.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 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.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 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.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 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-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.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.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.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.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 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.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:#ffffff80;margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{box-sizing:content-box;color:#000;background-color:#fff;border-radius:12px;min-height:20px;margin:10px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{visibility:visible;padding:2px 28px 2px 8px}.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{box-sizing:border-box;cursor:pointer;background-color:#ffffff80;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;outline:none;width:24px;height:24px;display:none;position:absolute;top:0;right:0}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;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:#0000000d}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{top:0;right:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{top:0;left:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors: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 (forced-colors:active) and (prefers-color-scheme:light){.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:#000000bf;text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{box-sizing:border-box;color:#333;white-space:nowrap;background-color:#ffffffbf;border:2px solid #333;border-top:#333;padding:0 5px;font-size:10px}.maplibregl-popup{pointer-events:none;will-change:transform;display:flex;position:absolute;top:0;left:0}.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{z-index:1;border:10px solid #0000;width:0;height:0}.maplibregl-popup-anchor-top .maplibregl-popup-tip{border-top:none;border-bottom-color:#fff;align-self:center}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{border-top:none;border-bottom-color:#fff;border-left:none;align-self:flex-start}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{border-top:none;border-bottom-color:#fff;border-right:none;align-self:flex-end}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{border-top-color:#fff;border-bottom:none;align-self:center}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{border-top-color:#fff;border-bottom:none;border-left:none;align-self:flex-start}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{border-top-color:#fff;border-bottom:none;border-right:none;align-self:flex-end}.maplibregl-popup-anchor-left .maplibregl-popup-tip{border-left:none;border-right-color:#fff;align-self:center}.maplibregl-popup-anchor-right .maplibregl-popup-tip{border-left-color:#fff;border-right:none;align-self:center}.maplibregl-popup-close-button{cursor:pointer;background-color:#0000;border:0;border-radius:0 3px 0 0;position:absolute;top:0;right:0}.maplibregl-popup-close-button:hover{background-color:#0000000d}.maplibregl-popup-content{pointer-events:auto;background:#fff;border-radius:3px;padding:15px 10px;position:relative;box-shadow:0 1px 2px #0000001a}.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;-webkit-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{will-change:transform;transition:opacity .2s;position:absolute;top:0;left:0}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;width:15px;height:15px}.maplibregl-user-location-dot:before{content:"";animation:2s infinite maplibregl-user-location-dot-pulse;position:absolute}.maplibregl-user-location-dot:after{box-sizing:border-box;content:"";border:2px solid #fff;border-radius:50%;width:19px;height:19px;position:absolute;top:-2px;left:-2px;box-shadow:0 0 3px #00000059}@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%;width:1px;height:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{opacity:.5;background:#fff;border:2px dotted #202020;width:0;height:0;position:absolute;top:0;left:0}.maplibregl-cooperative-gesture-screen{color:#fff;opacity:0;pointer-events:none;z-index:99999;background:#0006;justify-content:center;align-items:center;padding:1rem;font-size:1.4em;line-height:1.2;transition:opacity 1s 1s;display:flex;position:absolute;top:0;bottom:0;left:0;right:0}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity 50ms}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(pointer:coarse){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{z-index:99999;width:100%!important;height:100%!important;position:fixed!important;top:0!important;left:0!important}
+10
static/js/cropper-DyNc_82c.js
··· 1 + /*! 2 + * Cropper.js v1.6.2 3 + * https://fengyuanchen.github.io/cropperjs 4 + * 5 + * Copyright 2015-present Chen Fengyuan 6 + * Released under the MIT license 7 + * 8 + * Date: 2024-04-21T07:43:05.335Z 9 + */function Pt(a,t){var e=Object.keys(a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);t&&(i=i.filter(function(o){return Object.getOwnPropertyDescriptor(a,o).enumerable})),e.push.apply(e,i)}return e}function Zt(a){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Pt(Object(e),!0).forEach(function(i){bi(a,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(e)):Pt(Object(e)).forEach(function(i){Object.defineProperty(a,i,Object.getOwnPropertyDescriptor(e,i))})}return a}function mi(a,t){if(typeof a!="object"||!a)return a;var e=a[Symbol.toPrimitive];if(e!==void 0){var i=e.call(a,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(a)}function Jt(a){var t=mi(a,"string");return typeof t=="symbol"?t:t+""}function vt(a){"@babel/helpers - typeof";return vt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vt(a)}function vi(a,t){if(!(a instanceof t))throw new TypeError("Cannot call a class as a function")}function kt(a,t){for(var e=0;e<t.length;e++){var i=t[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(a,Jt(i.key),i)}}function wi(a,t,e){return t&&kt(a.prototype,t),e&&kt(a,e),Object.defineProperty(a,"prototype",{writable:!1}),a}function bi(a,t,e){return t=Jt(t),t in a?Object.defineProperty(a,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):a[t]=e,a}function ti(a){return yi(a)||xi(a)||Di(a)||Ei()}function yi(a){if(Array.isArray(a))return wt(a)}function xi(a){if(typeof Symbol<"u"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function Di(a,t){if(a){if(typeof a=="string")return wt(a,t);var e=Object.prototype.toString.call(a).slice(8,-1);if(e==="Object"&&a.constructor&&(e=a.constructor.name),e==="Map"||e==="Set")return Array.from(a);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return wt(a,t)}}function wt(a,t){(t==null||t>a.length)&&(t=a.length);for(var e=0,i=new Array(t);e<t;e++)i[e]=a[e];return i}function Ei(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 10 + In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var dt=typeof window<"u"&&typeof window.document<"u",k=dt?window:{},Ot=dt&&k.document.documentElement?"ontouchstart"in k.document.documentElement:!1,Nt=dt?"PointerEvent"in k:!1,y="cropper",At="all",ii="crop",ei="move",ai="zoom",$="e",q="w",K="s",H="n",it="ne",et="nw",at="se",rt="sw",bt="".concat(y,"-crop"),Yt="".concat(y,"-disabled"),S="".concat(y,"-hidden"),zt="".concat(y,"-hide"),Mi="".concat(y,"-invisible"),ft="".concat(y,"-modal"),yt="".concat(y,"-move"),ot="".concat(y,"Action"),ct="".concat(y,"Preview"),St="crop",ri="move",ni="none",xt="crop",Dt="cropend",Et="cropmove",Mt="cropstart",Xt="dblclick",Ti=Ot?"touchstart":"mousedown",Ci=Ot?"touchmove":"mousemove",Oi=Ot?"touchend touchcancel":"mouseup",Ht=Nt?"pointerdown":Ti,Wt=Nt?"pointermove":Ci,jt=Nt?"pointerup pointercancel":Oi,Ut="ready",Vt="resize",Gt="wheel",Tt="zoom",$t="image/jpeg",Ni=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Ai=/^data:/,Si=/^data:image\/jpeg;base64,/,Ri=/^img|canvas$/i,oi=200,si=100,qt={viewMode:0,dragMode:St,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:oi,minContainerHeight:si,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},_i='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>',Ii=Number.isNaN||k.isNaN;function u(a){return typeof a=="number"&&!Ii(a)}var Ft=function(t){return t>0&&t<1/0};function gt(a){return typeof a>"u"}function F(a){return vt(a)==="object"&&a!==null}var Li=Object.prototype.hasOwnProperty;function Q(a){if(!F(a))return!1;try{var t=a.constructor,e=t.prototype;return t&&e&&Li.call(e,"isPrototypeOf")}catch{return!1}}function A(a){return typeof a=="function"}var Bi=Array.prototype.slice;function hi(a){return Array.from?Array.from(a):Bi.call(a)}function E(a,t){return a&&A(t)&&(Array.isArray(a)||u(a.length)?hi(a).forEach(function(e,i){t.call(a,e,i,a)}):F(a)&&Object.keys(a).forEach(function(e){t.call(a,a[e],e,a)})),a}var x=Object.assign||function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),o=1;o<e;o++)i[o-1]=arguments[o];return F(t)&&i.length>0&&i.forEach(function(r){F(r)&&Object.keys(r).forEach(function(n){t[n]=r[n]})}),t},Pi=/\.\d*(?:0|9){12}\d*$/;function J(a){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return Pi.test(a)?Math.round(a*t)/t:a}var ki=/^width|height|left|top|marginLeft|marginTop$/;function W(a,t){var e=a.style;E(t,function(i,o){ki.test(o)&&u(i)&&(i="".concat(i,"px")),e[o]=i})}function Yi(a,t){return a.classList?a.classList.contains(t):a.className.indexOf(t)>-1}function O(a,t){if(t){if(u(a.length)){E(a,function(i){O(i,t)});return}if(a.classList){a.classList.add(t);return}var e=a.className.trim();e?e.indexOf(t)<0&&(a.className="".concat(e," ").concat(t)):a.className=t}}function P(a,t){if(t){if(u(a.length)){E(a,function(e){P(e,t)});return}if(a.classList){a.classList.remove(t);return}a.className.indexOf(t)>=0&&(a.className=a.className.replace(t,""))}}function Z(a,t,e){if(t){if(u(a.length)){E(a,function(i){Z(i,t,e)});return}e?O(a,t):P(a,t)}}var zi=/([a-z\d])([A-Z])/g;function Rt(a){return a.replace(zi,"$1-$2").toLowerCase()}function Ct(a,t){return F(a[t])?a[t]:a.dataset?a.dataset[t]:a.getAttribute("data-".concat(Rt(t)))}function st(a,t,e){F(e)?a[t]=e:a.dataset?a.dataset[t]=e:a.setAttribute("data-".concat(Rt(t)),e)}function Xi(a,t){if(F(a[t]))try{delete a[t]}catch{a[t]=void 0}else if(a.dataset)try{delete a.dataset[t]}catch{a.dataset[t]=void 0}else a.removeAttribute("data-".concat(Rt(t)))}var ci=/\s\s*/,li=(function(){var a=!1;if(dt){var t=!1,e=function(){},i=Object.defineProperty({},"once",{get:function(){return a=!0,t},set:function(r){t=r}});k.addEventListener("test",e,i),k.removeEventListener("test",e,i)}return a})();function L(a,t,e){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=e;t.trim().split(ci).forEach(function(r){if(!li){var n=a.listeners;n&&n[r]&&n[r][e]&&(o=n[r][e],delete n[r][e],Object.keys(n[r]).length===0&&delete n[r],Object.keys(n).length===0&&delete a.listeners)}a.removeEventListener(r,o,i)})}function I(a,t,e){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=e;t.trim().split(ci).forEach(function(r){if(i.once&&!li){var n=a.listeners,s=n===void 0?{}:n;o=function(){delete s[r][e],a.removeEventListener(r,o,i);for(var l=arguments.length,h=new Array(l),c=0;c<l;c++)h[c]=arguments[c];e.apply(a,h)},s[r]||(s[r]={}),s[r][e]&&a.removeEventListener(r,s[r][e],i),s[r][e]=o,a.listeners=s}a.addEventListener(r,o,i)})}function tt(a,t,e){var i;return A(Event)&&A(CustomEvent)?i=new CustomEvent(t,{detail:e,bubbles:!0,cancelable:!0}):(i=document.createEvent("CustomEvent"),i.initCustomEvent(t,!0,!0,e)),a.dispatchEvent(i)}function fi(a){var t=a.getBoundingClientRect();return{left:t.left+(window.pageXOffset-document.documentElement.clientLeft),top:t.top+(window.pageYOffset-document.documentElement.clientTop)}}var mt=k.location,Hi=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function Kt(a){var t=a.match(Hi);return t!==null&&(t[1]!==mt.protocol||t[2]!==mt.hostname||t[3]!==mt.port)}function Qt(a){var t="timestamp=".concat(new Date().getTime());return a+(a.indexOf("?")===-1?"?":"&")+t}function nt(a){var t=a.rotate,e=a.scaleX,i=a.scaleY,o=a.translateX,r=a.translateY,n=[];u(o)&&o!==0&&n.push("translateX(".concat(o,"px)")),u(r)&&r!==0&&n.push("translateY(".concat(r,"px)")),u(t)&&t!==0&&n.push("rotate(".concat(t,"deg)")),u(e)&&e!==1&&n.push("scaleX(".concat(e,")")),u(i)&&i!==1&&n.push("scaleY(".concat(i,")"));var s=n.length?n.join(" "):"none";return{WebkitTransform:s,msTransform:s,transform:s}}function Wi(a){var t=Zt({},a),e=0;return E(a,function(i,o){delete t[o],E(t,function(r){var n=Math.abs(i.startX-r.startX),s=Math.abs(i.startY-r.startY),d=Math.abs(i.endX-r.endX),l=Math.abs(i.endY-r.endY),h=Math.sqrt(n*n+s*s),c=Math.sqrt(d*d+l*l),f=(c-h)/h;Math.abs(f)>Math.abs(e)&&(e=f)})}),e}function lt(a,t){var e=a.pageX,i=a.pageY,o={endX:e,endY:i};return t?o:Zt({startX:e,startY:i},o)}function ji(a){var t=0,e=0,i=0;return E(a,function(o){var r=o.startX,n=o.startY;t+=r,e+=n,i+=1}),t/=i,e/=i,{pageX:t,pageY:e}}function j(a){var t=a.aspectRatio,e=a.height,i=a.width,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",r=Ft(i),n=Ft(e);if(r&&n){var s=e*t;o==="contain"&&s>i||o==="cover"&&s<i?e=i/t:i=e*t}else r?e=i/t:n&&(i=e*t);return{width:i,height:e}}function Ui(a){var t=a.width,e=a.height,i=a.degree;if(i=Math.abs(i)%180,i===90)return{width:e,height:t};var o=i%90*Math.PI/180,r=Math.sin(o),n=Math.cos(o),s=t*n+e*r,d=t*r+e*n;return i>90?{width:d,height:s}:{width:s,height:d}}function Vi(a,t,e,i){var o=t.aspectRatio,r=t.naturalWidth,n=t.naturalHeight,s=t.rotate,d=s===void 0?0:s,l=t.scaleX,h=l===void 0?1:l,c=t.scaleY,f=c===void 0?1:c,m=e.aspectRatio,g=e.naturalWidth,b=e.naturalHeight,v=i.fillColor,M=v===void 0?"transparent":v,C=i.imageSmoothingEnabled,D=C===void 0?!0:C,Y=i.imageSmoothingQuality,R=Y===void 0?"low":Y,p=i.maxWidth,w=p===void 0?1/0:p,T=i.maxHeight,_=T===void 0?1/0:T,z=i.minWidth,U=z===void 0?0:z,V=i.minHeight,X=V===void 0?0:V,B=document.createElement("canvas"),N=B.getContext("2d"),G=j({aspectRatio:m,width:w,height:_}),ht=j({aspectRatio:m,width:U,height:X},"cover"),pt=Math.min(G.width,Math.max(ht.width,g)),ut=Math.min(G.height,Math.max(ht.height,b)),_t=j({aspectRatio:o,width:w,height:_}),It=j({aspectRatio:o,width:U,height:X},"cover"),Lt=Math.min(_t.width,Math.max(It.width,r)),Bt=Math.min(_t.height,Math.max(It.height,n)),ui=[-Lt/2,-Bt/2,Lt,Bt];return B.width=J(pt),B.height=J(ut),N.fillStyle=M,N.fillRect(0,0,pt,ut),N.save(),N.translate(pt/2,ut/2),N.rotate(d*Math.PI/180),N.scale(h,f),N.imageSmoothingEnabled=D,N.imageSmoothingQuality=R,N.drawImage.apply(N,[a].concat(ti(ui.map(function(gi){return Math.floor(J(gi))})))),N.restore(),B}var di=String.fromCharCode;function Gi(a,t,e){var i="";e+=t;for(var o=t;o<e;o+=1)i+=di(a.getUint8(o));return i}var $i=/^data:.*,/;function qi(a){var t=a.replace($i,""),e=atob(t),i=new ArrayBuffer(e.length),o=new Uint8Array(i);return E(o,function(r,n){o[n]=e.charCodeAt(n)}),i}function Fi(a,t){for(var e=[],i=8192,o=new Uint8Array(a);o.length>0;)e.push(di.apply(null,hi(o.subarray(0,i)))),o=o.subarray(i);return"data:".concat(t,";base64,").concat(btoa(e.join("")))}function Ki(a){var t=new DataView(a),e;try{var i,o,r;if(t.getUint8(0)===255&&t.getUint8(1)===216)for(var n=t.byteLength,s=2;s+1<n;){if(t.getUint8(s)===255&&t.getUint8(s+1)===225){o=s;break}s+=1}if(o){var d=o+4,l=o+10;if(Gi(t,d,4)==="Exif"){var h=t.getUint16(l);if(i=h===18761,(i||h===19789)&&t.getUint16(l+2,i)===42){var c=t.getUint32(l+4,i);c>=8&&(r=l+c)}}}if(r){var f=t.getUint16(r,i),m,g;for(g=0;g<f;g+=1)if(m=r+g*12+2,t.getUint16(m,i)===274){m+=8,e=t.getUint16(m,i),t.setUint16(m,1,i);break}}}catch{e=1}return e}function Qi(a){var t=0,e=1,i=1;switch(a){case 2:e=-1;break;case 3:t=-180;break;case 4:i=-1;break;case 5:t=90,i=-1;break;case 6:t=90;break;case 7:t=90,e=-1;break;case 8:t=-90;break}return{rotate:t,scaleX:e,scaleY:i}}var Zi={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var t=this.element,e=this.options,i=this.container,o=this.cropper,r=Number(e.minContainerWidth),n=Number(e.minContainerHeight);O(o,S),P(t,S);var s={width:Math.max(i.offsetWidth,r>=0?r:oi),height:Math.max(i.offsetHeight,n>=0?n:si)};this.containerData=s,W(o,{width:s.width,height:s.height}),O(t,S),P(o,S)},initCanvas:function(){var t=this.containerData,e=this.imageData,i=this.options.viewMode,o=Math.abs(e.rotate)%180===90,r=o?e.naturalHeight:e.naturalWidth,n=o?e.naturalWidth:e.naturalHeight,s=r/n,d=t.width,l=t.height;t.height*s>t.width?i===3?d=t.height*s:l=t.width/s:i===3?l=t.width/s:d=t.height*s;var h={aspectRatio:s,naturalWidth:r,naturalHeight:n,width:d,height:l};this.canvasData=h,this.limited=i===1||i===2,this.limitCanvas(!0,!0),h.width=Math.min(Math.max(h.width,h.minWidth),h.maxWidth),h.height=Math.min(Math.max(h.height,h.minHeight),h.maxHeight),h.left=(t.width-h.width)/2,h.top=(t.height-h.height)/2,h.oldLeft=h.left,h.oldTop=h.top,this.initialCanvasData=x({},h)},limitCanvas:function(t,e){var i=this.options,o=this.containerData,r=this.canvasData,n=this.cropBoxData,s=i.viewMode,d=r.aspectRatio,l=this.cropped&&n;if(t){var h=Number(i.minCanvasWidth)||0,c=Number(i.minCanvasHeight)||0;s>1?(h=Math.max(h,o.width),c=Math.max(c,o.height),s===3&&(c*d>h?h=c*d:c=h/d)):s>0&&(h?h=Math.max(h,l?n.width:0):c?c=Math.max(c,l?n.height:0):l&&(h=n.width,c=n.height,c*d>h?h=c*d:c=h/d));var f=j({aspectRatio:d,width:h,height:c});h=f.width,c=f.height,r.minWidth=h,r.minHeight=c,r.maxWidth=1/0,r.maxHeight=1/0}if(e)if(s>(l?0:1)){var m=o.width-r.width,g=o.height-r.height;r.minLeft=Math.min(0,m),r.minTop=Math.min(0,g),r.maxLeft=Math.max(0,m),r.maxTop=Math.max(0,g),l&&this.limited&&(r.minLeft=Math.min(n.left,n.left+(n.width-r.width)),r.minTop=Math.min(n.top,n.top+(n.height-r.height)),r.maxLeft=n.left,r.maxTop=n.top,s===2&&(r.width>=o.width&&(r.minLeft=Math.min(0,m),r.maxLeft=Math.max(0,m)),r.height>=o.height&&(r.minTop=Math.min(0,g),r.maxTop=Math.max(0,g))))}else r.minLeft=-r.width,r.minTop=-r.height,r.maxLeft=o.width,r.maxTop=o.height},renderCanvas:function(t,e){var i=this.canvasData,o=this.imageData;if(e){var r=Ui({width:o.naturalWidth*Math.abs(o.scaleX||1),height:o.naturalHeight*Math.abs(o.scaleY||1),degree:o.rotate||0}),n=r.width,s=r.height,d=i.width*(n/i.naturalWidth),l=i.height*(s/i.naturalHeight);i.left-=(d-i.width)/2,i.top-=(l-i.height)/2,i.width=d,i.height=l,i.aspectRatio=n/s,i.naturalWidth=n,i.naturalHeight=s,this.limitCanvas(!0,!1)}(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCanvas(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,W(this.canvas,x({width:i.width,height:i.height},nt({translateX:i.left,translateY:i.top}))),this.renderImage(t),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(t){var e=this.canvasData,i=this.imageData,o=i.naturalWidth*(e.width/e.naturalWidth),r=i.naturalHeight*(e.height/e.naturalHeight);x(i,{width:o,height:r,left:(e.width-o)/2,top:(e.height-r)/2}),W(this.image,x({width:i.width,height:i.height},nt(x({translateX:i.left,translateY:i.top},i)))),t&&this.output()},initCropBox:function(){var t=this.options,e=this.canvasData,i=t.aspectRatio||t.initialAspectRatio,o=Number(t.autoCropArea)||.8,r={width:e.width,height:e.height};i&&(e.height*i>e.width?r.height=r.width/i:r.width=r.height*i),this.cropBoxData=r,this.limitCropBox(!0,!0),r.width=Math.min(Math.max(r.width,r.minWidth),r.maxWidth),r.height=Math.min(Math.max(r.height,r.minHeight),r.maxHeight),r.width=Math.max(r.minWidth,r.width*o),r.height=Math.max(r.minHeight,r.height*o),r.left=e.left+(e.width-r.width)/2,r.top=e.top+(e.height-r.height)/2,r.oldLeft=r.left,r.oldTop=r.top,this.initialCropBoxData=x({},r)},limitCropBox:function(t,e){var i=this.options,o=this.containerData,r=this.canvasData,n=this.cropBoxData,s=this.limited,d=i.aspectRatio;if(t){var l=Number(i.minCropBoxWidth)||0,h=Number(i.minCropBoxHeight)||0,c=s?Math.min(o.width,r.width,r.width+r.left,o.width-r.left):o.width,f=s?Math.min(o.height,r.height,r.height+r.top,o.height-r.top):o.height;l=Math.min(l,o.width),h=Math.min(h,o.height),d&&(l&&h?h*d>l?h=l/d:l=h*d:l?h=l/d:h&&(l=h*d),f*d>c?f=c/d:c=f*d),n.minWidth=Math.min(l,c),n.minHeight=Math.min(h,f),n.maxWidth=c,n.maxHeight=f}e&&(s?(n.minLeft=Math.max(0,r.left),n.minTop=Math.max(0,r.top),n.maxLeft=Math.min(o.width,r.left+r.width)-n.width,n.maxTop=Math.min(o.height,r.top+r.height)-n.height):(n.minLeft=0,n.minTop=0,n.maxLeft=o.width-n.width,n.maxTop=o.height-n.height))},renderCropBox:function(){var t=this.options,e=this.containerData,i=this.cropBoxData;(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCropBox(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,t.movable&&t.cropBoxMovable&&st(this.face,ot,i.width>=e.width&&i.height>=e.height?ei:At),W(this.cropBox,x({width:i.width,height:i.height},nt({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),tt(this.element,xt,this.getData())}},Ji={initPreview:function(){var t=this.element,e=this.crossOrigin,i=this.options.preview,o=e?this.crossOriginUrl:this.url,r=t.alt||"The image to preview",n=document.createElement("img");if(e&&(n.crossOrigin=e),n.src=o,n.alt=r,this.viewBox.appendChild(n),this.viewBoxImage=n,!!i){var s=i;typeof i=="string"?s=t.ownerDocument.querySelectorAll(i):i.querySelector&&(s=[i]),this.previews=s,E(s,function(d){var l=document.createElement("img");st(d,ct,{width:d.offsetWidth,height:d.offsetHeight,html:d.innerHTML}),e&&(l.crossOrigin=e),l.src=o,l.alt=r,l.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',d.innerHTML="",d.appendChild(l)})}},resetPreview:function(){E(this.previews,function(t){var e=Ct(t,ct);W(t,{width:e.width,height:e.height}),t.innerHTML=e.html,Xi(t,ct)})},preview:function(){var t=this.imageData,e=this.canvasData,i=this.cropBoxData,o=i.width,r=i.height,n=t.width,s=t.height,d=i.left-e.left-t.left,l=i.top-e.top-t.top;!this.cropped||this.disabled||(W(this.viewBoxImage,x({width:n,height:s},nt(x({translateX:-d,translateY:-l},t)))),E(this.previews,function(h){var c=Ct(h,ct),f=c.width,m=c.height,g=f,b=m,v=1;o&&(v=f/o,b=r*v),r&&b>m&&(v=m/r,g=o*v,b=m),W(h,{width:g,height:b}),W(h.getElementsByTagName("img")[0],x({width:n*v,height:s*v},nt(x({translateX:-d*v,translateY:-l*v},t))))}))}},te={bind:function(){var t=this.element,e=this.options,i=this.cropper;A(e.cropstart)&&I(t,Mt,e.cropstart),A(e.cropmove)&&I(t,Et,e.cropmove),A(e.cropend)&&I(t,Dt,e.cropend),A(e.crop)&&I(t,xt,e.crop),A(e.zoom)&&I(t,Tt,e.zoom),I(i,Ht,this.onCropStart=this.cropStart.bind(this)),e.zoomable&&e.zoomOnWheel&&I(i,Gt,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&I(i,Xt,this.onDblclick=this.dblclick.bind(this)),I(t.ownerDocument,Wt,this.onCropMove=this.cropMove.bind(this)),I(t.ownerDocument,jt,this.onCropEnd=this.cropEnd.bind(this)),e.responsive&&I(window,Vt,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,e=this.options,i=this.cropper;A(e.cropstart)&&L(t,Mt,e.cropstart),A(e.cropmove)&&L(t,Et,e.cropmove),A(e.cropend)&&L(t,Dt,e.cropend),A(e.crop)&&L(t,xt,e.crop),A(e.zoom)&&L(t,Tt,e.zoom),L(i,Ht,this.onCropStart),e.zoomable&&e.zoomOnWheel&&L(i,Gt,this.onWheel,{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&L(i,Xt,this.onDblclick),L(t.ownerDocument,Wt,this.onCropMove),L(t.ownerDocument,jt,this.onCropEnd),e.responsive&&L(window,Vt,this.onResize)}},ie={resize:function(){if(!this.disabled){var t=this.options,e=this.container,i=this.containerData,o=e.offsetWidth/i.width,r=e.offsetHeight/i.height,n=Math.abs(o-1)>Math.abs(r-1)?o:r;if(n!==1){var s,d;t.restore&&(s=this.getCanvasData(),d=this.getCropBoxData()),this.render(),t.restore&&(this.setCanvasData(E(s,function(l,h){s[h]=l*n})),this.setCropBoxData(E(d,function(l,h){d[h]=l*n})))}}},dblclick:function(){this.disabled||this.options.dragMode===ni||this.setDragMode(Yi(this.dragBox,bt)?ri:St)},wheel:function(t){var e=this,i=Number(this.options.wheelZoomRatio)||.1,o=1;this.disabled||(t.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){e.wheeling=!1},50),t.deltaY?o=t.deltaY>0?1:-1:t.wheelDelta?o=-t.wheelDelta/120:t.detail&&(o=t.detail>0?1:-1),this.zoom(-o*i,t)))},cropStart:function(t){var e=t.buttons,i=t.button;if(!(this.disabled||(t.type==="mousedown"||t.type==="pointerdown"&&t.pointerType==="mouse")&&(u(e)&&e!==1||u(i)&&i!==0||t.ctrlKey))){var o=this.options,r=this.pointers,n;t.changedTouches?E(t.changedTouches,function(s){r[s.identifier]=lt(s)}):r[t.pointerId||0]=lt(t),Object.keys(r).length>1&&o.zoomable&&o.zoomOnTouch?n=ai:n=Ct(t.target,ot),Ni.test(n)&&tt(this.element,Mt,{originalEvent:t,action:n})!==!1&&(t.preventDefault(),this.action=n,this.cropping=!1,n===ii&&(this.cropping=!0,O(this.dragBox,ft)))}},cropMove:function(t){var e=this.action;if(!(this.disabled||!e)){var i=this.pointers;t.preventDefault(),tt(this.element,Et,{originalEvent:t,action:e})!==!1&&(t.changedTouches?E(t.changedTouches,function(o){x(i[o.identifier]||{},lt(o,!0))}):x(i[t.pointerId||0]||{},lt(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var e=this.action,i=this.pointers;t.changedTouches?E(t.changedTouches,function(o){delete i[o.identifier]}):delete i[t.pointerId||0],e&&(t.preventDefault(),Object.keys(i).length||(this.action=""),this.cropping&&(this.cropping=!1,Z(this.dragBox,ft,this.cropped&&this.options.modal)),tt(this.element,Dt,{originalEvent:t,action:e}))}}},ee={change:function(t){var e=this.options,i=this.canvasData,o=this.containerData,r=this.cropBoxData,n=this.pointers,s=this.action,d=e.aspectRatio,l=r.left,h=r.top,c=r.width,f=r.height,m=l+c,g=h+f,b=0,v=0,M=o.width,C=o.height,D=!0,Y;!d&&t.shiftKey&&(d=c&&f?c/f:1),this.limited&&(b=r.minLeft,v=r.minTop,M=b+Math.min(o.width,i.width,i.left+i.width),C=v+Math.min(o.height,i.height,i.top+i.height));var R=n[Object.keys(n)[0]],p={x:R.endX-R.startX,y:R.endY-R.startY},w=function(_){switch(_){case $:m+p.x>M&&(p.x=M-m);break;case q:l+p.x<b&&(p.x=b-l);break;case H:h+p.y<v&&(p.y=v-h);break;case K:g+p.y>C&&(p.y=C-g);break}};switch(s){case At:l+=p.x,h+=p.y;break;case $:if(p.x>=0&&(m>=M||d&&(h<=v||g>=C))){D=!1;break}w($),c+=p.x,c<0&&(s=q,c=-c,l-=c),d&&(f=c/d,h+=(r.height-f)/2);break;case H:if(p.y<=0&&(h<=v||d&&(l<=b||m>=M))){D=!1;break}w(H),f-=p.y,h+=p.y,f<0&&(s=K,f=-f,h-=f),d&&(c=f*d,l+=(r.width-c)/2);break;case q:if(p.x<=0&&(l<=b||d&&(h<=v||g>=C))){D=!1;break}w(q),c-=p.x,l+=p.x,c<0&&(s=$,c=-c,l-=c),d&&(f=c/d,h+=(r.height-f)/2);break;case K:if(p.y>=0&&(g>=C||d&&(l<=b||m>=M))){D=!1;break}w(K),f+=p.y,f<0&&(s=H,f=-f,h-=f),d&&(c=f*d,l+=(r.width-c)/2);break;case it:if(d){if(p.y<=0&&(h<=v||m>=M)){D=!1;break}w(H),f-=p.y,h+=p.y,c=f*d}else w(H),w($),p.x>=0?m<M?c+=p.x:p.y<=0&&h<=v&&(D=!1):c+=p.x,p.y<=0?h>v&&(f-=p.y,h+=p.y):(f-=p.y,h+=p.y);c<0&&f<0?(s=rt,f=-f,c=-c,h-=f,l-=c):c<0?(s=et,c=-c,l-=c):f<0&&(s=at,f=-f,h-=f);break;case et:if(d){if(p.y<=0&&(h<=v||l<=b)){D=!1;break}w(H),f-=p.y,h+=p.y,c=f*d,l+=r.width-c}else w(H),w(q),p.x<=0?l>b?(c-=p.x,l+=p.x):p.y<=0&&h<=v&&(D=!1):(c-=p.x,l+=p.x),p.y<=0?h>v&&(f-=p.y,h+=p.y):(f-=p.y,h+=p.y);c<0&&f<0?(s=at,f=-f,c=-c,h-=f,l-=c):c<0?(s=it,c=-c,l-=c):f<0&&(s=rt,f=-f,h-=f);break;case rt:if(d){if(p.x<=0&&(l<=b||g>=C)){D=!1;break}w(q),c-=p.x,l+=p.x,f=c/d}else w(K),w(q),p.x<=0?l>b?(c-=p.x,l+=p.x):p.y>=0&&g>=C&&(D=!1):(c-=p.x,l+=p.x),p.y>=0?g<C&&(f+=p.y):f+=p.y;c<0&&f<0?(s=it,f=-f,c=-c,h-=f,l-=c):c<0?(s=at,c=-c,l-=c):f<0&&(s=et,f=-f,h-=f);break;case at:if(d){if(p.x>=0&&(m>=M||g>=C)){D=!1;break}w($),c+=p.x,f=c/d}else w(K),w($),p.x>=0?m<M?c+=p.x:p.y>=0&&g>=C&&(D=!1):c+=p.x,p.y>=0?g<C&&(f+=p.y):f+=p.y;c<0&&f<0?(s=et,f=-f,c=-c,h-=f,l-=c):c<0?(s=rt,c=-c,l-=c):f<0&&(s=it,f=-f,h-=f);break;case ei:this.move(p.x,p.y),D=!1;break;case ai:this.zoom(Wi(n),t),D=!1;break;case ii:if(!p.x||!p.y){D=!1;break}Y=fi(this.cropper),l=R.startX-Y.left,h=R.startY-Y.top,c=r.minWidth,f=r.minHeight,p.x>0?s=p.y>0?at:it:p.x<0&&(l-=c,s=p.y>0?rt:et),p.y<0&&(h-=f),this.cropped||(P(this.cropBox,S),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}D&&(r.width=c,r.height=f,r.left=l,r.top=h,this.action=s,this.renderCropBox()),E(n,function(T){T.startX=T.endX,T.startY=T.endY})}},ae={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&O(this.dragBox,ft),P(this.cropBox,S),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=x({},this.initialImageData),this.canvasData=x({},this.initialCanvasData),this.cropBoxData=x({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(x(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),P(this.dragBox,ft),O(this.cropBox,S)),this},replace:function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&t&&(this.isImg&&(this.element.src=t),e?(this.url=t,this.image.src=t,this.ready&&(this.viewBoxImage.src=t,E(this.previews,function(i){i.getElementsByTagName("img")[0].src=t}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(t))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,P(this.cropper,Yt)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,O(this.cropper,Yt)),this},destroy:function(){var t=this.element;return t[y]?(t[y]=void 0,this.isImg&&this.replaced&&(t.src=this.originalUrl),this.uncreate(),this):this},move:function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,i=this.canvasData,o=i.left,r=i.top;return this.moveTo(gt(t)?t:o+Number(t),gt(e)?e:r+Number(e))},moveTo:function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,i=this.canvasData,o=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.movable&&(u(t)&&(i.left=t,o=!0),u(e)&&(i.top=e,o=!0),o&&this.renderCanvas(!0)),this},zoom:function(t,e){var i=this.canvasData;return t=Number(t),t<0?t=1/(1-t):t=1+t,this.zoomTo(i.width*t/i.naturalWidth,null,e)},zoomTo:function(t,e,i){var o=this.options,r=this.canvasData,n=r.width,s=r.height,d=r.naturalWidth,l=r.naturalHeight;if(t=Number(t),t>=0&&this.ready&&!this.disabled&&o.zoomable){var h=d*t,c=l*t;if(tt(this.element,Tt,{ratio:t,oldRatio:n/d,originalEvent:i})===!1)return this;if(i){var f=this.pointers,m=fi(this.cropper),g=f&&Object.keys(f).length?ji(f):{pageX:i.pageX,pageY:i.pageY};r.left-=(h-n)*((g.pageX-m.left-r.left)/n),r.top-=(c-s)*((g.pageY-m.top-r.top)/s)}else Q(e)&&u(e.x)&&u(e.y)?(r.left-=(h-n)*((e.x-r.left)/n),r.top-=(c-s)*((e.y-r.top)/s)):(r.left-=(h-n)/2,r.top-=(c-s)/2);r.width=h,r.height=c,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return t=Number(t),u(t)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.renderCanvas(!0,!0)),this},scaleX:function(t){var e=this.imageData.scaleY;return this.scale(t,u(e)?e:1)},scaleY:function(t){var e=this.imageData.scaleX;return this.scale(u(e)?e:1,t)},scale:function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,i=this.imageData,o=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.scalable&&(u(t)&&(i.scaleX=t,o=!0),u(e)&&(i.scaleY=e,o=!0),o&&this.renderCanvas(!0,!0)),this},getData:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.options,i=this.imageData,o=this.canvasData,r=this.cropBoxData,n;if(this.ready&&this.cropped){n={x:r.left-o.left,y:r.top-o.top,width:r.width,height:r.height};var s=i.width/i.naturalWidth;if(E(n,function(h,c){n[c]=h/s}),t){var d=Math.round(n.y+n.height),l=Math.round(n.x+n.width);n.x=Math.round(n.x),n.y=Math.round(n.y),n.width=l-n.x,n.height=d-n.y}}else n={x:0,y:0,width:0,height:0};return e.rotatable&&(n.rotate=i.rotate||0),e.scalable&&(n.scaleX=i.scaleX||1,n.scaleY=i.scaleY||1),n},setData:function(t){var e=this.options,i=this.imageData,o=this.canvasData,r={};if(this.ready&&!this.disabled&&Q(t)){var n=!1;e.rotatable&&u(t.rotate)&&t.rotate!==i.rotate&&(i.rotate=t.rotate,n=!0),e.scalable&&(u(t.scaleX)&&t.scaleX!==i.scaleX&&(i.scaleX=t.scaleX,n=!0),u(t.scaleY)&&t.scaleY!==i.scaleY&&(i.scaleY=t.scaleY,n=!0)),n&&this.renderCanvas(!0,!0);var s=i.width/i.naturalWidth;u(t.x)&&(r.left=t.x*s+o.left),u(t.y)&&(r.top=t.y*s+o.top),u(t.width)&&(r.width=t.width*s),u(t.height)&&(r.height=t.height*s),this.setCropBoxData(r)}return this},getContainerData:function(){return this.ready?x({},this.containerData):{}},getImageData:function(){return this.sized?x({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,e={};return this.ready&&E(["left","top","width","height","naturalWidth","naturalHeight"],function(i){e[i]=t[i]}),e},setCanvasData:function(t){var e=this.canvasData,i=e.aspectRatio;return this.ready&&!this.disabled&&Q(t)&&(u(t.left)&&(e.left=t.left),u(t.top)&&(e.top=t.top),u(t.width)?(e.width=t.width,e.height=t.width/i):u(t.height)&&(e.height=t.height,e.width=t.height*i),this.renderCanvas(!0)),this},getCropBoxData:function(){var t=this.cropBoxData,e;return this.ready&&this.cropped&&(e={left:t.left,top:t.top,width:t.width,height:t.height}),e||{}},setCropBoxData:function(t){var e=this.cropBoxData,i=this.options.aspectRatio,o,r;return this.ready&&this.cropped&&!this.disabled&&Q(t)&&(u(t.left)&&(e.left=t.left),u(t.top)&&(e.top=t.top),u(t.width)&&t.width!==e.width&&(o=!0,e.width=t.width),u(t.height)&&t.height!==e.height&&(r=!0,e.height=t.height),i&&(o?e.height=e.width/i:r&&(e.width=e.height*i)),this.renderCropBox()),this},getCroppedCanvas:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var e=this.canvasData,i=Vi(this.image,this.imageData,e,t);if(!this.cropped)return i;var o=this.getData(t.rounded),r=o.x,n=o.y,s=o.width,d=o.height,l=i.width/Math.floor(e.naturalWidth);l!==1&&(r*=l,n*=l,s*=l,d*=l);var h=s/d,c=j({aspectRatio:h,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),f=j({aspectRatio:h,width:t.minWidth||0,height:t.minHeight||0},"cover"),m=j({aspectRatio:h,width:t.width||(l!==1?i.width:s),height:t.height||(l!==1?i.height:d)}),g=m.width,b=m.height;g=Math.min(c.width,Math.max(f.width,g)),b=Math.min(c.height,Math.max(f.height,b));var v=document.createElement("canvas"),M=v.getContext("2d");v.width=J(g),v.height=J(b),M.fillStyle=t.fillColor||"transparent",M.fillRect(0,0,g,b);var C=t.imageSmoothingEnabled,D=C===void 0?!0:C,Y=t.imageSmoothingQuality;M.imageSmoothingEnabled=D,Y&&(M.imageSmoothingQuality=Y);var R=i.width,p=i.height,w=r,T=n,_,z,U,V,X,B;w<=-s||w>R?(w=0,_=0,U=0,X=0):w<=0?(U=-w,w=0,_=Math.min(R,s+w),X=_):w<=R&&(U=0,_=Math.min(s,R-w),X=_),_<=0||T<=-d||T>p?(T=0,z=0,V=0,B=0):T<=0?(V=-T,T=0,z=Math.min(p,d+T),B=z):T<=p&&(V=0,z=Math.min(d,p-T),B=z);var N=[w,T,_,z];if(X>0&&B>0){var G=g/s;N.push(U*G,V*G,X*G,B*G)}return M.drawImage.apply(M,[i].concat(ti(N.map(function(ht){return Math.floor(J(ht))})))),v},setAspectRatio:function(t){var e=this.options;return!this.disabled&&!gt(t)&&(e.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(t){var e=this.options,i=this.dragBox,o=this.face;if(this.ready&&!this.disabled){var r=t===St,n=e.movable&&t===ri;t=r||n?t:ni,e.dragMode=t,st(i,ot,t),Z(i,bt,r),Z(i,yt,n),e.cropBoxMovable||(st(o,ot,t),Z(o,bt,r),Z(o,yt,n))}return this}},re=k.Cropper,pi=(function(){function a(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(vi(this,a),!t||!Ri.test(t.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=t,this.options=x({},qt,Q(e)&&e),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return wi(a,[{key:"init",value:function(){var e=this.element,i=e.tagName.toLowerCase(),o;if(!e[y]){if(e[y]=this,i==="img"){if(this.isImg=!0,o=e.getAttribute("src")||"",this.originalUrl=o,!o)return;o=e.src}else i==="canvas"&&window.HTMLCanvasElement&&(o=e.toDataURL());this.load(o)}}},{key:"load",value:function(e){var i=this;if(e){this.url=e,this.imageData={};var o=this.element,r=this.options;if(!r.rotatable&&!r.scalable&&(r.checkOrientation=!1),!r.checkOrientation||!window.ArrayBuffer){this.clone();return}if(Ai.test(e)){Si.test(e)?this.read(qi(e)):this.clone();return}var n=new XMLHttpRequest,s=this.clone.bind(this);this.reloading=!0,this.xhr=n,n.onabort=s,n.onerror=s,n.ontimeout=s,n.onprogress=function(){n.getResponseHeader("content-type")!==$t&&n.abort()},n.onload=function(){i.read(n.response)},n.onloadend=function(){i.reloading=!1,i.xhr=null},r.checkCrossOrigin&&Kt(e)&&o.crossOrigin&&(e=Qt(e)),n.open("GET",e,!0),n.responseType="arraybuffer",n.withCredentials=o.crossOrigin==="use-credentials",n.send()}}},{key:"read",value:function(e){var i=this.options,o=this.imageData,r=Ki(e),n=0,s=1,d=1;if(r>1){this.url=Fi(e,$t);var l=Qi(r);n=l.rotate,s=l.scaleX,d=l.scaleY}i.rotatable&&(o.rotate=n),i.scalable&&(o.scaleX=s,o.scaleY=d),this.clone()}},{key:"clone",value:function(){var e=this.element,i=this.url,o=e.crossOrigin,r=i;this.options.checkCrossOrigin&&Kt(i)&&(o||(o="anonymous"),r=Qt(i)),this.crossOrigin=o,this.crossOriginUrl=r;var n=document.createElement("img");o&&(n.crossOrigin=o),n.src=r||i,n.alt=e.alt||"The image to crop",this.image=n,n.onload=this.start.bind(this),n.onerror=this.stop.bind(this),O(n,zt),e.parentNode.insertBefore(n,e.nextSibling)}},{key:"start",value:function(){var e=this,i=this.image;i.onload=null,i.onerror=null,this.sizing=!0;var o=k.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(k.navigator.userAgent),r=function(l,h){x(e.imageData,{naturalWidth:l,naturalHeight:h,aspectRatio:l/h}),e.initialImageData=x({},e.imageData),e.sizing=!1,e.sized=!0,e.build()};if(i.naturalWidth&&!o){r(i.naturalWidth,i.naturalHeight);return}var n=document.createElement("img"),s=document.body||document.documentElement;this.sizingImage=n,n.onload=function(){r(n.width,n.height),o||s.removeChild(n)},n.src=i.src,o||(n.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",s.appendChild(n))}},{key:"stop",value:function(){var e=this.image;e.onload=null,e.onerror=null,e.parentNode.removeChild(e),this.image=null}},{key:"build",value:function(){if(!(!this.sized||this.ready)){var e=this.element,i=this.options,o=this.image,r=e.parentNode,n=document.createElement("div");n.innerHTML=_i;var s=n.querySelector(".".concat(y,"-container")),d=s.querySelector(".".concat(y,"-canvas")),l=s.querySelector(".".concat(y,"-drag-box")),h=s.querySelector(".".concat(y,"-crop-box")),c=h.querySelector(".".concat(y,"-face"));this.container=r,this.cropper=s,this.canvas=d,this.dragBox=l,this.cropBox=h,this.viewBox=s.querySelector(".".concat(y,"-view-box")),this.face=c,d.appendChild(o),O(e,S),r.insertBefore(s,e.nextSibling),P(o,zt),this.initPreview(),this.bind(),i.initialAspectRatio=Math.max(0,i.initialAspectRatio)||NaN,i.aspectRatio=Math.max(0,i.aspectRatio)||NaN,i.viewMode=Math.max(0,Math.min(3,Math.round(i.viewMode)))||0,O(h,S),i.guides||O(h.getElementsByClassName("".concat(y,"-dashed")),S),i.center||O(h.getElementsByClassName("".concat(y,"-center")),S),i.background&&O(s,"".concat(y,"-bg")),i.highlight||O(c,Mi),i.cropBoxMovable&&(O(c,yt),st(c,ot,At)),i.cropBoxResizable||(O(h.getElementsByClassName("".concat(y,"-line")),S),O(h.getElementsByClassName("".concat(y,"-point")),S)),this.render(),this.ready=!0,this.setDragMode(i.dragMode),i.autoCrop&&this.crop(),this.setData(i.data),A(i.ready)&&I(e,Ut,i.ready,{once:!0}),tt(e,Ut)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var e=this.cropper.parentNode;e&&e.removeChild(this.cropper),P(this.element,S)}}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=re,a}},{key:"setDefaults",value:function(e){x(qt,Q(e)&&e)}}])})();x(pi.prototype,Zi,Ji,te,ie,ee,ae);const ne=Object.freeze(Object.defineProperty({__proto__:null,default:pi},Symbol.toStringTag,{value:"Module"})),oe=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{oe as a,ne as c};
+2
static/js/event-map-BMN8EESL.js
··· 1 + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/maps-GDfHpVyJ.js","css/maps-CpDLi3o_.css"])))=>i.map(i=>d[i]); 2 + import{_ as d}from"./main-CuQd5Sql.js";const f=9;async function I(){const e=document.getElementById("event-map");if(e&&!(e.dataset.mapInitialized==="true"||e.dataset.mapInitializing==="true")){e.dataset.mapInitializing="true";try{const n=e.dataset.geoLocations;if(!n){e.dataset.mapInitializing="false";return}let u;try{u=JSON.parse(n)}catch(t){console.error("Failed to parse geo locations:",t),e.dataset.mapInitializing="false";return}const a=u.filter(t=>t!=null).map(t=>({latitude:typeof t.latitude=="string"?parseFloat(t.latitude):t.latitude,longitude:typeof t.longitude=="string"?parseFloat(t.longitude):t.longitude,name:t.name})).filter(t=>Number.isFinite(t.latitude)&&Number.isFinite(t.longitude));if(a.length===0){e.dataset.mapInitializing="false";return}const[o,p]=await Promise.all([d(()=>import("./maps-GDfHpVyJ.js").then(t=>t.l),__vite__mapDeps([0,1])).then(t=>t.default),d(()=>import("./maps-GDfHpVyJ.js").then(t=>t.h),__vite__mapDeps([0,1]))]);if(await d(()=>import("./maps-GDfHpVyJ.js").then(t=>t.a),__vite__mapDeps([0,1])),e.dataset.mapInitialized==="true"){e.dataset.mapInitializing="false";return}const g=a.reduce((t,i)=>t+i.latitude,0)/a.length,m=a.reduce((t,i)=>t+i.longitude,0)/a.length;if(!Number.isFinite(g)||!Number.isFinite(m)){e.dataset.mapInitializing="false";return}const l=o.map("event-map",{zoomControl:!0,scrollWheelZoom:!1,dragging:!0}).setView([g,m],16);o.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',maxZoom:19}).addTo(l);const s=[];if(a.forEach(t=>{const i=p.latLngToCell(t.latitude,t.longitude,f),c=p.cellToBoundary(i).map(r=>[r[0],r[1]]);c.forEach(r=>s.push(r)),o.polygon(c,{color:"#3273dc",fillColor:"#3273dc",fillOpacity:.2,weight:2,className:"h3-hex"}).addTo(l)}),s.length>0){const t=o.latLngBounds(s);l.fitBounds(t,{padding:[20,20]})}e.dataset.mapInitialized="true"}catch(n){console.error("Failed to initialize event map:",n)}finally{e.dataset.mapInitializing="false"}}}export{I as initEventMap};
+2
static/js/globe-map-v0wYAEFW.js
··· 1 + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/maps-GDfHpVyJ.js","css/maps-CpDLi3o_.css"])))=>i.map(i=>d[i]); 2 + import{_ as y}from"./main-CuQd5Sql.js";async function T(c){const m=(c==null?void 0:c.containerId)??"globe-map",v=(c==null?void 0:c.statusElementId)??"globe-status",u=document.getElementById(m),l=document.getElementById(v);if(u&&!(u.dataset.mapInitialized==="true"||u.dataset.mapInitializing==="true")){u.dataset.mapInitializing="true";try{let f=function(e,i){return i===0?"hsl(240, 70%, 50%)":`hsl(${240-e/i*180}, 70%, 50%)`},_=function(e,i){const o=h.cellToBoundary(e.key),r=h.cellToLatLng(e.key),n=o.map(([s,a])=>[a,s]);return n.push(n[0]),{type:"Feature",properties:{id:e.key,event_count:e.event_count??0,lfg_count:e.lfg_count??0,total:e.total??0,centerLat:r[0],centerLng:r[1],color:f(e.total??0,i)},geometry:{type:"Polygon",coordinates:[n]}}},b=function(){t=new p.Map({container:m,style:{version:8,projection:{type:"globe"},sources:{"carto-voyager":{type:"raster",tiles:["https://a.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png","https://b.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png","https://c.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png"],tileSize:256,attribution:'&copy; <a href="https://carto.com/attributions">CARTO</a>'}},layers:[{id:"background",type:"background",paint:{"background-color":"#e8e8e8"}},{id:"carto-voyager",type:"raster",source:"carto-voyager"}]},center:[-100,40],zoom:4,maxZoom:8,minZoom:1}),t.on("load",()=>{t&&(t.addSource("hexagons",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),t.addLayer({id:"hexagons-fill",type:"fill",source:"hexagons",paint:{"fill-color":["get","color"],"fill-opacity":.4}}),t.addLayer({id:"hexagons-outline",type:"line",source:"hexagons",paint:{"line-color":"#333","line-width":.5,"line-opacity":.4}}),g=new p.Popup({closeButton:!0,closeOnClick:!1}),t.on("click","hexagons-fill",e=>{const i=e.features;if(i&&i.length>0){const o=i[0].properties;let r=`<strong>Activity:</strong> ${o.total} total<br/>`;o.event_count>0&&(r+=`${o.event_count} event${o.event_count===1?"":"s"}<br/>`),o.lfg_count>0&&(r+=`${o.lfg_count} ${o.lfg_count===1?"person":"people"} LFG`),g==null||g.setLngLat([o.centerLng,o.centerLat]).setHTML(r).addTo(t)}}),t.on("mouseenter","hexagons-fill",()=>{t.getCanvas().style.cursor="pointer"}),t.on("mouseleave","hexagons-fill",()=>{t.getCanvas().style.cursor=""}),x())}),L()},L=function(){var e,i,o,r;(e=document.getElementById("focus-north-america"))==null||e.addEventListener("click",()=>{t==null||t.flyTo({center:[-100,40],zoom:4,duration:1500})}),(i=document.getElementById("focus-europe"))==null||i.addEventListener("click",()=>{t==null||t.flyTo({center:[10,50],zoom:4,duration:1500})}),(o=document.getElementById("focus-world"))==null||o.addEventListener("click",()=>{t==null||t.flyTo({center:[0,20],zoom:2,duration:1500})}),(r=document.getElementById("focus-my-location"))==null||r.addEventListener("click",()=>{const n=document.getElementById("focus-my-location");if(!n)return;const s=n.innerHTML;n.innerHTML='<span class="icon is-small"><i class="fas fa-spinner fa-pulse"></i></span><span>Locating...</span>',n.disabled=!0,navigator.geolocation?navigator.geolocation.getCurrentPosition(a=>{t==null||t.flyTo({center:[a.coords.longitude,a.coords.latitude],zoom:8,duration:1500}),n.innerHTML=s,n.disabled=!1},a=>{console.warn("Geolocation failed:",a.message),l&&(l.textContent="Could not get your location."),n.innerHTML=s,n.disabled=!1},{timeout:1e4,maximumAge:3e5}):(l&&(l.textContent="Geolocation not supported."),n.innerHTML=s,n.disabled=!1)})},x=function(){fetch("/api/globe-aggregation?resolution=5").then(e=>e.json()).then(e=>{if(!e.buckets||e.buckets.length===0){l&&(l.textContent="No activity found.");return}const i=Math.max(...e.buckets.map(a=>a.total??0)),o=[];e.buckets.forEach(a=>{try{o.push(_(a,i))}catch(d){console.warn("Failed to process hex:",a.key,d)}});const r=t==null?void 0:t.getSource("hexagons");r==null||r.setData({type:"FeatureCollection",features:o});const n=e.buckets.reduce((a,d)=>a+(d.event_count??0),0),s=e.buckets.reduce((a,d)=>a+(d.lfg_count??0),0);l&&(l.textContent=`${e.buckets.length} active regions: ${n} events, ${s} people LFG`)}).catch(e=>{console.error("Failed to load globe aggregation:",e),l&&(l.textContent="Failed to load activity data.")})};const[p,h]=await Promise.all([y(()=>import("./maps-GDfHpVyJ.js").then(e=>e.m),__vite__mapDeps([0,1])),y(()=>import("./maps-GDfHpVyJ.js").then(e=>e.h),__vite__mapDeps([0,1]))]);await y(()=>import("./maps-GDfHpVyJ.js").then(e=>e.b),__vite__mapDeps([0,1]));let t=null,g=null;b(),u.dataset.mapInitialized="true"}catch(f){console.error("Failed to initialize globe map:",f),l&&(l.textContent="Failed to load map.")}finally{u.dataset.mapInitializing="false"}}}export{T as initGlobeMap};
+2
static/js/heatmap-CJsCFdcC.js
··· 1 + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/maps-GDfHpVyJ.js","css/maps-CpDLi3o_.css"])))=>i.map(i=>d[i]); 2 + import{_ as c}from"./main-CuQd5Sql.js";async function B(){const o=document.getElementById("lfg-heatmap");if(o&&!(o.dataset.mapInitialized==="true"||o.dataset.mapInitializing==="true")){o.dataset.mapInitializing="true";try{const a=parseFloat(o.dataset.lat??"40.7128"),h=parseFloat(o.dataset.lon??"-74.006"),r=o.dataset.eventBuckets,l=o.dataset.profileBuckets,[i,y]=await Promise.all([c(()=>import("./maps-GDfHpVyJ.js").then(t=>t.l),__vite__mapDeps([0,1])).then(t=>t.default),c(()=>import("./maps-GDfHpVyJ.js").then(t=>t.h),__vite__mapDeps([0,1]))]);await c(()=>import("./maps-GDfHpVyJ.js").then(t=>t.a),__vite__mapDeps([0,1]));const d=i.map("lfg-heatmap").setView([a,h],12);i.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:"&copy; OpenStreetMap contributors"}).addTo(d);let m=[],f=[];try{r&&(m=JSON.parse(r)),l&&(f=JSON.parse(l))}catch(t){console.warn("Failed to parse heatmap buckets:",t)}const n=new Map;for(const t of m){const e=n.get(t.key)||{events:0,people:0};e.events=t.count,n.set(t.key,e)}for(const t of f){const e=n.get(t.key)||{events:0,people:0};e.people=t.count,n.set(t.key,e)}let s=0;n.forEach(t=>{const e=t.events+t.people;e>s&&(s=e)}),n.forEach((t,e)=>{try{const g=y.cellToBoundary(e).map(u=>[u[0],u[1]]),k=t.events+t.people,I=.2+Math.min(k/Math.max(s,1),1)*.5,p=[];t.events>0&&p.push(`${t.events} event${t.events!==1?"s":""}`),t.people>0&&p.push(`${t.people} ${t.people!==1?"people":"person"}`);const L=p.join(", ");i.polygon(g,{color:"#3273dc",fillColor:"#3273dc",fillOpacity:I,weight:1}).addTo(d).bindTooltip(L,{direction:"center"})}catch{console.warn("Invalid H3 cell:",e)}}),o.dataset.mapInitialized="true"}catch(a){console.error("Failed to initialize LFG heatmap:",a)}finally{o.dataset.mapInitializing="false"}}}export{B as initLfgHeatmap};
+2
static/js/index-BP1lDIcH.js
··· 1 + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/event-map-BMN8EESL.js","js/main-CuQd5Sql.js","css/main-DsS_JPFh.css","js/globe-map-v0wYAEFW.js","js/location-heatmap-qsLOB3hq.js"])))=>i.map(i=>d[i]); 2 + import{_ as i}from"./main-CuQd5Sql.js";async function o(){if(!document.getElementById("event-map"))return;const{initEventMap:t}=await i(async()=>{const{initEventMap:n}=await import("./event-map-BMN8EESL.js");return{initEventMap:n}},__vite__mapDeps([0,1,2]));await t()}async function e(){if(!document.getElementById("globe-map"))return;const{initGlobeMap:t}=await i(async()=>{const{initGlobeMap:n}=await import("./globe-map-v0wYAEFW.js");return{initGlobeMap:n}},__vite__mapDeps([3,1,2]));await t()}async function c(){if(!document.getElementById("location-heatmap"))return;const{initLocationHeatmap:t}=await i(async()=>{const{initLocationHeatmap:n}=await import("./location-heatmap-qsLOB3hq.js");return{initLocationHeatmap:n}},__vite__mapDeps([4,1,2]));await t()}function p(){o(),e(),c()}export{o as initEventMap,e as initGlobeMap,c as initLocationHeatmap,p as initMaps};
+2
static/js/index-Bcnf8oUZ.js
··· 1 + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/cropper-DyNc_82c.js","css/cropper-BJgXXBRK.css"])))=>i.map(i=>d[i]); 2 + import{_ as a}from"./main-CuQd5Sql.js";let t=null;async function o(){return t||(t=(async()=>{const[n]=await Promise.all([a(()=>import("./cropper-DyNc_82c.js").then(r=>r.c),__vite__mapDeps([0,1])),a(()=>import("./cropper-DyNc_82c.js").then(r=>r.a),__vite__mapDeps([0,1]))]),e=n.default;return window.Cropper=e,e})(),t)}async function s(){const n=document.getElementById("headerCanvas"),e=document.getElementById("thumbnailCanvas");!n&&!e||await o()}export{s as initCropper,o as loadCropper};
+2
static/js/location-heatmap-qsLOB3hq.js
··· 1 + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/maps-GDfHpVyJ.js","css/maps-CpDLi3o_.css"])))=>i.map(i=>d[i]); 2 + import{_}from"./main-CuQd5Sql.js";async function E(){const n=document.getElementById("location-heatmap");if(n&&!(n.dataset.mapInitialized==="true"||n.dataset.mapInitializing==="true")){n.dataset.mapInitializing="true";try{let h=function(e,c,r){if(r===c)return"#3273dc";const o=(e-c)/(r-c);if(o<.33){const t=o/.33;return f("#3273dc","#8957e5",t)}else if(o<.66){const t=(o-.33)/.33;return f("#8957e5","#f39c12",t)}else{const t=(o-.66)/.34;return f("#f39c12","#e74c3c",t)}},f=function(e,c,r){const o=parseInt(e.replace("#",""),16),t=parseInt(c.replace("#",""),16),a=o>>16,p=o>>8&255,g=o&255,y=t>>16,s=t>>8&255,u=t&255,m=Math.round(a+(y-a)*r),z=Math.round(p+(s-p)*r),k=Math.round(g+(u-g)*r);return"#"+(16777216+(m<<16)+(z<<8)+k).toString(16).slice(1)};const b=parseFloat(n.dataset.centerLat??"0"),C=parseFloat(n.dataset.centerLon??"0"),x=n.dataset.centerCell??"",I=n.dataset.geoBuckets;if(!I)return;let l;try{l=JSON.parse(I)}catch(e){console.error("Failed to parse geo buckets:",e);return}const[i,L]=await Promise.all([_(()=>import("./maps-GDfHpVyJ.js").then(e=>e.l),__vite__mapDeps([0,1])).then(e=>e.default),_(()=>import("./maps-GDfHpVyJ.js").then(e=>e.h),__vite__mapDeps([0,1]))]);await _(()=>import("./maps-GDfHpVyJ.js").then(e=>e.a),__vite__mapDeps([0,1]));const d=i.map("location-heatmap",{center:[b,C],zoom:9,zoomControl:!1,dragging:!1,touchZoom:!1,scrollWheelZoom:!1,doubleClickZoom:!1,boxZoom:!1,keyboard:!1,attributionControl:!0});if(i.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',maxZoom:19}).addTo(d),l&&l.length>0){const e=l.map(t=>t.doc_count??0),c=Math.min(...e),r=Math.max(...e);l.forEach(t=>{try{const a=t.key,p=t.doc_count??0,y=L.cellToBoundary(a).map(m=>[m[0],m[1]]),s=a===x,u=h(p,c,r);i.polygon(y,{color:s?"#1a1a1a":u,fillColor:u,fillOpacity:.5,weight:s?3:2,className:s?"h3-hex-center":"h3-hex"}).addTo(d)}catch(a){console.warn("Failed to draw hex:",t.key,a)}});const o=l.flatMap(t=>{try{return L.cellToBoundary(t.key).map(a=>[a[0],a[1]])}catch{return[]}});o.length>0&&d.fitBounds(o,{padding:[10,10]})}else i.marker([b,C]).addTo(d);n.dataset.mapInitialized="true"}catch(h){console.error("Failed to initialize location heatmap:",h)}finally{n.dataset.mapInitializing="false"}}}export{E as initLocationHeatmap};
+6
static/js/main-CuQd5Sql.js
··· 1 + const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/maps-GDfHpVyJ.js","css/maps-CpDLi3o_.css","js/profile-cropper-DwPaCPSP.js","js/index-Bcnf8oUZ.js"])))=>i.map(i=>d[i]); 2 + const scriptRel="modulepreload",assetsURL=function(e){return"/static/"+e},seen={},__vitePreload=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let s=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=s(n.map(c=>{if(c=assetsURL(c),c in seen)return;seen[c]=!0;const u=c.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":scriptRel,u||(d.as="script"),d.crossOrigin="",d.href=c,l&&d.setAttribute("nonce",l),document.head.appendChild(d),u)return new Promise((p,g)=>{d.addEventListener("load",p),d.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function o(s){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s}return i.then(s=>{for(const a of s||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})};var flushPending=!1,flushing=!1,queue=[],lastFlushedIndex=-1;function scheduler(e){queueJob(e)}function queueJob(e){queue.includes(e)||queue.push(e),queueFlush()}function dequeueJob(e){let t=queue.indexOf(e);t!==-1&&t>lastFlushedIndex&&queue.splice(t,1)}function queueFlush(){!flushing&&!flushPending&&(flushPending=!0,queueMicrotask(flushJobs))}function flushJobs(){flushPending=!1,flushing=!0;for(let e=0;e<queue.length;e++)queue[e](),lastFlushedIndex=e;queue.length=0,lastFlushedIndex=-1,flushing=!1}var reactive,effect,release,raw,shouldSchedule=!0;function disableEffectScheduling(e){shouldSchedule=!1,e(),shouldSchedule=!0}function setReactivityEngine(e){reactive=e.reactive,release=e.release,effect=t=>e.effect(t,{scheduler:n=>{shouldSchedule?scheduler(n):n()}}),raw=e.raw}function overrideEffect(e){effect=e}function elementBoundEffect(e){let t=()=>{};return[r=>{let i=effect(r);return e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(o=>o())}),e._x_effects.add(i),t=()=>{i!==void 0&&(e._x_effects.delete(i),release(i))},i},()=>{t()}]}function watch(e,t){let n=!0,r,i=effect(()=>{let o=e();JSON.stringify(o),n?r=o:queueMicrotask(()=>{t(o,r),r=o}),n=!1});return()=>release(i)}var onAttributeAddeds=[],onElRemoveds=[],onElAddeds=[];function onElAdded(e){onElAddeds.push(e)}function onElRemoved(e,t){typeof t=="function"?(e._x_cleanups||(e._x_cleanups=[]),e._x_cleanups.push(t)):(t=e,onElRemoveds.push(t))}function onAttributesAdded(e){onAttributeAddeds.push(e)}function onAttributeRemoved(e,t,n){e._x_attributeCleanups||(e._x_attributeCleanups={}),e._x_attributeCleanups[t]||(e._x_attributeCleanups[t]=[]),e._x_attributeCleanups[t].push(n)}function cleanupAttributes(e,t){e._x_attributeCleanups&&Object.entries(e._x_attributeCleanups).forEach(([n,r])=>{(t===void 0||t.includes(n))&&(r.forEach(i=>i()),delete e._x_attributeCleanups[n])})}function cleanupElement(e){var t,n;for((t=e._x_effects)==null||t.forEach(dequeueJob);(n=e._x_cleanups)!=null&&n.length;)e._x_cleanups.pop()()}var observer=new MutationObserver(onMutate),currentlyObserving=!1;function startObservingMutations(){observer.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),currentlyObserving=!0}function stopObservingMutations(){flushObserver(),observer.disconnect(),currentlyObserving=!1}var queuedMutations=[];function flushObserver(){let e=observer.takeRecords();queuedMutations.push(()=>e.length>0&&onMutate(e));let t=queuedMutations.length;queueMicrotask(()=>{if(queuedMutations.length===t)for(;queuedMutations.length>0;)queuedMutations.shift()()})}function mutateDom(e){if(!currentlyObserving)return e();stopObservingMutations();let t=e();return startObservingMutations(),t}var isCollecting=!1,deferredMutations=[];function deferMutations(){isCollecting=!0}function flushAndStopDeferringMutations(){isCollecting=!1,onMutate(deferredMutations),deferredMutations=[]}function onMutate(e){if(isCollecting){deferredMutations=deferredMutations.concat(e);return}let t=[],n=new Set,r=new Map,i=new Map;for(let o=0;o<e.length;o++)if(!e[o].target._x_ignoreMutationObserver&&(e[o].type==="childList"&&(e[o].removedNodes.forEach(s=>{s.nodeType===1&&s._x_marker&&n.add(s)}),e[o].addedNodes.forEach(s=>{if(s.nodeType===1){if(n.has(s)){n.delete(s);return}s._x_marker||t.push(s)}})),e[o].type==="attributes")){let s=e[o].target,a=e[o].attributeName,l=e[o].oldValue,c=()=>{r.has(s)||r.set(s,[]),r.get(s).push({name:a,value:s.getAttribute(a)})},u=()=>{i.has(s)||i.set(s,[]),i.get(s).push(a)};s.hasAttribute(a)&&l===null?c():s.hasAttribute(a)?(u(),c()):u()}i.forEach((o,s)=>{cleanupAttributes(s,o)}),r.forEach((o,s)=>{onAttributeAddeds.forEach(a=>a(s,o))});for(let o of n)t.some(s=>s.contains(o))||onElRemoveds.forEach(s=>s(o));for(let o of t)o.isConnected&&onElAddeds.forEach(s=>s(o));t=null,n=null,r=null,i=null}function scope(e){return mergeProxies(closestDataStack(e))}function addScopeToNode(e,t,n){return e._x_dataStack=[t,...closestDataStack(n||e)],()=>{e._x_dataStack=e._x_dataStack.filter(r=>r!==t)}}function closestDataStack(e){return e._x_dataStack?e._x_dataStack:typeof ShadowRoot=="function"&&e instanceof ShadowRoot?closestDataStack(e.host):e.parentNode?closestDataStack(e.parentNode):[]}function mergeProxies(e){return new Proxy({objects:e},mergeProxyTrap)}var mergeProxyTrap={ownKeys({objects:e}){return Array.from(new Set(e.flatMap(t=>Object.keys(t))))},has({objects:e},t){return t==Symbol.unscopables?!1:e.some(n=>Object.prototype.hasOwnProperty.call(n,t)||Reflect.has(n,t))},get({objects:e},t,n){return t=="toJSON"?collapseProxies:Reflect.get(e.find(r=>Reflect.has(r,t))||{},t,n)},set({objects:e},t,n,r){const i=e.find(s=>Object.prototype.hasOwnProperty.call(s,t))||e[e.length-1],o=Object.getOwnPropertyDescriptor(i,t);return o!=null&&o.set&&(o!=null&&o.get)?o.set.call(r,n)||!0:Reflect.set(i,t,n)}};function collapseProxies(){return Reflect.ownKeys(this).reduce((t,n)=>(t[n]=Reflect.get(this,n),t),{})}function initInterceptors(e){let t=r=>typeof r=="object"&&!Array.isArray(r)&&r!==null,n=(r,i="")=>{Object.entries(Object.getOwnPropertyDescriptors(r)).forEach(([o,{value:s,enumerable:a}])=>{if(a===!1||s===void 0||typeof s=="object"&&s!==null&&s.__v_skip)return;let l=i===""?o:`${i}.${o}`;typeof s=="object"&&s!==null&&s._x_interceptor?r[o]=s.initialize(e,l,o):t(s)&&s!==r&&!(s instanceof Element)&&n(s,l)})};return n(e)}function interceptor(e,t=()=>{}){let n={initialValue:void 0,_x_interceptor:!0,initialize(r,i,o){return e(this.initialValue,()=>get(r,i),s=>set(r,i,s),i,o)}};return t(n),r=>{if(typeof r=="object"&&r!==null&&r._x_interceptor){let i=n.initialize.bind(n);n.initialize=(o,s,a)=>{let l=r.initialize(o,s,a);return n.initialValue=l,i(o,s,a)}}else n.initialValue=r;return n}}function get(e,t){return t.split(".").reduce((n,r)=>n[r],e)}function set(e,t,n){if(typeof t=="string"&&(t=t.split(".")),t.length===1)e[t[0]]=n;else{if(t.length===0)throw error;return e[t[0]]||(e[t[0]]={}),set(e[t[0]],t.slice(1),n)}}var magics={};function magic(e,t){magics[e]=t}function injectMagics(e,t){let n=getUtilities(t);return Object.entries(magics).forEach(([r,i])=>{Object.defineProperty(e,`$${r}`,{get(){return i(t,n)},enumerable:!1})}),e}function getUtilities(e){let[t,n]=getElementBoundUtilities(e),r={interceptor,...t};return onElRemoved(e,n),r}function tryCatch(e,t,n,...r){try{return n(...r)}catch(i){handleError(i,e,t)}}function handleError(...e){return errorHandler(...e)}var errorHandler=normalErrorHandler;function setErrorHandler(e){errorHandler=e}function normalErrorHandler(e,t,n=void 0){e=Object.assign(e??{message:"No error message given."},{el:t,expression:n}),console.warn(`Alpine Expression Error: ${e.message} 3 + 4 + ${n?'Expression: "'+n+`" 5 + 6 + `:""}`,t),setTimeout(()=>{throw e},0)}var shouldAutoEvaluateFunctions=!0;function dontAutoEvaluateFunctions(e){let t=shouldAutoEvaluateFunctions;shouldAutoEvaluateFunctions=!1;let n=e();return shouldAutoEvaluateFunctions=t,n}function evaluate(e,t,n={}){let r;return evaluateLater(e,t)(i=>r=i,n),r}function evaluateLater(...e){return theEvaluatorFunction(...e)}var theEvaluatorFunction=normalEvaluator;function setEvaluator(e){theEvaluatorFunction=e}var theRawEvaluatorFunction;function setRawEvaluator(e){theRawEvaluatorFunction=e}function normalEvaluator(e,t){let n={};injectMagics(n,e);let r=[n,...closestDataStack(e)],i=typeof t=="function"?generateEvaluatorFromFunction(r,t):generateEvaluatorFromString(r,t,e);return tryCatch.bind(null,e,t,i)}function generateEvaluatorFromFunction(e,t){return(n=()=>{},{scope:r={},params:i=[],context:o}={})=>{if(!shouldAutoEvaluateFunctions){runIfTypeOfFunction(n,t,mergeProxies([r,...e]),i);return}let s=t.apply(mergeProxies([r,...e]),i);runIfTypeOfFunction(n,s)}}var evaluatorMemo={};function generateFunctionFromString(e,t){if(evaluatorMemo[e])return evaluatorMemo[e];let n=Object.getPrototypeOf(async function(){}).constructor,r=/^[\n\s]*if.*\(.*\)/.test(e.trim())||/^(let|const)\s/.test(e.trim())?`(async()=>{ ${e} })()`:e,o=(()=>{try{let s=new n(["__self","scope"],`with (scope) { __self.result = ${r} }; __self.finished = true; return __self.result;`);return Object.defineProperty(s,"name",{value:`[Alpine] ${e}`}),s}catch(s){return handleError(s,t,e),Promise.resolve()}})();return evaluatorMemo[e]=o,o}function generateEvaluatorFromString(e,t,n){let r=generateFunctionFromString(t,n);return(i=()=>{},{scope:o={},params:s=[],context:a}={})=>{r.result=void 0,r.finished=!1;let l=mergeProxies([o,...e]);if(typeof r=="function"){let c=r.call(a,r,l).catch(u=>handleError(u,n,t));r.finished?(runIfTypeOfFunction(i,r.result,l,s,n),r.result=void 0):c.then(u=>{runIfTypeOfFunction(i,u,l,s,n)}).catch(u=>handleError(u,n,t)).finally(()=>r.result=void 0)}}}function runIfTypeOfFunction(e,t,n,r,i){if(shouldAutoEvaluateFunctions&&typeof t=="function"){let o=t.apply(n,r);o instanceof Promise?o.then(s=>runIfTypeOfFunction(e,s,n,r)).catch(s=>handleError(s,i,t)):e(o)}else typeof t=="object"&&t instanceof Promise?t.then(o=>e(o)):e(t)}function evaluateRaw(...e){return theRawEvaluatorFunction(...e)}function normalRawEvaluator(e,t,n={}){let r={};injectMagics(r,e);let i=[r,...closestDataStack(e)],o=mergeProxies([n.scope??{},...i]),s=n.params??[];if(t.includes("await")){let a=Object.getPrototypeOf(async function(){}).constructor,l=/^[\n\s]*if.*\(.*\)/.test(t.trim())||/^(let|const)\s/.test(t.trim())?`(async()=>{ ${t} })()`:t;return new a(["scope"],`with (scope) { let __result = ${l}; return __result }`).call(n.context,o)}else{let a=/^[\n\s]*if.*\(.*\)/.test(t.trim())||/^(let|const)\s/.test(t.trim())?`(()=>{ ${t} })()`:t,c=new Function(["scope"],`with (scope) { let __result = ${a}; return __result }`).call(n.context,o);return typeof c=="function"&&shouldAutoEvaluateFunctions?c.apply(o,s):c}}var prefixAsString="x-";function prefix(e=""){return prefixAsString+e}function setPrefix(e){prefixAsString=e}var directiveHandlers={};function directive(e,t){return directiveHandlers[e]=t,{before(n){if(!directiveHandlers[n]){console.warn(String.raw`Cannot find directive \`${n}\`. \`${e}\` will use the default order of execution`);return}const r=directiveOrder.indexOf(n);directiveOrder.splice(r>=0?r:directiveOrder.indexOf("DEFAULT"),0,e)}}}function directiveExists(e){return Object.keys(directiveHandlers).includes(e)}function directives(e,t,n){if(t=Array.from(t),e._x_virtualDirectives){let o=Object.entries(e._x_virtualDirectives).map(([a,l])=>({name:a,value:l})),s=attributesOnly(o);o=o.map(a=>s.find(l=>l.name===a.name)?{name:`x-bind:${a.name}`,value:`"${a.value}"`}:a),t=t.concat(o)}let r={};return t.map(toTransformedAttributes((o,s)=>r[o]=s)).filter(outNonAlpineAttributes).map(toParsedDirectives(r,n)).sort(byPriority).map(o=>getDirectiveHandler(e,o))}function attributesOnly(e){return Array.from(e).map(toTransformedAttributes()).filter(t=>!outNonAlpineAttributes(t))}var isDeferringHandlers=!1,directiveHandlerStacks=new Map,currentHandlerStackKey=Symbol();function deferHandlingDirectives(e){isDeferringHandlers=!0;let t=Symbol();currentHandlerStackKey=t,directiveHandlerStacks.set(t,[]);let n=()=>{for(;directiveHandlerStacks.get(t).length;)directiveHandlerStacks.get(t).shift()();directiveHandlerStacks.delete(t)},r=()=>{isDeferringHandlers=!1,n()};e(n),r()}function getElementBoundUtilities(e){let t=[],n=a=>t.push(a),[r,i]=elementBoundEffect(e);return t.push(i),[{Alpine:alpine_default,effect:r,cleanup:n,evaluateLater:evaluateLater.bind(evaluateLater,e),evaluate:evaluate.bind(evaluate,e)},()=>t.forEach(a=>a())]}function getDirectiveHandler(e,t){let n=()=>{},r=directiveHandlers[t.type]||n,[i,o]=getElementBoundUtilities(e);onAttributeRemoved(e,t.original,o);let s=()=>{e._x_ignore||e._x_ignoreSelf||(r.inline&&r.inline(e,t,i),r=r.bind(r,e,t,i),isDeferringHandlers?directiveHandlerStacks.get(currentHandlerStackKey).push(r):r())};return s.runCleanups=o,s}var startingWith=(e,t)=>({name:n,value:r})=>(n.startsWith(e)&&(n=n.replace(e,t)),{name:n,value:r}),into=e=>e;function toTransformedAttributes(e=()=>{}){return({name:t,value:n})=>{let{name:r,value:i}=attributeTransformers.reduce((o,s)=>s(o),{name:t,value:n});return r!==t&&e(r,t),{name:r,value:i}}}var attributeTransformers=[];function mapAttributes(e){attributeTransformers.push(e)}function outNonAlpineAttributes({name:e}){return alpineAttributeRegex().test(e)}var alpineAttributeRegex=()=>new RegExp(`^${prefixAsString}([^:^.]+)\\b`);function toParsedDirectives(e,t){return({name:n,value:r})=>{n===r&&(r="");let i=n.match(alpineAttributeRegex()),o=n.match(/:([a-zA-Z0-9\-_:]+)/),s=n.match(/\.[^.\]]+(?=[^\]]*$)/g)||[],a=t||e[n]||n;return{type:i?i[1]:null,value:o?o[1]:null,modifiers:s.map(l=>l.replace(".","")),expression:r,original:a}}}var DEFAULT="DEFAULT",directiveOrder=["ignore","ref","data","id","anchor","bind","init","for","model","modelable","transition","show","if",DEFAULT,"teleport"];function byPriority(e,t){let n=directiveOrder.indexOf(e.type)===-1?DEFAULT:e.type,r=directiveOrder.indexOf(t.type)===-1?DEFAULT:t.type;return directiveOrder.indexOf(n)-directiveOrder.indexOf(r)}function dispatch(e,t,n={}){e.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0,cancelable:!0}))}function walk(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(i=>walk(i,t));return}let n=!1;if(t(e,()=>n=!0),n)return;let r=e.firstElementChild;for(;r;)walk(r,t),r=r.nextElementSibling}function warn(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}var started=!1;function start(){started&&warn("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems."),started=!0,document.body||warn("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?"),dispatch(document,"alpine:init"),dispatch(document,"alpine:initializing"),startObservingMutations(),onElAdded(t=>initTree(t,walk)),onElRemoved(t=>destroyTree(t)),onAttributesAdded((t,n)=>{directives(t,n).forEach(r=>r())});let e=t=>!closestRoot(t.parentElement,!0);Array.from(document.querySelectorAll(allSelectors().join(","))).filter(e).forEach(t=>{initTree(t)}),dispatch(document,"alpine:initialized"),setTimeout(()=>{warnAboutMissingPlugins()})}var rootSelectorCallbacks=[],initSelectorCallbacks=[];function rootSelectors(){return rootSelectorCallbacks.map(e=>e())}function allSelectors(){return rootSelectorCallbacks.concat(initSelectorCallbacks).map(e=>e())}function addRootSelector(e){rootSelectorCallbacks.push(e)}function addInitSelector(e){initSelectorCallbacks.push(e)}function closestRoot(e,t=!1){return findClosest(e,n=>{if((t?allSelectors():rootSelectors()).some(i=>n.matches(i)))return!0})}function findClosest(e,t){if(e){if(t(e))return e;if(e._x_teleportBack&&(e=e._x_teleportBack),e.parentNode instanceof ShadowRoot)return findClosest(e.parentNode.host,t);if(e.parentElement)return findClosest(e.parentElement,t)}}function isRoot(e){return rootSelectors().some(t=>e.matches(t))}var initInterceptors2=[];function interceptInit(e){initInterceptors2.push(e)}var markerDispenser=1;function initTree(e,t=walk,n=()=>{}){findClosest(e,r=>r._x_ignore)||deferHandlingDirectives(()=>{t(e,(r,i)=>{r._x_marker||(n(r,i),initInterceptors2.forEach(o=>o(r,i)),directives(r,r.attributes).forEach(o=>o()),r._x_ignore||(r._x_marker=markerDispenser++),r._x_ignore&&i())})})}function destroyTree(e,t=walk){t(e,n=>{cleanupElement(n),cleanupAttributes(n),delete n._x_marker})}function warnAboutMissingPlugins(){[["ui","dialog",["[x-dialog], [x-popover]"]],["anchor","anchor",["[x-anchor]"]],["sort","sort",["[x-sort]"]]].forEach(([t,n,r])=>{directiveExists(n)||r.some(i=>{if(document.querySelector(i))return warn(`found "${i}", but missing ${t} plugin`),!0})})}var tickStack=[],isHolding=!1;function nextTick(e=()=>{}){return queueMicrotask(()=>{isHolding||setTimeout(()=>{releaseNextTicks()})}),new Promise(t=>{tickStack.push(()=>{e(),t()})})}function releaseNextTicks(){for(isHolding=!1;tickStack.length;)tickStack.shift()()}function holdNextTicks(){isHolding=!0}function setClasses(e,t){return Array.isArray(t)?setClassesFromString(e,t.join(" ")):typeof t=="object"&&t!==null?setClassesFromObject(e,t):typeof t=="function"?setClasses(e,t()):setClassesFromString(e,t)}function setClassesFromString(e,t){let n=i=>i.split(" ").filter(o=>!e.classList.contains(o)).filter(Boolean),r=i=>(e.classList.add(...i),()=>{e.classList.remove(...i)});return t=t===!0?t="":t||"",r(n(t))}function setClassesFromObject(e,t){let n=a=>a.split(" ").filter(Boolean),r=Object.entries(t).flatMap(([a,l])=>l?n(a):!1).filter(Boolean),i=Object.entries(t).flatMap(([a,l])=>l?!1:n(a)).filter(Boolean),o=[],s=[];return i.forEach(a=>{e.classList.contains(a)&&(e.classList.remove(a),s.push(a))}),r.forEach(a=>{e.classList.contains(a)||(e.classList.add(a),o.push(a))}),()=>{s.forEach(a=>e.classList.add(a)),o.forEach(a=>e.classList.remove(a))}}function setStyles(e,t){return typeof t=="object"&&t!==null?setStylesFromObject(e,t):setStylesFromString(e,t)}function setStylesFromObject(e,t){let n={};return Object.entries(t).forEach(([r,i])=>{n[r]=e.style[r],r.startsWith("--")||(r=kebabCase(r)),e.style.setProperty(r,i)}),setTimeout(()=>{e.style.length===0&&e.removeAttribute("style")}),()=>{setStyles(e,n)}}function setStylesFromString(e,t){let n=e.getAttribute("style",t);return e.setAttribute("style",t),()=>{e.setAttribute("style",n||"")}}function kebabCase(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function once(e,t=()=>{}){let n=!1;return function(){n?t.apply(this,arguments):(n=!0,e.apply(this,arguments))}}directive("transition",(e,{value:t,modifiers:n,expression:r},{evaluate:i})=>{typeof r=="function"&&(r=i(r)),r!==!1&&(!r||typeof r=="boolean"?registerTransitionsFromHelper(e,n,t):registerTransitionsFromClassString(e,r,t))});function registerTransitionsFromClassString(e,t,n){registerTransitionObject(e,setClasses,""),{enter:i=>{e._x_transition.enter.during=i},"enter-start":i=>{e._x_transition.enter.start=i},"enter-end":i=>{e._x_transition.enter.end=i},leave:i=>{e._x_transition.leave.during=i},"leave-start":i=>{e._x_transition.leave.start=i},"leave-end":i=>{e._x_transition.leave.end=i}}[n](t)}function registerTransitionsFromHelper(e,t,n){registerTransitionObject(e,setStyles);let r=!t.includes("in")&&!t.includes("out")&&!n,i=r||t.includes("in")||["enter"].includes(n),o=r||t.includes("out")||["leave"].includes(n);t.includes("in")&&!r&&(t=t.filter((m,y)=>y<t.indexOf("out"))),t.includes("out")&&!r&&(t=t.filter((m,y)=>y>t.indexOf("out")));let s=!t.includes("opacity")&&!t.includes("scale"),a=s||t.includes("opacity"),l=s||t.includes("scale"),c=a?0:1,u=l?modifierValue(t,"scale",95)/100:1,f=modifierValue(t,"delay",0)/1e3,d=modifierValue(t,"origin","center"),p="opacity, transform",g=modifierValue(t,"duration",150)/1e3,v=modifierValue(t,"duration",75)/1e3,h="cubic-bezier(0.4, 0.0, 0.2, 1)";i&&(e._x_transition.enter.during={transformOrigin:d,transitionDelay:`${f}s`,transitionProperty:p,transitionDuration:`${g}s`,transitionTimingFunction:h},e._x_transition.enter.start={opacity:c,transform:`scale(${u})`},e._x_transition.enter.end={opacity:1,transform:"scale(1)"}),o&&(e._x_transition.leave.during={transformOrigin:d,transitionDelay:`${f}s`,transitionProperty:p,transitionDuration:`${v}s`,transitionTimingFunction:h},e._x_transition.leave.start={opacity:1,transform:"scale(1)"},e._x_transition.leave.end={opacity:c,transform:`scale(${u})`})}function registerTransitionObject(e,t,n={}){e._x_transition||(e._x_transition={enter:{during:n,start:n,end:n},leave:{during:n,start:n,end:n},in(r=()=>{},i=()=>{}){transition(e,t,{during:this.enter.during,start:this.enter.start,end:this.enter.end},r,i)},out(r=()=>{},i=()=>{}){transition(e,t,{during:this.leave.during,start:this.leave.start,end:this.leave.end},r,i)}})}window.Element.prototype._x_toggleAndCascadeWithTransitions=function(e,t,n,r){const i=document.visibilityState==="visible"?requestAnimationFrame:setTimeout;let o=()=>i(n);if(t){e._x_transition&&(e._x_transition.enter||e._x_transition.leave)?e._x_transition.enter&&(Object.entries(e._x_transition.enter.during).length||Object.entries(e._x_transition.enter.start).length||Object.entries(e._x_transition.enter.end).length)?e._x_transition.in(n):o():e._x_transition?e._x_transition.in(n):o();return}e._x_hidePromise=e._x_transition?new Promise((s,a)=>{e._x_transition.out(()=>{},()=>s(r)),e._x_transitioning&&e._x_transitioning.beforeCancel(()=>a({isFromCancelledTransition:!0}))}):Promise.resolve(r),queueMicrotask(()=>{let s=closestHide(e);s?(s._x_hideChildren||(s._x_hideChildren=[]),s._x_hideChildren.push(e)):i(()=>{let a=l=>{let c=Promise.all([l._x_hidePromise,...(l._x_hideChildren||[]).map(a)]).then(([u])=>u==null?void 0:u());return delete l._x_hidePromise,delete l._x_hideChildren,c};a(e).catch(l=>{if(!l.isFromCancelledTransition)throw l})})})};function closestHide(e){let t=e.parentNode;if(t)return t._x_hidePromise?t:closestHide(t)}function transition(e,t,{during:n,start:r,end:i}={},o=()=>{},s=()=>{}){if(e._x_transitioning&&e._x_transitioning.cancel(),Object.keys(n).length===0&&Object.keys(r).length===0&&Object.keys(i).length===0){o(),s();return}let a,l,c;performTransition(e,{start(){a=t(e,r)},during(){l=t(e,n)},before:o,end(){a(),c=t(e,i)},after:s,cleanup(){l(),c()}})}function performTransition(e,t){let n,r,i,o=once(()=>{mutateDom(()=>{n=!0,r||t.before(),i||(t.end(),releaseNextTicks()),t.after(),e.isConnected&&t.cleanup(),delete e._x_transitioning})});e._x_transitioning={beforeCancels:[],beforeCancel(s){this.beforeCancels.push(s)},cancel:once(function(){for(;this.beforeCancels.length;)this.beforeCancels.shift()();o()}),finish:o},mutateDom(()=>{t.start(),t.during()}),holdNextTicks(),requestAnimationFrame(()=>{if(n)return;let s=Number(getComputedStyle(e).transitionDuration.replace(/,.*/,"").replace("s",""))*1e3,a=Number(getComputedStyle(e).transitionDelay.replace(/,.*/,"").replace("s",""))*1e3;s===0&&(s=Number(getComputedStyle(e).animationDuration.replace("s",""))*1e3),mutateDom(()=>{t.before()}),r=!0,requestAnimationFrame(()=>{n||(mutateDom(()=>{t.end()}),releaseNextTicks(),setTimeout(e._x_transitioning.finish,s+a),i=!0)})})}function modifierValue(e,t,n){if(e.indexOf(t)===-1)return n;const r=e[e.indexOf(t)+1];if(!r||t==="scale"&&isNaN(r))return n;if(t==="duration"||t==="delay"){let i=r.match(/([0-9]+)ms/);if(i)return i[1]}return t==="origin"&&["top","right","left","center","bottom"].includes(e[e.indexOf(t)+2])?[r,e[e.indexOf(t)+2]].join(" "):r}var isCloning=!1;function skipDuringClone(e,t=()=>{}){return(...n)=>isCloning?t(...n):e(...n)}function onlyDuringClone(e){return(...t)=>isCloning&&e(...t)}var interceptors=[];function interceptClone(e){interceptors.push(e)}function cloneNode(e,t){interceptors.forEach(n=>n(e,t)),isCloning=!0,dontRegisterReactiveSideEffects(()=>{initTree(t,(n,r)=>{r(n,()=>{})})}),isCloning=!1}var isCloningLegacy=!1;function clone(e,t){t._x_dataStack||(t._x_dataStack=e._x_dataStack),isCloning=!0,isCloningLegacy=!0,dontRegisterReactiveSideEffects(()=>{cloneTree(t)}),isCloning=!1,isCloningLegacy=!1}function cloneTree(e){let t=!1;initTree(e,(r,i)=>{walk(r,(o,s)=>{if(t&&isRoot(o))return s();t=!0,i(o,s)})})}function dontRegisterReactiveSideEffects(e){let t=effect;overrideEffect((n,r)=>{let i=t(n);return release(i),()=>{}}),e(),overrideEffect(t)}function bind(e,t,n,r=[]){switch(e._x_bindings||(e._x_bindings=reactive({})),e._x_bindings[t]=n,t=r.includes("camel")?camelCase(t):t,t){case"value":bindInputValue(e,n);break;case"style":bindStyles(e,n);break;case"class":bindClasses(e,n);break;case"selected":case"checked":bindAttributeAndProperty(e,t,n);break;default:bindAttribute(e,t,n);break}}function bindInputValue(e,t){if(isRadio(e))e.attributes.value===void 0&&(e.value=t),window.fromModel&&(typeof t=="boolean"?e.checked=safeParseBoolean(e.value)===t:e.checked=checkedAttrLooseCompare(e.value,t));else if(isCheckbox(e))Number.isInteger(t)?e.value=t:!Array.isArray(t)&&typeof t!="boolean"&&![null,void 0].includes(t)?e.value=String(t):Array.isArray(t)?e.checked=t.some(n=>checkedAttrLooseCompare(n,e.value)):e.checked=!!t;else if(e.tagName==="SELECT")updateSelect(e,t);else{if(e.value===t)return;e.value=t===void 0?"":t}}function bindClasses(e,t){e._x_undoAddedClasses&&e._x_undoAddedClasses(),e._x_undoAddedClasses=setClasses(e,t)}function bindStyles(e,t){e._x_undoAddedStyles&&e._x_undoAddedStyles(),e._x_undoAddedStyles=setStyles(e,t)}function bindAttributeAndProperty(e,t,n){bindAttribute(e,t,n),setPropertyIfChanged(e,t,n)}function bindAttribute(e,t,n){[null,void 0,!1].includes(n)&&attributeShouldntBePreservedIfFalsy(t)?e.removeAttribute(t):(isBooleanAttr(t)&&(n=t),setIfChanged(e,t,n))}function setIfChanged(e,t,n){e.getAttribute(t)!=n&&e.setAttribute(t,n)}function setPropertyIfChanged(e,t,n){e[t]!==n&&(e[t]=n)}function updateSelect(e,t){const n=[].concat(t).map(r=>r+"");Array.from(e.options).forEach(r=>{r.selected=n.includes(r.value)})}function camelCase(e){return e.toLowerCase().replace(/-(\w)/g,(t,n)=>n.toUpperCase())}function checkedAttrLooseCompare(e,t){return e==t}function safeParseBoolean(e){return[1,"1","true","on","yes",!0].includes(e)?!0:[0,"0","false","off","no",!1].includes(e)?!1:e?!!e:null}var booleanAttributes=new Set(["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected","shadowrootclonable","shadowrootdelegatesfocus","shadowrootserializable"]);function isBooleanAttr(e){return booleanAttributes.has(e)}function attributeShouldntBePreservedIfFalsy(e){return!["aria-pressed","aria-checked","aria-expanded","aria-selected"].includes(e)}function getBinding(e,t,n){return e._x_bindings&&e._x_bindings[t]!==void 0?e._x_bindings[t]:getAttributeBinding(e,t,n)}function extractProp(e,t,n,r=!0){if(e._x_bindings&&e._x_bindings[t]!==void 0)return e._x_bindings[t];if(e._x_inlineBindings&&e._x_inlineBindings[t]!==void 0){let i=e._x_inlineBindings[t];return i.extract=r,dontAutoEvaluateFunctions(()=>evaluate(e,i.expression))}return getAttributeBinding(e,t,n)}function getAttributeBinding(e,t,n){let r=e.getAttribute(t);return r===null?typeof n=="function"?n():n:r===""?!0:isBooleanAttr(t)?!![t,"true"].includes(r):r}function isCheckbox(e){return e.type==="checkbox"||e.localName==="ui-checkbox"||e.localName==="ui-switch"}function isRadio(e){return e.type==="radio"||e.localName==="ui-radio"}function debounce(e,t){let n;return function(){const r=this,i=arguments,o=function(){n=null,e.apply(r,i)};clearTimeout(n),n=setTimeout(o,t)}}function throttle(e,t){let n;return function(){let r=this,i=arguments;n||(e.apply(r,i),n=!0,setTimeout(()=>n=!1,t))}}function entangle({get:e,set:t},{get:n,set:r}){let i=!0,o,s=effect(()=>{let a=e(),l=n();if(i)r(cloneIfObject(a)),i=!1;else{let c=JSON.stringify(a),u=JSON.stringify(l);c!==o?r(cloneIfObject(a)):c!==u&&t(cloneIfObject(l))}o=JSON.stringify(e()),JSON.stringify(n())});return()=>{release(s)}}function cloneIfObject(e){return typeof e=="object"?JSON.parse(JSON.stringify(e)):e}function plugin(e){(Array.isArray(e)?e:[e]).forEach(n=>n(alpine_default))}var stores={},isReactive=!1;function store(e,t){if(isReactive||(stores=reactive(stores),isReactive=!0),t===void 0)return stores[e];stores[e]=t,initInterceptors(stores[e]),typeof t=="object"&&t!==null&&t.hasOwnProperty("init")&&typeof t.init=="function"&&stores[e].init()}function getStores(){return stores}var binds={};function bind2(e,t){let n=typeof t!="function"?()=>t:t;return e instanceof Element?applyBindingsObject(e,n()):(binds[e]=n,()=>{})}function injectBindingProviders(e){return Object.entries(binds).forEach(([t,n])=>{Object.defineProperty(e,t,{get(){return(...r)=>n(...r)}})}),e}function applyBindingsObject(e,t,n){let r=[];for(;r.length;)r.pop()();let i=Object.entries(t).map(([s,a])=>({name:s,value:a})),o=attributesOnly(i);return i=i.map(s=>o.find(a=>a.name===s.name)?{name:`x-bind:${s.name}`,value:`"${s.value}"`}:s),directives(e,i,n).map(s=>{r.push(s.runCleanups),s()}),()=>{for(;r.length;)r.pop()()}}var datas={};function data(e,t){datas[e]=t}function injectDataProviders(e,t){return Object.entries(datas).forEach(([n,r])=>{Object.defineProperty(e,n,{get(){return(...i)=>r.bind(t)(...i)},enumerable:!1})}),e}var Alpine={get reactive(){return reactive},get release(){return release},get effect(){return effect},get raw(){return raw},version:"3.15.4",flushAndStopDeferringMutations,dontAutoEvaluateFunctions,disableEffectScheduling,startObservingMutations,stopObservingMutations,setReactivityEngine,onAttributeRemoved,onAttributesAdded,closestDataStack,skipDuringClone,onlyDuringClone,addRootSelector,addInitSelector,setErrorHandler,interceptClone,addScopeToNode,deferMutations,mapAttributes,evaluateLater,interceptInit,initInterceptors,injectMagics,setEvaluator,setRawEvaluator,mergeProxies,extractProp,findClosest,onElRemoved,closestRoot,destroyTree,interceptor,transition,setStyles,mutateDom,directive,entangle,throttle,debounce,evaluate,evaluateRaw,initTree,nextTick,prefixed:prefix,prefix:setPrefix,plugin,magic,store,start,clone,cloneNode,bound:getBinding,$data:scope,watch,walk,data,bind:bind2},alpine_default=Alpine;function makeMap(e,t){const n=Object.create(null),r=e.split(",");for(let i=0;i<r.length;i++)n[r[i]]=!0;return i=>!!n[i]}var EMPTY_OBJ=Object.freeze({}),hasOwnProperty=Object.prototype.hasOwnProperty,hasOwn=(e,t)=>hasOwnProperty.call(e,t),isArray=Array.isArray,isMap=e=>toTypeString(e)==="[object Map]",isString=e=>typeof e=="string",isSymbol=e=>typeof e=="symbol",isObject=e=>e!==null&&typeof e=="object",objectToString=Object.prototype.toString,toTypeString=e=>objectToString.call(e),toRawType=e=>toTypeString(e).slice(8,-1),isIntegerKey=e=>isString(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,cacheStringFunction=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},capitalize=cacheStringFunction(e=>e.charAt(0).toUpperCase()+e.slice(1)),hasChanged=(e,t)=>e!==t&&(e===e||t===t),targetMap=new WeakMap,effectStack=[],activeEffect,ITERATE_KEY=Symbol("iterate"),MAP_KEY_ITERATE_KEY=Symbol("Map key iterate");function isEffect(e){return e&&e._isEffect===!0}function effect2(e,t=EMPTY_OBJ){isEffect(e)&&(e=e.raw);const n=createReactiveEffect(e,t);return t.lazy||n(),n}function stop(e){e.active&&(cleanup(e),e.options.onStop&&e.options.onStop(),e.active=!1)}var uid=0;function createReactiveEffect(e,t){const n=function(){if(!n.active)return e();if(!effectStack.includes(n)){cleanup(n);try{return enableTracking(),effectStack.push(n),activeEffect=n,e()}finally{effectStack.pop(),resetTracking(),activeEffect=effectStack[effectStack.length-1]}}};return n.id=uid++,n.allowRecurse=!!t.allowRecurse,n._isEffect=!0,n.active=!0,n.raw=e,n.deps=[],n.options=t,n}function cleanup(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}var shouldTrack=!0,trackStack=[];function pauseTracking(){trackStack.push(shouldTrack),shouldTrack=!1}function enableTracking(){trackStack.push(shouldTrack),shouldTrack=!0}function resetTracking(){const e=trackStack.pop();shouldTrack=e===void 0?!0:e}function track(e,t,n){if(!shouldTrack||activeEffect===void 0)return;let r=targetMap.get(e);r||targetMap.set(e,r=new Map);let i=r.get(n);i||r.set(n,i=new Set),i.has(activeEffect)||(i.add(activeEffect),activeEffect.deps.push(i),activeEffect.options.onTrack&&activeEffect.options.onTrack({effect:activeEffect,target:e,type:t,key:n}))}function trigger(e,t,n,r,i,o){const s=targetMap.get(e);if(!s)return;const a=new Set,l=u=>{u&&u.forEach(f=>{(f!==activeEffect||f.allowRecurse)&&a.add(f)})};if(t==="clear")s.forEach(l);else if(n==="length"&&isArray(e))s.forEach((u,f)=>{(f==="length"||f>=r)&&l(u)});else switch(n!==void 0&&l(s.get(n)),t){case"add":isArray(e)?isIntegerKey(n)&&l(s.get("length")):(l(s.get(ITERATE_KEY)),isMap(e)&&l(s.get(MAP_KEY_ITERATE_KEY)));break;case"delete":isArray(e)||(l(s.get(ITERATE_KEY)),isMap(e)&&l(s.get(MAP_KEY_ITERATE_KEY)));break;case"set":isMap(e)&&l(s.get(ITERATE_KEY));break}const c=u=>{u.options.onTrigger&&u.options.onTrigger({effect:u,target:e,key:n,type:t,newValue:r,oldValue:i,oldTarget:o}),u.options.scheduler?u.options.scheduler(u):u()};a.forEach(c)}var isNonTrackableKeys=makeMap("__proto__,__v_isRef,__isVue"),builtInSymbols=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(isSymbol)),get2=createGetter(),readonlyGet=createGetter(!0),arrayInstrumentations=createArrayInstrumentations();function createArrayInstrumentations(){const e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){const r=toRaw(this);for(let o=0,s=this.length;o<s;o++)track(r,"get",o+"");const i=r[t](...n);return i===-1||i===!1?r[t](...n.map(toRaw)):i}}),["push","pop","shift","unshift","splice"].forEach(t=>{e[t]=function(...n){pauseTracking();const r=toRaw(this)[t].apply(this,n);return resetTracking(),r}}),e}function createGetter(e=!1,t=!1){return function(r,i,o){if(i==="__v_isReactive")return!e;if(i==="__v_isReadonly")return e;if(i==="__v_raw"&&o===(e?t?shallowReadonlyMap:readonlyMap:t?shallowReactiveMap:reactiveMap).get(r))return r;const s=isArray(r);if(!e&&s&&hasOwn(arrayInstrumentations,i))return Reflect.get(arrayInstrumentations,i,o);const a=Reflect.get(r,i,o);return(isSymbol(i)?builtInSymbols.has(i):isNonTrackableKeys(i))||(e||track(r,"get",i),t)?a:isRef(a)?!s||!isIntegerKey(i)?a.value:a:isObject(a)?e?readonly(a):reactive2(a):a}}var set2=createSetter();function createSetter(e=!1){return function(n,r,i,o){let s=n[r];if(!e&&(i=toRaw(i),s=toRaw(s),!isArray(n)&&isRef(s)&&!isRef(i)))return s.value=i,!0;const a=isArray(n)&&isIntegerKey(r)?Number(r)<n.length:hasOwn(n,r),l=Reflect.set(n,r,i,o);return n===toRaw(o)&&(a?hasChanged(i,s)&&trigger(n,"set",r,i,s):trigger(n,"add",r,i)),l}}function deleteProperty(e,t){const n=hasOwn(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&trigger(e,"delete",t,void 0,r),i}function has(e,t){const n=Reflect.has(e,t);return(!isSymbol(t)||!builtInSymbols.has(t))&&track(e,"has",t),n}function ownKeys(e){return track(e,"iterate",isArray(e)?"length":ITERATE_KEY),Reflect.ownKeys(e)}var mutableHandlers={get:get2,set:set2,deleteProperty,has,ownKeys},readonlyHandlers={get:readonlyGet,set(e,t){return console.warn(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0},deleteProperty(e,t){return console.warn(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}},toReactive=e=>isObject(e)?reactive2(e):e,toReadonly=e=>isObject(e)?readonly(e):e,toShallow=e=>e,getProto=e=>Reflect.getPrototypeOf(e);function get$1(e,t,n=!1,r=!1){e=e.__v_raw;const i=toRaw(e),o=toRaw(t);t!==o&&!n&&track(i,"get",t),!n&&track(i,"get",o);const{has:s}=getProto(i),a=r?toShallow:n?toReadonly:toReactive;if(s.call(i,t))return a(e.get(t));if(s.call(i,o))return a(e.get(o));e!==i&&e.get(t)}function has$1(e,t=!1){const n=this.__v_raw,r=toRaw(n),i=toRaw(e);return e!==i&&!t&&track(r,"has",e),!t&&track(r,"has",i),e===i?n.has(e):n.has(e)||n.has(i)}function size(e,t=!1){return e=e.__v_raw,!t&&track(toRaw(e),"iterate",ITERATE_KEY),Reflect.get(e,"size",e)}function add(e){e=toRaw(e);const t=toRaw(this);return getProto(t).has.call(t,e)||(t.add(e),trigger(t,"add",e,e)),this}function set$1(e,t){t=toRaw(t);const n=toRaw(this),{has:r,get:i}=getProto(n);let o=r.call(n,e);o?checkIdentityKeys(n,r,e):(e=toRaw(e),o=r.call(n,e));const s=i.call(n,e);return n.set(e,t),o?hasChanged(t,s)&&trigger(n,"set",e,t,s):trigger(n,"add",e,t),this}function deleteEntry(e){const t=toRaw(this),{has:n,get:r}=getProto(t);let i=n.call(t,e);i?checkIdentityKeys(t,n,e):(e=toRaw(e),i=n.call(t,e));const o=r?r.call(t,e):void 0,s=t.delete(e);return i&&trigger(t,"delete",e,void 0,o),s}function clear(){const e=toRaw(this),t=e.size!==0,n=isMap(e)?new Map(e):new Set(e),r=e.clear();return t&&trigger(e,"clear",void 0,void 0,n),r}function createForEach(e,t){return function(r,i){const o=this,s=o.__v_raw,a=toRaw(s),l=t?toShallow:e?toReadonly:toReactive;return!e&&track(a,"iterate",ITERATE_KEY),s.forEach((c,u)=>r.call(i,l(c),l(u),o))}}function createIterableMethod(e,t,n){return function(...r){const i=this.__v_raw,o=toRaw(i),s=isMap(o),a=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,c=i[e](...r),u=n?toShallow:t?toReadonly:toReactive;return!t&&track(o,"iterate",l?MAP_KEY_ITERATE_KEY:ITERATE_KEY),{next(){const{value:f,done:d}=c.next();return d?{value:f,done:d}:{value:a?[u(f[0]),u(f[1])]:u(f),done:d}},[Symbol.iterator](){return this}}}}function createReadonlyMethod(e){return function(...t){{const n=t[0]?`on key "${t[0]}" `:"";console.warn(`${capitalize(e)} operation ${n}failed: target is readonly.`,toRaw(this))}return e==="delete"?!1:this}}function createInstrumentations(){const e={get(o){return get$1(this,o)},get size(){return size(this)},has:has$1,add,set:set$1,delete:deleteEntry,clear,forEach:createForEach(!1,!1)},t={get(o){return get$1(this,o,!1,!0)},get size(){return size(this)},has:has$1,add,set:set$1,delete:deleteEntry,clear,forEach:createForEach(!1,!0)},n={get(o){return get$1(this,o,!0)},get size(){return size(this,!0)},has(o){return has$1.call(this,o,!0)},add:createReadonlyMethod("add"),set:createReadonlyMethod("set"),delete:createReadonlyMethod("delete"),clear:createReadonlyMethod("clear"),forEach:createForEach(!0,!1)},r={get(o){return get$1(this,o,!0,!0)},get size(){return size(this,!0)},has(o){return has$1.call(this,o,!0)},add:createReadonlyMethod("add"),set:createReadonlyMethod("set"),delete:createReadonlyMethod("delete"),clear:createReadonlyMethod("clear"),forEach:createForEach(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(o=>{e[o]=createIterableMethod(o,!1,!1),n[o]=createIterableMethod(o,!0,!1),t[o]=createIterableMethod(o,!1,!0),r[o]=createIterableMethod(o,!0,!0)}),[e,n,t,r]}var[mutableInstrumentations,readonlyInstrumentations]=createInstrumentations();function createInstrumentationGetter(e,t){const n=e?readonlyInstrumentations:mutableInstrumentations;return(r,i,o)=>i==="__v_isReactive"?!e:i==="__v_isReadonly"?e:i==="__v_raw"?r:Reflect.get(hasOwn(n,i)&&i in r?n:r,i,o)}var mutableCollectionHandlers={get:createInstrumentationGetter(!1)},readonlyCollectionHandlers={get:createInstrumentationGetter(!0)};function checkIdentityKeys(e,t,n){const r=toRaw(n);if(r!==n&&t.call(e,r)){const i=toRawType(e);console.warn(`Reactive ${i} contains both the raw and reactive versions of the same object${i==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}var reactiveMap=new WeakMap,shallowReactiveMap=new WeakMap,readonlyMap=new WeakMap,shallowReadonlyMap=new WeakMap;function targetTypeMap(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function getTargetType(e){return e.__v_skip||!Object.isExtensible(e)?0:targetTypeMap(toRawType(e))}function reactive2(e){return e&&e.__v_isReadonly?e:createReactiveObject(e,!1,mutableHandlers,mutableCollectionHandlers,reactiveMap)}function readonly(e){return createReactiveObject(e,!0,readonlyHandlers,readonlyCollectionHandlers,readonlyMap)}function createReactiveObject(e,t,n,r,i){if(!isObject(e))return console.warn(`value cannot be made reactive: ${String(e)}`),e;if(e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=i.get(e);if(o)return o;const s=getTargetType(e);if(s===0)return e;const a=new Proxy(e,s===2?r:n);return i.set(e,a),a}function toRaw(e){return e&&toRaw(e.__v_raw)||e}function isRef(e){return!!(e&&e.__v_isRef===!0)}magic("nextTick",()=>nextTick);magic("dispatch",e=>dispatch.bind(dispatch,e));magic("watch",(e,{evaluateLater:t,cleanup:n})=>(r,i)=>{let o=t(r),a=watch(()=>{let l;return o(c=>l=c),l},i);n(a)});magic("store",getStores);magic("data",e=>scope(e));magic("root",e=>closestRoot(e));magic("refs",e=>(e._x_refs_proxy||(e._x_refs_proxy=mergeProxies(getArrayOfRefObject(e))),e._x_refs_proxy));function getArrayOfRefObject(e){let t=[];return findClosest(e,n=>{n._x_refs&&t.push(n._x_refs)}),t}var globalIdMemo={};function findAndIncrementId(e){return globalIdMemo[e]||(globalIdMemo[e]=0),++globalIdMemo[e]}function closestIdRoot(e,t){return findClosest(e,n=>{if(n._x_ids&&n._x_ids[t])return!0})}function setIdRoot(e,t){e._x_ids||(e._x_ids={}),e._x_ids[t]||(e._x_ids[t]=findAndIncrementId(t))}magic("id",(e,{cleanup:t})=>(n,r=null)=>{let i=`${n}${r?`-${r}`:""}`;return cacheIdByNameOnElement(e,i,t,()=>{let o=closestIdRoot(e,n),s=o?o._x_ids[n]:findAndIncrementId(n);return r?`${n}-${s}-${r}`:`${n}-${s}`})});interceptClone((e,t)=>{e._x_id&&(t._x_id=e._x_id)});function cacheIdByNameOnElement(e,t,n,r){if(e._x_id||(e._x_id={}),e._x_id[t])return e._x_id[t];let i=r();return e._x_id[t]=i,n(()=>{delete e._x_id[t]}),i}magic("el",e=>e);warnMissingPluginMagic("Focus","focus","focus");warnMissingPluginMagic("Persist","persist","persist");function warnMissingPluginMagic(e,t,n){magic(t,r=>warn(`You can't use [$${t}] without first installing the "${e}" plugin here: https://alpinejs.dev/plugins/${n}`,r))}directive("modelable",(e,{expression:t},{effect:n,evaluateLater:r,cleanup:i})=>{let o=r(t),s=()=>{let u;return o(f=>u=f),u},a=r(`${t} = __placeholder`),l=u=>a(()=>{},{scope:{__placeholder:u}}),c=s();l(c),queueMicrotask(()=>{if(!e._x_model)return;e._x_removeModelListeners.default();let u=e._x_model.get,f=e._x_model.set,d=entangle({get(){return u()},set(p){f(p)}},{get(){return s()},set(p){l(p)}});i(d)})});directive("teleport",(e,{modifiers:t,expression:n},{cleanup:r})=>{e.tagName.toLowerCase()!=="template"&&warn("x-teleport can only be used on a <template> tag",e);let i=getTarget(n),o=e.content.cloneNode(!0).firstElementChild;e._x_teleport=o,o._x_teleportBack=e,e.setAttribute("data-teleport-template",!0),o.setAttribute("data-teleport-target",!0),e._x_forwardEvents&&e._x_forwardEvents.forEach(a=>{o.addEventListener(a,l=>{l.stopPropagation(),e.dispatchEvent(new l.constructor(l.type,l))})}),addScopeToNode(o,{},e);let s=(a,l,c)=>{c.includes("prepend")?l.parentNode.insertBefore(a,l):c.includes("append")?l.parentNode.insertBefore(a,l.nextSibling):l.appendChild(a)};mutateDom(()=>{s(o,i,t),skipDuringClone(()=>{initTree(o)})()}),e._x_teleportPutBack=()=>{let a=getTarget(n);mutateDom(()=>{s(e._x_teleport,a,t)})},r(()=>mutateDom(()=>{o.remove(),destroyTree(o)}))});var teleportContainerDuringClone=document.createElement("div");function getTarget(e){let t=skipDuringClone(()=>document.querySelector(e),()=>teleportContainerDuringClone)();return t||warn(`Cannot find x-teleport element for selector: "${e}"`),t}var handler=()=>{};handler.inline=(e,{modifiers:t},{cleanup:n})=>{t.includes("self")?e._x_ignoreSelf=!0:e._x_ignore=!0,n(()=>{t.includes("self")?delete e._x_ignoreSelf:delete e._x_ignore})};directive("ignore",handler);directive("effect",skipDuringClone((e,{expression:t},{effect:n})=>{n(evaluateLater(e,t))}));function on(e,t,n,r){let i=e,o=l=>r(l),s={},a=(l,c)=>u=>c(l,u);if(n.includes("dot")&&(t=dotSyntax(t)),n.includes("camel")&&(t=camelCase2(t)),n.includes("passive")&&(s.passive=!0),n.includes("capture")&&(s.capture=!0),n.includes("window")&&(i=window),n.includes("document")&&(i=document),n.includes("debounce")){let l=n[n.indexOf("debounce")+1]||"invalid-wait",c=isNumeric(l.split("ms")[0])?Number(l.split("ms")[0]):250;o=debounce(o,c)}if(n.includes("throttle")){let l=n[n.indexOf("throttle")+1]||"invalid-wait",c=isNumeric(l.split("ms")[0])?Number(l.split("ms")[0]):250;o=throttle(o,c)}return n.includes("prevent")&&(o=a(o,(l,c)=>{c.preventDefault(),l(c)})),n.includes("stop")&&(o=a(o,(l,c)=>{c.stopPropagation(),l(c)})),n.includes("once")&&(o=a(o,(l,c)=>{l(c),i.removeEventListener(t,o,s)})),(n.includes("away")||n.includes("outside"))&&(i=document,o=a(o,(l,c)=>{e.contains(c.target)||c.target.isConnected!==!1&&(e.offsetWidth<1&&e.offsetHeight<1||e._x_isShown!==!1&&l(c))})),n.includes("self")&&(o=a(o,(l,c)=>{c.target===e&&l(c)})),(isKeyEvent(t)||isClickEvent(t))&&(o=a(o,(l,c)=>{isListeningForASpecificKeyThatHasntBeenPressed(c,n)||l(c)})),i.addEventListener(t,o,s),()=>{i.removeEventListener(t,o,s)}}function dotSyntax(e){return e.replace(/-/g,".")}function camelCase2(e){return e.toLowerCase().replace(/-(\w)/g,(t,n)=>n.toUpperCase())}function isNumeric(e){return!Array.isArray(e)&&!isNaN(e)}function kebabCase2(e){return[" ","_"].includes(e)?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]/,"-").toLowerCase()}function isKeyEvent(e){return["keydown","keyup"].includes(e)}function isClickEvent(e){return["contextmenu","click","mouse"].some(t=>e.includes(t))}function isListeningForASpecificKeyThatHasntBeenPressed(e,t){let n=t.filter(o=>!["window","document","prevent","stop","once","capture","self","away","outside","passive","preserve-scroll"].includes(o));if(n.includes("debounce")){let o=n.indexOf("debounce");n.splice(o,isNumeric((n[o+1]||"invalid-wait").split("ms")[0])?2:1)}if(n.includes("throttle")){let o=n.indexOf("throttle");n.splice(o,isNumeric((n[o+1]||"invalid-wait").split("ms")[0])?2:1)}if(n.length===0||n.length===1&&keyToModifiers(e.key).includes(n[0]))return!1;const i=["ctrl","shift","alt","meta","cmd","super"].filter(o=>n.includes(o));return n=n.filter(o=>!i.includes(o)),!(i.length>0&&i.filter(s=>((s==="cmd"||s==="super")&&(s="meta"),e[`${s}Key`])).length===i.length&&(isClickEvent(e.type)||keyToModifiers(e.key).includes(n[0])))}function keyToModifiers(e){if(!e)return[];e=kebabCase2(e);let t={ctrl:"control",slash:"/",space:" ",spacebar:" ",cmd:"meta",esc:"escape",up:"arrow-up",down:"arrow-down",left:"arrow-left",right:"arrow-right",period:".",comma:",",equal:"=",minus:"-",underscore:"_"};return t[e]=e,Object.keys(t).map(n=>{if(t[n]===e)return n}).filter(n=>n)}directive("model",(e,{modifiers:t,expression:n},{effect:r,cleanup:i})=>{let o=e;t.includes("parent")&&(o=e.parentNode);let s=evaluateLater(o,n),a;typeof n=="string"?a=evaluateLater(o,`${n} = __placeholder`):typeof n=="function"&&typeof n()=="string"?a=evaluateLater(o,`${n()} = __placeholder`):a=()=>{};let l=()=>{let d;return s(p=>d=p),isGetterSetter(d)?d.get():d},c=d=>{let p;s(g=>p=g),isGetterSetter(p)?p.set(d):a(()=>{},{scope:{__placeholder:d}})};typeof n=="string"&&e.type==="radio"&&mutateDom(()=>{e.hasAttribute("name")||e.setAttribute("name",n)});let u=e.tagName.toLowerCase()==="select"||["checkbox","radio"].includes(e.type)||t.includes("lazy")?"change":"input",f=isCloning?()=>{}:on(e,u,t,d=>{c(getInputValue(e,t,d,l()))});if(t.includes("fill")&&([void 0,null,""].includes(l())||isCheckbox(e)&&Array.isArray(l())||e.tagName.toLowerCase()==="select"&&e.multiple)&&c(getInputValue(e,t,{target:e},l())),e._x_removeModelListeners||(e._x_removeModelListeners={}),e._x_removeModelListeners.default=f,i(()=>e._x_removeModelListeners.default()),e.form){let d=on(e.form,"reset",[],p=>{nextTick(()=>e._x_model&&e._x_model.set(getInputValue(e,t,{target:e},l())))});i(()=>d())}e._x_model={get(){return l()},set(d){c(d)}},e._x_forceModelUpdate=d=>{d===void 0&&typeof n=="string"&&n.match(/\./)&&(d=""),window.fromModel=!0,mutateDom(()=>bind(e,"value",d)),delete window.fromModel},r(()=>{let d=l();t.includes("unintrusive")&&document.activeElement.isSameNode(e)||e._x_forceModelUpdate(d)})});function getInputValue(e,t,n,r){return mutateDom(()=>{if(n instanceof CustomEvent&&n.detail!==void 0)return n.detail!==null&&n.detail!==void 0?n.detail:n.target.value;if(isCheckbox(e))if(Array.isArray(r)){let i=null;return t.includes("number")?i=safeParseNumber(n.target.value):t.includes("boolean")?i=safeParseBoolean(n.target.value):i=n.target.value,n.target.checked?r.includes(i)?r:r.concat([i]):r.filter(o=>!checkedAttrLooseCompare2(o,i))}else return n.target.checked;else{if(e.tagName.toLowerCase()==="select"&&e.multiple)return t.includes("number")?Array.from(n.target.selectedOptions).map(i=>{let o=i.value||i.text;return safeParseNumber(o)}):t.includes("boolean")?Array.from(n.target.selectedOptions).map(i=>{let o=i.value||i.text;return safeParseBoolean(o)}):Array.from(n.target.selectedOptions).map(i=>i.value||i.text);{let i;return isRadio(e)?n.target.checked?i=n.target.value:i=r:i=n.target.value,t.includes("number")?safeParseNumber(i):t.includes("boolean")?safeParseBoolean(i):t.includes("trim")?i.trim():i}}})}function safeParseNumber(e){let t=e?parseFloat(e):null;return isNumeric2(t)?t:e}function checkedAttrLooseCompare2(e,t){return e==t}function isNumeric2(e){return!Array.isArray(e)&&!isNaN(e)}function isGetterSetter(e){return e!==null&&typeof e=="object"&&typeof e.get=="function"&&typeof e.set=="function"}directive("cloak",e=>queueMicrotask(()=>mutateDom(()=>e.removeAttribute(prefix("cloak")))));addInitSelector(()=>`[${prefix("init")}]`);directive("init",skipDuringClone((e,{expression:t},{evaluate:n})=>typeof t=="string"?!!t.trim()&&n(t,{},!1):n(t,{},!1)));directive("text",(e,{expression:t},{effect:n,evaluateLater:r})=>{let i=r(t);n(()=>{i(o=>{mutateDom(()=>{e.textContent=o})})})});directive("html",(e,{expression:t},{effect:n,evaluateLater:r})=>{let i=r(t);n(()=>{i(o=>{mutateDom(()=>{e.innerHTML=o,e._x_ignoreSelf=!0,initTree(e),delete e._x_ignoreSelf})})})});mapAttributes(startingWith(":",into(prefix("bind:"))));var handler2=(e,{value:t,modifiers:n,expression:r,original:i},{effect:o,cleanup:s})=>{if(!t){let l={};injectBindingProviders(l),evaluateLater(e,r)(u=>{applyBindingsObject(e,u,i)},{scope:l});return}if(t==="key")return storeKeyForXFor(e,r);if(e._x_inlineBindings&&e._x_inlineBindings[t]&&e._x_inlineBindings[t].extract)return;let a=evaluateLater(e,r);o(()=>a(l=>{l===void 0&&typeof r=="string"&&r.match(/\./)&&(l=""),mutateDom(()=>bind(e,t,l,n))})),s(()=>{e._x_undoAddedClasses&&e._x_undoAddedClasses(),e._x_undoAddedStyles&&e._x_undoAddedStyles()})};handler2.inline=(e,{value:t,modifiers:n,expression:r})=>{t&&(e._x_inlineBindings||(e._x_inlineBindings={}),e._x_inlineBindings[t]={expression:r,extract:!1})};directive("bind",handler2);function storeKeyForXFor(e,t){e._x_keyExpression=t}addRootSelector(()=>`[${prefix("data")}]`);directive("data",(e,{expression:t},{cleanup:n})=>{if(shouldSkipRegisteringDataDuringClone(e))return;t=t===""?"{}":t;let r={};injectMagics(r,e);let i={};injectDataProviders(i,r);let o=evaluate(e,t,{scope:i});(o===void 0||o===!0)&&(o={}),injectMagics(o,e);let s=reactive(o);initInterceptors(s);let a=addScopeToNode(e,s);s.init&&evaluate(e,s.init),n(()=>{s.destroy&&evaluate(e,s.destroy),a()})});interceptClone((e,t)=>{e._x_dataStack&&(t._x_dataStack=e._x_dataStack,t.setAttribute("data-has-alpine-state",!0))});function shouldSkipRegisteringDataDuringClone(e){return isCloning?isCloningLegacy?!0:e.hasAttribute("data-has-alpine-state"):!1}directive("show",(e,{modifiers:t,expression:n},{effect:r})=>{let i=evaluateLater(e,n);e._x_doHide||(e._x_doHide=()=>{mutateDom(()=>{e.style.setProperty("display","none",t.includes("important")?"important":void 0)})}),e._x_doShow||(e._x_doShow=()=>{mutateDom(()=>{e.style.length===1&&e.style.display==="none"?e.removeAttribute("style"):e.style.removeProperty("display")})});let o=()=>{e._x_doHide(),e._x_isShown=!1},s=()=>{e._x_doShow(),e._x_isShown=!0},a=()=>setTimeout(s),l=once(f=>f?s():o(),f=>{typeof e._x_toggleAndCascadeWithTransitions=="function"?e._x_toggleAndCascadeWithTransitions(e,f,s,o):f?a():o()}),c,u=!0;r(()=>i(f=>{!u&&f===c||(t.includes("immediate")&&(f?a():o()),l(f),c=f,u=!1)}))});directive("for",(e,{expression:t},{effect:n,cleanup:r})=>{let i=parseForExpression(t),o=evaluateLater(e,i.items),s=evaluateLater(e,e._x_keyExpression||"index");e._x_prevKeys=[],e._x_lookup={},n(()=>loop(e,i,o,s)),r(()=>{Object.values(e._x_lookup).forEach(a=>mutateDom(()=>{destroyTree(a),a.remove()})),delete e._x_prevKeys,delete e._x_lookup})});function loop(e,t,n,r){let i=s=>typeof s=="object"&&!Array.isArray(s),o=e;n(s=>{isNumeric3(s)&&s>=0&&(s=Array.from(Array(s).keys(),h=>h+1)),s===void 0&&(s=[]);let a=e._x_lookup,l=e._x_prevKeys,c=[],u=[];if(i(s))s=Object.entries(s).map(([h,m])=>{let y=getIterationScopeVariables(t,m,h,s);r(E=>{u.includes(E)&&warn("Duplicate key on x-for",e),u.push(E)},{scope:{index:h,...y}}),c.push(y)});else for(let h=0;h<s.length;h++){let m=getIterationScopeVariables(t,s[h],h,s);r(y=>{u.includes(y)&&warn("Duplicate key on x-for",e),u.push(y)},{scope:{index:h,...m}}),c.push(m)}let f=[],d=[],p=[],g=[];for(let h=0;h<l.length;h++){let m=l[h];u.indexOf(m)===-1&&p.push(m)}l=l.filter(h=>!p.includes(h));let v="template";for(let h=0;h<u.length;h++){let m=u[h],y=l.indexOf(m);if(y===-1)l.splice(h,0,m),f.push([v,h]);else if(y!==h){let E=l.splice(h,1)[0],b=l.splice(y-1,1)[0];l.splice(h,0,b),l.splice(y,0,E),d.push([E,b])}else g.push(m);v=m}for(let h=0;h<p.length;h++){let m=p[h];m in a&&(mutateDom(()=>{destroyTree(a[m]),a[m].remove()}),delete a[m])}for(let h=0;h<d.length;h++){let[m,y]=d[h],E=a[m],b=a[y],C=document.createElement("div");mutateDom(()=>{b||warn('x-for ":key" is undefined or invalid',o,y,a),b.after(C),E.after(b),b._x_currentIfEl&&b.after(b._x_currentIfEl),C.before(E),E._x_currentIfEl&&E.after(E._x_currentIfEl),C.remove()}),b._x_refreshXForScope(c[u.indexOf(y)])}for(let h=0;h<f.length;h++){let[m,y]=f[h],E=m==="template"?o:a[m];E._x_currentIfEl&&(E=E._x_currentIfEl);let b=c[y],C=u[y],T=document.importNode(o.content,!0).firstElementChild,A=reactive(b);addScopeToNode(T,A,o),T._x_refreshXForScope=L=>{Object.entries(L).forEach(([I,H])=>{A[I]=H})},mutateDom(()=>{E.after(T),skipDuringClone(()=>initTree(T))()}),typeof C=="object"&&warn("x-for key cannot be an object, it must be a string or an integer",o),a[C]=T}for(let h=0;h<g.length;h++)a[g[h]]._x_refreshXForScope(c[u.indexOf(g[h])]);o._x_prevKeys=u})}function parseForExpression(e){let t=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,n=/^\s*\(|\)\s*$/g,r=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,i=e.match(r);if(!i)return;let o={};o.items=i[2].trim();let s=i[1].replace(n,"").trim(),a=s.match(t);return a?(o.item=s.replace(t,"").trim(),o.index=a[1].trim(),a[2]&&(o.collection=a[2].trim())):o.item=s,o}function getIterationScopeVariables(e,t,n,r){let i={};return/^\[.*\]$/.test(e.item)&&Array.isArray(t)?e.item.replace("[","").replace("]","").split(",").map(s=>s.trim()).forEach((s,a)=>{i[s]=t[a]}):/^\{.*\}$/.test(e.item)&&!Array.isArray(t)&&typeof t=="object"?e.item.replace("{","").replace("}","").split(",").map(s=>s.trim()).forEach(s=>{i[s]=t[s]}):i[e.item]=t,e.index&&(i[e.index]=n),e.collection&&(i[e.collection]=r),i}function isNumeric3(e){return!Array.isArray(e)&&!isNaN(e)}function handler3(){}handler3.inline=(e,{expression:t},{cleanup:n})=>{let r=closestRoot(e);r._x_refs||(r._x_refs={}),r._x_refs[t]=e,n(()=>delete r._x_refs[t])};directive("ref",handler3);directive("if",(e,{expression:t},{effect:n,cleanup:r})=>{e.tagName.toLowerCase()!=="template"&&warn("x-if can only be used on a <template> tag",e);let i=evaluateLater(e,t),o=()=>{if(e._x_currentIfEl)return e._x_currentIfEl;let a=e.content.cloneNode(!0).firstElementChild;return addScopeToNode(a,{},e),mutateDom(()=>{e.after(a),skipDuringClone(()=>initTree(a))()}),e._x_currentIfEl=a,e._x_undoIf=()=>{mutateDom(()=>{destroyTree(a),a.remove()}),delete e._x_currentIfEl},a},s=()=>{e._x_undoIf&&(e._x_undoIf(),delete e._x_undoIf)};n(()=>i(a=>{a?o():s()})),r(()=>e._x_undoIf&&e._x_undoIf())});directive("id",(e,{expression:t},{evaluate:n})=>{n(t).forEach(i=>setIdRoot(e,i))});interceptClone((e,t)=>{e._x_ids&&(t._x_ids=e._x_ids)});mapAttributes(startingWith("@",into(prefix("on:"))));directive("on",skipDuringClone((e,{value:t,modifiers:n,expression:r},{cleanup:i})=>{let o=r?evaluateLater(e,r):()=>{};e.tagName.toLowerCase()==="template"&&(e._x_forwardEvents||(e._x_forwardEvents=[]),e._x_forwardEvents.includes(t)||e._x_forwardEvents.push(t));let s=on(e,t,n,a=>{o(()=>{},{scope:{$event:a},params:[a]})});i(()=>s())}));warnMissingPluginDirective("Collapse","collapse","collapse");warnMissingPluginDirective("Intersect","intersect","intersect");warnMissingPluginDirective("Focus","trap","focus");warnMissingPluginDirective("Mask","mask","mask");function warnMissingPluginDirective(e,t,n){directive(t,r=>warn(`You can't use [x-${t}] without first installing the "${e}" plugin here: https://alpinejs.dev/plugins/${n}`,r))}alpine_default.setEvaluator(normalEvaluator);alpine_default.setRawEvaluator(normalRawEvaluator);alpine_default.setReactivityEngine({reactive:reactive2,effect:effect2,release:stop,raw:toRaw});var src_default=alpine_default,module_default=src_default,htmx=(function(){const htmx={onLoad:null,process:null,on:null,off:null,trigger:null,ajax:null,find:null,findAll:null,closest:null,values:function(e,t){return getInputValues(e,t||"post").values},remove:null,addClass:null,removeClass:null,toggleClass:null,takeClass:null,swap:null,defineExtension:null,removeExtension:null,logAll:null,logNone:null,logger:null,config:{historyEnabled:!0,historyCacheSize:10,refreshOnHistoryMiss:!1,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:!0,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:!0,allowScriptTags:!0,inlineScriptNonce:"",inlineStyleNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:!1,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",scrollBehavior:"instant",defaultFocusScroll:!1,getCacheBusterParam:!1,globalViewTransitions:!1,methodsThatUseUrlParams:["get","delete"],selfRequestsOnly:!0,ignoreTitle:!1,scrollIntoViewOnBoost:!0,triggerSpecsCache:null,disableInheritance:!1,responseHandling:[{code:"204",swap:!1},{code:"[23]..",swap:!0},{code:"[45]..",swap:!1,error:!0}],allowNestedOobSwaps:!0,historyRestoreAsHxRequest:!0,reportValidityOfForms:!1},parseInterval:null,location,_:null,version:"2.0.8"};htmx.onLoad=onLoadHelper,htmx.process=processNode,htmx.on=addEventListenerImpl,htmx.off=removeEventListenerImpl,htmx.trigger=triggerEvent,htmx.ajax=ajaxHelper,htmx.find=find,htmx.findAll=findAll,htmx.closest=closest,htmx.remove=removeElement,htmx.addClass=addClassToElement,htmx.removeClass=removeClassFromElement,htmx.toggleClass=toggleClassOnElement,htmx.takeClass=takeClassForElement,htmx.swap=swap,htmx.defineExtension=defineExtension,htmx.removeExtension=removeExtension,htmx.logAll=logAll,htmx.logNone=logNone,htmx.parseInterval=parseInterval,htmx._=internalEval;const internalAPI={addTriggerHandler,bodyContains,canAccessLocalStorage,findThisElement,filterValues,swap,hasAttribute,getAttributeValue,getClosestAttributeValue,getClosestMatch,getExpressionVars,getHeaders,getInputValues,getInternalData,getSwapSpecification,getTriggerSpecs,getTarget,makeFragment,mergeObjects,makeSettleInfo,oobSwap,querySelectorExt,settleImmediately,shouldCancel,triggerEvent,triggerErrorEvent,withExtensions},VERBS=["get","post","put","delete","patch"],VERB_SELECTOR=VERBS.map(function(e){return"[hx-"+e+"], [data-hx-"+e+"]"}).join(", ");function parseInterval(e){if(e==null)return;let t=NaN;return e.slice(-2)=="ms"?t=parseFloat(e.slice(0,-2)):e.slice(-1)=="s"?t=parseFloat(e.slice(0,-1))*1e3:e.slice(-1)=="m"?t=parseFloat(e.slice(0,-1))*1e3*60:t=parseFloat(e),isNaN(t)?void 0:t}function getRawAttribute(e,t){return e instanceof Element&&e.getAttribute(t)}function hasAttribute(e,t){return!!e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function getAttributeValue(e,t){return getRawAttribute(e,t)||getRawAttribute(e,"data-"+t)}function parentElt(e){const t=e.parentElement;return!t&&e.parentNode instanceof ShadowRoot?e.parentNode:t}function getDocument(){return document}function getRootNode(e,t){return e.getRootNode?e.getRootNode({composed:t}):getDocument()}function getClosestMatch(e,t){for(;e&&!t(e);)e=parentElt(e);return e||null}function getAttributeValueWithDisinheritance(e,t,n){const r=getAttributeValue(t,n),i=getAttributeValue(t,"hx-disinherit");var o=getAttributeValue(t,"hx-inherit");if(e!==t){if(htmx.config.disableInheritance)return o&&(o==="*"||o.split(" ").indexOf(n)>=0)?r:null;if(i&&(i==="*"||i.split(" ").indexOf(n)>=0))return"unset"}return r}function getClosestAttributeValue(e,t){let n=null;if(getClosestMatch(e,function(r){return!!(n=getAttributeValueWithDisinheritance(e,asElement(r),t))}),n!=="unset")return n}function matches(e,t){return e instanceof Element&&e.matches(t)}function getStartTag(e){const n=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i.exec(e);return n?n[1].toLowerCase():""}function parseHTML(e){return"parseHTMLUnsafe"in Document?Document.parseHTMLUnsafe(e):new DOMParser().parseFromString(e,"text/html")}function takeChildrenFor(e,t){for(;t.childNodes.length>0;)e.append(t.childNodes[0])}function duplicateScript(e){const t=getDocument().createElement("script");return forEach(e.attributes,function(n){t.setAttribute(n.name,n.value)}),t.textContent=e.textContent,t.async=!1,htmx.config.inlineScriptNonce&&(t.nonce=htmx.config.inlineScriptNonce),t}function isJavaScriptScriptNode(e){return e.matches("script")&&(e.type==="text/javascript"||e.type==="module"||e.type==="")}function normalizeScriptTags(e){Array.from(e.querySelectorAll("script")).forEach(t=>{if(isJavaScriptScriptNode(t)){const n=duplicateScript(t),r=t.parentNode;try{r.insertBefore(n,t)}catch(i){logError(i)}finally{t.remove()}}})}function makeFragment(e){const t=e.replace(/<head(\s[^>]*)?>[\s\S]*?<\/head>/i,""),n=getStartTag(t);let r;if(n==="html"){r=new DocumentFragment;const o=parseHTML(e);takeChildrenFor(r,o.body),r.title=o.title}else if(n==="body"){r=new DocumentFragment;const o=parseHTML(t);takeChildrenFor(r,o.body),r.title=o.title}else{const o=parseHTML('<body><template class="internal-htmx-wrapper">'+t+"</template></body>");r=o.querySelector("template").content,r.title=o.title;var i=r.querySelector("title");i&&i.parentNode===r&&(i.remove(),r.title=i.innerText)}return r&&(htmx.config.allowScriptTags?normalizeScriptTags(r):r.querySelectorAll("script").forEach(o=>o.remove())),r}function maybeCall(e){e&&e()}function isType(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function isFunction(e){return typeof e=="function"}function isRawObject(e){return isType(e,"Object")}function getInternalData(e){const t="htmx-internal-data";let n=e[t];return n||(n=e[t]={}),n}function toArray(e){const t=[];if(e)for(let n=0;n<e.length;n++)t.push(e[n]);return t}function forEach(e,t){if(e)for(let n=0;n<e.length;n++)t(e[n])}function isScrolledIntoView(e){const t=e.getBoundingClientRect(),n=t.top,r=t.bottom;return n<window.innerHeight&&r>=0}function bodyContains(e){return e.getRootNode({composed:!0})===document}function splitOnWhitespace(e){return e.trim().split(/\s+/)}function mergeObjects(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function parseJSON(e){try{return JSON.parse(e)}catch(t){return logError(t),null}}function canAccessLocalStorage(){const e="htmx:sessionStorageTest";try{return sessionStorage.setItem(e,e),sessionStorage.removeItem(e),!0}catch{return!1}}function normalizePath(e){const t=new URL(e,"http://x");return t&&(e=t.pathname+t.search),e!="/"&&(e=e.replace(/\/+$/,"")),e}function internalEval(str){return maybeEval(getDocument().body,function(){return eval(str)})}function onLoadHelper(e){return htmx.on("htmx:load",function(n){e(n.detail.elt)})}function logAll(){htmx.logger=function(e,t,n){console&&console.log(t,e,n)}}function logNone(){htmx.logger=null}function find(e,t){return typeof e!="string"?e.querySelector(t):find(getDocument(),e)}function findAll(e,t){return typeof e!="string"?e.querySelectorAll(t):findAll(getDocument(),e)}function getWindow(){return window}function removeElement(e,t){e=resolveTarget(e),t?getWindow().setTimeout(function(){removeElement(e),e=null},t):parentElt(e).removeChild(e)}function asElement(e){return e instanceof Element?e:null}function asHtmlElement(e){return e instanceof HTMLElement?e:null}function asString(e){return typeof e=="string"?e:null}function asParentNode(e){return e instanceof Element||e instanceof Document||e instanceof DocumentFragment?e:null}function addClassToElement(e,t,n){e=asElement(resolveTarget(e)),e&&(n?getWindow().setTimeout(function(){addClassToElement(e,t),e=null},n):e.classList&&e.classList.add(t))}function removeClassFromElement(e,t,n){let r=asElement(resolveTarget(e));r&&(n?getWindow().setTimeout(function(){removeClassFromElement(r,t),r=null},n):r.classList&&(r.classList.remove(t),r.classList.length===0&&r.removeAttribute("class")))}function toggleClassOnElement(e,t){e=resolveTarget(e),e.classList.toggle(t)}function takeClassForElement(e,t){e=resolveTarget(e),forEach(e.parentElement.children,function(n){removeClassFromElement(n,t)}),addClassToElement(asElement(e),t)}function closest(e,t){return e=asElement(resolveTarget(e)),e?e.closest(t):null}function startsWith(e,t){return e.substring(0,t.length)===t}function endsWith(e,t){return e.substring(e.length-t.length)===t}function normalizeSelector(e){const t=e.trim();return startsWith(t,"<")&&endsWith(t,"/>")?t.substring(1,t.length-2):t}function querySelectorAllExt(e,t,n){if(t.indexOf("global ")===0)return querySelectorAllExt(e,t.slice(7),!0);e=resolveTarget(e);const r=[];{let s=0,a=0;for(let l=0;l<t.length;l++){const c=t[l];if(c===","&&s===0){r.push(t.substring(a,l)),a=l+1;continue}c==="<"?s++:c==="/"&&l<t.length-1&&t[l+1]===">"&&s--}a<t.length&&r.push(t.substring(a))}const i=[],o=[];for(;r.length>0;){const s=normalizeSelector(r.shift());let a;s.indexOf("closest ")===0?a=closest(asElement(e),normalizeSelector(s.slice(8))):s.indexOf("find ")===0?a=find(asParentNode(e),normalizeSelector(s.slice(5))):s==="next"||s==="nextElementSibling"?a=asElement(e).nextElementSibling:s.indexOf("next ")===0?a=scanForwardQuery(e,normalizeSelector(s.slice(5)),!!n):s==="previous"||s==="previousElementSibling"?a=asElement(e).previousElementSibling:s.indexOf("previous ")===0?a=scanBackwardsQuery(e,normalizeSelector(s.slice(9)),!!n):s==="document"?a=document:s==="window"?a=window:s==="body"?a=document.body:s==="root"?a=getRootNode(e,!!n):s==="host"?a=e.getRootNode().host:o.push(s),a&&i.push(a)}if(o.length>0){const s=o.join(","),a=asParentNode(getRootNode(e,!!n));i.push(...toArray(a.querySelectorAll(s)))}return i}var scanForwardQuery=function(e,t,n){const r=asParentNode(getRootNode(e,n)).querySelectorAll(t);for(let i=0;i<r.length;i++){const o=r[i];if(o.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_PRECEDING)return o}},scanBackwardsQuery=function(e,t,n){const r=asParentNode(getRootNode(e,n)).querySelectorAll(t);for(let i=r.length-1;i>=0;i--){const o=r[i];if(o.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_FOLLOWING)return o}};function querySelectorExt(e,t){return typeof e!="string"?querySelectorAllExt(e,t)[0]:querySelectorAllExt(getDocument().body,e)[0]}function resolveTarget(e,t){return typeof e=="string"?find(asParentNode(t)||document,e):e}function processEventArgs(e,t,n,r){return isFunction(t)?{target:getDocument().body,event:asString(e),listener:t,options:n}:{target:resolveTarget(e),event:asString(t),listener:n,options:r}}function addEventListenerImpl(e,t,n,r){return ready(function(){const o=processEventArgs(e,t,n,r);o.target.addEventListener(o.event,o.listener,o.options)}),isFunction(t)?t:n}function removeEventListenerImpl(e,t,n){return ready(function(){const r=processEventArgs(e,t,n);r.target.removeEventListener(r.event,r.listener)}),isFunction(t)?t:n}const DUMMY_ELT=getDocument().createElement("output");function findAttributeTargets(e,t){const n=getClosestAttributeValue(e,t);if(n){if(n==="this")return[findThisElement(e,t)];{const r=querySelectorAllExt(e,n);if(/(^|,)(\s*)inherit(\s*)($|,)/.test(n)){const o=asElement(getClosestMatch(e,function(s){return s!==e&&hasAttribute(asElement(s),t)}));o&&r.push(...findAttributeTargets(o,t))}return r.length===0?(logError('The selector "'+n+'" on '+t+" returned no matches!"),[DUMMY_ELT]):r}}}function findThisElement(e,t){return asElement(getClosestMatch(e,function(n){return getAttributeValue(asElement(n),t)!=null}))}function getTarget(e){const t=getClosestAttributeValue(e,"hx-target");return t?t==="this"?findThisElement(e,"hx-target"):querySelectorExt(e,t):getInternalData(e).boosted?getDocument().body:e}function shouldSettleAttribute(e){return htmx.config.attributesToSettle.includes(e)}function cloneAttributes(e,t){forEach(Array.from(e.attributes),function(n){!t.hasAttribute(n.name)&&shouldSettleAttribute(n.name)&&e.removeAttribute(n.name)}),forEach(t.attributes,function(n){shouldSettleAttribute(n.name)&&e.setAttribute(n.name,n.value)})}function isInlineSwap(e,t){const n=getExtensions(t);for(let r=0;r<n.length;r++){const i=n[r];try{if(i.isInlineSwap(e))return!0}catch(o){logError(o)}}return e==="outerHTML"}function oobSwap(e,t,n,r){r=r||getDocument();let i="#"+CSS.escape(getRawAttribute(t,"id")),o="outerHTML";e==="true"||(e.indexOf(":")>0?(o=e.substring(0,e.indexOf(":")),i=e.substring(e.indexOf(":")+1)):o=e),t.removeAttribute("hx-swap-oob"),t.removeAttribute("data-hx-swap-oob");const s=querySelectorAllExt(r,i,!1);return s.length?(forEach(s,function(a){let l;const c=t.cloneNode(!0);l=getDocument().createDocumentFragment(),l.appendChild(c),isInlineSwap(o,a)||(l=asParentNode(c));const u={shouldSwap:!0,target:a,fragment:l};triggerEvent(a,"htmx:oobBeforeSwap",u)&&(a=u.target,u.shouldSwap&&(handlePreservedElements(l),swapWithStyle(o,a,a,l,n),restorePreservedElements()),forEach(n.elts,function(f){triggerEvent(f,"htmx:oobAfterSwap",u)}))}),t.parentNode.removeChild(t)):(t.parentNode.removeChild(t),triggerErrorEvent(getDocument().body,"htmx:oobErrorNoTarget",{content:t})),e}function restorePreservedElements(){const e=find("#--htmx-preserve-pantry--");if(e){for(const t of[...e.children]){const n=find("#"+t.id);n.parentNode.moveBefore(t,n),n.remove()}e.remove()}}function handlePreservedElements(e){forEach(findAll(e,"[hx-preserve], [data-hx-preserve]"),function(t){const n=getAttributeValue(t,"id"),r=getDocument().getElementById(n);if(r!=null)if(t.moveBefore){let i=find("#--htmx-preserve-pantry--");i==null&&(getDocument().body.insertAdjacentHTML("afterend","<div id='--htmx-preserve-pantry--'></div>"),i=find("#--htmx-preserve-pantry--")),i.moveBefore(r,null)}else t.parentNode.replaceChild(r,t)})}function handleAttributes(e,t,n){forEach(t.querySelectorAll("[id]"),function(r){const i=getRawAttribute(r,"id");if(i&&i.length>0){const o=i.replace("'","\\'"),s=r.tagName.replace(":","\\:"),a=asParentNode(e),l=a&&a.querySelector(s+"[id='"+o+"']");if(l&&l!==a){const c=r.cloneNode();cloneAttributes(r,l),n.tasks.push(function(){cloneAttributes(r,c)})}}})}function makeAjaxLoadTask(e){return function(){removeClassFromElement(e,htmx.config.addedClass),processNode(asElement(e)),processFocus(asParentNode(e)),triggerEvent(e,"htmx:load")}}function processFocus(e){const t="[autofocus]",n=asHtmlElement(matches(e,t)?e:e.querySelector(t));n!=null&&n.focus()}function insertNodesBefore(e,t,n,r){for(handleAttributes(e,n,r);n.childNodes.length>0;){const i=n.firstChild;addClassToElement(asElement(i),htmx.config.addedClass),e.insertBefore(i,t),i.nodeType!==Node.TEXT_NODE&&i.nodeType!==Node.COMMENT_NODE&&r.tasks.push(makeAjaxLoadTask(i))}}function stringHash(e,t){let n=0;for(;n<e.length;)t=(t<<5)-t+e.charCodeAt(n++)|0;return t}function attributeHash(e){let t=0;for(let n=0;n<e.attributes.length;n++){const r=e.attributes[n];r.value&&(t=stringHash(r.name,t),t=stringHash(r.value,t))}return t}function deInitOnHandlers(e){const t=getInternalData(e);if(t.onHandlers){for(let n=0;n<t.onHandlers.length;n++){const r=t.onHandlers[n];removeEventListenerImpl(e,r.event,r.listener)}delete t.onHandlers}}function deInitNode(e){const t=getInternalData(e);t.timeout&&clearTimeout(t.timeout),t.listenerInfos&&forEach(t.listenerInfos,function(n){n.on&&removeEventListenerImpl(n.on,n.trigger,n.listener)}),deInitOnHandlers(e),forEach(Object.keys(t),function(n){n!=="firstInitCompleted"&&delete t[n]})}function cleanUpElement(e){triggerEvent(e,"htmx:beforeCleanupElement"),deInitNode(e),forEach(e.children,function(t){cleanUpElement(t)})}function swapOuterHTML(e,t,n){if(e.tagName==="BODY")return swapInnerHTML(e,t,n);let r;const i=e.previousSibling,o=parentElt(e);if(o){for(insertNodesBefore(o,e,t,n),i==null?r=o.firstChild:r=i.nextSibling,n.elts=n.elts.filter(function(s){return s!==e});r&&r!==e;)r instanceof Element&&n.elts.push(r),r=r.nextSibling;cleanUpElement(e),e.remove()}}function swapAfterBegin(e,t,n){return insertNodesBefore(e,e.firstChild,t,n)}function swapBeforeBegin(e,t,n){return insertNodesBefore(parentElt(e),e,t,n)}function swapBeforeEnd(e,t,n){return insertNodesBefore(e,null,t,n)}function swapAfterEnd(e,t,n){return insertNodesBefore(parentElt(e),e.nextSibling,t,n)}function swapDelete(e){cleanUpElement(e);const t=parentElt(e);if(t)return t.removeChild(e)}function swapInnerHTML(e,t,n){const r=e.firstChild;if(insertNodesBefore(e,r,t,n),r){for(;r.nextSibling;)cleanUpElement(r.nextSibling),e.removeChild(r.nextSibling);cleanUpElement(r),e.removeChild(r)}}function swapWithStyle(e,t,n,r,i){switch(e){case"none":return;case"outerHTML":swapOuterHTML(n,r,i);return;case"afterbegin":swapAfterBegin(n,r,i);return;case"beforebegin":swapBeforeBegin(n,r,i);return;case"beforeend":swapBeforeEnd(n,r,i);return;case"afterend":swapAfterEnd(n,r,i);return;case"delete":swapDelete(n);return;default:var o=getExtensions(t);for(let s=0;s<o.length;s++){const a=o[s];try{const l=a.handleSwap(e,n,r,i);if(l){if(Array.isArray(l))for(let c=0;c<l.length;c++){const u=l[c];u.nodeType!==Node.TEXT_NODE&&u.nodeType!==Node.COMMENT_NODE&&i.tasks.push(makeAjaxLoadTask(u))}return}}catch(l){logError(l)}}e==="innerHTML"?swapInnerHTML(n,r,i):swapWithStyle(htmx.config.defaultSwapStyle,t,n,r,i)}}function findAndSwapOobElements(e,t,n){var r=findAll(e,"[hx-swap-oob], [data-hx-swap-oob]");return forEach(r,function(i){if(htmx.config.allowNestedOobSwaps||i.parentElement===null){const o=getAttributeValue(i,"hx-swap-oob");o!=null&&oobSwap(o,i,t,n)}else i.removeAttribute("hx-swap-oob"),i.removeAttribute("data-hx-swap-oob")}),r.length>0}function swap(e,t,n,r){r||(r={});let i=null,o=null,s=function(){maybeCall(r.beforeSwapCallback),e=resolveTarget(e);const c=r.contextElement?getRootNode(r.contextElement,!1):getDocument(),u=document.activeElement;let f={};f={elt:u,start:u?u.selectionStart:null,end:u?u.selectionEnd:null};const d=makeSettleInfo(e);if(n.swapStyle==="textContent")e.textContent=t;else{let g=makeFragment(t);if(d.title=r.title||g.title,r.historyRequest&&(g=g.querySelector("[hx-history-elt],[data-hx-history-elt]")||g),r.selectOOB){const v=r.selectOOB.split(",");for(let h=0;h<v.length;h++){const m=v[h].split(":",2);let y=m[0].trim();y.indexOf("#")===0&&(y=y.substring(1));const E=m[1]||"true",b=g.querySelector("#"+y);b&&oobSwap(E,b,d,c)}}if(findAndSwapOobElements(g,d,c),forEach(findAll(g,"template"),function(v){v.content&&findAndSwapOobElements(v.content,d,c)&&v.remove()}),r.select){const v=getDocument().createDocumentFragment();forEach(g.querySelectorAll(r.select),function(h){v.appendChild(h)}),g=v}handlePreservedElements(g),swapWithStyle(n.swapStyle,r.contextElement,e,g,d),restorePreservedElements()}if(f.elt&&!bodyContains(f.elt)&&getRawAttribute(f.elt,"id")){const g=document.getElementById(getRawAttribute(f.elt,"id")),v={preventScroll:n.focusScroll!==void 0?!n.focusScroll:!htmx.config.defaultFocusScroll};if(g){if(f.start&&g.setSelectionRange)try{g.setSelectionRange(f.start,f.end)}catch{}g.focus(v)}}e.classList.remove(htmx.config.swappingClass),forEach(d.elts,function(g){g.classList&&g.classList.add(htmx.config.settlingClass),triggerEvent(g,"htmx:afterSwap",r.eventInfo)}),maybeCall(r.afterSwapCallback),n.ignoreTitle||handleTitle(d.title);const p=function(){if(forEach(d.tasks,function(g){g.call()}),forEach(d.elts,function(g){g.classList&&g.classList.remove(htmx.config.settlingClass),triggerEvent(g,"htmx:afterSettle",r.eventInfo)}),r.anchor){const g=asElement(resolveTarget("#"+r.anchor));g&&g.scrollIntoView({block:"start",behavior:"auto"})}updateScrollState(d.elts,n),maybeCall(r.afterSettleCallback),maybeCall(i)};n.settleDelay>0?getWindow().setTimeout(p,n.settleDelay):p()},a=htmx.config.globalViewTransitions;n.hasOwnProperty("transition")&&(a=n.transition);const l=r.contextElement||getDocument();if(a&&triggerEvent(l,"htmx:beforeTransition",r.eventInfo)&&typeof Promise<"u"&&document.startViewTransition){const c=new Promise(function(f,d){i=f,o=d}),u=s;s=function(){document.startViewTransition(function(){return u(),c})}}try{n!=null&&n.swapDelay&&n.swapDelay>0?getWindow().setTimeout(s,n.swapDelay):s()}catch(c){throw triggerErrorEvent(l,"htmx:swapError",r.eventInfo),maybeCall(o),c}}function handleTriggerHeader(e,t,n){const r=e.getResponseHeader(t);if(r.indexOf("{")===0){const i=parseJSON(r);for(const o in i)if(i.hasOwnProperty(o)){let s=i[o];isRawObject(s)?n=s.target!==void 0?s.target:n:s={value:s},triggerEvent(n,o,s)}}else{const i=r.split(",");for(let o=0;o<i.length;o++)triggerEvent(n,i[o].trim(),[])}}const WHITESPACE_OR_COMMA=/[\s,]/,SYMBOL_START=/[_$a-zA-Z]/,SYMBOL_CONT=/[_$a-zA-Z0-9]/,STRINGISH_START=['"',"'","/"],NOT_WHITESPACE=/[^\s]/,COMBINED_SELECTOR_START=/[{(]/,COMBINED_SELECTOR_END=/[})]/;function tokenizeString(e){const t=[];let n=0;for(;n<e.length;){if(SYMBOL_START.exec(e.charAt(n))){for(var r=n;SYMBOL_CONT.exec(e.charAt(n+1));)n++;t.push(e.substring(r,n+1))}else if(STRINGISH_START.indexOf(e.charAt(n))!==-1){const i=e.charAt(n);var r=n;for(n++;n<e.length&&e.charAt(n)!==i;)e.charAt(n)==="\\"&&n++,n++;t.push(e.substring(r,n+1))}else{const i=e.charAt(n);t.push(i)}n++}return t}function isPossibleRelativeReference(e,t,n){return SYMBOL_START.exec(e.charAt(0))&&e!=="true"&&e!=="false"&&e!=="this"&&e!==n&&t!=="."}function maybeGenerateConditional(e,t,n){if(t[0]==="["){t.shift();let r=1,i=" return (function("+n+"){ return (",o=null;for(;t.length>0;){const s=t[0];if(s==="]"){if(r--,r===0){o===null&&(i=i+"true"),t.shift(),i+=")})";try{const a=maybeEval(e,function(){return Function(i)()},function(){return!0});return a.source=i,a}catch(a){return triggerErrorEvent(getDocument().body,"htmx:syntax:error",{error:a,source:i}),null}}}else s==="["&&r++;isPossibleRelativeReference(s,o,n)?i+="(("+n+"."+s+") ? ("+n+"."+s+") : (window."+s+"))":i=i+s,o=t.shift()}}}function consumeUntil(e,t){let n="";for(;e.length>0&&!t.test(e[0]);)n+=e.shift();return n}function consumeCSSSelector(e){let t;return e.length>0&&COMBINED_SELECTOR_START.test(e[0])?(e.shift(),t=consumeUntil(e,COMBINED_SELECTOR_END).trim(),e.shift()):t=consumeUntil(e,WHITESPACE_OR_COMMA),t}const INPUT_SELECTOR="input, textarea, select";function parseAndCacheTrigger(e,t,n){const r=[],i=tokenizeString(t);do{consumeUntil(i,NOT_WHITESPACE);const a=i.length,l=consumeUntil(i,/[,\[\s]/);if(l!=="")if(l==="every"){const c={trigger:"every"};consumeUntil(i,NOT_WHITESPACE),c.pollInterval=parseInterval(consumeUntil(i,/[,\[\s]/)),consumeUntil(i,NOT_WHITESPACE);var o=maybeGenerateConditional(e,i,"event");o&&(c.eventFilter=o),r.push(c)}else{const c={trigger:l};var o=maybeGenerateConditional(e,i,"event");for(o&&(c.eventFilter=o),consumeUntil(i,NOT_WHITESPACE);i.length>0&&i[0]!==",";){const f=i.shift();if(f==="changed")c.changed=!0;else if(f==="once")c.once=!0;else if(f==="consume")c.consume=!0;else if(f==="delay"&&i[0]===":")i.shift(),c.delay=parseInterval(consumeUntil(i,WHITESPACE_OR_COMMA));else if(f==="from"&&i[0]===":"){if(i.shift(),COMBINED_SELECTOR_START.test(i[0]))var s=consumeCSSSelector(i);else{var s=consumeUntil(i,WHITESPACE_OR_COMMA);if(s==="closest"||s==="find"||s==="next"||s==="previous"){i.shift();const p=consumeCSSSelector(i);p.length>0&&(s+=" "+p)}}c.from=s}else f==="target"&&i[0]===":"?(i.shift(),c.target=consumeCSSSelector(i)):f==="throttle"&&i[0]===":"?(i.shift(),c.throttle=parseInterval(consumeUntil(i,WHITESPACE_OR_COMMA))):f==="queue"&&i[0]===":"?(i.shift(),c.queue=consumeUntil(i,WHITESPACE_OR_COMMA)):f==="root"&&i[0]===":"?(i.shift(),c[f]=consumeCSSSelector(i)):f==="threshold"&&i[0]===":"?(i.shift(),c[f]=consumeUntil(i,WHITESPACE_OR_COMMA)):triggerErrorEvent(e,"htmx:syntax:error",{token:i.shift()});consumeUntil(i,NOT_WHITESPACE)}r.push(c)}i.length===a&&triggerErrorEvent(e,"htmx:syntax:error",{token:i.shift()}),consumeUntil(i,NOT_WHITESPACE)}while(i[0]===","&&i.shift());return n&&(n[t]=r),r}function getTriggerSpecs(e){const t=getAttributeValue(e,"hx-trigger");let n=[];if(t){const r=htmx.config.triggerSpecsCache;n=r&&r[t]||parseAndCacheTrigger(e,t,r)}return n.length>0?n:matches(e,"form")?[{trigger:"submit"}]:matches(e,'input[type="button"], input[type="submit"]')?[{trigger:"click"}]:matches(e,INPUT_SELECTOR)?[{trigger:"change"}]:[{trigger:"click"}]}function cancelPolling(e){getInternalData(e).cancelled=!0}function processPolling(e,t,n){const r=getInternalData(e);r.timeout=getWindow().setTimeout(function(){bodyContains(e)&&r.cancelled!==!0&&(maybeFilterEvent(n,e,makeEvent("hx:poll:trigger",{triggerSpec:n,target:e}))||t(e),processPolling(e,t,n))},n.pollInterval)}function isLocalLink(e){return location.hostname===e.hostname&&getRawAttribute(e,"href")&&getRawAttribute(e,"href").indexOf("#")!==0}function eltIsDisabled(e){return closest(e,htmx.config.disableSelector)}function boostElement(e,t,n){if(e instanceof HTMLAnchorElement&&isLocalLink(e)&&(e.target===""||e.target==="_self")||e.tagName==="FORM"&&String(getRawAttribute(e,"method")).toLowerCase()!=="dialog"){t.boosted=!0;let r,i;if(e.tagName==="A")r="get",i=getRawAttribute(e,"href");else{const o=getRawAttribute(e,"method");r=o?o.toLowerCase():"get",i=getRawAttribute(e,"action"),(i==null||i==="")&&(i=location.href),r==="get"&&i.includes("?")&&(i=i.replace(/\?[^#]+/,""))}n.forEach(function(o){addEventListener(e,function(s,a){const l=asElement(s);if(eltIsDisabled(l)){cleanUpElement(l);return}issueAjaxRequest(r,i,l,a)},t,o,!0)})}}function shouldCancel(e,t){if(e.type==="submit"&&t.tagName==="FORM")return!0;if(e.type==="click"){const n=t.closest('input[type="submit"], button');if(n&&n.form&&n.type==="submit")return!0;const r=t.closest("a"),i=/^#.+/;if(r&&r.href&&!i.test(r.getAttribute("href")))return!0}return!1}function ignoreBoostedAnchorCtrlClick(e,t){return getInternalData(e).boosted&&e instanceof HTMLAnchorElement&&t.type==="click"&&(t.ctrlKey||t.metaKey)}function maybeFilterEvent(e,t,n){const r=e.eventFilter;if(r)try{return r.call(t,n)!==!0}catch(i){const o=r.source;return triggerErrorEvent(getDocument().body,"htmx:eventFilter:error",{error:i,source:o}),!0}return!1}function addEventListener(e,t,n,r,i){const o=getInternalData(e);let s;r.from?s=querySelectorAllExt(e,r.from):s=[e],r.changed&&("lastValue"in o||(o.lastValue=new WeakMap),s.forEach(function(a){o.lastValue.has(r)||o.lastValue.set(r,new WeakMap),o.lastValue.get(r).set(a,a.value)})),forEach(s,function(a){const l=function(c){if(!bodyContains(e)){a.removeEventListener(r.trigger,l);return}if(ignoreBoostedAnchorCtrlClick(e,c)||((i||shouldCancel(c,a))&&c.preventDefault(),maybeFilterEvent(r,e,c)))return;const u=getInternalData(c);if(u.triggerSpec=r,u.handledFor==null&&(u.handledFor=[]),u.handledFor.indexOf(e)<0){if(u.handledFor.push(e),r.consume&&c.stopPropagation(),r.target&&c.target&&!matches(asElement(c.target),r.target))return;if(r.once){if(o.triggeredOnce)return;o.triggeredOnce=!0}if(r.changed){const f=c.target,d=f.value,p=o.lastValue.get(r);if(p.has(f)&&p.get(f)===d)return;p.set(f,d)}if(o.delayed&&clearTimeout(o.delayed),o.throttle)return;r.throttle>0?o.throttle||(triggerEvent(e,"htmx:trigger"),t(e,c),o.throttle=getWindow().setTimeout(function(){o.throttle=null},r.throttle)):r.delay>0?o.delayed=getWindow().setTimeout(function(){triggerEvent(e,"htmx:trigger"),t(e,c)},r.delay):(triggerEvent(e,"htmx:trigger"),t(e,c))}};n.listenerInfos==null&&(n.listenerInfos=[]),n.listenerInfos.push({trigger:r.trigger,listener:l,on:a}),a.addEventListener(r.trigger,l)})}let windowIsScrolling=!1,scrollHandler=null;function initScrollHandler(){scrollHandler||(scrollHandler=function(){windowIsScrolling=!0},window.addEventListener("scroll",scrollHandler),window.addEventListener("resize",scrollHandler),setInterval(function(){windowIsScrolling&&(windowIsScrolling=!1,forEach(getDocument().querySelectorAll("[hx-trigger*='revealed'],[data-hx-trigger*='revealed']"),function(e){maybeReveal(e)}))},200))}function maybeReveal(e){!hasAttribute(e,"data-hx-revealed")&&isScrolledIntoView(e)&&(e.setAttribute("data-hx-revealed","true"),getInternalData(e).initHash?triggerEvent(e,"revealed"):e.addEventListener("htmx:afterProcessNode",function(){triggerEvent(e,"revealed")},{once:!0}))}function loadImmediately(e,t,n,r){const i=function(){n.loaded||(n.loaded=!0,triggerEvent(e,"htmx:trigger"),t(e))};r>0?getWindow().setTimeout(i,r):i()}function processVerbs(e,t,n){let r=!1;return forEach(VERBS,function(i){if(hasAttribute(e,"hx-"+i)){const o=getAttributeValue(e,"hx-"+i);r=!0,t.path=o,t.verb=i,n.forEach(function(s){addTriggerHandler(e,s,t,function(a,l){const c=asElement(a);if(eltIsDisabled(c)){cleanUpElement(c);return}issueAjaxRequest(i,o,c,l)})})}}),r}function addTriggerHandler(e,t,n,r){if(t.trigger==="revealed")initScrollHandler(),addEventListener(e,r,n,t),maybeReveal(asElement(e));else if(t.trigger==="intersect"){const i={};t.root&&(i.root=querySelectorExt(e,t.root)),t.threshold&&(i.threshold=parseFloat(t.threshold)),new IntersectionObserver(function(s){for(let a=0;a<s.length;a++)if(s[a].isIntersecting){triggerEvent(e,"intersect");break}},i).observe(asElement(e)),addEventListener(asElement(e),r,n,t)}else!n.firstInitCompleted&&t.trigger==="load"?maybeFilterEvent(t,e,makeEvent("load",{elt:e}))||loadImmediately(asElement(e),r,n,t.delay):t.pollInterval>0?(n.polling=!0,processPolling(asElement(e),r,t)):addEventListener(e,r,n,t)}function shouldProcessHxOn(e){const t=asElement(e);if(!t)return!1;const n=t.attributes;for(let r=0;r<n.length;r++){const i=n[r].name;if(startsWith(i,"hx-on:")||startsWith(i,"data-hx-on:")||startsWith(i,"hx-on-")||startsWith(i,"data-hx-on-"))return!0}return!1}const HX_ON_QUERY=new XPathEvaluator().createExpression('.//*[@*[ starts-with(name(), "hx-on:") or starts-with(name(), "data-hx-on:") or starts-with(name(), "hx-on-") or starts-with(name(), "data-hx-on-") ]]');function processHXOnRoot(e,t){shouldProcessHxOn(e)&&t.push(asElement(e));const n=HX_ON_QUERY.evaluate(e);let r=null;for(;r=n.iterateNext();)t.push(asElement(r))}function findHxOnWildcardElements(e){const t=[];if(e instanceof DocumentFragment)for(const n of e.childNodes)processHXOnRoot(n,t);else processHXOnRoot(e,t);return t}function findElementsToProcess(e){if(e.querySelectorAll){const n=", [hx-boost] a, [data-hx-boost] a, a[hx-boost], a[data-hx-boost]",r=[];for(const o in extensions){const s=extensions[o];if(s.getSelectors){var t=s.getSelectors();t&&r.push(t)}}return e.querySelectorAll(VERB_SELECTOR+n+", form, [type='submit'], [hx-ext], [data-hx-ext], [hx-trigger], [data-hx-trigger]"+r.flat().map(o=>", "+o).join(""))}else return[]}function maybeSetLastButtonClicked(e){const t=getTargetButton(e.target),n=getRelatedFormData(e);n&&(n.lastButtonClicked=t)}function maybeUnsetLastButtonClicked(e){const t=getRelatedFormData(e);t&&(t.lastButtonClicked=null)}function getTargetButton(e){return closest(asElement(e),"button, input[type='submit']")}function getRelatedForm(e){return e.form||closest(e,"form")}function getRelatedFormData(e){const t=getTargetButton(e.target);if(!t)return;const n=getRelatedForm(t);if(n)return getInternalData(n)}function initButtonTracking(e){e.addEventListener("click",maybeSetLastButtonClicked),e.addEventListener("focusin",maybeSetLastButtonClicked),e.addEventListener("focusout",maybeUnsetLastButtonClicked)}function addHxOnEventHandler(e,t,n){const r=getInternalData(e);Array.isArray(r.onHandlers)||(r.onHandlers=[]);let i;const o=function(s){maybeEval(e,function(){eltIsDisabled(e)||(i||(i=new Function("event",n)),i.call(e,s))})};e.addEventListener(t,o),r.onHandlers.push({event:t,listener:o})}function processHxOnWildcard(e){deInitOnHandlers(e);for(let t=0;t<e.attributes.length;t++){const n=e.attributes[t].name,r=e.attributes[t].value;if(startsWith(n,"hx-on")||startsWith(n,"data-hx-on")){const i=n.indexOf("-on")+3,o=n.slice(i,i+1);if(o==="-"||o===":"){let s=n.slice(i+1);startsWith(s,":")?s="htmx"+s:startsWith(s,"-")?s="htmx:"+s.slice(1):startsWith(s,"htmx-")&&(s="htmx:"+s.slice(5)),addHxOnEventHandler(e,s,r)}}}}function initNode(e){triggerEvent(e,"htmx:beforeProcessNode");const t=getInternalData(e),n=getTriggerSpecs(e);processVerbs(e,t,n)||(getClosestAttributeValue(e,"hx-boost")==="true"?boostElement(e,t,n):hasAttribute(e,"hx-trigger")&&n.forEach(function(i){addTriggerHandler(e,i,t,function(){})})),(e.tagName==="FORM"||getRawAttribute(e,"type")==="submit"&&hasAttribute(e,"form"))&&initButtonTracking(e),t.firstInitCompleted=!0,triggerEvent(e,"htmx:afterProcessNode")}function maybeDeInitAndHash(e){if(!(e instanceof Element))return!1;const t=getInternalData(e),n=attributeHash(e);return t.initHash!==n?(deInitNode(e),t.initHash=n,!0):!1}function processNode(e){if(e=resolveTarget(e),eltIsDisabled(e)){cleanUpElement(e);return}const t=[];maybeDeInitAndHash(e)&&t.push(e),forEach(findElementsToProcess(e),function(n){if(eltIsDisabled(n)){cleanUpElement(n);return}maybeDeInitAndHash(n)&&t.push(n)}),forEach(findHxOnWildcardElements(e),processHxOnWildcard),forEach(t,initNode)}function kebabEventName(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function makeEvent(e,t){return new CustomEvent(e,{bubbles:!0,cancelable:!0,composed:!0,detail:t})}function triggerErrorEvent(e,t,n){triggerEvent(e,t,mergeObjects({error:t},n))}function ignoreEventForLogging(e){return e==="htmx:afterProcessNode"}function withExtensions(e,t,n){forEach(getExtensions(e,[],n),function(r){try{t(r)}catch(i){logError(i)}})}function logError(e){console.error(e)}function triggerEvent(e,t,n){e=resolveTarget(e),n==null&&(n={}),n.elt=e;const r=makeEvent(t,n);htmx.logger&&!ignoreEventForLogging(t)&&htmx.logger(e,t,n),n.error&&(logError(n.error),triggerEvent(e,"htmx:error",{errorInfo:n}));let i=e.dispatchEvent(r);const o=kebabEventName(t);if(i&&o!==t){const s=makeEvent(o,r.detail);i=i&&e.dispatchEvent(s)}return withExtensions(asElement(e),function(s){i=i&&s.onEvent(t,r)!==!1&&!r.defaultPrevented}),i}let currentPathForHistory;function setCurrentPathForHistory(e){currentPathForHistory=e,canAccessLocalStorage()&&sessionStorage.setItem("htmx-current-path-for-history",e)}setCurrentPathForHistory(location.pathname+location.search);function getHistoryElement(){return getDocument().querySelector("[hx-history-elt],[data-hx-history-elt]")||getDocument().body}function saveToHistoryCache(e,t){if(!canAccessLocalStorage())return;const n=cleanInnerHtmlForHistory(t),r=getDocument().title,i=window.scrollY;if(htmx.config.historyCacheSize<=0){sessionStorage.removeItem("htmx-history-cache");return}e=normalizePath(e);const o=parseJSON(sessionStorage.getItem("htmx-history-cache"))||[];for(let a=0;a<o.length;a++)if(o[a].url===e){o.splice(a,1);break}const s={url:e,content:n,title:r,scroll:i};for(triggerEvent(getDocument().body,"htmx:historyItemCreated",{item:s,cache:o}),o.push(s);o.length>htmx.config.historyCacheSize;)o.shift();for(;o.length>0;)try{sessionStorage.setItem("htmx-history-cache",JSON.stringify(o));break}catch(a){triggerErrorEvent(getDocument().body,"htmx:historyCacheError",{cause:a,cache:o}),o.shift()}}function getCachedHistory(e){if(!canAccessLocalStorage())return null;e=normalizePath(e);const t=parseJSON(sessionStorage.getItem("htmx-history-cache"))||[];for(let n=0;n<t.length;n++)if(t[n].url===e)return t[n];return null}function cleanInnerHtmlForHistory(e){const t=htmx.config.requestClass,n=e.cloneNode(!0);return forEach(findAll(n,"."+t),function(r){removeClassFromElement(r,t)}),forEach(findAll(n,"[data-disabled-by-htmx]"),function(r){r.removeAttribute("disabled")}),n.innerHTML}function saveCurrentPageToHistory(){const e=getHistoryElement();let t=currentPathForHistory;canAccessLocalStorage()&&(t=sessionStorage.getItem("htmx-current-path-for-history")),t=t||location.pathname+location.search,getDocument().querySelector('[hx-history="false" i],[data-hx-history="false" i]')||(triggerEvent(getDocument().body,"htmx:beforeHistorySave",{path:t,historyElt:e}),saveToHistoryCache(t,e)),htmx.config.historyEnabled&&history.replaceState({htmx:!0},getDocument().title,location.href)}function pushUrlIntoHistory(e){htmx.config.getCacheBusterParam&&(e=e.replace(/org\.htmx\.cache-buster=[^&]*&?/,""),(endsWith(e,"&")||endsWith(e,"?"))&&(e=e.slice(0,-1))),htmx.config.historyEnabled&&history.pushState({htmx:!0},"",e),setCurrentPathForHistory(e)}function replaceUrlInHistory(e){htmx.config.historyEnabled&&history.replaceState({htmx:!0},"",e),setCurrentPathForHistory(e)}function settleImmediately(e){forEach(e,function(t){t.call(void 0)})}function loadHistoryFromServer(e){const t=new XMLHttpRequest,n={swapStyle:"innerHTML",swapDelay:0,settleDelay:0},r={path:e,xhr:t,historyElt:getHistoryElement(),swapSpec:n};t.open("GET",e,!0),htmx.config.historyRestoreAsHxRequest&&t.setRequestHeader("HX-Request","true"),t.setRequestHeader("HX-History-Restore-Request","true"),t.setRequestHeader("HX-Current-URL",location.href),t.onload=function(){this.status>=200&&this.status<400?(r.response=this.response,triggerEvent(getDocument().body,"htmx:historyCacheMissLoad",r),swap(r.historyElt,r.response,n,{contextElement:r.historyElt,historyRequest:!0}),setCurrentPathForHistory(r.path),triggerEvent(getDocument().body,"htmx:historyRestore",{path:e,cacheMiss:!0,serverResponse:r.response})):triggerErrorEvent(getDocument().body,"htmx:historyCacheMissLoadError",r)},triggerEvent(getDocument().body,"htmx:historyCacheMiss",r)&&t.send()}function restoreHistory(e){saveCurrentPageToHistory(),e=e||location.pathname+location.search;const t=getCachedHistory(e);if(t){const n={swapStyle:"innerHTML",swapDelay:0,settleDelay:0,scroll:t.scroll},r={path:e,item:t,historyElt:getHistoryElement(),swapSpec:n};triggerEvent(getDocument().body,"htmx:historyCacheHit",r)&&(swap(r.historyElt,t.content,n,{contextElement:r.historyElt,title:t.title}),setCurrentPathForHistory(r.path),triggerEvent(getDocument().body,"htmx:historyRestore",r))}else htmx.config.refreshOnHistoryMiss?htmx.location.reload(!0):loadHistoryFromServer(e)}function addRequestIndicatorClasses(e){let t=findAttributeTargets(e,"hx-indicator");return t==null&&(t=[e]),forEach(t,function(n){const r=getInternalData(n);r.requestCount=(r.requestCount||0)+1,n.classList.add.call(n.classList,htmx.config.requestClass)}),t}function disableElements(e){let t=findAttributeTargets(e,"hx-disabled-elt");return t==null&&(t=[]),forEach(t,function(n){const r=getInternalData(n);r.requestCount=(r.requestCount||0)+1,n.setAttribute("disabled",""),n.setAttribute("data-disabled-by-htmx","")}),t}function removeRequestIndicators(e,t){forEach(e.concat(t),function(n){const r=getInternalData(n);r.requestCount=(r.requestCount||1)-1}),forEach(e,function(n){getInternalData(n).requestCount===0&&n.classList.remove.call(n.classList,htmx.config.requestClass)}),forEach(t,function(n){getInternalData(n).requestCount===0&&(n.removeAttribute("disabled"),n.removeAttribute("data-disabled-by-htmx"))})}function haveSeenNode(e,t){for(let n=0;n<e.length;n++)if(e[n].isSameNode(t))return!0;return!1}function shouldInclude(e){const t=e;return t.name===""||t.name==null||t.disabled||closest(t,"fieldset[disabled]")||t.type==="button"||t.type==="submit"||t.tagName==="image"||t.tagName==="reset"||t.tagName==="file"?!1:t.type==="checkbox"||t.type==="radio"?t.checked:!0}function addValueToFormData(e,t,n){e!=null&&t!=null&&(Array.isArray(t)?t.forEach(function(r){n.append(e,r)}):n.append(e,t))}function removeValueFromFormData(e,t,n){if(e!=null&&t!=null){let r=n.getAll(e);Array.isArray(t)?r=r.filter(i=>t.indexOf(i)<0):r=r.filter(i=>i!==t),n.delete(e),forEach(r,i=>n.append(e,i))}}function getValueFromInput(e){return e instanceof HTMLSelectElement&&e.multiple?toArray(e.querySelectorAll("option:checked")).map(function(t){return t.value}):e instanceof HTMLInputElement&&e.files?toArray(e.files):e.value}function processInputValue(e,t,n,r,i){if(!(r==null||haveSeenNode(e,r))){if(e.push(r),shouldInclude(r)){const o=getRawAttribute(r,"name");addValueToFormData(o,getValueFromInput(r),t),i&&validateElement(r,n)}r instanceof HTMLFormElement&&(forEach(r.elements,function(o){e.indexOf(o)>=0?removeValueFromFormData(o.name,getValueFromInput(o),t):e.push(o),i&&validateElement(o,n)}),new FormData(r).forEach(function(o,s){o instanceof File&&o.name===""||addValueToFormData(s,o,t)}))}}function validateElement(e,t){const n=e;n.willValidate&&(triggerEvent(n,"htmx:validation:validate"),n.checkValidity()||(triggerEvent(n,"htmx:validation:failed",{message:n.validationMessage,validity:n.validity})&&!t.length&&htmx.config.reportValidityOfForms&&n.reportValidity(),t.push({elt:n,message:n.validationMessage,validity:n.validity})))}function overrideFormData(e,t){for(const n of t.keys())e.delete(n);return t.forEach(function(n,r){e.append(r,n)}),e}function getInputValues(e,t){const n=[],r=new FormData,i=new FormData,o=[],s=getInternalData(e);s.lastButtonClicked&&!bodyContains(s.lastButtonClicked)&&(s.lastButtonClicked=null);let a=e instanceof HTMLFormElement&&e.noValidate!==!0||getAttributeValue(e,"hx-validate")==="true";if(s.lastButtonClicked&&(a=a&&s.lastButtonClicked.formNoValidate!==!0),t!=="get"&&processInputValue(n,i,o,getRelatedForm(e),a),processInputValue(n,r,o,e,a),s.lastButtonClicked||e.tagName==="BUTTON"||e.tagName==="INPUT"&&getRawAttribute(e,"type")==="submit"){const c=s.lastButtonClicked||e,u=getRawAttribute(c,"name");addValueToFormData(u,c.value,i)}const l=findAttributeTargets(e,"hx-include");return forEach(l,function(c){processInputValue(n,r,o,asElement(c),a),matches(c,"form")||forEach(asParentNode(c).querySelectorAll(INPUT_SELECTOR),function(u){processInputValue(n,r,o,u,a)})}),overrideFormData(r,i),{errors:o,formData:r,values:formDataProxy(r)}}function appendParam(e,t,n){e!==""&&(e+="&"),String(n)==="[object Object]"&&(n=JSON.stringify(n));const r=encodeURIComponent(n);return e+=encodeURIComponent(t)+"="+r,e}function urlEncode(e){e=formDataFromObject(e);let t="";return e.forEach(function(n,r){t=appendParam(t,r,n)}),t}function getHeaders(e,t,n){const r={"HX-Request":"true","HX-Trigger":getRawAttribute(e,"id"),"HX-Trigger-Name":getRawAttribute(e,"name"),"HX-Target":getAttributeValue(t,"id"),"HX-Current-URL":location.href};return getValuesForElement(e,"hx-headers",!1,r),n!==void 0&&(r["HX-Prompt"]=n),getInternalData(e).boosted&&(r["HX-Boosted"]="true"),r}function filterValues(e,t){const n=getClosestAttributeValue(t,"hx-params");if(n){if(n==="none")return new FormData;if(n==="*")return e;if(n.indexOf("not ")===0)return forEach(n.slice(4).split(","),function(r){r=r.trim(),e.delete(r)}),e;{const r=new FormData;return forEach(n.split(","),function(i){i=i.trim(),e.has(i)&&e.getAll(i).forEach(function(o){r.append(i,o)})}),r}}else return e}function isAnchorLink(e){return!!getRawAttribute(e,"href")&&getRawAttribute(e,"href").indexOf("#")>=0}function getSwapSpecification(e,t){const n=t||getClosestAttributeValue(e,"hx-swap"),r={swapStyle:getInternalData(e).boosted?"innerHTML":htmx.config.defaultSwapStyle,swapDelay:htmx.config.defaultSwapDelay,settleDelay:htmx.config.defaultSettleDelay};if(htmx.config.scrollIntoViewOnBoost&&getInternalData(e).boosted&&!isAnchorLink(e)&&(r.show="top"),n){const s=splitOnWhitespace(n);if(s.length>0)for(let a=0;a<s.length;a++){const l=s[a];if(l.indexOf("swap:")===0)r.swapDelay=parseInterval(l.slice(5));else if(l.indexOf("settle:")===0)r.settleDelay=parseInterval(l.slice(7));else if(l.indexOf("transition:")===0)r.transition=l.slice(11)==="true";else if(l.indexOf("ignoreTitle:")===0)r.ignoreTitle=l.slice(12)==="true";else if(l.indexOf("scroll:")===0){var i=l.slice(7).split(":");const u=i.pop();var o=i.length>0?i.join(":"):null;r.scroll=u,r.scrollTarget=o}else if(l.indexOf("show:")===0){var i=l.slice(5).split(":");const f=i.pop();var o=i.length>0?i.join(":"):null;r.show=f,r.showTarget=o}else if(l.indexOf("focus-scroll:")===0){const c=l.slice(13);r.focusScroll=c=="true"}else a==0?r.swapStyle=l:logError("Unknown modifier in hx-swap: "+l)}}return r}function usesFormData(e){return getClosestAttributeValue(e,"hx-encoding")==="multipart/form-data"||matches(e,"form")&&getRawAttribute(e,"enctype")==="multipart/form-data"}function encodeParamsForBody(e,t,n){let r=null;return withExtensions(t,function(i){r==null&&(r=i.encodeParameters(e,n,t))}),r??(usesFormData(t)?overrideFormData(new FormData,formDataFromObject(n)):urlEncode(n))}function makeSettleInfo(e){return{tasks:[],elts:[e]}}function updateScrollState(e,t){const n=e[0],r=e[e.length-1];if(t.scroll){var i=null;t.scrollTarget&&(i=asElement(querySelectorExt(n,t.scrollTarget))),t.scroll==="top"&&(n||i)&&(i=i||n,i.scrollTop=0),t.scroll==="bottom"&&(r||i)&&(i=i||r,i.scrollTop=i.scrollHeight),typeof t.scroll=="number"&&getWindow().setTimeout(function(){window.scrollTo(0,t.scroll)},0)}if(t.show){var i=null;if(t.showTarget){let s=t.showTarget;t.showTarget==="window"&&(s="body"),i=asElement(querySelectorExt(n,s))}t.show==="top"&&(n||i)&&(i=i||n,i.scrollIntoView({block:"start",behavior:htmx.config.scrollBehavior})),t.show==="bottom"&&(r||i)&&(i=i||r,i.scrollIntoView({block:"end",behavior:htmx.config.scrollBehavior}))}}function getValuesForElement(e,t,n,r,i){if(r==null&&(r={}),e==null)return r;const o=getAttributeValue(e,t);if(o){let s=o.trim(),a=n;if(s==="unset")return null;s.indexOf("javascript:")===0?(s=s.slice(11),a=!0):s.indexOf("js:")===0&&(s=s.slice(3),a=!0),s.indexOf("{")!==0&&(s="{"+s+"}");let l;a?l=maybeEval(e,function(){return i?Function("event","return ("+s+")").call(e,i):Function("return ("+s+")").call(e)},{}):l=parseJSON(s);for(const c in l)l.hasOwnProperty(c)&&r[c]==null&&(r[c]=l[c])}return getValuesForElement(asElement(parentElt(e)),t,n,r,i)}function maybeEval(e,t,n){return htmx.config.allowEval?t():(triggerErrorEvent(e,"htmx:evalDisallowedError"),n)}function getHXVarsForElement(e,t,n){return getValuesForElement(e,"hx-vars",!0,n,t)}function getHXValsForElement(e,t,n){return getValuesForElement(e,"hx-vals",!1,n,t)}function getExpressionVars(e,t){return mergeObjects(getHXVarsForElement(e,t),getHXValsForElement(e,t))}function safelySetHeaderValue(e,t,n){if(n!==null)try{e.setRequestHeader(t,n)}catch{e.setRequestHeader(t,encodeURIComponent(n)),e.setRequestHeader(t+"-URI-AutoEncoded","true")}}function getPathFromResponse(e){if(e.responseURL)try{const t=new URL(e.responseURL);return t.pathname+t.search}catch{triggerErrorEvent(getDocument().body,"htmx:badResponseUrl",{url:e.responseURL})}}function hasHeader(e,t){return t.test(e.getAllResponseHeaders())}function ajaxHelper(e,t,n){if(e=e.toLowerCase(),n){if(n instanceof Element||typeof n=="string")return issueAjaxRequest(e,t,null,null,{targetOverride:resolveTarget(n)||DUMMY_ELT,returnPromise:!0});{let r=resolveTarget(n.target);return(n.target&&!r||n.source&&!r&&!resolveTarget(n.source))&&(r=DUMMY_ELT),issueAjaxRequest(e,t,resolveTarget(n.source),n.event,{handler:n.handler,headers:n.headers,values:n.values,targetOverride:r,swapOverride:n.swap,select:n.select,returnPromise:!0,push:n.push,replace:n.replace,selectOOB:n.selectOOB})}}else return issueAjaxRequest(e,t,null,null,{returnPromise:!0})}function hierarchyForElt(e){const t=[];for(;e;)t.push(e),e=e.parentElement;return t}function verifyPath(e,t,n){const r=new URL(t,location.protocol!=="about:"?location.href:window.origin),o=(location.protocol!=="about:"?location.origin:window.origin)===r.origin;return htmx.config.selfRequestsOnly&&!o?!1:triggerEvent(e,"htmx:validateUrl",mergeObjects({url:r,sameHost:o},n))}function formDataFromObject(e){if(e instanceof FormData)return e;const t=new FormData;for(const n in e)e.hasOwnProperty(n)&&(e[n]&&typeof e[n].forEach=="function"?e[n].forEach(function(r){t.append(n,r)}):typeof e[n]=="object"&&!(e[n]instanceof Blob)?t.append(n,JSON.stringify(e[n])):t.append(n,e[n]));return t}function formDataArrayProxy(e,t,n){return new Proxy(n,{get:function(r,i){return typeof i=="number"?r[i]:i==="length"?r.length:i==="push"?function(o){r.push(o),e.append(t,o)}:typeof r[i]=="function"?function(){r[i].apply(r,arguments),e.delete(t),r.forEach(function(o){e.append(t,o)})}:r[i]&&r[i].length===1?r[i][0]:r[i]},set:function(r,i,o){return r[i]=o,e.delete(t),r.forEach(function(s){e.append(t,s)}),!0}})}function formDataProxy(e){return new Proxy(e,{get:function(t,n){if(typeof n=="symbol"){const i=Reflect.get(t,n);return typeof i=="function"?function(){return i.apply(e,arguments)}:i}if(n==="toJSON")return()=>Object.fromEntries(e);if(n in t&&typeof t[n]=="function")return function(){return e[n].apply(e,arguments)};const r=e.getAll(n);if(r.length!==0)return r.length===1?r[0]:formDataArrayProxy(t,n,r)},set:function(t,n,r){return typeof n!="string"?!1:(t.delete(n),r&&typeof r.forEach=="function"?r.forEach(function(i){t.append(n,i)}):typeof r=="object"&&!(r instanceof Blob)?t.append(n,JSON.stringify(r)):t.append(n,r),!0)},deleteProperty:function(t,n){return typeof n=="string"&&t.delete(n),!0},ownKeys:function(t){return Reflect.ownKeys(Object.fromEntries(t))},getOwnPropertyDescriptor:function(t,n){return Reflect.getOwnPropertyDescriptor(Object.fromEntries(t),n)}})}function issueAjaxRequest(e,t,n,r,i,o){let s=null,a=null;if(i=i??{},i.returnPromise&&typeof Promise<"u")var l=new Promise(function(x,_){s=x,a=_});n==null&&(n=getDocument().body);const c=i.handler||handleAjaxResponse,u=i.select||null;if(!bodyContains(n))return maybeCall(s),l;const f=i.targetOverride||asElement(getTarget(n));if(f==null||f==DUMMY_ELT)return triggerErrorEvent(n,"htmx:targetError",{target:getClosestAttributeValue(n,"hx-target")}),maybeCall(a),l;let d=getInternalData(n);const p=d.lastButtonClicked;if(p){const x=getRawAttribute(p,"formaction");x!=null&&(t=x);const _=getRawAttribute(p,"formmethod");if(_!=null)if(VERBS.includes(_.toLowerCase()))e=_;else return maybeCall(s),l}const g=getClosestAttributeValue(n,"hx-confirm");if(o===void 0&&triggerEvent(n,"htmx:confirm",{target:f,elt:n,path:t,verb:e,triggeringEvent:r,etc:i,issueRequest:function(R){return issueAjaxRequest(e,t,n,r,i,!!R)},question:g})===!1)return maybeCall(s),l;let v=n,h=getClosestAttributeValue(n,"hx-sync"),m=null,y=!1;if(h){const x=h.split(":"),_=x[0].trim();if(_==="this"?v=findThisElement(n,"hx-sync"):v=asElement(querySelectorExt(n,_)),h=(x[1]||"drop").trim(),d=getInternalData(v),h==="drop"&&d.xhr&&d.abortable!==!0)return maybeCall(s),l;if(h==="abort"){if(d.xhr)return maybeCall(s),l;y=!0}else h==="replace"?triggerEvent(v,"htmx:abort"):h.indexOf("queue")===0&&(m=(h.split(" ")[1]||"last").trim())}if(d.xhr)if(d.abortable)triggerEvent(v,"htmx:abort");else{if(m==null){if(r){const x=getInternalData(r);x&&x.triggerSpec&&x.triggerSpec.queue&&(m=x.triggerSpec.queue)}m==null&&(m="last")}return d.queuedRequests==null&&(d.queuedRequests=[]),m==="first"&&d.queuedRequests.length===0?d.queuedRequests.push(function(){issueAjaxRequest(e,t,n,r,i)}):m==="all"?d.queuedRequests.push(function(){issueAjaxRequest(e,t,n,r,i)}):m==="last"&&(d.queuedRequests=[],d.queuedRequests.push(function(){issueAjaxRequest(e,t,n,r,i)})),maybeCall(s),l}const E=new XMLHttpRequest;d.xhr=E,d.abortable=y;const b=function(){d.xhr=null,d.abortable=!1,d.queuedRequests!=null&&d.queuedRequests.length>0&&d.queuedRequests.shift()()},C=getClosestAttributeValue(n,"hx-prompt");if(C){var T=prompt(C);if(T===null||!triggerEvent(n,"htmx:prompt",{prompt:T,target:f}))return maybeCall(s),b(),l}if(g&&!o&&!confirm(g))return maybeCall(s),b(),l;let A=getHeaders(n,f,T);e!=="get"&&!usesFormData(n)&&(A["Content-Type"]="application/x-www-form-urlencoded"),i.headers&&(A=mergeObjects(A,i.headers));const L=getInputValues(n,e);let I=L.errors;const H=L.formData;i.values&&overrideFormData(H,formDataFromObject(i.values));const V=formDataFromObject(getExpressionVars(n,r)),F=overrideFormData(H,V);let O=filterValues(F,n);htmx.config.getCacheBusterParam&&e==="get"&&O.set("org.htmx.cache-buster",getRawAttribute(f,"id")||"true"),(t==null||t==="")&&(t=location.href);const N=getValuesForElement(n,"hx-request"),B=getInternalData(n).boosted;let M=htmx.config.methodsThatUseUrlParams.indexOf(e)>=0;const S={boosted:B,useUrlParams:M,formData:O,parameters:formDataProxy(O),unfilteredFormData:F,unfilteredParameters:formDataProxy(F),headers:A,elt:n,target:f,verb:e,errors:I,withCredentials:i.credentials||N.credentials||htmx.config.withCredentials,timeout:i.timeout||N.timeout||htmx.config.timeout,path:t,triggeringEvent:r};if(!triggerEvent(n,"htmx:configRequest",S))return maybeCall(s),b(),l;if(t=S.path,e=S.verb,A=S.headers,O=formDataFromObject(S.parameters),I=S.errors,M=S.useUrlParams,I&&I.length>0)return triggerEvent(n,"htmx:validation:halted",S),maybeCall(s),b(),l;const j=t.split("#"),U=j[0],q=j[1];let D=t;if(M&&(D=U,!O.keys().next().done&&(D.indexOf("?")<0?D+="?":D+="&",D+=urlEncode(O),q&&(D+="#"+q))),!verifyPath(n,D,S))return triggerErrorEvent(n,"htmx:invalidPath",S),maybeCall(a),b(),l;if(E.open(e.toUpperCase(),D,!0),E.overrideMimeType("text/html"),E.withCredentials=S.withCredentials,E.timeout=S.timeout,!N.noHeaders){for(const x in A)if(A.hasOwnProperty(x)){const _=A[x];safelySetHeaderValue(E,x,_)}}const w={xhr:E,target:f,requestConfig:S,etc:i,boosted:B,select:u,pathInfo:{requestPath:t,finalRequestPath:D,responsePath:null,anchor:q}};if(E.onload=function(){try{const x=hierarchyForElt(n);if(w.pathInfo.responsePath=getPathFromResponse(E),c(n,w),w.keepIndicators!==!0&&removeRequestIndicators(P,k),triggerEvent(n,"htmx:afterRequest",w),triggerEvent(n,"htmx:afterOnLoad",w),!bodyContains(n)){let _=null;for(;x.length>0&&_==null;){const R=x.shift();bodyContains(R)&&(_=R)}_&&(triggerEvent(_,"htmx:afterRequest",w),triggerEvent(_,"htmx:afterOnLoad",w))}maybeCall(s)}catch(x){throw triggerErrorEvent(n,"htmx:onLoadError",mergeObjects({error:x},w)),x}finally{b()}},E.onerror=function(){removeRequestIndicators(P,k),triggerErrorEvent(n,"htmx:afterRequest",w),triggerErrorEvent(n,"htmx:sendError",w),maybeCall(a),b()},E.onabort=function(){removeRequestIndicators(P,k),triggerErrorEvent(n,"htmx:afterRequest",w),triggerErrorEvent(n,"htmx:sendAbort",w),maybeCall(a),b()},E.ontimeout=function(){removeRequestIndicators(P,k),triggerErrorEvent(n,"htmx:afterRequest",w),triggerErrorEvent(n,"htmx:timeout",w),maybeCall(a),b()},!triggerEvent(n,"htmx:beforeRequest",w))return maybeCall(s),b(),l;var P=addRequestIndicatorClasses(n),k=disableElements(n);forEach(["loadstart","loadend","progress","abort"],function(x){forEach([E,E.upload],function(_){_.addEventListener(x,function(R){triggerEvent(n,"htmx:xhr:"+x,{lengthComputable:R.lengthComputable,loaded:R.loaded,total:R.total})})})}),triggerEvent(n,"htmx:beforeSend",w);const $=M?null:encodeParamsForBody(E,n,O);return E.send($),l}function determineHistoryUpdates(e,t){const n=t.xhr;let r=null,i=null;if(hasHeader(n,/HX-Push:/i)?(r=n.getResponseHeader("HX-Push"),i="push"):hasHeader(n,/HX-Push-Url:/i)?(r=n.getResponseHeader("HX-Push-Url"),i="push"):hasHeader(n,/HX-Replace-Url:/i)&&(r=n.getResponseHeader("HX-Replace-Url"),i="replace"),r)return r==="false"?{}:{type:i,path:r};const o=t.pathInfo.finalRequestPath,s=t.pathInfo.responsePath,a=t.etc.push||getClosestAttributeValue(e,"hx-push-url"),l=t.etc.replace||getClosestAttributeValue(e,"hx-replace-url"),c=getInternalData(e).boosted;let u=null,f=null;return a?(u="push",f=a):l?(u="replace",f=l):c&&(u="push",f=s||o),f?f==="false"?{}:(f==="true"&&(f=s||o),t.pathInfo.anchor&&f.indexOf("#")===-1&&(f=f+"#"+t.pathInfo.anchor),{type:u,path:f}):{}}function codeMatches(e,t){var n=new RegExp(e.code);return n.test(t.toString(10))}function resolveResponseHandling(e){for(var t=0;t<htmx.config.responseHandling.length;t++){var n=htmx.config.responseHandling[t];if(codeMatches(n,e.status))return n}return{swap:!1}}function handleTitle(e){if(e){const t=find("title");t?t.textContent=e:window.document.title=e}}function resolveRetarget(e,t){if(t==="this")return e;const n=asElement(querySelectorExt(e,t));if(n==null)throw triggerErrorEvent(e,"htmx:targetError",{target:t}),new Error(`Invalid re-target ${t}`);return n}function handleAjaxResponse(e,t){const n=t.xhr;let r=t.target;const i=t.etc,o=t.select;if(!triggerEvent(e,"htmx:beforeOnLoad",t))return;if(hasHeader(n,/HX-Trigger:/i)&&handleTriggerHeader(n,"HX-Trigger",e),hasHeader(n,/HX-Location:/i)){let y=n.getResponseHeader("HX-Location");var s={};y.indexOf("{")===0&&(s=parseJSON(y),y=s.path,delete s.path),s.push=s.push||"true",ajaxHelper("get",y,s);return}const a=hasHeader(n,/HX-Refresh:/i)&&n.getResponseHeader("HX-Refresh")==="true";if(hasHeader(n,/HX-Redirect:/i)){t.keepIndicators=!0,htmx.location.href=n.getResponseHeader("HX-Redirect"),a&&htmx.location.reload();return}if(a){t.keepIndicators=!0,htmx.location.reload();return}const l=determineHistoryUpdates(e,t),c=resolveResponseHandling(n),u=c.swap;let f=!!c.error,d=htmx.config.ignoreTitle||c.ignoreTitle,p=c.select;c.target&&(t.target=resolveRetarget(e,c.target));var g=i.swapOverride;g==null&&c.swapOverride&&(g=c.swapOverride),hasHeader(n,/HX-Retarget:/i)&&(t.target=resolveRetarget(e,n.getResponseHeader("HX-Retarget"))),hasHeader(n,/HX-Reswap:/i)&&(g=n.getResponseHeader("HX-Reswap"));var v=n.response,h=mergeObjects({shouldSwap:u,serverResponse:v,isError:f,ignoreTitle:d,selectOverride:p,swapOverride:g},t);if(!(c.event&&!triggerEvent(r,c.event,h))&&triggerEvent(r,"htmx:beforeSwap",h)){if(r=h.target,v=h.serverResponse,f=h.isError,d=h.ignoreTitle,p=h.selectOverride,g=h.swapOverride,t.target=r,t.failed=f,t.successful=!f,h.shouldSwap){n.status===286&&cancelPolling(e),withExtensions(e,function(b){v=b.transformResponse(v,n,e)}),l.type&&saveCurrentPageToHistory();var m=getSwapSpecification(e,g);m.hasOwnProperty("ignoreTitle")||(m.ignoreTitle=d),r.classList.add(htmx.config.swappingClass),o&&(p=o),hasHeader(n,/HX-Reselect:/i)&&(p=n.getResponseHeader("HX-Reselect"));const y=i.selectOOB||getClosestAttributeValue(e,"hx-select-oob"),E=getClosestAttributeValue(e,"hx-select");swap(r,v,m,{select:p==="unset"?null:p||E,selectOOB:y,eventInfo:t,anchor:t.pathInfo.anchor,contextElement:e,afterSwapCallback:function(){if(hasHeader(n,/HX-Trigger-After-Swap:/i)){let b=e;bodyContains(e)||(b=getDocument().body),handleTriggerHeader(n,"HX-Trigger-After-Swap",b)}},afterSettleCallback:function(){if(hasHeader(n,/HX-Trigger-After-Settle:/i)){let b=e;bodyContains(e)||(b=getDocument().body),handleTriggerHeader(n,"HX-Trigger-After-Settle",b)}},beforeSwapCallback:function(){l.type&&(triggerEvent(getDocument().body,"htmx:beforeHistoryUpdate",mergeObjects({history:l},t)),l.type==="push"?(pushUrlIntoHistory(l.path),triggerEvent(getDocument().body,"htmx:pushedIntoHistory",{path:l.path})):(replaceUrlInHistory(l.path),triggerEvent(getDocument().body,"htmx:replacedInHistory",{path:l.path})))}})}f&&triggerErrorEvent(e,"htmx:responseError",mergeObjects({error:"Response Status Error Code "+n.status+" from "+t.pathInfo.requestPath},t))}}const extensions={};function extensionBase(){return{init:function(e){return null},getSelectors:function(){return null},onEvent:function(e,t){return!0},transformResponse:function(e,t,n){return e},isInlineSwap:function(e){return!1},handleSwap:function(e,t,n,r){return!1},encodeParameters:function(e,t,n){return null}}}function defineExtension(e,t){t.init&&t.init(internalAPI),extensions[e]=mergeObjects(extensionBase(),t)}function removeExtension(e){delete extensions[e]}function getExtensions(e,t,n){if(t==null&&(t=[]),e==null)return t;n==null&&(n=[]);const r=getAttributeValue(e,"hx-ext");return r&&forEach(r.split(","),function(i){if(i=i.replace(/ /g,""),i.slice(0,7)=="ignore:"){n.push(i.slice(7));return}if(n.indexOf(i)<0){const o=extensions[i];o&&t.indexOf(o)<0&&t.push(o)}}),getExtensions(asElement(parentElt(e)),t,n)}var isReady=!1;getDocument().addEventListener("DOMContentLoaded",function(){isReady=!0});function ready(e){isReady||getDocument().readyState==="complete"?e():getDocument().addEventListener("DOMContentLoaded",e)}function insertIndicatorStyles(){if(htmx.config.includeIndicatorStyles!==!1){const e=htmx.config.inlineStyleNonce?` nonce="${htmx.config.inlineStyleNonce}"`:"",t=htmx.config.indicatorClass,n=htmx.config.requestClass;getDocument().head.insertAdjacentHTML("beforeend",`<style${e}>.${t}{opacity:0;visibility: hidden} .${n} .${t}, .${n}.${t}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}</style>`)}}function getMetaConfig(){const e=getDocument().querySelector('meta[name="htmx-config"]');return e?parseJSON(e.content):null}function mergeMetaConfig(){const e=getMetaConfig();e&&(htmx.config=mergeObjects(htmx.config,e))}return ready(function(){mergeMetaConfig(),insertIndicatorStyles();let e=getDocument().body;processNode(e);const t=getDocument().querySelectorAll("[hx-trigger='restored'],[data-hx-trigger='restored']");e.addEventListener("htmx:abort",function(r){const i=r.detail.elt||r.target,o=getInternalData(i);o&&o.xhr&&o.xhr.abort()});const n=window.onpopstate?window.onpopstate.bind(window):null;window.onpopstate=function(r){r.state&&r.state.htmx?(restoreHistory(),forEach(t,function(i){triggerEvent(i,"htmx:restored",{document:getDocument(),triggerEvent})})):n&&n(r)},getWindow().setTimeout(function(){triggerEvent(e,"htmx:load",{}),e=null},0)}),htmx})();function initLoadingStatesExtension(e){const t=[];function n(l){return e.closest(l,"[data-loading-states]")||document.body}function r(l,c){document.body.contains(l)&&c()}function i(l,c){const u=e.closest(l,"[data-loading-path]");return u?u.getAttribute("data-loading-path")===c:!0}function o(l,c,u,f){const d=e.closest(l,"[data-loading-delay]");if(d){const p=Number.parseInt(d.getAttribute("data-loading-delay")||"200",10),g=setTimeout(()=>{u(),t.push(()=>{r(c,f)})},p);t.push(()=>{r(c,()=>clearTimeout(g))})}else u(),t.push(()=>{r(c,f)})}function s(l,c,u){return Array.from(e.findAll(l,`[${c}]`)).filter(f=>i(f,u))}function a(l){const c=l.getAttribute("data-loading-target");return c?Array.from(e.findAll(c)):[l]}e.defineExtension("loading-states",{onEvent(l,c){var u,f;if(l==="htmx:beforeRequest"){const d=n(c.target),p=((f=(u=c.detail)==null?void 0:u.pathInfo)==null?void 0:f.requestPath)||"",g=["data-loading","data-loading-class","data-loading-class-remove","data-loading-disable","data-loading-aria-busy"],v={};for(const h of g)v[h]=s(d,h,p);for(const h of v["data-loading"])for(const m of a(h))o(h,m,()=>{m.style.display=h.getAttribute("data-loading")||"inline-block"},()=>{m.style.display="none"});for(const h of v["data-loading-class"]){const m=(h.getAttribute("data-loading-class")||"").split(" ");for(const y of a(h))o(h,y,()=>{for(const E of m)y.classList.add(E)},()=>{for(const E of m)y.classList.remove(E)})}for(const h of v["data-loading-class-remove"]){const m=(h.getAttribute("data-loading-class-remove")||"").split(" ");for(const y of a(h))o(h,y,()=>{for(const E of m)y.classList.remove(E)},()=>{for(const E of m)y.classList.add(E)})}for(const h of v["data-loading-disable"])for(const m of a(h))o(h,m,()=>{m.disabled=!0},()=>{m.disabled=!1});for(const h of v["data-loading-aria-busy"])for(const m of a(h))o(h,m,()=>{m.setAttribute("aria-busy","true")},()=>{m.removeAttribute("aria-busy")})}if(l==="htmx:beforeOnLoad")for(;t.length>0;){const d=t.shift();d==null||d()}}})}function initSSEExtension(e){let t;function n(c){return new EventSource(c,{withCredentials:!0})}function r(c){return t.getInternalData(c).sseEventSource!=null}function i(c){if(!t.bodyContains(c)){const f=t.getInternalData(c).sseEventSource;if(f!=null)return t.triggerEvent(c,"htmx:sseClose",{source:f,type:"nodeMissing"}),f.close(),!0}return!1}function o(c,u){let f=u;t.withExtensions(c,g=>{g.transformResponse&&(f=g.transformResponse(f,null,c))});const d=t.getSwapSpecification(c),p=t.getTarget(c);p&&t.swap(p,f,d)}function s(c){const u=t.getAttributeValue(c,"sse-swap");if(u){const d=t.getClosestMatch(c,r);if(d==null)return;const g=t.getInternalData(d).sseEventSource,v=u.split(",");for(const h of v){const m=h.trim(),y=E=>{const b=E;if(!i(d)){if(!t.bodyContains(c)){g.removeEventListener(m,y);return}t.triggerEvent(c,"htmx:sseBeforeMessage",E)&&(o(c,b.data),t.triggerEvent(c,"htmx:sseMessage",E))}};t.getInternalData(c).sseEventListener=y,g.addEventListener(m,y)}}if(t.getAttributeValue(c,"hx-trigger")){const d=t.getClosestMatch(c,r);if(d==null)return;const g=t.getInternalData(d).sseEventSource,v=t.getTriggerSpecs(c);for(const h of v){if(!h.trigger.startsWith("sse:"))continue;const m=h.trigger.slice(4),y=E=>{i(d)||(t.bodyContains(c)||g.removeEventListener(m,y),e.trigger(c,h.trigger,E),e.trigger(c,"htmx:sseMessage",E))};t.getInternalData(c).sseEventListener=y,g.addEventListener(m,y)}}}function a(c,u,f){const d=e.createEventSource(u);d.onerror=g=>{if(t.triggerErrorEvent(c,"htmx:sseError",{error:g,source:d}),!i(c)&&d.readyState===EventSource.CLOSED){let v=f||0;v=Math.max(Math.min(v*2,128),1);const h=v*500;window.setTimeout(()=>{l(c,v)},h)}},d.onopen=()=>{if(t.triggerEvent(c,"htmx:sseOpen",{source:d}),f&&f>0){const g=c.querySelectorAll("[sse-swap], [data-sse-swap], [hx-trigger], [data-hx-trigger]");for(const v of g)s(v)}},t.getInternalData(c).sseEventSource=d;const p=t.getAttributeValue(c,"sse-close");p&&d.addEventListener(p,()=>{t.triggerEvent(c,"htmx:sseClose",{source:d,type:"message"}),d.close()})}function l(c,u){if(c==null)return;const f=t.getAttributeValue(c,"sse-connect");f&&a(c,f,u),s(c)}e.defineExtension("sse",{init(c){t=c,e.createEventSource==null&&(e.createEventSource=n)},getSelectors(){return["[sse-connect]","[data-sse-connect]","[sse-swap]","[data-sse-swap]"]},onEvent(c,u){var d;const f=u.target||((d=u.detail)==null?void 0:d.elt);switch(c){case"htmx:beforeCleanupElement":{const g=t.getInternalData(f).sseEventSource;g&&(t.triggerEvent(f,"htmx:sseClose",{source:g,type:"nodeReplaced"}),g.close());return}case"htmx:afterProcessNode":l(f);break}}})}const htmxApi=htmx;window.htmx=htmxApi;initLoadingStatesExtension(htmxApi);initSSEExtension(htmxApi);window.Alpine=module_default;document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{module_default.start()}):module_default.start();function initNavigation(){document.querySelectorAll(".navbar-burger").forEach(t=>{t.addEventListener("click",()=>{const n=t.dataset.target;if(!n)return;const r=document.getElementById(n);r&&(t.classList.toggle("is-active"),r.classList.toggle("is-active"))})})}function eventForm(){return{submitUrl:"/event",isEditMode:!1,formData:{name:"",description:"",status:"scheduled",mode:"inperson",tz:"America/New_York",startsAt:null,endsAt:null,locations:[],links:[],headerCid:null,headerAlt:null,headerSize:null,thumbnailCid:null,thumbnailAlt:null,requireConfirmedEmail:!1,sendNotifications:!1},startDateTimeLocal:"",endDateTimeLocal:"",submitting:!1,submitted:!1,uploading:!1,uploadingThumbnail:!1,errorMessage:null,eventUrl:null,headerCropper:null,thumbnailCropper:null,showCropper:!1,showThumbnailCropper:!1,showDescriptionPreview:!1,descriptionPreviewHtml:"",loadingPreview:!1,locationSuggestions:[],loadingSuggestions:!1,showLocationSuggestions:!1,locationFeedback:null,locationFilter:"",init(){const e=this.$el;if(e.dataset.submitUrl&&(this.submitUrl=e.dataset.submitUrl),e.dataset.editMode==="true"&&(this.isEditMode=!0),e.dataset.eventData)try{this.formData=JSON.parse(e.dataset.eventData)}catch(t){console.error("Failed to parse event data:",t)}if(e.dataset.defaultTz&&(this.formData.tz=e.dataset.defaultTz),this.formData.startsAt){const t=new Date(this.formData.startsAt);this.startDateTimeLocal=this.formatDateTimeLocal(t)}else{const t=new Date;t.setHours(t.getHours()+3);const n=new Date(t);t.getHours()>=18&&n.setDate(n.getDate()+1),n.setHours(18,0,0,0),this.startDateTimeLocal=this.formatDateTimeLocal(n)}if(this.formData.endsAt){const t=new Date(this.formData.endsAt);this.endDateTimeLocal=this.formatDateTimeLocal(t)}this.$watch("startDateTimeLocal",t=>{if(t){const n=new Date(t);this.formData.startsAt=n.toISOString()}else this.formData.startsAt=null}),this.$watch("endDateTimeLocal",t=>{if(t){const n=new Date(t);this.formData.endsAt=n.toISOString()}else this.formData.endsAt=null})},get addressLocations(){return this.formData.locations.filter(e=>e.type==="address")},get geoLocations(){return this.formData.locations.filter(e=>e.type==="geo")},addressLocationIndex(e){return e},geoLocationIndex(e){return e},findAddressLocationIndex(e){let t=0;for(let n=0;n<this.formData.locations.length;n++)if(this.formData.locations[n].type==="address"){if(t===e)return n;t++}return-1},findGeoLocationIndex(e){let t=0;for(let n=0;n<this.formData.locations.length;n++)if(this.formData.locations[n].type==="geo"){if(t===e)return n;t++}return-1},formatDateTimeLocal(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),o=String(e.getMinutes()).padStart(2,"0");return`${t}-${n}-${r}T${i}:${o}`},get headerPreviewUrl(){return this.formData.headerCid?`/content/${this.formData.headerCid}.png`:null},get thumbnailPreviewUrl(){return this.formData.thumbnailCid?`/content/${this.formData.thumbnailCid}.png`:null},get filteredLocationSuggestions(){if(!this.locationFilter.trim())return this.locationSuggestions;const e=this.locationFilter.toLowerCase().trim();return this.locationSuggestions.filter(t=>{const n=[t.name,t.street,t.locality,t.region,t.postal_code,t.country].filter(Boolean).map(i=>i.toLowerCase());return e.split(/\s+/).every(i=>n.some(o=>o.includes(i)))})},addLocation(){this.formData.locations.push({type:"address",country:"",postalCode:null,region:null,locality:null,street:null,name:null})},removeAddressLocation(e){const t=this.findAddressLocationIndex(e);t!==-1&&this.formData.locations.splice(t,1)},addGeoLocation(){this.formData.locations.push({type:"geo",latitude:"",longitude:"",name:null})},removeGeoLocation(e){const t=this.findGeoLocationIndex(e);t!==-1&&this.formData.locations.splice(t,1)},addLink(){this.formData.links.push({url:"",label:null})},removeLink(e){this.formData.links.splice(e,1)},clearStartDateTime(){const e=document.getElementById("eventStartDateTime");e&&(e.value=""),this.startDateTimeLocal="",this.formData.startsAt=null},clearEndDateTime(){const e=document.getElementById("eventEndDateTime");e&&(e.value=""),this.endDateTimeLocal="",this.formData.endsAt=null},async fetchLocationSuggestions(){if(this.loadingSuggestions||this.locationSuggestions.length>0){this.showLocationSuggestions=!0;return}this.loadingSuggestions=!0;try{const e=await fetch("/event/location-suggestions"),t=await e.json();e.ok&&t.suggestions&&(this.locationSuggestions=t.suggestions)}catch(e){console.error("Failed to fetch location suggestions:",e)}finally{this.loadingSuggestions=!1,this.showLocationSuggestions=!0}},applyLocationSuggestion(e){const t=!!e.country,n=!!(e.latitude&&e.longitude);t&&this.formData.locations.push({type:"address",country:e.country||"",postalCode:e.postal_code||null,region:e.region||null,locality:e.locality||null,street:e.street||null,name:e.name||null}),n&&this.formData.locations.push({type:"geo",latitude:String(e.latitude),longitude:String(e.longitude),name:e.name||null}),t&&n?this.locationFeedback="Added address and coordinates":t?this.locationFeedback="Added address":n&&(this.locationFeedback="Added coordinates"),this.locationFeedback&&setTimeout(()=>{this.locationFeedback=null},3e3),this.showLocationSuggestions=!1,this.locationFilter=""},async toggleDescriptionPreview(){if(this.showDescriptionPreview){this.showDescriptionPreview=!1;return}if(!this.formData.description||this.formData.description.trim().length<10){alert("Description must be at least 10 characters to preview");return}this.showDescriptionPreview=!0,this.loadingPreview=!0,this.descriptionPreviewHtml="";try{const e=await fetch("/event/preview-description",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:this.formData.description})}),t=await e.json();e.ok?this.descriptionPreviewHtml=t.html:(this.errorMessage=t.error||"Failed to load preview",this.showDescriptionPreview=!1)}catch(e){console.error("Preview error:",e),this.errorMessage="Failed to load preview. Please try again.",this.showDescriptionPreview=!1}finally{this.loadingPreview=!1}},handleHeaderImageSelect(e){var r;const t=e.target,n=(r=t.files)==null?void 0:r[0];if(n){if(n.size>3e6){alert("Image must be smaller than 3MB"),t.value="";return}console.log("Header image selected, size:",n.size)}},handleThumbnailImageSelect(e){var r;const t=e.target,n=(r=t.files)==null?void 0:r[0];if(n){if(n.size>3e6){alert("Image must be smaller than 3MB"),t.value="";return}console.log("Thumbnail image selected, size:",n.size)}},removeHeader(){this.formData.headerCid=null,this.formData.headerAlt=null,this.formData.headerSize=null,this.showCropper=!1},removeThumbnail(){this.formData.thumbnailCid=null,this.formData.thumbnailAlt=null,this.showThumbnailCropper=!1},async submitForm(){if(this.errorMessage=null,!this.formData.name||this.formData.name.trim().length<10){this.errorMessage="Event name must be at least 10 characters.";return}if(this.formData.name.trim().length>500){this.errorMessage="Event name must be no more than 500 characters.";return}if(!this.formData.description||this.formData.description.trim().length<10){this.errorMessage="Description must be at least 10 characters.";return}if(this.formData.description.trim().length>3e3){this.errorMessage="Description must be no more than 3000 characters.";return}if(this.addressLocations.filter(n=>n.type==="address"&&(!n.country||n.country.trim()==="")).length>0){this.errorMessage="All locations must have a country selected. Please select a country or remove the location.";return}for(let n=0;n<this.geoLocations.length;n++){const r=this.geoLocations[n];if(r.type==="geo"){if(!r.latitude||!r.longitude){this.errorMessage=`Coordinates ${n+1} must have both latitude and longitude.`;return}const i=parseFloat(r.latitude),o=parseFloat(r.longitude);if(isNaN(i)||i<-90||i>90){this.errorMessage=`Coordinates ${n+1} has invalid latitude. Must be between -90 and 90.`;return}if(isNaN(o)||o<-180||o>180){this.errorMessage=`Coordinates ${n+1} has invalid longitude. Must be between -180 and 180.`;return}}}const t=[];for(let n=0;n<this.formData.links.length;n++){const r=this.formData.links[n];if(!r.url||r.url.trim()===""){t.push(`Link ${n+1} must have a URL or be removed.`);continue}if(!r.url.startsWith("https://")){t.push(`Link ${n+1} must be an HTTPS URL (starting with https://).`);continue}try{new URL(r.url)}catch{t.push(`Link ${n+1} has an invalid URL format.`)}}if(t.length>0){this.errorMessage=t.join(" ");return}this.submitting=!0,this.formData.locations=this.formData.locations.filter(n=>n.type==="address"?n.country&&n.country.trim()!=="":n.type==="geo"?n.latitude&&n.longitude:!1),this.formData.links=this.formData.links.filter(n=>n.url),this.formData.endsAt===""&&(this.formData.endsAt=null);try{const n=await fetch(this.submitUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(this.formData)}),r=await n.json();n.ok?(this.submitted=!0,this.eventUrl=r.url):this.errorMessage=r.error||"Failed to "+(this.isEditMode?"update":"create")+" event. Please try again."}catch(n){console.error("Submit error:",n),this.errorMessage="Network error. Please check your connection and try again."}finally{this.submitting=!1}},resetForm(){this.formData={name:"",description:"",status:"scheduled",mode:"inperson",tz:this.formData.tz,startsAt:null,endsAt:null,locations:[],links:[],headerCid:null,headerAlt:null,headerSize:null,thumbnailCid:null,thumbnailAlt:null,requireConfirmedEmail:!1,sendNotifications:!1},this.startDateTimeLocal="",this.endDateTimeLocal="",this.submitted=!1,this.eventUrl=null,this.errorMessage=null}}}const STORAGE_KEY="smokesignal_quick_event";function initQuickEventForm(){const e=document.getElementById("quick-event-form");if(!e)return;const t=e.dataset.authenticated==="true";e.addEventListener("submit",n=>{n.preventDefault();const r=document.getElementById("home-quick-event-title"),i=document.getElementById("home-quick-event-description"),o=document.getElementById("home-quick-event-starts");if(!(!r||!i||!o))if(t){const s=o.value;if(!s){alert("Please select a start time");return}const l=new Date(s).toISOString(),c={name:r.value,description:i.value,starts_at:l,status:"scheduled",mode:"inperson",locations:[],links:[],require_confirmed_email:!1,send_notifications:!0},u=e.querySelector('button[type="submit"]');u&&(u.disabled=!0,u.innerHTML='<span class="icon"><i class="fas fa-spinner fa-pulse"></i></span><span>Creating...</span>'),fetch("/event",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}).then(async f=>{const d=await f.json();f.ok&&d.url?window.location.href=d.url:(alert(d.error||"Failed to create event. Please try again."),u&&(u.disabled=!1,u.innerHTML="<strong>Create Event</strong>"))}).catch(f=>{console.error("Error creating event:",f),alert("Failed to create event. Please try again."),u&&(u.disabled=!1,u.innerHTML="<strong>Create Event</strong>")})}else{const s={name:r.value,description:i.value,starts_at:o.value};localStorage.setItem(STORAGE_KEY,JSON.stringify(s)),window.location.href="/quick-event"}})}const H3_RESOLUTION=7;let leafletModule=null,h3Module=null;async function loadMapLibraries(){if(!leafletModule||!h3Module){const[e,t]=await Promise.all([__vitePreload(()=>import("./maps-GDfHpVyJ.js").then(n=>n.l),__vite__mapDeps([0,1])),__vitePreload(()=>import("./maps-GDfHpVyJ.js").then(n=>n.h),__vite__mapDeps([0,1]))]);await __vitePreload(()=>import("./maps-GDfHpVyJ.js").then(n=>n.a),__vite__mapDeps([0,1])),leafletModule=e.default,h3Module=t}return{L:leafletModule,h3:h3Module}}function lfgForm(){return{latitude:"",longitude:"",h3Index:"",tags:[],tagInput:"",durationHours:"48",map:null,hexLayer:null,submitting:!1,errors:{location:null,tags:null,duration:null,general:null},init(){const e=this.$el;e.dataset.defaultDuration&&(this.durationHours=e.dataset.defaultDuration),this.$nextTick(()=>{this.initMap()})},async initMap(){try{const{L:e}=await loadMapLibraries(),t=40.7128,n=-74.006;this.map=e.map("lfg-map").setView([t,n],12),e.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:"&copy; OpenStreetMap contributors"}).addTo(this.map),this.map.on("click",r=>{this.handleMapClick(r.latlng.lat,r.latlng.lng)}),navigator.geolocation&&navigator.geolocation.getCurrentPosition(r=>{var s;const i=r.coords.latitude,o=r.coords.longitude;(s=this.map)==null||s.setView([i,o],12)},()=>{})}catch(e){console.error("Failed to load map libraries:",e)}},handleMapClick(e,t){if(!h3Module){console.warn("H3 not loaded");return}const n=h3Module.latLngToCell(e,t,H3_RESOLUTION);if(this.h3Index===n){this.clearLocation();return}this.selectLocation(n),this.errors.location=null},selectLocation(e){if(!this.map||!leafletModule||!h3Module)return;this.hexLayer&&this.map.removeLayer(this.hexLayer),this.h3Index=e;const n=h3Module.cellToBoundary(e).map(i=>[i[0],i[1]]);this.hexLayer=leafletModule.polygon(n,{color:"#00d1b2",fillColor:"#00d1b2",fillOpacity:.3,weight:3}).addTo(this.map),this.hexLayer.bindTooltip("Click to unselect",{permanent:!1,direction:"center"}),this.hexLayer.on("click",()=>{this.clearLocation()});const r=h3Module.cellToLatLng(e);this.latitude=r[0].toString(),this.longitude=r[1].toString()},clearLocation(){this.hexLayer&&this.map&&(this.map.removeLayer(this.hexLayer),this.hexLayer=null),this.h3Index="",this.latitude="",this.longitude=""},addTag(){const e=this.tagInput.trim().replace(/[^a-zA-Z0-9-]/g,""),t=e.toLowerCase(),n=this.tags.some(r=>r.toLowerCase()===t);e&&!n&&this.tags.length<10&&(this.tags.push(e),this.errors.tags=null),this.tagInput=""},addTagFromSuggestion(e){const t=e.toLowerCase();!this.tags.some(r=>r.toLowerCase()===t)&&this.tags.length<10&&(this.tags.push(e),this.errors.tags=null)},removeTag(e){this.tags.splice(e,1)},canSubmit(){return!!this.h3Index&&this.tags.length>=1},clearErrors(){this.errors={location:null,tags:null,duration:null,general:null}},async submitForm(){if(!this.canSubmit()||this.submitting)return;this.clearErrors(),this.submitting=!0;const e={latitude:parseFloat(this.latitude),longitude:parseFloat(this.longitude),tags:this.tags,duration_hours:parseInt(this.durationHours,10)};try{const t=await fetch("/lfg",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(t.ok)window.location.href="/lfg";else{const n=await t.json();n.error?n.error.includes("location")||n.error.includes("coordinate")?this.errors.location=n.message||"Invalid location":n.error.includes("tag")?this.errors.tags=n.message||"Invalid tags":n.error.includes("duration")?this.errors.duration=n.message||"Invalid duration":this.errors.general=n.message||"An error occurred":this.errors.general="An error occurred. Please try again."}}catch(t){console.error("LFG submission error:",t),this.errors.general="Network error. Please check your connection and try again."}finally{this.submitting=!1}}}}const loadingState={maps:null,cropper:null,profileCropper:null,lfgHeatmap:null};async function initEventMap(){if(!document.getElementById("event-map"))return;loadingState.maps||(loadingState.maps=__vitePreload(()=>import("./index-BP1lDIcH.js"),[]));const{initEventMap:e}=await loadingState.maps;await e()}async function initGlobeMap(){if(!document.getElementById("globe-map"))return;loadingState.maps||(loadingState.maps=__vitePreload(()=>import("./index-BP1lDIcH.js"),[]));const{initGlobeMap:e}=await loadingState.maps;await e()}async function initLocationHeatmap(){if(!document.getElementById("location-heatmap"))return;loadingState.maps||(loadingState.maps=__vitePreload(()=>import("./index-BP1lDIcH.js"),[]));const{initLocationHeatmap:e}=await loadingState.maps;await e()}async function initMaps(){await Promise.all([initEventMap(),initGlobeMap(),initLocationHeatmap()])}async function initCropper(){if(!document.getElementById("headerCanvas")&&!document.getElementById("thumbnailCanvas"))return;loadingState.cropper||(loadingState.cropper=__vitePreload(()=>import("./index-Bcnf8oUZ.js"),[]));const{initCropper:e}=await loadingState.cropper;await e()}async function initProfileCropper(){if(!document.getElementById("avatar-input")&&!document.getElementById("banner-input"))return;loadingState.profileCropper||(loadingState.profileCropper=__vitePreload(()=>import("./profile-cropper-DwPaCPSP.js"),__vite__mapDeps([2,3])));const{initProfileCropper:e}=await loadingState.profileCropper;await e()}async function initLfgHeatmap(){if(!document.getElementById("lfg-heatmap"))return;loadingState.lfgHeatmap||(loadingState.lfgHeatmap=__vitePreload(()=>import("./heatmap-CJsCFdcC.js"),[]));const{initLfgHeatmap:e}=await loadingState.lfgHeatmap;await e()}function initPage(){initNavigation(),initQuickEventForm(),initMaps(),initCropper(),initProfileCropper(),initLfgHeatmap()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",initPage):initPage();document.body.addEventListener("htmx:afterSettle",()=>{initMaps(),initCropper(),initProfileCropper(),initLfgHeatmap()});const SmokesignalApp={lfgForm,eventForm,initEventMap,initGlobeMap,initLocationHeatmap,initMaps,initCropper,initProfileCropper,initLfgHeatmap,initPage};window.SmokesignalApp=SmokesignalApp;export{__vitePreload as _};
+814
static/js/maps-GDfHpVyJ.js
··· 1 + var Gm=Object.defineProperty;var qm=(xe,J,fe)=>J in xe?Gm(xe,J,{enumerable:!0,configurable:!0,writable:!0,value:fe}):xe[J]=fe;var Pi=(xe,J,fe)=>qm(xe,typeof J!="symbol"?J+"":J,fe);function Kd(xe,J){for(var fe=0;fe<J.length;fe++){const Re=J[fe];if(typeof Re!="string"&&!Array.isArray(Re)){for(const We in Re)if(We!=="default"&&!(We in xe)){const ct=Object.getOwnPropertyDescriptor(Re,We);ct&&Object.defineProperty(xe,We,ct.get?ct:{enumerable:!0,get:()=>Re[We]})}}}return Object.freeze(Object.defineProperty(xe,Symbol.toStringTag,{value:"Module"}))}function Jd(xe){return xe&&xe.__esModule&&Object.prototype.hasOwnProperty.call(xe,"default")?xe.default:xe}var Zh={exports:{}};/* @preserve 2 + * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com 3 + * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade 4 + */var Hm=Zh.exports,Hd;function Wm(){return Hd||(Hd=1,(function(xe,J){(function(fe,Re){Re(J)})(Hm,(function(fe){var Re="1.9.4";function We(u){var v,E,R,q;for(E=1,R=arguments.length;E<R;E++){q=arguments[E];for(v in q)u[v]=q[v]}return u}var ct=Object.create||(function(){function u(){}return function(v){return u.prototype=v,new u}})();function W(u,v){var E=Array.prototype.slice;if(u.bind)return u.bind.apply(u,E.call(arguments,1));var R=E.call(arguments,2);return function(){return u.apply(v,R.length?R.concat(E.call(arguments)):arguments)}}var p=0;function it(u){return"_leaflet_id"in u||(u._leaflet_id=++p),u._leaflet_id}function ur(u,v,E){var R,q,ne,Ee;return Ee=function(){R=!1,q&&(ne.apply(E,q),q=!1)},ne=function(){R?q=arguments:(u.apply(E,arguments),setTimeout(Ee,v),R=!0)},ne}function fr(u,v,E){var R=v[1],q=v[0],ne=R-q;return u===R&&E?u:((u-q)%ne+ne)%ne+q}function Zi(){return!1}function un(u,v){if(v===!1)return u;var E=Math.pow(10,v===void 0?6:v);return Math.round(u*E)/E}function zr(u){return u.trim?u.trim():u.replace(/^\s+|\s+$/g,"")}function Mn(u){return zr(u).split(/\s+/)}function Gt(u,v){Object.prototype.hasOwnProperty.call(u,"options")||(u.options=u.options?ct(u.options):{});for(var E in v)u.options[E]=v[E];return u.options}function rt(u,v,E){var R=[];for(var q in u)R.push(encodeURIComponent(E?q.toUpperCase():q)+"="+encodeURIComponent(u[q]));return(!v||v.indexOf("?")===-1?"?":"&")+R.join("&")}var Fo=/\{ *([\w_ -]+) *\}/g;function hr(u,v){return u.replace(Fo,function(E,R){var q=v[R];if(q===void 0)throw new Error("No value provided for variable "+E);return typeof q=="function"&&(q=q(v)),q})}var zi=Array.isArray||function(u){return Object.prototype.toString.call(u)==="[object Array]"};function ro(u,v){for(var E=0;E<u.length;E++)if(u[E]===v)return E;return-1}var no="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function Ns(u){return window["webkit"+u]||window["moz"+u]||window["ms"+u]}var En=0;function Oo(u){var v=+new Date,E=Math.max(0,16-(v-En));return En=v+E,window.setTimeout(u,E)}var Vs=window.requestAnimationFrame||Ns("RequestAnimationFrame")||Oo,Cs=window.cancelAnimationFrame||Ns("CancelAnimationFrame")||Ns("CancelRequestAnimationFrame")||function(u){window.clearTimeout(u)};function cr(u,v,E){if(E&&Vs===Oo)u.call(v);else return Vs.call(window,W(u,v))}function Ji(u){u&&Cs.call(window,u)}var Sn={__proto__:null,extend:We,create:ct,bind:W,get lastId(){return p},stamp:it,throttle:ur,wrapNum:fr,falseFn:Zi,formatNum:un,trim:zr,splitWords:Mn,setOptions:Gt,getParamString:rt,template:hr,isArray:zi,indexOf:ro,emptyImageUrl:no,requestFn:Vs,cancelFn:Cs,requestAnimFrame:cr,cancelAnimFrame:Ji};function Cn(){}Cn.extend=function(u){var v=function(){Gt(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},E=v.__super__=this.prototype,R=ct(E);R.constructor=v,v.prototype=R;for(var q in this)Object.prototype.hasOwnProperty.call(this,q)&&q!=="prototype"&&q!=="__super__"&&(v[q]=this[q]);return u.statics&&We(v,u.statics),u.includes&&(Un(u.includes),We.apply(null,[R].concat(u.includes))),We(R,u),delete R.statics,delete R.includes,R.options&&(R.options=E.options?ct(E.options):{},We(R.options,u.options)),R._initHooks=[],R.callInitHooks=function(){if(!this._initHooksCalled){E.callInitHooks&&E.callInitHooks.call(this),this._initHooksCalled=!0;for(var ne=0,Ee=R._initHooks.length;ne<Ee;ne++)R._initHooks[ne].call(this)}},v},Cn.include=function(u){var v=this.prototype.options;return We(this.prototype,u),u.options&&(this.prototype.options=v,this.mergeOptions(u.options)),this},Cn.mergeOptions=function(u){return We(this.prototype.options,u),this},Cn.addInitHook=function(u){var v=Array.prototype.slice.call(arguments,1),E=typeof u=="function"?u:function(){this[u].apply(this,v)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(E),this};function Un(u){if(!(typeof L>"u"||!L||!L.Mixin)){u=zi(u)?u:[u];for(var v=0;v<u.length;v++)u[v]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",new Error().stack)}}var Jr={on:function(u,v,E){if(typeof u=="object")for(var R in u)this._on(R,u[R],v);else{u=Mn(u);for(var q=0,ne=u.length;q<ne;q++)this._on(u[q],v,E)}return this},off:function(u,v,E){if(!arguments.length)delete this._events;else if(typeof u=="object")for(var R in u)this._off(R,u[R],v);else{u=Mn(u);for(var q=arguments.length===1,ne=0,Ee=u.length;ne<Ee;ne++)q?this._off(u[ne]):this._off(u[ne],v,E)}return this},_on:function(u,v,E,R){if(typeof v!="function"){console.warn("wrong listener type: "+typeof v);return}if(this._listens(u,v,E)===!1){E===this&&(E=void 0);var q={fn:v,ctx:E};R&&(q.once=!0),this._events=this._events||{},this._events[u]=this._events[u]||[],this._events[u].push(q)}},_off:function(u,v,E){var R,q,ne;if(this._events&&(R=this._events[u],!!R)){if(arguments.length===1){if(this._firingCount)for(q=0,ne=R.length;q<ne;q++)R[q].fn=Zi;delete this._events[u];return}if(typeof v!="function"){console.warn("wrong listener type: "+typeof v);return}var Ee=this._listens(u,v,E);if(Ee!==!1){var Ze=R[Ee];this._firingCount&&(Ze.fn=Zi,this._events[u]=R=R.slice()),R.splice(Ee,1)}}},fire:function(u,v,E){if(!this.listens(u,E))return this;var R=We({},v,{type:u,target:this,sourceTarget:v&&v.sourceTarget||this});if(this._events){var q=this._events[u];if(q){this._firingCount=this._firingCount+1||1;for(var ne=0,Ee=q.length;ne<Ee;ne++){var Ze=q[ne],tt=Ze.fn;Ze.once&&this.off(u,tt,Ze.ctx),tt.call(Ze.ctx||this,R)}this._firingCount--}}return E&&this._propagateEvent(R),this},listens:function(u,v,E,R){typeof u!="string"&&console.warn('"string" type argument expected');var q=v;typeof v!="function"&&(R=!!v,q=void 0,E=void 0);var ne=this._events&&this._events[u];if(ne&&ne.length&&this._listens(u,q,E)!==!1)return!0;if(R){for(var Ee in this._eventParents)if(this._eventParents[Ee].listens(u,v,E,R))return!0}return!1},_listens:function(u,v,E){if(!this._events)return!1;var R=this._events[u]||[];if(!v)return!!R.length;E===this&&(E=void 0);for(var q=0,ne=R.length;q<ne;q++)if(R[q].fn===v&&R[q].ctx===E)return q;return!1},once:function(u,v,E){if(typeof u=="object")for(var R in u)this._on(R,u[R],v,!0);else{u=Mn(u);for(var q=0,ne=u.length;q<ne;q++)this._on(u[q],v,E,!0)}return this},addEventParent:function(u){return this._eventParents=this._eventParents||{},this._eventParents[it(u)]=u,this},removeEventParent:function(u){return this._eventParents&&delete this._eventParents[it(u)],this},_propagateEvent:function(u){for(var v in this._eventParents)this._eventParents[v].fire(u.type,We({layer:u.target,propagatedFrom:u.target},u),!0)}};Jr.addEventListener=Jr.on,Jr.removeEventListener=Jr.clearAllEventListeners=Jr.off,Jr.addOneTimeEventListener=Jr.once,Jr.fireEvent=Jr.fire,Jr.hasEventListeners=Jr.listens;var Hr=Cn.extend(Jr);function ti(u,v,E){this.x=E?Math.round(u):u,this.y=E?Math.round(v):v}var Oi=Math.trunc||function(u){return u>0?Math.floor(u):Math.ceil(u)};ti.prototype={clone:function(){return new ti(this.x,this.y)},add:function(u){return this.clone()._add(Yt(u))},_add:function(u){return this.x+=u.x,this.y+=u.y,this},subtract:function(u){return this.clone()._subtract(Yt(u))},_subtract:function(u){return this.x-=u.x,this.y-=u.y,this},divideBy:function(u){return this.clone()._divideBy(u)},_divideBy:function(u){return this.x/=u,this.y/=u,this},multiplyBy:function(u){return this.clone()._multiplyBy(u)},_multiplyBy:function(u){return this.x*=u,this.y*=u,this},scaleBy:function(u){return new ti(this.x*u.x,this.y*u.y)},unscaleBy:function(u){return new ti(this.x/u.x,this.y/u.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=Oi(this.x),this.y=Oi(this.y),this},distanceTo:function(u){u=Yt(u);var v=u.x-this.x,E=u.y-this.y;return Math.sqrt(v*v+E*E)},equals:function(u){return u=Yt(u),u.x===this.x&&u.y===this.y},contains:function(u){return u=Yt(u),Math.abs(u.x)<=Math.abs(this.x)&&Math.abs(u.y)<=Math.abs(this.y)},toString:function(){return"Point("+un(this.x)+", "+un(this.y)+")"}};function Yt(u,v,E){return u instanceof ti?u:zi(u)?new ti(u[0],u[1]):u==null?u:typeof u=="object"&&"x"in u&&"y"in u?new ti(u.x,u.y):new ti(u,v,E)}function Ni(u,v){if(u)for(var E=v?[u,v]:u,R=0,q=E.length;R<q;R++)this.extend(E[R])}Ni.prototype={extend:function(u){var v,E;if(!u)return this;if(u instanceof ti||typeof u[0]=="number"||"x"in u)v=E=Yt(u);else if(u=Mr(u),v=u.min,E=u.max,!v||!E)return this;return!this.min&&!this.max?(this.min=v.clone(),this.max=E.clone()):(this.min.x=Math.min(v.x,this.min.x),this.max.x=Math.max(E.x,this.max.x),this.min.y=Math.min(v.y,this.min.y),this.max.y=Math.max(E.y,this.max.y)),this},getCenter:function(u){return Yt((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,u)},getBottomLeft:function(){return Yt(this.min.x,this.max.y)},getTopRight:function(){return Yt(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(u){var v,E;return typeof u[0]=="number"||u instanceof ti?u=Yt(u):u=Mr(u),u instanceof Ni?(v=u.min,E=u.max):v=E=u,v.x>=this.min.x&&E.x<=this.max.x&&v.y>=this.min.y&&E.y<=this.max.y},intersects:function(u){u=Mr(u);var v=this.min,E=this.max,R=u.min,q=u.max,ne=q.x>=v.x&&R.x<=E.x,Ee=q.y>=v.y&&R.y<=E.y;return ne&&Ee},overlaps:function(u){u=Mr(u);var v=this.min,E=this.max,R=u.min,q=u.max,ne=q.x>v.x&&R.x<E.x,Ee=q.y>v.y&&R.y<E.y;return ne&&Ee},isValid:function(){return!!(this.min&&this.max)},pad:function(u){var v=this.min,E=this.max,R=Math.abs(v.x-E.x)*u,q=Math.abs(v.y-E.y)*u;return Mr(Yt(v.x-R,v.y-q),Yt(E.x+R,E.y+q))},equals:function(u){return u?(u=Mr(u),this.min.equals(u.getTopLeft())&&this.max.equals(u.getBottomRight())):!1}};function Mr(u,v){return!u||u instanceof Ni?u:new Ni(u,v)}function Wr(u,v){if(u)for(var E=v?[u,v]:u,R=0,q=E.length;R<q;R++)this.extend(E[R])}Wr.prototype={extend:function(u){var v=this._southWest,E=this._northEast,R,q;if(u instanceof xi)R=u,q=u;else if(u instanceof Wr){if(R=u._southWest,q=u._northEast,!R||!q)return this}else return u?this.extend(Ai(u)||or(u)):this;return!v&&!E?(this._southWest=new xi(R.lat,R.lng),this._northEast=new xi(q.lat,q.lng)):(v.lat=Math.min(R.lat,v.lat),v.lng=Math.min(R.lng,v.lng),E.lat=Math.max(q.lat,E.lat),E.lng=Math.max(q.lng,E.lng)),this},pad:function(u){var v=this._southWest,E=this._northEast,R=Math.abs(v.lat-E.lat)*u,q=Math.abs(v.lng-E.lng)*u;return new Wr(new xi(v.lat-R,v.lng-q),new xi(E.lat+R,E.lng+q))},getCenter:function(){return new xi((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new xi(this.getNorth(),this.getWest())},getSouthEast:function(){return new xi(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(u){typeof u[0]=="number"||u instanceof xi||"lat"in u?u=Ai(u):u=or(u);var v=this._southWest,E=this._northEast,R,q;return u instanceof Wr?(R=u.getSouthWest(),q=u.getNorthEast()):R=q=u,R.lat>=v.lat&&q.lat<=E.lat&&R.lng>=v.lng&&q.lng<=E.lng},intersects:function(u){u=or(u);var v=this._southWest,E=this._northEast,R=u.getSouthWest(),q=u.getNorthEast(),ne=q.lat>=v.lat&&R.lat<=E.lat,Ee=q.lng>=v.lng&&R.lng<=E.lng;return ne&&Ee},overlaps:function(u){u=or(u);var v=this._southWest,E=this._northEast,R=u.getSouthWest(),q=u.getNorthEast(),ne=q.lat>v.lat&&R.lat<E.lat,Ee=q.lng>v.lng&&R.lng<E.lng;return ne&&Ee},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(u,v){return u?(u=or(u),this._southWest.equals(u.getSouthWest(),v)&&this._northEast.equals(u.getNorthEast(),v)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function or(u,v){return u instanceof Wr?u:new Wr(u,v)}function xi(u,v,E){if(isNaN(u)||isNaN(v))throw new Error("Invalid LatLng object: ("+u+", "+v+")");this.lat=+u,this.lng=+v,E!==void 0&&(this.alt=+E)}xi.prototype={equals:function(u,v){if(!u)return!1;u=Ai(u);var E=Math.max(Math.abs(this.lat-u.lat),Math.abs(this.lng-u.lng));return E<=(v===void 0?1e-9:v)},toString:function(u){return"LatLng("+un(this.lat,u)+", "+un(this.lng,u)+")"},distanceTo:function(u){return Er.distance(this,Ai(u))},wrap:function(){return Er.wrapLatLng(this)},toBounds:function(u){var v=180*u/40075017,E=v/Math.cos(Math.PI/180*this.lat);return or([this.lat-v,this.lng-E],[this.lat+v,this.lng+E])},clone:function(){return new xi(this.lat,this.lng,this.alt)}};function Ai(u,v,E){return u instanceof xi?u:zi(u)&&typeof u[0]!="object"?u.length===3?new xi(u[0],u[1],u[2]):u.length===2?new xi(u[0],u[1]):null:u==null?u:typeof u=="object"&&"lat"in u?new xi(u.lat,"lng"in u?u.lng:u.lon,u.alt):v===void 0?null:new xi(u,v,E)}var hn={latLngToPoint:function(u,v){var E=this.projection.project(u),R=this.scale(v);return this.transformation._transform(E,R)},pointToLatLng:function(u,v){var E=this.scale(v),R=this.transformation.untransform(u,E);return this.projection.unproject(R)},project:function(u){return this.projection.project(u)},unproject:function(u){return this.projection.unproject(u)},scale:function(u){return 256*Math.pow(2,u)},zoom:function(u){return Math.log(u/256)/Math.LN2},getProjectedBounds:function(u){if(this.infinite)return null;var v=this.projection.bounds,E=this.scale(u),R=this.transformation.transform(v.min,E),q=this.transformation.transform(v.max,E);return new Ni(R,q)},infinite:!1,wrapLatLng:function(u){var v=this.wrapLng?fr(u.lng,this.wrapLng,!0):u.lng,E=this.wrapLat?fr(u.lat,this.wrapLat,!0):u.lat,R=u.alt;return new xi(E,v,R)},wrapLatLngBounds:function(u){var v=u.getCenter(),E=this.wrapLatLng(v),R=v.lat-E.lat,q=v.lng-E.lng;if(R===0&&q===0)return u;var ne=u.getSouthWest(),Ee=u.getNorthEast(),Ze=new xi(ne.lat-R,ne.lng-q),tt=new xi(Ee.lat-R,Ee.lng-q);return new Wr(Ze,tt)}},Er=We({},hn,{wrapLng:[-180,180],R:6371e3,distance:function(u,v){var E=Math.PI/180,R=u.lat*E,q=v.lat*E,ne=Math.sin((v.lat-u.lat)*E/2),Ee=Math.sin((v.lng-u.lng)*E/2),Ze=ne*ne+Math.cos(R)*Math.cos(q)*Ee*Ee,tt=2*Math.atan2(Math.sqrt(Ze),Math.sqrt(1-Ze));return this.R*tt}}),yo=6378137,us={R:yo,MAX_LATITUDE:85.0511287798,project:function(u){var v=Math.PI/180,E=this.MAX_LATITUDE,R=Math.max(Math.min(E,u.lat),-E),q=Math.sin(R*v);return new ti(this.R*u.lng*v,this.R*Math.log((1+q)/(1-q))/2)},unproject:function(u){var v=180/Math.PI;return new xi((2*Math.atan(Math.exp(u.y/this.R))-Math.PI/2)*v,u.x*v/this.R)},bounds:(function(){var u=yo*Math.PI;return new Ni([-u,-u],[u,u])})()};function No(u,v,E,R){if(zi(u)){this._a=u[0],this._b=u[1],this._c=u[2],this._d=u[3];return}this._a=u,this._b=v,this._c=E,this._d=R}No.prototype={transform:function(u,v){return this._transform(u.clone(),v)},_transform:function(u,v){return v=v||1,u.x=v*(this._a*u.x+this._b),u.y=v*(this._c*u.y+this._d),u},untransform:function(u,v){return v=v||1,new ti((u.x/v-this._b)/this._a,(u.y/v-this._d)/this._c)}};function In(u,v,E,R){return new No(u,v,E,R)}var Vo=We({},Er,{code:"EPSG:3857",projection:us,transformation:(function(){var u=.5/(Math.PI*us.R);return In(u,.5,-u,.5)})()}),en=We({},Vo,{code:"EPSG:900913"});function hs(u){return document.createElementNS("http://www.w3.org/2000/svg",u)}function Is(u,v){var E="",R,q,ne,Ee,Ze,tt;for(R=0,ne=u.length;R<ne;R++){for(Ze=u[R],q=0,Ee=Ze.length;q<Ee;q++)tt=Ze[q],E+=(q?"L":"M")+tt.x+" "+tt.y;E+=v?o.svg?"z":"x":""}return E||"M0 0"}var Ui=document.documentElement.style,Dn="ActiveXObject"in window,jo=Dn&&!document.addEventListener,Zo="msLaunchUri"in navigator&&!("documentMode"in document),tn=At("webkit"),Gn=At("android"),vo=At("android 2")||At("android 3"),Ds=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),mn=Gn&&At("Google")&&Ds<537&&!("AudioNode"in window),Ne=!!window.opera,ee=!Zo&&At("chrome"),K=At("gecko")&&!tn&&!Ne&&!Dn,le=!ee&&At("safari"),Me=At("phantom"),Se="OTransition"in Ui,Ge=navigator.platform.indexOf("Win")===0,Fe=Dn&&"transition"in Ui,ke="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!vo,Qe="MozPerspective"in Ui,ft=!window.L_DISABLE_3D&&(Fe||ke||Qe)&&!Se&&!Me,ot=typeof orientation<"u"||At("mobile"),St=ot&&tn,je=ot&&ke,Xt=!window.PointerEvent&&window.MSPointerEvent,Gi=!!(window.PointerEvent||Xt),Bi="ontouchstart"in window||!!window.TouchEvent,qe=!window.L_NO_TOUCH&&(Bi||Gi),Hi=ot&&Ne,rn=ot&&K,Kt=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,qi=(function(){var u=!1;try{var v=Object.defineProperty({},"passive",{get:function(){u=!0}});window.addEventListener("testPassiveEventSupport",Zi,v),window.removeEventListener("testPassiveEventSupport",Zi,v)}catch{}return u})(),Vr=(function(){return!!document.createElement("canvas").getContext})(),Wi=!!(document.createElementNS&&hs("svg").createSVGRect),er=!!Wi&&(function(){var u=document.createElement("div");return u.innerHTML="<svg/>",(u.firstChild&&u.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),Ve=!Wi&&(function(){try{var u=document.createElement("div");u.innerHTML='<v:shape adj="1"/>';var v=u.firstChild;return v.style.behavior="url(#default#VML)",v&&typeof v.adj=="object"}catch{return!1}})(),at=navigator.platform.indexOf("Mac")===0,It=navigator.platform.indexOf("Linux")===0;function At(u){return navigator.userAgent.toLowerCase().indexOf(u)>=0}var o={ie:Dn,ielt9:jo,edge:Zo,webkit:tn,android:Gn,android23:vo,androidStock:mn,opera:Ne,chrome:ee,gecko:K,safari:le,phantom:Me,opera12:Se,win:Ge,ie3d:Fe,webkit3d:ke,gecko3d:Qe,any3d:ft,mobile:ot,mobileWebkit:St,mobileWebkit3d:je,msPointer:Xt,pointer:Gi,touch:qe,touchNative:Bi,mobileOpera:Hi,mobileGecko:rn,retina:Kt,passiveEvents:qi,canvas:Vr,svg:Wi,vml:Ve,inlineSvg:er,mac:at,linux:It},X=o.msPointer?"MSPointerDown":"pointerdown",ii=o.msPointer?"MSPointerMove":"pointermove",Ri=o.msPointer?"MSPointerUp":"pointerup",Qi=o.msPointer?"MSPointerCancel":"pointercancel",ut={touchstart:X,touchmove:ii,touchend:Ri,touchcancel:Qi},zt={touchstart:Hn,touchmove:qn,touchend:qn,touchcancel:qn},$t={},fi=!1;function di(u,v,E){return v==="touchstart"&&kn(),zt[v]?(E=zt[v].bind(this,E),u.addEventListener(ut[v],E,!1),E):(console.warn("wrong event specified:",v),Zi)}function jr(u,v,E){if(!ut[v]){console.warn("wrong event specified:",v);return}u.removeEventListener(ut[v],E,!1)}function ni(u){$t[u.pointerId]=u}function Ea(u){$t[u.pointerId]&&($t[u.pointerId]=u)}function xo(u){delete $t[u.pointerId]}function kn(){fi||(document.addEventListener(X,ni,!0),document.addEventListener(ii,Ea,!0),document.addEventListener(Ri,xo,!0),document.addEventListener(Qi,xo,!0),fi=!0)}function qn(u,v){if(v.pointerType!==(v.MSPOINTER_TYPE_MOUSE||"mouse")){v.touches=[];for(var E in $t)v.touches.push($t[E]);v.changedTouches=[v],u(v)}}function Hn(u,v){v.MSPOINTER_TYPE_TOUCH&&v.pointerType===v.MSPOINTER_TYPE_TOUCH&&Si(v),qn(u,v)}function bo(u){var v={},E,R;for(R in u)E=u[R],v[R]=E&&E.bind?E.bind(u):E;return u=v,v.type="dblclick",v.detail=2,v.isTrusted=!1,v._simulated=!0,v}var Sa=200;function vr(u,v){u.addEventListener("dblclick",v);var E=0,R;function q(ne){if(ne.detail!==1){R=ne.detail;return}if(!(ne.pointerType==="mouse"||ne.sourceCapabilities&&!ne.sourceCapabilities.firesTouchEvents)){var Ee=gs(ne);if(!(Ee.some(function(tt){return tt instanceof HTMLLabelElement&&tt.attributes.for})&&!Ee.some(function(tt){return tt instanceof HTMLInputElement||tt instanceof HTMLSelectElement}))){var Ze=Date.now();Ze-E<=Sa?(R++,R===2&&v(bo(ne))):R=1,E=Ze}}}return u.addEventListener("click",q),{dblclick:v,simDblclick:q}}function Ft(u,v){u.removeEventListener("dblclick",v.dblclick),u.removeEventListener("click",v.simDblclick)}var ae=Ln(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),qt=Ln(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Uo=qt==="webkitTransition"||qt==="OTransition"?qt+"End":"transitionend";function wo(u){return typeof u=="string"?document.getElementById(u):u}function zn(u,v){var E=u.style[v]||u.currentStyle&&u.currentStyle[v];if((!E||E==="auto")&&document.defaultView){var R=document.defaultView.getComputedStyle(u,null);E=R?R[v]:null}return E==="auto"?null:E}function Fi(u,v,E){var R=document.createElement(u);return R.className=v||"",E&&E.appendChild(R),R}function Xi(u){var v=u.parentNode;v&&v.removeChild(u)}function te(u){for(;u.firstChild;)u.removeChild(u.firstChild)}function tr(u){var v=u.parentNode;v&&v.lastChild!==u&&v.appendChild(u)}function Go(u){var v=u.parentNode;v&&v.firstChild!==u&&v.insertBefore(u,v.firstChild)}function Ha(u,v){if(u.classList!==void 0)return u.classList.contains(v);var E=ha(u);return E.length>0&&new RegExp("(^|\\s)"+v+"(\\s|$)").test(E)}function _i(u,v){if(u.classList!==void 0)for(var E=Mn(v),R=0,q=E.length;R<q;R++)u.classList.add(E[R]);else if(!Ha(u,v)){var ne=ha(u);Wa(u,(ne?ne+" ":"")+v)}}function Sr(u,v){u.classList!==void 0?u.classList.remove(v):Wa(u,zr((" "+ha(u)+" ").replace(" "+v+" "," ")))}function Wa(u,v){u.className.baseVal===void 0?u.className=v:u.className.baseVal=v}function ha(u){return u.correspondingElement&&(u=u.correspondingElement),u.className.baseVal===void 0?u.className:u.className.baseVal}function _n(u,v){"opacity"in u.style?u.style.opacity=v:"filter"in u.style&&Qa(u,v)}function Qa(u,v){var E=!1,R="DXImageTransform.Microsoft.Alpha";try{E=u.filters.item(R)}catch{if(v===1)return}v=Math.round(v*100),E?(E.Enabled=v!==100,E.Opacity=v):u.style.filter+=" progid:"+R+"(opacity="+v+")"}function Ln(u){for(var v=document.documentElement.style,E=0;E<u.length;E++)if(u[E]in v)return u[E];return!1}function ar(u,v,E){var R=v||new ti(0,0);u.style[ae]=(o.ie3d?"translate("+R.x+"px,"+R.y+"px)":"translate3d("+R.x+"px,"+R.y+"px,0)")+(E?" scale("+E+")":"")}function Cr(u,v){u._leaflet_pos=v,o.any3d?ar(u,v):(u.style.left=v.x+"px",u.style.top=v.y+"px")}function To(u){return u._leaflet_pos||new ti(0,0)}var so,js,$a;if("onselectstart"in document)so=function(){Ht(window,"selectstart",Si)},js=function(){Dt(window,"selectstart",Si)};else{var ks=Ln(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);so=function(){if(ks){var u=document.documentElement.style;$a=u[ks],u[ks]="none"}},js=function(){ks&&(document.documentElement.style[ks]=$a,$a=void 0)}}function Ca(){Ht(window,"dragstart",Si)}function qo(){Dt(window,"dragstart",Si)}var zs,Vi;function oi(u){for(;u.tabIndex===-1;)u=u.parentNode;u.style&&(Ho(),zs=u,Vi=u.style.outlineStyle,u.style.outlineStyle="none",Ht(window,"keydown",Ho))}function Ho(){zs&&(zs.style.outlineStyle=Vi,zs=void 0,Vi=void 0,Dt(window,"keydown",Ho))}function Nl(u){do u=u.parentNode;while((!u.offsetWidth||!u.offsetHeight)&&u!==document.body);return u}function Ia(u){var v=u.getBoundingClientRect();return{x:v.width/u.offsetWidth||1,y:v.height/u.offsetHeight||1,boundingClientRect:v}}var Wn={__proto__:null,TRANSFORM:ae,TRANSITION:qt,TRANSITION_END:Uo,get:wo,getStyle:zn,create:Fi,remove:Xi,empty:te,toFront:tr,toBack:Go,hasClass:Ha,addClass:_i,removeClass:Sr,setClass:Wa,getClass:ha,setOpacity:_n,testProp:Ln,setTransform:ar,setPosition:Cr,getPosition:To,get disableTextSelection(){return so},get enableTextSelection(){return js},disableImageDrag:Ca,enableImageDrag:qo,preventOutline:oi,restoreOutline:Ho,getSizedParentNode:Nl,getScale:Ia};function Ht(u,v,E,R){if(v&&typeof v=="object")for(var q in v)cn(u,q,v[q],E);else{v=Mn(v);for(var ne=0,Ee=v.length;ne<Ee;ne++)cn(u,v[ne],E,R)}return this}var Li="_leaflet_events";function Dt(u,v,E,R){if(arguments.length===1)Ki(u),delete u[Li];else if(v&&typeof v=="object")for(var q in v)gn(u,q,v[q],E);else if(v=Mn(v),arguments.length===2)Ki(u,function(Ze){return ro(v,Ze)!==-1});else for(var ne=0,Ee=v.length;ne<Ee;ne++)gn(u,v[ne],E,R);return this}function Ki(u,v){for(var E in u[Li]){var R=E.split(/\d/)[0];(!v||v(R))&&gn(u,R,null,null,E)}}var Zs={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function cn(u,v,E,R){var q=v+it(E)+(R?"_"+it(R):"");if(u[Li]&&u[Li][q])return this;var ne=function(Ze){return E.call(R||u,Ze||window.event)},Ee=ne;!o.touchNative&&o.pointer&&v.indexOf("touch")===0?ne=di(u,v,ne):o.touch&&v==="dblclick"?ne=vr(u,ne):"addEventListener"in u?v==="touchstart"||v==="touchmove"||v==="wheel"||v==="mousewheel"?u.addEventListener(Zs[v]||v,ne,o.passiveEvents?{passive:!1}:!1):v==="mouseenter"||v==="mouseleave"?(ne=function(Ze){Ze=Ze||window.event,Ls(u,Ze)&&Ee(Ze)},u.addEventListener(Zs[v],ne,!1)):u.addEventListener(v,Ee,!1):u.attachEvent("on"+v,ne),u[Li]=u[Li]||{},u[Li][q]=ne}function gn(u,v,E,R,q){q=q||v+it(E)+(R?"_"+it(R):"");var ne=u[Li]&&u[Li][q];if(!ne)return this;!o.touchNative&&o.pointer&&v.indexOf("touch")===0?jr(u,v,ne):o.touch&&v==="dblclick"?Ft(u,ne):"removeEventListener"in u?u.removeEventListener(Zs[v]||v,ne,!1):u.detachEvent("on"+v,ne),u[Li][q]=null}function Lr(u){return u.stopPropagation?u.stopPropagation():u.originalEvent?u.originalEvent._stopped=!0:u.cancelBubble=!0,this}function Us(u){return cn(u,"wheel",Lr),this}function Qn(u){return Ht(u,"mousedown touchstart dblclick contextmenu",Lr),u._leaflet_disable_click=!0,this}function Si(u){return u.preventDefault?u.preventDefault():u.returnValue=!1,this}function $n(u){return Si(u),Lr(u),this}function gs(u){if(u.composedPath)return u.composedPath();for(var v=[],E=u.target;E;)v.push(E),E=E.parentNode;return v}function ca(u,v){if(!v)return new ti(u.clientX,u.clientY);var E=Ia(v),R=E.boundingClientRect;return new ti((u.clientX-R.left)/E.x-v.clientLeft,(u.clientY-R.top)/E.y-v.clientTop)}var Yn=o.linux&&o.chrome?window.devicePixelRatio:o.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function Po(u){return o.edge?u.wheelDeltaY/2:u.deltaY&&u.deltaMode===0?-u.deltaY/Yn:u.deltaY&&u.deltaMode===1?-u.deltaY*20:u.deltaY&&u.deltaMode===2?-u.deltaY*60:u.deltaX||u.deltaZ?0:u.wheelDelta?(u.wheelDeltaY||u.wheelDelta)/2:u.detail&&Math.abs(u.detail)<32765?-u.detail*20:u.detail?u.detail/-32765*60:0}function Ls(u,v){var E=v.relatedTarget;if(!E)return!0;try{for(;E&&E!==u;)E=E.parentNode}catch{return!1}return E!==u}var Vl={__proto__:null,on:Ht,off:Dt,stopPropagation:Lr,disableScrollPropagation:Us,disableClickPropagation:Qn,preventDefault:Si,stop:$n,getPropagationPath:gs,getMousePosition:ca,getWheelDelta:Po,isExternalTarget:Ls,addListener:Ht,removeListener:Dt},Qr=Hr.extend({run:function(u,v,E,R){this.stop(),this._el=u,this._inProgress=!0,this._duration=E||.25,this._easeOutPower=1/Math.max(R||.5,.2),this._startPos=To(u),this._offset=v.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=cr(this._animate,this),this._step()},_step:function(u){var v=+new Date-this._startTime,E=this._duration*1e3;v<E?this._runFrame(this._easeOut(v/E),u):(this._runFrame(1),this._complete())},_runFrame:function(u,v){var E=this._startPos.add(this._offset.multiplyBy(u));v&&E._round(),Cr(this._el,E),this.fire("step")},_complete:function(){Ji(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(u){return 1-Math.pow(1-u,this._easeOutPower)}}),hi=Hr.extend({options:{crs:Vo,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(u,v){v=Gt(this,v),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(u),this._initLayout(),this._onResize=W(this._onResize,this),this._initEvents(),v.maxBounds&&this.setMaxBounds(v.maxBounds),v.zoom!==void 0&&(this._zoom=this._limitZoom(v.zoom)),v.center&&v.zoom!==void 0&&this.setView(Ai(v.center),v.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=qt&&o.any3d&&!o.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),Ht(this._proxy,Uo,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(u,v,E){if(v=v===void 0?this._zoom:this._limitZoom(v),u=this._limitCenter(Ai(u),v,this.options.maxBounds),E=E||{},this._stop(),this._loaded&&!E.reset&&E!==!0){E.animate!==void 0&&(E.zoom=We({animate:E.animate},E.zoom),E.pan=We({animate:E.animate,duration:E.duration},E.pan));var R=this._zoom!==v?this._tryAnimatedZoom&&this._tryAnimatedZoom(u,v,E.zoom):this._tryAnimatedPan(u,E.pan);if(R)return clearTimeout(this._sizeTimer),this}return this._resetView(u,v,E.pan&&E.pan.noMoveStart),this},setZoom:function(u,v){return this._loaded?this.setView(this.getCenter(),u,{zoom:v}):(this._zoom=u,this)},zoomIn:function(u,v){return u=u||(o.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+u,v)},zoomOut:function(u,v){return u=u||(o.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-u,v)},setZoomAround:function(u,v,E){var R=this.getZoomScale(v),q=this.getSize().divideBy(2),ne=u instanceof ti?u:this.latLngToContainerPoint(u),Ee=ne.subtract(q).multiplyBy(1-1/R),Ze=this.containerPointToLatLng(q.add(Ee));return this.setView(Ze,v,{zoom:E})},_getBoundsCenterZoom:function(u,v){v=v||{},u=u.getBounds?u.getBounds():or(u);var E=Yt(v.paddingTopLeft||v.padding||[0,0]),R=Yt(v.paddingBottomRight||v.padding||[0,0]),q=this.getBoundsZoom(u,!1,E.add(R));if(q=typeof v.maxZoom=="number"?Math.min(v.maxZoom,q):q,q===1/0)return{center:u.getCenter(),zoom:q};var ne=R.subtract(E).divideBy(2),Ee=this.project(u.getSouthWest(),q),Ze=this.project(u.getNorthEast(),q),tt=this.unproject(Ee.add(Ze).divideBy(2).add(ne),q);return{center:tt,zoom:q}},fitBounds:function(u,v){if(u=or(u),!u.isValid())throw new Error("Bounds are not valid.");var E=this._getBoundsCenterZoom(u,v);return this.setView(E.center,E.zoom,v)},fitWorld:function(u){return this.fitBounds([[-90,-180],[90,180]],u)},panTo:function(u,v){return this.setView(u,this._zoom,{pan:v})},panBy:function(u,v){if(u=Yt(u).round(),v=v||{},!u.x&&!u.y)return this.fire("moveend");if(v.animate!==!0&&!this.getSize().contains(u))return this._resetView(this.unproject(this.project(this.getCenter()).add(u)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new Qr,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),v.noMoveStart||this.fire("movestart"),v.animate!==!1){_i(this._mapPane,"leaflet-pan-anim");var E=this._getMapPanePos().subtract(u).round();this._panAnim.run(this._mapPane,E,v.duration||.25,v.easeLinearity)}else this._rawPanBy(u),this.fire("move").fire("moveend");return this},flyTo:function(u,v,E){if(E=E||{},E.animate===!1||!o.any3d)return this.setView(u,v,E);this._stop();var R=this.project(this.getCenter()),q=this.project(u),ne=this.getSize(),Ee=this._zoom;u=Ai(u),v=v===void 0?Ee:v;var Ze=Math.max(ne.x,ne.y),tt=Ze*this.getZoomScale(Ee,v),gt=q.distanceTo(R)||1,Rt=1.42,Jt=Rt*Rt;function Ti(pr){var nr=pr?-1:1,ll=pr?tt:Ze,Co=tt*tt-Ze*Ze+nr*Jt*Jt*gt*gt,Ao=2*ll*Jt*gt,Ur=Co/Ao,ta=Math.sqrt(Ur*Ur+1)-Ur,Kl=ta<1e-9?-18:Math.log(ta);return Kl}function Zr(pr){return(Math.exp(pr)-Math.exp(-pr))/2}function Br(pr){return(Math.exp(pr)+Math.exp(-pr))/2}function ps(pr){return Zr(pr)/Br(pr)}var On=Ti(0);function Ks(pr){return Ze*(Br(On)/Br(On+Rt*pr))}function al(pr){return Ze*(Br(On)*ps(On+Rt*pr)-Zr(On))/Jt}function Yl(pr){return 1-Math.pow(1-pr,1.5)}var Xl=Date.now(),br=(Ti(1)-On)/Rt,ea=E.duration?1e3*E.duration:1e3*br*.8;function Nn(){var pr=(Date.now()-Xl)/ea,nr=Yl(pr)*br;pr<=1?(this._flyToFrame=cr(Nn,this),this._move(this.unproject(R.add(q.subtract(R).multiplyBy(al(nr)/gt)),Ee),this.getScaleZoom(Ze/Ks(nr),Ee),{flyTo:!0})):this._move(u,v)._moveEnd(!0)}return this._moveStart(!0,E.noMoveStart),Nn.call(this),this},flyToBounds:function(u,v){var E=this._getBoundsCenterZoom(u,v);return this.flyTo(E.center,E.zoom,v)},setMaxBounds:function(u){return u=or(u),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),u.isValid()?(this.options.maxBounds=u,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(u){var v=this.options.minZoom;return this.options.minZoom=u,this._loaded&&v!==u&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(u):this},setMaxZoom:function(u){var v=this.options.maxZoom;return this.options.maxZoom=u,this._loaded&&v!==u&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(u):this},panInsideBounds:function(u,v){this._enforcingBounds=!0;var E=this.getCenter(),R=this._limitCenter(E,this._zoom,or(u));return E.equals(R)||this.panTo(R,v),this._enforcingBounds=!1,this},panInside:function(u,v){v=v||{};var E=Yt(v.paddingTopLeft||v.padding||[0,0]),R=Yt(v.paddingBottomRight||v.padding||[0,0]),q=this.project(this.getCenter()),ne=this.project(u),Ee=this.getPixelBounds(),Ze=Mr([Ee.min.add(E),Ee.max.subtract(R)]),tt=Ze.getSize();if(!Ze.contains(ne)){this._enforcingBounds=!0;var gt=ne.subtract(Ze.getCenter()),Rt=Ze.extend(ne).getSize().subtract(tt);q.x+=gt.x<0?-Rt.x:Rt.x,q.y+=gt.y<0?-Rt.y:Rt.y,this.panTo(this.unproject(q),v),this._enforcingBounds=!1}return this},invalidateSize:function(u){if(!this._loaded)return this;u=We({animate:!1,pan:!0},u===!0?{animate:!0}:u);var v=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var E=this.getSize(),R=v.divideBy(2).round(),q=E.divideBy(2).round(),ne=R.subtract(q);return!ne.x&&!ne.y?this:(u.animate&&u.pan?this.panBy(ne):(u.pan&&this._rawPanBy(ne),this.fire("move"),u.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(W(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:v,newSize:E}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(u){if(u=this._locateOptions=We({timeout:1e4,watch:!1},u),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var v=W(this._handleGeolocationResponse,this),E=W(this._handleGeolocationError,this);return u.watch?this._locationWatchId=navigator.geolocation.watchPosition(v,E,u):navigator.geolocation.getCurrentPosition(v,E,u),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(u){if(this._container._leaflet_id){var v=u.code,E=u.message||(v===1?"permission denied":v===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:v,message:"Geolocation error: "+E+"."})}},_handleGeolocationResponse:function(u){if(this._container._leaflet_id){var v=u.coords.latitude,E=u.coords.longitude,R=new xi(v,E),q=R.toBounds(u.coords.accuracy*2),ne=this._locateOptions;if(ne.setView){var Ee=this.getBoundsZoom(q);this.setView(R,ne.maxZoom?Math.min(Ee,ne.maxZoom):Ee)}var Ze={latlng:R,bounds:q,timestamp:u.timestamp};for(var tt in u.coords)typeof u.coords[tt]=="number"&&(Ze[tt]=u.coords[tt]);this.fire("locationfound",Ze)}},addHandler:function(u,v){if(!v)return this;var E=this[u]=new v(this);return this._handlers.push(E),this.options[u]&&E.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),Xi(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(Ji(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var u;for(u in this._layers)this._layers[u].remove();for(u in this._panes)Xi(this._panes[u]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(u,v){var E="leaflet-pane"+(u?" leaflet-"+u.replace("Pane","")+"-pane":""),R=Fi("div",E,v||this._mapPane);return u&&(this._panes[u]=R),R},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var u=this.getPixelBounds(),v=this.unproject(u.getBottomLeft()),E=this.unproject(u.getTopRight());return new Wr(v,E)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(u,v,E){u=or(u),E=Yt(E||[0,0]);var R=this.getZoom()||0,q=this.getMinZoom(),ne=this.getMaxZoom(),Ee=u.getNorthWest(),Ze=u.getSouthEast(),tt=this.getSize().subtract(E),gt=Mr(this.project(Ze,R),this.project(Ee,R)).getSize(),Rt=o.any3d?this.options.zoomSnap:1,Jt=tt.x/gt.x,Ti=tt.y/gt.y,Zr=v?Math.max(Jt,Ti):Math.min(Jt,Ti);return R=this.getScaleZoom(Zr,R),Rt&&(R=Math.round(R/(Rt/100))*(Rt/100),R=v?Math.ceil(R/Rt)*Rt:Math.floor(R/Rt)*Rt),Math.max(q,Math.min(ne,R))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new ti(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(u,v){var E=this._getTopLeftPoint(u,v);return new Ni(E,E.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(u){return this.options.crs.getProjectedBounds(u===void 0?this.getZoom():u)},getPane:function(u){return typeof u=="string"?this._panes[u]:u},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(u,v){var E=this.options.crs;return v=v===void 0?this._zoom:v,E.scale(u)/E.scale(v)},getScaleZoom:function(u,v){var E=this.options.crs;v=v===void 0?this._zoom:v;var R=E.zoom(u*E.scale(v));return isNaN(R)?1/0:R},project:function(u,v){return v=v===void 0?this._zoom:v,this.options.crs.latLngToPoint(Ai(u),v)},unproject:function(u,v){return v=v===void 0?this._zoom:v,this.options.crs.pointToLatLng(Yt(u),v)},layerPointToLatLng:function(u){var v=Yt(u).add(this.getPixelOrigin());return this.unproject(v)},latLngToLayerPoint:function(u){var v=this.project(Ai(u))._round();return v._subtract(this.getPixelOrigin())},wrapLatLng:function(u){return this.options.crs.wrapLatLng(Ai(u))},wrapLatLngBounds:function(u){return this.options.crs.wrapLatLngBounds(or(u))},distance:function(u,v){return this.options.crs.distance(Ai(u),Ai(v))},containerPointToLayerPoint:function(u){return Yt(u).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(u){return Yt(u).add(this._getMapPanePos())},containerPointToLatLng:function(u){var v=this.containerPointToLayerPoint(Yt(u));return this.layerPointToLatLng(v)},latLngToContainerPoint:function(u){return this.layerPointToContainerPoint(this.latLngToLayerPoint(Ai(u)))},mouseEventToContainerPoint:function(u){return ca(u,this._container)},mouseEventToLayerPoint:function(u){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(u))},mouseEventToLatLng:function(u){return this.layerPointToLatLng(this.mouseEventToLayerPoint(u))},_initContainer:function(u){var v=this._container=wo(u);if(v){if(v._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");Ht(v,"scroll",this._onScroll,this),this._containerId=it(v)},_initLayout:function(){var u=this._container;this._fadeAnimated=this.options.fadeAnimation&&o.any3d,_i(u,"leaflet-container"+(o.touch?" leaflet-touch":"")+(o.retina?" leaflet-retina":"")+(o.ielt9?" leaflet-oldie":"")+(o.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var v=zn(u,"position");v!=="absolute"&&v!=="relative"&&v!=="fixed"&&v!=="sticky"&&(u.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var u=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Cr(this._mapPane,new ti(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(_i(u.markerPane,"leaflet-zoom-hide"),_i(u.shadowPane,"leaflet-zoom-hide"))},_resetView:function(u,v,E){Cr(this._mapPane,new ti(0,0));var R=!this._loaded;this._loaded=!0,v=this._limitZoom(v),this.fire("viewprereset");var q=this._zoom!==v;this._moveStart(q,E)._move(u,v)._moveEnd(q),this.fire("viewreset"),R&&this.fire("load")},_moveStart:function(u,v){return u&&this.fire("zoomstart"),v||this.fire("movestart"),this},_move:function(u,v,E,R){v===void 0&&(v=this._zoom);var q=this._zoom!==v;return this._zoom=v,this._lastCenter=u,this._pixelOrigin=this._getNewPixelOrigin(u),R?E&&E.pinch&&this.fire("zoom",E):((q||E&&E.pinch)&&this.fire("zoom",E),this.fire("move",E)),this},_moveEnd:function(u){return u&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return Ji(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(u){Cr(this._mapPane,this._getMapPanePos().subtract(u))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(u){this._targets={},this._targets[it(this._container)]=this;var v=u?Dt:Ht;v(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&v(window,"resize",this._onResize,this),o.any3d&&this.options.transform3DLimit&&(u?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){Ji(this._resizeRequest),this._resizeRequest=cr(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var u=this._getMapPanePos();Math.max(Math.abs(u.x),Math.abs(u.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(u,v){for(var E=[],R,q=v==="mouseout"||v==="mouseover",ne=u.target||u.srcElement,Ee=!1;ne;){if(R=this._targets[it(ne)],R&&(v==="click"||v==="preclick")&&this._draggableMoved(R)){Ee=!0;break}if(R&&R.listens(v,!0)&&(q&&!Ls(ne,u)||(E.push(R),q))||ne===this._container)break;ne=ne.parentNode}return!E.length&&!Ee&&!q&&this.listens(v,!0)&&(E=[this]),E},_isClickDisabled:function(u){for(;u&&u!==this._container;){if(u._leaflet_disable_click)return!0;u=u.parentNode}},_handleDOMEvent:function(u){var v=u.target||u.srcElement;if(!(!this._loaded||v._leaflet_disable_events||u.type==="click"&&this._isClickDisabled(v))){var E=u.type;E==="mousedown"&&oi(v),this._fireDOMEvent(u,E)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(u,v,E){if(u.type==="click"){var R=We({},u);R.type="preclick",this._fireDOMEvent(R,R.type,E)}var q=this._findEventTargets(u,v);if(E){for(var ne=[],Ee=0;Ee<E.length;Ee++)E[Ee].listens(v,!0)&&ne.push(E[Ee]);q=ne.concat(q)}if(q.length){v==="contextmenu"&&Si(u);var Ze=q[0],tt={originalEvent:u};if(u.type!=="keypress"&&u.type!=="keydown"&&u.type!=="keyup"){var gt=Ze.getLatLng&&(!Ze._radius||Ze._radius<=10);tt.containerPoint=gt?this.latLngToContainerPoint(Ze.getLatLng()):this.mouseEventToContainerPoint(u),tt.layerPoint=this.containerPointToLayerPoint(tt.containerPoint),tt.latlng=gt?Ze.getLatLng():this.layerPointToLatLng(tt.layerPoint)}for(Ee=0;Ee<q.length;Ee++)if(q[Ee].fire(v,tt,!0),tt.originalEvent._stopped||q[Ee].options.bubblingMouseEvents===!1&&ro(this._mouseEvents,v)!==-1)return}},_draggableMoved:function(u){return u=u.dragging&&u.dragging.enabled()?u:this,u.dragging&&u.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var u=0,v=this._handlers.length;u<v;u++)this._handlers[u].disable()},whenReady:function(u,v){return this._loaded?u.call(v||this,{target:this}):this.on("load",u,v),this},_getMapPanePos:function(){return To(this._mapPane)||new ti(0,0)},_moved:function(){var u=this._getMapPanePos();return u&&!u.equals([0,0])},_getTopLeftPoint:function(u,v){var E=u&&v!==void 0?this._getNewPixelOrigin(u,v):this.getPixelOrigin();return E.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(u,v){var E=this.getSize()._divideBy(2);return this.project(u,v)._subtract(E)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(u,v,E){var R=this._getNewPixelOrigin(E,v);return this.project(u,v)._subtract(R)},_latLngBoundsToNewLayerBounds:function(u,v,E){var R=this._getNewPixelOrigin(E,v);return Mr([this.project(u.getSouthWest(),v)._subtract(R),this.project(u.getNorthWest(),v)._subtract(R),this.project(u.getSouthEast(),v)._subtract(R),this.project(u.getNorthEast(),v)._subtract(R)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(u){return this.latLngToLayerPoint(u).subtract(this._getCenterLayerPoint())},_limitCenter:function(u,v,E){if(!E)return u;var R=this.project(u,v),q=this.getSize().divideBy(2),ne=new Ni(R.subtract(q),R.add(q)),Ee=this._getBoundsOffset(ne,E,v);return Math.abs(Ee.x)<=1&&Math.abs(Ee.y)<=1?u:this.unproject(R.add(Ee),v)},_limitOffset:function(u,v){if(!v)return u;var E=this.getPixelBounds(),R=new Ni(E.min.add(u),E.max.add(u));return u.add(this._getBoundsOffset(R,v))},_getBoundsOffset:function(u,v,E){var R=Mr(this.project(v.getNorthEast(),E),this.project(v.getSouthWest(),E)),q=R.min.subtract(u.min),ne=R.max.subtract(u.max),Ee=this._rebound(q.x,-ne.x),Ze=this._rebound(q.y,-ne.y);return new ti(Ee,Ze)},_rebound:function(u,v){return u+v>0?Math.round(u-v)/2:Math.max(0,Math.ceil(u))-Math.max(0,Math.floor(v))},_limitZoom:function(u){var v=this.getMinZoom(),E=this.getMaxZoom(),R=o.any3d?this.options.zoomSnap:1;return R&&(u=Math.round(u/R)*R),Math.max(v,Math.min(E,u))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){Sr(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(u,v){var E=this._getCenterOffset(u)._trunc();return(v&&v.animate)!==!0&&!this.getSize().contains(E)?!1:(this.panBy(E,v),!0)},_createAnimProxy:function(){var u=this._proxy=Fi("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(u),this.on("zoomanim",function(v){var E=ae,R=this._proxy.style[E];ar(this._proxy,this.project(v.center,v.zoom),this.getZoomScale(v.zoom,1)),R===this._proxy.style[E]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){Xi(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var u=this.getCenter(),v=this.getZoom();ar(this._proxy,this.project(u,v),this.getZoomScale(v,1))},_catchTransitionEnd:function(u){this._animatingZoom&&u.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(u,v,E){if(this._animatingZoom)return!0;if(E=E||{},!this._zoomAnimated||E.animate===!1||this._nothingToAnimate()||Math.abs(v-this._zoom)>this.options.zoomAnimationThreshold)return!1;var R=this.getZoomScale(v),q=this._getCenterOffset(u)._divideBy(1-1/R);return E.animate!==!0&&!this.getSize().contains(q)?!1:(cr(function(){this._moveStart(!0,E.noMoveStart||!1)._animateZoom(u,v,!0)},this),!0)},_animateZoom:function(u,v,E,R){this._mapPane&&(E&&(this._animatingZoom=!0,this._animateToCenter=u,this._animateToZoom=v,_i(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:u,zoom:v,noUpdate:R}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(W(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&Sr(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function bi(u,v){return new hi(u,v)}var nn=Cn.extend({options:{position:"topright"},initialize:function(u){Gt(this,u)},getPosition:function(){return this.options.position},setPosition:function(u){var v=this._map;return v&&v.removeControl(this),this.options.position=u,v&&v.addControl(this),this},getContainer:function(){return this._container},addTo:function(u){this.remove(),this._map=u;var v=this._container=this.onAdd(u),E=this.getPosition(),R=u._controlCorners[E];return _i(v,"leaflet-control"),E.indexOf("bottom")!==-1?R.insertBefore(v,R.firstChild):R.appendChild(v),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(Xi(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(u){this._map&&u&&u.screenX>0&&u.screenY>0&&this._map.getContainer().focus()}}),wi=function(u){return new nn(u)};hi.include({addControl:function(u){return u.addTo(this),this},removeControl:function(u){return u.remove(),this},_initControlPos:function(){var u=this._controlCorners={},v="leaflet-",E=this._controlContainer=Fi("div",v+"control-container",this._container);function R(q,ne){var Ee=v+q+" "+v+ne;u[q+ne]=Fi("div",Ee,E)}R("top","left"),R("top","right"),R("bottom","left"),R("bottom","right")},_clearControlPos:function(){for(var u in this._controlCorners)Xi(this._controlCorners[u]);Xi(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var ri=nn.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(u,v,E,R){return E<R?-1:R<E?1:0}},initialize:function(u,v,E){Gt(this,E),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var R in u)this._addLayer(u[R],R);for(R in v)this._addLayer(v[R],R,!0)},onAdd:function(u){this._initLayout(),this._update(),this._map=u,u.on("zoomend",this._checkDisabledLayers,this);for(var v=0;v<this._layers.length;v++)this._layers[v].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(u){return nn.prototype.addTo.call(this,u),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var u=0;u<this._layers.length;u++)this._layers[u].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(u,v){return this._addLayer(u,v),this._map?this._update():this},addOverlay:function(u,v){return this._addLayer(u,v,!0),this._map?this._update():this},removeLayer:function(u){u.off("add remove",this._onLayerChange,this);var v=this._getLayer(it(u));return v&&this._layers.splice(this._layers.indexOf(v),1),this._map?this._update():this},expand:function(){_i(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var u=this._map.getSize().y-(this._container.offsetTop+50);return u<this._section.clientHeight?(_i(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=u+"px"):Sr(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return Sr(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var u="leaflet-control-layers",v=this._container=Fi("div",u),E=this.options.collapsed;v.setAttribute("aria-haspopup",!0),Qn(v),Us(v);var R=this._section=Fi("section",u+"-list");E&&(this._map.on("click",this.collapse,this),Ht(v,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var q=this._layersLink=Fi("a",u+"-toggle",v);q.href="#",q.title="Layers",q.setAttribute("role","button"),Ht(q,{keydown:function(ne){ne.keyCode===13&&this._expandSafely()},click:function(ne){Si(ne),this._expandSafely()}},this),E||this.expand(),this._baseLayersList=Fi("div",u+"-base",R),this._separator=Fi("div",u+"-separator",R),this._overlaysList=Fi("div",u+"-overlays",R),v.appendChild(R)},_getLayer:function(u){for(var v=0;v<this._layers.length;v++)if(this._layers[v]&&it(this._layers[v].layer)===u)return this._layers[v]},_addLayer:function(u,v,E){this._map&&u.on("add remove",this._onLayerChange,this),this._layers.push({layer:u,name:v,overlay:E}),this.options.sortLayers&&this._layers.sort(W(function(R,q){return this.options.sortFunction(R.layer,q.layer,R.name,q.name)},this)),this.options.autoZIndex&&u.setZIndex&&(this._lastZIndex++,u.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;te(this._baseLayersList),te(this._overlaysList),this._layerControlInputs=[];var u,v,E,R,q=0;for(E=0;E<this._layers.length;E++)R=this._layers[E],this._addItem(R),v=v||R.overlay,u=u||!R.overlay,q+=R.overlay?0:1;return this.options.hideSingleBase&&(u=u&&q>1,this._baseLayersList.style.display=u?"":"none"),this._separator.style.display=v&&u?"":"none",this},_onLayerChange:function(u){this._handlingClick||this._update();var v=this._getLayer(it(u.target)),E=v.overlay?u.type==="add"?"overlayadd":"overlayremove":u.type==="add"?"baselayerchange":null;E&&this._map.fire(E,v)},_createRadioElement:function(u,v){var E='<input type="radio" class="leaflet-control-layers-selector" name="'+u+'"'+(v?' checked="checked"':"")+"/>",R=document.createElement("div");return R.innerHTML=E,R.firstChild},_addItem:function(u){var v=document.createElement("label"),E=this._map.hasLayer(u.layer),R;u.overlay?(R=document.createElement("input"),R.type="checkbox",R.className="leaflet-control-layers-selector",R.defaultChecked=E):R=this._createRadioElement("leaflet-base-layers_"+it(this),E),this._layerControlInputs.push(R),R.layerId=it(u.layer),Ht(R,"click",this._onInputClick,this);var q=document.createElement("span");q.innerHTML=" "+u.name;var ne=document.createElement("span");v.appendChild(ne),ne.appendChild(R),ne.appendChild(q);var Ee=u.overlay?this._overlaysList:this._baseLayersList;return Ee.appendChild(v),this._checkDisabledLayers(),v},_onInputClick:function(){if(!this._preventClick){var u=this._layerControlInputs,v,E,R=[],q=[];this._handlingClick=!0;for(var ne=u.length-1;ne>=0;ne--)v=u[ne],E=this._getLayer(v.layerId).layer,v.checked?R.push(E):v.checked||q.push(E);for(ne=0;ne<q.length;ne++)this._map.hasLayer(q[ne])&&this._map.removeLayer(q[ne]);for(ne=0;ne<R.length;ne++)this._map.hasLayer(R[ne])||this._map.addLayer(R[ne]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var u=this._layerControlInputs,v,E,R=this._map.getZoom(),q=u.length-1;q>=0;q--)v=u[q],E=this._getLayer(v.layerId).layer,v.disabled=E.options.minZoom!==void 0&&R<E.options.minZoom||E.options.maxZoom!==void 0&&R>E.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var u=this._section;this._preventClick=!0,Ht(u,"click",Si),this.expand();var v=this;setTimeout(function(){Dt(u,"click",Si),v._preventClick=!1})}}),Aa=function(u,v,E){return new ri(u,v,E)},Ci=nn.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">&#x2212;</span>',zoomOutTitle:"Zoom out"},onAdd:function(u){var v="leaflet-control-zoom",E=Fi("div",v+" leaflet-bar"),R=this.options;return this._zoomInButton=this._createButton(R.zoomInText,R.zoomInTitle,v+"-in",E,this._zoomIn),this._zoomOutButton=this._createButton(R.zoomOutText,R.zoomOutTitle,v+"-out",E,this._zoomOut),this._updateDisabled(),u.on("zoomend zoomlevelschange",this._updateDisabled,this),E},onRemove:function(u){u.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(u){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(u.shiftKey?3:1))},_zoomOut:function(u){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(u.shiftKey?3:1))},_createButton:function(u,v,E,R,q){var ne=Fi("a",E,R);return ne.innerHTML=u,ne.href="#",ne.title=v,ne.setAttribute("role","button"),ne.setAttribute("aria-label",v),Qn(ne),Ht(ne,"click",$n),Ht(ne,"click",q,this),Ht(ne,"click",this._refocusOnMap,this),ne},_updateDisabled:function(){var u=this._map,v="leaflet-disabled";Sr(this._zoomInButton,v),Sr(this._zoomOutButton,v),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||u._zoom===u.getMinZoom())&&(_i(this._zoomOutButton,v),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||u._zoom===u.getMaxZoom())&&(_i(this._zoomInButton,v),this._zoomInButton.setAttribute("aria-disabled","true"))}});hi.mergeOptions({zoomControl:!0}),hi.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Ci,this.addControl(this.zoomControl))});var Da=function(u){return new Ci(u)},Xn=nn.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(u){var v="leaflet-control-scale",E=Fi("div",v),R=this.options;return this._addScales(R,v+"-line",E),u.on(R.updateWhenIdle?"moveend":"move",this._update,this),u.whenReady(this._update,this),E},onRemove:function(u){u.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(u,v,E){u.metric&&(this._mScale=Fi("div",v,E)),u.imperial&&(this._iScale=Fi("div",v,E))},_update:function(){var u=this._map,v=u.getSize().y/2,E=u.distance(u.containerPointToLatLng([0,v]),u.containerPointToLatLng([this.options.maxWidth,v]));this._updateScales(E)},_updateScales:function(u){this.options.metric&&u&&this._updateMetric(u),this.options.imperial&&u&&this._updateImperial(u)},_updateMetric:function(u){var v=this._getRoundNum(u),E=v<1e3?v+" m":v/1e3+" km";this._updateScale(this._mScale,E,v/u)},_updateImperial:function(u){var v=u*3.2808399,E,R,q;v>5280?(E=v/5280,R=this._getRoundNum(E),this._updateScale(this._iScale,R+" mi",R/E)):(q=this._getRoundNum(v),this._updateScale(this._iScale,q+" ft",q/v))},_updateScale:function(u,v,E){u.style.width=Math.round(this.options.maxWidth*E)+"px",u.innerHTML=v},_getRoundNum:function(u){var v=Math.pow(10,(Math.floor(u)+"").length-1),E=u/v;return E=E>=10?10:E>=5?5:E>=3?3:E>=2?2:1,v*E}}),oo=function(u){return new Xn(u)},Kn='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg>',ka=nn.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(o.inlineSvg?Kn+" ":"")+"Leaflet</a>"},initialize:function(u){Gt(this,u),this._attributions={}},onAdd:function(u){u.attributionControl=this,this._container=Fi("div","leaflet-control-attribution"),Qn(this._container);for(var v in u._layers)u._layers[v].getAttribution&&this.addAttribution(u._layers[v].getAttribution());return this._update(),u.on("layeradd",this._addAttribution,this),this._container},onRemove:function(u){u.off("layeradd",this._addAttribution,this)},_addAttribution:function(u){u.layer.getAttribution&&(this.addAttribution(u.layer.getAttribution()),u.layer.once("remove",function(){this.removeAttribution(u.layer.getAttribution())},this))},setPrefix:function(u){return this.options.prefix=u,this._update(),this},addAttribution:function(u){return u?(this._attributions[u]||(this._attributions[u]=0),this._attributions[u]++,this._update(),this):this},removeAttribution:function(u){return u?(this._attributions[u]&&(this._attributions[u]--,this._update()),this):this},_update:function(){if(this._map){var u=[];for(var v in this._attributions)this._attributions[v]&&u.push(v);var E=[];this.options.prefix&&E.push(this.options.prefix),u.length&&E.push(u.join(", ")),this._container.innerHTML=E.join(' <span aria-hidden="true">|</span> ')}}});hi.mergeOptions({attributionControl:!0}),hi.addInitHook(function(){this.options.attributionControl&&new ka().addTo(this)});var fa=function(u){return new ka(u)};nn.Layers=ri,nn.Zoom=Ci,nn.Scale=Xn,nn.Attribution=ka,wi.layers=Aa,wi.zoom=Da,wi.scale=oo,wi.attribution=fa;var Bn=Cn.extend({initialize:function(u){this._map=u},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});Bn.addTo=function(u,v){return u.addHandler(v,this),this};var Wo={Events:Jr},Gs=o.touch?"touchstart mousedown":"mousedown",xr=Hr.extend({options:{clickTolerance:3},initialize:function(u,v,E,R){Gt(this,R),this._element=u,this._dragStartTarget=v||u,this._preventOutline=E},enable:function(){this._enabled||(Ht(this._dragStartTarget,Gs,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(xr._dragging===this&&this.finishDrag(!0),Dt(this._dragStartTarget,Gs,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(u){if(this._enabled&&(this._moved=!1,!Ha(this._element,"leaflet-zoom-anim"))){if(u.touches&&u.touches.length!==1){xr._dragging===this&&this.finishDrag();return}if(!(xr._dragging||u.shiftKey||u.which!==1&&u.button!==1&&!u.touches)&&(xr._dragging=this,this._preventOutline&&oi(this._element),Ca(),so(),!this._moving)){this.fire("down");var v=u.touches?u.touches[0]:u,E=Nl(this._element);this._startPoint=new ti(v.clientX,v.clientY),this._startPos=To(this._element),this._parentScale=Ia(E);var R=u.type==="mousedown";Ht(document,R?"mousemove":"touchmove",this._onMove,this),Ht(document,R?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(u){if(this._enabled){if(u.touches&&u.touches.length>1){this._moved=!0;return}var v=u.touches&&u.touches.length===1?u.touches[0]:u,E=new ti(v.clientX,v.clientY)._subtract(this._startPoint);!E.x&&!E.y||Math.abs(E.x)+Math.abs(E.y)<this.options.clickTolerance||(E.x/=this._parentScale.x,E.y/=this._parentScale.y,Si(u),this._moved||(this.fire("dragstart"),this._moved=!0,_i(document.body,"leaflet-dragging"),this._lastTarget=u.target||u.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),_i(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(E),this._moving=!0,this._lastEvent=u,this._updatePosition())}},_updatePosition:function(){var u={originalEvent:this._lastEvent};this.fire("predrag",u),Cr(this._element,this._newPos),this.fire("drag",u)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(u){Sr(document.body,"leaflet-dragging"),this._lastTarget&&(Sr(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),Dt(document,"mousemove touchmove",this._onMove,this),Dt(document,"mouseup touchend touchcancel",this._onUp,this),qo(),js();var v=this._moved&&this._moving;this._moving=!1,xr._dragging=!1,v&&this.fire("dragend",{noInertia:u,distance:this._newPos.distanceTo(this._startPos)})}});function ys(u,v,E){var R,q=[1,4,2,8],ne,Ee,Ze,tt,gt,Rt,Jt,Ti;for(ne=0,Rt=u.length;ne<Rt;ne++)u[ne]._code=vs(u[ne],v);for(Ze=0;Ze<4;Ze++){for(Jt=q[Ze],R=[],ne=0,Rt=u.length,Ee=Rt-1;ne<Rt;Ee=ne++)tt=u[ne],gt=u[Ee],tt._code&Jt?gt._code&Jt||(Ti=lo(gt,tt,Jt,v,E),Ti._code=vs(Ti,v),R.push(Ti)):(gt._code&Jt&&(Ti=lo(gt,tt,Jt,v,E),Ti._code=vs(Ti,v),R.push(Ti)),R.push(tt));u=R}return u}function ir(u,v){var E,R,q,ne,Ee,Ze,tt,gt,Rt;if(!u||u.length===0)throw new Error("latlngs not passed");An(u)||(console.warn("latlngs are not flat! Only the first ring will be used"),u=u[0]);var Jt=Ai([0,0]),Ti=or(u),Zr=Ti.getNorthWest().distanceTo(Ti.getSouthWest())*Ti.getNorthEast().distanceTo(Ti.getNorthWest());Zr<1700&&(Jt=ao(u));var Br=u.length,ps=[];for(E=0;E<Br;E++){var On=Ai(u[E]);ps.push(v.project(Ai([On.lat-Jt.lat,On.lng-Jt.lng])))}for(Ze=tt=gt=0,E=0,R=Br-1;E<Br;R=E++)q=ps[E],ne=ps[R],Ee=q.y*ne.x-ne.y*q.x,tt+=(q.x+ne.x)*Ee,gt+=(q.y+ne.y)*Ee,Ze+=Ee*3;Ze===0?Rt=ps[0]:Rt=[tt/Ze,gt/Ze];var Ks=v.unproject(Yt(Rt));return Ai([Ks.lat+Jt.lat,Ks.lng+Jt.lng])}function ao(u){for(var v=0,E=0,R=0,q=0;q<u.length;q++){var ne=Ai(u[q]);v+=ne.lat,E+=ne.lng,R++}return Ai([v/R,E/R])}var yl={__proto__:null,clipPolygon:ys,polygonCenter:ir,centroid:ao};function Qo(u,v){if(!v||!u.length)return u.slice();var E=v*v;return u=uu(u,E),u=vl(u,E),u}function dr(u,v,E){return Math.sqrt(qs(u,v,E,!0))}function jl(u,v,E){return qs(u,v,E)}function vl(u,v){var E=u.length,R=typeof Uint8Array<"u"?Uint8Array:Array,q=new R(E);q[0]=q[E-1]=1,Ya(u,q,v,0,E-1);var ne,Ee=[];for(ne=0;ne<E;ne++)q[ne]&&Ee.push(u[ne]);return Ee}function Ya(u,v,E,R,q){var ne=0,Ee,Ze,tt;for(Ze=R+1;Ze<=q-1;Ze++)tt=qs(u[Ze],u[R],u[q],!0),tt>ne&&(Ee=Ze,ne=tt);ne>E&&(v[Ee]=1,Ya(u,v,E,R,Ee),Ya(u,v,E,Ee,q))}function uu(u,v){for(var E=[u[0]],R=1,q=0,ne=u.length;R<ne;R++)La(u[R],u[q])>v&&(E.push(u[R]),q=R);return q<ne-1&&E.push(u[ne-1]),E}var Mo;function za(u,v,E,R,q){var ne=R?Mo:vs(u,E),Ee=vs(v,E),Ze,tt,gt;for(Mo=Ee;;){if(!(ne|Ee))return[u,v];if(ne&Ee)return!1;Ze=ne||Ee,tt=lo(u,v,Ze,E,q),gt=vs(tt,E),Ze===ne?(u=tt,ne=gt):(v=tt,Ee=gt)}}function lo(u,v,E,R,q){var ne=v.x-u.x,Ee=v.y-u.y,Ze=R.min,tt=R.max,gt,Rt;return E&8?(gt=u.x+ne*(tt.y-u.y)/Ee,Rt=tt.y):E&4?(gt=u.x+ne*(Ze.y-u.y)/Ee,Rt=Ze.y):E&2?(gt=tt.x,Rt=u.y+Ee*(tt.x-u.x)/ne):E&1&&(gt=Ze.x,Rt=u.y+Ee*(Ze.x-u.x)/ne),new ti(gt,Rt,q)}function vs(u,v){var E=0;return u.x<v.min.x?E|=1:u.x>v.max.x&&(E|=2),u.y<v.min.y?E|=4:u.y>v.max.y&&(E|=8),E}function La(u,v){var E=v.x-u.x,R=v.y-u.y;return E*E+R*R}function qs(u,v,E,R){var q=v.x,ne=v.y,Ee=E.x-q,Ze=E.y-ne,tt=Ee*Ee+Ze*Ze,gt;return tt>0&&(gt=((u.x-q)*Ee+(u.y-ne)*Ze)/tt,gt>1?(q=E.x,ne=E.y):gt>0&&(q+=Ee*gt,ne+=Ze*gt)),Ee=u.x-q,Ze=u.y-ne,R?Ee*Ee+Ze*Ze:new ti(q,ne)}function An(u){return!zi(u[0])||typeof u[0][0]!="object"&&typeof u[0][0]<"u"}function Ar(u){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),An(u)}function xl(u,v){var E,R,q,ne,Ee,Ze,tt,gt;if(!u||u.length===0)throw new Error("latlngs not passed");An(u)||(console.warn("latlngs are not flat! Only the first ring will be used"),u=u[0]);var Rt=Ai([0,0]),Jt=or(u),Ti=Jt.getNorthWest().distanceTo(Jt.getSouthWest())*Jt.getNorthEast().distanceTo(Jt.getNorthWest());Ti<1700&&(Rt=ao(u));var Zr=u.length,Br=[];for(E=0;E<Zr;E++){var ps=Ai(u[E]);Br.push(v.project(Ai([ps.lat-Rt.lat,ps.lng-Rt.lng])))}for(E=0,R=0;E<Zr-1;E++)R+=Br[E].distanceTo(Br[E+1])/2;if(R===0)gt=Br[0];else for(E=0,ne=0;E<Zr-1;E++)if(Ee=Br[E],Ze=Br[E+1],q=Ee.distanceTo(Ze),ne+=q,ne>R){tt=(ne-R)/q,gt=[Ze.x-tt*(Ze.x-Ee.x),Ze.y-tt*(Ze.y-Ee.y)];break}var On=v.unproject(Yt(gt));return Ai([On.lat+Rt.lat,On.lng+Rt.lng])}var Eo={__proto__:null,simplify:Qo,pointToSegmentDistance:dr,closestPointOnSegment:jl,clipSegment:za,_getEdgeIntersection:lo,_getBitCode:vs,_sqClosestPointOnSegment:qs,isFlat:An,_flat:Ar,polylineCenter:xl},So={project:function(u){return new ti(u.lng,u.lat)},unproject:function(u){return new xi(u.y,u.x)},bounds:new Ni([-180,-90],[180,90])},Jn={R:6378137,R_MINOR:6356752314245179e-9,bounds:new Ni([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(u){var v=Math.PI/180,E=this.R,R=u.lat*v,q=this.R_MINOR/E,ne=Math.sqrt(1-q*q),Ee=ne*Math.sin(R),Ze=Math.tan(Math.PI/4-R/2)/Math.pow((1-Ee)/(1+Ee),ne/2);return R=-E*Math.log(Math.max(Ze,1e-10)),new ti(u.lng*v*E,R)},unproject:function(u){for(var v=180/Math.PI,E=this.R,R=this.R_MINOR/E,q=Math.sqrt(1-R*R),ne=Math.exp(-u.y/E),Ee=Math.PI/2-2*Math.atan(ne),Ze=0,tt=.1,gt;Ze<15&&Math.abs(tt)>1e-7;Ze++)gt=q*Math.sin(Ee),gt=Math.pow((1-gt)/(1+gt),q/2),tt=Math.PI/2-2*Math.atan(ne*gt)-Ee,Ee+=tt;return new xi(Ee*v,u.x*v/E)}},hu={__proto__:null,LonLat:So,Mercator:Jn,SphericalMercator:us},da=We({},Er,{code:"EPSG:3395",projection:Jn,transformation:(function(){var u=.5/(Math.PI*Jn.R);return In(u,.5,-u,.5)})()}),bl=We({},Er,{code:"EPSG:4326",projection:So,transformation:In(1/180,1,-1/180,.5)}),pa=We({},hn,{projection:So,transformation:In(1,0,-1,0),scale:function(u){return Math.pow(2,u)},zoom:function(u){return Math.log(u)/Math.LN2},distance:function(u,v){var E=v.lng-u.lng,R=v.lat-u.lat;return Math.sqrt(E*E+R*R)},infinite:!0});hn.Earth=Er,hn.EPSG3395=da,hn.EPSG3857=Vo,hn.EPSG900913=en,hn.EPSG4326=bl,hn.Simple=pa;var Rn=Hr.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(u){return u.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(u){return u&&u.removeLayer(this),this},getPane:function(u){return this._map.getPane(u?this.options[u]||u:this.options.pane)},addInteractiveTarget:function(u){return this._map._targets[it(u)]=this,this},removeInteractiveTarget:function(u){return delete this._map._targets[it(u)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(u){var v=u.target;if(v.hasLayer(this)){if(this._map=v,this._zoomAnimated=v._zoomAnimated,this.getEvents){var E=this.getEvents();v.on(E,this),this.once("remove",function(){v.off(E,this)},this)}this.onAdd(v),this.fire("add"),v.fire("layeradd",{layer:this})}}});hi.include({addLayer:function(u){if(!u._layerAdd)throw new Error("The provided object is not a Layer.");var v=it(u);return this._layers[v]?this:(this._layers[v]=u,u._mapToAdd=this,u.beforeAdd&&u.beforeAdd(this),this.whenReady(u._layerAdd,u),this)},removeLayer:function(u){var v=it(u);return this._layers[v]?(this._loaded&&u.onRemove(this),delete this._layers[v],this._loaded&&(this.fire("layerremove",{layer:u}),u.fire("remove")),u._map=u._mapToAdd=null,this):this},hasLayer:function(u){return it(u)in this._layers},eachLayer:function(u,v){for(var E in this._layers)u.call(v,this._layers[E]);return this},_addLayers:function(u){u=u?zi(u)?u:[u]:[];for(var v=0,E=u.length;v<E;v++)this.addLayer(u[v])},_addZoomLimit:function(u){(!isNaN(u.options.maxZoom)||!isNaN(u.options.minZoom))&&(this._zoomBoundLayers[it(u)]=u,this._updateZoomLevels())},_removeZoomLimit:function(u){var v=it(u);this._zoomBoundLayers[v]&&(delete this._zoomBoundLayers[v],this._updateZoomLevels())},_updateZoomLevels:function(){var u=1/0,v=-1/0,E=this._getZoomSpan();for(var R in this._zoomBoundLayers){var q=this._zoomBoundLayers[R].options;u=q.minZoom===void 0?u:Math.min(u,q.minZoom),v=q.maxZoom===void 0?v:Math.max(v,q.maxZoom)}this._layersMaxZoom=v===-1/0?void 0:v,this._layersMinZoom=u===1/0?void 0:u,E!==this._getZoomSpan()&&this.fire("zoomlevelschange"),this.options.maxZoom===void 0&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var $o=Rn.extend({initialize:function(u,v){Gt(this,v),this._layers={};var E,R;if(u)for(E=0,R=u.length;E<R;E++)this.addLayer(u[E])},addLayer:function(u){var v=this.getLayerId(u);return this._layers[v]=u,this._map&&this._map.addLayer(u),this},removeLayer:function(u){var v=u in this._layers?u:this.getLayerId(u);return this._map&&this._layers[v]&&this._map.removeLayer(this._layers[v]),delete this._layers[v],this},hasLayer:function(u){var v=typeof u=="number"?u:this.getLayerId(u);return v in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(u){var v=Array.prototype.slice.call(arguments,1),E,R;for(E in this._layers)R=this._layers[E],R[u]&&R[u].apply(R,v);return this},onAdd:function(u){this.eachLayer(u.addLayer,u)},onRemove:function(u){this.eachLayer(u.removeLayer,u)},eachLayer:function(u,v){for(var E in this._layers)u.call(v,this._layers[E]);return this},getLayer:function(u){return this._layers[u]},getLayers:function(){var u=[];return this.eachLayer(u.push,u),u},setZIndex:function(u){return this.invoke("setZIndex",u)},getLayerId:function(u){return it(u)}}),Zl=function(u,v){return new $o(u,v)},cs=$o.extend({addLayer:function(u){return this.hasLayer(u)?this:(u.addEventParent(this),$o.prototype.addLayer.call(this,u),this.fire("layeradd",{layer:u}))},removeLayer:function(u){return this.hasLayer(u)?(u in this._layers&&(u=this._layers[u]),u.removeEventParent(this),$o.prototype.removeLayer.call(this,u),this.fire("layerremove",{layer:u})):this},setStyle:function(u){return this.invoke("setStyle",u)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var u=new Wr;for(var v in this._layers){var E=this._layers[v];u.extend(E.getBounds?E.getBounds():E.getLatLng())}return u}}),wl=function(u,v){return new cs(u,v)},Hs=Cn.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(u){Gt(this,u)},createIcon:function(u){return this._createIcon("icon",u)},createShadow:function(u){return this._createIcon("shadow",u)},_createIcon:function(u,v){var E=this._getIconUrl(u);if(!E){if(u==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var R=this._createImg(E,v&&v.tagName==="IMG"?v:null);return this._setIconStyles(R,u),(this.options.crossOrigin||this.options.crossOrigin==="")&&(R.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),R},_setIconStyles:function(u,v){var E=this.options,R=E[v+"Size"];typeof R=="number"&&(R=[R,R]);var q=Yt(R),ne=Yt(v==="shadow"&&E.shadowAnchor||E.iconAnchor||q&&q.divideBy(2,!0));u.className="leaflet-marker-"+v+" "+(E.className||""),ne&&(u.style.marginLeft=-ne.x+"px",u.style.marginTop=-ne.y+"px"),q&&(u.style.width=q.x+"px",u.style.height=q.y+"px")},_createImg:function(u,v){return v=v||document.createElement("img"),v.src=u,v},_getIconUrl:function(u){return o.retina&&this.options[u+"RetinaUrl"]||this.options[u+"Url"]}});function Xa(u){return new Hs(u)}var Ws=Hs.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(u){return typeof Ws.imagePath!="string"&&(Ws.imagePath=this._detectIconPath()),(this.options.imagePath||Ws.imagePath)+Hs.prototype._getIconUrl.call(this,u)},_stripUrl:function(u){var v=function(E,R,q){var ne=R.exec(E);return ne&&ne[q]};return u=v(u,/^url\((['"])?(.+)\1\)$/,2),u&&v(u,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var u=Fi("div","leaflet-default-icon-path",document.body),v=zn(u,"background-image")||zn(u,"backgroundImage");if(document.body.removeChild(u),v=this._stripUrl(v),v)return v;var E=document.querySelector('link[href$="leaflet.css"]');return E?E.href.substring(0,E.href.length-11-1):""}}),$i=Bn.extend({initialize:function(u){this._marker=u},addHooks:function(){var u=this._marker._icon;this._draggable||(this._draggable=new xr(u,u,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),_i(u,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&Sr(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(u){var v=this._marker,E=v._map,R=this._marker.options.autoPanSpeed,q=this._marker.options.autoPanPadding,ne=To(v._icon),Ee=E.getPixelBounds(),Ze=E.getPixelOrigin(),tt=Mr(Ee.min._subtract(Ze).add(q),Ee.max._subtract(Ze).subtract(q));if(!tt.contains(ne)){var gt=Yt((Math.max(tt.max.x,ne.x)-tt.max.x)/(Ee.max.x-tt.max.x)-(Math.min(tt.min.x,ne.x)-tt.min.x)/(Ee.min.x-tt.min.x),(Math.max(tt.max.y,ne.y)-tt.max.y)/(Ee.max.y-tt.max.y)-(Math.min(tt.min.y,ne.y)-tt.min.y)/(Ee.min.y-tt.min.y)).multiplyBy(R);E.panBy(gt,{animate:!1}),this._draggable._newPos._add(gt),this._draggable._startPos._add(gt),Cr(v._icon,this._draggable._newPos),this._onDrag(u),this._panRequest=cr(this._adjustPan.bind(this,u))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(u){this._marker.options.autoPan&&(Ji(this._panRequest),this._panRequest=cr(this._adjustPan.bind(this,u)))},_onDrag:function(u){var v=this._marker,E=v._shadow,R=To(v._icon),q=v._map.layerPointToLatLng(R);E&&Cr(E,R),v._latlng=q,u.latlng=q,u.oldLatLng=this._oldLatLng,v.fire("move",u).fire("drag",u)},_onDragEnd:function(u){Ji(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",u)}}),Qs=Rn.extend({options:{icon:new Ws,interactive:!0,keyboard:!0,title:"",alt:"Marker",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,autoPanOnFocus:!0,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(u,v){Gt(this,v),this._latlng=Ai(u)},onAdd:function(u){this._zoomAnimated=this._zoomAnimated&&u.options.markerZoomAnimation,this._zoomAnimated&&u.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(u){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&u.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(u){var v=this._latlng;return this._latlng=Ai(u),this.update(),this.fire("move",{oldLatLng:v,latlng:this._latlng})},setZIndexOffset:function(u){return this.options.zIndexOffset=u,this.update()},getIcon:function(){return this.options.icon},setIcon:function(u){return this.options.icon=u,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var u=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(u)}return this},_initIcon:function(){var u=this.options,v="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),E=u.icon.createIcon(this._icon),R=!1;E!==this._icon&&(this._icon&&this._removeIcon(),R=!0,u.title&&(E.title=u.title),E.tagName==="IMG"&&(E.alt=u.alt||"")),_i(E,v),u.keyboard&&(E.tabIndex="0",E.setAttribute("role","button")),this._icon=E,u.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Ht(E,"focus",this._panOnFocus,this);var q=u.icon.createShadow(this._shadow),ne=!1;q!==this._shadow&&(this._removeShadow(),ne=!0),q&&(_i(q,v),q.alt=""),this._shadow=q,u.opacity<1&&this._updateOpacity(),R&&this.getPane().appendChild(this._icon),this._initInteraction(),q&&ne&&this.getPane(u.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Dt(this._icon,"focus",this._panOnFocus,this),Xi(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&Xi(this._shadow),this._shadow=null},_setPos:function(u){this._icon&&Cr(this._icon,u),this._shadow&&Cr(this._shadow,u),this._zIndex=u.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(u){this._icon&&(this._icon.style.zIndex=this._zIndex+u)},_animateZoom:function(u){var v=this._map._latLngToNewLayerPoint(this._latlng,u.zoom,u.center).round();this._setPos(v)},_initInteraction:function(){if(this.options.interactive&&(_i(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),$i)){var u=this.options.draggable;this.dragging&&(u=this.dragging.enabled(),this.dragging.disable()),this.dragging=new $i(this),u&&this.dragging.enable()}},setOpacity:function(u){return this.options.opacity=u,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var u=this.options.opacity;this._icon&&_n(this._icon,u),this._shadow&&_n(this._shadow,u)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var u=this._map;if(u){var v=this.options.icon.options,E=v.iconSize?Yt(v.iconSize):Yt(0,0),R=v.iconAnchor?Yt(v.iconAnchor):Yt(0,0);u.panInside(this._latlng,{paddingTopLeft:R,paddingBottomRight:E.subtract(R)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function Tl(u,v){return new Qs(u,v)}var Bs=Rn.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(u){this._renderer=u.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(u){return Gt(this,u),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&u&&Object.prototype.hasOwnProperty.call(u,"weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+(this._renderer.options.tolerance||0)}}),uo=Bs.extend({options:{fill:!0,radius:10},initialize:function(u,v){Gt(this,v),this._latlng=Ai(u),this._radius=this.options.radius},setLatLng:function(u){var v=this._latlng;return this._latlng=Ai(u),this.redraw(),this.fire("move",{oldLatLng:v,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(u){return this.options.radius=this._radius=u,this.redraw()},getRadius:function(){return this._radius},setStyle:function(u){var v=u&&u.radius||this._radius;return Bs.prototype.setStyle.call(this,u),this.setRadius(v),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var u=this._radius,v=this._radiusY||u,E=this._clickTolerance(),R=[u+E,v+E];this._pxBounds=new Ni(this._point.subtract(R),this._point.add(R))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(u){return u.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function Ul(u,v){return new uo(u,v)}var ma=uo.extend({initialize:function(u,v,E){if(typeof v=="number"&&(v=We({},E,{radius:v})),Gt(this,v),this._latlng=Ai(u),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(u){return this._mRadius=u,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var u=[this._radius,this._radiusY||this._radius];return new Wr(this._map.layerPointToLatLng(this._point.subtract(u)),this._map.layerPointToLatLng(this._point.add(u)))},setStyle:Bs.prototype.setStyle,_project:function(){var u=this._latlng.lng,v=this._latlng.lat,E=this._map,R=E.options.crs;if(R.distance===Er.distance){var q=Math.PI/180,ne=this._mRadius/Er.R/q,Ee=E.project([v+ne,u]),Ze=E.project([v-ne,u]),tt=Ee.add(Ze).divideBy(2),gt=E.unproject(tt).lat,Rt=Math.acos((Math.cos(ne*q)-Math.sin(v*q)*Math.sin(gt*q))/(Math.cos(v*q)*Math.cos(gt*q)))/q;(isNaN(Rt)||Rt===0)&&(Rt=ne/Math.cos(Math.PI/180*v)),this._point=tt.subtract(E.getPixelOrigin()),this._radius=isNaN(Rt)?0:tt.x-E.project([gt,u-Rt]).x,this._radiusY=tt.y-Ee.y}else{var Jt=R.unproject(R.project(this._latlng).subtract([this._mRadius,0]));this._point=E.latLngToLayerPoint(this._latlng),this._radius=this._point.x-E.latLngToLayerPoint(Jt).x}this._updateBounds()}});function cu(u,v,E){return new ma(u,v,E)}var Ir=Bs.extend({options:{smoothFactor:1,noClip:!1},initialize:function(u,v){Gt(this,v),this._setLatLngs(u)},getLatLngs:function(){return this._latlngs},setLatLngs:function(u){return this._setLatLngs(u),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(u){for(var v=1/0,E=null,R=qs,q,ne,Ee=0,Ze=this._parts.length;Ee<Ze;Ee++)for(var tt=this._parts[Ee],gt=1,Rt=tt.length;gt<Rt;gt++){q=tt[gt-1],ne=tt[gt];var Jt=R(u,q,ne,!0);Jt<v&&(v=Jt,E=R(u,q,ne))}return E&&(E.distance=Math.sqrt(v)),E},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return xl(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(u,v){return v=v||this._defaultShape(),u=Ai(u),v.push(u),this._bounds.extend(u),this.redraw()},_setLatLngs:function(u){this._bounds=new Wr,this._latlngs=this._convertLatLngs(u)},_defaultShape:function(){return An(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(u){for(var v=[],E=An(u),R=0,q=u.length;R<q;R++)E?(v[R]=Ai(u[R]),this._bounds.extend(v[R])):v[R]=this._convertLatLngs(u[R]);return v},_project:function(){var u=new Ni;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,u),this._bounds.isValid()&&u.isValid()&&(this._rawPxBounds=u,this._updateBounds())},_updateBounds:function(){var u=this._clickTolerance(),v=new ti(u,u);this._rawPxBounds&&(this._pxBounds=new Ni([this._rawPxBounds.min.subtract(v),this._rawPxBounds.max.add(v)]))},_projectLatlngs:function(u,v,E){var R=u[0]instanceof xi,q=u.length,ne,Ee;if(R){for(Ee=[],ne=0;ne<q;ne++)Ee[ne]=this._map.latLngToLayerPoint(u[ne]),E.extend(Ee[ne]);v.push(Ee)}else for(ne=0;ne<q;ne++)this._projectLatlngs(u[ne],v,E)},_clipPoints:function(){var u=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(u))){if(this.options.noClip){this._parts=this._rings;return}var v=this._parts,E,R,q,ne,Ee,Ze,tt;for(E=0,q=0,ne=this._rings.length;E<ne;E++)for(tt=this._rings[E],R=0,Ee=tt.length;R<Ee-1;R++)Ze=za(tt[R],tt[R+1],u,R,!0),Ze&&(v[q]=v[q]||[],v[q].push(Ze[0]),(Ze[1]!==tt[R+1]||R===Ee-2)&&(v[q].push(Ze[1]),q++))}},_simplifyPoints:function(){for(var u=this._parts,v=this.options.smoothFactor,E=0,R=u.length;E<R;E++)u[E]=Qo(u[E],v)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(u,v){var E,R,q,ne,Ee,Ze,tt=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(u))return!1;for(E=0,ne=this._parts.length;E<ne;E++)for(Ze=this._parts[E],R=0,Ee=Ze.length,q=Ee-1;R<Ee;q=R++)if(!(!v&&R===0)&&dr(u,Ze[q],Ze[R])<=tt)return!0;return!1}});function Ka(u,v){return new Ir(u,v)}Ir._flat=Ar;var yn=Ir.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return ir(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(u){var v=Ir.prototype._convertLatLngs.call(this,u),E=v.length;return E>=2&&v[0]instanceof xi&&v[0].equals(v[E-1])&&v.pop(),v},_setLatLngs:function(u){Ir.prototype._setLatLngs.call(this,u),An(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return An(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var u=this._renderer._bounds,v=this.options.weight,E=new ti(v,v);if(u=new Ni(u.min.subtract(E),u.max.add(E)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(u))){if(this.options.noClip){this._parts=this._rings;return}for(var R=0,q=this._rings.length,ne;R<q;R++)ne=ys(this._rings[R],u,!0),ne.length&&this._parts.push(ne)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(u){var v=!1,E,R,q,ne,Ee,Ze,tt,gt;if(!this._pxBounds||!this._pxBounds.contains(u))return!1;for(ne=0,tt=this._parts.length;ne<tt;ne++)for(E=this._parts[ne],Ee=0,gt=E.length,Ze=gt-1;Ee<gt;Ze=Ee++)R=E[Ee],q=E[Ze],R.y>u.y!=q.y>u.y&&u.x<(q.x-R.x)*(u.y-R.y)/(q.y-R.y)+R.x&&(v=!v);return v||Ir.prototype._containsPoint.call(this,u,!0)}});function Gl(u,v){return new yn(u,v)}var As=cs.extend({initialize:function(u,v){Gt(this,v),this._layers={},u&&this.addData(u)},addData:function(u){var v=zi(u)?u:u.features,E,R,q;if(v){for(E=0,R=v.length;E<R;E++)q=v[E],(q.geometries||q.geometry||q.features||q.coordinates)&&this.addData(q);return this}var ne=this.options;if(ne.filter&&!ne.filter(u))return this;var Ee=Ba(u,ne);return Ee?(Ee.feature=Yo(u),Ee.defaultOptions=Ee.options,this.resetStyle(Ee),ne.onEachFeature&&ne.onEachFeature(u,Ee),this.addLayer(Ee)):this},resetStyle:function(u){return u===void 0?this.eachLayer(this.resetStyle,this):(u.options=We({},u.defaultOptions),this._setLayerStyle(u,this.options.style),this)},setStyle:function(u){return this.eachLayer(function(v){this._setLayerStyle(v,u)},this)},_setLayerStyle:function(u,v){u.setStyle&&(typeof v=="function"&&(v=v(u.feature)),u.setStyle(v))}});function Ba(u,v){var E=u.type==="Feature"?u.geometry:u,R=E?E.coordinates:null,q=[],ne=v&&v.pointToLayer,Ee=v&&v.coordsToLatLng||Fn,Ze,tt,gt,Rt;if(!R&&!E)return null;switch(E.type){case"Point":return Ze=Ee(R),vn(ne,u,Ze,v);case"MultiPoint":for(gt=0,Rt=R.length;gt<Rt;gt++)Ze=Ee(R[gt]),q.push(vn(ne,u,Ze,v));return new cs(q);case"LineString":case"MultiLineString":return tt=ho(R,E.type==="LineString"?0:1,Ee),new Ir(tt,v);case"Polygon":case"MultiPolygon":return tt=ho(R,E.type==="Polygon"?1:2,Ee),new yn(tt,v);case"GeometryCollection":for(gt=0,Rt=E.geometries.length;gt<Rt;gt++){var Jt=Ba({geometry:E.geometries[gt],type:"Feature",properties:u.properties},v);Jt&&q.push(Jt)}return new cs(q);case"FeatureCollection":for(gt=0,Rt=E.features.length;gt<Rt;gt++){var Ti=Ba(E.features[gt],v);Ti&&q.push(Ti)}return new cs(q);default:throw new Error("Invalid GeoJSON object.")}}function vn(u,v,E,R){return u?u(v,E):new Qs(E,R&&R.markersInheritOptions&&R)}function Fn(u){return new xi(u[1],u[0],u[2])}function ho(u,v,E){for(var R=[],q=0,ne=u.length,Ee;q<ne;q++)Ee=v?ho(u[q],v-1,E):(E||Fn)(u[q]),R.push(Ee);return R}function $s(u,v){return u=Ai(u),u.alt!==void 0?[un(u.lng,v),un(u.lat,v),un(u.alt,v)]:[un(u.lng,v),un(u.lat,v)]}function xs(u,v,E,R){for(var q=[],ne=0,Ee=u.length;ne<Ee;ne++)q.push(v?xs(u[ne],An(u[ne])?0:v-1,E,R):$s(u[ne],R));return!v&&E&&q.length>0&&q.push(q[0].slice()),q}function fs(u,v){return u.feature?We({},u.feature,{geometry:v}):Yo(v)}function Yo(u){return u.type==="Feature"||u.type==="FeatureCollection"?u:{type:"Feature",properties:{},geometry:u}}var Ys={toGeoJSON:function(u){return fs(this,{type:"Point",coordinates:$s(this.getLatLng(),u)})}};Qs.include(Ys),ma.include(Ys),uo.include(Ys),Ir.include({toGeoJSON:function(u){var v=!An(this._latlngs),E=xs(this._latlngs,v?1:0,!1,u);return fs(this,{type:(v?"Multi":"")+"LineString",coordinates:E})}}),yn.include({toGeoJSON:function(u){var v=!An(this._latlngs),E=v&&!An(this._latlngs[0]),R=xs(this._latlngs,E?2:v?1:0,!0,u);return v||(R=[R]),fs(this,{type:(E?"Multi":"")+"Polygon",coordinates:R})}}),$o.include({toMultiPoint:function(u){var v=[];return this.eachLayer(function(E){v.push(E.toGeoJSON(u).geometry.coordinates)}),fs(this,{type:"MultiPoint",coordinates:v})},toGeoJSON:function(u){var v=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(v==="MultiPoint")return this.toMultiPoint(u);var E=v==="GeometryCollection",R=[];return this.eachLayer(function(q){if(q.toGeoJSON){var ne=q.toGeoJSON(u);if(E)R.push(ne.geometry);else{var Ee=Yo(ne);Ee.type==="FeatureCollection"?R.push.apply(R,Ee.features):R.push(Ee)}}}),E?fs(this,{geometries:R,type:"GeometryCollection"}):{type:"FeatureCollection",features:R}}});function Ja(u,v){return new As(u,v)}var Pl=Ja,Ra=Rn.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(u,v,E){this._url=u,this._bounds=or(v),Gt(this,E)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(_i(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){Xi(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(u){return this.options.opacity=u,this._image&&this._updateOpacity(),this},setStyle:function(u){return u.opacity&&this.setOpacity(u.opacity),this},bringToFront:function(){return this._map&&tr(this._image),this},bringToBack:function(){return this._map&&Go(this._image),this},setUrl:function(u){return this._url=u,this._image&&(this._image.src=u),this},setBounds:function(u){return this._bounds=or(u),this._map&&this._reset(),this},getEvents:function(){var u={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(u.zoomanim=this._animateZoom),u},setZIndex:function(u){return this.options.zIndex=u,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var u=this._url.tagName==="IMG",v=this._image=u?this._url:Fi("img");if(_i(v,"leaflet-image-layer"),this._zoomAnimated&&_i(v,"leaflet-zoom-animated"),this.options.className&&_i(v,this.options.className),v.onselectstart=Zi,v.onmousemove=Zi,v.onload=W(this.fire,this,"load"),v.onerror=W(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(v.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),u){this._url=v.src;return}v.src=this._url,v.alt=this.options.alt},_animateZoom:function(u){var v=this._map.getZoomScale(u.zoom),E=this._map._latLngBoundsToNewLayerBounds(this._bounds,u.zoom,u.center).min;ar(this._image,E,v)},_reset:function(){var u=this._image,v=new Ni(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),E=v.getSize();Cr(u,v.min),u.style.width=E.x+"px",u.style.height=E.y+"px"},_updateOpacity:function(){_n(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var u=this.options.errorOverlayUrl;u&&this._url!==u&&(this._url=u,this._image.src=u)},getCenter:function(){return this._bounds.getCenter()}}),Au=function(u,v,E){return new Ra(u,v,E)},el=Ra.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var u=this._url.tagName==="VIDEO",v=this._image=u?this._url:Fi("video");if(_i(v,"leaflet-image-layer"),this._zoomAnimated&&_i(v,"leaflet-zoom-animated"),this.options.className&&_i(v,this.options.className),v.onselectstart=Zi,v.onmousemove=Zi,v.onloadeddata=W(this.fire,this,"load"),u){for(var E=v.getElementsByTagName("source"),R=[],q=0;q<E.length;q++)R.push(E[q].src);this._url=E.length>0?R:[v.src];return}zi(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(v.style,"objectFit")&&(v.style.objectFit="fill"),v.autoplay=!!this.options.autoplay,v.loop=!!this.options.loop,v.muted=!!this.options.muted,v.playsInline=!!this.options.playsInline;for(var ne=0;ne<this._url.length;ne++){var Ee=Fi("source");Ee.src=this._url[ne],v.appendChild(Ee)}}});function Ml(u,v,E){return new el(u,v,E)}var tl=Ra.extend({_initImage:function(){var u=this._image=this._url;_i(u,"leaflet-image-layer"),this._zoomAnimated&&_i(u,"leaflet-zoom-animated"),this.options.className&&_i(u,this.options.className),u.onselectstart=Zi,u.onmousemove=Zi}});function Ii(u,v,E){return new tl(u,v,E)}var sn=Rn.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(u,v){u&&(u instanceof xi||zi(u))?(this._latlng=Ai(u),Gt(this,v)):(Gt(this,u),this._source=v),this.options.content&&(this._content=this.options.content)},openOn:function(u){return u=arguments.length?u:this._source._map,u.hasLayer(this)||u.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(u){return this._map?this.close():(arguments.length?this._source=u:u=this._source,this._prepareOpen(),this.openOn(u._map)),this},onAdd:function(u){this._zoomAnimated=u._zoomAnimated,this._container||this._initLayout(),u._fadeAnimated&&_n(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),u._fadeAnimated&&_n(this._container,1),this.bringToFront(),this.options.interactive&&(_i(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(u){u._fadeAnimated?(_n(this._container,0),this._removeTimeout=setTimeout(W(Xi,void 0,this._container),200)):Xi(this._container),this.options.interactive&&(Sr(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(u){return this._latlng=Ai(u),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(u){return this._content=u,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var u={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(u.zoomanim=this._animateZoom),u},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&tr(this._container),this},bringToBack:function(){return this._map&&Go(this._container),this},_prepareOpen:function(u){var v=this._source;if(!v._map)return!1;if(v instanceof cs){v=null;var E=this._source._layers;for(var R in E)if(E[R]._map){v=E[R];break}if(!v)return!1;this._source=v}if(!u)if(v.getCenter)u=v.getCenter();else if(v.getLatLng)u=v.getLatLng();else if(v.getBounds)u=v.getBounds().getCenter();else throw new Error("Unable to get source layer LatLng.");return this.setLatLng(u),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var u=this._contentNode,v=typeof this._content=="function"?this._content(this._source||this):this._content;if(typeof v=="string")u.innerHTML=v;else{for(;u.hasChildNodes();)u.removeChild(u.firstChild);u.appendChild(v)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var u=this._map.latLngToLayerPoint(this._latlng),v=Yt(this.options.offset),E=this._getAnchor();this._zoomAnimated?Cr(this._container,u.add(E)):v=v.add(u).add(E);var R=this._containerBottom=-v.y,q=this._containerLeft=-Math.round(this._containerWidth/2)+v.x;this._container.style.bottom=R+"px",this._container.style.left=q+"px"}},_getAnchor:function(){return[0,0]}});hi.include({_initOverlay:function(u,v,E,R){var q=v;return q instanceof u||(q=new u(R).setContent(v)),E&&q.setLatLng(E),q}}),Rn.include({_initOverlay:function(u,v,E,R){var q=E;return q instanceof u?(Gt(q,R),q._source=this):(q=v&&!R?v:new u(R,this),q.setContent(E)),q}});var $r=sn.extend({options:{pane:"popupPane",offset:[0,7],maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(u){return u=arguments.length?u:this._source._map,!u.hasLayer(this)&&u._popup&&u._popup.options.autoClose&&u.removeLayer(u._popup),u._popup=this,sn.prototype.openOn.call(this,u)},onAdd:function(u){sn.prototype.onAdd.call(this,u),u.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof Bs||this._source.on("preclick",Lr))},onRemove:function(u){sn.prototype.onRemove.call(this,u),u.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof Bs||this._source.off("preclick",Lr))},getEvents:function(){var u=sn.prototype.getEvents.call(this);return(this.options.closeOnClick!==void 0?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(u.preclick=this.close),this.options.keepInView&&(u.moveend=this._adjustPan),u},_initLayout:function(){var u="leaflet-popup",v=this._container=Fi("div",u+" "+(this.options.className||"")+" leaflet-zoom-animated"),E=this._wrapper=Fi("div",u+"-content-wrapper",v);if(this._contentNode=Fi("div",u+"-content",E),Qn(v),Us(this._contentNode),Ht(v,"contextmenu",Lr),this._tipContainer=Fi("div",u+"-tip-container",v),this._tip=Fi("div",u+"-tip",this._tipContainer),this.options.closeButton){var R=this._closeButton=Fi("a",u+"-close-button",v);R.setAttribute("role","button"),R.setAttribute("aria-label","Close popup"),R.href="#close",R.innerHTML='<span aria-hidden="true">&#215;</span>',Ht(R,"click",function(q){Si(q),this.close()},this)}},_updateLayout:function(){var u=this._contentNode,v=u.style;v.width="",v.whiteSpace="nowrap";var E=u.offsetWidth;E=Math.min(E,this.options.maxWidth),E=Math.max(E,this.options.minWidth),v.width=E+1+"px",v.whiteSpace="",v.height="";var R=u.offsetHeight,q=this.options.maxHeight,ne="leaflet-popup-scrolled";q&&R>q?(v.height=q+"px",_i(u,ne)):Sr(u,ne),this._containerWidth=this._container.offsetWidth},_animateZoom:function(u){var v=this._map._latLngToNewLayerPoint(this._latlng,u.zoom,u.center),E=this._getAnchor();Cr(this._container,v.add(E))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var u=this._map,v=parseInt(zn(this._container,"marginBottom"),10)||0,E=this._container.offsetHeight+v,R=this._containerWidth,q=new ti(this._containerLeft,-E-this._containerBottom);q._add(To(this._container));var ne=u.layerPointToContainerPoint(q),Ee=Yt(this.options.autoPanPadding),Ze=Yt(this.options.autoPanPaddingTopLeft||Ee),tt=Yt(this.options.autoPanPaddingBottomRight||Ee),gt=u.getSize(),Rt=0,Jt=0;ne.x+R+tt.x>gt.x&&(Rt=ne.x+R-gt.x+tt.x),ne.x-Rt-Ze.x<0&&(Rt=ne.x-Ze.x),ne.y+E+tt.y>gt.y&&(Jt=ne.y+E-gt.y+tt.y),ne.y-Jt-Ze.y<0&&(Jt=ne.y-Ze.y),(Rt||Jt)&&(this.options.keepInView&&(this._autopanning=!0),u.fire("autopanstart").panBy([Rt,Jt]))}},_getAnchor:function(){return Yt(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),il=function(u,v){return new $r(u,v)};hi.mergeOptions({closePopupOnClick:!0}),hi.include({openPopup:function(u,v,E){return this._initOverlay($r,u,v,E).openOn(this),this},closePopup:function(u){return u=arguments.length?u:this._popup,u&&u.close(),this}}),Rn.include({bindPopup:function(u,v){return this._popup=this._initOverlay($r,this._popup,u,v),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(u){return this._popup&&(this instanceof cs||(this._popup._source=this),this._popup._prepareOpen(u||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(u){return this._popup&&this._popup.setContent(u),this},getPopup:function(){return this._popup},_openPopup:function(u){if(!(!this._popup||!this._map)){$n(u);var v=u.layer||u.target;if(this._popup._source===v&&!(v instanceof Bs)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(u.latlng);return}this._popup._source=v,this.openPopup(u.latlng)}},_movePopup:function(u){this._popup.setLatLng(u.latlng)},_onKeyPress:function(u){u.originalEvent.keyCode===13&&this._openPopup(u)}});var Xs=sn.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(u){sn.prototype.onAdd.call(this,u),this.setOpacity(this.options.opacity),u.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(u){sn.prototype.onRemove.call(this,u),u.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var u=sn.prototype.getEvents.call(this);return this.options.permanent||(u.preclick=this.close),u},_initLayout:function(){var u="leaflet-tooltip",v=u+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=Fi("div",v),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+it(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(u){var v,E,R=this._map,q=this._container,ne=R.latLngToContainerPoint(R.getCenter()),Ee=R.layerPointToContainerPoint(u),Ze=this.options.direction,tt=q.offsetWidth,gt=q.offsetHeight,Rt=Yt(this.options.offset),Jt=this._getAnchor();Ze==="top"?(v=tt/2,E=gt):Ze==="bottom"?(v=tt/2,E=0):Ze==="center"?(v=tt/2,E=gt/2):Ze==="right"?(v=0,E=gt/2):Ze==="left"?(v=tt,E=gt/2):Ee.x<ne.x?(Ze="right",v=0,E=gt/2):(Ze="left",v=tt+(Rt.x+Jt.x)*2,E=gt/2),u=u.subtract(Yt(v,E,!0)).add(Rt).add(Jt),Sr(q,"leaflet-tooltip-right"),Sr(q,"leaflet-tooltip-left"),Sr(q,"leaflet-tooltip-top"),Sr(q,"leaflet-tooltip-bottom"),_i(q,"leaflet-tooltip-"+Ze),Cr(q,u)},_updatePosition:function(){var u=this._map.latLngToLayerPoint(this._latlng);this._setPosition(u)},setOpacity:function(u){this.options.opacity=u,this._container&&_n(this._container,u)},_animateZoom:function(u){var v=this._map._latLngToNewLayerPoint(this._latlng,u.zoom,u.center);this._setPosition(v)},_getAnchor:function(){return Yt(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Xo=function(u,v){return new Xs(u,v)};hi.include({openTooltip:function(u,v,E){return this._initOverlay(Xs,u,v,E).openOn(this),this},closeTooltip:function(u){return u.close(),this}}),Rn.include({bindTooltip:function(u,v){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(Xs,this._tooltip,u,v),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(u){if(!(!u&&this._tooltipHandlersAdded)){var v=u?"off":"on",E={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?E.add=this._openTooltip:(E.mouseover=this._openTooltip,E.mouseout=this.closeTooltip,E.click=this._openTooltip,this._map?this._addFocusListeners():E.add=this._addFocusListeners),this._tooltip.options.sticky&&(E.mousemove=this._moveTooltip),this[v](E),this._tooltipHandlersAdded=!u}},openTooltip:function(u){return this._tooltip&&(this instanceof cs||(this._tooltip._source=this),this._tooltip._prepareOpen(u)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this))),this},closeTooltip:function(){if(this._tooltip)return this._tooltip.close()},toggleTooltip:function(){return this._tooltip&&this._tooltip.toggle(this),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(u){return this._tooltip&&this._tooltip.setContent(u),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(u){var v=typeof u.getElement=="function"&&u.getElement();v&&(Ht(v,"focus",function(){this._tooltip._source=u,this.openTooltip()},this),Ht(v,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(u){var v=typeof u.getElement=="function"&&u.getElement();v&&v.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(u){if(!(!this._tooltip||!this._map)){if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var v=this;this._map.once("moveend",function(){v._openOnceFlag=!1,v._openTooltip(u)});return}this._tooltip._source=u.layer||u.target,this.openTooltip(this._tooltip.options.sticky?u.latlng:void 0)}},_moveTooltip:function(u){var v=u.latlng,E,R;this._tooltip.options.sticky&&u.originalEvent&&(E=this._map.mouseEventToContainerPoint(u.originalEvent),R=this._map.containerPointToLayerPoint(E),v=this._map.layerPointToLatLng(R)),this._tooltip.setLatLng(v)}});var _a=Hs.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(u){var v=u&&u.tagName==="DIV"?u:document.createElement("div"),E=this.options;if(E.html instanceof Element?(te(v),v.appendChild(E.html)):v.innerHTML=E.html!==!1?E.html:"",E.bgPos){var R=Yt(E.bgPos);v.style.backgroundPosition=-R.x+"px "+-R.y+"px"}return this._setIconStyles(v,"icon"),v},createShadow:function(){return null}});function ga(u){return new _a(u)}Hs.Default=Ws;var fn=Rn.extend({options:{tileSize:256,opacity:1,updateWhenIdle:o.mobile,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(u){Gt(this,u)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(u){u._addZoomLimit(this)},onRemove:function(u){this._removeAllTiles(),Xi(this._container),u._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(tr(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(Go(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(u){return this.options.opacity=u,this._updateOpacity(),this},setZIndex:function(u){return this.options.zIndex=u,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var u=this._clampZoom(this._map.getZoom());u!==this._tileZoom&&(this._tileZoom=u,this._updateLevels()),this._update()}return this},getEvents:function(){var u={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=ur(this._onMoveEnd,this.options.updateInterval,this)),u.move=this._onMove),this._zoomAnimated&&(u.zoomanim=this._animateZoom),u},createTile:function(){return document.createElement("div")},getTileSize:function(){var u=this.options.tileSize;return u instanceof ti?u:new ti(u,u)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(u){for(var v=this.getPane().children,E=-u(-1/0,1/0),R=0,q=v.length,ne;R<q;R++)ne=v[R].style.zIndex,v[R]!==this._container&&ne&&(E=u(E,+ne));isFinite(E)&&(this.options.zIndex=E+u(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!o.ielt9){_n(this._container,this.options.opacity);var u=+new Date,v=!1,E=!1;for(var R in this._tiles){var q=this._tiles[R];if(!(!q.current||!q.loaded)){var ne=Math.min(1,(u-q.loaded)/200);_n(q.el,ne),ne<1?v=!0:(q.active?E=!0:this._onOpaqueTile(q),q.active=!0)}}E&&!this._noPrune&&this._pruneTiles(),v&&(Ji(this._fadeFrame),this._fadeFrame=cr(this._updateOpacity,this))}},_onOpaqueTile:Zi,_initContainer:function(){this._container||(this._container=Fi("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var u=this._tileZoom,v=this.options.maxZoom;if(u!==void 0){for(var E in this._levels)E=Number(E),this._levels[E].el.children.length||E===u?(this._levels[E].el.style.zIndex=v-Math.abs(u-E),this._onUpdateLevel(E)):(Xi(this._levels[E].el),this._removeTilesAtZoom(E),this._onRemoveLevel(E),delete this._levels[E]);var R=this._levels[u],q=this._map;return R||(R=this._levels[u]={},R.el=Fi("div","leaflet-tile-container leaflet-zoom-animated",this._container),R.el.style.zIndex=v,R.origin=q.project(q.unproject(q.getPixelOrigin()),u).round(),R.zoom=u,this._setZoomTransform(R,q.getCenter(),q.getZoom()),Zi(R.el.offsetWidth),this._onCreateLevel(R)),this._level=R,R}},_onUpdateLevel:Zi,_onRemoveLevel:Zi,_onCreateLevel:Zi,_pruneTiles:function(){if(this._map){var u,v,E=this._map.getZoom();if(E>this.options.maxZoom||E<this.options.minZoom){this._removeAllTiles();return}for(u in this._tiles)v=this._tiles[u],v.retain=v.current;for(u in this._tiles)if(v=this._tiles[u],v.current&&!v.active){var R=v.coords;this._retainParent(R.x,R.y,R.z,R.z-5)||this._retainChildren(R.x,R.y,R.z,R.z+2)}for(u in this._tiles)this._tiles[u].retain||this._removeTile(u)}},_removeTilesAtZoom:function(u){for(var v in this._tiles)this._tiles[v].coords.z===u&&this._removeTile(v)},_removeAllTiles:function(){for(var u in this._tiles)this._removeTile(u)},_invalidateAll:function(){for(var u in this._levels)Xi(this._levels[u].el),this._onRemoveLevel(Number(u)),delete this._levels[u];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(u,v,E,R){var q=Math.floor(u/2),ne=Math.floor(v/2),Ee=E-1,Ze=new ti(+q,+ne);Ze.z=+Ee;var tt=this._tileCoordsToKey(Ze),gt=this._tiles[tt];return gt&&gt.active?(gt.retain=!0,!0):(gt&&gt.loaded&&(gt.retain=!0),Ee>R?this._retainParent(q,ne,Ee,R):!1)},_retainChildren:function(u,v,E,R){for(var q=2*u;q<2*u+2;q++)for(var ne=2*v;ne<2*v+2;ne++){var Ee=new ti(q,ne);Ee.z=E+1;var Ze=this._tileCoordsToKey(Ee),tt=this._tiles[Ze];if(tt&&tt.active){tt.retain=!0;continue}else tt&&tt.loaded&&(tt.retain=!0);E+1<R&&this._retainChildren(q,ne,E+1,R)}},_resetView:function(u){var v=u&&(u.pinch||u.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),v,v)},_animateZoom:function(u){this._setView(u.center,u.zoom,!0,u.noUpdate)},_clampZoom:function(u){var v=this.options;return v.minNativeZoom!==void 0&&u<v.minNativeZoom?v.minNativeZoom:v.maxNativeZoom!==void 0&&v.maxNativeZoom<u?v.maxNativeZoom:u},_setView:function(u,v,E,R){var q=Math.round(v);this.options.maxZoom!==void 0&&q>this.options.maxZoom||this.options.minZoom!==void 0&&q<this.options.minZoom?q=void 0:q=this._clampZoom(q);var ne=this.options.updateWhenZooming&&q!==this._tileZoom;(!R||ne)&&(this._tileZoom=q,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),q!==void 0&&this._update(u),E||this._pruneTiles(),this._noPrune=!!E),this._setZoomTransforms(u,v)},_setZoomTransforms:function(u,v){for(var E in this._levels)this._setZoomTransform(this._levels[E],u,v)},_setZoomTransform:function(u,v,E){var R=this._map.getZoomScale(E,u.zoom),q=u.origin.multiplyBy(R).subtract(this._map._getNewPixelOrigin(v,E)).round();o.any3d?ar(u.el,q,R):Cr(u.el,q)},_resetGrid:function(){var u=this._map,v=u.options.crs,E=this._tileSize=this.getTileSize(),R=this._tileZoom,q=this._map.getPixelWorldBounds(this._tileZoom);q&&(this._globalTileRange=this._pxBoundsToTileRange(q)),this._wrapX=v.wrapLng&&!this.options.noWrap&&[Math.floor(u.project([0,v.wrapLng[0]],R).x/E.x),Math.ceil(u.project([0,v.wrapLng[1]],R).x/E.y)],this._wrapY=v.wrapLat&&!this.options.noWrap&&[Math.floor(u.project([v.wrapLat[0],0],R).y/E.x),Math.ceil(u.project([v.wrapLat[1],0],R).y/E.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(u){var v=this._map,E=v._animatingZoom?Math.max(v._animateToZoom,v.getZoom()):v.getZoom(),R=v.getZoomScale(E,this._tileZoom),q=v.project(u,this._tileZoom).floor(),ne=v.getSize().divideBy(R*2);return new Ni(q.subtract(ne),q.add(ne))},_update:function(u){var v=this._map;if(v){var E=this._clampZoom(v.getZoom());if(u===void 0&&(u=v.getCenter()),this._tileZoom!==void 0){var R=this._getTiledPixelBounds(u),q=this._pxBoundsToTileRange(R),ne=q.getCenter(),Ee=[],Ze=this.options.keepBuffer,tt=new Ni(q.getBottomLeft().subtract([Ze,-Ze]),q.getTopRight().add([Ze,-Ze]));if(!(isFinite(q.min.x)&&isFinite(q.min.y)&&isFinite(q.max.x)&&isFinite(q.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var gt in this._tiles){var Rt=this._tiles[gt].coords;(Rt.z!==this._tileZoom||!tt.contains(new ti(Rt.x,Rt.y)))&&(this._tiles[gt].current=!1)}if(Math.abs(E-this._tileZoom)>1){this._setView(u,E);return}for(var Jt=q.min.y;Jt<=q.max.y;Jt++)for(var Ti=q.min.x;Ti<=q.max.x;Ti++){var Zr=new ti(Ti,Jt);if(Zr.z=this._tileZoom,!!this._isValidTile(Zr)){var Br=this._tiles[this._tileCoordsToKey(Zr)];Br?Br.current=!0:Ee.push(Zr)}}if(Ee.sort(function(On,Ks){return On.distanceTo(ne)-Ks.distanceTo(ne)}),Ee.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var ps=document.createDocumentFragment();for(Ti=0;Ti<Ee.length;Ti++)this._addTile(Ee[Ti],ps);this._level.el.appendChild(ps)}}}},_isValidTile:function(u){var v=this._map.options.crs;if(!v.infinite){var E=this._globalTileRange;if(!v.wrapLng&&(u.x<E.min.x||u.x>E.max.x)||!v.wrapLat&&(u.y<E.min.y||u.y>E.max.y))return!1}if(!this.options.bounds)return!0;var R=this._tileCoordsToBounds(u);return or(this.options.bounds).overlaps(R)},_keyToBounds:function(u){return this._tileCoordsToBounds(this._keyToTileCoords(u))},_tileCoordsToNwSe:function(u){var v=this._map,E=this.getTileSize(),R=u.scaleBy(E),q=R.add(E),ne=v.unproject(R,u.z),Ee=v.unproject(q,u.z);return[ne,Ee]},_tileCoordsToBounds:function(u){var v=this._tileCoordsToNwSe(u),E=new Wr(v[0],v[1]);return this.options.noWrap||(E=this._map.wrapLatLngBounds(E)),E},_tileCoordsToKey:function(u){return u.x+":"+u.y+":"+u.z},_keyToTileCoords:function(u){var v=u.split(":"),E=new ti(+v[0],+v[1]);return E.z=+v[2],E},_removeTile:function(u){var v=this._tiles[u];v&&(Xi(v.el),delete this._tiles[u],this.fire("tileunload",{tile:v.el,coords:this._keyToTileCoords(u)}))},_initTile:function(u){_i(u,"leaflet-tile");var v=this.getTileSize();u.style.width=v.x+"px",u.style.height=v.y+"px",u.onselectstart=Zi,u.onmousemove=Zi,o.ielt9&&this.options.opacity<1&&_n(u,this.options.opacity)},_addTile:function(u,v){var E=this._getTilePos(u),R=this._tileCoordsToKey(u),q=this.createTile(this._wrapCoords(u),W(this._tileReady,this,u));this._initTile(q),this.createTile.length<2&&cr(W(this._tileReady,this,u,null,q)),Cr(q,E),this._tiles[R]={el:q,coords:u,current:!0},v.appendChild(q),this.fire("tileloadstart",{tile:q,coords:u})},_tileReady:function(u,v,E){v&&this.fire("tileerror",{error:v,tile:E,coords:u});var R=this._tileCoordsToKey(u);E=this._tiles[R],E&&(E.loaded=+new Date,this._map._fadeAnimated?(_n(E.el,0),Ji(this._fadeFrame),this._fadeFrame=cr(this._updateOpacity,this)):(E.active=!0,this._pruneTiles()),v||(_i(E.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:E.el,coords:u})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),o.ielt9||!this._map._fadeAnimated?cr(this._pruneTiles,this):setTimeout(W(this._pruneTiles,this),250)))},_getTilePos:function(u){return u.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(u){var v=new ti(this._wrapX?fr(u.x,this._wrapX):u.x,this._wrapY?fr(u.y,this._wrapY):u.y);return v.z=u.z,v},_pxBoundsToTileRange:function(u){var v=this.getTileSize();return new Ni(u.min.unscaleBy(v).floor(),u.max.unscaleBy(v).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var u in this._tiles)if(!this._tiles[u].loaded)return!1;return!0}});function ql(u){return new fn(u)}var Ko=fn.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(u,v){this._url=u,v=Gt(this,v),v.detectRetina&&o.retina&&v.maxZoom>0?(v.tileSize=Math.floor(v.tileSize/2),v.zoomReverse?(v.zoomOffset--,v.minZoom=Math.min(v.maxZoom,v.minZoom+1)):(v.zoomOffset++,v.maxZoom=Math.max(v.minZoom,v.maxZoom-1)),v.minZoom=Math.max(0,v.minZoom)):v.zoomReverse?v.minZoom=Math.min(v.maxZoom,v.minZoom):v.maxZoom=Math.max(v.minZoom,v.maxZoom),typeof v.subdomains=="string"&&(v.subdomains=v.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(u,v){return this._url===u&&v===void 0&&(v=!0),this._url=u,v||this.redraw(),this},createTile:function(u,v){var E=document.createElement("img");return Ht(E,"load",W(this._tileOnLoad,this,v,E)),Ht(E,"error",W(this._tileOnError,this,v,E)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(E.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(E.referrerPolicy=this.options.referrerPolicy),E.alt="",E.src=this.getTileUrl(u),E},getTileUrl:function(u){var v={r:o.retina?"@2x":"",s:this._getSubdomain(u),x:u.x,y:u.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var E=this._globalTileRange.max.y-u.y;this.options.tms&&(v.y=E),v["-y"]=E}return hr(this._url,We(v,this.options))},_tileOnLoad:function(u,v){o.ielt9?setTimeout(W(u,this,null,v),0):u(null,v)},_tileOnError:function(u,v,E){var R=this.options.errorTileUrl;R&&v.getAttribute("src")!==R&&(v.src=R),u(E,v)},_onTileRemove:function(u){u.tile.onload=null},_getZoomForUrl:function(){var u=this._tileZoom,v=this.options.maxZoom,E=this.options.zoomReverse,R=this.options.zoomOffset;return E&&(u=v-u),u+R},_getSubdomain:function(u){var v=Math.abs(u.x+u.y)%this.options.subdomains.length;return this.options.subdomains[v]},_abortLoading:function(){var u,v;for(u in this._tiles)if(this._tiles[u].coords.z!==this._tileZoom&&(v=this._tiles[u].el,v.onload=Zi,v.onerror=Zi,!v.complete)){v.src=no;var E=this._tiles[u].coords;Xi(v),delete this._tiles[u],this.fire("tileabort",{tile:v,coords:E})}},_removeTile:function(u){var v=this._tiles[u];if(v)return v.el.setAttribute("src",no),fn.prototype._removeTile.call(this,u)},_tileReady:function(u,v,E){if(!(!this._map||E&&E.getAttribute("src")===no))return fn.prototype._tileReady.call(this,u,v,E)}});function rl(u,v){return new Ko(u,v)}var Rs=Ko.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(u,v){this._url=u;var E=We({},this.defaultWmsParams);for(var R in v)R in this.options||(E[R]=v[R]);v=Gt(this,v);var q=v.detectRetina&&o.retina?2:1,ne=this.getTileSize();E.width=ne.x*q,E.height=ne.y*q,this.wmsParams=E},onAdd:function(u){this._crs=this.options.crs||u.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var v=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[v]=this._crs.code,Ko.prototype.onAdd.call(this,u)},getTileUrl:function(u){var v=this._tileCoordsToNwSe(u),E=this._crs,R=Mr(E.project(v[0]),E.project(v[1])),q=R.min,ne=R.max,Ee=(this._wmsVersion>=1.3&&this._crs===bl?[q.y,q.x,ne.y,ne.x]:[q.x,q.y,ne.x,ne.y]).join(","),Ze=Ko.prototype.getTileUrl.call(this,u);return Ze+rt(this.wmsParams,Ze,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+Ee},setParams:function(u,v){return We(this.wmsParams,u),v||this.redraw(),this}});function Fa(u,v){return new Rs(u,v)}Ko.WMS=Rs,rl.wms=Fa;var es=Rn.extend({options:{padding:.1},initialize:function(u){Gt(this,u),it(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),_i(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var u={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(u.zoomanim=this._onAnimZoom),u},_onAnimZoom:function(u){this._updateTransform(u.center,u.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(u,v){var E=this._map.getZoomScale(v,this._zoom),R=this._map.getSize().multiplyBy(.5+this.options.padding),q=this._map.project(this._center,v),ne=R.multiplyBy(-E).add(q).subtract(this._map._getNewPixelOrigin(u,v));o.any3d?ar(this._container,ne,E):Cr(this._container,ne)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var u in this._layers)this._layers[u]._reset()},_onZoomEnd:function(){for(var u in this._layers)this._layers[u]._project()},_updatePaths:function(){for(var u in this._layers)this._layers[u]._update()},_update:function(){var u=this.options.padding,v=this._map.getSize(),E=this._map.containerPointToLayerPoint(v.multiplyBy(-u)).round();this._bounds=new Ni(E,E.add(v.multiplyBy(1+u*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),ya=es.extend({options:{tolerance:0},getEvents:function(){var u=es.prototype.getEvents.call(this);return u.viewprereset=this._onViewPreReset,u},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){es.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var u=this._container=document.createElement("canvas");Ht(u,"mousemove",this._onMouseMove,this),Ht(u,"click dblclick mousedown mouseup contextmenu",this._onClick,this),Ht(u,"mouseout",this._handleMouseOut,this),u._leaflet_disable_events=!0,this._ctx=u.getContext("2d")},_destroyContainer:function(){Ji(this._redrawRequest),delete this._ctx,Xi(this._container),Dt(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var u;this._redrawBounds=null;for(var v in this._layers)u=this._layers[v],u._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){es.prototype._update.call(this);var u=this._bounds,v=this._container,E=u.getSize(),R=o.retina?2:1;Cr(v,u.min),v.width=R*E.x,v.height=R*E.y,v.style.width=E.x+"px",v.style.height=E.y+"px",o.retina&&this._ctx.scale(2,2),this._ctx.translate(-u.min.x,-u.min.y),this.fire("update")}},_reset:function(){es.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(u){this._updateDashArray(u),this._layers[it(u)]=u;var v=u._order={layer:u,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=v),this._drawLast=v,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(u){this._requestRedraw(u)},_removePath:function(u){var v=u._order,E=v.next,R=v.prev;E?E.prev=R:this._drawLast=R,R?R.next=E:this._drawFirst=E,delete u._order,delete this._layers[it(u)],this._requestRedraw(u)},_updatePath:function(u){this._extendRedrawBounds(u),u._project(),u._update(),this._requestRedraw(u)},_updateStyle:function(u){this._updateDashArray(u),this._requestRedraw(u)},_updateDashArray:function(u){if(typeof u.options.dashArray=="string"){var v=u.options.dashArray.split(/[, ]+/),E=[],R,q;for(q=0;q<v.length;q++){if(R=Number(v[q]),isNaN(R))return;E.push(R)}u.options._dashArray=E}else u.options._dashArray=u.options.dashArray},_requestRedraw:function(u){this._map&&(this._extendRedrawBounds(u),this._redrawRequest=this._redrawRequest||cr(this._redraw,this))},_extendRedrawBounds:function(u){if(u._pxBounds){var v=(u.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new Ni,this._redrawBounds.extend(u._pxBounds.min.subtract([v,v])),this._redrawBounds.extend(u._pxBounds.max.add([v,v]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var u=this._redrawBounds;if(u){var v=u.getSize();this._ctx.clearRect(u.min.x,u.min.y,v.x,v.y)}else this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore()},_draw:function(){var u,v=this._redrawBounds;if(this._ctx.save(),v){var E=v.getSize();this._ctx.beginPath(),this._ctx.rect(v.min.x,v.min.y,E.x,E.y),this._ctx.clip()}this._drawing=!0;for(var R=this._drawFirst;R;R=R.next)u=R.layer,(!v||u._pxBounds&&u._pxBounds.intersects(v))&&u._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(u,v){if(this._drawing){var E,R,q,ne,Ee=u._parts,Ze=Ee.length,tt=this._ctx;if(Ze){for(tt.beginPath(),E=0;E<Ze;E++){for(R=0,q=Ee[E].length;R<q;R++)ne=Ee[E][R],tt[R?"lineTo":"moveTo"](ne.x,ne.y);v&&tt.closePath()}this._fillStroke(tt,u)}}},_updateCircle:function(u){if(!(!this._drawing||u._empty())){var v=u._point,E=this._ctx,R=Math.max(Math.round(u._radius),1),q=(Math.max(Math.round(u._radiusY),1)||R)/R;q!==1&&(E.save(),E.scale(1,q)),E.beginPath(),E.arc(v.x,v.y/q,R,0,Math.PI*2,!1),q!==1&&E.restore(),this._fillStroke(E,u)}},_fillStroke:function(u,v){var E=v.options;E.fill&&(u.globalAlpha=E.fillOpacity,u.fillStyle=E.fillColor||E.color,u.fill(E.fillRule||"evenodd")),E.stroke&&E.weight!==0&&(u.setLineDash&&u.setLineDash(v.options&&v.options._dashArray||[]),u.globalAlpha=E.opacity,u.lineWidth=E.weight,u.strokeStyle=E.color,u.lineCap=E.lineCap,u.lineJoin=E.lineJoin,u.stroke())},_onClick:function(u){for(var v=this._map.mouseEventToLayerPoint(u),E,R,q=this._drawFirst;q;q=q.next)E=q.layer,E.options.interactive&&E._containsPoint(v)&&(!(u.type==="click"||u.type==="preclick")||!this._map._draggableMoved(E))&&(R=E);this._fireEvent(R?[R]:!1,u)},_onMouseMove:function(u){if(!(!this._map||this._map.dragging.moving()||this._map._animatingZoom)){var v=this._map.mouseEventToLayerPoint(u);this._handleMouseHover(u,v)}},_handleMouseOut:function(u){var v=this._hoveredLayer;v&&(Sr(this._container,"leaflet-interactive"),this._fireEvent([v],u,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(u,v){if(!this._mouseHoverThrottled){for(var E,R,q=this._drawFirst;q;q=q.next)E=q.layer,E.options.interactive&&E._containsPoint(v)&&(R=E);R!==this._hoveredLayer&&(this._handleMouseOut(u),R&&(_i(this._container,"leaflet-interactive"),this._fireEvent([R],u,"mouseover"),this._hoveredLayer=R)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,u),this._mouseHoverThrottled=!0,setTimeout(W(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(u,v,E){this._map._fireDOMEvent(v,E||v.type,u)},_bringToFront:function(u){var v=u._order;if(v){var E=v.next,R=v.prev;if(E)E.prev=R;else return;R?R.next=E:E&&(this._drawFirst=E),v.prev=this._drawLast,this._drawLast.next=v,v.next=null,this._drawLast=v,this._requestRedraw(u)}},_bringToBack:function(u){var v=u._order;if(v){var E=v.next,R=v.prev;if(R)R.next=E;else return;E?E.prev=R:R&&(this._drawLast=R),v.prev=null,v.next=this._drawFirst,this._drawFirst.prev=v,this._drawFirst=v,this._requestRedraw(u)}}});function Oa(u){return o.canvas?new ya(u):null}var va=(function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(u){return document.createElement("<lvml:"+u+' class="lvml">')}}catch{}return function(u){return document.createElement("<"+u+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),xa={_initContainer:function(){this._container=Fi("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(es.prototype._update.call(this),this.fire("update"))},_initPath:function(u){var v=u._container=va("shape");_i(v,"leaflet-vml-shape "+(this.options.className||"")),v.coordsize="1 1",u._path=va("path"),v.appendChild(u._path),this._updateStyle(u),this._layers[it(u)]=u},_addPath:function(u){var v=u._container;this._container.appendChild(v),u.options.interactive&&u.addInteractiveTarget(v)},_removePath:function(u){var v=u._container;Xi(v),u.removeInteractiveTarget(v),delete this._layers[it(u)]},_updateStyle:function(u){var v=u._stroke,E=u._fill,R=u.options,q=u._container;q.stroked=!!R.stroke,q.filled=!!R.fill,R.stroke?(v||(v=u._stroke=va("stroke")),q.appendChild(v),v.weight=R.weight+"px",v.color=R.color,v.opacity=R.opacity,R.dashArray?v.dashStyle=zi(R.dashArray)?R.dashArray.join(" "):R.dashArray.replace(/( *, *)/g," "):v.dashStyle="",v.endcap=R.lineCap.replace("butt","flat"),v.joinstyle=R.lineJoin):v&&(q.removeChild(v),u._stroke=null),R.fill?(E||(E=u._fill=va("fill")),q.appendChild(E),E.color=R.fillColor||R.color,E.opacity=R.fillOpacity):E&&(q.removeChild(E),u._fill=null)},_updateCircle:function(u){var v=u._point.round(),E=Math.round(u._radius),R=Math.round(u._radiusY||E);this._setPath(u,u._empty()?"M0 0":"AL "+v.x+","+v.y+" "+E+","+R+" 0,"+65535*360)},_setPath:function(u,v){u._path.v=v},_bringToFront:function(u){tr(u._container)},_bringToBack:function(u){Go(u._container)}},co=o.vml?va:hs,ba=es.extend({_initContainer:function(){this._container=co("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=co("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){Xi(this._container),Dt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){es.prototype._update.call(this);var u=this._bounds,v=u.getSize(),E=this._container;(!this._svgSize||!this._svgSize.equals(v))&&(this._svgSize=v,E.setAttribute("width",v.x),E.setAttribute("height",v.y)),Cr(E,u.min),E.setAttribute("viewBox",[u.min.x,u.min.y,v.x,v.y].join(" ")),this.fire("update")}},_initPath:function(u){var v=u._path=co("path");u.options.className&&_i(v,u.options.className),u.options.interactive&&_i(v,"leaflet-interactive"),this._updateStyle(u),this._layers[it(u)]=u},_addPath:function(u){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(u._path),u.addInteractiveTarget(u._path)},_removePath:function(u){Xi(u._path),u.removeInteractiveTarget(u._path),delete this._layers[it(u)]},_updatePath:function(u){u._project(),u._update()},_updateStyle:function(u){var v=u._path,E=u.options;v&&(E.stroke?(v.setAttribute("stroke",E.color),v.setAttribute("stroke-opacity",E.opacity),v.setAttribute("stroke-width",E.weight),v.setAttribute("stroke-linecap",E.lineCap),v.setAttribute("stroke-linejoin",E.lineJoin),E.dashArray?v.setAttribute("stroke-dasharray",E.dashArray):v.removeAttribute("stroke-dasharray"),E.dashOffset?v.setAttribute("stroke-dashoffset",E.dashOffset):v.removeAttribute("stroke-dashoffset")):v.setAttribute("stroke","none"),E.fill?(v.setAttribute("fill",E.fillColor||E.color),v.setAttribute("fill-opacity",E.fillOpacity),v.setAttribute("fill-rule",E.fillRule||"evenodd")):v.setAttribute("fill","none"))},_updatePoly:function(u,v){this._setPath(u,Is(u._parts,v))},_updateCircle:function(u){var v=u._point,E=Math.max(Math.round(u._radius),1),R=Math.max(Math.round(u._radiusY),1)||E,q="a"+E+","+R+" 0 1,0 ",ne=u._empty()?"M0 0":"M"+(v.x-E)+","+v.y+q+E*2+",0 "+q+-E*2+",0 ";this._setPath(u,ne)},_setPath:function(u,v){u._path.setAttribute("d",v)},_bringToFront:function(u){tr(u._path)},_bringToBack:function(u){Go(u._path)}});o.vml&&ba.include(xa);function nl(u){return o.svg||o.vml?new ba(u):null}hi.include({getRenderer:function(u){var v=u.options.renderer||this._getPaneRenderer(u.options.pane)||this.options.renderer||this._renderer;return v||(v=this._renderer=this._createRenderer()),this.hasLayer(v)||this.addLayer(v),v},_getPaneRenderer:function(u){if(u==="overlayPane"||u===void 0)return!1;var v=this._paneRenderers[u];return v===void 0&&(v=this._createRenderer({pane:u}),this._paneRenderers[u]=v),v},_createRenderer:function(u){return this.options.preferCanvas&&Oa(u)||nl(u)}});var gi=yn.extend({initialize:function(u,v){yn.prototype.initialize.call(this,this._boundsToLatLngs(u),v)},setBounds:function(u){return this.setLatLngs(this._boundsToLatLngs(u))},_boundsToLatLngs:function(u){return u=or(u),[u.getSouthWest(),u.getNorthWest(),u.getNorthEast(),u.getSouthEast()]}});function sl(u,v){return new gi(u,v)}ba.create=co,ba.pointsToPath=Is,As.geometryToLayer=Ba,As.coordsToLatLng=Fn,As.coordsToLatLngs=ho,As.latLngToCoords=$s,As.latLngsToCoords=xs,As.getFeature=fs,As.asFeature=Yo,hi.mergeOptions({boxZoom:!0});var El=Bn.extend({initialize:function(u){this._map=u,this._container=u._container,this._pane=u._panes.overlayPane,this._resetStateTimeout=0,u.on("unload",this._destroy,this)},addHooks:function(){Ht(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Dt(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){Xi(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(u){if(!u.shiftKey||u.which!==1&&u.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),so(),Ca(),this._startPoint=this._map.mouseEventToContainerPoint(u),Ht(document,{contextmenu:$n,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(u){this._moved||(this._moved=!0,this._box=Fi("div","leaflet-zoom-box",this._container),_i(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(u);var v=new Ni(this._point,this._startPoint),E=v.getSize();Cr(this._box,v.min),this._box.style.width=E.x+"px",this._box.style.height=E.y+"px"},_finish:function(){this._moved&&(Xi(this._box),Sr(this._container,"leaflet-crosshair")),js(),qo(),Dt(document,{contextmenu:$n,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(u){if(!(u.which!==1&&u.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(W(this._resetState,this),0);var v=new Wr(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(v).fire("boxzoomend",{boxZoomBounds:v})}},_onKeyDown:function(u){u.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});hi.addInitHook("addHandler","boxZoom",El),hi.mergeOptions({doubleClickZoom:!0});var Fs=Bn.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(u){var v=this._map,E=v.getZoom(),R=v.options.zoomDelta,q=u.originalEvent.shiftKey?E-R:E+R;v.options.doubleClickZoom==="center"?v.setZoom(q):v.setZoomAround(u.containerPoint,q)}});hi.addInitHook("addHandler","doubleClickZoom",Fs),hi.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Jo=Bn.extend({addHooks:function(){if(!this._draggable){var u=this._map;this._draggable=new xr(u._mapPane,u._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),u.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),u.on("zoomend",this._onZoomEnd,this),u.whenReady(this._onZoomEnd,this))}_i(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Sr(this._map._container,"leaflet-grab"),Sr(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var u=this._map;if(u._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var v=or(this._map.options.maxBounds);this._offsetLimit=Mr(this._map.latLngToContainerPoint(v.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(v.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;u.fire("movestart").fire("dragstart"),u.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(u){if(this._map.options.inertia){var v=this._lastTime=+new Date,E=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(E),this._times.push(v),this._prunePositions(v)}this._map.fire("move",u).fire("drag",u)},_prunePositions:function(u){for(;this._positions.length>1&&u-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var u=this._map.getSize().divideBy(2),v=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=v.subtract(u).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(u,v){return u-(u-v)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var u=this._draggable._newPos.subtract(this._draggable._startPos),v=this._offsetLimit;u.x<v.min.x&&(u.x=this._viscousLimit(u.x,v.min.x)),u.y<v.min.y&&(u.y=this._viscousLimit(u.y,v.min.y)),u.x>v.max.x&&(u.x=this._viscousLimit(u.x,v.max.x)),u.y>v.max.y&&(u.y=this._viscousLimit(u.y,v.max.y)),this._draggable._newPos=this._draggable._startPos.add(u)}},_onPreDragWrap:function(){var u=this._worldWidth,v=Math.round(u/2),E=this._initialWorldOffset,R=this._draggable._newPos.x,q=(R-v+E)%u+v-E,ne=(R+v+E)%u-v-E,Ee=Math.abs(q+E)<Math.abs(ne+E)?q:ne;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=Ee},_onDragEnd:function(u){var v=this._map,E=v.options,R=!E.inertia||u.noInertia||this._times.length<2;if(v.fire("dragend",u),R)v.fire("moveend");else{this._prunePositions(+new Date);var q=this._lastPos.subtract(this._positions[0]),ne=(this._lastTime-this._times[0])/1e3,Ee=E.easeLinearity,Ze=q.multiplyBy(Ee/ne),tt=Ze.distanceTo([0,0]),gt=Math.min(E.inertiaMaxSpeed,tt),Rt=Ze.multiplyBy(gt/tt),Jt=gt/(E.inertiaDeceleration*Ee),Ti=Rt.multiplyBy(-Jt/2).round();!Ti.x&&!Ti.y?v.fire("moveend"):(Ti=v._limitOffset(Ti,v.options.maxBounds),cr(function(){v.panBy(Ti,{duration:Jt,easeLinearity:Ee,noMoveStart:!0,animate:!0})}))}}});hi.addInitHook("addHandler","dragging",Jo),hi.mergeOptions({keyboard:!0,keyboardPanDelta:80});var Hl=Bn.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(u){this._map=u,this._setPanDelta(u.options.keyboardPanDelta),this._setZoomDelta(u.options.zoomDelta)},addHooks:function(){var u=this._map._container;u.tabIndex<=0&&(u.tabIndex="0"),Ht(u,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Dt(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var u=document.body,v=document.documentElement,E=u.scrollTop||v.scrollTop,R=u.scrollLeft||v.scrollLeft;this._map._container.focus(),window.scrollTo(R,E)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(u){var v=this._panKeys={},E=this.keyCodes,R,q;for(R=0,q=E.left.length;R<q;R++)v[E.left[R]]=[-1*u,0];for(R=0,q=E.right.length;R<q;R++)v[E.right[R]]=[u,0];for(R=0,q=E.down.length;R<q;R++)v[E.down[R]]=[0,u];for(R=0,q=E.up.length;R<q;R++)v[E.up[R]]=[0,-1*u]},_setZoomDelta:function(u){var v=this._zoomKeys={},E=this.keyCodes,R,q;for(R=0,q=E.zoomIn.length;R<q;R++)v[E.zoomIn[R]]=u;for(R=0,q=E.zoomOut.length;R<q;R++)v[E.zoomOut[R]]=-u},_addHooks:function(){Ht(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Dt(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(u){if(!(u.altKey||u.ctrlKey||u.metaKey)){var v=u.keyCode,E=this._map,R;if(v in this._panKeys){if(!E._panAnim||!E._panAnim._inProgress)if(R=this._panKeys[v],u.shiftKey&&(R=Yt(R).multiplyBy(3)),E.options.maxBounds&&(R=E._limitOffset(Yt(R),E.options.maxBounds)),E.options.worldCopyJump){var q=E.wrapLatLng(E.unproject(E.project(E.getCenter()).add(R)));E.panTo(q)}else E.panBy(R)}else if(v in this._zoomKeys)E.setZoom(E.getZoom()+(u.shiftKey?3:1)*this._zoomKeys[v]);else if(v===27&&E._popup&&E._popup.options.closeOnEscapeKey)E.closePopup();else return;$n(u)}}});hi.addInitHook("addHandler","keyboard",Hl),hi.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var Wl=Bn.extend({addHooks:function(){Ht(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Dt(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(u){var v=Po(u),E=this._map.options.wheelDebounceTime;this._delta+=v,this._lastMousePos=this._map.mouseEventToContainerPoint(u),this._startTime||(this._startTime=+new Date);var R=Math.max(E-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(W(this._performZoom,this),R),$n(u)},_performZoom:function(){var u=this._map,v=u.getZoom(),E=this._map.options.zoomSnap||0;u._stop();var R=this._delta/(this._map.options.wheelPxPerZoomLevel*4),q=4*Math.log(2/(1+Math.exp(-Math.abs(R))))/Math.LN2,ne=E?Math.ceil(q/E)*E:q,Ee=u._limitZoom(v+(this._delta>0?ne:-ne))-v;this._delta=0,this._startTime=null,Ee&&(u.options.scrollWheelZoom==="center"?u.setZoom(v+Ee):u.setZoomAround(this._lastMousePos,v+Ee))}});hi.addInitHook("addHandler","scrollWheelZoom",Wl);var Ql=600;hi.mergeOptions({tapHold:o.touchNative&&o.safari&&o.mobile,tapTolerance:15});var $l=Bn.extend({addHooks:function(){Ht(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Dt(this._map._container,"touchstart",this._onDown,this)},_onDown:function(u){if(clearTimeout(this._holdTimeout),u.touches.length===1){var v=u.touches[0];this._startPos=this._newPos=new ti(v.clientX,v.clientY),this._holdTimeout=setTimeout(W(function(){this._cancel(),this._isTapValid()&&(Ht(document,"touchend",Si),Ht(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",v))},this),Ql),Ht(document,"touchend touchcancel contextmenu",this._cancel,this),Ht(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function u(){Dt(document,"touchend",Si),Dt(document,"touchend touchcancel",u)},_cancel:function(){clearTimeout(this._holdTimeout),Dt(document,"touchend touchcancel contextmenu",this._cancel,this),Dt(document,"touchmove",this._onMove,this)},_onMove:function(u){var v=u.touches[0];this._newPos=new ti(v.clientX,v.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(u,v){var E=new MouseEvent(u,{bubbles:!0,cancelable:!0,view:window,screenX:v.screenX,screenY:v.screenY,clientX:v.clientX,clientY:v.clientY});E._simulated=!0,v.target.dispatchEvent(E)}});hi.addInitHook("addHandler","tapHold",$l),hi.mergeOptions({touchZoom:o.touch,bounceAtZoomLimits:!0});var ol=Bn.extend({addHooks:function(){_i(this._map._container,"leaflet-touch-zoom"),Ht(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Sr(this._map._container,"leaflet-touch-zoom"),Dt(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(u){var v=this._map;if(!(!u.touches||u.touches.length!==2||v._animatingZoom||this._zooming)){var E=v.mouseEventToContainerPoint(u.touches[0]),R=v.mouseEventToContainerPoint(u.touches[1]);this._centerPoint=v.getSize()._divideBy(2),this._startLatLng=v.containerPointToLatLng(this._centerPoint),v.options.touchZoom!=="center"&&(this._pinchStartLatLng=v.containerPointToLatLng(E.add(R)._divideBy(2))),this._startDist=E.distanceTo(R),this._startZoom=v.getZoom(),this._moved=!1,this._zooming=!0,v._stop(),Ht(document,"touchmove",this._onTouchMove,this),Ht(document,"touchend touchcancel",this._onTouchEnd,this),Si(u)}},_onTouchMove:function(u){if(!(!u.touches||u.touches.length!==2||!this._zooming)){var v=this._map,E=v.mouseEventToContainerPoint(u.touches[0]),R=v.mouseEventToContainerPoint(u.touches[1]),q=E.distanceTo(R)/this._startDist;if(this._zoom=v.getScaleZoom(q,this._startZoom),!v.options.bounceAtZoomLimits&&(this._zoom<v.getMinZoom()&&q<1||this._zoom>v.getMaxZoom()&&q>1)&&(this._zoom=v._limitZoom(this._zoom)),v.options.touchZoom==="center"){if(this._center=this._startLatLng,q===1)return}else{var ne=E._add(R)._divideBy(2)._subtract(this._centerPoint);if(q===1&&ne.x===0&&ne.y===0)return;this._center=v.unproject(v.project(this._pinchStartLatLng,this._zoom).subtract(ne),this._zoom)}this._moved||(v._moveStart(!0,!1),this._moved=!0),Ji(this._animRequest);var Ee=W(v._move,v,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=cr(Ee,this,!0),Si(u)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,Ji(this._animRequest),Dt(document,"touchmove",this._onTouchMove,this),Dt(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});hi.addInitHook("addHandler","touchZoom",ol),hi.BoxZoom=El,hi.DoubleClickZoom=Fs,hi.Drag=Jo,hi.Keyboard=Hl,hi.ScrollWheelZoom=Wl,hi.TapHold=$l,hi.TouchZoom=ol,fe.Bounds=Ni,fe.Browser=o,fe.CRS=hn,fe.Canvas=ya,fe.Circle=ma,fe.CircleMarker=uo,fe.Class=Cn,fe.Control=nn,fe.DivIcon=_a,fe.DivOverlay=sn,fe.DomEvent=Vl,fe.DomUtil=Wn,fe.Draggable=xr,fe.Evented=Hr,fe.FeatureGroup=cs,fe.GeoJSON=As,fe.GridLayer=fn,fe.Handler=Bn,fe.Icon=Hs,fe.ImageOverlay=Ra,fe.LatLng=xi,fe.LatLngBounds=Wr,fe.Layer=Rn,fe.LayerGroup=$o,fe.LineUtil=Eo,fe.Map=hi,fe.Marker=Qs,fe.Mixin=Wo,fe.Path=Bs,fe.Point=ti,fe.PolyUtil=yl,fe.Polygon=yn,fe.Polyline=Ir,fe.Popup=$r,fe.PosAnimation=Qr,fe.Projection=hu,fe.Rectangle=gi,fe.Renderer=es,fe.SVG=ba,fe.SVGOverlay=tl,fe.TileLayer=Ko,fe.Tooltip=Xs,fe.Transformation=No,fe.Util=Sn,fe.VideoOverlay=el,fe.bind=W,fe.bounds=Mr,fe.canvas=Oa,fe.circle=cu,fe.circleMarker=Ul,fe.control=wi,fe.divIcon=ga,fe.extend=We,fe.featureGroup=wl,fe.geoJSON=Ja,fe.geoJson=Pl,fe.gridLayer=ql,fe.icon=Xa,fe.imageOverlay=Au,fe.latLng=Ai,fe.latLngBounds=or,fe.layerGroup=Zl,fe.map=bi,fe.marker=Tl,fe.point=Yt,fe.polygon=Gl,fe.polyline=Ka,fe.popup=il,fe.rectangle=sl,fe.setOptions=Gt,fe.stamp=it,fe.svg=nl,fe.svgOverlay=Ii,fe.tileLayer=rl,fe.tooltip=Xo,fe.transformation=In,fe.version=Re,fe.videoOverlay=Ml;var ds=window.L;fe.noConflict=function(){return window.L=ds,this},window.L=fe}))})(Zh,Zh.exports)),Zh.exports}var ep=Wm();const Qm=Jd(ep),Pg=Kd({__proto__:null,default:Qm},[ep]);var et=(function(xe){xe=xe||{};var J=typeof xe<"u"?xe:{},fe={},Re;for(Re in J)J.hasOwnProperty(Re)&&(fe[Re]=J[Re]);var We="";function ct(Ve){return J.locateFile?J.locateFile(Ve,We):We+Ve}var W;typeof document<"u"&&document.currentScript&&(We=document.currentScript.src),We.indexOf("blob:")!==0?We=We.substr(0,We.lastIndexOf("/")+1):We="",W=function(at,It,At){var o=new XMLHttpRequest;o.open("GET",at,!0),o.responseType="arraybuffer",o.onload=function(){if(o.status==200||o.status==0&&o.response){It(o.response);return}var ii=ft(at);if(ii){It(ii.buffer);return}At()},o.onerror=At,o.send(null)};var p=J.print||console.log.bind(console),it=J.printErr||console.warn.bind(console);for(Re in fe)fe.hasOwnProperty(Re)&&(J[Re]=fe[Re]);fe=null,J.arguments&&J.arguments;var ur=0,fr=function(Ve){ur=Ve},Zi=function(){return ur},un=8;function zr(Ve,at,It,At){switch(It=It||"i8",It.charAt(It.length-1)==="*"&&(It="i32"),It){case"i1":Ji[Ve>>0]=at;break;case"i8":Ji[Ve>>0]=at;break;case"i16":Cn[Ve>>1]=at;break;case"i32":Un[Ve>>2]=at;break;case"i64":mn=[at>>>0,(Ds=at,+Vo(Ds)>=1?Ds>0?(Is(+hs(Ds/4294967296),4294967295)|0)>>>0:~~+en((Ds-+(~~Ds>>>0))/4294967296)>>>0:0)],Un[Ve>>2]=mn[0],Un[Ve+4>>2]=mn[1];break;case"float":Jr[Ve>>2]=at;break;case"double":Hr[Ve>>3]=at;break;default:er("invalid type for setValue: "+It)}}function Mn(Ve,at,It){switch(at=at||"i8",at.charAt(at.length-1)==="*"&&(at="i32"),at){case"i1":return Ji[Ve>>0];case"i8":return Ji[Ve>>0];case"i16":return Cn[Ve>>1];case"i32":return Un[Ve>>2];case"i64":return Un[Ve>>2];case"float":return Jr[Ve>>2];case"double":return Hr[Ve>>3];default:er("invalid type for getValue: "+at)}return null}var Gt=!1;function rt(Ve,at){Ve||er("Assertion failed: "+at)}function Fo(Ve){var at=J["_"+Ve];return rt(at,"Cannot call unknown function "+Ve+", make sure it is exported"),at}function hr(Ve,at,It,At,o){var X={string:function(di){var jr=0;if(di!=null&&di!==0){var ni=(di.length<<2)+1;jr=Gi(ni),Oo(di,jr,ni)}return jr},array:function(di){var jr=Gi(di.length);return Vs(di,jr),jr}};function ii(di){return at==="string"?Ns(di):at==="boolean"?!!di:di}var Ri=Fo(Ve),Qi=[],ut=0;if(At)for(var zt=0;zt<At.length;zt++){var $t=X[It[zt]];$t?(ut===0&&(ut=qe()),Qi[zt]=$t(At[zt])):Qi[zt]=At[zt]}var fi=Ri.apply(null,Qi);return fi=ii(fi),ut!==0&&Bi(ut),fi}function zi(Ve,at,It,At){It=It||[];var o=It.every(function(ii){return ii==="number"}),X=at!=="string";return X&&o&&!At?Fo(Ve):function(){return hr(Ve,at,It,arguments)}}var ro=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function no(Ve,at,It){for(var At=at+It,o=at;Ve[o]&&!(o>=At);)++o;if(o-at>16&&Ve.subarray&&ro)return ro.decode(Ve.subarray(at,o));for(var X="";at<o;){var ii=Ve[at++];if(!(ii&128)){X+=String.fromCharCode(ii);continue}var Ri=Ve[at++]&63;if((ii&224)==192){X+=String.fromCharCode((ii&31)<<6|Ri);continue}var Qi=Ve[at++]&63;if((ii&240)==224?ii=(ii&15)<<12|Ri<<6|Qi:ii=(ii&7)<<18|Ri<<12|Qi<<6|Ve[at++]&63,ii<65536)X+=String.fromCharCode(ii);else{var ut=ii-65536;X+=String.fromCharCode(55296|ut>>10,56320|ut&1023)}}return X}function Ns(Ve,at){return Ve?no(Sn,Ve,at):""}function En(Ve,at,It,At){if(!(At>0))return 0;for(var o=It,X=It+At-1,ii=0;ii<Ve.length;++ii){var Ri=Ve.charCodeAt(ii);if(Ri>=55296&&Ri<=57343){var Qi=Ve.charCodeAt(++ii);Ri=65536+((Ri&1023)<<10)|Qi&1023}if(Ri<=127){if(It>=X)break;at[It++]=Ri}else if(Ri<=2047){if(It+1>=X)break;at[It++]=192|Ri>>6,at[It++]=128|Ri&63}else if(Ri<=65535){if(It+2>=X)break;at[It++]=224|Ri>>12,at[It++]=128|Ri>>6&63,at[It++]=128|Ri&63}else{if(It+3>=X)break;at[It++]=240|Ri>>18,at[It++]=128|Ri>>12&63,at[It++]=128|Ri>>6&63,at[It++]=128|Ri&63}}return at[It]=0,It-o}function Oo(Ve,at,It){return En(Ve,Sn,at,It)}typeof TextDecoder<"u"&&new TextDecoder("utf-16le");function Vs(Ve,at){Ji.set(Ve,at)}function Cs(Ve,at){return Ve%at>0&&(Ve+=at-Ve%at),Ve}var cr,Ji,Sn,Cn,Un,Jr,Hr;function ti(Ve){cr=Ve,J.HEAP8=Ji=new Int8Array(Ve),J.HEAP16=Cn=new Int16Array(Ve),J.HEAP32=Un=new Int32Array(Ve),J.HEAPU8=Sn=new Uint8Array(Ve),J.HEAPU16=new Uint16Array(Ve),J.HEAPU32=new Uint32Array(Ve),J.HEAPF32=Jr=new Float32Array(Ve),J.HEAPF64=Hr=new Float64Array(Ve)}var Oi=5271536,Yt=28624,Ni=J.TOTAL_MEMORY||33554432;J.buffer?cr=J.buffer:cr=new ArrayBuffer(Ni),Ni=cr.byteLength,ti(cr),Un[Yt>>2]=Oi;function Mr(Ve){for(;Ve.length>0;){var at=Ve.shift();if(typeof at=="function"){at();continue}var It=at.func;typeof It=="number"?at.arg===void 0?J.dynCall_v(It):J.dynCall_vi(It,at.arg):It(at.arg===void 0?null:at.arg)}}var Wr=[],or=[],xi=[],Ai=[];function hn(){if(J.preRun)for(typeof J.preRun=="function"&&(J.preRun=[J.preRun]);J.preRun.length;)No(J.preRun.shift());Mr(Wr)}function Er(){Mr(or)}function yo(){Mr(xi)}function us(){if(J.postRun)for(typeof J.postRun=="function"&&(J.postRun=[J.postRun]);J.postRun.length;)In(J.postRun.shift());Mr(Ai)}function No(Ve){Wr.unshift(Ve)}function In(Ve){Ai.unshift(Ve)}var Vo=Math.abs,en=Math.ceil,hs=Math.floor,Is=Math.min,Ui=0,Dn=null;function jo(Ve){Ui++,J.monitorRunDependencies&&J.monitorRunDependencies(Ui)}function Zo(Ve){if(Ui--,J.monitorRunDependencies&&J.monitorRunDependencies(Ui),Ui==0&&Dn){var at=Dn;Dn=null,at()}}J.preloadedImages={},J.preloadedAudios={};var tn=null,Gn="data:application/octet-stream;base64,";function vo(Ve){return String.prototype.startsWith?Ve.startsWith(Gn):Ve.indexOf(Gn)===0}var Ds,mn;tn="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAYAAAAAAAAAAwAAAAIAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAABAAAAAAAAAABAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAgAAAAQAAAADAAAACAAAAAEAAAAHAAAABgAAAAkAAAAAAAAAAwAAAAIAAAACAAAABgAAAAoAAAALAAAAAAAAAAEAAAAFAAAAAwAAAA0AAAABAAAABwAAAAQAAAAMAAAAAAAAAAQAAAB/AAAADwAAAAgAAAADAAAAAAAAAAwAAAAFAAAAAgAAABIAAAAKAAAACAAAAAAAAAAQAAAABgAAAA4AAAALAAAAEQAAAAEAAAAJAAAAAgAAAAcAAAAVAAAACQAAABMAAAADAAAADQAAAAEAAAAIAAAABQAAABYAAAAQAAAABAAAAAAAAAAPAAAACQAAABMAAAAOAAAAFAAAAAEAAAAHAAAABgAAAAoAAAALAAAAGAAAABcAAAAFAAAAAgAAABIAAAALAAAAEQAAABcAAAAZAAAAAgAAAAYAAAAKAAAADAAAABwAAAANAAAAGgAAAAQAAAAPAAAAAwAAAA0AAAAaAAAAFQAAAB0AAAADAAAADAAAAAcAAAAOAAAAfwAAABEAAAAbAAAACQAAABQAAAAGAAAADwAAABYAAAAcAAAAHwAAAAQAAAAIAAAADAAAABAAAAASAAAAIQAAAB4AAAAIAAAABQAAABYAAAARAAAACwAAAA4AAAAGAAAAIwAAABkAAAAbAAAAEgAAABgAAAAeAAAAIAAAAAUAAAAKAAAAEAAAABMAAAAiAAAAFAAAACQAAAAHAAAAFQAAAAkAAAAUAAAADgAAABMAAAAJAAAAKAAAABsAAAAkAAAAFQAAACYAAAATAAAAIgAAAA0AAAAdAAAABwAAABYAAAAQAAAAKQAAACEAAAAPAAAACAAAAB8AAAAXAAAAGAAAAAsAAAAKAAAAJwAAACUAAAAZAAAAGAAAAH8AAAAgAAAAJQAAAAoAAAAXAAAAEgAAABkAAAAXAAAAEQAAAAsAAAAtAAAAJwAAACMAAAAaAAAAKgAAAB0AAAArAAAADAAAABwAAAANAAAAGwAAACgAAAAjAAAALgAAAA4AAAAUAAAAEQAAABwAAAAfAAAAKgAAACwAAAAMAAAADwAAABoAAAAdAAAAKwAAACYAAAAvAAAADQAAABoAAAAVAAAAHgAAACAAAAAwAAAAMgAAABAAAAASAAAAIQAAAB8AAAApAAAALAAAADUAAAAPAAAAFgAAABwAAAAgAAAAHgAAABgAAAASAAAANAAAADIAAAAlAAAAIQAAAB4AAAAxAAAAMAAAABYAAAAQAAAAKQAAACIAAAATAAAAJgAAABUAAAA2AAAAJAAAADMAAAAjAAAALgAAAC0AAAA4AAAAEQAAABsAAAAZAAAAJAAAABQAAAAiAAAAEwAAADcAAAAoAAAANgAAACUAAAAnAAAANAAAADkAAAAYAAAAFwAAACAAAAAmAAAAfwAAACIAAAAzAAAAHQAAAC8AAAAVAAAAJwAAACUAAAAZAAAAFwAAADsAAAA5AAAALQAAACgAAAAbAAAAJAAAABQAAAA8AAAALgAAADcAAAApAAAAMQAAADUAAAA9AAAAFgAAACEAAAAfAAAAKgAAADoAAAArAAAAPgAAABwAAAAsAAAAGgAAACsAAAA+AAAALwAAAEAAAAAaAAAAKgAAAB0AAAAsAAAANQAAADoAAABBAAAAHAAAAB8AAAAqAAAALQAAACcAAAAjAAAAGQAAAD8AAAA7AAAAOAAAAC4AAAA8AAAAOAAAAEQAAAAbAAAAKAAAACMAAAAvAAAAJgAAACsAAAAdAAAARQAAADMAAABAAAAAMAAAADEAAAAeAAAAIQAAAEMAAABCAAAAMgAAADEAAAB/AAAAPQAAAEIAAAAhAAAAMAAAACkAAAAyAAAAMAAAACAAAAAeAAAARgAAAEMAAAA0AAAAMwAAAEUAAAA2AAAARwAAACYAAAAvAAAAIgAAADQAAAA5AAAARgAAAEoAAAAgAAAAJQAAADIAAAA1AAAAPQAAAEEAAABLAAAAHwAAACkAAAAsAAAANgAAAEcAAAA3AAAASQAAACIAAAAzAAAAJAAAADcAAAAoAAAANgAAACQAAABIAAAAPAAAAEkAAAA4AAAARAAAAD8AAABNAAAAIwAAAC4AAAAtAAAAOQAAADsAAABKAAAATgAAACUAAAAnAAAANAAAADoAAAB/AAAAPgAAAEwAAAAsAAAAQQAAACoAAAA7AAAAPwAAAE4AAABPAAAAJwAAAC0AAAA5AAAAPAAAAEgAAABEAAAAUAAAACgAAAA3AAAALgAAAD0AAAA1AAAAMQAAACkAAABRAAAASwAAAEIAAAA+AAAAKwAAADoAAAAqAAAAUgAAAEAAAABMAAAAPwAAAH8AAAA4AAAALQAAAE8AAAA7AAAATQAAAEAAAAAvAAAAPgAAACsAAABUAAAARQAAAFIAAABBAAAAOgAAADUAAAAsAAAAVgAAAEwAAABLAAAAQgAAAEMAAABRAAAAVQAAADEAAAAwAAAAPQAAAEMAAABCAAAAMgAAADAAAABXAAAAVQAAAEYAAABEAAAAOAAAADwAAAAuAAAAWgAAAE0AAABQAAAARQAAADMAAABAAAAALwAAAFkAAABHAAAAVAAAAEYAAABDAAAANAAAADIAAABTAAAAVwAAAEoAAABHAAAAWQAAAEkAAABbAAAAMwAAAEUAAAA2AAAASAAAAH8AAABJAAAANwAAAFAAAAA8AAAAWAAAAEkAAABbAAAASAAAAFgAAAA2AAAARwAAADcAAABKAAAATgAAAFMAAABcAAAANAAAADkAAABGAAAASwAAAEEAAAA9AAAANQAAAF4AAABWAAAAUQAAAEwAAABWAAAAUgAAAGAAAAA6AAAAQQAAAD4AAABNAAAAPwAAAEQAAAA4AAAAXQAAAE8AAABaAAAATgAAAEoAAAA7AAAAOQAAAF8AAABcAAAATwAAAE8AAABOAAAAPwAAADsAAABdAAAAXwAAAE0AAABQAAAARAAAAEgAAAA8AAAAYwAAAFoAAABYAAAAUQAAAFUAAABeAAAAZQAAAD0AAABCAAAASwAAAFIAAABgAAAAVAAAAGIAAAA+AAAATAAAAEAAAABTAAAAfwAAAEoAAABGAAAAZAAAAFcAAABcAAAAVAAAAEUAAABSAAAAQAAAAGEAAABZAAAAYgAAAFUAAABXAAAAZQAAAGYAAABCAAAAQwAAAFEAAABWAAAATAAAAEsAAABBAAAAaAAAAGAAAABeAAAAVwAAAFMAAABmAAAAZAAAAEMAAABGAAAAVQAAAFgAAABIAAAAWwAAAEkAAABjAAAAUAAAAGkAAABZAAAAYQAAAFsAAABnAAAARQAAAFQAAABHAAAAWgAAAE0AAABQAAAARAAAAGoAAABdAAAAYwAAAFsAAABJAAAAWQAAAEcAAABpAAAAWAAAAGcAAABcAAAAUwAAAE4AAABKAAAAbAAAAGQAAABfAAAAXQAAAE8AAABaAAAATQAAAG0AAABfAAAAagAAAF4AAABWAAAAUQAAAEsAAABrAAAAaAAAAGUAAABfAAAAXAAAAE8AAABOAAAAbQAAAGwAAABdAAAAYAAAAGgAAABiAAAAbgAAAEwAAABWAAAAUgAAAGEAAAB/AAAAYgAAAFQAAABnAAAAWQAAAG8AAABiAAAAbgAAAGEAAABvAAAAUgAAAGAAAABUAAAAYwAAAFAAAABpAAAAWAAAAGoAAABaAAAAcQAAAGQAAABmAAAAUwAAAFcAAABsAAAAcgAAAFwAAABlAAAAZgAAAGsAAABwAAAAUQAAAFUAAABeAAAAZgAAAGUAAABXAAAAVQAAAHIAAABwAAAAZAAAAGcAAABbAAAAYQAAAFkAAAB0AAAAaQAAAG8AAABoAAAAawAAAG4AAABzAAAAVgAAAF4AAABgAAAAaQAAAFgAAABnAAAAWwAAAHEAAABjAAAAdAAAAGoAAABdAAAAYwAAAFoAAAB1AAAAbQAAAHEAAABrAAAAfwAAAGUAAABeAAAAcwAAAGgAAABwAAAAbAAAAGQAAABfAAAAXAAAAHYAAAByAAAAbQAAAG0AAABsAAAAXQAAAF8AAAB1AAAAdgAAAGoAAABuAAAAYgAAAGgAAABgAAAAdwAAAG8AAABzAAAAbwAAAGEAAABuAAAAYgAAAHQAAABnAAAAdwAAAHAAAABrAAAAZgAAAGUAAAB4AAAAcwAAAHIAAABxAAAAYwAAAHQAAABpAAAAdQAAAGoAAAB5AAAAcgAAAHAAAABkAAAAZgAAAHYAAAB4AAAAbAAAAHMAAABuAAAAawAAAGgAAAB4AAAAdwAAAHAAAAB0AAAAZwAAAHcAAABvAAAAcQAAAGkAAAB5AAAAdQAAAH8AAABtAAAAdgAAAHEAAAB5AAAAagAAAHYAAAB4AAAAbAAAAHIAAAB1AAAAeQAAAG0AAAB3AAAAbwAAAHMAAABuAAAAeQAAAHQAAAB4AAAAeAAAAHMAAAByAAAAcAAAAHkAAAB3AAAAdgAAAHkAAAB0AAAAeAAAAHcAAAB1AAAAcQAAAHYAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAACAAAABQAAAAEAAAAAAAAA/////wEAAAAAAAAAAwAAAAQAAAACAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAUAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABAAAAAUAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAUAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAD//////////wEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAAAAAAAAAAABAAAAAgAAAAYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAFAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAGAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADgAAAAIAAAAAAAAAAAAAAAEAAAAAAAAACQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAAAAAAAAAAAAAEAAAAEAAAACAAAAAoAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAAAAAAAAAAAAQAAAAsAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAIAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAAAAAAAAAAAAQAAAAwAAAAQAAAADAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAAAAAAAAAAABAAAACgAAABMAAAAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAEAAAANAAAAEQAAAA0AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAAAAAAABAAAADgAAABIAAAAPAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAADwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAAAAAAAAQAAAP//////////EwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAASAAAAAAAAABgAAAAAAAAAIQAAAAAAAAAeAAAAAAAAACAAAAADAAAAMQAAAAEAAAAwAAAAAwAAADIAAAADAAAACAAAAAAAAAAFAAAABQAAAAoAAAAFAAAAFgAAAAAAAAAQAAAAAAAAABIAAAAAAAAAKQAAAAEAAAAhAAAAAAAAAB4AAAAAAAAABAAAAAAAAAAAAAAABQAAAAIAAAAFAAAADwAAAAEAAAAIAAAAAAAAAAUAAAAFAAAAHwAAAAEAAAAWAAAAAAAAABAAAAAAAAAAAgAAAAAAAAAGAAAAAAAAAA4AAAAAAAAACgAAAAAAAAALAAAAAAAAABEAAAADAAAAGAAAAAEAAAAXAAAAAwAAABkAAAADAAAAAAAAAAAAAAABAAAABQAAAAkAAAAFAAAABQAAAAAAAAACAAAAAAAAAAYAAAAAAAAAEgAAAAEAAAAKAAAAAAAAAAsAAAAAAAAABAAAAAEAAAADAAAABQAAAAcAAAAFAAAACAAAAAEAAAAAAAAAAAAAAAEAAAAFAAAAEAAAAAEAAAAFAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAVAAAAAAAAACYAAAAAAAAACQAAAAAAAAATAAAAAAAAACIAAAADAAAADgAAAAEAAAAUAAAAAwAAACQAAAADAAAAAwAAAAAAAAANAAAABQAAAB0AAAAFAAAAAQAAAAAAAAAHAAAAAAAAABUAAAAAAAAABgAAAAEAAAAJAAAAAAAAABMAAAAAAAAABAAAAAIAAAAMAAAABQAAABoAAAAFAAAAAAAAAAEAAAADAAAAAAAAAA0AAAAFAAAAAgAAAAEAAAABAAAAAAAAAAcAAAAAAAAAGgAAAAAAAAAqAAAAAAAAADoAAAAAAAAAHQAAAAAAAAArAAAAAAAAAD4AAAADAAAAJgAAAAEAAAAvAAAAAwAAAEAAAAADAAAADAAAAAAAAAAcAAAABQAAACwAAAAFAAAADQAAAAAAAAAaAAAAAAAAACoAAAAAAAAAFQAAAAEAAAAdAAAAAAAAACsAAAAAAAAABAAAAAMAAAAPAAAABQAAAB8AAAAFAAAAAwAAAAEAAAAMAAAAAAAAABwAAAAFAAAABwAAAAEAAAANAAAAAAAAABoAAAAAAAAAHwAAAAAAAAApAAAAAAAAADEAAAAAAAAALAAAAAAAAAA1AAAAAAAAAD0AAAADAAAAOgAAAAEAAABBAAAAAwAAAEsAAAADAAAADwAAAAAAAAAWAAAABQAAACEAAAAFAAAAHAAAAAAAAAAfAAAAAAAAACkAAAAAAAAAKgAAAAEAAAAsAAAAAAAAADUAAAAAAAAABAAAAAQAAAAIAAAABQAAABAAAAAFAAAADAAAAAEAAAAPAAAAAAAAABYAAAAFAAAAGgAAAAEAAAAcAAAAAAAAAB8AAAAAAAAAMgAAAAAAAAAwAAAAAAAAADEAAAADAAAAIAAAAAAAAAAeAAAAAwAAACEAAAADAAAAGAAAAAMAAAASAAAAAwAAABAAAAADAAAARgAAAAAAAABDAAAAAAAAAEIAAAADAAAANAAAAAMAAAAyAAAAAAAAADAAAAAAAAAAJQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAUwAAAAAAAABXAAAAAwAAAFUAAAADAAAASgAAAAMAAABGAAAAAAAAAEMAAAAAAAAAOQAAAAEAAAA0AAAAAwAAADIAAAAAAAAAGQAAAAAAAAAXAAAAAAAAABgAAAADAAAAEQAAAAAAAAALAAAAAwAAAAoAAAADAAAADgAAAAMAAAAGAAAAAwAAAAIAAAADAAAALQAAAAAAAAAnAAAAAAAAACUAAAADAAAAIwAAAAMAAAAZAAAAAAAAABcAAAAAAAAAGwAAAAMAAAARAAAAAAAAAAsAAAADAAAAPwAAAAAAAAA7AAAAAwAAADkAAAADAAAAOAAAAAMAAAAtAAAAAAAAACcAAAAAAAAALgAAAAMAAAAjAAAAAwAAABkAAAAAAAAAJAAAAAAAAAAUAAAAAAAAAA4AAAADAAAAIgAAAAAAAAATAAAAAwAAAAkAAAADAAAAJgAAAAMAAAAVAAAAAwAAAAcAAAADAAAANwAAAAAAAAAoAAAAAAAAABsAAAADAAAANgAAAAMAAAAkAAAAAAAAABQAAAAAAAAAMwAAAAMAAAAiAAAAAAAAABMAAAADAAAASAAAAAAAAAA8AAAAAwAAAC4AAAADAAAASQAAAAMAAAA3AAAAAAAAACgAAAAAAAAARwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAQAAAAAAAAAAvAAAAAAAAACYAAAADAAAAPgAAAAAAAAArAAAAAwAAAB0AAAADAAAAOgAAAAMAAAAqAAAAAwAAABoAAAADAAAAVAAAAAAAAABFAAAAAAAAADMAAAADAAAAUgAAAAMAAABAAAAAAAAAAC8AAAAAAAAATAAAAAMAAAA+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE4AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAH6iBfbytuk/Gq6akm/58z/Xrm0Liez0P5doSdOpSwRAWs602ULg8D/dT7Rcbo/1v1N1RQHFNOM/g9Snx7HW3L8HWsP8Q3jfP6VwOLosutk/9rjk1YQcxj+gnmKMsNn6P/HDeuPFY+M/YHwDjqKhB0Ci19/fCVrbP4UxKkDWOP6/pvljWa09tL9wi7wrQXjnv/Z6yLImkM2/3yTlOzY14D+m+WNZrT20PzwKVQnrQwNA9nrIsiaQzT/g40rFrRQFwPa45NWEHMa/kbslHEZq97/xw3rjxWPjv4cLC2SMBci/otff3wla27+rKF5oIAv0P1N1RQHFNOO/iDJPGyWHBUAHWsP8Q3jfvwQf/by16gXAfqIF9vK26b8XrO0Vh0r+v9eubQuJ7PS/BxLrA0ZZ479azrTZQuDwv1MK1EuItPw/yscgV9Z6FkAwHBR2WjQMQJNRzXsQ5vY/GlUHVJYKF0DONuFv2lMNQNCGZ28QJfk/0WUwoIL36D8ggDOMQuATQNqMOeAy/wZAWFYOYM+M2z/LWC4uH3oSQDE+LyTsMgRAkJzhRGWFGEDd4soovCQQQKqk0DJMEP8/rGmNdwOLBUAW2X/9xCbjP4hu3dcqJhNAzuYItRvdB0CgzW3zJW/sPxotm/Y2TxRAQAk9XmdDDEC1Kx9MKgT3P1M+NctcghZAFVqcLlb0C0Bgzd3sB2b2P77mZDPUWhZAFROHJpUGCEDAfma5CxXtPz1DWq/zYxRAmhYY5824F0DOuQKWSbAOQNCMqrvu3fs/L6DR22K2wT9nAAxPBU8RQGiN6mW43AFAZhu25b633D8c1YgmzowSQNM25BRKWARArGS08/lNxD+LFssHwmMRQLC5aNcxBgJABL9HT0WRF0CjCmJmOGEOQHsuaVzMP/s/TWJCaGGwBUCeu1PAPLzjP9nqN9DZOBNAKE4JcydbCkCGtbd1qjPzP8dgm9U8jhVAtPeKTkVwDkCeCLss5l37P401XMPLmBdAFd29VMVQDUBg0yA55h75Pz6odcYLCRdApBM4rBrkAkDyAVWgQxbRP4XDMnK20hFAymLlF7EmzD8GUgo9XBHlP3lbK7T9COc/k+OhPthhy7+YGEpnrOvCPzBFhLs15u4/epbqB6H4uz9IuuLF5svev6lzLKY31es/CaQ0envF5z8ZY0xlUADXv7zaz7HYEuI/CfbK1sn16T8uAQfWwxLWPzKn/YuFN94/5KdbC1AFu793fyCSnlfvPzK2y4doAMY/NRg5t1/X6b/shq4QJaHDP5yNIAKPOeI/vpn7BSE30r/X4YQrO6nrv78Ziv/Thto/DqJ1Y6+y5z9l51NaxFrlv8QlA65HOLS/86dxiEc96z+Hj0+LFjneP6LzBZ8LTc2/DaJ1Y6+y579l51NaxFrlP8QlA65HOLQ/8qdxiEc967+Jj0+LFjnev6LzBZ8LTc0/1qdbC1AFuz93fyCSnlfvvzK2y4doAMa/NRg5t1/X6T/vhq4QJaHDv5yNIAKPOeK/wJn7BSE30j/W4YQrO6nrP78Ziv/Thtq/CaQ0envF578XY0xlUADXP7zaz7HYEuK/CvbK1sn16b8rAQfWwxLWvzKn/YuFN96/zWLlF7EmzL8GUgo9XBHlv3lbK7T9COe/kOOhPthhyz+cGEpnrOvCvzBFhLs15u6/c5bqB6H4u79IuuLF5sveP6lzLKY31eu/AQAAAP////8HAAAA/////zEAAAD/////VwEAAP////9hCQAA/////6dBAAD/////kcsBAP/////3kAwA/////8H2VwAAAAAAAAAAAAAAAAACAAAA/////w4AAAD/////YgAAAP////+uAgAA/////8ISAAD/////ToMAAP////8ilwMA/////+4hGQD/////gu2vAAAAAAAAAAAAAAAAAAAAAAACAAAA//////////8BAAAAAwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////////////////////AQAAAAAAAAACAAAA////////////////AwAAAP//////////////////////////////////////////////////////////AgAAAP//////////AQAAAAAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD/////////////////////AQAAAP///////////////wIAAAD///////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAD///////////////8CAAAAAQAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8BAAAAAgAAAP///////////////wAAAAD/////////////////////AwAAAP///////////////////////////////wIAAAD///////////////8BAAAA/////////////////////wAAAAD/////////////////////AwAAAP////////////////////////////////////////////////////8DAAAA/////////////////////wAAAAABAAAA//////////8CAAAA//////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAA////////////////AgAAAAAAAAABAAAA//////////////////////////////////////////////////////////////////////////8DAAAAAQAAAP//////////AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAACAAAAAAAAAAIAAAABAAAAAQAAAAIAAAACAAAAAAAAAAUAAAAFAAAAAAAAAAIAAAACAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAEAAAACAAAAAgAAAAIAAAAAAAAABQAAAAYAAAAAAAAAAgAAAAIAAAADAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAAAAAACAAAAAQAAAAMAAAACAAAAAgAAAAAAAAAFAAAABwAAAAAAAAACAAAAAgAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAAAAAAAAAAIAAAABAAAABAAAAAIAAAACAAAAAAAAAAUAAAAIAAAAAAAAAAIAAAACAAAAAwAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAIAAAAAAAAAAgAAAAEAAAAAAAAAAgAAAAIAAAAAAAAABQAAAAkAAAAAAAAAAgAAAAIAAAADAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAIAAAAAAAAAAwAAAA4AAAACAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAgAAAAMAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAgAAAAAAAAADAAAACgAAAAIAAAAAAAAAAgAAAAMAAAABAAAAAAAAAAIAAAACAAAAAwAAAAcAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAIAAAACAAAAAAAAAAMAAAALAAAAAgAAAAAAAAACAAAAAwAAAAIAAAAAAAAAAgAAAAIAAAADAAAACAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAgAAAAIAAAAAAAAAAwAAAAwAAAACAAAAAAAAAAIAAAADAAAAAwAAAAAAAAACAAAAAgAAAAMAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAACAAAAAgAAAAAAAAADAAAADQAAAAIAAAAAAAAAAgAAAAMAAAAEAAAAAAAAAAIAAAACAAAAAwAAAAoAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAIAAAACAAAAAAAAAAMAAAAGAAAAAgAAAAAAAAACAAAAAwAAAA8AAAAAAAAAAgAAAAIAAAADAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAIAAAAAAAAAAwAAAAcAAAACAAAAAAAAAAIAAAADAAAAEAAAAAAAAAACAAAAAgAAAAMAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAACAAAAAgAAAAAAAAADAAAACAAAAAIAAAAAAAAAAgAAAAMAAAARAAAAAAAAAAIAAAACAAAAAwAAAA0AAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAACAAAAAAAAAAMAAAAJAAAAAgAAAAAAAAACAAAAAwAAABIAAAAAAAAAAgAAAAIAAAADAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAgAAAAIAAAAAAAAAAwAAAAUAAAACAAAAAAAAAAIAAAADAAAAEwAAAAAAAAACAAAAAgAAAAMAAAAPAAAAAAAAAAAAAAAAAAAAAAAAABAAAAACAAAAAAAAAAIAAAABAAAAEwAAAAIAAAACAAAAAAAAAAUAAAAKAAAAAAAAAAIAAAACAAAAAwAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAIAAAAAAAAAAgAAAAEAAAAPAAAAAgAAAAIAAAAAAAAABQAAAAsAAAAAAAAAAgAAAAIAAAADAAAAEQAAAAAAAAAAAAAAAAAAAAAAAAASAAAAAgAAAAAAAAACAAAAAQAAABAAAAACAAAAAgAAAAAAAAAFAAAADAAAAAAAAAACAAAAAgAAAAMAAAASAAAAAAAAAAAAAAAAAAAAAAAAABMAAAACAAAAAAAAAAIAAAABAAAAEQAAAAIAAAACAAAAAAAAAAUAAAANAAAAAAAAAAIAAAACAAAAAwAAABMAAAAAAAAAAAAAAAAAAAAAAAAADwAAAAIAAAAAAAAAAgAAAAEAAAASAAAAAgAAAAIAAAAAAAAABQAAAA4AAAAAAAAAAgAAAAIAAAADAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAAAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAEAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAQAAAAAAAAABQAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAEAAAAAAQAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAA6B6FaUp9QQTPXMuL4myJBraiDfBwx9UBYJseitzTIQOL5if9jqZtAnXX+Z+ycb0C3pucbhRBCQG8wJBYqpRRAlWbDCzCY5z/eFWBUEve6P/+qo4Q50Y4/D9YM3iCcYT8fcA2QJSA0P4ADxu0qAAc/BNcGolVJ2j5d9FACqwquPh9z7MthtI9CSUSYJke/YUJQ/64OyjU0Qpi0+HCmFQdCm3GfIVdh2kHsJ11kAyauQYC3UDFJOoFBSJsFV1OwU0FK5fcxX4AmQWhy/zZIt/lACqaCPsBjzUDbdUNIScugQMYQlVJ4MXNANiuq8GTvRUDxTXnulxEZQFZ8QX5kpuw/qmG/JwYFlEAluh3Q6DB+QKn4vyNq0GZAKOXekas+UUB8xabXXhI6QG63C2pLtSNAdDBtyNfLDUDyOcu67ID2P0rCMvRXAeE/Ki2TSVyzyT9Dk+8Sz2uzP5J+w5ARWp0/NQAoOiMuhj9YnP+RyMJwPxgW7TvQVFk/KgsLYF0kQz9g5dAC6IwzQcgHPVvDex1B1XjppodHBkHJq3OMM9fwQNvcmJ7wddlAInGPpQs/w0BRobq5EBmtQJZ2ai7n+ZVAtv2G5E+bgECG+gIfKBlpQK5f8jdI91JAL39sL/WpPEB8rGxhDqklQK6yUf43XhBAxL9y/tK8+D86XyZpgrHiPwAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAP////8AAAAAAAAAAAAAAAABAAAAAAAAAAAAAAD/////AAAAAAAAAAABAAAAAQAAAAAAAAAAAAAA/////wAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAP////8FAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQAAAAAAAQABAAABAQAAAAAAAQAAAAEAAAABAAEAAAAAAAAAAAAAAAAAAAAAquJYWJZl+D9jaeZNtj/zPwwdI9KqaeO/qGefXwdHdz+q4lhYlmX4P+OrlPMN3PI/DB0j0qpp47+7SQLV4VIEQKriWFiWZfg/r2kma3tz8T82eQmLqNIGwMRIWXMqSvo/fcCszPux9j+jara6ozTwP6hnn18HR3c/MSoKLequ8r+SabgA2nj0P7jBLbDOHO8/1Ym/ICfH4T+6lxjvlFXHv73m373LRPU/0vXyDVxo7T+ToKRHJXMAQF/33578aPE/pAyy64tD9T8+U/hCvyruPwxv8Y7YYwLAuXYr8NAiCEB4+LDK0Sn0P1Qeuy4j+eo/OMx50n7K7L+TrGB/nyf8v5ehC2fbYPM/aXMKexiT6z8mFRIMjg/zP7yUVwGGBNw/E6opHERf8z/z0wR2g9DqPw4pBpcOhvu/NbA29uWAA8DMaTExyXzyP02biiQ+Ruk/S8jz2/FKBEB1pzZnpbb9P7pQU4wLfPI//7ZcQXeG6D9CqEQvAYoIwDB2VB6sSgRAVyv8H5We8T+EHWF8XNPmPzB2wT8Nrrg/SEi+cX+w4L8of+GtdSDxP1sjk5AdouU/6ZjOVru13r8K0obqI6bxvwVbdNXyhfA/w5GG024n5z+rwmtMzP8BwLw9pSX49QXABe/2uQxP8D+b6wCzCvXkP7uGT87fK+Q/pz/JWw4coj+qoBf2J0nwP/yE3PUo0+I/vFJeHcaC+D96luSIqvntP/bf8sHUYu8/gZNN41mL4z9bhOqVOF4FwO6lmAh1hQhAbCVxbdhk7z+1C8NdDcfiPwG36x/0OQBAx0WJ76c2+D9nlSHXANfuP2HlfZ3gqOE/EwnVlVPg9r96+oHzEH//v5bXzdT1Auw/DM3GwLsA4D9p/8uoKcr+v+U9x5DQVAPAehjSdghb7D9sc1IetODgP8MVwwB1pu6/azPk6OGe978W8t/TUc3rP+0QMvYfP+A/RsG/QpSE8D+l3uwScxzgPwQaifgujuw/k1Vti1I43z8MAwLnSh0GQH5nYnwwZgJAiGUzWC5s6j8WyyI/BbLgPw4iUapGeQJAB3W+imnp/j9BLWR4ssrpP2t+gG5Pstk/cpBsfm6DCMCOpU9dOZsFQEv8nFypHeo/ehJ6i+6S2D9jqlGEmarLv7STC5TRiOa/bC+x8WZD6D9H3yUkWpDZP8gZvmCMuQLAreY19/eRBsCoPOc8UzzpP6KI/QV+y9g/t/MoboyWzT+Hv5q3Zu3Mvy2xROCT4uY/9gQitMMg1T9abAqhWMDkv1oLTavoUfG/PMUJP9CD5j+fHRX3t6fSPz7W2gk6bvs/WRnuHwqN9D8YFturGCTmP1EZczv0b9I/5t4exabB5D/1ESLh5fTEP9X2z6SYweQ/6lv3I2zT0D9zkRGNUNMAQKoSvc4EIfs/Xggt8wQI5T+mJHHg/w/SP4lhT/9t8vQ/DrZ/DbwH7D+XlhbYZrjkP34LIpFt6c4/lwfp8fLX9L+j96CTTf76v3WdNhEv9uM/d8c3o4lV0D/vFdCHVcsFwAHeDq0F1QhApbYqcZiN5D9KoilqByXLPwX0/diA0vq/0fo0GxnxAMBbaTkvlCzjP/RrFrWXrMs/UYTrky7jA0DB9f4FiZYAQEGAk/3QzeE/r/TeqE8t0D/OqjlsnPbvvz8RKU8JOfW/smSEbK/O4T8MzuyPm3DDP/rFtctq9gZAfb1EVEaSA0Dts5dVInnhP18SFMc79MM/7y34cw6LAMDFrRJsZO0DwC2KLvLSYuA/hx5wcUHewz+49SnK/4ruPyeS0PX9a+E/ZxaaLvvZ3z8WPu5T2QS8Pygo4RIvMqa/BJ0Kqsd0279cKW4ay8jdP3b05bmZ364/10/qtdxk2r+Bcz6CDMvpv54qOw+Amdw/qLV71pW7sT/YKc80nIPUP8OfIaBJ77G/LyTuD1un2z+diYu8efWzP1wU7ACkfwjAZroyPL1yBkAmv3lKJJbbPysKSE4W+p0/dIgqY79TA8ATLTOQ3tsGwJ2zweD/Xdg/XO/jXeFUaL8VW2qLFKfov1cA9Aa6XfK/tIa7YGgI2T+f3hu/sxqPv2nXdPpf3Pc/jkw8Jbda8j+tT/z8tGPVP1yBHpJd35k/KYvYOy1s8j/yz+kCQjPrP9+agH7x59g/PZfJ9aBhpr/rDKzvYBb+PwtkiaGCt/c/vb1mVr+f1T/JIHwHc8Govw7aeF6+9vG/Xv7kD6fp979isYioQYHVP7AIQZuSFrG/3z1AdUTnAUDN3XY9O7f9P0AdQ9ljYNQ/dJANJPTOrb8kLECUiiPlP4yF7UgmStA/9xGmXxCG1T9qZzix4W2zv2SGJRJVrPe/Fh9a2M/B/b8IexzFCoPSP9y1QFD2bLe/Q86cWLJe/b+mOOfYm78BwOTjkPAGE9E/8aPCUKu/ub9pPZyLCiUGwBA7Mev/BQlALOmrlRi+0j+AMJ/dKULBv7iLtL6a6QRAEMDV/yajAUDa62dE3crJP1P70RgBUbq/38hVnR6esT/s1tG10Z/Ov/zLwalHPss/dTS9NKTXx78nMcRzCIEHQAabxDsAmQRA0tyLK3gSyT+Aui7nOhDGv5Gs58z3WgHATN3forJuBMCAui7nOhDGP9Lciyt4Esm/WAJyHQ4c7z8UP5HFIs3iP3U0vTSk18c//MvBqUc+y7+cvv8HLg/Kvy1I/mHsI+K/U/vRGAFRuj/a62dE3crJv8p+WV8KlQjAuQ/nOP43B0CAMJ/dKULBPyzpq5UYvtK/ZoU+VoLh4L9etLlRUfvtv/GjwlCrv7k/5OOQ8AYT0b9DfT9FhufXPwUX8hJp+4u/3LVAUPZstz8IexzFCoPSv9+L609E5fQ/q9Fz7X2J7T9qZzix4W2zP/cRpl8QhtW/vtNilqGX+j8MOy7QJoL0P3SQDST0zq0/QB1D2WNg1L8IIjSvGNkDwGB8Jou2GAfAsAhBm5IWsT9isYioQYHVvyS9D3zb6uy/gnwRa7uM9L/JIHwHc8GoP729Zla/n9W/CsAHJZwmAEDEW6OYT1r6Pz2XyfWgYaY/35qAfvHn2L83Tdy4lS30vxf2/gZ0jPq/XIEekl3fmb+tT/z8tGPVvybPr2zJ1/+/K7mJ0ypVAsCf3hu/sxqPPwCGu2BoCNm/5oITrpZn+r+UDUyDP+n/v1zv413hVGg/nbPB4P9d2L9MlmkxNvgCQMtZlKE85v8/KwpIThb6nb8mv3lKJJbbv8+SZsTvOOc/pQCIIOYw0j+diYu8efWzvy8k7g9bp9u/kxYDa+pKtD9XlYvA8HnVv6i1e9aVu7G/nio7D4CZ3L/WR6rNh5EGwCkgQweBkghAdvTluZnfrr9cKW4ay8jdvxbjhr1f1QVAR5C0MzivAkAWPu5T2QS8v2cWmi772d+/cKj4lzLJCEBx2QJfYrMFQIcecHFB3sO/LYou8tJi4L+jr7lhO38BwIcI0Nb7xgTAXxIUxzv0w7/ts5dVInnhv0T+l8DZLfE/MP3FoFvS5D8MzuyPm3DDv7JkhGyvzuG/tzhzRIRc0b9Ovv3/0z7mv6/03qhPLdC/m4CT/dDN4b9dwjU5VCQBQBBJX1ntCv0/9GsWtZesy79baTkvlCzjv1mjYgEz++S/oW6KnOQW8b9KoilqByXLv6W2KnGYjeS/SmaKz3Vx9z+BZB5yxGHwP3fHN6OJVdC/dZ02ES/2478PuaBjLrXaP4/JU81pPaO/fgsikW3pzr+XlhbYZrjkv4tSn7YDbP0/f2LnFKlF9z+mJHHg/w/Sv14ILfMECOW/mfg4qYhR/b+OP+RQDCACwOpb9yNs09C/1fbPpJjB5L9pN2WOVZ3wv3hHy9nxIve/URlzO/Rv0r8YFturGCTmv1d1/KKR8QPA8gsy9qzSB8CfHRX3t6fSvzzFCT/Qg+a/EYStnrzV9r/2QJqI7Lb9v/YEIrTDINW/LbFE4JPi5r/7kQEs5fEDQHunnf4GeQBAooj9BX7L2L+oPOc8Uzzpv+ydYY2SSAfAL4HK6CRTB0BH3yUkWpDZv2wvsfFmQ+i/Ik0Yzruh6T8fM3LoGoDUP3oSeovukti/S/ycXKkd6r9rEv+7UWcHQCRIQe/GfwNAa36Abk+y2b9BLWR4ssrpv9KT87qa0bM/FTyktw823L8WyyI/BbLgv4hlM1gubOq/DizMp9Ki6r8b5ckdjVrzv5NVbYtSON+/BBqJ+C6O7L/dUBFqgyXYv00Wh18r7+q/7RAy9h8/4L8W8t/TUc3rv4RM5DKx3wDAfvWIj94aBcBsc1IetODgv3oY0nYIW+y/oGcTFF54AUDkJqS/FKX6PwzNxsC7AOC/ltfN1PUC7L+5Wrz/zHnzP6688w2rNOc/YeV9neCo4b9nlSHXANfuvw9RsxKjY/s/1V8GteXE8j+1C8NdDcfiv2wlcW3YZO+/IOywaA7Q8b9bFP+4Tg36v4GTTeNZi+O/9t/ywdRi77+tRc3yFR7eP2bkcHXJkLO//ITc9SjT4r+qoBf2J0nwv2YHKoswwfm/iQcLspCjAcCb6wCzCvXkvwXv9rkMT/C/YkuwYAMXBMApCNUai9kIwMORhtNuJ+e/BVt01fKF8L+ZqWEfvIjsP6h693QZYNk/WyOTkB2i5b8of+GtdSDxvwpaaulDSwVADMQAX+lOAECEHWF8XNPmv1cr/B+VnvG/XyFG6opcCMD/mtR32/UEQP+2XEF3hui/ulBTjAt88r/imfCfRP+yP9zbvtc8XeO/TZuKJD5G6b/MaTExyXzyvxiTQeElXOO/rbJRQVGN9L/z0wR2g9DqvxOqKRxEX/O/FDGCEei99j9x8zV4VYTmP2lzCnsYk+u/l6ELZ9tg878pRXacaDT/v3k6GZRqoQXAVB67LiP56r94+LDK0Sn0vwO6pZ9b7wFAvK0nKVcc9j8+U/hCvyruv6QMsuuLQ/W/FPhKFYv46j8MyxaDTOW/v9L18g1caO2/vebfvctE9b/7GD8ZrF3xv3gx1AR9bQDAuMEtsM4c77+SabgA2nj0v5xKFIwxsATArKNSBaKsB0Cjara6ozTwv33ArMz7sfa/dF2U0FcWCcDxL357DJX/P69pJmt7c/G/quJYWJZl+L/YntVJlnrSP4sRLzXM+fe/46uU8w3c8r+q4lhYlmX4v85lu5+QRwRAsI0H/WU8479jaeZNtj/zv6riWFiWZfi/sI0H/WU847/OZbufkEcEQHAoPUBrnss/9exKzDtFtT88wM8kax+gP9OqeKeAYog/MW0ItiZvcj+ph+smvt5bP2lCaV5dEUU/StaUmQDaLz+kK9y22BMYP0O3whZuMwI/IIbgZGWE6z7UkjYaEM3UPuezxwa9cr8+LybxRMnFpz6E1N8DbPiRPsYjySMvK3s+//////8fAAj//////zMQCP////9/MiAI/////28yMAj/////YzJACP///z9iMlAI////N2IyYAj///8zYjJwCP//vzNiMoAI//+rM2IykAj/f6szYjKgCP8PqzNiMrAI/wOrM2IywAi/A6szYjLQCJ8DqzNiMuAImQOrM2Iy8Aj//////z8PCP//////Kx8I/////38pLwj/////Pyk/CP////85KU8I////PzgpXwj///8POClvCP///w44KX8I//8fDjgpjwj//w8OOCmfCP9/DQ44Ka8I/w8NDjgpvwj/DQ0OOCnPCP8MDQ44Kd8IxwwNDjgp7wjEDA0OOCn/CAcAAAAHAAAAAQAAAAIAAAAEAAAAAwAAAAAAAAAAAAAABwAAAAMAAAABAAAAAgAAAAUAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAACAAAAAQAAAAMAAAAOAAAABgAAAAsAAAACAAAABwAAAAEAAAAYAAAABQAAAAoAAAABAAAABgAAAAAAAAAmAAAABwAAAAwAAAADAAAACAAAAAIAAAAxAAAACQAAAA4AAAAAAAAABQAAAAQAAAA6AAAACAAAAA0AAAAEAAAACQAAAAMAAAA/AAAACwAAAAYAAAAPAAAACgAAABAAAABIAAAADAAAAAcAAAAQAAAACwAAABEAAABTAAAACgAAAAUAAAATAAAADgAAAA8AAABhAAAADQAAAAgAAAARAAAADAAAABIAAABrAAAADgAAAAkAAAASAAAADQAAABMAAAB1AAAADwAAABMAAAARAAAAEgAAABAAAAAGAAAAAgAAAAMAAAAFAAAABAAAAAAAAAAAAAAAAAAAAAYAAAACAAAAAwAAAAEAAAAFAAAABAAAAAAAAAAAAAAABwAAAAUAAAADAAAABAAAAAEAAAAAAAAAAgAAAAAAAAACAAAAAwAAAAEAAAAFAAAABAAAAAYAAAAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+b8YLURU+yEJQBgtRFT7IQnAYWxnb3MuYwBoM05laWdoYm9yUm90YXRpb25zAGNvb3JkaWprLmMAX3VwQXA3Q2hlY2tlZABfdXBBcDdyQ2hlY2tlZABkaXJlY3RlZEVkZ2UuYwBkaXJlY3RlZEVkZ2VUb0JvdW5kYXJ5AGFkamFjZW50RmFjZURpclt0bXBGaWprLmZhY2VdW2ZpamsuZmFjZV0gPT0gS0kAZmFjZWlqay5jAF9mYWNlSWprUGVudFRvQ2VsbEJvdW5kYXJ5AGFkamFjZW50RmFjZURpcltjZW50ZXJJSksuZmFjZV1bZmFjZTJdID09IEtJAF9mYWNlSWprVG9DZWxsQm91bmRhcnkAaDNJbmRleC5jAGNvbXBhY3RDZWxscwBsYXRMbmdUb0NlbGwAY2VsbFRvQ2hpbGRQb3MAdmFsaWRhdGVDaGlsZFBvcwBsYXRMbmcuYwBjZWxsQXJlYVJhZHMyAHBvbHlnb24tPm5leHQgPT0gTlVMTABsaW5rZWRHZW8uYwBhZGROZXdMaW5rZWRQb2x5Z29uAG5leHQgIT0gTlVMTABsb29wICE9IE5VTEwAYWRkTmV3TGlua2VkTG9vcABwb2x5Z29uLT5maXJzdCA9PSBOVUxMAGFkZExpbmtlZExvb3AAY29vcmQgIT0gTlVMTABhZGRMaW5rZWRDb29yZABsb29wLT5maXJzdCA9PSBOVUxMAGlubmVyTG9vcHMgIT0gTlVMTABub3JtYWxpemVNdWx0aVBvbHlnb24AYmJveGVzICE9IE5VTEwAY2FuZGlkYXRlcyAhPSBOVUxMAGZpbmRQb2x5Z29uRm9ySG9sZQBjYW5kaWRhdGVCQm94ZXMgIT0gTlVMTAByZXZEaXIgIT0gSU5WQUxJRF9ESUdJVABsb2NhbGlqLmMAY2VsbFRvTG9jYWxJamsAYmFzZUNlbGwgIT0gb3JpZ2luQmFzZUNlbGwAIShvcmlnaW5PblBlbnQgJiYgaW5kZXhPblBlbnQpAGJhc2VDZWxsID09IG9yaWdpbkJhc2VDZWxsAGJhc2VDZWxsICE9IElOVkFMSURfQkFTRV9DRUxMAGxvY2FsSWprVG9DZWxsACFfaXNCYXNlQ2VsbFBlbnRhZ29uKGJhc2VDZWxsKQBiYXNlQ2VsbFJvdGF0aW9ucyA+PSAwAGdyaWRQYXRoQ2VsbHMAcG9seWZpbGwuYwBpdGVyU3RlcFBvbHlnb25Db21wYWN0ADAAdmVydGV4LmMAdmVydGV4Um90YXRpb25zAGNlbGxUb1ZlcnRleABncmFwaC0+YnVja2V0cyAhPSBOVUxMAHZlcnRleEdyYXBoLmMAaW5pdFZlcnRleEdyYXBoAG5vZGUgIT0gTlVMTABhZGRWZXJ0ZXhOb2Rl";var Ne=28640;function ee(Ve,at,It,At){er("Assertion failed: "+Ns(Ve)+", at: "+[at?Ns(at):"unknown filename",It,At?Ns(At):"unknown function"])}function K(){return Ji.length}function le(Ve,at,It){Sn.set(Sn.subarray(at,at+It),Ve)}function Me(Ve){return J.___errno_location&&(Un[J.___errno_location()>>2]=Ve),Ve}function Se(Ve){er("OOM")}function Ge(Ve){try{var at=new ArrayBuffer(Ve);return at.byteLength!=Ve?void 0:(new Int8Array(at).set(Ji),Xt(at),ti(at),1)}catch{}}function Fe(Ve){var at=K(),It=16777216,At=2147483648-It;if(Ve>At)return!1;for(var o=16777216,X=Math.max(at,o);X<Ve;)X<=536870912?X=Cs(2*X,It):X=Math.min(Cs((3*X+2147483648)/4,It),At);var ii=Ge(X);return!!ii}var ke=typeof atob=="function"?atob:function(Ve){var at="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",It="",At,o,X,ii,Ri,Qi,ut,zt=0;Ve=Ve.replace(/[^A-Za-z0-9\+\/\=]/g,"");do ii=at.indexOf(Ve.charAt(zt++)),Ri=at.indexOf(Ve.charAt(zt++)),Qi=at.indexOf(Ve.charAt(zt++)),ut=at.indexOf(Ve.charAt(zt++)),At=ii<<2|Ri>>4,o=(Ri&15)<<4|Qi>>2,X=(Qi&3)<<6|ut,It=It+String.fromCharCode(At),Qi!==64&&(It=It+String.fromCharCode(o)),ut!==64&&(It=It+String.fromCharCode(X));while(zt<Ve.length);return It};function Qe(Ve){try{for(var at=ke(Ve),It=new Uint8Array(at.length),At=0;At<at.length;++At)It[At]=at.charCodeAt(At);return It}catch{throw new Error("Converting base64 string to bytes failed.")}}function ft(Ve){if(vo(Ve))return Qe(Ve.slice(Gn.length))}var ot={Math,Int8Array,Int32Array,Uint8Array,Float32Array,Float64Array},St={b:fr,c:Zi,d:ee,e:Me,f:K,g:le,h:Fe,i:Se,o:Ne,p:Yt},je=(function(Ve,at,It){"almost asm";var At=new Ve.Int8Array(It),o=new Ve.Int32Array(It);new Ve.Uint8Array(It),new Ve.Float32Array(It);var X=new Ve.Float64Array(It),ii=at.o|0,Ri=at.p|0,Qi=Ve.Math.floor,ut=Ve.Math.abs,zt=Ve.Math.sqrt,$t=Ve.Math.pow,fi=Ve.Math.cos,di=Ve.Math.sin,jr=Ve.Math.tan,ni=Ve.Math.acos,Ea=Ve.Math.asin,xo=Ve.Math.atan,kn=Ve.Math.atan2,qn=Ve.Math.ceil,Hn=Ve.Math.imul,bo=Ve.Math.min,Sa=Ve.Math.max,vr=Ve.Math.clz32,Ft=at.b,ae=at.c,qt=at.d,Uo=at.e,wo=at.f,zn=at.g,Fi=at.h,Xi=at.i,te=28656;function tr(l){return At=new Int8Array(l),o=new Int32Array(l),X=new Float64Array(l),It=l,!0}function Go(l){l=l|0;var a=0;return a=te,te=te+l|0,te=te+15&-16,a|0}function Ha(){return te|0}function _i(l){l=l|0,te=l}function Sr(l,a){l=l|0,te=l}function Wa(l,a){l=l|0,a=a|0;var c=0,m=0,g=0;return(l|0)<0?(a=2,a|0):(l|0)>13780509?(a=Rs(15,a)|0,a|0):(c=((l|0)<0)<<31>>31,g=lr(l|0,c|0,3,0)|0,m=ae()|0,c=Wt(l|0,c|0,1,0)|0,c=lr(g|0,m|0,c|0,ae()|0)|0,c=Wt(c|0,ae()|0,1,0)|0,l=ae()|0,o[a>>2]=c,o[a+4>>2]=l,a=0,a|0)}function ha(l,a,c,m){return l=l|0,a=a|0,c=c|0,m=m|0,_n(l,a,c,m,0)|0}function _n(l,a,c,m,g){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0;var w=0,P=0,S=0,z=0,O=0;if(z=te,te=te+16|0,P=z,!(Qa(l,a,c,m,g)|0))return m=0,te=z,m|0;do if((c|0)>=0){if((c|0)>13780509){if(w=Rs(15,P)|0,w|0)break;S=P,P=o[S>>2]|0,S=o[S+4>>2]|0}else w=((c|0)<0)<<31>>31,O=lr(c|0,w|0,3,0)|0,S=ae()|0,w=Wt(c|0,w|0,1,0)|0,w=lr(O|0,S|0,w|0,ae()|0)|0,w=Wt(w|0,ae()|0,1,0)|0,S=ae()|0,o[P>>2]=w,o[P+4>>2]=S,P=w;if(bn(m|0,0,P<<3|0)|0,g|0){bn(g|0,0,P<<2|0)|0,w=Ln(l,a,c,m,g,P,S,0)|0;break}w=ts(P,4)|0,w?(O=Ln(l,a,c,m,w,P,S,0)|0,Qt(w),w=O):w=13}else w=2;while(!1);return O=w,te=z,O|0}function Qa(l,a,c,m,g){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0;var w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0;if(Ie=te,te=te+16|0,de=Ie,me=Ie+8|0,pe=de,o[pe>>2]=l,o[pe+4>>2]=a,(c|0)<0)return me=2,te=Ie,me|0;if(w=m,o[w>>2]=l,o[w+4>>2]=a,w=(g|0)!=0,w&&(o[g>>2]=0),$i(l,a)|0)return me=9,te=Ie,me|0;o[me>>2]=0;e:do if((c|0)>=1)if(w)for(Z=1,O=0,se=0,pe=1,w=l;;){if(!(O|se)){if(w=ar(w,a,4,me,de)|0,w|0)break e;if(a=de,w=o[a>>2]|0,a=o[a+4>>2]|0,$i(w,a)|0){w=9;break e}}if(w=ar(w,a,o[26800+(se<<2)>>2]|0,me,de)|0,w|0)break e;if(a=de,w=o[a>>2]|0,a=o[a+4>>2]|0,l=m+(Z<<3)|0,o[l>>2]=w,o[l+4>>2]=a,o[g+(Z<<2)>>2]=pe,l=O+1|0,P=(l|0)==(pe|0),S=se+1|0,z=(S|0)==6,$i(w,a)|0){w=9;break e}if(pe=pe+(z&P&1)|0,(pe|0)>(c|0)){w=0;break}else Z=Z+1|0,O=P?0:l,se=P?z?0:S:se}else for(Z=1,O=0,se=0,pe=1,w=l;;){if(!(O|se)){if(w=ar(w,a,4,me,de)|0,w|0)break e;if(a=de,w=o[a>>2]|0,a=o[a+4>>2]|0,$i(w,a)|0){w=9;break e}}if(w=ar(w,a,o[26800+(se<<2)>>2]|0,me,de)|0,w|0)break e;if(a=de,w=o[a>>2]|0,a=o[a+4>>2]|0,l=m+(Z<<3)|0,o[l>>2]=w,o[l+4>>2]=a,l=O+1|0,P=(l|0)==(pe|0),S=se+1|0,z=(S|0)==6,$i(w,a)|0){w=9;break e}if(pe=pe+(z&P&1)|0,(pe|0)>(c|0)){w=0;break}else Z=Z+1|0,O=P?0:l,se=P?z?0:S:se}else w=0;while(!1);return me=w,te=Ie,me|0}function Ln(l,a,c,m,g,w,P,S){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0,w=w|0,P=P|0,S=S|0;var z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0,Be=0,Je=0;if(Ie=te,te=te+16|0,de=Ie+8|0,me=Ie,z=Do(l|0,a|0,w|0,P|0)|0,Z=ae()|0,se=m+(z<<3)|0,Be=se,Je=o[Be>>2]|0,Be=o[Be+4>>2]|0,O=(Je|0)==(l|0)&(Be|0)==(a|0),!((Je|0)==0&(Be|0)==0|O))do z=Wt(z|0,Z|0,1,0)|0,z=ul(z|0,ae()|0,w|0,P|0)|0,Z=ae()|0,se=m+(z<<3)|0,Je=se,Be=o[Je>>2]|0,Je=o[Je+4>>2]|0,O=(Be|0)==(l|0)&(Je|0)==(a|0);while(!((Be|0)==0&(Je|0)==0|O));if(z=g+(z<<2)|0,O&&(o[z>>2]|0)<=(S|0)||(Je=se,o[Je>>2]=l,o[Je+4>>2]=a,o[z>>2]=S,(S|0)>=(c|0)))return Je=0,te=Ie,Je|0;switch(O=S+1|0,o[de>>2]=0,z=ar(l,a,2,de,me)|0,z|0){case 9:{pe=9;break}case 0:{z=me,z=Ln(o[z>>2]|0,o[z+4>>2]|0,c,m,g,w,P,O)|0,z||(pe=9);break}}e:do if((pe|0)==9){switch(o[de>>2]=0,z=ar(l,a,3,de,me)|0,z|0){case 9:break;case 0:{if(z=me,z=Ln(o[z>>2]|0,o[z+4>>2]|0,c,m,g,w,P,O)|0,z|0)break e;break}default:break e}switch(o[de>>2]=0,z=ar(l,a,1,de,me)|0,z|0){case 9:break;case 0:{if(z=me,z=Ln(o[z>>2]|0,o[z+4>>2]|0,c,m,g,w,P,O)|0,z|0)break e;break}default:break e}switch(o[de>>2]=0,z=ar(l,a,5,de,me)|0,z|0){case 9:break;case 0:{if(z=me,z=Ln(o[z>>2]|0,o[z+4>>2]|0,c,m,g,w,P,O)|0,z|0)break e;break}default:break e}switch(o[de>>2]=0,z=ar(l,a,4,de,me)|0,z|0){case 9:break;case 0:{if(z=me,z=Ln(o[z>>2]|0,o[z+4>>2]|0,c,m,g,w,P,O)|0,z|0)break e;break}default:break e}switch(o[de>>2]=0,z=ar(l,a,6,de,me)|0,z|0){case 9:break;case 0:{if(z=me,z=Ln(o[z>>2]|0,o[z+4>>2]|0,c,m,g,w,P,O)|0,z|0)break e;break}default:break e}return Je=0,te=Ie,Je|0}while(!1);return Je=z,te=Ie,Je|0}function ar(l,a,c,m,g){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0;var w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0;if(c>>>0>6)return g=1,g|0;if(se=(o[m>>2]|0)%6|0,o[m>>2]=se,(se|0)>0){w=0;do c=Wo(c)|0,w=w+1|0;while((w|0)<(o[m>>2]|0))}if(se=ht(l|0,a|0,45)|0,ae()|0,Z=se&127,Z>>>0>121)return g=5,g|0;z=Ir(l,a)|0,w=ht(l|0,a|0,52)|0,ae()|0,w=w&15;e:do if(!w)O=8;else{for(;;){if(P=(15-w|0)*3|0,S=ht(l|0,a|0,P|0)|0,ae()|0,S=S&7,(S|0)==7){a=5;break}if(me=(vn(w)|0)==0,w=w+-1|0,pe=yt(7,0,P|0)|0,a=a&~(ae()|0),de=yt(o[(me?432:16)+(S*28|0)+(c<<2)>>2]|0,0,P|0)|0,P=ae()|0,c=o[(me?640:224)+(S*28|0)+(c<<2)>>2]|0,l=de|l&~pe,a=P|a,!c){c=0;break e}if(!w){O=8;break e}}return a|0}while(!1);(O|0)==8&&(me=o[848+(Z*28|0)+(c<<2)>>2]|0,de=yt(me|0,0,45)|0,l=de|l,a=ae()|0|a&-1040385,c=o[4272+(Z*28|0)+(c<<2)>>2]|0,(me&127|0)==127&&(me=yt(o[848+(Z*28|0)+20>>2]|0,0,45)|0,a=ae()|0|a&-1040385,c=o[4272+(Z*28|0)+20>>2]|0,l=yn(me|l,a)|0,a=ae()|0,o[m>>2]=(o[m>>2]|0)+1)),S=ht(l|0,a|0,45)|0,ae()|0,S=S&127;e:do if(Vi(S)|0){t:do if((Ir(l,a)|0)==1){if((Z|0)!=(S|0))if(Ht(S,o[7696+(Z*28|0)>>2]|0)|0){l=As(l,a)|0,P=1,a=ae()|0;break}else qt(27795,26864,533,26872);switch(z|0){case 3:{l=yn(l,a)|0,a=ae()|0,o[m>>2]=(o[m>>2]|0)+1,P=0;break t}case 5:{l=As(l,a)|0,a=ae()|0,o[m>>2]=(o[m>>2]|0)+5,P=0;break t}case 0:return me=9,me|0;default:return me=1,me|0}}else P=0;while(!1);if((c|0)>0){w=0;do l=Ka(l,a)|0,a=ae()|0,w=w+1|0;while((w|0)!=(c|0))}if((Z|0)!=(S|0)){if(!(oi(S)|0)){if((P|0)!=0|(Ir(l,a)|0)!=5)break;o[m>>2]=(o[m>>2]|0)+1;break}switch(se&127){case 8:case 118:break e}(Ir(l,a)|0)!=3&&(o[m>>2]=(o[m>>2]|0)+1)}}else if((c|0)>0){w=0;do l=yn(l,a)|0,a=ae()|0,w=w+1|0;while((w|0)!=(c|0))}while(!1);return o[m>>2]=((o[m>>2]|0)+c|0)%6|0,me=g,o[me>>2]=l,o[me+4>>2]=a,me=0,me|0}function Cr(l,a,c,m){return l=l|0,a=a|0,c=c|0,m=m|0,To(l,a,c,m)|0?(bn(m|0,0,c*48|0)|0,m=so(l,a,c,m)|0,m|0):(m=0,m|0)}function To(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0;if(me=te,te=te+16|0,pe=me,de=me+8|0,se=pe,o[se>>2]=l,o[se+4>>2]=a,(c|0)<0)return de=2,te=me,de|0;if(!c)return de=m,o[de>>2]=l,o[de+4>>2]=a,de=0,te=me,de|0;o[de>>2]=0;e:do if($i(l,a)|0)l=9;else{g=0,se=l;do{if(l=ar(se,a,4,de,pe)|0,l|0)break e;if(a=pe,se=o[a>>2]|0,a=o[a+4>>2]|0,g=g+1|0,$i(se,a)|0){l=9;break e}}while((g|0)<(c|0));Z=m,o[Z>>2]=se,o[Z+4>>2]=a,Z=c+-1|0,O=0,l=1;do{if(g=26800+(O<<2)|0,(O|0)==5)for(P=o[g>>2]|0,w=0,g=l;;){if(l=pe,l=ar(o[l>>2]|0,o[l+4>>2]|0,P,de,pe)|0,l|0)break e;if((w|0)!=(Z|0))if(z=pe,S=o[z>>2]|0,z=o[z+4>>2]|0,l=m+(g<<3)|0,o[l>>2]=S,o[l+4>>2]=z,!($i(S,z)|0))l=g+1|0;else{l=9;break e}else l=g;if(w=w+1|0,(w|0)>=(c|0))break;g=l}else for(P=pe,z=o[g>>2]|0,S=0,g=l,w=o[P>>2]|0,P=o[P+4>>2]|0;;){if(l=ar(w,P,z,de,pe)|0,l|0)break e;if(P=pe,w=o[P>>2]|0,P=o[P+4>>2]|0,l=m+(g<<3)|0,o[l>>2]=w,o[l+4>>2]=P,l=g+1|0,$i(w,P)|0){l=9;break e}if(S=S+1|0,(S|0)>=(c|0))break;g=l}O=O+1|0}while(O>>>0<6);l=pe,l=(se|0)==(o[l>>2]|0)&&(a|0)==(o[l+4>>2]|0)?0:9}while(!1);return de=l,te=me,de|0}function so(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0;if(se=te,te=te+16|0,P=se,!c)return o[m>>2]=l,o[m+4>>2]=a,m=0,te=se,m|0;do if((c|0)>=0){if((c|0)>13780509){if(g=Rs(15,P)|0,g|0)break;w=P,g=o[w>>2]|0,w=o[w+4>>2]|0}else g=((c|0)<0)<<31>>31,Z=lr(c|0,g|0,3,0)|0,w=ae()|0,g=Wt(c|0,g|0,1,0)|0,g=lr(Z|0,w|0,g|0,ae()|0)|0,g=Wt(g|0,ae()|0,1,0)|0,w=ae()|0,Z=P,o[Z>>2]=g,o[Z+4>>2]=w;if(O=ts(g,8)|0,!O)g=13;else{if(Z=ts(g,4)|0,!Z){Qt(O),g=13;break}if(g=Ln(l,a,c,O,Z,g,w,0)|0,g|0){Qt(O),Qt(Z);break}if(a=o[P>>2]|0,P=o[P+4>>2]|0,(P|0)>0|(P|0)==0&a>>>0>0){g=0,S=0,z=0;do l=O+(S<<3)|0,w=o[l>>2]|0,l=o[l+4>>2]|0,!((w|0)==0&(l|0)==0)&&(o[Z+(S<<2)>>2]|0)==(c|0)&&(pe=m+(g<<3)|0,o[pe>>2]=w,o[pe+4>>2]=l,g=g+1|0),S=Wt(S|0,z|0,1,0)|0,z=ae()|0;while((z|0)<(P|0)|(z|0)==(P|0)&S>>>0<a>>>0)}Qt(O),Qt(Z),g=0}}else g=2;while(!1);return pe=g,te=se,pe|0}function js(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0,O=0;for(S=te,te=te+16|0,w=S,P=S+8|0,g=($i(l,a)|0)==0,g=g?1:2;;){if(o[P>>2]=0,O=(ar(l,a,g,P,w)|0)==0,z=w,O&((o[z>>2]|0)==(c|0)?(o[z+4>>2]|0)==(m|0):0)){l=4;break}if(g=g+1|0,g>>>0>=7){g=7,l=4;break}}return(l|0)==4?(te=S,g|0):0}function $a(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0,O=0;if(S=te,te=te+48|0,g=S+16|0,w=S+8|0,P=S,c=tt(c)|0,c|0)return P=c,te=S,P|0;if(O=l,z=o[O+4>>2]|0,c=w,o[c>>2]=o[O>>2],o[c+4>>2]=z,Ze(w,g),c=ca(g,a,P)|0,!c){if(a=o[w>>2]|0,w=o[l+8>>2]|0,(w|0)>0){g=o[l+12>>2]|0,c=0;do a=(o[g+(c<<3)>>2]|0)+a|0,c=c+1|0;while((c|0)<(w|0))}c=P,g=o[c>>2]|0,c=o[c+4>>2]|0,w=((a|0)<0)<<31>>31,(c|0)<(w|0)|(c|0)==(w|0)&g>>>0<a>>>0?(c=P,o[c>>2]=a,o[c+4>>2]=w,c=w):a=g,z=Wt(a|0,c|0,12,0)|0,O=ae()|0,c=P,o[c>>2]=z,o[c+4>>2]=O,c=m,o[c>>2]=z,o[c+4>>2]=O,c=0}return O=c,te=S,O|0}function ks(l,a,c,m,g,w,P){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0,w=w|0,P=P|0;var S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0,Be=0,Je=0,Oe=0,ze=0,De=0,bt=0,Zt=0,Nt=0,ai=0,pi=0,Mi=0,ei=0,Vt=0,vt=0,_t=0,Mt=0,li=0,Yi=0,wn=0,is=0;if(Mt=te,te=te+64|0,ei=Mt+48|0,Vt=Mt+32|0,vt=Mt+24|0,bt=Mt+8|0,Zt=Mt,z=o[l>>2]|0,(z|0)<=0)return _t=0,te=Mt,_t|0;for(Nt=l+4|0,ai=ei+8|0,pi=Vt+8|0,Mi=bt+8|0,S=0,ze=0;;){O=o[Nt>>2]|0,Oe=O+(ze<<4)|0,o[ei>>2]=o[Oe>>2],o[ei+4>>2]=o[Oe+4>>2],o[ei+8>>2]=o[Oe+8>>2],o[ei+12>>2]=o[Oe+12>>2],(ze|0)==(z+-1|0)?(o[Vt>>2]=o[O>>2],o[Vt+4>>2]=o[O+4>>2],o[Vt+8>>2]=o[O+8>>2],o[Vt+12>>2]=o[O+12>>2]):(Oe=O+(ze+1<<4)|0,o[Vt>>2]=o[Oe>>2],o[Vt+4>>2]=o[Oe+4>>2],o[Vt+8>>2]=o[Oe+8>>2],o[Vt+12>>2]=o[Oe+12>>2]),z=Yn(ei,Vt,m,vt)|0;e:do if(z)O=0,S=z;else if(z=vt,O=o[z>>2]|0,z=o[z+4>>2]|0,(z|0)>0|(z|0)==0&O>>>0>0){Je=0,Oe=0;t:for(;;){if(Yi=1/(+(O>>>0)+4294967296*+(z|0)),is=+X[ei>>3],z=wr(O|0,z|0,Je|0,Oe|0)|0,wn=+(z>>>0)+4294967296*+(ae()|0),li=+(Je>>>0)+4294967296*+(Oe|0),X[bt>>3]=Yi*(is*wn)+Yi*(+X[Vt>>3]*li),X[Mi>>3]=Yi*(+X[ai>>3]*wn)+Yi*(+X[pi>>3]*li),z=Fn(bt,m,Zt)|0,z|0){S=z;break}Be=Zt,Ie=o[Be>>2]|0,Be=o[Be+4>>2]|0,pe=Do(Ie|0,Be|0,a|0,c|0)|0,Z=ae()|0,z=P+(pe<<3)|0,se=z,O=o[se>>2]|0,se=o[se+4>>2]|0;i:do if((O|0)==0&(se|0)==0)De=z,_t=16;else for(de=0,me=0;;){if((de|0)>(c|0)|(de|0)==(c|0)&me>>>0>a>>>0){S=1;break t}if((O|0)==(Ie|0)&(se|0)==(Be|0))break i;if(z=Wt(pe|0,Z|0,1,0)|0,pe=ul(z|0,ae()|0,a|0,c|0)|0,Z=ae()|0,me=Wt(me|0,de|0,1,0)|0,de=ae()|0,z=P+(pe<<3)|0,se=z,O=o[se>>2]|0,se=o[se+4>>2]|0,(O|0)==0&(se|0)==0){De=z,_t=16;break}}while(!1);if((_t|0)==16&&(_t=0,!((Ie|0)==0&(Be|0)==0))&&(me=De,o[me>>2]=Ie,o[me+4>>2]=Be,me=w+(o[g>>2]<<3)|0,o[me>>2]=Ie,o[me+4>>2]=Be,me=g,me=Wt(o[me>>2]|0,o[me+4>>2]|0,1,0)|0,Ie=ae()|0,Be=g,o[Be>>2]=me,o[Be+4>>2]=Ie),Je=Wt(Je|0,Oe|0,1,0)|0,Oe=ae()|0,z=vt,O=o[z>>2]|0,z=o[z+4>>2]|0,!((z|0)>(Oe|0)|(z|0)==(Oe|0)&O>>>0>Je>>>0)){O=1;break e}}O=0}else O=1;while(!1);if(ze=ze+1|0,!O){_t=21;break}if(z=o[l>>2]|0,(ze|0)>=(z|0)){S=0,_t=21;break}}return(_t|0)==21?(te=Mt,S|0):0}function Ca(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0,Be=0,Je=0,Oe=0,ze=0,De=0,bt=0,Zt=0,Nt=0,ai=0,pi=0,Mi=0,ei=0,Vt=0,vt=0,_t=0,Mt=0,li=0,Yi=0,wn=0;if(wn=te,te=te+112|0,_t=wn+80|0,z=wn+72|0,Mt=wn,li=wn+56|0,g=tt(c)|0,g|0)return Yi=g,te=wn,Yi|0;if(O=l+8|0,Yi=Js((o[O>>2]<<5)+32|0)|0,!Yi)return Yi=13,te=wn,Yi|0;if(gt(l,Yi),g=tt(c)|0,!g){if(Vt=l,vt=o[Vt+4>>2]|0,g=z,o[g>>2]=o[Vt>>2],o[g+4>>2]=vt,Ze(z,_t),g=ca(_t,a,Mt)|0,g)Vt=0,vt=0;else{if(g=o[z>>2]|0,w=o[O>>2]|0,(w|0)>0){P=o[l+12>>2]|0,c=0;do g=(o[P+(c<<3)>>2]|0)+g|0,c=c+1|0;while((c|0)!=(w|0));c=g}else c=g;g=Mt,w=o[g>>2]|0,g=o[g+4>>2]|0,P=((c|0)<0)<<31>>31,(g|0)<(P|0)|(g|0)==(P|0)&w>>>0<c>>>0?(g=Mt,o[g>>2]=c,o[g+4>>2]=P,g=P):c=w,Vt=Wt(c|0,g|0,12,0)|0,vt=ae()|0,g=Mt,o[g>>2]=Vt,o[g+4>>2]=vt,g=0}if(!g){if(c=ts(Vt,8)|0,!c)return Qt(Yi),Yi=13,te=wn,Yi|0;if(S=ts(Vt,8)|0,!S)return Qt(Yi),Qt(c),Yi=13,te=wn,Yi|0;Mi=_t,o[Mi>>2]=0,o[Mi+4>>2]=0,Mi=l,ei=o[Mi+4>>2]|0,g=z,o[g>>2]=o[Mi>>2],o[g+4>>2]=ei,g=ks(z,Vt,vt,a,_t,c,S)|0;e:do if(g)Qt(c),Qt(S),Qt(Yi);else{t:do if((o[O>>2]|0)>0){for(P=l+12|0,w=0;g=ks((o[P>>2]|0)+(w<<3)|0,Vt,vt,a,_t,c,S)|0,w=w+1|0,!(g|0);)if((w|0)>=(o[O>>2]|0))break t;Qt(c),Qt(S),Qt(Yi);break e}while(!1);(vt|0)>0|(vt|0)==0&Vt>>>0>0&&bn(S|0,0,Vt<<3|0)|0,ei=_t,Mi=o[ei+4>>2]|0;t:do if((Mi|0)>0|(Mi|0)==0&(o[ei>>2]|0)>>>0>0){Nt=c,ai=S,pi=c,Mi=S,ei=c,g=c,De=c,bt=S,Zt=S,c=S;i:for(;;){for(Be=0,Je=0,Oe=0,ze=0,w=0,P=0;;){S=Mt,z=S+56|0;do o[S>>2]=0,S=S+4|0;while((S|0)<(z|0));if(a=Nt+(Be<<3)|0,O=o[a>>2]|0,a=o[a+4>>2]|0,Qa(O,a,1,Mt,0)|0){S=Mt,z=S+56|0;do o[S>>2]=0,S=S+4|0;while((S|0)<(z|0));S=ts(7,4)|0,S|0&&(Ln(O,a,1,Mt,S,7,0,0)|0,Qt(S))}for(Ie=0;;){me=Mt+(Ie<<3)|0,de=o[me>>2]|0,me=o[me+4>>2]|0;r:do if((de|0)==0&(me|0)==0)S=w,z=P;else{if(Z=Do(de|0,me|0,Vt|0,vt|0)|0,O=ae()|0,S=m+(Z<<3)|0,a=S,z=o[a>>2]|0,a=o[a+4>>2]|0,!((z|0)==0&(a|0)==0)){se=0,pe=0;do{if((se|0)>(vt|0)|(se|0)==(vt|0)&pe>>>0>Vt>>>0)break i;if((z|0)==(de|0)&(a|0)==(me|0)){S=w,z=P;break r}S=Wt(Z|0,O|0,1,0)|0,Z=ul(S|0,ae()|0,Vt|0,vt|0)|0,O=ae()|0,pe=Wt(pe|0,se|0,1,0)|0,se=ae()|0,S=m+(Z<<3)|0,a=S,z=o[a>>2]|0,a=o[a+4>>2]|0}while(!((z|0)==0&(a|0)==0))}if((de|0)==0&(me|0)==0){S=w,z=P;break}xs(de,me,li)|0,Rt(l,Yi,li)|0&&(pe=Wt(w|0,P|0,1,0)|0,P=ae()|0,se=S,o[se>>2]=de,o[se+4>>2]=me,w=ai+(w<<3)|0,o[w>>2]=de,o[w+4>>2]=me,w=pe),S=w,z=P}while(!1);if(Ie=Ie+1|0,Ie>>>0>=7)break;w=S,P=z}if(Be=Wt(Be|0,Je|0,1,0)|0,Je=ae()|0,Oe=Wt(Oe|0,ze|0,1,0)|0,ze=ae()|0,P=_t,w=o[P>>2]|0,P=o[P+4>>2]|0,(ze|0)<(P|0)|(ze|0)==(P|0)&Oe>>>0<w>>>0)w=S,P=z;else break}if((P|0)>0|(P|0)==0&w>>>0>0){w=0,P=0;do ze=Nt+(w<<3)|0,o[ze>>2]=0,o[ze+4>>2]=0,w=Wt(w|0,P|0,1,0)|0,P=ae()|0,ze=_t,Oe=o[ze+4>>2]|0;while((P|0)<(Oe|0)|((P|0)==(Oe|0)?w>>>0<(o[ze>>2]|0)>>>0:0))}if(ze=_t,o[ze>>2]=S,o[ze+4>>2]=z,(z|0)>0|(z|0)==0&S>>>0>0)Ie=c,Be=Zt,Je=ei,Oe=bt,ze=ai,c=De,Zt=g,bt=pi,De=Ie,g=Be,ei=Mi,Mi=Je,pi=Oe,ai=Nt,Nt=ze;else break t}Qt(pi),Qt(Mi),Qt(Yi),g=1;break e}else g=S;while(!1);Qt(Yi),Qt(c),Qt(g),g=0}while(!1);return Yi=g,te=wn,Yi|0}}return Qt(Yi),Yi=g,te=wn,Yi|0}function qo(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0;if(Z=te,te=te+176|0,z=Z,(a|0)<1)return du(c,0,0),O=0,te=Z,O|0;for(S=l,S=ht(o[S>>2]|0,o[S+4>>2]|0,52)|0,ae()|0,du(c,(a|0)>6?a:6,S&15),S=0;m=l+(S<<3)|0,m=fs(o[m>>2]|0,o[m+4>>2]|0,z)|0,!(m|0);){if(m=o[z>>2]|0,(m|0)>0){P=0;do w=z+8+(P<<4)|0,P=P+1|0,m=z+8+(((P|0)%(m|0)|0)<<4)|0,g=gu(c,m,w)|0,g?ia(c,g)|0:_u(c,w,m)|0,m=o[z>>2]|0;while((P|0)<(m|0))}if(S=S+1|0,(S|0)>=(a|0)){m=0,O=13;break}}return(O|0)==13?(te=Z,m|0):(pu(c),O=m,te=Z,O|0)}function zs(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0;if(w=te,te=te+32|0,m=w,g=w+16|0,l=qo(l,a,g)|0,l|0)return c=l,te=w,c|0;if(o[c>>2]=0,o[c+4>>2]=0,o[c+8>>2]=0,l=mu(g)|0,l|0)do{a=ba(c)|0;do nl(a,l)|0,P=l+16|0,o[m>>2]=o[P>>2],o[m+4>>2]=o[P+4>>2],o[m+8>>2]=o[P+8>>2],o[m+12>>2]=o[P+12>>2],ia(g,l)|0,l=Sl(g,m)|0;while((l|0)!=0);l=mu(g)|0}while((l|0)!=0);return pu(g),l=sl(c)|0,l?(gi(c),P=l,te=w,P|0):(P=0,te=w,P|0)}function Vi(l){return l=l|0,l>>>0>121?(l=0,l|0):(l=o[7696+(l*28|0)+16>>2]|0,l|0)}function oi(l){return l=l|0,(l|0)==4|(l|0)==117|0}function Ho(l){return l=l|0,o[11120+((o[l>>2]|0)*216|0)+((o[l+4>>2]|0)*72|0)+((o[l+8>>2]|0)*24|0)+(o[l+12>>2]<<3)>>2]|0}function Nl(l){return l=l|0,o[11120+((o[l>>2]|0)*216|0)+((o[l+4>>2]|0)*72|0)+((o[l+8>>2]|0)*24|0)+(o[l+12>>2]<<3)+4>>2]|0}function Ia(l,a){l=l|0,a=a|0,l=7696+(l*28|0)|0,o[a>>2]=o[l>>2],o[a+4>>2]=o[l+4>>2],o[a+8>>2]=o[l+8>>2],o[a+12>>2]=o[l+12>>2]}function Wn(l,a){l=l|0,a=a|0;var c=0,m=0;if(a>>>0>20)return a=-1,a|0;do if((o[11120+(a*216|0)>>2]|0)!=(l|0))if((o[11120+(a*216|0)+8>>2]|0)!=(l|0))if((o[11120+(a*216|0)+16>>2]|0)!=(l|0))if((o[11120+(a*216|0)+24>>2]|0)!=(l|0))if((o[11120+(a*216|0)+32>>2]|0)!=(l|0))if((o[11120+(a*216|0)+40>>2]|0)!=(l|0))if((o[11120+(a*216|0)+48>>2]|0)!=(l|0))if((o[11120+(a*216|0)+56>>2]|0)!=(l|0))if((o[11120+(a*216|0)+64>>2]|0)!=(l|0))if((o[11120+(a*216|0)+72>>2]|0)!=(l|0))if((o[11120+(a*216|0)+80>>2]|0)!=(l|0))if((o[11120+(a*216|0)+88>>2]|0)!=(l|0))if((o[11120+(a*216|0)+96>>2]|0)!=(l|0))if((o[11120+(a*216|0)+104>>2]|0)!=(l|0))if((o[11120+(a*216|0)+112>>2]|0)!=(l|0))if((o[11120+(a*216|0)+120>>2]|0)!=(l|0))if((o[11120+(a*216|0)+128>>2]|0)!=(l|0))if((o[11120+(a*216|0)+136>>2]|0)==(l|0))l=2,c=1,m=2;else{if((o[11120+(a*216|0)+144>>2]|0)==(l|0)){l=0,c=2,m=0;break}if((o[11120+(a*216|0)+152>>2]|0)==(l|0)){l=0,c=2,m=1;break}if((o[11120+(a*216|0)+160>>2]|0)==(l|0)){l=0,c=2,m=2;break}if((o[11120+(a*216|0)+168>>2]|0)==(l|0)){l=1,c=2,m=0;break}if((o[11120+(a*216|0)+176>>2]|0)==(l|0)){l=1,c=2,m=1;break}if((o[11120+(a*216|0)+184>>2]|0)==(l|0)){l=1,c=2,m=2;break}if((o[11120+(a*216|0)+192>>2]|0)==(l|0)){l=2,c=2,m=0;break}if((o[11120+(a*216|0)+200>>2]|0)==(l|0)){l=2,c=2,m=1;break}if((o[11120+(a*216|0)+208>>2]|0)==(l|0)){l=2,c=2,m=2;break}else l=-1;return l|0}else l=2,c=1,m=1;else l=2,c=1,m=0;else l=1,c=1,m=2;else l=1,c=1,m=1;else l=1,c=1,m=0;else l=0,c=1,m=2;else l=0,c=1,m=1;else l=0,c=1,m=0;else l=2,c=0,m=2;else l=2,c=0,m=1;else l=2,c=0,m=0;else l=1,c=0,m=2;else l=1,c=0,m=1;else l=1,c=0,m=0;else l=0,c=0,m=2;else l=0,c=0,m=1;else l=0,c=0,m=0;while(!1);return a=o[11120+(a*216|0)+(c*72|0)+(l*24|0)+(m<<3)+4>>2]|0,a|0}function Ht(l,a){return l=l|0,a=a|0,(o[7696+(l*28|0)+20>>2]|0)==(a|0)?(a=1,a|0):(a=(o[7696+(l*28|0)+24>>2]|0)==(a|0),a|0)}function Li(l,a){return l=l|0,a=a|0,o[848+(l*28|0)+(a<<2)>>2]|0}function Dt(l,a){return l=l|0,a=a|0,(o[848+(l*28|0)>>2]|0)==(a|0)?(a=0,a|0):(o[848+(l*28|0)+4>>2]|0)==(a|0)?(a=1,a|0):(o[848+(l*28|0)+8>>2]|0)==(a|0)?(a=2,a|0):(o[848+(l*28|0)+12>>2]|0)==(a|0)?(a=3,a|0):(o[848+(l*28|0)+16>>2]|0)==(a|0)?(a=4,a|0):(o[848+(l*28|0)+20>>2]|0)==(a|0)?(a=5,a|0):((o[848+(l*28|0)+24>>2]|0)==(a|0)?6:7)|0}function Ki(){return 122}function Zs(l){l=l|0;var a=0,c=0,m=0;a=0;do yt(a|0,0,45)|0,m=ae()|0|134225919,c=l+(a<<3)|0,o[c>>2]=-1,o[c+4>>2]=m,a=a+1|0;while((a|0)!=122);return 0}function cn(l){l=l|0;var a=0,c=0,m=0;return m=+X[l+16>>3],c=+X[l+24>>3],a=m-c,+(m<c?a+6.283185307179586:a)}function gn(l){return l=l|0,+X[l+16>>3]<+X[l+24>>3]|0}function Lr(l){return l=l|0,+(+X[l>>3]-+X[l+8>>3])}function Us(l,a){l=l|0,a=a|0;var c=0,m=0,g=0;return c=+X[a>>3],!(c>=+X[l+8>>3])||!(c<=+X[l>>3])?(a=0,a|0):(m=+X[l+16>>3],c=+X[l+24>>3],g=+X[a+8>>3],a=g>=c,l=g<=m&1,m<c?a&&(l=1):a||(l=0),a=(l|0)!=0,a|0)}function Qn(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0;return+X[l>>3]<+X[a+8>>3]||+X[l+8>>3]>+X[a>>3]?(m=0,m|0):(w=+X[l+16>>3],c=l+24|0,Z=+X[c>>3],P=w<Z,m=a+16|0,O=+X[m>>3],g=a+24|0,z=+X[g>>3],S=O<z,a=Z-O<z-w,l=P?S|a?1:2:0,a=S?P?1:a?2:1:0,w=+$r(w,l),w<+$r(+X[g>>3],a)||(Z=+$r(+X[c>>3],l),Z>+$r(+X[m>>3],a))?(S=0,S|0):(S=1,S|0))}function Si(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0;w=+X[l+16>>3],z=+X[l+24>>3],l=w<z,S=+X[a+16>>3],P=+X[a+24>>3],g=S<P,a=z-S<P-w,o[c>>2]=l?g|a?1:2:0,o[m>>2]=g?l?1:a?2:1:0}function $n(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0;return+X[l>>3]<+X[a>>3]||+X[l+8>>3]>+X[a+8>>3]?(m=0,m|0):(m=l+16|0,z=+X[m>>3],w=+X[l+24>>3],P=z<w,c=a+16|0,Z=+X[c>>3],g=a+24|0,O=+X[g>>3],S=Z<O,a=w-Z<O-z,l=P?S|a?1:2:0,a=S?P?1:a?2:1:0,w=+$r(w,l),w<=+$r(+X[g>>3],a)?(Z=+$r(+X[m>>3],l),S=Z>=+$r(+X[c>>3],a),S|0):(S=0,S|0))}function gs(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0,P=0,S=0;g=te,te=te+176|0,m=g,o[m>>2]=4,S=+X[a>>3],X[m+8>>3]=S,w=+X[a+16>>3],X[m+16>>3]=w,X[m+24>>3]=S,S=+X[a+24>>3],X[m+32>>3]=S,P=+X[a+8>>3],X[m+40>>3]=P,X[m+48>>3]=S,X[m+56>>3]=P,X[m+64>>3]=w,a=m+72|0,c=a+96|0;do o[a>>2]=0,a=a+4|0;while((a|0)<(c|0));fo(l|0,m|0,168)|0,te=g}function ca(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0,Be=0;me=te,te=te+288|0,Z=me+264|0,se=me+96|0,O=me,S=O,z=S+96|0;do o[S>>2]=0,S=S+4|0;while((S|0)<(z|0));return a=Pl(a,O)|0,a|0?(de=a,te=me,de|0):(z=O,O=o[z>>2]|0,z=o[z+4>>2]|0,xs(O,z,Z)|0,fs(O,z,se)|0,P=+Xs(Z,se+8|0),X[Z>>3]=+X[l>>3],z=Z+8|0,X[z>>3]=+X[l+16>>3],X[se>>3]=+X[l+8>>3],O=se+8|0,X[O>>3]=+X[l+24>>3],g=+Xs(Z,se),Be=+X[z>>3]-+X[O>>3],w=+ut(+Be),Ie=+X[Z>>3]-+X[se>>3],m=+ut(+Ie),!(Be==0|Ie==0)&&(Be=+Nu(+w,+m),Be=+qn(+(g*g/+eu(+(Be/+eu(+w,+m)),3)/(P*(P*2.59807621135)*.8))),X[ii>>3]=Be,pe=~~Be>>>0,de=+ut(Be)>=1?Be>0?~~+bo(+Qi(Be/4294967296),4294967295)>>>0:~~+qn((Be-+(~~Be>>>0))/4294967296)>>>0:0,(o[ii+4>>2]&2146435072|0)!=2146435072)?(se=(pe|0)==0&(de|0)==0,a=c,o[a>>2]=se?1:pe,o[a+4>>2]=se?0:de,a=0):a=1,de=a,te=me,de|0)}function Yn(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0,O=0,Z=0;O=te,te=te+288|0,P=O+264|0,S=O+96|0,z=O,g=z,w=g+96|0;do o[g>>2]=0,g=g+4|0;while((g|0)<(w|0));return c=Pl(c,z)|0,c|0?(m=c,te=O,m|0):(c=z,g=o[c>>2]|0,c=o[c+4>>2]|0,xs(g,c,P)|0,fs(g,c,S)|0,Z=+Xs(P,S+8|0),Z=+qn(+(+Xs(l,a)/(Z*2))),X[ii>>3]=Z,c=~~Z>>>0,g=+ut(Z)>=1?Z>0?~~+bo(+Qi(Z/4294967296),4294967295)>>>0:~~+qn((Z-+(~~Z>>>0))/4294967296)>>>0:0,(o[ii+4>>2]&2146435072|0)==2146435072?(m=1,te=O,m|0):(z=(c|0)==0&(g|0)==0,o[m>>2]=z?1:c,o[m+4>>2]=z?0:g,m=0,te=O,m|0))}function Po(l,a){l=l|0,a=+a;var c=0,m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0;w=l+16|0,P=+X[w>>3],c=l+24|0,g=+X[c>>3],m=P-g,m=P<g?m+6.283185307179586:m,O=+X[l>>3],S=l+8|0,z=+X[S>>3],Z=O-z,m=(m*a-m)*.5,a=(Z*a-Z)*.5,O=O+a,X[l>>3]=O>1.5707963267948966?1.5707963267948966:O,a=z-a,X[S>>3]=a<-1.5707963267948966?-1.5707963267948966:a,a=P+m,a=a>3.141592653589793?a+-6.283185307179586:a,X[w>>3]=a<-3.141592653589793?a+6.283185307179586:a,a=g-m,a=a>3.141592653589793?a+-6.283185307179586:a,X[c>>3]=a<-3.141592653589793?a+6.283185307179586:a}function Ls(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0,o[l>>2]=a,o[l+4>>2]=c,o[l+8>>2]=m}function Vl(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0;se=a+8|0,o[se>>2]=0,z=+X[l>>3],P=+ut(+z),O=+X[l+8>>3],S=+ut(+O)*1.1547005383792515,P=P+S*.5,c=~~P,l=~~S,P=P-+(c|0),S=S-+(l|0);do if(P<.5)if(P<.3333333333333333)if(o[a>>2]=c,S<(P+1)*.5){o[a+4>>2]=l;break}else{l=l+1|0,o[a+4>>2]=l;break}else if(pe=1-P,l=(!(S<pe)&1)+l|0,o[a+4>>2]=l,pe<=S&S<P*2){c=c+1|0,o[a>>2]=c;break}else{o[a>>2]=c;break}else{if(!(P<.6666666666666666))if(c=c+1|0,o[a>>2]=c,S<P*.5){o[a+4>>2]=l;break}else{l=l+1|0,o[a+4>>2]=l;break}if(S<1-P){if(o[a+4>>2]=l,P*2+-1<S){o[a>>2]=c;break}}else l=l+1|0,o[a+4>>2]=l;c=c+1|0,o[a>>2]=c}while(!1);do if(z<0)if(l&1){Z=(l+1|0)/2|0,Z=wr(c|0,((c|0)<0)<<31>>31|0,Z|0,((Z|0)<0)<<31>>31|0)|0,c=~~(+(c|0)-((+(Z>>>0)+4294967296*+(ae()|0))*2+1)),o[a>>2]=c;break}else{Z=(l|0)/2|0,Z=wr(c|0,((c|0)<0)<<31>>31|0,Z|0,((Z|0)<0)<<31>>31|0)|0,c=~~(+(c|0)-(+(Z>>>0)+4294967296*+(ae()|0))*2),o[a>>2]=c;break}while(!1);Z=a+4|0,O<0&&(c=c-((l<<1|1|0)/2|0)|0,o[a>>2]=c,l=0-l|0,o[Z>>2]=l),m=l-c|0,(c|0)<0?(g=0-c|0,o[Z>>2]=m,o[se>>2]=g,o[a>>2]=0,l=m,c=0):g=0,(l|0)<0&&(c=c-l|0,o[a>>2]=c,g=g-l|0,o[se>>2]=g,o[Z>>2]=0,l=0),w=c-g|0,m=l-g|0,(g|0)<0&&(o[a>>2]=w,o[Z>>2]=m,o[se>>2]=0,l=m,c=w,g=0),m=(l|0)<(c|0)?l:c,m=(g|0)<(m|0)?g:m,!((m|0)<=0)&&(o[a>>2]=c-m,o[Z>>2]=l-m,o[se>>2]=g-m)}function Qr(l){l=l|0;var a=0,c=0,m=0,g=0,w=0,P=0;a=o[l>>2]|0,P=l+4|0,c=o[P>>2]|0,(a|0)<0&&(c=c-a|0,o[P>>2]=c,w=l+8|0,o[w>>2]=(o[w>>2]|0)-a,o[l>>2]=0,a=0),(c|0)<0?(a=a-c|0,o[l>>2]=a,w=l+8|0,g=(o[w>>2]|0)-c|0,o[w>>2]=g,o[P>>2]=0,c=0):(g=l+8|0,w=g,g=o[g>>2]|0),(g|0)<0&&(a=a-g|0,o[l>>2]=a,c=c-g|0,o[P>>2]=c,o[w>>2]=0,g=0),m=(c|0)<(a|0)?c:a,m=(g|0)<(m|0)?g:m,!((m|0)<=0)&&(o[l>>2]=a-m,o[P>>2]=c-m,o[w>>2]=g-m)}function hi(l,a){l=l|0,a=a|0;var c=0,m=0;m=o[l+8>>2]|0,c=+((o[l+4>>2]|0)-m|0),X[a>>3]=+((o[l>>2]|0)-m|0)-c*.5,X[a+8>>3]=c*.8660254037844386}function bi(l,a,c){l=l|0,a=a|0,c=c|0,o[c>>2]=(o[a>>2]|0)+(o[l>>2]|0),o[c+4>>2]=(o[a+4>>2]|0)+(o[l+4>>2]|0),o[c+8>>2]=(o[a+8>>2]|0)+(o[l+8>>2]|0)}function nn(l,a,c){l=l|0,a=a|0,c=c|0,o[c>>2]=(o[l>>2]|0)-(o[a>>2]|0),o[c+4>>2]=(o[l+4>>2]|0)-(o[a+4>>2]|0),o[c+8>>2]=(o[l+8>>2]|0)-(o[a+8>>2]|0)}function wi(l,a){l=l|0,a=a|0;var c=0,m=0;c=Hn(o[l>>2]|0,a)|0,o[l>>2]=c,c=l+4|0,m=Hn(o[c>>2]|0,a)|0,o[c>>2]=m,l=l+8|0,a=Hn(o[l>>2]|0,a)|0,o[l>>2]=a}function ri(l){l=l|0;var a=0,c=0,m=0,g=0,w=0,P=0,S=0;P=o[l>>2]|0,S=(P|0)<0,m=(o[l+4>>2]|0)-(S?P:0)|0,w=(m|0)<0,g=(w?0-m|0:0)+((o[l+8>>2]|0)-(S?P:0))|0,c=(g|0)<0,l=c?0:g,a=(w?0:m)-(c?g:0)|0,g=(S?0:P)-(w?m:0)-(c?g:0)|0,c=(a|0)<(g|0)?a:g,c=(l|0)<(c|0)?l:c,m=(c|0)>0,l=l-(m?c:0)|0,a=a-(m?c:0)|0;e:do switch(g-(m?c:0)|0){case 0:switch(a|0){case 0:return S=(l|0)==0?0:(l|0)==1?1:7,S|0;case 1:return S=(l|0)==0?2:(l|0)==1?3:7,S|0;default:break e}case 1:switch(a|0){case 0:return S=(l|0)==0?4:(l|0)==1?5:7,S|0;case 1:{if(!l)l=6;else break e;return l|0}default:break e}}while(!1);return S=7,S|0}function Aa(l){l=l|0;var a=0,c=0,m=0,g=0,w=0,P=0,S=0,z=0,O=0;if(z=l+8|0,P=o[z>>2]|0,S=(o[l>>2]|0)-P|0,O=l+4|0,P=(o[O>>2]|0)-P|0,S>>>0>715827881|P>>>0>715827881){if(m=(S|0)>0,g=2147483647-S|0,w=-2147483648-S|0,(m?(g|0)<(S|0):(w|0)>(S|0))||(c=S<<1,m?(2147483647-c|0)<(S|0):(-2147483648-c|0)>(S|0))||((P|0)>0?(2147483647-P|0)<(P|0):(-2147483648-P|0)>(P|0))||(a=S*3|0,c=P<<1,(m?(g|0)<(c|0):(w|0)>(c|0))||((S|0)>-1?(a|-2147483648|0)>=(P|0):(a^-2147483648|0)<(P|0))))return O=1,O|0}else c=P<<1,a=S*3|0;return m=Io(+(a-P|0)*.14285714285714285)|0,o[l>>2]=m,g=Io(+(c+S|0)*.14285714285714285)|0,o[O>>2]=g,o[z>>2]=0,c=(g|0)<(m|0),a=c?m:g,c=c?g:m,(c|0)<0&&(((c|0)==-2147483648||((a|0)>0?(2147483647-a|0)<(c|0):(-2147483648-a|0)>(c|0)))&&qt(27795,26892,354,26903),((a|0)>-1?(a|-2147483648|0)>=(c|0):(a^-2147483648|0)<(c|0))&&qt(27795,26892,354,26903)),a=g-m|0,(m|0)<0?(c=0-m|0,o[O>>2]=a,o[z>>2]=c,o[l>>2]=0,m=0):(a=g,c=0),(a|0)<0&&(m=m-a|0,o[l>>2]=m,c=c-a|0,o[z>>2]=c,o[O>>2]=0,a=0),w=m-c|0,g=a-c|0,(c|0)<0?(o[l>>2]=w,o[O>>2]=g,o[z>>2]=0,a=g,g=w,c=0):g=m,m=(a|0)<(g|0)?a:g,m=(c|0)<(m|0)?c:m,(m|0)<=0?(O=0,O|0):(o[l>>2]=g-m,o[O>>2]=a-m,o[z>>2]=c-m,O=0,O|0)}function Ci(l){l=l|0;var a=0,c=0,m=0,g=0,w=0,P=0,S=0,z=0;if(P=l+8|0,g=o[P>>2]|0,w=(o[l>>2]|0)-g|0,S=l+4|0,g=(o[S>>2]|0)-g|0,w>>>0>715827881|g>>>0>715827881){if(c=(w|0)>0,(c?(2147483647-w|0)<(w|0):(-2147483648-w|0)>(w|0))||(a=w<<1,m=(g|0)>0,m?(2147483647-g|0)<(g|0):(-2147483648-g|0)>(g|0)))return S=1,S|0;if(z=g<<1,(m?(2147483647-z|0)<(g|0):(-2147483648-z|0)>(g|0))||(c?(2147483647-a|0)<(g|0):(-2147483648-a|0)>(g|0))||(c=g*3|0,(g|0)>-1?(c|-2147483648|0)>=(w|0):(c^-2147483648|0)<(w|0)))return z=1,z|0}else c=g*3|0,a=w<<1;return m=Io(+(a+g|0)*.14285714285714285)|0,o[l>>2]=m,g=Io(+(c-w|0)*.14285714285714285)|0,o[S>>2]=g,o[P>>2]=0,c=(g|0)<(m|0),a=c?m:g,c=c?g:m,(c|0)<0&&(((c|0)==-2147483648||((a|0)>0?(2147483647-a|0)<(c|0):(-2147483648-a|0)>(c|0)))&&qt(27795,26892,402,26917),((a|0)>-1?(a|-2147483648|0)>=(c|0):(a^-2147483648|0)<(c|0))&&qt(27795,26892,402,26917)),a=g-m|0,(m|0)<0?(c=0-m|0,o[S>>2]=a,o[P>>2]=c,o[l>>2]=0,m=0):(a=g,c=0),(a|0)<0&&(m=m-a|0,o[l>>2]=m,c=c-a|0,o[P>>2]=c,o[S>>2]=0,a=0),w=m-c|0,g=a-c|0,(c|0)<0?(o[l>>2]=w,o[S>>2]=g,o[P>>2]=0,a=g,g=w,c=0):g=m,m=(a|0)<(g|0)?a:g,m=(c|0)<(m|0)?c:m,(m|0)<=0?(z=0,z|0):(o[l>>2]=g-m,o[S>>2]=a-m,o[P>>2]=c-m,z=0,z|0)}function Da(l){l=l|0;var a=0,c=0,m=0,g=0,w=0,P=0,S=0;P=l+8|0,c=o[P>>2]|0,a=(o[l>>2]|0)-c|0,S=l+4|0,c=(o[S>>2]|0)-c|0,m=Io(+((a*3|0)-c|0)*.14285714285714285)|0,o[l>>2]=m,a=Io(+((c<<1)+a|0)*.14285714285714285)|0,o[S>>2]=a,o[P>>2]=0,c=a-m|0,(m|0)<0?(w=0-m|0,o[S>>2]=c,o[P>>2]=w,o[l>>2]=0,a=c,m=0,c=w):c=0,(a|0)<0&&(m=m-a|0,o[l>>2]=m,c=c-a|0,o[P>>2]=c,o[S>>2]=0,a=0),w=m-c|0,g=a-c|0,(c|0)<0?(o[l>>2]=w,o[S>>2]=g,o[P>>2]=0,a=g,g=w,c=0):g=m,m=(a|0)<(g|0)?a:g,m=(c|0)<(m|0)?c:m,!((m|0)<=0)&&(o[l>>2]=g-m,o[S>>2]=a-m,o[P>>2]=c-m)}function Xn(l){l=l|0;var a=0,c=0,m=0,g=0,w=0,P=0,S=0;P=l+8|0,c=o[P>>2]|0,a=(o[l>>2]|0)-c|0,S=l+4|0,c=(o[S>>2]|0)-c|0,m=Io(+((a<<1)+c|0)*.14285714285714285)|0,o[l>>2]=m,a=Io(+((c*3|0)-a|0)*.14285714285714285)|0,o[S>>2]=a,o[P>>2]=0,c=a-m|0,(m|0)<0?(w=0-m|0,o[S>>2]=c,o[P>>2]=w,o[l>>2]=0,a=c,m=0,c=w):c=0,(a|0)<0&&(m=m-a|0,o[l>>2]=m,c=c-a|0,o[P>>2]=c,o[S>>2]=0,a=0),w=m-c|0,g=a-c|0,(c|0)<0?(o[l>>2]=w,o[S>>2]=g,o[P>>2]=0,a=g,g=w,c=0):g=m,m=(a|0)<(g|0)?a:g,m=(c|0)<(m|0)?c:m,!((m|0)<=0)&&(o[l>>2]=g-m,o[S>>2]=a-m,o[P>>2]=c-m)}function oo(l){l=l|0;var a=0,c=0,m=0,g=0,w=0,P=0,S=0;a=o[l>>2]|0,P=l+4|0,c=o[P>>2]|0,S=l+8|0,m=o[S>>2]|0,g=c+(a*3|0)|0,o[l>>2]=g,c=m+(c*3|0)|0,o[P>>2]=c,a=(m*3|0)+a|0,o[S>>2]=a,m=c-g|0,(g|0)<0?(a=a-g|0,o[P>>2]=m,o[S>>2]=a,o[l>>2]=0,c=m,m=0):m=g,(c|0)<0&&(m=m-c|0,o[l>>2]=m,a=a-c|0,o[S>>2]=a,o[P>>2]=0,c=0),w=m-a|0,g=c-a|0,(a|0)<0?(o[l>>2]=w,o[P>>2]=g,o[S>>2]=0,m=w,a=0):g=c,c=(g|0)<(m|0)?g:m,c=(a|0)<(c|0)?a:c,!((c|0)<=0)&&(o[l>>2]=m-c,o[P>>2]=g-c,o[S>>2]=a-c)}function Kn(l){l=l|0;var a=0,c=0,m=0,g=0,w=0,P=0,S=0;g=o[l>>2]|0,P=l+4|0,a=o[P>>2]|0,S=l+8|0,c=o[S>>2]|0,m=(a*3|0)+g|0,g=c+(g*3|0)|0,o[l>>2]=g,o[P>>2]=m,a=(c*3|0)+a|0,o[S>>2]=a,c=m-g|0,(g|0)<0?(a=a-g|0,o[P>>2]=c,o[S>>2]=a,o[l>>2]=0,g=0):c=m,(c|0)<0&&(g=g-c|0,o[l>>2]=g,a=a-c|0,o[S>>2]=a,o[P>>2]=0,c=0),w=g-a|0,m=c-a|0,(a|0)<0?(o[l>>2]=w,o[P>>2]=m,o[S>>2]=0,g=w,a=0):m=c,c=(m|0)<(g|0)?m:g,c=(a|0)<(c|0)?a:c,!((c|0)<=0)&&(o[l>>2]=g-c,o[P>>2]=m-c,o[S>>2]=a-c)}function ka(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0,P=0,S=0;(a+-1|0)>>>0>=6||(g=(o[15440+(a*12|0)>>2]|0)+(o[l>>2]|0)|0,o[l>>2]=g,S=l+4|0,m=(o[15440+(a*12|0)+4>>2]|0)+(o[S>>2]|0)|0,o[S>>2]=m,P=l+8|0,a=(o[15440+(a*12|0)+8>>2]|0)+(o[P>>2]|0)|0,o[P>>2]=a,c=m-g|0,(g|0)<0?(a=a-g|0,o[S>>2]=c,o[P>>2]=a,o[l>>2]=0,m=0):(c=m,m=g),(c|0)<0&&(m=m-c|0,o[l>>2]=m,a=a-c|0,o[P>>2]=a,o[S>>2]=0,c=0),w=m-a|0,g=c-a|0,(a|0)<0?(o[l>>2]=w,o[S>>2]=g,o[P>>2]=0,m=w,a=0):g=c,c=(g|0)<(m|0)?g:m,c=(a|0)<(c|0)?a:c,!((c|0)<=0)&&(o[l>>2]=m-c,o[S>>2]=g-c,o[P>>2]=a-c))}function fa(l){l=l|0;var a=0,c=0,m=0,g=0,w=0,P=0,S=0;g=o[l>>2]|0,P=l+4|0,a=o[P>>2]|0,S=l+8|0,c=o[S>>2]|0,m=a+g|0,g=c+g|0,o[l>>2]=g,o[P>>2]=m,a=c+a|0,o[S>>2]=a,c=m-g|0,(g|0)<0?(a=a-g|0,o[P>>2]=c,o[S>>2]=a,o[l>>2]=0,m=0):(c=m,m=g),(c|0)<0&&(m=m-c|0,o[l>>2]=m,a=a-c|0,o[S>>2]=a,o[P>>2]=0,c=0),w=m-a|0,g=c-a|0,(a|0)<0?(o[l>>2]=w,o[P>>2]=g,o[S>>2]=0,m=w,a=0):g=c,c=(g|0)<(m|0)?g:m,c=(a|0)<(c|0)?a:c,!((c|0)<=0)&&(o[l>>2]=m-c,o[P>>2]=g-c,o[S>>2]=a-c)}function Bn(l){l=l|0;var a=0,c=0,m=0,g=0,w=0,P=0,S=0;a=o[l>>2]|0,P=l+4|0,m=o[P>>2]|0,S=l+8|0,c=o[S>>2]|0,g=m+a|0,o[l>>2]=g,m=c+m|0,o[P>>2]=m,a=c+a|0,o[S>>2]=a,c=m-g|0,(g|0)<0?(a=a-g|0,o[P>>2]=c,o[S>>2]=a,o[l>>2]=0,m=0):(c=m,m=g),(c|0)<0&&(m=m-c|0,o[l>>2]=m,a=a-c|0,o[S>>2]=a,o[P>>2]=0,c=0),w=m-a|0,g=c-a|0,(a|0)<0?(o[l>>2]=w,o[P>>2]=g,o[S>>2]=0,m=w,a=0):g=c,c=(g|0)<(m|0)?g:m,c=(a|0)<(c|0)?a:c,!((c|0)<=0)&&(o[l>>2]=m-c,o[P>>2]=g-c,o[S>>2]=a-c)}function Wo(l){switch(l=l|0,l|0){case 1:{l=5;break}case 5:{l=4;break}case 4:{l=6;break}case 6:{l=2;break}case 2:{l=3;break}case 3:{l=1;break}}return l|0}function Gs(l){switch(l=l|0,l|0){case 1:{l=3;break}case 3:{l=2;break}case 2:{l=6;break}case 6:{l=4;break}case 4:{l=5;break}case 5:{l=1;break}}return l|0}function xr(l){l=l|0;var a=0,c=0,m=0,g=0,w=0,P=0,S=0;a=o[l>>2]|0,P=l+4|0,c=o[P>>2]|0,S=l+8|0,m=o[S>>2]|0,g=c+(a<<1)|0,o[l>>2]=g,c=m+(c<<1)|0,o[P>>2]=c,a=(m<<1)+a|0,o[S>>2]=a,m=c-g|0,(g|0)<0?(a=a-g|0,o[P>>2]=m,o[S>>2]=a,o[l>>2]=0,c=m,m=0):m=g,(c|0)<0&&(m=m-c|0,o[l>>2]=m,a=a-c|0,o[S>>2]=a,o[P>>2]=0,c=0),w=m-a|0,g=c-a|0,(a|0)<0?(o[l>>2]=w,o[P>>2]=g,o[S>>2]=0,m=w,a=0):g=c,c=(g|0)<(m|0)?g:m,c=(a|0)<(c|0)?a:c,!((c|0)<=0)&&(o[l>>2]=m-c,o[P>>2]=g-c,o[S>>2]=a-c)}function ys(l){l=l|0;var a=0,c=0,m=0,g=0,w=0,P=0,S=0;g=o[l>>2]|0,P=l+4|0,a=o[P>>2]|0,S=l+8|0,c=o[S>>2]|0,m=(a<<1)+g|0,g=c+(g<<1)|0,o[l>>2]=g,o[P>>2]=m,a=(c<<1)+a|0,o[S>>2]=a,c=m-g|0,(g|0)<0?(a=a-g|0,o[P>>2]=c,o[S>>2]=a,o[l>>2]=0,g=0):c=m,(c|0)<0&&(g=g-c|0,o[l>>2]=g,a=a-c|0,o[S>>2]=a,o[P>>2]=0,c=0),w=g-a|0,m=c-a|0,(a|0)<0?(o[l>>2]=w,o[P>>2]=m,o[S>>2]=0,g=w,a=0):m=c,c=(m|0)<(g|0)?m:g,c=(a|0)<(c|0)?a:c,!((c|0)<=0)&&(o[l>>2]=g-c,o[P>>2]=m-c,o[S>>2]=a-c)}function ir(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0,P=0,S=0;return P=(o[l>>2]|0)-(o[a>>2]|0)|0,S=(P|0)<0,m=(o[l+4>>2]|0)-(o[a+4>>2]|0)-(S?P:0)|0,w=(m|0)<0,g=(S?0-P|0:0)+(o[l+8>>2]|0)-(o[a+8>>2]|0)+(w?0-m|0:0)|0,l=(g|0)<0,a=l?0:g,c=(w?0:m)-(l?g:0)|0,g=(S?0:P)-(w?m:0)-(l?g:0)|0,l=(c|0)<(g|0)?c:g,l=(a|0)<(l|0)?a:l,m=(l|0)>0,a=a-(m?l:0)|0,c=c-(m?l:0)|0,l=g-(m?l:0)|0,l=(l|0)>-1?l:0-l|0,c=(c|0)>-1?c:0-c|0,a=(a|0)>-1?a:0-a|0,a=(c|0)>(a|0)?c:a,((l|0)>(a|0)?l:a)|0}function ao(l,a){l=l|0,a=a|0;var c=0;c=o[l+8>>2]|0,o[a>>2]=(o[l>>2]|0)-c,o[a+4>>2]=(o[l+4>>2]|0)-c}function yl(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0,P=0,S=0;return m=o[l>>2]|0,o[a>>2]=m,g=o[l+4>>2]|0,P=a+4|0,o[P>>2]=g,S=a+8|0,o[S>>2]=0,c=(g|0)<(m|0),l=c?m:g,c=c?g:m,(c|0)<0&&((c|0)==-2147483648||((l|0)>0?(2147483647-l|0)<(c|0):(-2147483648-l|0)>(c|0))||((l|0)>-1?(l|-2147483648|0)>=(c|0):(l^-2147483648|0)<(c|0)))?(a=1,a|0):(l=g-m|0,(m|0)<0?(c=0-m|0,o[P>>2]=l,o[S>>2]=c,o[a>>2]=0,m=0):(l=g,c=0),(l|0)<0&&(m=m-l|0,o[a>>2]=m,c=c-l|0,o[S>>2]=c,o[P>>2]=0,l=0),w=m-c|0,g=l-c|0,(c|0)<0?(o[a>>2]=w,o[P>>2]=g,o[S>>2]=0,l=g,g=w,c=0):g=m,m=(l|0)<(g|0)?l:g,m=(c|0)<(m|0)?c:m,(m|0)<=0?(a=0,a|0):(o[a>>2]=g-m,o[P>>2]=l-m,o[S>>2]=c-m,a=0,a|0))}function Qo(l){l=l|0;var a=0,c=0,m=0,g=0;a=l+8|0,g=o[a>>2]|0,c=g-(o[l>>2]|0)|0,o[l>>2]=c,m=l+4|0,l=(o[m>>2]|0)-g|0,o[m>>2]=l,o[a>>2]=0-(l+c)}function dr(l){l=l|0;var a=0,c=0,m=0,g=0,w=0,P=0,S=0;c=o[l>>2]|0,a=0-c|0,o[l>>2]=a,P=l+8|0,o[P>>2]=0,S=l+4|0,m=o[S>>2]|0,g=m+c|0,(c|0)>0?(o[S>>2]=g,o[P>>2]=c,o[l>>2]=0,a=0,m=g):c=0,(m|0)<0?(w=a-m|0,o[l>>2]=w,c=c-m|0,o[P>>2]=c,o[S>>2]=0,g=w-c|0,a=0-c|0,(c|0)<0?(o[l>>2]=g,o[S>>2]=a,o[P>>2]=0,m=a,c=0):(m=0,g=w)):g=a,a=(m|0)<(g|0)?m:g,a=(c|0)<(a|0)?c:a,!((a|0)<=0)&&(o[l>>2]=g-a,o[S>>2]=m-a,o[P>>2]=c-a)}function jl(l,a,c,m,g){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0;var w=0,P=0,S=0,z=0,O=0,Z=0,se=0;if(se=te,te=te+64|0,Z=se,S=se+56|0,!(!0&(a&2013265920|0)==134217728&(!0&(m&2013265920|0)==134217728)))return g=5,te=se,g|0;if((l|0)==(c|0)&(a|0)==(m|0))return o[g>>2]=0,g=0,te=se,g|0;if(P=ht(l|0,a|0,52)|0,ae()|0,P=P&15,O=ht(c|0,m|0,52)|0,ae()|0,(P|0)!=(O&15|0))return g=12,te=se,g|0;if(w=P+-1|0,P>>>0>1){Xa(l,a,w,Z)|0,Xa(c,m,w,S)|0,O=Z,z=o[O>>2]|0,O=o[O+4>>2]|0;e:do if((z|0)==(o[S>>2]|0)&&(O|0)==(o[S+4>>2]|0)){P=(P^15)*3|0,w=ht(l|0,a|0,P|0)|0,ae()|0,w=w&7,P=ht(c|0,m|0,P|0)|0,ae()|0,P=P&7;do if((w|0)==0|(P|0)==0)o[g>>2]=1,w=0;else if((w|0)==7)w=5;else{if((w|0)==1|(P|0)==1&&$i(z,O)|0){w=5;break}if((o[15536+(w<<2)>>2]|0)!=(P|0)&&(o[15568+(w<<2)>>2]|0)!=(P|0))break e;o[g>>2]=1,w=0}while(!1);return g=w,te=se,g|0}while(!1)}w=Z,P=w+56|0;do o[w>>2]=0,w=w+4|0;while((w|0)<(P|0));return ha(l,a,1,Z)|0,a=Z,!((o[a>>2]|0)==(c|0)&&(o[a+4>>2]|0)==(m|0))&&(a=Z+8|0,!((o[a>>2]|0)==(c|0)&&(o[a+4>>2]|0)==(m|0)))&&(a=Z+16|0,!((o[a>>2]|0)==(c|0)&&(o[a+4>>2]|0)==(m|0)))&&(a=Z+24|0,!((o[a>>2]|0)==(c|0)&&(o[a+4>>2]|0)==(m|0)))&&(a=Z+32|0,!((o[a>>2]|0)==(c|0)&&(o[a+4>>2]|0)==(m|0)))&&(a=Z+40|0,!((o[a>>2]|0)==(c|0)&&(o[a+4>>2]|0)==(m|0)))?(w=Z+48|0,w=((o[w>>2]|0)==(c|0)?(o[w+4>>2]|0)==(m|0):0)&1):w=1,o[g>>2]=w,g=0,te=se,g|0}function vl(l,a,c,m,g){return l=l|0,a=a|0,c=c|0,m=m|0,g=g|0,c=js(l,a,c,m)|0,(c|0)==7?(g=11,g|0):(m=yt(c|0,0,56)|0,a=a&-2130706433|(ae()|0)|268435456,o[g>>2]=l|m,o[g+4>>2]=a,g=0,g|0)}function Ya(l,a,c){return l=l|0,a=a|0,c=c|0,!0&(a&2013265920|0)==268435456?(o[c>>2]=l,o[c+4>>2]=a&-2130706433|134217728,c=0,c|0):(c=6,c|0)}function uu(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0;return g=te,te=te+16|0,m=g,o[m>>2]=0,!0&(a&2013265920|0)==268435456?(w=ht(l|0,a|0,56)|0,ae()|0,m=ar(l,a&-2130706433|134217728,w&7,m,c)|0,te=g,m|0):(m=6,te=g,m|0)}function Mo(l,a){l=l|0,a=a|0;var c=0;switch(c=ht(l|0,a|0,56)|0,ae()|0,c&7){case 0:case 7:return c=0,c|0}return c=a&-2130706433|134217728,!(!0&(a&2013265920|0)==268435456)||!0&(a&117440512|0)==16777216&($i(l,c)|0)!=0?(c=0,c|0):(c=cs(l,c)|0,c|0)}function za(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0;return g=te,te=te+16|0,m=g,!0&(a&2013265920|0)==268435456?(w=a&-2130706433|134217728,P=c,o[P>>2]=l,o[P+4>>2]=w,o[m>>2]=0,a=ht(l|0,a|0,56)|0,ae()|0,m=ar(l,w,a&7,m,c+8|0)|0,te=g,m|0):(m=6,te=g,m|0)}function lo(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0;return g=($i(l,a)|0)==0,a=a&-2130706433,m=c,o[m>>2]=g?l:0,o[m+4>>2]=g?a|285212672:0,m=c+8|0,o[m>>2]=l,o[m+4>>2]=a|301989888,m=c+16|0,o[m>>2]=l,o[m+4>>2]=a|318767104,m=c+24|0,o[m>>2]=l,o[m+4>>2]=a|335544320,m=c+32|0,o[m>>2]=l,o[m+4>>2]=a|352321536,c=c+40|0,o[c>>2]=l,o[c+4>>2]=a|369098752,0}function vs(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0;return P=te,te=te+16|0,g=P,w=a&-2130706433|134217728,!0&(a&2013265920|0)==268435456?(m=ht(l|0,a|0,56)|0,ae()|0,m=Co(l,w,m&7)|0,(m|0)==-1?(o[c>>2]=0,w=6,te=P,w|0):($s(l,w,g)|0&&qt(27795,26932,282,26947),a=ht(l|0,a|0,52)|0,ae()|0,a=a&15,$i(l,w)|0?Eo(g,a,m,2,c):da(g,a,m,2,c),w=0,te=P,w|0)):(w=6,te=P,w|0)}function La(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0;m=te,te=te+16|0,g=m,qs(l,a,c,g),Vl(g,c+4|0),te=m}function qs(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0;if(S=te,te=te+16|0,z=S,An(l,c,z),w=+ni(+(1-+X[z>>3]*.5)),w<1e-16){o[m>>2]=0,o[m+4>>2]=0,o[m+8>>2]=0,o[m+12>>2]=0,te=S;return}if(z=o[c>>2]|0,g=+X[15920+(z*24|0)>>3],g=+Ii(g-+Ii(+_a(15600+(z<<4)|0,l))),vn(a)|0?P=+Ii(g+-.3334731722518321):P=g,g=+jr(+w)*2.618033988749896,(a|0)>0){l=0;do g=g*2.6457513110645907,l=l+1|0;while((l|0)!=(a|0))}w=+fi(+P)*g,X[m>>3]=w,P=+di(+P)*g,X[m+8>>3]=P,te=S}function An(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0;if(w=te,te=te+32|0,g=w,ll(l,g),o[a>>2]=0,X[c>>3]=5,m=+nr(16400,g),m<+X[c>>3]&&(o[a>>2]=0,X[c>>3]=m),m=+nr(16424,g),m<+X[c>>3]&&(o[a>>2]=1,X[c>>3]=m),m=+nr(16448,g),m<+X[c>>3]&&(o[a>>2]=2,X[c>>3]=m),m=+nr(16472,g),m<+X[c>>3]&&(o[a>>2]=3,X[c>>3]=m),m=+nr(16496,g),m<+X[c>>3]&&(o[a>>2]=4,X[c>>3]=m),m=+nr(16520,g),m<+X[c>>3]&&(o[a>>2]=5,X[c>>3]=m),m=+nr(16544,g),m<+X[c>>3]&&(o[a>>2]=6,X[c>>3]=m),m=+nr(16568,g),m<+X[c>>3]&&(o[a>>2]=7,X[c>>3]=m),m=+nr(16592,g),m<+X[c>>3]&&(o[a>>2]=8,X[c>>3]=m),m=+nr(16616,g),m<+X[c>>3]&&(o[a>>2]=9,X[c>>3]=m),m=+nr(16640,g),m<+X[c>>3]&&(o[a>>2]=10,X[c>>3]=m),m=+nr(16664,g),m<+X[c>>3]&&(o[a>>2]=11,X[c>>3]=m),m=+nr(16688,g),m<+X[c>>3]&&(o[a>>2]=12,X[c>>3]=m),m=+nr(16712,g),m<+X[c>>3]&&(o[a>>2]=13,X[c>>3]=m),m=+nr(16736,g),m<+X[c>>3]&&(o[a>>2]=14,X[c>>3]=m),m=+nr(16760,g),m<+X[c>>3]&&(o[a>>2]=15,X[c>>3]=m),m=+nr(16784,g),m<+X[c>>3]&&(o[a>>2]=16,X[c>>3]=m),m=+nr(16808,g),m<+X[c>>3]&&(o[a>>2]=17,X[c>>3]=m),m=+nr(16832,g),m<+X[c>>3]&&(o[a>>2]=18,X[c>>3]=m),m=+nr(16856,g),!(m<+X[c>>3])){te=w;return}o[a>>2]=19,X[c>>3]=m,te=w}function Ar(l,a,c,m,g){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0;var w=0,P=0,S=0;if(w=+ea(l),w<1e-16){a=15600+(a<<4)|0,o[g>>2]=o[a>>2],o[g+4>>2]=o[a+4>>2],o[g+8>>2]=o[a+8>>2],o[g+12>>2]=o[a+12>>2];return}if(P=+kn(+ +X[l+8>>3],+ +X[l>>3]),(c|0)>0){l=0;do w=w*.37796447300922725,l=l+1|0;while((l|0)!=(c|0))}S=w*.3333333333333333,m?(c=(vn(c)|0)==0,w=+xo(+((c?S:S*.37796447300922725)*.381966011250105))):(w=+xo(+(w*.381966011250105)),vn(c)|0&&(P=+Ii(P+.3334731722518321))),ga(15600+(a<<4)|0,+Ii(+X[15920+(a*24|0)>>3]-P),w,g)}function xl(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0;m=te,te=te+16|0,g=m,hi(l+4|0,g),Ar(g,o[l>>2]|0,a,0,c),te=m}function Eo(l,a,c,m,g){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0;var w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0,Be=0,Je=0,Oe=0,ze=0,De=0,bt=0,Zt=0,Nt=0,ai=0,pi=0,Mi=0,ei=0,Vt=0,vt=0,_t=0,Mt=0,li=0;if(_t=te,te=te+272|0,w=_t+256|0,Oe=_t+240|0,ei=_t,Vt=_t+224|0,vt=_t+208|0,ze=_t+176|0,De=_t+160|0,bt=_t+192|0,Zt=_t+144|0,Nt=_t+128|0,ai=_t+112|0,pi=_t+96|0,Mi=_t+80|0,o[w>>2]=a,o[Oe>>2]=o[l>>2],o[Oe+4>>2]=o[l+4>>2],o[Oe+8>>2]=o[l+8>>2],o[Oe+12>>2]=o[l+12>>2],So(Oe,w,ei),o[g>>2]=0,Oe=m+c+((m|0)==5&1)|0,(Oe|0)<=(c|0)){te=_t;return}z=o[w>>2]|0,O=Vt+4|0,Z=ze+4|0,se=c+5|0,pe=16880+(z<<2)|0,de=16960+(z<<2)|0,me=Nt+8|0,Ie=ai+8|0,Be=pi+8|0,Je=vt+4|0,S=c;e:for(;;){P=ei+(((S|0)%5|0)<<4)|0,o[vt>>2]=o[P>>2],o[vt+4>>2]=o[P+4>>2],o[vt+8>>2]=o[P+8>>2],o[vt+12>>2]=o[P+12>>2];do;while((Jn(vt,z,0,1)|0)==2);if((S|0)>(c|0)&(vn(a)|0)!=0){if(o[ze>>2]=o[vt>>2],o[ze+4>>2]=o[vt+4>>2],o[ze+8>>2]=o[vt+8>>2],o[ze+12>>2]=o[vt+12>>2],hi(O,De),m=o[ze>>2]|0,w=o[17040+(m*80|0)+(o[Vt>>2]<<2)>>2]|0,o[ze>>2]=o[18640+(m*80|0)+(w*20|0)>>2],P=o[18640+(m*80|0)+(w*20|0)+16>>2]|0,(P|0)>0){l=0;do fa(Z),l=l+1|0;while((l|0)<(P|0))}switch(P=18640+(m*80|0)+(w*20|0)+4|0,o[bt>>2]=o[P>>2],o[bt+4>>2]=o[P+4>>2],o[bt+8>>2]=o[P+8>>2],wi(bt,(o[pe>>2]|0)*3|0),bi(Z,bt,Z),Qr(Z),hi(Z,Zt),Mt=+(o[de>>2]|0),X[Nt>>3]=Mt*3,X[me>>3]=0,li=Mt*-1.5,X[ai>>3]=li,X[Ie>>3]=Mt*2.598076211353316,X[pi>>3]=li,X[Be>>3]=Mt*-2.598076211353316,o[17040+((o[ze>>2]|0)*80|0)+(o[vt>>2]<<2)>>2]|0){case 1:{l=ai,m=Nt;break}case 3:{l=pi,m=ai;break}case 2:{l=Nt,m=pi;break}default:{l=12;break e}}Nn(De,Zt,m,l,Mi),Ar(Mi,o[ze>>2]|0,z,1,g+8+(o[g>>2]<<4)|0),o[g>>2]=(o[g>>2]|0)+1}if((S|0)<(se|0)&&(hi(Je,ze),Ar(ze,o[vt>>2]|0,z,1,g+8+(o[g>>2]<<4)|0),o[g>>2]=(o[g>>2]|0)+1),o[Vt>>2]=o[vt>>2],o[Vt+4>>2]=o[vt+4>>2],o[Vt+8>>2]=o[vt+8>>2],o[Vt+12>>2]=o[vt+12>>2],S=S+1|0,(S|0)>=(Oe|0)){l=3;break}}if((l|0)==3){te=_t;return}else(l|0)==12&&qt(26970,27017,572,27027)}function So(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0,S=0,z=0;z=te,te=te+128|0,m=z+64|0,g=z,w=m,P=20240,S=w+60|0;do o[w>>2]=o[P>>2],w=w+4|0,P=P+4|0;while((w|0)<(S|0));w=g,P=20304,S=w+60|0;do o[w>>2]=o[P>>2],w=w+4|0,P=P+4|0;while((w|0)<(S|0));S=(vn(o[a>>2]|0)|0)==0,m=S?m:g,g=l+4|0,xr(g),ys(g),vn(o[a>>2]|0)|0&&(Kn(g),o[a>>2]=(o[a>>2]|0)+1),o[c>>2]=o[l>>2],a=c+4|0,bi(g,m,a),Qr(a),o[c+16>>2]=o[l>>2],a=c+20|0,bi(g,m+12|0,a),Qr(a),o[c+32>>2]=o[l>>2],a=c+36|0,bi(g,m+24|0,a),Qr(a),o[c+48>>2]=o[l>>2],a=c+52|0,bi(g,m+36|0,a),Qr(a),o[c+64>>2]=o[l>>2],c=c+68|0,bi(g,m+48|0,c),Qr(c),te=z}function Jn(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0;if(me=te,te=te+32|0,pe=me+12|0,S=me,de=l+4|0,se=o[16960+(a<<2)>>2]|0,Z=(m|0)!=0,se=Z?se*3|0:se,g=o[de>>2]|0,O=l+8|0,P=o[O>>2]|0,Z){if(w=l+12|0,m=o[w>>2]|0,g=P+g+m|0,(g|0)==(se|0))return de=1,te=me,de|0;z=w}else z=l+12|0,m=o[z>>2]|0,g=P+g+m|0;if((g|0)<=(se|0))return de=0,te=me,de|0;do if((m|0)>0){if(m=o[l>>2]|0,(P|0)>0){w=18640+(m*80|0)+60|0,m=l;break}m=18640+(m*80|0)+40|0,c?(Ls(pe,se,0,0),nn(de,pe,S),Bn(S),bi(S,pe,de),w=m,m=l):(w=m,m=l)}else w=18640+((o[l>>2]|0)*80|0)+20|0,m=l;while(!1);if(o[m>>2]=o[w>>2],g=w+16|0,(o[g>>2]|0)>0){m=0;do fa(de),m=m+1|0;while((m|0)<(o[g>>2]|0))}return l=w+4|0,o[pe>>2]=o[l>>2],o[pe+4>>2]=o[l+4>>2],o[pe+8>>2]=o[l+8>>2],a=o[16880+(a<<2)>>2]|0,wi(pe,Z?a*3|0:a),bi(de,pe,de),Qr(de),Z?m=((o[O>>2]|0)+(o[de>>2]|0)+(o[z>>2]|0)|0)==(se|0)?1:2:m=2,de=m,te=me,de|0}function hu(l,a){l=l|0,a=a|0;var c=0;do c=Jn(l,a,0,1)|0;while((c|0)==2);return c|0}function da(l,a,c,m,g){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0;var w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0,Be=0,Je=0,Oe=0,ze=0,De=0,bt=0,Zt=0,Nt=0,ai=0,pi=0,Mi=0,ei=0;if(pi=te,te=te+240|0,w=pi+224|0,bt=pi+208|0,Zt=pi,Nt=pi+192|0,ai=pi+176|0,Be=pi+160|0,Je=pi+144|0,Oe=pi+128|0,ze=pi+112|0,De=pi+96|0,o[w>>2]=a,o[bt>>2]=o[l>>2],o[bt+4>>2]=o[l+4>>2],o[bt+8>>2]=o[l+8>>2],o[bt+12>>2]=o[l+12>>2],bl(bt,w,Zt),o[g>>2]=0,Ie=m+c+((m|0)==6&1)|0,(Ie|0)<=(c|0)){te=pi;return}z=o[w>>2]|0,O=c+6|0,Z=16960+(z<<2)|0,se=Je+8|0,pe=Oe+8|0,de=ze+8|0,me=Nt+4|0,P=0,S=c,m=-1;e:for(;;){if(w=(S|0)%6|0,l=Zt+(w<<4)|0,o[Nt>>2]=o[l>>2],o[Nt+4>>2]=o[l+4>>2],o[Nt+8>>2]=o[l+8>>2],o[Nt+12>>2]=o[l+12>>2],l=P,P=Jn(Nt,z,0,1)|0,(S|0)>(c|0)&(vn(a)|0)!=0&&(l|0)!=1&&(o[Nt>>2]|0)!=(m|0)){switch(hi(Zt+(((w+5|0)%6|0)<<4)+4|0,ai),hi(Zt+(w<<4)+4|0,Be),Mi=+(o[Z>>2]|0),X[Je>>3]=Mi*3,X[se>>3]=0,ei=Mi*-1.5,X[Oe>>3]=ei,X[pe>>3]=Mi*2.598076211353316,X[ze>>3]=ei,X[de>>3]=Mi*-2.598076211353316,w=o[bt>>2]|0,o[17040+(w*80|0)+(((m|0)==(w|0)?o[Nt>>2]|0:m)<<2)>>2]|0){case 1:{l=Oe,m=Je;break}case 3:{l=ze,m=Oe;break}case 2:{l=Je,m=ze;break}default:{l=8;break e}}Nn(ai,Be,m,l,De),!(pr(ai,De)|0)&&!(pr(Be,De)|0)&&(Ar(De,o[bt>>2]|0,z,1,g+8+(o[g>>2]<<4)|0),o[g>>2]=(o[g>>2]|0)+1)}if((S|0)<(O|0)&&(hi(me,ai),Ar(ai,o[Nt>>2]|0,z,1,g+8+(o[g>>2]<<4)|0),o[g>>2]=(o[g>>2]|0)+1),S=S+1|0,(S|0)>=(Ie|0)){l=3;break}else m=o[Nt>>2]|0}if((l|0)==3){te=pi;return}else(l|0)==8&&qt(27054,27017,737,27099)}function bl(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0,S=0,z=0;z=te,te=te+160|0,m=z+80|0,g=z,w=m,P=20368,S=w+72|0;do o[w>>2]=o[P>>2],w=w+4|0,P=P+4|0;while((w|0)<(S|0));w=g,P=20448,S=w+72|0;do o[w>>2]=o[P>>2],w=w+4|0,P=P+4|0;while((w|0)<(S|0));S=(vn(o[a>>2]|0)|0)==0,m=S?m:g,g=l+4|0,xr(g),ys(g),vn(o[a>>2]|0)|0&&(Kn(g),o[a>>2]=(o[a>>2]|0)+1),o[c>>2]=o[l>>2],a=c+4|0,bi(g,m,a),Qr(a),o[c+16>>2]=o[l>>2],a=c+20|0,bi(g,m+12|0,a),Qr(a),o[c+32>>2]=o[l>>2],a=c+36|0,bi(g,m+24|0,a),Qr(a),o[c+48>>2]=o[l>>2],a=c+52|0,bi(g,m+36|0,a),Qr(a),o[c+64>>2]=o[l>>2],a=c+68|0,bi(g,m+48|0,a),Qr(a),o[c+80>>2]=o[l>>2],c=c+84|0,bi(g,m+60|0,c),Qr(c),te=z}function pa(l,a){return l=l|0,a=a|0,a=ht(l|0,a|0,52)|0,ae()|0,a&15|0}function Rn(l,a){return l=l|0,a=a|0,a=ht(l|0,a|0,45)|0,ae()|0,a&127|0}function $o(l,a,c,m){return l=l|0,a=a|0,c=c|0,m=m|0,(c+-1|0)>>>0>14?(m=4,m|0):(c=ht(l|0,a|0,(15-c|0)*3|0)|0,ae()|0,o[m>>2]=c&7,m=0,m|0)}function Zl(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0,O=0;if(l>>>0>15)return m=4,m|0;if(a>>>0>121)return m=17,m|0;P=yt(l|0,0,52)|0,g=ae()|0,S=yt(a|0,0,45)|0,g=g|(ae()|0)|134225919;e:do if((l|0)>=1){for(S=1,P=(At[20528+a>>0]|0)!=0,w=-1;;){if(a=o[c+(S+-1<<2)>>2]|0,a>>>0>6){g=18,a=10;break}if(!((a|0)==0|P^1))if((a|0)==1){g=19,a=10;break}else P=0;if(O=(15-S|0)*3|0,z=yt(7,0,O|0)|0,g=g&~(ae()|0),a=yt(a|0,((a|0)<0)<<31>>31|0,O|0)|0,w=a|w&~z,g=ae()|0|g,(S|0)<(l|0))S=S+1|0;else break e}if((a|0)==10)return g|0}else w=-1;while(!1);return O=m,o[O>>2]=w,o[O+4>>2]=g,O=0,O|0}function cs(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0,P=0;return!(!0&(a&-16777216|0)==134217728)||(m=ht(l|0,a|0,52)|0,ae()|0,m=m&15,c=ht(l|0,a|0,45)|0,ae()|0,c=c&127,c>>>0>121)?(l=0,l|0):(P=(m^15)*3|0,g=ht(l|0,a|0,P|0)|0,P=yt(g|0,ae()|0,P|0)|0,g=ae()|0,w=wr(-1227133514,-1171,P|0,g|0)|0,!((P&613566756&w|0)==0&(g&4681&(ae()|0)|0)==0)||(P=(m*3|0)+19|0,w=yt(~l|0,~a|0,P|0)|0,P=ht(w|0,ae()|0,P|0)|0,!((m|0)==15|(P|0)==0&(ae()|0)==0))?(P=0,P|0):!(At[20528+c>>0]|0)||(a=a&8191,(l|0)==0&(a|0)==0)?(P=1,P|0):(P=Jl(l|0,a|0)|0,ae()|0,((63-P|0)%3|0|0)!=0|0))}function wl(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0,P=0;return!0&(a&-16777216|0)==134217728&&(m=ht(l|0,a|0,52)|0,ae()|0,m=m&15,c=ht(l|0,a|0,45)|0,ae()|0,c=c&127,c>>>0<=121)&&(P=(m^15)*3|0,g=ht(l|0,a|0,P|0)|0,P=yt(g|0,ae()|0,P|0)|0,g=ae()|0,w=wr(-1227133514,-1171,P|0,g|0)|0,(P&613566756&w|0)==0&(g&4681&(ae()|0)|0)==0)&&(P=(m*3|0)+19|0,w=yt(~l|0,~a|0,P|0)|0,P=ht(w|0,ae()|0,P|0)|0,(m|0)==15|(P|0)==0&(ae()|0)==0)&&(!(At[20528+c>>0]|0)||(c=a&8191,(l|0)==0&(c|0)==0)||(P=Jl(l|0,c|0)|0,ae()|0,(63-P|0)%3|0|0))||Mo(l,a)|0?(P=1,P|0):(P=(fu(l,a)|0)!=0&1,P|0)}function Hs(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0;if(g=yt(a|0,0,52)|0,w=ae()|0,c=yt(c|0,0,45)|0,c=w|(ae()|0)|134225919,(a|0)<1){w=-1,m=c,a=l,o[a>>2]=w,l=l+4|0,o[l>>2]=m;return}for(w=1,g=-1;P=(15-w|0)*3|0,S=yt(7,0,P|0)|0,c=c&~(ae()|0),P=yt(m|0,0,P|0)|0,g=g&~S|P,c=c|(ae()|0),(w|0)!=(a|0);)w=w+1|0;S=l,P=S,o[P>>2]=g,S=S+4|0,o[S>>2]=c}function Xa(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0;if(w=ht(l|0,a|0,52)|0,ae()|0,w=w&15,c>>>0>15)return m=4,m|0;if((w|0)<(c|0))return m=12,m|0;if((w|0)==(c|0))return o[m>>2]=l,o[m+4>>2]=a,m=0,m|0;if(g=yt(c|0,0,52)|0,g=g|l,l=ae()|0|a&-15728641,(w|0)>(c|0))do a=yt(7,0,(14-c|0)*3|0)|0,c=c+1|0,g=a|g,l=ae()|0|l;while((c|0)<(w|0));return o[m>>2]=g,o[m+4>>2]=l,m=0,m|0}function Ws(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0;if(w=ht(l|0,a|0,52)|0,ae()|0,w=w&15,!((c|0)<16&(w|0)<=(c|0)))return m=4,m|0;g=c-w|0,c=ht(l|0,a|0,45)|0,ae()|0;e:do if(!(Vi(c&127)|0))c=ds(7,0,g,((g|0)<0)<<31>>31)|0,g=ae()|0;else{t:do if(w|0){for(c=1;P=yt(7,0,(15-c|0)*3|0)|0,!!((P&l|0)==0&((ae()|0)&a|0)==0);)if(c>>>0<w>>>0)c=c+1|0;else break t;c=ds(7,0,g,((g|0)<0)<<31>>31)|0,g=ae()|0;break e}while(!1);c=ds(7,0,g,((g|0)<0)<<31>>31)|0,c=lr(c|0,ae()|0,5,0)|0,c=Wt(c|0,ae()|0,-5,-1)|0,c=xn(c|0,ae()|0,6,0)|0,c=Wt(c|0,ae()|0,1,0)|0,g=ae()|0}while(!1);return P=m,o[P>>2]=c,o[P+4>>2]=g,P=0,P|0}function $i(l,a){l=l|0,a=a|0;var c=0,m=0,g=0;if(g=ht(l|0,a|0,45)|0,ae()|0,!(Vi(g&127)|0))return g=0,g|0;g=ht(l|0,a|0,52)|0,ae()|0,g=g&15;e:do if(!g)c=0;else for(m=1;;){if(c=ht(l|0,a|0,(15-m|0)*3|0)|0,ae()|0,c=c&7,c|0)break e;if(m>>>0<g>>>0)m=m+1|0;else{c=0;break}}while(!1);return g=(c|0)==0&1,g|0}function Qs(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0;if(P=te,te=te+16|0,w=P,el(w,l,a,c),a=w,l=o[a>>2]|0,a=o[a+4>>2]|0,(l|0)==0&(a|0)==0)return te=P,0;g=0,c=0;do S=m+(g<<3)|0,o[S>>2]=l,o[S+4>>2]=a,g=Wt(g|0,c|0,1,0)|0,c=ae()|0,tl(w),S=w,l=o[S>>2]|0,a=o[S+4>>2]|0;while(!((l|0)==0&(a|0)==0));return te=P,0}function Tl(l,a,c,m){return l=l|0,a=a|0,c=c|0,m=m|0,(m|0)<(c|0)?(c=a,m=l,Ft(c|0),m|0):(c=yt(-1,-1,((m-c|0)*3|0)+3|0)|0,m=yt(~c|0,~(ae()|0)|0,(15-m|0)*3|0)|0,c=~(ae()|0)&a,m=~m&l,Ft(c|0),m|0)}function Bs(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0;return g=ht(l|0,a|0,52)|0,ae()|0,g=g&15,(c|0)<16&(g|0)<=(c|0)?((g|0)<(c|0)&&(g=yt(-1,-1,((c+-1-g|0)*3|0)+3|0)|0,g=yt(~g|0,~(ae()|0)|0,(15-c|0)*3|0)|0,a=~(ae()|0)&a,l=~g&l),g=yt(c|0,0,52)|0,c=a&-15728641|(ae()|0),o[m>>2]=l|g,o[m+4>>2]=c,m=0,m|0):(m=4,m|0)}function uo(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0,Be=0,Je=0,Oe=0,ze=0,De=0,bt=0,Zt=0,Nt=0,ai=0,pi=0,Mi=0,ei=0,Vt=0,vt=0;if((c|0)==0&(m|0)==0)return vt=0,vt|0;if(g=l,w=o[g>>2]|0,g=o[g+4>>2]|0,!0&(g&15728640|0)==0){if(!((m|0)>0|(m|0)==0&c>>>0>0)||(vt=a,o[vt>>2]=w,o[vt+4>>2]=g,(c|0)==1&(m|0)==0))return vt=0,vt|0;g=1,w=0;do ei=l+(g<<3)|0,Vt=o[ei+4>>2]|0,vt=a+(g<<3)|0,o[vt>>2]=o[ei>>2],o[vt+4>>2]=Vt,g=Wt(g|0,w|0,1,0)|0,w=ae()|0;while((w|0)<(m|0)|(w|0)==(m|0)&g>>>0<c>>>0);return g=0,g|0}if(Mi=c<<3,Vt=Js(Mi)|0,!Vt)return vt=13,vt|0;if(fo(Vt|0,l|0,Mi|0)|0,ei=ts(c,8)|0,!ei)return Qt(Vt),vt=13,vt|0;e:for(;;){g=Vt,O=o[g>>2]|0,g=o[g+4>>2]|0,ai=ht(O|0,g|0,52)|0,ae()|0,ai=ai&15,pi=ai+-1|0,Nt=(ai|0)!=0,Zt=(m|0)>0|(m|0)==0&c>>>0>0;t:do if(Nt&Zt){if(Oe=yt(pi|0,0,52)|0,ze=ae()|0,pi>>>0>15){if(!((O|0)==0&(g|0)==0)){vt=16;break e}for(w=0,l=0;;){if(w=Wt(w|0,l|0,1,0)|0,l=ae()|0,!((l|0)<(m|0)|(l|0)==(m|0)&w>>>0<c>>>0))break t;if(P=Vt+(w<<3)|0,bt=o[P>>2]|0,P=o[P+4>>2]|0,!((bt|0)==0&(P|0)==0)){g=P,vt=16;break e}}}for(S=O,l=g,w=0,P=0;;){if(!((S|0)==0&(l|0)==0)){if(!(!0&(l&117440512|0)==0)){vt=21;break e}if(Z=ht(S|0,l|0,52)|0,ae()|0,Z=Z&15,(Z|0)<(pi|0)){g=12,vt=27;break e}if((Z|0)!=(pi|0)&&(S=S|Oe,l=l&-15728641|ze,Z>>>0>=ai>>>0)){z=pi;do bt=yt(7,0,(14-z|0)*3|0)|0,z=z+1|0,S=bt|S,l=ae()|0|l;while(z>>>0<Z>>>0)}if(pe=Do(S|0,l|0,c|0,m|0)|0,de=ae()|0,z=ei+(pe<<3)|0,Z=z,se=o[Z>>2]|0,Z=o[Z+4>>2]|0,!((se|0)==0&(Z|0)==0)){Be=0,Je=0;do{if((Be|0)>(m|0)|(Be|0)==(m|0)&Je>>>0>c>>>0){vt=31;break e}if((se|0)==(S|0)&(Z&-117440513|0)==(l|0)){me=ht(se|0,Z|0,56)|0,ae()|0,me=me&7,Ie=me+1|0,bt=ht(se|0,Z|0,45)|0,ae()|0;i:do if(!(Vi(bt&127)|0))Z=7;else{if(se=ht(se|0,Z|0,52)|0,ae()|0,se=se&15,!se){Z=6;break}for(Z=1;;){if(bt=yt(7,0,(15-Z|0)*3|0)|0,!((bt&S|0)==0&((ae()|0)&l|0)==0)){Z=7;break i}if(Z>>>0<se>>>0)Z=Z+1|0;else{Z=6;break}}}while(!1);if((me+2|0)>>>0>Z>>>0){vt=41;break e}bt=yt(Ie|0,0,56)|0,l=ae()|0|l&-117440513,De=z,o[De>>2]=0,o[De+4>>2]=0,S=bt|S}else pe=Wt(pe|0,de|0,1,0)|0,pe=ul(pe|0,ae()|0,c|0,m|0)|0,de=ae()|0;Je=Wt(Je|0,Be|0,1,0)|0,Be=ae()|0,z=ei+(pe<<3)|0,Z=z,se=o[Z>>2]|0,Z=o[Z+4>>2]|0}while(!((se|0)==0&(Z|0)==0))}bt=z,o[bt>>2]=S,o[bt+4>>2]=l}if(w=Wt(w|0,P|0,1,0)|0,P=ae()|0,!((P|0)<(m|0)|(P|0)==(m|0)&w>>>0<c>>>0))break t;l=Vt+(w<<3)|0,S=o[l>>2]|0,l=o[l+4>>2]|0}}while(!1);if(bt=Wt(c|0,m|0,5,0)|0,De=ae()|0,De>>>0<0|(De|0)==0&bt>>>0<11){vt=85;break}if(bt=xn(c|0,m|0,6,0)|0,ae()|0,bt=ts(bt,8)|0,!bt){vt=48;break}do if(Zt){for(Ie=0,l=0,me=0,Be=0;;){if(Z=ei+(Ie<<3)|0,P=Z,w=o[P>>2]|0,P=o[P+4>>2]|0,(w|0)==0&(P|0)==0)De=me;else{se=ht(w|0,P|0,56)|0,ae()|0,se=se&7,S=se+1|0,pe=P&-117440513,De=ht(w|0,P|0,45)|0,ae()|0;t:do if(Vi(De&127)|0){if(de=ht(w|0,P|0,52)|0,ae()|0,de=de&15,de|0)for(z=1;;){if(De=yt(7,0,(15-z|0)*3|0)|0,!((w&De|0)==0&(pe&(ae()|0)|0)==0))break t;if(z>>>0<de>>>0)z=z+1|0;else break}P=yt(S|0,0,56)|0,w=P|w,P=ae()|0|pe,S=Z,o[S>>2]=w,o[S+4>>2]=P,S=se+2|0}while(!1);(S|0)==7?(De=bt+(l<<3)|0,o[De>>2]=w,o[De+4>>2]=P&-117440513,l=Wt(l|0,me|0,1,0)|0,De=ae()|0):De=me}if(Ie=Wt(Ie|0,Be|0,1,0)|0,Be=ae()|0,(Be|0)<(m|0)|(Be|0)==(m|0)&Ie>>>0<c>>>0)me=De;else break}if(Zt){if(Je=pi>>>0>15,Oe=yt(pi|0,0,52)|0,ze=ae()|0,!Nt){for(w=0,z=0,S=0,P=0;(O|0)==0&(g|0)==0||(pi=a+(w<<3)|0,o[pi>>2]=O,o[pi+4>>2]=g,w=Wt(w|0,z|0,1,0)|0,z=ae()|0),S=Wt(S|0,P|0,1,0)|0,P=ae()|0,!!((P|0)<(m|0)|(P|0)==(m|0)&S>>>0<c>>>0);)g=Vt+(S<<3)|0,O=o[g>>2]|0,g=o[g+4>>2]|0;g=De;break}for(w=0,z=0,P=0,S=0;;){do if(!((O|0)==0&(g|0)==0)){if(de=ht(O|0,g|0,52)|0,ae()|0,de=de&15,Je|(de|0)<(pi|0)){vt=80;break e}if((de|0)!=(pi|0)){if(Z=O|Oe,se=g&-15728641|ze,de>>>0>=ai>>>0){pe=pi;do Nt=yt(7,0,(14-pe|0)*3|0)|0,pe=pe+1|0,Z=Nt|Z,se=ae()|0|se;while(pe>>>0<de>>>0)}}else Z=O,se=g;me=Do(Z|0,se|0,c|0,m|0)|0,pe=0,de=0,Be=ae()|0;do{if((pe|0)>(m|0)|(pe|0)==(m|0)&de>>>0>c>>>0){vt=81;break e}if(Nt=ei+(me<<3)|0,Ie=o[Nt+4>>2]|0,(Ie&-117440513|0)==(se|0)&&(o[Nt>>2]|0)==(Z|0)){vt=65;break}Nt=Wt(me|0,Be|0,1,0)|0,me=ul(Nt|0,ae()|0,c|0,m|0)|0,Be=ae()|0,de=Wt(de|0,pe|0,1,0)|0,pe=ae()|0,Nt=ei+(me<<3)|0}while(!((o[Nt>>2]|0)==(Z|0)&&(o[Nt+4>>2]|0)==(se|0)));if((vt|0)==65&&(vt=0,!0&(Ie&117440512|0)==100663296))break;Nt=a+(w<<3)|0,o[Nt>>2]=O,o[Nt+4>>2]=g,w=Wt(w|0,z|0,1,0)|0,z=ae()|0}while(!1);if(P=Wt(P|0,S|0,1,0)|0,S=ae()|0,!((S|0)<(m|0)|(S|0)==(m|0)&P>>>0<c>>>0))break;g=Vt+(P<<3)|0,O=o[g>>2]|0,g=o[g+4>>2]|0}g=De}else w=0,g=De}else w=0,l=0,g=0;while(!1);if(bn(ei|0,0,Mi|0)|0,fo(Vt|0,bt|0,l<<3|0)|0,Qt(bt),(l|0)==0&(g|0)==0){vt=89;break}else a=a+(w<<3)|0,m=g,c=l}if((vt|0)==16)!0&(g&117440512|0)==0?(g=4,vt=27):vt=21;else if((vt|0)==31)qt(27795,27122,620,27132);else{if((vt|0)==41)return Qt(Vt),Qt(ei),vt=10,vt|0;if((vt|0)==48)return Qt(Vt),Qt(ei),vt=13,vt|0;(vt|0)==80?qt(27795,27122,711,27132):(vt|0)==81?qt(27795,27122,723,27132):(vt|0)==85&&(fo(a|0,Vt|0,c<<3|0)|0,vt=89)}return(vt|0)==21?(Qt(Vt),Qt(ei),vt=5,vt|0):(vt|0)==27?(Qt(Vt),Qt(ei),vt=g,vt|0):(vt|0)==89?(Qt(Vt),Qt(ei),vt=0,vt|0):0}function Ul(l,a,c,m,g,w,P){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0,w=w|0,P=P|0;var S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0;if(Ie=te,te=te+16|0,me=Ie,!((c|0)>0|(c|0)==0&a>>>0>0))return me=0,te=Ie,me|0;if((P|0)>=16)return me=12,te=Ie,me|0;pe=0,de=0,se=0,S=0;e:for(;;){if(O=l+(pe<<3)|0,z=o[O>>2]|0,O=o[O+4>>2]|0,Z=ht(z|0,O|0,52)|0,ae()|0,(Z&15|0)>(P|0)){S=12,z=11;break}if(el(me,z,O,P),Z=me,O=o[Z>>2]|0,Z=o[Z+4>>2]|0,(O|0)==0&(Z|0)==0)z=se;else{z=se;do{if(!((S|0)<(w|0)|(S|0)==(w|0)&z>>>0<g>>>0)){z=10;break e}se=m+(z<<3)|0,o[se>>2]=O,o[se+4>>2]=Z,z=Wt(z|0,S|0,1,0)|0,S=ae()|0,tl(me),se=me,O=o[se>>2]|0,Z=o[se+4>>2]|0}while(!((O|0)==0&(Z|0)==0))}if(pe=Wt(pe|0,de|0,1,0)|0,de=ae()|0,(de|0)<(c|0)|(de|0)==(c|0)&pe>>>0<a>>>0)se=z;else{S=0,z=11;break}}return(z|0)==10?(me=14,te=Ie,me|0):(z|0)==11?(te=Ie,S|0):0}function ma(l,a,c,m,g){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0;var w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0;pe=te,te=te+16|0,se=pe;e:do if((c|0)>0|(c|0)==0&a>>>0>0){for(O=0,P=0,w=0,Z=0;;){if(z=l+(O<<3)|0,S=o[z>>2]|0,z=o[z+4>>2]|0,!((S|0)==0&(z|0)==0)&&(z=(Ws(S,z,m,se)|0)==0,S=se,P=Wt(o[S>>2]|0,o[S+4>>2]|0,P|0,w|0)|0,w=ae()|0,!z)){w=12;break}if(O=Wt(O|0,Z|0,1,0)|0,Z=ae()|0,!((Z|0)<(c|0)|(Z|0)==(c|0)&O>>>0<a>>>0))break e}return te=pe,w|0}else P=0,w=0;while(!1);return o[g>>2]=P,o[g+4>>2]=w,g=0,te=pe,g|0}function cu(l,a){return l=l|0,a=a|0,a=ht(l|0,a|0,52)|0,ae()|0,a&1|0}function Ir(l,a){l=l|0,a=a|0;var c=0,m=0,g=0;if(g=ht(l|0,a|0,52)|0,ae()|0,g=g&15,!g)return g=0,g|0;for(m=1;;){if(c=ht(l|0,a|0,(15-m|0)*3|0)|0,ae()|0,c=c&7,c|0){m=5;break}if(m>>>0<g>>>0)m=m+1|0;else{c=0,m=5;break}}return(m|0)==5?c|0:0}function Ka(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0,P=0,S=0,z=0;if(z=ht(l|0,a|0,52)|0,ae()|0,z=z&15,!z)return S=a,z=l,Ft(S|0),z|0;for(S=1,c=0;;){w=(15-S|0)*3|0,m=yt(7,0,w|0)|0,g=ae()|0,P=ht(l|0,a|0,w|0)|0,ae()|0,w=yt(Wo(P&7)|0,0,w|0)|0,P=ae()|0,l=w|l&~m,a=P|a&~g;e:do if(!c)if((w&m|0)==0&(P&g|0)==0)c=0;else if(m=ht(l|0,a|0,52)|0,ae()|0,m=m&15,!m)c=1;else{c=1;t:for(;;){switch(P=ht(l|0,a|0,(15-c|0)*3|0)|0,ae()|0,P&7){case 1:break t;case 0:break;default:{c=1;break e}}if(c>>>0<m>>>0)c=c+1|0;else{c=1;break e}}for(c=1;;)if(P=(15-c|0)*3|0,g=ht(l|0,a|0,P|0)|0,ae()|0,w=yt(7,0,P|0)|0,a=a&~(ae()|0),P=yt(Wo(g&7)|0,0,P|0)|0,l=l&~w|P,a=a|(ae()|0),c>>>0<m>>>0)c=c+1|0;else{c=1;break}}while(!1);if(S>>>0<z>>>0)S=S+1|0;else break}return Ft(a|0),l|0}function yn(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0,P=0;if(m=ht(l|0,a|0,52)|0,ae()|0,m=m&15,!m)return c=a,m=l,Ft(c|0),m|0;for(c=1;w=(15-c|0)*3|0,P=ht(l|0,a|0,w|0)|0,ae()|0,g=yt(7,0,w|0)|0,a=a&~(ae()|0),w=yt(Wo(P&7)|0,0,w|0)|0,l=w|l&~g,a=ae()|0|a,c>>>0<m>>>0;)c=c+1|0;return Ft(a|0),l|0}function Gl(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0,P=0,S=0,z=0;if(z=ht(l|0,a|0,52)|0,ae()|0,z=z&15,!z)return S=a,z=l,Ft(S|0),z|0;for(S=1,c=0;;){w=(15-S|0)*3|0,m=yt(7,0,w|0)|0,g=ae()|0,P=ht(l|0,a|0,w|0)|0,ae()|0,w=yt(Gs(P&7)|0,0,w|0)|0,P=ae()|0,l=w|l&~m,a=P|a&~g;e:do if(!c)if((w&m|0)==0&(P&g|0)==0)c=0;else if(m=ht(l|0,a|0,52)|0,ae()|0,m=m&15,!m)c=1;else{c=1;t:for(;;){switch(P=ht(l|0,a|0,(15-c|0)*3|0)|0,ae()|0,P&7){case 1:break t;case 0:break;default:{c=1;break e}}if(c>>>0<m>>>0)c=c+1|0;else{c=1;break e}}for(c=1;;)if(g=(15-c|0)*3|0,w=yt(7,0,g|0)|0,P=a&~(ae()|0),a=ht(l|0,a|0,g|0)|0,ae()|0,a=yt(Gs(a&7)|0,0,g|0)|0,l=l&~w|a,a=P|(ae()|0),c>>>0<m>>>0)c=c+1|0;else{c=1;break}}while(!1);if(S>>>0<z>>>0)S=S+1|0;else break}return Ft(a|0),l|0}function As(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0,P=0;if(m=ht(l|0,a|0,52)|0,ae()|0,m=m&15,!m)return c=a,m=l,Ft(c|0),m|0;for(c=1;P=(15-c|0)*3|0,w=yt(7,0,P|0)|0,g=a&~(ae()|0),a=ht(l|0,a|0,P|0)|0,ae()|0,a=yt(Gs(a&7)|0,0,P|0)|0,l=a|l&~w,a=ae()|0|g,c>>>0<m>>>0;)c=c+1|0;return Ft(a|0),l|0}function Ba(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0;if(z=te,te=te+64|0,S=z+40|0,m=z+24|0,g=z+12|0,w=z,yt(a|0,0,52)|0,c=ae()|0|134225919,!a)return(o[l+4>>2]|0)>2||(o[l+8>>2]|0)>2||(o[l+12>>2]|0)>2?(P=0,S=0,Ft(P|0),te=z,S|0):(yt(Ho(l)|0,0,45)|0,P=ae()|0|c,S=-1,Ft(P|0),te=z,S|0);if(o[S>>2]=o[l>>2],o[S+4>>2]=o[l+4>>2],o[S+8>>2]=o[l+8>>2],o[S+12>>2]=o[l+12>>2],P=S+4|0,(a|0)>0)for(l=-1;o[m>>2]=o[P>>2],o[m+4>>2]=o[P+4>>2],o[m+8>>2]=o[P+8>>2],a&1?(Da(P),o[g>>2]=o[P>>2],o[g+4>>2]=o[P+4>>2],o[g+8>>2]=o[P+8>>2],oo(g)):(Xn(P),o[g>>2]=o[P>>2],o[g+4>>2]=o[P+4>>2],o[g+8>>2]=o[P+8>>2],Kn(g)),nn(m,g,w),Qr(w),Z=(15-a|0)*3|0,O=yt(7,0,Z|0)|0,c=c&~(ae()|0),Z=yt(ri(w)|0,0,Z|0)|0,l=Z|l&~O,c=ae()|0|c,(a|0)>1;)a=a+-1|0;else l=-1;e:do if((o[P>>2]|0)<=2&&(o[S+8>>2]|0)<=2&&(o[S+12>>2]|0)<=2){if(m=Ho(S)|0,a=yt(m|0,0,45)|0,a=a|l,l=ae()|0|c&-1040385,w=Nl(S)|0,!(Vi(m)|0)){if((w|0)<=0)break;for(g=0;;){if(m=ht(a|0,l|0,52)|0,ae()|0,m=m&15,m)for(c=1;Z=(15-c|0)*3|0,S=ht(a|0,l|0,Z|0)|0,ae()|0,O=yt(7,0,Z|0)|0,l=l&~(ae()|0),Z=yt(Wo(S&7)|0,0,Z|0)|0,a=a&~O|Z,l=l|(ae()|0),c>>>0<m>>>0;)c=c+1|0;if(g=g+1|0,(g|0)==(w|0))break e}}g=ht(a|0,l|0,52)|0,ae()|0,g=g&15;t:do if(g){c=1;i:for(;;){switch(Z=ht(a|0,l|0,(15-c|0)*3|0)|0,ae()|0,Z&7){case 1:break i;case 0:break;default:break t}if(c>>>0<g>>>0)c=c+1|0;else break t}if(Ht(m,o[S>>2]|0)|0)for(c=1;S=(15-c|0)*3|0,O=yt(7,0,S|0)|0,Z=l&~(ae()|0),l=ht(a|0,l|0,S|0)|0,ae()|0,l=yt(Gs(l&7)|0,0,S|0)|0,a=a&~O|l,l=Z|(ae()|0),c>>>0<g>>>0;)c=c+1|0;else for(c=1;Z=(15-c|0)*3|0,S=ht(a|0,l|0,Z|0)|0,ae()|0,O=yt(7,0,Z|0)|0,l=l&~(ae()|0),Z=yt(Wo(S&7)|0,0,Z|0)|0,a=a&~O|Z,l=l|(ae()|0),c>>>0<g>>>0;)c=c+1|0}while(!1);if((w|0)>0){c=0;do a=Ka(a,l)|0,l=ae()|0,c=c+1|0;while((c|0)!=(w|0))}}else a=0,l=0;while(!1);return O=l,Z=a,Ft(O|0),te=z,Z|0}function vn(l){return l=l|0,(l|0)%2|0|0}function Fn(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0;return g=te,te=te+16|0,m=g,a>>>0>15?(m=4,te=g,m|0):(o[l+4>>2]&2146435072|0)==2146435072||(o[l+8+4>>2]&2146435072|0)==2146435072?(m=3,te=g,m|0):(La(l,a,m),a=Ba(m,a)|0,m=ae()|0,o[c>>2]=a,o[c+4>>2]=m,(a|0)==0&(m|0)==0&&qt(27795,27122,1050,27145),m=0,te=g,m|0)}function ho(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0;if(g=c+4|0,w=ht(l|0,a|0,52)|0,ae()|0,w=w&15,P=ht(l|0,a|0,45)|0,ae()|0,m=(w|0)==0,Vi(P&127)|0){if(m)return P=1,P|0;m=1}else{if(m)return P=0,P|0;(o[g>>2]|0)==0&&(o[c+8>>2]|0)==0?m=(o[c+12>>2]|0)!=0&1:m=1}for(c=1;c&1?oo(g):Kn(g),P=ht(l|0,a|0,(15-c|0)*3|0)|0,ae()|0,ka(g,P&7),c>>>0<w>>>0;)c=c+1|0;return m|0}function $s(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0;if(Z=te,te=te+16|0,z=Z,O=ht(l|0,a|0,45)|0,ae()|0,O=O&127,O>>>0>121)return o[c>>2]=0,o[c+4>>2]=0,o[c+8>>2]=0,o[c+12>>2]=0,O=5,te=Z,O|0;e:do if((Vi(O)|0)!=0&&(w=ht(l|0,a|0,52)|0,ae()|0,w=w&15,(w|0)!=0)){m=1;t:for(;;){switch(S=ht(l|0,a|0,(15-m|0)*3|0)|0,ae()|0,S&7){case 5:break t;case 0:break;default:{m=a;break e}}if(m>>>0<w>>>0)m=m+1|0;else{m=a;break e}}for(g=1,m=a;a=(15-g|0)*3|0,P=yt(7,0,a|0)|0,S=m&~(ae()|0),m=ht(l|0,m|0,a|0)|0,ae()|0,m=yt(Gs(m&7)|0,0,a|0)|0,l=l&~P|m,m=S|(ae()|0),g>>>0<w>>>0;)g=g+1|0}else m=a;while(!1);if(S=7696+(O*28|0)|0,o[c>>2]=o[S>>2],o[c+4>>2]=o[S+4>>2],o[c+8>>2]=o[S+8>>2],o[c+12>>2]=o[S+12>>2],!(ho(l,m,c)|0))return O=0,te=Z,O|0;if(P=c+4|0,o[z>>2]=o[P>>2],o[z+4>>2]=o[P+4>>2],o[z+8>>2]=o[P+8>>2],w=ht(l|0,m|0,52)|0,ae()|0,S=w&15,w&1?(Kn(P),w=S+1|0):w=S,!(Vi(O)|0))m=0;else{e:do if(!S)m=0;else for(a=1;;){if(g=ht(l|0,m|0,(15-a|0)*3|0)|0,ae()|0,g=g&7,g|0){m=g;break e}if(a>>>0<S>>>0)a=a+1|0;else{m=0;break}}while(!1);m=(m|0)==4&1}if(!(Jn(c,w,m,0)|0))(w|0)!=(S|0)&&(o[P>>2]=o[z>>2],o[P+4>>2]=o[z+4>>2],o[P+8>>2]=o[z+8>>2]);else{if(Vi(O)|0)do;while((Jn(c,w,0,0)|0)!=0);(w|0)!=(S|0)&&Xn(P)}return O=0,te=Z,O|0}function xs(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0;return w=te,te=te+16|0,m=w,g=$s(l,a,m)|0,g|0?(te=w,g|0):(g=ht(l|0,a|0,52)|0,ae()|0,xl(m,g&15,c),g=0,te=w,g|0)}function fs(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0,S=0;if(P=te,te=te+16|0,w=P,m=$s(l,a,w)|0,m|0)return w=m,te=P,w|0;m=ht(l|0,a|0,45)|0,ae()|0,m=(Vi(m&127)|0)==0,g=ht(l|0,a|0,52)|0,ae()|0,g=g&15;e:do if(!m){if(g|0)for(m=1;;){if(S=yt(7,0,(15-m|0)*3|0)|0,!((S&l|0)==0&((ae()|0)&a|0)==0))break e;if(m>>>0<g>>>0)m=m+1|0;else break}return Eo(w,g,0,5,c),S=0,te=P,S|0}while(!1);return da(w,g,0,6,c),S=0,te=P,S|0}function Yo(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0;if(g=ht(l|0,a|0,45)|0,ae()|0,!(Vi(g&127)|0))return g=2,o[c>>2]=g,0;if(g=ht(l|0,a|0,52)|0,ae()|0,g=g&15,!g)return g=5,o[c>>2]=g,0;for(m=1;;){if(w=yt(7,0,(15-m|0)*3|0)|0,!((w&l|0)==0&((ae()|0)&a|0)==0)){m=2,l=6;break}if(m>>>0<g>>>0)m=m+1|0;else{m=5,l=6;break}}return(l|0)==6&&(o[c>>2]=m),0}function Ys(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0;se=te,te=te+128|0,O=se+112|0,w=se+96|0,Z=se,g=ht(l|0,a|0,52)|0,ae()|0,S=g&15,o[O>>2]=S,P=ht(l|0,a|0,45)|0,ae()|0,P=P&127;e:do if(Vi(P)|0){if(S|0)for(m=1;;){if(z=yt(7,0,(15-m|0)*3|0)|0,!((z&l|0)==0&((ae()|0)&a|0)==0)){g=0;break e}if(m>>>0<S>>>0)m=m+1|0;else break}if(g&1)g=1;else return z=yt(S+1|0,0,52)|0,Z=ae()|0|a&-15728641,O=yt(7,0,(14-S|0)*3|0)|0,Z=Ys((z|l)&~O,Z&~(ae()|0),c)|0,te=se,Z|0}else g=0;while(!1);if(m=$s(l,a,w)|0,!m){g?(So(w,O,Z),z=5):(bl(w,O,Z),z=6);e:do if(Vi(P)|0)if(!S)l=5;else for(m=1;;){if(P=yt(7,0,(15-m|0)*3|0)|0,!((P&l|0)==0&((ae()|0)&a|0)==0)){l=2;break e}if(m>>>0<S>>>0)m=m+1|0;else{l=5;break}}else l=2;while(!1);bn(c|0,-1,l<<2|0)|0;e:do if(g)for(w=0;;){if(P=Z+(w<<4)|0,hu(P,o[O>>2]|0)|0,P=o[P>>2]|0,S=o[c>>2]|0,(S|0)==-1|(S|0)==(P|0))m=c;else{g=0;do{if(g=g+1|0,g>>>0>=l>>>0){m=1;break e}m=c+(g<<2)|0,S=o[m>>2]|0}while(!((S|0)==-1|(S|0)==(P|0)))}if(o[m>>2]=P,w=w+1|0,w>>>0>=z>>>0){m=0;break}}else for(w=0;;){if(P=Z+(w<<4)|0,Jn(P,o[O>>2]|0,0,1)|0,P=o[P>>2]|0,S=o[c>>2]|0,(S|0)==-1|(S|0)==(P|0))m=c;else{g=0;do{if(g=g+1|0,g>>>0>=l>>>0){m=1;break e}m=c+(g<<2)|0,S=o[m>>2]|0}while(!((S|0)==-1|(S|0)==(P|0)))}if(o[m>>2]=P,w=w+1|0,w>>>0>=z>>>0){m=0;break}}while(!1)}return Z=m,te=se,Z|0}function Ja(){return 12}function Pl(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0,P=0,S=0,z=0;if(l>>>0>15)return S=4,S|0;if(yt(l|0,0,52)|0,S=ae()|0|134225919,!l){c=0,m=0;do Vi(m)|0&&(yt(m|0,0,45)|0,P=S|(ae()|0),l=a+(c<<3)|0,o[l>>2]=-1,o[l+4>>2]=P,c=c+1|0),m=m+1|0;while((m|0)!=122);return c=0,c|0}c=0,P=0;do{if(Vi(P)|0){for(yt(P|0,0,45)|0,m=1,g=-1,w=S|(ae()|0);z=yt(7,0,(15-m|0)*3|0)|0,g=g&~z,w=w&~(ae()|0),(m|0)!=(l|0);)m=m+1|0;z=a+(c<<3)|0,o[z>>2]=g,o[z+4>>2]=w,c=c+1|0}P=P+1|0}while((P|0)!=122);return c=0,c|0}function Ra(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0,Be=0,Je=0,Oe=0;if(Oe=te,te=te+16|0,Be=Oe,Je=ht(l|0,a|0,52)|0,ae()|0,Je=Je&15,c>>>0>15)return Je=4,te=Oe,Je|0;if((Je|0)<(c|0))return Je=12,te=Oe,Je|0;if((Je|0)!=(c|0))if(w=yt(c|0,0,52)|0,w=w|l,S=ae()|0|a&-15728641,(Je|0)>(c|0)){z=c;do Ie=yt(7,0,(14-z|0)*3|0)|0,z=z+1|0,w=Ie|w,S=ae()|0|S;while((z|0)<(Je|0));Ie=w}else Ie=w;else Ie=l,S=a;me=ht(Ie|0,S|0,45)|0,ae()|0;e:do if(Vi(me&127)|0){if(z=ht(Ie|0,S|0,52)|0,ae()|0,z=z&15,z|0)for(w=1;;){if(me=yt(7,0,(15-w|0)*3|0)|0,!((me&Ie|0)==0&((ae()|0)&S|0)==0)){O=33;break e}if(w>>>0<z>>>0)w=w+1|0;else break}if(me=m,o[me>>2]=0,o[me+4>>2]=0,(Je|0)>(c|0)){for(me=a&-15728641,de=Je;;){if(pe=de,de=de+-1|0,de>>>0>15|(Je|0)<(de|0)){O=19;break}if((Je|0)!=(de|0))if(w=yt(de|0,0,52)|0,w=w|l,z=ae()|0|me,(Je|0)<(pe|0))se=w;else{O=de;do se=yt(7,0,(14-O|0)*3|0)|0,O=O+1|0,w=se|w,z=ae()|0|z;while((O|0)<(Je|0));se=w}else se=l,z=a;if(Z=ht(se|0,z|0,45)|0,ae()|0,!(Vi(Z&127)|0))w=0;else{Z=ht(se|0,z|0,52)|0,ae()|0,Z=Z&15;t:do if(!Z)w=0;else for(O=1;;){if(w=ht(se|0,z|0,(15-O|0)*3|0)|0,ae()|0,w=w&7,w|0)break t;if(O>>>0<Z>>>0)O=O+1|0;else{w=0;break}}while(!1);w=(w|0)==0&1}if(z=ht(l|0,a|0,(15-pe|0)*3|0)|0,ae()|0,z=z&7,(z|0)==7){g=5,O=42;break}if(w=(w|0)!=0,(z|0)==1&w){g=5,O=42;break}if(se=z+(((z|0)!=0&w)<<31>>31)|0,se|0&&(O=Je-pe|0,O=ds(7,0,O,((O|0)<0)<<31>>31)|0,Z=ae()|0,w?(w=lr(O|0,Z|0,5,0)|0,w=Wt(w|0,ae()|0,-5,-1)|0,w=xn(w|0,ae()|0,6,0)|0,w=Wt(w|0,ae()|0,1,0)|0,z=ae()|0):(w=O,z=Z),pe=se+-1|0,pe=lr(O|0,Z|0,pe|0,((pe|0)<0)<<31>>31|0)|0,pe=Wt(w|0,z|0,pe|0,ae()|0)|0,se=ae()|0,Z=m,Z=Wt(pe|0,se|0,o[Z>>2]|0,o[Z+4>>2]|0)|0,se=ae()|0,pe=m,o[pe>>2]=Z,o[pe+4>>2]=se),(de|0)<=(c|0)){O=37;break}}if((O|0)==19)qt(27795,27122,1367,27158);else if((O|0)==37){P=m,g=o[P+4>>2]|0,P=o[P>>2]|0;break}else if((O|0)==42)return te=Oe,g|0}else g=0,P=0}else O=33;while(!1);e:do if((O|0)==33)if(me=m,o[me>>2]=0,o[me+4>>2]=0,(Je|0)>(c|0)){for(w=Je;;){if(g=ht(l|0,a|0,(15-w|0)*3|0)|0,ae()|0,g=g&7,(g|0)==7){g=5;break}if(P=Je-w|0,P=ds(7,0,P,((P|0)<0)<<31>>31)|0,g=lr(P|0,ae()|0,g|0,0)|0,P=ae()|0,me=m,P=Wt(o[me>>2]|0,o[me+4>>2]|0,g|0,P|0)|0,g=ae()|0,me=m,o[me>>2]=P,o[me+4>>2]=g,w=w+-1|0,(w|0)<=(c|0))break e}return te=Oe,g|0}else g=0,P=0;while(!1);return Ws(Ie,S,Je,Be)|0&&qt(27795,27122,1327,27173),Je=Be,Be=o[Je+4>>2]|0,((g|0)>-1|(g|0)==-1&P>>>0>4294967295)&((Be|0)>(g|0)|((Be|0)==(g|0)?(o[Je>>2]|0)>>>0>P>>>0:0))?(Je=0,te=Oe,Je|0):(qt(27795,27122,1407,27158),0)}function Au(l,a,c,m,g,w){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0,w=w|0;var P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0;if(se=te,te=te+16|0,P=se,g>>>0>15)return w=4,te=se,w|0;if(S=ht(c|0,m|0,52)|0,ae()|0,S=S&15,(S|0)>(g|0))return w=12,te=se,w|0;if(Ws(c,m,g,P)|0&&qt(27795,27122,1327,27173),Z=P,O=o[Z+4>>2]|0,!(((a|0)>-1|(a|0)==-1&l>>>0>4294967295)&((O|0)>(a|0)|((O|0)==(a|0)?(o[Z>>2]|0)>>>0>l>>>0:0))))return w=2,te=se,w|0;Z=g-S|0,g=yt(g|0,0,52)|0,z=ae()|0|m&-15728641,O=w,o[O>>2]=g|c,o[O+4>>2]=z,O=ht(c|0,m|0,45)|0,ae()|0;e:do if(Vi(O&127)|0){if(S|0)for(P=1;;){if(O=yt(7,0,(15-P|0)*3|0)|0,!((O&c|0)==0&((ae()|0)&m|0)==0))break e;if(P>>>0<S>>>0)P=P+1|0;else break}if((Z|0)<1)return w=0,te=se,w|0;for(O=S^15,m=-1,z=1,P=1;;){S=Z-z|0,S=ds(7,0,S,((S|0)<0)<<31>>31)|0,c=ae()|0;do if(P)if(P=lr(S|0,c|0,5,0)|0,P=Wt(P|0,ae()|0,-5,-1)|0,P=xn(P|0,ae()|0,6,0)|0,g=ae()|0,(a|0)>(g|0)|(a|0)==(g|0)&l>>>0>P>>>0){a=Wt(l|0,a|0,-1,-1)|0,a=wr(a|0,ae()|0,P|0,g|0)|0,P=ae()|0,pe=w,me=o[pe>>2]|0,pe=o[pe+4>>2]|0,Ie=(O+m|0)*3|0,de=yt(7,0,Ie|0)|0,pe=pe&~(ae()|0),m=xn(a|0,P|0,S|0,c|0)|0,l=ae()|0,g=Wt(m|0,l|0,2,0)|0,Ie=yt(g|0,ae()|0,Ie|0)|0,pe=ae()|0|pe,g=w,o[g>>2]=Ie|me&~de,o[g+4>>2]=pe,l=lr(m|0,l|0,S|0,c|0)|0,l=wr(a|0,P|0,l|0,ae()|0)|0,P=0,a=ae()|0;break}else{Ie=w,de=o[Ie>>2]|0,Ie=o[Ie+4>>2]|0,me=yt(7,0,(O+m|0)*3|0)|0,Ie=Ie&~(ae()|0),P=w,o[P>>2]=de&~me,o[P+4>>2]=Ie,P=1;break}else de=w,g=o[de>>2]|0,de=o[de+4>>2]|0,m=(O+m|0)*3|0,pe=yt(7,0,m|0)|0,de=de&~(ae()|0),Ie=xn(l|0,a|0,S|0,c|0)|0,P=ae()|0,m=yt(Ie|0,P|0,m|0)|0,de=ae()|0|de,me=w,o[me>>2]=m|g&~pe,o[me+4>>2]=de,P=lr(Ie|0,P|0,S|0,c|0)|0,l=wr(l|0,a|0,P|0,ae()|0)|0,P=0,a=ae()|0;while(!1);if((Z|0)>(z|0))m=~z,z=z+1|0;else{a=0;break}}return te=se,a|0}while(!1);if((Z|0)<1)return Ie=0,te=se,Ie|0;for(g=S^15,P=1;;)if(me=Z-P|0,me=ds(7,0,me,((me|0)<0)<<31>>31)|0,Ie=ae()|0,z=w,c=o[z>>2]|0,z=o[z+4>>2]|0,S=(g-P|0)*3|0,m=yt(7,0,S|0)|0,z=z&~(ae()|0),pe=xn(l|0,a|0,me|0,Ie|0)|0,de=ae()|0,S=yt(pe|0,de|0,S|0)|0,z=ae()|0|z,O=w,o[O>>2]=S|c&~m,o[O+4>>2]=z,Ie=lr(pe|0,de|0,me|0,Ie|0)|0,l=wr(l|0,a|0,Ie|0,ae()|0)|0,a=ae()|0,(Z|0)<=(P|0)){a=0;break}else P=P+1|0;return te=se,a|0}function el(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0;g=ht(a|0,c|0,52)|0,ae()|0,g=g&15,(a|0)==0&(c|0)==0|((m|0)>15|(g|0)>(m|0))?(w=-1,a=-1,c=0,g=0):(a=Tl(a,c,g+1|0,m)|0,P=(ae()|0)&-15728641,c=yt(m|0,0,52)|0,c=a|c,P=P|(ae()|0),a=($i(c,P)|0)==0,w=g,a=a?-1:m,g=P),P=l,o[P>>2]=c,o[P+4>>2]=g,o[l+8>>2]=w,o[l+12>>2]=a}function Ml(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0;if(g=ht(l|0,a|0,52)|0,ae()|0,g=g&15,w=m+8|0,o[w>>2]=g,(l|0)==0&(a|0)==0|((c|0)>15|(g|0)>(c|0))){c=m,o[c>>2]=0,o[c+4>>2]=0,o[w>>2]=-1,o[m+12>>2]=-1;return}if(l=Tl(l,a,g+1|0,c)|0,w=(ae()|0)&-15728641,g=yt(c|0,0,52)|0,g=l|g,w=w|(ae()|0),l=m,o[l>>2]=g,o[l+4>>2]=w,l=m+12|0,$i(g,w)|0){o[l>>2]=c;return}else{o[l>>2]=-1;return}}function tl(l){l=l|0;var a=0,c=0,m=0,g=0,w=0,P=0,S=0,z=0,O=0;if(c=l,a=o[c>>2]|0,c=o[c+4>>2]|0,!((a|0)==0&(c|0)==0)&&(m=ht(a|0,c|0,52)|0,ae()|0,m=m&15,S=yt(1,0,(m^15)*3|0)|0,a=Wt(S|0,ae()|0,a|0,c|0)|0,c=ae()|0,S=l,o[S>>2]=a,o[S+4>>2]=c,S=l+8|0,P=o[S>>2]|0,!((m|0)<(P|0)))){for(z=l+12|0,w=m;;){if((w|0)==(P|0)){m=5;break}if(O=(w|0)==(o[z>>2]|0),g=(15-w|0)*3|0,m=ht(a|0,c|0,g|0)|0,ae()|0,m=m&7,O&((m|0)==1&!0)){m=7;break}if(!((m|0)==7&!0)){m=10;break}if(O=yt(1,0,g|0)|0,a=Wt(a|0,c|0,O|0,ae()|0)|0,c=ae()|0,O=l,o[O>>2]=a,o[O+4>>2]=c,(w|0)>(P|0))w=w+-1|0;else{m=10;break}}if((m|0)==5){O=l,o[O>>2]=0,o[O+4>>2]=0,o[S>>2]=-1,o[z>>2]=-1;return}else if((m|0)==7){P=yt(1,0,g|0)|0,P=Wt(a|0,c|0,P|0,ae()|0)|0,S=ae()|0,O=l,o[O>>2]=P,o[O+4>>2]=S,o[z>>2]=w+-1;return}else if((m|0)==10)return}}function Ii(l){l=+l;var a=0;return a=l<0?l+6.283185307179586:l,+(l>=6.283185307179586?a+-6.283185307179586:a)}function sn(l,a){return l=l|0,a=a|0,+ut(+(+X[l>>3]-+X[a>>3]))<17453292519943298e-27?(a=+ut(+(+X[l+8>>3]-+X[a+8>>3]))<17453292519943298e-27,a|0):(a=0,a|0)}function $r(l,a){switch(l=+l,a=a|0,a|0){case 1:{l=l<0?l+6.283185307179586:l;break}case 2:{l=l>0?l+-6.283185307179586:l;break}}return+l}function il(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0;return g=+X[a>>3],m=+X[l>>3],w=+di(+((g-m)*.5)),c=+di(+((+X[a+8>>3]-+X[l+8>>3])*.5)),c=w*w+c*(+fi(+g)*+fi(+m)*c),+(+kn(+ +zt(+c),+ +zt(+(1-c)))*2)}function Xs(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0;return g=+X[a>>3],m=+X[l>>3],w=+di(+((g-m)*.5)),c=+di(+((+X[a+8>>3]-+X[l+8>>3])*.5)),c=w*w+c*(+fi(+g)*+fi(+m)*c),+(+kn(+ +zt(+c),+ +zt(+(1-c)))*2*6371.007180918475)}function Xo(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0;return g=+X[a>>3],m=+X[l>>3],w=+di(+((g-m)*.5)),c=+di(+((+X[a+8>>3]-+X[l+8>>3])*.5)),c=w*w+c*(+fi(+g)*+fi(+m)*c),+(+kn(+ +zt(+c),+ +zt(+(1-c)))*2*6371.007180918475*1e3)}function _a(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0,P=0;return w=+X[a>>3],m=+fi(+w),g=+X[a+8>>3]-+X[l+8>>3],P=m*+di(+g),c=+X[l>>3],+ +kn(+P,+(+di(+w)*+fi(+c)-+fi(+g)*(m*+di(+c))))}function ga(l,a,c,m){l=l|0,a=+a,c=+c,m=m|0;var g=0,w=0,P=0,S=0;if(c<1e-16){o[m>>2]=o[l>>2],o[m+4>>2]=o[l+4>>2],o[m+8>>2]=o[l+8>>2],o[m+12>>2]=o[l+12>>2];return}w=a<0?a+6.283185307179586:a,w=a>=6.283185307179586?w+-6.283185307179586:w;do if(w<1e-16)a=+X[l>>3]+c,X[m>>3]=a,g=m;else{if(g=+ut(+(w+-3.141592653589793))<1e-16,a=+X[l>>3],g){a=a-c,X[m>>3]=a,g=m;break}if(P=+fi(+c),c=+di(+c),a=P*+di(+a)+ +fi(+w)*(c*+fi(+a)),a=a>1?1:a,a=+Ea(+(a<-1?-1:a)),X[m>>3]=a,+ut(+(a+-1.5707963267948966))<1e-16){X[m>>3]=1.5707963267948966,X[m+8>>3]=0;return}if(+ut(+(a+1.5707963267948966))<1e-16){X[m>>3]=-1.5707963267948966,X[m+8>>3]=0;return}if(S=1/+fi(+a),w=c*+di(+w)*S,c=+X[l>>3],a=S*((P-+di(+a)*+di(+c))/+fi(+c)),P=w>1?1:w,a=a>1?1:a,a=+X[l+8>>3]+ +kn(+(P<-1?-1:P),+(a<-1?-1:a)),a>3.141592653589793)do a=a+-6.283185307179586;while(a>3.141592653589793);if(a<-3.141592653589793)do a=a+6.283185307179586;while(a<-3.141592653589793);X[m+8>>3]=a;return}while(!1);if(+ut(+(a+-1.5707963267948966))<1e-16){X[g>>3]=1.5707963267948966,X[m+8>>3]=0;return}if(+ut(+(a+1.5707963267948966))<1e-16){X[g>>3]=-1.5707963267948966,X[m+8>>3]=0;return}if(a=+X[l+8>>3],a>3.141592653589793)do a=a+-6.283185307179586;while(a>3.141592653589793);if(a<-3.141592653589793)do a=a+6.283185307179586;while(a<-3.141592653589793);X[m+8>>3]=a}function fn(l,a){return l=l|0,a=a|0,l>>>0>15?(a=4,a|0):(X[a>>3]=+X[20656+(l<<3)>>3],a=0,a|0)}function ql(l,a){return l=l|0,a=a|0,l>>>0>15?(a=4,a|0):(X[a>>3]=+X[20784+(l<<3)>>3],a=0,a|0)}function Ko(l,a){return l=l|0,a=a|0,l>>>0>15?(a=4,a|0):(X[a>>3]=+X[20912+(l<<3)>>3],a=0,a|0)}function rl(l,a){return l=l|0,a=a|0,l>>>0>15?(a=4,a|0):(X[a>>3]=+X[21040+(l<<3)>>3],a=0,a|0)}function Rs(l,a){l=l|0,a=a|0;var c=0;return l>>>0>15?(a=4,a|0):(c=ds(7,0,l,((l|0)<0)<<31>>31)|0,c=lr(c|0,ae()|0,120,0)|0,l=ae()|0,o[a>>2]=c|2,o[a+4>>2]=l,a=0,a|0)}function Fa(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0;return pe=+X[a>>3],Z=+X[l>>3],z=+di(+((pe-Z)*.5)),w=+X[a+8>>3],O=+X[l+8>>3],P=+di(+((w-O)*.5)),S=+fi(+Z),se=+fi(+pe),P=z*z+P*(se*S*P),P=+kn(+ +zt(+P),+ +zt(+(1-P)))*2,z=+X[c>>3],pe=+di(+((z-pe)*.5)),m=+X[c+8>>3],w=+di(+((m-w)*.5)),g=+fi(+z),w=pe*pe+w*(se*g*w),w=+kn(+ +zt(+w),+ +zt(+(1-w)))*2,z=+di(+((Z-z)*.5)),m=+di(+((O-m)*.5)),m=z*z+m*(S*g*m),m=+kn(+ +zt(+m),+ +zt(+(1-m)))*2,g=(P+w+m)*.5,+(+xo(+ +zt(+(+jr(+(g*.5))*+jr(+((g-P)*.5))*+jr(+((g-w)*.5))*+jr(+((g-m)*.5)))))*4)}function es(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0,S=0;if(S=te,te=te+192|0,w=S+168|0,P=S,g=xs(l,a,w)|0,g|0)return c=g,te=S,c|0;if(fs(l,a,P)|0&&qt(27795,27190,415,27199),a=o[P>>2]|0,(a|0)>0){if(m=+Fa(P+8|0,P+8+(((a|0)!=1&1)<<4)|0,w)+0,(a|0)!=1){l=1;do g=l,l=l+1|0,m=m+ +Fa(P+8+(g<<4)|0,P+8+(((l|0)%(a|0)|0)<<4)|0,w);while((l|0)<(a|0))}}else m=0;return X[c>>3]=m,c=0,te=S,c|0}function ya(l,a,c){return l=l|0,a=a|0,c=c|0,l=es(l,a,c)|0,l|0||(X[c>>3]=+X[c>>3]*6371.007180918475*6371.007180918475),l|0}function Oa(l,a,c){return l=l|0,a=a|0,c=c|0,l=es(l,a,c)|0,l|0||(X[c>>3]=+X[c>>3]*6371.007180918475*6371.007180918475*1e3*1e3),l|0}function va(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0;if(S=te,te=te+176|0,P=S,l=vs(l,a,P)|0,l|0)return P=l,te=S,P|0;if(X[c>>3]=0,l=o[P>>2]|0,(l|0)<=1)return P=0,te=S,P|0;a=l+-1|0,l=0,m=+X[P+8>>3],g=+X[P+16>>3],w=0;do l=l+1|0,O=m,m=+X[P+8+(l<<4)>>3],Z=+di(+((m-O)*.5)),z=g,g=+X[P+8+(l<<4)+8>>3],z=+di(+((g-z)*.5)),z=Z*Z+z*(+fi(+m)*+fi(+O)*z),w=w+ +kn(+ +zt(+z),+ +zt(+(1-z)))*2;while((l|0)<(a|0));return X[c>>3]=w,P=0,te=S,P|0}function xa(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0;if(S=te,te=te+176|0,P=S,l=vs(l,a,P)|0,l|0)return P=l,w=+X[c>>3],w=w*6371.007180918475,X[c>>3]=w,te=S,P|0;if(X[c>>3]=0,l=o[P>>2]|0,(l|0)<=1)return P=0,w=0,w=w*6371.007180918475,X[c>>3]=w,te=S,P|0;a=l+-1|0,l=0,m=+X[P+8>>3],g=+X[P+16>>3],w=0;do l=l+1|0,O=m,m=+X[P+8+(l<<4)>>3],Z=+di(+((m-O)*.5)),z=g,g=+X[P+8+(l<<4)+8>>3],z=+di(+((g-z)*.5)),z=Z*Z+z*(+fi(+O)*+fi(+m)*z),w=w+ +kn(+ +zt(+z),+ +zt(+(1-z)))*2;while((l|0)!=(a|0));return X[c>>3]=w,P=0,Z=w,Z=Z*6371.007180918475,X[c>>3]=Z,te=S,P|0}function co(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0;if(S=te,te=te+176|0,P=S,l=vs(l,a,P)|0,l|0)return P=l,w=+X[c>>3],w=w*6371.007180918475,w=w*1e3,X[c>>3]=w,te=S,P|0;if(X[c>>3]=0,l=o[P>>2]|0,(l|0)<=1)return P=0,w=0,w=w*6371.007180918475,w=w*1e3,X[c>>3]=w,te=S,P|0;a=l+-1|0,l=0,m=+X[P+8>>3],g=+X[P+16>>3],w=0;do l=l+1|0,O=m,m=+X[P+8+(l<<4)>>3],Z=+di(+((m-O)*.5)),z=g,g=+X[P+8+(l<<4)+8>>3],z=+di(+((g-z)*.5)),z=Z*Z+z*(+fi(+O)*+fi(+m)*z),w=w+ +kn(+ +zt(+z),+ +zt(+(1-z)))*2;while((l|0)!=(a|0));return X[c>>3]=w,P=0,Z=w,Z=Z*6371.007180918475,Z=Z*1e3,X[c>>3]=Z,te=S,P|0}function ba(l){l=l|0;var a=0,c=0,m=0;return a=ts(1,12)|0,a||qt(27280,27235,49,27293),c=l+4|0,m=o[c>>2]|0,m|0?(m=m+8|0,o[m>>2]=a,o[c>>2]=a,a|0):(o[l>>2]|0&&qt(27310,27235,61,27333),m=l,o[m>>2]=a,o[c>>2]=a,a|0)}function nl(l,a){l=l|0,a=a|0;var c=0,m=0;return m=Js(24)|0,m||qt(27347,27235,78,27361),o[m>>2]=o[a>>2],o[m+4>>2]=o[a+4>>2],o[m+8>>2]=o[a+8>>2],o[m+12>>2]=o[a+12>>2],o[m+16>>2]=0,a=l+4|0,c=o[a>>2]|0,c|0?(o[c+16>>2]=m,o[a>>2]=m,m|0):(o[l>>2]|0&&qt(27376,27235,82,27361),o[l>>2]=m,o[a>>2]=m,m|0)}function gi(l){l=l|0;var a=0,c=0,m=0,g=0;if(l)for(m=1;;){if(a=o[l>>2]|0,a|0)do{if(c=o[a>>2]|0,c|0)do g=c,c=o[c+16>>2]|0,Qt(g);while((c|0)!=0);g=a,a=o[a+8>>2]|0,Qt(g)}while((a|0)!=0);if(a=l,l=o[l+8>>2]|0,m||Qt(a),l)m=0;else break}}function sl(l){l=l|0;var a=0,c=0,m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0,Be=0,Je=0,Oe=0,ze=0,De=0,bt=0,Zt=0,Nt=0,ai=0,pi=0,Mi=0,ei=0,Vt=0,vt=0,_t=0,Mt=0,li=0;if(g=l+8|0,o[g>>2]|0)return li=1,li|0;if(m=o[l>>2]|0,!m)return li=0,li|0;a=m,c=0;do c=c+1|0,a=o[a+8>>2]|0;while((a|0)!=0);if(c>>>0<2)return li=0,li|0;_t=Js(c<<2)|0,_t||qt(27396,27235,317,27415),vt=Js(c<<5)|0,vt||qt(27437,27235,321,27415),o[l>>2]=0,Zt=l+4|0,o[Zt>>2]=0,o[g>>2]=0,c=0,Vt=0,bt=0,se=0;e:for(;;){if(Z=o[m>>2]|0,Z){w=0,P=Z;do{if(z=+X[P+8>>3],a=P,P=o[P+16>>2]|0,O=(P|0)==0,g=O?Z:P,S=+X[g+8>>3],+ut(+(z-S))>3.141592653589793){li=14;break}w=w+(S-z)*(+X[a>>3]+ +X[g>>3])}while(!O);if((li|0)==14){li=0,w=0,a=Z;do De=+X[a+8>>3],ei=a+16|0,Mi=o[ei>>2]|0,Mi=(Mi|0)==0?Z:Mi,ze=+X[Mi+8>>3],w=w+(+X[a>>3]+ +X[Mi>>3])*((ze<0?ze+6.283185307179586:ze)-(De<0?De+6.283185307179586:De)),a=o[((a|0)==0?m:ei)>>2]|0;while((a|0)!=0)}w>0?(o[_t+(Vt<<2)>>2]=m,Vt=Vt+1|0,g=bt,a=se):li=19}else li=19;if((li|0)==19){li=0;do if(c){if(a=c+8|0,o[a>>2]|0){li=21;break e}if(c=ts(1,12)|0,!c){li=23;break e}o[a>>2]=c,g=c+4|0,P=c,a=se}else if(se){g=Zt,P=se+8|0,a=m,c=l;break}else if(o[l>>2]|0){li=27;break e}else{g=Zt,P=l,a=m,c=l;break}while(!1);if(o[P>>2]=m,o[g>>2]=m,P=vt+(bt<<5)|0,O=o[m>>2]|0,O){for(Z=vt+(bt<<5)+8|0,X[Z>>3]=17976931348623157e292,se=vt+(bt<<5)+24|0,X[se>>3]=17976931348623157e292,X[P>>3]=-17976931348623157e292,pe=vt+(bt<<5)+16|0,X[pe>>3]=-17976931348623157e292,Je=17976931348623157e292,Oe=-17976931348623157e292,g=0,de=O,z=17976931348623157e292,Ie=17976931348623157e292,Be=-17976931348623157e292,S=-17976931348623157e292;w=+X[de>>3],De=+X[de+8>>3],de=o[de+16>>2]|0,me=(de|0)==0,ze=+X[(me?O:de)+8>>3],w<z&&(X[Z>>3]=w,z=w),De<Ie&&(X[se>>3]=De,Ie=De),w>Be?X[P>>3]=w:w=Be,De>S&&(X[pe>>3]=De,S=De),Je=De>0&De<Je?De:Je,Oe=De<0&De>Oe?De:Oe,g=g|+ut(+(De-ze))>3.141592653589793,!me;)Be=w;g&&(X[pe>>3]=Oe,X[se>>3]=Je)}else o[P>>2]=0,o[P+4>>2]=0,o[P+8>>2]=0,o[P+12>>2]=0,o[P+16>>2]=0,o[P+20>>2]=0,o[P+24>>2]=0,o[P+28>>2]=0;g=bt+1|0}if(ei=m+8|0,m=o[ei>>2]|0,o[ei>>2]=0,m)bt=g,se=a;else{li=45;break}}if((li|0)==21)qt(27213,27235,35,27247);else if((li|0)==23)qt(27267,27235,37,27247);else if((li|0)==27)qt(27310,27235,61,27333);else if((li|0)==45){e:do if((Vt|0)>0){for(ei=(g|0)==0,pi=g<<2,Mi=(l|0)==0,ai=0,a=0;;){if(Nt=o[_t+(ai<<2)>>2]|0,ei)li=73;else{if(bt=Js(pi)|0,!bt){li=50;break}if(Zt=Js(pi)|0,!Zt){li=52;break}t:do if(Mi)c=0;else{for(g=0,c=0,P=l;m=vt+(g<<5)|0,El(o[P>>2]|0,m,o[Nt>>2]|0)|0?(o[bt+(c<<2)>>2]=P,o[Zt+(c<<2)>>2]=m,me=c+1|0):me=c,P=o[P+8>>2]|0,P;)g=g+1|0,c=me;if((me|0)>0)if(m=o[bt>>2]|0,(me|0)==1)c=m;else for(pe=0,de=-1,c=m,se=m;;){for(O=o[se>>2]|0,m=0,P=0;g=o[o[bt+(P<<2)>>2]>>2]|0,(g|0)==(O|0)?Z=m:Z=m+((El(g,o[Zt+(P<<2)>>2]|0,o[O>>2]|0)|0)&1)|0,P=P+1|0,(P|0)!=(me|0);)m=Z;if(g=(Z|0)>(de|0),c=g?se:c,m=pe+1|0,(m|0)==(me|0))break t;pe=m,de=g?Z:de,se=o[bt+(m<<2)>>2]|0}else c=0}while(!1);if(Qt(bt),Qt(Zt),c){if(g=c+4|0,m=o[g>>2]|0,m)c=m+8|0;else if(o[c>>2]|0){li=70;break}o[c>>2]=Nt,o[g>>2]=Nt}else li=73}if((li|0)==73){if(li=0,a=o[Nt>>2]|0,a|0)do Zt=a,a=o[a+16>>2]|0,Qt(Zt);while((a|0)!=0);Qt(Nt),a=1}if(ai=ai+1|0,(ai|0)>=(Vt|0)){Mt=a;break e}}(li|0)==50?qt(27452,27235,249,27471):(li|0)==52?qt(27490,27235,252,27471):(li|0)==70&&qt(27310,27235,61,27333)}else Mt=0;while(!1);return Qt(_t),Qt(vt),li=Mt,li|0}return 0}function El(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0;if(!(Us(a,c)|0)||(a=gn(a)|0,m=+X[c>>3],g=+X[c+8>>3],g=a&g<0?g+6.283185307179586:g,l=o[l>>2]|0,!l))return l=0,l|0;if(a){a=0,O=g,c=l;e:for(;;){for(;P=+X[c>>3],g=+X[c+8>>3],c=c+16|0,Z=o[c>>2]|0,Z=(Z|0)==0?l:Z,w=+X[Z>>3],S=+X[Z+8>>3],P>w?(z=P,P=S):(z=w,w=P,P=g,g=S),m=m==w|m==z?m+2220446049250313e-31:m,!!(m<w|m>z);)if(c=o[c>>2]|0,!c){c=22;break e}if(S=P<0?P+6.283185307179586:P,P=g<0?g+6.283185307179586:g,O=S==O|P==O?O+-2220446049250313e-31:O,z=S+(P-S)*((m-w)/(z-w)),(z<0?z+6.283185307179586:z)>O&&(a=a^1),c=o[c>>2]|0,!c){c=22;break}}if((c|0)==22)return a|0}else{a=0,O=g,c=l;e:for(;;){for(;P=+X[c>>3],g=+X[c+8>>3],c=c+16|0,Z=o[c>>2]|0,Z=(Z|0)==0?l:Z,w=+X[Z>>3],S=+X[Z+8>>3],P>w?(z=P,P=S):(z=w,w=P,P=g,g=S),m=m==w|m==z?m+2220446049250313e-31:m,!!(m<w|m>z);)if(c=o[c>>2]|0,!c){c=22;break e}if(O=P==O|g==O?O+-2220446049250313e-31:O,P+(g-P)*((m-w)/(z-w))>O&&(a=a^1),c=o[c>>2]|0,!c){c=22;break}}if((c|0)==22)return a|0}return 0}function Fs(l,a,c,m,g){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0;var w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0,Be=0,Je=0,Oe=0;if(Oe=te,te=te+32|0,Je=Oe+16|0,Be=Oe,w=ht(l|0,a|0,52)|0,ae()|0,w=w&15,de=ht(c|0,m|0,52)|0,ae()|0,(w|0)!=(de&15|0))return Je=12,te=Oe,Je|0;if(O=ht(l|0,a|0,45)|0,ae()|0,O=O&127,Z=ht(c|0,m|0,45)|0,ae()|0,Z=Z&127,O>>>0>121|Z>>>0>121)return Je=5,te=Oe,Je|0;if(de=(O|0)!=(Z|0),de){if(S=Dt(O,Z)|0,(S|0)==7)return Je=1,te=Oe,Je|0;z=Dt(Z,O)|0,(z|0)==7?qt(27514,27538,161,27548):(me=S,P=z)}else me=0,P=0;se=Vi(O)|0,pe=Vi(Z)|0,o[Je>>2]=0,o[Je+4>>2]=0,o[Je+8>>2]=0,o[Je+12>>2]=0;do if(me){if(Z=o[4272+(O*28|0)+(me<<2)>>2]|0,S=(Z|0)>0,pe)if(S){O=0,z=c,S=m;do z=Gl(z,S)|0,S=ae()|0,P=Gs(P)|0,(P|0)==1&&(P=Gs(1)|0),O=O+1|0;while((O|0)!=(Z|0));Z=P,O=z,z=S}else Z=P,O=c,z=m;else if(S){O=0,z=c,S=m;do z=As(z,S)|0,S=ae()|0,P=Gs(P)|0,O=O+1|0;while((O|0)!=(Z|0));Z=P,O=z,z=S}else Z=P,O=c,z=m;if(ho(O,z,Je)|0,de||qt(27563,27538,191,27548),S=(se|0)!=0,P=(pe|0)!=0,S&P&&qt(27590,27538,192,27548),S){if(P=Ir(l,a)|0,(P|0)==7){w=5;break}if(At[22e3+(P*7|0)+me>>0]|0){w=1;break}z=o[21168+(P*28|0)+(me<<2)>>2]|0,O=z}else if(P){if(P=Ir(O,z)|0,(P|0)==7){w=5;break}if(At[22e3+(P*7|0)+Z>>0]|0){w=1;break}O=0,z=o[21168+(Z*28|0)+(P<<2)>>2]|0}else O=0,z=0;if((O|z|0)<0)w=5;else{if((z|0)>0){S=Je+4|0,P=0;do Bn(S),P=P+1|0;while((P|0)!=(z|0))}if(o[Be>>2]=0,o[Be+4>>2]=0,o[Be+8>>2]=0,ka(Be,me),w|0)for(;vn(w)|0?oo(Be):Kn(Be),(w|0)>1;)w=w+-1|0;if((O|0)>0){w=0;do Bn(Be),w=w+1|0;while((w|0)!=(O|0))}Ie=Je+4|0,bi(Ie,Be,Ie),Qr(Ie),Ie=51}}else if(ho(c,m,Je)|0,(se|0)!=0&(pe|0)!=0)if((Z|0)!=(O|0)&&qt(27621,27538,261,27548),P=Ir(l,a)|0,w=Ir(c,m)|0,(P|0)==7|(w|0)==7)w=5;else if(At[22e3+(P*7|0)+w>>0]|0)w=1;else if(P=o[21168+(P*28|0)+(w<<2)>>2]|0,(P|0)>0){S=Je+4|0,w=0;do Bn(S),w=w+1|0;while((w|0)!=(P|0));Ie=51}else Ie=51;else Ie=51;while(!1);return(Ie|0)==51&&(w=Je+4|0,o[g>>2]=o[w>>2],o[g+4>>2]=o[w+4>>2],o[g+8>>2]=o[w+8>>2],w=0),Je=w,te=Oe,Je|0}function Jo(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0,Be=0,Je=0,Oe=0,ze=0;if(Ie=te,te=te+48|0,O=Ie+36|0,P=Ie+24|0,S=Ie+12|0,z=Ie,g=ht(l|0,a|0,52)|0,ae()|0,g=g&15,pe=ht(l|0,a|0,45)|0,ae()|0,pe=pe&127,pe>>>0>121)return m=5,te=Ie,m|0;if(Z=Vi(pe)|0,yt(g|0,0,52)|0,Be=ae()|0|134225919,w=m,o[w>>2]=-1,o[w+4>>2]=Be,!g)return g=ri(c)|0,(g|0)==7||(g=Li(pe,g)|0,(g|0)==127)?(Be=1,te=Ie,Be|0):(de=yt(g|0,0,45)|0,me=ae()|0,pe=m,me=o[pe+4>>2]&-1040385|me,Be=m,o[Be>>2]=o[pe>>2]|de,o[Be+4>>2]=me,Be=0,te=Ie,Be|0);for(o[O>>2]=o[c>>2],o[O+4>>2]=o[c+4>>2],o[O+8>>2]=o[c+8>>2],c=g;;){if(w=c,c=c+-1|0,o[P>>2]=o[O>>2],o[P+4>>2]=o[O+4>>2],o[P+8>>2]=o[O+8>>2],vn(w)|0){if(g=Aa(O)|0,g|0){c=13;break}o[S>>2]=o[O>>2],o[S+4>>2]=o[O+4>>2],o[S+8>>2]=o[O+8>>2],oo(S)}else{if(g=Ci(O)|0,g|0){c=13;break}o[S>>2]=o[O>>2],o[S+4>>2]=o[O+4>>2],o[S+8>>2]=o[O+8>>2],Kn(S)}if(nn(P,S,z),Qr(z),g=m,Oe=o[g>>2]|0,g=o[g+4>>2]|0,ze=(15-w|0)*3|0,Je=yt(7,0,ze|0)|0,g=g&~(ae()|0),ze=yt(ri(z)|0,0,ze|0)|0,g=ae()|0|g,Be=m,o[Be>>2]=ze|Oe&~Je,o[Be+4>>2]=g,(w|0)<=1){c=14;break}}e:do if((c|0)!=13&&(c|0)==14)if((o[O>>2]|0)<=1&&(o[O+4>>2]|0)<=1&&(o[O+8>>2]|0)<=1){c=ri(O)|0,g=Li(pe,c)|0,(g|0)==127?z=0:z=Vi(g)|0;t:do if(c){if(Z){if(g=Ir(l,a)|0,(g|0)==7){g=5;break e}if(w=o[21376+(g*28|0)+(c<<2)>>2]|0,(w|0)>0){g=c,c=0;do g=Wo(g)|0,c=c+1|0;while((c|0)!=(w|0))}else g=c;if((g|0)==1){g=9;break e}c=Li(pe,g)|0,(c|0)==127&&qt(27648,27538,411,27678),Vi(c)|0?qt(27693,27538,412,27678):(me=c,de=w,se=g)}else me=g,de=0,se=c;if(S=o[4272+(pe*28|0)+(se<<2)>>2]|0,(S|0)<=-1&&qt(27724,27538,419,27678),!z){if((de|0)<0){g=5;break e}if(de|0){w=m,g=0,c=o[w>>2]|0,w=o[w+4>>2]|0;do c=yn(c,w)|0,w=ae()|0,ze=m,o[ze>>2]=c,o[ze+4>>2]=w,g=g+1|0;while((g|0)<(de|0))}if((S|0)<=0){g=me,c=58;break}for(w=m,g=0,c=o[w>>2]|0,w=o[w+4>>2]|0;;)if(c=yn(c,w)|0,w=ae()|0,ze=m,o[ze>>2]=c,o[ze+4>>2]=w,g=g+1|0,(g|0)==(S|0)){g=me,c=58;break t}}if(P=Dt(me,pe)|0,(P|0)==7&&qt(27514,27538,428,27678),g=m,c=o[g>>2]|0,g=o[g+4>>2]|0,(S|0)>0){w=0;do c=yn(c,g)|0,g=ae()|0,ze=m,o[ze>>2]=c,o[ze+4>>2]=g,w=w+1|0;while((w|0)!=(S|0))}if(g=Ir(c,g)|0,(g|0)==7&&qt(27795,27538,440,27678),c=oi(me)|0,c=o[(c?21792:21584)+(P*28|0)+(g<<2)>>2]|0,(c|0)<0&&qt(27795,27538,454,27678),!c)g=me,c=58;else{P=m,g=0,w=o[P>>2]|0,P=o[P+4>>2]|0;do w=Ka(w,P)|0,P=ae()|0,ze=m,o[ze>>2]=w,o[ze+4>>2]=P,g=g+1|0;while((g|0)<(c|0));g=me,c=58}}else if((Z|0)!=0&(z|0)!=0){if(c=Ir(l,a)|0,w=m,w=Ir(o[w>>2]|0,o[w+4>>2]|0)|0,(c|0)==7|(w|0)==7){g=5;break e}if(w=o[21376+(c*28|0)+(w<<2)>>2]|0,(w|0)<0){g=5;break e}if(!w)c=59;else{S=m,c=0,P=o[S>>2]|0,S=o[S+4>>2]|0;do P=yn(P,S)|0,S=ae()|0,ze=m,o[ze>>2]=P,o[ze+4>>2]=S,c=c+1|0;while((c|0)<(w|0));c=58}}else c=58;while(!1);if((c|0)==58&&z&&(c=59),(c|0)==59&&(ze=m,(Ir(o[ze>>2]|0,o[ze+4>>2]|0)|0)==1)){g=9;break}ze=m,Je=o[ze>>2]|0,ze=o[ze+4>>2]&-1040385,Oe=yt(g|0,0,45)|0,ze=ze|(ae()|0),g=m,o[g>>2]=Je|Oe,o[g+4>>2]=ze,g=0}else g=1;while(!1);return ze=g,te=Ie,ze|0}function Hl(l,a,c,m,g,w){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0,w=w|0;var P=0,S=0;return S=te,te=te+16|0,P=S,g?l=15:(l=Fs(l,a,c,m,P)|0,l||(ao(P,w),l=0)),te=S,l|0}function Wl(l,a,c,m,g){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0;var w=0,P=0;return P=te,te=te+16|0,w=P,m?c=15:(c=yl(c,w)|0,c||(c=Jo(l,a,w,g)|0)),te=P,c|0}function Ql(l,a,c,m,g){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0;var w=0,P=0,S=0,z=0;return z=te,te=te+32|0,P=z+12|0,S=z,w=Fs(l,a,l,a,P)|0,w|0?(S=w,te=z,S|0):(l=Fs(l,a,c,m,S)|0,l|0?(S=l,te=z,S|0):(P=ir(P,S)|0,S=g,o[S>>2]=P,o[S+4>>2]=((P|0)<0)<<31>>31,S=0,te=z,S|0))}function $l(l,a,c,m,g){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0;var w=0,P=0,S=0,z=0;return z=te,te=te+32|0,P=z+12|0,S=z,w=Fs(l,a,l,a,P)|0,!w&&(w=Fs(l,a,c,m,S)|0,!w)?(m=ir(P,S)|0,m=Wt(m|0,((m|0)<0)<<31>>31|0,1,0)|0,P=ae()|0,S=g,o[S>>2]=m,o[S+4>>2]=P,S=0,te=z,S|0):(S=w,te=z,S|0)}function ol(l,a,c,m,g){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0;var w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0,Be=0,Je=0,Oe=0,ze=0,De=0,bt=0,Zt=0,Nt=0,ai=0;if(Nt=te,te=te+48|0,bt=Nt+24|0,P=Nt+12|0,Zt=Nt,w=Fs(l,a,l,a,bt)|0,!w&&(w=Fs(l,a,c,m,P)|0,!w)){ze=ir(bt,P)|0,De=((ze|0)<0)<<31>>31,o[bt>>2]=0,o[bt+4>>2]=0,o[bt+8>>2]=0,o[P>>2]=0,o[P+4>>2]=0,o[P+8>>2]=0,Fs(l,a,l,a,bt)|0&&qt(27795,27538,692,27747),Fs(l,a,c,m,P)|0&&qt(27795,27538,697,27747),Qo(bt),Qo(P),Z=(ze|0)==0?0:1/+(ze|0),c=o[bt>>2]|0,Ie=Z*+((o[P>>2]|0)-c|0),Be=bt+4|0,m=o[Be>>2]|0,Je=Z*+((o[P+4>>2]|0)-m|0),Oe=bt+8|0,w=o[Oe>>2]|0,Z=Z*+((o[P+8>>2]|0)-w|0),o[Zt>>2]=c,se=Zt+4|0,o[se>>2]=m,pe=Zt+8|0,o[pe>>2]=w;e:do if((ze|0)<0)w=0;else for(de=0,me=0;;){z=+(me>>>0)+4294967296*+(de|0),ai=Ie*z+ +(c|0),S=Je*z+ +(m|0),z=Z*z+ +(w|0),c=~~+ra(+ai),P=~~+ra(+S),w=~~+ra(+z),ai=+ut(+(+(c|0)-ai)),S=+ut(+(+(P|0)-S)),z=+ut(+(+(w|0)-z));do if(ai>S&ai>z)c=0-(P+w)|0,m=P;else if(O=0-c|0,S>z){m=O-w|0;break}else{m=P,w=O-P|0;break}while(!1);if(o[Zt>>2]=c,o[se>>2]=m,o[pe>>2]=w,dr(Zt),w=Jo(l,a,Zt,g+(me<<3)|0)|0,w|0)break e;if(!((de|0)<(De|0)|(de|0)==(De|0)&me>>>0<ze>>>0)){w=0;break e}c=Wt(me|0,de|0,1,0)|0,m=ae()|0,de=m,me=c,c=o[bt>>2]|0,m=o[Be>>2]|0,w=o[Oe>>2]|0}while(!1);return Zt=w,te=Nt,Zt|0}return Zt=w,te=Nt,Zt|0}function ds(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0;if((c|0)==0&(m|0)==0)return g=0,w=1,Ft(g|0),w|0;w=l,g=a,l=1,a=0;do P=(c&1|0)==0&!0,l=lr((P?1:w)|0,(P?0:g)|0,l|0,a|0)|0,a=ae()|0,c=hl(c|0,m|0,1)|0,m=ae()|0,w=lr(w|0,g|0,w|0,g|0)|0,g=ae()|0;while(!((c|0)==0&(m|0)==0));return Ft(a|0),l|0}function u(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0,O=0,Z=0;S=te,te=te+16|0,w=S,P=ht(l|0,a|0,52)|0,ae()|0,P=P&15;do if(P){if(g=xs(l,a,w)|0,!g){O=+X[w>>3],z=1/+fi(+O),Z=+X[25968+(P<<3)>>3],X[c>>3]=O+Z,X[c+8>>3]=O-Z,O=+X[w+8>>3],z=Z*z,X[c+16>>3]=z+O,X[c+24>>3]=O-z;break}return P=g,te=S,P|0}else{if(g=ht(l|0,a|0,45)|0,ae()|0,g=g&127,g>>>0>121)return P=5,te=S,P|0;w=22064+(g<<5)|0,o[c>>2]=o[w>>2],o[c+4>>2]=o[w+4>>2],o[c+8>>2]=o[w+8>>2],o[c+12>>2]=o[w+12>>2],o[c+16>>2]=o[w+16>>2],o[c+20>>2]=o[w+20>>2],o[c+24>>2]=o[w+24>>2],o[c+28>>2]=o[w+28>>2];break}while(!1);return Po(c,m?1.4:1.1),m=26096+(P<<3)|0,(o[m>>2]|0)==(l|0)&&(o[m+4>>2]|0)==(a|0)&&(X[c>>3]=1.5707963267948966),P=26224+(P<<3)|0,(o[P>>2]|0)==(l|0)&&(o[P+4>>2]|0)==(a|0)&&(X[c+8>>3]=-1.5707963267948966),+X[c>>3]!=1.5707963267948966&&+X[c+8>>3]!=-1.5707963267948966?(P=0,te=S,P|0):(X[c+16>>3]=3.141592653589793,X[c+24>>3]=-3.141592653589793,P=0,te=S,P|0)}function v(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0,O=0,Z=0;O=te,te=te+48|0,P=O+32|0,w=O+40|0,S=O,Hs(P,0,0,0),z=o[P>>2]|0,P=o[P+4>>2]|0;do if(c>>>0<=15){if(g=tt(m)|0,g|0){m=S,o[m>>2]=0,o[m+4>>2]=0,o[S+8>>2]=g,o[S+12>>2]=-1,m=S+16|0,z=S+29|0,o[m>>2]=0,o[m+4>>2]=0,o[m+8>>2]=0,At[m+12>>0]=0,At[z>>0]=At[w>>0]|0,At[z+1>>0]=At[w+1>>0]|0,At[z+2>>0]=At[w+2>>0]|0;break}if(g=ts((o[a+8>>2]|0)+1|0,32)|0,g){gt(a,g),Z=S,o[Z>>2]=z,o[Z+4>>2]=P,o[S+8>>2]=0,o[S+12>>2]=c,o[S+16>>2]=m,o[S+20>>2]=a,o[S+24>>2]=g,At[S+28>>0]=0,z=S+29|0,At[z>>0]=At[w>>0]|0,At[z+1>>0]=At[w+1>>0]|0,At[z+2>>0]=At[w+2>>0]|0;break}else{m=S,o[m>>2]=0,o[m+4>>2]=0,o[S+8>>2]=13,o[S+12>>2]=-1,m=S+16|0,z=S+29|0,o[m>>2]=0,o[m+4>>2]=0,o[m+8>>2]=0,At[m+12>>0]=0,At[z>>0]=At[w>>0]|0,At[z+1>>0]=At[w+1>>0]|0,At[z+2>>0]=At[w+2>>0]|0;break}}else z=S,o[z>>2]=0,o[z+4>>2]=0,o[S+8>>2]=4,o[S+12>>2]=-1,z=S+16|0,Z=S+29|0,o[z>>2]=0,o[z+4>>2]=0,o[z+8>>2]=0,At[z+12>>0]=0,At[Z>>0]=At[w>>0]|0,At[Z+1>>0]=At[w+1>>0]|0,At[Z+2>>0]=At[w+2>>0]|0;while(!1);E(S),o[l>>2]=o[S>>2],o[l+4>>2]=o[S+4>>2],o[l+8>>2]=o[S+8>>2],o[l+12>>2]=o[S+12>>2],o[l+16>>2]=o[S+16>>2],o[l+20>>2]=o[S+20>>2],o[l+24>>2]=o[S+24>>2],o[l+28>>2]=o[S+28>>2],te=O}function E(l){l=l|0;var a=0,c=0,m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0,Be=0,Je=0,Oe=0,ze=0,De=0;if(De=te,te=te+336|0,de=De+168|0,me=De,m=l,c=o[m>>2]|0,m=o[m+4>>2]|0,(c|0)==0&(m|0)==0){te=De;return}if(a=l+28|0,At[a>>0]|0?(c=R(c,m)|0,m=ae()|0):At[a>>0]=1,ze=l+20|0,!(o[o[ze>>2]>>2]|0)){a=l+24|0,c=o[a>>2]|0,c|0&&Qt(c),Oe=l,o[Oe>>2]=0,o[Oe+4>>2]=0,o[l+8>>2]=0,o[ze>>2]=0,o[l+12>>2]=-1,o[l+16>>2]=0,o[a>>2]=0,te=De;return}Oe=l+16|0,a=o[Oe>>2]|0,g=a&15;e:do if((c|0)==0&(m|0)==0)Je=l+24|0;else{Ie=l+12|0,se=(g|0)==3,Z=a&255,z=(g|1|0)==3,pe=l+24|0,O=(g+-1|0)>>>0<3,P=(g|2|0)==3,S=me+8|0;t:for(;;){if(w=ht(c|0,m|0,52)|0,ae()|0,w=w&15,(w|0)==(o[Ie>>2]|0)){switch(Z&15){case 0:case 2:case 3:{if(g=xs(c,m,de)|0,g|0){Be=15;break t}if(Rt(o[ze>>2]|0,o[pe>>2]|0,de)|0){Be=19;break t}break}}if(z&&(g=o[(o[ze>>2]|0)+4>>2]|0,o[de>>2]=o[g>>2],o[de+4>>2]=o[g+4>>2],o[de+8>>2]=o[g+8>>2],o[de+12>>2]=o[g+12>>2],Us(26832,de)|0)){if(Fn(o[(o[ze>>2]|0)+4>>2]|0,w,me)|0){Be=25;break}if(g=me,(o[g>>2]|0)==(c|0)&&(o[g+4>>2]|0)==(m|0)){Be=29;break}}if(O){if(g=fs(c,m,de)|0,g|0){Be=32;break}if(u(c,m,me,0)|0){Be=36;break}if(P&&Jt(o[ze>>2]|0,o[pe>>2]|0,de,me)|0){Be=42;break}if(z&&Zr(o[ze>>2]|0,o[pe>>2]|0,de,me)|0){Be=42;break}}if(se){if(a=u(c,m,de,1)|0,g=o[pe>>2]|0,a|0){Be=45;break}if(Qn(g,de)|0){if(gs(me,de),$n(de,o[pe>>2]|0)|0){Be=53;break}if(Rt(o[ze>>2]|0,o[pe>>2]|0,S)|0){Be=53;break}if(Zr(o[ze>>2]|0,o[pe>>2]|0,me,de)|0){Be=53;break}}}}do if((w|0)<(o[Ie>>2]|0)){if(a=u(c,m,de,1)|0,g=o[pe>>2]|0,a|0){Be=58;break t}if(!(Qn(g,de)|0)){Be=73;break}if($n(o[pe>>2]|0,de)|0&&(gs(me,de),Jt(o[ze>>2]|0,o[pe>>2]|0,me,de)|0)){Be=65;break t}if(c=Bs(c,m,w+1|0,me)|0,c|0){Be=67;break t}m=me,c=o[m>>2]|0,m=o[m+4>>2]|0}else Be=73;while(!1);if((Be|0)==73&&(Be=0,c=R(c,m)|0,m=ae()|0),(c|0)==0&(m|0)==0){Je=pe;break e}}switch(Be|0){case 15:{a=o[pe>>2]|0,a|0&&Qt(a),Be=l,o[Be>>2]=0,o[Be+4>>2]=0,o[ze>>2]=0,o[Ie>>2]=-1,o[Oe>>2]=0,o[pe>>2]=0,o[l+8>>2]=g,Be=20;break}case 19:{o[l>>2]=c,o[l+4>>2]=m,Be=20;break}case 25:{qt(27795,27761,470,27772);break}case 29:{o[l>>2]=c,o[l+4>>2]=m,te=De;return}case 32:{a=o[pe>>2]|0,a|0&&Qt(a),Je=l,o[Je>>2]=0,o[Je+4>>2]=0,o[ze>>2]=0,o[Ie>>2]=-1,o[Oe>>2]=0,o[pe>>2]=0,o[l+8>>2]=g,te=De;return}case 36:{qt(27795,27761,493,27772);break}case 42:{o[l>>2]=c,o[l+4>>2]=m,te=De;return}case 45:{g|0&&Qt(g),Be=l,o[Be>>2]=0,o[Be+4>>2]=0,o[ze>>2]=0,o[Ie>>2]=-1,o[Oe>>2]=0,o[pe>>2]=0,o[l+8>>2]=a,Be=55;break}case 53:{o[l>>2]=c,o[l+4>>2]=m,Be=55;break}case 58:{g|0&&Qt(g),Be=l,o[Be>>2]=0,o[Be+4>>2]=0,o[ze>>2]=0,o[Ie>>2]=-1,o[Oe>>2]=0,o[pe>>2]=0,o[l+8>>2]=a,Be=71;break}case 65:{o[l>>2]=c,o[l+4>>2]=m,Be=71;break}case 67:{a=o[pe>>2]|0,a|0&&Qt(a),Je=l,o[Je>>2]=0,o[Je+4>>2]=0,o[ze>>2]=0,o[Ie>>2]=-1,o[Oe>>2]=0,o[pe>>2]=0,o[l+8>>2]=c,te=De;return}}if((Be|0)==20){te=De;return}else if((Be|0)==55){te=De;return}else if((Be|0)==71){te=De;return}}while(!1);a=o[Je>>2]|0,a|0&&Qt(a),Be=l,o[Be>>2]=0,o[Be+4>>2]=0,o[l+8>>2]=0,o[ze>>2]=0,o[l+12>>2]=-1,o[Oe>>2]=0,o[Je>>2]=0,te=De}function R(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0;se=te,te=te+16|0,Z=se,m=ht(l|0,a|0,52)|0,ae()|0,m=m&15,c=ht(l|0,a|0,45)|0,ae()|0;do if(m){for(;c=yt(m+4095|0,0,52)|0,g=ae()|0|a&-15728641,w=(15-m|0)*3|0,P=yt(7,0,w|0)|0,S=ae()|0,c=c|l|P,g=g|S,z=ht(l|0,a|0,w|0)|0,ae()|0,z=z&7,m=m+-1|0,!(z>>>0<6);)if(m)a=g,l=c;else{O=4;break}if((O|0)==4){c=ht(c|0,g|0,45)|0,ae()|0;break}return Z=(z|0)==0&($i(c,g)|0)!=0,Z=yt((Z?2:1)+z|0,0,w|0)|0,O=ae()|0|a&~S,Z=Z|l&~P,Ft(O|0),te=se,Z|0}while(!1);return c=c&127,c>>>0>120?(O=0,Z=0,Ft(O|0),te=se,Z|0):(Hs(Z,0,c+1|0,0),O=o[Z+4>>2]|0,Z=o[Z>>2]|0,Ft(O|0),te=se,Z|0)}function q(l,a,c,m,g,w){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0,w=w|0;var P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0,Be=0;Be=te,te=te+160|0,se=Be+80|0,S=Be+64|0,pe=Be+112|0,Ie=Be,v(se,l,a,c),O=se,el(S,o[O>>2]|0,o[O+4>>2]|0,a),O=S,z=o[O>>2]|0,O=o[O+4>>2]|0,P=o[se+8>>2]|0,de=pe+4|0,o[de>>2]=o[se>>2],o[de+4>>2]=o[se+4>>2],o[de+8>>2]=o[se+8>>2],o[de+12>>2]=o[se+12>>2],o[de+16>>2]=o[se+16>>2],o[de+20>>2]=o[se+20>>2],o[de+24>>2]=o[se+24>>2],o[de+28>>2]=o[se+28>>2],de=Ie,o[de>>2]=z,o[de+4>>2]=O,de=Ie+8|0,o[de>>2]=P,l=Ie+12|0,a=pe,c=l+36|0;do o[l>>2]=o[a>>2],l=l+4|0,a=a+4|0;while((l|0)<(c|0));if(pe=Ie+48|0,o[pe>>2]=o[S>>2],o[pe+4>>2]=o[S+4>>2],o[pe+8>>2]=o[S+8>>2],o[pe+12>>2]=o[S+12>>2],(z|0)==0&(O|0)==0)return Ie=P,te=Be,Ie|0;c=Ie+16|0,Z=Ie+24|0,se=Ie+28|0,P=0,S=0,a=z,l=O;do{if(!((P|0)<(g|0)|(P|0)==(g|0)&S>>>0<m>>>0)){me=4;break}if(O=S,S=Wt(S|0,P|0,1,0)|0,P=ae()|0,O=w+(O<<3)|0,o[O>>2]=a,o[O+4>>2]=l,tl(pe),l=pe,a=o[l>>2]|0,l=o[l+4>>2]|0,(a|0)==0&(l|0)==0){if(E(c),a=c,l=o[a>>2]|0,a=o[a+4>>2]|0,(l|0)==0&(a|0)==0){me=10;break}Ml(l,a,o[se>>2]|0,pe),l=pe,a=o[l>>2]|0,l=o[l+4>>2]|0}O=Ie,o[O>>2]=a,o[O+4>>2]=l}while(!((a|0)==0&(l|0)==0));return(me|0)==4?(l=Ie+40|0,a=o[l>>2]|0,a|0&&Qt(a),me=Ie+16|0,o[me>>2]=0,o[me+4>>2]=0,o[Z>>2]=0,o[Ie+36>>2]=0,o[se>>2]=-1,o[Ie+32>>2]=0,o[l>>2]=0,Ml(0,0,0,pe),o[Ie>>2]=0,o[Ie+4>>2]=0,o[de>>2]=0,Ie=14,te=Be,Ie|0):((me|0)==10&&(o[Ie>>2]=0,o[Ie+4>>2]=0,o[de>>2]=o[Z>>2]),Ie=o[de>>2]|0,te=Be,Ie|0)}function ne(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0;if(se=te,te=te+48|0,z=se+32|0,S=se+40|0,O=se,!(o[l>>2]|0))return Z=m,o[Z>>2]=0,o[Z+4>>2]=0,Z=0,te=se,Z|0;Hs(z,0,0,0),P=z,g=o[P>>2]|0,P=o[P+4>>2]|0;do if(a>>>0>15)Z=O,o[Z>>2]=0,o[Z+4>>2]=0,o[O+8>>2]=4,o[O+12>>2]=-1,Z=O+16|0,c=O+29|0,o[Z>>2]=0,o[Z+4>>2]=0,o[Z+8>>2]=0,At[Z+12>>0]=0,At[c>>0]=At[S>>0]|0,At[c+1>>0]=At[S+1>>0]|0,At[c+2>>0]=At[S+2>>0]|0,c=4,Z=9;else{if(c=tt(c)|0,c|0){z=O,o[z>>2]=0,o[z+4>>2]=0,o[O+8>>2]=c,o[O+12>>2]=-1,z=O+16|0,Z=O+29|0,o[z>>2]=0,o[z+4>>2]=0,o[z+8>>2]=0,At[z+12>>0]=0,At[Z>>0]=At[S>>0]|0,At[Z+1>>0]=At[S+1>>0]|0,At[Z+2>>0]=At[S+2>>0]|0,Z=9;break}if(c=ts((o[l+8>>2]|0)+1|0,32)|0,!c){Z=O,o[Z>>2]=0,o[Z+4>>2]=0,o[O+8>>2]=13,o[O+12>>2]=-1,Z=O+16|0,c=O+29|0,o[Z>>2]=0,o[Z+4>>2]=0,o[Z+8>>2]=0,At[Z+12>>0]=0,At[c>>0]=At[S>>0]|0,At[c+1>>0]=At[S+1>>0]|0,At[c+2>>0]=At[S+2>>0]|0,c=13,Z=9;break}gt(l,c),de=O,o[de>>2]=g,o[de+4>>2]=P,P=O+8|0,o[P>>2]=0,o[O+12>>2]=a,o[O+20>>2]=l,o[O+24>>2]=c,At[O+28>>0]=0,g=O+29|0,At[g>>0]=At[S>>0]|0,At[g+1>>0]=At[S+1>>0]|0,At[g+2>>0]=At[S+2>>0]|0,o[O+16>>2]=3,pe=+Lr(c),pe=pe*+cn(c),w=+ut(+ +X[c>>3]),w=pe/+fi(+ +eu(+w,+ +ut(+ +X[c+8>>3])))*6371.007180918475*6371.007180918475,g=O+12|0,c=o[g>>2]|0;e:do if((c|0)>0)do{if(fn(c+-1|0,z)|0,!(w/+X[z>>3]>10))break e;de=o[g>>2]|0,c=de+-1|0,o[g>>2]=c}while((de|0)>1);while(!1);if(E(O),g=m,o[g>>2]=0,o[g+4>>2]=0,g=O,c=o[g>>2]|0,g=o[g+4>>2]|0,!((c|0)==0&(g|0)==0))do Ws(c,g,a,z)|0,S=z,l=m,S=Wt(o[l>>2]|0,o[l+4>>2]|0,o[S>>2]|0,o[S+4>>2]|0)|0,l=ae()|0,de=m,o[de>>2]=S,o[de+4>>2]=l,E(O),de=O,c=o[de>>2]|0,g=o[de+4>>2]|0;while(!((c|0)==0&(g|0)==0));c=o[P>>2]|0}while(!1);return de=c,te=se,de|0}function Ee(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0;if(!(Us(a,c)|0)||(a=gn(a)|0,m=+X[c>>3],g=+X[c+8>>3],g=a&g<0?g+6.283185307179586:g,pe=o[l>>2]|0,(pe|0)<=0))return pe=0,pe|0;if(se=o[l+4>>2]|0,a){a=0,Z=g,c=-1,l=0;e:for(;;){for(O=l;P=+X[se+(O<<4)>>3],g=+X[se+(O<<4)+8>>3],l=(c+2|0)%(pe|0)|0,w=+X[se+(l<<4)>>3],S=+X[se+(l<<4)+8>>3],P>w?(z=P,P=S):(z=w,w=P,P=g,g=S),m=m==w|m==z?m+2220446049250313e-31:m,!!(m<w|m>z);)if(c=O+1|0,(c|0)>=(pe|0)){c=22;break e}else l=O,O=c,c=l;if(S=P<0?P+6.283185307179586:P,P=g<0?g+6.283185307179586:g,Z=S==Z|P==Z?Z+-2220446049250313e-31:Z,z=S+(P-S)*((m-w)/(z-w)),(z<0?z+6.283185307179586:z)>Z&&(a=a^1),l=O+1|0,(l|0)>=(pe|0)){c=22;break}else c=O}if((c|0)==22)return a|0}else{a=0,Z=g,c=-1,l=0;e:for(;;){for(O=l;P=+X[se+(O<<4)>>3],g=+X[se+(O<<4)+8>>3],l=(c+2|0)%(pe|0)|0,w=+X[se+(l<<4)>>3],S=+X[se+(l<<4)+8>>3],P>w?(z=P,P=S):(z=w,w=P,P=g,g=S),m=m==w|m==z?m+2220446049250313e-31:m,!!(m<w|m>z);)if(c=O+1|0,(c|0)>=(pe|0)){c=22;break e}else l=O,O=c,c=l;if(Z=P==Z|g==Z?Z+-2220446049250313e-31:Z,P+(g-P)*((m-w)/(z-w))>Z&&(a=a^1),l=O+1|0,(l|0)>=(pe|0)){c=22;break}else c=O}if((c|0)==22)return a|0}return 0}function Ze(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0,Be=0,Je=0,Oe=0;if(me=o[l>>2]|0,!me){o[a>>2]=0,o[a+4>>2]=0,o[a+8>>2]=0,o[a+12>>2]=0,o[a+16>>2]=0,o[a+20>>2]=0,o[a+24>>2]=0,o[a+28>>2]=0;return}if(Ie=a+8|0,X[Ie>>3]=17976931348623157e292,Be=a+24|0,X[Be>>3]=17976931348623157e292,X[a>>3]=-17976931348623157e292,Je=a+16|0,X[Je>>3]=-17976931348623157e292,!((me|0)<=0)){for(pe=o[l+4>>2]|0,O=17976931348623157e292,Z=-17976931348623157e292,se=0,l=-1,w=17976931348623157e292,P=17976931348623157e292,z=-17976931348623157e292,m=-17976931348623157e292,de=0;c=+X[pe+(de<<4)>>3],S=+X[pe+(de<<4)+8>>3],l=l+2|0,g=+X[pe+(((l|0)==(me|0)?0:l)<<4)+8>>3],c<w&&(X[Ie>>3]=c,w=c),S<P&&(X[Be>>3]=S,P=S),c>z?X[a>>3]=c:c=z,S>m&&(X[Je>>3]=S,m=S),O=S>0&S<O?S:O,Z=S<0&S>Z?S:Z,se=se|+ut(+(S-g))>3.141592653589793,l=de+1|0,(l|0)!=(me|0);)Oe=de,z=c,de=l,l=Oe;se&&(X[Je>>3]=Z,X[Be>>3]=O)}}function tt(l){return l=l|0,(l>>>0<4?0:15)|0}function gt(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0,Be=0,Je=0,Oe=0,ze=0,De=0,bt=0,Zt=0,Nt=0;if(me=o[l>>2]|0,me){if(Ie=a+8|0,X[Ie>>3]=17976931348623157e292,Be=a+24|0,X[Be>>3]=17976931348623157e292,X[a>>3]=-17976931348623157e292,Je=a+16|0,X[Je>>3]=-17976931348623157e292,(me|0)>0){for(g=o[l+4>>2]|0,pe=17976931348623157e292,de=-17976931348623157e292,m=0,c=-1,z=17976931348623157e292,O=17976931348623157e292,se=-17976931348623157e292,P=-17976931348623157e292,Oe=0;w=+X[g+(Oe<<4)>>3],Z=+X[g+(Oe<<4)+8>>3],Zt=c+2|0,S=+X[g+(((Zt|0)==(me|0)?0:Zt)<<4)+8>>3],w<z&&(X[Ie>>3]=w,z=w),Z<O&&(X[Be>>3]=Z,O=Z),w>se?X[a>>3]=w:w=se,Z>P&&(X[Je>>3]=Z,P=Z),pe=Z>0&Z<pe?Z:pe,de=Z<0&Z>de?Z:de,m=m|+ut(+(Z-S))>3.141592653589793,c=Oe+1|0,(c|0)!=(me|0);)Zt=Oe,se=w,Oe=c,c=Zt;m&&(X[Je>>3]=de,X[Be>>3]=pe)}}else o[a>>2]=0,o[a+4>>2]=0,o[a+8>>2]=0,o[a+12>>2]=0,o[a+16>>2]=0,o[a+20>>2]=0,o[a+24>>2]=0,o[a+28>>2]=0;if(Zt=l+8|0,c=o[Zt>>2]|0,!((c|0)<=0)){bt=l+12|0,De=0;do if(g=o[bt>>2]|0,m=De,De=De+1|0,Be=a+(De<<5)|0,Je=o[g+(m<<3)>>2]|0,Je){if(Oe=a+(De<<5)+8|0,X[Oe>>3]=17976931348623157e292,l=a+(De<<5)+24|0,X[l>>3]=17976931348623157e292,X[Be>>3]=-17976931348623157e292,ze=a+(De<<5)+16|0,X[ze>>3]=-17976931348623157e292,(Je|0)>0){for(me=o[g+(m<<3)+4>>2]|0,pe=17976931348623157e292,de=-17976931348623157e292,g=0,m=-1,Ie=0,z=17976931348623157e292,O=17976931348623157e292,Z=-17976931348623157e292,P=-17976931348623157e292;w=+X[me+(Ie<<4)>>3],se=+X[me+(Ie<<4)+8>>3],m=m+2|0,S=+X[me+(((m|0)==(Je|0)?0:m)<<4)+8>>3],w<z&&(X[Oe>>3]=w,z=w),se<O&&(X[l>>3]=se,O=se),w>Z?X[Be>>3]=w:w=Z,se>P&&(X[ze>>3]=se,P=se),pe=se>0&se<pe?se:pe,de=se<0&se>de?se:de,g=g|+ut(+(se-S))>3.141592653589793,m=Ie+1|0,(m|0)!=(Je|0);)Nt=Ie,Ie=m,Z=w,m=Nt;g&&(X[ze>>3]=de,X[l>>3]=pe)}}else o[Be>>2]=0,o[Be+4>>2]=0,o[Be+8>>2]=0,o[Be+12>>2]=0,o[Be+16>>2]=0,o[Be+20>>2]=0,o[Be+24>>2]=0,o[Be+28>>2]=0,c=o[Zt>>2]|0;while((De|0)<(c|0))}}function Rt(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0;if(!(Ee(l,a,c)|0))return g=0,g|0;if(g=l+8|0,(o[g>>2]|0)<=0)return g=1,g|0;for(m=l+12|0,l=0;;){if(w=l,l=l+1|0,Ee((o[m>>2]|0)+(w<<3)|0,a+(l<<5)|0,c)|0){l=0,m=6;break}if((l|0)>=(o[g>>2]|0)){l=1,m=6;break}}return(m|0)==6?l|0:0}function Jt(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0,O=0,Z=0;if(O=te,te=te+16|0,S=O,P=c+8|0,!(Ee(l,a,P)|0))return z=0,te=O,z|0;z=l+8|0;e:do if((o[z>>2]|0)>0){for(w=l+12|0,g=0;;){if(Z=g,g=g+1|0,Ee((o[w>>2]|0)+(Z<<3)|0,a+(g<<5)|0,P)|0){g=0;break}if((g|0)>=(o[z>>2]|0))break e}return te=O,g|0}while(!1);if(Ti(l,a,c,m)|0)return Z=0,te=O,Z|0;o[S>>2]=o[c>>2],o[S+4>>2]=P,g=o[z>>2]|0;e:do if((g|0)>0)for(l=l+12|0,P=0,w=g;;){if(g=o[l>>2]|0,(o[g+(P<<3)>>2]|0)>0){if(Ee(S,m,o[g+(P<<3)+4>>2]|0)|0){g=0;break e}if(g=P+1|0,Ti((o[l>>2]|0)+(P<<3)|0,a+(g<<5)|0,c,m)|0){g=0;break e}w=o[z>>2]|0}else g=P+1|0;if((g|0)<(w|0))P=g;else{g=1;break}}else g=1;while(!1);return Z=g,te=O,Z|0}function Ti(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0,Be=0,Je=0,Oe=0,ze=0,De=0,bt=0,Zt=0,Nt=0,ai=0;if(Zt=te,te=te+176|0,Oe=Zt+172|0,g=Zt+168|0,ze=Zt,!(Qn(a,m)|0))return l=0,te=Zt,l|0;if(Si(a,m,Oe,g),fo(ze|0,c|0,168)|0,(o[c>>2]|0)>0){a=0;do Nt=ze+8+(a<<4)+8|0,Je=+$r(+X[Nt>>3],o[g>>2]|0),X[Nt>>3]=Je,a=a+1|0;while((a|0)<(o[c>>2]|0))}Ie=+X[m>>3],Be=+X[m+8>>3],Je=+$r(+X[m+16>>3],o[g>>2]|0),de=+$r(+X[m+24>>3],o[g>>2]|0);e:do if((o[l>>2]|0)>0){if(m=l+4|0,g=o[ze>>2]|0,(g|0)<=0){for(a=0;;)if(a=a+1|0,(a|0)>=(o[l>>2]|0)){a=0;break e}}for(c=0;;){if(a=o[m>>2]|0,pe=+X[a+(c<<4)>>3],me=+$r(+X[a+(c<<4)+8>>3],o[Oe>>2]|0),a=o[m>>2]|0,c=c+1|0,Nt=(c|0)%(o[l>>2]|0)|0,w=+X[a+(Nt<<4)>>3],P=+$r(+X[a+(Nt<<4)+8>>3],o[Oe>>2]|0),!(pe>=Ie)|!(w>=Ie)&&!(pe<=Be)|!(w<=Be)&&!(me<=de)|!(P<=de)&&!(me>=Je)|!(P>=Je)){se=w-pe,O=P-me,a=0;do if(ai=a,a=a+1|0,Nt=(a|0)==(g|0)?0:a,w=+X[ze+8+(ai<<4)+8>>3],P=+X[ze+8+(Nt<<4)+8>>3]-w,S=+X[ze+8+(ai<<4)>>3],z=+X[ze+8+(Nt<<4)>>3]-S,Z=se*P-O*z,Z!=0&&(De=me-w,bt=pe-S,z=(De*z-P*bt)/Z,!(z<0|z>1))&&(Z=(se*De-O*bt)/Z,Z>=0&Z<=1)){a=1;break e}while((a|0)<(g|0))}if((c|0)>=(o[l>>2]|0)){a=0;break}}}else a=0;while(!1);return ai=a,te=Zt,ai|0}function Zr(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0;if(Ti(l,a,c,m)|0)return w=1,w|0;if(w=l+8|0,(o[w>>2]|0)<=0)return w=0,w|0;for(g=l+12|0,l=0;;){if(P=l,l=l+1|0,Ti((o[g>>2]|0)+(P<<3)|0,a+(l<<5)|0,c,m)|0){l=1,g=6;break}if((l|0)>=(o[w>>2]|0)){l=0,g=6;break}}return(g|0)==6?l|0:0}function Br(){return 8}function ps(){return 16}function On(){return 168}function Ks(){return 8}function al(){return 16}function Yl(){return 12}function Xl(){return 8}function br(l){return l=l|0,+(+((o[l>>2]|0)>>>0)+4294967296*+(o[l+4>>2]|0))}function ea(l){l=l|0;var a=0,c=0;return c=+X[l>>3],a=+X[l+8>>3],+ +zt(+(c*c+a*a))}function Nn(l,a,c,m,g){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0;var w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0;O=+X[l>>3],z=+X[a>>3]-O,S=+X[l+8>>3],P=+X[a+8>>3]-S,se=+X[c>>3],w=+X[m>>3]-se,pe=+X[c+8>>3],Z=+X[m+8>>3]-pe,w=(w*(S-pe)-(O-se)*Z)/(z*Z-P*w),X[g>>3]=O+z*w,X[g+8>>3]=S+P*w}function pr(l,a){return l=l|0,a=a|0,+ut(+(+X[l>>3]-+X[a>>3]))<11920928955078125e-23?(a=+ut(+(+X[l+8>>3]-+X[a+8>>3]))<11920928955078125e-23,a|0):(a=0,a|0)}function nr(l,a){l=l|0,a=a|0;var c=0,m=0,g=0;return g=+X[l>>3]-+X[a>>3],m=+X[l+8>>3]-+X[a+8>>3],c=+X[l+16>>3]-+X[a+16>>3],+(g*g+m*m+c*c)}function ll(l,a){l=l|0,a=a|0;var c=0,m=0,g=0;c=+X[l>>3],m=+fi(+c),c=+di(+c),X[a+16>>3]=c,c=+X[l+8>>3],g=m*+fi(+c),X[a>>3]=g,c=m*+di(+c),X[a+8>>3]=c}function Co(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0;if(w=te,te=te+16|0,g=w,m=$i(l,a)|0,(c+-1|0)>>>0>5||(m=(m|0)!=0,(c|0)==1&m))return g=-1,te=w,g|0;do if(Ao(l,a,g)|0)m=-1;else if(m){m=((o[26352+(c<<2)>>2]|0)+5-(o[g>>2]|0)|0)%5|0;break}else{m=((o[26384+(c<<2)>>2]|0)+6-(o[g>>2]|0)|0)%6|0;break}while(!1);return g=m,te=w,g|0}function Ao(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0;if(Z=te,te=te+32|0,S=Z+16|0,z=Z,m=$s(l,a,S)|0,m|0)return c=m,te=Z,c|0;w=Rn(l,a)|0,O=Ir(l,a)|0,Ia(w,z),m=Wn(w,o[S>>2]|0)|0;do if(Vi(w)|0){do switch(w|0){case 4:{g=0;break}case 14:{g=1;break}case 24:{g=2;break}case 38:{g=3;break}case 49:{g=4;break}case 58:{g=5;break}case 63:{g=6;break}case 72:{g=7;break}case 83:{g=8;break}case 97:{g=9;break}case 107:{g=10;break}case 117:{g=11;break}default:qt(27795,27797,75,27806)}while(!1);if(P=o[26416+(g*24|0)+8>>2]|0,a=o[26416+(g*24|0)+16>>2]|0,l=o[S>>2]|0,(l|0)!=(o[z>>2]|0)&&(z=oi(w)|0,l=o[S>>2]|0,z|(l|0)==(a|0)&&(m=(m+1|0)%6|0)),(O|0)==3&(l|0)==(a|0)){m=(m+5|0)%6|0;break}(O|0)==5&(l|0)==(P|0)&&(m=(m+1|0)%6|0)}while(!1);return o[c>>2]=m,c=0,te=Z,c|0}function Ur(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0,Be=0,Je=0,Oe=0,ze=0;if(ze=te,te=te+32|0,Oe=ze+24|0,Be=ze+20|0,me=ze+8|0,de=ze+16|0,pe=ze,z=($i(l,a)|0)==0,z=z?6:5,Z=ht(l|0,a|0,52)|0,ae()|0,Z=Z&15,z>>>0<=c>>>0)return m=2,te=ze,m|0;se=(Z|0)==0,!se&&(Ie=yt(7,0,(Z^15)*3|0)|0,(Ie&l|0)==0&((ae()|0)&a|0)==0)?g=c:w=4;e:do if((w|0)==4){if(g=($i(l,a)|0)!=0,((g?4:5)|0)<(c|0)||Ao(l,a,Oe)|0||(w=(o[Oe>>2]|0)+c|0,g?g=26704+(((w|0)%5|0)<<2)|0:g=26736+(((w|0)%6|0)<<2)|0,Ie=o[g>>2]|0,(Ie|0)==7))return m=1,te=ze,m|0;o[Be>>2]=0,g=ar(l,a,Ie,Be,me)|0;do if(!g){if(S=me,O=o[S>>2]|0,S=o[S+4>>2]|0,P=S>>>0<a>>>0|(S|0)==(a|0)&O>>>0<l>>>0,w=P?O:l,P=P?S:a,!se&&(se=yt(7,0,(Z^15)*3|0)|0,(O&se|0)==0&(S&(ae()|0)|0)==0))g=c;else{if(S=(c+-1+z|0)%(z|0)|0,g=$i(l,a)|0,(S|0)<0&&qt(27795,27797,248,27822),z=(g|0)!=0,((z?4:5)|0)<(S|0)&&qt(27795,27797,248,27822),Ao(l,a,Oe)|0&&qt(27795,27797,248,27822),g=(o[Oe>>2]|0)+S|0,z?g=26704+(((g|0)%5|0)<<2)|0:g=26736+(((g|0)%6|0)<<2)|0,S=o[g>>2]|0,(S|0)==7&&qt(27795,27797,248,27822),o[de>>2]=0,g=ar(l,a,S,de,pe)|0,g|0)break;O=pe,z=o[O>>2]|0,O=o[O+4>>2]|0;do if(O>>>0<P>>>0|(O|0)==(P|0)&z>>>0<w>>>0){if($i(z,O)|0?w=js(z,O,l,a)|0:w=o[26800+((((o[de>>2]|0)+(o[26768+(S<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,g=$i(z,O)|0,(w+-1|0)>>>0>5){g=-1,w=z,P=O;break}if(g=(g|0)!=0,(w|0)==1&g){g=-1,w=z,P=O;break}do if(Ao(z,O,Oe)|0)g=-1;else if(g){g=((o[26352+(w<<2)>>2]|0)+5-(o[Oe>>2]|0)|0)%5|0;break}else{g=((o[26384+(w<<2)>>2]|0)+6-(o[Oe>>2]|0)|0)%6|0;break}while(!1);w=z,P=O}else g=c;while(!1);S=me,O=o[S>>2]|0,S=o[S+4>>2]|0}if((w|0)==(O|0)&(P|0)==(S|0)){if(z=($i(O,S)|0)!=0,z?l=js(O,S,l,a)|0:l=o[26800+((((o[Be>>2]|0)+(o[26768+(Ie<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,g=$i(O,S)|0,(l+-1|0)>>>0<=5&&(Je=(g|0)!=0,!((l|0)==1&Je)))do if(Ao(O,S,Oe)|0)g=-1;else if(Je){g=((o[26352+(l<<2)>>2]|0)+5-(o[Oe>>2]|0)|0)%5|0;break}else{g=((o[26384+(l<<2)>>2]|0)+6-(o[Oe>>2]|0)|0)%6|0;break}while(!1);else g=-1;g=g+1|0,g=(g|0)==6|z&(g|0)==5?0:g}a=P,l=w;break e}while(!1);return m=g,te=ze,m|0}while(!1);return Je=yt(g|0,0,56)|0,Oe=ae()|0|a&-2130706433|536870912,o[m>>2]=Je|l,o[m+4>>2]=Oe,m=0,te=ze,m|0}function ta(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0;return w=($i(l,a)|0)==0,m=Ur(l,a,0,c)|0,g=(m|0)==0,w?!g||(m=Ur(l,a,1,c+8|0)|0,m|0)||(m=Ur(l,a,2,c+16|0)|0,m|0)||(m=Ur(l,a,3,c+24|0)|0,m|0)||(m=Ur(l,a,4,c+32|0)|0,m)?(w=m,w|0):Ur(l,a,5,c+40|0)|0:!g||(m=Ur(l,a,1,c+8|0)|0,m|0)||(m=Ur(l,a,2,c+16|0)|0,m|0)||(m=Ur(l,a,3,c+24|0)|0,m|0)||(m=Ur(l,a,4,c+32|0)|0,m|0)?(w=m,w|0):(w=c+40|0,o[w>>2]=0,o[w+4>>2]=0,w=0,w|0)}function Kl(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0,S=0,z=0;return z=te,te=te+192|0,g=z,w=z+168|0,P=ht(l|0,a|0,56)|0,ae()|0,P=P&7,S=a&-2130706433|134217728,m=$s(l,S,w)|0,m|0?(S=m,te=z,S|0):(a=ht(l|0,a|0,52)|0,ae()|0,a=a&15,$i(l,S)|0?Eo(w,a,P,1,g):da(w,a,P,1,g),S=g+8|0,o[c>>2]=o[S>>2],o[c+4>>2]=o[S+4>>2],o[c+8>>2]=o[S+8>>2],o[c+12>>2]=o[S+12>>2],S=0,te=z,S|0)}function fu(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0;return g=te,te=te+16|0,c=g,!(!0&(a&2013265920|0)==536870912)||(m=a&-2130706433|134217728,!(cs(l,m)|0))?(m=0,te=g,m|0):(w=ht(l|0,a|0,56)|0,ae()|0,w=(Ur(l,m,w&7,c)|0)==0,m=c,m=w&((o[m>>2]|0)==(l|0)?(o[m+4>>2]|0)==(a|0):0)&1,te=g,m|0)}function du(l,a,c){l=l|0,a=a|0,c=c|0;var m=0;(a|0)>0?(m=ts(a,4)|0,o[l>>2]=m,m||qt(27835,27858,40,27872)):o[l>>2]=0,o[l+4>>2]=a,o[l+8>>2]=0,o[l+12>>2]=c}function pu(l){l=l|0;var a=0,c=0,m=0,g=0,w=0,P=0,S=0;g=l+4|0,w=l+12|0,P=l+8|0;e:for(;;){for(c=o[g>>2]|0,a=0;;){if((a|0)>=(c|0))break e;if(m=o[l>>2]|0,S=o[m+(a<<2)>>2]|0,!S)a=a+1|0;else break}a=m+(~~(+ut(+(+$t(10,+ +(15-(o[w>>2]|0)|0))*(+X[S>>3]+ +X[S+8>>3])))%+(c|0))>>>0<<2)|0,c=o[a>>2]|0;t:do if(c|0){if(m=S+32|0,(c|0)==(S|0))o[a>>2]=o[m>>2];else{if(c=c+32|0,a=o[c>>2]|0,!a)break;for(;(a|0)!=(S|0);)if(c=a+32|0,a=o[c>>2]|0,!a)break t;o[c>>2]=o[m>>2]}Qt(S),o[P>>2]=(o[P>>2]|0)+-1}while(!1)}Qt(o[l>>2]|0)}function mu(l){l=l|0;var a=0,c=0,m=0;for(m=o[l+4>>2]|0,c=0;;){if((c|0)>=(m|0)){a=0,c=4;break}if(a=o[(o[l>>2]|0)+(c<<2)>>2]|0,!a)c=c+1|0;else{c=4;break}}return(c|0)==4?a|0:0}function ia(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0;if(c=~~(+ut(+(+$t(10,+ +(15-(o[l+12>>2]|0)|0))*(+X[a>>3]+ +X[a+8>>3])))%+(o[l+4>>2]|0))>>>0,c=(o[l>>2]|0)+(c<<2)|0,m=o[c>>2]|0,!m)return w=1,w|0;w=a+32|0;do if((m|0)!=(a|0)){if(c=o[m+32>>2]|0,!c)return w=1,w|0;for(g=c;;){if((g|0)==(a|0)){g=8;break}if(c=o[g+32>>2]|0,c)m=g,g=c;else{c=1,g=10;break}}if((g|0)==8){o[m+32>>2]=o[w>>2];break}else if((g|0)==10)return c|0}else o[c>>2]=o[w>>2];while(!1);return Qt(a),w=l+8|0,o[w>>2]=(o[w>>2]|0)+-1,w=0,w|0}function _u(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0;w=Js(40)|0,w||qt(27888,27858,98,27901),o[w>>2]=o[a>>2],o[w+4>>2]=o[a+4>>2],o[w+8>>2]=o[a+8>>2],o[w+12>>2]=o[a+12>>2],g=w+16|0,o[g>>2]=o[c>>2],o[g+4>>2]=o[c+4>>2],o[g+8>>2]=o[c+8>>2],o[g+12>>2]=o[c+12>>2],o[w+32>>2]=0,g=~~(+ut(+(+$t(10,+ +(15-(o[l+12>>2]|0)|0))*(+X[a>>3]+ +X[a+8>>3])))%+(o[l+4>>2]|0))>>>0,g=(o[l>>2]|0)+(g<<2)|0,m=o[g>>2]|0;do if(!m)o[g>>2]=w;else{for(;!(sn(m,a)|0&&sn(m+16|0,c)|0);)if(g=o[m+32>>2]|0,m=(g|0)==0?m:g,!(o[m+32>>2]|0)){P=10;break}if((P|0)==10){o[m+32>>2]=w;break}return Qt(w),P=m,P|0}while(!1);return P=l+8|0,o[P>>2]=(o[P>>2]|0)+1,P=w,P|0}function gu(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0;if(g=~~(+ut(+(+$t(10,+ +(15-(o[l+12>>2]|0)|0))*(+X[a>>3]+ +X[a+8>>3])))%+(o[l+4>>2]|0))>>>0,g=o[(o[l>>2]|0)+(g<<2)>>2]|0,!g)return c=0,c|0;if(!c){for(l=g;;){if(sn(l,a)|0){m=10;break}if(l=o[l+32>>2]|0,!l){l=0,m=10;break}}if((m|0)==10)return l|0}for(l=g;;){if(sn(l,a)|0&&sn(l+16|0,c)|0){m=10;break}if(l=o[l+32>>2]|0,!l){l=0,m=10;break}}return(m|0)==10?l|0:0}function Sl(l,a){l=l|0,a=a|0;var c=0;if(c=~~(+ut(+(+$t(10,+ +(15-(o[l+12>>2]|0)|0))*(+X[a>>3]+ +X[a+8>>3])))%+(o[l+4>>2]|0))>>>0,l=o[(o[l>>2]|0)+(c<<2)>>2]|0,!l)return c=0,c|0;for(;;){if(sn(l,a)|0){a=5;break}if(l=o[l+32>>2]|0,!l){l=0,a=5;break}}return(a|0)==5?l|0:0}function Fu(){return 27920}function Io(l){return l=+l,~~+kt(+l)|0}function Js(l){l=l|0;var a=0,c=0,m=0,g=0,w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0,Ie=0,Be=0,Je=0,Oe=0,ze=0,De=0,bt=0;bt=te,te=te+16|0,pe=bt;do if(l>>>0<245){if(O=l>>>0<11?16:l+11&-8,l=O>>>3,se=o[6981]|0,c=se>>>l,c&3|0)return a=(c&1^1)+l|0,l=27964+(a<<1<<2)|0,c=l+8|0,m=o[c>>2]|0,g=m+8|0,w=o[g>>2]|0,(w|0)==(l|0)?o[6981]=se&~(1<<a):(o[w+12>>2]=l,o[c>>2]=w),De=a<<3,o[m+4>>2]=De|3,De=m+De+4|0,o[De>>2]=o[De>>2]|1,De=g,te=bt,De|0;if(Z=o[6983]|0,O>>>0>Z>>>0){if(c|0)return a=2<<l,a=c<<l&(a|0-a),a=(a&0-a)+-1|0,S=a>>>12&16,a=a>>>S,c=a>>>5&8,a=a>>>c,w=a>>>2&4,a=a>>>w,l=a>>>1&2,a=a>>>l,m=a>>>1&1,m=(c|S|w|l|m)+(a>>>m)|0,a=27964+(m<<1<<2)|0,l=a+8|0,w=o[l>>2]|0,S=w+8|0,c=o[S>>2]|0,(c|0)==(a|0)?(l=se&~(1<<m),o[6981]=l):(o[c+12>>2]=a,o[l>>2]=c,l=se),De=m<<3,P=De-O|0,o[w+4>>2]=O|3,g=w+O|0,o[g+4>>2]=P|1,o[w+De>>2]=P,Z|0&&(m=o[6986]|0,a=Z>>>3,c=27964+(a<<1<<2)|0,a=1<<a,l&a?(l=c+8|0,a=o[l>>2]|0):(o[6981]=l|a,a=c,l=c+8|0),o[l>>2]=m,o[a+12>>2]=m,o[m+8>>2]=a,o[m+12>>2]=c),o[6983]=P,o[6986]=g,De=S,te=bt,De|0;if(w=o[6982]|0,w){for(c=(w&0-w)+-1|0,g=c>>>12&16,c=c>>>g,m=c>>>5&8,c=c>>>m,P=c>>>2&4,c=c>>>P,S=c>>>1&2,c=c>>>S,z=c>>>1&1,z=o[28228+((m|g|P|S|z)+(c>>>z)<<2)>>2]|0,c=z,S=z,z=(o[z+4>>2]&-8)-O|0;l=o[c+16>>2]|0,!(!l&&(l=o[c+20>>2]|0,!l));)P=(o[l+4>>2]&-8)-O|0,g=P>>>0<z>>>0,c=l,S=g?l:S,z=g?P:z;if(P=S+O|0,P>>>0>S>>>0){g=o[S+24>>2]|0,a=o[S+12>>2]|0;do if((a|0)==(S|0)){if(l=S+20|0,a=o[l>>2]|0,!a&&(l=S+16|0,a=o[l>>2]|0,!a)){c=0;break}for(;;)if(m=a+20|0,c=o[m>>2]|0,c)a=c,l=m;else if(m=a+16|0,c=o[m>>2]|0,c)a=c,l=m;else break;o[l>>2]=0,c=a}else c=o[S+8>>2]|0,o[c+12>>2]=a,o[a+8>>2]=c,c=a;while(!1);do if(g|0){if(a=o[S+28>>2]|0,l=28228+(a<<2)|0,(S|0)==(o[l>>2]|0)){if(o[l>>2]=c,!c){o[6982]=w&~(1<<a);break}}else if(De=g+16|0,o[((o[De>>2]|0)==(S|0)?De:g+20|0)>>2]=c,!c)break;o[c+24>>2]=g,a=o[S+16>>2]|0,a|0&&(o[c+16>>2]=a,o[a+24>>2]=c),a=o[S+20>>2]|0,a|0&&(o[c+20>>2]=a,o[a+24>>2]=c)}while(!1);return z>>>0<16?(De=z+O|0,o[S+4>>2]=De|3,De=S+De+4|0,o[De>>2]=o[De>>2]|1):(o[S+4>>2]=O|3,o[P+4>>2]=z|1,o[P+z>>2]=z,Z|0&&(m=o[6986]|0,a=Z>>>3,c=27964+(a<<1<<2)|0,a=1<<a,a&se?(l=c+8|0,a=o[l>>2]|0):(o[6981]=a|se,a=c,l=c+8|0),o[l>>2]=m,o[a+12>>2]=m,o[m+8>>2]=a,o[m+12>>2]=c),o[6983]=z,o[6986]=P),De=S+8|0,te=bt,De|0}else se=O}else se=O}else se=O}else if(l>>>0<=4294967231)if(l=l+11|0,O=l&-8,m=o[6982]|0,m){g=0-O|0,l=l>>>8,l?O>>>0>16777215?z=31:(se=(l+1048320|0)>>>16&8,Ie=l<<se,S=(Ie+520192|0)>>>16&4,Ie=Ie<<S,z=(Ie+245760|0)>>>16&2,z=14-(S|se|z)+(Ie<<z>>>15)|0,z=O>>>(z+7|0)&1|z<<1):z=0,c=o[28228+(z<<2)>>2]|0;e:do if(!c)c=0,l=0,Ie=61;else for(l=0,S=O<<((z|0)==31?0:25-(z>>>1)|0),w=0;;){if(P=(o[c+4>>2]&-8)-O|0,P>>>0<g>>>0)if(P)l=c,g=P;else{l=c,g=0,Ie=65;break e}if(Ie=o[c+20>>2]|0,c=o[c+16+(S>>>31<<2)>>2]|0,w=(Ie|0)==0|(Ie|0)==(c|0)?w:Ie,c)S=S<<1;else{c=w,Ie=61;break}}while(!1);if((Ie|0)==61){if((c|0)==0&(l|0)==0){if(l=2<<z,l=(l|0-l)&m,!l){se=O;break}se=(l&0-l)+-1|0,P=se>>>12&16,se=se>>>P,w=se>>>5&8,se=se>>>w,S=se>>>2&4,se=se>>>S,z=se>>>1&2,se=se>>>z,c=se>>>1&1,l=0,c=o[28228+((w|P|S|z|c)+(se>>>c)<<2)>>2]|0}c?Ie=65:(S=l,P=g)}if((Ie|0)==65)for(w=c;;)if(se=(o[w+4>>2]&-8)-O|0,c=se>>>0<g>>>0,g=c?se:g,l=c?w:l,c=o[w+16>>2]|0,c||(c=o[w+20>>2]|0),c)w=c;else{S=l,P=g;break}if((S|0)!=0&&P>>>0<((o[6983]|0)-O|0)>>>0&&(Z=S+O|0,Z>>>0>S>>>0)){w=o[S+24>>2]|0,a=o[S+12>>2]|0;do if((a|0)==(S|0)){if(l=S+20|0,a=o[l>>2]|0,!a&&(l=S+16|0,a=o[l>>2]|0,!a)){a=0;break}for(;;)if(g=a+20|0,c=o[g>>2]|0,c)a=c,l=g;else if(g=a+16|0,c=o[g>>2]|0,c)a=c,l=g;else break;o[l>>2]=0}else De=o[S+8>>2]|0,o[De+12>>2]=a,o[a+8>>2]=De;while(!1);do if(w){if(l=o[S+28>>2]|0,c=28228+(l<<2)|0,(S|0)==(o[c>>2]|0)){if(o[c>>2]=a,!a){m=m&~(1<<l),o[6982]=m;break}}else if(De=w+16|0,o[((o[De>>2]|0)==(S|0)?De:w+20|0)>>2]=a,!a)break;o[a+24>>2]=w,l=o[S+16>>2]|0,l|0&&(o[a+16>>2]=l,o[l+24>>2]=a),l=o[S+20>>2]|0,l&&(o[a+20>>2]=l,o[l+24>>2]=a)}while(!1);e:do if(P>>>0<16)De=P+O|0,o[S+4>>2]=De|3,De=S+De+4|0,o[De>>2]=o[De>>2]|1;else{if(o[S+4>>2]=O|3,o[Z+4>>2]=P|1,o[Z+P>>2]=P,a=P>>>3,P>>>0<256){c=27964+(a<<1<<2)|0,l=o[6981]|0,a=1<<a,l&a?(l=c+8|0,a=o[l>>2]|0):(o[6981]=l|a,a=c,l=c+8|0),o[l>>2]=Z,o[a+12>>2]=Z,o[Z+8>>2]=a,o[Z+12>>2]=c;break}if(a=P>>>8,a?P>>>0>16777215?c=31:(ze=(a+1048320|0)>>>16&8,De=a<<ze,Oe=(De+520192|0)>>>16&4,De=De<<Oe,c=(De+245760|0)>>>16&2,c=14-(Oe|ze|c)+(De<<c>>>15)|0,c=P>>>(c+7|0)&1|c<<1):c=0,a=28228+(c<<2)|0,o[Z+28>>2]=c,l=Z+16|0,o[l+4>>2]=0,o[l>>2]=0,l=1<<c,!(m&l)){o[6982]=m|l,o[a>>2]=Z,o[Z+24>>2]=a,o[Z+12>>2]=Z,o[Z+8>>2]=Z;break}a=o[a>>2]|0;t:do if((o[a+4>>2]&-8|0)!=(P|0)){for(m=P<<((c|0)==31?0:25-(c>>>1)|0);c=a+16+(m>>>31<<2)|0,l=o[c>>2]|0,!!l;)if((o[l+4>>2]&-8|0)==(P|0)){a=l;break t}else m=m<<1,a=l;o[c>>2]=Z,o[Z+24>>2]=a,o[Z+12>>2]=Z,o[Z+8>>2]=Z;break e}while(!1);ze=a+8|0,De=o[ze>>2]|0,o[De+12>>2]=Z,o[ze>>2]=Z,o[Z+8>>2]=De,o[Z+12>>2]=a,o[Z+24>>2]=0}while(!1);return De=S+8|0,te=bt,De|0}else se=O}else se=O;else se=-1;while(!1);if(c=o[6983]|0,c>>>0>=se>>>0)return a=c-se|0,l=o[6986]|0,a>>>0>15?(De=l+se|0,o[6986]=De,o[6983]=a,o[De+4>>2]=a|1,o[l+c>>2]=a,o[l+4>>2]=se|3):(o[6983]=0,o[6986]=0,o[l+4>>2]=c|3,De=l+c+4|0,o[De>>2]=o[De>>2]|1),De=l+8|0,te=bt,De|0;if(P=o[6984]|0,P>>>0>se>>>0)return Oe=P-se|0,o[6984]=Oe,De=o[6987]|0,ze=De+se|0,o[6987]=ze,o[ze+4>>2]=Oe|1,o[De+4>>2]=se|3,De=De+8|0,te=bt,De|0;if(o[7099]|0?l=o[7101]|0:(o[7101]=4096,o[7100]=4096,o[7102]=-1,o[7103]=-1,o[7104]=0,o[7092]=0,o[7099]=pe&-16^1431655768,l=4096),S=se+48|0,z=se+47|0,w=l+z|0,g=0-l|0,O=w&g,O>>>0<=se>>>0||(l=o[7091]|0,l|0&&(Z=o[7089]|0,pe=Z+O|0,pe>>>0<=Z>>>0|pe>>>0>l>>>0)))return De=0,te=bt,De|0;e:do if(o[7092]&4)a=0,Ie=143;else{c=o[6987]|0;t:do if(c){for(m=28372;pe=o[m>>2]|0,!(pe>>>0<=c>>>0&&(pe+(o[m+4>>2]|0)|0)>>>0>c>>>0);)if(l=o[m+8>>2]|0,l)m=l;else{Ie=128;break t}if(a=w-P&g,a>>>0<2147483647)if(l=po(a|0)|0,(l|0)==((o[m>>2]|0)+(o[m+4>>2]|0)|0)){if((l|0)!=-1){P=a,w=l,Ie=145;break e}}else m=l,Ie=136;else a=0}else Ie=128;while(!1);do if((Ie|0)==128)if(c=po(0)|0,(c|0)!=-1&&(a=c,de=o[7100]|0,me=de+-1|0,a=((me&a|0)==0?0:(me+a&0-de)-a|0)+O|0,de=o[7089]|0,me=a+de|0,a>>>0>se>>>0&a>>>0<2147483647)){if(pe=o[7091]|0,pe|0&&me>>>0<=de>>>0|me>>>0>pe>>>0){a=0;break}if(l=po(a|0)|0,(l|0)==(c|0)){P=a,w=c,Ie=145;break e}else m=l,Ie=136}else a=0;while(!1);do if((Ie|0)==136){if(c=0-a|0,!(S>>>0>a>>>0&(a>>>0<2147483647&(m|0)!=-1)))if((m|0)==-1){a=0;break}else{P=a,w=m,Ie=145;break e}if(l=o[7101]|0,l=z-a+l&0-l,l>>>0>=2147483647){P=a,w=m,Ie=145;break e}if((po(l|0)|0)==-1){po(c|0)|0,a=0;break}else{P=l+a|0,w=m,Ie=145;break e}}while(!1);o[7092]=o[7092]|4,Ie=143}while(!1);if((Ie|0)==143&&O>>>0<2147483647&&(Oe=po(O|0)|0,me=po(0)|0,Be=me-Oe|0,Je=Be>>>0>(se+40|0)>>>0,!((Oe|0)==-1|Je^1|Oe>>>0<me>>>0&((Oe|0)!=-1&(me|0)!=-1)^1))&&(P=Je?Be:a,w=Oe,Ie=145),(Ie|0)==145){a=(o[7089]|0)+P|0,o[7089]=a,a>>>0>(o[7090]|0)>>>0&&(o[7090]=a),z=o[6987]|0;e:do if(z){for(a=28372;;){if(l=o[a>>2]|0,c=o[a+4>>2]|0,(w|0)==(l+c|0)){Ie=154;break}if(m=o[a+8>>2]|0,m)a=m;else break}if((Ie|0)==154&&(ze=a+4|0,(o[a+12>>2]&8|0)==0)&&w>>>0>z>>>0&l>>>0<=z>>>0){o[ze>>2]=c+P,De=(o[6984]|0)+P|0,Oe=z+8|0,Oe=(Oe&7|0)==0?0:0-Oe&7,ze=z+Oe|0,Oe=De-Oe|0,o[6987]=ze,o[6984]=Oe,o[ze+4>>2]=Oe|1,o[z+De+4>>2]=40,o[6988]=o[7103];break}for(w>>>0<(o[6985]|0)>>>0&&(o[6985]=w),c=w+P|0,a=28372;;){if((o[a>>2]|0)==(c|0)){Ie=162;break}if(l=o[a+8>>2]|0,l)a=l;else break}if((Ie|0)==162&&(o[a+12>>2]&8|0)==0){o[a>>2]=w,Z=a+4|0,o[Z>>2]=(o[Z>>2]|0)+P,Z=w+8|0,Z=w+((Z&7|0)==0?0:0-Z&7)|0,a=c+8|0,a=c+((a&7|0)==0?0:0-a&7)|0,O=Z+se|0,S=a-Z-se|0,o[Z+4>>2]=se|3;t:do if((z|0)==(a|0))De=(o[6984]|0)+S|0,o[6984]=De,o[6987]=O,o[O+4>>2]=De|1;else{if((o[6986]|0)==(a|0)){De=(o[6983]|0)+S|0,o[6983]=De,o[6986]=O,o[O+4>>2]=De|1,o[O+De>>2]=De;break}if(l=o[a+4>>2]|0,(l&3|0)==1){P=l&-8,m=l>>>3;i:do if(l>>>0<256)if(l=o[a+8>>2]|0,c=o[a+12>>2]|0,(c|0)==(l|0)){o[6981]=o[6981]&~(1<<m);break}else{o[l+12>>2]=c,o[c+8>>2]=l;break}else{w=o[a+24>>2]|0,l=o[a+12>>2]|0;do if((l|0)==(a|0)){if(c=a+16|0,m=c+4|0,l=o[m>>2]|0,l)c=m;else if(l=o[c>>2]|0,!l){l=0;break}for(;;)if(g=l+20|0,m=o[g>>2]|0,m)l=m,c=g;else if(g=l+16|0,m=o[g>>2]|0,m)l=m,c=g;else break;o[c>>2]=0}else De=o[a+8>>2]|0,o[De+12>>2]=l,o[l+8>>2]=De;while(!1);if(!w)break;c=o[a+28>>2]|0,m=28228+(c<<2)|0;do if((o[m>>2]|0)!=(a|0)){if(De=w+16|0,o[((o[De>>2]|0)==(a|0)?De:w+20|0)>>2]=l,!l)break i}else{if(o[m>>2]=l,l|0)break;o[6982]=o[6982]&~(1<<c);break i}while(!1);if(o[l+24>>2]=w,c=a+16|0,m=o[c>>2]|0,m|0&&(o[l+16>>2]=m,o[m+24>>2]=l),c=o[c+4>>2]|0,!c)break;o[l+20>>2]=c,o[c+24>>2]=l}while(!1);a=a+P|0,g=P+S|0}else g=S;if(a=a+4|0,o[a>>2]=o[a>>2]&-2,o[O+4>>2]=g|1,o[O+g>>2]=g,a=g>>>3,g>>>0<256){c=27964+(a<<1<<2)|0,l=o[6981]|0,a=1<<a,l&a?(l=c+8|0,a=o[l>>2]|0):(o[6981]=l|a,a=c,l=c+8|0),o[l>>2]=O,o[a+12>>2]=O,o[O+8>>2]=a,o[O+12>>2]=c;break}a=g>>>8;do if(!a)m=0;else{if(g>>>0>16777215){m=31;break}ze=(a+1048320|0)>>>16&8,De=a<<ze,Oe=(De+520192|0)>>>16&4,De=De<<Oe,m=(De+245760|0)>>>16&2,m=14-(Oe|ze|m)+(De<<m>>>15)|0,m=g>>>(m+7|0)&1|m<<1}while(!1);if(a=28228+(m<<2)|0,o[O+28>>2]=m,l=O+16|0,o[l+4>>2]=0,o[l>>2]=0,l=o[6982]|0,c=1<<m,!(l&c)){o[6982]=l|c,o[a>>2]=O,o[O+24>>2]=a,o[O+12>>2]=O,o[O+8>>2]=O;break}a=o[a>>2]|0;i:do if((o[a+4>>2]&-8|0)!=(g|0)){for(m=g<<((m|0)==31?0:25-(m>>>1)|0);c=a+16+(m>>>31<<2)|0,l=o[c>>2]|0,!!l;)if((o[l+4>>2]&-8|0)==(g|0)){a=l;break i}else m=m<<1,a=l;o[c>>2]=O,o[O+24>>2]=a,o[O+12>>2]=O,o[O+8>>2]=O;break t}while(!1);ze=a+8|0,De=o[ze>>2]|0,o[De+12>>2]=O,o[ze>>2]=O,o[O+8>>2]=De,o[O+12>>2]=a,o[O+24>>2]=0}while(!1);return De=Z+8|0,te=bt,De|0}for(a=28372;l=o[a>>2]|0,!(l>>>0<=z>>>0&&(De=l+(o[a+4>>2]|0)|0,De>>>0>z>>>0));)a=o[a+8>>2]|0;g=De+-47|0,l=g+8|0,l=g+((l&7|0)==0?0:0-l&7)|0,g=z+16|0,l=l>>>0<g>>>0?z:l,a=l+8|0,c=P+-40|0,Oe=w+8|0,Oe=(Oe&7|0)==0?0:0-Oe&7,ze=w+Oe|0,Oe=c-Oe|0,o[6987]=ze,o[6984]=Oe,o[ze+4>>2]=Oe|1,o[w+c+4>>2]=40,o[6988]=o[7103],c=l+4|0,o[c>>2]=27,o[a>>2]=o[7093],o[a+4>>2]=o[7094],o[a+8>>2]=o[7095],o[a+12>>2]=o[7096],o[7093]=w,o[7094]=P,o[7096]=0,o[7095]=a,a=l+24|0;do ze=a,a=a+4|0,o[a>>2]=7;while((ze+8|0)>>>0<De>>>0);if((l|0)!=(z|0)){if(w=l-z|0,o[c>>2]=o[c>>2]&-2,o[z+4>>2]=w|1,o[l>>2]=w,a=w>>>3,w>>>0<256){c=27964+(a<<1<<2)|0,l=o[6981]|0,a=1<<a,l&a?(l=c+8|0,a=o[l>>2]|0):(o[6981]=l|a,a=c,l=c+8|0),o[l>>2]=z,o[a+12>>2]=z,o[z+8>>2]=a,o[z+12>>2]=c;break}if(a=w>>>8,a?w>>>0>16777215?m=31:(ze=(a+1048320|0)>>>16&8,De=a<<ze,Oe=(De+520192|0)>>>16&4,De=De<<Oe,m=(De+245760|0)>>>16&2,m=14-(Oe|ze|m)+(De<<m>>>15)|0,m=w>>>(m+7|0)&1|m<<1):m=0,c=28228+(m<<2)|0,o[z+28>>2]=m,o[z+20>>2]=0,o[g>>2]=0,a=o[6982]|0,l=1<<m,!(a&l)){o[6982]=a|l,o[c>>2]=z,o[z+24>>2]=c,o[z+12>>2]=z,o[z+8>>2]=z;break}a=o[c>>2]|0;t:do if((o[a+4>>2]&-8|0)!=(w|0)){for(m=w<<((m|0)==31?0:25-(m>>>1)|0);c=a+16+(m>>>31<<2)|0,l=o[c>>2]|0,!!l;)if((o[l+4>>2]&-8|0)==(w|0)){a=l;break t}else m=m<<1,a=l;o[c>>2]=z,o[z+24>>2]=a,o[z+12>>2]=z,o[z+8>>2]=z;break e}while(!1);ze=a+8|0,De=o[ze>>2]|0,o[De+12>>2]=z,o[ze>>2]=z,o[z+8>>2]=De,o[z+12>>2]=a,o[z+24>>2]=0}}else De=o[6985]|0,(De|0)==0|w>>>0<De>>>0&&(o[6985]=w),o[7093]=w,o[7094]=P,o[7096]=0,o[6990]=o[7099],o[6989]=-1,o[6994]=27964,o[6993]=27964,o[6996]=27972,o[6995]=27972,o[6998]=27980,o[6997]=27980,o[7e3]=27988,o[6999]=27988,o[7002]=27996,o[7001]=27996,o[7004]=28004,o[7003]=28004,o[7006]=28012,o[7005]=28012,o[7008]=28020,o[7007]=28020,o[7010]=28028,o[7009]=28028,o[7012]=28036,o[7011]=28036,o[7014]=28044,o[7013]=28044,o[7016]=28052,o[7015]=28052,o[7018]=28060,o[7017]=28060,o[7020]=28068,o[7019]=28068,o[7022]=28076,o[7021]=28076,o[7024]=28084,o[7023]=28084,o[7026]=28092,o[7025]=28092,o[7028]=28100,o[7027]=28100,o[7030]=28108,o[7029]=28108,o[7032]=28116,o[7031]=28116,o[7034]=28124,o[7033]=28124,o[7036]=28132,o[7035]=28132,o[7038]=28140,o[7037]=28140,o[7040]=28148,o[7039]=28148,o[7042]=28156,o[7041]=28156,o[7044]=28164,o[7043]=28164,o[7046]=28172,o[7045]=28172,o[7048]=28180,o[7047]=28180,o[7050]=28188,o[7049]=28188,o[7052]=28196,o[7051]=28196,o[7054]=28204,o[7053]=28204,o[7056]=28212,o[7055]=28212,De=P+-40|0,Oe=w+8|0,Oe=(Oe&7|0)==0?0:0-Oe&7,ze=w+Oe|0,Oe=De-Oe|0,o[6987]=ze,o[6984]=Oe,o[ze+4>>2]=Oe|1,o[w+De+4>>2]=40,o[6988]=o[7103];while(!1);if(a=o[6984]|0,a>>>0>se>>>0)return Oe=a-se|0,o[6984]=Oe,De=o[6987]|0,ze=De+se|0,o[6987]=ze,o[ze+4>>2]=Oe|1,o[De+4>>2]=se|3,De=De+8|0,te=bt,De|0}return De=Fu()|0,o[De>>2]=12,De=0,te=bt,De|0}function Qt(l){l=l|0;var a=0,c=0,m=0,g=0,w=0,P=0,S=0,z=0;if(l){c=l+-8|0,g=o[6985]|0,l=o[l+-4>>2]|0,a=l&-8,z=c+a|0;do if(l&1)S=c,P=c;else{if(m=o[c>>2]|0,!(l&3)||(P=c+(0-m)|0,w=m+a|0,P>>>0<g>>>0))return;if((o[6986]|0)==(P|0)){if(l=z+4|0,a=o[l>>2]|0,(a&3|0)!=3){S=P,a=w;break}o[6983]=w,o[l>>2]=a&-2,o[P+4>>2]=w|1,o[P+w>>2]=w;return}if(c=m>>>3,m>>>0<256)if(l=o[P+8>>2]|0,a=o[P+12>>2]|0,(a|0)==(l|0)){o[6981]=o[6981]&~(1<<c),S=P,a=w;break}else{o[l+12>>2]=a,o[a+8>>2]=l,S=P,a=w;break}g=o[P+24>>2]|0,l=o[P+12>>2]|0;do if((l|0)==(P|0)){if(a=P+16|0,c=a+4|0,l=o[c>>2]|0,l)a=c;else if(l=o[a>>2]|0,!l){l=0;break}for(;;)if(m=l+20|0,c=o[m>>2]|0,c)l=c,a=m;else if(m=l+16|0,c=o[m>>2]|0,c)l=c,a=m;else break;o[a>>2]=0}else S=o[P+8>>2]|0,o[S+12>>2]=l,o[l+8>>2]=S;while(!1);if(g){if(a=o[P+28>>2]|0,c=28228+(a<<2)|0,(o[c>>2]|0)==(P|0)){if(o[c>>2]=l,!l){o[6982]=o[6982]&~(1<<a),S=P,a=w;break}}else if(S=g+16|0,o[((o[S>>2]|0)==(P|0)?S:g+20|0)>>2]=l,!l){S=P,a=w;break}o[l+24>>2]=g,a=P+16|0,c=o[a>>2]|0,c|0&&(o[l+16>>2]=c,o[c+24>>2]=l),a=o[a+4>>2]|0,a?(o[l+20>>2]=a,o[a+24>>2]=l,S=P,a=w):(S=P,a=w)}else S=P,a=w}while(!1);if(!(P>>>0>=z>>>0)&&(l=z+4|0,m=o[l>>2]|0,!!(m&1))){if(m&2)o[l>>2]=m&-2,o[S+4>>2]=a|1,o[P+a>>2]=a,g=a;else{if((o[6987]|0)==(z|0)){if(z=(o[6984]|0)+a|0,o[6984]=z,o[6987]=S,o[S+4>>2]=z|1,(S|0)!=(o[6986]|0))return;o[6986]=0,o[6983]=0;return}if((o[6986]|0)==(z|0)){z=(o[6983]|0)+a|0,o[6983]=z,o[6986]=P,o[S+4>>2]=z|1,o[P+z>>2]=z;return}g=(m&-8)+a|0,c=m>>>3;do if(m>>>0<256)if(a=o[z+8>>2]|0,l=o[z+12>>2]|0,(l|0)==(a|0)){o[6981]=o[6981]&~(1<<c);break}else{o[a+12>>2]=l,o[l+8>>2]=a;break}else{w=o[z+24>>2]|0,l=o[z+12>>2]|0;do if((l|0)==(z|0)){if(a=z+16|0,c=a+4|0,l=o[c>>2]|0,l)a=c;else if(l=o[a>>2]|0,!l){c=0;break}for(;;)if(m=l+20|0,c=o[m>>2]|0,c)l=c,a=m;else if(m=l+16|0,c=o[m>>2]|0,c)l=c,a=m;else break;o[a>>2]=0,c=l}else c=o[z+8>>2]|0,o[c+12>>2]=l,o[l+8>>2]=c,c=l;while(!1);if(w|0){if(l=o[z+28>>2]|0,a=28228+(l<<2)|0,(o[a>>2]|0)==(z|0)){if(o[a>>2]=c,!c){o[6982]=o[6982]&~(1<<l);break}}else if(m=w+16|0,o[((o[m>>2]|0)==(z|0)?m:w+20|0)>>2]=c,!c)break;o[c+24>>2]=w,l=z+16|0,a=o[l>>2]|0,a|0&&(o[c+16>>2]=a,o[a+24>>2]=c),l=o[l+4>>2]|0,l|0&&(o[c+20>>2]=l,o[l+24>>2]=c)}}while(!1);if(o[S+4>>2]=g|1,o[P+g>>2]=g,(S|0)==(o[6986]|0)){o[6983]=g;return}}if(l=g>>>3,g>>>0<256){c=27964+(l<<1<<2)|0,a=o[6981]|0,l=1<<l,a&l?(a=c+8|0,l=o[a>>2]|0):(o[6981]=a|l,l=c,a=c+8|0),o[a>>2]=S,o[l+12>>2]=S,o[S+8>>2]=l,o[S+12>>2]=c;return}l=g>>>8,l?g>>>0>16777215?m=31:(P=(l+1048320|0)>>>16&8,z=l<<P,w=(z+520192|0)>>>16&4,z=z<<w,m=(z+245760|0)>>>16&2,m=14-(w|P|m)+(z<<m>>>15)|0,m=g>>>(m+7|0)&1|m<<1):m=0,l=28228+(m<<2)|0,o[S+28>>2]=m,o[S+20>>2]=0,o[S+16>>2]=0,a=o[6982]|0,c=1<<m;e:do if(!(a&c))o[6982]=a|c,o[l>>2]=S,o[S+24>>2]=l,o[S+12>>2]=S,o[S+8>>2]=S;else{l=o[l>>2]|0;t:do if((o[l+4>>2]&-8|0)!=(g|0)){for(m=g<<((m|0)==31?0:25-(m>>>1)|0);c=l+16+(m>>>31<<2)|0,a=o[c>>2]|0,!!a;)if((o[a+4>>2]&-8|0)==(g|0)){l=a;break t}else m=m<<1,l=a;o[c>>2]=S,o[S+24>>2]=l,o[S+12>>2]=S,o[S+8>>2]=S;break e}while(!1);P=l+8|0,z=o[P>>2]|0,o[z+12>>2]=S,o[P>>2]=S,o[S+8>>2]=z,o[S+12>>2]=l,o[S+24>>2]=0}while(!1);if(z=(o[6989]|0)+-1|0,o[6989]=z,!(z|0)){for(l=28380;l=o[l>>2]|0,l;)l=l+8|0;o[6989]=-1}}}}function ts(l,a){l=l|0,a=a|0;var c=0;return l?(c=Hn(a,l)|0,(a|l)>>>0>65535&&(c=((c>>>0)/(l>>>0)|0|0)==(a|0)?c:-1)):c=0,l=Js(c)|0,!l||!(o[l+-4>>2]&3)||bn(l|0,0,c|0)|0,l|0}function Wt(l,a,c,m){return l=l|0,a=a|0,c=c|0,m=m|0,c=l+c>>>0,Ft(a+m+(c>>>0<l>>>0|0)>>>0|0),c|0|0}function wr(l,a,c,m){return l=l|0,a=a|0,c=c|0,m=m|0,m=a-m-(c>>>0>l>>>0|0)>>>0,Ft(m|0),l-c>>>0|0|0}function yu(l){return l=l|0,(l?31-(vr(l^l-1)|0)|0:32)|0}function bs(l,a,c,m,g){l=l|0,a=a|0,c=c|0,m=m|0,g=g|0;var w=0,P=0,S=0,z=0,O=0,Z=0,se=0,pe=0,de=0,me=0;if(Z=l,z=a,O=z,P=c,pe=m,S=pe,!O)return w=(g|0)!=0,S?w?(o[g>>2]=l|0,o[g+4>>2]=a&0,pe=0,g=0,Ft(pe|0),g|0):(pe=0,g=0,Ft(pe|0),g|0):(w&&(o[g>>2]=(Z>>>0)%(P>>>0),o[g+4>>2]=0),pe=0,g=(Z>>>0)/(P>>>0)>>>0,Ft(pe|0),g|0);w=(S|0)==0;do if(P){if(!w){if(w=(vr(S|0)|0)-(vr(O|0)|0)|0,w>>>0<=31){se=w+1|0,S=31-w|0,a=w-31>>31,P=se,l=Z>>>(se>>>0)&a|O<<S,a=O>>>(se>>>0)&a,w=0,S=Z<<S;break}return g?(o[g>>2]=l|0,o[g+4>>2]=z|a&0,pe=0,g=0,Ft(pe|0),g|0):(pe=0,g=0,Ft(pe|0),g|0)}if(w=P-1|0,w&P|0){S=(vr(P|0)|0)+33-(vr(O|0)|0)|0,me=64-S|0,se=32-S|0,z=se>>31,de=S-32|0,a=de>>31,P=S,l=se-1>>31&O>>>(de>>>0)|(O<<se|Z>>>(S>>>0))&a,a=a&O>>>(S>>>0),w=Z<<me&z,S=(O<<me|Z>>>(de>>>0))&z|Z<<se&S-33>>31;break}return g|0&&(o[g>>2]=w&Z,o[g+4>>2]=0),(P|0)==1?(de=z|a&0,me=l|0|0,Ft(de|0),me|0):(me=yu(P|0)|0,de=O>>>(me>>>0)|0,me=O<<32-me|Z>>>(me>>>0)|0,Ft(de|0),me|0)}else{if(w)return g|0&&(o[g>>2]=(O>>>0)%(P>>>0),o[g+4>>2]=0),de=0,me=(O>>>0)/(P>>>0)>>>0,Ft(de|0),me|0;if(!Z)return g|0&&(o[g>>2]=0,o[g+4>>2]=(O>>>0)%(S>>>0)),de=0,me=(O>>>0)/(S>>>0)>>>0,Ft(de|0),me|0;if(w=S-1|0,!(w&S))return g|0&&(o[g>>2]=l|0,o[g+4>>2]=w&O|a&0),de=0,me=O>>>((yu(S|0)|0)>>>0),Ft(de|0),me|0;if(w=(vr(S|0)|0)-(vr(O|0)|0)|0,w>>>0<=30){a=w+1|0,S=31-w|0,P=a,l=O<<S|Z>>>(a>>>0),a=O>>>(a>>>0),w=0,S=Z<<S;break}return g?(o[g>>2]=l|0,o[g+4>>2]=z|a&0,de=0,me=0,Ft(de|0),me|0):(de=0,me=0,Ft(de|0),me|0)}while(!1);if(!P)O=S,z=0,S=0;else{se=c|0|0,Z=pe|m&0,O=Wt(se|0,Z|0,-1,-1)|0,c=ae()|0,z=S,S=0;do m=z,z=w>>>31|z<<1,w=S|w<<1,m=l<<1|m>>>31|0,pe=l>>>31|a<<1|0,wr(O|0,c|0,m|0,pe|0)|0,me=ae()|0,de=me>>31|((me|0)<0?-1:0)<<1,S=de&1,l=wr(m|0,pe|0,de&se|0,(((me|0)<0?-1:0)>>31|((me|0)<0?-1:0)<<1)&Z|0)|0,a=ae()|0,P=P-1|0;while((P|0)!=0);O=z,z=0}return P=0,g|0&&(o[g>>2]=l,o[g+4>>2]=a),de=(w|0)>>>31|(O|P)<<1|(P<<1|w>>>31)&0|z,me=(w<<1|0)&-2|S,Ft(de|0),me|0}function xn(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0,O=0;return O=a>>31|((a|0)<0?-1:0)<<1,z=((a|0)<0?-1:0)>>31|((a|0)<0?-1:0)<<1,w=m>>31|((m|0)<0?-1:0)<<1,g=((m|0)<0?-1:0)>>31|((m|0)<0?-1:0)<<1,S=wr(O^l|0,z^a|0,O|0,z|0)|0,P=ae()|0,l=w^O,a=g^z,wr((bs(S,P,wr(w^c|0,g^m|0,w|0,g|0)|0,ae()|0,0)|0)^l|0,(ae()|0)^a|0,l|0,a|0)|0}function Ou(l,a){l=l|0,a=a|0;var c=0,m=0,g=0,w=0;return w=l&65535,g=a&65535,c=Hn(g,w)|0,m=l>>>16,l=(c>>>16)+(Hn(g,m)|0)|0,g=a>>>16,a=Hn(g,w)|0,Ft((l>>>16)+(Hn(g,m)|0)+(((l&65535)+a|0)>>>16)|0),l+a<<16|c&65535|0|0}function lr(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0;return g=l,w=c,c=Ou(g,w)|0,l=ae()|0,Ft((Hn(a,w)|0)+(Hn(m,g)|0)+l|l&0|0),c|0|0|0}function ul(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0,P=0,S=0,z=0,O=0;return g=te,te=te+16|0,S=g|0,P=a>>31|((a|0)<0?-1:0)<<1,w=((a|0)<0?-1:0)>>31|((a|0)<0?-1:0)<<1,O=m>>31|((m|0)<0?-1:0)<<1,z=((m|0)<0?-1:0)>>31|((m|0)<0?-1:0)<<1,l=wr(P^l|0,w^a|0,P|0,w|0)|0,a=ae()|0,bs(l,a,wr(O^c|0,z^m|0,O|0,z|0)|0,ae()|0,S)|0,m=wr(o[S>>2]^P|0,o[S+4>>2]^w|0,P|0,w|0)|0,c=ae()|0,te=g,Ft(c|0),m|0}function Do(l,a,c,m){l=l|0,a=a|0,c=c|0,m=m|0;var g=0,w=0;return w=te,te=te+16|0,g=w|0,bs(l,a,c,m,g)|0,te=w,Ft(o[g+4>>2]|0),o[g>>2]|0|0}function hl(l,a,c){return l=l|0,a=a|0,c=c|0,(c|0)<32?(Ft(a>>c|0),l>>>c|(a&(1<<c)-1)<<32-c):(Ft(((a|0)<0?-1:0)|0),a>>c-32|0)}function ht(l,a,c){return l=l|0,a=a|0,c=c|0,(c|0)<32?(Ft(a>>>c|0),l>>>c|(a&(1<<c)-1)<<32-c):(Ft(0),a>>>c-32|0)}function yt(l,a,c){return l=l|0,a=a|0,c=c|0,(c|0)<32?(Ft(a<<c|(l&(1<<c)-1<<32-c)>>>32-c|0),l<<c):(Ft(l<<c-32|0),0)}function Jl(l,a,c){return l=l|0,a=a|0,a=vr(a)|0,(a|0)==32&&(a=a+(vr(l)|0)|0),Ft(0),a|0}function Nu(l,a){return l=+l,a=+a,l!=l?+a:a!=a?+l:+Sa(+l,+a)}function eu(l,a){return l=+l,a=+a,l!=l?+a:a!=a?+l:+bo(+l,+a)}function ra(l){return l=+l,l>=0?+Qi(l+.5):+qn(l-.5)}function fo(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0;if((c|0)>=8192)return zn(l|0,a|0,c|0)|0,l|0;if(w=l|0,g=l+c|0,(l&3)==(a&3)){for(;l&3;){if(!c)return w|0;At[l>>0]=At[a>>0]|0,l=l+1|0,a=a+1|0,c=c-1|0}for(c=g&-4|0,m=c-64|0;(l|0)<=(m|0);)o[l>>2]=o[a>>2],o[l+4>>2]=o[a+4>>2],o[l+8>>2]=o[a+8>>2],o[l+12>>2]=o[a+12>>2],o[l+16>>2]=o[a+16>>2],o[l+20>>2]=o[a+20>>2],o[l+24>>2]=o[a+24>>2],o[l+28>>2]=o[a+28>>2],o[l+32>>2]=o[a+32>>2],o[l+36>>2]=o[a+36>>2],o[l+40>>2]=o[a+40>>2],o[l+44>>2]=o[a+44>>2],o[l+48>>2]=o[a+48>>2],o[l+52>>2]=o[a+52>>2],o[l+56>>2]=o[a+56>>2],o[l+60>>2]=o[a+60>>2],l=l+64|0,a=a+64|0;for(;(l|0)<(c|0);)o[l>>2]=o[a>>2],l=l+4|0,a=a+4|0}else for(c=g-4|0;(l|0)<(c|0);)At[l>>0]=At[a>>0]|0,At[l+1>>0]=At[a+1>>0]|0,At[l+2>>0]=At[a+2>>0]|0,At[l+3>>0]=At[a+3>>0]|0,l=l+4|0,a=a+4|0;for(;(l|0)<(g|0);)At[l>>0]=At[a>>0]|0,l=l+1|0,a=a+1|0;return w|0}function bn(l,a,c){l=l|0,a=a|0,c=c|0;var m=0,g=0,w=0,P=0;if(w=l+c|0,a=a&255,(c|0)>=67){for(;l&3;)At[l>>0]=a,l=l+1|0;for(m=w&-4|0,P=a|a<<8|a<<16|a<<24,g=m-64|0;(l|0)<=(g|0);)o[l>>2]=P,o[l+4>>2]=P,o[l+8>>2]=P,o[l+12>>2]=P,o[l+16>>2]=P,o[l+20>>2]=P,o[l+24>>2]=P,o[l+28>>2]=P,o[l+32>>2]=P,o[l+36>>2]=P,o[l+40>>2]=P,o[l+44>>2]=P,o[l+48>>2]=P,o[l+52>>2]=P,o[l+56>>2]=P,o[l+60>>2]=P,l=l+64|0;for(;(l|0)<(m|0);)o[l>>2]=P,l=l+4|0}for(;(l|0)<(w|0);)At[l>>0]=a,l=l+1|0;return w-c|0}function kt(l){return l=+l,l>=0?+Qi(l+.5):+qn(l-.5)}function po(l){l=l|0;var a=0,c=0,m=0;return m=wo()|0,c=o[Ri>>2]|0,a=c+l|0,(l|0)>0&(a|0)<(c|0)|(a|0)<0?(Xi(a|0)|0,Uo(12),-1):(a|0)>(m|0)&&!(Fi(a|0)|0)?(Uo(12),-1):(o[Ri>>2]=a,c|0)}return{___divdi3:xn,___muldi3:lr,___remdi3:ul,___uremdi3:Do,_areNeighborCells:jl,_bitshift64Ashr:hl,_bitshift64Lshr:ht,_bitshift64Shl:yt,_calloc:ts,_cellAreaKm2:ya,_cellAreaM2:Oa,_cellAreaRads2:es,_cellToBoundary:fs,_cellToCenterChild:Bs,_cellToChildPos:Ra,_cellToChildren:Qs,_cellToChildrenSize:Ws,_cellToLatLng:xs,_cellToLocalIj:Hl,_cellToParent:Xa,_cellToVertex:Ur,_cellToVertexes:ta,_cellsToDirectedEdge:vl,_cellsToLinkedMultiPolygon:zs,_childPosToCell:Au,_compactCells:uo,_constructCell:Zl,_destroyLinkedMultiPolygon:gi,_directedEdgeToBoundary:vs,_directedEdgeToCells:za,_edgeLengthKm:xa,_edgeLengthM:co,_edgeLengthRads:va,_emscripten_replace_memory:tr,_free:Qt,_getBaseCellNumber:Rn,_getDirectedEdgeDestination:uu,_getDirectedEdgeOrigin:Ya,_getHexagonAreaAvgKm2:fn,_getHexagonAreaAvgM2:ql,_getHexagonEdgeLengthAvgKm:Ko,_getHexagonEdgeLengthAvgM:rl,_getIcosahedronFaces:Ys,_getIndexDigit:$o,_getNumCells:Rs,_getPentagons:Pl,_getRes0Cells:Zs,_getResolution:pa,_greatCircleDistanceKm:Xs,_greatCircleDistanceM:Xo,_greatCircleDistanceRads:il,_gridDisk:ha,_gridDiskDistances:_n,_gridDistance:Ql,_gridPathCells:ol,_gridPathCellsSize:$l,_gridRing:Cr,_gridRingUnsafe:To,_i64Add:Wt,_i64Subtract:wr,_isPentagon:$i,_isResClassIII:cu,_isValidCell:cs,_isValidDirectedEdge:Mo,_isValidIndex:wl,_isValidVertex:fu,_latLngToCell:Fn,_llvm_ctlz_i64:Jl,_llvm_maxnum_f64:Nu,_llvm_minnum_f64:eu,_llvm_round_f64:ra,_localIjToCell:Wl,_malloc:Js,_maxFaceCount:Yo,_maxGridDiskSize:Wa,_maxPolygonToCellsSize:$a,_maxPolygonToCellsSizeExperimental:ne,_memcpy:fo,_memset:bn,_originToDirectedEdges:lo,_pentagonCount:Ja,_polygonToCells:Ca,_polygonToCellsExperimental:q,_readInt64AsDoubleFromPointer:br,_res0CellCount:Ki,_round:kt,_sbrk:po,_sizeOfCellBoundary:On,_sizeOfCoordIJ:Xl,_sizeOfGeoLoop:Ks,_sizeOfGeoPolygon:al,_sizeOfH3Index:Br,_sizeOfLatLng:ps,_sizeOfLinkedGeoPolygon:Yl,_uncompactCells:Ul,_uncompactCellsSize:ma,_vertexToLatLng:Kl,establishStackSpace:Sr,stackAlloc:Go,stackRestore:_i,stackSave:Ha}})(ot,St,cr);J.___divdi3=je.___divdi3,J.___muldi3=je.___muldi3,J.___remdi3=je.___remdi3,J.___uremdi3=je.___uremdi3,J._areNeighborCells=je._areNeighborCells,J._bitshift64Ashr=je._bitshift64Ashr,J._bitshift64Lshr=je._bitshift64Lshr,J._bitshift64Shl=je._bitshift64Shl,J._calloc=je._calloc,J._cellAreaKm2=je._cellAreaKm2,J._cellAreaM2=je._cellAreaM2,J._cellAreaRads2=je._cellAreaRads2,J._cellToBoundary=je._cellToBoundary,J._cellToCenterChild=je._cellToCenterChild,J._cellToChildPos=je._cellToChildPos,J._cellToChildren=je._cellToChildren,J._cellToChildrenSize=je._cellToChildrenSize,J._cellToLatLng=je._cellToLatLng,J._cellToLocalIj=je._cellToLocalIj,J._cellToParent=je._cellToParent,J._cellToVertex=je._cellToVertex,J._cellToVertexes=je._cellToVertexes,J._cellsToDirectedEdge=je._cellsToDirectedEdge,J._cellsToLinkedMultiPolygon=je._cellsToLinkedMultiPolygon,J._childPosToCell=je._childPosToCell,J._compactCells=je._compactCells,J._constructCell=je._constructCell,J._destroyLinkedMultiPolygon=je._destroyLinkedMultiPolygon,J._directedEdgeToBoundary=je._directedEdgeToBoundary,J._directedEdgeToCells=je._directedEdgeToCells,J._edgeLengthKm=je._edgeLengthKm,J._edgeLengthM=je._edgeLengthM,J._edgeLengthRads=je._edgeLengthRads;var Xt=J._emscripten_replace_memory=je._emscripten_replace_memory;J._free=je._free,J._getBaseCellNumber=je._getBaseCellNumber,J._getDirectedEdgeDestination=je._getDirectedEdgeDestination,J._getDirectedEdgeOrigin=je._getDirectedEdgeOrigin,J._getHexagonAreaAvgKm2=je._getHexagonAreaAvgKm2,J._getHexagonAreaAvgM2=je._getHexagonAreaAvgM2,J._getHexagonEdgeLengthAvgKm=je._getHexagonEdgeLengthAvgKm,J._getHexagonEdgeLengthAvgM=je._getHexagonEdgeLengthAvgM,J._getIcosahedronFaces=je._getIcosahedronFaces,J._getIndexDigit=je._getIndexDigit,J._getNumCells=je._getNumCells,J._getPentagons=je._getPentagons,J._getRes0Cells=je._getRes0Cells,J._getResolution=je._getResolution,J._greatCircleDistanceKm=je._greatCircleDistanceKm,J._greatCircleDistanceM=je._greatCircleDistanceM,J._greatCircleDistanceRads=je._greatCircleDistanceRads,J._gridDisk=je._gridDisk,J._gridDiskDistances=je._gridDiskDistances,J._gridDistance=je._gridDistance,J._gridPathCells=je._gridPathCells,J._gridPathCellsSize=je._gridPathCellsSize,J._gridRing=je._gridRing,J._gridRingUnsafe=je._gridRingUnsafe,J._i64Add=je._i64Add,J._i64Subtract=je._i64Subtract,J._isPentagon=je._isPentagon,J._isResClassIII=je._isResClassIII,J._isValidCell=je._isValidCell,J._isValidDirectedEdge=je._isValidDirectedEdge,J._isValidIndex=je._isValidIndex,J._isValidVertex=je._isValidVertex,J._latLngToCell=je._latLngToCell,J._llvm_ctlz_i64=je._llvm_ctlz_i64,J._llvm_maxnum_f64=je._llvm_maxnum_f64,J._llvm_minnum_f64=je._llvm_minnum_f64,J._llvm_round_f64=je._llvm_round_f64,J._localIjToCell=je._localIjToCell,J._malloc=je._malloc,J._maxFaceCount=je._maxFaceCount,J._maxGridDiskSize=je._maxGridDiskSize,J._maxPolygonToCellsSize=je._maxPolygonToCellsSize,J._maxPolygonToCellsSizeExperimental=je._maxPolygonToCellsSizeExperimental,J._memcpy=je._memcpy,J._memset=je._memset,J._originToDirectedEdges=je._originToDirectedEdges,J._pentagonCount=je._pentagonCount,J._polygonToCells=je._polygonToCells,J._polygonToCellsExperimental=je._polygonToCellsExperimental,J._readInt64AsDoubleFromPointer=je._readInt64AsDoubleFromPointer,J._res0CellCount=je._res0CellCount,J._round=je._round,J._sbrk=je._sbrk,J._sizeOfCellBoundary=je._sizeOfCellBoundary,J._sizeOfCoordIJ=je._sizeOfCoordIJ,J._sizeOfGeoLoop=je._sizeOfGeoLoop,J._sizeOfGeoPolygon=je._sizeOfGeoPolygon,J._sizeOfH3Index=je._sizeOfH3Index,J._sizeOfLatLng=je._sizeOfLatLng,J._sizeOfLinkedGeoPolygon=je._sizeOfLinkedGeoPolygon,J._uncompactCells=je._uncompactCells,J._uncompactCellsSize=je._uncompactCellsSize,J._vertexToLatLng=je._vertexToLatLng,J.establishStackSpace=je.establishStackSpace;var Gi=J.stackAlloc=je.stackAlloc,Bi=J.stackRestore=je.stackRestore,qe=J.stackSave=je.stackSave;if(J.asm=je,J.cwrap=zi,J.setValue=zr,J.getValue=Mn,tn){vo(tn)||(tn=ct(tn));{jo();var Hi=function(Ve){Ve.byteLength&&(Ve=new Uint8Array(Ve)),Sn.set(Ve,un),J.memoryInitializerRequest&&delete J.memoryInitializerRequest.response,Zo()},rn=function(){W(tn,Hi,function(){throw"could not load memory initializer "+tn})},Kt=ft(tn);if(Kt)Hi(Kt.buffer);else if(J.memoryInitializerRequest){var qi=function(){var Ve=J.memoryInitializerRequest,at=Ve.response;if(Ve.status!==200&&Ve.status!==0){var It=ft(J.memoryInitializerRequestURL);if(It)at=It.buffer;else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+Ve.status+", retrying "+tn),rn();return}}Hi(at)};J.memoryInitializerRequest.response?setTimeout(qi,0):J.memoryInitializerRequest.addEventListener("load",qi)}else rn()}}var Vr;Dn=function Ve(){Vr||Wi(),Vr||(Dn=Ve)};function Wi(Ve){if(Ui>0||(hn(),Ui>0))return;function at(){Vr||(Vr=!0,!Gt&&(Er(),yo(),J.onRuntimeInitialized&&J.onRuntimeInitialized(),us()))}J.setStatus?(J.setStatus("Running..."),setTimeout(function(){setTimeout(function(){J.setStatus("")},1),at()},1)):at()}J.run=Wi;function er(Ve){throw J.onAbort&&J.onAbort(Ve),Ve+="",p(Ve),it(Ve),Gt=!0,"abort("+Ve+"). Build with -s ASSERTIONS=1 for more info."}if(J.abort=er,J.preInit)for(typeof J.preInit=="function"&&(J.preInit=[J.preInit]);J.preInit.length>0;)J.preInit.pop()();return Wi(),xe})(typeof et=="object"?et:{}),ci="number",ui=ci,ch=ci,yi=ci,vi=ci,Es=ci,jt=ci,$m=[["sizeOfH3Index",ci],["sizeOfLatLng",ci],["sizeOfCellBoundary",ci],["sizeOfGeoLoop",ci],["sizeOfGeoPolygon",ci],["sizeOfLinkedGeoPolygon",ci],["sizeOfCoordIJ",ci],["readInt64AsDoubleFromPointer",ci],["isValidCell",ch,[yi,vi]],["isValidIndex",ch,[yi,vi]],["latLngToCell",ui,[ci,ci,Es,jt]],["cellToLatLng",ui,[yi,vi,jt]],["cellToBoundary",ui,[yi,vi,jt]],["maxGridDiskSize",ui,[ci,jt]],["gridDisk",ui,[yi,vi,ci,jt]],["gridDiskDistances",ui,[yi,vi,ci,jt,jt]],["gridRing",ui,[yi,vi,ci,jt]],["gridRingUnsafe",ui,[yi,vi,ci,jt]],["maxPolygonToCellsSize",ui,[jt,Es,ci,jt]],["polygonToCells",ui,[jt,Es,ci,jt]],["maxPolygonToCellsSizeExperimental",ui,[jt,Es,ci,jt]],["polygonToCellsExperimental",ui,[jt,Es,ci,ci,ci,jt]],["cellsToLinkedMultiPolygon",ui,[jt,ci,jt]],["destroyLinkedMultiPolygon",null,[jt]],["compactCells",ui,[jt,jt,ci,ci]],["uncompactCells",ui,[jt,ci,ci,jt,ci,Es]],["uncompactCellsSize",ui,[jt,ci,ci,Es,jt]],["isPentagon",ch,[yi,vi]],["isResClassIII",ch,[yi,vi]],["getBaseCellNumber",ci,[yi,vi]],["getResolution",ci,[yi,vi]],["getIndexDigit",ci,[yi,vi,ci]],["constructCell",ui,[ci,ci,jt,jt]],["maxFaceCount",ui,[yi,vi,jt]],["getIcosahedronFaces",ui,[yi,vi,jt]],["cellToParent",ui,[yi,vi,Es,jt]],["cellToChildren",ui,[yi,vi,Es,jt]],["cellToCenterChild",ui,[yi,vi,Es,jt]],["cellToChildrenSize",ui,[yi,vi,Es,jt]],["cellToChildPos",ui,[yi,vi,Es,jt]],["childPosToCell",ui,[ci,ci,yi,vi,Es,jt]],["areNeighborCells",ui,[yi,vi,yi,vi,jt]],["cellsToDirectedEdge",ui,[yi,vi,yi,vi,jt]],["getDirectedEdgeOrigin",ui,[yi,vi,jt]],["getDirectedEdgeDestination",ui,[yi,vi,jt]],["isValidDirectedEdge",ch,[yi,vi]],["directedEdgeToCells",ui,[yi,vi,jt]],["originToDirectedEdges",ui,[yi,vi,jt]],["directedEdgeToBoundary",ui,[yi,vi,jt]],["gridDistance",ui,[yi,vi,yi,vi,jt]],["gridPathCells",ui,[yi,vi,yi,vi,jt]],["gridPathCellsSize",ui,[yi,vi,yi,vi,jt]],["cellToLocalIj",ui,[yi,vi,yi,vi,ci,jt]],["localIjToCell",ui,[yi,vi,jt,ci,jt]],["getHexagonAreaAvgM2",ui,[Es,jt]],["getHexagonAreaAvgKm2",ui,[Es,jt]],["getHexagonEdgeLengthAvgM",ui,[Es,jt]],["getHexagonEdgeLengthAvgKm",ui,[Es,jt]],["greatCircleDistanceM",ci,[jt,jt]],["greatCircleDistanceKm",ci,[jt,jt]],["greatCircleDistanceRads",ci,[jt,jt]],["cellAreaM2",ui,[yi,vi,jt]],["cellAreaKm2",ui,[yi,vi,jt]],["cellAreaRads2",ui,[yi,vi,jt]],["edgeLengthM",ui,[yi,vi,jt]],["edgeLengthKm",ui,[yi,vi,jt]],["edgeLengthRads",ui,[yi,vi,jt]],["getNumCells",ui,[Es,jt]],["getRes0Cells",ui,[jt]],["res0CellCount",ci],["getPentagons",ui,[ci,jt]],["pentagonCount",ci],["cellToVertex",ui,[yi,vi,ci,jt]],["cellToVertexes",ui,[yi,vi,jt]],["vertexToLatLng",ui,[yi,vi,jt]],["isValidVertex",ch,[yi,vi]]],Ym=0,Xm=1,Km=2,Jm=3,tp=4,ip=5,e_=6,t_=7,i_=8,r_=9,n_=10,s_=11,o_=12,a_=13,l_=14,rp=15,u_=16,h_=17,DA=18,c_=19,Zn={};Zn[Ym]="Success";Zn[Xm]="The operation failed but a more specific error is not available";Zn[Km]="Argument was outside of acceptable range";Zn[Jm]="Latitude or longitude arguments were outside of acceptable range";Zn[tp]="Resolution argument was outside of acceptable range";Zn[ip]="Cell argument was not valid";Zn[e_]="Directed edge argument was not valid";Zn[t_]="Undirected edge argument was not valid";Zn[i_]="Vertex argument was not valid";Zn[r_]="Pentagon distortion was encountered";Zn[n_]="Duplicate input";Zn[s_]="Cell arguments were not neighbors";Zn[o_]="Cell arguments had incompatible resolutions";Zn[a_]="Memory allocation failed";Zn[l_]="Bounds of provided memory were insufficient";Zn[rp]="Mode or flags argument was not valid";Zn[u_]="Index argument was not valid";Zn[h_]="Base cell number was outside of acceptable range";Zn[DA]="Child indexing digits invalid";Zn[c_]="Child indexing digits refer to a deleted subsequence";var fh=1e3,np=1001,sp=1002,Mc={};Mc[fh]="Unknown unit";Mc[np]="Array length out of bounds";Mc[sp]="Got unexpected null value for H3 index";var A_="Unknown error";function op(xe,J,fe){var Re=fe&&"value"in fe,We=new Error((xe[J]||A_)+" (code: "+J+(Re?", value: "+fe.value:"")+")");return We.code=J,We}function Hh(xe,J){var fe=arguments.length===2?{value:J}:{};return op(Zn,xe,fe)}function lu(xe,J){var fe=arguments.length===2?{value:J}:{};return op(Mc,xe,fe)}function si(xe){if(xe!==0)throw Hh(xe)}var Bt={};$m.forEach(function(J){Bt[J[0]]=et.cwrap.apply(et,J)});var Ah=16,Gh=0,Ss=4,Wd=4,ua=8,ml=8,yr=Bt.sizeOfH3Index(),Wh=Bt.sizeOfLatLng(),ap=Bt.sizeOfCellBoundary(),f_=Bt.sizeOfGeoPolygon(),qh=Bt.sizeOfGeoLoop(),d_=Bt.sizeOfLinkedGeoPolygon(),lp=Bt.sizeOfCoordIJ(),Bo={m:"m",m2:"m2",km:"km",km2:"km2",rads:"rads",rads2:"rads2"},Uh={containmentCenter:"containmentCenter",containmentFull:"containmentFull",containmentOverlapping:"containmentOverlapping",containmentOverlappingBbox:"containmentOverlappingBbox"};function p_(xe){switch(xe){case Uh.containmentCenter:return 0;case Uh.containmentFull:return 1;case Uh.containmentOverlapping:return 2;case Uh.containmentOverlappingBbox:return 3;default:throw lu(rp,xe)}}function Bu(xe){if(typeof xe!="number"||xe<0||xe>15||Math.floor(xe)!==xe)throw Hh(tp,xe);return xe}function _l(xe){if(!xe)throw lu(sp);return xe}var m_=Math.pow(2,32)-1;function Ru(xe){if(xe>m_)throw lu(np,xe);return xe}var __=/[^0-9a-fA-F]/;function Ei(xe){if(Array.isArray(xe)&&xe.length===2&&Number.isInteger(xe[0])&&Number.isInteger(xe[1]))return xe;if(typeof xe!="string"||__.test(xe))return[0,0];var J=parseInt(xe.substring(0,xe.length-8),Ah),fe=parseInt(xe.substring(xe.length-8),Ah);return[fe,J]}function Qd(xe){if(xe>=0)return xe.toString(Ah);xe=xe&2147483647;var J=hp(8,xe.toString(Ah)),fe=(parseInt(J[0],Ah)+8).toString(Ah);return J=fe+J.substring(1),J}function up(xe,J){return Qd(J)+hp(8,Qd(xe))}function hp(xe,J){for(var fe=xe-J.length,Re="",We=0;We<fe;We++)Re+="0";return Re=Re+J,Re}var g_=Math.pow(2,32);function y_(xe){return typeof xe!="number"?[0,0]:[xe|0,xe/g_|0]}function $d(xe,J,fe){for(var Re=xe.length,We=et._calloc(Re,Wh),ct=fe?1:0,W=fe?0:1,p=0;p<Re*2;p+=2)et.HEAPF64.set([xe[p/2][ct],xe[p/2][W]].map(Cc),We/ua+p);return et.HEAPU32.set([Re,We],J/Ss),J}function cp(xe,J){var fe=xe.length-1,Re=et._calloc(f_),We=0,ct=We+qh,W=ct+Ss;$d(xe[0],Re+We,J);var p;if(fe>0){p=et._calloc(fe,qh);for(var it=0;it<fe;it++)$d(xe[it+1],p+qh*it,J)}return et.setValue(Re+ct,fe,"i32"),et.setValue(Re+W,p,"i32"),Re}function Ap(xe){var J=0,fe=J+qh,Re=fe+Ss,We=Ss;et._free(et.getValue(xe+J+We,"i8*"));var ct=et.getValue(xe+fe,"i32");if(ct>0){for(var W=et.getValue(xe+Re,"i32"),p=0;p<ct;p++)et._free(et.getValue(W+qh*p+We,"i8*"));et._free(W)}et._free(xe)}function Ma(xe,J){J===void 0&&(J=0);var fe=et.getValue(xe+yr*J,"i32"),Re=et.getValue(xe+yr*J+Ss,"i32");return Re?up(fe,Re):null}function v_(xe,J){J===void 0&&(J=0);var fe=et.getValue(xe+Ss*J,"i32");return!!fe}function Ec(xe,J){return J===void 0&&(J=0),et.getValue(xe+ua*J,"double")}function gl(xe){return Bt.readInt64AsDoubleFromPointer(xe)}function x_(xe,J,fe){et.HEAPU32.set(Ei(xe),J/Ss+2*fe)}function Ro(xe,J){for(var fe=[],Re=0;Re<J;Re++){var We=Ma(xe,Re);We!==null&&fe.push(We)}return fe}function kA(xe,J){for(var fe=J.length,Re=0;Re<fe;Re++)x_(J[Re],xe,Re)}function Yd(xe,J){var fe=et._calloc(1,Wh);return et.HEAPF64.set([xe,J].map(Cc),fe/ua),fe}function Pc(xe){return _p(et.getValue(xe,"double"))}function Sc(xe){return[Pc(xe),Pc(xe+ua)]}function fp(xe){return[Pc(xe+ua),Pc(xe)]}function dp(xe,J,fe){for(var Re=et.getValue(xe,"i32"),We=xe+ua,ct=[],W=J?fp:Sc,p=0;p<Re*2;p+=2)ct.push(W(We+ua*p));return fe&&ct.push(ct[0]),ct}function b_(xe,J){for(var fe=[],Re=J?fp:Sc,We,ct,W,p;xe;){for(fe.push(We=[]),ct=et.getValue(xe,"i8*");ct;){for(We.push(W=[]),p=et.getValue(ct,"i8*");p;)W.push(Re(p)),p=et.getValue(p+ua*2,"i8*");J&&W.push(W[0]),ct=et.getValue(ct+Wd*2,"i8*")}xe=et.getValue(xe+Wd*2,"i8*")}return fe}function w_(xe){return{i:et.getValue(xe,"i32"),j:et.getValue(xe+Ss,"i32")}}function T_(xe,J){var fe=J.i,Re=J.j;et.setValue(xe,fe,"i32"),et.setValue(xe+Ss,Re,"i32")}function P_(xe,J){for(var fe=[],Re=0;Re<J;Re++){var We=et.getValue(xe+Ss*Re,"i32");We>=0&&fe.push(We)}return fe}function zA(xe){var J=Ei(xe),fe=J[0],Re=J[1];return!!Bt.isValidCell(fe,Re)}function M_(xe){var J=Ei(xe),fe=J[0],Re=J[1];return!!Bt.isValidIndex(fe,Re)}function E_(xe){var J=Ei(xe),fe=J[0],Re=J[1];return!!Bt.isPentagon(fe,Re)}function S_(xe){var J=Ei(xe),fe=J[0],Re=J[1];return!!Bt.isResClassIII(fe,Re)}function C_(xe){var J=Ei(xe),fe=J[0],Re=J[1];return Bt.getBaseCellNumber(fe,Re)}function I_(xe,J){var fe=et._malloc(Ss),Re=Ei(xe),We=Re[0],ct=Re[1];try{return si(Bt.getIndexDigit(We,ct,J,fe)),et.getValue(fe,"i32")}finally{et._free(fe)}}function D_(xe){var J=Ei(xe),fe=J[0],Re=J[1],We=et._malloc(Ss);try{si(Bt.maxFaceCount(fe,Re,We));var ct=et.getValue(We,"i32"),W=et._malloc(Ss*ct);try{return si(Bt.getIcosahedronFaces(fe,Re,W)),P_(W,ct)}finally{et._free(W)}}finally{et._free(We)}}function k_(xe){var J=Ei(xe),fe=J[0],Re=J[1];return Bt.isValidCell(fe,Re)?Bt.getResolution(fe,Re):-1}function z_(xe,J,fe){if(fe===void 0&&(fe=J.length),J.length!==fe||J.length>15)throw Hh(DA,J.length);var Re=et._malloc(Ss*J.length),We=et._malloc(yr);try{return J.forEach(function(ct,W){et.setValue(Re+Ss*W,ct,"i32")}),si(Bt.constructCell(fe,xe,Re,We)),_l(Ma(We))}finally{et._free(We),et._free(Re)}}function L_(xe,J,fe){var Re=et._malloc(Wh);et.HEAPF64.set([xe,J].map(Cc),Re/ua);var We=et._malloc(yr);try{return si(Bt.latLngToCell(Re,fe,We)),_l(Ma(We))}finally{et._free(We),et._free(Re)}}function B_(xe){var J=et._malloc(Wh),fe=Ei(xe),Re=fe[0],We=fe[1];try{return si(Bt.cellToLatLng(Re,We,J)),Sc(J)}finally{et._free(J)}}function R_(xe,J){var fe=et._malloc(ap),Re=Ei(xe),We=Re[0],ct=Re[1];try{return si(Bt.cellToBoundary(We,ct,fe)),dp(fe,J,J)}finally{et._free(fe)}}function F_(xe,J){var fe=Ei(xe),Re=fe[0],We=fe[1],ct=et._malloc(yr);try{return si(Bt.cellToParent(Re,We,J,ct)),_l(Ma(ct))}finally{et._free(ct)}}function O_(xe,J){if(!zA(xe))return[];var fe=Ei(xe),Re=fe[0],We=fe[1],ct=Ru(pp(xe,J)),W=et._calloc(ct,yr);try{return si(Bt.cellToChildren(Re,We,J,W)),Ro(W,ct)}finally{et._free(W)}}function pp(xe,J){if(!zA(xe))throw Hh(ip);var fe=Ei(xe),Re=fe[0],We=fe[1],ct=et._malloc(ml);try{return si(Bt.cellToChildrenSize(Re,We,J,ct)),gl(ct)}finally{et._free(ct)}}function N_(xe,J){var fe=Ei(xe),Re=fe[0],We=fe[1],ct=et._malloc(yr);try{return si(Bt.cellToCenterChild(Re,We,J,ct)),_l(Ma(ct))}finally{et._free(ct)}}function V_(xe,J){var fe=Ei(xe),Re=fe[0],We=fe[1],ct=et._malloc(ml);try{return si(Bt.cellToChildPos(Re,We,J,ct)),gl(ct)}finally{et._free(ct)}}function j_(xe,J,fe){var Re=y_(xe),We=Re[0],ct=Re[1],W=Ei(J),p=W[0],it=W[1],ur=et._malloc(yr);try{return si(Bt.childPosToCell(We,ct,p,it,fe,ur)),_l(Ma(ur))}finally{et._free(ur)}}function Z_(xe,J){var fe=Ei(xe),Re=fe[0],We=fe[1],ct=et._malloc(ml);try{si(Bt.maxGridDiskSize(J,ct));var W=Ru(gl(ct)),p=et._calloc(W,yr);try{return si(Bt.gridDisk(Re,We,J,p)),Ro(p,W)}finally{et._free(p)}}finally{et._free(ct)}}function U_(xe,J){var fe=Ei(xe),Re=fe[0],We=fe[1],ct=et._malloc(ml);try{si(Bt.maxGridDiskSize(J,ct));var W=Ru(gl(ct)),p=et._calloc(W,yr),it=et._calloc(W,Ss);try{si(Bt.gridDiskDistances(Re,We,J,p,it));for(var ur=[],fr=0;fr<J+1;fr++)ur.push([]);for(var Zi=0;Zi<W;Zi++){var un=Ma(p,Zi),zr=et.getValue(it+Ss*Zi,"i32");un!==null&&ur[zr].push(un)}return ur}finally{et._free(p),et._free(it)}}finally{et._free(ct)}}function G_(xe,J){var fe=J===0?1:6*J,Re=et._calloc(fe,yr);try{return si(Bt.gridRing.apply(Bt,Ei(xe).concat([J],[Re]))),Ro(Re,fe)}finally{et._free(Re)}}function q_(xe,J){var fe=J===0?1:6*J,Re=et._calloc(fe,yr);try{return si(Bt.gridRingUnsafe.apply(Bt,Ei(xe).concat([J],[Re]))),Ro(Re,fe)}finally{et._free(Re)}}function H_(xe,J,fe){if(Bu(J),fe=!!fe,xe.length===0||xe[0].length===0)return[];var Re=typeof xe[0][0]=="number"?[xe]:xe,We=cp(Re,fe),ct=et._malloc(ml);try{si(Bt.maxPolygonToCellsSize(We,J,0,ct));var W=Ru(gl(ct)),p=et._calloc(W,yr);try{return si(Bt.polygonToCells(We,J,0,p)),Ro(p,W)}finally{et._free(p)}}finally{et._free(ct),Ap(We)}}function W_(xe,J,fe,Re){Bu(J),Re=!!Re;var We=p_(fe);if(xe.length===0||xe[0].length===0)return[];var ct=typeof xe[0][0]=="number"?[xe]:xe,W=cp(ct,Re),p=et._malloc(ml);try{si(Bt.maxPolygonToCellsSizeExperimental(W,J,We,p));var it=Ru(gl(p)),ur=et._calloc(it,yr);try{return si(Bt.polygonToCellsExperimental(W,J,We,it,Gh,ur)),Ro(ur,it)}finally{et._free(ur)}}finally{et._free(p),Ap(W)}}function Q_(xe,J){if(!xe||!xe.length)return[];var fe=xe.length,Re=et._calloc(fe,yr);kA(Re,xe);var We=et._calloc(d_);try{return si(Bt.cellsToLinkedMultiPolygon(Re,fe,We)),b_(We,J)}finally{Bt.destroyLinkedMultiPolygon(We),et._free(We),et._free(Re)}}function $_(xe){if(!xe||!xe.length)return[];var J=xe.length,fe=et._calloc(J,yr);kA(fe,xe);var Re=et._calloc(J,yr);try{return si(Bt.compactCells(fe,Re,J,Gh)),Ro(Re,J)}finally{et._free(fe),et._free(Re)}}function Y_(xe,J){if(Bu(J),!xe||!xe.length)return[];var fe=xe.length,Re=et._calloc(fe,yr);kA(Re,xe);var We=et._malloc(ml);try{si(Bt.uncompactCellsSize(Re,fe,Gh,J,We));var ct=Ru(gl(We)),W=et._calloc(ct,yr);try{return si(Bt.uncompactCells(Re,fe,Gh,W,ct,Gh,J)),Ro(W,ct)}finally{et._free(Re),et._free(W)}}finally{et._free(We)}}function X_(xe,J){var fe=Ei(xe),Re=fe[0],We=fe[1],ct=Ei(J),W=ct[0],p=ct[1],it=et._malloc(Ss);try{return si(Bt.areNeighborCells(Re,We,W,p,it)),v_(it)}finally{et._free(it)}}function K_(xe,J){var fe=Ei(xe),Re=fe[0],We=fe[1],ct=Ei(J),W=ct[0],p=ct[1],it=et._malloc(yr);try{return si(Bt.cellsToDirectedEdge(Re,We,W,p,it)),_l(Ma(it))}finally{et._free(it)}}function J_(xe){var J=Ei(xe),fe=J[0],Re=J[1],We=et._malloc(yr);try{return si(Bt.getDirectedEdgeOrigin(fe,Re,We)),_l(Ma(We))}finally{et._free(We)}}function eg(xe){var J=Ei(xe),fe=J[0],Re=J[1],We=et._malloc(yr);try{return si(Bt.getDirectedEdgeDestination(fe,Re,We)),_l(Ma(We))}finally{et._free(We)}}function tg(xe){var J=Ei(xe),fe=J[0],Re=J[1];return!!Bt.isValidDirectedEdge(fe,Re)}function ig(xe){var J=Ei(xe),fe=J[0],Re=J[1],We=2,ct=et._calloc(We,yr);try{return si(Bt.directedEdgeToCells(fe,Re,ct)),Ro(ct,We)}finally{et._free(ct)}}function rg(xe){var J=Ei(xe),fe=J[0],Re=J[1],We=6,ct=et._calloc(We,yr);try{return si(Bt.originToDirectedEdges(fe,Re,ct)),Ro(ct,We)}finally{et._free(ct)}}function ng(xe,J){var fe=et._malloc(ap),Re=Ei(xe),We=Re[0],ct=Re[1];try{return si(Bt.directedEdgeToBoundary(We,ct,fe)),dp(fe,J)}finally{et._free(fe)}}function sg(xe,J){var fe=Ei(xe),Re=fe[0],We=fe[1],ct=Ei(J),W=ct[0],p=ct[1],it=et._malloc(ml);try{return si(Bt.gridDistance(Re,We,W,p,it)),gl(it)}finally{et._free(it)}}function og(xe,J){var fe=Ei(xe),Re=fe[0],We=fe[1],ct=Ei(J),W=ct[0],p=ct[1],it=et._malloc(ml);try{si(Bt.gridPathCellsSize(Re,We,W,p,it));var ur=Ru(gl(it)),fr=et._calloc(ur,yr);try{return Bt.gridPathCells(Re,We,W,p,fr),Ro(fr,ur)}finally{et._free(fr)}}finally{et._free(it)}}var mp=0;function ag(xe,J){var fe=et._malloc(lp);try{return si(Bt.cellToLocalIj.apply(Bt,Ei(xe).concat(Ei(J),[mp],[fe]))),w_(fe)}finally{et._free(fe)}}function lg(xe,J){if(!J||typeof J.i!="number"||typeof J.j!="number")throw new Error("Coordinates must be provided as an {i, j} object");var fe=et._malloc(lp),Re=et._malloc(yr);T_(fe,J);try{return si(Bt.localIjToCell.apply(Bt,Ei(xe).concat([fe],[mp],[Re]))),_l(Ma(Re))}finally{et._free(fe),et._free(Re)}}function ug(xe,J,fe){var Re=Yd(xe[0],xe[1]),We=Yd(J[0],J[1]),ct;switch(fe){case Bo.m:ct=Bt.greatCircleDistanceM(Re,We);break;case Bo.km:ct=Bt.greatCircleDistanceKm(Re,We);break;case Bo.rads:ct=Bt.greatCircleDistanceRads(Re,We);break;default:ct=null}if(et._free(Re),et._free(We),ct===null)throw lu(fh,fe);return ct}function hg(xe,J){var fe=Ei(xe),Re=fe[0],We=fe[1],ct=et._malloc(ua);try{switch(J){case Bo.m2:si(Bt.cellAreaM2(Re,We,ct));break;case Bo.km2:si(Bt.cellAreaKm2(Re,We,ct));break;case Bo.rads2:si(Bt.cellAreaRads2(Re,We,ct));break;default:throw lu(fh,J)}return Ec(ct)}finally{et._free(ct)}}function cg(xe,J){var fe=Ei(xe),Re=fe[0],We=fe[1],ct=et._malloc(ua);try{switch(J){case Bo.m:si(Bt.edgeLengthM(Re,We,ct));break;case Bo.km:si(Bt.edgeLengthKm(Re,We,ct));break;case Bo.rads:si(Bt.edgeLengthRads(Re,We,ct));break;default:throw lu(fh,J)}return Ec(ct)}finally{et._free(ct)}}function Ag(xe,J){Bu(xe);var fe=et._malloc(ua);try{switch(J){case Bo.m2:si(Bt.getHexagonAreaAvgM2(xe,fe));break;case Bo.km2:si(Bt.getHexagonAreaAvgKm2(xe,fe));break;default:throw lu(fh,J)}return Ec(fe)}finally{et._free(fe)}}function fg(xe,J){Bu(xe);var fe=et._malloc(ua);try{switch(J){case Bo.m:si(Bt.getHexagonEdgeLengthAvgM(xe,fe));break;case Bo.km:si(Bt.getHexagonEdgeLengthAvgKm(xe,fe));break;default:throw lu(fh,J)}return Ec(fe)}finally{et._free(fe)}}function dg(xe,J){var fe=Ei(xe),Re=fe[0],We=fe[1],ct=et._malloc(yr);try{return si(Bt.cellToVertex(Re,We,J,ct)),_l(Ma(ct))}finally{et._free(ct)}}function pg(xe){var J=Ei(xe),fe=J[0],Re=J[1],We=6,ct=et._calloc(We,yr);try{return si(Bt.cellToVertexes(fe,Re,ct)),Ro(ct,We)}finally{et._free(ct)}}function mg(xe){var J=et._malloc(Wh),fe=Ei(xe),Re=fe[0],We=fe[1];try{return si(Bt.vertexToLatLng(Re,We,J)),Sc(J)}finally{et._free(J)}}function _g(xe){var J=Ei(xe),fe=J[0],Re=J[1];return!!Bt.isValidVertex(fe,Re)}function gg(xe){Bu(xe);var J=et._malloc(ml);try{return si(Bt.getNumCells(xe,J)),gl(J)}finally{et._free(J)}}function yg(){var xe=Bt.res0CellCount(),J=et._malloc(yr*xe);try{return si(Bt.getRes0Cells(J)),Ro(J,xe)}finally{et._free(J)}}function vg(xe){Bu(xe);var J=Bt.pentagonCount(),fe=et._malloc(yr*J);try{return si(Bt.getPentagons(xe,fe)),Ro(fe,J)}finally{et._free(fe)}}function Cc(xe){return xe*Math.PI/180}function _p(xe){return xe*180/Math.PI}const Mg=Object.freeze(Object.defineProperty({__proto__:null,POLYGON_TO_CELLS_FLAGS:Uh,UNITS:Bo,areNeighborCells:X_,cellArea:hg,cellToBoundary:R_,cellToCenterChild:N_,cellToChildPos:V_,cellToChildren:O_,cellToChildrenSize:pp,cellToLatLng:B_,cellToLocalIj:ag,cellToParent:F_,cellToVertex:dg,cellToVertexes:pg,cellsToDirectedEdge:K_,cellsToMultiPolygon:Q_,childPosToCell:j_,compactCells:$_,constructCell:z_,degsToRads:Cc,directedEdgeToBoundary:ng,directedEdgeToCells:ig,edgeLength:cg,getBaseCellNumber:C_,getDirectedEdgeDestination:eg,getDirectedEdgeOrigin:J_,getHexagonAreaAvg:Ag,getHexagonEdgeLengthAvg:fg,getIcosahedronFaces:D_,getIndexDigit:I_,getNumCells:gg,getPentagons:vg,getRes0Cells:yg,getResolution:k_,greatCircleDistance:ug,gridDisk:Z_,gridDiskDistances:U_,gridDistance:sg,gridPathCells:og,gridRing:G_,gridRingUnsafe:q_,h3IndexToSplitLong:Ei,isPentagon:E_,isResClassIII:S_,isValidCell:zA,isValidDirectedEdge:tg,isValidIndex:M_,isValidVertex:_g,latLngToCell:L_,localIjToCell:lg,originToDirectedEdges:rg,polygonToCells:H_,polygonToCellsExperimental:W_,radsToDegs:_p,splitLongToH3Index:up,uncompactCells:Y_,vertexToLatLng:mg},Symbol.toStringTag,{value:"Module"})),Eg=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var Tc={exports:{}};/** 5 + * MapLibre GL JS 6 + * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.16.0/LICENSE.txt 7 + */var xg=Tc.exports,Xd;function bg(){return Xd||(Xd=1,(function(xe,J){(function(fe,Re){xe.exports=Re()})(xg,(function(){var fe={},Re={};function We(W,p,it){if(Re[W]=it,W==="index"){var ur="var sharedModule = {}; ("+Re.shared+")(sharedModule); ("+Re.worker+")(sharedModule);",fr={};return Re.shared(fr),Re.index(fe,fr),typeof window<"u"&&fe.setWorkerUrl(window.URL.createObjectURL(new Blob([ur],{type:"text/javascript"}))),fe}}We("shared",["exports"],(function(W){function p(r,e,i,s){return new(i||(i=Promise))((function(A,d){function _(I){try{M(s.next(I))}catch(k){d(k)}}function b(I){try{M(s.throw(I))}catch(k){d(k)}}function M(I){var k;I.done?A(I.value):(k=I.value,k instanceof i?k:new i((function(F){F(k)}))).then(_,b)}M((s=s.apply(r,e||[])).next())}))}function it(r,e){this.x=r,this.y=e}function ur(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var fr,Zi;typeof SuppressedError=="function"&&SuppressedError,it.prototype={clone(){return new it(this.x,this.y)},add(r){return this.clone()._add(r)},sub(r){return this.clone()._sub(r)},multByPoint(r){return this.clone()._multByPoint(r)},divByPoint(r){return this.clone()._divByPoint(r)},mult(r){return this.clone()._mult(r)},div(r){return this.clone()._div(r)},rotate(r){return this.clone()._rotate(r)},rotateAround(r,e){return this.clone()._rotateAround(r,e)},matMult(r){return this.clone()._matMult(r)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(r){return this.x===r.x&&this.y===r.y},dist(r){return Math.sqrt(this.distSqr(r))},distSqr(r){const e=r.x-this.x,i=r.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith(r){return this.angleWithSep(r.x,r.y)},angleWithSep(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult(r){const e=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=e,this},_add(r){return this.x+=r.x,this.y+=r.y,this},_sub(r){return this.x-=r.x,this.y-=r.y,this},_mult(r){return this.x*=r,this.y*=r,this},_div(r){return this.x/=r,this.y/=r,this},_multByPoint(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint(r){return this.x/=r.x,this.y/=r.y,this},_unit(){return this._div(this.mag()),this},_perp(){const r=this.y;return this.y=this.x,this.x=-r,this},_rotate(r){const e=Math.cos(r),i=Math.sin(r),s=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=s,this},_rotateAround(r,e){const i=Math.cos(r),s=Math.sin(r),A=e.y+s*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-s*(this.y-e.y),this.y=A,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:it},it.convert=function(r){if(r instanceof it)return r;if(Array.isArray(r))return new it(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new it(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};var un=(function(){if(Zi)return fr;function r(e,i,s,A){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(A-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=s,this.p2y=A}return Zi=1,fr=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,A=0;A<8;A++){var d=this.sampleCurveX(s)-e;if(Math.abs(d)<i)return s;var _=this.sampleCurveDerivativeX(s);if(Math.abs(_)<1e-6)break;s-=d/_}var b=0,M=1;for(s=e,A=0;A<20&&(d=this.sampleCurveX(s),!(Math.abs(d-e)<i));A++)e>d?b=s:M=s,s=.5*(M-b)+b;return s},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},fr})(),zr=ur(un);let Mn,Gt;function rt(){return Mn==null&&(Mn=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Mn}function Fo(){if(Gt==null&&(Gt=!1,rt())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let s=0;s<25;s++){const A=4*s;e.fillStyle=`rgb(${A},${A+1},${A+2})`,e.fillRect(s%5,Math.floor(s/5),1,1)}const i=e.getImageData(0,0,5,5).data;for(let s=0;s<100;s++)if(s%4!=3&&i[s]!==s){Gt=!0;break}}}return Gt||!1}var hr=1e-6,zi=typeof Float32Array<"u"?Float32Array:Array;function ro(){var r=new zi(9);return zi!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function no(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function Ns(){var r=new zi(3);return zi!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function En(r){var e=r[0],i=r[1],s=r[2];return Math.sqrt(e*e+i*i+s*s)}function Oo(r,e,i){var s=new zi(3);return s[0]=r,s[1]=e,s[2]=i,s}function Vs(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function Cs(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function cr(r,e,i){var s=e[0],A=e[1],d=e[2],_=i[0],b=i[1],M=i[2];return r[0]=A*M-d*b,r[1]=d*_-s*M,r[2]=s*b-A*_,r}var Ji,Sn=En;function Cn(r,e,i){var s=e[0],A=e[1],d=e[2],_=e[3];return r[0]=i[0]*s+i[4]*A+i[8]*d+i[12]*_,r[1]=i[1]*s+i[5]*A+i[9]*d+i[13]*_,r[2]=i[2]*s+i[6]*A+i[10]*d+i[14]*_,r[3]=i[3]*s+i[7]*A+i[11]*d+i[15]*_,r}function Un(){var r=new zi(4);return zi!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Jr(r,e,i,s){var A=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",d=Math.PI/360;e*=d,s*=d,i*=d;var _=Math.sin(e),b=Math.cos(e),M=Math.sin(i),I=Math.cos(i),k=Math.sin(s),F=Math.cos(s);switch(A){case"xyz":r[0]=_*I*F+b*M*k,r[1]=b*M*F-_*I*k,r[2]=b*I*k+_*M*F,r[3]=b*I*F-_*M*k;break;case"xzy":r[0]=_*I*F-b*M*k,r[1]=b*M*F-_*I*k,r[2]=b*I*k+_*M*F,r[3]=b*I*F+_*M*k;break;case"yxz":r[0]=_*I*F+b*M*k,r[1]=b*M*F-_*I*k,r[2]=b*I*k-_*M*F,r[3]=b*I*F+_*M*k;break;case"yzx":r[0]=_*I*F+b*M*k,r[1]=b*M*F+_*I*k,r[2]=b*I*k-_*M*F,r[3]=b*I*F-_*M*k;break;case"zxy":r[0]=_*I*F-b*M*k,r[1]=b*M*F+_*I*k,r[2]=b*I*k+_*M*F,r[3]=b*I*F-_*M*k;break;case"zyx":r[0]=_*I*F-b*M*k,r[1]=b*M*F+_*I*k,r[2]=b*I*k-_*M*F,r[3]=b*I*F+_*M*k;break;default:throw new Error("Unknown angle order "+A)}return r}function Hr(){var r=new zi(2);return zi!=Float32Array&&(r[0]=0,r[1]=0),r}function ti(r,e){var i=new zi(2);return i[0]=r,i[1]=e,i}Ns(),Ji=new zi(4),zi!=Float32Array&&(Ji[0]=0,Ji[1]=0,Ji[2]=0,Ji[3]=0),Ns(),Oo(1,0,0),Oo(0,1,0),Un(),Un(),ro(),Hr();const Oi=8192;function Yt(r,e,i){return e*(Oi/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}function Ni(r,e){return(r%e+e)%e}function Mr(r,e,i){return r*(1-i)+e*i}function Wr(r){if(r<=0)return 0;if(r>=1)return 1;const e=r*r,i=e*r;return 4*(r<.5?i:3*(r-e)+i-.75)}function or(r,e,i,s){const A=new zr(r,e,i,s);return d=>A.solve(d)}const xi=or(.25,.1,.25,1);function Ai(r,e,i){return Math.min(i,Math.max(e,r))}function hn(r,e,i){const s=i-e,A=((r-e)%s+s)%s+e;return A===e?i:A}function Er(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}let yo=1;function us(r,e,i){const s={};for(const A in r)s[A]=e.call(this,r[A],A,r);return s}function No(r,e,i){const s={};for(const A in r)e.call(this,r[A],A,r)&&(s[A]=r[A]);return s}function In(r){return Array.isArray(r)?r.map(In):typeof r=="object"&&r?us(r,In):r}const Vo={};function en(r){Vo[r]||(typeof console<"u"&&console.warn(r),Vo[r]=!0)}function hs(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function Is(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let Ui=null;function Dn(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}const jo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Zo(r,e,i,s,A){return p(this,void 0,void 0,(function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const d=new VideoFrame(r,{timestamp:0});try{const _=d==null?void 0:d.format;if(!_||!_.startsWith("BGR")&&!_.startsWith("RGB"))throw new Error(`Unrecognized format ${_}`);const b=_.startsWith("BGR"),M=new Uint8ClampedArray(s*A*4);if(yield d.copyTo(M,(function(I,k,F,V,j){const H=4*Math.max(-k,0),Q=(Math.max(0,F)-F)*V*4+H,Y=4*V,re=Math.max(0,k),ge=Math.max(0,F);return{rect:{x:re,y:ge,width:Math.min(I.width,k+V)-re,height:Math.min(I.height,F+j)-ge},layout:[{offset:Q,stride:Y}]}})(r,e,i,s,A)),b)for(let I=0;I<M.length;I+=4){const k=M[I];M[I]=M[I+2],M[I+2]=k}return M}finally{d.close()}}))}let tn,Gn;function vo(r,e,i,s){return r.addEventListener(e,i,s),{unsubscribe:()=>{r.removeEventListener(e,i,s)}}}function Ds(r){return r*Math.PI/180}function mn(r){return r/Math.PI*180}const Ne={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},ee={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},K="AbortError";class le extends Error{constructor(e=K){super(e instanceof Error?e.message:e),this.name=K,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function Me(r){return r.name===K}const Se={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Ge(r){return Se.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}const Fe="global-dispatcher";class ke extends Error{constructor(e,i,s,A){super(`AJAXError: ${i} (${e}): ${s}`),this.status=e,this.statusText=i,this.url=s,this.body=A}}const Qe=()=>Is(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,ft=function(r,e){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){const s=Ge(r.url);if(s)return s(r,e);if(Is(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:Fe},e)}if(!(/^file:/.test(i=r.url)||/^file:/.test(Qe())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return(function(s,A){return p(this,void 0,void 0,(function*(){const d=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,cache:s.cache,referrer:Qe(),signal:A.signal});let _,b;s.type!=="json"||d.headers.has("Accept")||d.headers.set("Accept","application/json");try{_=yield fetch(d)}catch(I){throw Me(I)?I:new ke(0,I.message,s.url,new Blob)}if(!_.ok){const I=yield _.blob();throw new ke(_.status,_.statusText,s.url,I)}b=s.type==="arrayBuffer"||s.type==="image"?_.arrayBuffer():s.type==="json"?_.json():_.text();const M=yield b;return A.signal.throwIfAborted(),{data:M,cacheControl:_.headers.get("Cache-Control"),expires:_.headers.get("Expires")}}))})(r,e);if(Is(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:Fe},e)}var i;return(function(s,A){return new Promise(((d,_)=>{var b;const M=new XMLHttpRequest;M.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(M.responseType="arraybuffer");for(const I in s.headers)M.setRequestHeader(I,s.headers[I]);s.type==="json"&&(M.responseType="text",!((b=s.headers)===null||b===void 0)&&b.Accept||M.setRequestHeader("Accept","application/json")),M.withCredentials=s.credentials==="include",M.onerror=()=>{_(new Error(M.statusText))},M.onload=()=>{if(!A.signal.aborted)if((M.status>=200&&M.status<300||M.status===0)&&M.response!==null){let I=M.response;if(s.type==="json")try{I=JSON.parse(M.response)}catch(k){return void _(k)}d({data:I,cacheControl:M.getResponseHeader("Cache-Control"),expires:M.getResponseHeader("Expires")})}else{const I=new Blob([M.response],{type:M.getResponseHeader("Content-Type")});_(new ke(M.status,M.statusText,s.url,I))}},A.signal.addEventListener("abort",(()=>{M.abort(),_(new le(A.signal.reason))})),M.send(s.body)}))})(r,e)};function ot(r){if(!r||r.indexOf("://")<=0||r.indexOf("data:image/")===0||r.indexOf("blob:")===0)return!0;const e=new URL(r),i=window.location;return e.protocol===i.protocol&&e.host===i.host}function St(r,e,i){i[r]&&i[r].indexOf(e)!==-1||(i[r]=i[r]||[],i[r].push(e))}function je(r,e,i){if(i&&i[r]){const s=i[r].indexOf(e);s!==-1&&i[r].splice(s,1)}}class Xt{constructor(e,i={}){Er(this,i),this.type=e}}class Gi extends Xt{constructor(e,i={}){super("error",Er({error:e},i))}}class Bi{on(e,i){return this._listeners=this._listeners||{},St(e,i,this._listeners),{unsubscribe:()=>{this.off(e,i)}}}off(e,i){return je(e,i,this._listeners),je(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},St(e,i,this._oneTimeListeners),this):new Promise((s=>this.once(e,s)))}fire(e,i){typeof e=="string"&&(e=new Xt(e,i||{}));const s=e.type;if(this.listens(s)){e.target=this;const A=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const b of A)b.call(this,e);const d=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const b of d)je(s,b,this._oneTimeListeners),b.call(this,e);const _=this._eventedParent;_&&(Er(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),_.fire(e))}else e instanceof Gi&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}var qe={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},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},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{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:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},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:"filter"},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:{},"color-relief":{},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_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},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:"expression_name",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}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","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","feature"]},"property-type":"cross-faded-data-driven"},"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:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,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:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",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"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},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"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const Hi=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function rn(r,e){const i={};for(const s in r)s!=="ref"&&(i[s]=r[s]);return Hi.forEach((s=>{s in e&&(i[s]=e[s])})),i}function Kt(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(!Kt(r[i],e[i]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(const i in r)if(!Kt(r[i],e[i]))return!1;return!0}return r===e}function qi(r,e){r.push(e)}function Vr(r,e,i){qi(i,{command:"addSource",args:[r,e[r]]})}function Wi(r,e,i){qi(e,{command:"removeSource",args:[r]}),i[r]=!0}function er(r,e,i,s){Wi(r,i,s),Vr(r,e,i)}function Ve(r,e,i){let s;for(s in r[i])if(Object.prototype.hasOwnProperty.call(r[i],s)&&s!=="data"&&!Kt(r[i][s],e[i][s]))return!1;for(s in e[i])if(Object.prototype.hasOwnProperty.call(e[i],s)&&s!=="data"&&!Kt(r[i][s],e[i][s]))return!1;return!0}function at(r,e,i,s,A,d){r=r||{},e=e||{};for(const _ in r)Object.prototype.hasOwnProperty.call(r,_)&&(Kt(r[_],e[_])||i.push({command:d,args:[s,_,e[_],A]}));for(const _ in e)Object.prototype.hasOwnProperty.call(e,_)&&!Object.prototype.hasOwnProperty.call(r,_)&&(Kt(r[_],e[_])||i.push({command:d,args:[s,_,e[_],A]}))}function It(r){return r.id}function At(r,e){return r[e.id]=e,r}class o{constructor(e,i,s,A){this.message=(e?`${e}: `:"")+s,A&&(this.identifier=A),i!=null&&i.__line__&&(this.line=i.__line__)}}function X(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}class ii extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class Ri{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[s,A]of i)this.bindings[s]=A}concat(e){return new Ri(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Qi={kind:"null"},ut={kind:"number"},zt={kind:"string"},$t={kind:"boolean"},fi={kind:"color"},di={kind:"projectionDefinition"},jr={kind:"object"},ni={kind:"value"},Ea={kind:"collator"},xo={kind:"formatted"},kn={kind:"padding"},qn={kind:"colorArray"},Hn={kind:"numberArray"},bo={kind:"resolvedImage"},Sa={kind:"variableAnchorOffsetCollection"};function vr(r,e){return{kind:"array",itemType:r,N:e}}function Ft(r){if(r.kind==="array"){const e=Ft(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const ae=[Qi,ut,zt,$t,fi,di,xo,jr,vr(ni),kn,Hn,qn,bo,Sa];function qt(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!qt(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(const i of ae)if(!qt(i,e))return null}}return`Expected ${Ft(r)} but found ${Ft(e)} instead.`}function Uo(r,e){return e.some((i=>i.kind===r.kind))}function wo(r,e){return e.some((i=>i==="null"?r===null:i==="array"?Array.isArray(r):i==="object"?r&&!Array.isArray(r)&&typeof r=="object":i===typeof r))}function zn(r,e){return r.kind==="array"&&e.kind==="array"?r.itemType.kind===e.itemType.kind&&typeof r.N=="number":r.kind===e.kind}const Fi=.96422,Xi=.82521,te=4/29,tr=6/29,Go=3*tr*tr,Ha=tr*tr*tr,_i=Math.PI/180,Sr=180/Math.PI;function Wa(r){return(r%=360)<0&&(r+=360),r}function ha([r,e,i,s]){let A,d;const _=Qa((.2225045*(r=_n(r))+.7168786*(e=_n(e))+.0606169*(i=_n(i)))/1);r===e&&e===i?A=d=_:(A=Qa((.4360747*r+.3850649*e+.1430804*i)/Fi),d=Qa((.0139322*r+.0971045*e+.7141733*i)/Xi));const b=116*_-16;return[b<0?0:b,500*(A-_),200*(_-d),s]}function _n(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Qa(r){return r>Ha?Math.pow(r,1/3):r/Go+te}function Ln([r,e,i,s]){let A=(r+16)/116,d=isNaN(e)?A:A+e/500,_=isNaN(i)?A:A-i/200;return A=1*Cr(A),d=Fi*Cr(d),_=Xi*Cr(_),[ar(3.1338561*d-1.6168667*A-.4906146*_),ar(-.9787684*d+1.9161415*A+.033454*_),ar(.0719453*d-.2289914*A+1.4052427*_),s]}function ar(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function Cr(r){return r>tr?r*r*r:Go*(r-te)}const To=Object.hasOwn||function(r,e){return Object.prototype.hasOwnProperty.call(r,e)};function so(r,e){return To(r,e)?r[e]:void 0}function js(r){return parseInt(r.padEnd(2,r),16)/255}function $a(r,e){return ks(e?r/100:r,0,1)}function ks(r,e,i){return Math.min(Math.max(e,r),i)}function Ca(r){return!r.some(Number.isNaN)}const qo={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]};function zs(r,e,i){return r+i*(e-r)}function Vi(r,e,i){return r.map(((s,A)=>zs(s,e[A],i)))}class oi{constructor(e,i,s,A=1,d=!0){this.r=e,this.g=i,this.b=s,this.a=A,d||(this.r*=A,this.g*=A,this.b*=A,A||this.overwriteGetter("rgb",[e,i,s,A]))}static parse(e){if(e instanceof oi)return e;if(typeof e!="string")return;const i=(function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];const A=so(qo,s);if(A){const[_,b,M]=A;return[_/255,b/255,M/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const _=s.length<6?1:2;let b=1;return[js(s.slice(b,b+=_)),js(s.slice(b,b+=_)),js(s.slice(b,b+=_)),js(s.slice(b,b+_)||"ff")]}if(s.startsWith("rgb")){const _=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(_){const[b,M,I,k,F,V,j,H,Q,Y,re,ge]=_,oe=[k||" ",j||" ",Y].join("");if(oe===" "||oe===" /"||oe===",,"||oe===",,,"){const ue=[I,V,Q].join(""),ve=ue==="%%%"?100:ue===""?255:0;if(ve){const Te=[ks(+M/ve,0,1),ks(+F/ve,0,1),ks(+H/ve,0,1),re?$a(+re,ge):1];if(Ca(Te))return Te}}return}}const d=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[_,b,M,I,k,F,V,j,H]=d,Q=[M||" ",k||" ",V].join("");if(Q===" "||Q===" /"||Q===",,"||Q===",,,"){const Y=[+b,ks(+I,0,100),ks(+F,0,100),j?$a(+j,H):1];if(Ca(Y))return(function([re,ge,oe,ue]){function ve(Te){const Ue=(Te+re/30)%12,lt=ge*Math.min(oe,1-oe);return oe-lt*Math.max(-1,Math.min(Ue-3,9-Ue,1))}return re=Wa(re),ge/=100,oe/=100,[ve(0),ve(8),ve(4),ue]})(Y)}}})(e);return i?new oi(...i,!1):void 0}get rgb(){const{r:e,g:i,b:s,a:A}=this,d=A||1/0;return this.overwriteGetter("rgb",[e/d,i/d,s/d,A])}get hcl(){return this.overwriteGetter("hcl",(function(e){const[i,s,A,d]=ha(e),_=Math.sqrt(s*s+A*A);return[Math.round(1e4*_)?Wa(Math.atan2(A,s)*Sr):NaN,_,i,d]})(this.rgb))}get lab(){return this.overwriteGetter("lab",ha(this.rgb))}overwriteGetter(e,i){return Object.defineProperty(this,e,{value:i}),i}toString(){const[e,i,s,A]=this.rgb;return`rgba(${[e,i,s].map((d=>Math.round(255*d))).join(",")},${A})`}static interpolate(e,i,s,A="rgb"){switch(A){case"rgb":{const[d,_,b,M]=Vi(e.rgb,i.rgb,s);return new oi(d,_,b,M,!1)}case"hcl":{const[d,_,b,M]=e.hcl,[I,k,F,V]=i.hcl;let j,H;if(isNaN(d)||isNaN(I))isNaN(d)?isNaN(I)?j=NaN:(j=I,b!==1&&b!==0||(H=k)):(j=d,F!==1&&F!==0||(H=_));else{let oe=I-d;I>d&&oe>180?oe-=360:I<d&&d-I>180&&(oe+=360),j=d+s*oe}const[Q,Y,re,ge]=(function([oe,ue,ve,Te]){return oe=isNaN(oe)?0:oe*_i,Ln([ve,Math.cos(oe)*ue,Math.sin(oe)*ue,Te])})([j,H??zs(_,k,s),zs(b,F,s),zs(M,V,s)]);return new oi(Q,Y,re,ge,!1)}case"lab":{const[d,_,b,M]=Ln(Vi(e.lab,i.lab,s));return new oi(d,_,b,M,!1)}}}}oi.black=new oi(0,0,0,1),oi.white=new oi(1,1,1,1),oi.transparent=new oi(0,0,0,0),oi.red=new oi(1,0,0,1);class Ho{constructor(e,i,s){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const Nl=["bottom","center","top"];class Ia{constructor(e,i,s,A,d,_){this.text=e,this.image=i,this.scale=s,this.fontStack=A,this.textColor=d,this.verticalAlign=_}}class Wn{constructor(e){this.sections=e}static fromString(e){return new Wn([new Ia(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((e=>e.text.length!==0||e.image&&e.image.name.length!==0))}static factory(e){return e instanceof Wn?e:Wn.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map((e=>e.text)).join("")}}class Ht{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ht)return e;if(typeof e=="number")return new Ht([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const i of e)if(typeof i!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Ht(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){return new Ht(Vi(e.values,i.values,s))}}class Li{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Li)return e;if(typeof e=="number")return new Li([e]);if(Array.isArray(e)){for(const i of e)if(typeof i!="number")return;return new Li(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){return new Li(Vi(e.values,i.values,s))}}class Dt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Dt)return e;if(typeof e=="string"){const s=oi.parse(e);return s?new Dt([s]):void 0}if(!Array.isArray(e))return;const i=[];for(const s of e){if(typeof s!="string")return;const A=oi.parse(s);if(!A)return;i.push(A)}return new Dt(i)}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s,A="rgb"){const d=[];if(e.values.length!=i.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${i.values.length}), cannot interpolate.`);for(let _=0;_<e.values.length;_++)d.push(oi.interpolate(e.values[_],i.values[_],s,A));return new Dt(d)}}class Ki extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const Zs=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class cn{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof cn)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let i=0;i<e.length;i+=2){const s=e[i],A=e[i+1];if(typeof s!="string"||!Zs.has(s)||!Array.isArray(A)||A.length!==2||typeof A[0]!="number"||typeof A[1]!="number")return}return new cn(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){const A=e.values,d=i.values;if(A.length!==d.length)throw new Ki(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${i.toString()}`);const _=[];for(let b=0;b<A.length;b+=2){if(A[b]!==d[b])throw new Ki(`Cannot interpolate values containing mismatched anchors. from[${b}]: ${A[b]}, to[${b}]: ${d[b]}`);_.push(A[b]);const[M,I]=A[b+1],[k,F]=d[b+1];_.push([zs(M,k,s),zs(I,F,s)])}return new cn(_)}}class gn{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new gn({name:e,available:!1}):null}}class Lr{constructor(e,i,s){this.from=e,this.to=i,this.transition=s}static interpolate(e,i,s){return new Lr(e,i,s)}static parse(e){return e instanceof Lr?e:Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"?new Lr(e[0],e[1],e[2]):typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number"?new Lr(e.from,e.to,e.transition):typeof e=="string"?new Lr(e,e,1):void 0}}function Us(r,e,i,s){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[r,e,i,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[r,e,i,s]:[r,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Qn(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof Lr||r instanceof oi||r instanceof Ho||r instanceof Wn||r instanceof Ht||r instanceof Li||r instanceof Dt||r instanceof cn||r instanceof gn)return!0;if(Array.isArray(r)){for(const e of r)if(!Qn(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!Qn(r[e]))return!1;return!0}return!1}function Si(r){if(r===null)return Qi;if(typeof r=="string")return zt;if(typeof r=="boolean")return $t;if(typeof r=="number")return ut;if(r instanceof oi)return fi;if(r instanceof Lr)return di;if(r instanceof Ho)return Ea;if(r instanceof Wn)return xo;if(r instanceof Ht)return kn;if(r instanceof Li)return Hn;if(r instanceof Dt)return qn;if(r instanceof cn)return Sa;if(r instanceof gn)return bo;if(Array.isArray(r)){const e=r.length;let i;for(const s of r){const A=Si(s);if(i){if(i===A)continue;i=ni;break}i=A}return vr(i||ni,e)}return jr}function $n(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof oi||r instanceof Lr||r instanceof Wn||r instanceof Ht||r instanceof Li||r instanceof Dt||r instanceof cn||r instanceof gn?r.toString():JSON.stringify(r)}class gs{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Qn(e[1]))return i.error("invalid value");const s=e[1];let A=Si(s);const d=i.expectedType;return A.kind!=="array"||A.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(A=d),new gs(A,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const ca={string:zt,number:ut,boolean:$t,object:jr};class Yn{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let s,A=1;const d=e[0];if(d==="array"){let b,M;if(e.length>2){const I=e[1];if(typeof I!="string"||!(I in ca)||I==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);b=ca[I],A++}else b=ni;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);M=e[2],A++}s=vr(b,M)}else{if(!ca[d])throw new Error(`Types doesn't contain name = ${d}`);s=ca[d]}const _=[];for(;A<e.length;A++){const b=i.parse(e[A],A,ni);if(!b)return null;_.push(b)}return new Yn(s,_)}evaluate(e){for(let i=0;i<this.args.length;i++){const s=this.args[i].evaluate(e);if(!qt(this.type,Si(s)))return s;if(i===this.args.length-1)throw new Ki(`Expected value to be of type ${Ft(this.type)}, but found ${Ft(Si(s))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const Po={"to-boolean":$t,"to-color":fi,"to-number":ut,"to-string":zt};class Ls{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[0];if(!Po[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return i.error("Expected one argument.");const A=Po[s],d=[];for(let _=1;_<e.length;_++){const b=i.parse(e[_],_,ni);if(!b)return null;d.push(b)}return new Ls(A,d)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let i,s;for(const A of this.args){if(i=A.evaluate(e),s=null,i instanceof oi)return i;if(typeof i=="string"){const d=e.parseColor(i);if(d)return d}else if(Array.isArray(i)&&(s=i.length<3||i.length>4?`Invalid rgba value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:Us(i[0],i[1],i[2],i[3]),!s))return new oi(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new Ki(s||`Could not parse color from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"padding":{let i;for(const s of this.args){i=s.evaluate(e);const A=Ht.parse(i);if(A)return A}throw new Ki(`Could not parse padding from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"numberArray":{let i;for(const s of this.args){i=s.evaluate(e);const A=Li.parse(i);if(A)return A}throw new Ki(`Could not parse numberArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"colorArray":{let i;for(const s of this.args){i=s.evaluate(e);const A=Dt.parse(i);if(A)return A}throw new Ki(`Could not parse colorArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"variableAnchorOffsetCollection":{let i;for(const s of this.args){i=s.evaluate(e);const A=cn.parse(i);if(A)return A}throw new Ki(`Could not parse variableAnchorOffsetCollection from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"number":{let i=null;for(const s of this.args){if(i=s.evaluate(e),i===null)return 0;const A=Number(i);if(!isNaN(A))return A}throw new Ki(`Could not convert ${JSON.stringify(i)} to number.`)}case"formatted":return Wn.fromString($n(this.args[0].evaluate(e)));case"resolvedImage":return gn.fromString($n(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return $n(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const Vl=["Unknown","Point","LineString","Polygon"];class Qr{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Vl[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(e){let i=this._parseColorCache.get(e);return i||(i=oi.parse(e),this._parseColorCache.set(e,i)),i}}class hi{constructor(e,i,s=[],A,d=new Ri,_=[]){this.registry=e,this.path=s,this.key=s.map((b=>`[${b}]`)).join(""),this.scope=d,this.errors=_,this.expectedType=A,this._isConstant=i}parse(e,i,s,A,d={}){return i?this.concat(i,s,A)._parse(e,d):this._parse(e,d)}_parse(e,i){function s(A,d,_){return _==="assert"?new Yn(d,[A]):_==="coerce"?new Ls(d,[A]):A}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const A=e[0];if(typeof A!="string")return this.error(`Expression name must be a string, but found ${typeof A} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const d=this.registry[A];if(d){let _=d.parse(e,this);if(!_)return null;if(this.expectedType){const b=this.expectedType,M=_.type;if(b.kind!=="string"&&b.kind!=="number"&&b.kind!=="boolean"&&b.kind!=="object"&&b.kind!=="array"||M.kind!=="value"){if(b.kind==="projectionDefinition"&&["string","array"].includes(M.kind)||["color","formatted","resolvedImage"].includes(b.kind)&&["value","string"].includes(M.kind)||["padding","numberArray"].includes(b.kind)&&["value","number","array"].includes(M.kind)||b.kind==="colorArray"&&["value","string","array"].includes(M.kind)||b.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(M.kind))_=s(_,b,i.typeAnnotation||"coerce");else if(this.checkSubtype(b,M))return null}else _=s(_,b,i.typeAnnotation||"assert")}if(!(_ instanceof gs)&&_.type.kind!=="resolvedImage"&&this._isConstant(_)){const b=new Qr;try{_=new gs(_.type,_.evaluate(b))}catch(M){return this.error(M.message),null}}return _}return this.error(`Unknown expression "${A}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,s){const A=typeof e=="number"?this.path.concat(e):this.path,d=s?this.scope.concat(s):this.scope;return new hi(this.registry,this._isConstant,A,i||null,d,this.errors)}error(e,...i){const s=`${this.key}${i.map((A=>`[${A}]`)).join("")}`;this.errors.push(new ii(s,e))}checkSubtype(e,i){const s=qt(e,i);return s&&this.error(s),s}}class bi{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let d=1;d<e.length-1;d+=2){const _=e[d];if(typeof _!="string")return i.error(`Expected string, but found ${typeof _} instead.`,d);if(/[^a-zA-Z0-9_]/.test(_))return i.error("Variable names must contain only alphanumeric characters or '_'.",d);const b=i.parse(e[d+1],d+1);if(!b)return null;s.push([_,b])}const A=i.parse(e[e.length-1],e.length-1,i.expectedType,s);return A?new bi(s,A):null}outputDefined(){return this.result.outputDefined()}}class nn{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const s=e[1];return i.scope.has(s)?new nn(s,i.scope.get(s)):i.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class wi{constructor(e,i,s){this.type=e,this.index=i,this.input=s}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,ut),A=i.parse(e[2],2,vr(i.expectedType||ni));return s&&A?new wi(A.type.itemType,s,A):null}evaluate(e){const i=this.index.evaluate(e),s=this.input.evaluate(e);if(i<0)throw new Ki(`Array index out of bounds: ${i} < 0.`);if(i>=s.length)throw new Ki(`Array index out of bounds: ${i} > ${s.length-1}.`);if(i!==Math.floor(i))throw new Ki(`Array index must be an integer, but found ${i} instead.`);return s[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class ri{constructor(e,i){this.type=$t,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,ni),A=i.parse(e[2],2,ni);return s&&A?Uo(s.type,[$t,zt,ut,Qi,ni])?new ri(s,A):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ft(s.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!wo(i,["boolean","string","number","null"]))throw new Ki(`Expected first argument to be of type boolean, string, number or null, but found ${Ft(Si(i))} instead.`);if(!wo(s,["string","array"]))throw new Ki(`Expected second argument to be of type array or string, but found ${Ft(Si(s))} instead.`);return s.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Aa{constructor(e,i,s){this.type=ut,this.needle=e,this.haystack=i,this.fromIndex=s}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,ni),A=i.parse(e[2],2,ni);if(!s||!A)return null;if(!Uo(s.type,[$t,zt,ut,Qi,ni]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ft(s.type)} instead`);if(e.length===4){const d=i.parse(e[3],3,ut);return d?new Aa(s,A,d):null}return new Aa(s,A)}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!wo(i,["boolean","string","number","null"]))throw new Ki(`Expected first argument to be of type boolean, string, number or null, but found ${Ft(Si(i))} instead.`);let A;if(this.fromIndex&&(A=this.fromIndex.evaluate(e)),wo(s,["string"])){const d=s.indexOf(i,A);return d===-1?-1:[...s.slice(0,d)].length}if(wo(s,["array"]))return s.indexOf(i,A);throw new Ki(`Expected second argument to be of type array or string, but found ${Ft(Si(s))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Ci{constructor(e,i,s,A,d,_){this.inputType=e,this.type=i,this.input=s,this.cases=A,this.outputs=d,this.otherwise=_}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let s,A;i.expectedType&&i.expectedType.kind!=="value"&&(A=i.expectedType);const d={},_=[];for(let I=2;I<e.length-1;I+=2){let k=e[I];const F=e[I+1];Array.isArray(k)||(k=[k]);const V=i.concat(I);if(k.length===0)return V.error("Expected at least one branch label.");for(const H of k){if(typeof H!="number"&&typeof H!="string")return V.error("Branch labels must be numbers or strings.");if(typeof H=="number"&&Math.abs(H)>Number.MAX_SAFE_INTEGER)return V.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof H=="number"&&Math.floor(H)!==H)return V.error("Numeric branch labels must be integer values.");if(s){if(V.checkSubtype(s,Si(H)))return null}else s=Si(H);if(d[String(H)]!==void 0)return V.error("Branch labels must be unique.");d[String(H)]=_.length}const j=i.parse(F,I,A);if(!j)return null;A=A||j.type,_.push(j)}const b=i.parse(e[1],1,ni);if(!b)return null;const M=i.parse(e[e.length-1],e.length-1,A);return M?b.type.kind!=="value"&&i.concat(1).checkSubtype(s,b.type)?null:new Ci(s,A,b,d,_,M):null}evaluate(e){const i=this.input.evaluate(e);return(Si(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}}class Da{constructor(e,i,s){this.type=e,this.branches=i,this.otherwise=s}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let s;i.expectedType&&i.expectedType.kind!=="value"&&(s=i.expectedType);const A=[];for(let _=1;_<e.length-1;_+=2){const b=i.parse(e[_],_,$t);if(!b)return null;const M=i.parse(e[_+1],_+1,s);if(!M)return null;A.push([b,M]),s=s||M.type}const d=i.parse(e[e.length-1],e.length-1,s);if(!d)return null;if(!s)throw new Error("Can't infer output type");return new Da(s,A,d)}evaluate(e){for(const[i,s]of this.branches)if(i.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,s]of this.branches)e(i),e(s);e(this.otherwise)}outputDefined(){return this.branches.every((([e,i])=>i.outputDefined()))&&this.otherwise.outputDefined()}}class Xn{constructor(e,i,s,A){this.type=e,this.input=i,this.beginIndex=s,this.endIndex=A}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,ni),A=i.parse(e[2],2,ut);if(!s||!A)return null;if(!Uo(s.type,[vr(ni),zt,ni]))return i.error(`Expected first argument to be of type array or string, but found ${Ft(s.type)} instead`);if(e.length===4){const d=i.parse(e[3],3,ut);return d?new Xn(s.type,s,A,d):null}return new Xn(s.type,s,A)}evaluate(e){const i=this.input.evaluate(e),s=this.beginIndex.evaluate(e);let A;if(this.endIndex&&(A=this.endIndex.evaluate(e)),wo(i,["string"]))return[...i].slice(s,A).join("");if(wo(i,["array"]))return i.slice(s,A);throw new Ki(`Expected first argument to be of type array or string, but found ${Ft(Si(i))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function oo(r,e){const i=r.length-1;let s,A,d=0,_=i,b=0;for(;d<=_;)if(b=Math.floor((d+_)/2),s=r[b],A=r[b+1],s<=e){if(b===i||e<A)return b;d=b+1}else{if(!(s>e))throw new Ki("Input is not a number.");_=b-1}return 0}class Kn{constructor(e,i,s){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[A,d]of s)this.labels.push(A),this.outputs.push(d)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const s=i.parse(e[1],1,ut);if(!s)return null;const A=[];let d=null;i.expectedType&&i.expectedType.kind!=="value"&&(d=i.expectedType);for(let _=1;_<e.length;_+=2){const b=_===1?-1/0:e[_],M=e[_+1],I=_,k=_+1;if(typeof b!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',I);if(A.length&&A[A.length-1][0]>=b)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',I);const F=i.parse(M,k,d);if(!F)return null;d=d||F.type,A.push([b,F])}return new Kn(d,s,A)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const A=this.input.evaluate(e);if(A<=i[0])return s[0].evaluate(e);const d=i.length;return A>=i[d-1]?s[d-1].evaluate(e):s[oo(i,A)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function ka(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var fa,Bn,Wo=(function(){if(Bn)return fa;function r(e,i,s,A){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(A-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=s,this.p2y=A}return Bn=1,fa=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,A=0;A<8;A++){var d=this.sampleCurveX(s)-e;if(Math.abs(d)<i)return s;var _=this.sampleCurveDerivativeX(s);if(Math.abs(_)<1e-6)break;s-=d/_}var b=0,M=1;for(s=e,A=0;A<20&&(d=this.sampleCurveX(s),!(Math.abs(d-e)<i));A++)e>d?b=s:M=s,s=.5*(M-b)+b;return s},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},fa})(),Gs=ka(Wo);class xr{constructor(e,i,s,A,d){this.type=e,this.operator=i,this.interpolation=s,this.input=A,this.labels=[],this.outputs=[];for(const[_,b]of d)this.labels.push(_),this.outputs.push(b)}static interpolationFactor(e,i,s,A){let d=0;if(e.name==="exponential")d=ys(i,e.base,s,A);else if(e.name==="linear")d=ys(i,1,s,A);else if(e.name==="cubic-bezier"){const _=e.controlPoints;d=new Gs(_[0],_[1],_[2],_[3]).solve(ys(i,1,s,A))}return d}static parse(e,i){let[s,A,d,..._]=e;if(!Array.isArray(A)||A.length===0)return i.error("Expected an interpolation type expression.",1);if(A[0]==="linear")A={name:"linear"};else if(A[0]==="exponential"){const I=A[1];if(typeof I!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);A={name:"exponential",base:I}}else{if(A[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(A[0])}`,1,0);{const I=A.slice(1);if(I.length!==4||I.some((k=>typeof k!="number"||k<0||k>1)))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);A={name:"cubic-bezier",controlPoints:I}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(d=i.parse(d,2,ut),!d)return null;const b=[];let M=null;s!=="interpolate-hcl"&&s!=="interpolate-lab"||i.expectedType==qn?i.expectedType&&i.expectedType.kind!=="value"&&(M=i.expectedType):M=fi;for(let I=0;I<_.length;I+=2){const k=_[I],F=_[I+1],V=I+3,j=I+4;if(typeof k!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',V);if(b.length&&b[b.length-1][0]>=k)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',V);const H=i.parse(F,j,M);if(!H)return null;M=M||H.type,b.push([k,H])}return zn(M,ut)||zn(M,di)||zn(M,fi)||zn(M,kn)||zn(M,Hn)||zn(M,qn)||zn(M,Sa)||zn(M,vr(ut))?new xr(M,s,A,d,b):i.error(`Type ${Ft(M)} is not interpolatable.`)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const A=this.input.evaluate(e);if(A<=i[0])return s[0].evaluate(e);const d=i.length;if(A>=i[d-1])return s[d-1].evaluate(e);const _=oo(i,A),b=xr.interpolationFactor(this.interpolation,A,i[_],i[_+1]),M=s[_].evaluate(e),I=s[_+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return zs(M,I,b);case"color":return oi.interpolate(M,I,b);case"padding":return Ht.interpolate(M,I,b);case"colorArray":return Dt.interpolate(M,I,b);case"numberArray":return Li.interpolate(M,I,b);case"variableAnchorOffsetCollection":return cn.interpolate(M,I,b);case"array":return Vi(M,I,b);case"projectionDefinition":return Lr.interpolate(M,I,b)}case"interpolate-hcl":switch(this.type.kind){case"color":return oi.interpolate(M,I,b,"hcl");case"colorArray":return Dt.interpolate(M,I,b,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return oi.interpolate(M,I,b,"lab");case"colorArray":return Dt.interpolate(M,I,b,"lab")}}}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function ys(r,e,i,s){const A=s-i,d=r-i;return A===0?0:e===1?d/A:(Math.pow(e,d)-1)/(Math.pow(e,A)-1)}const ir={color:oi.interpolate,number:zs,padding:Ht.interpolate,numberArray:Li.interpolate,colorArray:Dt.interpolate,variableAnchorOffsetCollection:cn.interpolate,array:Vi};class ao{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let s=null;const A=i.expectedType;A&&A.kind!=="value"&&(s=A);const d=[];for(const b of e.slice(1)){const M=i.parse(b,1+d.length,s,void 0,{typeAnnotation:"omit"});if(!M)return null;s=s||M.type,d.push(M)}if(!s)throw new Error("No output type");const _=A&&d.some((b=>qt(A,b.type)));return new ao(_?ni:s,d)}evaluate(e){let i,s=null,A=0;for(const d of this.args)if(A++,s=d.evaluate(e),s&&s instanceof gn&&!s.available&&(i||(i=s.name),s=null,A===this.args.length&&(s=i)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function yl(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Qo(r,e,i,s){return s.compare(e,i)===0}function dr(r,e,i){const s=r!=="=="&&r!=="!=";return class gp{constructor(d,_,b){this.type=$t,this.lhs=d,this.rhs=_,this.collator=b,this.hasUntypedArgument=d.type.kind==="value"||_.type.kind==="value"}static parse(d,_){if(d.length!==3&&d.length!==4)return _.error("Expected two or three arguments.");const b=d[0];let M=_.parse(d[1],1,ni);if(!M)return null;if(!yl(b,M.type))return _.concat(1).error(`"${b}" comparisons are not supported for type '${Ft(M.type)}'.`);let I=_.parse(d[2],2,ni);if(!I)return null;if(!yl(b,I.type))return _.concat(2).error(`"${b}" comparisons are not supported for type '${Ft(I.type)}'.`);if(M.type.kind!==I.type.kind&&M.type.kind!=="value"&&I.type.kind!=="value")return _.error(`Cannot compare types '${Ft(M.type)}' and '${Ft(I.type)}'.`);s&&(M.type.kind==="value"&&I.type.kind!=="value"?M=new Yn(I.type,[M]):M.type.kind!=="value"&&I.type.kind==="value"&&(I=new Yn(M.type,[I])));let k=null;if(d.length===4){if(M.type.kind!=="string"&&I.type.kind!=="string"&&M.type.kind!=="value"&&I.type.kind!=="value")return _.error("Cannot use collator to compare non-string types.");if(k=_.parse(d[3],3,Ea),!k)return null}return new gp(M,I,k)}evaluate(d){const _=this.lhs.evaluate(d),b=this.rhs.evaluate(d);if(s&&this.hasUntypedArgument){const M=Si(_),I=Si(b);if(M.kind!==I.kind||M.kind!=="string"&&M.kind!=="number")throw new Ki(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${M.kind}, ${I.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const M=Si(_),I=Si(b);if(M.kind!=="string"||I.kind!=="string")return e(d,_,b)}return this.collator?i(d,_,b,this.collator.evaluate(d)):e(d,_,b)}eachChild(d){d(this.lhs),d(this.rhs),this.collator&&d(this.collator)}outputDefined(){return!0}}}const jl=dr("==",(function(r,e,i){return e===i}),Qo),vl=dr("!=",(function(r,e,i){return e!==i}),(function(r,e,i,s){return!Qo(0,e,i,s)})),Ya=dr("<",(function(r,e,i){return e<i}),(function(r,e,i,s){return s.compare(e,i)<0})),uu=dr(">",(function(r,e,i){return e>i}),(function(r,e,i,s){return s.compare(e,i)>0})),Mo=dr("<=",(function(r,e,i){return e<=i}),(function(r,e,i,s){return s.compare(e,i)<=0})),za=dr(">=",(function(r,e,i){return e>=i}),(function(r,e,i,s){return s.compare(e,i)>=0}));class lo{constructor(e,i,s){this.type=Ea,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return i.error("Collator options argument must be an object.");const A=i.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,$t);if(!A)return null;const d=i.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,$t);if(!d)return null;let _=null;return s.locale&&(_=i.parse(s.locale,1,zt),!_)?null:new lo(A,d,_)}evaluate(e){return new Ho(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class vs{constructor(e,i,s,A,d){this.type=zt,this.number=e,this.locale=i,this.currency=s,this.minFractionDigits=A,this.maxFractionDigits=d}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const s=i.parse(e[1],1,ut);if(!s)return null;const A=e[2];if(typeof A!="object"||Array.isArray(A))return i.error("NumberFormat options argument must be an object.");let d=null;if(A.locale&&(d=i.parse(A.locale,1,zt),!d))return null;let _=null;if(A.currency&&(_=i.parse(A.currency,1,zt),!_))return null;let b=null;if(A["min-fraction-digits"]&&(b=i.parse(A["min-fraction-digits"],1,ut),!b))return null;let M=null;return A["max-fraction-digits"]&&(M=i.parse(A["max-fraction-digits"],1,ut),!M)?null:new vs(s,d,_,b,M)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class La{constructor(e){this.type=xo,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return i.error("First argument must be an image or text section.");const A=[];let d=!1;for(let _=1;_<=e.length-1;++_){const b=e[_];if(d&&typeof b=="object"&&!Array.isArray(b)){d=!1;let M=null;if(b["font-scale"]&&(M=i.parse(b["font-scale"],1,ut),!M))return null;let I=null;if(b["text-font"]&&(I=i.parse(b["text-font"],1,vr(zt)),!I))return null;let k=null;if(b["text-color"]&&(k=i.parse(b["text-color"],1,fi),!k))return null;let F=null;if(b["vertical-align"]){if(typeof b["vertical-align"]=="string"&&!Nl.includes(b["vertical-align"]))return i.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${b["vertical-align"]}' instead.`);if(F=i.parse(b["vertical-align"],1,zt),!F)return null}const V=A[A.length-1];V.scale=M,V.font=I,V.textColor=k,V.verticalAlign=F}else{const M=i.parse(e[_],1,ni);if(!M)return null;const I=M.type.kind;if(I!=="string"&&I!=="value"&&I!=="null"&&I!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,A.push({content:M,scale:null,font:null,textColor:null,verticalAlign:null})}}return new La(A)}evaluate(e){return new Wn(this.sections.map((i=>{const s=i.content.evaluate(e);return Si(s)===bo?new Ia("",s,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(e):null):new Ia($n(s),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null,i.verticalAlign?i.verticalAlign.evaluate(e):null)})))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor),i.verticalAlign&&e(i.verticalAlign)}outputDefined(){return!1}}class qs{constructor(e){this.type=bo,this.input=e}static parse(e,i){if(e.length!==2)return i.error("Expected two arguments.");const s=i.parse(e[1],1,zt);return s?new qs(s):i.error("No image name provided.")}evaluate(e){const i=this.input.evaluate(e),s=gn.fromString(i);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(i)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class An{constructor(e){this.type=ut,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=i.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${Ft(s.type)} instead.`):new An(s):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string")return[...i].length;if(Array.isArray(i))return i.length;throw new Ki(`Expected value to be of type string or array, but found ${Ft(Si(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Ar=8192;function xl(r,e){const i=(180+r[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,A=Math.pow(2,e.z);return[Math.round(i*A*Ar),Math.round(s*A*Ar)]}function Eo(r,e){const i=Math.pow(2,e.z);return[(A=(r[0]/Ar+e.x)/i,360*A-180),(s=(r[1]/Ar+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,A}function So(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function Jn(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function hu(r,e,i){const s=r[0]-e[0],A=r[1]-e[1],d=r[0]-i[0],_=r[1]-i[1];return s*_-d*A==0&&s*d<=0&&A*_<=0}function da(r,e,i,s){return(A=[s[0]-i[0],s[1]-i[1]])[0]*(d=[e[0]-r[0],e[1]-r[1]])[1]-A[1]*d[0]!=0&&!(!cs(r,e,i,s)||!cs(i,s,r,e));var A,d}function bl(r,e,i){for(const s of i)for(let A=0;A<s.length-1;++A)if(da(r,e,s[A],s[A+1]))return!0;return!1}function pa(r,e,i=!1){let s=!1;for(const b of e)for(let M=0;M<b.length-1;M++){if(hu(r,b[M],b[M+1]))return i;(d=b[M])[1]>(A=r)[1]!=(_=b[M+1])[1]>A[1]&&A[0]<(_[0]-d[0])*(A[1]-d[1])/(_[1]-d[1])+d[0]&&(s=!s)}var A,d,_;return s}function Rn(r,e){for(const i of e)if(pa(r,i))return!0;return!1}function $o(r,e){for(const i of r)if(!pa(i,e))return!1;for(let i=0;i<r.length-1;++i)if(bl(r[i],r[i+1],e))return!1;return!0}function Zl(r,e){for(const i of e)if($o(r,i))return!0;return!1}function cs(r,e,i,s){const A=s[0]-i[0],d=s[1]-i[1],_=(r[0]-i[0])*d-A*(r[1]-i[1]),b=(e[0]-i[0])*d-A*(e[1]-i[1]);return _>0&&b<0||_<0&&b>0}function wl(r,e,i){const s=[];for(let A=0;A<r.length;A++){const d=[];for(let _=0;_<r[A].length;_++){const b=xl(r[A][_],i);So(e,b),d.push(b)}s.push(d)}return s}function Hs(r,e,i){const s=[];for(let A=0;A<r.length;A++){const d=wl(r[A],e,i);s.push(d)}return s}function Xa(r,e,i,s){if(r[0]<i[0]||r[0]>i[2]){const A=.5*s;let d=r[0]-i[0]>A?-s:i[0]-r[0]>A?s:0;d===0&&(d=r[0]-i[2]>A?-s:i[2]-r[0]>A?s:0),r[0]+=d}So(e,r)}function Ws(r,e,i,s){const A=Math.pow(2,s.z)*Ar,d=[s.x*Ar,s.y*Ar],_=[];for(const b of r)for(const M of b){const I=[M.x+d[0],M.y+d[1]];Xa(I,e,i,A),_.push(I)}return _}function $i(r,e,i,s){const A=Math.pow(2,s.z)*Ar,d=[s.x*Ar,s.y*Ar],_=[];for(const M of r){const I=[];for(const k of M){const F=[k.x+d[0],k.y+d[1]];So(e,F),I.push(F)}_.push(I)}if(e[2]-e[0]<=A/2){(b=e)[0]=b[1]=1/0,b[2]=b[3]=-1/0;for(const M of _)for(const I of M)Xa(I,e,i,A)}var b;return _}class Qs{constructor(e,i){this.type=$t,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Qn(e[1])){const s=e[1];if(s.type==="FeatureCollection"){const A=[];for(const d of s.features){const{type:_,coordinates:b}=d.geometry;_==="Polygon"&&A.push(b),_==="MultiPolygon"&&A.push(...b)}if(A.length)return new Qs(s,{type:"MultiPolygon",coordinates:A})}else if(s.type==="Feature"){const A=s.geometry.type;if(A==="Polygon"||A==="MultiPolygon")return new Qs(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new Qs(s,s)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(i,s){const A=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],_=i.canonicalID();if(s.type==="Polygon"){const b=wl(s.coordinates,d,_),M=Ws(i.geometry(),A,d,_);if(!Jn(A,d))return!1;for(const I of M)if(!pa(I,b))return!1}if(s.type==="MultiPolygon"){const b=Hs(s.coordinates,d,_),M=Ws(i.geometry(),A,d,_);if(!Jn(A,d))return!1;for(const I of M)if(!Rn(I,b))return!1}return!0})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,s){const A=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],_=i.canonicalID();if(s.type==="Polygon"){const b=wl(s.coordinates,d,_),M=$i(i.geometry(),A,d,_);if(!Jn(A,d))return!1;for(const I of M)if(!$o(I,b))return!1}if(s.type==="MultiPolygon"){const b=Hs(s.coordinates,d,_),M=$i(i.geometry(),A,d,_);if(!Jn(A,d))return!1;for(const I of M)if(!Zl(I,b))return!1}return!0})(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Tl=class{constructor(r=[],e=(i,s)=>i<s?-1:i>s?1:0){if(this.data=r,this.length=this.data.length,this.compare=e,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;const r=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:e,compare:i}=this,s=e[r];for(;r>0;){const A=r-1>>1,d=e[A];if(i(s,d)>=0)break;e[r]=d,r=A}e[r]=s}_down(r){const{data:e,compare:i}=this,s=this.length>>1,A=e[r];for(;r<s;){let d=1+(r<<1);const _=d+1;if(_<this.length&&i(e[_],e[d])<0&&(d=_),i(e[d],A)>=0)break;e[r]=e[d],r=d}e[r]=A}};function Bs(r,e,i=0,s=r.length-1,A=Ul){for(;s>i;){if(s-i>600){const M=s-i+1,I=e-i+1,k=Math.log(M),F=.5*Math.exp(2*k/3),V=.5*Math.sqrt(k*F*(M-F)/M)*(I-M/2<0?-1:1);Bs(r,e,Math.max(i,Math.floor(e-I*F/M+V)),Math.min(s,Math.floor(e+(M-I)*F/M+V)),A)}const d=r[e];let _=i,b=s;for(uo(r,i,e),A(r[s],d)>0&&uo(r,i,s);_<b;){for(uo(r,_,b),_++,b--;A(r[_],d)<0;)_++;for(;A(r[b],d)>0;)b--}A(r[i],d)===0?uo(r,i,b):(b++,uo(r,b,s)),b<=e&&(i=b+1),e<=b&&(s=b-1)}}function uo(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function Ul(r,e){return r<e?-1:r>e?1:0}function ma(r,e){if(r.length<=1)return[r];const i=[];let s,A;for(const d of r){const _=Ir(d);_!==0&&(d.area=Math.abs(_),A===void 0&&(A=_<0),A===_<0?(s&&i.push(s),s=[d]):s.push(d))}if(s&&i.push(s),e>1)for(let d=0;d<i.length;d++)i[d].length<=e||(Bs(i[d],e,1,i[d].length-1,cu),i[d]=i[d].slice(0,e));return i}function cu(r,e){return e.area-r.area}function Ir(r){let e=0;for(let i,s,A=0,d=r.length,_=d-1;A<d;_=A++)i=r[A],s=r[_],e+=(s.x-i.x)*(i.y+s.y);return e}const Ka=1/298.257223563,yn=Ka*(2-Ka),Gl=Math.PI/180;class As{constructor(e){const i=6378.137*Gl*1e3,s=Math.cos(e*Gl),A=1/(1-yn*(1-s*s)),d=Math.sqrt(A);this.kx=i*d*s,this.ky=i*d*A*(1-yn)}distance(e,i){const s=this.wrap(e[0]-i[0])*this.kx,A=(e[1]-i[1])*this.ky;return Math.sqrt(s*s+A*A)}pointOnLine(e,i){let s,A,d,_,b=1/0;for(let M=0;M<e.length-1;M++){let I=e[M][0],k=e[M][1],F=this.wrap(e[M+1][0]-I)*this.kx,V=(e[M+1][1]-k)*this.ky,j=0;F===0&&V===0||(j=(this.wrap(i[0]-I)*this.kx*F+(i[1]-k)*this.ky*V)/(F*F+V*V),j>1?(I=e[M+1][0],k=e[M+1][1]):j>0&&(I+=F/this.kx*j,k+=V/this.ky*j)),F=this.wrap(i[0]-I)*this.kx,V=(i[1]-k)*this.ky;const H=F*F+V*V;H<b&&(b=H,s=I,A=k,d=M,_=j)}return{point:[s,A],index:d,t:Math.max(0,Math.min(1,_))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function Ba(r,e){return e[0]-r[0]}function vn(r){return r[1]-r[0]+1}function Fn(r,e){return r[1]>=r[0]&&r[1]<e}function ho(r,e){if(r[0]>r[1])return[null,null];const i=vn(r);if(e){if(i===2)return[r,null];const A=Math.floor(i/2);return[[r[0],r[0]+A],[r[0]+A,r[1]]]}if(i===1)return[r,null];const s=Math.floor(i/2)-1;return[[r[0],r[0]+s],[r[0]+s+1,r[1]]]}function $s(r,e){if(!Fn(e,r.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let s=e[0];s<=e[1];++s)So(i,r[s]);return i}function xs(r){const e=[1/0,1/0,-1/0,-1/0];for(const i of r)for(const s of i)So(e,s);return e}function fs(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function Yo(r,e,i){if(!fs(r)||!fs(e))return NaN;let s=0,A=0;return r[2]<e[0]&&(s=e[0]-r[2]),r[0]>e[2]&&(s=r[0]-e[2]),r[1]>e[3]&&(A=r[1]-e[3]),r[3]<e[1]&&(A=e[1]-r[3]),i.distance([0,0],[s,A])}function Ys(r,e,i){const s=i.pointOnLine(e,r);return i.distance(r,s.point)}function Ja(r,e,i,s,A){const d=Math.min(Ys(r,[i,s],A),Ys(e,[i,s],A)),_=Math.min(Ys(i,[r,e],A),Ys(s,[r,e],A));return Math.min(d,_)}function Pl(r,e,i,s,A){if(!Fn(e,r.length)||!Fn(s,i.length))return 1/0;let d=1/0;for(let _=e[0];_<e[1];++_){const b=r[_],M=r[_+1];for(let I=s[0];I<s[1];++I){const k=i[I],F=i[I+1];if(da(b,M,k,F))return 0;d=Math.min(d,Ja(b,M,k,F,A))}}return d}function Ra(r,e,i,s,A){if(!Fn(e,r.length)||!Fn(s,i.length))return NaN;let d=1/0;for(let _=e[0];_<=e[1];++_)for(let b=s[0];b<=s[1];++b)if(d=Math.min(d,A.distance(r[_],i[b])),d===0)return d;return d}function Au(r,e,i){if(pa(r,e,!0))return 0;let s=1/0;for(const A of e){const d=A[0],_=A[A.length-1];if(d!==_&&(s=Math.min(s,Ys(r,[_,d],i)),s===0))return s;const b=i.pointOnLine(A,r);if(s=Math.min(s,i.distance(r,b.point)),s===0)return s}return s}function el(r,e,i,s){if(!Fn(e,r.length))return NaN;for(let d=e[0];d<=e[1];++d)if(pa(r[d],i,!0))return 0;let A=1/0;for(let d=e[0];d<e[1];++d){const _=r[d],b=r[d+1];for(const M of i)for(let I=0,k=M.length,F=k-1;I<k;F=I++){const V=M[F],j=M[I];if(da(_,b,V,j))return 0;A=Math.min(A,Ja(_,b,V,j,s))}}return A}function Ml(r,e){for(const i of r)for(const s of i)if(pa(s,e,!0))return!0;return!1}function tl(r,e,i,s=1/0){const A=xs(r),d=xs(e);if(s!==1/0&&Yo(A,d,i)>=s)return s;if(Jn(A,d)){if(Ml(r,e))return 0}else if(Ml(e,r))return 0;let _=1/0;for(const b of r)for(let M=0,I=b.length,k=I-1;M<I;k=M++){const F=b[k],V=b[M];for(const j of e)for(let H=0,Q=j.length,Y=Q-1;H<Q;Y=H++){const re=j[Y],ge=j[H];if(da(F,V,re,ge))return 0;_=Math.min(_,Ja(F,V,re,ge,i))}}return _}function Ii(r,e,i,s,A,d){if(!d)return;const _=Yo($s(s,d),A,i);_<e&&r.push([_,d,[0,0]])}function sn(r,e,i,s,A,d,_){if(!d||!_)return;const b=Yo($s(s,d),$s(A,_),i);b<e&&r.push([b,d,_])}function $r(r,e,i,s,A=1/0){let d=Math.min(s.distance(r[0],i[0][0]),A);if(d===0)return d;const _=new Tl([[0,[0,r.length-1],[0,0]]],Ba),b=xs(i);for(;_.length>0;){const M=_.pop();if(M[0]>=d)continue;const I=M[1],k=e?50:100;if(vn(I)<=k){if(!Fn(I,r.length))return NaN;if(e){const F=el(r,I,i,s);if(isNaN(F)||F===0)return F;d=Math.min(d,F)}else for(let F=I[0];F<=I[1];++F){const V=Au(r[F],i,s);if(d=Math.min(d,V),d===0)return 0}}else{const F=ho(I,e);Ii(_,d,s,r,b,F[0]),Ii(_,d,s,r,b,F[1])}}return d}function il(r,e,i,s,A,d=1/0){let _=Math.min(d,A.distance(r[0],i[0]));if(_===0)return _;const b=new Tl([[0,[0,r.length-1],[0,i.length-1]]],Ba);for(;b.length>0;){const M=b.pop();if(M[0]>=_)continue;const I=M[1],k=M[2],F=e?50:100,V=s?50:100;if(vn(I)<=F&&vn(k)<=V){if(!Fn(I,r.length)&&Fn(k,i.length))return NaN;let j;if(e&&s)j=Pl(r,I,i,k,A),_=Math.min(_,j);else if(e&&!s){const H=r.slice(I[0],I[1]+1);for(let Q=k[0];Q<=k[1];++Q)if(j=Ys(i[Q],H,A),_=Math.min(_,j),_===0)return _}else if(!e&&s){const H=i.slice(k[0],k[1]+1);for(let Q=I[0];Q<=I[1];++Q)if(j=Ys(r[Q],H,A),_=Math.min(_,j),_===0)return _}else j=Ra(r,I,i,k,A),_=Math.min(_,j)}else{const j=ho(I,e),H=ho(k,s);sn(b,_,A,r,i,j[0],H[0]),sn(b,_,A,r,i,j[0],H[1]),sn(b,_,A,r,i,j[1],H[0]),sn(b,_,A,r,i,j[1],H[1])}}return _}function Xs(r){return r.type==="MultiPolygon"?r.coordinates.map((e=>({type:"Polygon",coordinates:e}))):r.type==="MultiLineString"?r.coordinates.map((e=>({type:"LineString",coordinates:e}))):r.type==="MultiPoint"?r.coordinates.map((e=>({type:"Point",coordinates:e}))):[r]}class Xo{constructor(e,i){this.type=ut,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Qn(e[1])){const s=e[1];if(s.type==="FeatureCollection")return new Xo(s,s.features.map((A=>Xs(A.geometry))).flat());if(s.type==="Feature")return new Xo(s,Xs(s.geometry));if("type"in s&&"coordinates"in s)return new Xo(s,Xs(s))}return i.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(i,s){const A=i.geometry(),d=A.flat().map((M=>Eo([M.x,M.y],i.canonical)));if(A.length===0)return NaN;const _=new As(d[0][1]);let b=1/0;for(const M of s){switch(M.type){case"Point":b=Math.min(b,il(d,!1,[M.coordinates],!1,_,b));break;case"LineString":b=Math.min(b,il(d,!1,M.coordinates,!0,_,b));break;case"Polygon":b=Math.min(b,$r(d,!1,M.coordinates,_,b))}if(b===0)return b}return b})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,s){const A=i.geometry(),d=A.flat().map((M=>Eo([M.x,M.y],i.canonical)));if(A.length===0)return NaN;const _=new As(d[0][1]);let b=1/0;for(const M of s){switch(M.type){case"Point":b=Math.min(b,il(d,!0,[M.coordinates],!1,_,b));break;case"LineString":b=Math.min(b,il(d,!0,M.coordinates,!0,_,b));break;case"Polygon":b=Math.min(b,$r(d,!0,M.coordinates,_,b))}if(b===0)return b}return b})(e,this.geometries);if(e.geometryType()==="Polygon")return(function(i,s){const A=i.geometry();if(A.length===0||A[0].length===0)return NaN;const d=ma(A,0).map((M=>M.map((I=>I.map((k=>Eo([k.x,k.y],i.canonical))))))),_=new As(d[0][0][0][1]);let b=1/0;for(const M of s)for(const I of d){switch(M.type){case"Point":b=Math.min(b,$r([M.coordinates],!1,I,_,b));break;case"LineString":b=Math.min(b,$r(M.coordinates,!0,I,_,b));break;case"Polygon":b=Math.min(b,tl(I,M.coordinates,_,b))}if(b===0)return b}return b})(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class _a{constructor(e){this.type=ni,this.key=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=e[1];return s==null?i.error("Global state property must be defined."):typeof s!="string"?i.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new _a(s)}evaluate(e){var i;const s=(i=e.globals)===null||i===void 0?void 0:i.globalState;return s&&Object.keys(s).length!==0?so(s,this.key):null}eachChild(){}outputDefined(){return!1}}const ga={"==":jl,"!=":vl,">":uu,"<":Ya,">=":za,"<=":Mo,array:Yn,at:wi,boolean:Yn,case:Da,coalesce:ao,collator:lo,format:La,image:qs,in:ri,"index-of":Aa,interpolate:xr,"interpolate-hcl":xr,"interpolate-lab":xr,length:An,let:bi,literal:gs,match:Ci,number:Yn,"number-format":vs,object:Yn,slice:Xn,step:Kn,string:Yn,"to-boolean":Ls,"to-color":Ls,"to-number":Ls,"to-string":Ls,var:nn,within:Qs,distance:Xo,"global-state":_a};class fn{constructor(e,i,s,A){this.name=e,this.type=i,this._evaluate=s,this.args=A}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,i){const s=e[0],A=fn.definitions[s];if(!A)return i.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const d=Array.isArray(A)?A[0]:A.type,_=Array.isArray(A)?[[A[1],A[2]]]:A.overloads,b=_.filter((([I])=>!Array.isArray(I)||I.length===e.length-1));let M=null;for(const[I,k]of b){M=new hi(i.registry,Fa,i.path,null,i.scope);const F=[];let V=!1;for(let j=1;j<e.length;j++){const H=e[j],Q=Array.isArray(I)?I[j-1]:I.type,Y=M.parse(H,1+F.length,Q);if(!Y){V=!0;break}F.push(Y)}if(!V)if(Array.isArray(I)&&I.length!==F.length)M.error(`Expected ${I.length} arguments, but found ${F.length} instead.`);else{for(let j=0;j<F.length;j++){const H=Array.isArray(I)?I[j]:I.type,Q=F[j];M.concat(j+1).checkSubtype(H,Q.type)}if(M.errors.length===0)return new fn(s,d,k,F)}}if(b.length===1)i.errors.push(...M.errors);else{const I=(b.length?b:_).map((([F])=>{return V=F,Array.isArray(V)?`(${V.map(Ft).join(", ")})`:`(${Ft(V.type)}...)`;var V})).join(" | "),k=[];for(let F=1;F<e.length;F++){const V=i.parse(e[F],1+k.length);if(!V)return null;k.push(Ft(V.type))}i.error(`Expected arguments of type ${I}, but found (${k.join(", ")}) instead.`)}return null}static register(e,i){fn.definitions=i;for(const s in i)e[s]=fn}}function ql(r,[e,i,s,A]){e=e.evaluate(r),i=i.evaluate(r),s=s.evaluate(r);const d=A?A.evaluate(r):1,_=Us(e,i,s,d);if(_)throw new Ki(_);return new oi(e/255,i/255,s/255,d,!1)}function Ko(r,e){return r in e}function rl(r,e){const i=e[r];return i===void 0?null:i}function Rs(r){return{type:r}}function Fa(r){if(r instanceof nn)return Fa(r.boundExpression);if(r instanceof fn&&r.name==="error"||r instanceof lo||r instanceof Qs||r instanceof Xo||r instanceof _a)return!1;const e=r instanceof Ls||r instanceof Yn;let i=!0;return r.eachChild((s=>{i=e?i&&Fa(s):i&&s instanceof gs})),!!i&&es(r)&&Oa(r,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function es(r){if(r instanceof fn&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof Qs||r instanceof Xo)return!1;let e=!0;return r.eachChild((i=>{e&&!es(i)&&(e=!1)})),e}function ya(r){if(r instanceof fn&&r.name==="feature-state")return!1;let e=!0;return r.eachChild((i=>{e&&!ya(i)&&(e=!1)})),e}function Oa(r,e){if(r instanceof fn&&e.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild((s=>{i&&!Oa(s,e)&&(i=!1)})),i}function va(r){return{result:"success",value:r}}function xa(r){return{result:"error",value:r}}function co(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function ba(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function nl(r){return!!r.expression&&r.expression.interpolated}function gi(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function sl(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&Si(r)===jr}function El(r){return r}function Fs(r,e){const i=r.stops&&typeof r.stops[0][0]=="object",s=i||!(i||r.property!==void 0),A=r.type||(nl(e)?"exponential":"interval"),d=(function(k){switch(k.type){case"color":return oi.parse;case"padding":return Ht.parse;case"numberArray":return Li.parse;case"colorArray":return Dt.parse;default:return null}})(e);if(d&&((r=X({},r)).stops&&(r.stops=r.stops.map((k=>[k[0],d(k[1])]))),r.default=d(r.default?r.default:e.default)),r.colorSpace&&(_=r.colorSpace)!=="rgb"&&_!=="hcl"&&_!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var _;const b=(function(k){switch(k){case"exponential":return Ql;case"interval":return Wl;case"categorical":return Hl;case"identity":return $l;default:throw new Error(`Unknown function type "${k}"`)}})(A);let M,I;if(A==="categorical"){M=Object.create(null);for(const k of r.stops)M[k[0]]=k[1];I=typeof r.stops[0][0]}if(i){const k={},F=[];for(let H=0;H<r.stops.length;H++){const Q=r.stops[H],Y=Q[0].zoom;k[Y]===void 0&&(k[Y]={zoom:Y,type:r.type,property:r.property,default:r.default,stops:[]},F.push(Y)),k[Y].stops.push([Q[0].value,Q[1]])}const V=[];for(const H of F)V.push([k[H].zoom,Fs(k[H],e)]);const j={name:"linear"};return{kind:"composite",interpolationType:j,interpolationFactor:xr.interpolationFactor.bind(void 0,j),zoomStops:V.map((H=>H[0])),evaluate:({zoom:H},Q)=>Ql({stops:V,base:r.base},e,H).evaluate(H,Q)}}if(s){const k=A==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:k,interpolationFactor:xr.interpolationFactor.bind(void 0,k),zoomStops:r.stops.map((F=>F[0])),evaluate:({zoom:F})=>b(r,e,F,M,I)}}return{kind:"source",evaluate(k,F){const V=F&&F.properties?F.properties[r.property]:void 0;return V===void 0?Jo(r.default,e.default):b(r,e,V,M,I)}}}function Jo(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function Hl(r,e,i,s,A){return Jo(typeof i===A?s[i]:void 0,r.default,e.default)}function Wl(r,e,i){if(gi(i)!=="number")return Jo(r.default,e.default);const s=r.stops.length;if(s===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[s-1][0])return r.stops[s-1][1];const A=oo(r.stops.map((d=>d[0])),i);return r.stops[A][1]}function Ql(r,e,i){const s=r.base!==void 0?r.base:1;if(gi(i)!=="number")return Jo(r.default,e.default);const A=r.stops.length;if(A===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[A-1][0])return r.stops[A-1][1];const d=oo(r.stops.map((k=>k[0])),i),_=(function(k,F,V,j){const H=j-V,Q=k-V;return H===0?0:F===1?Q/H:(Math.pow(F,Q)-1)/(Math.pow(F,H)-1)})(i,s,r.stops[d][0],r.stops[d+1][0]),b=r.stops[d][1],M=r.stops[d+1][1],I=ir[e.type]||El;return typeof b.evaluate=="function"?{evaluate(...k){const F=b.evaluate.apply(void 0,k),V=M.evaluate.apply(void 0,k);if(F!==void 0&&V!==void 0)return I(F,V,_,r.colorSpace)}}:I(b,M,_,r.colorSpace)}function $l(r,e,i){switch(e.type){case"color":i=oi.parse(i);break;case"formatted":i=Wn.fromString(i.toString());break;case"resolvedImage":i=gn.fromString(i.toString());break;case"padding":i=Ht.parse(i);break;case"colorArray":i=Dt.parse(i);break;case"numberArray":i=Li.parse(i);break;default:gi(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0)}return Jo(i,r.default,e.default)}fn.register(ga,{error:[{kind:"error"},[zt],(r,[e])=>{throw new Ki(e.evaluate(r))}],typeof:[zt,[ni],(r,[e])=>Ft(Si(e.evaluate(r)))],"to-rgba":[vr(ut,4),[fi],(r,[e])=>{const[i,s,A,d]=e.evaluate(r).rgb;return[255*i,255*s,255*A,d]}],rgb:[fi,[ut,ut,ut],ql],rgba:[fi,[ut,ut,ut,ut],ql],has:{type:$t,overloads:[[[zt],(r,[e])=>Ko(e.evaluate(r),r.properties())],[[zt,jr],(r,[e,i])=>Ko(e.evaluate(r),i.evaluate(r))]]},get:{type:ni,overloads:[[[zt],(r,[e])=>rl(e.evaluate(r),r.properties())],[[zt,jr],(r,[e,i])=>rl(e.evaluate(r),i.evaluate(r))]]},"feature-state":[ni,[zt],(r,[e])=>rl(e.evaluate(r),r.featureState||{})],properties:[jr,[],r=>r.properties()],"geometry-type":[zt,[],r=>r.geometryType()],id:[ni,[],r=>r.id()],zoom:[ut,[],r=>r.globals.zoom],"heatmap-density":[ut,[],r=>r.globals.heatmapDensity||0],elevation:[ut,[],r=>r.globals.elevation||0],"line-progress":[ut,[],r=>r.globals.lineProgress||0],accumulated:[ni,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[ut,Rs(ut),(r,e)=>{let i=0;for(const s of e)i+=s.evaluate(r);return i}],"*":[ut,Rs(ut),(r,e)=>{let i=1;for(const s of e)i*=s.evaluate(r);return i}],"-":{type:ut,overloads:[[[ut,ut],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[ut],(r,[e])=>-e.evaluate(r)]]},"/":[ut,[ut,ut],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[ut,[ut,ut],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[ut,[],()=>Math.LN2],pi:[ut,[],()=>Math.PI],e:[ut,[],()=>Math.E],"^":[ut,[ut,ut],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[ut,[ut],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[ut,[ut],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[ut,[ut],(r,[e])=>Math.log(e.evaluate(r))],log2:[ut,[ut],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[ut,[ut],(r,[e])=>Math.sin(e.evaluate(r))],cos:[ut,[ut],(r,[e])=>Math.cos(e.evaluate(r))],tan:[ut,[ut],(r,[e])=>Math.tan(e.evaluate(r))],asin:[ut,[ut],(r,[e])=>Math.asin(e.evaluate(r))],acos:[ut,[ut],(r,[e])=>Math.acos(e.evaluate(r))],atan:[ut,[ut],(r,[e])=>Math.atan(e.evaluate(r))],min:[ut,Rs(ut),(r,e)=>Math.min(...e.map((i=>i.evaluate(r))))],max:[ut,Rs(ut),(r,e)=>Math.max(...e.map((i=>i.evaluate(r))))],abs:[ut,[ut],(r,[e])=>Math.abs(e.evaluate(r))],round:[ut,[ut],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[ut,[ut],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[ut,[ut],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[$t,[zt,ni],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[$t,[ni],(r,[e])=>r.id()===e.value],"filter-type-==":[$t,[zt],(r,[e])=>r.geometryType()===e.value],"filter-<":[$t,[zt,ni],(r,[e,i])=>{const s=r.properties()[e.value],A=i.value;return typeof s==typeof A&&s<A}],"filter-id-<":[$t,[ni],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<s}],"filter->":[$t,[zt,ni],(r,[e,i])=>{const s=r.properties()[e.value],A=i.value;return typeof s==typeof A&&s>A}],"filter-id->":[$t,[ni],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>s}],"filter-<=":[$t,[zt,ni],(r,[e,i])=>{const s=r.properties()[e.value],A=i.value;return typeof s==typeof A&&s<=A}],"filter-id-<=":[$t,[ni],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<=s}],"filter->=":[$t,[zt,ni],(r,[e,i])=>{const s=r.properties()[e.value],A=i.value;return typeof s==typeof A&&s>=A}],"filter-id->=":[$t,[ni],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>=s}],"filter-has":[$t,[ni],(r,[e])=>e.value in r.properties()],"filter-has-id":[$t,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[$t,[vr(zt)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[$t,[vr(ni)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[$t,[zt,vr(ni)],(r,[e,i])=>i.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[$t,[zt,vr(ni)],(r,[e,i])=>(function(s,A,d,_){for(;d<=_;){const b=d+_>>1;if(A[b]===s)return!0;A[b]>s?_=b-1:d=b+1}return!1})(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:$t,overloads:[[[$t,$t],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[Rs($t),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:$t,overloads:[[[$t,$t],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[Rs($t),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[$t,[$t],(r,[e])=>!e.evaluate(r)],"is-supported-script":[$t,[zt],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[zt,[zt],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[zt,[zt],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[zt,Rs(ni),(r,e)=>e.map((i=>$n(i.evaluate(r)))).join("")],"resolved-locale":[zt,[Ea],(r,[e])=>e.evaluate(r).resolvedLocale()]});class ol{constructor(e,i,s){this.expression=e,this._warningHistory={},this._evaluator=new Qr,this._defaultValue=i?(function(A){if(A.type==="color"&&sl(A.default))return new oi(0,0,0,0);switch(A.type){case"color":return oi.parse(A.default)||null;case"padding":return Ht.parse(A.default)||null;case"numberArray":return Li.parse(A.default)||null;case"colorArray":return Dt.parse(A.default)||null;case"variableAnchorOffsetCollection":return cn.parse(A.default)||null;case"projectionDefinition":return Lr.parse(A.default)||null;default:return A.default===void 0?null:A.default}})(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this._globalState=s}evaluateWithoutErrorHandling(e,i,s,A,d,_){return this._globalState&&(e=Ze(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=s,this._evaluator.canonical=A,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=_,this.expression.evaluate(this._evaluator)}evaluate(e,i,s,A,d,_){this._globalState&&(e=Ze(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=s||null,this._evaluator.canonical=A,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=_||null;try{const b=this.expression.evaluate(this._evaluator);if(b==null||typeof b=="number"&&b!=b)return this._defaultValue;if(this._enumValues&&!(b in this._enumValues))throw new Ki(`Expected value to be one of ${Object.keys(this._enumValues).map((M=>JSON.stringify(M))).join(", ")}, but found ${JSON.stringify(b)} instead.`);return b}catch(b){return this._warningHistory[b.message]||(this._warningHistory[b.message]=!0,typeof console<"u"&&console.warn(b.message)),this._defaultValue}}}function ds(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in ga}function u(r,e,i){const s=new hi(ga,Fa,[],e?(function(d){const _={color:fi,string:zt,number:ut,enum:zt,boolean:$t,formatted:xo,padding:kn,numberArray:Hn,colorArray:qn,projectionDefinition:di,resolvedImage:bo,variableAnchorOffsetCollection:Sa};return d.type==="array"?vr(_[d.value]||ni,d.length):_[d.type]})(e):void 0),A=s.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return A?va(new ol(A,e,i)):xa(s.errors)}class v{constructor(e,i,s){this.kind=e,this._styleExpression=i,this.isStateDependent=e!=="constant"&&!ya(i.expression),this.globalStateRefs=Ee(i.expression),this._globalState=s}evaluateWithoutErrorHandling(e,i,s,A,d,_){return this._globalState&&(e=Ze(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,i,s,A,d,_)}evaluate(e,i,s,A,d,_){return this._globalState&&(e=Ze(e,this._globalState)),this._styleExpression.evaluate(e,i,s,A,d,_)}}class E{constructor(e,i,s,A,d){this.kind=e,this.zoomStops=s,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!ya(i.expression),this.globalStateRefs=Ee(i.expression),this.interpolationType=A,this._globalState=d}evaluateWithoutErrorHandling(e,i,s,A,d,_){return this._globalState&&(e=Ze(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,i,s,A,d,_)}evaluate(e,i,s,A,d,_){return this._globalState&&(e=Ze(e,this._globalState)),this._styleExpression.evaluate(e,i,s,A,d,_)}interpolationFactor(e,i,s){return this.interpolationType?xr.interpolationFactor(this.interpolationType,e,i,s):0}}function R(r,e,i){const s=u(r,e,i);if(s.result==="error")return s;const A=s.value.expression,d=es(A);if(!d&&!co(e))return xa([new ii("","data expressions not supported")]);const _=Oa(A,["zoom"]);if(!_&&!ba(e))return xa([new ii("","zoom expressions not supported")]);const b=ne(A);return b||_?b instanceof ii?xa([b]):b instanceof xr&&!nl(e)?xa([new ii("",'"interpolate" expressions cannot be used with this property')]):va(b?new E(d?"camera":"composite",s.value,b.labels,b instanceof xr?b.interpolation:void 0,i):new v(d?"constant":"source",s.value,i)):xa([new ii("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class q{constructor(e,i){this._parameters=e,this._specification=i,X(this,Fs(this._parameters,this._specification))}static deserialize(e){return new q(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function ne(r){let e=null;if(r instanceof bi)e=ne(r.result);else if(r instanceof ao){for(const i of r.args)if(e=ne(i),e)break}else(r instanceof Kn||r instanceof xr)&&r.input instanceof fn&&r.input.name==="zoom"&&(e=r);return e instanceof ii||r.eachChild((i=>{const s=ne(i);s instanceof ii?e=s:!e&&s?e=new ii("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new ii("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Ee(r,e=new Set){return r instanceof _a&&e.add(r.key),r.eachChild((i=>{Ee(i,e)})),e}function Ze(r,e){const{zoom:i,heatmapDensity:s,elevation:A,lineProgress:d,isSupportedScript:_,accumulated:b}=r??{};return{zoom:i,heatmapDensity:s,elevation:A,lineProgress:d,isSupportedScript:_,accumulated:b,globalState:e}}function tt(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const e of r.slice(1))if(!tt(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const gt={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Rt(r,e){if(r==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};tt(r)||(r=Zr(r));const i=u(r,gt,e);if(i.result==="error")throw new Error(i.value.map((s=>`${s.key}: ${s.message}`)).join(", "));return{filter:(s,A,d)=>i.value.evaluate(s,A,{},d),needGeometry:Ti(r),getGlobalStateRefs:()=>Ee(i.value.expression)}}function Jt(r,e){return r<e?-1:r>e?1:0}function Ti(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(Ti(r[e]))return!0;return!1}function Zr(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?Br(r[1],r[2],"=="):e==="!="?Ks(Br(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Br(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(Zr))):e==="all"?["all"].concat(r.slice(1).map(Zr)):e==="none"?["all"].concat(r.slice(1).map(Zr).map(Ks)):e==="in"?ps(r[1],r.slice(2)):e==="!in"?Ks(ps(r[1],r.slice(2))):e==="has"?On(r[1]):e!=="!has"||Ks(On(r[1]));var i}function Br(r,e,i){switch(r){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,r,e]}}function ps(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((i=>typeof i!=typeof e[0]))?["filter-in-large",r,["literal",e.sort(Jt)]]:["filter-in-small",r,["literal",e]]}}function On(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function Ks(r){return["!",r]}function al(r){const e=typeof r;if(e==="number"||e==="boolean"||e==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let A="[";for(const d of r)A+=`${al(d)},`;return`${A}]`}const i=Object.keys(r).sort();let s="{";for(let A=0;A<i.length;A++)s+=`${JSON.stringify(i[A])}:${al(r[i[A]])},`;return`${s}}`}function Yl(r){let e="";for(const i of Hi)e+=`/${al(r[i])}`;return e}function Xl(r){const e=r.value;return e?[new o(r.key,e,"constants have been deprecated as of v8")]:[]}function br(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function ea(r){if(Array.isArray(r))return r.map(ea);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const i in r)e[i]=ea(r[i]);return e}return br(r)}function Nn(r){const e=r.key,i=r.value,s=r.valueSpec||{},A=r.objectElementValidators||{},d=r.style,_=r.styleSpec,b=r.validateSpec;let M=[];const I=gi(i);if(I!=="object")return[new o(e,i,`object expected, ${I} found`)];for(const k in i){const F=k.split(".")[0],V=so(s,F)||s["*"];let j;if(so(A,F))j=A[F];else if(so(s,F)){if(i[k]===void 0)continue;j=b}else if(A["*"])j=A["*"];else{if(!s["*"]){M.push(new o(e,i[k],`unknown property "${k}"`));continue}j=b}M=M.concat(j({key:(e&&`${e}.`)+k,value:i[k],valueSpec:V,style:d,styleSpec:_,object:i,objectKey:k,validateSpec:b},i))}for(const k in s)A[k]||s[k].required&&s[k].default===void 0&&i[k]===void 0&&M.push(new o(e,i,`missing required property "${k}"`));return M}function pr(r){const e=r.value,i=r.valueSpec,s=r.style,A=r.styleSpec,d=r.key,_=r.arrayElementValidator||r.validateSpec;if(gi(e)!=="array")return[new o(d,e,`array expected, ${gi(e)} found`)];if(i.length&&e.length!==i.length)return[new o(d,e,`array length ${i.length} expected, length ${e.length} found`)];let b={type:i.value,values:i.values};A.$version<7&&(b.function=i.function),gi(i.value)==="object"&&(b=i.value);let M=[];for(let I=0;I<e.length;I++)M=M.concat(_({array:e,arrayIndex:I,value:e[I],valueSpec:b,validateSpec:r.validateSpec,style:s,styleSpec:A,key:`${d}[${I}]`}));return M}function nr(r){const e=r.key,i=r.value,s=r.valueSpec;let A=gi(i);return A==="number"&&i!=i&&(A="NaN"),A!=="number"?[new o(e,i,`number expected, ${A} found`)]:"minimum"in s&&i<s.minimum?[new o(e,i,`${i} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&i>s.maximum?[new o(e,i,`${i} is greater than the maximum value ${s.maximum}`)]:[]}function ll(r){const e=r.valueSpec,i=br(r.value.type);let s,A,d,_={};const b=i!=="categorical"&&r.value.property===void 0,M=!b,I=gi(r.value.stops)==="array"&&gi(r.value.stops[0])==="array"&&gi(r.value.stops[0][0])==="object",k=Nn({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(j){if(i==="identity")return[new o(j.key,j.value,'identity function may not have a "stops" property')];let H=[];const Q=j.value;return H=H.concat(pr({key:j.key,value:Q,valueSpec:j.valueSpec,validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec,arrayElementValidator:F})),gi(Q)==="array"&&Q.length===0&&H.push(new o(j.key,Q,"array must have at least one stop")),H},default:function(j){return j.validateSpec({key:j.key,value:j.value,valueSpec:e,validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec})}}});return i==="identity"&&b&&k.push(new o(r.key,r.value,'missing required property "property"')),i==="identity"||r.value.stops||k.push(new o(r.key,r.value,'missing required property "stops"')),i==="exponential"&&r.valueSpec.expression&&!nl(r.valueSpec)&&k.push(new o(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(M&&!co(r.valueSpec)?k.push(new o(r.key,r.value,"property functions not supported")):b&&!ba(r.valueSpec)&&k.push(new o(r.key,r.value,"zoom functions not supported"))),i!=="categorical"&&!I||r.value.property!==void 0||k.push(new o(r.key,r.value,'"property" property is required')),k;function F(j){let H=[];const Q=j.value,Y=j.key;if(gi(Q)!=="array")return[new o(Y,Q,`array expected, ${gi(Q)} found`)];if(Q.length!==2)return[new o(Y,Q,`array length 2 expected, length ${Q.length} found`)];if(I){if(gi(Q[0])!=="object")return[new o(Y,Q,`object expected, ${gi(Q[0])} found`)];if(Q[0].zoom===void 0)return[new o(Y,Q,"object stop key must have zoom")];if(Q[0].value===void 0)return[new o(Y,Q,"object stop key must have value")];if(d&&d>br(Q[0].zoom))return[new o(Y,Q[0].zoom,"stop zoom values must appear in ascending order")];br(Q[0].zoom)!==d&&(d=br(Q[0].zoom),A=void 0,_={}),H=H.concat(Nn({key:`${Y}[0]`,value:Q[0],valueSpec:{zoom:{}},validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec,objectElementValidators:{zoom:nr,value:V}}))}else H=H.concat(V({key:`${Y}[0]`,value:Q[0],validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec},Q));return ds(ea(Q[1]))?H.concat([new o(`${Y}[1]`,Q[1],"expressions are not allowed in function stops.")]):H.concat(j.validateSpec({key:`${Y}[1]`,value:Q[1],valueSpec:e,validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec}))}function V(j,H){const Q=gi(j.value),Y=br(j.value),re=j.value!==null?j.value:H;if(s){if(Q!==s)return[new o(j.key,re,`${Q} stop domain type must match previous stop domain type ${s}`)]}else s=Q;if(Q!=="number"&&Q!=="string"&&Q!=="boolean")return[new o(j.key,re,"stop domain value must be a number, string, or boolean")];if(Q!=="number"&&i!=="categorical"){let ge=`number expected, ${Q} found`;return co(e)&&i===void 0&&(ge+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new o(j.key,re,ge)]}return i!=="categorical"||Q!=="number"||isFinite(Y)&&Math.floor(Y)===Y?i!=="categorical"&&Q==="number"&&A!==void 0&&Y<A?[new o(j.key,re,"stop domain values must appear in ascending order")]:(A=Y,i==="categorical"&&Y in _?[new o(j.key,re,"stop domain values must be unique")]:(_[Y]=!0,[])):[new o(j.key,re,`integer expected, found ${Y}`)]}}function Co(r){const e=(r.expressionContext==="property"?R:u)(ea(r.value),r.valueSpec);if(e.result==="error")return e.value.map((s=>new o(`${r.key}${s.key}`,r.value,s.message)));const i=e.value.expression||e.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!i.outputDefined())return[new o(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!ya(i))return[new o(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!ya(i))return[new o(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!Oa(i,["zoom","feature-state"]))return[new o(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!es(i))return[new o(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ao(r){const e=r.key,i=r.value,s=gi(i);return s!=="string"?[new o(e,i,`color expected, ${s} found`)]:oi.parse(String(i))?[]:[new o(e,i,`color expected, "${i}" found`)]}function Ur(r){const e=r.key,i=r.value,s=r.valueSpec,A=[];return Array.isArray(s.values)?s.values.indexOf(br(i))===-1&&A.push(new o(e,i,`expected one of [${s.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(s.values).indexOf(br(i))===-1&&A.push(new o(e,i,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(i)} found`)),A}function ta(r){return tt(ea(r.value))?Co(X({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Kl(r)}function Kl(r){const e=r.value,i=r.key;if(gi(e)!=="array")return[new o(i,e,`array expected, ${gi(e)} found`)];const s=r.styleSpec;let A,d=[];if(e.length<1)return[new o(i,e,"filter array must have at least 1 element")];switch(d=d.concat(Ur({key:`${i}[0]`,value:e[0],valueSpec:s.filter_operator,style:r.style,styleSpec:r.styleSpec})),br(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&br(e[1])==="$type"&&d.push(new o(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&d.push(new o(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(A=gi(e[1]),A!=="string"&&d.push(new o(`${i}[1]`,e[1],`string expected, ${A} found`)));for(let _=2;_<e.length;_++)A=gi(e[_]),br(e[1])==="$type"?d=d.concat(Ur({key:`${i}[${_}]`,value:e[_],valueSpec:s.geometry_type,style:r.style,styleSpec:r.styleSpec})):A!=="string"&&A!=="number"&&A!=="boolean"&&d.push(new o(`${i}[${_}]`,e[_],`string, number, or boolean expected, ${A} found`));break;case"any":case"all":case"none":for(let _=1;_<e.length;_++)d=d.concat(Kl({key:`${i}[${_}]`,value:e[_],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":A=gi(e[1]),e.length!==2?d.push(new o(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):A!=="string"&&d.push(new o(`${i}[1]`,e[1],`string expected, ${A} found`))}return d}function fu(r,e){const i=r.key,s=r.validateSpec,A=r.style,d=r.styleSpec,_=r.value,b=r.objectKey,M=d[`${e}_${r.layerType}`];if(!M)return[];const I=b.match(/^(.*)-transition$/);if(e==="paint"&&I&&M[I[1]]&&M[I[1]].transition)return s({key:i,value:_,valueSpec:d.transition,style:A,styleSpec:d});const k=r.valueSpec||M[b];if(!k)return[new o(i,_,`unknown property "${b}"`)];let F;if(gi(_)==="string"&&co(k)&&!k.tokens&&(F=/^{([^}]+)}$/.exec(_)))return[new o(i,_,`"${b}" does not support interpolation syntax 8 + Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(F[1])} }\`.`)];const V=[];return r.layerType==="symbol"&&b==="text-font"&&sl(ea(_))&&br(_.type)==="identity"&&V.push(new o(i,_,'"text-font" does not support identity functions')),V.concat(s({key:r.key,value:_,valueSpec:k,style:A,styleSpec:d,expressionContext:"property",propertyType:e,propertyKey:b}))}function du(r){return fu(r,"paint")}function pu(r){return fu(r,"layout")}function mu(r){let e=[];const i=r.value,s=r.key,A=r.style,d=r.styleSpec;if(gi(i)!=="object")return[new o(s,i,`object expected, ${gi(i)} found`)];i.type||i.ref||e.push(new o(s,i,'either "type" or "ref" is required'));let _=br(i.type);const b=br(i.ref);if(i.id){const M=br(i.id);for(let I=0;I<r.arrayIndex;I++){const k=A.layers[I];br(k.id)===M&&e.push(new o(s,i.id,`duplicate layer id "${i.id}", previously used at line ${k.id.__line__}`))}}if("ref"in i){let M;["type","source","source-layer","filter","layout"].forEach((I=>{I in i&&e.push(new o(s,i[I],`"${I}" is prohibited for ref layers`))})),A.layers.forEach((I=>{br(I.id)===b&&(M=I)})),M?M.ref?e.push(new o(s,i.ref,"ref cannot reference another ref layer")):_=br(M.type):e.push(new o(s,i.ref,`ref layer "${b}" not found`))}else if(_!=="background")if(i.source){const M=A.sources&&A.sources[i.source],I=M&&br(M.type);M?I==="vector"&&_==="raster"?e.push(new o(s,i.source,`layer "${i.id}" requires a raster source`)):I!=="raster-dem"&&_==="hillshade"||I!=="raster-dem"&&_==="color-relief"?e.push(new o(s,i.source,`layer "${i.id}" requires a raster-dem source`)):I==="raster"&&_!=="raster"?e.push(new o(s,i.source,`layer "${i.id}" requires a vector source`)):I!=="vector"||i["source-layer"]?I==="raster-dem"&&_!=="hillshade"&&_!=="color-relief"?e.push(new o(s,i.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):_!=="line"||!i.paint||!i.paint["line-gradient"]||I==="geojson"&&M.lineMetrics||e.push(new o(s,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new o(s,i,`layer "${i.id}" must specify a "source-layer"`)):e.push(new o(s,i.source,`source "${i.source}" not found`))}else e.push(new o(s,i,'missing required property "source"'));return e=e.concat(Nn({key:s,value:i,valueSpec:d.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${s}.type`,value:i.type,valueSpec:d.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:i,objectKey:"type"}),filter:ta,layout:M=>Nn({layer:i,key:M.key,value:M.value,style:M.style,styleSpec:M.styleSpec,validateSpec:M.validateSpec,objectElementValidators:{"*":I=>pu(X({layerType:_},I))}}),paint:M=>Nn({layer:i,key:M.key,value:M.value,style:M.style,styleSpec:M.styleSpec,validateSpec:M.validateSpec,objectElementValidators:{"*":I=>du(X({layerType:_},I))}})}})),e}function ia(r){const e=r.value,i=r.key,s=gi(e);return s!=="string"?[new o(i,e,`string expected, ${s} found`)]:[]}const _u={promoteId:function({key:r,value:e}){if(gi(e)==="string")return ia({key:r,value:e});{const i=[];for(const s in e)i.push(...ia({key:`${r}.${s}`,value:e[s]}));return i}}};function gu(r){const e=r.value,i=r.key,s=r.styleSpec,A=r.style,d=r.validateSpec;if(!e.type)return[new o(i,e,'"type" is required')];const _=br(e.type);let b;switch(_){case"vector":case"raster":return b=Nn({key:i,value:e,valueSpec:s[`source_${_.replace("-","_")}`],style:r.style,styleSpec:s,objectElementValidators:_u,validateSpec:d}),b;case"raster-dem":return b=(function(M){var I;const k=(I=M.sourceName)!==null&&I!==void 0?I:"",F=M.value,V=M.styleSpec,j=V.source_raster_dem,H=M.style;let Q=[];const Y=gi(F);if(F===void 0)return Q;if(Y!=="object")return Q.push(new o("source_raster_dem",F,`object expected, ${Y} found`)),Q;const re=br(F.encoding)==="custom",ge=["redFactor","greenFactor","blueFactor","baseShift"],oe=M.value.encoding?`"${M.value.encoding}"`:"Default";for(const ue in F)!re&&ge.includes(ue)?Q.push(new o(ue,F[ue],`In "${k}": "${ue}" is only valid when "encoding" is set to "custom". ${oe} encoding found`)):j[ue]?Q=Q.concat(M.validateSpec({key:ue,value:F[ue],valueSpec:j[ue],validateSpec:M.validateSpec,style:H,styleSpec:V})):Q.push(new o(ue,F[ue],`unknown property "${ue}"`));return Q})({sourceName:i,value:e,style:r.style,styleSpec:s,validateSpec:d}),b;case"geojson":if(b=Nn({key:i,value:e,valueSpec:s.source_geojson,style:A,styleSpec:s,validateSpec:d,objectElementValidators:_u}),e.cluster)for(const M in e.clusterProperties){const[I,k]=e.clusterProperties[M],F=typeof I=="string"?[I,["accumulated"],["get",M]]:I;b.push(...Co({key:`${i}.${M}.map`,value:k,expressionContext:"cluster-map"})),b.push(...Co({key:`${i}.${M}.reduce`,value:F,expressionContext:"cluster-reduce"}))}return b;case"video":return Nn({key:i,value:e,valueSpec:s.source_video,style:A,validateSpec:d,styleSpec:s});case"image":return Nn({key:i,value:e,valueSpec:s.source_image,style:A,validateSpec:d,styleSpec:s});case"canvas":return[new o(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ur({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Sl(r){const e=r.value,i=r.styleSpec,s=i.light,A=r.style;let d=[];const _=gi(e);if(e===void 0)return d;if(_!=="object")return d=d.concat([new o("light",e,`object expected, ${_} found`)]),d;for(const b in e){const M=b.match(/^(.*)-transition$/);d=d.concat(M&&s[M[1]]&&s[M[1]].transition?r.validateSpec({key:b,value:e[b],valueSpec:i.transition,validateSpec:r.validateSpec,style:A,styleSpec:i}):s[b]?r.validateSpec({key:b,value:e[b],valueSpec:s[b],validateSpec:r.validateSpec,style:A,styleSpec:i}):[new o(b,e[b],`unknown property "${b}"`)])}return d}function Fu(r){const e=r.value,i=r.styleSpec,s=i.sky,A=r.style,d=gi(e);if(e===void 0)return[];if(d!=="object")return[new o("sky",e,`object expected, ${d} found`)];let _=[];for(const b in e)_=_.concat(s[b]?r.validateSpec({key:b,value:e[b],valueSpec:s[b],style:A,styleSpec:i}):[new o(b,e[b],`unknown property "${b}"`)]);return _}function Io(r){const e=r.value,i=r.styleSpec,s=i.terrain,A=r.style;let d=[];const _=gi(e);if(e===void 0)return d;if(_!=="object")return d=d.concat([new o("terrain",e,`object expected, ${_} found`)]),d;for(const b in e)d=d.concat(s[b]?r.validateSpec({key:b,value:e[b],valueSpec:s[b],validateSpec:r.validateSpec,style:A,styleSpec:i}):[new o(b,e[b],`unknown property "${b}"`)]);return d}function Js(r){let e=[];const i=r.value,s=r.key;if(Array.isArray(i)){const A=[],d=[];for(const _ in i)i[_].id&&A.includes(i[_].id)&&e.push(new o(s,i,`all the sprites' ids must be unique, but ${i[_].id} is duplicated`)),A.push(i[_].id),i[_].url&&d.includes(i[_].url)&&e.push(new o(s,i,`all the sprites' URLs must be unique, but ${i[_].url} is duplicated`)),d.push(i[_].url),e=e.concat(Nn({key:`${s}[${_}]`,value:i[_],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return e}return ia({key:s,value:i})}function Qt(r){return!!r&&r.constructor===Object}function ts(r){return Qt(r.value)?[]:[new o(r.key,r.value,`object expected, ${gi(r.value)} found`)]}const Wt={"*":()=>[],array:pr,boolean:function(r){const e=r.value,i=r.key,s=gi(e);return s!=="boolean"?[new o(i,e,`boolean expected, ${s} found`)]:[]},number:nr,color:Ao,constants:Xl,enum:Ur,filter:ta,function:ll,layer:mu,object:Nn,source:gu,light:Sl,sky:Fu,terrain:Io,projection:function(r){const e=r.value,i=r.styleSpec,s=i.projection,A=r.style,d=gi(e);if(e===void 0)return[];if(d!=="object")return[new o("projection",e,`object expected, ${d} found`)];let _=[];for(const b in e)_=_.concat(s[b]?r.validateSpec({key:b,value:e[b],valueSpec:s[b],style:A,styleSpec:i}):[new o(b,e[b],`unknown property "${b}"`)]);return _},projectionDefinition:function(r){const e=r.key;let i=r.value;i=i instanceof String?i.valueOf():i;const s=gi(i);return s!=="array"||(function(A){return Array.isArray(A)&&A.length===3&&typeof A[0]=="string"&&typeof A[1]=="string"&&typeof A[2]=="number"})(i)||(function(A){return!!["interpolate","step","literal"].includes(A[0])})(i)?["array","string"].includes(s)?[]:[new o(e,i,`projection expected, invalid type "${s}" found`)]:[new o(e,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:ia,formatted:function(r){return ia(r).length===0?[]:Co(r)},resolvedImage:function(r){return ia(r).length===0?[]:Co(r)},padding:function(r){const e=r.key,i=r.value;if(gi(i)==="array"){if(i.length<1||i.length>4)return[new o(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const s={type:"number"};let A=[];for(let d=0;d<i.length;d++)A=A.concat(r.validateSpec({key:`${e}[${d}]`,value:i[d],validateSpec:r.validateSpec,valueSpec:s}));return A}return nr({key:e,value:i,valueSpec:{}})},numberArray:function(r){const e=r.key,i=r.value;if(gi(i)==="array"){const s={type:"number"};if(i.length<1)return[new o(e,i,"array length at least 1 expected, length 0 found")];let A=[];for(let d=0;d<i.length;d++)A=A.concat(r.validateSpec({key:`${e}[${d}]`,value:i[d],validateSpec:r.validateSpec,valueSpec:s}));return A}return nr({key:e,value:i,valueSpec:{}})},colorArray:function(r){const e=r.key,i=r.value;if(gi(i)==="array"){if(i.length<1)return[new o(e,i,"array length at least 1 expected, length 0 found")];let s=[];for(let A=0;A<i.length;A++)s=s.concat(Ao({key:`${e}[${A}]`,value:i[A]}));return s}return Ao({key:e,value:i})},variableAnchorOffsetCollection:function(r){const e=r.key,i=r.value,s=gi(i),A=r.styleSpec;if(s!=="array"||i.length<1||i.length%2!=0)return[new o(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let d=[];for(let _=0;_<i.length;_+=2)d=d.concat(Ur({key:`${e}[${_}]`,value:i[_],valueSpec:A.layout_symbol["text-anchor"]})),d=d.concat(pr({key:`${e}[${_+1}]`,value:i[_+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:A}));return d},sprite:Js,state:ts,fontFaces:function(r){const e=r.key,i=r.value,s=r.validateSpec,A=r.styleSpec,d=r.style;if(!Qt(i))return[new o(e,i,`object expected, ${gi(i)} found`)];const _=[];for(const b in i){const M=i[b],I=gi(M);if(I==="string")_.push(...ia({key:`${e}.${b}`,value:M}));else if(I==="array"){const k={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[F,V]of M.entries())_.push(...Nn({key:`${e}.${b}[${F}]`,value:V,valueSpec:k,styleSpec:A,style:d,validateSpec:s}))}else _.push(new o(`${e}.${b}`,M,`string or array expected, ${I} found`))}return _}};function wr(r){const e=r.value,i=r.valueSpec,s=r.styleSpec;return r.validateSpec=wr,i.expression&&sl(br(e))?ll(r):i.expression&&ds(ea(e))?Co(r):i.type&&Wt[i.type]?Wt[i.type](r):Nn(X({},r,{valueSpec:i.type?s[i.type]:i}))}function yu(r){const e=r.value,i=r.key,s=ia(r);return s.length||(e.indexOf("{fontstack}")===-1&&s.push(new o(i,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&s.push(new o(i,e,'"glyphs" url must include a "{range}" token'))),s}function bs(r,e=qe){let i=[];return i=i.concat(wr({key:"",value:r,valueSpec:e.$root,styleSpec:e,style:r,validateSpec:wr,objectElementValidators:{glyphs:yu,"*":()=>[]}})),r.constants&&(i=i.concat(Xl({key:"constants",value:r.constants}))),Ou(i)}function xn(r){return function(e){return r(Object.assign({},e,{validateSpec:wr}))}}function Ou(r){return[].concat(r).sort(((e,i)=>e.line-i.line))}function lr(r){return function(...e){return Ou(r.apply(this,e))}}bs.source=lr(xn(gu)),bs.sprite=lr(xn(Js)),bs.glyphs=lr(xn(yu)),bs.light=lr(xn(Sl)),bs.sky=lr(xn(Fu)),bs.terrain=lr(xn(Io)),bs.state=lr(xn(ts)),bs.layer=lr(xn(mu)),bs.filter=lr(xn(ta)),bs.paintProperty=lr(xn(du)),bs.layoutProperty=lr(xn(pu));const ul={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class Do{constructor(e,i){this._globalState=i,this.setValue(e)}evaluate(){var e;return(e=this._literalValue)!==null&&e!==void 0?e:this._compiledValue.evaluate({})}setValue(e){if(e==null||e==="visible"||e==="none")return this._literalValue=e==="none"?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);const i=u(e,ul,this._globalState);if(i.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,new Error(i.value.map((s=>`${s.key}: ${s.message}`)).join(", "));this._literalValue=void 0,this._compiledValue=i.value,this._globalStateRefs=Ee(i.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}const hl=qe,ht=bs,yt=ht.light,Jl=ht.sky,Nu=ht.paintProperty,eu=ht.layoutProperty;function ra(r,e){let i=!1;if(e&&e.length)for(const s of e)r.fire(new Gi(new Error(s.message))),i=!0;return i}class fo{constructor(e,i,s){const A=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const _=new Int32Array(this.arrayBuffer);e=_[0],this.d=(i=_[1])+2*(s=_[2]);for(let M=0;M<this.d*this.d;M++){const I=_[3+M],k=_[3+M+1];A.push(I===k?null:_.subarray(I,k))}const b=_[3+A.length+1];this.keys=_.subarray(_[3+A.length],b),this.bboxes=_.subarray(b),this.insert=this._insertReadonly}else{this.d=i+2*s;for(let _=0;_<this.d*this.d;_++)A.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=e,this.padding=s,this.scale=i/e,this.uid=0;const d=s/i*e;this.min=-d,this.max=e+d}insert(e,i,s,A,d){this._forEachCell(i,s,A,d,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(i),this.bboxes.push(s),this.bboxes.push(A),this.bboxes.push(d)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,i,s,A,d,_){this.cells[d].push(_)}query(e,i,s,A,d){const _=this.min,b=this.max;if(e<=_&&i<=_&&b<=s&&b<=A&&!d)return Array.prototype.slice.call(this.keys);{const M=[];return this._forEachCell(e,i,s,A,this._queryCell,M,{},d),M}}_queryCell(e,i,s,A,d,_,b,M){const I=this.cells[d];if(I!==null){const k=this.keys,F=this.bboxes;for(let V=0;V<I.length;V++){const j=I[V];if(b[j]===void 0){const H=4*j;(M?M(F[H+0],F[H+1],F[H+2],F[H+3]):e<=F[H+2]&&i<=F[H+3]&&s>=F[H+0]&&A>=F[H+1])?(b[j]=!0,_.push(k[j])):b[j]=!1}}}}_forEachCell(e,i,s,A,d,_,b,M){const I=this._convertToCellCoord(e),k=this._convertToCellCoord(i),F=this._convertToCellCoord(s),V=this._convertToCellCoord(A);for(let j=I;j<=F;j++)for(let H=k;H<=V;H++){const Q=this.d*H+j;if((!M||M(this._convertFromCellCoord(j),this._convertFromCellCoord(H),this._convertFromCellCoord(j+1),this._convertFromCellCoord(H+1)))&&d.call(this,e,i,s,A,Q,_,b,M))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,i=3+this.cells.length+1+1;let s=0;for(let _=0;_<this.cells.length;_++)s+=this.cells[_].length;const A=new Int32Array(i+s+this.keys.length+this.bboxes.length);A[0]=this.extent,A[1]=this.n,A[2]=this.padding;let d=i;for(let _=0;_<e.length;_++){const b=e[_];A[3+_]=d,A.set(b,d),d+=b.length}return A[3+e.length]=d,A.set(this.keys,d),d+=this.keys.length,A[3+e.length+1]=d,A.set(this.bboxes,d),d+=this.bboxes.length,A.buffer}static serialize(e,i){const s=e.toArrayBuffer();return i&&i.push(s),{buffer:s}}static deserialize(e){return new fo(e.buffer)}}const bn={};function kt(r,e,i={}){if(bn[r])throw new Error(`${r} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:r,writeable:!1}),bn[r]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}kt("Object",Object),kt("Set",Set),kt("TransferableGridIndex",fo),kt("Color",oi),kt("Error",Error),kt("AJAXError",ke),kt("ResolvedImage",gn),kt("StylePropertyFunction",q),kt("StyleExpression",ol,{omit:["_evaluator"]}),kt("ZoomDependentExpression",E),kt("ZoomConstantExpression",v),kt("CompoundExpression",fn,{omit:["_evaluate"]});for(const r in ga)ga[r]._classRegistryKey||kt(`Expression_${r}`,ga[r]);function po(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function l(r){return r.$name||r.constructor._classRegistryKey}function a(r){return!(function(e){if(e===null||typeof e!="object")return!1;const i=l(e);return!(!i||i==="Object")})(r)&&(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error||po(r)||Dn(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function c(r,e){if(a(r))return(po(r)||Dn(r))&&e&&e.push(r),ArrayBuffer.isView(r)&&e&&e.push(r.buffer),r instanceof ImageData&&e&&e.push(r.data.buffer),r;if(Array.isArray(r)){const d=[];for(const _ of r)d.push(c(_,e));return d}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);const i=l(r);if(!i)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!bn[i])throw new Error(`${i} is not registered.`);const{klass:s}=bn[i],A=s.serialize?s.serialize(r,e):{};if(s.serialize){if(e&&A===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const d in r){if(!r.hasOwnProperty(d)||bn[i].omit.indexOf(d)>=0)continue;const _=r[d];A[d]=bn[i].shallow.indexOf(d)>=0?_:c(_,e)}r instanceof Error&&(A.message=r.message)}if(A.$name)throw new Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(A.$name=i),A}function m(r){if(a(r))return r;if(Array.isArray(r))return r.map(m);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);const e=l(r)||"Object";if(!bn[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:i}=bn[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(r);const s=Object.create(i.prototype);for(const A of Object.keys(r)){if(A==="$name")continue;const d=r[A];s[A]=bn[e].shallow.indexOf(A)>=0?d:m(d)}return s}class g{constructor(){this.first=!0}update(e,i){const s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=i):this.lastFloorZoom<s&&(this.lastIntegerZoom=s,this.lastIntegerZoomTime=i),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=s,!0))}}function w(r){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))}function P(r){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))}function S(r){return/\s/u.test(String.fromCodePoint(r))}function z(r){for(const e of r)if(P(e.codePointAt(0)))return!0;return!1}function O(r){for(const e of r)if(!pe(e.codePointAt(0)))return!1;return!0}function Z(r){const e=r.map((i=>{try{return new RegExp(`\\p{sc=${i}}`,"u").source}catch{return null}})).filter((i=>i));return new RegExp(e.join("|"),"u")}const se=Z(["Arab","Dupl","Mong","Ougr","Syrc"]);function pe(r){return!se.test(String.fromCodePoint(r))}function de(r){return!(P(r)||(e=r,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(e))));var e}const me=Z(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Ie(r){return me.test(String.fromCodePoint(r))}function Be(r,e){return!(!e&&Ie(r)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(r)))}function Je(r){for(const e of r)if(Ie(e.codePointAt(0)))return!0;return!1}const Oe=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(r){this.pluginStatus=r.pluginStatus,this.pluginURL=r.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(r){if(Oe.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=r.applyArabicShaping,this.processBidirectionalText=r.processBidirectionalText,this.processStyledBidirectionalText=r.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(r,e){return p(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if(r.pluginStatus!=="loading")return this.setState(r),r;const i=r.pluginURL,s=new Promise((d=>{this.loadScriptResolve=d}));e(i);const A=new Promise((d=>setTimeout((()=>d()),this.TIMEOUT)));if(yield Promise.race([s,A]),this.isParsed()){const d={pluginStatus:"loaded",pluginURL:i};return this.setState(d),d}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${i}`)}))}};class ze{constructor(e,i){this.isSupportedScript=De,this.zoom=e,i?(this.now=i.now||0,this.fadeDuration=i.fadeDuration||0,this.zoomHistory=i.zoomHistory||new g,this.transition=i.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new g,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,i=e-Math.floor(e),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:i+(1-i)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*i}}}function De(r){return(function(e,i){for(const s of e)if(!Be(s.codePointAt(0),i))return!1;return!0})(r,Oe.getRTLTextPluginStatus()==="loaded")}const bt="-transition";class Zt{constructor(e,i,s){this.property=e,this.value=i,this.expression=(function(A,d,_){if(sl(A))return new q(A,d);if(ds(A)){const b=R(A,d,_);if(b.result==="error")throw new Error(b.value.map((M=>`${M.key}: ${M.message}`)).join(", "));return b.value}{let b=A;return d.type==="color"&&typeof A=="string"?b=oi.parse(A):d.type!=="padding"||typeof A!="number"&&!Array.isArray(A)?d.type!=="numberArray"||typeof A!="number"&&!Array.isArray(A)?d.type!=="colorArray"||typeof A!="string"&&!Array.isArray(A)?d.type==="variableAnchorOffsetCollection"&&Array.isArray(A)?b=cn.parse(A):d.type==="projectionDefinition"&&typeof A=="string"&&(b=Lr.parse(A)):b=Dt.parse(A):b=Li.parse(A):b=Ht.parse(A),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>b}}})(i===void 0?e.specification.default:i,e.specification,s)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,i,s){return this.property.possiblyEvaluate(this,e,i,s)}}class Nt{constructor(e,i){this.property=e,this.value=new Zt(e,void 0,i)}transitioned(e,i){return new pi(this.property,this.value,i,Er({},e.transition,this.transition),e.now)}untransitioned(){return new pi(this.property,this.value,null,{},0)}}class ai{constructor(e,i){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=i}getValue(e){return In(this._values[e].value.value)}setValue(e,i){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Nt(this._values[e].property,this._globalState)),this._values[e].value=new Zt(this._values[e].property,i===null?void 0:In(i),this._globalState)}getTransition(e){return In(this._values[e].transition)}setTransition(e,i){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Nt(this._values[e].property,this._globalState)),this._values[e].transition=In(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s);const A=this.getTransition(i);A!==void 0&&(e[`${i}${bt}`]=A)}return e}transitioned(e,i){const s=new Mi(this._properties);for(const A of Object.keys(this._values))s._values[A]=this._values[A].transitioned(e,i._values[A]);return s}untransitioned(){const e=new Mi(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class pi{constructor(e,i,s,A,d){this.property=e,this.value=i,this.begin=d+A.delay||0,this.end=this.begin+A.duration||0,e.specification.transition&&(A.delay||A.duration)&&(this.prior=s)}possiblyEvaluate(e,i,s){const A=e.now||0,d=this.value.possiblyEvaluate(e,i,s),_=this.prior;if(_){if(A>this.end)return this.prior=null,d;if(this.value.isDataDriven())return this.prior=null,d;if(A<this.begin)return _.possiblyEvaluate(e,i,s);{const b=(A-this.begin)/(this.end-this.begin);return this.property.interpolate(_.possiblyEvaluate(e,i,s),d,Wr(b))}}return d}}class Mi{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,s){const A=new vt(this._properties);for(const d of Object.keys(this._values))A._values[d]=this._values[d].possiblyEvaluate(e,i,s);return A}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class ei{constructor(e,i){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=i}hasValue(e){return this._values[e].value!==void 0}getValue(e){return In(this._values[e].value)}setValue(e,i){this._values[e]=new Zt(this._values[e].property,i===null?void 0:In(i),this._globalState)}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s)}return e}possiblyEvaluate(e,i,s){const A=new vt(this._properties);for(const d of Object.keys(this._values))A._values[d]=this._values[d].possiblyEvaluate(e,i,s);return A}}class Vt{constructor(e,i,s){this.property=e,this.value=i,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,s,A){return this.property.evaluate(this.value,this.parameters,e,i,s,A)}}class vt{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class _t{constructor(e){this.specification=e}possiblyEvaluate(e,i){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(i)}interpolate(e,i,s){const A=ir[this.specification.type];return A?A(e,i,s):e}}class Mt{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,s,A){return new Vt(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(i,null,{},s,A)}:e.expression,i)}interpolate(e,i,s){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new Vt(this,{kind:"constant",value:void 0},e.parameters);const A=ir[this.specification.type];if(A){const d=A(e.value.value,i.value.value,s);return new Vt(this,{kind:"constant",value:d},e.parameters)}return e}evaluate(e,i,s,A,d,_){return e.kind==="constant"?e.value:e.evaluate(i,s,A,d,_)}}class li extends Mt{possiblyEvaluate(e,i,s,A){if(e.value===void 0)return new Vt(this,{kind:"constant",value:void 0},i);if(e.expression.kind==="constant"){const d=e.expression.evaluate(i,null,{},s,A),_=e.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,b=this._calculate(_,_,_,i);return new Vt(this,{kind:"constant",value:b},i)}if(e.expression.kind==="camera"){const d=this._calculate(e.expression.evaluate({zoom:i.zoom-1}),e.expression.evaluate({zoom:i.zoom}),e.expression.evaluate({zoom:i.zoom+1}),i);return new Vt(this,{kind:"constant",value:d},i)}return new Vt(this,e.expression,i)}evaluate(e,i,s,A,d,_){if(e.kind==="source"){const b=e.evaluate(i,s,A,d,_);return this._calculate(b,b,b,i)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(i.zoom)-1},s,A),e.evaluate({zoom:Math.floor(i.zoom)},s,A),e.evaluate({zoom:Math.floor(i.zoom)+1},s,A),i):e.value}_calculate(e,i,s,A){return A.zoom>A.zoomHistory.lastIntegerZoom?{from:e,to:i}:{from:s,to:i}}interpolate(e){return e}}class Yi{constructor(e){this.specification=e}possiblyEvaluate(e,i,s,A){if(e.value!==void 0){if(e.expression.kind==="constant"){const d=e.expression.evaluate(i,null,{},s,A);return this._calculate(d,d,d,i)}return this._calculate(e.expression.evaluate(new ze(Math.floor(i.zoom-1),i)),e.expression.evaluate(new ze(Math.floor(i.zoom),i)),e.expression.evaluate(new ze(Math.floor(i.zoom+1),i)),i)}}_calculate(e,i,s,A){return A.zoom>A.zoomHistory.lastIntegerZoom?{from:e,to:i}:{from:s,to:i}}interpolate(e){return e}}class wn{constructor(e){this.specification=e}possiblyEvaluate(e,i,s,A){return!!e.expression.evaluate(i,null,{},s,A)}interpolate(){return!1}}class is{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const i in e){const s=e[i];s.specification.overridable&&this.overridableProperties.push(i);const A=this.defaultPropertyValues[i]=new Zt(s,void 0,void 0),d=this.defaultTransitionablePropertyValues[i]=new Nt(s,void 0);this.defaultTransitioningPropertyValues[i]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=A.possiblyEvaluate({})}}}kt("DataDrivenProperty",Mt),kt("DataConstantProperty",_t),kt("CrossFadedDataDrivenProperty",li),kt("CrossFadedProperty",Yi),kt("ColorRampProperty",wn);class ko extends Bi{constructor(e,i,s){if(super(),this.id=e.id,this.type=e.type,this._globalState=s,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=(function(A,d){return new Do(A,d)})(this.visibility,s),e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=Rt(e.filter,s)),i.layout&&(this._unevaluatedLayout=new ei(i.layout,s)),i.paint)){this._transitionablePaint=new ai(i.paint,s);for(const A in e.paint)this.setPaintProperty(A,e.paint[A],{validate:!1});for(const A in e.layout)this.setLayoutProperty(A,e.layout[A],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new vt(i.paint)}}setFilter(e){this.filter=e,this._featureFilter=Rt(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){const e=new Set;for(const i of this._visibilityExpression.getGlobalStateRefs())e.add(i);if(this._unevaluatedLayout)for(const i in this._unevaluatedLayout._values){const s=this._unevaluatedLayout._values[i];for(const A of s.getGlobalStateRefs())e.add(A)}for(const i of this._featureFilter.getGlobalStateRefs())e.add(i);return e}getPaintAffectingGlobalStateRefs(){var e;const i=new globalThis.Map;if(this._transitionablePaint)for(const s in this._transitionablePaint._values){const A=this._transitionablePaint._values[s].value;for(const d of A.getGlobalStateRefs()){const _=(e=i.get(d))!==null&&e!==void 0?e:[];_.push({name:s,value:A.value}),i.set(d,_)}}return i}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,i,s={}){if(i==null||!this._validate(eu,`layers.${this.id}.layout.${e}`,e,i,s))return e==="visibility"?(this.visibility=i,this._visibilityExpression.setValue(i),void this.recalculateVisibility()):void this._unevaluatedLayout.setValue(e,i)}getPaintProperty(e){return e.endsWith(bt)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i,s={}){if(i!=null&&this._validate(Nu,`layers.${this.id}.paint.${e}`,e,i,s))return!1;if(e.endsWith(bt))return this._transitionablePaint.setTransition(e.slice(0,-11),i||void 0),!1;{const A=this._transitionablePaint._values[e],d=A.property.specification["property-type"]==="cross-faded-data-driven",_=A.value.isDataDriven(),b=A.value;this._transitionablePaint.setValue(e,i),this._handleSpecialPaintPropertyUpdate(e);const M=this._transitionablePaint._values[e].value;return M.isDataDriven()||_||d||this._handleOverridablePaintPropertyUpdate(e,b,M)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,i,s){return!1}isHidden(e=this.minzoom,i=!1){return!!(this.minzoom&&e<(i?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&e>=this.maxzoom)||this._evaluatedVisibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(e,i){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){const e={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&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),No(e,((i,s)=>!(i===void 0||s==="layout"&&!Object.keys(i).length||s==="paint"&&!Object.keys(i).length)))}_validate(e,i,s,A,d={}){return(!d||d.validate!==!1)&&ra(this,e.call(ht,{key:i,layerType:this.type,objectKey:s,value:A,styleSpec:qe,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof Vt&&co(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}}let dh;var Qh={get paint(){return dh=dh||new is({"raster-opacity":new _t(qe.paint_raster["raster-opacity"]),"raster-hue-rotate":new _t(qe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new _t(qe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new _t(qe.paint_raster["raster-brightness-max"]),"raster-saturation":new _t(qe.paint_raster["raster-saturation"]),"raster-contrast":new _t(qe.paint_raster["raster-contrast"]),"raster-resampling":new _t(qe.paint_raster["raster-resampling"]),"raster-fade-duration":new _t(qe.paint_raster["raster-fade-duration"])})}};class Ic extends ko{constructor(e,i){super(e,Qh,i)}}const Dc={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class vu{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Gr{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&(e.isTransferred=!0,i.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function on(r,e=1){let i=0,s=0;return{members:r.map((A=>{const d=Dc[A.type].BYTES_PER_ELEMENT,_=i=Cl(i,Math.max(e,d)),b=A.components||1;return s=Math.max(s,d),i+=d*b,{name:A.name,type:A.type,components:b,offset:_}})),size:Cl(i,Math.max(s,e)),alignment:e}}function Cl(r,e){return Math.ceil(r/e)*e}class xu extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const A=2*e;return this.int16[A+0]=i,this.int16[A+1]=s,e}}xu.prototype.bytesPerElement=4,kt("StructArrayLayout2i4",xu);class Vu extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s){const A=this.length;return this.resize(A+1),this.emplace(A,e,i,s)}emplace(e,i,s,A){const d=3*e;return this.int16[d+0]=i,this.int16[d+1]=s,this.int16[d+2]=A,e}}Vu.prototype.bytesPerElement=6,kt("StructArrayLayout3i6",Vu);class ph extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,A){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,s,A)}emplace(e,i,s,A,d){const _=4*e;return this.int16[_+0]=i,this.int16[_+1]=s,this.int16[_+2]=A,this.int16[_+3]=d,e}}ph.prototype.bytesPerElement=8,kt("StructArrayLayout4i8",ph);class ju extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,A,d,_){const b=this.length;return this.resize(b+1),this.emplace(b,e,i,s,A,d,_)}emplace(e,i,s,A,d,_,b){const M=6*e;return this.int16[M+0]=i,this.int16[M+1]=s,this.int16[M+2]=A,this.int16[M+3]=d,this.int16[M+4]=_,this.int16[M+5]=b,e}}ju.prototype.bytesPerElement=12,kt("StructArrayLayout2i4i12",ju);class mh extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,A,d,_){const b=this.length;return this.resize(b+1),this.emplace(b,e,i,s,A,d,_)}emplace(e,i,s,A,d,_,b){const M=4*e,I=8*e;return this.int16[M+0]=i,this.int16[M+1]=s,this.uint8[I+4]=A,this.uint8[I+5]=d,this.uint8[I+6]=_,this.uint8[I+7]=b,e}}mh.prototype.bytesPerElement=8,kt("StructArrayLayout2i4ub8",mh);class bu extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const A=2*e;return this.float32[A+0]=i,this.float32[A+1]=s,e}}bu.prototype.bytesPerElement=8,kt("StructArrayLayout2f8",bu);class Na extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,A,d,_,b,M,I,k){const F=this.length;return this.resize(F+1),this.emplace(F,e,i,s,A,d,_,b,M,I,k)}emplace(e,i,s,A,d,_,b,M,I,k,F){const V=10*e;return this.uint16[V+0]=i,this.uint16[V+1]=s,this.uint16[V+2]=A,this.uint16[V+3]=d,this.uint16[V+4]=_,this.uint16[V+5]=b,this.uint16[V+6]=M,this.uint16[V+7]=I,this.uint16[V+8]=k,this.uint16[V+9]=F,e}}Na.prototype.bytesPerElement=20,kt("StructArrayLayout10ui20",Na);class Zu extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,A,d,_,b,M){const I=this.length;return this.resize(I+1),this.emplace(I,e,i,s,A,d,_,b,M)}emplace(e,i,s,A,d,_,b,M,I){const k=8*e;return this.uint16[k+0]=i,this.uint16[k+1]=s,this.uint16[k+2]=A,this.uint16[k+3]=d,this.uint16[k+4]=_,this.uint16[k+5]=b,this.uint16[k+6]=M,this.uint16[k+7]=I,e}}Zu.prototype.bytesPerElement=16,kt("StructArrayLayout8ui16",Zu);class wu extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,A,d,_,b,M,I,k,F,V){const j=this.length;return this.resize(j+1),this.emplace(j,e,i,s,A,d,_,b,M,I,k,F,V)}emplace(e,i,s,A,d,_,b,M,I,k,F,V,j){const H=12*e;return this.int16[H+0]=i,this.int16[H+1]=s,this.int16[H+2]=A,this.int16[H+3]=d,this.uint16[H+4]=_,this.uint16[H+5]=b,this.uint16[H+6]=M,this.uint16[H+7]=I,this.int16[H+8]=k,this.int16[H+9]=F,this.int16[H+10]=V,this.int16[H+11]=j,e}}wu.prototype.bytesPerElement=24,kt("StructArrayLayout4i4ui4i24",wu);class Uu extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const A=this.length;return this.resize(A+1),this.emplace(A,e,i,s)}emplace(e,i,s,A){const d=3*e;return this.float32[d+0]=i,this.float32[d+1]=s,this.float32[d+2]=A,e}}Uu.prototype.bytesPerElement=12,kt("StructArrayLayout3f12",Uu);class Tu extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}Tu.prototype.bytesPerElement=4,kt("StructArrayLayout1ul4",Tu);class _h extends Gr{_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(e,i,s,A,d,_,b,M,I){const k=this.length;return this.resize(k+1),this.emplace(k,e,i,s,A,d,_,b,M,I)}emplace(e,i,s,A,d,_,b,M,I,k){const F=10*e,V=5*e;return this.int16[F+0]=i,this.int16[F+1]=s,this.int16[F+2]=A,this.int16[F+3]=d,this.int16[F+4]=_,this.int16[F+5]=b,this.uint32[V+3]=M,this.uint16[F+8]=I,this.uint16[F+9]=k,e}}_h.prototype.bytesPerElement=20,kt("StructArrayLayout6i1ul2ui20",_h);class tu extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,A,d,_){const b=this.length;return this.resize(b+1),this.emplace(b,e,i,s,A,d,_)}emplace(e,i,s,A,d,_,b){const M=6*e;return this.int16[M+0]=i,this.int16[M+1]=s,this.int16[M+2]=A,this.int16[M+3]=d,this.int16[M+4]=_,this.int16[M+5]=b,e}}tu.prototype.bytesPerElement=12,kt("StructArrayLayout2i2i2i12",tu);class Il extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,A,d){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,s,A,d)}emplace(e,i,s,A,d,_){const b=4*e,M=8*e;return this.float32[b+0]=i,this.float32[b+1]=s,this.float32[b+2]=A,this.int16[M+6]=d,this.int16[M+7]=_,e}}Il.prototype.bytesPerElement=16,kt("StructArrayLayout2f1f2i16",Il);class gh extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,A,d,_){const b=this.length;return this.resize(b+1),this.emplace(b,e,i,s,A,d,_)}emplace(e,i,s,A,d,_,b){const M=16*e,I=4*e,k=8*e;return this.uint8[M+0]=i,this.uint8[M+1]=s,this.float32[I+1]=A,this.float32[I+2]=d,this.int16[k+6]=_,this.int16[k+7]=b,e}}gh.prototype.bytesPerElement=16,kt("StructArrayLayout2ub2f2i16",gh);class Pu extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s){const A=this.length;return this.resize(A+1),this.emplace(A,e,i,s)}emplace(e,i,s,A){const d=3*e;return this.uint16[d+0]=i,this.uint16[d+1]=s,this.uint16[d+2]=A,e}}Pu.prototype.bytesPerElement=6,kt("StructArrayLayout3ui6",Pu);class Dl extends Gr{_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(e,i,s,A,d,_,b,M,I,k,F,V,j,H,Q,Y,re){const ge=this.length;return this.resize(ge+1),this.emplace(ge,e,i,s,A,d,_,b,M,I,k,F,V,j,H,Q,Y,re)}emplace(e,i,s,A,d,_,b,M,I,k,F,V,j,H,Q,Y,re,ge){const oe=24*e,ue=12*e,ve=48*e;return this.int16[oe+0]=i,this.int16[oe+1]=s,this.uint16[oe+2]=A,this.uint16[oe+3]=d,this.uint32[ue+2]=_,this.uint32[ue+3]=b,this.uint32[ue+4]=M,this.uint16[oe+10]=I,this.uint16[oe+11]=k,this.uint16[oe+12]=F,this.float32[ue+7]=V,this.float32[ue+8]=j,this.uint8[ve+36]=H,this.uint8[ve+37]=Q,this.uint8[ve+38]=Y,this.uint32[ue+10]=re,this.int16[oe+22]=ge,e}}Dl.prototype.bytesPerElement=48,kt("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Dl);class yh extends Gr{_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(e,i,s,A,d,_,b,M,I,k,F,V,j,H,Q,Y,re,ge,oe,ue,ve,Te,Ue,lt,nt,dt,Tt,mt){const st=this.length;return this.resize(st+1),this.emplace(st,e,i,s,A,d,_,b,M,I,k,F,V,j,H,Q,Y,re,ge,oe,ue,ve,Te,Ue,lt,nt,dt,Tt,mt)}emplace(e,i,s,A,d,_,b,M,I,k,F,V,j,H,Q,Y,re,ge,oe,ue,ve,Te,Ue,lt,nt,dt,Tt,mt,st){const Xe=32*e,Lt=16*e;return this.int16[Xe+0]=i,this.int16[Xe+1]=s,this.int16[Xe+2]=A,this.int16[Xe+3]=d,this.int16[Xe+4]=_,this.int16[Xe+5]=b,this.int16[Xe+6]=M,this.int16[Xe+7]=I,this.uint16[Xe+8]=k,this.uint16[Xe+9]=F,this.uint16[Xe+10]=V,this.uint16[Xe+11]=j,this.uint16[Xe+12]=H,this.uint16[Xe+13]=Q,this.uint16[Xe+14]=Y,this.uint16[Xe+15]=re,this.uint16[Xe+16]=ge,this.uint16[Xe+17]=oe,this.uint16[Xe+18]=ue,this.uint16[Xe+19]=ve,this.uint16[Xe+20]=Te,this.uint16[Xe+21]=Ue,this.uint16[Xe+22]=lt,this.uint32[Lt+12]=nt,this.float32[Lt+13]=dt,this.float32[Lt+14]=Tt,this.uint16[Xe+30]=mt,this.uint16[Xe+31]=st,e}}yh.prototype.bytesPerElement=64,kt("StructArrayLayout8i15ui1ul2f2ui64",yh);class Gu extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}Gu.prototype.bytesPerElement=4,kt("StructArrayLayout1f4",Gu);class qu extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const A=this.length;return this.resize(A+1),this.emplace(A,e,i,s)}emplace(e,i,s,A){const d=3*e;return this.uint16[6*e+0]=i,this.float32[d+1]=s,this.float32[d+2]=A,e}}qu.prototype.bytesPerElement=12,kt("StructArrayLayout1ui2f12",qu);class vh extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s){const A=this.length;return this.resize(A+1),this.emplace(A,e,i,s)}emplace(e,i,s,A){const d=4*e;return this.uint32[2*e+0]=i,this.uint16[d+2]=s,this.uint16[d+3]=A,e}}vh.prototype.bytesPerElement=8,kt("StructArrayLayout1ul2ui8",vh);class y extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const A=2*e;return this.uint16[A+0]=i,this.uint16[A+1]=s,e}}y.prototype.bytesPerElement=4,kt("StructArrayLayout2ui4",y);class t extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}t.prototype.bytesPerElement=2,kt("StructArrayLayout1ui2",t);class n extends Gr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,A){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,s,A)}emplace(e,i,s,A,d){const _=4*e;return this.float32[_+0]=i,this.float32[_+1]=s,this.float32[_+2]=A,this.float32[_+3]=d,e}}n.prototype.bytesPerElement=16,kt("StructArrayLayout4f16",n);class h extends vu{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 it(this.anchorPointX,this.anchorPointY)}}h.prototype.size=20;class f extends _h{get(e){return new h(this,e)}}kt("CollisionBoxArray",f);class x extends vu{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(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}x.prototype.size=48;class T extends Dl{get(e){return new x(this,e)}}kt("PlacedSymbolArray",T);class C extends vu{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(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}C.prototype.size=64;class D extends yh{get(e){return new C(this,e)}}kt("SymbolInstanceArray",D);class B extends Gu{getoffsetX(e){return this.float32[1*e+0]}}kt("GlyphOffsetArray",B);class N extends Vu{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}kt("SymbolLineVertexArray",N);class G extends vu{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}G.prototype.size=12;class U extends qu{get(e){return new G(this,e)}}kt("TextAnchorOffsetArray",U);class $ extends vu{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]}}$.prototype.size=8;class ie extends vh{get(e){return new $(this,e)}}kt("FeatureIndexArray",ie);class he extends xu{}class Ae extends xu{}class ce extends xu{}class ye extends ju{}class Pe extends mh{}class _e extends bu{}class we extends Na{}class Ce extends Zu{}class be extends wu{}class Le extends Uu{}class Ke extends Tu{}class He extends tu{}class $e extends gh{}class Ye extends Pu{}class xt extends y{}const wt=on([{name:"a_pos",components:2,type:"Int16"}],4),{members:pt}=wt;class Pt{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,i,s,A){const d=this.segments[this.segments.length-1];return e>Pt.MAX_VERTEX_ARRAY_LENGTH&&en(`Max vertices per segment is ${Pt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${Pt.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!d||d.vertexLength+e>Pt.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==A?this.createNewSegment(i,s,A):d}createNewSegment(e,i,s){const A={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0,vaos:{}};return s!==void 0&&(A.sortKey=s),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(A),A}getOrCreateLatestSegment(e,i,s){return this.prepareSegment(0,e,i,s)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,s,A){return new Pt([{vertexOffset:e,primitiveOffset:i,vertexLength:s,primitiveLength:A,vaos:{},sortKey:0}])}}function mi(r,e){return 256*(r=Ai(Math.floor(r),0,255))+Ai(Math.floor(e),0,255)}Pt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,kt("SegmentVector",Pt);const sr=on([{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"}]),Dr=on([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var mr,Rr,_r,Yr={exports:{}},Fr={exports:{}},rs={exports:{}},dn=(function(){if(_r)return Yr.exports;_r=1;var r=(mr||(mr=1,Fr.exports=function(i,s){var A,d,_,b,M,I,k,F;for(d=i.length-(A=3&i.length),_=s,M=3432918353,I=461845907,F=0;F<d;)k=255&i.charCodeAt(F)|(255&i.charCodeAt(++F))<<8|(255&i.charCodeAt(++F))<<16|(255&i.charCodeAt(++F))<<24,++F,_=27492+(65535&(b=5*(65535&(_=(_^=k=(65535&(k=(k=(65535&k)*M+(((k>>>16)*M&65535)<<16)&4294967295)<<15|k>>>17))*I+(((k>>>16)*I&65535)<<16)&4294967295)<<13|_>>>19))+((5*(_>>>16)&65535)<<16)&4294967295))+((58964+(b>>>16)&65535)<<16);switch(k=0,A){case 3:k^=(255&i.charCodeAt(F+2))<<16;case 2:k^=(255&i.charCodeAt(F+1))<<8;case 1:_^=k=(65535&(k=(k=(65535&(k^=255&i.charCodeAt(F)))*M+(((k>>>16)*M&65535)<<16)&4294967295)<<15|k>>>17))*I+(((k>>>16)*I&65535)<<16)&4294967295}return _^=i.length,_=2246822507*(65535&(_^=_>>>16))+((2246822507*(_>>>16)&65535)<<16)&4294967295,_=3266489909*(65535&(_^=_>>>13))+((3266489909*(_>>>16)&65535)<<16)&4294967295,(_^=_>>>16)>>>0}),Fr.exports),e=(Rr||(Rr=1,rs.exports=function(i,s){for(var A,d=i.length,_=s^d,b=0;d>=4;)A=1540483477*(65535&(A=255&i.charCodeAt(b)|(255&i.charCodeAt(++b))<<8|(255&i.charCodeAt(++b))<<16|(255&i.charCodeAt(++b))<<24))+((1540483477*(A>>>16)&65535)<<16),_=1540483477*(65535&_)+((1540483477*(_>>>16)&65535)<<16)^(A=1540483477*(65535&(A^=A>>>24))+((1540483477*(A>>>16)&65535)<<16)),d-=4,++b;switch(d){case 3:_^=(255&i.charCodeAt(b+2))<<16;case 2:_^=(255&i.charCodeAt(b+1))<<8;case 1:_=1540483477*(65535&(_^=255&i.charCodeAt(b)))+((1540483477*(_>>>16)&65535)<<16)}return _=1540483477*(65535&(_^=_>>>13))+((1540483477*(_>>>16)&65535)<<16),(_^=_>>>15)>>>0}),rs.exports);return Yr.exports=r,Yr.exports.murmur3=r,Yr.exports.murmur2=e,Yr.exports})(),an=ur(dn);class ms{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,i,s,A){this.ids.push(cl(e)),this.positions.push(i,s,A)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const i=cl(e);let s=0,A=this.ids.length-1;for(;s<A;){const _=s+A>>1;this.ids[_]>=i?A=_:s=_+1}const d=[];for(;this.ids[s]===i;)d.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return d}static serialize(e,i){const s=new Float64Array(e.ids),A=new Uint32Array(e.positions);return Va(s,A,0,s.length-1),i&&i.push(s.buffer,A.buffer),{ids:s,positions:A}}static deserialize(e){const i=new ms;return i.ids=e.ids,i.positions=e.positions,i.indexed=!0,i}}function cl(r){const e=+r;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:an(String(r))}function Va(r,e,i,s){for(;i<s;){const A=r[i+s>>1];let d=i-1,_=s+1;for(;;){do d++;while(r[d]<A);do _--;while(r[_]>A);if(d>=_)break;wa(r,d,_),wa(e,3*d,3*_),wa(e,3*d+1,3*_+1),wa(e,3*d+2,3*_+2)}_-i<s-_?(Va(r,e,i,_),i=_+1):(Va(r,e,_+1,s),s=_)}}function wa(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}kt("FeaturePositionMap",ms);class eo{constructor(e,i){this.gl=e.gl,this.location=i}}class kl extends eo{constructor(e,i){super(e,i),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Mu extends eo{constructor(e,i){super(e,i),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class zl extends eo{constructor(e,i){super(e,i),this.current=oi.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const zo=new Float32Array(16);function Ta(r){return[mi(255*r.r,255*r.g),mi(255*r.b,255*r.a)]}class na{constructor(e,i,s){this.value=e,this.uniformNames=i.map((A=>`u_${A}`)),this.type=s}setUniform(e,i,s){e.set(s.constantOr(this.value))}getBinding(e,i,s){return this.type==="color"?new zl(e,i):new kl(e,i)}}class sa{constructor(e,i){this.uniformNames=i.map((s=>`u_${s}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,i){this.pixelRatioFrom=i.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=i.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,i){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,i.y,i.height,i.width]}setUniform(e,i,s,A){let d=null;A==="u_pattern_to"?d=this.patternTo:A==="u_pattern_from"?d=this.patternFrom:A==="u_dasharray_to"?d=this.dashTo:A==="u_dasharray_from"?d=this.dashFrom:A==="u_pixel_ratio_to"?d=this.pixelRatioTo:A==="u_pixel_ratio_from"&&(d=this.pixelRatioFrom),d!==null&&e.set(d)}getBinding(e,i,s){return s.substr(0,9)==="u_pattern"||s.substr(0,12)==="u_dasharray_"?new Mu(e,i):new kl(e,i)}}class Tr{constructor(e,i,s,A){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=i.map((d=>({name:`a_${d}`,type:"Float32",components:s==="color"?2:1,offset:0}))),this.paintVertexArray=new A}populatePaintArray(e,i,s){const A=this.paintVertexArray.length,d=this.expression.evaluate(new ze(0,s),i,{},s.canonical,[],s.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(A,e,d)}updatePaintArray(e,i,s,A,d){const _=this.expression.evaluate(new ze(0,d),s,A);this._setPaintValue(e,i,_)}_setPaintValue(e,i,s){if(this.type==="color"){const A=Ta(s);for(let d=e;d<i;d++)this.paintVertexArray.emplace(d,A[0],A[1])}else{for(let A=e;A<i;A++)this.paintVertexArray.emplace(A,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class gr{constructor(e,i,s,A,d,_){this.expression=e,this.uniformNames=i.map((b=>`u_${b}_t`)),this.type=s,this.useIntegerZoom=A,this.zoom=d,this.maxValue=0,this.paintVertexAttributes=i.map((b=>({name:`a_${b}`,type:"Float32",components:s==="color"?4:2,offset:0}))),this.paintVertexArray=new _}populatePaintArray(e,i,s){const A=this.expression.evaluate(new ze(this.zoom,s),i,{},s.canonical,[],s.formattedSection),d=this.expression.evaluate(new ze(this.zoom+1,s),i,{},s.canonical,[],s.formattedSection),_=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(_,e,A,d)}updatePaintArray(e,i,s,A,d){const _=this.expression.evaluate(new ze(this.zoom,d),s,A),b=this.expression.evaluate(new ze(this.zoom+1,d),s,A);this._setPaintValue(e,i,_,b)}_setPaintValue(e,i,s,A){if(this.type==="color"){const d=Ta(s),_=Ta(A);for(let b=e;b<i;b++)this.paintVertexArray.emplace(b,d[0],d[1],_[0],_[1])}else{for(let d=e;d<i;d++)this.paintVertexArray.emplace(d,s,A);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(A))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i){const s=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,A=Ai(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(A)}getBinding(e,i,s){return new kl(e,i)}}class Vn{constructor(e,i,s,A,d,_){this.expression=e,this.type=i,this.useIntegerZoom=s,this.zoom=A,this.layerId=_,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}populatePaintArray(e,i,s){const A=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(A,e,this.getPositionIds(i),s)}updatePaintArray(e,i,s,A,d){this._setPaintValues(e,i,this.getPositionIds(s),d)}_setPaintValues(e,i,s,A){const d=this.getPositions(A);if(!d||!s)return;const _=d[s.min],b=d[s.mid],M=d[s.max];if(_&&b&&M)for(let I=e;I<i;I++)this.emplace(this.zoomInPaintVertexArray,I,b,_),this.emplace(this.zoomOutPaintVertexArray,I,b,M)}upload(e){if(this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer){const i=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,i,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,i,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class jn extends Vn{getPositions(e){return e.imagePositions}getPositionIds(e){return e.patterns&&e.patterns[this.layerId]}getVertexAttributes(){return sr.members}emplace(e,i,s,A){e.emplace(i,s.tlbr[0],s.tlbr[1],s.tlbr[2],s.tlbr[3],A.tlbr[0],A.tlbr[1],A.tlbr[2],A.tlbr[3],s.pixelRatio,A.pixelRatio)}}class $h extends Vn{getPositions(e){return e.dashPositions}getPositionIds(e){return e.dashes&&e.dashes[this.layerId]}getVertexAttributes(){return Dr.members}emplace(e,i,s,A){e.emplace(i,0,s.y,s.height,s.width,0,A.y,A.height,A.width)}}class Yh{constructor(e,i,s){this.binders={},this._buffers=[];const A=[];for(const d in e.paint._values){if(!s(d))continue;const _=e.paint.get(d);if(!(_ instanceof Vt&&co(_.property.specification)))continue;const b=kc(d,e.type),M=_.value,I=_.property.specification.type,k=_.property.useIntegerZoom,F=_.property.specification["property-type"],V=F==="cross-faded"||F==="cross-faded-data-driven";if(M.kind==="constant")this.binders[d]=V?new sa(M.value,b):new na(M.value,b,I),A.push(`/u_${d}`);else if(M.kind==="source"||V){const j=Xh(d,I,"source");this.binders[d]=V?d==="line-dasharray"?new $h(M,I,k,i,j,e.id):new jn(M,I,k,i,j,e.id):new Tr(M,b,I,j),A.push(`/a_${d}`)}else{const j=Xh(d,I,"composite");this.binders[d]=new gr(M,b,I,k,i,j),A.push(`/z_${d}`)}}this.cacheKey=A.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof Tr||i instanceof gr?i.maxValue:0}populatePaintArrays(e,i,s){for(const A in this.binders){const d=this.binders[A];(d instanceof Tr||d instanceof gr||d instanceof Vn)&&d.populatePaintArray(e,i,s)}}setConstantPatternPositions(e,i){for(const s in this.binders){const A=this.binders[s];A instanceof sa&&A.setConstantPatternPositions(e,i)}}setConstantDashPositions(e,i){for(const s in this.binders){const A=this.binders[s];A instanceof sa&&A.setConstantDashPositions(e,i)}}updatePaintArrays(e,i,s,A,d){let _=!1;for(const b in e){const M=i.getPositions(b);for(const I of M){const k=s.feature(I.index);for(const F in this.binders){const V=this.binders[F];if((V instanceof Tr||V instanceof gr||V instanceof Vn)&&V.expression.isStateDependent===!0){const j=A.paint.get(F);V.expression=j.value,V.updatePaintArray(I.start,I.end,k,e[b],d),_=!0}}}}return _}defines(){const e=[];for(const i in this.binders){const s=this.binders[i];(s instanceof na||s instanceof sa)&&e.push(...s.uniformNames.map((A=>`#define HAS_UNIFORM_${A}`)))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof Tr||s instanceof gr)for(let A=0;A<s.paintVertexAttributes.length;A++)e.push(s.paintVertexAttributes[A].name);else if(s instanceof Vn){const A=s.getVertexAttributes();for(const d of A)e.push(d.name)}}return e}getBinderUniforms(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof na||s instanceof sa||s instanceof gr)for(const A of s.uniformNames)e.push(A)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,i){const s=[];for(const A in this.binders){const d=this.binders[A];if(d instanceof na||d instanceof sa||d instanceof gr){for(const _ of d.uniformNames)if(i[_]){const b=d.getBinding(e,i[_],_);s.push({name:_,property:A,binding:b})}}}return s}setUniforms(e,i,s,A){for(const{name:d,property:_,binding:b}of i)this.binders[_].setUniform(b,A,s.get(_),d)}updatePaintBuffers(e){this._buffers=[];for(const i in this.binders){const s=this.binders[i];if(e&&s instanceof Vn){const A=e.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;A&&this._buffers.push(A)}else(s instanceof Tr||s instanceof gr)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(e){for(const i in this.binders){const s=this.binders[i];(s instanceof Tr||s instanceof gr||s instanceof Vn)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof Tr||i instanceof gr||i instanceof Vn)&&i.destroy()}}}class Ll{constructor(e,i,s=()=>!0){this.programConfigurations={};for(const A of e)this.programConfigurations[A.id]=new Yh(A,i,s);this.needsUpload=!1,this._featureMap=new ms,this._bufferOffset=0}populatePaintArrays(e,i,s,A){for(const d in this.programConfigurations)this.programConfigurations[d].populatePaintArrays(e,i,A);i.id!==void 0&&this._featureMap.add(i.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,s,A){for(const d of s)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(e,this._featureMap,i,d,A)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function kc(r,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-dasharray":["dasharray_to","dasharray_from"],"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"]}[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}function Xh(r,e,i){const s={color:{source:bu,composite:n},number:{source:Gu,composite:bu}},A=(function(d){return{"line-pattern":{source:we,composite:we},"fill-pattern":{source:we,composite:we},"fill-extrusion-pattern":{source:we,composite:we},"line-dasharray":{source:Ce,composite:Ce}}[d]})(r);return A&&A[i]||s[e][i]}kt("ConstantBinder",na),kt("CrossFadedConstantBinder",sa),kt("SourceExpressionBinder",Tr),kt("CrossFadedPatternBinder",jn),kt("CrossFadedDasharrayBinder",$h),kt("CompositeExpressionBinder",gr),kt("ProgramConfiguration",Yh,{omit:["_buffers"]}),kt("ProgramConfigurationSet",Ll);const xh=Math.pow(2,14)-1,Al=-xh-1;function fl(r){const e=Oi/r.extent,i=r.loadGeometry();for(let s=0;s<i.length;s++){const A=i[s];for(let d=0;d<A.length;d++){const _=A[d],b=Math.round(_.x*e),M=Math.round(_.y*e);_.x=Ai(b,Al,xh),_.y=Ai(M,Al,xh),(b<_.x||b>_.x+1||M<_.y||M>_.y+1)&&en("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function dl(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?fl(r):[]}}const bh=-32768;function wh(r,e,i,s,A){r.emplaceBack(bh+8*e+s,bh+8*i+A)}class Hu{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Ae,this.indexArray=new Ye,this.segments=new Pt,this.programConfigurations=new Ll(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){const A=this.layers[0],d=[];let _=null,b=!1,M=A.type==="heatmap";if(A.type==="circle"){const k=A;_=k.layout.get("circle-sort-key"),b=!_.isConstant(),M=M||k.paint.get("circle-pitch-alignment")==="map"}const I=M?i.subdivisionGranularity.circle:1;for(const{feature:k,id:F,index:V,sourceLayerIndex:j}of e){const H=this.layers[0]._featureFilter.needGeometry,Q=dl(k,H);if(!this.layers[0]._featureFilter.filter(new ze(this.zoom),Q,s))continue;const Y=b?_.evaluate(Q,{},s):void 0,re={id:F,properties:k.properties,type:k.type,sourceLayerIndex:j,index:V,geometry:H?Q.geometry:fl(k),patterns:{},sortKey:Y};d.push(re)}b&&d.sort(((k,F)=>k.sortKey-F.sortKey));for(const k of d){const{geometry:F,index:V,sourceLayerIndex:j}=k,H=e[V].feature;this.addFeature(k,F,V,s,I),i.featureIndex.insert(H,F,V,j,this.index)}}update(e,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,pt),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,s,A,d=1){let _;switch(d){case 1:_=[0,7];break;case 3:_=[0,2,5,7];break;case 5:_=[0,1,3,4,6,7];break;case 7:_=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${d}; valid values are 1, 3, 5, 7.`)}const b=_.length;for(const M of i)for(const I of M){const k=I.x,F=I.y;if(k<0||k>=Oi||F<0||F>=Oi)continue;const V=this.segments.prepareSegment(b*b,this.layoutVertexArray,this.indexArray,e.sortKey),j=V.vertexLength;for(let H=0;H<b;H++)for(let Q=0;Q<b;Q++)wh(this.layoutVertexArray,k,F,_[Q],_[H]);for(let H=0;H<b-1;H++)for(let Q=0;Q<b-1;Q++){const Y=j+H*b+Q,re=j+(H+1)*b+Q;this.indexArray.emplaceBack(Y,re+1,Y+1),this.indexArray.emplaceBack(Y,re,re+1)}V.vertexLength+=b*b,V.primitiveLength+=(b-1)*(b-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:{},canonical:A})}}function Wu(r,e){for(let i=0;i<r.length;i++)if(Qu(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Qu(r,e[i]))return!0;return!!zc(r,e)}function Kh(r,e,i){return!!Qu(r,e)||!!Lc(e,r,i)}function LA(r,e){if(r.length===1)return RA(e,r[0]);for(let i=0;i<e.length;i++){const s=e[i];for(let A=0;A<s.length;A++)if(Qu(r,s[A]))return!0}for(let i=0;i<r.length;i++)if(RA(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(zc(r,e[i]))return!0;return!1}function vp(r,e,i){if(r.length>1){if(zc(r,e))return!0;for(let s=0;s<e.length;s++)if(Lc(e[s],r,i))return!0}for(let s=0;s<r.length;s++)if(Lc(r[s],e,i))return!0;return!1}function zc(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const s=r[i],A=r[i+1];for(let d=0;d<e.length-1;d++)if(xp(s,A,e[d],e[d+1]))return!0}return!1}function xp(r,e,i,s){return hs(r,i,s)!==hs(e,i,s)&&hs(r,e,i)!==hs(r,e,s)}function Lc(r,e,i){const s=i*i;if(e.length===1)return r.distSqr(e[0])<s;for(let A=1;A<e.length;A++)if(BA(r,e[A-1],e[A])<s)return!0;return!1}function BA(r,e,i){const s=e.distSqr(i);if(s===0)return r.distSqr(e);const A=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/s;return r.distSqr(A<0?e:A>1?i:i.sub(e)._mult(A)._add(e))}function RA(r,e){let i,s,A,d=!1;for(let _=0;_<r.length;_++){i=r[_];for(let b=0,M=i.length-1;b<i.length;M=b++)s=i[b],A=i[M],s.y>e.y!=A.y>e.y&&e.x<(A.x-s.x)*(e.y-s.y)/(A.y-s.y)+s.x&&(d=!d)}return d}function Qu(r,e){let i=!1;for(let s=0,A=r.length-1;s<r.length;A=s++){const d=r[s],_=r[A];d.y>e.y!=_.y>e.y&&e.x<(_.x-d.x)*(e.y-d.y)/(_.y-d.y)+d.x&&(i=!i)}return i}function bp(r,e,i){const s=i[0],A=i[2];if(r.x<s.x&&e.x<s.x||r.x>A.x&&e.x>A.x||r.y<s.y&&e.y<s.y||r.y>A.y&&e.y>A.y)return!1;const d=hs(r,e,i[0]);return d!==hs(r,e,i[1])||d!==hs(r,e,i[2])||d!==hs(r,e,i[3])}function $u(r,e,i){const s=e.paint.get(r).value;return s.kind==="constant"?s.value:i.programConfigurations.get(e.id).getMaxValue(r)}function Jh(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function ec(r,e,i,s,A){if(!e[0]&&!e[1])return r;const d=it.convert(e)._mult(A);i==="viewport"&&d._rotate(-s);const _=[];for(let b=0;b<r.length;b++)_.push(r[b].sub(d));return _}function wp(r){const e=[];for(let i=0;i<r.length;i++){const s=r[i],A=e.at(-1);(i===0||A&&!s.equals(A))&&e.push(s)}return e}function Tp({queryGeometry:r,size:e},i){return Kh(r,i,e)}function Pp({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:A},d){return Kh(r,d,e*(i.projectTileCoordinates(d.x,d.y,s,A).signedDistanceFromCamera/i.cameraToCenterDistance))}function Mp({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:A},d){const _=i.projectTileCoordinates(d.x,d.y,s,A).signedDistanceFromCamera,b=e*(i.cameraToCenterDistance/_);return Kh(r,Bc(d,i,s,A),b)}function Ep({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:A},d){return Kh(r,Bc(d,i,s,A),e)}function FA({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:A,pitchAlignment:d="map",pitchScale:_="map"},b){const M=d==="map"?_==="map"?Tp:Pp:_==="map"?Mp:Ep,I={queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:A};for(const k of b)for(const F of k)if(M(I,F))return!0;return!1}function Bc(r,e,i,s){const A=e.projectTileCoordinates(r.x,r.y,i,s).point;return new it((.5*A.x+.5)*e.width,(.5*-A.y+.5)*e.height)}let OA,NA;kt("CircleBucket",Hu,{omit:["layers"]});var Sp={get paint(){return NA=NA||new is({"circle-radius":new Mt(qe.paint_circle["circle-radius"]),"circle-color":new Mt(qe.paint_circle["circle-color"]),"circle-blur":new Mt(qe.paint_circle["circle-blur"]),"circle-opacity":new Mt(qe.paint_circle["circle-opacity"]),"circle-translate":new _t(qe.paint_circle["circle-translate"]),"circle-translate-anchor":new _t(qe.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new _t(qe.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new _t(qe.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Mt(qe.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Mt(qe.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Mt(qe.paint_circle["circle-stroke-opacity"])})},get layout(){return OA=OA||new is({"circle-sort-key":new Mt(qe.layout_circle["circle-sort-key"])})}};class Cp extends ko{constructor(e,i){super(e,Sp,i)}createBucket(e){return new Hu(e)}queryRadius(e){const i=e;return $u("circle-radius",this,i)+$u("circle-stroke-width",this,i)+Jh(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:A,transform:d,pixelsToTileUnits:_,unwrappedTileID:b,getElevation:M}){const I=ec(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-d.bearingInRadians,_),k=this.paint.get("circle-radius").evaluate(i,s)+this.paint.get("circle-stroke-width").evaluate(i,s),F=this.paint.get("circle-pitch-scale"),V=this.paint.get("circle-pitch-alignment");let j,H;return V==="map"?(j=I,H=k*_):(j=(function(Q,Y,re,ge){return Q.map((oe=>Bc(oe,Y,re,ge)))})(I,d,b,M),H=k),FA({queryGeometry:j,size:H,transform:d,unwrappedTileID:b,getElevation:M,pitchAlignment:V,pitchScale:F},A)}}class VA extends Hu{}let jA;kt("HeatmapBucket",VA,{omit:["layers"]});var Ip={get paint(){return jA=jA||new is({"heatmap-radius":new Mt(qe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Mt(qe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new _t(qe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new wn(qe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new _t(qe.paint_heatmap["heatmap-opacity"])})}};function Rc(r,{width:e,height:i},s,A){if(A){if(A instanceof Uint8ClampedArray)A=new Uint8Array(A.buffer);else if(A.length!==e*i*s)throw new RangeError(`mismatched image size. expected: ${A.length} but got: ${e*i*s}`)}else A=new Uint8Array(e*i*s);return r.width=e,r.height=i,r.data=A,r}function ZA(r,{width:e,height:i},s){if(e===r.width&&i===r.height)return;const A=Rc({},{width:e,height:i},s);Fc(r,A,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,e),height:Math.min(r.height,i)},s),r.width=e,r.height=i,r.data=A.data}function Fc(r,e,i,s,A,d){if(A.width===0||A.height===0)return e;if(A.width>r.width||A.height>r.height||i.x>r.width-A.width||i.y>r.height-A.height)throw new RangeError("out of range source coordinates for image copy");if(A.width>e.width||A.height>e.height||s.x>e.width-A.width||s.y>e.height-A.height)throw new RangeError("out of range destination coordinates for image copy");const _=r.data,b=e.data;if(_===b)throw new Error("srcData equals dstData, so image is already copied");for(let M=0;M<A.height;M++){const I=((i.y+M)*r.width+i.x)*d,k=((s.y+M)*e.width+s.x)*d;for(let F=0;F<A.width*d;F++)b[k+F]=_[I+F]}return e}class Th{constructor(e,i){Rc(this,e,1,i)}resize(e){ZA(this,e,1)}clone(){return new Th({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,A,d){Fc(e,i,s,A,d,1)}}class mo{constructor(e,i){Rc(this,e,4,i)}resize(e){ZA(this,e,4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new mo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,A,d){Fc(e,i,s,A,d,4)}setPixel(e,i,s){const A=4*(e*this.width+i);this.data[A+0]=Math.round(255*s.r/s.a),this.data[A+1]=Math.round(255*s.g/s.a),this.data[A+2]=Math.round(255*s.b/s.a),this.data[A+3]=Math.round(255*s.a)}}function UA(r){const e={},i=r.resolution||256,s=r.clips?r.clips.length:1,A=r.image||new mo({width:i,height:s});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const d=(_,b,M)=>{e[r.evaluationKey]=M;const I=r.expression.evaluate(e);A.setPixel(_/4/i,b/4,I)};if(r.clips)for(let _=0,b=0;_<s;++_,b+=4*i)for(let M=0,I=0;M<i;M++,I+=4){const k=M/(i-1),{start:F,end:V}=r.clips[_];d(b,I,F*(1-k)+V*k)}else for(let _=0,b=0;_<i;_++,b+=4)d(0,b,_/(i-1));return A}kt("AlphaImage",Th),kt("RGBAImage",mo);const Oc="big-fb";class Dp extends ko{createBucket(e){return new VA(e)}constructor(e,i){super(e,Ip,i),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=UA({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Oc)&&this.heatmapFbos.delete(Oc)}queryRadius(e){return $u("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:A,transform:d,pixelsToTileUnits:_,unwrappedTileID:b,getElevation:M}){return FA({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(i,s)*_,transform:d,unwrappedTileID:b,getElevation:M},A)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&!this.isHidden()}}let GA;var kp={get paint(){return GA=GA||new is({"hillshade-illumination-direction":new _t(qe.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new _t(qe.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new _t(qe.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new _t(qe.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new _t(qe.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new _t(qe.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new _t(qe.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new _t(qe.paint_hillshade["hillshade-method"])})}};class zp extends ko{constructor(e,i){super(e,kp,i),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,i=this.paint.get("hillshade-illumination-altitude").values,s=this.paint.get("hillshade-highlight-color").values,A=this.paint.get("hillshade-shadow-color").values;const d=Math.max(e.length,i.length,s.length,A.length);e=e.concat(Array(d-e.length).fill(e.at(-1))),i=i.concat(Array(d-i.length).fill(i.at(-1))),s=s.concat(Array(d-s.length).fill(s.at(-1))),A=A.concat(Array(d-A.length).fill(A.at(-1)));const _=i.map(Ds);return{directionRadians:e.map(Ds),altitudeRadians:_,shadowColor:A,highlightColor:s}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}}let qA;var Lp={get paint(){return qA=qA||new is({"color-relief-opacity":new _t(qe["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new wn(qe["paint_color-relief"]["color-relief-color"])})}};class Nc{constructor(e,i,s,A){this.context=e,this.format=s,this.texture=e.gl.createTexture(),this.update(i,A)}update(e,i,s){const{width:A,height:d}=e,_=!(this.size&&this.size[0]===A&&this.size[1]===d||s),{context:b}=this,{gl:M}=b;if(this.useMipmap=!!(i&&i.useMipmap),M.bindTexture(M.TEXTURE_2D,this.texture),b.pixelStoreUnpackFlipY.set(!1),b.pixelStoreUnpack.set(1),b.pixelStoreUnpackPremultiplyAlpha.set(this.format===M.RGBA&&(!i||i.premultiply!==!1)),_)this.size=[A,d],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||Dn(e)?M.texImage2D(M.TEXTURE_2D,0,this.format,this.format,M.UNSIGNED_BYTE,e):M.texImage2D(M.TEXTURE_2D,0,this.format,A,d,0,this.format,M.UNSIGNED_BYTE,e.data);else{const{x:I,y:k}=s||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||Dn(e)?M.texSubImage2D(M.TEXTURE_2D,0,I,k,M.RGBA,M.UNSIGNED_BYTE,e):M.texSubImage2D(M.TEXTURE_2D,0,I,k,A,d,M.RGBA,M.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&M.generateMipmap(M.TEXTURE_2D),b.pixelStoreUnpackFlipY.setDefault(),b.pixelStoreUnpack.setDefault(),b.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,i,s){const{context:A}=this,{gl:d}=A;d.bindTexture(d.TEXTURE_2D,this.texture),s!==d.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=d.LINEAR),e!==this.filter&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,e),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,s||e),this.filter=e),i!==this.wrap&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,i),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,i),this.wrap=i)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class HA{constructor(e,i,s,A=1,d=1,_=1,b=0){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(s&&!["mapbox","terrarium","custom"].includes(s))return void en(`"${s}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=i.height;const M=this.dim=i.height-2;switch(this.data=new Uint32Array(i.data.buffer),s){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=A,this.greenFactor=d,this.blueFactor=_,this.baseShift=b;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let I=0;I<M;I++)this.data[this._idx(-1,I)]=this.data[this._idx(0,I)],this.data[this._idx(M,I)]=this.data[this._idx(M-1,I)],this.data[this._idx(I,-1)]=this.data[this._idx(I,0)],this.data[this._idx(I,M)]=this.data[this._idx(I,M-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(M,-1)]=this.data[this._idx(M-1,0)],this.data[this._idx(-1,M)]=this.data[this._idx(0,M-1)],this.data[this._idx(M,M)]=this.data[this._idx(M-1,M-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let I=0;I<M;I++)for(let k=0;k<M;k++){const F=this.get(I,k);F>this.max&&(this.max=F),F<this.min&&(this.min=F)}}get(e,i){const s=new Uint8Array(this.data.buffer),A=4*this._idx(e,i);return this.unpack(s[A],s[A+1],s[A+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${i}, dim: ${this.dim}`);return(i+1)*this.stride+(e+1)}unpack(e,i,s){return e*this.redFactor+i*this.greenFactor+s*this.blueFactor-this.baseShift}pack(e){return WA(e,this.getUnpackVector())}getPixels(){return new mo({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,i,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let A=i*this.dim,d=i*this.dim+this.dim,_=s*this.dim,b=s*this.dim+this.dim;switch(i){case-1:A=d-1;break;case 1:d=A+1}switch(s){case-1:_=b-1;break;case 1:b=_+1}const M=-i*this.dim,I=-s*this.dim;for(let k=_;k<b;k++)for(let F=A;F<d;F++)this.data[this._idx(F,k)]=e.data[this._idx(F+M,k+I)]}}function WA(r,e){const i=e[0],s=e[1],A=e[2],d=e[3],_=Math.min(i,s,A),b=Math.round((r+d)/_);return{r:Math.floor(b*_/i)%256,g:Math.floor(b*_/s)%256,b:Math.floor(b*_/A)%256}}kt("DEMData",HA);class Bp extends ko{constructor(e,i){super(e,Lp,i)}_createColorRamp(e){const i={elevationStops:[],colorStops:[]},s=this._transitionablePaint._values["color-relief-color"].value.expression;if(s instanceof v&&s._styleExpression.expression instanceof xr){this.colorRampExpression=s;const _=s._styleExpression.expression;i.elevationStops=_.labels,i.colorStops=[];for(const b of i.elevationStops)i.colorStops.push(_.evaluate({globals:{elevation:b}}))}if(i.elevationStops.length<1&&(i.elevationStops=[0],i.colorStops=[oi.transparent]),i.elevationStops.length<2&&(i.elevationStops.push(i.elevationStops[0]+1),i.colorStops.push(i.colorStops[0])),i.elevationStops.length<=e)return i;const A={elevationStops:[],colorStops:[]},d=(i.elevationStops.length-1)/(e-1);for(let _=0;_<i.elevationStops.length-.5;_+=d)A.elevationStops.push(i.elevationStops[Math.round(_)]),A.colorStops.push(i.colorStops[Math.round(_)]);return en(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${i.elevationStops.length}`),A}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,i,s){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const A=this._createColorRamp(i),d=new mo({width:A.colorStops.length,height:1}),_=new mo({width:A.colorStops.length,height:1});for(let b=0;b<A.elevationStops.length;b++){const M=WA(A.elevationStops[b],s);_.setPixel(0,b,new oi(M.r/255,M.g/255,M.b/255,1)),d.setPixel(0,b,A.colorStops[b])}return this.colorRampTextures={elevationTexture:new Nc(e,_,e.gl.RGBA),colorTexture:new Nc(e,d,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}const Rp=on([{name:"a_pos",components:2,type:"Int16"}],4),{members:Fp}=Rp;function tc(r,e,i){const s=i.patternDependencies;let A=!1;for(const d of e){const _=d.paint.get(`${r}-pattern`);_.isConstant()||(A=!0);const b=_.constantOr(null);b&&(A=!0,s[b.to]=!0,s[b.from]=!0)}return A}function Vc(r,e,i,s,A){const{zoom:d}=s,_=A.patternDependencies;for(const b of e){const M=b.paint.get(`${r}-pattern`).value;if(M.kind!=="constant"){let I=M.evaluate({zoom:d-1},i,{},A.availableImages),k=M.evaluate({zoom:d},i,{},A.availableImages),F=M.evaluate({zoom:d+1},i,{},A.availableImages);I=I&&I.name?I.name:I,k=k&&k.name?k.name:k,F=F&&F.name?F.name:F,_[I]=!0,_[k]=!0,_[F]=!0,i.patterns[b.id]={min:I,mid:k,max:F}}}return i}function QA(r,e,i,s,A){let d;if(A===(function(_,b,M,I){let k=0;for(let F=b,V=M-I;F<M;F+=I)k+=(_[V]-_[F])*(_[F+1]+_[V+1]),V=F;return k})(r,e,i,s)>0)for(let _=e;_<i;_+=s)d=KA(_/s|0,r[_],r[_+1],d);else for(let _=i-s;_>=e;_-=s)d=KA(_/s|0,r[_],r[_+1],d);return d&&Yu(d,d.next)&&(Sh(d),d=d.next),d}function Eu(r,e){if(!r)return r;e||(e=r);let i,s=r;do if(i=!1,s.steiner||!Yu(s,s.next)&&pn(s.prev,s,s.next)!==0)s=s.next;else{if(Sh(s),s=e=s.prev,s===s.next)break;i=!0}while(i||s!==e);return e}function Ph(r,e,i,s,A,d,_){if(!r)return;!_&&d&&(function(M,I,k,F){let V=M;do V.z===0&&(V.z=jc(V.x,V.y,I,k,F)),V.prevZ=V.prev,V.nextZ=V.next,V=V.next;while(V!==M);V.prevZ.nextZ=null,V.prevZ=null,(function(j){let H,Q=1;do{let Y,re=j;j=null;let ge=null;for(H=0;re;){H++;let oe=re,ue=0;for(let Te=0;Te<Q&&(ue++,oe=oe.nextZ,oe);Te++);let ve=Q;for(;ue>0||ve>0&&oe;)ue!==0&&(ve===0||!oe||re.z<=oe.z)?(Y=re,re=re.nextZ,ue--):(Y=oe,oe=oe.nextZ,ve--),ge?ge.nextZ=Y:j=Y,Y.prevZ=ge,ge=Y;re=oe}ge.nextZ=null,Q*=2}while(H>1)})(V)})(r,s,A,d);let b=r;for(;r.prev!==r.next;){const M=r.prev,I=r.next;if(d?Np(r,s,A,d):Op(r))e.push(M.i,r.i,I.i),Sh(r),r=I.next,b=I.next;else if((r=I)===b){_?_===1?Ph(r=Vp(Eu(r),e),e,i,s,A,d,2):_===2&&jp(r,e,i,s,A,d):Ph(Eu(r),e,i,s,A,d,1);break}}}function Op(r){const e=r.prev,i=r,s=r.next;if(pn(e,i,s)>=0)return!1;const A=e.x,d=i.x,_=s.x,b=e.y,M=i.y,I=s.y,k=Math.min(A,d,_),F=Math.min(b,M,I),V=Math.max(A,d,_),j=Math.max(b,M,I);let H=s.next;for(;H!==e;){if(H.x>=k&&H.x<=V&&H.y>=F&&H.y<=j&&Mh(A,b,d,M,_,I,H.x,H.y)&&pn(H.prev,H,H.next)>=0)return!1;H=H.next}return!0}function Np(r,e,i,s){const A=r.prev,d=r,_=r.next;if(pn(A,d,_)>=0)return!1;const b=A.x,M=d.x,I=_.x,k=A.y,F=d.y,V=_.y,j=Math.min(b,M,I),H=Math.min(k,F,V),Q=Math.max(b,M,I),Y=Math.max(k,F,V),re=jc(j,H,e,i,s),ge=jc(Q,Y,e,i,s);let oe=r.prevZ,ue=r.nextZ;for(;oe&&oe.z>=re&&ue&&ue.z<=ge;){if(oe.x>=j&&oe.x<=Q&&oe.y>=H&&oe.y<=Y&&oe!==A&&oe!==_&&Mh(b,k,M,F,I,V,oe.x,oe.y)&&pn(oe.prev,oe,oe.next)>=0||(oe=oe.prevZ,ue.x>=j&&ue.x<=Q&&ue.y>=H&&ue.y<=Y&&ue!==A&&ue!==_&&Mh(b,k,M,F,I,V,ue.x,ue.y)&&pn(ue.prev,ue,ue.next)>=0))return!1;ue=ue.nextZ}for(;oe&&oe.z>=re;){if(oe.x>=j&&oe.x<=Q&&oe.y>=H&&oe.y<=Y&&oe!==A&&oe!==_&&Mh(b,k,M,F,I,V,oe.x,oe.y)&&pn(oe.prev,oe,oe.next)>=0)return!1;oe=oe.prevZ}for(;ue&&ue.z<=ge;){if(ue.x>=j&&ue.x<=Q&&ue.y>=H&&ue.y<=Y&&ue!==A&&ue!==_&&Mh(b,k,M,F,I,V,ue.x,ue.y)&&pn(ue.prev,ue,ue.next)>=0)return!1;ue=ue.nextZ}return!0}function Vp(r,e){let i=r;do{const s=i.prev,A=i.next.next;!Yu(s,A)&&YA(s,i,i.next,A)&&Eh(s,A)&&Eh(A,s)&&(e.push(s.i,i.i,A.i),Sh(i),Sh(i.next),i=r=A),i=i.next}while(i!==r);return Eu(i)}function jp(r,e,i,s,A,d){let _=r;do{let b=_.next.next;for(;b!==_.prev;){if(_.i!==b.i&&Hp(_,b)){let M=XA(_,b);return _=Eu(_,_.next),M=Eu(M,M.next),Ph(_,e,i,s,A,d,0),void Ph(M,e,i,s,A,d,0)}b=b.next}_=_.next}while(_!==r)}function Zp(r,e){let i=r.x-e.x;return i===0&&(i=r.y-e.y,i===0)&&(i=(r.next.y-r.y)/(r.next.x-r.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function Up(r,e){const i=(function(A,d){let _=d;const b=A.x,M=A.y;let I,k=-1/0;if(Yu(A,_))return _;do{if(Yu(A,_.next))return _.next;if(M<=_.y&&M>=_.next.y&&_.next.y!==_.y){const Q=_.x+(M-_.y)*(_.next.x-_.x)/(_.next.y-_.y);if(Q<=b&&Q>k&&(k=Q,I=_.x<_.next.x?_:_.next,Q===b))return I}_=_.next}while(_!==d);if(!I)return null;const F=I,V=I.x,j=I.y;let H=1/0;_=I;do{if(b>=_.x&&_.x>=V&&b!==_.x&&$A(M<j?b:k,M,V,j,M<j?k:b,M,_.x,_.y)){const Q=Math.abs(M-_.y)/(b-_.x);Eh(_,A)&&(Q<H||Q===H&&(_.x>I.x||_.x===I.x&&Gp(I,_)))&&(I=_,H=Q)}_=_.next}while(_!==F);return I})(r,e);if(!i)return e;const s=XA(i,r);return Eu(s,s.next),Eu(i,i.next)}function Gp(r,e){return pn(r.prev,r,e.prev)<0&&pn(e.next,r,r.next)<0}function jc(r,e,i,s,A){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*A|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*A|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function qp(r){let e=r,i=r;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==r);return i}function $A(r,e,i,s,A,d,_,b){return(A-_)*(e-b)>=(r-_)*(d-b)&&(r-_)*(s-b)>=(i-_)*(e-b)&&(i-_)*(d-b)>=(A-_)*(s-b)}function Mh(r,e,i,s,A,d,_,b){return!(r===_&&e===b)&&$A(r,e,i,s,A,d,_,b)}function Hp(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!(function(i,s){let A=i;do{if(A.i!==i.i&&A.next.i!==i.i&&A.i!==s.i&&A.next.i!==s.i&&YA(A,A.next,i,s))return!0;A=A.next}while(A!==i);return!1})(r,e)&&(Eh(r,e)&&Eh(e,r)&&(function(i,s){let A=i,d=!1;const _=(i.x+s.x)/2,b=(i.y+s.y)/2;do A.y>b!=A.next.y>b&&A.next.y!==A.y&&_<(A.next.x-A.x)*(b-A.y)/(A.next.y-A.y)+A.x&&(d=!d),A=A.next;while(A!==i);return d})(r,e)&&(pn(r.prev,r,e.prev)||pn(r,e.prev,e))||Yu(r,e)&&pn(r.prev,r,r.next)>0&&pn(e.prev,e,e.next)>0)}function pn(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function Yu(r,e){return r.x===e.x&&r.y===e.y}function YA(r,e,i,s){const A=rc(pn(r,e,i)),d=rc(pn(r,e,s)),_=rc(pn(i,s,r)),b=rc(pn(i,s,e));return A!==d&&_!==b||!(A!==0||!ic(r,i,e))||!(d!==0||!ic(r,s,e))||!(_!==0||!ic(i,r,s))||!(b!==0||!ic(i,e,s))}function ic(r,e,i){return e.x<=Math.max(r.x,i.x)&&e.x>=Math.min(r.x,i.x)&&e.y<=Math.max(r.y,i.y)&&e.y>=Math.min(r.y,i.y)}function rc(r){return r>0?1:r<0?-1:0}function Eh(r,e){return pn(r.prev,r,r.next)<0?pn(r,e,r.next)>=0&&pn(r,r.prev,e)>=0:pn(r,e,r.prev)<0||pn(r,r.next,e)<0}function XA(r,e){const i=Zc(r.i,r.x,r.y),s=Zc(e.i,e.x,e.y),A=r.next,d=e.prev;return r.next=e,e.prev=r,i.next=A,A.prev=i,s.next=i,i.prev=s,d.next=s,s.prev=d,s}function KA(r,e,i,s){const A=Zc(r,e,i);return s?(A.next=s.next,A.prev=s,s.next.prev=A,s.next=A):(A.prev=A,A.next=A),A}function Sh(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Zc(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class Xu{constructor(e,i){if(i>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=i}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class nc{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}nc.noSubdivision=new nc({fill:new Xu(0,0),line:new Xu(0,0),tile:new Xu(0,0),stencil:new Xu(0,0),circle:1}),kt("SubdivisionGranularityExpression",Xu),kt("SubdivisionGranularitySetting",nc);const Ku=-32768,Ch=32767;class Wp{constructor(e,i){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=Oi/e,this._canonical=i}_getKey(e,i){return(e+=32768)<<16|i+32768}_vertexToIndex(e,i){if(e<-32768||i<-32768||e>32767||i>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const s=0|Math.round(e),A=0|Math.round(i),d=this._getKey(s,A);if(this._vertexDictionary.has(d))return this._vertexDictionary.get(d);const _=this._vertexBuffer.length/2;return this._vertexDictionary.set(d,_),this._vertexBuffer.push(s,A),_}_subdivideTrianglesScanline(e){if(this._granularity<2)return(function(A,d){const _=[];for(let b=0;b<d.length;b+=3){const M=d[b],I=d[b+1],k=d[b+2],F=A[2*M],V=A[2*M+1];(A[2*I]-F)*(A[2*k+1]-V)-(A[2*I+1]-V)*(A[2*k]-F)>0?(_.push(M),_.push(k),_.push(I)):(_.push(M),_.push(I),_.push(k))}return _})(this._vertexBuffer,e);const i=[],s=e.length;for(let A=0;A<s;A+=3){const d=[e[A+0],e[A+1],e[A+2]],_=[this._vertexBuffer[2*e[A+0]+0],this._vertexBuffer[2*e[A+0]+1],this._vertexBuffer[2*e[A+1]+0],this._vertexBuffer[2*e[A+1]+1],this._vertexBuffer[2*e[A+2]+0],this._vertexBuffer[2*e[A+2]+1]];let b=1/0,M=1/0,I=-1/0,k=-1/0;for(let Q=0;Q<3;Q++){const Y=_[2*Q],re=_[2*Q+1];b=Math.min(b,Y),I=Math.max(I,Y),M=Math.min(M,re),k=Math.max(k,re)}if(b===I||M===k)continue;const F=Math.floor(b/this._granularityCellSize),V=Math.ceil(I/this._granularityCellSize),j=Math.floor(M/this._granularityCellSize),H=Math.ceil(k/this._granularityCellSize);if(F!==V||j!==H)for(let Q=j;Q<H;Q++){const Y=this._scanlineGenerateVertexRingForCellRow(Q,_,d);Qp(this._vertexBuffer,Y,i)}else i.push(...d)}return i}_scanlineGenerateVertexRingForCellRow(e,i,s){const A=e*this._granularityCellSize,d=A+this._granularityCellSize,_=[];for(let b=0;b<3;b++){const M=i[2*b],I=i[2*b+1],k=i[2*(b+1)%6],F=i[(2*(b+1)+1)%6],V=i[2*(b+2)%6],j=i[(2*(b+2)+1)%6],H=k-M,Q=F-I,Y=H===0,re=Q===0,ge=(A-I)/Q,oe=(d-I)/Q,ue=Math.min(ge,oe),ve=Math.max(ge,oe);if(!re&&(ue>=1||ve<=0)||re&&(I<A||I>d)){F>=A&&F<=d&&_.push(s[(b+1)%3]);continue}!re&&ue>0&&_.push(this._vertexToIndex(M+H*ue,I+Q*ue));const Te=M+H*Math.max(ue,0),Ue=M+H*Math.min(ve,1);Y||this._generateIntraEdgeVertices(_,M,I,k,F,Te,Ue),!re&&ve<1&&_.push(this._vertexToIndex(M+H*ve,I+Q*ve)),(re||F>=A&&F<=d)&&_.push(s[(b+1)%3]),!re&&(F<=A||F>=d)&&this._generateInterEdgeVertices(_,M,I,k,F,V,j,Ue,A,d)}return _}_generateIntraEdgeVertices(e,i,s,A,d,_,b){const M=A-i,I=d-s,k=I===0,F=k?Math.min(i,A):Math.min(_,b),V=k?Math.max(i,A):Math.max(_,b),j=Math.floor(F/this._granularityCellSize)+1,H=Math.ceil(V/this._granularityCellSize)-1;if(k?i<A:_<b)for(let Q=j;Q<=H;Q++){const Y=Q*this._granularityCellSize;e.push(this._vertexToIndex(Y,s+I*(Y-i)/M))}else for(let Q=H;Q>=j;Q--){const Y=Q*this._granularityCellSize;e.push(this._vertexToIndex(Y,s+I*(Y-i)/M))}}_generateInterEdgeVertices(e,i,s,A,d,_,b,M,I,k){const F=d-s,V=_-A,j=b-d,H=(I-d)/j,Q=(k-d)/j,Y=Math.min(H,Q),re=Math.max(H,Q),ge=A+V*Y;let oe=Math.floor(Math.min(ge,M)/this._granularityCellSize)+1,ue=Math.ceil(Math.max(ge,M)/this._granularityCellSize)-1,ve=M<ge;const Te=j===0;if(Te&&(b===I||b===k))return;if(Te||Y>=1||re<=0){const lt=s-b,nt=_+(i-_)*Math.min((I-b)/lt,(k-b)/lt);oe=Math.floor(Math.min(nt,M)/this._granularityCellSize)+1,ue=Math.ceil(Math.max(nt,M)/this._granularityCellSize)-1,ve=M<nt}const Ue=F>0?k:I;if(ve)for(let lt=oe;lt<=ue;lt++)e.push(this._vertexToIndex(lt*this._granularityCellSize,Ue));else for(let lt=ue;lt>=oe;lt--)e.push(this._vertexToIndex(lt*this._granularityCellSize,Ue))}_generateOutline(e){const i=[];for(const s of e){const A=Su(s,this._granularity,!0),d=this._pointArrayToIndices(A),_=[];for(let b=1;b<d.length;b++)_.push(d[b-1]),_.push(d[b]);i.push(_)}return i}_handlePoles(e){let i=!1,s=!1;this._canonical&&(this._canonical.y===0&&(i=!0),this._canonical.y===(1<<this._canonical.z)-1&&(s=!0)),(i||s)&&this._fillPoles(e,i,s)}_ensureNoPoleVertices(){const e=this._vertexBuffer;for(let i=0;i<e.length;i+=2){const s=e[i+1];s===Ku&&(e[i+1]=-32767),s===Ch&&(e[i+1]=32766)}}_generatePoleQuad(e,i,s,A,d,_){A>d!=(_===Ku)?(e.push(i),e.push(s),e.push(this._vertexToIndex(A,_)),e.push(s),e.push(this._vertexToIndex(d,_)),e.push(this._vertexToIndex(A,_))):(e.push(s),e.push(i),e.push(this._vertexToIndex(A,_)),e.push(this._vertexToIndex(d,_)),e.push(s),e.push(this._vertexToIndex(A,_)))}_fillPoles(e,i,s){const A=this._vertexBuffer,d=Oi,_=e.length;for(let b=2;b<_;b+=3){const M=e[b-2],I=e[b-1],k=e[b],F=A[2*M],V=A[2*M+1],j=A[2*I],H=A[2*I+1],Q=A[2*k],Y=A[2*k+1];i&&(V===0&&H===0&&this._generatePoleQuad(e,M,I,F,j,Ku),H===0&&Y===0&&this._generatePoleQuad(e,I,k,j,Q,Ku),Y===0&&V===0&&this._generatePoleQuad(e,k,M,Q,F,Ku)),s&&(V===d&&H===d&&this._generatePoleQuad(e,M,I,F,j,Ch),H===d&&Y===d&&this._generatePoleQuad(e,I,k,j,Q,Ch),Y===d&&V===d&&this._generatePoleQuad(e,k,M,Q,F,Ch))}}_initializeVertices(e){for(let i=0;i<e.length;i+=2)this._vertexToIndex(e[i],e[i+1])}subdividePolygonInternal(e,i){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:s,holeIndices:A}=(function(b){const M=[],I=[];for(const k of b)if(k.length!==0){k!==b[0]&&M.push(I.length/2);for(let F=0;F<k.length;F++)I.push(k[F].x),I.push(k[F].y)}return{flattened:I,holeIndices:M}})(e);let d;this._initializeVertices(s);try{const b=(function(I,k,F=2){const V=k&&k.length,j=V?k[0]*F:I.length;let H=QA(I,0,j,F,!0);const Q=[];if(!H||H.next===H.prev)return Q;let Y,re,ge;if(V&&(H=(function(oe,ue,ve,Te){const Ue=[];for(let lt=0,nt=ue.length;lt<nt;lt++){const dt=QA(oe,ue[lt]*Te,lt<nt-1?ue[lt+1]*Te:oe.length,Te,!1);dt===dt.next&&(dt.steiner=!0),Ue.push(qp(dt))}Ue.sort(Zp);for(let lt=0;lt<Ue.length;lt++)ve=Up(Ue[lt],ve);return ve})(I,k,H,F)),I.length>80*F){Y=I[0],re=I[1];let oe=Y,ue=re;for(let ve=F;ve<j;ve+=F){const Te=I[ve],Ue=I[ve+1];Te<Y&&(Y=Te),Ue<re&&(re=Ue),Te>oe&&(oe=Te),Ue>ue&&(ue=Ue)}ge=Math.max(oe-Y,ue-re),ge=ge!==0?32767/ge:0}return Ph(H,Q,F,Y,re,ge,0),Q})(s,A),M=this._convertIndices(s,b);d=this._subdivideTrianglesScanline(M)}catch(b){console.error(b)}let _=[];return i&&(_=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(d),{verticesFlattened:this._vertexBuffer,indicesTriangles:d,indicesLineList:_}}_convertIndices(e,i){const s=[];for(let A=0;A<i.length;A++)s.push(this._vertexToIndex(e[2*i[A]],e[2*i[A]+1]));return s}_pointArrayToIndices(e){const i=[];for(let s=0;s<e.length;s++){const A=e[s];i.push(this._vertexToIndex(A.x,A.y))}return i}}function JA(r,e,i,s=!0){return new Wp(i,e).subdividePolygonInternal(r,s)}function Su(r,e,i=!1){if(!r||r.length<1)return[];if(r.length<2)return[];const s=r[0],A=r[r.length-1],d=i&&(s.x!==A.x||s.y!==A.y);if(e<2)return d?[...r,r[0]]:[...r];const _=Math.floor(Oi/e),b=[];b.push(new it(r[0].x,r[0].y));const M=r.length,I=d?M:M-1;for(let k=0;k<I;k++){const F=r[k],V=k<M-1?r[k+1]:r[0],j=F.x,H=F.y,Q=V.x,Y=V.y,re=j!==Q,ge=H!==Y;if(!re&&!ge)continue;const oe=Q-j,ue=Y-H,ve=Math.abs(oe),Te=Math.abs(ue);let Ue=j,lt=H;for(;;){const dt=oe>0?(Math.floor(Ue/_)+1)*_:(Math.ceil(Ue/_)-1)*_,Tt=ue>0?(Math.floor(lt/_)+1)*_:(Math.ceil(lt/_)-1)*_,mt=Math.abs(Ue-dt),st=Math.abs(lt-Tt),Xe=Math.abs(Ue-Q),Lt=Math.abs(lt-Y),Ct=re?mt/ve:Number.POSITIVE_INFINITY,Ot=ge?st/Te:Number.POSITIVE_INFINITY;if((Xe<=mt||!re)&&(Lt<=st||!ge))break;if(Ct<Ot&&re||!ge){Ue=dt,lt+=ue*Ct;const Et=new it(Ue,Math.round(lt));b[b.length-1].x===Et.x&&b[b.length-1].y===Et.y||b.push(Et)}else{Ue+=oe*Ot,lt=Tt;const Et=new it(Math.round(Ue),lt);b[b.length-1].x===Et.x&&b[b.length-1].y===Et.y||b.push(Et)}}const nt=new it(Q,Y);b[b.length-1].x===nt.x&&b[b.length-1].y===nt.y||b.push(nt)}return b}function Qp(r,e,i){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let s=0,A=r[2*e[0]];for(let M=1;M<e.length;M++){const I=r[2*e[M]];I<A&&(A=I,s=M)}const d=e.length;let _=s,b=(_+1)%d;for(;;){const M=_-1>=0?_-1:d-1,I=(b+1)%d,k=r[2*e[M]],F=r[2*e[I]],V=r[2*e[_]],j=r[2*e[_]+1],H=r[2*e[b]+1];let Q=!1;if(k<F)Q=!0;else if(k>F)Q=!1;else{const Y=H-j,re=-(r[2*e[b]]-V),ge=j<H?1:-1;((k-V)*Y+(r[2*e[M]+1]-j)*re)*ge>((F-V)*Y+(r[2*e[I]+1]-j)*re)*ge&&(Q=!0)}if(Q){const Y=e[M],re=e[_],ge=e[b];Y!==re&&Y!==ge&&re!==ge&&i.push(ge,re,Y),_--,_<0&&(_=d-1)}else{const Y=e[I],re=e[_],ge=e[b];Y!==re&&Y!==ge&&re!==ge&&i.push(ge,re,Y),b++,b>=d&&(b=0)}if(M===I)break}}function ef(r,e,i,s,A,d,_,b,M){const I=A.length/2,k=_&&b&&M;if(I<Pt.MAX_VERTEX_ARRAY_LENGTH){const F=e.prepareSegment(I,i,s),V=F.vertexLength;for(let Q=0;Q<d.length;Q+=3)s.emplaceBack(V+d[Q],V+d[Q+1],V+d[Q+2]);let j,H;F.vertexLength+=I,F.primitiveLength+=d.length/3,k&&(H=_.prepareSegment(I,i,b),j=H.vertexLength,H.vertexLength+=I);for(let Q=0;Q<A.length;Q+=2)r(A[Q],A[Q+1]);if(k)for(let Q=0;Q<M.length;Q++){const Y=M[Q];for(let re=1;re<Y.length;re+=2)b.emplaceBack(j+Y[re-1],j+Y[re]);H.primitiveLength+=Y.length/2}}else(function(F,V,j,H,Q,Y){const re=[];for(let Te=0;Te<H.length/2;Te++)re.push(-1);const ge={count:0};let oe=0,ue=F.getOrCreateLatestSegment(V,j),ve=ue.vertexLength;for(let Te=2;Te<Q.length;Te+=3){const Ue=Q[Te-2],lt=Q[Te-1],nt=Q[Te];let dt=re[Ue]<oe,Tt=re[lt]<oe,mt=re[nt]<oe;ue.vertexLength+((dt?1:0)+(Tt?1:0)+(mt?1:0))>Pt.MAX_VERTEX_ARRAY_LENGTH&&(ue=F.createNewSegment(V,j),oe=ge.count,dt=!0,Tt=!0,mt=!0,ve=0);const st=Ih(re,H,Y,ge,Ue,dt,ue),Xe=Ih(re,H,Y,ge,lt,Tt,ue),Lt=Ih(re,H,Y,ge,nt,mt,ue);j.emplaceBack(ve+st-oe,ve+Xe-oe,ve+Lt-oe),ue.primitiveLength++}})(e,i,s,A,d,r),k&&(function(F,V,j,H,Q,Y){const re=[];for(let Te=0;Te<H.length/2;Te++)re.push(-1);const ge={count:0};let oe=0,ue=F.getOrCreateLatestSegment(V,j),ve=ue.vertexLength;for(let Te=0;Te<Q.length;Te++){const Ue=Q[Te];for(let lt=1;lt<Q[Te].length;lt+=2){const nt=Ue[lt-1],dt=Ue[lt];let Tt=re[nt]<oe,mt=re[dt]<oe;ue.vertexLength+((Tt?1:0)+(mt?1:0))>Pt.MAX_VERTEX_ARRAY_LENGTH&&(ue=F.createNewSegment(V,j),oe=ge.count,Tt=!0,mt=!0,ve=0);const st=Ih(re,H,Y,ge,nt,Tt,ue),Xe=Ih(re,H,Y,ge,dt,mt,ue);j.emplaceBack(ve+st-oe,ve+Xe-oe),ue.primitiveLength++}}})(_,i,b,A,M,r),e.forceNewSegmentOnNextPrepare(),_==null||_.forceNewSegmentOnNextPrepare()}function Ih(r,e,i,s,A,d,_){if(d){const b=s.count;return i(e[2*A],e[2*A+1]),r[A]=s.count,s.count++,_.vertexLength++,b}return r[A]}class Uc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new ce,this.indexArray=new Ye,this.indexArray2=new xt,this.programConfigurations=new Ll(e.layers,e.zoom),this.segments=new Pt,this.segments2=new Pt,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){this.hasDependencies=tc("fill",this.layers,i);const A=this.layers[0].layout.get("fill-sort-key"),d=!A.isConstant(),_=[];for(const{feature:b,id:M,index:I,sourceLayerIndex:k}of e){const F=this.layers[0]._featureFilter.needGeometry,V=dl(b,F);if(!this.layers[0]._featureFilter.filter(new ze(this.zoom),V,s))continue;const j=d?A.evaluate(V,{},s,i.availableImages):void 0,H={id:M,properties:b.properties,type:b.type,sourceLayerIndex:k,index:I,geometry:F?V.geometry:fl(b),patterns:{},sortKey:j};_.push(H)}d&&_.sort(((b,M)=>b.sortKey-M.sortKey));for(const b of _){const{geometry:M,index:I,sourceLayerIndex:k}=b;if(this.hasDependencies){const F=Vc("fill",this.layers,b,{zoom:this.zoom},i);this.patternFeatures.push(F)}else this.addFeature(b,M,I,s,{},i.subdivisionGranularity);i.featureIndex.insert(e[I].feature,M,I,k,this.index)}}update(e,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s})}addFeatures(e,i,s){for(const A of this.patternFeatures)this.addFeature(A,A.geometry,A.index,i,s,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Fp),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,i,s,A,d,_){for(const b of ma(i,500)){const M=JA(b,A,_.fill.getGranularityForZoomLevel(A.z)),I=this.layoutVertexArray;ef(((k,F)=>{I.emplaceBack(k,F)}),this.segments,this.layoutVertexArray,this.indexArray,M.verticesFlattened,M.indicesTriangles,this.segments2,this.indexArray2,M.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:d,canonical:A})}}let tf,rf;kt("FillBucket",Uc,{omit:["layers","patternFeatures"]});var $p={get paint(){return rf=rf||new is({"fill-antialias":new _t(qe.paint_fill["fill-antialias"]),"fill-opacity":new Mt(qe.paint_fill["fill-opacity"]),"fill-color":new Mt(qe.paint_fill["fill-color"]),"fill-outline-color":new Mt(qe.paint_fill["fill-outline-color"]),"fill-translate":new _t(qe.paint_fill["fill-translate"]),"fill-translate-anchor":new _t(qe.paint_fill["fill-translate-anchor"]),"fill-pattern":new li(qe.paint_fill["fill-pattern"])})},get layout(){return tf=tf||new is({"fill-sort-key":new Mt(qe.layout_fill["fill-sort-key"])})}};class Yp extends ko{constructor(e,i){super(e,$p,i)}recalculate(e,i){super.recalculate(e,i);const s=this.paint._values["fill-outline-color"];s.value.kind==="constant"&&s.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Uc(e)}queryRadius(){return Jh(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:i,transform:s,pixelsToTileUnits:A}){return LA(ec(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-s.bearingInRadians,A),i)}isTileClipped(){return!0}}const Xp=on([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Kp=on([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Jp}=Xp;class Dh{constructor(e,i,s,A,d){this.properties={},this.extent=s,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=A,this._values=d,e.readFields(e0,this,i)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos,s=[];let A,d=1,_=0,b=0,M=0;for(;e.pos<i;){if(_<=0){const I=e.readVarint();d=7&I,_=I>>3}if(_--,d===1||d===2)b+=e.readSVarint(),M+=e.readSVarint(),d===1&&(A&&s.push(A),A=[]),A&&A.push(new it(b,M));else{if(d!==7)throw new Error(`unknown command ${d}`);A&&A.push(A[0].clone())}}return A&&s.push(A),s}bbox(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos;let s=1,A=0,d=0,_=0,b=1/0,M=-1/0,I=1/0,k=-1/0;for(;e.pos<i;){if(A<=0){const F=e.readVarint();s=7&F,A=F>>3}if(A--,s===1||s===2)d+=e.readSVarint(),_+=e.readSVarint(),d<b&&(b=d),d>M&&(M=d),_<I&&(I=_),_>k&&(k=_);else if(s!==7)throw new Error(`unknown command ${s}`)}return[b,I,M,k]}toGeoJSON(e,i,s){const A=this.extent*Math.pow(2,s),d=this.extent*e,_=this.extent*i,b=this.loadGeometry();function M(V){return[360*(V.x+d)/A-180,360/Math.PI*Math.atan(Math.exp((1-2*(V.y+_)/A)*Math.PI))-90]}function I(V){return V.map(M)}let k;if(this.type===1){const V=[];for(const H of b)V.push(H[0]);const j=I(V);k=V.length===1?{type:"Point",coordinates:j[0]}:{type:"MultiPoint",coordinates:j}}else if(this.type===2){const V=b.map(I);k=V.length===1?{type:"LineString",coordinates:V[0]}:{type:"MultiLineString",coordinates:V}}else{if(this.type!==3)throw new Error("unknown feature type");{const V=nf(b),j=[];for(const H of V)j.push(H.map(I));k=j.length===1?{type:"Polygon",coordinates:j[0]}:{type:"MultiPolygon",coordinates:j}}}const F={type:"Feature",geometry:k,properties:this.properties};return this.id!=null&&(F.id=this.id),F}}function e0(r,e,i){r===1?e.id=i.readVarint():r===2?(function(s,A){const d=s.readVarint()+s.pos;for(;s.pos<d;){const _=A._keys[s.readVarint()],b=A._values[s.readVarint()];A.properties[_]=b}})(i,e):r===3?e.type=i.readVarint():r===4&&(e._geometry=i.pos)}function nf(r){const e=r.length;if(e<=1)return[r];const i=[];let s,A;for(let d=0;d<e;d++){const _=t0(r[d]);_!==0&&(A===void 0&&(A=_<0),A===_<0?(s&&i.push(s),s=[r[d]]):s&&s.push(r[d]))}return s&&i.push(s),i}function t0(r){let e=0;for(let i,s,A=0,d=r.length,_=d-1;A<d;_=A++)i=r[A],s=r[_],e+=(s.x-i.x)*(i.y+s.y);return e}Dh.types=["Unknown","Point","LineString","Polygon"];class i0{constructor(e,i){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(r0,this,i),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const i=this._pbf.readVarint()+this._pbf.pos;return new Dh(this._pbf,i,this.extent,this._keys,this._values)}}function r0(r,e,i){r===15?e.version=i.readVarint():r===1?e.name=i.readString():r===5?e.extent=i.readVarint():r===2?e._features.push(i.pos):r===3?e._keys.push(i.readString()):r===4&&e._values.push((function(s){let A=null;const d=s.readVarint()+s.pos;for(;s.pos<d;){const _=s.readVarint()>>3;A=_===1?s.readString():_===2?s.readFloat():_===3?s.readDouble():_===4?s.readVarint64():_===5?s.readVarint():_===6?s.readSVarint():_===7?s.readBoolean():null}if(A==null)throw new Error("unknown feature value");return A})(i))}class sf{constructor(e,i){this.layers=e.readFields(n0,{},i)}}function n0(r,e,i){if(r===3){const s=new i0(i,i.readVarint()+i.pos);s.length&&(e[s.name]=s)}}const Gc=Math.pow(2,13);function kh(r,e,i,s,A,d,_,b){r.emplaceBack(e,i,2*Math.floor(s*Gc)+_,A*Gc*2,d*Gc*2,Math.round(b))}class qc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new ye,this.centroidVertexArray=new he,this.indexArray=new Ye,this.programConfigurations=new Ll(e.layers,e.zoom),this.segments=new Pt,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){this.features=[],this.hasDependencies=tc("fill-extrusion",this.layers,i);for(const{feature:A,id:d,index:_,sourceLayerIndex:b}of e){const M=this.layers[0]._featureFilter.needGeometry,I=dl(A,M);if(!this.layers[0]._featureFilter.filter(new ze(this.zoom),I,s))continue;const k={id:d,sourceLayerIndex:b,index:_,geometry:M?I.geometry:fl(A),properties:A.properties,type:A.type,patterns:{}};this.hasDependencies?this.features.push(Vc("fill-extrusion",this.layers,k,{zoom:this.zoom},i)):this.addFeature(k,k.geometry,_,s,{},i.subdivisionGranularity),i.featureIndex.insert(A,k.geometry,_,b,this.index,!0)}}addFeatures(e,i,s){for(const A of this.features){const{geometry:d}=A;this.addFeature(A,d,A.index,i,s,e.subdivisionGranularity)}}update(e,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Jp),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Kp.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,i,s,A,d,_){for(const b of ma(i,500)){const M={x:0,y:0,sampleCount:0},I=this.layoutVertexArray.length;this.processPolygon(M,A,e,b,_);const k=this.layoutVertexArray.length-I,F=Math.floor(M.x/M.sampleCount),V=Math.floor(M.y/M.sampleCount);for(let j=0;j<k;j++)this.centroidVertexArray.emplaceBack(F,V)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:d,canonical:A})}processPolygon(e,i,s,A,d){if(A.length<1||of(A[0]))return;for(const F of A)F.length!==0&&s0(e,F);const _={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},b=d.fill.getGranularityForZoomLevel(i.z),M=Dh.types[s.type]==="Polygon";for(const F of A){if(F.length===0||of(F))continue;const V=Su(F,b,M);this._generateSideFaces(V,_)}if(!M)return;const I=JA(A,i,b,!1),k=this.layoutVertexArray;ef(((F,V)=>{kh(k,F,V,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,I.verticesFlattened,I.indicesTriangles)}_generateSideFaces(e,i){let s=0;for(let A=1;A<e.length;A++){const d=e[A],_=e[A-1];if(o0(d,_))continue;i.segment.vertexLength+4>Pt.MAX_VERTEX_ARRAY_LENGTH&&(i.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const b=d.sub(_)._perp()._unit(),M=_.dist(d);s+M>32768&&(s=0),kh(this.layoutVertexArray,d.x,d.y,b.x,b.y,0,0,s),kh(this.layoutVertexArray,d.x,d.y,b.x,b.y,0,1,s),s+=M,kh(this.layoutVertexArray,_.x,_.y,b.x,b.y,0,0,s),kh(this.layoutVertexArray,_.x,_.y,b.x,b.y,0,1,s);const I=i.segment.vertexLength;this.indexArray.emplaceBack(I,I+2,I+1),this.indexArray.emplaceBack(I+1,I+2,I+3),i.segment.vertexLength+=4,i.segment.primitiveLength+=2}}}function s0(r,e){for(let i=0;i<e.length;i++){const s=e[i];i===e.length-1&&e[0].x===s.x&&e[0].y===s.y||(r.x+=s.x,r.y+=s.y,r.sampleCount++)}}function o0(r,e){return r.x===e.x&&(r.x<0||r.x>Oi)||r.y===e.y&&(r.y<0||r.y>Oi)}function of(r){return r.every((e=>e.x<0))||r.every((e=>e.x>Oi))||r.every((e=>e.y<0))||r.every((e=>e.y>Oi))}let af;kt("FillExtrusionBucket",qc,{omit:["layers","features"]});var a0={get paint(){return af=af||new is({"fill-extrusion-opacity":new _t(qe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Mt(qe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new _t(qe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new _t(qe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new li(qe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Mt(qe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Mt(qe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new _t(qe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class l0 extends ko{constructor(e,i){super(e,a0,i)}createBucket(e){return new qc(e)}queryRadius(){return Jh(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:A,transform:d,pixelsToTileUnits:_,pixelPosMatrix:b}){const M=ec(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-d.bearingInRadians,_),I=this.paint.get("fill-extrusion-height").evaluate(i,s),k=this.paint.get("fill-extrusion-base").evaluate(i,s),F=(function(j,H){const Q=[];for(const Y of j){const re=[Y.x,Y.y,0,1];Cn(re,re,H),Q.push(new it(re[0]/re[3],re[1]/re[3]))}return Q})(M,b),V=(function(j,H,Q,Y){const re=[],ge=[],oe=Y[8]*H,ue=Y[9]*H,ve=Y[10]*H,Te=Y[11]*H,Ue=Y[8]*Q,lt=Y[9]*Q,nt=Y[10]*Q,dt=Y[11]*Q;for(const Tt of j){const mt=[],st=[];for(const Xe of Tt){const Lt=Xe.x,Ct=Xe.y,Ot=Y[0]*Lt+Y[4]*Ct+Y[12],Et=Y[1]*Lt+Y[5]*Ct+Y[13],Ut=Y[2]*Lt+Y[6]*Ct+Y[14],ji=Y[3]*Lt+Y[7]*Ct+Y[15],Di=Ut+ve,Or=ji+Te,Ps=Ot+Ue,Tn=Et+lt,Nr=Ut+nt,kr=ji+dt,rr=new it((Ot+oe)/Or,(Et+ue)/Or);rr.z=Di/Or,mt.push(rr);const Xr=new it(Ps/kr,Tn/kr);Xr.z=Nr/kr,st.push(Xr)}re.push(mt),ge.push(st)}return[re,ge]})(A,k,I,b);return(function(j,H,Q){let Y=1/0;LA(Q,H)&&(Y=lf(Q,H[0]));for(let re=0;re<H.length;re++){const ge=H[re],oe=j[re];for(let ue=0;ue<ge.length-1;ue++){const ve=ge[ue],Te=[ve,ge[ue+1],oe[ue+1],oe[ue],ve];Wu(Q,Te)&&(Y=Math.min(Y,lf(Q,Te)))}}return Y!==1/0&&Y})(V[0],V[1],F)}}function zh(r,e){return r.x*e.x+r.y*e.y}function lf(r,e){if(r.length===1){let i=0;const s=e[i++];let A;for(;!A||s.equals(A);)if(A=e[i++],!A)return 1/0;for(;i<e.length;i++){const d=e[i],_=r[0],b=A.sub(s),M=d.sub(s),I=_.sub(s),k=zh(b,b),F=zh(b,M),V=zh(M,M),j=zh(I,b),H=zh(I,M),Q=k*V-F*F,Y=(V*j-F*H)/Q,re=(k*H-F*j)/Q,ge=s.z*(1-Y-re)+A.z*Y+d.z*re;if(isFinite(ge))return ge}return 1/0}{let i=1/0;for(const s of e)i=Math.min(i,s.z);return i}}const u0=on([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:h0}=u0,c0=on([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:A0}=c0,f0=Math.cos(Math.PI/180*37.5),uf=Math.pow(2,14)/.5;class Hc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((i=>{this.gradients[i.id]={}})),this.layoutVertexArray=new Pe,this.layoutVertexArray2=new _e,this.indexArray=new Ye,this.programConfigurations=new Ll(e.layers,e.zoom),this.segments=new Pt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){this.hasDependencies=tc("line",this.layers,i)||this.hasLineDasharray(this.layers);const A=this.layers[0].layout.get("line-sort-key"),d=!A.isConstant(),_=[];for(const{feature:b,id:M,index:I,sourceLayerIndex:k}of e){const F=this.layers[0]._featureFilter.needGeometry,V=dl(b,F);if(!this.layers[0]._featureFilter.filter(new ze(this.zoom),V,s))continue;const j=d?A.evaluate(V,{},s):void 0,H={id:M,properties:b.properties,type:b.type,sourceLayerIndex:k,index:I,geometry:F?V.geometry:fl(b),patterns:{},dashes:{},sortKey:j};_.push(H)}d&&_.sort(((b,M)=>b.sortKey-M.sortKey));for(const b of _){const{geometry:M,index:I,sourceLayerIndex:k}=b;this.hasDependencies?(tc("line",this.layers,i)?Vc("line",this.layers,b,{zoom:this.zoom},i):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,b,this.zoom,i),this.patternFeatures.push(b)):this.addFeature(b,M,I,s,{},{},i.subdivisionGranularity),i.featureIndex.insert(e[I].feature,M,I,k,this.index)}}update(e,i,s,A){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s,dashPositions:A})}addFeatures(e,i,s,A){for(const d of this.patternFeatures)this.addFeature(d,d.geometry,d.index,i,s,A,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,A0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,h0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,i,s,A,d,_,b){const M=this.layers[0].layout,I=M.get("line-join").evaluate(e,{}),k=M.get("line-cap"),F=M.get("line-miter-limit"),V=M.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const j of i)this.addLine(j,e,I,k,F,V,A,b);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:d,dashPositions:_,canonical:A})}addLine(e,i,s,A,d,_,b,M){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=Su(e,b?M.line.getGranularityForZoomLevel(b.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let oe=0;oe<e.length-1;oe++)this.totalDistance+=e[oe].dist(e[oe+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const I=Dh.types[i.type]==="Polygon";let k=e.length;for(;k>=2&&e[k-1].equals(e[k-2]);)k--;let F=0;for(;F<k-1&&e[F].equals(e[F+1]);)F++;if(k<(I?3:2))return;s==="bevel"&&(d=1.05);const V=this.overscaling<=16?122880/(512*this.overscaling):0,j=this.segments.prepareSegment(10*k,this.layoutVertexArray,this.indexArray);let H,Q,Y,re,ge;this.e1=this.e2=-1,I&&(H=e[k-2],ge=e[F].sub(H)._unit()._perp());for(let oe=F;oe<k;oe++){if(Y=oe===k-1?I?e[F+1]:void 0:e[oe+1],Y&&e[oe].equals(Y))continue;ge&&(re=ge),H&&(Q=H),H=e[oe],ge=Y?Y.sub(H)._unit()._perp():re,re=re||ge;let ue=re.add(ge);ue.x===0&&ue.y===0||ue._unit();const ve=re.x*ge.x+re.y*ge.y,Te=ue.x*ge.x+ue.y*ge.y,Ue=Te!==0?1/Te:1/0,lt=2*Math.sqrt(2-2*Te),nt=Te<f0&&Q&&Y,dt=re.x*ge.y-re.y*ge.x>0;if(nt&&oe>F){const st=H.dist(Q);if(st>2*V){const Xe=H.sub(H.sub(Q)._mult(V/st)._round());this.updateDistance(Q,Xe),this.addCurrentVertex(Xe,re,0,0,j),Q=Xe}}const Tt=Q&&Y;let mt=Tt?s:I?"butt":A;if(Tt&&mt==="round"&&(Ue<_?mt="miter":Ue<=2&&(mt="fakeround")),mt==="miter"&&Ue>d&&(mt="bevel"),mt==="bevel"&&(Ue>2&&(mt="flipbevel"),Ue<d&&(mt="miter")),Q&&this.updateDistance(Q,H),mt==="miter")ue._mult(Ue),this.addCurrentVertex(H,ue,0,0,j);else if(mt==="flipbevel"){if(Ue>100)ue=ge.mult(-1);else{const st=Ue*re.add(ge).mag()/re.sub(ge).mag();ue._perp()._mult(st*(dt?-1:1))}this.addCurrentVertex(H,ue,0,0,j),this.addCurrentVertex(H,ue.mult(-1),0,0,j)}else if(mt==="bevel"||mt==="fakeround"){const st=-Math.sqrt(Ue*Ue-1),Xe=dt?st:0,Lt=dt?0:st;if(Q&&this.addCurrentVertex(H,re,Xe,Lt,j),mt==="fakeround"){const Ct=Math.round(180*lt/Math.PI/20);for(let Ot=1;Ot<Ct;Ot++){let Et=Ot/Ct;if(Et!==.5){const ji=Et-.5;Et+=Et*ji*(Et-1)*((1.0904+ve*(ve*(3.55645-1.43519*ve)-3.2452))*ji*ji+(.848013+ve*(.215638*ve-1.06021)))}const Ut=ge.sub(re)._mult(Et)._add(re)._unit()._mult(dt?-1:1);this.addHalfVertex(H,Ut.x,Ut.y,!1,dt,0,j)}}Y&&this.addCurrentVertex(H,ge,-Xe,-Lt,j)}else if(mt==="butt")this.addCurrentVertex(H,ue,0,0,j);else if(mt==="square"){const st=Q?1:-1;this.addCurrentVertex(H,ue,st,st,j)}else mt==="round"&&(Q&&(this.addCurrentVertex(H,re,0,0,j),this.addCurrentVertex(H,re,1,1,j,!0)),Y&&(this.addCurrentVertex(H,ge,-1,-1,j,!0),this.addCurrentVertex(H,ge,0,0,j)));if(nt&&oe<k-1){const st=H.dist(Y);if(st>2*V){const Xe=H.add(Y.sub(H)._mult(V/st)._round());this.updateDistance(H,Xe),this.addCurrentVertex(Xe,ge,0,0,j),H=Xe}}}}addCurrentVertex(e,i,s,A,d,_=!1){const b=i.y*A-i.x,M=-i.y-i.x*A;this.addHalfVertex(e,i.x+i.y*s,i.y-i.x*s,_,!1,s,d),this.addHalfVertex(e,b,M,_,!0,-A,d),this.distance>uf/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,i,s,A,d,_))}addHalfVertex({x:e,y:i},s,A,d,_,b,M){const I=.5*(this.lineClips?this.scaledDistance*(uf-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(d?1:0),(i<<1)+(_?1:0),Math.round(63*s)+128,Math.round(63*A)+128,1+(b===0?0:b<0?-1:1)|(63&I)<<2,I>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const k=M.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,k,this.e2),M.primitiveLength++),_?this.e2=k:this.e1=k}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,i){this.distance+=e.dist(i),this.updateScaledDistance()}hasLineDasharray(e){for(const i of e){const s=i.paint.get("line-dasharray");if(s&&!s.isConstant())return!0}return!1}addLineDashDependencies(e,i,s,A){for(const d of e){const _=d.paint.get("line-dasharray");if(!_||_.value.kind==="constant")continue;const b=d.layout.get("line-cap")==="round",M={dasharray:_.value.evaluate({zoom:s-1},i,{}),round:b},I={dasharray:_.value.evaluate({zoom:s},i,{}),round:b},k={dasharray:_.value.evaluate({zoom:s+1},i,{}),round:b},F=`${M.dasharray.join(",")},${M.round}`,V=`${I.dasharray.join(",")},${I.round}`,j=`${k.dasharray.join(",")},${k.round}`;A.dashDependencies[F]=M,A.dashDependencies[V]=I,A.dashDependencies[j]=k,i.dashes[d.id]={min:F,mid:V,max:j}}}}let hf,cf;kt("LineBucket",Hc,{omit:["layers","patternFeatures"]});var Af={get paint(){return cf=cf||new is({"line-opacity":new Mt(qe.paint_line["line-opacity"]),"line-color":new Mt(qe.paint_line["line-color"]),"line-translate":new _t(qe.paint_line["line-translate"]),"line-translate-anchor":new _t(qe.paint_line["line-translate-anchor"]),"line-width":new Mt(qe.paint_line["line-width"]),"line-gap-width":new Mt(qe.paint_line["line-gap-width"]),"line-offset":new Mt(qe.paint_line["line-offset"]),"line-blur":new Mt(qe.paint_line["line-blur"]),"line-dasharray":new li(qe.paint_line["line-dasharray"]),"line-pattern":new li(qe.paint_line["line-pattern"]),"line-gradient":new wn(qe.paint_line["line-gradient"])})},get layout(){return hf=hf||new is({"line-cap":new _t(qe.layout_line["line-cap"]),"line-join":new Mt(qe.layout_line["line-join"]),"line-miter-limit":new _t(qe.layout_line["line-miter-limit"]),"line-round-limit":new _t(qe.layout_line["line-round-limit"]),"line-sort-key":new Mt(qe.layout_line["line-sort-key"])})}};class d0 extends Mt{possiblyEvaluate(e,i){return i=new ze(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,zoomHistory:i.zoomHistory,transition:i.transition}),super.possiblyEvaluate(e,i)}evaluate(e,i,s,A){return i=Er({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,s,A)}}let sc;class p0 extends ko{constructor(e,i){super(e,Af,i),this.gradientVersion=0,sc||(sc=new d0(Af.paint.properties["line-width"].specification),sc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const i=this.gradientExpression();this.stepInterpolant=!!(function(s){return s._styleExpression!==void 0})(i)&&i._styleExpression.expression instanceof Kn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,i){super.recalculate(e,i),this.paint._values["line-floorwidth"]=sc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Hc(e)}queryRadius(e){const i=e,s=ff($u("line-width",this,i),$u("line-gap-width",this,i)),A=$u("line-offset",this,i);return s/2+Math.abs(A)+Jh(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:A,transform:d,pixelsToTileUnits:_}){const b=ec(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-d.bearingInRadians,_),M=_/2*ff(this.paint.get("line-width").evaluate(i,s),this.paint.get("line-gap-width").evaluate(i,s)),I=this.paint.get("line-offset").evaluate(i,s);return I&&(A=(function(k,F){const V=[];for(let j=0;j<k.length;j++){const H=wp(k[j]),Q=[];for(let Y=0;Y<H.length;Y++){const re=H[Y],ge=H[Y-1],oe=H[Y+1],ue=Y===0?new it(0,0):re.sub(ge)._unit()._perp(),ve=Y===H.length-1?new it(0,0):oe.sub(re)._unit()._perp(),Te=ue._add(ve)._unit(),Ue=Te.x*ve.x+Te.y*ve.y;Ue!==0&&Te._mult(1/Ue),Q.push(Te._mult(F)._add(re))}V.push(Q)}return V})(A,I*_)),(function(k,F,V){for(let j=0;j<F.length;j++){const H=F[j];if(k.length>=3){for(let Q=0;Q<H.length;Q++)if(Qu(k,H[Q]))return!0}if(vp(k,H,V))return!0}return!1})(b,A,M)}isTileClipped(){return!0}}function ff(r,e){return e>0?e+2*r:r}const m0=on([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),_0=on([{name:"a_projected_pos",components:3,type:"Float32"}],4);on([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const g0=on([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);on([{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 df=on([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),y0=on([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function v0(r,e,i){return r.sections.forEach((s=>{s.text=(function(A,d,_){const b=d.layout.get("text-transform").evaluate(_,{});return b==="uppercase"?A=A.toLocaleUpperCase():b==="lowercase"&&(A=A.toLocaleLowerCase()),Oe.applyArabicShaping&&(A=Oe.applyArabicShaping(A)),A})(s.text,e,i)})),r}on([{name:"triangle",components:3,type:"Uint16"}]),on([{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"}]),on([{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",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),on([{type:"Float32",name:"offsetX"}]),on([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),on([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var ns=24;const Lh={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},x0={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},b0={40:!0};function pf(r,e,i,s,A,d){if("fontStack"in e){const _=i[e.fontStack],b=_&&_[r];return b?b.metrics.advance*e.scale+A:0}{const _=s[e.imageName];return _?_.displaySize[0]*e.scale*ns/d+A:0}}function mf(r,e,i,s){const A=Math.pow(r-e,2);return s?r<e?A/2:2*A:A+Math.abs(i)*i}function w0(r,e,i){let s=0;return r===10&&(s-=1e4),i&&(s+=150),r!==40&&r!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function _f(r,e,i,s,A,d){let _=null,b=mf(e,i,A,d);for(const M of s){const I=mf(e-M.x,i,A,d)+M.badness;I<=b&&(_=M,b=I)}return{index:r,x:e,priorBreak:_,badness:b}}function gf(r){return r?gf(r.priorBreak).concat(r.index):[]}class Ju{constructor(e="",i=[],s=[]){this.text=e,this.sections=i,this.sectionIndex=s,this.imageSectionID=null}static fromFeature(e,i){const s=new Ju;for(let A=0;A<e.sections.length;A++){const d=e.sections[A];d.image?s.addImageSection(d):s.addTextSection(d,i)}return s}length(){return[...this.text].length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=(function(e){let i="",s={premature:!0,value:void 0};const A=e[Symbol.iterator]();let d=A.next();const _=e[Symbol.iterator]();_.next();let b=_.next();for(;!d.done;)i+=!b.done&&de(b.value.codePointAt(0))&&!Lh[b.value]||!s.premature&&de(s.value.codePointAt(0))&&!Lh[s.value]||!Lh[d.value]?d.value:Lh[d.value],s={value:d.value,premature:!1},d=A.next(),b=_.next();return i})(this.text)}hasZeroWidthSpaces(){return this.text.includes("​")}trim(){const e=this.text.match(/^\s*/),i=e?e[0].length:0,s=this.text.match(/\S\s*$/),A=s?s[0].length-1:0;this.text=this.text.substring(i,this.text.length-A),this.sectionIndex=this.sectionIndex.slice(i,this.sectionIndex.length-A)}substring(e,i){const s=[...this.text].slice(e,i).join(""),A=this.sectionIndex.slice(e,i);return new Ju(s,this.sections,A)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,i)=>Math.max(e,this.sections[i].scale)),0)}getMaxImageSize(e){let i=0,s=0;for(let A=0;A<this.length();A++){const d=this.getSection(A);if("imageName"in d){const _=e[d.imageName];if(!_)continue;const b=_.displaySize;i=Math.max(i,b[0]),s=Math.max(s,b[1])}}return{maxImageWidth:i,maxImageHeight:s}}addTextSection(e,i){this.text+=e.text,this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||i});const s=this.sections.length-1;this.sectionIndex.push(...[...e.text].map((()=>s)))}addImageSection(e){const i=e.image?e.image.name:"";if(i.length===0)return void en("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:i}),this.sectionIndex.push(this.sections.length-1)):en("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,i,s,A,d){const _=[],b=this.determineAverageLineWidth(e,i,s,A,d),M=this.hasZeroWidthSpaces();let I=0,k=0;const F=this.text[Symbol.iterator]();let V=F.next();const j=this.text[Symbol.iterator]();j.next();let H=j.next();const Q=this.text[Symbol.iterator]();Q.next(),Q.next();let Y=Q.next();for(;!V.done;){const re=this.getSection(k),ge=V.value.codePointAt(0);if(S(ge)||(I+=pf(ge,re,s,A,e,d)),!H.done){const oe=w(ge),ue=H.value.codePointAt(0);(x0[ge]||oe||"imageName"in re||!Y.done&&b0[ue])&&_.push(_f(k+1,I,b,_,w0(ge,ue,oe&&M),!1))}k++,V=F.next(),H=j.next(),Y=Q.next()}return gf(_f(this.length(),I,b,_,0,!0))}determineAverageLineWidth(e,i,s,A,d){let _=0,b=0;for(const M of this.text){const I=this.getSection(b);_+=pf(M.codePointAt(0),I,s,A,e,d),b++}return _/Math.max(1,Math.ceil(_/i))}}const Wc=4294967296,yf=1/Wc,vf=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class oc{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,i,s=this.length){for(;this.pos<s;){const A=this.readVarint(),d=A>>3,_=this.pos;this.type=7&A,e(d,i,this),this.pos===_&&this.skip(A)}return i}readMessage(e,i){return this.readFields(e,i,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Wc;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Wc;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const i=this.buf;let s,A;return A=i[this.pos++],s=127&A,A<128?s:(A=i[this.pos++],s|=(127&A)<<7,A<128?s:(A=i[this.pos++],s|=(127&A)<<14,A<128?s:(A=i[this.pos++],s|=(127&A)<<21,A<128?s:(A=i[this.pos],s|=(15&A)<<28,(function(d,_,b){const M=b.buf;let I,k;if(k=M[b.pos++],I=(112&k)>>4,k<128||(k=M[b.pos++],I|=(127&k)<<3,k<128)||(k=M[b.pos++],I|=(127&k)<<10,k<128)||(k=M[b.pos++],I|=(127&k)<<17,k<128)||(k=M[b.pos++],I|=(127&k)<<24,k<128)||(k=M[b.pos++],I|=(1&k)<<31,k<128))return eh(d,I,_);throw new Error("Expected varint not more than 10 bytes")})(s,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,i=this.pos;return this.pos=e,e-i>=12&&vf?vf.decode(this.buf.subarray(i,e)):(function(s,A,d){let _="",b=A;for(;b<d;){const M=s[b];let I,k,F,V=null,j=M>239?4:M>223?3:M>191?2:1;if(b+j>d)break;j===1?M<128&&(V=M):j===2?(I=s[b+1],(192&I)==128&&(V=(31&M)<<6|63&I,V<=127&&(V=null))):j===3?(I=s[b+1],k=s[b+2],(192&I)==128&&(192&k)==128&&(V=(15&M)<<12|(63&I)<<6|63&k,(V<=2047||V>=55296&&V<=57343)&&(V=null))):j===4&&(I=s[b+1],k=s[b+2],F=s[b+3],(192&I)==128&&(192&k)==128&&(192&F)==128&&(V=(15&M)<<18|(63&I)<<12|(63&k)<<6|63&F,(V<=65535||V>=1114112)&&(V=null))),V===null?(V=65533,j=1):V>65535&&(V-=65536,_+=String.fromCharCode(V>>>10&1023|55296),V=56320|1023&V),_+=String.fromCharCode(V),b+=j}return _})(this.buf,i,e)}readBytes(){const e=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,e);return this.pos=e,i}readPackedVarint(e=[],i){const s=this.readPackedEnd();for(;this.pos<s;)e.push(this.readVarint(i));return e}readPackedSVarint(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(e){const i=7&e;if(i===0)for(;this.buf[this.pos++]>127;);else if(i===2)this.pos=this.readVarint()+this.pos;else if(i===5)this.pos+=4;else{if(i!==1)throw new Error(`Unimplemented type: ${i}`);this.pos+=8}}writeTag(e,i){this.writeVarint(e<<3|i)}realloc(e){let i=this.length||16;for(;i<this.pos+e;)i*=2;if(i!==this.length){const s=new Uint8Array(i);s.set(this.buf),this.buf=s,this.dataView=new DataView(s.buffer),this.length=i}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*yf),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*yf),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?(function(i,s){let A,d;if(i>=0?(A=i%4294967296|0,d=i/4294967296|0):(A=~(-i%4294967296),d=~(-i/4294967296),4294967295^A?A=A+1|0:(A=0,d=d+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");s.realloc(10),(function(_,b,M){M.buf[M.pos++]=127&_|128,_>>>=7,M.buf[M.pos++]=127&_|128,_>>>=7,M.buf[M.pos++]=127&_|128,_>>>=7,M.buf[M.pos++]=127&_|128,M.buf[M.pos]=127&(_>>>=7)})(A,0,s),(function(_,b){const M=(7&_)<<4;b.buf[b.pos++]|=M|((_>>>=3)?128:0),_&&(b.buf[b.pos++]=127&_|((_>>>=7)?128:0),_&&(b.buf[b.pos++]=127&_|((_>>>=7)?128:0),_&&(b.buf[b.pos++]=127&_|((_>>>=7)?128:0),_&&(b.buf[b.pos++]=127&_|((_>>>=7)?128:0),_&&(b.buf[b.pos++]=127&_)))))})(d,s)})(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;const i=this.pos;this.pos=(function(A,d,_){for(let b,M,I=0;I<d.length;I++){if(b=d.charCodeAt(I),b>55295&&b<57344){if(!M){b>56319||I+1===d.length?(A[_++]=239,A[_++]=191,A[_++]=189):M=b;continue}if(b<56320){A[_++]=239,A[_++]=191,A[_++]=189,M=b;continue}b=M-55296<<10|b-56320|65536,M=null}else M&&(A[_++]=239,A[_++]=191,A[_++]=189,M=null);b<128?A[_++]=b:(b<2048?A[_++]=b>>6|192:(b<65536?A[_++]=b>>12|224:(A[_++]=b>>18|240,A[_++]=b>>12&63|128),A[_++]=b>>6&63|128),A[_++]=63&b|128)}return _})(this.buf,e,this.pos);const s=this.pos-i;s>=128&&xf(i,s,this),this.pos=i-1,this.writeVarint(s),this.pos+=s}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const i=e.length;this.writeVarint(i),this.realloc(i);for(let s=0;s<i;s++)this.buf[this.pos++]=e[s]}writeRawMessage(e,i){this.pos++;const s=this.pos;e(i,this);const A=this.pos-s;A>=128&&xf(s,A,this),this.pos=s-1,this.writeVarint(A),this.pos+=A}writeMessage(e,i,s){this.writeTag(e,2),this.writeRawMessage(i,s)}writePackedVarint(e,i){i.length&&this.writeMessage(e,T0,i)}writePackedSVarint(e,i){i.length&&this.writeMessage(e,P0,i)}writePackedBoolean(e,i){i.length&&this.writeMessage(e,S0,i)}writePackedFloat(e,i){i.length&&this.writeMessage(e,M0,i)}writePackedDouble(e,i){i.length&&this.writeMessage(e,E0,i)}writePackedFixed32(e,i){i.length&&this.writeMessage(e,C0,i)}writePackedSFixed32(e,i){i.length&&this.writeMessage(e,I0,i)}writePackedFixed64(e,i){i.length&&this.writeMessage(e,D0,i)}writePackedSFixed64(e,i){i.length&&this.writeMessage(e,k0,i)}writeBytesField(e,i){this.writeTag(e,2),this.writeBytes(i)}writeFixed32Field(e,i){this.writeTag(e,5),this.writeFixed32(i)}writeSFixed32Field(e,i){this.writeTag(e,5),this.writeSFixed32(i)}writeFixed64Field(e,i){this.writeTag(e,1),this.writeFixed64(i)}writeSFixed64Field(e,i){this.writeTag(e,1),this.writeSFixed64(i)}writeVarintField(e,i){this.writeTag(e,0),this.writeVarint(i)}writeSVarintField(e,i){this.writeTag(e,0),this.writeSVarint(i)}writeStringField(e,i){this.writeTag(e,2),this.writeString(i)}writeFloatField(e,i){this.writeTag(e,5),this.writeFloat(i)}writeDoubleField(e,i){this.writeTag(e,1),this.writeDouble(i)}writeBooleanField(e,i){this.writeVarintField(e,+i)}}function eh(r,e,i){return i?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function xf(r,e,i){const s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(s);for(let A=i.pos-1;A>=r;A--)i.buf[A+s]=i.buf[A]}function T0(r,e){for(let i=0;i<r.length;i++)e.writeVarint(r[i])}function P0(r,e){for(let i=0;i<r.length;i++)e.writeSVarint(r[i])}function M0(r,e){for(let i=0;i<r.length;i++)e.writeFloat(r[i])}function E0(r,e){for(let i=0;i<r.length;i++)e.writeDouble(r[i])}function S0(r,e){for(let i=0;i<r.length;i++)e.writeBoolean(r[i])}function C0(r,e){for(let i=0;i<r.length;i++)e.writeFixed32(r[i])}function I0(r,e){for(let i=0;i<r.length;i++)e.writeSFixed32(r[i])}function D0(r,e){for(let i=0;i<r.length;i++)e.writeFixed64(r[i])}function k0(r,e){for(let i=0;i<r.length;i++)e.writeSFixed64(r[i])}function z0(r,e,i){r===1&&i.readMessage(L0,e)}function L0(r,e,i){if(r===3){const{id:s,bitmap:A,width:d,height:_,left:b,top:M,advance:I}=i.readMessage(B0,{});e.push({id:s,bitmap:new Th({width:d+6,height:_+6},A),metrics:{width:d,height:_,left:b,top:M,advance:I}})}}function B0(r,e,i){r===1?e.id=i.readVarint():r===2?e.bitmap=i.readBytes():r===3?e.width=i.readVarint():r===4?e.height=i.readVarint():r===5?e.left=i.readSVarint():r===6?e.top=i.readSVarint():r===7&&(e.advance=i.readVarint())}function bf(r){let e=0,i=0;for(const _ of r)e+=_.w*_.h,i=Math.max(i,_.w);r.sort(((_,b)=>b.h-_.h));const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let A=0,d=0;for(const _ of r)for(let b=s.length-1;b>=0;b--){const M=s[b];if(!(_.w>M.w||_.h>M.h)){if(_.x=M.x,_.y=M.y,d=Math.max(d,_.y+_.h),A=Math.max(A,_.x+_.w),_.w===M.w&&_.h===M.h){const I=s.pop();I&&b<s.length&&(s[b]=I)}else _.h===M.h?(M.x+=_.w,M.w-=_.w):_.w===M.w?(M.y+=_.h,M.h-=_.h):(s.push({x:M.x+_.w,y:M.y,w:M.w-_.w,h:_.h}),M.y+=_.h,M.h-=_.h);break}}return{w:A,h:d,fill:e/(A*d)||0}}class Qc{constructor(e,{pixelRatio:i,version:s,stretchX:A,stretchY:d,content:_,textFitWidth:b,textFitHeight:M}){this.paddedRect=e,this.pixelRatio=i,this.stretchX=A,this.stretchY=d,this.content=_,this.version=s,this.textFitWidth=b,this.textFitHeight=M}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class wf{constructor(e,i){const s={},A={};this.haveRenderCallbacks=[];const d=[];this.addImages(e,s,d),this.addImages(i,A,d);const{w:_,h:b}=bf(d),M=new mo({width:_||1,height:b||1});for(const I in e){const k=e[I],F=s[I].paddedRect;mo.copy(k.data,M,{x:0,y:0},{x:F.x+1,y:F.y+1},k.data)}for(const I in i){const k=i[I],F=A[I].paddedRect,V=F.x+1,j=F.y+1,H=k.data.width,Q=k.data.height;mo.copy(k.data,M,{x:0,y:0},{x:V,y:j},k.data),mo.copy(k.data,M,{x:0,y:Q-1},{x:V,y:j-1},{width:H,height:1}),mo.copy(k.data,M,{x:0,y:0},{x:V,y:j+Q},{width:H,height:1}),mo.copy(k.data,M,{x:H-1,y:0},{x:V-1,y:j},{width:1,height:Q}),mo.copy(k.data,M,{x:0,y:0},{x:V+H,y:j},{width:1,height:Q})}this.image=M,this.iconPositions=s,this.patternPositions=A}addImages(e,i,s){for(const A in e){const d=e[A],_={x:0,y:0,w:d.data.width+2,h:d.data.height+2};s.push(_),i[A]=new Qc(_,d),d.hasRenderCallback&&this.haveRenderCallbacks.push(A)}}patchUpdatedImages(e,i){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const s in e.updatedImages)this.patchUpdatedImage(this.iconPositions[s],e.getImage(s),i),this.patchUpdatedImage(this.patternPositions[s],e.getImage(s),i)}patchUpdatedImage(e,i,s){if(!e||!i||e.version===i.version)return;e.version=i.version;const[A,d]=e.tl;s.update(i.data,void 0,{x:A,y:d})}}var iu;function ac(r,e,i,s,A,d,_,b,M,I,k,F,V,j,H){const Q=Ju.fromFeature(r,A);let Y;F===W.az.vertical&&Q.verticalizePunctuation();let re=Q.determineLineBreaks(I,d,e,s,j);const{processBidirectionalText:ge,processStyledBidirectionalText:oe}=Oe;if(ge&&Q.sections.length===1){Y=[],re=re.map((Ue=>Q.toCodeUnitIndex(Ue)));const Te=ge(Q.toString(),re);for(const Ue of Te){const lt=[...Ue].map((()=>0));Y.push(new Ju(Ue,Q.sections,lt))}}else if(oe){Y=[],re=re.map((nt=>Q.toCodeUnitIndex(nt)));let Te=0;const Ue=[];for(const nt of Q.text)Ue.push(...Array(nt.length).fill(Q.sectionIndex[Te])),Te++;const lt=oe(Q.text,Ue,re);for(const nt of lt){const dt=[];let Tt="";for(const mt of nt[0])dt.push(nt[1][Tt.length]),Tt+=mt;Y.push(new Ju(nt[0],Q.sections,dt))}}else Y=(function(Te,Ue){const lt=[];let nt=0;for(const dt of Ue)lt.push(Te.substring(nt,dt)),nt=dt;return nt<Te.length()&&lt.push(Te.substring(nt,Te.length())),lt})(Q,re);const ue=[],ve={positionedLines:ue,text:Q.toString(),top:k[1],bottom:k[1],left:k[0],right:k[0],writingMode:F,iconsInText:!1,verticalizable:!1};return(function(Te,Ue,lt,nt,dt,Tt,mt,st,Xe,Lt,Ct,Ot){let Et=0,Ut=0,ji=0,Di=0;const Or=st==="right"?1:st==="left"?0:.5,Ps=ns/Ot;let Tn=0;for(const rr of dt){rr.trim();const Xr=rr.getMaxScale(),ln={positionedGlyphs:[],lineOffset:0};Te.positionedLines[Tn]=ln;const Pr=ln.positionedGlyphs;let _o=0;if(!rr.length()){Ut+=Tt,++Tn;continue}const Ms=R0(nt,rr,Ps);let go=0;for(const as of rr.text){const qr=rr.getSection(go),Pn=as.codePointAt(0),Kr=F0(Xe,Ct,Pn),ls={glyph:Pn,imageName:null,x:Et,y:Ut+-17,vertical:Kr,scale:1,fontStack:"",sectionIndex:rr.getSectionIndex(go),metrics:null,rect:null};let Fl;if("fontStack"in qr){if(Fl=O0(qr,Pn,Kr,Ms,Ue,lt),!Fl)continue;ls.fontStack=qr.fontStack}else{if(Te.iconsInText=!0,qr.scale*=Ps,Fl=N0(qr,Kr,Xr,Ms,nt),!Fl)continue;_o=Math.max(_o,Fl.imageOffset),ls.imageName=qr.imageName}const{rect:Ua,metrics:jh,baselineOffset:au}=Fl;ls.y+=au,ls.scale=qr.scale,ls.metrics=jh,ls.rect=Ua,Pr.push(ls),Kr?(Te.verticalizable=!0,Et+=("imageName"in qr?jh.advance:ns)*qr.scale+Lt):Et+=jh.advance*qr.scale+Lt,go++}Pr.length!==0&&(ji=Math.max(Et-Lt,ji),V0(Pr,0,Pr.length-1,Or)),Et=0,ln.lineOffset=Math.max(_o,(Xr-1)*ns);const Pa=Tt*Xr+_o;Ut+=Pa,Di=Math.max(Pa,Di),++Tn}const{horizontalAlign:Nr,verticalAlign:kr}=$c(mt);(function(rr,Xr,ln,Pr,_o,Ms,go,Pa,as){const qr=(Xr-ln)*_o;let Pn=0;Pn=Ms!==go?-Pa*Pr- -17:-Pr*as*go+.5*go;for(const Kr of rr)for(const ls of Kr.positionedGlyphs)ls.x+=qr,ls.y+=Pn})(Te.positionedLines,Or,Nr,kr,ji,Di,Tt,Ut,dt.length),Te.top+=-kr*Ut,Te.bottom=Te.top+Ut,Te.left+=-Nr*ji,Te.right=Te.left+ji})(ve,e,i,s,Y,_,b,M,F,I,V,H),!(function(Te){for(const Ue of Te)if(Ue.positionedGlyphs.length!==0)return!1;return!0})(ue)&&ve}function $c(r){let e=.5,i=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function R0(r,e,i){const s=e.getMaxScale()*ns,{maxImageWidth:A,maxImageHeight:d}=e.getMaxImageSize(r),_=Math.max(s,d*i);return{verticalLineContentWidth:Math.max(s,A*i),horizontalLineContentHeight:_}}function Tf(r){switch(r){case"top":return 0;case"center":return .5;default:return 1}}function F0(r,e,i){return!(r===W.az.horizontal||!e&&!P(i)||e&&(S(i)||(s=i,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(s)))));var s}function O0(r,e,i,s,A,d){const _=d[r.fontStack],b=(function(I,k,F,V){if(I&&I.rect)return I;const j=k[F.fontStack],H=j&&j[V];return H?{rect:null,metrics:H.metrics}:null})(_&&_[e],A,r,e);if(b===null)return null;let M;if(i)M=s.verticalLineContentWidth-r.scale*ns;else{const I=Tf(r.verticalAlign);M=(s.horizontalLineContentHeight-r.scale*ns)*I}return{rect:b.rect,metrics:b.metrics,baselineOffset:M}}function N0(r,e,i,s,A){const d=A[r.imageName];if(!d)return null;const _=d.paddedRect,b=d.displaySize,M={width:b[0],height:b[1],left:1,top:-3,advance:e?b[1]:b[0]};let I;if(e)I=s.verticalLineContentWidth-b[1]*r.scale;else{const k=Tf(r.verticalAlign);I=(s.horizontalLineContentHeight-b[1]*r.scale)*k}return{rect:_,metrics:M,baselineOffset:I,imageOffset:(e?b[0]:b[1])*r.scale-ns*i}}function V0(r,e,i,s){if(s===0)return;const A=r[i],d=(r[i].x+A.metrics.advance*A.scale)*s;for(let _=e;_<=i;_++)r[_].x-=d}function j0(r,e,i){const{horizontalAlign:s,verticalAlign:A}=$c(i),d=e[0]-r.displaySize[0]*s,_=e[1]-r.displaySize[1]*A;return{image:r,top:_,bottom:_+r.displaySize[1],left:d,right:d+r.displaySize[0]}}function Pf(r){var e,i;let s=r.left,A=r.top,d=r.right-s,_=r.bottom-A;const b=(e=r.image.textFitWidth)!==null&&e!==void 0?e:"stretchOrShrink",M=(i=r.image.textFitHeight)!==null&&i!==void 0?i:"stretchOrShrink",I=(r.image.content[2]-r.image.content[0])/(r.image.content[3]-r.image.content[1]);if(M==="proportional"){if(b==="stretchOnly"&&d/_<I||b==="proportional"){const k=Math.ceil(_*I);s*=k/d,d=k}}else if(b==="proportional"&&M==="stretchOnly"&&I!==0&&d/_>I){const k=Math.ceil(d/I);A*=k/_,_=k}return{x1:s,y1:A,x2:s+d,y2:A+_}}function Mf(r,e,i,s,A,d){const _=r.image;let b;if(_.content){const Y=_.content,re=_.pixelRatio||1;b=[Y[0]/re,Y[1]/re,_.displaySize[0]-Y[2]/re,_.displaySize[1]-Y[3]/re]}const M=e.left*d,I=e.right*d;let k,F,V,j;i==="width"||i==="both"?(j=A[0]+M-s[3],F=A[0]+I+s[1]):(j=A[0]+(M+I-_.displaySize[0])/2,F=j+_.displaySize[0]);const H=e.top*d,Q=e.bottom*d;return i==="height"||i==="both"?(k=A[1]+H-s[0],V=A[1]+Q+s[2]):(k=A[1]+(H+Q-_.displaySize[1])/2,V=k+_.displaySize[1]),{image:_,top:k,right:F,bottom:V,left:j,collisionPadding:b}}kt("ImagePosition",Qc),kt("ImageAtlas",wf),W.az=void 0,(iu=W.az||(W.az={}))[iu.none=0]="none",iu[iu.horizontal=1]="horizontal",iu[iu.vertical=2]="vertical",iu[iu.horizontalOnly=3]="horizontalOnly";const Bl=128,ru=32640;function Ef(r,e){const{expression:i}=e;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new ze(r+1))};if(i.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:A}=i;let d=0;for(;d<s.length&&s[d]<=r;)d++;d=Math.max(0,d-1);let _=d;for(;_<s.length&&s[_]<r+1;)_++;_=Math.min(s.length-1,_);const b=s[d],M=s[_];return i.kind==="composite"?{kind:"composite",minZoom:b,maxZoom:M,interpolationType:A}:{kind:"camera",minZoom:b,maxZoom:M,minSize:i.evaluate(new ze(b)),maxSize:i.evaluate(new ze(M)),interpolationType:A}}}function Yc(r,e,i){let s="never";const A=r.get(e);return A?s=A:r.get(i)&&(s="always"),s}const Z0=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function lc(r,e,i,s,A,d,_,b,M,I,k,F,V){const j=b?Math.min(ru,Math.round(b[0])):0,H=b?Math.min(ru,Math.round(b[1])):0;r.emplaceBack(e,i,Math.round(32*s),Math.round(32*A),d,_,(j<<1)+(M?1:0),H,16*I,16*k,256*F,256*V)}function Xc(r,e,i){r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i)}function U0(r){for(const e of r.sections)if(Je(e.text))return!0;return!1}class Kc{constructor(e){this.layoutVertexArray=new be,this.indexArray=new Ye,this.programConfigurations=e,this.segments=new Pt,this.dynamicLayoutVertexArray=new Le,this.opacityVertexArray=new Ke,this.hasVisibleVertices=!1,this.placedSymbolArray=new T}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,i,s,A){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,m0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,_0.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Z0,!0),this.opacityVertexBuffer.itemSize=1),(s||A)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}kt("SymbolBuffers",Kc);class Jc{constructor(e,i,s){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new s,this.segments=new Pt,this.collisionVertexArray=new $e}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,g0.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}kt("CollisionBuffers",Jc);class th{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((_=>_.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Ef(this.zoom,i["text-size"]),this.iconSizeData=Ef(this.zoom,i["icon-size"]);const s=this.layers[0].layout,A=s.get("symbol-sort-key"),d=s.get("symbol-z-order");this.canOverlap=Yc(s,"text-overlap","text-allow-overlap")!=="never"||Yc(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=d!=="viewport-y"&&!A.isConstant(),this.sortFeaturesByY=(d==="viewport-y"||d==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map((_=>W.az[_]))),this.stateDependentLayerIds=this.layers.filter((_=>_.isStateDependent())).map((_=>_.id)),this.sourceID=e.sourceID}createArrays(){this.text=new Kc(new Ll(this.layers,this.zoom,(e=>/^text/.test(e)))),this.icon=new Kc(new Ll(this.layers,this.zoom,(e=>/^icon/.test(e)))),this.glyphOffsetArray=new B,this.lineVertexArray=new N,this.symbolInstances=new D,this.textAnchorOffsets=new U}calculateGlyphDependencies(e,i,s,A,d){for(const _ of e)if(i[_.codePointAt(0)]=!0,(s||A)&&d){const b=Lh[_];b&&(i[b.codePointAt(0)]=!0)}}populate(e,i,s){const A=this.layers[0],d=A.layout,_=d.get("text-font"),b=d.get("text-field"),M=d.get("icon-image"),I=(b.value.kind!=="constant"||b.value.value instanceof Wn&&!b.value.value.isEmpty()||b.value.value.toString().length>0)&&(_.value.kind!=="constant"||_.value.value.length>0),k=M.value.kind!=="constant"||!!M.value.value||Object.keys(M.parameters).length>0,F=d.get("symbol-sort-key");if(this.features=[],!I&&!k)return;const V=i.iconDependencies,j=i.glyphDependencies,H=i.availableImages,Q=new ze(this.zoom);for(const{feature:Y,id:re,index:ge,sourceLayerIndex:oe}of e){const ue=A._featureFilter.needGeometry,ve=dl(Y,ue);if(!A._featureFilter.filter(Q,ve,s))continue;let Te,Ue;if(ue||(ve.geometry=fl(Y)),I){const nt=A.getValueAndResolveTokens("text-field",ve,s,H),dt=Wn.factory(nt),Tt=this.hasRTLText=this.hasRTLText||U0(dt);(!Tt||Oe.getRTLTextPluginStatus()==="unavailable"||Tt&&Oe.isParsed())&&(Te=v0(dt,A,ve))}if(k){const nt=A.getValueAndResolveTokens("icon-image",ve,s,H);Ue=nt instanceof gn?nt:gn.fromString(nt)}if(!Te&&!Ue)continue;const lt=this.sortFeaturesByKey?F.evaluate(ve,{},s):void 0;if(this.features.push({id:re,text:Te,icon:Ue,index:ge,sourceLayerIndex:oe,geometry:ve.geometry,properties:Y.properties,type:Dh.types[Y.type],sortKey:lt}),Ue&&(V[Ue.name]=!0),Te){const nt=_.evaluate(ve,{},s).join(","),dt=d.get("text-rotation-alignment")!=="viewport"&&d.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(W.az.vertical)>=0;for(const Tt of Te.sections)if(Tt.image)V[Tt.image.name]=!0;else{const mt=z(Te.toString()),st=Tt.fontStack||nt,Xe=j[st]=j[st]||{};this.calculateGlyphDependencies(Tt.text,Xe,dt,this.allowVerticalPlacement,mt)}}}d.get("symbol-placement")==="line"&&(this.features=(function(Y){const re={},ge={},oe=[];let ue=0;function ve(nt){oe.push(Y[nt]),ue++}function Te(nt,dt,Tt){const mt=ge[nt];return delete ge[nt],ge[dt]=mt,oe[mt].geometry[0].pop(),oe[mt].geometry[0]=oe[mt].geometry[0].concat(Tt[0]),mt}function Ue(nt,dt,Tt){const mt=re[dt];return delete re[dt],re[nt]=mt,oe[mt].geometry[0].shift(),oe[mt].geometry[0]=Tt[0].concat(oe[mt].geometry[0]),mt}function lt(nt,dt,Tt){const mt=Tt?dt[0][dt[0].length-1]:dt[0][0];return`${nt}:${mt.x}:${mt.y}`}for(let nt=0;nt<Y.length;nt++){const dt=Y[nt],Tt=dt.geometry,mt=dt.text?dt.text.toString():null;if(!mt){ve(nt);continue}const st=lt(mt,Tt),Xe=lt(mt,Tt,!0);if(st in ge&&Xe in re&&ge[st]!==re[Xe]){const Lt=Ue(st,Xe,Tt),Ct=Te(st,Xe,oe[Lt].geometry);delete re[st],delete ge[Xe],ge[lt(mt,oe[Ct].geometry,!0)]=Ct,oe[Lt].geometry=null}else st in ge?Te(st,Xe,Tt):Xe in re?Ue(st,Xe,Tt):(ve(nt),re[st]=ue-1,ge[Xe]=ue-1)}return oe.filter((nt=>nt.geometry))})(this.features)),this.sortFeaturesByKey&&this.features.sort(((Y,re)=>Y.sortKey-re.sortKey))}update(e,i,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,i,this.layers,{imagePositions:s}),this.icon.programConfigurations.updatePaintArrays(e,i,this.layers,{imagePositions:s}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,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(e,i){const s=this.lineVertexArray.length;if(e.segment!==void 0){let A=e.dist(i[e.segment+1]),d=e.dist(i[e.segment]);const _={};for(let b=e.segment+1;b<i.length;b++)_[b]={x:i[b].x,y:i[b].y,tileUnitDistanceFromAnchor:A},b<i.length-1&&(A+=i[b+1].dist(i[b]));for(let b=e.segment||0;b>=0;b--)_[b]={x:i[b].x,y:i[b].y,tileUnitDistanceFromAnchor:d},b>0&&(d+=i[b-1].dist(i[b]));for(let b=0;b<i.length;b++){const M=_[b];this.lineVertexArray.emplaceBack(M.x,M.y,M.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,i,s,A,d,_,b,M,I,k,F,V){const j=e.indexArray,H=e.layoutVertexArray,Q=e.segments.prepareSegment(4*i.length,H,j,this.canOverlap?_.sortKey:void 0),Y=this.glyphOffsetArray.length,re=Q.vertexLength,ge=this.allowVerticalPlacement&&b===W.az.vertical?Math.PI/2:0,oe=_.text&&_.text.sections;for(let ue=0;ue<i.length;ue++){const{tl:ve,tr:Te,bl:Ue,br:lt,tex:nt,pixelOffsetTL:dt,pixelOffsetBR:Tt,minFontScaleX:mt,minFontScaleY:st,glyphOffset:Xe,isSDF:Lt,sectionIndex:Ct}=i[ue],Ot=Q.vertexLength,Et=Xe[1];lc(H,M.x,M.y,ve.x,Et+ve.y,nt.x,nt.y,s,Lt,dt.x,dt.y,mt,st),lc(H,M.x,M.y,Te.x,Et+Te.y,nt.x+nt.w,nt.y,s,Lt,Tt.x,dt.y,mt,st),lc(H,M.x,M.y,Ue.x,Et+Ue.y,nt.x,nt.y+nt.h,s,Lt,dt.x,Tt.y,mt,st),lc(H,M.x,M.y,lt.x,Et+lt.y,nt.x+nt.w,nt.y+nt.h,s,Lt,Tt.x,Tt.y,mt,st),Xc(e.dynamicLayoutVertexArray,M,ge),j.emplaceBack(Ot,Ot+2,Ot+1),j.emplaceBack(Ot+1,Ot+2,Ot+3),Q.vertexLength+=4,Q.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Xe[0]),ue!==i.length-1&&Ct===i[ue+1].sectionIndex||e.programConfigurations.populatePaintArrays(H.length,_,_.index,{imagePositions:{},canonical:V,formattedSection:oe&&oe[Ct]})}e.placedSymbolArray.emplaceBack(M.x,M.y,Y,this.glyphOffsetArray.length-Y,re,I,k,M.segment,s?s[0]:0,s?s[1]:0,A[0],A[1],b,0,!1,0,F)}_addCollisionDebugVertex(e,i,s,A,d,_){return i.emplaceBack(0,0),e.emplaceBack(s.x,s.y,A,d,Math.round(_.x),Math.round(_.y))}addCollisionDebugVertices(e,i,s,A,d,_,b){const M=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),I=M.vertexLength,k=d.layoutVertexArray,F=d.collisionVertexArray,V=b.anchorX,j=b.anchorY;this._addCollisionDebugVertex(k,F,_,V,j,new it(e,i)),this._addCollisionDebugVertex(k,F,_,V,j,new it(s,i)),this._addCollisionDebugVertex(k,F,_,V,j,new it(s,A)),this._addCollisionDebugVertex(k,F,_,V,j,new it(e,A)),M.vertexLength+=4;const H=d.indexArray;H.emplaceBack(I,I+1),H.emplaceBack(I+1,I+2),H.emplaceBack(I+2,I+3),H.emplaceBack(I+3,I),M.primitiveLength+=4}addDebugCollisionBoxes(e,i,s,A){for(let d=e;d<i;d++){const _=this.collisionBoxArray.get(d);this.addCollisionDebugVertices(_.x1,_.y1,_.x2,_.y2,A?this.textCollisionBox:this.iconCollisionBox,_.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Jc(He,df.members,xt),this.iconCollisionBox=new Jc(He,df.members,xt);for(let e=0;e<this.symbolInstances.length;e++){const i=this.symbolInstances.get(e);this.addDebugCollisionBoxes(i.textBoxStartIndex,i.textBoxEndIndex,i,!0),this.addDebugCollisionBoxes(i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i,!0),this.addDebugCollisionBoxes(i.iconBoxStartIndex,i.iconBoxEndIndex,i,!1),this.addDebugCollisionBoxes(i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex,i,!1)}}_deserializeCollisionBoxesForSymbol(e,i,s,A,d,_,b,M,I){const k={};for(let F=i;F<s;F++){const V=e.get(F);k.textBox={x1:V.x1,y1:V.y1,x2:V.x2,y2:V.y2,anchorPointX:V.anchorPointX,anchorPointY:V.anchorPointY},k.textFeatureIndex=V.featureIndex;break}for(let F=A;F<d;F++){const V=e.get(F);k.verticalTextBox={x1:V.x1,y1:V.y1,x2:V.x2,y2:V.y2,anchorPointX:V.anchorPointX,anchorPointY:V.anchorPointY},k.verticalTextFeatureIndex=V.featureIndex;break}for(let F=_;F<b;F++){const V=e.get(F);k.iconBox={x1:V.x1,y1:V.y1,x2:V.x2,y2:V.y2,anchorPointX:V.anchorPointX,anchorPointY:V.anchorPointY},k.iconFeatureIndex=V.featureIndex;break}for(let F=M;F<I;F++){const V=e.get(F);k.verticalIconBox={x1:V.x1,y1:V.y1,x2:V.x2,y2:V.y2,anchorPointX:V.anchorPointX,anchorPointY:V.anchorPointY},k.verticalIconFeatureIndex=V.featureIndex;break}return k}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.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(e,i){const s=e.placedSymbolArray.get(i),A=s.vertexStartIndex+4*s.numGlyphs;for(let d=s.vertexStartIndex;d<A;d+=4)e.indexArray.emplaceBack(d,d+2,d+1),e.indexArray.emplaceBack(d+1,d+2,d+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),s=Math.cos(e),A=[],d=[],_=[];for(let b=0;b<this.symbolInstances.length;++b){_.push(b);const M=this.symbolInstances.get(b);A.push(0|Math.round(i*M.anchorX+s*M.anchorY)),d.push(M.featureIndex)}return _.sort(((b,M)=>A[b]-A[M]||d[M]-d[b])),_}addToSortKeyRanges(e,i){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===i?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const i of this.symbolInstanceIndexes){const s=this.symbolInstances.get(i);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach(((A,d,_)=>{A>=0&&_.indexOf(A)===d&&this.addIndicesForPlacedSymbol(this.text,A)})),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Sf,Cf;kt("SymbolBucket",th,{omit:["layers","collisionBoxArray","features","compareText"]}),th.MAX_GLYPHS=65535,th.addDynamicAttributes=Xc;var eA={get paint(){return Cf=Cf||new is({"icon-opacity":new Mt(qe.paint_symbol["icon-opacity"]),"icon-color":new Mt(qe.paint_symbol["icon-color"]),"icon-halo-color":new Mt(qe.paint_symbol["icon-halo-color"]),"icon-halo-width":new Mt(qe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Mt(qe.paint_symbol["icon-halo-blur"]),"icon-translate":new _t(qe.paint_symbol["icon-translate"]),"icon-translate-anchor":new _t(qe.paint_symbol["icon-translate-anchor"]),"text-opacity":new Mt(qe.paint_symbol["text-opacity"]),"text-color":new Mt(qe.paint_symbol["text-color"],{runtimeType:fi,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new Mt(qe.paint_symbol["text-halo-color"]),"text-halo-width":new Mt(qe.paint_symbol["text-halo-width"]),"text-halo-blur":new Mt(qe.paint_symbol["text-halo-blur"]),"text-translate":new _t(qe.paint_symbol["text-translate"]),"text-translate-anchor":new _t(qe.paint_symbol["text-translate-anchor"])})},get layout(){return Sf=Sf||new is({"symbol-placement":new _t(qe.layout_symbol["symbol-placement"]),"symbol-spacing":new _t(qe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new _t(qe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Mt(qe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new _t(qe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new _t(qe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new _t(qe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new _t(qe.layout_symbol["icon-ignore-placement"]),"icon-optional":new _t(qe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new _t(qe.layout_symbol["icon-rotation-alignment"]),"icon-size":new Mt(qe.layout_symbol["icon-size"]),"icon-text-fit":new _t(qe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new _t(qe.layout_symbol["icon-text-fit-padding"]),"icon-image":new Mt(qe.layout_symbol["icon-image"]),"icon-rotate":new Mt(qe.layout_symbol["icon-rotate"]),"icon-padding":new Mt(qe.layout_symbol["icon-padding"]),"icon-keep-upright":new _t(qe.layout_symbol["icon-keep-upright"]),"icon-offset":new Mt(qe.layout_symbol["icon-offset"]),"icon-anchor":new Mt(qe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new _t(qe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new _t(qe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new _t(qe.layout_symbol["text-rotation-alignment"]),"text-field":new Mt(qe.layout_symbol["text-field"]),"text-font":new Mt(qe.layout_symbol["text-font"]),"text-size":new Mt(qe.layout_symbol["text-size"]),"text-max-width":new Mt(qe.layout_symbol["text-max-width"]),"text-line-height":new _t(qe.layout_symbol["text-line-height"]),"text-letter-spacing":new Mt(qe.layout_symbol["text-letter-spacing"]),"text-justify":new Mt(qe.layout_symbol["text-justify"]),"text-radial-offset":new Mt(qe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new _t(qe.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Mt(qe.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Mt(qe.layout_symbol["text-anchor"]),"text-max-angle":new _t(qe.layout_symbol["text-max-angle"]),"text-writing-mode":new _t(qe.layout_symbol["text-writing-mode"]),"text-rotate":new Mt(qe.layout_symbol["text-rotate"]),"text-padding":new _t(qe.layout_symbol["text-padding"]),"text-keep-upright":new _t(qe.layout_symbol["text-keep-upright"]),"text-transform":new Mt(qe.layout_symbol["text-transform"]),"text-offset":new Mt(qe.layout_symbol["text-offset"]),"text-allow-overlap":new _t(qe.layout_symbol["text-allow-overlap"]),"text-overlap":new _t(qe.layout_symbol["text-overlap"]),"text-ignore-placement":new _t(qe.layout_symbol["text-ignore-placement"]),"text-optional":new _t(qe.layout_symbol["text-optional"])})}};class If{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Qi,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}kt("FormatSectionOverride",If,{omit:["defaultValue"]});class uc extends ko{constructor(e,i){super(e,eA,i)}recalculate(e,i){if(super.recalculate(e,i),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const s=this.layout.get("text-writing-mode");if(s){const A=[];for(const d of s)A.indexOf(d)<0&&A.push(d);this.layout._values["text-writing-mode"]=A}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,i,s,A){const d=this.layout.get(e).evaluate(i,{},s,A),_=this._unevaluatedLayout._values[e];return _.isDataDriven()||ds(_.value)||!d?d:(function(b,M){return M.replace(/{([^{}]+)}/g,((I,k)=>b&&k in b?String(b[k]):""))})(i.properties,d)}createBucket(e){return new th(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of eA.paint.overridableProperties){if(!uc.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),s=new If(i),A=new ol(s,i.property.specification);let d=null;d=i.value.kind==="constant"||i.value.kind==="source"?new v("source",A):new E("composite",A,i.value.zoomStops),this.paint._values[e]=new Vt(i.property,d,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,s){return!(!this.layout||i.isDataDriven()||s.isDataDriven())&&uc.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const s=e.get("text-field"),A=eA.paint.properties[i];let d=!1;const _=b=>{for(const M of b)if(A.overrides&&A.overrides.hasOverride(M))return void(d=!0)};if(s.value.kind==="constant"&&s.value.value instanceof Wn)_(s.value.value.sections);else if(s.value.kind==="source"||s.value.kind==="composite"){const b=I=>{d||(I instanceof gs&&Si(I.value)===xo?_(I.value.sections):I instanceof La?_(I.sections):I.eachChild(b))},M=s.value;M._styleExpression&&b(M._styleExpression.expression)}return d}}let Df;var G0={get paint(){return Df=Df||new is({"background-color":new _t(qe.paint_background["background-color"]),"background-pattern":new Yi(qe.paint_background["background-pattern"]),"background-opacity":new _t(qe.paint_background["background-opacity"])})}};class q0 extends ko{constructor(e,i){super(e,G0,i)}}class H0 extends ko{constructor(e,i){super(e,{},i),this.onAdd=s=>{this.implementation.onAdd&&this.implementation.onAdd(s,s.painter.context.gl)},this.onRemove=s=>{this.implementation.onRemove&&this.implementation.onRemove(s,s.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class W0{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._methodToThrottle()}),0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Q0={once:!0},tA=63710088e-1;class nu{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new nu(hn(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,s=this.lat*i,A=e.lat*i,d=Math.sin(s)*Math.sin(A)+Math.cos(s)*Math.cos(A)*Math.cos((e.lng-this.lng)*i);return tA*Math.acos(Math.min(d,1))}static convert(e){if(e instanceof nu)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new nu(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new nu(Number("lng"in e?e.lng:e.lon),Number(e.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 kf=2*Math.PI*tA;function zf(r){return kf*Math.cos(r*Math.PI/180)}function Lf(r){return(180+r)/360}function Bf(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function Rf(r,e){return r/zf(e)}function Ff(r){return 360*r-180}function hc(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Of(r,e){return r*zf(hc(e))}class Bh{constructor(e,i,s=0){this.x=+e,this.y=+i,this.z=+s}static fromLngLat(e,i=0){const s=nu.convert(e);return new Bh(Lf(s.lng),Bf(s.lat),Rf(i,s.lat))}toLngLat(){return new nu(Ff(this.x),hc(this.y))}toAltitude(){return Of(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/kf*(e=hc(this.y),1/Math.cos(e*Math.PI/180));var e}}function Nf(r,e,i){var s=2*Math.PI*6378137/256/Math.pow(2,i);return[r*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}class iA{constructor(e,i,s){if(!(function(A,d,_){return!(A<0||A>25||_<0||_>=Math.pow(2,A)||d<0||d>=Math.pow(2,A))})(e,i,s))throw new Error(`x=${i}, y=${s}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=i,this.y=s,this.key=ih(0,e,e,i,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i,s){const A=(function(_,b,M){var I=Nf(256*_,256*(b=Math.pow(2,M)-b-1),M),k=Nf(256*(_+1),256*(b+1),M);return I[0]+","+I[1]+","+k[0]+","+k[1]})(this.x,this.y,this.z),d=(function(_,b,M){let I,k="";for(let F=_;F>0;F--)I=1<<F-1,k+=(b&I?1:0)+(M&I?2:0);return k})(this.z,this.x,this.y);return e[(this.x+this.y)%e.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(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,i>1?"@2x":"").replace(/{quadkey}/g,d).replace(/{bbox-epsg-3857}/g,A)}isChildOf(e){const i=this.z-e.z;return i>0&&e.x===this.x>>i&&e.y===this.y>>i}getTilePoint(e){const i=Math.pow(2,this.z);return new it((e.x*i-this.x)*Oi,(e.y*i-this.y)*Oi)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Vf{constructor(e,i){this.wrap=e,this.canonical=i,this.key=ih(e,i.z,i.z,i.x,i.y)}}class oa{constructor(e,i,s,A,d){if(this.terrainRttPosMatrix32f=null,e<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=i,this.canonical=new iA(s,+A,+d),this.key=ih(i,e,s,A,d)}clone(){return new oa(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-e;return e>this.canonical.z?new oa(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new oa(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,i){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-e;return e>this.canonical.z?ih(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y):ih(this.wrap*+i,e,e,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;const i=this.canonical.z-e.canonical.z;return!(i<0)&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new oa(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,s=2*this.canonical.x,A=2*this.canonical.y;return[new oa(i,this.wrap,i,s,A),new oa(i,this.wrap,i,s+1,A),new oa(i,this.wrap,i,s,A+1),new oa(i,this.wrap,i,s+1,A+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new oa(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new oa(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Vf(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Bh(e.x-this.wrap,e.y))}}function ih(r,e,i,s,A){(r*=2)<0&&(r=-1*r-1);const d=1<<i;return(d*d*r+d*A+s).toString(36)+i.toString(36)+e.toString(36)}function rA(r,e){return e?r.properties[e]:r.id}function $0(r,e){const i={id:r.id};if(e.removeAllProperties&&(delete r.removeProperties,delete r.addOrUpdateProperties,delete e.removeProperties),e.removeProperties)for(const s of e.removeProperties){const A=r.addOrUpdateProperties.findIndex((d=>d.key===s));A>-1&&r.addOrUpdateProperties.splice(A,1)}return(r.removeAllProperties||e.removeAllProperties)&&(i.removeAllProperties=!0),(r.removeProperties||e.removeProperties)&&(i.removeProperties=[...r.removeProperties||[],...e.removeProperties||[]]),(r.addOrUpdateProperties||e.addOrUpdateProperties)&&(i.addOrUpdateProperties=[...r.addOrUpdateProperties||[],...e.addOrUpdateProperties||[]]),(r.newGeometry||e.newGeometry)&&(i.newGeometry=e.newGeometry||r.newGeometry),i}function jf(r){var e,i;if(!r)return{};const s={};return s.removeAll=r.removeAll,s.remove=new Set(r.remove||[]),s.add=new Map((e=r.add)===null||e===void 0?void 0:e.map((A=>[A.id,A]))),s.update=new Map((i=r.update)===null||i===void 0?void 0:i.map((A=>[A.id,A]))),s}kt("CanonicalTileID",iA),kt("OverscaledTileID",oa,{omit:["terrainRttPosMatrix32f"]});class Cu{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){const i=new Cu;return i.extend(e(new it(this.minX,this.minY))),i.extend(e(new it(this.maxX,this.minY))),i.extend(e(new it(this.minX,this.maxY))),i.extend(e(new it(this.maxX,this.maxY))),i}static fromPoints(e){const i=new Cu;for(const s of e)i.extend(s);return i}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}}class Zf{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const s=e[i];this._stringToNumber[s]=i,this._numberToString[i]=s}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Uf{constructor(e,i,s,A,d){this.type="Feature",this._vectorTileFeature=e,this._x=s,this._y=A,this._z=i,this.properties=e.properties,this.id=d}projectPoint(e,i,s,A){return[360*(e.x+i)/A-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+s)/A)*Math.PI))-90]}projectLine(e,i,s,A){return e.map((d=>this.projectPoint(d,i,s,A)))}get geometry(){if(this._geometry)return this._geometry;const e=this._vectorTileFeature,i=e.extent*Math.pow(2,this._z),s=e.extent*this._x,A=e.extent*this._y,d=e.loadGeometry();switch(e.type){case 1:{const _=[];for(const M of d)_.push(M[0]);const b=this.projectLine(_,s,A,i);this._geometry=_.length===1?{type:"Point",coordinates:b[0]}:{type:"MultiPoint",coordinates:b};break}case 2:{const _=d.map((b=>this.projectLine(b,s,A,i)));this._geometry=_.length===1?{type:"LineString",coordinates:_[0]}:{type:"MultiLineString",coordinates:_};break}case 3:{const _=nf(d),b=[];for(const M of _)b.push(M.map((I=>this.projectLine(I,s,A,i))));this._geometry=b.length===1?{type:"Polygon",coordinates:b[0]}:{type:"MultiPolygon",coordinates:b};break}default:throw new Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const i in this)i!=="_geometry"&&i!=="_vectorTileFeature"&&i!=="_x"&&i!=="_y"&&i!=="_z"&&(e[i]=this[i]);return e}}class rh{constructor(e,i,s){Pi(this,"_name");Pi(this,"dataBuffer");Pi(this,"nullabilityBuffer");Pi(this,"_size");this._name=e,this.dataBuffer=i,typeof s=="number"?this._size=s:(this.nullabilityBuffer=s,this._size=s.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer&&this.nullabilityBuffer.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class cc extends rh{}class nA extends cc{getValueFromBuffer(e){return this.dataBuffer[e]}}class sA extends cc{getValueFromBuffer(e){return this.dataBuffer[e]}}class Gf extends rh{constructor(i,s,A,d){super(i,s,d);Pi(this,"delta");this.delta=A}}class oA extends Gf{constructor(e,i,s,A){super(e,Int32Array.of(i),s,A)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class aA extends rh{constructor(e,i,s){super(e,Int32Array.of(i),s)}getValueFromBuffer(e){return this.dataBuffer[0]}}class Y0{constructor(e,i,s,A,d=4096){Pi(this,"_name");Pi(this,"_geometryVector");Pi(this,"_idVector");Pi(this,"_propertyVectors");Pi(this,"_extent");Pi(this,"propertyVectorsMap");this._name=e,this._geometryVector=i,this._idVector=s,this._propertyVectors=A,this._extent=d}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map((i=>[i.name,i])))),this.propertyVectorsMap.get(e)}*[Symbol.iterator](){const e=this.geometryVector[Symbol.iterator]();let i=0;for(;i<this.numFeatures;){let s;this.idVector&&(s=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(i)):this.idVector.getValue(i));const A=e==null?void 0:e.next().value,d={};for(const _ of this.propertyVectors){if(!_)continue;const b=_.name,M=_.getValue(i);M!==null&&(d[b]=M)}i++,yield{id:s,geometry:A,properties:d}}}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const e=[],i=this.geometryVector.getGeometries();for(let s=0;s<this.numFeatures;s++){let A;this.idVector&&(A=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(s)):this.idVector.getValue(s));const d={coordinates:i[s],type:this.geometryVector.geometryType(s)},_={};for(const b of this.propertyVectors){if(!b)continue;const M=b.name,I=b.getValue(s);I!==null&&(_[M]=I)}e.push({id:A,geometry:d,properties:_})}return e}containsMaxSaveIntegerValues(e){return e instanceof nA||e instanceof aA&&e instanceof oA||e instanceof sA}}class X0{constructor(e){Pi(this,"value");this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var ki,Rl,ws,ja,Iu,Lo,ss,os,qf,aa;function _s(r,e,i){const s=new Int32Array(i);let A=0,d=e.get();for(let _=0;_<s.length;_++){let b=r[d++],M=127&b;b<128||(b=r[d++],M|=(127&b)<<7,b<128||(b=r[d++],M|=(127&b)<<14,b<128||(b=r[d++],M|=(127&b)<<21,b<128||(b=r[d++],M|=(15&b)<<28)))),s[A++]=M}return e.set(d),s}function Ac(r,e,i){const s=new BigInt64Array(i);for(let A=0;A<s.length;A++)s[A]=J0(r,e);return s}function K0(r,e){let i,s;return s=r[e.get()],e.increment(),i=127&s,s<128?i:(s=r[e.get()],e.increment(),i|=(127&s)<<7,s<128?i:(s=r[e.get()],e.increment(),i|=(127&s)<<14,s<128?i:(s=r[e.get()],e.increment(),i|=(127&s)<<21,s<128?i:(s=r[e.get()],i|=(15&s)<<28,(function(A,d,_){let b,M;if(M=d[_.get()],_.increment(),b=(112&M)>>4,M<128||(M=d[_.get()],_.increment(),b|=(127&M)<<3,M<128)||(M=d[_.get()],_.increment(),b|=(127&M)<<10,M<128)||(M=d[_.get()],_.increment(),b|=(127&M)<<17,M<128)||(M=d[_.get()],_.increment(),b|=(127&M)<<24,M<128)||(M=d[_.get()],_.increment(),b|=(1&M)<<31,M<128))return 4294967296*b+(A>>>0);throw new Error("Expected varint not more than 10 bytes")})(i,r,e)))))}function Hf(r,e,i,s){throw new Error("FastPFor is not implemented yet.")}function Du(r){return r>>>1^-(1&r)}function nh(r){return r>>1n^-(1n&r)}function J0(r,e){let i=0n,s=0,A=e.get();for(;A<r.length;){const d=r[A++];if(i|=BigInt(127&d)<<BigInt(s),!(128&d))break;if(s+=7,s>=64)throw new Error("Varint too long")}return e.set(A),i}function Wf(r,e,i){const s=new Int32Array(i);let A=0;for(let d=0;d<e;d++){const _=r[d];s.fill(r[d+e],A,A+_),A+=_}return s}function Qf(r,e,i){const s=new BigInt64Array(i);let A=0;for(let d=0;d<e;d++){const _=Number(r[d]);s.fill(r[d+e],A,A+_),A+=_}return s}function $f(r,e,i){const s=new Float64Array(i);let A=0;for(let d=0;d<e;d++){const _=r[d];s.fill(r[d+e],A,A+_),A+=_}return s}function lA(r){const e=r.length/4*4;let i=1;if(e>=4)for(let s=r[0];i<e-4;i+=4)s=r[i]+=s,s=r[i+1]+=s,s=r[i+2]+=s,s=r[i+3]+=s;for(;i!=r.length;)r[i]+=r[i-1],++i}function Yf(r){r[0]=r[0]>>>1^-(1&r[0]),r[1]=r[1]>>>1^-(1&r[1]);const e=r.length/4*4;let i=2;if(e>=4)for(;i<e-4;i+=4){const s=r[i],A=r[i+1],d=r[i+2],_=r[i+3];r[i]=(s>>>1^-(1&s))+r[i-2],r[i+1]=(A>>>1^-(1&A))+r[i-1],r[i+2]=(d>>>1^-(1&d))+r[i],r[i+3]=(_>>>1^-(1&_))+r[i+1]}for(;i!=r.length;i+=2)r[i]=(r[i]>>>1^-(1&r[i]))+r[i-2],r[i+1]=(r[i+1]>>>1^-(1&r[i+1]))+r[i-1]}(function(r){r.NONE="NONE",r.DELTA="DELTA",r.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",r.RLE="RLE",r.MORTON="MORTON",r.PDE="PDE"})(ki||(ki={})),(function(r){r.NONE="NONE",r.FAST_PFOR="FAST_PFOR",r.VARINT="VARINT",r.ALP="ALP"})(Rl||(Rl={})),(function(r){r.PRESENT="PRESENT",r.DATA="DATA",r.OFFSET="OFFSET",r.LENGTH="LENGTH"})(ws||(ws={}));class uA{constructor(e,i,s){Pi(this,"_dictionaryType");Pi(this,"_offsetType");Pi(this,"_lengthType");this._dictionaryType=e,this._offsetType=i,this._lengthType=s}get dictionaryType(){return this._dictionaryType}get offsetType(){return this._offsetType}get lengthType(){return this._lengthType}}function to(r,e){const i=(function(s,A){const d=s[A.get()],_=Object.values(ws)[d>>4];let b=null;switch(_){case ws.DATA:b=new uA(Object.values(ja)[15&d]);break;case ws.OFFSET:b=new uA(null,Object.values(Iu)[15&d]);break;case ws.LENGTH:b=new uA(null,null,Object.values(Lo)[15&d])}A.increment();const M=s[A.get()],I=Object.values(ki)[M>>5],k=Object.values(ki)[M>>2&7],F=Object.values(Rl)[3&M];A.increment();const V=_s(s,A,2),j=V[0];return{physicalStreamType:_,logicalStreamType:b,logicalLevelTechnique1:I,logicalLevelTechnique2:k,physicalLevelTechnique:F,numValues:j,byteLength:V[1],decompressedCount:j}})(r,e);return i.logicalLevelTechnique1===ki.MORTON?(function(s,A,d){const _=_s(A,d,2);return{physicalStreamType:s.physicalStreamType,logicalStreamType:s.logicalStreamType,logicalLevelTechnique1:s.logicalLevelTechnique1,logicalLevelTechnique2:s.logicalLevelTechnique2,physicalLevelTechnique:s.physicalLevelTechnique,numValues:s.numValues,byteLength:s.byteLength,decompressedCount:s.decompressedCount,numBits:_[0],coordinateShift:_[1]}})(i,r,e):ki.RLE!==i.logicalLevelTechnique1&&ki.RLE!==i.logicalLevelTechnique2||Rl.NONE===i.physicalLevelTechnique?i:(function(s,A,d){const _=_s(A,d,2);return{physicalStreamType:s.physicalStreamType,logicalStreamType:s.logicalStreamType,logicalLevelTechnique1:s.logicalLevelTechnique1,logicalLevelTechnique2:s.logicalLevelTechnique2,physicalLevelTechnique:s.physicalLevelTechnique,numValues:s.numValues,byteLength:s.byteLength,decompressedCount:_[1],runs:_[0],numRleValues:_[1]}})(i,r,e)}(function(r){r.NONE="NONE",r.SINGLE="SINGLE",r.SHARED="SHARED",r.VERTEX="VERTEX",r.MORTON="MORTON",r.FSST="FSST"})(ja||(ja={})),(function(r){r.VERTEX="VERTEX",r.INDEX="INDEX",r.STRING="STRING",r.KEY="KEY"})(Iu||(Iu={})),(function(r){r.VAR_BINARY="VAR_BINARY",r.GEOMETRIES="GEOMETRIES",r.PARTS="PARTS",r.RINGS="RINGS",r.TRIANGLES="TRIANGLES",r.SYMBOL="SYMBOL",r.DICTIONARY="DICTIONARY"})(Lo||(Lo={})),(function(r){r[r.FLAT=0]="FLAT",r[r.CONST=1]="CONST",r[r.SEQUENCE=2]="SEQUENCE",r[r.DICTIONARY=3]="DICTIONARY",r[r.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(ss||(ss={}));class Za{constructor(e,i){Pi(this,"values");Pi(this,"_size");this.values=e,this._size=i}get(e){const i=Math.floor(e/8);return(this.values[i]>>e%8&1)==1}set(e,i){const s=Math.floor(e/8);this.values[s]=this.values[s]|(i?1:0)<<e%8}getInt(e){const i=Math.floor(e/8);return this.values[i]>>e%8&1}size(){return this._size}getBuffer(){return this.values}}function io(r,e,i,s,A){return(function(d,_,b){switch(_.logicalLevelTechnique1){case ki.DELTA:return _.logicalLevelTechnique2===ki.RLE?(function(M,I,k){const F=new Int32Array(k);let V=0,j=0;for(let H=0;H<I;H++){const Q=M[H],Y=Du(M[H+I]);for(let re=0;re<Q;re++)j+=Y,F[V++]=j}return F})(d,_.runs,_.numRleValues):((function(M){M[0]=M[0]>>>1^-(1&M[0]);const I=M.length/4*4;let k=1;if(I>=4)for(;k<I-4;k+=4){const F=M[k],V=M[k+1],j=M[k+2],H=M[k+3];M[k]=(F>>>1^-(1&F))+M[k-1],M[k+1]=(V>>>1^-(1&V))+M[k],M[k+2]=(j>>>1^-(1&j))+M[k+1],M[k+3]=(H>>>1^-(1&H))+M[k+2]}for(;k!=M.length;++k)M[k]=(M[k]>>>1^-(1&M[k]))+M[k-1]})(d),d);case ki.RLE:return(function(M,I,k){return k?(function(F,V,j){const H=new Int32Array(j);let Q=0;for(let Y=0;Y<V;Y++){const re=F[Y];let ge=F[Y+V];ge=ge>>>1^-(1&ge),H.fill(ge,Q,Q+re),Q+=re}return H})(M,I.runs,I.numRleValues):Wf(M,I.runs,I.numRleValues)})(d,_,b);case ki.MORTON:return lA(d),d;case ki.COMPONENTWISE_DELTA:return Yf(d),d;case ki.NONE:return b&&(function(M){for(let I=0;I<M.length;I++){const k=M[I];M[I]=k>>>1^-(1&k)}})(d),d;default:throw new Error(`The specified Logical level technique is not supported: ${_.logicalLevelTechnique1}`)}})(fc(r,e,i),i,s)}function su(r,e,i){return(function(s,A){if(A.logicalLevelTechnique1===ki.DELTA&&A.logicalLevelTechnique2===ki.NONE)return(function(_){const b=new Int32Array(_.length+1);b[0]=0,b[1]=Du(_[0]);let M=b[1],I=2;for(;I!=b.length;++I){const k=_[I-1];M+=k>>>1^-(1&k),b[I]=b[I-1]+M}return b})(s);if(A.logicalLevelTechnique1===ki.RLE&&A.logicalLevelTechnique2===ki.NONE)return(function(_,b,M){const I=new Int32Array(M+1);I[0]=0;let k=1,F=I[0];for(let V=0;V<b;V++){const j=_[V],H=_[V+b];for(let Q=k;Q<k+j;Q++)I[Q]=H+F,F=I[Q];k+=j}return I})(s,A.runs,A.numRleValues);if(A.logicalLevelTechnique1===ki.NONE&&A.logicalLevelTechnique2===ki.NONE){(function(_){let b=0;for(let M=0;M<_.length;M++)_[M]+=b,b=_[M]})(s);const d=new Int32Array(A.numValues+1);return d[0]=0,d.set(s,1),d}if(A.logicalLevelTechnique1===ki.DELTA&&A.logicalLevelTechnique2===ki.RLE){const d=(function(_,b,M){const I=new Int32Array(M+1);I[0]=0;let k=1,F=I[0];for(let V=0;V<b;V++){const j=_[V];let H=_[V+b];H=H>>>1^-(1&H);for(let Q=k;Q<k+j;Q++)I[Q]=H+F,F=I[Q];k+=j}return I})(s,A.runs,A.numRleValues);return lA(d),d}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")})(fc(r,e,i),i)}function fc(r,e,i){const s=i.physicalLevelTechnique;if(s===Rl.FAST_PFOR)return Hf();if(s===Rl.VARINT)return _s(r,e,i.numValues);if(s===Rl.NONE){const A=e.get();e.add(i.byteLength);const d=r.subarray(A,e.get());return new Int32Array(d)}throw new Error("Specified physicalLevelTechnique is not supported (yet).")}function hA(r,e,i,s){const A=fc(r,e,i);if(A.length===1){const d=A[0];return s?Du(d):d}return s?(function(d){return Du(d[1])})(A):(function(d){return d[1]})(A)}function Xf(r,e,i){return(function(s){if(s.length==2){const A=Du(s[1]);return[A,A]}return[Du(s[2]),Du(s[3])]})(fc(r,e,i))}function Kf(r,e,i){return(function(s){if(s.length==2){const A=nh(s[1]);return[A,A]}return[nh(s[2]),nh(s[3])]})(Ac(r,e,i.numValues))}function Jf(r,e,i,s){return(function(A,d,_){switch(d.logicalLevelTechnique1){case ki.DELTA:return d.logicalLevelTechnique2===ki.RLE?(function(b,M,I){const k=new BigInt64Array(I);let F=0,V=0n;for(let j=0;j<M;j++){const H=Number(b[j]),Q=nh(b[j+M]);for(let Y=0;Y<H;Y++)V+=Q,k[F++]=V}return k})(A,d.runs,d.numRleValues):((function(b){b[0]=b[0]>>1n^-(1n&b[0]);const M=b.length/4*4;let I=1;if(M>=4)for(;I<M-4;I+=4){const k=b[I],F=b[I+1],V=b[I+2],j=b[I+3];b[I]=(k>>1n^-(1n&k))+b[I-1],b[I+1]=(F>>1n^-(1n&F))+b[I],b[I+2]=(V>>1n^-(1n&V))+b[I+1],b[I+3]=(j>>1n^-(1n&j))+b[I+2]}for(;I!=b.length;++I)b[I]=(b[I]>>1n^-(1n&b[I]))+b[I-1]})(A),A);case ki.RLE:return(function(b,M,I){return I?(function(k,F,V){const j=new BigInt64Array(V);let H=0;for(let Q=0;Q<F;Q++){const Y=Number(k[Q]);let re=k[Q+F];re=re>>1n^-(1n&re),j.fill(re,H,H+Y),H+=Y}return j})(b,M.runs,M.numRleValues):Qf(b,M.runs,M.numRleValues)})(A,d,_);case ki.NONE:return _&&(function(b){for(let M=0;M<b.length;M++){const I=b[M];b[M]=I>>1n^-(1n&I)}})(A),A;default:throw new Error(`The specified Logical level technique is not supported: ${d.logicalLevelTechnique1}`)}})(Ac(r,e,i.numValues),i,s)}function ed(r,e,i,s){const A=Ac(r,e,i.numValues);if(A.length===1){const d=A[0];return s?nh(d):d}return s?(function(d){return nh(d[1])})(A):(function(d){return d[1]})(A)}function cA(r,e,i,s,A){return(function(d,_,b,M){switch(_.logicalLevelTechnique1){case ki.DELTA:return _.logicalLevelTechnique2===ki.RLE&&(d=Wf(d,_.runs,_.numRleValues)),(function(I,k){const F=new Int32Array(I.size());let V=0;I.get(0)?(F[0]=I.get(0)?k[0]>>>1^-(1&k[0]):0,V=1):F[0]=0;let j=1;for(;j!=F.length;++j)F[j]=I.get(j)?F[j-1]+(k[V]>>>1^-(1&k[V++])):F[j-1];return F})(M,d);case ki.RLE:return(function(I,k,F,V){const j=k;return F?(function(H,Q,Y){const re=new Int32Array(H.size());let ge=0;for(let oe=0;oe<Y;oe++){const ue=Q[oe];let ve=Q[oe+Y];ve=ve>>>1^-(1&ve);for(let Te=ge;Te<ge+ue;Te++)H.get(Te)?re[Te]=ve:(re[Te]=0,ge++);ge+=ue}return re})(V,I,j.runs):(function(H,Q,Y){const re=new Int32Array(H.size());let ge=0;for(let oe=0;oe<Y;oe++){const ue=Q[oe],ve=Q[oe+Y];for(let Te=ge;Te<ge+ue;Te++)H.get(Te)?re[Te]=ve:(re[Te]=0,ge++);ge+=ue}return re})(V,I,j.runs)})(d,_,b,M);case ki.MORTON:return lA(d),d;case ki.COMPONENTWISE_DELTA:return Yf(d),d;case ki.NONE:return d=b?(function(I,k){const F=new Int32Array(I.size());let V=0,j=0;for(;j!=F.length;++j)if(I.get(j)){const H=k[V++];F[j]=H>>>1^-(1&H)}else F[j]=0;return F})(M,d):(function(I,k){const F=new Int32Array(I.size());let V=0,j=0;for(;j!=F.length;++j)F[j]=I.get(j)?k[V++]:0;return F})(M,d),d;default:throw new Error("The specified Logical level technique is not supported")}})(i.physicalLevelTechnique===Rl.FAST_PFOR?Hf():_s(r,e,i.numValues),i,s,A)}function dc(r,e,i,s){const A=r.logicalLevelTechnique1;if(A===ki.RLE)return r.runs===1?ss.CONST:ss.FLAT;const d=e instanceof Za?e.size():e;if(A===ki.DELTA&&r.logicalLevelTechnique2===ki.RLE){const _=r.runs,b=2;if(r.numRleValues!==d)return ss.FLAT;if(_===1)return ss.SEQUENCE;if(_===2){const M=s.get();let I;if(r.physicalLevelTechnique===Rl.VARINT)I=_s(i,s,4);else{const k=s.get();I=new Int32Array(i.buffer,i.byteOffset+k,4)}if(s.set(M),I[2]===b&&I[3]===b)return ss.SEQUENCE}}return r.numValues===1?ss.CONST:ss.FLAT}class td extends cc{getValueFromBuffer(e){return this.dataBuffer[e]}}class id extends Gf{constructor(e,i,s,A){super(e,BigInt64Array.of(i),s,A)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}class sh{constructor(e,i,s){Pi(this,"_geometryOffsets");Pi(this,"_partOffsets");Pi(this,"_ringOffsets");this._geometryOffsets=e,this._partOffsets=i,this._ringOffsets=s}get geometryOffsets(){return this._geometryOffsets}get partOffsets(){return this._partOffsets}get ringOffsets(){return this._ringOffsets}}function AA(r,e,i){return{x:rd(r,e)-i,y:rd(r>>1,e)-i}}function rd(r,e){let i=0;for(let s=0;s<e;s++)i|=(r&1<<2*s)>>s;return i}(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON",r[r.MULTIPOINT=3]="MULTIPOINT",r[r.MULTILINESTRING=4]="MULTILINESTRING",r[r.MULTIPOLYGON=5]="MULTIPOLYGON"})(os||(os={})),(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON"})(qf||(qf={})),(function(r){r[r.MORTON=0]="MORTON",r[r.VEC_2=1]="VEC_2",r[r.VEC_3=2]="VEC_3"})(aa||(aa={}));class em{createPoint(e){return[[e]]}createMultiPoint(e){return e.map((i=>[i]))}createLineString(e){return[e]}createMultiLineString(e){return e}createPolygon(e,i){return[e].concat(i)}createMultiPolygon(e){return e.flat()}}function nd(r){const e=new Array(r.numGeometries);let i=1,s=1,A=1,d=0;const _=new em;let b=0,M=0;const I=r.mortonSettings,k=r.topologyVector,F=k.geometryOffsets,V=k.partOffsets,j=k.ringOffsets,H=r.vertexOffsets,Q=r.containsPolygonGeometry(),Y=r.vertexBuffer;for(let re=0;re<r.numGeometries;re++){const ge=r.geometryType(re);if(ge===os.POINT){if(H&&H.length!==0)if(r.vertexBufferType===aa.VEC_2){const oe=2*H[M++],ue=new it(Y[oe],Y[oe+1]);e[d++]=_.createPoint(ue)}else{const oe=AA(Y[H[M++]],I.numBits,I.coordinateShift),ue=new it(oe.x,oe.y);e[d++]=_.createPoint(ue)}else{const oe=new it(Y[b++],Y[b++]);e[d++]=_.createPoint(oe)}F&&A++,V&&i++,j&&s++}else if(ge===os.MULTIPOINT){const oe=F[A]-F[A-1];A++;const ue=new Array(oe);if(H&&H.length!==0){for(let ve=0;ve<oe;ve++){const Te=2*H[M++];ue[ve]=new it(Y[Te],Y[Te+1])}e[d++]=_.createMultiPoint(ue)}else{for(let ve=0;ve<oe;ve++){const Te=Y[b++],Ue=Y[b++];ue[ve]=new it(Te,Ue)}e[d++]=_.createMultiPoint(ue)}}else if(ge===os.LINESTRING){let oe,ue=0;Q?(ue=j[s]-j[s-1],s++):ue=V[i]-V[i-1],i++,H&&H.length!==0?(oe=r.vertexBufferType===aa.VEC_2?dA(Y,H,M,ue,!1):pA(Y,H,M,ue,!1,I),M+=ue):(oe=fA(Y,b,ue,!1),b+=2*ue),e[d++]=_.createLineString(oe),F&&A++}else if(ge===os.POLYGON){const oe=V[i]-V[i-1];i++;const ue=new Array(oe-1);let ve=j[s]-j[s-1];if(s++,H&&H.length!==0){const Te=r.vertexBufferType===aa.VEC_2?mc(Y,H,M,ve):_c(Y,H,M,ve,0,I);M+=ve;for(let Ue=0;Ue<ue.length;Ue++)ve=j[s]-j[s-1],s++,ue[Ue]=r.vertexBufferType===aa.VEC_2?mc(Y,H,M,ve):_c(Y,H,M,ve,0,I),M+=ve;e[d++]=_.createPolygon(Te,ue)}else{const Te=pc(Y,b,ve);b+=2*ve;for(let Ue=0;Ue<ue.length;Ue++)ve=j[s]-j[s-1],s++,ue[Ue]=pc(Y,b,ve),b+=2*ve;e[d++]=_.createPolygon(Te,ue)}F&&A++}else if(ge===os.MULTILINESTRING){const oe=F[A]-F[A-1];A++;const ue=new Array(oe);if(H&&H.length!==0){for(let ve=0;ve<oe;ve++){let Te=0;Q?(Te=j[s]-j[s-1],s++):Te=V[i]-V[i-1],i++;const Ue=r.vertexBufferType===aa.VEC_2?dA(Y,H,M,Te,!1):pA(Y,H,M,Te,!1,I);ue[ve]=Ue,M+=Te}e[d++]=_.createMultiLineString(ue)}else{for(let ve=0;ve<oe;ve++){let Te=0;Q?(Te=j[s]-j[s-1],s++):Te=V[i]-V[i-1],i++,ue[ve]=fA(Y,b,Te,!1),b+=2*Te}e[d++]=_.createMultiLineString(ue)}}else{if(ge!==os.MULTIPOLYGON)throw new Error("The specified geometry type is currently not supported.");{const oe=F[A]-F[A-1];A++;const ue=new Array(oe);let ve=0;if(H&&H.length!==0){for(let Te=0;Te<oe;Te++){const Ue=V[i]-V[i-1];i++;const lt=new Array(Ue-1);ve=j[s]-j[s-1],s++;const nt=r.vertexBufferType===aa.VEC_2?mc(Y,H,M,ve):_c(Y,H,M,ve,0,I);M+=ve;for(let dt=0;dt<lt.length;dt++)ve=j[s]-j[s-1],s++,lt[dt]=r.vertexBufferType===aa.VEC_2?mc(Y,H,M,ve):_c(Y,H,M,ve,0,I),M+=ve;ue[Te]=_.createPolygon(nt,lt)}e[d++]=_.createMultiPolygon(ue)}else{for(let Te=0;Te<oe;Te++){const Ue=V[i]-V[i-1];i++;const lt=new Array(Ue-1);ve=j[s]-j[s-1],s++;const nt=pc(Y,b,ve);b+=2*ve;for(let dt=0;dt<lt.length;dt++){const Tt=j[s]-j[s-1];s++,lt[dt]=pc(Y,b,Tt),b+=2*Tt}ue[Te]=_.createPolygon(nt,lt)}e[d++]=_.createMultiPolygon(ue)}}}}return e}function pc(r,e,i){return fA(r,e,i,!0)}function mc(r,e,i,s){return dA(r,e,i,s,!0)}function _c(r,e,i,s,A,d){return pA(r,e,i,s,!0,d)}function fA(r,e,i,s){const A=new Array(s?i+1:i);for(let d=0;d<2*i;d+=2)A[d/2]=new it(r[e+d],r[e+d+1]);return s&&(A[A.length-1]=A[0]),A}function dA(r,e,i,s,A){const d=new Array(A?s+1:s);for(let _=0;_<2*s;_+=2){const b=2*e[i+_/2];d[_/2]=new it(r[b],r[b+1])}return A&&(d[d.length-1]=d[0]),d}function pA(r,e,i,s,A,d){const _=new Array(A?s+1:s);for(let b=0;b<s;b++){const M=AA(r[e[i+b]],d.numBits,d.coordinateShift);_[b]=new it(M.x,M.y)}return A&&(_[_.length-1]=_[0]),_}class sd{constructor(e,i,s,A,d){Pi(this,"_vertexBufferType");Pi(this,"_topologyVector");Pi(this,"_vertexOffsets");Pi(this,"_vertexBuffer");Pi(this,"_mortonSettings");this._vertexBufferType=e,this._topologyVector=i,this._vertexOffsets=s,this._vertexBuffer=A,this._mortonSettings=d}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}*[Symbol.iterator](){const e=nd(this);let i=0;for(;i<this.numGeometries;)yield{coordinates:e[i],type:this.geometryType(i)},i++}getSimpleEncodedVertex(e){const i=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){const s=AA(this.vertexBuffer[this.vertexOffsets[e]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[s.x,s.y]}const i=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getGeometries(){return nd(this)}get mortonSettings(){return this._mortonSettings}}class od extends sd{constructor(i,s,A,d,_,b,M){super(A,d,_,b,M);Pi(this,"_numGeometries");Pi(this,"_geometryType");this._numGeometries=i,this._geometryType=s}geometryType(i){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===os.POLYGON||this._geometryType===os.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class ad extends sd{constructor(i,s,A,d,_,b){super(i,A,d,_,b);Pi(this,"_geometryTypes");this._geometryTypes=s}geometryType(i){return this._geometryTypes[i]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let i=0;i<this.numGeometries;i++)if(this.geometryType(i)===os.POLYGON||this.geometryType(i)===os.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class ld{constructor(e,i,s,A){Pi(this,"_triangleOffsets");Pi(this,"_indexBuffer");Pi(this,"_vertexBuffer");Pi(this,"_topologyVector");this._triangleOffsets=e,this._indexBuffer=i,this._vertexBuffer=s,this._topologyVector=A}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");const e=new Array(this.numGeometries),i=this._topologyVector,s=i.partOffsets,A=i.ringOffsets,d=i.geometryOffsets;let _=0,b=1,M=1,I=1;for(let k=0;k<this.numGeometries;k++)switch(this.geometryType(k)){case os.POLYGON:{const F=s[b]-s[b-1];b++;const V=[];for(let j=0;j<F;j++){const H=A[M]-A[M-1];M++;const Q=[];for(let Y=0;Y<H;Y++){const re=this._vertexBuffer[_++],ge=this._vertexBuffer[_++];Q.push(new it(re,ge))}Q.length>0&&Q.push(Q[0]),V.push(Q)}e[k]=V,d&&I++}break;case os.MULTIPOLYGON:{const F=d[I]-d[I-1];I++;const V=[];for(let j=0;j<F;j++){const H=s[b]-s[b-1];b++;for(let Q=0;Q<H;Q++){const Y=A[M]-A[M-1];M++;const re=[];for(let ge=0;ge<Y;ge++){const oe=this._vertexBuffer[_++],ue=this._vertexBuffer[_++];re.push(new it(oe,ue))}re.length>0&&re.push(re[0]),V.push(re)}}e[k]=V}}return e}[Symbol.iterator](){return null}}function ud(r,e,i,s,A,d){return new tm(r,e,i,s,A,d)}class tm extends ld{constructor(i,s,A,d,_,b){super(A,d,_,b);Pi(this,"_numGeometries");Pi(this,"_geometryType");this._numGeometries=i,this._geometryType=s}geometryType(i){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function hd(r,e,i,s,A){return new im(r,e,i,s,A)}class im extends ld{constructor(i,s,A,d,_){super(s,A,d,_);Pi(this,"_geometryTypes");this._geometryTypes=i}geometryType(i){return this._geometryTypes[i]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function rm(r,e,i,s,A){const d=to(r,i);let _=null,b=null,M=null,I=null,k=null,F=null,V=null,j=null;if(dc(d,s,r,i)===ss.CONST){const Q=hA(r,i,d,!1);for(let Y=0;Y<e-1;Y++){const re=to(r,i);switch(re.physicalStreamType){case ws.LENGTH:switch(re.logicalStreamType.lengthType){case Lo.GEOMETRIES:_=su(r,i,re);break;case Lo.PARTS:b=su(r,i,re);break;case Lo.RINGS:M=su(r,i,re);break;case Lo.TRIANGLES:V=su(r,i,re)}break;case ws.OFFSET:switch(re.logicalStreamType.offsetType){case Iu.VERTEX:I=io(r,i,re,!1);break;case Iu.INDEX:j=io(r,i,re,!1)}break;case ws.DATA:ja.VERTEX===re.logicalStreamType.dictionaryType?k=io(r,i,re,!0):(F={numBits:re.numBits,coordinateShift:re.coordinateShift},k=io(r,i,re,!1))}}return j!==null?_!=null||b!=null?ud(s,Q,V,j,k,new sh(_,b,M)):ud(s,Q,V,j,k):F===null?(function(Y,re,ge,oe,ue){return new od(Y,re,aa.VEC_2,ge,oe,ue)})(s,Q,new sh(_,b,M),I,k):(function(Y,re,ge,oe,ue,ve){return new od(Y,re,aa.MORTON,ge,oe,ue,ve)})(s,Q,new sh(_,b,M),I,k,F)}const H=io(r,i,d,!1);for(let Q=0;Q<e-1;Q++){const Y=to(r,i);switch(Y.physicalStreamType){case ws.LENGTH:switch(Y.logicalStreamType.lengthType){case Lo.GEOMETRIES:_=io(r,i,Y,!1);break;case Lo.PARTS:b=io(r,i,Y,!1);break;case Lo.RINGS:M=io(r,i,Y,!1);break;case Lo.TRIANGLES:V=su(r,i,Y)}break;case ws.OFFSET:switch(Y.logicalStreamType.offsetType){case Iu.VERTEX:I=io(r,i,Y,!1);break;case Iu.INDEX:j=io(r,i,Y,!1)}break;case ws.DATA:ja.VERTEX===Y.logicalStreamType.dictionaryType?k=io(r,i,Y,!0):(F={numBits:Y.numBits,coordinateShift:Y.coordinateShift},k=io(r,i,Y,!1))}}return j!==null&&b===null?hd(H,V,j,k):(_!==null?(_=mA(H,_,2),b!==null&&M!==null?(b=cd(H,_,b,!1),M=(function(Q,Y,re,ge){const oe=new Int32Array(re[re.length-1]+1);let ue=0;oe[0]=ue;let ve=1,Te=1,Ue=0;for(let lt=0;lt<Q.length;lt++){const nt=Q[lt],dt=Y[lt+1]-Y[lt];if(nt!==0&&nt!==3)for(let Tt=0;Tt<dt;Tt++){const mt=re[ve]-re[ve-1];ve++;for(let st=0;st<mt;st++)ue=oe[Te++]=ue+ge[Ue++]}else for(let Tt=0;Tt<dt;Tt++)oe[Te++]=++ue,ve++}return oe})(H,_,b,M)):b!==null&&(b=(function(Q,Y,re){const ge=new Int32Array(Y[Y.length-1]+1);let oe=0;ge[0]=oe;let ue=1,ve=0;for(let Te=0;Te<Q.length;Te++){const Ue=Q[Te],lt=Y[Te+1]-Y[Te];if(Ue===4||Ue===1)for(let nt=0;nt<lt;nt++)oe=ge[ue++]=oe+re[ve++];else for(let nt=0;nt<lt;nt++)ge[ue++]=++oe}return ge})(H,_,b))):b!==null&&M!==null?(b=mA(H,b,1),M=cd(H,b,M,!0)):b!==null&&(b=mA(H,b,0)),j!==null?hd(H,V,j,k,new sh(_,b,M)):F===null?(function(Q,Y,re,ge){return new ad(aa.VEC_2,Q,Y,re,ge)})(H,new sh(_,b,M),I,k):(function(Q,Y,re,ge,oe){return new ad(aa.MORTON,Q,Y,re,ge,oe)})(H,new sh(_,b,M),I,k,F))}function mA(r,e,i){const s=new Int32Array(r.length+1);let A=0;s[0]=A;let d=0;for(let _=0;_<r.length;_++)A=s[_+1]=A+(r[_]>i?e[d++]:1);return s}function cd(r,e,i,s){const A=new Int32Array(e[e.length-1]+1);let d=0;A[0]=d;let _=1,b=0;for(let M=0;M<r.length;M++){const I=r[M],k=e[M+1]-e[M];if(I===5||I===2||s&&(I===4||I===1))for(let F=0;F<k;F++)d=A[_++]=d+i[b++];else for(let F=0;F<k;F++)A[_++]=++d}return A}class nm extends rh{constructor(i,s,A){super(i,s.getBuffer(),A);Pi(this,"dataVector");this.dataVector=s}getValueFromBuffer(i){return this.dataVector.get(i)}}class sm extends cc{getValueFromBuffer(e){return this.dataBuffer[e]}}class Ad extends rh{constructor(e,i,s){super(e,BigInt64Array.of(i),s)}getValueFromBuffer(e){return this.dataBuffer[0]}}function Rh(r,e,i){return fd(r,Math.ceil(e/8),i)}function fd(r,e,i){const s=new Uint8Array(e);let A=0;for(;A<e;){const d=r[i.increment()];if(d<=127){const _=d+3,b=r[i.increment()],M=A+_;s.fill(b,A,M),A=M}else{const _=256-d;for(let b=0;b<_;b++)s[A++]=r[i.increment()]}}return s}const om=new TextDecoder;function _A(r,e,i){return i-e>=12?om.decode(r.subarray(e,i)):(function(s,A,d){let _="",b=A;for(;b<d;){const M=s[b];let I,k,F,V=null,j=M>239?4:M>223?3:M>191?2:1;if(b+j>d)break;j===1?M<128&&(V=M):j===2?(I=s[b+1],(192&I)==128&&(V=(31&M)<<6|63&I,V<=127&&(V=null))):j===3?(I=s[b+1],k=s[b+2],(192&I)==128&&(192&k)==128&&(V=(15&M)<<12|(63&I)<<6|63&k,(V<=2047||V>=55296&&V<=57343)&&(V=null))):j===4&&(I=s[b+1],k=s[b+2],F=s[b+3],(192&I)==128&&(192&k)==128&&(192&F)==128&&(V=(15&M)<<18|(63&I)<<12|(63&k)<<6|63&F,(V<=65535||V>=1114112)&&(V=null))),V===null?(V=65533,j=1):V>65535&&(V-=65536,_+=String.fromCharCode(V>>>10&1023|55296),V=56320|1023&V),_+=String.fromCharCode(V),b+=j}return _})(r,e,i)}class gA extends rh{constructor(i,s,A,d){super(i,A,d);Pi(this,"offsetBuffer");this.offsetBuffer=s}}class dd extends gA{constructor(i,s,A,d){super(i,s,A,d??s.length-1);Pi(this,"textEncoder");this.textEncoder=new TextEncoder}getValueFromBuffer(i){return _A(this.dataBuffer,this.offsetBuffer[i],this.offsetBuffer[i+1])}}class oh extends gA{constructor(i,s,A,d,_){super(i,A,d,_??s.length);Pi(this,"indexBuffer");Pi(this,"textEncoder");this.indexBuffer=s,this.indexBuffer=s,this.textEncoder=new TextEncoder}getValueFromBuffer(i){const s=this.indexBuffer[i];return _A(this.dataBuffer,this.offsetBuffer[s],this.offsetBuffer[s+1])}}class pd extends gA{constructor(i,s,A,d,_,b,M){super(i,A,d,M);Pi(this,"indexBuffer");Pi(this,"symbolOffsetBuffer");Pi(this,"symbolTableBuffer");Pi(this,"textEncoder");Pi(this,"symbolLengthBuffer");Pi(this,"lengthBuffer");Pi(this,"decodedDictionary");this.indexBuffer=s,this.symbolOffsetBuffer=_,this.symbolTableBuffer=b,this.textEncoder=new TextEncoder}getValueFromBuffer(i){this.decodedDictionary==null&&(this.symbolLengthBuffer==null&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer),this.lengthBuffer=this.offsetToLengthBuffer(this.offsetBuffer)),this.decodedDictionary=(function(A,d,_){const b=[],M=new Array(d.length).fill(0);for(let I=1;I<d.length;I++)M[I]=M[I-1]+d[I-1];for(let I=0;I<_.length;I++)if(_[I]===255)b.push(_[++I]);else{const k=d[_[I]],F=M[_[I]];for(let V=0;V<k;V++)b.push(A[F+V])}return new Uint8Array(b)})(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const s=this.indexBuffer[i];return _A(this.decodedDictionary,this.offsetBuffer[s],this.offsetBuffer[s+1])}offsetToLengthBuffer(i){const s=new Uint32Array(i.length-1);let A=i[0];for(let d=1;d<i.length;d++){const _=i[d];s[d-1]=_-A,A=_}return s}}function am(r,e,i,s,A,d){return i.type==="scalarType"?(function(_,b,M,I,k,F){let V=null,j=0;if(_===0)return null;if(F.nullable){const Q=to(b,M);j=Q.numValues;const Y=M.get(),re=Rh(b,j,M);M.set(Y+Q.byteLength),V=new Za(re,Q.numValues)}const H=V??I;switch(k.physicalType){case 4:case 3:return(function(Q,Y,re,ge,oe){const ue=to(Q,Y),ve=dc(ue,oe,Q,Y),Te=ge.physicalType===3;if(ve===ss.FLAT){const Ue=Fh(oe)?cA(Q,Y,ue,Te,oe):io(Q,Y,ue,Te);return new nA(re.name,Ue,oe)}if(ve===ss.SEQUENCE){const Ue=Xf(Q,Y,ue);return new oA(re.name,Ue[0],Ue[1],ue.numRleValues)}{const Ue=hA(Q,Y,ue,Te);return new aA(re.name,Ue,oe)}})(b,M,F,k,H);case 9:return(function(Q,Y,re,ge,oe){let ue=null,ve=null,Te=null,Ue=null,lt=null,nt=null,dt=null,Tt=null;for(let mt=0;mt<ge;mt++){const st=to(Y,re);if(st.byteLength!==0)switch(st.physicalStreamType){case ws.PRESENT:{const Xe=Rh(Y,st.numValues,re);nt=new Za(Xe,st.numValues);break}case ws.OFFSET:ve=oe!=null||nt!=null?cA(Y,re,st,!1,oe??nt):io(Y,re,st,!1);break;case ws.LENGTH:{const Xe=su(Y,re,st);Lo.DICTIONARY===st.logicalStreamType.lengthType?ue=Xe:Lo.SYMBOL===st.logicalStreamType.lengthType?Ue=Xe:dt=Xe;break}case ws.DATA:{const Xe=Y.subarray(re.get(),re.get()+st.byteLength);re.add(st.byteLength);const Lt=st.logicalStreamType.dictionaryType;ja.FSST===Lt?lt=Xe:ja.SINGLE===Lt||ja.SHARED===Lt?Te=Xe:ja.NONE===Lt&&(Tt=Xe);break}}}return(function(mt,st,Xe,Lt,Ct,Ot,Et){return st?new pd(mt,Xe,Lt,Ct,Ot,st,Et):null})(Q,lt,ve,ue,Te,Ue,oe??nt)??(function(mt,st,Xe,Lt,Ct){return st?Ct?new oh(mt,Xe,Lt,st,Ct):new oh(mt,Xe,Lt,st):null})(Q,Te,ve,ue,oe??nt)??(function(mt,st,Xe,Lt,Ct){if(!st||!Xe)return null;if(Lt)return Ct?new oh(mt,Lt,st,Xe,Ct):new oh(mt,Lt,st,Xe);if(Ct&&Ct.size()!==st.length-1){const Ot=new Int32Array(Ct.size());let Et=0;for(let Ut=0;Ut<Ct.size();Ut++)Ot[Ut]=Ct.get(Ut)?Et++:0;return new oh(mt,Ot,st,Xe,Ct)}return Ct?new dd(mt,st,Xe,Ct):new dd(mt,st,Xe)})(Q,dt,Tt,ve,oe??nt)})(F.name,b,M,F.nullable?_-1:_,V);case 0:return(function(Q,Y,re,ge,oe){const ue=to(Q,Y),ve=ue.numValues,Te=Y.get(),Ue=Fh(oe)?(function(nt,dt,Tt,mt){const st=fd(nt,Math.ceil(dt/8),Tt),Xe=new Za(st,dt),Lt=mt.size(),Ct=new Za(new Uint8Array(Lt),Lt);let Ot=0;for(let Et=0;Et<mt.size();Et++){const Ut=!!mt.get(Et)&&Xe.get(Ot++);Ct.set(Et,Ut)}return Ct.getBuffer()})(Q,ve,Y,oe):Rh(Q,ve,Y);Y.set(Te+ue.byteLength);const lt=new Za(Ue,ve);return new nm(re.name,lt,oe)})(b,M,F,0,H);case 6:case 5:return(function(Q,Y,re,ge,oe){const ue=to(Q,Y),ve=dc(ue,ge,Q,Y),Te=oe.physicalType===5;if(ve===ss.FLAT){const Ue=Fh(ge)?(function(lt,nt,dt,Tt,mt){return(function(st,Xe,Lt,Ct){switch(Xe.logicalLevelTechnique1){case ki.DELTA:return Xe.logicalLevelTechnique2===ki.RLE&&(st=Qf(st,Xe.runs,Xe.numRleValues)),(function(Ot,Et){const Ut=new BigInt64Array(Ot.size());let ji=0;Ot.get(0)?(Ut[0]=Ot.get(0)?Et[0]>>1n^-(1n&Et[0]):0n,ji=1):Ut[0]=0n;let Di=1;for(;Di!=Ut.length;++Di)Ut[Di]=Ot.get(Di)?Ut[Di-1]+(Et[ji]>>1n^-(1n&Et[ji++])):Ut[Di-1];return Ut})(Ct,st);case ki.RLE:return(function(Ot,Et,Ut,ji){const Di=Et;return Ut?(function(Or,Ps,Tn){const Nr=new BigInt64Array(Or.size());let kr=0;for(let rr=0;rr<Tn;rr++){const Xr=Number(Ps[rr]);let ln=Ps[rr+Tn];ln=ln>>1n^-(1n&ln);for(let Pr=kr;Pr<kr+Xr;Pr++)Or.get(Pr)?Nr[Pr]=ln:(Nr[Pr]=0n,kr++);kr+=Xr}return Nr})(ji,Ot,Di.runs):(function(Or,Ps,Tn){const Nr=new BigInt64Array(Or.size());let kr=0;for(let rr=0;rr<Tn;rr++){const Xr=Number(Ps[rr]),ln=Ps[rr+Tn];for(let Pr=kr;Pr<kr+Xr;Pr++)Or.get(Pr)?Nr[Pr]=ln:(Nr[Pr]=0n,kr++);kr+=Xr}return Nr})(ji,Ot,Di.runs)})(st,Xe,Lt,Ct);case ki.NONE:return st=Lt?(function(Ot,Et){const Ut=new BigInt64Array(Ot.size());let ji=0,Di=0;for(;Di!=Ut.length;++Di)if(Ot.get(Di)){const Or=Et[ji++];Ut[Di]=Or>>1n^-(1n&Or)}else Ut[Di]=0n;return Ut})(Ct,st):(function(Ot,Et){const Ut=new BigInt64Array(Ot.size());let ji=0,Di=0;for(;Di!=Ut.length;++Di)Ut[Di]=Ot.get(Di)?Et[ji++]:0n;return Ut})(Ct,st),st;default:throw new Error("The specified Logical level technique is not supported")}})(Ac(lt,nt,dt.numValues),dt,Tt,mt)})(Q,Y,ue,Te,ge):Jf(Q,Y,ue,Te);return new td(re.name,Ue,ge)}if(ve===ss.SEQUENCE){const Ue=Kf(Q,Y,ue);return new id(re.name,Ue[0],Ue[1],ue.numRleValues)}{const Ue=ed(Q,Y,ue,Te);return new Ad(re.name,Ue,ge)}})(b,M,F,H,k);case 7:return(function(Q,Y,re,ge){const oe=to(Q,Y),ue=Fh(ge)?(function(ve,Te,Ue,lt){const nt=Te.get(),dt=nt+lt*Float32Array.BYTES_PER_ELEMENT,Tt=new Uint8Array(ve.subarray(nt,dt)).buffer,mt=new Float32Array(Tt);Te.set(dt);const st=Ue.size(),Xe=new Float32Array(st);let Lt=0;for(let Ct=0;Ct<st;Ct++)Xe[Ct]=Ue.get(Ct)?mt[Lt++]:0;return Xe})(Q,Y,ge,oe.numValues):(function(ve,Te,Ue){const lt=Te.get(),nt=lt+Ue*Float32Array.BYTES_PER_ELEMENT,dt=new Uint8Array(ve.subarray(lt,nt)).buffer,Tt=new Float32Array(dt);return Te.set(nt),Tt})(Q,Y,oe.numValues);return new sm(re.name,ue,ge)})(b,M,F,H);case 8:return(function(Q,Y,re,ge){const oe=to(Q,Y),ue=Fh(ge)?(function(ve,Te,Ue,lt){const nt=Te.get(),dt=nt+lt*Float64Array.BYTES_PER_ELEMENT,Tt=new Uint8Array(ve.subarray(nt,dt)).buffer,mt=new Float64Array(Tt);Te.set(dt);const st=Ue.size(),Xe=new Float64Array(st);let Lt=0;for(let Ct=0;Ct<st;Ct++)Xe[Ct]=Ue.get(Ct)?mt[Lt++]:0;return Xe})(Q,Y,ge,oe.numValues):(function(ve,Te,Ue){const lt=Te.get(),nt=lt+Ue*Float64Array.BYTES_PER_ELEMENT,dt=new Uint8Array(ve.subarray(lt,nt)).buffer,Tt=new Float64Array(dt);return Te.set(nt),Tt})(Q,Y,oe.numValues);return new sA(re.name,ue,ge)})(b,M,F,H);default:throw new Error(`The specified data type for the field is currently not supported: ${k}`)}})(s,r,e,A,i.scalarType,i):s!=1?null:(function(_,b,M,I){let k=null,F=null,V=null,j=null,H=!1;for(;!H;){const ge=to(_,b);switch(ge.physicalStreamType){case ws.LENGTH:Lo.DICTIONARY===ge.logicalStreamType.lengthType?k=su(_,b,ge):V=su(_,b,ge);break;case ws.DATA:ja.SINGLE===ge.logicalStreamType.dictionaryType||ja.SHARED===ge.logicalStreamType.dictionaryType?(F=_.subarray(b.get(),b.get()+ge.byteLength),H=!0):j=_.subarray(b.get(),b.get()+ge.byteLength),b.add(ge.byteLength)}}const Q=M.complexType.children,Y=[];let re=0;for(const ge of Q){const oe=_s(_,b,1)[0];if(oe==0)continue;const ue=`${M.name}${ge.name==="default"?"":":"+ge.name}`;if(oe!==2||ge.type!=="scalarField"||ge.scalarField.physicalType!==9)throw new Error("Currently only optional string fields are implemented for a struct.");const ve=to(_,b),Te=Rh(_,ve.numValues,b),Ue=to(_,b),lt=Ue.decompressedCount!==I?cA(_,b,Ue,!1,new Za(Te,ve.numValues)):io(_,b,Ue,!1);Y[re++]=j?new pd(ue,lt,k,F,V,j,new Za(Te,ve.numValues)):new oh(ue,lt,k,F,new Za(Te,ve.numValues))}return Y})(r,e,i,A)}function Fh(r){return r instanceof Za}function lm(r){if(r.name==="id")return!1;if(r.type==="scalarType"){const e=r.scalarType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}else if(e.type==="logicalType")return!1}else if(r.type==="complexType"){const e=r.complexType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",r),!1}const um=new TextDecoder;function md(r,e){const i=_s(r,e,1)[0];if(i===0)return"";const s=e.get(),A=r.subarray(s,s+i);return e.add(i),um.decode(A)}function _d(r,e){const i=_s(r,e,1)[0]>>>0,s=!!(4&i),A=!!(2&i),d=_s(r,e,1)[0]>>>0,_={};if(1&i&&(_.nullable=!0),A){const b={};if(s?(b.type="logicalType",b.logicalType=d):(b.type="physicalType",b.physicalType=d),8&i){const M=_s(r,e,1)[0]>>>0;b.children=new Array(M);for(let I=0;I<M;I++)b.children[I]=_d(r,e)}_.type="complexField",_.complexField=b}else{const b={};s?(b.type="logicalType",b.logicalType=d):(b.type="physicalType",b.physicalType=d),_.type="scalarField",_.scalarField=b}return _}function hm(r,e){const i=_s(r,e,1)[0]>>>0,s=(function(A){switch(A){case 0:case 1:case 2:case 3:{const d={};d.nullable=!!(1&A),d.columnScope=0;const _={};return _.physicalType=A>1?6:4,_.type="physicalType",d.scalarType=_,d.type="scalarType",d}case 4:{const d={nullable:!1,columnScope:0},_={type:"physicalType",physicalType:0};return d.type="complexType",d.complexType=_,d}case 30:{const d={nullable:!1,columnScope:0},_={type:"physicalType",physicalType:1};return d.type="complexType",d.complexType=_,d}default:return(function(d){let _=null;switch(d){case 10:case 11:_=0;break;case 12:case 13:_=1;break;case 14:case 15:_=2;break;case 16:case 17:_=3;break;case 18:case 19:_=4;break;case 20:case 21:_=5;break;case 22:case 23:_=6;break;case 24:case 25:_=7;break;case 26:case 27:_=8;break;case 28:case 29:_=9;break;default:return null}const b={};b.nullable=!!(1&d),b.columnScope=0;const M={type:"physicalType"};return M.physicalType=_,b.type="scalarType",b.scalarType=M,b})(A)}})(i);if(!s)throw new Error(`Unsupported column type code: ${i}`);if((function(A){return A>=10})(i)?s.name=md(r,e):i>=0&&i<=3?s.name="id":i===4&&(s.name="geometry"),(function(A){return A===30})(i)){const A=_s(r,e,1)[0]>>>0,d=s.complexType;d.children=new Array(A);for(let _=0;_<A;_++)d.children[_]=_d(r,e)}return s}function cm(r,e){const i={featureTables:[]},s={};s.name=md(r,e);const A=_s(r,e,1)[0]>>>0,d=_s(r,e,1)[0]>>>0;s.columns=new Array(d);for(let _=0;_<d;_++)s.columns[_]=hm(r,e);return i.featureTables.push(s),[i,A]}function Am(r,e,i,s,A,d,_=!1){const b=e.scalarType.physicalType,M=dc(A,d,r,i);if(b===4)switch(M){case ss.FLAT:{const I=io(r,i,A,!1);return new nA(s,I,d)}case ss.SEQUENCE:{const I=Xf(r,i,A);return new oA(s,I[0],I[1],A.numRleValues)}case ss.CONST:{const I=hA(r,i,A,!1);return new aA(s,I,d)}}else switch(M){case ss.FLAT:{if(_){const k=(function(F,V,j,H){const Q=(function(Y,re,ge){const oe=new Float64Array(re);for(let ue=0;ue<re;ue++)oe[ue]=K0(Y,ge);return oe})(F,j.numValues,V);return(function(Y,re,ge){switch(re.logicalLevelTechnique1){case ki.DELTA:return re.logicalLevelTechnique2===ki.RLE&&(Y=$f(Y,re.runs,re.numRleValues)),(function(oe){oe[0]=oe[0]%2==1?(oe[0]+1)/-2:oe[0]/2;const ue=oe.length/4*4;let ve=1;if(ue>=4)for(;ve<ue-4;ve+=4){const Te=oe[ve],Ue=oe[ve+1],lt=oe[ve+2],nt=oe[ve+3];oe[ve]=(Te%2==1?(Te+1)/-2:Te/2)+oe[ve-1],oe[ve+1]=(Ue%2==1?(Ue+1)/-2:Ue/2)+oe[ve],oe[ve+2]=(lt%2==1?(lt+1)/-2:lt/2)+oe[ve+1],oe[ve+3]=(nt%2==1?(nt+1)/-2:nt/2)+oe[ve+2]}for(;ve!=oe.length;++ve)oe[ve]=(oe[ve]%2==1?(oe[ve]+1)/-2:oe[ve]/2)+oe[ve-1]})(Y),Y;case ki.RLE:return(function(oe,ue,ve){return $f(oe,ue.runs,ue.numRleValues)})(Y,re);case ki.NONE:return Y;default:throw new Error(`The specified Logical level technique is not supported: ${re.logicalLevelTechnique1}`)}})(Q,j)})(r,i,A);return new sA(s,k,d)}const I=Jf(r,i,A,!1);return new td(s,I,d)}case ss.SEQUENCE:{const I=Kf(r,i,A);return new id(s,I[0],I[1],A.numRleValues)}case ss.CONST:{const I=ed(r,i,A,!1);return new Ad(s,I,d)}}throw new Error("Vector type not supported for id column.")}class fm{constructor(e,i){var s;switch(this._featureData=e,this.properties=this._featureData.properties||{},(s=this._featureData.geometry)===null||s===void 0?void 0:s.type){case os.POINT:case os.MULTIPOINT:this.type=1;break;case os.LINESTRING:case os.MULTILINESTRING:this.type=2;break;case os.POLYGON:case os.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=i,this.id=Number(this._featureData.id)}loadGeometry(){const e=[];for(const i of this._featureData.geometry.coordinates){const s=[];for(const A of i)s.push(new it(A.x,A.y));e.push(s)}return e}}class dm{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new fm(this.features[e],this.extent)}}class gd{constructor(e){this.layers={};const i=(function(s,A,d=!0){const _=new X0(0),b=[];for(;_.get()<s.length;){const M=_s(s,_,1)[0]>>>0,I=_.get()+M;if(I>s.length)throw new Error(`Block overruns tile: ${I} > ${s.length}`);if(_s(s,_,1)[0]>>>0!=1){_.set(I);continue}const k=cm(s,_),F=k[1],V=k[0].featureTables[0];let j=null,H=null;const Q=[];let Y=0;for(const ge of V.columns){const oe=ge.name;if(oe==="id"){let ue=null;if(ge.nullable){const Te=to(s,_),Ue=_.get(),lt=Rh(s,Te.numValues,_);_.set(Ue+Te.byteLength),ue=new Za(lt,Te.numValues)}const ve=to(s,_);Y=ve.decompressedCount,j=Am(s,ge,_,oe,ve,ue??Y,d)}else if(oe==="geometry"){const ue=_s(s,_,1)[0];if(Y===0){const ve=_.get();Y=to(s,_).decompressedCount,_.set(ve)}H=rm(s,ue,_,Y)}else{const ue=lm(ge)?_s(s,_,1)[0]:1;if(ue===0&&ge.type==="scalarType")continue;const ve=am(s,_,ge,ue,Y);if(ve)if(Array.isArray(ve))for(const Te of ve)Q.push(Te);else Q.push(ve)}}const re=new Y0(V.name,H,j,Q,F);b.push(re),_.set(I)}return b})(new Uint8Array(e));this.layers=i.reduce(((s,A)=>Object.assign(Object.assign({},s),{[A.name]:new dm(A)})),{})}}class pm{constructor(e,i){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=i,"id"in e&&(typeof e.id=="string"?this.id=parseInt(e.id,10):typeof e.id!="number"||isNaN(e.id)||(this.id=e.id))}loadGeometry(){const e=[],i=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(const s of i){const A=[];for(const d of s)A.push(new it(d[0],d[1]));e.push(A)}return e}}const Oh="_geojsonTileLayer";function mm(r,e){e.writeVarintField(15,r.version||1),e.writeStringField(1,r.name||""),e.writeVarintField(5,r.extent||4096);const i={keys:[],values:[],keycache:{},valuecache:{}};for(let d=0;d<r.length;d++)i.feature=r.feature(d),e.writeMessage(2,_m,i);const s=i.keys;for(const d of s)e.writeStringField(3,d);const A=i.values;for(const d of A)e.writeMessage(4,vm,d)}function _m(r,e){if(!r.feature)return;const i=r.feature;i.id!==void 0&&e.writeVarintField(1,i.id),e.writeMessage(2,gm,r),e.writeVarintField(3,i.type),e.writeMessage(4,ym,i)}function gm(r,e){var i;for(const s in(i=r.feature)==null?void 0:i.properties){let A=r.feature.properties[s],d=r.keycache[s];if(A==null)continue;d===void 0&&(r.keys.push(s),d=r.keys.length-1,r.keycache[s]=d),e.writeVarint(d),typeof A!="string"&&typeof A!="boolean"&&typeof A!="number"&&(A=JSON.stringify(A));const _=typeof A+":"+A;let b=r.valuecache[_];b===void 0&&(r.values.push(A),b=r.values.length-1,r.valuecache[_]=b),e.writeVarint(b)}}function yA(r,e){return(e<<3)+(7&r)}function yd(r){return r<<1^r>>31}function ym(r,e){const i=r.loadGeometry(),s=r.type;let A=0,d=0;for(const _ of i){let b=1;s===1&&(b=_.length),e.writeVarint(yA(1,b));const M=s===3?_.length-1:_.length;for(let I=0;I<M;I++){I===1&&s!==1&&e.writeVarint(yA(2,M-1));const k=_[I].x-A,F=_[I].y-d;e.writeVarint(yd(k)),e.writeVarint(yd(F)),A+=k,d+=F}r.type===3&&e.writeVarint(yA(7,1))}}function vm(r,e){const i=typeof r;i==="string"?e.writeStringField(1,r):i==="boolean"?e.writeBooleanField(7,r):i==="number"&&(r%1!=0?e.writeDoubleField(3,r):r<0?e.writeSVarintField(6,r):e.writeVarintField(5,r))}class vd{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new fo(Oi,16,0),this.grid3D=new fo(Oi,16,0),this.featureIndexArray=new ie,this.promoteId=i}insert(e,i,s,A,d,_){const b=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,A,d);const M=_?this.grid3D:this.grid;for(let I=0;I<i.length;I++){const k=i[I],F=[1/0,1/0,-1/0,-1/0];for(let V=0;V<k.length;V++){const j=k[V];F[0]=Math.min(F[0],j.x),F[1]=Math.min(F[1],j.y),F[2]=Math.max(F[2],j.x),F[3]=Math.max(F[3],j.y)}F[0]<Oi&&F[1]<Oi&&F[2]>=0&&F[3]>=0&&M.insert(b,F[0],F[1],F[2],F[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=this.encoding!=="mlt"?new sf(new oc(this.rawTileData)).layers:new gd(this.rawTileData).layers,this.sourceLayerCoder=new Zf(this.vtLayers?Object.keys(this.vtLayers).sort():[Oh])),this.vtLayers}query(e,i,s,A){this.loadVTLayers();const d=e.params,_=Oi/e.tileSize/e.scale,b=Rt(d.filter,d.globalState),M=e.queryGeometry,I=e.queryPadding*_,k=Cu.fromPoints(M),F=this.grid.query(k.minX-I,k.minY-I,k.maxX+I,k.maxY+I),V=Cu.fromPoints(e.cameraQueryGeometry).expandBy(I),j=this.grid3D.query(V.minX,V.minY,V.maxX,V.maxY,((Y,re,ge,oe)=>(function(ue,ve,Te,Ue,lt){for(const dt of ue)if(ve<=dt.x&&Te<=dt.y&&Ue>=dt.x&&lt>=dt.y)return!0;const nt=[new it(ve,Te),new it(ve,lt),new it(Ue,lt),new it(Ue,Te)];if(ue.length>2){for(const dt of nt)if(Qu(ue,dt))return!0}for(let dt=0;dt<ue.length-1;dt++)if(bp(ue[dt],ue[dt+1],nt))return!0;return!1})(e.cameraQueryGeometry,Y-I,re-I,ge+I,oe+I)));for(const Y of j)F.push(Y);F.sort(xm);const H={};let Q;for(let Y=0;Y<F.length;Y++){const re=F[Y];if(re===Q)continue;Q=re;const ge=this.featureIndexArray.get(re);let oe=null;this.loadMatchingFeature(H,ge.bucketIndex,ge.sourceLayerIndex,ge.featureIndex,b,d.layers,d.availableImages,i,s,A,((ue,ve,Te)=>(oe||(oe=fl(ue)),ve.queryIntersectsFeature({queryGeometry:M,feature:ue,featureState:Te,geometry:oe,zoom:this.z,transform:e.transform,pixelsToTileUnits:_,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation}))))}return H}loadMatchingFeature(e,i,s,A,d,_,b,M,I,k,F){const V=this.bucketLayerIDs[i];if(_&&!V.some((Y=>_.has(Y))))return;const j=this.sourceLayerCoder.decode(s),H=this.vtLayers[j].feature(A);if(d.needGeometry){const Y=dl(H,!0);if(!d.filter(new ze(this.tileID.overscaledZ),Y,this.tileID.canonical))return}else if(!d.filter(new ze(this.tileID.overscaledZ),H))return;const Q=this.getId(H,j);for(let Y=0;Y<V.length;Y++){const re=V[Y];if(_&&!_.has(re))continue;const ge=M[re];if(!ge)continue;let oe={};Q&&k&&(oe=k.getState(ge.sourceLayer||Oh,Q));const ue=Er({},I[re]);ue.paint=xd(ue.paint,ge.paint,H,oe,b),ue.layout=xd(ue.layout,ge.layout,H,oe,b);const ve=!F||F(H,ge,oe);if(!ve)continue;const Te=new Uf(H,this.z,this.x,this.y,Q);Te.layer=ue;let Ue=e[re];Ue===void 0&&(Ue=e[re]=[]),Ue.push({featureIndex:A,feature:Te,intersectionZ:ve})}}lookupSymbolFeatures(e,i,s,A,d,_,b,M){const I={};this.loadVTLayers();const k=Rt(d.filterSpec,d.globalState);for(const F of e)this.loadMatchingFeature(I,s,A,F,k,_,b,M,i);return I}hasLayer(e){for(const i of this.bucketLayerIDs)for(const s of i)if(e===s)return!0;return!1}getId(e,i){var s;let A=e.id;return this.promoteId&&(A=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[i]],typeof A=="boolean"&&(A=Number(A)),A===void 0&&(!((s=e.properties)===null||s===void 0)&&s.cluster)&&this.promoteId&&(A=Number(e.properties.cluster_id))),A}}function xd(r,e,i,s,A){return us(r,((d,_)=>{const b=e instanceof vt?e.get(_):null;return b&&b.evaluate?b.evaluate(i,s,A):b}))}function xm(r,e){return e-r}function bd(r,e,i,s,A){const d=[];for(let _=0;_<r.length;_++){const b=r[_];let M;for(let I=0;I<b.length-1;I++){let k=b[I],F=b[I+1];k.x<e&&F.x<e||(k.x<e?k=new it(e,k.y+(e-k.x)/(F.x-k.x)*(F.y-k.y))._round():F.x<e&&(F=new it(e,k.y+(e-k.x)/(F.x-k.x)*(F.y-k.y))._round()),k.y<i&&F.y<i||(k.y<i?k=new it(k.x+(i-k.y)/(F.y-k.y)*(F.x-k.x),i)._round():F.y<i&&(F=new it(k.x+(i-k.y)/(F.y-k.y)*(F.x-k.x),i)._round()),k.x>=s&&F.x>=s||(k.x>=s?k=new it(s,k.y+(s-k.x)/(F.x-k.x)*(F.y-k.y))._round():F.x>=s&&(F=new it(s,k.y+(s-k.x)/(F.x-k.x)*(F.y-k.y))._round()),k.y>=A&&F.y>=A||(k.y>=A?k=new it(k.x+(A-k.y)/(F.y-k.y)*(F.x-k.x),A)._round():F.y>=A&&(F=new it(k.x+(A-k.y)/(F.y-k.y)*(F.x-k.x),A)._round()),M&&k.equals(M[M.length-1])||(M=[k],d.push(M)),M.push(F)))))}}return d}function wd(r,e,i,s,A){switch(e){case 1:return(function(d,_,b,M){const I=[];for(const k of d)for(const F of k){const V=M===0?F.x:F.y;V>=_&&V<=b&&I.push([F])}return I})(r,i,s,A);case 2:return Td(r,i,s,A,!1);case 3:return Td(r,i,s,A,!0)}return[]}function bm(r,e,i,s,A){const d=s===0?wm:Tm;let _=[];const b=[];for(let k=0;k<r.length-1;k++){const F=r[k],V=r[k+1],j=s===0?F.x:F.y,H=s===0?V.x:V.y;let Q=!1;j<e?H>e&&_.push(d(F,V,e)):j>i?H<i&&_.push(d(F,V,i)):_.push(F),H<e&&j>=e&&(_.push(d(F,V,e)),Q=!0),H>i&&j<=i&&(_.push(d(F,V,i)),Q=!0),!A&&Q&&(b.push(_),_=[])}const M=r.length-1,I=s===0?r[M].x:r[M].y;return I>=e&&I<=i&&_.push(r[M]),A&&_.length>0&&!_[0].equals(_[_.length-1])&&_.push(new it(_[0].x,_[0].y)),_.length>0&&b.push(_),b}function Td(r,e,i,s,A){const d=[];for(const _ of r){const b=bm(_,e,i,s,A);b.length>0&&d.push(...b)}return d}function wm(r,e,i){return new it(i,r.y+(i-r.x)/(e.x-r.x)*(e.y-r.y))}function Tm(r,e,i){return new it(r.x+(i-r.y)/(e.y-r.y)*(e.x-r.x),i)}kt("FeatureIndex",vd,{omit:["rawTileData","sourceLayerCoder"]});class ou extends it{constructor(e,i,s,A){super(e,i),this.angle=s,A!==void 0&&(this.segment=A)}clone(){return new ou(this.x,this.y,this.angle,this.segment)}}function Pd(r,e,i,s,A){if(e.segment===void 0||i===0)return!0;let d=e,_=e.segment+1,b=0;for(;b>-i/2;){if(_--,_<0)return!1;b-=r[_].dist(d),d=r[_]}b+=r[_].dist(r[_+1]),_++;const M=[];let I=0;for(;b<i/2;){const k=r[_],F=r[_+1];if(!F)return!1;let V=r[_-1].angleTo(k)-k.angleTo(F);for(V=Math.abs((V+3*Math.PI)%(2*Math.PI)-Math.PI),M.push({distance:b,angleDelta:V}),I+=V;b-M[0].distance>s;)I-=M.shift().angleDelta;if(I>A)return!1;_++,b+=k.dist(F)}return!0}function Md(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function Ed(r,e,i){return r?.6*e*i:0}function Sd(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function Pm(r,e,i,s,A,d){const _=Ed(i,A,d),b=Sd(i,s)*d;let M=0;const I=Md(r)/2;for(let k=0;k<r.length-1;k++){const F=r[k],V=r[k+1],j=F.dist(V);if(M+j>I){const H=(I-M)/j,Q=ir.number(F.x,V.x,H),Y=ir.number(F.y,V.y,H),re=new ou(Q,Y,V.angleTo(F),k);return re._round(),!_||Pd(r,re,b,_,e)?re:void 0}M+=j}}function Mm(r,e,i,s,A,d,_,b,M){const I=Ed(s,d,_),k=Sd(s,A),F=k*_,V=r[0].x===0||r[0].x===M||r[0].y===0||r[0].y===M;return e-F<e/4&&(e=F+e/4),Cd(r,V?e/2*b%e:(k/2+2*d)*_*b%e,e,I,i,F,V,!1,M)}function Cd(r,e,i,s,A,d,_,b,M){const I=d/2,k=Md(r);let F=0,V=e-i,j=[];for(let H=0;H<r.length-1;H++){const Q=r[H],Y=r[H+1],re=Q.dist(Y),ge=Y.angleTo(Q);for(;V+i<F+re;){V+=i;const oe=(V-F)/re,ue=ir.number(Q.x,Y.x,oe),ve=ir.number(Q.y,Y.y,oe);if(ue>=0&&ue<M&&ve>=0&&ve<M&&V-I>=0&&V+I<=k){const Te=new ou(ue,ve,ge,H);Te._round(),s&&!Pd(r,Te,d,s,A)||j.push(Te)}}F+=re}return b||j.length||_||(j=Cd(r,F/2,i,s,A,d,_,!0,M)),j}function Id(r,e,i,s){const A=[],d=r.image,_=d.pixelRatio,b=d.paddedRect.w-2,M=d.paddedRect.h-2;let I={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom};const k=d.stretchX||[[0,b]],F=d.stretchY||[[0,M]],V=(Xe,Lt)=>Xe+Lt[1]-Lt[0],j=k.reduce(V,0),H=F.reduce(V,0),Q=b-j,Y=M-H;let re=0,ge=j,oe=0,ue=H,ve=0,Te=Q,Ue=0,lt=Y;if(d.content&&s){const Xe=d.content,Lt=Xe[2]-Xe[0],Ct=Xe[3]-Xe[1];(d.textFitWidth||d.textFitHeight)&&(I=Pf(r)),re=gc(k,0,Xe[0]),oe=gc(F,0,Xe[1]),ge=gc(k,Xe[0],Xe[2]),ue=gc(F,Xe[1],Xe[3]),ve=Xe[0]-re,Ue=Xe[1]-oe,Te=Lt-ge,lt=Ct-ue}const nt=I.x1,dt=I.y1,Tt=I.x2-nt,mt=I.y2-dt,st=(Xe,Lt,Ct,Ot)=>{const Et=yc(Xe.stretch-re,ge,Tt,nt),Ut=vc(Xe.fixed-ve,Te,Xe.stretch,j),ji=yc(Lt.stretch-oe,ue,mt,dt),Di=vc(Lt.fixed-Ue,lt,Lt.stretch,H),Or=yc(Ct.stretch-re,ge,Tt,nt),Ps=vc(Ct.fixed-ve,Te,Ct.stretch,j),Tn=yc(Ot.stretch-oe,ue,mt,dt),Nr=vc(Ot.fixed-Ue,lt,Ot.stretch,H),kr=new it(Et,ji),rr=new it(Or,ji),Xr=new it(Or,Tn),ln=new it(Et,Tn),Pr=new it(Ut/_,Di/_),_o=new it(Ps/_,Nr/_),Ms=e*Math.PI/180;if(Ms){const as=Math.sin(Ms),qr=Math.cos(Ms),Pn=[qr,-as,as,qr];kr._matMult(Pn),rr._matMult(Pn),ln._matMult(Pn),Xr._matMult(Pn)}const go=Xe.stretch+Xe.fixed,Pa=Lt.stretch+Lt.fixed;return{tl:kr,tr:rr,bl:ln,br:Xr,tex:{x:d.paddedRect.x+1+go,y:d.paddedRect.y+1+Pa,w:Ct.stretch+Ct.fixed-go,h:Ot.stretch+Ot.fixed-Pa},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Pr,pixelOffsetBR:_o,minFontScaleX:Te/_/Tt,minFontScaleY:lt/_/mt,isSDF:i}};if(s&&(d.stretchX||d.stretchY)){const Xe=Dd(k,Q,j),Lt=Dd(F,Y,H);for(let Ct=0;Ct<Xe.length-1;Ct++){const Ot=Xe[Ct],Et=Xe[Ct+1];for(let Ut=0;Ut<Lt.length-1;Ut++)A.push(st(Ot,Lt[Ut],Et,Lt[Ut+1]))}}else A.push(st({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:b+1},{fixed:0,stretch:M+1}));return A}function gc(r,e,i){let s=0;for(const A of r)s+=Math.max(e,Math.min(i,A[1]))-Math.max(e,Math.min(i,A[0]));return s}function Dd(r,e,i){const s=[{fixed:-1,stretch:0}];for(const[A,d]of r){const _=s[s.length-1];s.push({fixed:A-_.stretch,stretch:_.stretch}),s.push({fixed:A-_.stretch,stretch:_.stretch+(d-A)})}return s.push({fixed:e+1,stretch:i}),s}function yc(r,e,i,s){return r/e*i+s}function vc(r,e,i,s){return r-e*i/s}kt("Anchor",ou);class xc{constructor(e,i,s,A,d,_,b,M,I,k){var F;if(this.boxStartIndex=e.length,I){let V=_.top,j=_.bottom;const H=_.collisionPadding;H&&(V-=H[1],j+=H[3]);let Q=j-V;Q>0&&(Q=Math.max(10,Q),this.circleDiameter=Q)}else{const V=!((F=_.image)===null||F===void 0)&&F.content&&(_.image.textFitWidth||_.image.textFitHeight)?Pf(_):{x1:_.left,y1:_.top,x2:_.right,y2:_.bottom};V.y1=V.y1*b-M[0],V.y2=V.y2*b+M[2],V.x1=V.x1*b-M[3],V.x2=V.x2*b+M[1];const j=_.collisionPadding;if(j&&(V.x1-=j[0]*b,V.y1-=j[1]*b,V.x2+=j[2]*b,V.y2+=j[3]*b),k){const H=new it(V.x1,V.y1),Q=new it(V.x2,V.y1),Y=new it(V.x1,V.y2),re=new it(V.x2,V.y2),ge=k*Math.PI/180;H._rotate(ge),Q._rotate(ge),Y._rotate(ge),re._rotate(ge),V.x1=Math.min(H.x,Q.x,Y.x,re.x),V.x2=Math.max(H.x,Q.x,Y.x,re.x),V.y1=Math.min(H.y,Q.y,Y.y,re.y),V.y2=Math.max(H.y,Q.y,Y.y,re.y)}e.emplaceBack(i.x,i.y,V.x1,V.y1,V.x2,V.y2,s,A,d)}this.boxEndIndex=e.length}}class Em{constructor(e=[],i=(s,A)=>s<A?-1:s>A?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:s}=this,A=i[e];for(;e>0;){const d=e-1>>1,_=i[d];if(s(A,_)>=0)break;i[e]=_,e=d}i[e]=A}_down(e){const{data:i,compare:s}=this,A=this.length>>1,d=i[e];for(;e<A;){let _=1+(e<<1);const b=_+1;if(b<this.length&&s(i[b],i[_])<0&&(_=b),s(i[_],d)>=0)break;i[e]=i[_],e=_}i[e]=d}}function Sm(r,e=1,i=!1){const s=Cu.fromPoints(r[0]),A=Math.min(s.width(),s.height());let d=A/2;const _=new Em([],Cm),{minX:b,minY:M,maxX:I,maxY:k}=s;if(A===0)return new it(b,M);for(let j=b;j<I;j+=A)for(let H=M;H<k;H+=A)_.push(new ah(j+d,H+d,d,r));let F=(function(j){let H=0,Q=0,Y=0;const re=j[0];for(let ge=0,oe=re.length,ue=oe-1;ge<oe;ue=ge++){const ve=re[ge],Te=re[ue],Ue=ve.x*Te.y-Te.x*ve.y;Q+=(ve.x+Te.x)*Ue,Y+=(ve.y+Te.y)*Ue,H+=3*Ue}return new ah(Q/H,Y/H,0,j)})(r),V=_.length;for(;_.length;){const j=_.pop();(j.d>F.d||!F.d)&&(F=j,i&&console.log("found best %d after %d probes",Math.round(1e4*j.d)/1e4,V)),j.max-F.d<=e||(d=j.h/2,_.push(new ah(j.p.x-d,j.p.y-d,d,r)),_.push(new ah(j.p.x+d,j.p.y-d,d,r)),_.push(new ah(j.p.x-d,j.p.y+d,d,r)),_.push(new ah(j.p.x+d,j.p.y+d,d,r)),V+=4)}return i&&(console.log(`num probes: ${V}`),console.log(`best distance: ${F.d}`)),F.p}function Cm(r,e){return e.max-r.max}function ah(r,e,i,s){this.p=new it(r,e),this.h=i,this.d=(function(A,d){let _=!1,b=1/0;for(let M=0;M<d.length;M++){const I=d[M];for(let k=0,F=I.length,V=F-1;k<F;V=k++){const j=I[k],H=I[V];j.y>A.y!=H.y>A.y&&A.x<(H.x-j.x)*(A.y-j.y)/(H.y-j.y)+j.x&&(_=!_),b=Math.min(b,BA(A,j,H))}}return(_?1:-1)*Math.sqrt(b)})(this.p,s),this.max=this.d+this.h*Math.SQRT2}var Ts;W.aP=void 0,(Ts=W.aP||(W.aP={}))[Ts.center=1]="center",Ts[Ts.left=2]="left",Ts[Ts.right=3]="right",Ts[Ts.top=4]="top",Ts[Ts.bottom=5]="bottom",Ts[Ts["top-left"]=6]="top-left",Ts[Ts["top-right"]=7]="top-right",Ts[Ts["bottom-left"]=8]="bottom-left",Ts[Ts["bottom-right"]=9]="bottom-right";const vA=Number.POSITIVE_INFINITY;function kd(r,e){return e[1]!==vA?(function(i,s,A){let d=0,_=0;switch(s=Math.abs(s),A=Math.abs(A),i){case"top-right":case"top-left":case"top":_=A-7;break;case"bottom-right":case"bottom-left":case"bottom":_=7-A}switch(i){case"top-right":case"bottom-right":case"right":d=-s;break;case"top-left":case"bottom-left":case"left":d=s}return[d,_]})(r,e[0],e[1]):(function(i,s){let A=0,d=0;s<0&&(s=0);const _=s/Math.SQRT2;switch(i){case"top-right":case"top-left":d=_-7;break;case"bottom-right":case"bottom-left":d=7-_;break;case"bottom":d=7-s;break;case"top":d=s-7}switch(i){case"top-right":case"bottom-right":A=-_;break;case"top-left":case"bottom-left":A=_;break;case"left":A=s;break;case"right":A=-s}return[A,d]})(r,e[0])}function zd(r,e,i){var s;const A=r.layout,d=(s=A.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(e,{},i);if(d){const b=d.values,M=[];for(let I=0;I<b.length;I+=2){const k=M[I]=b[I],F=b[I+1].map((V=>V*ns));k.startsWith("top")?F[1]-=7:k.startsWith("bottom")&&(F[1]+=7),M[I+1]=F}return new cn(M)}const _=A.get("text-variable-anchor");if(_){let b;b=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[A.get("text-radial-offset").evaluate(e,{},i)*ns,vA]:A.get("text-offset").evaluate(e,{},i).map((I=>I*ns));const M=[];for(const I of _)M.push(I,kd(I,b));return new cn(M)}return null}function xA(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Im(r,e,i,s,A,d,_,b,M,I,k,F){let V=d.textMaxSize.evaluate(e,{});V===void 0&&(V=_);const j=r.layers[0].layout,H=j.get("icon-offset").evaluate(e,{},k),Q=Bd(i.horizontal),Y=_/24,re=r.tilePixelRatio*Y,ge=r.tilePixelRatio*V/24,oe=r.tilePixelRatio*b,ue=r.tilePixelRatio*j.get("symbol-spacing"),ve=j.get("text-padding")*r.tilePixelRatio,Te=(function(Ct,Ot,Et,Ut=1){const ji=Ct.get("icon-padding").evaluate(Ot,{},Et),Di=ji&&ji.values;return[Di[0]*Ut,Di[1]*Ut,Di[2]*Ut,Di[3]*Ut]})(j,e,k,r.tilePixelRatio),Ue=j.get("text-max-angle")/180*Math.PI,lt=j.get("text-rotation-alignment")!=="viewport"&&j.get("symbol-placement")!=="point",nt=j.get("icon-rotation-alignment")==="map"&&j.get("symbol-placement")!=="point",dt=j.get("symbol-placement"),Tt=ue/2,mt=j.get("icon-text-fit");let st;s&&mt!=="none"&&(r.allowVerticalPlacement&&i.vertical&&(st=Mf(s,i.vertical,mt,j.get("icon-text-fit-padding"),H,Y)),Q&&(s=Mf(s,Q,mt,j.get("icon-text-fit-padding"),H,Y)));const Xe=k?F.line.getGranularityForZoomLevel(k.z):1,Lt=(Ct,Ot)=>{Ot.x<0||Ot.x>=Oi||Ot.y<0||Ot.y>=Oi||(function(Et,Ut,ji,Di,Or,Ps,Tn,Nr,kr,rr,Xr,ln,Pr,_o,Ms,go,Pa,as,qr,Pn,Kr,ls,Fl,Ua,jh){const au=Et.addToLineVertexArray(Ut,ji);let ku,lh,uh,hh,Nd=0,Vd=0,jd=0,Zd=0,CA=-1,IA=-1;const Ol={};let Ud=an("");if(Et.allowVerticalPlacement&&Di.vertical){const Os=Nr.layout.get("text-rotate").evaluate(Kr,{},Ua)+90;uh=new xc(kr,Ut,rr,Xr,ln,Di.vertical,Pr,_o,Ms,Os),Tn&&(hh=new xc(kr,Ut,rr,Xr,ln,Tn,Pa,as,Ms,Os))}if(Or){const Os=Nr.layout.get("icon-rotate").evaluate(Kr,{}),la=Nr.layout.get("icon-text-fit")!=="none",zu=Id(Or,Os,Fl,la),qa=Tn?Id(Tn,Os,Fl,la):void 0;lh=new xc(kr,Ut,rr,Xr,ln,Or,Pa,as,!1,Os),Nd=4*zu.length;const Lu=Et.iconSizeData;let pl=null;Lu.kind==="source"?(pl=[Bl*Nr.layout.get("icon-size").evaluate(Kr,{})],pl[0]>ru&&en(`${Et.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Lu.kind==="composite"&&(pl=[Bl*ls.compositeIconSizes[0].evaluate(Kr,{},Ua),Bl*ls.compositeIconSizes[1].evaluate(Kr,{},Ua)],(pl[0]>ru||pl[1]>ru)&&en(`${Et.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Et.addSymbols(Et.icon,zu,pl,Pn,qr,Kr,W.az.none,Ut,au.lineStartIndex,au.lineLength,-1,Ua),CA=Et.icon.placedSymbolArray.length-1,qa&&(Vd=4*qa.length,Et.addSymbols(Et.icon,qa,pl,Pn,qr,Kr,W.az.vertical,Ut,au.lineStartIndex,au.lineLength,-1,Ua),IA=Et.icon.placedSymbolArray.length-1)}const Gd=Object.keys(Di.horizontal);for(const Os of Gd){const la=Di.horizontal[Os];if(!ku){Ud=an(la.text);const qa=Nr.layout.get("text-rotate").evaluate(Kr,{},Ua);ku=new xc(kr,Ut,rr,Xr,ln,la,Pr,_o,Ms,qa)}const zu=la.positionedLines.length===1;if(jd+=Ld(Et,Ut,la,Ps,Nr,Ms,Kr,go,au,Di.vertical?W.az.horizontal:W.az.horizontalOnly,zu?Gd:[Os],Ol,CA,ls,Ua),zu)break}Di.vertical&&(Zd+=Ld(Et,Ut,Di.vertical,Ps,Nr,Ms,Kr,go,au,W.az.vertical,["vertical"],Ol,IA,ls,Ua));const zm=ku?ku.boxStartIndex:Et.collisionBoxArray.length,Lm=ku?ku.boxEndIndex:Et.collisionBoxArray.length,Bm=uh?uh.boxStartIndex:Et.collisionBoxArray.length,Rm=uh?uh.boxEndIndex:Et.collisionBoxArray.length,Fm=lh?lh.boxStartIndex:Et.collisionBoxArray.length,Om=lh?lh.boxEndIndex:Et.collisionBoxArray.length,Nm=hh?hh.boxStartIndex:Et.collisionBoxArray.length,Vm=hh?hh.boxEndIndex:Et.collisionBoxArray.length;let Ga=-1;const wc=(Os,la)=>Os&&Os.circleDiameter?Math.max(Os.circleDiameter,la):la;Ga=wc(ku,Ga),Ga=wc(uh,Ga),Ga=wc(lh,Ga),Ga=wc(hh,Ga);const qd=Ga>-1?1:0;qd&&(Ga*=jh/ns),Et.glyphOffsetArray.length>=th.MAX_GLYPHS&&en("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Kr.sortKey!==void 0&&Et.addToSortKeyRanges(Et.symbolInstances.length,Kr.sortKey);const jm=zd(Nr,Kr,Ua),[Zm,Um]=(function(Os,la){const zu=Os.length,qa=la==null?void 0:la.values;if((qa==null?void 0:qa.length)>0)for(let Lu=0;Lu<qa.length;Lu+=2){const pl=qa[Lu+1];Os.emplaceBack(W.aP[qa[Lu]],pl[0],pl[1])}return[zu,Os.length]})(Et.textAnchorOffsets,jm);Et.symbolInstances.emplaceBack(Ut.x,Ut.y,Ol.right>=0?Ol.right:-1,Ol.center>=0?Ol.center:-1,Ol.left>=0?Ol.left:-1,Ol.vertical||-1,CA,IA,Ud,zm,Lm,Bm,Rm,Fm,Om,Nm,Vm,rr,jd,Zd,Nd,Vd,qd,0,Pr,Ga,Zm,Um)})(r,Ot,Ct,i,s,A,st,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,re,[ve,ve,ve,ve],lt,M,oe,Te,nt,H,e,d,I,k,_)};if(dt==="line")for(const Ct of bd(e.geometry,0,0,Oi,Oi)){const Ot=Su(Ct,Xe),Et=Mm(Ot,ue,Ue,i.vertical||Q,s,24,ge,r.overscaling,Oi);for(const Ut of Et)Q&&Dm(r,Q.text,Tt,Ut)||Lt(Ot,Ut)}else if(dt==="line-center"){for(const Ct of e.geometry)if(Ct.length>1){const Ot=Su(Ct,Xe),Et=Pm(Ot,Ue,i.vertical||Q,s,24,ge);Et&&Lt(Ot,Et)}}else if(e.type==="Polygon")for(const Ct of ma(e.geometry,0)){const Ot=Sm(Ct,16);Lt(Su(Ct[0],Xe,!0),new ou(Ot.x,Ot.y,0))}else if(e.type==="LineString")for(const Ct of e.geometry){const Ot=Su(Ct,Xe);Lt(Ot,new ou(Ot[0].x,Ot[0].y,0))}else if(e.type==="Point")for(const Ct of e.geometry)for(const Ot of Ct)Lt([Ot],new ou(Ot.x,Ot.y,0))}function Ld(r,e,i,s,A,d,_,b,M,I,k,F,V,j,H){const Q=(function(ge,oe,ue,ve,Te,Ue,lt,nt){const dt=ve.layout.get("text-rotate").evaluate(Ue,{})*Math.PI/180,Tt=[];for(const mt of oe.positionedLines)for(const st of mt.positionedGlyphs){if(!st.rect)continue;const Xe=st.rect||{};let Lt=4,Ct=!0,Ot=1,Et=0;const Ut=(Te||nt)&&st.vertical,ji=st.metrics.advance*st.scale/2;if(nt&&oe.verticalizable&&(Et=mt.lineOffset/2-(st.imageName?-(ns-st.metrics.width*st.scale)/2:(st.scale-1)*ns)),st.imageName){const as=lt[st.imageName];Ct=as.sdf,Ot=as.pixelRatio,Lt=1/Ot}const Di=Te?[st.x+ji,st.y]:[0,0];let Or=Te?[0,0]:[st.x+ji+ue[0],st.y+ue[1]-Et],Ps=[0,0];Ut&&(Ps=Or,Or=[0,0]);const Tn=st.metrics.isDoubleResolution?2:1,Nr=(st.metrics.left-Lt)*st.scale-ji+Or[0],kr=(-st.metrics.top-Lt)*st.scale+Or[1],rr=Nr+Xe.w/Tn*st.scale/Ot,Xr=kr+Xe.h/Tn*st.scale/Ot,ln=new it(Nr,kr),Pr=new it(rr,kr),_o=new it(Nr,Xr),Ms=new it(rr,Xr);if(Ut){const as=new it(-ji,ji- -17),qr=-Math.PI/2,Pn=12-ji,Kr=new it(22-Pn,-(st.imageName?Pn:0)),ls=new it(...Ps);ln._rotateAround(qr,as)._add(Kr)._add(ls),Pr._rotateAround(qr,as)._add(Kr)._add(ls),_o._rotateAround(qr,as)._add(Kr)._add(ls),Ms._rotateAround(qr,as)._add(Kr)._add(ls)}if(dt){const as=Math.sin(dt),qr=Math.cos(dt),Pn=[qr,-as,as,qr];ln._matMult(Pn),Pr._matMult(Pn),_o._matMult(Pn),Ms._matMult(Pn)}const go=new it(0,0),Pa=new it(0,0);Tt.push({tl:ln,tr:Pr,bl:_o,br:Ms,tex:Xe,writingMode:oe.writingMode,glyphOffset:Di,sectionIndex:st.sectionIndex,isSDF:Ct,pixelOffsetTL:go,pixelOffsetBR:Pa,minFontScaleX:0,minFontScaleY:0})}return Tt})(0,i,b,A,d,_,s,r.allowVerticalPlacement),Y=r.textSizeData;let re=null;Y.kind==="source"?(re=[Bl*A.layout.get("text-size").evaluate(_,{})],re[0]>ru&&en(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):Y.kind==="composite"&&(re=[Bl*j.compositeTextSizes[0].evaluate(_,{},H),Bl*j.compositeTextSizes[1].evaluate(_,{},H)],(re[0]>ru||re[1]>ru)&&en(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),r.addSymbols(r.text,Q,re,b,d,_,I,e,M.lineStartIndex,M.lineLength,V,H);for(const ge of k)F[ge]=r.text.placedSymbolArray.length-1;return 4*Q.length}function Bd(r){for(const e in r)return r[e];return null}function Dm(r,e,i,s){const A=r.compareText;if(e in A){const d=A[e];for(let _=d.length-1;_>=0;_--)if(s.dist(d[_])<i)return!0}else A[e]=[];return A[e].push(s),!1}const Rd=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class bA{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,s]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const A=s>>4;if(A!==1)throw new Error(`Got v${A} data when expected v1.`);const d=Rd[15&s];if(!d)throw new Error("Unrecognized array type.");const[_]=new Uint16Array(e,2,1),[b]=new Uint32Array(e,4,1);return new bA(b,_,d,e)}constructor(e,i=64,s=Float64Array,A){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const d=Rd.indexOf(this.ArrayType),_=2*e*this.ArrayType.BYTES_PER_ELEMENT,b=e*this.IndexArrayType.BYTES_PER_ELEMENT,M=(8-b%8)%8;if(d<0)throw new Error(`Unexpected typed array class: ${s}.`);A&&A instanceof ArrayBuffer?(this.data=A,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+b+M,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+_+b+M),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+b+M,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+d]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=i,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return wA(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,s,A){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:_,nodeSize:b}=this,M=[0,d.length-1,0],I=[];for(;M.length;){const k=M.pop()||0,F=M.pop()||0,V=M.pop()||0;if(F-V<=b){for(let Y=V;Y<=F;Y++){const re=_[2*Y],ge=_[2*Y+1];re>=e&&re<=s&&ge>=i&&ge<=A&&I.push(d[Y])}continue}const j=V+F>>1,H=_[2*j],Q=_[2*j+1];H>=e&&H<=s&&Q>=i&&Q<=A&&I.push(d[j]),(k===0?e<=H:i<=Q)&&(M.push(V),M.push(j-1),M.push(1-k)),(k===0?s>=H:A>=Q)&&(M.push(j+1),M.push(F),M.push(1-k))}return I}within(e,i,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:A,coords:d,nodeSize:_}=this,b=[0,A.length-1,0],M=[],I=s*s;for(;b.length;){const k=b.pop()||0,F=b.pop()||0,V=b.pop()||0;if(F-V<=_){for(let Y=V;Y<=F;Y++)Od(d[2*Y],d[2*Y+1],e,i)<=I&&M.push(A[Y]);continue}const j=V+F>>1,H=d[2*j],Q=d[2*j+1];Od(H,Q,e,i)<=I&&M.push(A[j]),(k===0?e-s<=H:i-s<=Q)&&(b.push(V),b.push(j-1),b.push(1-k)),(k===0?e+s>=H:i+s>=Q)&&(b.push(j+1),b.push(F),b.push(1-k))}return M}}function wA(r,e,i,s,A,d){if(A-s<=i)return;const _=s+A>>1;Fd(r,e,_,s,A,d),wA(r,e,i,s,_-1,1-d),wA(r,e,i,_+1,A,1-d)}function Fd(r,e,i,s,A,d){for(;A>s;){if(A-s>600){const I=A-s+1,k=i-s+1,F=Math.log(I),V=.5*Math.exp(2*F/3),j=.5*Math.sqrt(F*V*(I-V)/I)*(k-I/2<0?-1:1);Fd(r,e,i,Math.max(s,Math.floor(i-k*V/I+j)),Math.min(A,Math.floor(i+(I-k)*V/I+j)),d)}const _=e[2*i+d];let b=s,M=A;for(Nh(r,e,s,i),e[2*A+d]>_&&Nh(r,e,s,A);b<M;){for(Nh(r,e,b,M),b++,M--;e[2*b+d]<_;)b++;for(;e[2*M+d]>_;)M--}e[2*s+d]===_?Nh(r,e,s,M):(M++,Nh(r,e,M,A)),M<=i&&(s=M+1),i<=M&&(A=M-1)}}function Nh(r,e,i,s){TA(r,i,s),TA(e,2*i,2*s),TA(e,2*i+1,2*s+1)}function TA(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function Od(r,e,i,s){const A=r-i,d=e-s;return A*A+d*d}var PA;W.cH=void 0,(PA=W.cH||(W.cH={})).create="create",PA.load="load",PA.fullLoad="fullLoad";let bc=null,Vh=[];const MA=1e3/60,EA="loadTime",SA="fullLoadTime",km={mark(r){performance.mark(r)},frame(r){const e=r;bc!=null&&Vh.push(e-bc),bc=e},clearMetrics(){bc=null,Vh=[],performance.clearMeasures(EA),performance.clearMeasures(SA);for(const r in W.cH)performance.clearMarks(W.cH[r])},getPerformanceMetrics(){performance.measure(EA,W.cH.create,W.cH.load),performance.measure(SA,W.cH.create,W.cH.fullLoad);const r=performance.getEntriesByName(EA)[0].duration,e=performance.getEntriesByName(SA)[0].duration,i=Vh.length,s=1/(Vh.reduce(((d,_)=>d+_),0)/i/1e3),A=Vh.filter((d=>d>MA)).reduce(((d,_)=>d+(_-MA)/MA),0);return{loadTime:r,fullLoadTime:e,fps:s,percentDroppedFrames:A/(i+A)*100,totalFrames:i}}};W.$=rt,W.A=zi,W.B=ra,W.C=ht,W.D=_t,W.E=Bi,W.F=function([r,e,i]){return e+=90,e*=Math.PI/180,i*=Math.PI/180,{x:r*Math.cos(e)*Math.sin(i),y:r*Math.sin(e)*Math.sin(i),z:r*Math.cos(i)}},W.G=ir,W.H=ze,W.I=Qc,W.J=Jl,W.K=function(r){if(Ui==null){const e=r.navigator?r.navigator.userAgent:null;Ui=!!r.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Ui},W.L=class{constructor(r,e){this.target=r,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new W0((()=>this.process())),this.subscription=vo(this.target,"message",(i=>this.receive(i)),!1),this.globalScope=Is(self)?r:window}registerMessageHandler(r,e){this.messageHandlers[r]=e}unregisterMessageHandler(r){delete this.messageHandlers[r]}sendAsync(r,e){return new Promise(((i,s)=>{const A=Math.round(1e18*Math.random()).toString(36).substring(0,10),d=e?vo(e.signal,"abort",(()=>{d==null||d.unsubscribe(),delete this.resolveRejects[A];const M={id:A,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(M)}),Q0):null;this.resolveRejects[A]={resolve:M=>{d==null||d.unsubscribe(),i(M)},reject:M=>{d==null||d.unsubscribe(),s(M)}};const _=[],b=Object.assign(Object.assign({},r),{id:A,sourceMapId:this.mapId,origin:location.origin,data:c(r.data,_)});this.target.postMessage(b,{transfer:_})}))}receive(r){const e=r.data,i=e.id;if(!(e.origin!=="file://"&&location.origin!=="file://"&&e.origin!=="resource://android"&&location.origin!=="resource://android"&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[i];const s=this.abortControllers[i];return delete this.abortControllers[i],void(s&&s.abort())}if(Is(self)||e.mustQueue)return this.tasks[i]=e,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,e)}}process(){if(this.taskQueue.length===0)return;const r=this.taskQueue.shift(),e=this.tasks[r];delete this.tasks[r],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(r,e)}processTask(r,e){return p(this,void 0,void 0,(function*(){if(e.type==="<response>"){const A=this.resolveRejects[r];return delete this.resolveRejects[r],A?void(e.error?A.reject(m(e.error)):A.resolve(m(e.data))):void 0}if(!this.messageHandlers[e.type])return void this.completeTask(r,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const i=m(e.data),s=new AbortController;this.abortControllers[r]=s;try{const A=yield this.messageHandlers[e.type](e.sourceMapId,i,s);this.completeTask(r,null,A)}catch(A){this.completeTask(r,A)}}))}completeTask(r,e,i){const s=[];delete this.abortControllers[r];const A={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?c(e):null,data:c(i,s)};this.target.postMessage(A,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},W.M=Fe,W.N=function(){var r=new zi(16);return zi!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r},W.O=function(r,e,i){var s,A,d,_,b,M,I,k,F,V,j,H,Q=i[0],Y=i[1],re=i[2];return e===r?(r[12]=e[0]*Q+e[4]*Y+e[8]*re+e[12],r[13]=e[1]*Q+e[5]*Y+e[9]*re+e[13],r[14]=e[2]*Q+e[6]*Y+e[10]*re+e[14],r[15]=e[3]*Q+e[7]*Y+e[11]*re+e[15]):(A=e[1],d=e[2],_=e[3],b=e[4],M=e[5],I=e[6],k=e[7],F=e[8],V=e[9],j=e[10],H=e[11],r[0]=s=e[0],r[1]=A,r[2]=d,r[3]=_,r[4]=b,r[5]=M,r[6]=I,r[7]=k,r[8]=F,r[9]=V,r[10]=j,r[11]=H,r[12]=s*Q+b*Y+F*re+e[12],r[13]=A*Q+M*Y+V*re+e[13],r[14]=d*Q+I*Y+j*re+e[14],r[15]=_*Q+k*Y+H*re+e[15]),r},W.P=it,W.Q=function(r,e,i){var s=i[0],A=i[1],d=i[2];return r[0]=e[0]*s,r[1]=e[1]*s,r[2]=e[2]*s,r[3]=e[3]*s,r[4]=e[4]*A,r[5]=e[5]*A,r[6]=e[6]*A,r[7]=e[7]*A,r[8]=e[8]*d,r[9]=e[9]*d,r[10]=e[10]*d,r[11]=e[11]*d,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},W.R=mo,W.S=function(r,e,i){var s=e[0],A=e[1],d=e[2],_=e[3],b=e[4],M=e[5],I=e[6],k=e[7],F=e[8],V=e[9],j=e[10],H=e[11],Q=e[12],Y=e[13],re=e[14],ge=e[15],oe=i[0],ue=i[1],ve=i[2],Te=i[3];return r[0]=oe*s+ue*b+ve*F+Te*Q,r[1]=oe*A+ue*M+ve*V+Te*Y,r[2]=oe*d+ue*I+ve*j+Te*re,r[3]=oe*_+ue*k+ve*H+Te*ge,r[4]=(oe=i[4])*s+(ue=i[5])*b+(ve=i[6])*F+(Te=i[7])*Q,r[5]=oe*A+ue*M+ve*V+Te*Y,r[6]=oe*d+ue*I+ve*j+Te*re,r[7]=oe*_+ue*k+ve*H+Te*ge,r[8]=(oe=i[8])*s+(ue=i[9])*b+(ve=i[10])*F+(Te=i[11])*Q,r[9]=oe*A+ue*M+ve*V+Te*Y,r[10]=oe*d+ue*I+ve*j+Te*re,r[11]=oe*_+ue*k+ve*H+Te*ge,r[12]=(oe=i[12])*s+(ue=i[13])*b+(ve=i[14])*F+(Te=i[15])*Q,r[13]=oe*A+ue*M+ve*V+Te*Y,r[14]=oe*d+ue*I+ve*j+Te*re,r[15]=oe*_+ue*k+ve*H+Te*ge,r},W.T=Nc,W.U=function(r,e){const i={};for(let s=0;s<e.length;s++){const A=e[s];A in r&&(i[A]=r[A])}return i},W.V=nu,W.W=hn,W.X=Bf,W.Y=Lf,W.Z=Me,W._=p,W.a=le,W.a$=Cs,W.a0=Fo,W.a1=Zo,W.a2=oa,W.a3=Ff,W.a4=hc,W.a5=Oi,W.a6=function(r,e,i){if(!r)return e||{};if(!e)return r||{};const s=jf(r),A=jf(e);(function(_,b){b.removeAll&&(_.add.clear(),_.update.clear(),_.remove.clear(),b.remove.clear());for(const M of b.remove)_.add.delete(M),_.update.delete(M);for(const[M,I]of b.update){const k=_.update.get(M);k&&(b.update.set(M,$0(k,I)),_.update.delete(M))}})(s,A);const d={};if((s.removeAll||A.removeAll)&&(d.removeAll=!0),d.remove=new Set([...s.remove,...A.remove]),d.add=new Map([...s.add,...A.add]),d.update=new Map([...s.update,...A.update]),d.remove.size&&d.add.size)for(const _ of d.add.keys())d.remove.delete(_);return(function(_){const b={};return _.removeAll&&(b.removeAll=_.removeAll),_.remove&&(b.remove=Array.from(_.remove)),_.add&&(b.add=Array.from(_.add.values())),_.update&&(b.update=Array.from(_.update.values())),b})(d)},W.a7=function(r,e){const i=new Map;if(r==null||r.type==null)return i;if(r.type==="Feature"){const s=rA(r,e);return s==null?void 0:(i.set(s,r),i)}if(r.type==="FeatureCollection"){const s=new Set;for(const A of r.features){const d=rA(A,e);if(d==null||s.has(d))return;s.add(d),i.set(d,A)}return i}},W.a8=function(r,e,i){var s,A;const d=[];if(e.removeAll)r.clear();else if(e.remove)for(const _ of e.remove){const b=r.get(_);b&&(d.push(b.geometry),r.delete(_))}if(e.add)for(const _ of e.add){const b=rA(_,i);if(b==null)continue;const M=r.get(b);M&&d.push(M.geometry),d.push(_.geometry),r.set(b,_)}if(e.update)for(const _ of e.update){const b=r.get(_.id);if(!b)continue;const M=!!_.newGeometry,I=_.removeAllProperties||((s=_.removeProperties)===null||s===void 0?void 0:s.length)>0||((A=_.addOrUpdateProperties)===null||A===void 0?void 0:A.length)>0;if(!M&&!I)continue;d.push(b.geometry);const k=Object.assign({},b);if(r.set(_.id,k),M&&(d.push(_.newGeometry),k.geometry=_.newGeometry),I){if(k.properties=_.removeAllProperties?{}:Object.assign({},k.properties||{}),_.removeProperties)for(const F of _.removeProperties)delete k.properties[F];if(_.addOrUpdateProperties)for(const{key:F,value:V}of _.addOrUpdateProperties)k.properties[F]=V}}return d},W.a9=Bh,W.aA=function(r,{uSize:e,uSizeT:i},{lowerSize:s,upperSize:A}){return r.kind==="source"?s/Bl:r.kind==="composite"?ir.number(s/Bl,A/Bl,i):e},W.aB=function(r,e){var i=e[0],s=e[1],A=e[2],d=e[3],_=e[4],b=e[5],M=e[6],I=e[7],k=e[8],F=e[9],V=e[10],j=e[11],H=e[12],Q=e[13],Y=e[14],re=e[15],ge=i*b-s*_,oe=i*M-A*_,ue=i*I-d*_,ve=s*M-A*b,Te=s*I-d*b,Ue=A*I-d*M,lt=k*Q-F*H,nt=k*Y-V*H,dt=k*re-j*H,Tt=F*Y-V*Q,mt=F*re-j*Q,st=V*re-j*Y,Xe=ge*st-oe*mt+ue*Tt+ve*dt-Te*nt+Ue*lt;return Xe?(r[0]=(b*st-M*mt+I*Tt)*(Xe=1/Xe),r[1]=(A*mt-s*st-d*Tt)*Xe,r[2]=(Q*Ue-Y*Te+re*ve)*Xe,r[3]=(V*Te-F*Ue-j*ve)*Xe,r[4]=(M*dt-_*st-I*nt)*Xe,r[5]=(i*st-A*dt+d*nt)*Xe,r[6]=(Y*ue-H*Ue-re*oe)*Xe,r[7]=(k*Ue-V*ue+j*oe)*Xe,r[8]=(_*mt-b*dt+I*lt)*Xe,r[9]=(s*dt-i*mt-d*lt)*Xe,r[10]=(H*Te-Q*ue+re*ge)*Xe,r[11]=(F*ue-k*Te-j*ge)*Xe,r[12]=(b*nt-_*Tt-M*lt)*Xe,r[13]=(i*Tt-s*nt+A*lt)*Xe,r[14]=(Q*oe-H*ve-Y*ge)*Xe,r[15]=(k*ve-F*oe+V*ge)*Xe,r):null},W.aC=Hr,W.aD=function(r){var e=r[0],i=r[1];return Math.sqrt(e*e+i*i)},W.aE=function(r){return r[0]=0,r[1]=0,r},W.aF=function(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r},W.aG=Xc,W.aH=Cn,W.aI=function(r,e,i,s){const A=e.y-r.y,d=e.x-r.x,_=s.y-i.y,b=s.x-i.x,M=_*d-b*A;if(M===0)return null;const I=(b*(r.y-i.y)-_*(r.x-i.x))/M;return new it(r.x+I*d,r.y+I*A)},W.aJ=bd,W.aK=Wu,W.aL=function(r){let e=1/0,i=1/0,s=-1/0,A=-1/0;for(const d of r)e=Math.min(e,d.x),i=Math.min(i,d.y),s=Math.max(s,d.x),A=Math.max(A,d.y);return[e,i,s,A]},W.aM=ns,W.aN=Yt,W.aO=function(r,e,i,s,A=!1){if(!i[0]&&!i[1])return[0,0];const d=A?s==="map"?-r.bearingInRadians:0:s==="viewport"?r.bearingInRadians:0;if(d){const _=Math.sin(d),b=Math.cos(d);i=[i[0]*b-i[1]*_,i[0]*_+i[1]*b]}return[A?i[0]:Yt(e,i[0],r.zoom),A?i[1]:Yt(e,i[1],r.zoom)]},W.aQ=Yc,W.aR=xA,W.aS=$c,W.aT=bA,W.aU=on,W.aV=nc,W.aW=he,W.aX=Pt,W.aY=Ye,W.aZ=mn,W.a_=Of,W.aa=Cu,W.ab=25,W.ac=iA,W.ad=r=>{const e=window.document.createElement("video");return e.muted=!0,new Promise((i=>{e.onloadstart=()=>{i(e)};for(const s of r){const A=window.document.createElement("source");ot(s)||(e.crossOrigin="Anonymous"),A.src=s,e.appendChild(A)}}))},W.ae=o,W.af=function(){return yo++},W.ag=f,W.ah=th,W.ai=Oh,W.aj=Rt,W.ak=dl,W.al=Uf,W.am=function(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((i,s,A,d)=>{const _=A||d;return e[s]=!_||_.toLowerCase(),""})),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e},W.an=Ai,W.ao=85.051129,W.ap=Ds,W.aq=function(r){return Math.pow(2,r)},W.ar=no,W.as=Rf,W.at=function(r){return Math.log(r)/Math.LN2},W.au=function(r){var e=r[0],i=r[1];return e*e+i*i},W.av=function(r){if(!r.length)return new Set;const e=Math.max(...r.map((M=>M.canonical.z)));let i=1/0,s=-1/0,A=1/0,d=-1/0;const _=[];for(const M of r){const{x:I,y:k,z:F}=M.canonical,V=Math.pow(2,e-F),j=I*V,H=k*V;_.push({id:M,x:j,y:H}),j<i&&(i=j),j>s&&(s=j),H<A&&(A=H),H>d&&(d=H)}const b=new Set;for(const M of _)M.x!==i&&M.x!==s&&M.y!==A&&M.y!==d||b.add(M.id);return b},W.aw=function(r,e){const i=Math.abs(2*r.wrap)-+(r.wrap<0),s=Math.abs(2*e.wrap)-+(e.wrap<0);return r.overscaledZ-e.overscaledZ||s-i||e.canonical.y-r.canonical.y||e.canonical.x-r.canonical.x},W.ax=class{constructor(r,e){this.max=r,this.onRemove=e,this.reset()}reset(){for(const r in this.data)for(const e of this.data[r])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(r,e,i){const s=r.wrapped().key;this.data[s]===void 0&&(this.data[s]=[]);const A={value:e,timeout:void 0};if(i!==void 0&&(A.timeout=setTimeout((()=>{this.remove(r,A)}),i)),this.data[s].push(A),this.order.push(s),this.order.length>this.max){const d=this._getAndRemoveByKey(this.order[0]);d&&this.onRemove(d)}return this}has(r){return r.wrapped().key in this.data}getAndRemove(r){return this.has(r)?this._getAndRemoveByKey(r.wrapped().key):null}_getAndRemoveByKey(r){const e=this.data[r].shift();return e.timeout&&clearTimeout(e.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),e.value}getByKey(r){const e=this.data[r];return e?e[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,e){if(!this.has(r))return this;const i=r.wrapped().key,s=e===void 0?0:this.data[i].indexOf(e),A=this.data[i][s];return this.data[i].splice(s,1),A.timeout&&clearTimeout(A.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(A.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(r){const e=[];for(const i in this.data)for(const s of this.data[i])r(s.value)||e.push(s);for(const i of e)this.remove(i.value.tileID,i)}},W.ay=function(r,e){let i=0,s=0;if(r.kind==="constant")s=r.layoutSize;else if(r.kind!=="source"){const{interpolationType:A,minZoom:d,maxZoom:_}=r,b=A?Ai(xr.interpolationFactor(A,e,d,_),0,1):0;r.kind==="camera"?s=ir.number(r.minSize,r.maxSize,b):i=b}return{uSizeT:i,uSize:s}},W.b=Dn,W.b$=zl,W.b0=Vs,W.b1=function(r){var e=new zi(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e},W.b2=function(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],r},W.b3=function(r,e){var i=e[0],s=e[1],A=e[2],d=i*i+s*s+A*A;return d>0&&(d=1/Math.sqrt(d)),r[0]=e[0]*d,r[1]=e[1]*d,r[2]=e[2]*d,r},W.b4=cr,W.b5=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]},W.b6=function(r,e,i){return r[0]=e[0]*i[0],r[1]=e[1]*i[1],r[2]=e[2]*i[2],r[3]=e[3]*i[3],r},W.b7=En,W.b8=function(r,e,i){const s=e[0]*i[0]+e[1]*i[1]+e[2]*i[2];return s===0?null:(-(r[0]*i[0]+r[1]*i[1]+r[2]*i[2])-i[3])/s},W.b9=Sn,W.bA=function(r,e,i,s){return r[0]=e[0]+i[0]*s,r[1]=e[1]+i[1]*s,r[2]=e[2]+i[2]*s,r},W.bB=Jr,W.bC=function(r,e,i){var s=i[0],A=i[1],d=i[2],_=i[3],b=e[0],M=e[1],I=e[2],k=A*I-d*M,F=d*b-s*I,V=s*M-A*b;return r[0]=b+_*(k+=k)+A*(V+=V)-d*(F+=F),r[1]=M+_*F+d*k-s*V,r[2]=I+_*V+s*F-A*k,r},W.bD=function(r,e,i){const s=(function(M){var I=M[3],k=M[4],F=M[5],V=M[6],j=M[7],H=M[8];return M[0]*(H*k-F*j)+M[1]*(-H*I+F*V)+M[2]*(j*I-k*V)})([r[0],r[1],r[2],e[0],e[1],e[2],i[0],i[1],i[2]]);if(s===0)return null;const A=cr([],[e[0],e[1],e[2]],[i[0],i[1],i[2]]),d=cr([],[i[0],i[1],i[2]],[r[0],r[1],r[2]]),_=cr([],[r[0],r[1],r[2]],[e[0],e[1],e[2]]),b=Cs([],A,-r[3]);return Vs(b,b,Cs([],d,-e[3])),Vs(b,b,Cs([],_,-i[3])),Cs(b,b,1/s),b},W.bE=tA,W.bF=function(){return new Float64Array(4)},W.bG=function(r,e,i,s){var A=[],d=[];return A[0]=e[0]-i[0],A[1]=e[1]-i[1],A[2]=e[2]-i[2],d[0]=A[0]*Math.cos(s)-A[1]*Math.sin(s),d[1]=A[0]*Math.sin(s)+A[1]*Math.cos(s),d[2]=A[2],r[0]=d[0]+i[0],r[1]=d[1]+i[1],r[2]=d[2]+i[2],r},W.bH=function(r,e,i,s){var A=[],d=[];return A[0]=e[0]-i[0],A[1]=e[1]-i[1],A[2]=e[2]-i[2],d[0]=A[0],d[1]=A[1]*Math.cos(s)-A[2]*Math.sin(s),d[2]=A[1]*Math.sin(s)+A[2]*Math.cos(s),r[0]=d[0]+i[0],r[1]=d[1]+i[1],r[2]=d[2]+i[2],r},W.bI=function(r,e,i,s){var A=[],d=[];return A[0]=e[0]-i[0],A[1]=e[1]-i[1],A[2]=e[2]-i[2],d[0]=A[2]*Math.sin(s)+A[0]*Math.cos(s),d[1]=A[1],d[2]=A[2]*Math.cos(s)-A[0]*Math.sin(s),r[0]=d[0]+i[0],r[1]=d[1]+i[1],r[2]=d[2]+i[2],r},W.bJ=function(r,e,i){var s=Math.sin(i),A=Math.cos(i),d=e[0],_=e[1],b=e[2],M=e[3],I=e[8],k=e[9],F=e[10],V=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=d*A-I*s,r[1]=_*A-k*s,r[2]=b*A-F*s,r[3]=M*A-V*s,r[8]=d*s+I*A,r[9]=_*s+k*A,r[10]=b*s+F*A,r[11]=M*s+V*A,r},W.bK=function(r,e){const i=Ni(r,360),s=Ni(e,360),A=s-i,d=s>i?A-360:A+360;return Math.abs(A)<Math.abs(d)?A:d},W.bL=function(r){return r[0]=0,r[1]=0,r[2]=0,r},W.bM=function(r,e,i,s){const A=Math.sqrt(r*r+e*e),d=Math.sqrt(i*i+s*s);r/=A,e/=A,i/=d,s/=d;const _=Math.acos(r*i+e*s);return-e*i+r*s>0?_:-_},W.bN=function(r,e){const i=Ni(r,2*Math.PI),s=Ni(e,2*Math.PI);return Math.min(Math.abs(i-s),Math.abs(i-s+2*Math.PI),Math.abs(i-s-2*Math.PI))},W.bO=function(){const r={},e=qe.$version;for(const i in qe.$root){const s=qe.$root[i];if(s.required){let A=null;A=i==="version"?e:s.type==="array"?[]:{},A!=null&&(r[i]=A)}}return r},W.bP=Qe,W.bQ=g,W.bR=function r(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let s=0;s<e.length;s++)if(!r(e[s],i[s]))return!1;return!0}if(typeof e=="object"&&e!==null&&i!==null){if(typeof i!="object"||Object.keys(e).length!==Object.keys(i).length)return!1;for(const s in e)if(!r(e[s],i[s]))return!1;return!0}return e===i},W.bS=function(r){r=r.slice();const e=Object.create(null);for(let i=0;i<r.length;i++)e[r[i].id]=r[i];for(let i=0;i<r.length;i++)"ref"in r[i]&&(r[i]=rn(r[i],e[r[i].ref]));return r},W.bT=function(r,e){if(r.type==="custom")return new H0(r,e);switch(r.type){case"background":return new q0(r,e);case"circle":return new Cp(r,e);case"color-relief":return new Bp(r,e);case"fill":return new Yp(r,e);case"fill-extrusion":return new l0(r,e);case"heatmap":return new Dp(r,e);case"hillshade":return new zp(r,e);case"line":return new p0(r,e);case"raster":return new Ic(r,e);case"symbol":return new uc(r,e)}},W.bU=r=>r.type==="raster",W.bV=In,W.bW=function(r,e){if(!r)return[{command:"setStyle",args:[e]}];let i=[];try{if(!Kt(r.version,e.version))return[{command:"setStyle",args:[e]}];Kt(r.center,e.center)||i.push({command:"setCenter",args:[e.center]}),Kt(r.state,e.state)||i.push({command:"setGlobalState",args:[e.state]}),Kt(r.centerAltitude,e.centerAltitude)||i.push({command:"setCenterAltitude",args:[e.centerAltitude]}),Kt(r.zoom,e.zoom)||i.push({command:"setZoom",args:[e.zoom]}),Kt(r.bearing,e.bearing)||i.push({command:"setBearing",args:[e.bearing]}),Kt(r.pitch,e.pitch)||i.push({command:"setPitch",args:[e.pitch]}),Kt(r.roll,e.roll)||i.push({command:"setRoll",args:[e.roll]}),Kt(r.sprite,e.sprite)||i.push({command:"setSprite",args:[e.sprite]}),Kt(r.glyphs,e.glyphs)||i.push({command:"setGlyphs",args:[e.glyphs]}),Kt(r.transition,e.transition)||i.push({command:"setTransition",args:[e.transition]}),Kt(r.light,e.light)||i.push({command:"setLight",args:[e.light]}),Kt(r.terrain,e.terrain)||i.push({command:"setTerrain",args:[e.terrain]}),Kt(r.sky,e.sky)||i.push({command:"setSky",args:[e.sky]}),Kt(r.projection,e.projection)||i.push({command:"setProjection",args:[e.projection]});const s={},A=[];(function(_,b,M,I){let k;for(k in b=b||{},_=_||{})Object.prototype.hasOwnProperty.call(_,k)&&(Object.prototype.hasOwnProperty.call(b,k)||Wi(k,M,I));for(k in b)Object.prototype.hasOwnProperty.call(b,k)&&(Object.prototype.hasOwnProperty.call(_,k)?Kt(_[k],b[k])||(_[k].type==="geojson"&&b[k].type==="geojson"&&Ve(_,b,k)?qi(M,{command:"setGeoJSONSourceData",args:[k,b[k].data]}):er(k,b,M,I)):Vr(k,b,M))})(r.sources,e.sources,A,s);const d=[];r.layers&&r.layers.forEach((_=>{"source"in _&&s[_.source]?i.push({command:"removeLayer",args:[_.id]}):d.push(_)})),i=i.concat(A),(function(_,b,M){b=b||[];const I=(_=_||[]).map(It),k=b.map(It),F=_.reduce(At,{}),V=b.reduce(At,{}),j=I.slice(),H=Object.create(null);let Q,Y,re,ge,oe;for(let ue=0,ve=0;ue<I.length;ue++)Q=I[ue],Object.prototype.hasOwnProperty.call(V,Q)?ve++:(qi(M,{command:"removeLayer",args:[Q]}),j.splice(j.indexOf(Q,ve),1));for(let ue=0,ve=0;ue<k.length;ue++)Q=k[k.length-1-ue],j[j.length-1-ue]!==Q&&(Object.prototype.hasOwnProperty.call(F,Q)?(qi(M,{command:"removeLayer",args:[Q]}),j.splice(j.lastIndexOf(Q,j.length-ve),1)):ve++,ge=j[j.length-ue],qi(M,{command:"addLayer",args:[V[Q],ge]}),j.splice(j.length-ue,0,Q),H[Q]=!0);for(let ue=0;ue<k.length;ue++)if(Q=k[ue],Y=F[Q],re=V[Q],!H[Q]&&!Kt(Y,re))if(Kt(Y.source,re.source)&&Kt(Y["source-layer"],re["source-layer"])&&Kt(Y.type,re.type)){for(oe in at(Y.layout,re.layout,M,Q,null,"setLayoutProperty"),at(Y.paint,re.paint,M,Q,null,"setPaintProperty"),Kt(Y.filter,re.filter)||qi(M,{command:"setFilter",args:[Q,re.filter]}),Kt(Y.minzoom,re.minzoom)&&Kt(Y.maxzoom,re.maxzoom)||qi(M,{command:"setLayerZoomRange",args:[Q,re.minzoom,re.maxzoom]}),Y)Object.prototype.hasOwnProperty.call(Y,oe)&&oe!=="layout"&&oe!=="paint"&&oe!=="filter"&&oe!=="metadata"&&oe!=="minzoom"&&oe!=="maxzoom"&&(oe.indexOf("paint.")===0?at(Y[oe],re[oe],M,Q,oe.slice(6),"setPaintProperty"):Kt(Y[oe],re[oe])||qi(M,{command:"setLayerProperty",args:[Q,oe,re[oe]]}));for(oe in re)Object.prototype.hasOwnProperty.call(re,oe)&&!Object.prototype.hasOwnProperty.call(Y,oe)&&oe!=="layout"&&oe!=="paint"&&oe!=="filter"&&oe!=="metadata"&&oe!=="minzoom"&&oe!=="maxzoom"&&(oe.indexOf("paint.")===0?at(Y[oe],re[oe],M,Q,oe.slice(6),"setPaintProperty"):Kt(Y[oe],re[oe])||qi(M,{command:"setLayerProperty",args:[Q,oe,re[oe]]}))}else qi(M,{command:"removeLayer",args:[Q]}),ge=j[j.lastIndexOf(Q)+1],qi(M,{command:"addLayer",args:[re,ge]})})(d,e.layers,i)}catch(s){console.warn("Unable to compute style diff:",s),i=[{command:"setStyle",args:[e]}]}return i},W.bX=function(r){const e=[],i=r.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},W.bY=us,W.bZ=No,W.b_=class extends eo{constructor(r,e){super(r,e),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},W.ba=function(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[3]=e[3]*i,r},W.bb=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]},W.bc=Vf,W.bd=ih,W.be=function(r,e,i,s,A){var d=1/Math.tan(e/2);if(r[0]=d/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=d,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,A!=null&&A!==1/0){var _=1/(s-A);r[10]=(A+s)*_,r[14]=2*A*s*_}else r[10]=-1,r[14]=-2*s;return r},W.bf=function(r){var e=new zi(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e},W.bg=function(r,e,i){var s=Math.sin(i),A=Math.cos(i),d=e[0],_=e[1],b=e[2],M=e[3],I=e[4],k=e[5],F=e[6],V=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=d*A+I*s,r[1]=_*A+k*s,r[2]=b*A+F*s,r[3]=M*A+V*s,r[4]=I*A-d*s,r[5]=k*A-_*s,r[6]=F*A-b*s,r[7]=V*A-M*s,r},W.bh=function(r,e,i){var s=Math.sin(i),A=Math.cos(i),d=e[4],_=e[5],b=e[6],M=e[7],I=e[8],k=e[9],F=e[10],V=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=d*A+I*s,r[5]=_*A+k*s,r[6]=b*A+F*s,r[7]=M*A+V*s,r[8]=I*A-d*s,r[9]=k*A-_*s,r[10]=F*A-b*s,r[11]=V*A-M*s,r},W.bi=function(){const r=new Float32Array(16);return no(r),r},W.bj=function(){const r=new Float64Array(16);return no(r),r},W.bk=function(){return new Float64Array(16)},W.bl=function(r,e,i){const s=new Float64Array(4);return Jr(s,r,e-90,i),s},W.bm=function(r,e,i,s){var A,d,_,b,M,I=e[0],k=e[1],F=e[2],V=e[3],j=i[0],H=i[1],Q=i[2],Y=i[3];return(d=I*j+k*H+F*Q+V*Y)<0&&(d=-d,j=-j,H=-H,Q=-Q,Y=-Y),1-d>hr?(A=Math.acos(d),_=Math.sin(A),b=Math.sin((1-s)*A)/_,M=Math.sin(s*A)/_):(b=1-s,M=s),r[0]=b*I+M*j,r[1]=b*k+M*H,r[2]=b*F+M*Q,r[3]=b*V+M*Y,r},W.bn=function(r){const e=new Float64Array(9);(function(d,_){var b=_[0],M=_[1],I=_[2],k=_[3],F=b+b,V=M+M,j=I+I,H=b*F,Q=M*F,Y=M*V,re=I*F,ge=I*V,oe=I*j,ue=k*F,ve=k*V,Te=k*j;d[0]=1-Y-oe,d[3]=Q-Te,d[6]=re+ve,d[1]=Q+Te,d[4]=1-H-oe,d[7]=ge-ue,d[2]=re-ve,d[5]=ge+ue,d[8]=1-H-Y})(e,r);const i=mn(-Math.asin(Ai(e[2],-1,1)));let s,A;return Math.hypot(e[5],e[8])<.001?(s=0,A=-mn(Math.atan2(e[3],e[4]))):(s=mn(e[5]===0&&e[8]===0?0:Math.atan2(e[5],e[8])),A=mn(e[1]===0&&e[0]===0?0:Math.atan2(e[1],e[0]))),{roll:s,pitch:i+90,bearing:A}},W.bo=function(r,e){return r.roll==e.roll&&r.pitch==e.pitch&&r.bearing==e.bearing},W.bp=oi,W.bq=kl,W.br=Ku,W.bs=Ch,W.bt=Xu,W.bu=Mr,W.bv=Wr,W.bw=Lr,W.bx=function(r,e,i,s,A){return Mr(s,A,Ai((r-e)/(i-e),0,1))},W.by=Ni,W.bz=function(){return new Float64Array(3)},W.c=Se,W.c$=function(r,e,i,s,A){return p(this,void 0,void 0,(function*(){if(Fo())try{return yield Zo(r,e,i,s,A)}catch{}return(function(d,_,b,M,I){const k=d.width,F=d.height;tn&&Gn||(tn=new OffscreenCanvas(k,F),Gn=tn.getContext("2d",{willReadFrequently:!0})),tn.width=k,tn.height=F,Gn.drawImage(d,0,0,k,F);const V=Gn.getImageData(_,b,M,I);return Gn.clearRect(0,0,k,F),V.data})(r,e,i,s,A)}))},W.c0=class extends eo{constructor(r,e){super(r,e),this.current=zo}set(r){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 e=1;e<16;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},W.c1=Mu,W.c2=class extends eo{constructor(r,e){super(r,e),this.current=[0,0,0]}set(r){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]))}},W.c3=class extends eo{constructor(r,e){super(r,e),this.current=[0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1]))}},W.c4=ro,W.c5=function(r,e){var i=Math.sin(e),s=Math.cos(e);return r[0]=s,r[1]=i,r[2]=0,r[3]=-i,r[4]=s,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},W.c6=function(r,e,i){var s=e[0],A=e[1],d=e[2];return r[0]=s*i[0]+A*i[3]+d*i[6],r[1]=s*i[1]+A*i[4]+d*i[7],r[2]=s*i[2]+A*i[5]+d*i[8],r},W.c7=function(r,e,i,s,A,d,_){var b=1/(e-i),M=1/(s-A),I=1/(d-_);return r[0]=-2*b,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*M,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*I,r[11]=0,r[12]=(e+i)*b,r[13]=(A+s)*M,r[14]=(_+d)*I,r[15]=1,r},W.c8=class extends eo{constructor(r,e){super(r,e),this.current=new Array}set(r){if(r!=this.current){this.current=r;const e=new Float32Array(4*r.length);for(let i=0;i<r.length;i++)e[4*i]=r[i].r,e[4*i+1]=r[i].g,e[4*i+2]=r[i].b,e[4*i+3]=r[i].a;this.gl.uniform4fv(this.location,e)}}},W.c9=class extends eo{constructor(r,e){super(r,e),this.current=new Array}set(r){if(r!=this.current){this.current=r;const e=new Float32Array(r);this.gl.uniform1fv(this.location,e)}}},W.cA=function(r,e){return Ne[e]&&"touches"in r},W.cB=function(r){return Ne[r]||ee[r]},W.cC=function(r,e,i){var s=e[0],A=e[1];return r[0]=i[0]*s+i[4]*A+i[12],r[1]=i[1]*s+i[5]*A+i[13],r},W.cD=function(r,e){const{x:i,y:s}=Bh.fromLngLat(e);return!(r<0||r>25||s<0||s>=1||i<0||i>=1)},W.cE=function(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},W.cF=class extends Vu{},W.cG=km,W.cI=ke,W.cJ=function(r,e){Se.REGISTERED_PROTOCOLS[r]=e},W.cK=function(r){delete Se.REGISTERED_PROTOCOLS[r]},W.cL=function(r,e){const i={};for(let A=0;A<r.length;A++){const d=e&&e[r[A].id]||Yl(r[A]);e&&(e[r[A].id]=d);let _=i[d];_||(_=i[d]=[]),_.push(r[A])}const s=[];for(const A in i)s.push(i[A]);return s},W.cM=kt,W.cN=Zf,W.cO=vd,W.cP=wf,W.cQ=function(r){r.bucket.createArrays(),r.bucket.tilePixelRatio=Oi/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const e=r.bucket.layers[0],i=e.layout,s=e._unevaluatedLayout._values,A={layoutIconSize:s["icon-size"].possiblyEvaluate(new ze(r.bucket.zoom+1),r.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new ze(r.bucket.zoom+1),r.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new ze(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:I,maxZoom:k}=r.bucket.textSizeData;A.compositeTextSizes=[s["text-size"].possiblyEvaluate(new ze(I),r.canonical),s["text-size"].possiblyEvaluate(new ze(k),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:I,maxZoom:k}=r.bucket.iconSizeData;A.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new ze(I),r.canonical),s["icon-size"].possiblyEvaluate(new ze(k),r.canonical)]}const d=i.get("text-line-height")*ns,_=i.get("text-rotation-alignment")!=="viewport"&&i.get("symbol-placement")!=="point",b=i.get("text-keep-upright"),M=i.get("text-size");for(const I of r.bucket.features){const k=i.get("text-font").evaluate(I,{},r.canonical).join(","),F=M.evaluate(I,{},r.canonical),V=A.layoutTextSize.evaluate(I,{},r.canonical),j=A.layoutIconSize.evaluate(I,{},r.canonical),H={horizontal:{},vertical:void 0},Q=I.text;let Y,re=[0,0];if(Q){const ue=Q.toString(),ve=i.get("text-letter-spacing").evaluate(I,{},r.canonical)*ns,Te=O(ue)?ve:0,Ue=i.get("text-anchor").evaluate(I,{},r.canonical),lt=zd(e,I,r.canonical);if(!lt){const mt=i.get("text-radial-offset").evaluate(I,{},r.canonical);re=mt?kd(Ue,[mt*ns,vA]):i.get("text-offset").evaluate(I,{},r.canonical).map((st=>st*ns))}let nt=_?"center":i.get("text-justify").evaluate(I,{},r.canonical);const dt=i.get("symbol-placement")==="point"?i.get("text-max-width").evaluate(I,{},r.canonical)*ns:1/0,Tt=()=>{r.bucket.allowVerticalPlacement&&z(ue)&&(H.vertical=ac(Q,r.glyphMap,r.glyphPositions,r.imagePositions,k,dt,d,Ue,"left",Te,re,W.az.vertical,!0,V,F))};if(!_&&lt){const mt=new Set;if(nt==="auto")for(let Xe=0;Xe<lt.values.length;Xe+=2)mt.add(xA(lt.values[Xe]));else mt.add(nt);let st=!1;for(const Xe of mt)if(!H.horizontal[Xe])if(st)H.horizontal[Xe]=H.horizontal[0];else{const Lt=ac(Q,r.glyphMap,r.glyphPositions,r.imagePositions,k,dt,d,"center",Xe,Te,re,W.az.horizontal,!1,V,F);Lt&&(H.horizontal[Xe]=Lt,st=Lt.positionedLines.length===1)}Tt()}else{nt==="auto"&&(nt=xA(Ue));const mt=ac(Q,r.glyphMap,r.glyphPositions,r.imagePositions,k,dt,d,Ue,nt,Te,re,W.az.horizontal,!1,V,F);mt&&(H.horizontal[nt]=mt),Tt(),z(ue)&&_&&b&&(H.vertical=ac(Q,r.glyphMap,r.glyphPositions,r.imagePositions,k,dt,d,Ue,nt,Te,re,W.az.vertical,!1,V,F))}}let ge=!1;if(I.icon&&I.icon.name){const ue=r.imageMap[I.icon.name];ue&&(Y=j0(r.imagePositions[I.icon.name],i.get("icon-offset").evaluate(I,{},r.canonical),i.get("icon-anchor").evaluate(I,{},r.canonical)),ge=!!ue.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=ge:r.bucket.sdfIcons!==ge&&en("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ue.pixelRatio!==r.bucket.pixelRatio||i.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}const oe=Bd(H.horizontal)||H.vertical;r.bucket.iconsInText=!!oe&&oe.iconsInText,(oe||Y)&&Im(r.bucket,I,H,Y,r.imageMap,A,V,j,re,ge,r.canonical,r.subdivisionGranularity)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},W.cR=Uc,W.cS=qc,W.cT=Hc,W.cU=function(r){const e=new oc;return(function(i,s){for(const A in i.layers)s.writeMessage(3,mm,i.layers[A])})(r,e),e.finish()},W.cV=function(r,e,i,s,A,d){let _=wd(r,e,i,A,0);return _=wd(_,e,s,d,1),_},W.cW=class{constructor(r){this.maxEntries=r,this.map=new Map}get(r){const e=this.map.get(r);return e!==void 0&&(this.map.delete(r),this.map.set(r,e)),e}set(r,e){if(this.map.has(r))this.map.delete(r);else if(this.map.size>=this.maxEntries){const i=this.map.keys().next().value;this.map.delete(i)}this.map.set(r,e)}clear(){this.map.clear()}},W.cX=sf,W.cY=oc,W.cZ=gd,W.c_=class{constructor(r){this._marks={start:[r.url,"start"].join("#"),end:[r.url,"end"].join("#"),measure:r.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let r=performance.getEntriesByName(this._marks.measure);return r.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),r=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),r}},W.ca=class extends Il{},W.cb=y0,W.cc=class extends Pu{},W.cd=Oc,W.ce=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},W.cf=UA,W.cg=function(r,e,i){var s=e[0],A=e[1],d=e[2],_=i[3]*s+i[7]*A+i[11]*d+i[15];return r[0]=(i[0]*s+i[4]*A+i[8]*d+i[12])/(_=_||1),r[1]=(i[1]*s+i[5]*A+i[9]*d+i[13])/_,r[2]=(i[2]*s+i[6]*A+i[10]*d+i[14])/_,r},W.ch=class extends ph{},W.ci=class extends t{},W.cj=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]&&r[9]===e[9]&&r[10]===e[10]&&r[11]===e[11]&&r[12]===e[12]&&r[13]===e[13]&&r[14]===e[14]&&r[15]===e[15]},W.ck=function(r,e){var i=r[0],s=r[1],A=r[2],d=r[3],_=r[4],b=r[5],M=r[6],I=r[7],k=r[8],F=r[9],V=r[10],j=r[11],H=r[12],Q=r[13],Y=r[14],re=r[15],ge=e[0],oe=e[1],ue=e[2],ve=e[3],Te=e[4],Ue=e[5],lt=e[6],nt=e[7],dt=e[8],Tt=e[9],mt=e[10],st=e[11],Xe=e[12],Lt=e[13],Ct=e[14],Ot=e[15];return Math.abs(i-ge)<=hr*Math.max(1,Math.abs(i),Math.abs(ge))&&Math.abs(s-oe)<=hr*Math.max(1,Math.abs(s),Math.abs(oe))&&Math.abs(A-ue)<=hr*Math.max(1,Math.abs(A),Math.abs(ue))&&Math.abs(d-ve)<=hr*Math.max(1,Math.abs(d),Math.abs(ve))&&Math.abs(_-Te)<=hr*Math.max(1,Math.abs(_),Math.abs(Te))&&Math.abs(b-Ue)<=hr*Math.max(1,Math.abs(b),Math.abs(Ue))&&Math.abs(M-lt)<=hr*Math.max(1,Math.abs(M),Math.abs(lt))&&Math.abs(I-nt)<=hr*Math.max(1,Math.abs(I),Math.abs(nt))&&Math.abs(k-dt)<=hr*Math.max(1,Math.abs(k),Math.abs(dt))&&Math.abs(F-Tt)<=hr*Math.max(1,Math.abs(F),Math.abs(Tt))&&Math.abs(V-mt)<=hr*Math.max(1,Math.abs(V),Math.abs(mt))&&Math.abs(j-st)<=hr*Math.max(1,Math.abs(j),Math.abs(st))&&Math.abs(H-Xe)<=hr*Math.max(1,Math.abs(H),Math.abs(Xe))&&Math.abs(Q-Lt)<=hr*Math.max(1,Math.abs(Q),Math.abs(Lt))&&Math.abs(Y-Ct)<=hr*Math.max(1,Math.abs(Y),Math.abs(Ct))&&Math.abs(re-Ot)<=hr*Math.max(1,Math.abs(re),Math.abs(Ot))},W.cl=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},W.cm=r=>r.type==="symbol",W.cn=r=>r.type==="circle",W.co=r=>r.type==="heatmap",W.cp=r=>r.type==="line",W.cq=r=>r.type==="fill",W.cr=r=>r.type==="fill-extrusion",W.cs=r=>r.type==="hillshade",W.ct=r=>r.type==="color-relief",W.cu=r=>r.type==="background",W.cv=r=>r.type==="custom",W.cw=or,W.cx=function(r,e,i){const s=ti(e.x-i.x,e.y-i.y),A=ti(r.x-i.x,r.y-i.y),d=Math.atan2(s[0]*A[1]-s[1]*A[0],(function(_,b){return _[0]*b[0]+_[1]*b[1]})(s,A));return mn(d)},W.cy=xi,W.cz=function(r,e){return ee[e]&&(r instanceof MouseEvent||r instanceof WheelEvent)},W.d=ot,W.d0=HA,W.d1=ur,W.d2=class{constructor(r,e){this.layers={[Oh]:this},this.name=Oh,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=r.length,this.features=r}feature(r){return new pm(this.features[r],this.extent)}},W.d3=u,W.d4=Oe,W.e=Er,W.f=r=>p(void 0,void 0,void 0,(function*(){if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(e)}catch(i){throw new Error(`Could not load image because of ${i.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),W.g=Ge,W.h=r=>new Promise(((e,i)=>{const s=new Image;s.onload=()=>{e(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame((()=>{s.src=jo}))},s.onerror=()=>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."));const A=new Blob([new Uint8Array(r)],{type:"image/png"});s.src=r.byteLength?URL.createObjectURL(A):jo})),W.i=Is,W.j=(r,e)=>ft(Er(r,{type:"json"}),e),W.k=Gi,W.l=Xt,W.m=ft,W.n=(r,e)=>ft(Er(r,{type:"arrayBuffer"}),e),W.o=function(r){return new oc(r).readFields(z0,[])},W.p=bf,W.q=function(r){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(r))},W.r=Th,W.s=vo,W.t=is,W.u=qe,W.v=hl,W.w=en,W.x=ai,W.y=yt,W.z=bt})),We("worker",["./shared"],(function(W){class p{constructor(ee,K){this.keyCache={},ee&&this.replace(ee,K)}replace(ee,K){this._layerConfigs={},this._layers={},this.update(ee,[],K)}update(ee,K,le){for(const Se of ee){this._layerConfigs[Se.id]=Se;const Ge=this._layers[Se.id]=W.bT(Se,le);Ge._featureFilter=W.aj(Ge.filter,le),this.keyCache[Se.id]&&delete this.keyCache[Se.id]}for(const Se of K)delete this.keyCache[Se],delete this._layerConfigs[Se],delete this._layers[Se];this.familiesBySource={};const Me=W.cL(Object.values(this._layerConfigs),this.keyCache);for(const Se of Me){const Ge=Se.map((St=>this._layers[St.id])),Fe=Ge[0];if(Fe.isHidden())continue;const ke=Fe.source||"";let Qe=this.familiesBySource[ke];Qe||(Qe=this.familiesBySource[ke]={});const ft=Fe.sourceLayer||W.ai;let ot=Qe[ft];ot||(ot=Qe[ft]=[]),ot.push(Ge)}}}class it{constructor(ee){const K={},le=[];for(const Fe in ee){const ke=ee[Fe],Qe=K[Fe]={};for(const ft in ke){const ot=ke[+ft];if(!ot||ot.bitmap.width===0||ot.bitmap.height===0)continue;const St={x:0,y:0,w:ot.bitmap.width+2,h:ot.bitmap.height+2};le.push(St),Qe[ft]={rect:St,metrics:ot.metrics}}}const{w:Me,h:Se}=W.p(le),Ge=new W.r({width:Me||1,height:Se||1});for(const Fe in ee){const ke=ee[Fe];for(const Qe in ke){const ft=ke[+Qe];if(!ft||ft.bitmap.width===0||ft.bitmap.height===0)continue;const ot=K[Fe][Qe].rect;W.r.copy(ft.bitmap,Ge,{x:0,y:0},{x:ot.x+1,y:ot.y+1},ft.bitmap)}}this.image=Ge,this.positions=K}}W.cM("GlyphAtlas",it);class ur{constructor(ee){this.tileID=new W.a2(ee.tileID.overscaledZ,ee.tileID.wrap,ee.tileID.canonical.z,ee.tileID.canonical.x,ee.tileID.canonical.y),this.uid=ee.uid,this.zoom=ee.zoom,this.pixelRatio=ee.pixelRatio,this.tileSize=ee.tileSize,this.source=ee.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=ee.showCollisionBoxes,this.collectResourceTiming=!!ee.collectResourceTiming,this.returnDependencies=!!ee.returnDependencies,this.promoteId=ee.promoteId,this.inFlightDependencies=[]}parse(ee,K,le,Me,Se){return W._(this,void 0,void 0,(function*(){this.status="parsing",this.data=ee,this.collisionBoxArray=new W.ag;const Ge=new W.cN(Object.keys(ee.layers).sort()),Fe=new W.cO(this.tileID,this.promoteId);Fe.bucketLayerIDs=[];const ke={},Qe={featureIndex:Fe,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:le,subdivisionGranularity:Se},ft=K.familiesBySource[this.source];for(const Ve in ft){const at=ee.layers[Ve];if(!at)continue;at.version===1&&W.w(`Vector tile source "${this.source}" layer "${Ve}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const It=Ge.encode(Ve),At=[];for(let o=0;o<at.length;o++){const X=at.feature(o),ii=Fe.getId(X,Ve);At.push({feature:X,id:ii,index:o,sourceLayerIndex:It})}for(const o of ft[Ve]){const X=o[0];X.source!==this.source&&W.w(`layer.source = ${X.source} does not equal this.source = ${this.source}`),X.isHidden(this.zoom,!0)||(fr(o,this.zoom,le),(ke[X.id]=X.createBucket({index:Fe.bucketLayerIDs.length,layers:o,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:It,sourceID:this.source})).populate(At,Qe,this.tileID.canonical),Fe.bucketLayerIDs.push(o.map((ii=>ii.id))))}}const ot=W.bY(Qe.glyphDependencies,(Ve=>Object.keys(Ve).map(Number)));this.inFlightDependencies.forEach((Ve=>Ve==null?void 0:Ve.abort())),this.inFlightDependencies=[];let St=Promise.resolve({});if(Object.keys(ot).length){const Ve=new AbortController;this.inFlightDependencies.push(Ve),St=Me.sendAsync({type:"GG",data:{stacks:ot,source:this.source,tileID:this.tileID,type:"glyphs"}},Ve)}const je=Object.keys(Qe.iconDependencies);let Xt=Promise.resolve({});if(je.length){const Ve=new AbortController;this.inFlightDependencies.push(Ve),Xt=Me.sendAsync({type:"GI",data:{icons:je,source:this.source,tileID:this.tileID,type:"icons"}},Ve)}const Gi=Object.keys(Qe.patternDependencies);let Bi=Promise.resolve({});if(Gi.length){const Ve=new AbortController;this.inFlightDependencies.push(Ve),Bi=Me.sendAsync({type:"GI",data:{icons:Gi,source:this.source,tileID:this.tileID,type:"patterns"}},Ve)}const qe=Qe.dashDependencies;let Hi=Promise.resolve({});if(Object.keys(qe).length){const Ve=new AbortController;this.inFlightDependencies.push(Ve),Hi=Me.sendAsync({type:"GDA",data:{dashes:qe}},Ve)}const[rn,Kt,qi,Vr]=yield Promise.all([St,Xt,Bi,Hi]),Wi=new it(rn),er=new W.cP(Kt,qi);for(const Ve in ke){const at=ke[Ve];at instanceof W.ah?(fr(at.layers,this.zoom,le),W.cQ({bucket:at,glyphMap:rn,glyphPositions:Wi.positions,imageMap:Kt,imagePositions:er.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:Qe.subdivisionGranularity})):at.hasDependencies&&(at instanceof W.cR||at instanceof W.cS||at instanceof W.cT)&&(fr(at.layers,this.zoom,le),at.addFeatures(Qe,this.tileID.canonical,er.patternPositions,Vr))}return this.status="done",{buckets:Object.values(ke).filter((Ve=>!Ve.isEmpty())),featureIndex:Fe,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Wi.image,imageAtlas:er,dashPositions:Vr,glyphMap:this.returnDependencies?rn:null,iconMap:this.returnDependencies?Kt:null,glyphPositions:this.returnDependencies?Wi.positions:null}}))}}function fr(Ne,ee,K){const le=new W.H(ee);for(const Me of Ne)Me.recalculate(le,K)}class Zi{constructor(ee,K,le,Me,Se){this.type=ee,this.properties=le||{},this.extent=Se,this.pointsArray=K,this.id=Me}loadGeometry(){return this.pointsArray.map((ee=>ee.map((K=>new W.P(K.x,K.y)))))}}class un{constructor(ee,K,le){this.version=2,this._myFeatures=ee,this.name=K,this.length=ee.length,this.extent=le}feature(ee){return this._myFeatures[ee]}}class zr{constructor(){this.layers={}}addLayer(ee){this.layers[ee.name]=ee}}function Mn(Ne){let ee=W.cU(Ne);return ee.byteOffset===0&&ee.byteLength===ee.buffer.byteLength||(ee=new Uint8Array(ee)),{vectorTile:Ne,rawData:ee.buffer}}function Gt(Ne,ee,K){const{extent:le}=Ne,Me=Math.pow(2,K.z-ee.z),Se=(K.x-ee.x*Me)*le,Ge=(K.y-ee.y*Me)*le,Fe=[];for(let ke=0;ke<Ne.length;ke++){const Qe=Ne.feature(ke);let ft=Qe.loadGeometry();for(const St of ft)for(const je of St)je.x=je.x*Me-Se,je.y=je.y*Me-Ge;const ot=128;ft=W.cV(ft,Qe.type,-ot,-ot,le+ot,le+ot),ft.length!==0&&Fe.push(new Zi(Qe.type,ft,Qe.properties,Qe.id,le))}return new un(Fe,Ne.name,le)}class rt{constructor(ee,K,le){this.actor=ee,this.layerIndex=K,this.availableImages=le,this.fetching={},this.loading={},this.loaded={},this.overzoomedTileResultCache=new W.cW(1e3)}loadVectorTile(ee,K){return W._(this,void 0,void 0,(function*(){const le=yield W.n(ee.request,K);try{return{vectorTile:ee.encoding!=="mlt"?new W.cX(new W.cY(le.data)):new W.cZ(le.data),rawData:le.data,cacheControl:le.cacheControl,expires:le.expires}}catch(Me){const Se=new Uint8Array(le.data);let Ge=`Unable to parse the tile at ${ee.request.url}, `;throw Ge+=Se[0]===31&&Se[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${Me.message}`,new Error(Ge)}}))}loadTile(ee){return W._(this,void 0,void 0,(function*(){const{uid:K,overzoomParameters:le}=ee;le&&(ee.request=le.overzoomRequest);const Me=!!(ee&&ee.request&&ee.request.collectResourceTiming)&&new W.c_(ee.request),Se=new ur(ee);this.loading[K]=Se;const Ge=new AbortController;Se.abort=Ge;try{const Fe=yield this.loadVectorTile(ee,Ge);if(delete this.loading[K],!Fe)return null;if(le){const St=this._getOverzoomTile(ee,Fe.vectorTile);Fe.rawData=St.rawData,Fe.vectorTile=St.vectorTile}const ke=Fe.rawData,Qe={};Fe.expires&&(Qe.expires=Fe.expires),Fe.cacheControl&&(Qe.cacheControl=Fe.cacheControl);const ft={};if(Me){const St=Me.finish();St&&(ft.resourceTiming=JSON.parse(JSON.stringify(St)))}Se.vectorTile=Fe.vectorTile;const ot=Se.parse(Fe.vectorTile,this.layerIndex,this.availableImages,this.actor,ee.subdivisionGranularity);this.loaded[K]=Se,this.fetching[K]={rawTileData:ke,cacheControl:Qe,resourceTiming:ft};try{const St=yield ot;return W.e({rawTileData:ke.slice(0),encoding:ee.encoding},St,Qe,ft)}finally{delete this.fetching[K]}}catch(Fe){throw delete this.loading[K],Se.status="done",this.loaded[K]=Se,Fe}}))}_getOverzoomTile(ee,K){const{tileID:le,source:Me,overzoomParameters:Se}=ee,{maxZoomTileID:Ge}=Se,Fe=`${Ge.key}_${le.key}`,ke=this.overzoomedTileResultCache.get(Fe);if(ke)return ke;const Qe=new zr,ft=this.layerIndex.familiesBySource[Me];for(const St in ft){const je=K.layers[St];if(!je)continue;const Xt=Gt(je,Ge,le.canonical);Xt.length>0&&Qe.addLayer(Xt)}const ot=Mn(Qe);return this.overzoomedTileResultCache.set(Fe,ot),ot}reloadTile(ee){return W._(this,void 0,void 0,(function*(){const K=ee.uid;if(!this.loaded||!this.loaded[K])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const le=this.loaded[K];if(le.showCollisionBoxes=ee.showCollisionBoxes,le.status==="parsing"){const Me=yield le.parse(le.vectorTile,this.layerIndex,this.availableImages,this.actor,ee.subdivisionGranularity);let Se;if(this.fetching[K]){const{rawTileData:Ge,cacheControl:Fe,resourceTiming:ke}=this.fetching[K];delete this.fetching[K],Se=W.e({rawTileData:Ge.slice(0),encoding:ee.encoding},Me,Fe,ke)}else Se=Me;return Se}if(le.status==="done"&&le.vectorTile)return le.parse(le.vectorTile,this.layerIndex,this.availableImages,this.actor,ee.subdivisionGranularity)}))}abortTile(ee){return W._(this,void 0,void 0,(function*(){const K=this.loading,le=ee.uid;K&&K[le]&&K[le].abort&&(K[le].abort.abort(),delete K[le])}))}removeTile(ee){return W._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[ee.uid]&&delete this.loaded[ee.uid]}))}}class Fo{constructor(){this.loaded={}}loadTile(ee){return W._(this,void 0,void 0,(function*(){const{uid:K,encoding:le,rawImageData:Me,redFactor:Se,greenFactor:Ge,blueFactor:Fe,baseShift:ke}=ee,Qe=Me.width+2,ft=Me.height+2,ot=W.b(Me)?new W.R({width:Qe,height:ft},yield W.c$(Me,-1,-1,Qe,ft)):Me,St=new W.d0(K,ot,le,Se,Ge,Fe,ke);return this.loaded=this.loaded||{},this.loaded[K]=St,St}))}removeTile(ee){const K=this.loaded,le=ee.uid;K&&K[le]&&delete K[le]}}var hr,zi,ro=(function(){if(zi)return hr;function Ne(K,le){if(K.length!==0){ee(K[0],le);for(var Me=1;Me<K.length;Me++)ee(K[Me],!le)}}function ee(K,le){for(var Me=0,Se=0,Ge=0,Fe=K.length,ke=Fe-1;Ge<Fe;ke=Ge++){var Qe=(K[Ge][0]-K[ke][0])*(K[ke][1]+K[Ge][1]),ft=Me+Qe;Se+=Math.abs(Me)>=Math.abs(Qe)?Me-ft+Qe:Qe-ft+Me,Me=ft}Me+Se>=0!=!!le&&K.reverse()}return zi=1,hr=function K(le,Me){var Se,Ge=le&&le.type;if(Ge==="FeatureCollection")for(Se=0;Se<le.features.length;Se++)K(le.features[Se],Me);else if(Ge==="GeometryCollection")for(Se=0;Se<le.geometries.length;Se++)K(le.geometries[Se],Me);else if(Ge==="Feature")K(le.geometry,Me);else if(Ge==="Polygon")Ne(le.coordinates,Me);else if(Ge==="MultiPolygon")for(Se=0;Se<le.coordinates.length;Se++)Ne(le.coordinates[Se],Me);return le}})(),no=W.d1(ro);const Ns={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:Ne=>Ne},En=Math.fround||(Oo=new Float32Array(1),Ne=>(Oo[0]=+Ne,Oo[0]));var Oo;class Vs{constructor(ee){this.options=Object.assign(Object.create(Ns),ee),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(ee){const{log:K,minZoom:le,maxZoom:Me}=this.options;K&&console.time("total time");const Se=`prepare ${ee.length} points`;K&&console.time(Se),this.points=ee;const Ge=[];for(let ke=0;ke<ee.length;ke++){const Qe=ee[ke];if(!Qe.geometry)continue;const[ft,ot]=Qe.geometry.coordinates,St=En(Ji(ft)),je=En(Sn(ot));Ge.push(St,je,1/0,ke,-1,1),this.options.reduce&&Ge.push(0)}let Fe=this.trees[Me+1]=this._createTree(Ge);K&&console.timeEnd(Se);for(let ke=Me;ke>=le;ke--){const Qe=+Date.now();Fe=this.trees[ke]=this._createTree(this._cluster(Fe,ke)),K&&console.log("z%d: %d clusters in %dms",ke,Fe.numItems,+Date.now()-Qe)}return K&&console.timeEnd("total time"),this}getClusters(ee,K){let le=((ee[0]+180)%360+360)%360-180;const Me=Math.max(-90,Math.min(90,ee[1]));let Se=ee[2]===180?180:((ee[2]+180)%360+360)%360-180;const Ge=Math.max(-90,Math.min(90,ee[3]));if(ee[2]-ee[0]>=360)le=-180,Se=180;else if(le>Se){const ot=this.getClusters([le,Me,180,Ge],K),St=this.getClusters([-180,Me,Se,Ge],K);return ot.concat(St)}const Fe=this.trees[this._limitZoom(K)],ke=Fe.range(Ji(le),Sn(Ge),Ji(Se),Sn(Me)),Qe=Fe.data,ft=[];for(const ot of ke){const St=this.stride*ot;ft.push(Qe[St+5]>1?Cs(Qe,St,this.clusterProps):this.points[Qe[St+3]])}return ft}getChildren(ee){const K=this._getOriginId(ee),le=this._getOriginZoom(ee),Me="No cluster with the specified id.",Se=this.trees[le];if(!Se)throw new Error(Me);const Ge=Se.data;if(K*this.stride>=Ge.length)throw new Error(Me);const Fe=this.options.radius/(this.options.extent*Math.pow(2,le-1)),ke=Se.within(Ge[K*this.stride],Ge[K*this.stride+1],Fe),Qe=[];for(const ft of ke){const ot=ft*this.stride;Ge[ot+4]===ee&&Qe.push(Ge[ot+5]>1?Cs(Ge,ot,this.clusterProps):this.points[Ge[ot+3]])}if(Qe.length===0)throw new Error(Me);return Qe}getLeaves(ee,K,le){const Me=[];return this._appendLeaves(Me,ee,K=K||10,le=le||0,0),Me}getTile(ee,K,le){const Me=this.trees[this._limitZoom(ee)],Se=Math.pow(2,ee),{extent:Ge,radius:Fe}=this.options,ke=Fe/Ge,Qe=(le-ke)/Se,ft=(le+1+ke)/Se,ot={features:[]};return this._addTileFeatures(Me.range((K-ke)/Se,Qe,(K+1+ke)/Se,ft),Me.data,K,le,Se,ot),K===0&&this._addTileFeatures(Me.range(1-ke/Se,Qe,1,ft),Me.data,Se,le,Se,ot),K===Se-1&&this._addTileFeatures(Me.range(0,Qe,ke/Se,ft),Me.data,-1,le,Se,ot),ot.features.length?ot:null}getClusterExpansionZoom(ee){let K=this._getOriginZoom(ee)-1;for(;K<=this.options.maxZoom;){const le=this.getChildren(ee);if(K++,le.length!==1)break;ee=le[0].properties.cluster_id}return K}_appendLeaves(ee,K,le,Me,Se){const Ge=this.getChildren(K);for(const Fe of Ge){const ke=Fe.properties;if(ke&&ke.cluster?Se+ke.point_count<=Me?Se+=ke.point_count:Se=this._appendLeaves(ee,ke.cluster_id,le,Me,Se):Se<Me?Se++:ee.push(Fe),ee.length===le)break}return Se}_createTree(ee){const K=new W.aT(ee.length/this.stride|0,this.options.nodeSize,Float32Array);for(let le=0;le<ee.length;le+=this.stride)K.add(ee[le],ee[le+1]);return K.finish(),K.data=ee,K}_addTileFeatures(ee,K,le,Me,Se,Ge){for(const Fe of ee){const ke=Fe*this.stride,Qe=K[ke+5]>1;let ft,ot,St;if(Qe)ft=cr(K,ke,this.clusterProps),ot=K[ke],St=K[ke+1];else{const Gi=this.points[K[ke+3]];ft=Gi.properties;const[Bi,qe]=Gi.geometry.coordinates;ot=Ji(Bi),St=Sn(qe)}const je={type:1,geometry:[[Math.round(this.options.extent*(ot*Se-le)),Math.round(this.options.extent*(St*Se-Me))]],tags:ft};let Xt;Xt=Qe||this.options.generateId?K[ke+3]:this.points[K[ke+3]].id,Xt!==void 0&&(je.id=Xt),Ge.features.push(je)}}_limitZoom(ee){return Math.max(this.options.minZoom,Math.min(Math.floor(+ee),this.options.maxZoom+1))}_cluster(ee,K){const{radius:le,extent:Me,reduce:Se,minPoints:Ge}=this.options,Fe=le/(Me*Math.pow(2,K)),ke=ee.data,Qe=[],ft=this.stride;for(let ot=0;ot<ke.length;ot+=ft){if(ke[ot+2]<=K)continue;ke[ot+2]=K;const St=ke[ot],je=ke[ot+1],Xt=ee.within(ke[ot],ke[ot+1],Fe),Gi=ke[ot+5];let Bi=Gi;for(const qe of Xt){const Hi=qe*ft;ke[Hi+2]>K&&(Bi+=ke[Hi+5])}if(Bi>Gi&&Bi>=Ge){let qe,Hi=St*Gi,rn=je*Gi,Kt=-1;const qi=(ot/ft<<5)+(K+1)+this.points.length;for(const Vr of Xt){const Wi=Vr*ft;if(ke[Wi+2]<=K)continue;ke[Wi+2]=K;const er=ke[Wi+5];Hi+=ke[Wi]*er,rn+=ke[Wi+1]*er,ke[Wi+4]=qi,Se&&(qe||(qe=this._map(ke,ot,!0),Kt=this.clusterProps.length,this.clusterProps.push(qe)),Se(qe,this._map(ke,Wi)))}ke[ot+4]=qi,Qe.push(Hi/Bi,rn/Bi,1/0,qi,-1,Bi),Se&&Qe.push(Kt)}else{for(let qe=0;qe<ft;qe++)Qe.push(ke[ot+qe]);if(Bi>1)for(const qe of Xt){const Hi=qe*ft;if(!(ke[Hi+2]<=K)){ke[Hi+2]=K;for(let rn=0;rn<ft;rn++)Qe.push(ke[Hi+rn])}}}}return Qe}_getOriginId(ee){return ee-this.points.length>>5}_getOriginZoom(ee){return(ee-this.points.length)%32}_map(ee,K,le){if(ee[K+5]>1){const Ge=this.clusterProps[ee[K+6]];return le?Object.assign({},Ge):Ge}const Me=this.points[ee[K+3]].properties,Se=this.options.map(Me);return le&&Se===Me?Object.assign({},Se):Se}}function Cs(Ne,ee,K){return{type:"Feature",id:Ne[ee+3],properties:cr(Ne,ee,K),geometry:{type:"Point",coordinates:[(le=Ne[ee],360*(le-.5)),Cn(Ne[ee+1])]}};var le}function cr(Ne,ee,K){const le=Ne[ee+5],Me=le>=1e4?`${Math.round(le/1e3)}k`:le>=1e3?Math.round(le/100)/10+"k":le,Se=Ne[ee+6],Ge=Se===-1?{}:Object.assign({},K[Se]);return Object.assign(Ge,{cluster:!0,cluster_id:Ne[ee+3],point_count:le,point_count_abbreviated:Me})}function Ji(Ne){return Ne/360+.5}function Sn(Ne){const ee=Math.sin(Ne*Math.PI/180),K=.5-.25*Math.log((1+ee)/(1-ee))/Math.PI;return K<0?0:K>1?1:K}function Cn(Ne){const ee=(180-360*Ne)*Math.PI/180;return 360*Math.atan(Math.exp(ee))/Math.PI-90}function Un(Ne,ee,K,le){let Me=le;const Se=ee+(K-ee>>1);let Ge,Fe=K-ee;const ke=Ne[ee],Qe=Ne[ee+1],ft=Ne[K],ot=Ne[K+1];for(let St=ee+3;St<K;St+=3){const je=Jr(Ne[St],Ne[St+1],ke,Qe,ft,ot);if(je>Me)Ge=St,Me=je;else if(je===Me){const Xt=Math.abs(St-Se);Xt<Fe&&(Ge=St,Fe=Xt)}}Me>le&&(Ge-ee>3&&Un(Ne,ee,Ge,le),Ne[Ge+2]=Me,K-Ge>3&&Un(Ne,Ge,K,le))}function Jr(Ne,ee,K,le,Me,Se){let Ge=Me-K,Fe=Se-le;if(Ge!==0||Fe!==0){const ke=((Ne-K)*Ge+(ee-le)*Fe)/(Ge*Ge+Fe*Fe);ke>1?(K=Me,le=Se):ke>0&&(K+=Ge*ke,le+=Fe*ke)}return Ge=Ne-K,Fe=ee-le,Ge*Ge+Fe*Fe}function Hr(Ne,ee,K,le){const Me={id:Ne??null,type:ee,geometry:K,tags:le,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(ee==="Point"||ee==="MultiPoint"||ee==="LineString")ti(Me,K);else if(ee==="Polygon")ti(Me,K[0]);else if(ee==="MultiLineString")for(const Se of K)ti(Me,Se);else if(ee==="MultiPolygon")for(const Se of K)ti(Me,Se[0]);return Me}function ti(Ne,ee){for(let K=0;K<ee.length;K+=3)Ne.minX=Math.min(Ne.minX,ee[K]),Ne.minY=Math.min(Ne.minY,ee[K+1]),Ne.maxX=Math.max(Ne.maxX,ee[K]),Ne.maxY=Math.max(Ne.maxY,ee[K+1])}function Oi(Ne,ee,K,le){if(!ee.geometry)return;const Me=ee.geometry.coordinates;if(Me&&Me.length===0)return;const Se=ee.geometry.type,Ge=Math.pow(K.tolerance/((1<<K.maxZoom)*K.extent),2);let Fe=[],ke=ee.id;if(K.promoteId?ke=ee.properties[K.promoteId]:K.generateId&&(ke=le||0),Se==="Point")Yt(Me,Fe);else if(Se==="MultiPoint")for(const Qe of Me)Yt(Qe,Fe);else if(Se==="LineString")Ni(Me,Fe,Ge,!1);else if(Se==="MultiLineString"){if(K.lineMetrics){for(const Qe of Me)Fe=[],Ni(Qe,Fe,Ge,!1),Ne.push(Hr(ke,"LineString",Fe,ee.properties));return}Mr(Me,Fe,Ge,!1)}else if(Se==="Polygon")Mr(Me,Fe,Ge,!0);else{if(Se!=="MultiPolygon"){if(Se==="GeometryCollection"){for(const Qe of ee.geometry.geometries)Oi(Ne,{id:ke,geometry:Qe,properties:ee.properties},K,le);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Qe of Me){const ft=[];Mr(Qe,ft,Ge,!0),Fe.push(ft)}}Ne.push(Hr(ke,Se,Fe,ee.properties))}function Yt(Ne,ee){ee.push(Wr(Ne[0]),or(Ne[1]),0)}function Ni(Ne,ee,K,le){let Me,Se,Ge=0;for(let ke=0;ke<Ne.length;ke++){const Qe=Wr(Ne[ke][0]),ft=or(Ne[ke][1]);ee.push(Qe,ft,0),ke>0&&(Ge+=le?(Me*ft-Qe*Se)/2:Math.sqrt(Math.pow(Qe-Me,2)+Math.pow(ft-Se,2))),Me=Qe,Se=ft}const Fe=ee.length-3;ee[2]=1,Un(ee,0,Fe,K),ee[Fe+2]=1,ee.size=Math.abs(Ge),ee.start=0,ee.end=ee.size}function Mr(Ne,ee,K,le){for(let Me=0;Me<Ne.length;Me++){const Se=[];Ni(Ne[Me],Se,K,le),ee.push(Se)}}function Wr(Ne){return Ne/360+.5}function or(Ne){const ee=Math.sin(Ne*Math.PI/180),K=.5-.25*Math.log((1+ee)/(1-ee))/Math.PI;return K<0?0:K>1?1:K}function xi(Ne,ee,K,le,Me,Se,Ge,Fe){if(le/=ee,Se>=(K/=ee)&&Ge<le)return Ne;if(Ge<K||Se>=le)return null;const ke=[];for(const Qe of Ne){const ft=Qe.geometry;let ot=Qe.type;const St=Me===0?Qe.minX:Qe.minY,je=Me===0?Qe.maxX:Qe.maxY;if(St>=K&&je<le){ke.push(Qe);continue}if(je<K||St>=le)continue;let Xt=[];if(ot==="Point"||ot==="MultiPoint")Ai(ft,Xt,K,le,Me);else if(ot==="LineString")hn(ft,Xt,K,le,Me,!1,Fe.lineMetrics);else if(ot==="MultiLineString")yo(ft,Xt,K,le,Me,!1);else if(ot==="Polygon")yo(ft,Xt,K,le,Me,!0);else if(ot==="MultiPolygon")for(const Gi of ft){const Bi=[];yo(Gi,Bi,K,le,Me,!0),Bi.length&&Xt.push(Bi)}if(Xt.length){if(Fe.lineMetrics&&ot==="LineString"){for(const Gi of Xt)ke.push(Hr(Qe.id,ot,Gi,Qe.tags));continue}ot!=="LineString"&&ot!=="MultiLineString"||(Xt.length===1?(ot="LineString",Xt=Xt[0]):ot="MultiLineString"),ot!=="Point"&&ot!=="MultiPoint"||(ot=Xt.length===3?"Point":"MultiPoint"),ke.push(Hr(Qe.id,ot,Xt,Qe.tags))}}return ke.length?ke:null}function Ai(Ne,ee,K,le,Me){for(let Se=0;Se<Ne.length;Se+=3){const Ge=Ne[Se+Me];Ge>=K&&Ge<=le&&us(ee,Ne[Se],Ne[Se+1],Ne[Se+2])}}function hn(Ne,ee,K,le,Me,Se,Ge){let Fe=Er(Ne);const ke=Me===0?No:In;let Qe,ft,ot=Ne.start;for(let Bi=0;Bi<Ne.length-3;Bi+=3){const qe=Ne[Bi],Hi=Ne[Bi+1],rn=Ne[Bi+2],Kt=Ne[Bi+3],qi=Ne[Bi+4],Vr=Me===0?qe:Hi,Wi=Me===0?Kt:qi;let er=!1;Ge&&(Qe=Math.sqrt(Math.pow(qe-Kt,2)+Math.pow(Hi-qi,2))),Vr<K?Wi>K&&(ft=ke(Fe,qe,Hi,Kt,qi,K),Ge&&(Fe.start=ot+Qe*ft)):Vr>le?Wi<le&&(ft=ke(Fe,qe,Hi,Kt,qi,le),Ge&&(Fe.start=ot+Qe*ft)):us(Fe,qe,Hi,rn),Wi<K&&Vr>=K&&(ft=ke(Fe,qe,Hi,Kt,qi,K),er=!0),Wi>le&&Vr<=le&&(ft=ke(Fe,qe,Hi,Kt,qi,le),er=!0),!Se&&er&&(Ge&&(Fe.end=ot+Qe*ft),ee.push(Fe),Fe=Er(Ne)),Ge&&(ot+=Qe)}let St=Ne.length-3;const je=Ne[St],Xt=Ne[St+1],Gi=Me===0?je:Xt;Gi>=K&&Gi<=le&&us(Fe,je,Xt,Ne[St+2]),St=Fe.length-3,Se&&St>=3&&(Fe[St]!==Fe[0]||Fe[St+1]!==Fe[1])&&us(Fe,Fe[0],Fe[1],Fe[2]),Fe.length&&ee.push(Fe)}function Er(Ne){const ee=[];return ee.size=Ne.size,ee.start=Ne.start,ee.end=Ne.end,ee}function yo(Ne,ee,K,le,Me,Se){for(const Ge of Ne)hn(Ge,ee,K,le,Me,Se,!1)}function us(Ne,ee,K,le){Ne.push(ee,K,le)}function No(Ne,ee,K,le,Me,Se){const Ge=(Se-ee)/(le-ee);return us(Ne,Se,K+(Me-K)*Ge,1),Ge}function In(Ne,ee,K,le,Me,Se){const Ge=(Se-K)/(Me-K);return us(Ne,ee+(le-ee)*Ge,Se,1),Ge}function Vo(Ne,ee){const K=[];for(let le=0;le<Ne.length;le++){const Me=Ne[le],Se=Me.type;let Ge;if(Se==="Point"||Se==="MultiPoint"||Se==="LineString")Ge=en(Me.geometry,ee);else if(Se==="MultiLineString"||Se==="Polygon"){Ge=[];for(const Fe of Me.geometry)Ge.push(en(Fe,ee))}else if(Se==="MultiPolygon"){Ge=[];for(const Fe of Me.geometry){const ke=[];for(const Qe of Fe)ke.push(en(Qe,ee));Ge.push(ke)}}K.push(Hr(Me.id,Se,Ge,Me.tags))}return K}function en(Ne,ee){const K=[];K.size=Ne.size,Ne.start!==void 0&&(K.start=Ne.start,K.end=Ne.end);for(let le=0;le<Ne.length;le+=3)K.push(Ne[le]+ee,Ne[le+1],Ne[le+2]);return K}function hs(Ne,ee){if(Ne.transformed)return Ne;const K=1<<Ne.z,le=Ne.x,Me=Ne.y;for(const Se of Ne.features){const Ge=Se.geometry,Fe=Se.type;if(Se.geometry=[],Fe===1)for(let ke=0;ke<Ge.length;ke+=2)Se.geometry.push(Is(Ge[ke],Ge[ke+1],ee,K,le,Me));else for(let ke=0;ke<Ge.length;ke++){const Qe=[];for(let ft=0;ft<Ge[ke].length;ft+=2)Qe.push(Is(Ge[ke][ft],Ge[ke][ft+1],ee,K,le,Me));Se.geometry.push(Qe)}}return Ne.transformed=!0,Ne}function Is(Ne,ee,K,le,Me,Se){return[Math.round(K*(Ne*le-Me)),Math.round(K*(ee*le-Se))]}function Ui(Ne,ee,K,le,Me){const Se=ee===Me.maxZoom?0:Me.tolerance/((1<<ee)*Me.extent),Ge={features:[],numPoints:0,numSimplified:0,numFeatures:Ne.length,source:null,x:K,y:le,z:ee,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const Fe of Ne)Dn(Ge,Fe,Se,Me);return Ge}function Dn(Ne,ee,K,le){const Me=ee.geometry,Se=ee.type,Ge=[];if(Ne.minX=Math.min(Ne.minX,ee.minX),Ne.minY=Math.min(Ne.minY,ee.minY),Ne.maxX=Math.max(Ne.maxX,ee.maxX),Ne.maxY=Math.max(Ne.maxY,ee.maxY),Se==="Point"||Se==="MultiPoint")for(let Fe=0;Fe<Me.length;Fe+=3)Ge.push(Me[Fe],Me[Fe+1]),Ne.numPoints++,Ne.numSimplified++;else if(Se==="LineString")jo(Ge,Me,Ne,K,!1,!1);else if(Se==="MultiLineString"||Se==="Polygon")for(let Fe=0;Fe<Me.length;Fe++)jo(Ge,Me[Fe],Ne,K,Se==="Polygon",Fe===0);else if(Se==="MultiPolygon")for(let Fe=0;Fe<Me.length;Fe++){const ke=Me[Fe];for(let Qe=0;Qe<ke.length;Qe++)jo(Ge,ke[Qe],Ne,K,!0,Qe===0)}if(Ge.length){let Fe=ee.tags||null;if(Se==="LineString"&&le.lineMetrics){Fe={};for(const Qe in ee.tags)Fe[Qe]=ee.tags[Qe];Fe.mapbox_clip_start=Me.start/Me.size,Fe.mapbox_clip_end=Me.end/Me.size}const ke={geometry:Ge,type:Se==="Polygon"||Se==="MultiPolygon"?3:Se==="LineString"||Se==="MultiLineString"?2:1,tags:Fe};ee.id!==null&&(ke.id=ee.id),Ne.features.push(ke)}}function jo(Ne,ee,K,le,Me,Se){const Ge=le*le;if(le>0&&ee.size<(Me?Ge:le))return void(K.numPoints+=ee.length/3);const Fe=[];for(let ke=0;ke<ee.length;ke+=3)(le===0||ee[ke+2]>Ge)&&(K.numSimplified++,Fe.push(ee[ke],ee[ke+1])),K.numPoints++;Me&&(function(ke,Qe){let ft=0;for(let ot=0,St=ke.length,je=St-2;ot<St;je=ot,ot+=2)ft+=(ke[ot]-ke[je])*(ke[ot+1]+ke[je+1]);if(ft>0===Qe)for(let ot=0,St=ke.length;ot<St/2;ot+=2){const je=ke[ot],Xt=ke[ot+1];ke[ot]=ke[St-2-ot],ke[ot+1]=ke[St-1-ot],ke[St-2-ot]=je,ke[St-1-ot]=Xt}})(Fe,Se),Ne.push(Fe)}const Zo={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class tn{constructor(ee,K){const le=(K=this.options=(function(Se,Ge){for(const Fe in Ge)Se[Fe]=Ge[Fe];return Se})(Object.create(Zo),K)).debug;if(le&&console.time("preprocess data"),K.maxZoom<0||K.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(K.promoteId&&K.generateId)throw new Error("promoteId and generateId cannot be used together.");let Me=(function(Se,Ge){const Fe=[];if(Se.type==="FeatureCollection")for(let ke=0;ke<Se.features.length;ke++)Oi(Fe,Se.features[ke],Ge,ke);else Oi(Fe,Se.type==="Feature"?Se:{geometry:Se},Ge);return Fe})(ee,K);this.tiles={},this.tileCoords=[],le&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",K.indexMaxZoom,K.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),Me=(function(Se,Ge){const Fe=Ge.buffer/Ge.extent;let ke=Se;const Qe=xi(Se,1,-1-Fe,Fe,0,-1,2,Ge),ft=xi(Se,1,1-Fe,2+Fe,0,-1,2,Ge);return(Qe||ft)&&(ke=xi(Se,1,-Fe,1+Fe,0,-1,2,Ge)||[],Qe&&(ke=Vo(Qe,1).concat(ke)),ft&&(ke=ke.concat(Vo(ft,-1)))),ke})(Me,K),Me.length&&this.splitTile(Me,0,0,0),le&&(Me.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)))}splitTile(ee,K,le,Me,Se,Ge,Fe){const ke=[ee,K,le,Me],Qe=this.options,ft=Qe.debug;for(;ke.length;){Me=ke.pop(),le=ke.pop(),K=ke.pop(),ee=ke.pop();const ot=1<<K,St=Gn(K,le,Me);let je=this.tiles[St];if(!je&&(ft>1&&console.time("creation"),je=this.tiles[St]=Ui(ee,K,le,Me,Qe),this.tileCoords.push({z:K,x:le,y:Me}),ft)){ft>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",K,le,Me,je.numFeatures,je.numPoints,je.numSimplified),console.timeEnd("creation"));const er=`z${K}`;this.stats[er]=(this.stats[er]||0)+1,this.total++}if(je.source=ee,Se==null){if(K===Qe.indexMaxZoom||je.numPoints<=Qe.indexMaxPoints)continue}else{if(K===Qe.maxZoom||K===Se)continue;if(Se!=null){const er=Se-K;if(le!==Ge>>er||Me!==Fe>>er)continue}}if(je.source=null,ee.length===0)continue;ft>1&&console.time("clipping");const Xt=.5*Qe.buffer/Qe.extent,Gi=.5-Xt,Bi=.5+Xt,qe=1+Xt;let Hi=null,rn=null,Kt=null,qi=null,Vr=xi(ee,ot,le-Xt,le+Bi,0,je.minX,je.maxX,Qe),Wi=xi(ee,ot,le+Gi,le+qe,0,je.minX,je.maxX,Qe);ee=null,Vr&&(Hi=xi(Vr,ot,Me-Xt,Me+Bi,1,je.minY,je.maxY,Qe),rn=xi(Vr,ot,Me+Gi,Me+qe,1,je.minY,je.maxY,Qe),Vr=null),Wi&&(Kt=xi(Wi,ot,Me-Xt,Me+Bi,1,je.minY,je.maxY,Qe),qi=xi(Wi,ot,Me+Gi,Me+qe,1,je.minY,je.maxY,Qe),Wi=null),ft>1&&console.timeEnd("clipping"),ke.push(Hi||[],K+1,2*le,2*Me),ke.push(rn||[],K+1,2*le,2*Me+1),ke.push(Kt||[],K+1,2*le+1,2*Me),ke.push(qi||[],K+1,2*le+1,2*Me+1)}}getTile(ee,K,le){ee=+ee,K=+K,le=+le;const Me=this.options,{extent:Se,debug:Ge}=Me;if(ee<0||ee>24)return null;const Fe=1<<ee,ke=Gn(ee,K=K+Fe&Fe-1,le);if(this.tiles[ke])return hs(this.tiles[ke],Se);Ge>1&&console.log("drilling down to z%d-%d-%d",ee,K,le);let Qe,ft=ee,ot=K,St=le;for(;!Qe&&ft>0;)ft--,ot>>=1,St>>=1,Qe=this.tiles[Gn(ft,ot,St)];return Qe&&Qe.source?(Ge>1&&(console.log("found parent tile z%d-%d-%d",ft,ot,St),console.time("drilling down")),this.splitTile(Qe.source,ft,ot,St,ee,K,le),Ge>1&&console.timeEnd("drilling down"),this.tiles[ke]?hs(this.tiles[ke],Se):null):null}}function Gn(Ne,ee,K){return 32*((1<<Ne)*K+ee)+Ne}class vo extends rt{constructor(ee,K,le,Me=Ds){super(ee,K,le),this._dataUpdateable=new Map,this._createGeoJSONIndex=Me}loadVectorTile(ee,K){return W._(this,void 0,void 0,(function*(){const le=ee.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const Me=this._geoJSONIndex.getTile(le.z,le.x,le.y);return Me?Mn(new W.d2(Me.features,{version:2,extent:W.a5})):null}))}loadData(ee){return W._(this,void 0,void 0,(function*(){var K;(K=this._pendingRequest)===null||K===void 0||K.abort();const le=this._startPerformance(ee);this._pendingRequest=new AbortController;try{(!this._pendingData||ee.request||ee.data||ee.dataDiff)&&(this._pendingData=this.loadAndProcessGeoJSON(ee,this._pendingRequest));const Me=yield this._pendingData;this._geoJSONIndex=this._createGeoJSONIndex(Me,ee),this.loaded={};const Se={};return ee.request&&(Se.data=Me),this._finishPerformance(le,ee,Se),Se}catch(Me){if(delete this._pendingRequest,W.Z(Me))return{abandoned:!0};throw Me}}))}_startPerformance(ee){var K;if(!((K=ee==null?void 0:ee.request)===null||K===void 0)&&K.collectResourceTiming)return new W.c_(ee.request)}_finishPerformance(ee,K,le){if(!ee)return;const Me=ee.finish();Me&&(le.resourceTiming={},le.resourceTiming[K.source]=JSON.parse(JSON.stringify(Me)))}getData(){return W._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(ee){const K=this.loaded;return K&&K[ee.uid]?super.reloadTile(ee):this.loadTile(ee)}loadAndProcessGeoJSON(ee,K){return W._(this,void 0,void 0,(function*(){let le;if(ee.request?le=yield this.loadGeoJSONFromUrl(ee.request,ee.promoteId,K):ee.data?le=this._loadGeoJSONFromObject(ee.data,ee.promoteId):ee.dataDiff&&(le=this._loadGeoJSONFromDiff(ee.dataDiff,ee.promoteId,ee.source)),delete this._pendingRequest,typeof le!="object")throw new Error(`Input data given to '${ee.source}' is not a valid GeoJSON object.`);return no(le,!0),ee.filter&&(le=this._filterGeoJSON(le,ee.filter)),le}))}loadGeoJSONFromUrl(ee,K,le){return W._(this,void 0,void 0,(function*(){const Me=yield W.j(ee,le);return this._dataUpdateable=W.a7(Me.data,K),Me.data}))}_loadGeoJSONFromObject(ee,K){return this._dataUpdateable=W.a7(ee,K),ee}_loadGeoJSONFromDiff(ee,K,le){if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${le}`);W.a8(this._dataUpdateable,ee,K);const Me=Array.from(this._dataUpdateable.values());return this._toFeatureCollection(Me)}_filterGeoJSON(ee,K){const le=W.d3(K,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(le.result==="error")throw new Error(le.value.map((Se=>`${Se.key}: ${Se.message}`)).join(", "));const Me=ee.features.filter((Se=>le.value.evaluate({zoom:0},Se)));return this._toFeatureCollection(Me)}_toFeatureCollection(ee){return{type:"FeatureCollection",features:ee}}removeSource(ee){return W._(this,void 0,void 0,(function*(){this._pendingRequest&&this._pendingRequest.abort()}))}getClusterExpansionZoom(ee){return this._geoJSONIndex.getClusterExpansionZoom(ee.clusterId)}getClusterChildren(ee){return this._geoJSONIndex.getChildren(ee.clusterId)}getClusterLeaves(ee){return this._geoJSONIndex.getLeaves(ee.clusterId,ee.limit,ee.offset)}}function Ds(Ne,ee){return ee.cluster?new Vs((function({superclusterOptions:K,clusterProperties:le}){if(!le||!K)return K;const Me={},Se={},Ge={accumulated:null,zoom:0},Fe={properties:null},ke=Object.keys(le);for(const Qe of ke){const[ft,ot]=le[Qe],St=W.d3(ot),je=W.d3(typeof ft=="string"?[ft,["accumulated"],["get",Qe]]:ft);Me[Qe]=St.value,Se[Qe]=je.value}return K.map=Qe=>{Fe.properties=Qe;const ft={};for(const ot of ke)ft[ot]=Me[ot].evaluate(Ge,Fe);return ft},K.reduce=(Qe,ft)=>{Fe.properties=ft;for(const ot of ke)Ge.accumulated=Qe[ot],Qe[ot]=Se[ot].evaluate(Ge,Fe)},K})(ee)).load(Ne.features):(function(K,le){return new tn(K,le)})(Ne,ee.geojsonVtOptions)}class mn{constructor(ee){this.self=ee,this.actor=new W.L(ee),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(K,le)=>{if(this.externalWorkerSourceTypes[K])throw new Error(`Worker source with name "${K}" already registered.`);this.externalWorkerSourceTypes[K]=le},this.self.addProtocol=W.cJ,this.self.removeProtocol=W.cK,this.self.registerRTLTextPlugin=K=>{W.d4.setMethods(K)},this.actor.registerMessageHandler("LDT",((K,le)=>this._getDEMWorkerSource(K,le.source).loadTile(le))),this.actor.registerMessageHandler("RDT",((K,le)=>W._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(K,le.source).removeTile(le)})))),this.actor.registerMessageHandler("GCEZ",((K,le)=>W._(this,void 0,void 0,(function*(){return this._getWorkerSource(K,le.type,le.source).getClusterExpansionZoom(le)})))),this.actor.registerMessageHandler("GCC",((K,le)=>W._(this,void 0,void 0,(function*(){return this._getWorkerSource(K,le.type,le.source).getClusterChildren(le)})))),this.actor.registerMessageHandler("GCL",((K,le)=>W._(this,void 0,void 0,(function*(){return this._getWorkerSource(K,le.type,le.source).getClusterLeaves(le)})))),this.actor.registerMessageHandler("LD",((K,le)=>this._getWorkerSource(K,le.type,le.source).loadData(le))),this.actor.registerMessageHandler("GD",((K,le)=>this._getWorkerSource(K,le.type,le.source).getData())),this.actor.registerMessageHandler("LT",((K,le)=>this._getWorkerSource(K,le.type,le.source).loadTile(le))),this.actor.registerMessageHandler("RT",((K,le)=>this._getWorkerSource(K,le.type,le.source).reloadTile(le))),this.actor.registerMessageHandler("AT",((K,le)=>this._getWorkerSource(K,le.type,le.source).abortTile(le))),this.actor.registerMessageHandler("RMT",((K,le)=>this._getWorkerSource(K,le.type,le.source).removeTile(le))),this.actor.registerMessageHandler("RS",((K,le)=>W._(this,void 0,void 0,(function*(){if(!this.workerSources[K]||!this.workerSources[K][le.type]||!this.workerSources[K][le.type][le.source])return;const Me=this.workerSources[K][le.type][le.source];delete this.workerSources[K][le.type][le.source],Me.removeSource!==void 0&&Me.removeSource(le)})))),this.actor.registerMessageHandler("RM",(K=>W._(this,void 0,void 0,(function*(){delete this.layerIndexes[K],delete this.availableImages[K],delete this.workerSources[K],delete this.demWorkerSources[K],this.globalStates.delete(K)})))),this.actor.registerMessageHandler("SR",((K,le)=>W._(this,void 0,void 0,(function*(){this.referrer=le})))),this.actor.registerMessageHandler("SRPS",((K,le)=>this._syncRTLPluginState(K,le))),this.actor.registerMessageHandler("IS",((K,le)=>W._(this,void 0,void 0,(function*(){this.self.importScripts(le)})))),this.actor.registerMessageHandler("SI",((K,le)=>this._setImages(K,le))),this.actor.registerMessageHandler("UL",((K,le)=>W._(this,void 0,void 0,(function*(){this._getLayerIndex(K).update(le.layers,le.removedIds,this._getGlobalState(K))})))),this.actor.registerMessageHandler("UGS",((K,le)=>W._(this,void 0,void 0,(function*(){const Me=this._getGlobalState(K);for(const Se in le)Me[Se]=le[Se]})))),this.actor.registerMessageHandler("SL",((K,le)=>W._(this,void 0,void 0,(function*(){this._getLayerIndex(K).replace(le,this._getGlobalState(K))}))))}_getGlobalState(ee){let K=this.globalStates.get(ee);return K||(K={},this.globalStates.set(ee,K)),K}_setImages(ee,K){return W._(this,void 0,void 0,(function*(){this.availableImages[ee]=K;for(const le in this.workerSources[ee]){const Me=this.workerSources[ee][le];for(const Se in Me)Me[Se].availableImages=K}}))}_syncRTLPluginState(ee,K){return W._(this,void 0,void 0,(function*(){return yield W.d4.syncState(K,this.self.importScripts)}))}_getAvailableImages(ee){let K=this.availableImages[ee];return K||(K=[]),K}_getLayerIndex(ee){let K=this.layerIndexes[ee];return K||(K=this.layerIndexes[ee]=new p),K}_getWorkerSource(ee,K,le){if(this.workerSources[ee]||(this.workerSources[ee]={}),this.workerSources[ee][K]||(this.workerSources[ee][K]={}),!this.workerSources[ee][K][le]){const Me={sendAsync:(Se,Ge)=>(Se.targetMapId=ee,this.actor.sendAsync(Se,Ge))};switch(K){case"vector":this.workerSources[ee][K][le]=new rt(Me,this._getLayerIndex(ee),this._getAvailableImages(ee));break;case"geojson":this.workerSources[ee][K][le]=new vo(Me,this._getLayerIndex(ee),this._getAvailableImages(ee));break;default:this.workerSources[ee][K][le]=new this.externalWorkerSourceTypes[K](Me,this._getLayerIndex(ee),this._getAvailableImages(ee))}}return this.workerSources[ee][K][le]}_getDEMWorkerSource(ee,K){return this.demWorkerSources[ee]||(this.demWorkerSources[ee]={}),this.demWorkerSources[ee][K]||(this.demWorkerSources[ee][K]=new Fo),this.demWorkerSources[ee][K]}}return W.i(self)&&(self.worker=new mn(self)),mn})),We("index",["exports","./shared"],(function(W,p){var it="5.16.0";function ur(){var y=new p.A(4);return p.A!=Float32Array&&(y[1]=0,y[2]=0),y[0]=1,y[3]=1,y}let fr,Zi,un;const zr={frame(y,t,n){const h=requestAnimationFrame((x=>{f(),t(x)})),{unsubscribe:f}=p.s(y.signal,"abort",(()=>{f(),cancelAnimationFrame(h),n(new p.a(y.signal.reason))}),!1)},frameAsync(y){return new Promise(((t,n)=>{this.frame(y,t,n)}))},getImageData(y,t=0){return this.getImageCanvasContext(y).getImageData(-t,-t,y.width+2*t,y.height+2*t)},getImageCanvasContext(y){const t=window.document.createElement("canvas"),n=t.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return t.width=y.width,t.height=y.height,n.drawImage(y,0,0,y.width,y.height),n},resolveURL:y=>(fr||(fr=document.createElement("a")),fr.href=y,fr.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return un!==void 0?un:!!matchMedia&&(Zi==null&&(Zi=matchMedia("(prefers-reduced-motion: reduce)")),Zi.matches)},set prefersReducedMotion(y){un=y}},Mn=new class{constructor(){this._realTime=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),this._frozenAt=null}getCurrentTime(){return this._frozenAt!==null?this._frozenAt:this._realTime()}setNow(y){this._frozenAt=y}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function Gt(){return Mn.getCurrentTime()}class rt{static testProp(t){if(!rt.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in rt.docStyle)return t[n];return t[0]}static create(t,n,h){const f=window.document.createElement(t);return n!==void 0&&(f.className=n),h&&h.appendChild(f),f}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){rt.docStyle&&rt.selectProp&&(rt.userSelect=rt.docStyle[rt.selectProp],rt.docStyle[rt.selectProp]="none")}static enableDrag(){rt.docStyle&&rt.selectProp&&(rt.docStyle[rt.selectProp]=rt.userSelect)}static setTransform(t,n){t.style[rt.transformProp]=n}static addEventListener(t,n,h,f={}){t.addEventListener(n,h,"passive"in f?f:f.capture)}static removeEventListener(t,n,h,f={}){t.removeEventListener(n,h,"passive"in f?f:f.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",rt.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",rt.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",rt.suppressClickInternal,!0)}),0)}static getScale(t){const n=t.getBoundingClientRect();return{x:n.width/t.offsetWidth||1,y:n.height/t.offsetHeight||1,boundingClientRect:n}}static getPoint(t,n,h){const f=n.boundingClientRect;return new p.P((h.clientX-f.left)/n.x-t.clientLeft,(h.clientY-f.top)/n.y-t.clientTop)}static mousePos(t,n){const h=rt.getScale(t);return rt.getPoint(t,h,n)}static touchPos(t,n){const h=[],f=rt.getScale(t);for(let x=0;x<n.length;x++)h.push(rt.getPoint(t,f,n[x]));return h}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}static sanitize(t){const n=new DOMParser().parseFromString(t,"text/html").body||document.createElement("body"),h=n.querySelectorAll("script");for(const f of h)f.remove();return rt.clean(n),n.innerHTML}static isPossiblyDangerous(t,n){const h=n.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(t)||!h.includes("javascript:")&&!h.includes("data:"))||!!t.startsWith("on")||void 0}static clean(t){const n=t.children;for(const h of n)rt.removeAttributes(h),rt.clean(h)}static removeAttributes(t){for(const{name:n,value:h}of t.attributes)rt.isPossiblyDangerous(n,h)&&t.removeAttribute(n)}}rt.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,rt.selectProp=rt.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),rt.transformProp=rt.testProp(["transform","WebkitTransform"]);const Fo={supported:!1,testSupport:function(y){!ro&&zi&&(no?Ns(y):hr=y)}};let hr,zi,ro=!1,no=!1;function Ns(y){const t=y.createTexture();y.bindTexture(y.TEXTURE_2D,t);try{if(y.texImage2D(y.TEXTURE_2D,0,y.RGBA,y.RGBA,y.UNSIGNED_BYTE,zi),y.isContextLost())return;Fo.supported=!0}catch{}y.deleteTexture(t),ro=!0}var En;typeof document<"u"&&(zi=document.createElement("img"),zi.onload=()=>{hr&&Ns(hr),hr=null,no=!0},zi.onerror=()=>{ro=!0,hr=null},zi.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),(function(y){let t,n,h,f;y.resetRequestQueue=()=>{t=[],n=0,h=0,f={}},y.addThrottleControl=D=>{const B=h++;return f[B]=D,B},y.removeThrottleControl=D=>{delete f[D],T()},y.getImage=(D,B,N=!0)=>new Promise(((G,U)=>{Fo.supported&&(D.headers||(D.headers={}),D.headers.accept="image/webp,*/*"),p.e(D,{type:"image"}),t.push({abortController:B,requestParameters:D,supportImageRefresh:N,state:"queued",onError:$=>{U($)},onSuccess:$=>{G($)}}),T()}));const x=D=>p._(this,void 0,void 0,(function*(){D.state="running";const{requestParameters:B,supportImageRefresh:N,onError:G,onSuccess:U,abortController:$}=D,ie=N===!1&&!p.i(self)&&!p.g(B.url)&&(!B.headers||Object.keys(B.headers).reduce(((ce,ye)=>ce&&ye==="accept"),!0));n++;const he=ie?C(B,$):p.m(B,$);try{const ce=yield he;delete D.abortController,D.state="completed",ce.data instanceof HTMLImageElement||p.b(ce.data)?U(ce):ce.data&&U({data:yield(Ae=ce.data,typeof createImageBitmap=="function"?p.f(Ae):p.h(Ae)),cacheControl:ce.cacheControl,expires:ce.expires})}catch(ce){delete D.abortController,G(ce)}finally{n--,T()}var Ae})),T=()=>{const D=(()=>{for(const B of Object.keys(f))if(f[B]())return!0;return!1})()?p.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:p.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let B=n;B<D&&t.length>0;B++){const N=t.shift();N.abortController.signal.aborted?B--:x(N)}},C=(D,B)=>new Promise(((N,G)=>{const U=new Image,$=D.url,ie=D.credentials;ie&&ie==="include"?U.crossOrigin="use-credentials":(ie&&ie==="same-origin"||!p.d($))&&(U.crossOrigin="anonymous"),B.signal.addEventListener("abort",(()=>{U.src="",G(new p.a(B.signal.reason))})),U.fetchPriority="high",U.onload=()=>{U.onerror=U.onload=null,N({data:U})},U.onerror=()=>{U.onerror=U.onload=null,B.signal.aborted||G(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."))},U.src=$}))})(En||(En={})),En.resetRequestQueue();class Oo{constructor(t){this._transformRequestFn=t??null}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function Vs(y){const t=[];if(typeof y=="string")t.push({id:"default",url:y});else if(y&&y.length>0){const n=[];for(const{id:h,url:f}of y){const x=`${h}${f}`;n.indexOf(x)===-1&&(n.push(x),t.push({id:h,url:f}))}}return t}function Cs(y,t,n){try{const h=new URL(y);return h.pathname+=`${t}${n}`,h.toString()}catch{throw new Error(`Invalid sprite URL "${y}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function cr(y){const{userImage:t}=y;return!!(t&&t.render&&t.render())&&(y.data.replace(new Uint8Array(t.data.buffer)),!0)}class Ji extends p.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new p.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(const t of Object.keys(this.images))this.removeImage(t);this.patterns={},this.atlasImage=new p.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,promiseResolve:h}of this.requestors)h(this._getImagesForIds(n));this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const h=n.spriteData;n.data=new p.R({width:h.width,height:h.height},h.context.getImageData(h.x,h.y,h.width,h.height).data),n.spriteData=null}return n}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let h=!0;const f=n.data||n.spriteData;return this._validateStretch(n.stretchX,f&&f.width)||(this.fire(new p.k(new Error(`Image "${t}" has invalid "stretchX" value`))),h=!1),this._validateStretch(n.stretchY,f&&f.height)||(this.fire(new p.k(new Error(`Image "${t}" has invalid "stretchY" value`))),h=!1),this._validateContent(n.content,n)||(this.fire(new p.k(new Error(`Image "${t}" has invalid "content" value`))),h=!1),h}_validateStretch(t,n){if(!t)return!0;let h=0;for(const f of t){if(f[0]<h||f[1]<f[0]||n<f[1])return!1;h=f[1]}return!0}_validateContent(t,n){if(!t)return!0;if(t.length!==4)return!1;const h=n.spriteData,f=h&&h.width||n.data.width,x=h&&h.height||n.data.height;return!(t[0]<0||f<t[0]||t[1]<0||x<t[1]||t[2]<0||f<t[2]||t[3]<0||x<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,n,h=!0){const f=this.getImage(t);if(h&&(f.data.width!==n.data.width||f.data.height!==n.data.height))throw new Error(`size mismatch between old image (${f.data.width}x${f.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=f.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise(((n,h)=>{let f=!0;if(!this.isLoaded())for(const x of t)this.images[x]||(f=!1);this.isLoaded()||f?n(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:n})}))}_getImagesForIds(t){const n={};for(const h of t){let f=this.getImage(h);f||(this.fire(new p.l("styleimagemissing",{id:h})),f=this.getImage(h)),f?n[h]={data:f.data.clone(),pixelRatio:f.pixelRatio,sdf:f.sdf,version:f.version,stretchX:f.stretchX,stretchY:f.stretchY,content:f.content,textFitWidth:f.textFitWidth,textFitHeight:f.textFitHeight,hasRenderCallback:!!(f.userImage&&f.userImage.render)}:p.w(`Image "${h}" 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.`)}return n}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],h=this.getImage(t);if(!h)return null;if(n&&n.position.version===h.version)return n.position;if(n)n.position.version=h.version;else{const f={w:h.data.width+2,h:h.data.height+2,x:0,y:0},x=new p.I(f,h);this.patterns[t]={bin:f,position:x}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new p.T(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const x in this.patterns)t.push(this.patterns[x].bin);const{w:n,h}=p.p(t),f=this.atlasImage;f.resize({width:n||1,height:h||1});for(const x in this.patterns){const{bin:T}=this.patterns[x],C=T.x+1,D=T.y+1,B=this.getImage(x).data,N=B.width,G=B.height;p.R.copy(B,f,{x:0,y:0},{x:C,y:D},{width:N,height:G}),p.R.copy(B,f,{x:0,y:G-1},{x:C,y:D-1},{width:N,height:1}),p.R.copy(B,f,{x:0,y:0},{x:C,y:D+G},{width:N,height:1}),p.R.copy(B,f,{x:N-1,y:0},{x:C-1,y:D},{width:1,height:G}),p.R.copy(B,f,{x:0,y:0},{x:C+N,y:D},{width:1,height:G})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const h=this.getImage(n);h||p.w(`Image with ID: "${n}" was not found`),cr(h)&&this.updateImage(n,h)}}cloneImages(){const t={};for(const n in this.images){const h=this.images[n];t[n]=Object.assign(Object.assign({},h),{data:h.data?h.data.clone():null})}return t}}const Sn=1e20;function Cn(y,t,n,h,f,x,T,C,D){for(let B=t;B<t+h;B++)Un(y,n*x+B,x,f,T,C,D);for(let B=n;B<n+f;B++)Un(y,B*x+t,1,h,T,C,D)}function Un(y,t,n,h,f,x,T){x[0]=0,T[0]=-Sn,T[1]=Sn,f[0]=y[t];for(let C=1,D=0,B=0;C<h;C++){f[C]=y[t+C*n];const N=C*C;do{const G=x[D];B=(f[C]-f[G]+N-G*G)/(C-G)/2}while(B<=T[D]&&--D>-1);D++,x[D]=C,T[D]=B,T[D+1]=Sn}for(let C=0,D=0;C<h;C++){for(;T[D+1]<C;)D++;const B=x[D],N=C-B;y[t+C*n]=f[B]+N*N}}const Jr=p.v.layout_symbol["text-font"].default.join(",");class Hr{constructor(t,n,h){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={},this.lang=h}setURL(t){this.url=t}getGlyphs(t){return p._(this,void 0,void 0,(function*(){const n=[];for(const x in t)for(const T of t[x])n.push(this._getAndCacheGlyphsPromise(x,T));const h=yield Promise.all(n),f={};for(const{stack:x,id:T,glyph:C}of h)f[x]||(f[x]={}),f[x][T]=C&&{id:C.id,bitmap:C.bitmap.clone(),metrics:C.metrics};return f}))}_getAndCacheGlyphsPromise(t,n){return p._(this,void 0,void 0,(function*(){let h=this.entries[t];h||(h=this.entries[t]={glyphs:{},requests:{},ranges:{}});let f=h.glyphs[n];return f!==void 0?{stack:t,id:n,glyph:f}:!this.url||this._charUsesLocalIdeographFontFamily(n)?(f=h.glyphs[n]=this._drawGlyph(h,t,n),{stack:t,id:n,glyph:f}):yield this._downloadAndCacheRangePromise(t,n)}))}_downloadAndCacheRangePromise(t,n){return p._(this,void 0,void 0,(function*(){const h=this.entries[t],f=Math.floor(n/256);if(h.ranges[f])return{stack:t,id:n,glyph:null};if(!h.requests[f]){const x=Hr.loadGlyphRange(t,f,this.url,this.requestManager);h.requests[f]=x}try{const x=yield h.requests[f];for(const T in x)h.glyphs[+T]=x[+T];return h.ranges[f]=!0,{stack:t,id:n,glyph:x[n]||null}}catch(x){const T=h.glyphs[n]=this._drawGlyph(h,t,n);return this._warnOnMissingGlyphRange(T,f,n,x),{stack:t,id:n,glyph:T}}}))}_warnOnMissingGlyphRange(t,n,h,f){const x=256*n,T=x+255,C=h.toString(16).padStart(4,"0").toUpperCase();p.w(`Unable to load glyph range ${n}, ${x}-${T}. Rendering codepoint U+${C} locally instead. ${f}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&p.q(t)}_drawGlyph(t,n,h){const f=n===Jr&&this.localIdeographFontFamily!==""&&this._charUsesLocalIdeographFontFamily(h),x=f?"ideographTinySDF":"tinySDF";t[x]||(t[x]=this._createTinySDF(f?this.localIdeographFontFamily:n));const T=t[x].draw(String.fromCodePoint(h)),C=new RegExp("^\\p{gc=Cf}+$","u").test(String.fromCodePoint(h));return{id:h,bitmap:new p.r({width:T.width||60,height:T.height||60},T.data),metrics:{width:C?0:T.glyphWidth/2||24,height:T.glyphHeight/2||24,left:T.glyphLeft/2+.5||0,top:T.glyphTop/2-27.5||-8,advance:C?0:T.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(t){const n=t?t.split(","):[];n.push("sans-serif");const h=n.map((f=>/[-\w]+/.test(f)?f:`'${CSS.escape(f)}'`)).join(",");return new Hr.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:h,fontWeight:this._fontWeight(n[0]),fontStyle:this._fontStyle(n[0]),lang:this.lang})}_fontStyle(t){return/italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){const n={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950};let h;for(const[f,x]of Object.entries(n))new RegExp(`\\b${f}\\b`,"i").test(t)&&(h=`${x}`);return h}destroy(){for(const t in this.entries){const n=this.entries[t];n.tinySDF&&(n.tinySDF=null),n.ideographTinySDF&&(n.ideographTinySDF=null),n.glyphs={},n.requests={},n.ranges={}}this.entries={}}}Hr.loadGlyphRange=function(y,t,n,h){return p._(this,void 0,void 0,(function*(){const f=256*t,x=f+255,T=h.transformRequest(n.replace("{fontstack}",y).replace("{range}",`${f}-${x}`),"Glyphs"),C=yield p.n(T,new AbortController);if(!C||!C.data)throw new Error(`Could not load glyph range. range: ${t}, ${f}-${x}`);const D={};for(const B of p.o(C.data))D[B.id]=B;return D}))},Hr.TinySDF=class{constructor({fontSize:y=24,buffer:t=3,radius:n=8,cutoff:h=.25,fontFamily:f="sans-serif",fontWeight:x="normal",fontStyle:T="normal",lang:C=null}={}){this.buffer=t,this.cutoff=h,this.radius=n,this.lang=C;const D=this.size=y+4*t,B=this._createCanvas(D),N=this.ctx=B.getContext("2d",{willReadFrequently:!0});N.font=`${T} ${x} ${y}px ${f}`,N.textBaseline="alphabetic",N.textAlign="left",N.fillStyle="black",this.gridOuter=new Float64Array(D*D),this.gridInner=new Float64Array(D*D),this.f=new Float64Array(D),this.z=new Float64Array(D+1),this.v=new Uint16Array(D)}_createCanvas(y){const t=document.createElement("canvas");return t.width=t.height=y,t}draw(y){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:h,actualBoundingBoxLeft:f,actualBoundingBoxRight:x}=this.ctx.measureText(y),T=Math.ceil(n),C=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(x-f))),D=Math.min(this.size-this.buffer,T+Math.ceil(h)),B=C+2*this.buffer,N=D+2*this.buffer,G=Math.max(B*N,0),U=new Uint8ClampedArray(G),$={data:U,width:B,height:N,glyphWidth:C,glyphHeight:D,glyphTop:T,glyphLeft:0,glyphAdvance:t};if(C===0||D===0)return $;const{ctx:ie,buffer:he,gridInner:Ae,gridOuter:ce}=this;this.lang&&(ie.lang=this.lang),ie.clearRect(he,he,C,D),ie.fillText(y,he,he+T);const ye=ie.getImageData(he,he,C,D);ce.fill(Sn,0,G),Ae.fill(0,0,G);for(let Pe=0;Pe<D;Pe++)for(let _e=0;_e<C;_e++){const we=ye.data[4*(Pe*C+_e)+3]/255;if(we===0)continue;const Ce=(Pe+he)*B+_e+he;if(we===1)ce[Ce]=0,Ae[Ce]=Sn;else{const be=.5-we;ce[Ce]=be>0?be*be:0,Ae[Ce]=be<0?be*be:0}}Cn(ce,0,0,B,N,B,this.f,this.v,this.z),Cn(Ae,he,he,C,D,B,this.f,this.v,this.z);for(let Pe=0;Pe<G;Pe++){const _e=Math.sqrt(ce[Pe])-Math.sqrt(Ae[Pe]);U[Pe]=Math.round(255-255*(_e/this.radius+this.cutoff))}return $}};class ti{constructor(){this.specification=p.u.light.position}possiblyEvaluate(t,n){return p.F(t.expression.evaluate(n))}interpolate(t,n,h){return{x:p.G.number(t.x,n.x,h),y:p.G.number(t.y,n.y,h),z:p.G.number(t.z,n.z,h)}}}let Oi;class Yt extends p.E{constructor(t){super(),Oi=Oi||new p.t({anchor:new p.D(p.u.light.anchor),position:new ti,color:new p.D(p.u.light.color),intensity:new p.D(p.u.light.intensity)}),this._transitionable=new p.x(Oi,void 0),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(p.y,t,n))for(const h in t){const f=t[h];h.endsWith(p.z)?this._transitionable.setTransition(h.slice(0,-p.z.length),f):this._transitionable.setValue(h,f)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,h){return(!h||h.validate!==!1)&&p.B(this,t.call(p.C,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:p.u}))}}const Ni=new p.t({"sky-color":new p.D(p.u.sky["sky-color"]),"horizon-color":new p.D(p.u.sky["horizon-color"]),"fog-color":new p.D(p.u.sky["fog-color"]),"fog-ground-blend":new p.D(p.u.sky["fog-ground-blend"]),"horizon-fog-blend":new p.D(p.u.sky["horizon-fog-blend"]),"sky-horizon-blend":new p.D(p.u.sky["sky-horizon-blend"]),"atmosphere-blend":new p.D(p.u.sky["atmosphere-blend"])});class Mr extends p.E{constructor(t){super(),this._transitionable=new p.x(Ni,void 0),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new p.H(0))}setSky(t,n={}){if(!this._validate(p.J,t,n)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const h in t){const f=t[h];h.endsWith(p.z)?this._transitionable.setTransition(h.slice(0,-p.z.length),f):this._transitionable.setValue(h,f)}}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,h={}){return(h==null?void 0:h.validate)!==!1&&p.B(this,t.call(p.C,p.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:p.u})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class Wr{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const h=t.join(",")+String(n);return this.dashEntry[h]||(this.dashEntry[h]=this.addDash(t,n)),this.dashEntry[h]}getDashRanges(t,n,h){const f=[];let x=t.length%2==1?-t[t.length-1]*h:0,T=t[0]*h,C=!0;f.push({left:x,right:T,isDash:C,zeroLength:t[0]===0});let D=t[0];for(let B=1;B<t.length;B++){C=!C;const N=t[B];x=D*h,D+=N,T=D*h,f.push({left:x,right:T,isDash:C,zeroLength:N===0})}return f}addRoundDash(t,n,h){const f=n/2;for(let x=-h;x<=h;x++){const T=this.width*(this.nextRow+h+x);let C=0,D=t[C];for(let B=0;B<this.width;B++){B/D.right>1&&(D=t[++C]);const N=Math.abs(B-D.left),G=Math.abs(B-D.right),U=Math.min(N,G);let $;const ie=x/h*(f+1);if(D.isDash){const he=f-Math.abs(ie);$=Math.sqrt(U*U+he*he)}else $=f-Math.sqrt(U*U+ie*ie);this.data[T+B]=Math.max(0,Math.min(255,$+128))}}}addRegularDash(t){for(let C=t.length-1;C>=0;--C){const D=t[C],B=t[C+1];D.zeroLength?t.splice(C,1):B&&B.isDash===D.isDash&&(B.left=D.left,t.splice(C,1))}const n=t[0],h=t[t.length-1];n.isDash===h.isDash&&(n.left=h.left-this.width,h.right=n.right+this.width);const f=this.width*this.nextRow;let x=0,T=t[x];for(let C=0;C<this.width;C++){C/T.right>1&&(T=t[++x]);const D=Math.abs(C-T.left),B=Math.abs(C-T.right),N=Math.min(D,B);this.data[f+C]=Math.max(0,Math.min(255,(T.isDash?N:-N)+128))}}addDash(t,n){const h=n?7:0,f=2*h+1;if(this.nextRow+f>this.height)return p.w("LineAtlas out of space"),null;let x=0;for(let C=0;C<t.length;C++)x+=t[C];if(x!==0){const C=this.width/x,D=this.getDashRanges(t,this.width,C);n?this.addRoundDash(D,C,h):this.addRegularDash(D)}const T={y:this.nextRow+h,height:2*h,width:x};return this.nextRow+=f,this.dirty=!0,T}bind(t){const n=t.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}const or="maplibre_preloaded_worker_pool";class xi{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<xi.workerCount;)this.workers.push(new Worker(p.c.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach((n=>{n.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[or]}numActive(){return Object.keys(this.active).length}}const Ai=Math.floor(zr.hardwareConcurrency/2);let hn,Er;function yo(){return hn||(hn=new xi),hn}xi.workerCount=p.K(globalThis)?Math.max(Math.min(Ai,3),1):1;class us{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=n;const h=this.workerPool.acquire(n);for(let f=0;f<h.length;f++){const x=new p.L(h[f],n);x.name=`Worker ${f}`,this.actors.push(x)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n){const h=[];for(const f of this.actors)h.push(f.sendAsync({type:t,data:n}));return Promise.all(h)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach((n=>{n.remove()})),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,n){for(const h of this.actors)h.registerMessageHandler(t,n)}unregisterMessageHandler(t){for(const n of this.actors)n.unregisterMessageHandler(t)}}function No(){return Er||(Er=new us(yo(),p.M),Er.registerMessageHandler("GR",((y,t,n)=>p.m(t,n)))),Er}function In(y,t){const n=p.N();return p.O(n,n,[1,1,0]),p.Q(n,n,[.5*y.width,.5*y.height,1]),y.calculatePosMatrix?p.S(n,n,y.calculatePosMatrix(t.toUnwrapped())):n}function Vo(y,t,n,h,f,x,T){var C;const D=(function(U,$,ie){if(U)for(const he of U){const Ae=$[he];if(Ae&&Ae.source===ie&&Ae.type==="fill-extrusion")return!0}else for(const he in $){const Ae=$[he];if(Ae.source===ie&&Ae.type==="fill-extrusion")return!0}return!1})((C=f==null?void 0:f.layers)!==null&&C!==void 0?C:null,t,y.id),B=x.maxPitchScaleFactor(),N=y.tilesIn(h,B,D);N.sort(en);const G=[];for(const U of N)G.push({wrappedTileID:U.tileID.wrapped().key,queryResults:U.tile.queryRenderedFeatures(t,n,y.getState(),U.queryGeometry,U.cameraQueryGeometry,U.scale,f,x,B,In(x,U.tileID),T?($,ie)=>T(U.tileID,$,ie):void 0)});return(function(U,$){for(const ie in U)for(const he of U[ie])hs(he,$);return U})((function(U){const $={},ie={};for(const he of U){const Ae=he.queryResults,ce=he.wrappedTileID,ye=ie[ce]=ie[ce]||{};for(const Pe in Ae){const _e=Ae[Pe],we=ye[Pe]=ye[Pe]||{},Ce=$[Pe]=$[Pe]||[];for(const be of _e)we[be.featureIndex]||(we[be.featureIndex]=!0,Ce.push(be))}}return $})(G),y)}function en(y,t){const n=y.tileID,h=t.tileID;return n.overscaledZ-h.overscaledZ||n.canonical.y-h.canonical.y||n.wrap-h.wrap||n.canonical.x-h.canonical.x}function hs(y,t){const n=y.feature,h=t.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=h}function Is(y,t,n){return p._(this,void 0,void 0,(function*(){let h=y;if(y.url?h=(yield p.j(t.transformRequest(y.url,"Source"),n)).data:yield zr.frameAsync(n),!h)return null;const f=p.U(p.e(h,y),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in h&&h.vector_layers&&(f.vectorLayerIds=h.vector_layers.map((x=>x.id))),f}))}class Ui{constructor(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof p.V?new p.V(t.lng,t.lat):p.V.convert(t),this}setSouthWest(t){return this._sw=t instanceof p.V?new p.V(t.lng,t.lat):p.V.convert(t),this}extend(t){const n=this._sw,h=this._ne;let f,x;if(t instanceof p.V)f=t,x=t;else{if(!(t instanceof Ui))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(Ui.convert(t)):this.extend(p.V.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(p.V.convert(t)):this;if(f=t._sw,x=t._ne,!f||!x)return this}return n||h?(n.lng=Math.min(f.lng,n.lng),n.lat=Math.min(f.lat,n.lat),h.lng=Math.max(x.lng,h.lng),h.lat=Math.max(x.lat,h.lat)):(this._sw=new p.V(f.lng,f.lat),this._ne=new p.V(x.lng,x.lat)),this}getCenter(){return new p.V((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 p.V(this.getWest(),this.getNorth())}getSouthEast(){return new p.V(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:n,lat:h}=p.V.convert(t);let f=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(f=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=h&&h<=this._ne.lat&&f}intersects(t){if(!((t=Ui.convert(t)).getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;const n=Math.abs(this.getEast()-this.getWest()),h=Math.abs(t.getEast()-t.getWest());if(n>=360||h>=360)return!0;const f=p.W(this.getWest(),-180,180),x=p.W(this.getEast(),-180,180),T=p.W(t.getWest(),-180,180),C=p.W(t.getEast(),-180,180),D=f>=x,B=T>=C;return!(!D||!B)||(D?C>=f||T<=x:B?x>=T||f<=C:T<=x&&C>=f)}static convert(t){return t instanceof Ui?t:t&&new Ui(t)}static fromLngLat(t,n=0){const h=360*n/40075017,f=h/Math.cos(Math.PI/180*t.lat);return new Ui(new p.V(t.lng-f,t.lat-h),new p.V(t.lng+f,t.lat+h))}adjustAntiMeridian(){const t=new p.V(this._sw.lng,this._sw.lat),n=new p.V(this._ne.lng,this._ne.lat);return new Ui(t,t.lng>n.lng?new p.V(n.lng+360,n.lat):n)}}class Dn{constructor(t,n,h){this.bounds=Ui.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=h||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[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(t){const n=Math.pow(2,t.z),h=Math.floor(p.Y(this.bounds.getWest())*n),f=Math.floor(p.X(this.bounds.getNorth())*n),x=Math.ceil(p.Y(this.bounds.getEast())*n),T=Math.ceil(p.X(this.bounds.getSouth())*n);return t.x>=h&&t.x<x&&t.y>=f&&t.y<T}}class jo extends p.E{constructor(t,n,h,f){if(super(),this.id=t,this.dispatcher=h,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,p.e(this,p.U(n,["url","scheme","tileSize","promoteId","encoding"])),this._options=p.e({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(f)}load(){return p._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new p.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield Is(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.tileManagers[this.id].clearTiles(),t&&(p.e(this,t),t.bounds&&(this.tileBounds=new Dn(t.bounds,this.minzoom,this.maxzoom)),this.fire(new p.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new p.l("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,p.Z(t)||this.fire(new p.k(t))}}))}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.abort(),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.abort(),this._tileJSONRequest=null)}serialize(){return p.e({},this._options)}loadTile(t){return p._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),h={request:this.map._requestManager.transformRequest(n,"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,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:this._getOverzoomParameters(t)};h.request.collectResourceTiming=this._collectResourceTiming;let f="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise(((x,T)=>{t.reloadPromise={resolve:x,reject:T}}))}else t.actor=this.dispatcher.getActor(),f="LT";t.abortController=new AbortController;try{const x=yield t.actor.sendAsync({type:f,data:h},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,x)}catch(x){if(delete t.abortController,t.aborted)return;if(x&&x.status!==404)throw x;this._afterTileLoadWorkerResponse(t,null)}}))}_getOverzoomParameters(t){if(t.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;const n=t.tileID.scaledTo(this.maxzoom).canonical,h=n.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:n,overzoomRequest:this.map._requestManager.transformRequest(h,"Tile")}}_afterTileLoadWorkerResponse(t,n){if(n&&n.resourceTiming&&(t.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&t.setExpiryData(n),t.loadVectorData(n,this.map.painter),t.reloadPromise){const h=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(h.resolve).catch(h.reject)}}abortTile(t){return p._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}unloadTile(t){return p._(this,void 0,void 0,(function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class Zo extends p.E{constructor(t,n,h,f){super(),this.id=t,this.dispatcher=h,this.setEventedParent(f),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=p.e({type:"raster"},n),p.e(this,p.U(n,["url","scheme","tileSize"]))}load(){return p._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new p.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const n=yield Is(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,n&&(p.e(this,n),n.bounds&&(this.tileBounds=new Dn(n.bounds,this.minzoom,this.maxzoom)),this.fire(new p.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new p.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(n){this._tileJSONRequest=null,this._loaded=!0,p.Z(n)||this.fire(new p.k(n))}}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}serialize(){return p.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return p._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const h=yield En.getImage(this.map._requestManager.transformRequest(n,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(h&&h.data){this.map._refreshExpiredTiles&&(h.cacheControl||h.expires)&&t.setExpiryData({cacheControl:h.cacheControl,expires:h.expires});const f=this.map.painter.context,x=f.gl,T=h.data;t.texture=this.map.painter.getTileTexture(T.width),t.texture?t.texture.update(T,{useMipmap:!0}):(t.texture=new p.T(f,T,x.RGBA,{useMipmap:!0}),t.texture.bind(x.LINEAR,x.CLAMP_TO_EDGE,x.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(h){if(delete t.abortController,t.aborted)t.state="unloaded";else if(h)throw t.state="errored",h}}))}abortTile(t){return p._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)}))}unloadTile(t){return p._(this,void 0,void 0,(function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)}))}hasTransition(){return!1}}class tn extends Zo{constructor(t,n,h,f){super(t,n,h,f),this.type="raster-dem",this.maxzoom=22,this._options=p.e({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox",this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(t){return p._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),h=this.map._requestManager.transformRequest(n,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const f=yield En.getImage(h,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(f&&f.data){const x=f.data;this.map._refreshExpiredTiles&&(f.cacheControl||f.expires)&&t.setExpiryData({cacheControl:f.cacheControl,expires:f.expires});const T=p.b(x)&&p.$()?x:yield this.readImageNow(x),C={type:this.type,uid:t.uid,source:this.id,rawImageData:T,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||t.state==="expired"){t.actor=this.dispatcher.getActor();const D=yield t.actor.sendAsync({type:"LDT",data:C});t.dem=D,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}catch(f){if(delete t.abortController,t.aborted)t.state="unloaded";else if(f)throw t.state="errored",f}}))}readImageNow(t){return p._(this,void 0,void 0,(function*(){if(typeof VideoFrame<"u"&&p.a0()){const n=t.width+2,h=t.height+2;try{return new p.R({width:n,height:h},yield p.a1(t,-1,-1,n,h))}catch{}}return zr.getImageData(t,1)}))}_getNeighboringTiles(t){const n=t.canonical,h=Math.pow(2,n.z),f=(n.x-1+h)%h,x=n.x===0?t.wrap-1:t.wrap,T=(n.x+1+h)%h,C=n.x+1===h?t.wrap+1:t.wrap,D={};return D[new p.a2(t.overscaledZ,x,n.z,f,n.y).key]={backfilled:!1},D[new p.a2(t.overscaledZ,C,n.z,T,n.y).key]={backfilled:!1},n.y>0&&(D[new p.a2(t.overscaledZ,x,n.z,f,n.y-1).key]={backfilled:!1},D[new p.a2(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},D[new p.a2(t.overscaledZ,C,n.z,T,n.y-1).key]={backfilled:!1}),n.y+1<h&&(D[new p.a2(t.overscaledZ,x,n.z,f,n.y+1).key]={backfilled:!1},D[new p.a2(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},D[new p.a2(t.overscaledZ,C,n.z,T,n.y+1).key]={backfilled:!1}),D}unloadTile(t){return p._(this,void 0,void 0,(function*(){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&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))}))}}function Gn(y){return y.type==="GeometryCollection"?y.geometries.map((t=>t.coordinates)).flat(1/0):y.coordinates.flat(1/0)}function vo(y){const t=new Ui;let n;switch(y.type){case"FeatureCollection":n=y.features.map((h=>Gn(h.geometry))).flat(1/0);break;case"Feature":n=Gn(y.geometry);break;default:n=Gn(y)}if(n.length==0)return t;for(let h=0;h<n.length-1;h+=2)t.extend([n[h],n[h+1]]);return t}class Ds extends p.E{constructor(t,n,h,f){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:n.data},this.actor=h.getActor(),this.setEventedParent(f),this._data=typeof n.data=="string"?{url:n.data}:{geojson:n.data},this._options=p.e({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId,n.clusterMaxZoom!==void 0&&this.maxzoom<=n.clusterMaxZoom&&p.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${n.clusterMaxZoom}".`),this.workerOptions=p.e({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(n.buffer!==void 0?n.buffer:128),tolerance:this._pixelsToTileUnits(n.tolerance!==void 0?n.tolerance:.375),extent:p.a5,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(n.clusterMaxZoom),minPoints:Math.max(2,n.clusterMinPoints||2),extent:p.a5,radius:this._pixelsToTileUnits(n.clusterRadius||50),log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.optionsChanged}_pixelsToTileUnits(t){return t*(p.a5/this.tileSize)}_getClusterMaxZoom(t){const n=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||t===void 0||p.w(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${n}"`),n}load(){return p._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(t){this.map=t,this.load()}setData(t,n){this._data=typeof t=="string"?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t};const h=this._updateWorkerData();return n?h:this}updateData(t,n){this._pendingWorkerUpdate.diff=p.a6(this._pendingWorkerUpdate.diff,t);const h=this._updateWorkerData();return n?h:this}getData(){return p._(this,void 0,void 0,(function*(){const t=p.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:t})}))}getBounds(){return p._(this,void 0,void 0,(function*(){return vo(yield this.getData())}))}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),t.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.optionsChanged=!0,this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,n,h){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:n,offset:h}})}_updateWorkerData(){return p._(this,void 0,void 0,(function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void p.w(`No pending worker updates for GeoJSONSource ${this.id}.`);const{data:t,diff:n}=this._pendingWorkerUpdate,h=p.e({type:this.type},this.workerOptions);t!==void 0?(typeof t=="string"?(h.request=this.map._requestManager.transformRequest(zr.resolveURL(t),"Source"),h.request.collectResourceTiming=this._collectResourceTiming):h.data=t,this._pendingWorkerUpdate.data=void 0):n&&(h.dataDiff=n,this._pendingWorkerUpdate.diff=void 0),this._pendingWorkerUpdate.optionsChanged=void 0,this._isUpdatingWorker=!0,this.fire(new p.l("dataloading",{dataType:"source"}));try{const f=yield this.actor.sendAsync({type:"LD",data:h});if(this._isUpdatingWorker=!1,this._removed||f.abandoned)return void this.fire(new p.l("dataabort",{dataType:"source"}));f.data&&(this._data={geojson:f.data});const x=this._applyDiffToSource(n),T=this._getShouldReloadTileOptions(x);let C=null;f.resourceTiming&&f.resourceTiming[this.id]&&(C=f.resourceTiming[this.id].slice(0));const D={dataType:"source"};this._collectResourceTiming&&C&&C.length>0&&p.e(D,{resourceTiming:C}),this.fire(new p.l("data",Object.assign(Object.assign({},D),{sourceDataType:"metadata"}))),this.fire(new p.l("data",Object.assign(Object.assign({},D),{sourceDataType:"content",shouldReloadTileOptions:T})))}catch(f){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new p.l("dataabort",{dataType:"source"}));this.fire(new p.k(f))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}}))}_applyDiffToSource(t){if(!t)return;const n=typeof this.promoteId=="string"?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){const f=p.a7(this._data.geojson,n);if(!f)throw new Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:f}}if(!this._data.updateable)return;const h=p.a8(this._data.updateable,t,n);return t.removeAll||this._options.cluster?void 0:h}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map((n=>vo(n)))}}shouldReloadTile(t,{affectedBounds:n}){if(t.state==="loading")return!0;if(t.state==="unloaded")return!1;const{buffer:h,extent:f}=this.workerOptions.geojsonVtOptions,x=(function({x:T,y:C,z:D},B=0){const N=p.a3((T-B)/Math.pow(2,D)),G=p.a4((C+1+B)/Math.pow(2,D)),U=p.a3((T+1+B)/Math.pow(2,D)),$=p.a4((C-B)/Math.pow(2,D));return new Ui([N,G],[U,$])})(t.tileID.canonical,h/f);for(const T of n)if(x.intersects(T))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(t){return p._(this,void 0,void 0,(function*(){const n=t.actor?"RT":"LT";t.actor=this.actor;const h={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,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};t.abortController=new AbortController;const f=yield this.actor.sendAsync({type:n,data:h},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(f,this.map.painter,n==="RT")}))}abortTile(t){return p._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0}))}unloadTile(t){return p._(this,void 0,void 0,(function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return p.e({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}}class mn extends p.E{constructor(t,n,h,f){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=h,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(f),this.options=n}load(t){return p._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new p.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const n=yield En.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,t&&(this.coordinates=t),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,p.Z(n)||this.fire(new p.k(n))}}))}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally((()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new p.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(p.a9.fromLngLat);var h;return this.tileID=(function(f){const x=p.aa.fromPoints(f),T=x.width(),C=x.height(),D=Math.max(T,C),B=Math.max(0,Math.floor(-Math.log(D)/Math.LN2)),N=Math.pow(2,B);return new p.ac(B,Math.floor((x.minX+x.maxX)/2*N),Math.floor((x.minY+x.maxY)/2*N))})(n),this.terrainTileRanges=this._getOverlappingTileRanges(n),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=n.map((f=>this.tileID.getTilePoint(f)._round())),this.flippedWindingOrder=((h=this.tileCoords)[1].x-h[0].x)*(h[2].y-h[0].y)-(h[1].y-h[0].y)*(h[2].x-h[0].x)<0,this.fire(new p.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.texture||(this.texture=new p.T(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let h=!1;for(const f in this.tiles){const x=this.tiles[f];x.state!=="loaded"&&(x.state="loaded",x.texture=this.texture,h=!0)}h&&this.fire(new p.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return p._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(t){const{minX:n,minY:h,maxX:f,maxY:x}=p.aa.fromPoints(t),T={};for(let C=0;C<=p.ab;C++){const D=Math.pow(2,C),B=Math.floor(n*D),N=Math.floor(h*D),G=Math.floor(f*D),U=Math.floor(x*D),$=(B%D+D)%D,ie=G%D,he=Math.floor(B/D),Ae=Math.floor(G/D);T[C]={minWrap:he,maxWrap:Ae,minTileXWrapped:$,maxTileXWrapped:ie,minTileY:N,maxTileY:U}}return T}}class Ne extends mn{constructor(t,n,h,f){super(t,n,h,f),this.roundZoom=!0,this.type="video",this.options=n}load(){return p._(this,void 0,void 0,(function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,"Source").url);try{const n=yield p.ad(this.urls);if(this._loaded=!0,!n)return;this.video=n,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading()}catch(n){this.fire(new p.k(n))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new p.k(new p.ae(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,n=t.gl;this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new p.T(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let h=!1;for(const f in this.tiles){const x=this.tiles[f];x.state!=="loaded"&&(x.state="loaded",x.texture=this.texture,h=!0)}h&&this.fire(new p.l("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 ee extends mn{constructor(t,n,h,f){super(t,n,h,f),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some((x=>!Array.isArray(x)||x.length!==2||x.some((T=>typeof T!="number"))))||this.fire(new p.k(new p.ae(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new p.k(new p.ae(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new p.k(new p.ae(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new p.k(new p.ae(`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 p.k(new p.ae(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return p._(this,void 0,void 0,(function*(){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 p.k(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 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()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,h=n.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new p.T(n,this.canvas,h.RGBA,{premultiply:!0}),this.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE));let f=!1;for(const x in this.tiles){const T=this.tiles[x];T.state!=="loaded"&&(T.state="loaded",T.texture=this.texture,f=!0)}f&&this.fire(new p.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.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 K={},le=y=>{switch(y){case"geojson":return Ds;case"image":return mn;case"raster":return Zo;case"raster-dem":return tn;case"vector":return jo;case"video":return Ne;case"canvas":return ee}return K[y]},Me="RTLPluginLoaded";class Se extends p.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=No()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch((n=>{throw this.status="error",n}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return p._(this,arguments,void 0,(function*(n,h=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=zr.resolveURL(n),!this.url)throw new Error(`requested url ${n} is invalid`);if(this.status==="unavailable"){if(!h)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()}))}_requestImport(){return p._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new p.l(Me))}))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Ge=null;function Fe(){return Ge||(Ge=new Se),Ge}var ke,Qe;(function(y){y[y.Base=0]="Base",y[y.Parent=1]="Parent"})(ke||(ke={})),(function(y){y[y.Departing=0]="Departing",y[y.Incoming=1]="Incoming"})(Qe||(Qe={}));class ft{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=p.af(),this.uses=0,this.tileSize=n,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"}isRenderable(t){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:n,fadingParentID:h,fadeEndTime:f}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=n,this.fadingParentID=h,this.fadeEndTime=f}setSelfFadeLogic(t){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=t}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=Gt(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,n,h){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData,this.latestFeatureIndex.encoding=t.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=(function(f,x){const T={};if(!x)return T;for(const C of f){const D=C.layerIds.map((B=>x.getLayer(B))).filter(Boolean);if(D.length!==0){C.layers=D,C.stateDependentLayerIds&&(C.stateDependentLayers=C.stateDependentLayerIds.map((B=>D.filter((N=>N.id===B))[0])));for(const B of D)T[B.id]=C}}return T})(t.buckets,n==null?void 0:n.style),this.hasSymbolBuckets=!1;for(const f in this.buckets){const x=this.buckets[f];if(x instanceof p.ah){if(this.hasSymbolBuckets=!0,!h)break;x.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const f in this.buckets){const x=this.buckets[f];if(x instanceof p.ah&&x.hasRTLText){this.hasRTLText=!0,Fe().lazyLoad();break}}this.queryPadding=0;for(const f in this.buckets){const x=this.buckets[f];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(f).queryRadius(x))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions}else this.collisionBoxArray=new p.ag}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.dashPositions&&(this.dashPositions=null),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const h in this.buckets){const f=this.buckets[h];f.uploadPending()&&f.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new p.T(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new p.T(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,h,f,x,T,C,D,B,N,G){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:f,cameraQueryGeometry:x,scale:T,tileSize:this.tileSize,pixelPosMatrix:N,transform:D,params:C,queryPadding:this.queryPadding*B,getElevation:G},t,n,h):{}}querySourceFeatures(t,n){const h=this.latestFeatureIndex;if(!h||!h.rawTileData)return;const f=h.loadVTLayers(),x=n&&n.sourceLayer?n.sourceLayer:"",T=f[p.ai]||f[x];if(!T)return;const C=p.aj(n==null?void 0:n.filter,n==null?void 0:n.globalState),{z:D,x:B,y:N}=this.tileID.canonical,G={z:D,x:B,y:N};for(let U=0;U<T.length;U++){const $=T.feature(U);if(C.needGeometry){const Ae=p.ak($,!0);if(!C.filter(new p.H(this.tileID.overscaledZ),Ae,this.tileID.canonical))continue}else if(!C.filter(new p.H(this.tileID.overscaledZ),$))continue;const ie=h.getId($,x),he=new p.al($,D,B,N,ie);he.tile=G,t.push(he)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const h=p.am(t.cacheControl);h["max-age"]&&(this.expirationTime=Date.now()+1e3*h["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const h=Date.now();let f=!1;if(this.expirationTime>h)f=!1;else if(n)if(this.expirationTime<n)f=!0;else{const x=this.expirationTime-n;x?this.expirationTime=h+Math.max(x,3e4):f=!0}else f=!0;f?(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,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const h=this.latestFeatureIndex.loadVTLayers();for(const f in this.buckets){if(!n.style.hasLayer(f))continue;const x=this.buckets[f],T=x.layers[0].sourceLayer||p.ai,C=h[T],D=t[T];if(!C||!D||Object.keys(D).length===0)continue;x.update(D,C,this.imageAtlas&&this.imageAtlas.patternPositions||{},this.dashPositions||{});const B=n&&n.style&&n.style.getLayer(f);B&&(this.queryPadding=Math.max(this.queryPadding,B.queryRadius(x)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Gt()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=Gt()+t}setDependencies(t,n){const h={};for(const f of n)h[f]=!0;this.dependencies[t]=h}hasDependency(t,n){for(const h of t){const f=this.dependencies[h];if(f){for(const x of n)if(f[x])return!0}}return!1}}class ot{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,h){const f=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][f]=this.stateChanges[t][f]||{},p.e(this.stateChanges[t][f],h),this.deletedStates[t]===null){this.deletedStates[t]={};for(const x in this.state[t])x!==f&&(this.deletedStates[t][x]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][f]===null){this.deletedStates[t][f]={};for(const x in this.state[t][f])h[x]||(this.deletedStates[t][f][x]=null)}else for(const x in h)this.deletedStates[t]&&this.deletedStates[t][f]&&this.deletedStates[t][f][x]===null&&delete this.deletedStates[t][f][x]}removeFeatureState(t,n,h){if(this.deletedStates[t]===null)return;const f=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},h&&n!==void 0)this.deletedStates[t][f]!==null&&(this.deletedStates[t][f]=this.deletedStates[t][f]||{},this.deletedStates[t][f][h]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][f])for(h in this.deletedStates[t][f]={},this.stateChanges[t][f])this.deletedStates[t][f][h]=null;else this.deletedStates[t][f]=null;else this.deletedStates[t]=null}getState(t,n){const h=String(n),f=p.e({},(this.state[t]||{})[h],(this.stateChanges[t]||{})[h]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const x=this.deletedStates[t][n];if(x===null)return{};for(const T in x)delete f[T]}return f}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const h={};for(const f in this.stateChanges){this.state[f]=this.state[f]||{};const x={};for(const T in this.stateChanges[f])this.state[f][T]||(this.state[f][T]={}),p.e(this.state[f][T],this.stateChanges[f][T]),x[T]=this.state[f][T];h[f]=x}for(const f in this.deletedStates){this.state[f]=this.state[f]||{};const x={};if(this.deletedStates[f]===null)for(const T in this.state[f])x[T]={},this.state[f][T]={};else for(const T in this.deletedStates[f]){if(this.deletedStates[f][T]===null)this.state[f][T]={};else for(const C of Object.keys(this.deletedStates[f][T]))delete this.state[f][T][C];x[T]=this.state[f][T]}h[f]=h[f]||{},p.e(h[f],x)}this.stateChanges={},this.deletedStates={},Object.keys(h).length!==0&&t.setFeatureState(h,n)}}const St=89.25;function je(y,t){const n=p.an(t.lat,-p.ao,p.ao);return new p.P(p.Y(t.lng)*y,p.X(n)*y)}function Xt(y,t){return new p.a9(t.x/y,t.y/y).toLngLat()}function Gi(y){return y.cameraToCenterDistance*Math.min(.85*Math.tan(p.ap(90-y.pitch)),Math.tan(p.ap(St-y.pitch)))}function Bi(y,t){const n=y.canonical,h=t/p.aq(n.z),f=n.x+Math.pow(2,n.z)*y.wrap,x=p.ar(new Float64Array(16));return p.O(x,x,[f*h,n.y*h,0]),p.Q(x,x,[h/p.a5,h/p.a5,1]),x}function qe(y,t,n,h,f){const x=p.a9.fromLngLat(y,t),T=f*p.as(1,y.lat),{x:C,y:D,z:B}=Hi(n,h);return new p.a9(x.x+T*-C,x.y+T*-D,x.z+T*-B)}function Hi(y,t){const n=p.ap(y),h=p.ap(t),f=Math.cos(-n),x=Math.sin(n);return{x:x*Math.sin(h),y:-x*Math.cos(h),z:f}}function rn(y,t,n){const h=t.intersectsFrustum(y);if(!n||h===0)return h;const f=t.intersectsPlane(n);return f===0?0:h===2&&f===2?2:1}function Kt(y,t,n){let h=0;const f=(n-t)/10;for(let x=0;x<10;x++)h+=f*Math.pow(Math.cos(t+(x+.5)/10*(n-t)),y);return h}function qi(y,t){return function(n,h,f,x,T){const C=2*((y-1)/p.at(Math.cos(p.ap(St-T))/Math.cos(p.ap(St)))-1),D=Math.acos(f/x),B=2*Kt(C-1,0,p.ap(T/2)),N=Math.min(p.ap(St),D+p.ap(T/2)),G=Kt(C-1,Math.min(N,D-p.ap(T/2)),N),U=Math.atan(h/f),$=Math.hypot(h,f);let ie=n;return ie+=p.at(x/$/Math.max(.5,Math.cos(p.ap(T/2)))),ie+=C*p.at(Math.cos(U))/2,ie-=p.at(Math.max(1,G/B/t))/2,ie}}const Vr=qi(9.314,3);function Wi(y,t){const n=(t.roundZoom?Math.round:Math.floor)(y.zoom+p.at(y.tileSize/t.tileSize));return Math.max(0,n)}function er(y,t){const n=y.getCameraFrustum(),h=y.getClippingPlane(),f=y.screenPointToMercatorCoordinate(y.getCameraPoint()),x=p.a9.fromLngLat(y.center,y.elevation);f.z=x.z+Math.cos(y.pitchInRadians)*y.cameraToCenterDistance/y.worldSize;const T=y.getCoveringTilesDetailsProvider(),C=T.allowVariableZoom(y,t),D=Wi(y,t),B=t.minzoom||0,N=t.maxzoom!==void 0?t.maxzoom:y.maxZoom,G=Math.min(Math.max(0,D),N),U=Math.pow(2,G),$=[U*f.x,U*f.y,0],ie=[U*x.x,U*x.y,0],he=Math.hypot(x.x-f.x,x.y-f.y),Ae=Math.abs(x.z-f.z),ce=Math.hypot(he,Ae),ye=we=>({zoom:0,x:0,y:0,wrap:we,fullyVisible:!1}),Pe=[],_e=[];if(y.renderWorldCopies&&T.allowWorldCopies())for(let we=1;we<=3;we++)Pe.push(ye(-we)),Pe.push(ye(we));for(Pe.push(ye(0));Pe.length>0;){const we=Pe.pop(),Ce=we.x,be=we.y;let Le=we.fullyVisible;const Ke={x:Ce,y:be,z:we.zoom},He=T.getTileBoundingVolume(Ke,we.wrap,y.elevation,t);if(!Le){const wt=rn(n,He,h);if(wt===0)continue;Le=wt===2}const $e=T.distanceToTile2d(f.x,f.y,Ke,He);let Ye=D;C&&(Ye=(t.calculateTileZoom||Vr)(y.zoom+p.at(y.tileSize/t.tileSize),$e,Ae,ce,y.fov)),Ye=(t.roundZoom?Math.round:Math.floor)(Ye),Ye=Math.max(0,Ye);const xt=Math.min(Ye,N);if(we.wrap=T.getWrap(x,Ke,we.wrap),we.zoom>=xt){if(we.zoom<B)continue;const wt=G-we.zoom,pt=$[0]-.5-(Ce<<wt),Pt=$[1]-.5-(be<<wt),mi=t.reparseOverscaled?Math.max(we.zoom,Ye):we.zoom;_e.push({tileID:new p.a2(we.zoom===N?mi:we.zoom,we.wrap,we.zoom,Ce,be),distanceSq:p.au([ie[0]-.5-Ce,ie[1]-.5-be]),tileDistanceToCamera:Math.sqrt(pt*pt+Pt*Pt)})}else for(let wt=0;wt<4;wt++)Pe.push({zoom:we.zoom+1,x:(Ce<<1)+wt%2,y:(be<<1)+(wt>>1),wrap:we.wrap,fullyVisible:Le})}return _e.sort(((we,Ce)=>we.distanceSq-Ce.distanceSq)).map((we=>we.tileID))}const Ve=p.aa.fromPoints([new p.P(0,0),new p.P(p.a5,p.a5)]);function at(y){return y==="raster"||y==="image"||y==="video"}function It(y,t,n,h,f,x,T){if(!t.hasData())return!1;const{tileID:C,fadingRole:D,fadingDirection:B,fadingParentID:N}=t;if(D===ke.Base&&B===Qe.Incoming&&N)return n[N.key]=N,!0;const G=Math.max(C.overscaledZ-f,x);for(let U=C.overscaledZ-1;U>=G;U--){const $=C.scaledTo(U),ie=y.getLoadedTile($);if(ie)return t.setCrossFadeLogic({fadingRole:ke.Base,fadingDirection:Qe.Incoming,fadingParentID:ie.tileID,fadeEndTime:h+T}),ie.setCrossFadeLogic({fadingRole:ke.Parent,fadingDirection:Qe.Departing,fadeEndTime:h+T}),n[$.key]=$,!0}return!1}function At(y,t,n,h,f,x){if(!t.hasData())return!1;const T=t.tileID.children(f);let C=o(y,t,T,n,h,f,x);if(C)return!0;for(const D of T)o(y,t,D.children(f),n,h,f,x)&&(C=!0);return C}function o(y,t,n,h,f,x,T){if(n[0].overscaledZ>=x)return!1;let C=!1;for(const D of n){const B=y.getLoadedTile(D);if(!B)continue;const{fadingRole:N,fadingDirection:G,fadingParentID:U}=B;N===ke.Base&&G===Qe.Departing&&U||(B.setCrossFadeLogic({fadingRole:ke.Base,fadingDirection:Qe.Departing,fadingParentID:t.tileID,fadeEndTime:f+T}),t.setCrossFadeLogic({fadingRole:ke.Parent,fadingDirection:Qe.Incoming,fadeEndTime:f+T})),h[D.key]=D,C=!0}return C}function X(y,t,n,h){const f=y.tileID;return!!y.selfFading||!y.hasData()&&!!t.has(f)&&(y.setSelfFadeLogic(n+h),!0)}function ii(y,t){var n;y.needsHillshadePrepare=!0,y.needsTerrainPrepare=!0;let h=t.tileID.canonical.x-y.tileID.canonical.x;const f=t.tileID.canonical.y-y.tileID.canonical.y,x=Math.pow(2,y.tileID.canonical.z),T=t.tileID.key;h===0&&f===0||Math.abs(f)>1||(Math.abs(h)>1&&(Math.abs(h+x)===1?h+=x:Math.abs(h-x)===1&&(h-=x)),t.dem&&y.dem&&(y.dem.backfillBorder(t.dem,h,f),!((n=y.neighboringTiles)===null||n===void 0)&&n[T]&&(y.neighboringTiles[T].backfilled=!0)))}class Ri{constructor(){this._tiles={}}handleWrapJump(t){const n={};for(const h in this._tiles){const f=this._tiles[h];f.tileID=f.tileID.unwrapTo(f.tileID.wrap+t),n[f.tileID.key]=f}this._tiles=n}setFeatureState(t,n){for(const h in this._tiles)this._tiles[h].setFeatureState(t,n)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map((n=>n.tileID)).sort(p.aw).map((n=>n.key)):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,n){this._tiles[t]=n}deleteTileById(t){delete this._tiles[t]}getLoadedTile(t){const n=this.getTileById(t.key);return n!=null&&n.hasData()?n:null}isIdRenderable(t,n=!1){var h;return(h=this.getTileById(t))===null||h===void 0?void 0:h.isRenderable(n)}getRenderableIds(t=0,n){const h=[];for(const f of this.getAllIds())this.isIdRenderable(f,n)&&h.push(this.getTileById(f));return n?h.sort(((f,x)=>{const T=f.tileID,C=x.tileID,D=new p.P(T.canonical.x,T.canonical.y)._rotate(-t),B=new p.P(C.canonical.x,C.canonical.y)._rotate(-t);return T.overscaledZ-C.overscaledZ||B.y-D.y||B.x-D.x})).map((f=>f.tileID.key)):h.map((f=>f.tileID)).sort(p.aw).map((f=>f.key))}}class Qi extends p.E{constructor(t,n,h){super(),this.id=t,this.dispatcher=h,this.on("data",(f=>this._dataHandler(f))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((f,x,T,C)=>{const D=new(le(x.type))(f,x,T,C);if(D.id!==f)throw new Error(`Expected Source id to be ${f} instead of ${D.id}`);return D})(t,n,h,this),this._inViewTiles=new Ri,this._outOfViewCache=new p.ax(0,(f=>this._unloadTile(f))),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new ot,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){for(const n of this._inViewTiles.getAllTiles())n.unloadVectorData();this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t),this._inViewTiles=new Ri}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}getSource(){return this._source}getState(){return this._state}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,n,h){return p._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,n,h)}catch(f){t.state="errored",f.status!==404?this._source.fire(new p.k(f,{tile:t})):this.update(this.transform,this.terrain)}}))}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new p.l("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(const n of this._inViewTiles.getAllTiles())n.upload(t),n.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){var n;return this._inViewTiles.getRenderableIds((n=this.transform)===null||n===void 0?void 0:n.bearingInRadians,t)}hasRenderableParent(t){const n=t.overscaledZ-1;if(n>=this._source.minzoom){const h=this.getLoadedTile(t.scaledTo(n));if(h)return this._inViewTiles.isIdRenderable(h.tileID.key)}return!1}reload(t,n=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(const h of this._inViewTiles.getAllIds()){const f=this._inViewTiles.getTileById(h);n&&!this._source.shouldReloadTile(f,n)||(t?this._reloadTile(h,"expired"):f.state!=="errored"&&this._reloadTile(h,"reloading"))}}}_reloadTile(t,n){return p._(this,void 0,void 0,(function*(){const h=this._inViewTiles.getTileById(t);h&&(h.state!=="loading"&&(h.state=n),yield this._loadTile(h,t,n))}))}_tileLoaded(t,n,h){t.timeAdded=Gt(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration),h==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&(function(f,x){var T,C;const D=x.getRenderableIds();for(const B of D){if(!f.neighboringTiles||!f.neighboringTiles[B])continue;const N=x.getTileById(B);f.neighboringTiles[B].backfilled||ii(f,N),!((C=(T=N.neighboringTiles)===null||T===void 0?void 0:T[f.tileID.key])===null||C===void 0)&&C.backfilled||ii(N,f)}})(t,this._inViewTiles),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new p.l("data",{dataType:"source",tile:t,coord:t.tileID}))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(t,n){const h=this._getLoadedDescendents(n),f=new Set;for(const x of n){const T=h[x.key];if(!(T!=null&&T.length)){f.add(x);continue}const C=x.overscaledZ+Qi.maxOverzooming,D=T.filter((G=>G.tileID.overscaledZ<=C));if(!D.length){f.add(x);continue}const B=Math.min(...D.map((G=>G.tileID.overscaledZ))),N=D.filter((G=>G.tileID.overscaledZ===B)).map((G=>G.tileID));for(const G of N)t[G.key]=G;this._areDescendentsComplete(N,B,x.overscaledZ)||f.add(x)}return f}_getLoadedDescendents(t){var n;const h={};for(const f of this._inViewTiles.getAllTiles().filter((x=>x.hasData())))for(const x of t)f.tileID.isChildOf(x)&&(h[n=x.key]||(h[n]=[])).push(f);return h}_areDescendentsComplete(t,n,h){return t.length===1&&t[0].isOverscaled()?t[0].overscaledZ===n:Math.pow(4,n-h)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,h=Math.ceil(t.height/this._source.tileSize)+1,f=Math.floor(n*h*(this._maxTileCacheZoomLevels===null?p.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),x=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,f):f;this._outOfViewCache.setMaxSize(x)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);this._prevLng=t,n&&(this._inViewTiles.handleWrapJump(n),this._resetTileReloadTimers())}update(t,n){if(!this._sourceLoaded||this._paused)return;let h;this.transform=t,this.terrain=n,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?h=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((D=>new p.a2(D.canonical.z,D.wrap,D.canonical.z,D.canonical.x,D.canonical.y))):(h=er(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type==="vector"&&this.map._zoomLevelsToOverscale!==void 0?t.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(h=h.filter((D=>this._source.hasTile(D))))):h=[],this.usedForTerrain&&(h=this._addTerrainIdealTiles(h));const f=h.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,f&&this.fire(new p.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const x=Wi(t,this._source),T=this._updateRetainedTiles(h,x),C=at(this._source.type);C&&this._rasterFadeDuration>0&&!n&&(function(D,B,N,G,U,$,ie){const he=Gt(),Ae=p.av(B);for(const ce of B){const ye=D.getTileById(ce.key);ye.fadingDirection!==Qe.Departing&&ye.fadeOpacity!==0||ye.resetFadeLogic(),It(D,ye,N,he,G,U,ie)||At(D,ye,N,he,$,ie)||X(ye,Ae,he,ie)||ye.resetFadeLogic()}})(this._inViewTiles,h,T,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),C?this._cleanUpRasterTiles(T):this._cleanUpVectorTiles(T)}_cleanUpRasterTiles(t){for(const n of this._inViewTiles.getAllIds())t[n]||this._removeTile(n)}_cleanUpVectorTiles(t){for(const n of this._inViewTiles.getAllIds()){const h=this._inViewTiles.getTileById(n);t[n]?h.clearSymbolFadeHold():h.hasSymbolBuckets?h.holdingForSymbolFade()?h.symbolFadeFinished()&&this._removeTile(n):h.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(n)}}_addTerrainIdealTiles(t){const n=[];for(const h of t)if(h.canonical.z>this._source.minzoom){const f=h.scaledTo(h.canonical.z-1);n.push(f);const x=h.scaledTo(Math.max(this._source.minzoom,Math.min(h.canonical.z,5)));n.push(x)}return t.concat(n)}releaseSymbolFadeTiles(){for(const t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){var h;const f=new Set;for(const B of t)this._addTile(B).hasData()||f.add(B);const x=t.reduce(((B,N)=>(B[N.key]=N,B)),{}),T=this._retainLoadedChildren(x,f),C={},D=Math.max(n-Qi.maxUnderzooming,this._source.minzoom);for(const B of T){let N=this._inViewTiles.getTileById(B.key),G=N==null?void 0:N.wasRequested();for(let U=B.overscaledZ-1;U>=D;--U){const $=B.scaledTo(U);if(C[$.key])break;if(C[$.key]=!0,N=this.getTile($),!N&&G&&(N=this._addTile($)),N){const ie=N.hasData();if((ie||!(!((h=this.map)===null||h===void 0)&&h.cancelPendingTileRequestsWhileZooming)||G)&&(x[$.key]=$),G=N.wasRequested(),ie)break}}}return x}_addTile(t){let n=this._inViewTiles.getTileById(t.key);if(n)return n;n=this._outOfViewCache.getAndRemove(t),n&&(n.resetFadeLogic(),this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null));const h=n;return n||(n=new ft(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,t.key,n.state)),n.uses++,this._inViewTiles.setTile(t.key,n),h||this._source.fire(new p.l("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){this._clearTileReloadTimer(t);const h=n.getExpiryTimeout();h&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),h))}_clearTileReloadTimer(t){const n=this._timers[t];n&&(clearTimeout(n),delete this._timers[t])}_resetTileReloadTimers(){for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t of this._inViewTiles.getAllIds()){const n=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,n)}}refreshTiles(t){for(const n of this._inViewTiles.getAllIds()){const h=this._inViewTiles.getTileById(n);(this._inViewTiles.isIdRenderable(n)||h.state=="errored")&&t.some((f=>f.equals(h.tileID.canonical)))&&this._reloadTile(n,"expired")}}_removeTile(t){const n=this._inViewTiles.getTileById(t);n&&(n.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._outOfViewCache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}_dataHandler(t){t.dataType==="source"&&(t.sourceDataType!=="metadata"?t.sourceDataType==="content"&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t of this._inViewTiles.getAllIds())this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,n,h){const f=[],x=this.transform;if(!x)return f;const T=x.getCoveringTilesDetailsProvider().allowWorldCopies(),C=h?x.getCameraQueryGeometry(t):t,D=$=>x.screenPointToMercatorCoordinate($,this.terrain),B=this.transformBbox(t,D,!T),N=this.transformBbox(C,D,!T),G=this.getIds(),U=p.aa.fromPoints(N);for(let $=0;$<G.length;$++){const ie=this._inViewTiles.getTileById(G[$]);if(ie.holdingForSymbolFade())continue;const he=T?[ie.tileID]:[ie.tileID.unwrapTo(-1),ie.tileID.unwrapTo(0)],Ae=Math.pow(2,x.zoom-ie.tileID.overscaledZ),ce=n*ie.queryPadding*p.a5/ie.tileSize/Ae;for(const ye of he){const Pe=U.map((_e=>ye.getTilePoint(new p.a9(_e.x,_e.y))));if(Pe.expandBy(ce),Pe.intersects(Ve)){const _e=B.map((Ce=>ye.getTilePoint(Ce))),we=N.map((Ce=>ye.getTilePoint(Ce)));f.push({tile:ie,tileID:T?ye:ye.unwrapTo(0),queryGeometry:_e,cameraQueryGeometry:we,scale:Ae})}}}return f}transformBbox(t,n,h){let f=t.map(n);if(h){const x=p.aa.fromPoints(t);x.shrinkBy(.001*Math.min(x.width(),x.height()));const T=x.map(n);p.aa.fromPoints(f).covers(T)||(f=f.map((C=>C.x>.5?new p.a9(C.x-1,C.y,C.z):C)))}return f}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map((h=>this._inViewTiles.getTileById(h).tileID));return this.transform&&this.transform.populateCache(n),n}hasTransition(){return!!this._source.hasTransition()||!(!at(this._source.type)||!(function(t,n){if(n<=0)return!1;const h=Gt();for(const f of t.getAllTiles())if(f.fadeEndTime>=h)return!0;return!1})(this._inViewTiles,this._rasterFadeDuration))}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,n,h){this._state.updateState(t=t||p.ai,n,h)}removeFeatureState(t,n,h){this._state.removeFeatureState(t=t||p.ai,n,h)}getFeatureState(t,n){return this._state.getState(t=t||p.ai,n)}setDependencies(t,n,h){const f=this._inViewTiles.getTileById(t);f&&f.setDependencies(n,h)}reloadTilesForDependencies(t,n){for(const h of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(h).hasDependency(t,n)&&this._reloadTile(h,"reloading");this._outOfViewCache.filter((h=>!h.hasDependency(t,n)))}areTilesLoaded(){for(const t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}}Qi.maxUnderzooming=10,Qi.maxOverzooming=3;class ut{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let h=1;h<this.points.length;h++)this._distances[h]=this._distances[h-1]+this.points[h].dist(this.points[h-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=p.an(t,0,1);let n=1,h=this._distances[n];const f=t*this.paddedLength+this.padding;for(;h<f&&n<this._distances.length;)h=this._distances[++n];const x=n-1,T=this._distances[x],C=h-T,D=C>0?(f-T)/C:0;return this.points[x].mult(1-D).add(this.points[n].mult(D))}}function zt(y,t){let n=!0;return y==="always"||y!=="never"&&t!=="never"||(n=!1),n}class $t{constructor(t,n,h){const f=this.boxCells=[],x=this.circleCells=[];this.xCellCount=Math.ceil(t/h),this.yCellCount=Math.ceil(n/h);for(let T=0;T<this.xCellCount*this.yCellCount;T++)f.push([]),x.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,h,f,x){this._forEachCell(n,h,f,x,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(h),this.bboxes.push(f),this.bboxes.push(x)}insertCircle(t,n,h,f){this._forEachCell(n-f,h-f,n+f,h+f,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(h),this.circles.push(f)}_insertBoxCell(t,n,h,f,x,T){this.boxCells[x].push(T)}_insertCircleCell(t,n,h,f,x,T){this.circleCells[x].push(T)}_query(t,n,h,f,x,T,C){if(h<0||t>this.width||f<0||n>this.height)return[];const D=[];if(t<=0&&n<=0&&this.width<=h&&this.height<=f){if(x)return[{key:null,x1:t,y1:n,x2:h,y2:f}];for(let B=0;B<this.boxKeys.length;B++)D.push({key:this.boxKeys[B],x1:this.bboxes[4*B],y1:this.bboxes[4*B+1],x2:this.bboxes[4*B+2],y2:this.bboxes[4*B+3]});for(let B=0;B<this.circleKeys.length;B++){const N=this.circles[3*B],G=this.circles[3*B+1],U=this.circles[3*B+2];D.push({key:this.circleKeys[B],x1:N-U,y1:G-U,x2:N+U,y2:G+U})}}else this._forEachCell(t,n,h,f,this._queryCell,D,{hitTest:x,overlapMode:T,seenUids:{box:{},circle:{}}},C);return D}query(t,n,h,f){return this._query(t,n,h,f,!1,null)}hitTest(t,n,h,f,x,T){return this._query(t,n,h,f,!0,x,T).length>0}hitTestCircle(t,n,h,f,x){const T=t-h,C=t+h,D=n-h,B=n+h;if(C<0||T>this.width||B<0||D>this.height)return!1;const N=[];return this._forEachCell(T,D,C,B,this._queryCellCircle,N,{hitTest:!0,overlapMode:f,circle:{x:t,y:n,radius:h},seenUids:{box:{},circle:{}}},x),N.length>0}_queryCell(t,n,h,f,x,T,C,D){const{seenUids:B,hitTest:N,overlapMode:G}=C,U=this.boxCells[x];if(U!==null){const ie=this.bboxes;for(const he of U)if(!B.box[he]){B.box[he]=!0;const Ae=4*he,ce=this.boxKeys[he];if(t<=ie[Ae+2]&&n<=ie[Ae+3]&&h>=ie[Ae+0]&&f>=ie[Ae+1]&&(!D||D(ce))&&(!N||!zt(G,ce.overlapMode))&&(T.push({key:ce,x1:ie[Ae],y1:ie[Ae+1],x2:ie[Ae+2],y2:ie[Ae+3]}),N))return!0}}const $=this.circleCells[x];if($!==null){const ie=this.circles;for(const he of $)if(!B.circle[he]){B.circle[he]=!0;const Ae=3*he,ce=this.circleKeys[he];if(this._circleAndRectCollide(ie[Ae],ie[Ae+1],ie[Ae+2],t,n,h,f)&&(!D||D(ce))&&(!N||!zt(G,ce.overlapMode))){const ye=ie[Ae],Pe=ie[Ae+1],_e=ie[Ae+2];if(T.push({key:ce,x1:ye-_e,y1:Pe-_e,x2:ye+_e,y2:Pe+_e}),N)return!0}}}return!1}_queryCellCircle(t,n,h,f,x,T,C,D){const{circle:B,seenUids:N,overlapMode:G}=C,U=this.boxCells[x];if(U!==null){const ie=this.bboxes;for(const he of U)if(!N.box[he]){N.box[he]=!0;const Ae=4*he,ce=this.boxKeys[he];if(this._circleAndRectCollide(B.x,B.y,B.radius,ie[Ae+0],ie[Ae+1],ie[Ae+2],ie[Ae+3])&&(!D||D(ce))&&!zt(G,ce.overlapMode))return T.push(!0),!0}}const $=this.circleCells[x];if($!==null){const ie=this.circles;for(const he of $)if(!N.circle[he]){N.circle[he]=!0;const Ae=3*he,ce=this.circleKeys[he];if(this._circlesCollide(ie[Ae],ie[Ae+1],ie[Ae+2],B.x,B.y,B.radius)&&(!D||D(ce))&&!zt(G,ce.overlapMode))return T.push(!0),!0}}}_forEachCell(t,n,h,f,x,T,C,D){const B=this._convertToXCellCoord(t),N=this._convertToYCellCoord(n),G=this._convertToXCellCoord(h),U=this._convertToYCellCoord(f);for(let $=B;$<=G;$++)for(let ie=N;ie<=U;ie++)if(x.call(this,t,n,h,f,this.xCellCount*ie+$,T,C,D))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,n,h,f,x,T){const C=f-t,D=x-n,B=h+T;return B*B>C*C+D*D}_circleAndRectCollide(t,n,h,f,x,T,C){const D=(T-f)/2,B=Math.abs(t-(f+D));if(B>D+h)return!1;const N=(C-x)/2,G=Math.abs(n-(x+N));if(G>N+h)return!1;if(B<=D||G<=N)return!0;const U=B-D,$=G-N;return U*U+$*$<=h*h}}function fi(y,t,n){const h=p.N();if(!y){const{vecSouth:G,vecEast:U}=jr(t),$=ur();$[0]=U[0],$[1]=U[1],$[2]=G[0],$[3]=G[1],f=$,(N=(T=(x=$)[0])*(B=x[3])-(D=x[2])*(C=x[1]))&&(f[0]=B*(N=1/N),f[1]=-C*N,f[2]=-D*N,f[3]=T*N),h[0]=$[0],h[1]=$[1],h[4]=$[2],h[5]=$[3]}var f,x,T,C,D,B,N;return p.Q(h,h,[1/n,1/n,1]),h}function di(y,t,n,h){if(y){const f=p.N();if(!t){const{vecSouth:x,vecEast:T}=jr(n);f[0]=T[0],f[1]=T[1],f[4]=x[0],f[5]=x[1]}return p.Q(f,f,[h,h,1]),f}return n.pixelsToClipSpaceMatrix}function jr(y){const t=Math.cos(y.rollInRadians),n=Math.sin(y.rollInRadians),h=Math.cos(y.pitchInRadians),f=Math.cos(y.bearingInRadians),x=Math.sin(y.bearingInRadians),T=p.aC();T[0]=-f*h*n-x*t,T[1]=-x*h*n+f*t;const C=p.aD(T);C<1e-9?p.aE(T):p.aF(T,T,1/C);const D=p.aC();D[0]=f*h*t-x*n,D[1]=x*h*t+f*n;const B=p.aD(D);return B<1e-9?p.aE(D):p.aF(D,D,1/B),{vecEast:D,vecSouth:T}}function ni(y,t,n,h){let f;h?(f=[y,t,h(y,t),1],p.aH(f,f,n)):(f=[y,t,0,1],te(f,f,n));const x=f[3];return{point:new p.P(f[0]/x,f[1]/x),signedDistanceFromCamera:x,isOccluded:!1}}function Ea(y,t){return .5+y/t*.5}function xo(y,t){return y.x>=-t[0]&&y.x<=t[0]&&y.y>=-t[1]&&y.y<=t[1]}function kn(y,t,n,h,f,x,T,C,D,B,N,G,U){const $=n?y.textSizeData:y.iconSizeData,ie=p.ay($,t.transform.zoom),he=[256/t.width*2+1,256/t.height*2+1],Ae=n?y.text.dynamicLayoutVertexArray:y.icon.dynamicLayoutVertexArray;Ae.clear();const ce=y.lineVertexArray,ye=n?y.text.placedSymbolArray:y.icon.placedSymbolArray,Pe=t.transform.width/t.transform.height;let _e=!1;for(let we=0;we<ye.length;we++){const Ce=ye.get(we);if(Ce.hidden||Ce.writingMode===p.az.vertical&&!_e){Xi(Ce.numGlyphs,Ae);continue}_e=!1;const be=new p.P(Ce.anchorX,Ce.anchorY),Le={getElevation:U,pitchedLabelPlaneMatrix:h,lineVertexArray:ce,pitchWithMap:x,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:be,unwrappedTileID:D,width:B,height:N,translation:G},Ke=qt(Ce.anchorX,Ce.anchorY,Le);if(!xo(Ke.point,he)){Xi(Ce.numGlyphs,Ae);continue}const He=Ea(t.transform.cameraToCenterDistance,Ke.signedDistanceFromCamera),$e=p.aA($,ie,Ce),Ye=x?$e*t.transform.getPitchedTextCorrection(Ce.anchorX,Ce.anchorY,D)/He:$e*He,xt=bo({projectionContext:Le,pitchedLabelPlaneMatrixInverse:f,symbol:Ce,fontSize:Ye,flip:!1,keepUpright:T,glyphOffsetArray:y.glyphOffsetArray,dynamicLayoutVertexArray:Ae,aspectRatio:Pe,rotateToLine:C});_e=xt.useVertical,(xt.notEnoughRoom||_e||xt.needsFlipping&&bo({projectionContext:Le,pitchedLabelPlaneMatrixInverse:f,symbol:Ce,fontSize:Ye,flip:!0,keepUpright:T,glyphOffsetArray:y.glyphOffsetArray,dynamicLayoutVertexArray:Ae,aspectRatio:Pe,rotateToLine:C}).notEnoughRoom)&&Xi(Ce.numGlyphs,Ae)}n?y.text.dynamicLayoutVertexBuffer.updateData(Ae):y.icon.dynamicLayoutVertexBuffer.updateData(Ae)}function qn(y,t,n,h,f,x,T,C){const D=x.glyphStartIndex+x.numGlyphs,B=x.lineStartIndex,N=x.lineStartIndex+x.lineLength,G=t.getoffsetX(x.glyphStartIndex),U=t.getoffsetX(D-1),$=zn(y*G,n,h,f,x.segment,B,N,C,T);if(!$)return null;const ie=zn(y*U,n,h,f,x.segment,B,N,C,T);return ie?C.projectionCache.anyProjectionOccluded?null:{first:$,last:ie}:null}function Hn(y,t,n,h){return y===p.az.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*h?{useVertical:!0}:(y===p.az.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function bo(y){const{projectionContext:t,pitchedLabelPlaneMatrixInverse:n,symbol:h,fontSize:f,flip:x,keepUpright:T,glyphOffsetArray:C,dynamicLayoutVertexArray:D,aspectRatio:B,rotateToLine:N}=y,G=f/24,U=h.lineOffsetX*G,$=h.lineOffsetY*G;let ie;if(h.numGlyphs>1){const he=h.glyphStartIndex+h.numGlyphs,Ae=h.lineStartIndex,ce=h.lineStartIndex+h.lineLength,ye=qn(G,C,U,$,x,h,N,t);if(!ye)return{notEnoughRoom:!0};const Pe=ae(ye.first.point.x,ye.first.point.y,t,n),_e=ae(ye.last.point.x,ye.last.point.y,t,n);if(T&&!x){const we=Hn(h.writingMode,Pe,_e,B);if(we)return we}ie=[ye.first];for(let we=h.glyphStartIndex+1;we<he-1;we++){const Ce=zn(G*C.getoffsetX(we),U,$,x,h.segment,Ae,ce,t,N);if(!Ce)return{notEnoughRoom:!0};ie.push(Ce)}ie.push(ye.last)}else{if(T&&!x){const Ae=Ft(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,ce=h.lineStartIndex+h.segment+1,ye=new p.P(t.lineVertexArray.getx(ce),t.lineVertexArray.gety(ce)),Pe=Ft(ye.x,ye.y,t),_e=Pe.signedDistanceFromCamera>0?Pe.point:Sa(t.tileAnchorPoint,ye,Ae,1,t),we=ae(Ae.x,Ae.y,t,n),Ce=ae(_e.x,_e.y,t,n),be=Hn(h.writingMode,we,Ce,B);if(be)return be}const he=zn(G*C.getoffsetX(h.glyphStartIndex),U,$,x,h.segment,h.lineStartIndex,h.lineStartIndex+h.lineLength,t,N);if(!he||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};ie=[he]}for(const he of ie)p.aG(D,he.point,he.angle);return{}}function Sa(y,t,n,h,f){const x=y.add(y.sub(t)._unit()),T=Ft(x.x,x.y,f).point,C=n.sub(T);return n.add(C._mult(h/C.mag()))}function vr(y,t,n){const h=t.projectionCache;if(h.projections[y])return h.projections[y];const f=new p.P(t.lineVertexArray.getx(y),t.lineVertexArray.gety(y)),x=Ft(f.x,f.y,t);if(x.signedDistanceFromCamera>0)return h.projections[y]=x.point,h.anyProjectionOccluded=h.anyProjectionOccluded||x.isOccluded,x.point;const T=y-n.direction;return Sa(n.distanceFromAnchor===0?t.tileAnchorPoint:new p.P(t.lineVertexArray.getx(T),t.lineVertexArray.gety(T)),f,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,t)}function Ft(y,t,n){const h=y+n.translation[0],f=t+n.translation[1];let x;return n.pitchWithMap?(x=ni(h,f,n.pitchedLabelPlaneMatrix,n.getElevation),x.isOccluded=!1):(x=n.transform.projectTileCoordinates(h,f,n.unwrappedTileID,n.getElevation),x.point.x=(.5*x.point.x+.5)*n.width,x.point.y=(.5*-x.point.y+.5)*n.height),x}function ae(y,t,n,h){if(n.pitchWithMap){const f=[y,t,0,1];return p.aH(f,f,h),n.transform.projectTileCoordinates(f[0]/f[3],f[1]/f[3],n.unwrappedTileID,n.getElevation).point}return{x:y/n.width*2-1,y:1-t/n.height*2}}function qt(y,t,n){return n.transform.projectTileCoordinates(y,t,n.unwrappedTileID,n.getElevation)}function Uo(y,t,n){return y._unit()._perp()._mult(t*n)}function wo(y,t,n,h,f,x,T,C,D){if(C.projectionCache.offsets[y])return C.projectionCache.offsets[y];const B=n.add(t);if(y+D.direction<h||y+D.direction>=f)return C.projectionCache.offsets[y]=B,B;const N=vr(y+D.direction,C,D),G=Uo(N.sub(n),T,D.direction),U=n.add(G),$=N.add(G);return C.projectionCache.offsets[y]=p.aI(x,B,U,$)||B,C.projectionCache.offsets[y]}function zn(y,t,n,h,f,x,T,C,D){const B=h?y-t:y+t;let N=B>0?1:-1,G=0;h&&(N*=-1,G=Math.PI),N<0&&(G+=Math.PI);let U,$=N>0?x+f:x+f+1;C.projectionCache.cachedAnchorPoint?U=C.projectionCache.cachedAnchorPoint:(U=Ft(C.tileAnchorPoint.x,C.tileAnchorPoint.y,C).point,C.projectionCache.cachedAnchorPoint=U);let ie,he,Ae=U,ce=U,ye=0,Pe=0;const _e=Math.abs(B),we=[];let Ce;for(;ye+Pe<=_e;){if($+=N,$<x||$>=T)return null;ye+=Pe,ce=Ae,he=ie;const Ke={absOffsetX:_e,direction:N,distanceFromAnchor:ye,previousVertex:ce};if(Ae=vr($,C,Ke),n===0)we.push(ce),Ce=Ae.sub(ce);else{let He;const $e=Ae.sub(ce);He=$e.mag()===0?Uo(vr($+N,C,Ke).sub(Ae),n,N):Uo($e,n,N),he||(he=ce.add(He)),ie=wo($,He,Ae,x,T,he,n,C,Ke),we.push(he),Ce=ie.sub(he)}Pe=Ce.mag()}const be=Ce._mult((_e-ye)/Pe)._add(he||ce),Le=G+Math.atan2(Ae.y-ce.y,Ae.x-ce.x);return we.push(be),{point:be,angle:D?Le:0,path:we}}const Fi=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Xi(y,t){for(let n=0;n<y;n++){const h=t.length;t.resize(h+4),t.float32.set(Fi,3*h)}}function te(y,t,n){const h=t[0],f=t[1];return y[0]=n[0]*h+n[4]*f+n[12],y[1]=n[1]*h+n[5]*f+n[13],y[3]=n[3]*h+n[7]*f+n[15],y}const tr=100;class Go{constructor(t,n=new $t(t.width+200,t.height+200,25),h=new $t(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=h,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+tr,this.screenBottomBoundary=t.height+tr,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,h,f,x,T,C,D,B,N,G,U){const $=this.projectAndGetPerspectiveRatio(t.anchorPointX+D[0],t.anchorPointY+D[1],x,N,U),ie=h*$.perspectiveRatio;let he;if(T||C)he=this._projectCollisionBox(t,ie,f,x,T,C,D,$,N,G,U);else{const Ce=$.x+(G?G.x*ie:0),be=$.y+(G?G.y*ie:0);he={allPointsOccluded:!1,box:[Ce+t.x1*ie,be+t.y1*ie,Ce+t.x2*ie,be+t.y2*ie]}}const[Ae,ce,ye,Pe]=he.box,_e=T?he.allPointsOccluded:$.isOccluded;let we=_e;return we||(we=$.perspectiveRatio<this.perspectiveRatioCutoff),we||(we=!this.isInsideGrid(Ae,ce,ye,Pe)),we||n!=="always"&&this.grid.hitTest(Ae,ce,ye,Pe,n,B)?{box:[Ae,ce,ye,Pe],placeable:!1,offscreen:!1,occluded:_e}:{box:[Ae,ce,ye,Pe],placeable:!0,offscreen:this.isOffscreen(Ae,ce,ye,Pe),occluded:_e}}placeCollisionCircles(t,n,h,f,x,T,C,D,B,N,G,U,$,ie){const he=[],Ae=new p.P(n.anchorX,n.anchorY),ce=this.getPerspectiveRatio(Ae.x,Ae.y,T,ie),ye=(B?x*this.transform.getPitchedTextCorrection(n.anchorX,n.anchorY,T)/ce:x*ce)/p.aM,Pe={getElevation:ie,pitchedLabelPlaneMatrix:C,lineVertexArray:h,pitchWithMap:B,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:Ae,unwrappedTileID:T,width:this.transform.width,height:this.transform.height,translation:$},_e=qn(ye,f,n.lineOffsetX*ye,n.lineOffsetY*ye,!1,n,!1,Pe);let we=!1,Ce=!1,be=!0;if(_e){const Le=.5*G*ce+U,Ke=new p.P(-100,-100),He=new p.P(this.screenRightBoundary,this.screenBottomBoundary),$e=new ut,Ye=_e.first,xt=_e.last;let wt=[];for(let mi=Ye.path.length-1;mi>=1;mi--)wt.push(Ye.path[mi]);for(let mi=1;mi<xt.path.length;mi++)wt.push(xt.path[mi]);const pt=2.5*Le;if(B){const mi=this.projectPathToScreenSpace(wt,Pe);wt=mi.some((sr=>sr.signedDistanceFromCamera<=0))?[]:mi.map((sr=>sr.point))}let Pt=[];if(wt.length>0){const mi=wt[0].clone(),sr=wt[0].clone();for(let Dr=1;Dr<wt.length;Dr++)mi.x=Math.min(mi.x,wt[Dr].x),mi.y=Math.min(mi.y,wt[Dr].y),sr.x=Math.max(sr.x,wt[Dr].x),sr.y=Math.max(sr.y,wt[Dr].y);Pt=mi.x>=Ke.x&&sr.x<=He.x&&mi.y>=Ke.y&&sr.y<=He.y?[wt]:sr.x<Ke.x||mi.x>He.x||sr.y<Ke.y||mi.y>He.y?[]:p.aJ([wt],Ke.x,Ke.y,He.x,He.y)}for(const mi of Pt){$e.reset(mi,.25*Le);let sr=0;sr=$e.length<=.5*Le?1:Math.ceil($e.paddedLength/pt)+1;for(let Dr=0;Dr<sr;Dr++){const mr=Dr/Math.max(sr-1,1),Rr=$e.lerp(mr),_r=Rr.x+tr,Yr=Rr.y+tr;he.push(_r,Yr,Le,0);const Fr=_r-Le,rs=Yr-Le,dn=_r+Le,an=Yr+Le;if(be=be&&this.isOffscreen(Fr,rs,dn,an),Ce=Ce||this.isInsideGrid(Fr,rs,dn,an),t!=="always"&&this.grid.hitTestCircle(_r,Yr,Le,t,N)&&(we=!0,!D))return{circles:[],offscreen:!1,collisionDetected:we}}}}return{circles:!D&&we||!Ce||ce<this.perspectiveRatioCutoff?[]:he,offscreen:be,collisionDetected:we}}projectPathToScreenSpace(t,n){const h=(function(f,x){const T=p.N();return p.aB(T,x.pitchedLabelPlaneMatrix),f.map((C=>{const D=ni(C.x,C.y,T,x.getElevation),B=x.transform.projectTileCoordinates(D.point.x,D.point.y,x.unwrappedTileID,x.getElevation);return B.point.x=(.5*B.point.x+.5)*x.width,B.point.y=(.5*-B.point.y+.5)*x.height,B}))})(t,n);return(function(f){let x=0,T=0,C=0,D=0;for(let B=0;B<f.length;B++)f[B].isOccluded?(C=B+1,D=0):(D++,D>T&&(T=D,x=C));return f.slice(x,x+T)})(h)}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[],h=new p.aa;for(const G of t){const U=new p.P(G.x+tr,G.y+tr);h.extend(U),n.push(U)}const{minX:f,minY:x,maxX:T,maxY:C}=h,D=this.grid.query(f,x,T,C).concat(this.ignoredGrid.query(f,x,T,C)),B={},N={};for(const G of D){const U=G.key;if(B[U.bucketInstanceId]===void 0&&(B[U.bucketInstanceId]={}),B[U.bucketInstanceId][U.featureIndex])continue;const $=[new p.P(G.x1,G.y1),new p.P(G.x2,G.y1),new p.P(G.x2,G.y2),new p.P(G.x1,G.y2)];p.aK(n,$)&&(B[U.bucketInstanceId][U.featureIndex]=!0,N[U.bucketInstanceId]===void 0&&(N[U.bucketInstanceId]=[]),N[U.bucketInstanceId].push(U.featureIndex))}return N}insertCollisionBox(t,n,h,f,x,T){(h?this.ignoredGrid:this.grid).insert({bucketInstanceId:f,featureIndex:x,collisionGroupID:T,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,h,f,x,T){const C=h?this.ignoredGrid:this.grid,D={bucketInstanceId:f,featureIndex:x,collisionGroupID:T,overlapMode:n};for(let B=0;B<t.length;B+=4)C.insertCircle(D,t[B],t[B+1],t[B+2])}projectAndGetPerspectiveRatio(t,n,h,f,x){if(x){let T;f?(T=[t,n,f(t,n),1],p.aH(T,T,x)):(T=[t,n,0,1],te(T,T,x));const C=T[3];return{x:(T[0]/C+1)/2*this.transform.width+tr,y:(-T[1]/C+1)/2*this.transform.height+tr,perspectiveRatio:.5+this.transform.cameraToCenterDistance/C*.5,isOccluded:!1,signedDistanceFromCamera:C}}{const T=this.transform.projectTileCoordinates(t,n,h,f);return{x:(T.point.x+1)/2*this.transform.width+tr,y:(1-T.point.y)/2*this.transform.height+tr,perspectiveRatio:.5+this.transform.cameraToCenterDistance/T.signedDistanceFromCamera*.5,isOccluded:T.isOccluded,signedDistanceFromCamera:T.signedDistanceFromCamera}}}getPerspectiveRatio(t,n,h,f){const x=this.transform.projectTileCoordinates(t,n,h,f);return .5+this.transform.cameraToCenterDistance/x.signedDistanceFromCamera*.5}isOffscreen(t,n,h,f){return h<tr||t>=this.screenRightBoundary||f<tr||n>this.screenBottomBoundary}isInsideGrid(t,n,h,f){return h>=0&&t<this.gridRightBoundary&&f>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=p.ar([]);return p.O(t,t,[-100,-100,0]),t}_projectCollisionBox(t,n,h,f,x,T,C,D,B,N,G){let U=1,$=0,ie=0,he=1;const Ae=t.anchorPointX+C[0],ce=t.anchorPointY+C[1];if(T&&!x){const wt=this.projectAndGetPerspectiveRatio(Ae+1,ce,f,B,G),pt=wt.x-D.x,Pt=Math.atan((wt.y-D.y)/pt)+(pt<0?Math.PI:0),mi=Math.sin(Pt),sr=Math.cos(Pt);U=sr,$=mi,ie=-mi,he=sr}else if(!T&&x){const wt=jr(this.transform);U=wt.vecEast[0],$=wt.vecEast[1],ie=wt.vecSouth[0],he=wt.vecSouth[1]}let ye=D.x,Pe=D.y,_e=n;x&&(ye=Ae,Pe=ce,_e=Math.pow(2,-(this.transform.zoom-h.overscaledZ)),_e*=this.transform.getPitchedTextCorrection(Ae,ce,f),N||(_e*=p.an(.5+D.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),N&&(ye+=U*N.x*_e+ie*N.y*_e,Pe+=$*N.x*_e+he*N.y*_e);const we=t.x1*_e,Ce=t.x2*_e,be=(we+Ce)/2,Le=t.y1*_e,Ke=t.y2*_e,He=(Le+Ke)/2,$e=[{offsetX:we,offsetY:Le},{offsetX:be,offsetY:Le},{offsetX:Ce,offsetY:Le},{offsetX:Ce,offsetY:He},{offsetX:Ce,offsetY:Ke},{offsetX:be,offsetY:Ke},{offsetX:we,offsetY:Ke},{offsetX:we,offsetY:He}];let Ye=[];for(const{offsetX:wt,offsetY:pt}of $e)Ye.push(new p.P(ye+U*wt+ie*pt,Pe+$*wt+he*pt));let xt=!1;if(x){const wt=Ye.map((pt=>this.projectAndGetPerspectiveRatio(pt.x,pt.y,f,B,G)));xt=wt.some((pt=>!pt.isOccluded)),Ye=wt.map((pt=>new p.P(pt.x,pt.y)))}else xt=!0;return{box:p.aL(Ye),allPointsOccluded:!xt}}}class Ha{constructor(t,n,h,f){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):f&&h?1:0,this.placed=h}isHidden(){return this.opacity===0&&!this.placed}}class _i{constructor(t,n,h,f,x){this.text=new Ha(t?t.text:null,n,h,x),this.icon=new Ha(t?t.icon:null,n,f,x)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Sr{constructor(t,n,h){this.text=t,this.icon=n,this.skipFade=h}}class Wa{constructor(t,n,h,f,x){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=h,this.bucketIndex=f,this.tileID=x}}class ha{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 n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:h=>h.collisionGroupID===n}}return this.collisionGroups[t]}}function _n(y,t,n,h,f){const{horizontalAlign:x,verticalAlign:T}=p.aS(y);return new p.P(-(x-.5)*t+h[0]*f,-(T-.5)*n+h[1]*f)}class Qa{constructor(t,n,h,f,x){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new Go(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=h,this.retainedQueryData={},this.collisionGroups=new ha(f),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=x,x&&(x.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const n=this.terrain;return n?(h,f)=>n.getElevation(t,h,f):null}getBucketParts(t,n,h,f){const x=h.getBucket(n),T=h.latestFeatureIndex;if(!x||!T||n.id!==x.layerIds[0])return;const C=h.collisionBoxArray,D=x.layers[0].layout,B=x.layers[0].paint,N=Math.pow(2,this.transform.zoom-h.tileID.overscaledZ),G=h.tileSize/p.a5,U=h.tileID.toUnwrapped(),$=D.get("text-rotation-alignment")==="map",ie=p.aN(h,1,this.transform.zoom),he=p.aO(this.collisionIndex.transform,h,B.get("text-translate"),B.get("text-translate-anchor")),Ae=p.aO(this.collisionIndex.transform,h,B.get("icon-translate"),B.get("icon-translate-anchor")),ce=fi($,this.transform,ie);this.retainedQueryData[x.bucketInstanceId]=new Wa(x.bucketInstanceId,T,x.sourceLayerIndex,x.index,h.tileID);const ye={bucket:x,layout:D,translationText:he,translationIcon:Ae,unwrappedTileID:U,pitchedLabelPlaneMatrix:ce,scale:N,textPixelRatio:G,holdingForFade:h.holdingForSymbolFade(),collisionBoxArray:C,partiallyEvaluatedTextSize:p.ay(x.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(x.sourceID)};if(f)for(const Pe of x.sortKeyRanges){const{sortKey:_e,symbolInstanceStart:we,symbolInstanceEnd:Ce}=Pe;t.push({sortKey:_e,symbolInstanceStart:we,symbolInstanceEnd:Ce,parameters:ye})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:x.symbolInstances.length,parameters:ye})}attemptAnchorPlacement(t,n,h,f,x,T,C,D,B,N,G,U,$,ie,he,Ae,ce,ye,Pe,_e){const we=p.aP[t.textAnchor],Ce=[t.textOffset0,t.textOffset1],be=_n(we,h,f,Ce,x),Le=this.collisionIndex.placeCollisionBox(n,U,D,B,N,C,T,Ae,G.predicate,Pe,be,_e);if((!ye||this.collisionIndex.placeCollisionBox(ye,U,D,B,N,C,T,ce,G.predicate,Pe,be,_e).placeable)&&Le.placeable){let Ke;if(this.prevPlacement&&this.prevPlacement.variableOffsets[$.crossTileID]&&this.prevPlacement.placements[$.crossTileID]&&this.prevPlacement.placements[$.crossTileID].text&&(Ke=this.prevPlacement.variableOffsets[$.crossTileID].anchor),$.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[$.crossTileID]={textOffset:Ce,width:h,height:f,anchor:we,textBoxScale:x,prevAnchor:Ke},this.markUsedJustification(ie,we,$,he),ie.allowVerticalPlacement&&(this.markUsedOrientation(ie,he,$),this.placedOrientations[$.crossTileID]=he),{shift:be,placedGlyphBoxes:Le}}}placeLayerBucketPart(t,n,h){const{bucket:f,layout:x,translationText:T,translationIcon:C,unwrappedTileID:D,pitchedLabelPlaneMatrix:B,textPixelRatio:N,holdingForFade:G,collisionBoxArray:U,partiallyEvaluatedTextSize:$,collisionGroup:ie}=t.parameters,he=x.get("text-optional"),Ae=x.get("icon-optional"),ce=p.aQ(x,"text-overlap","text-allow-overlap"),ye=ce==="always",Pe=p.aQ(x,"icon-overlap","icon-allow-overlap"),_e=Pe==="always",we=x.get("text-rotation-alignment")==="map",Ce=x.get("text-pitch-alignment")==="map",be=x.get("icon-text-fit")!=="none",Le=x.get("symbol-z-order")==="viewport-y",Ke=ye&&(_e||!f.hasIconData()||Ae),He=_e&&(ye||!f.hasTextData()||he);!f.collisionArrays&&U&&f.deserializeCollisionBoxes(U);const $e=this.retainedQueryData[f.bucketInstanceId].tileID,Ye=this._getTerrainElevationFunc($e),xt=this.transform.getFastPathSimpleProjectionMatrix($e),wt=(pt,Pt,mi)=>{var sr,Dr;if(n[pt.crossTileID])return;if(G)return void(this.placements[pt.crossTileID]=new Sr(!1,!1,!1));let mr=!1,Rr=!1,_r=!0,Yr=null,Fr={box:null,placeable:!1,offscreen:null,occluded:!1},rs={placeable:!1},dn=null,an=null,ms=null,cl=0,Va=0,wa=0;Pt.textFeatureIndex?cl=Pt.textFeatureIndex:pt.useRuntimeCollisionCircles&&(cl=pt.featureIndex),Pt.verticalTextFeatureIndex&&(Va=Pt.verticalTextFeatureIndex);const eo=Pt.textBox;if(eo){const zo=Tr=>{let gr=p.az.horizontal;if(f.allowVerticalPlacement&&!Tr&&this.prevPlacement){const Vn=this.prevPlacement.placedOrientations[pt.crossTileID];Vn&&(this.placedOrientations[pt.crossTileID]=Vn,gr=Vn,this.markUsedOrientation(f,gr,pt))}return gr},Ta=(Tr,gr)=>{if(f.allowVerticalPlacement&&pt.numVerticalGlyphVertices>0&&Pt.verticalTextBox){for(const Vn of f.writingModes)if(Vn===p.az.vertical?(Fr=gr(),rs=Fr):Fr=Tr(),Fr&&Fr.placeable)break}else Fr=Tr()},na=pt.textAnchorOffsetStartIndex,sa=pt.textAnchorOffsetEndIndex;if(sa===na){const Tr=(gr,Vn)=>{const jn=this.collisionIndex.placeCollisionBox(gr,ce,N,$e,D,Ce,we,T,ie.predicate,Ye,void 0,xt);return jn&&jn.placeable&&(this.markUsedOrientation(f,Vn,pt),this.placedOrientations[pt.crossTileID]=Vn),jn};Ta((()=>Tr(eo,p.az.horizontal)),(()=>{const gr=Pt.verticalTextBox;return f.allowVerticalPlacement&&pt.numVerticalGlyphVertices>0&&gr?Tr(gr,p.az.vertical):{box:null,offscreen:null}})),zo(Fr&&Fr.placeable)}else{let Tr=p.aP[(Dr=(sr=this.prevPlacement)===null||sr===void 0?void 0:sr.variableOffsets[pt.crossTileID])===null||Dr===void 0?void 0:Dr.anchor];const gr=(jn,$h,Yh)=>{const Ll=jn.x2-jn.x1,kc=jn.y2-jn.y1,Xh=pt.textBoxScale,xh=be&&Pe==="never"?$h:null;let Al=null,fl=ce==="never"?1:2,dl="never";Tr&&fl++;for(let bh=0;bh<fl;bh++){for(let wh=na;wh<sa;wh++){const Hu=f.textAnchorOffsets.get(wh);if(Tr&&Hu.textAnchor!==Tr)continue;const Wu=this.attemptAnchorPlacement(Hu,jn,Ll,kc,Xh,we,Ce,N,$e,D,ie,dl,pt,f,Yh,T,C,xh,Ye);if(Wu&&(Al=Wu.placedGlyphBoxes,Al&&Al.placeable))return mr=!0,Yr=Wu.shift,Al}Tr?Tr=null:dl=ce}return h&&!Al&&(Al={box:this.collisionIndex.placeCollisionBox(eo,"always",N,$e,D,Ce,we,T,ie.predicate,Ye,void 0,xt).box,offscreen:!1,placeable:!1,occluded:!1}),Al};Ta((()=>gr(eo,Pt.iconBox,p.az.horizontal)),(()=>{const jn=Pt.verticalTextBox;return f.allowVerticalPlacement&&(!Fr||!Fr.placeable)&&pt.numVerticalGlyphVertices>0&&jn?gr(jn,Pt.verticalIconBox,p.az.vertical):{box:null,occluded:!0,offscreen:null}})),Fr&&(mr=Fr.placeable,_r=Fr.offscreen);const Vn=zo(Fr&&Fr.placeable);if(!mr&&this.prevPlacement){const jn=this.prevPlacement.variableOffsets[pt.crossTileID];jn&&(this.variableOffsets[pt.crossTileID]=jn,this.markUsedJustification(f,jn.anchor,pt,Vn))}}}if(dn=Fr,mr=dn&&dn.placeable,_r=dn&&dn.offscreen,pt.useRuntimeCollisionCircles&&pt.centerJustifiedTextSymbolIndex>=0){const zo=f.text.placedSymbolArray.get(pt.centerJustifiedTextSymbolIndex),Ta=p.aA(f.textSizeData,$,zo),na=x.get("text-padding");an=this.collisionIndex.placeCollisionCircles(ce,zo,f.lineVertexArray,f.glyphOffsetArray,Ta,D,B,h,Ce,ie.predicate,pt.collisionCircleDiameter,na,T,Ye),an.circles.length&&an.collisionDetected&&!h&&p.w("Collisions detected, but collision boxes are not shown"),mr=ye||an.circles.length>0&&!an.collisionDetected,_r=_r&&an.offscreen}if(Pt.iconFeatureIndex&&(wa=Pt.iconFeatureIndex),Pt.iconBox){const zo=Ta=>this.collisionIndex.placeCollisionBox(Ta,Pe,N,$e,D,Ce,we,C,ie.predicate,Ye,be&&Yr?Yr:void 0,xt);rs&&rs.placeable&&Pt.verticalIconBox?(ms=zo(Pt.verticalIconBox),Rr=ms.placeable):(ms=zo(Pt.iconBox),Rr=ms.placeable),_r=_r&&ms.offscreen}const kl=he||pt.numHorizontalGlyphVertices===0&&pt.numVerticalGlyphVertices===0,Mu=Ae||pt.numIconVertices===0;kl||Mu?Mu?kl||(Rr=Rr&&mr):mr=Rr&&mr:Rr=mr=Rr&&mr;const zl=Rr&&ms.placeable;if(mr&&dn.placeable&&this.collisionIndex.insertCollisionBox(dn.box,ce,x.get("text-ignore-placement"),f.bucketInstanceId,rs&&rs.placeable&&Va?Va:cl,ie.ID),zl&&this.collisionIndex.insertCollisionBox(ms.box,Pe,x.get("icon-ignore-placement"),f.bucketInstanceId,wa,ie.ID),an&&mr&&this.collisionIndex.insertCollisionCircles(an.circles,ce,x.get("text-ignore-placement"),f.bucketInstanceId,cl,ie.ID),h&&this.storeCollisionData(f.bucketInstanceId,mi,Pt,dn,ms,an),pt.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(f.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[pt.crossTileID]=new Sr((mr||Ke)&&!(dn!=null&&dn.occluded),(Rr||He)&&!(ms!=null&&ms.occluded),_r||f.justReloaded),n[pt.crossTileID]=!0};if(Le){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const pt=f.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let Pt=pt.length-1;Pt>=0;--Pt){const mi=pt[Pt];wt(f.symbolInstances.get(mi),f.collisionArrays[mi],mi)}}else for(let pt=t.symbolInstanceStart;pt<t.symbolInstanceEnd;pt++)wt(f.symbolInstances.get(pt),f.collisionArrays[pt],pt);f.justReloaded=!1}storeCollisionData(t,n,h,f,x,T){if(h.textBox||h.iconBox){let C,D;this.collisionBoxArrays.has(t)?C=this.collisionBoxArrays.get(t):(C=new Map,this.collisionBoxArrays.set(t,C)),C.has(n)?D=C.get(n):(D={text:null,icon:null},C.set(n,D)),h.textBox&&(D.text=f.box),h.iconBox&&(D.icon=x.box)}if(T){let C=this.collisionCircleArrays[t];C===void 0&&(C=this.collisionCircleArrays[t]=[]);for(let D=0;D<T.circles.length;D+=4)C.push(T.circles[D+0]-tr),C.push(T.circles[D+1]-tr),C.push(T.circles[D+2]),C.push(T.collisionDetected?1:0)}}markUsedJustification(t,n,h,f){let x;x=f===p.az.vertical?h.verticalPlacedTextSymbolIndex:{left:h.leftJustifiedTextSymbolIndex,center:h.centerJustifiedTextSymbolIndex,right:h.rightJustifiedTextSymbolIndex}[p.aR(n)];const T=[h.leftJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.rightJustifiedTextSymbolIndex,h.verticalPlacedTextSymbolIndex];for(const C of T)C>=0&&(t.text.placedSymbolArray.get(C).crossTileID=x>=0&&C!==x?0:h.crossTileID)}markUsedOrientation(t,n,h){const f=n===p.az.horizontal||n===p.az.horizontalOnly?n:0,x=n===p.az.vertical?n:0,T=[h.leftJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.rightJustifiedTextSymbolIndex];for(const C of T)t.text.placedSymbolArray.get(C).placedOrientation=f;h.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(h.verticalPlacedTextSymbolIndex).placedOrientation=x)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let h=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const f=n?n.symbolFadeChange(t):1,x=n?n.opacities:{},T=n?n.variableOffsets:{},C=n?n.placedOrientations:{};for(const D in this.placements){const B=this.placements[D],N=x[D];N?(this.opacities[D]=new _i(N,f,B.text,B.icon),h=h||B.text!==N.text.placed||B.icon!==N.icon.placed):(this.opacities[D]=new _i(null,f,B.text,B.icon,B.skipFade),h=h||B.text||B.icon)}for(const D in x){const B=x[D];if(!this.opacities[D]){const N=new _i(B,f,!1,!1);N.isHidden()||(this.opacities[D]=N,h=h||B.text.placed||B.icon.placed)}}for(const D in T)this.variableOffsets[D]||!this.opacities[D]||this.opacities[D].isHidden()||(this.variableOffsets[D]=T[D]);for(const D in C)this.placedOrientations[D]||!this.opacities[D]||this.opacities[D].isHidden()||(this.placedOrientations[D]=C[D]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");h?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const h={};for(const f of n){const x=f.getBucket(t);x&&f.latestFeatureIndex&&t.id===x.layerIds[0]&&this.updateBucketOpacities(x,f.tileID,h,f.collisionBoxArray)}}updateBucketOpacities(t,n,h,f){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const x=t.layers[0],T=x.layout,C=new _i(null,0,!1,!1,!0),D=T.get("text-allow-overlap"),B=T.get("icon-allow-overlap"),N=x._unevaluatedLayout.hasValue("text-variable-anchor")||x._unevaluatedLayout.hasValue("text-variable-anchor-offset"),G=T.get("text-rotation-alignment")==="map",U=T.get("text-pitch-alignment")==="map",$=T.get("icon-text-fit")!=="none",ie=new _i(null,0,D&&(B||!t.hasIconData()||T.get("icon-optional")),B&&(D||!t.hasTextData()||T.get("text-optional")),!0);!t.collisionArrays&&f&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(f);const he=(ce,ye,Pe)=>{for(let _e=0;_e<ye/4;_e++)ce.opacityVertexArray.emplaceBack(Pe);ce.hasVisibleVertices=ce.hasVisibleVertices||Pe!==qo},Ae=this.collisionBoxArrays.get(t.bucketInstanceId);for(let ce=0;ce<t.symbolInstances.length;ce++){const ye=t.symbolInstances.get(ce),{numHorizontalGlyphVertices:Pe,numVerticalGlyphVertices:_e,crossTileID:we}=ye;let Ce=this.opacities[we];h[we]?Ce=C:Ce||(Ce=ie,this.opacities[we]=Ce),h[we]=!0;const be=ye.numIconVertices>0,Le=this.placedOrientations[ye.crossTileID],Ke=Le===p.az.vertical,He=Le===p.az.horizontal||Le===p.az.horizontalOnly;if(Pe>0||_e>0){const Ye=Ca(Ce.text);he(t.text,Pe,Ke?qo:Ye),he(t.text,_e,He?qo:Ye);const xt=Ce.text.isHidden();[ye.rightJustifiedTextSymbolIndex,ye.centerJustifiedTextSymbolIndex,ye.leftJustifiedTextSymbolIndex].forEach((Pt=>{Pt>=0&&(t.text.placedSymbolArray.get(Pt).hidden=xt||Ke?1:0)})),ye.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(ye.verticalPlacedTextSymbolIndex).hidden=xt||He?1:0);const wt=this.variableOffsets[ye.crossTileID];wt&&this.markUsedJustification(t,wt.anchor,ye,Le);const pt=this.placedOrientations[ye.crossTileID];pt&&(this.markUsedJustification(t,"left",ye,pt),this.markUsedOrientation(t,pt,ye))}if(be){const Ye=Ca(Ce.icon),xt=!($&&ye.verticalPlacedIconSymbolIndex&&Ke);ye.placedIconSymbolIndex>=0&&(he(t.icon,ye.numIconVertices,xt?Ye:qo),t.icon.placedSymbolArray.get(ye.placedIconSymbolIndex).hidden=Ce.icon.isHidden()),ye.verticalPlacedIconSymbolIndex>=0&&(he(t.icon,ye.numVerticalIconVertices,xt?qo:Ye),t.icon.placedSymbolArray.get(ye.verticalPlacedIconSymbolIndex).hidden=Ce.icon.isHidden())}const $e=Ae&&Ae.has(ce)?Ae.get(ce):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const Ye=t.collisionArrays[ce];if(Ye){let xt=new p.P(0,0);if(Ye.textBox||Ye.verticalTextBox){let wt=!0;if(N){const pt=this.variableOffsets[we];pt?(xt=_n(pt.anchor,pt.width,pt.height,pt.textOffset,pt.textBoxScale),G&&xt._rotate(U?-this.transform.bearingInRadians:this.transform.bearingInRadians)):wt=!1}if(Ye.textBox||Ye.verticalTextBox){let pt;Ye.textBox&&(pt=Ke),Ye.verticalTextBox&&(pt=He),Ln(t.textCollisionBox.collisionVertexArray,Ce.text.placed,!wt||pt,$e.text,xt.x,xt.y)}}if(Ye.iconBox||Ye.verticalIconBox){const wt=!!(!He&&Ye.verticalIconBox);let pt;Ye.iconBox&&(pt=wt),Ye.verticalIconBox&&(pt=!wt),Ln(t.iconCollisionBox.collisionVertexArray,Ce.icon.placed,pt,$e.icon,$?xt.x:0,$?xt.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),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.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return this.fadeDuration===0?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,n){const h=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*h>t}setStale(){this.stale=!0}}function Ln(y,t,n,h,f,x){h&&h.length!==0||(h=[0,0,0,0]);const T=h[0]-tr,C=h[1]-tr,D=h[2]-tr,B=h[3]-tr;y.emplaceBack(t?1:0,n?1:0,f||0,x||0,T,C),y.emplaceBack(t?1:0,n?1:0,f||0,x||0,D,C),y.emplaceBack(t?1:0,n?1:0,f||0,x||0,D,B),y.emplaceBack(t?1:0,n?1:0,f||0,x||0,T,B)}const ar=Math.pow(2,25),Cr=Math.pow(2,24),To=Math.pow(2,17),so=Math.pow(2,16),js=Math.pow(2,9),$a=Math.pow(2,8),ks=Math.pow(2,1);function Ca(y){if(y.opacity===0&&!y.placed)return 0;if(y.opacity===1&&y.placed)return 4294967295;const t=y.placed?1:0,n=Math.floor(127*y.opacity);return n*ar+t*Cr+n*To+t*so+n*js+t*$a+n*ks+t}const qo=0;class zs{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,h,f,x){const T=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(T,f,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,x())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,T.sort(((C,D)=>C.sortKey-D.sortKey)));this._currentPartIndex<T.length;)if(n.placeLayerBucketPart(T[this._currentPartIndex],this._seenCrossTileIDs,h),this._currentPartIndex++,x())return!0;return!1}}class Vi{constructor(t,n,h,f,x,T,C,D){this.placement=new Qa(t,n,T,C,D),this._currentPlacementIndex=h.length-1,this._forceFullPlacement=f,this._showCollisionBoxes=x,this._done=!1}isDone(){return this._done}continuePlacement(t,n,h){const f=Gt(),x=()=>!this._forceFullPlacement&&Gt()-f>2;for(;this._currentPlacementIndex>=0;){const T=n[t[this._currentPlacementIndex]],C=this.placement.collisionIndex.transform.zoom;if(T.type==="symbol"&&(!T.minzoom||T.minzoom<=C)&&(!T.maxzoom||T.maxzoom>C)){if(this._inProgressLayer||(this._inProgressLayer=new zs(T)),this._inProgressLayer.continuePlacement(h[T.source],this.placement,this._showCollisionBoxes,T,x))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const oi=512/p.a5/2;class Ho{constructor(t,n,h){this.tileID=t,this.bucketInstanceId=h,this._symbolsByKey={};const f=new Map;for(let x=0;x<n.length;x++){const T=n.get(x),C=T.key,D=f.get(C);D?D.push(T):f.set(C,[T])}for(const[x,T]of f){const C={positions:T.map((D=>({x:Math.floor(D.anchorX*oi),y:Math.floor(D.anchorY*oi)}))),crossTileIDs:T.map((D=>D.crossTileID))};if(C.positions.length>128){const D=new p.aT(C.positions.length,16,Uint16Array);for(const{x:B,y:N}of C.positions)D.add(B,N);D.finish(),delete C.positions,C.index=D}this._symbolsByKey[x]=C}}getScaledCoordinates(t,n){const{x:h,y:f,z:x}=this.tileID.canonical,{x:T,y:C,z:D}=n.canonical,B=oi/Math.pow(2,D-x),N=(C*p.a5+t.anchorY)*B,G=f*p.a5*oi;return{x:Math.floor((T*p.a5+t.anchorX)*B-h*p.a5*oi),y:Math.floor(N-G)}}findMatches(t,n,h){const f=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let x=0;x<t.length;x++){const T=t.get(x);if(T.crossTileID)continue;const C=this._symbolsByKey[T.key];if(!C)continue;const D=this.getScaledCoordinates(T,n);if(C.index){const B=C.index.range(D.x-f,D.y-f,D.x+f,D.y+f).sort();for(const N of B){const G=C.crossTileIDs[N];if(!h[G]){h[G]=!0,T.crossTileID=G;break}}}else if(C.positions)for(let B=0;B<C.positions.length;B++){const N=C.positions[B],G=C.crossTileIDs[B];if(Math.abs(N.x-D.x)<=f&&Math.abs(N.y-D.y)<=f&&!h[G]){h[G]=!0,T.crossTileID=G;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class Nl{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ia{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const h in this.indexes){const f=this.indexes[h],x={};for(const T in f){const C=f[T];C.tileID=C.tileID.unwrapTo(C.tileID.wrap+n),x[C.tileID.key]=C}this.indexes[h]=x}this.lng=t}addBucket(t,n,h){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let x=0;x<n.symbolInstances.length;x++)n.symbolInstances.get(x).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const f=this.usedCrossTileIDs[t.overscaledZ];for(const x in this.indexes){const T=this.indexes[x];if(Number(x)>t.overscaledZ)for(const C in T){const D=T[C];D.tileID.isChildOf(t)&&D.findMatches(n.symbolInstances,t,f)}else{const C=T[t.scaledTo(Number(x)).key];C&&C.findMatches(n.symbolInstances,t,f)}}for(let x=0;x<n.symbolInstances.length;x++){const T=n.symbolInstances.get(x);T.crossTileID||(T.crossTileID=h.generate(),f[T.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Ho(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const h of n.getCrossTileIDsLists())for(const f of h)delete this.usedCrossTileIDs[t][f]}removeStaleBuckets(t){let n=!1;for(const h in this.indexes){const f=this.indexes[h];for(const x in f)t[f[x].bucketInstanceId]||(this.removeBucketCrossTileIDs(h,f[x]),delete f[x],n=!0)}return n}}class Wn{constructor(){this.layerIndexes={},this.crossTileIDs=new Nl,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,h){let f=this.layerIndexes[t.id];f===void 0&&(f=this.layerIndexes[t.id]=new Ia);let x=!1;const T={};f.handleWrapJump(h);for(const C of n){const D=C.getBucket(t);D&&t.id===D.layerIds[0]&&(D.bucketInstanceId||(D.bucketInstanceId=++this.maxBucketInstanceId),f.addBucket(C.tileID,D,this.crossTileIDs)&&(x=!0),T[D.bucketInstanceId]=!0)}return f.removeStaleBuckets(T)&&(x=!0),x}pruneUnusedLayers(t){const n={};t.forEach((h=>{n[h]=!0}));for(const h in this.layerIndexes)n[h]||delete this.layerIndexes[h]}}var Ht="void main() {fragColor=vec4(1.0);}";const Li={prelude:Dt(`#ifdef GL_ES 9 + precision mediump float; 10 + #else 11 + #if !defined(lowp) 12 + #define lowp 13 + #endif 14 + #if !defined(mediump) 15 + #define mediump 16 + #endif 17 + #if !defined(highp) 18 + #define highp 19 + #endif 20 + #endif 21 + out highp vec4 fragColor;`,`#ifdef GL_ES 22 + precision highp float; 23 + #else 24 + #if !defined(lowp) 25 + #define lowp 26 + #endif 27 + #if !defined(mediump) 28 + #define mediump 29 + #endif 30 + #if !defined(highp) 31 + #define highp 32 + #endif 33 + #endif 34 + vec2 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 35 + );}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;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c 36 + );} 37 + #ifdef TERRAIN3D 38 + uniform 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; 39 + #endif 40 + const 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) { 41 + #ifdef TERRAIN3D 42 + highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0)); 43 + #else 44 + return 1.0; 45 + #endif 46 + }float calculate_visibility(vec4 pos) { 47 + #ifdef TERRAIN3D 48 + vec3 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; 49 + #else 50 + return 1.0; 51 + #endif 52 + }float ele(vec2 pos) { 53 + #ifdef TERRAIN3D 54 + vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; 55 + #else 56 + return 0.0; 57 + #endif 58 + }float get_elevation(vec2 pos) { 59 + #ifdef TERRAIN3D 60 + #ifdef GLOBE 61 + if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;} 62 + #endif 63 + vec2 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; 64 + #else 65 + return 0.0; 66 + #endif 67 + }const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:Dt("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:Dt("",`#define GLOBE_RADIUS 6371008.8 68 + uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos 69 + );}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); 70 + if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len 71 + );if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:Dt(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity; 72 + #ifdef OVERDRAW_INSPECTOR 73 + fragColor=vec4(1.0); 74 + #endif 75 + }`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:Dt(`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;in vec2 v_pos_a;in 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity; 76 + #ifdef OVERDRAW_INSPECTOR 77 + fragColor=vec4(1.0); 78 + #endif 79 + }`,"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;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);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:Dt(`in vec3 v_data;in float v_visibility; 80 + #pragma mapbox: define highp vec4 color 81 + #pragma mapbox: define mediump float radius 82 + #pragma mapbox: define lowp float blur 83 + #pragma mapbox: define lowp float opacity 84 + #pragma mapbox: define highp vec4 stroke_color 85 + #pragma mapbox: define mediump float stroke_width 86 + #pragma mapbox: define lowp float stroke_opacity 87 + void main() { 88 + #pragma mapbox: initialize highp vec4 color 89 + #pragma mapbox: initialize mediump float radius 90 + #pragma mapbox: initialize lowp float blur 91 + #pragma mapbox: initialize lowp float opacity 92 + #pragma mapbox: initialize highp vec4 stroke_color 93 + #pragma mapbox: initialize mediump float stroke_width 94 + #pragma mapbox: initialize lowp float stroke_opacity 95 + vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;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));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;} 96 + #ifdef OVERDRAW_INSPECTOR 97 + fragColor=vec4(1.0); 98 + #endif 99 + }`,`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility; 100 + #pragma mapbox: define highp vec4 color 101 + #pragma mapbox: define mediump float radius 102 + #pragma mapbox: define lowp float blur 103 + #pragma mapbox: define lowp float opacity 104 + #pragma mapbox: define highp vec4 stroke_color 105 + #pragma mapbox: define mediump float stroke_width 106 + #pragma mapbox: define lowp float stroke_opacity 107 + void main(void) { 108 + #pragma mapbox: initialize highp vec4 color 109 + #pragma mapbox: initialize mediump float radius 110 + #pragma mapbox: initialize lowp float blur 111 + #pragma mapbox: initialize lowp float opacity 112 + #pragma mapbox: initialize highp vec4 stroke_color 113 + #pragma mapbox: initialize mediump float stroke_width 114 + #pragma mapbox: initialize lowp float stroke_opacity 115 + vec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) { 116 + #ifdef GLOBE 117 + vec3 center_vector=projectToSphere(circle_center); 118 + #endif 119 + float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else { 120 + #ifdef GLOBE 121 + vec4 projected_center=interpolateProjection(circle_center,center_vector,ele); 122 + #else 123 + vec4 projected_center=projectTileWithElevation(circle_center,ele); 124 + #endif 125 + corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);} 126 + #ifdef GLOBE 127 + vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele); 128 + #else 129 + gl_Position=projectTileWithElevation(corner_position,ele); 130 + #endif 131 + } else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}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;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:Dt(Ht,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:Dt(`uniform highp float u_intensity;in vec2 v_extrude; 132 + #pragma mapbox: define highp float weight 133 + #define GAUSS_COEF 0.3989422804014327 134 + void main() { 135 + #pragma mapbox: initialize highp float weight 136 + float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0); 137 + #ifdef OVERDRAW_INSPECTOR 138 + fragColor=vec4(1.0); 139 + #endif 140 + }`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude; 141 + #pragma mapbox: define highp float weight 142 + #pragma mapbox: define mediump float radius 143 + const highp float ZERO=1.0/255.0/16.0; 144 + #define GAUSS_COEF 0.3989422804014327 145 + void main(void) { 146 + #pragma mapbox: initialize highp float weight 147 + #pragma mapbox: initialize mediump float radius 148 + vec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.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 circle_center=floor(pos_raw/8.0); 149 + #ifdef GLOBE 150 + vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0); 151 + #else 152 + gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center)); 153 + #endif 154 + }`),heatmapTexture:Dt(`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));fragColor=color*u_opacity; 155 + #ifdef OVERDRAW_INSPECTOR 156 + fragColor=vec4(0.0); 157 + #endif 158 + }`,"uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out 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:Dt("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Dt("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;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);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {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;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:Dt(`#ifdef GL_ES 159 + precision highp float; 160 + #endif 161 + uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else 162 + {l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0)); 163 + #ifdef OVERDRAW_INSPECTOR 164 + fragColor=vec4(1.0); 165 + #endif 166 + }`,"uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:Dt("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:Dt(Ht,`in vec2 a_pos;void main() { 167 + #ifdef GLOBE 168 + gl_Position=projectTileFor3D(a_pos,0.0); 169 + #else 170 + gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0); 171 + #endif 172 + }`),fill:Dt(`#pragma mapbox: define highp vec4 color 173 + #pragma mapbox: define lowp float opacity 174 + void main() { 175 + #pragma mapbox: initialize highp vec4 color 176 + #pragma mapbox: initialize lowp float opacity 177 + fragColor=color*opacity; 178 + #ifdef OVERDRAW_INSPECTOR 179 + fragColor=vec4(1.0); 180 + #endif 181 + }`,`uniform vec2 u_fill_translate;in vec2 a_pos; 182 + #pragma mapbox: define highp vec4 color 183 + #pragma mapbox: define lowp float opacity 184 + void main() { 185 + #pragma mapbox: initialize highp vec4 color 186 + #pragma mapbox: initialize lowp float opacity 187 + gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:Dt(`in vec2 v_pos; 188 + #ifdef GLOBE 189 + in float v_depth; 190 + #endif 191 + #pragma mapbox: define highp vec4 outline_color 192 + #pragma mapbox: define lowp float opacity 193 + void main() { 194 + #pragma mapbox: initialize highp vec4 outline_color 195 + #pragma mapbox: initialize lowp float opacity 196 + float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity); 197 + #ifdef GLOBE 198 + if (v_depth > 1.0) {discard;} 199 + #endif 200 + #ifdef OVERDRAW_INSPECTOR 201 + fragColor=vec4(1.0); 202 + #endif 203 + }`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos; 204 + #ifdef GLOBE 205 + out float v_depth; 206 + #endif 207 + #pragma mapbox: define highp vec4 outline_color 208 + #pragma mapbox: define lowp float opacity 209 + void main() { 210 + #pragma mapbox: initialize highp vec4 outline_color 211 + #pragma mapbox: initialize lowp float opacity 212 + gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 213 + #ifdef GLOBE 214 + v_depth=gl_Position.z/gl_Position.w; 215 + #endif 216 + }`),fillOutlinePattern:Dt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos; 217 + #ifdef GLOBE 218 + in float v_depth; 219 + #endif 220 + #pragma mapbox: define lowp float opacity 221 + #pragma mapbox: define lowp vec4 pattern_from 222 + #pragma mapbox: define lowp vec4 pattern_to 223 + void main() { 224 + #pragma mapbox: initialize lowp float opacity 225 + #pragma mapbox: initialize mediump vec4 pattern_from 226 + #pragma mapbox: initialize mediump vec4 pattern_to 227 + vec2 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=texture(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=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity; 228 + #ifdef GLOBE 229 + if (v_depth > 1.0) {discard;} 230 + #endif 231 + #ifdef OVERDRAW_INSPECTOR 232 + fragColor=vec4(1.0); 233 + #endif 234 + }`,`uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos; 235 + #ifdef GLOBE 236 + out float v_depth; 237 + #endif 238 + #pragma mapbox: define lowp float opacity 239 + #pragma mapbox: define lowp vec4 pattern_from 240 + #pragma mapbox: define lowp vec4 pattern_to 241 + #pragma mapbox: define lowp float pixel_ratio_from 242 + #pragma mapbox: define lowp float pixel_ratio_to 243 + void main() { 244 + #pragma mapbox: initialize lowp float opacity 245 + #pragma mapbox: initialize mediump vec4 pattern_from 246 + #pragma mapbox: initialize mediump vec4 pattern_to 247 + #pragma mapbox: initialize lowp float pixel_ratio_from 248 + #pragma mapbox: initialize lowp float pixel_ratio_to 249 + vec2 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=projectTile(a_pos+u_fill_translate,a_pos);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; 250 + #ifdef GLOBE 251 + v_depth=gl_Position.z/gl_Position.w; 252 + #endif 253 + }`),fillPattern:Dt(`#ifdef GL_ES 254 + precision highp float; 255 + #endif 256 + uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b; 257 + #pragma mapbox: define lowp float opacity 258 + #pragma mapbox: define lowp vec4 pattern_from 259 + #pragma mapbox: define lowp vec4 pattern_to 260 + void main() { 261 + #pragma mapbox: initialize lowp float opacity 262 + #pragma mapbox: initialize mediump vec4 pattern_from 263 + #pragma mapbox: initialize mediump vec4 pattern_to 264 + vec2 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity; 265 + #ifdef OVERDRAW_INSPECTOR 266 + fragColor=vec4(1.0); 267 + #endif 268 + }`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b; 269 + #pragma mapbox: define lowp float opacity 270 + #pragma mapbox: define lowp vec4 pattern_from 271 + #pragma mapbox: define lowp vec4 pattern_to 272 + #pragma mapbox: define lowp float pixel_ratio_from 273 + #pragma mapbox: define lowp float pixel_ratio_to 274 + void main() { 275 + #pragma mapbox: initialize lowp float opacity 276 + #pragma mapbox: initialize mediump vec4 pattern_from 277 + #pragma mapbox: initialize mediump vec4 pattern_to 278 + #pragma mapbox: initialize lowp float pixel_ratio_from 279 + #pragma mapbox: initialize lowp float pixel_ratio_to 280 + vec2 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=projectTile(a_pos+u_fill_translate,a_pos);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:Dt(`in vec4 v_color;void main() {fragColor=v_color; 281 + #ifdef OVERDRAW_INSPECTOR 282 + fragColor=vec4(1.0); 283 + #endif 284 + }`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed; 285 + #ifdef TERRAIN3D 286 + in vec2 a_centroid; 287 + #endif 288 + out vec4 v_color; 289 + #pragma mapbox: define highp float base 290 + #pragma mapbox: define highp float height 291 + #pragma mapbox: define highp vec4 color 292 + void main() { 293 + #pragma mapbox: initialize highp float base 294 + #pragma mapbox: initialize highp float height 295 + #pragma mapbox: initialize highp vec4 color 296 + vec3 normal=a_normal_ed.xyz; 297 + #ifdef TERRAIN3D 298 + float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); 299 + #else 300 + float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; 301 + #endif 302 + base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate; 303 + #ifdef GLOBE 304 + vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation); 305 + #else 306 + gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0); 307 + #endif 308 + 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;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0); 309 + #ifdef GLOBE 310 + mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition); 311 + #endif 312 + 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:Dt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting; 313 + #pragma mapbox: define lowp float base 314 + #pragma mapbox: define lowp float height 315 + #pragma mapbox: define lowp vec4 pattern_from 316 + #pragma mapbox: define lowp vec4 pattern_to 317 + #pragma mapbox: define lowp float pixel_ratio_from 318 + #pragma mapbox: define lowp float pixel_ratio_to 319 + void main() { 320 + #pragma mapbox: initialize lowp float base 321 + #pragma mapbox: initialize lowp float height 322 + #pragma mapbox: initialize mediump vec4 pattern_from 323 + #pragma mapbox: initialize mediump vec4 pattern_to 324 + #pragma mapbox: initialize lowp float pixel_ratio_from 325 + #pragma mapbox: initialize lowp float pixel_ratio_to 326 + vec2 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=texture(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=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting; 327 + #ifdef OVERDRAW_INSPECTOR 328 + fragColor=vec4(1.0); 329 + #endif 330 + }`,`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 vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed; 331 + #ifdef TERRAIN3D 332 + in vec2 a_centroid; 333 + #endif 334 + #ifdef GLOBE 335 + out vec3 v_sphere_pos; 336 + #endif 337 + out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting; 338 + #pragma mapbox: define lowp float base 339 + #pragma mapbox: define lowp float height 340 + #pragma mapbox: define lowp vec4 pattern_from 341 + #pragma mapbox: define lowp vec4 pattern_to 342 + #pragma mapbox: define lowp float pixel_ratio_from 343 + #pragma mapbox: define lowp float pixel_ratio_to 344 + void main() { 345 + #pragma mapbox: initialize lowp float base 346 + #pragma mapbox: initialize lowp float height 347 + #pragma mapbox: initialize mediump vec4 pattern_from 348 + #pragma mapbox: initialize mediump vec4 pattern_to 349 + #pragma mapbox: initialize lowp float pixel_ratio_from 350 + #pragma mapbox: initialize lowp float pixel_ratio_to 351 + vec2 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; 352 + #ifdef TERRAIN3D 353 + float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); 354 + #else 355 + float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; 356 + #endif 357 + base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate; 358 + #ifdef GLOBE 359 + vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation); 360 + #else 361 + gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0); 362 + #endif 363 + vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 364 + ? a_pos 365 + : vec2(edgedistance,elevation*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:Dt(`#ifdef GL_ES 366 + precision highp float; 367 + #endif 368 + uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;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))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0); 369 + #ifdef OVERDRAW_INSPECTOR 370 + fragColor=vec4(1.0); 371 + #endif 372 + }`,"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:Dt(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES]; 373 + #define PI 3.141592653589793 374 + #define STANDARD 0 375 + #define COMBINED 1 376 + #define IGOR 2 377 + #define MULTIDIRECTIONAL 3 378 + #define BASIC 4 379 + float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;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_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else 380 + {fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else 381 + {fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);} 382 + #ifdef OVERDRAW_INSPECTOR 383 + fragColor=vec4(1.0); 384 + #endif 385 + }`,"uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:Dt(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale; 386 + #ifdef GLOBE 387 + in float v_depth; 388 + #endif 389 + #pragma mapbox: define highp vec4 color 390 + #pragma mapbox: define lowp float blur 391 + #pragma mapbox: define lowp float opacity 392 + void main() { 393 + #pragma mapbox: initialize highp vec4 color 394 + #pragma mapbox: initialize lowp float blur 395 + #pragma mapbox: initialize lowp float opacity 396 + 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);fragColor=color*(alpha*opacity); 397 + #ifdef GLOBE 398 + if (v_depth > 1.0) {discard;} 399 + #endif 400 + #ifdef OVERDRAW_INSPECTOR 401 + fragColor=vec4(1.0); 402 + #endif 403 + }`,` 404 + #define scale 0.015873016 405 + in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;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 float v_linesofar; 406 + #ifdef GLOBE 407 + out float v_depth; 408 + #endif 409 + #pragma mapbox: define highp vec4 color 410 + #pragma mapbox: define lowp float blur 411 + #pragma mapbox: define lowp float opacity 412 + #pragma mapbox: define mediump float gapwidth 413 + #pragma mapbox: define lowp float offset 414 + #pragma mapbox: define mediump float width 415 + void main() { 416 + #pragma mapbox: initialize highp vec4 color 417 + #pragma mapbox: initialize lowp float blur 418 + #pragma mapbox: initialize lowp float opacity 419 + #pragma mapbox: initialize mediump float gapwidth 420 + #pragma mapbox: initialize lowp float offset 421 + #pragma mapbox: initialize mediump float width 422 + float 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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 423 + #ifdef GLOBE 424 + v_depth=gl_Position.z/gl_Position.w; 425 + #endif 426 + #ifdef TERRAIN3D 427 + v_gamma_scale=1.0; 428 + #else 429 + float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 430 + #endif 431 + v_width2=vec2(outset,inset);}`),lineGradient:Dt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv; 432 + #ifdef GLOBE 433 + in float v_depth; 434 + #endif 435 + #pragma mapbox: define lowp float blur 436 + #pragma mapbox: define lowp float opacity 437 + void main() { 438 + #pragma mapbox: initialize lowp float blur 439 + #pragma mapbox: initialize lowp float opacity 440 + 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);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity); 441 + #ifdef GLOBE 442 + if (v_depth > 1.0) {discard;} 443 + #endif 444 + #ifdef OVERDRAW_INSPECTOR 445 + fragColor=vec4(1.0); 446 + #endif 447 + }`,` 448 + #define scale 0.015873016 449 + in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv; 450 + #ifdef GLOBE 451 + out float v_depth; 452 + #endif 453 + #pragma mapbox: define lowp float blur 454 + #pragma mapbox: define lowp float opacity 455 + #pragma mapbox: define mediump float gapwidth 456 + #pragma mapbox: define lowp float offset 457 + #pragma mapbox: define mediump float width 458 + void main() { 459 + #pragma mapbox: initialize lowp float blur 460 + #pragma mapbox: initialize lowp float opacity 461 + #pragma mapbox: initialize mediump float gapwidth 462 + #pragma mapbox: initialize lowp float offset 463 + #pragma mapbox: initialize mediump float width 464 + float 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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 465 + #ifdef GLOBE 466 + v_depth=gl_Position.z/gl_Position.w; 467 + #endif 468 + #ifdef TERRAIN3D 469 + v_gamma_scale=1.0; 470 + #else 471 + float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 472 + #endif 473 + v_width2=vec2(outset,inset);}`),linePattern:Dt(`#ifdef GL_ES 474 + precision highp float; 475 + #endif 476 + uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;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; 477 + #ifdef GLOBE 478 + in float v_depth; 479 + #endif 480 + #pragma mapbox: define lowp vec4 pattern_from 481 + #pragma mapbox: define lowp vec4 pattern_to 482 + #pragma mapbox: define lowp float pixel_ratio_from 483 + #pragma mapbox: define lowp float pixel_ratio_to 484 + #pragma mapbox: define lowp float blur 485 + #pragma mapbox: define lowp float opacity 486 + void main() { 487 + #pragma mapbox: initialize mediump vec4 pattern_from 488 + #pragma mapbox: initialize mediump vec4 pattern_to 489 + #pragma mapbox: initialize lowp float pixel_ratio_from 490 + #pragma mapbox: initialize lowp float pixel_ratio_to 491 + #pragma mapbox: initialize lowp float blur 492 + #pragma mapbox: initialize lowp float opacity 493 + vec2 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(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity; 494 + #ifdef GLOBE 495 + if (v_depth > 1.0) {discard;} 496 + #endif 497 + #ifdef OVERDRAW_INSPECTOR 498 + fragColor=vec4(1.0); 499 + #endif 500 + }`,` 501 + #define scale 0.015873016 502 + #define LINE_DISTANCE_SCALE 2.0 503 + in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;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; 504 + #ifdef GLOBE 505 + out float v_depth; 506 + #endif 507 + #pragma mapbox: define lowp float blur 508 + #pragma mapbox: define lowp float opacity 509 + #pragma mapbox: define lowp float offset 510 + #pragma mapbox: define mediump float gapwidth 511 + #pragma mapbox: define mediump float width 512 + #pragma mapbox: define lowp float floorwidth 513 + #pragma mapbox: define lowp vec4 pattern_from 514 + #pragma mapbox: define lowp vec4 pattern_to 515 + #pragma mapbox: define lowp float pixel_ratio_from 516 + #pragma mapbox: define lowp float pixel_ratio_to 517 + void main() { 518 + #pragma mapbox: initialize lowp float blur 519 + #pragma mapbox: initialize lowp float opacity 520 + #pragma mapbox: initialize lowp float offset 521 + #pragma mapbox: initialize mediump float gapwidth 522 + #pragma mapbox: initialize mediump float width 523 + #pragma mapbox: initialize lowp float floorwidth 524 + #pragma mapbox: initialize mediump vec4 pattern_from 525 + #pragma mapbox: initialize mediump vec4 pattern_to 526 + #pragma mapbox: initialize lowp float pixel_ratio_from 527 + #pragma mapbox: initialize lowp float pixel_ratio_to 528 + float 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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 529 + #ifdef GLOBE 530 + v_depth=gl_Position.z/gl_Position.w; 531 + #endif 532 + #ifdef TERRAIN3D 533 + v_gamma_scale=1.0; 534 + #else 535 + float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 536 + #endif 537 + v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Dt(`uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale; 538 + #ifdef GLOBE 539 + in float v_depth; 540 + #endif 541 + #pragma mapbox: define highp vec4 color 542 + #pragma mapbox: define lowp float blur 543 + #pragma mapbox: define lowp float opacity 544 + #pragma mapbox: define mediump float width 545 + #pragma mapbox: define lowp float floorwidth 546 + #pragma mapbox: define mediump vec4 dasharray_from 547 + #pragma mapbox: define mediump vec4 dasharray_to 548 + void main() { 549 + #pragma mapbox: initialize highp vec4 color 550 + #pragma mapbox: initialize lowp float blur 551 + #pragma mapbox: initialize lowp float opacity 552 + #pragma mapbox: initialize mediump float width 553 + #pragma mapbox: initialize lowp float floorwidth 554 + #pragma mapbox: initialize mediump vec4 dasharray_from 555 + #pragma mapbox: initialize mediump vec4 dasharray_to 556 + 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 sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity); 557 + #ifdef GLOBE 558 + if (v_depth > 1.0) {discard;} 559 + #endif 560 + #ifdef OVERDRAW_INSPECTOR 561 + fragColor=vec4(1.0); 562 + #endif 563 + }`,` 564 + #define scale 0.015873016 565 + #define LINE_DISTANCE_SCALE 2.0 566 + in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale; 567 + #ifdef GLOBE 568 + out float v_depth; 569 + #endif 570 + #pragma mapbox: define highp vec4 color 571 + #pragma mapbox: define lowp float blur 572 + #pragma mapbox: define lowp float opacity 573 + #pragma mapbox: define mediump float gapwidth 574 + #pragma mapbox: define lowp float offset 575 + #pragma mapbox: define mediump float width 576 + #pragma mapbox: define lowp float floorwidth 577 + #pragma mapbox: define mediump vec4 dasharray_from 578 + #pragma mapbox: define mediump vec4 dasharray_to 579 + void main() { 580 + #pragma mapbox: initialize highp vec4 color 581 + #pragma mapbox: initialize lowp float blur 582 + #pragma mapbox: initialize lowp float opacity 583 + #pragma mapbox: initialize mediump float gapwidth 584 + #pragma mapbox: initialize lowp float offset 585 + #pragma mapbox: initialize mediump float width 586 + #pragma mapbox: initialize lowp float floorwidth 587 + #pragma mapbox: initialize mediump vec4 dasharray_from 588 + #pragma mapbox: initialize mediump vec4 dasharray_to 589 + float 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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 590 + #ifdef GLOBE 591 + v_depth=gl_Position.z/gl_Position.w; 592 + #endif 593 + #ifdef TERRAIN3D 594 + v_gamma_scale=1.0; 595 + #else 596 + float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 597 + #endif 598 + float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),lineGradientSDF:Dt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv; 599 + #ifdef GLOBE 600 + in float v_depth; 601 + #endif 602 + #pragma mapbox: define lowp float blur 603 + #pragma mapbox: define lowp float opacity 604 + #pragma mapbox: define mediump float width 605 + #pragma mapbox: define lowp float floorwidth 606 + #pragma mapbox: define mediump vec4 dasharray_from 607 + #pragma mapbox: define mediump vec4 dasharray_to 608 + void main() { 609 + #pragma mapbox: initialize lowp float blur 610 + #pragma mapbox: initialize lowp float opacity 611 + #pragma mapbox: initialize mediump float width 612 + #pragma mapbox: initialize lowp float floorwidth 613 + #pragma mapbox: initialize mediump vec4 dasharray_from 614 + #pragma mapbox: initialize mediump vec4 dasharray_to 615 + 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);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity); 616 + #ifdef GLOBE 617 + if (v_depth > 1.0) {discard;} 618 + #endif 619 + #ifdef OVERDRAW_INSPECTOR 620 + fragColor=vec4(1.0); 621 + #endif 622 + }`,` 623 + #define scale 0.015873016 624 + #define LINE_DISTANCE_SCALE 2.0 625 + in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b; 626 + #ifdef GLOBE 627 + out float v_depth; 628 + #endif 629 + #pragma mapbox: define lowp float blur 630 + #pragma mapbox: define lowp float opacity 631 + #pragma mapbox: define mediump float gapwidth 632 + #pragma mapbox: define lowp float offset 633 + #pragma mapbox: define mediump float width 634 + #pragma mapbox: define lowp float floorwidth 635 + #pragma mapbox: define mediump vec4 dasharray_from 636 + #pragma mapbox: define mediump vec4 dasharray_to 637 + void main() { 638 + #pragma mapbox: initialize lowp float blur 639 + #pragma mapbox: initialize lowp float opacity 640 + #pragma mapbox: initialize mediump float gapwidth 641 + #pragma mapbox: initialize lowp float offset 642 + #pragma mapbox: initialize mediump float width 643 + #pragma mapbox: initialize lowp float floorwidth 644 + #pragma mapbox: initialize mediump vec4 dasharray_from 645 + #pragma mapbox: initialize mediump vec4 dasharray_to 646 + float 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;float texel_height=1.0/u_image_height;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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude; 647 + #ifdef GLOBE 648 + v_depth=gl_Position.z/gl_Position.w; 649 + #endif 650 + #ifdef TERRAIN3D 651 + v_gamma_scale=1.0; 652 + #else 653 + float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 654 + #endif 655 + float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),raster:Dt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in 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=texture(u_image0,v_pos0);vec4 color1=texture(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);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a); 656 + #ifdef OVERDRAW_INSPECTOR 657 + fragColor=vec4(1.0); 658 + #endif 659 + }`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5; 660 + #ifdef GLOBE 661 + if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;} 662 + #endif 663 + v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:Dt(`uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity; 664 + #pragma mapbox: define lowp float opacity 665 + void main() { 666 + #pragma mapbox: initialize lowp float opacity 667 + lowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha; 668 + #ifdef OVERDRAW_INSPECTOR 669 + fragColor=vec4(1.0); 670 + #endif 671 + }`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity; 672 + #pragma mapbox: define lowp float opacity 673 + void main() { 674 + #pragma mapbox: initialize lowp float opacity 675 + vec2 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? 676 + camera_to_anchor_distance/u_camera_to_center_distance : 677 + u_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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0; 678 + #ifdef GLOBE 679 + if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} 680 + #endif 681 + vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;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:Dt(`#define SDF_PX 8.0 682 + uniform 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;in vec2 v_data0;in vec3 v_data1; 683 + #pragma mapbox: define highp vec4 fill_color 684 + #pragma mapbox: define highp vec4 halo_color 685 + #pragma mapbox: define lowp float opacity 686 + #pragma mapbox: define lowp float halo_width 687 + #pragma mapbox: define lowp float halo_blur 688 + void main() { 689 + #pragma mapbox: initialize highp vec4 fill_color 690 + #pragma mapbox: initialize highp vec4 halo_color 691 + #pragma mapbox: initialize lowp float opacity 692 + #pragma mapbox: initialize lowp float halo_width 693 + #pragma mapbox: initialize lowp float halo_blur 694 + float 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 inner_edge=(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);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity); 695 + #ifdef OVERDRAW_INSPECTOR 696 + fragColor=vec4(1.0); 697 + #endif 698 + }`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;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_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1; 699 + #pragma mapbox: define highp vec4 fill_color 700 + #pragma mapbox: define highp vec4 halo_color 701 + #pragma mapbox: define lowp float opacity 702 + #pragma mapbox: define lowp float halo_width 703 + #pragma mapbox: define lowp float halo_blur 704 + void main() { 705 + #pragma mapbox: initialize highp vec4 fill_color 706 + #pragma mapbox: initialize highp vec4 halo_color 707 + #pragma mapbox: initialize lowp float opacity 708 + #pragma mapbox: initialize lowp float halo_width 709 + #pragma mapbox: initialize lowp float halo_blur 710 + vec2 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? 711 + camera_to_anchor_distance/u_camera_to_center_distance : 712 + u_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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0; 713 + #ifdef GLOBE 714 + if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} 715 + #endif 716 + vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;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:Dt(`#define SDF_PX 8.0 717 + #define SDF 1.0 718 + #define ICON 0.0 719 + uniform 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;in vec4 v_data0;in vec4 v_data1; 720 + #pragma mapbox: define highp vec4 fill_color 721 + #pragma mapbox: define highp vec4 halo_color 722 + #pragma mapbox: define lowp float opacity 723 + #pragma mapbox: define lowp float halo_width 724 + #pragma mapbox: define lowp float halo_blur 725 + void main() { 726 + #pragma mapbox: initialize highp vec4 fill_color 727 + #pragma mapbox: initialize highp vec4 halo_color 728 + #pragma mapbox: initialize lowp float opacity 729 + #pragma mapbox: initialize lowp float halo_width 730 + #pragma mapbox: initialize lowp float halo_blur 731 + float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha; 732 + #ifdef OVERDRAW_INSPECTOR 733 + fragColor=vec4(1.0); 734 + #endif 735 + return;}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=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity); 736 + #ifdef OVERDRAW_INSPECTOR 737 + fragColor=vec4(1.0); 738 + #endif 739 + }`,`in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in 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_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;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1; 740 + #pragma mapbox: define highp vec4 fill_color 741 + #pragma mapbox: define highp vec4 halo_color 742 + #pragma mapbox: define lowp float opacity 743 + #pragma mapbox: define lowp float halo_width 744 + #pragma mapbox: define lowp float halo_blur 745 + void main() { 746 + #pragma mapbox: initialize highp vec4 fill_color 747 + #pragma mapbox: initialize highp vec4 halo_color 748 + #pragma mapbox: initialize lowp float opacity 749 + #pragma mapbox: initialize lowp float halo_width 750 + #pragma mapbox: initialize lowp float halo_blur 751 + vec2 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? 752 + camera_to_anchor_distance/u_camera_to_center_distance : 753 + u_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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0; 754 + #ifdef GLOBE 755 + if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);} 756 + #endif 757 + vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;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:Dt("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:Dt("in 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() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:Dt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:Dt("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:Dt(`#ifdef GL_ES 758 + precision highp float; 759 + #endif 760 + in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758 761 + );color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:Dt("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function Dt(y,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,h=t.match(/in ([\w]+) ([\w]+)/g),f=y.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),x=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),T=x?x.concat(f):f,C={};return{fragmentSource:y=y.replace(n,((D,B,N,G,U)=>(C[U]=!0,B==="define"?` 762 + #ifndef HAS_UNIFORM_u_${U} 763 + in ${N} ${G} ${U}; 764 + #else 765 + uniform ${N} ${G} u_${U}; 766 + #endif 767 + `:` 768 + #ifdef HAS_UNIFORM_u_${U} 769 + ${N} ${G} ${U} = u_${U}; 770 + #endif 771 + `))),vertexSource:t=t.replace(n,((D,B,N,G,U)=>{const $=G==="float"?"vec2":"vec4",ie=U.match(/color/)?"color":$;return C[U]?B==="define"?` 772 + #ifndef HAS_UNIFORM_u_${U} 773 + uniform lowp float u_${U}_t; 774 + in ${N} ${$} a_${U}; 775 + out ${N} ${G} ${U}; 776 + #else 777 + uniform ${N} ${G} u_${U}; 778 + #endif 779 + `:ie==="vec4"?` 780 + #ifndef HAS_UNIFORM_u_${U} 781 + ${U} = a_${U}; 782 + #else 783 + ${N} ${G} ${U} = u_${U}; 784 + #endif 785 + `:` 786 + #ifndef HAS_UNIFORM_u_${U} 787 + ${U} = unpack_mix_${ie}(a_${U}, u_${U}_t); 788 + #else 789 + ${N} ${G} ${U} = u_${U}; 790 + #endif 791 + `:B==="define"?` 792 + #ifndef HAS_UNIFORM_u_${U} 793 + uniform lowp float u_${U}_t; 794 + in ${N} ${$} a_${U}; 795 + #else 796 + uniform ${N} ${G} u_${U}; 797 + #endif 798 + `:ie==="vec4"?` 799 + #ifndef HAS_UNIFORM_u_${U} 800 + ${N} ${G} ${U} = a_${U}; 801 + #else 802 + ${N} ${G} ${U} = u_${U}; 803 + #endif 804 + `:` 805 + #ifndef HAS_UNIFORM_u_${U} 806 + ${N} ${G} ${U} = unpack_mix_${ie}(a_${U}, u_${U}_t); 807 + #else 808 + ${N} ${G} ${U} = u_${U}; 809 + #endif 810 + `})),staticAttributes:h,staticUniforms:T}}class Ki{constructor(t,n,h){this.vertexBuffer=t,this.indexBuffer=n,this.segments=h}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var Zs=p.aU([{name:"a_pos",type:"Int16",components:2}]);const cn="#define PROJECTION_MERCATOR",gn="mercator";class Lr{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return gn}get shaderDefine(){return cn}get shaderPreludeCode(){return Li.projectionMercator}get vertexShaderPreludeCode(){return Li.projectionMercator.vertexSource}get subdivisionGranularity(){return p.aV.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(t){}getMeshFromTileID(t,n,h,f,x){if(this._cachedMesh)return this._cachedMesh;const T=new p.aW;T.emplaceBack(0,0),T.emplaceBack(p.a5,0),T.emplaceBack(0,p.a5),T.emplaceBack(p.a5,p.a5);const C=t.createVertexBuffer(T,Zs.members),D=p.aX.simpleSegment(0,0,4,2),B=new p.aY;B.emplaceBack(1,0,2),B.emplaceBack(1,2,3);const N=t.createIndexBuffer(B);return this._cachedMesh=new Ki(C,N,D),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(t){}}class Us{constructor(t=0,n=0,h=0,f=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(h)||h<0||isNaN(f)||f<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=h,this.right=f}interpolate(t,n,h){return n.top!=null&&t.top!=null&&(this.top=p.G.number(t.top,n.top,h)),n.bottom!=null&&t.bottom!=null&&(this.bottom=p.G.number(t.bottom,n.bottom,h)),n.left!=null&&t.left!=null&&(this.left=p.G.number(t.left,n.left,h)),n.right!=null&&t.right!=null&&(this.right=p.G.number(t.right,n.right,h)),this}getCenter(t,n){const h=p.an((this.left+t-this.right)/2,0,t),f=p.an((this.top+n-this.bottom)/2,0,n);return new p.P(h,f)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Us(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Qn(y,t){if(!y.renderWorldCopies||y.lngRange)return;const n=t.lng-y.center.lng;t.lng+=n>180?-360:n<-180?360:0}function Si(y){return Math.max(0,Math.floor(y))}class $n{constructor(t,n){var h;this.applyConstrain=(f,x)=>this._constrainOverride!==null?this._constrainOverride(f,x):this._callbacks.defaultConstrain(f,x),this._callbacks=t,this._tileSize=512,this._renderWorldCopies=(n==null?void 0:n.renderWorldCopies)===void 0||!!(n!=null&&n.renderWorldCopies),this._minZoom=(n==null?void 0:n.minZoom)||0,this._maxZoom=(n==null?void 0:n.maxZoom)||22,this._minPitch=(n==null?void 0:n.minPitch)==null?0:n==null?void 0:n.minPitch,this._maxPitch=(n==null?void 0:n.maxPitch)==null?60:n==null?void 0:n.maxPitch,this._constrainOverride=(h=n==null?void 0:n.constrainOverride)!==null&&h!==void 0?h:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new p.V(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Si(this._zoom),this._scale=p.aq(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Us,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,n,h){this._constrainOverride=t.constrainOverride,this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=Si(this._zoom),this._scale=p.aq(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new Us(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=!h&&t.autoCalculateNearFarZ,n&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(t){this._minZoom!==t&&(this._minZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(t){this._minPitch!==t&&(this._minPitch=t,this.setPitch(Math.max(this.pitch,t)))}get maxPitch(){return this._maxPitch}setMaxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.setPitch(Math.min(this.pitch,t)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get constrainOverride(){return this._constrainOverride}setConstrainOverride(t){t===void 0&&(t=null),this._constrainOverride!==t&&(this._constrainOverride=t,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new p.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){const n=p.W(t,-180,180)*Math.PI/180;var h,f,x,T,C,D,B,N,G;this._bearingInRadians!==n&&(this._unmodified=!1,this._bearingInRadians=n,this._calcMatrices(),this._rotationMatrix=ur(),h=this._rotationMatrix,x=-this._bearingInRadians,T=(f=this._rotationMatrix)[0],C=f[1],D=f[2],B=f[3],N=Math.sin(x),G=Math.cos(x),h[0]=T*G+D*N,h[1]=C*G+B*N,h[2]=T*-N+D*G,h[3]=C*-N+B*G)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){const n=p.an(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==n&&(this._unmodified=!1,this._pitchInRadians=n,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){const n=t/180*Math.PI;this._rollInRadians!==n&&(this._unmodified=!1,this._rollInRadians=n,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return p.aZ(this._fovInRadians)}setFov(t){t=p.an(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=p.ap(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){const n=this.applyConstrain(this._center,t).zoom;this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this._tileZoom=Math.max(0,Math.floor(n)),this._scale=p.aq(n),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(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)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(t,n){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=n,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,h){this._unmodified=!1,this._edgeInsets.interpolate(t,n,h),this.constrainInternal(),this._calcMatrices()}resize(t,n,h=!0){this._width=t,this._height=n,h&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange&&this._latRange.length===2&&this._lngRange&&this._lngRange.length===2?new Ui([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-p.ao,p.ao])}getCameraQueryGeometry(t,n){if(n.length===1)return[n[0],t];{const{minX:h,minY:f,maxX:x,maxY:T}=p.aa.fromPoints(n).extend(t);return[new p.P(h,f),new p.P(x,f),new p.P(x,T),new p.P(h,T),new p.P(h,f)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:n,zoom:h}=this.applyConstrain(this.center,this.zoom);this.setCenter(n),this.setZoom(h),this._unmodified=t,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=p.ar(new Float64Array(16));p.Q(t,t,[this._width/2,-this._height/2,1]),p.O(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=p.ar(new Float64Array(16)),p.Q(t,t,[1,-1,1]),p.O(t,t,[-1,-1,0]),p.Q(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,n,h,f){const x=h!==void 0?h:this.bearing,T=f=f!==void 0?f:this.pitch,{distanceToCenter:C,clampedElevation:D}=this._distanceToCenterFromAltElevationPitch(n,this.elevation,T),{x:B,y:N}=Hi(T,x),G=p.a9.fromLngLat(t,n);let U,$,ie=p.a_(1,G.y),he=0;do{if(he+=1,he>10)break;$=C/ie,U=new p.a9(G.x+B*$,G.y+N*$),ie=1/U.meterInMercatorCoordinateUnits()}while(Math.abs(C-$*ie)>1e-12);return{center:U.toLngLat(),elevation:D,zoom:p.at(this.height/2/Math.tan(this.fovInRadians/2)/$/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;const n=1/this.worldSize,h=p.as(1,this.center.lat)*this.worldSize,f=p.a9.fromLngLat(this.center,this.elevation),x=f.x/n,T=f.y/n,C=f.z/n,D=this.pitch,B=this.bearing,{x:N,y:G,z:U}=Hi(D,B),$=this.cameraToCenterDistance,ie=x+$*-N,he=T+$*-G,Ae=C+$*U,{distanceToCenter:ce,clampedElevation:ye}=this._distanceToCenterFromAltElevationPitch(Ae/h,t,D),Pe=ce*h,_e=new p.a9((ie+N*Pe)*n,(he+G*Pe)*n,0).toLngLat(),we=p.as(1,_e.lat),Ce=p.at(this.height/2/Math.tan(this.fovInRadians/2)/ce/we/this.tileSize);this._elevation=ye,this._center=_e,this.setZoom(Ce)}_distanceToCenterFromAltElevationPitch(t,n,h){const f=-Math.cos(p.ap(h)),x=t-n;let T,C=n;return f*x>=0||Math.abs(f)<.1?(T=1e4,C=t+T*f):T=-x/f,{distanceToCenter:T,clampedElevation:C}}getCameraPoint(){const t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new p.P(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const t=p.as(1,this.center.lat)*this.worldSize;return qe(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/t).toLngLat()}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];const n=t.canonical.z>=0?1<<t.canonical.z:Math.pow(2,t.canonical.z);return[t.canonical.x/n,t.canonical.y/n,1/n/p.a5,1/n/p.a5]}}class gs{constructor(t,n){this.min=t,this.max=n,this.center=p.a$([],p.b0([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],h=p.b1(this.min),f=p.b1(this.max);for(let x=0;x<n.length;x++)h[x]=n[x]?this.min[x]:this.center[x],f[x]=n[x]?this.center[x]:this.max[x];return f[2]=this.max[2],new gs(h,f)}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]}intersectsFrustum(t){let n=!0;for(let h=0;h<t.planes.length;h++){const f=this.intersectsPlane(t.planes[h]);if(f===0)return 0;f===1&&(n=!1)}return n?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let n=t[3],h=t[3];for(let f=0;f<3;f++)t[f]>0?(n+=t[f]*this.min[f],h+=t[f]*this.max[f]):(h+=t[f]*this.min[f],n+=t[f]*this.max[f]);return n>=0?2:h<0?0:1}}class ca{distanceToTile2d(t,n,h,f){const x=f.distanceX([t,n]),T=f.distanceY([t,n]);return Math.hypot(x,T)}getWrap(t,n,h){return h}getTileBoundingVolume(t,n,h,f){var x,T;let C=0,D=0;if(f!=null&&f.terrain){const N=new p.a2(t.z,n,t.z,t.x,t.y),G=f.terrain.getMinMaxElevation(N);C=(x=G.minElevation)!==null&&x!==void 0?x:Math.min(0,h),D=(T=G.maxElevation)!==null&&T!==void 0?T:Math.max(0,h)}const B=1<<t.z;return new gs([n+t.x/B,t.y/B,C],[n+(t.x+1)/B,(t.y+1)/B,D])}allowVariableZoom(t,n){const h=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,f=p.an(78.5-h/2,0,60);return!!n.terrain||t.pitch>f}allowWorldCopies(){return!0}prepareNextFrame(){}}class Yn{constructor(t,n,h){this.points=t,this.planes=n,this.aabb=h}static fromInvProjectionMatrix(t,n=1,h=0,f,x){const T=x?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],C=Math.pow(2,h),D=[[-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((U=>(function($,ie,he,Ae){const ce=p.aH([],$,ie),ye=1/ce[3]/he*Ae;return p.b6(ce,ce,[ye,ye,1/ce[3],ye])})(U,t,n,C)));f&&(function(U,$,ie,he){const Ae=he?4:0,ce=he?0:4;let ye=0;const Pe=[],_e=[];for(let be=0;be<4;be++){const Le=p.b2([],U[be+ce],U[be+Ae]),Ke=p.b7(Le);p.a$(Le,Le,1/Ke),Pe.push(Ke),_e.push(Le)}for(let be=0;be<4;be++){const Le=p.b8(U[be+Ae],_e[be],ie);ye=Le!==null&&Le>=0?Math.max(ye,Le):Math.max(ye,Pe[be])}const we=(function(be,Le){const Ke=p.b2([],be[Le[0]],be[Le[1]]),He=p.b2([],be[Le[2]],be[Le[1]]),$e=[0,0,0,0];return p.b3($e,p.b4([],Ke,He)),$e[3]=-p.b5($e,be[Le[0]]),$e})(U,$),Ce=(function(be,Le){const Ke=p.b9(be),He=p.ba([],be,1/Ke),$e=p.b2([],Le,p.a$([],He,p.b5(Le,He))),Ye=p.b9($e);if(Ye>0){const xt=Math.sqrt(1-He[3]*He[3]),wt=p.a$([],He,-He[3]),pt=p.b0([],wt,p.a$([],$e,xt/Ye));return p.bb(Le,pt)}return null})(ie,we);if(Ce!==null){const be=Ce/p.b5(_e[0],we);ye=Math.min(ye,be)}for(let be=0;be<4;be++){const Le=Math.min(ye,Pe[be]);U[be+ce]=[U[be+Ae][0]+_e[be][0]*Le,U[be+Ae][1]+_e[be][1]*Le,U[be+Ae][2]+_e[be][2]*Le,1]}})(D,T[0],f,x);const B=T.map((U=>{const $=p.b2([],D[U[0]],D[U[1]]),ie=p.b2([],D[U[2]],D[U[1]]),he=p.b3([],p.b4([],$,ie)),Ae=-p.b5(he,D[U[1]]);return he.concat(Ae)})),N=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],G=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const U of D)for(let $=0;$<3;$++)N[$]=Math.min(N[$],U[$]),G[$]=Math.max(G[$],U[$]);return new Yn(D,B,new gs(N,G))}}class Po{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,n,h){return this._helper.interpolatePadding(t,n,h)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n,h=!0){this._helper.resize(t,n,h)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,n){this._helper.overrideNearFarZ(t,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,n){}constructor(t){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(n,h)=>{h=p.an(+h,this.minZoom,this.maxZoom);const f={center:new p.V(n.lng,n.lat),zoom:h};let x=this._helper._lngRange;if(!this._helper._renderWorldCopies&&x===null){const _e=179.9999999999;x=[-_e,_e]}const T=this.tileSize*p.aq(f.zoom);let C=0,D=T,B=0,N=T,G=0,U=0;const{x:$,y:ie}=this.size;if(this._helper._latRange){const _e=this._helper._latRange;C=p.X(_e[1])*T,D=p.X(_e[0])*T,D-C<ie&&(G=ie/(D-C))}x&&(B=p.W(p.Y(x[0])*T,0,T),N=p.W(p.Y(x[1])*T,0,T),N<B&&(N+=T),N-B<$&&(U=$/(N-B)));const{x:he,y:Ae}=je(T,n);let ce,ye;const Pe=Math.max(U||0,G||0);if(Pe){const _e=new p.P(U?(N+B)/2:he,G?(D+C)/2:Ae);return f.center=Xt(T,_e).wrap(),f.zoom+=p.at(Pe),f}if(this._helper._latRange){const _e=ie/2;Ae-_e<C&&(ye=C+_e),Ae+_e>D&&(ye=D-_e)}if(x){const _e=(B+N)/2;let we=he;this._helper._renderWorldCopies&&(we=p.W(he,_e-T/2,_e+T/2));const Ce=$/2;we-Ce<B&&(ce=B+Ce),we+Ce>N&&(ce=N-Ce)}if(ce!==void 0||ye!==void 0){const _e=new p.P(ce??he,ye??Ae);f.center=Xt(T,_e).wrap()}return f},this.applyConstrain=(n,h)=>this._helper.applyConstrain(n,h),this._helper=new $n({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,h)=>this.defaultConstrain(n,h)},t),this._coveringTilesDetailsProvider=new ca}clone(){const t=new Po;return t.apply(this,!1),t}apply(t,n,h){this._helper.apply(t,n,h)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){const n=[new p.bc(0,t)];if(this._helper._renderWorldCopies){const h=this.screenPointToMercatorCoordinate(new p.P(0,0)),f=this.screenPointToMercatorCoordinate(new p.P(this._helper._width,0)),x=this.screenPointToMercatorCoordinate(new p.P(this._helper._width,this._helper._height)),T=this.screenPointToMercatorCoordinate(new p.P(0,this._helper._height)),C=Math.floor(Math.min(h.x,f.x,x.x,T.x)),D=Math.floor(Math.max(h.x,f.x,x.x,T.x)),B=1;for(let N=C-B;N<=D+B;N++)N!==0&&n.push(new p.bc(N,t))}return n}getCameraFrustum(){return Yn.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){const n=this.screenPointToLocation(this.centerPoint,t),h=t?t.getElevationForLngLatZoom(n,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(h)}setLocationAtPoint(t,n){const h=p.as(this.elevation,this.center.lat),f=this.screenPointToMercatorCoordinateAtZ(n,h),x=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,h),T=p.a9.fromLngLat(t),C=new p.a9(T.x-(f.x-x.x),T.y-(f.y-x.y));this.setCenter(C==null?void 0:C.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,n){return n?this.coordinatePoint(p.a9.fromLngLat(t),n.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(p.a9.fromLngLat(t))}screenPointToLocation(t,n){var h;return(h=this.screenPointToMercatorCoordinate(t,n))===null||h===void 0?void 0:h.toLngLat()}screenPointToMercatorCoordinate(t,n){if(n){const h=n.pointCoordinate(t);if(h!=null)return h}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,n){const h=n||0,f=[t.x,t.y,0,1],x=[t.x,t.y,1,1];p.aH(f,f,this._pixelMatrixInverse),p.aH(x,x,this._pixelMatrixInverse);const T=f[3],C=x[3],D=f[1]/T,B=x[1]/C,N=f[2]/T,G=x[2]/C,U=N===G?0:(h-N)/(G-N);return new p.a9(p.G.number(f[0]/T,x[0]/C,U)/this.worldSize,p.G.number(D,B,U)/this.worldSize,h)}coordinatePoint(t,n=0,h=this._pixelMatrix){const f=[t.x*this.worldSize,t.y*this.worldSize,n,1];return p.aH(f,f,h),new p.P(f[0]/f[3],f[1]/f[3])}getBounds(){const t=Math.max(0,this._helper._height/2-Gi(this));return new Ui().extend(this.screenPointToLocation(new p.P(0,t))).extend(this.screenPointToLocation(new p.P(this._helper._width,t))).extend(this.screenPointToLocation(new p.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new p.P(0,this._helper._height)))}isPointOnMapSurface(t,n){return n?n.pointCoordinate(t)!=null:t.y>this.height/2-Gi(this)}calculatePosMatrix(t,n=!1,h){var f;const x=(f=t.key)!==null&&f!==void 0?f:p.bd(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),T=n?this._alignedPosMatrixCache:this._posMatrixCache;if(T.has(x)){const B=T.get(x);return h?B.f32:B.f64}const C=Bi(t,this.worldSize);p.S(C,n?this._alignedProjMatrix:this._viewProjMatrix,C);const D={f64:C,f32:new Float32Array(C)};return T.set(x,D),h?D.f32:D.f64}calculateFogMatrix(t){const n=t.key,h=this._fogMatrixCacheF32;if(h.has(n))return h.get(n);const f=Bi(t,this.worldSize);return p.S(f,this._fogMatrix,f),h.set(n,new Float32Array(f)),h.get(n)}calculateCenterFromCameraLngLatAlt(t,n,h,f){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,h,f)}_calculateNearFarZIfNeeded(t,n,h){if(!this._helper.autoCalculateNearFarZ)return;const f=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),x=t-f*this._helper._pixelPerMeter/Math.cos(n),T=f<0?x:t,C=Math.PI/2+this.pitchInRadians,D=p.ap(this.fov)*(Math.abs(Math.cos(p.ap(this.roll)))*this.height+Math.abs(Math.sin(p.ap(this.roll)))*this.width)/this.height*(.5+h.y/this.height),B=Math.sin(D)*T/Math.sin(p.an(Math.PI-C-D,.01,Math.PI-.01)),N=Gi(this),G=Math.atan(N/this._helper.cameraToCenterDistance),U=p.ap(.75),$=G>U?2*G*(.5+h.y/(2*N)):U,ie=Math.sin($)*T/Math.sin(p.an(Math.PI-C-$,.01,Math.PI-.01)),he=Math.min(B,ie);this._helper._farZ=1.01*(Math.cos(Math.PI/2-n)*he+T),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const t=this.centerOffset,n=je(this.worldSize,this.center),h=n.x,f=n.y;this._helper._pixelPerMeter=p.as(1,this.center.lat)*this.worldSize;const x=p.ap(Math.min(this.pitch,St)),T=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(x));let C;this._calculateNearFarZIfNeeded(T,x,t),C=new Float64Array(16),p.be(C,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),p.aB(this._invProjMatrix,C),C[8]=2*-t.x/this._helper._width,C[9]=2*t.y/this._helper._height,this._projectionMatrix=p.bf(C),p.Q(C,C,[1,-1,1]),p.O(C,C,[0,0,-this._helper.cameraToCenterDistance]),p.bg(C,C,-this.rollInRadians),p.bh(C,C,this.pitchInRadians),p.bg(C,C,-this.bearingInRadians),p.O(C,C,[-h,-f,0]),this._mercatorMatrix=p.Q([],C,[this.worldSize,this.worldSize,this.worldSize]),p.Q(C,C,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=p.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,C),p.O(C,C,[0,0,-this.elevation]),this._viewProjMatrix=C,this._invViewProjMatrix=p.aB([],C);const D=[0,0,-1,1];p.aH(D,D,this._invViewProjMatrix),this._cameraPosition=[D[0]/D[3],D[1]/D[3],D[2]/D[3]],this._fogMatrix=new Float64Array(16),p.be(this._fogMatrix,this.fovInRadians,this.width/this.height,T,this._helper._farZ),this._fogMatrix[8]=2*-t.x/this.width,this._fogMatrix[9]=2*t.y/this.height,p.Q(this._fogMatrix,this._fogMatrix,[1,-1,1]),p.O(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),p.bg(this._fogMatrix,this._fogMatrix,-this.rollInRadians),p.bh(this._fogMatrix,this._fogMatrix,this.pitchInRadians),p.bg(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),p.O(this._fogMatrix,this._fogMatrix,[-h,-f,0]),p.Q(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),p.O(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=p.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,C);const B=this._helper._width%2/2,N=this._helper._height%2/2,G=Math.cos(this.bearingInRadians),U=Math.sin(-this.bearingInRadians),$=h-Math.round(h)+G*B+U*N,ie=f-Math.round(f)+G*N+U*B,he=new Float64Array(C);if(p.O(he,he,[$>.5?$-1:$,ie>.5?ie-1:ie,0]),this._alignedProjMatrix=he,C=p.aB(new Float64Array(16),this._pixelMatrix),!C)throw new Error("failed to invert matrix");this._pixelMatrixInverse=C,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const t=this.screenPointToMercatorCoordinate(new p.P(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return p.aH(n,n,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const t=p.as(1,this.center.lat)*this.worldSize;return qe(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}lngLatToCameraDepth(t,n){const h=p.a9.fromLngLat(t),f=[h.x*this.worldSize,h.y*this.worldSize,n,1];return p.aH(f,f,this._viewProjMatrix),f[2]/f[3]}getProjectionData(t){const{overscaledTileID:n,aligned:h,applyTerrainMatrix:f}=t,x=this._helper.getMercatorTileCoordinates(n),T=n?this.calculatePosMatrix(n,h,!0):null;let C;return C=n&&n.terrainRttPosMatrix32f&&f?n.terrainRttPosMatrix32f:T||p.bi(),{mainMatrix:C,tileMercatorCoords:x,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:C}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,n,h){return 1}transformLightDirection(t){return p.b1(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,n,h,f){const x=this.calculatePosMatrix(h);let T;f?(T=[t,n,f(t,n),1],p.aH(T,T,x)):(T=[t,n,0,1],te(T,T,x));const C=T[3];return{point:new p.P(T[0]/C,T[1]/C),signedDistanceFromCamera:C,isOccluded:!1}}populateCache(t){for(const n of t)this.calculatePosMatrix(n)}getMatrixForModel(t,n){const h=p.a9.fromLngLat(t,n),f=h.meterInMercatorCoordinateUnits(),x=p.bj();return p.O(x,x,[h.x,h.y,h.z]),p.bg(x,x,Math.PI),p.bh(x,x,Math.PI/2),p.Q(x,x,[-f,f,f]),x}getProjectionDataForCustomLayer(t=!0){const n=new p.a2(0,0,0,0,0),h=this.getProjectionData({overscaledTileID:n,applyGlobeMatrix:t}),f=Bi(n,this.worldSize);p.S(f,this._viewProjMatrix,f),h.tileMercatorCoords=[0,0,1,1];const x=[p.a5,p.a5,this.worldSize/this._helper.pixelsPerMeter],T=p.bk();return p.Q(T,f,x),h.fallbackMatrix=T,h.mainMatrix=T,h}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}}function Ls(){p.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Vl(y){if(y.useSlerp)if(y.k<1){const t=p.bl(y.startEulerAngles.roll,y.startEulerAngles.pitch,y.startEulerAngles.bearing),n=p.bl(y.endEulerAngles.roll,y.endEulerAngles.pitch,y.endEulerAngles.bearing),h=new Float64Array(4);p.bm(h,t,n,y.k);const f=p.bn(h);y.tr.setRoll(f.roll),y.tr.setPitch(f.pitch),y.tr.setBearing(f.bearing)}else y.tr.setRoll(y.endEulerAngles.roll),y.tr.setPitch(y.endEulerAngles.pitch),y.tr.setBearing(y.endEulerAngles.bearing);else y.tr.setRoll(p.G.number(y.startEulerAngles.roll,y.endEulerAngles.roll,y.k)),y.tr.setPitch(p.G.number(y.startEulerAngles.pitch,y.endEulerAngles.pitch,y.k)),y.tr.setBearing(p.G.number(y.startEulerAngles.bearing,y.endEulerAngles.bearing,y.k))}function Qr(y,t,n,h,f){const x=f.padding,T=je(f.worldSize,n.getNorthWest()),C=je(f.worldSize,n.getNorthEast()),D=je(f.worldSize,n.getSouthEast()),B=je(f.worldSize,n.getSouthWest()),N=p.ap(-h),G=T.rotate(N),U=C.rotate(N),$=D.rotate(N),ie=B.rotate(N),he=new p.P(Math.max(G.x,U.x,ie.x,$.x),Math.max(G.y,U.y,ie.y,$.y)),Ae=new p.P(Math.min(G.x,U.x,ie.x,$.x),Math.min(G.y,U.y,ie.y,$.y)),ce=he.sub(Ae),ye=(f.width-(x.left+x.right+t.left+t.right))/ce.x,Pe=(f.height-(x.top+x.bottom+t.top+t.bottom))/ce.y;if(Pe<0||ye<0)return void Ls();const _e=Math.min(p.at(f.scale*Math.min(ye,Pe)),y.maxZoom),we=p.P.convert(y.offset),Ce=new p.P((t.left-t.right)/2,(t.top-t.bottom)/2).rotate(p.ap(h)),be=we.add(Ce).mult(f.scale/p.aq(_e));return{center:Xt(f.worldSize,T.add(D).div(2).sub(be)),zoom:_e,bearing:h}}class hi{get useGlobeControls(){return!1}handlePanInertia(t,n){const h=t.mag(),f=Math.abs(Gi(n));return{easingOffset:t.mult(Math.min(.75*f/h,1)),easingCenter:n.center}}handleMapControlsRollPitchBearingZoom(t,n){t.bearingDelta&&n.setBearing(n.bearing+t.bearingDelta),t.pitchDelta&&n.setPitch(n.pitch+t.pitchDelta),t.rollDelta&&n.setRoll(n.roll+t.rollDelta),t.zoomDelta&&n.setZoom(n.zoom+t.zoomDelta)}handleMapControlsPan(t,n,h){t.around.distSqr(n.centerPoint)<.01||n.setLocationAtPoint(h,t.around)}cameraForBoxAndBearing(t,n,h,f,x){return Qr(t,n,h,f,x)}handleJumpToCenterZoom(t,n){t.zoom!==(n.zoom!==void 0?+n.zoom:t.zoom)&&t.setZoom(+n.zoom),n.center!==void 0&&t.setCenter(p.V.convert(n.center))}handleEaseTo(t,n){const h=t.zoom,f=t.padding,x={roll:t.roll,pitch:t.pitch,bearing:t.bearing},T={roll:n.roll===void 0?t.roll:n.roll,pitch:n.pitch===void 0?t.pitch:n.pitch,bearing:n.bearing===void 0?t.bearing:n.bearing},C=n.zoom!==void 0,D=!t.isPaddingEqual(n.padding);let B=!1;const N=C?+n.zoom:t.zoom;let G=t.centerPoint.add(n.offsetAsPoint);const U=t.screenPointToLocation(G),{center:$,zoom:ie}=t.applyConstrain(p.V.convert(n.center||U),N??h);Qn(t,$);const he=je(t.worldSize,U),Ae=je(t.worldSize,$).sub(he),ce=p.aq(ie-h);return B=ie!==h,{easeFunc:ye=>{if(B&&t.setZoom(p.G.number(h,ie,ye)),p.bo(x,T)||Vl({startEulerAngles:x,endEulerAngles:T,tr:t,k:ye,useSlerp:x.roll!=T.roll}),D&&(t.interpolatePadding(f,n.padding,ye),G=t.centerPoint.add(n.offsetAsPoint)),n.around)t.setLocationAtPoint(n.around,n.aroundPoint);else{const Pe=p.aq(t.zoom-h),_e=ie>h?Math.min(2,ce):Math.max(.5,ce),we=Math.pow(_e,1-ye),Ce=Xt(t.worldSize,he.add(Ae.mult(ye*we)).mult(Pe));t.setLocationAtPoint(t.renderWorldCopies?Ce.wrap():Ce,G)}},isZooming:B,elevationCenter:$}}handleFlyTo(t,n){const h=n.zoom!==void 0,f=t.zoom,x=t.applyConstrain(p.V.convert(n.center||n.locationAtOffset),h?+n.zoom:f),T=x.center,C=x.zoom;Qn(t,T);const D=je(t.worldSize,n.locationAtOffset),B=je(t.worldSize,T).sub(D),N=B.mag(),G=p.aq(C-f);let U;if(n.minZoom!==void 0){const $=Math.min(+n.minZoom,f,C),ie=t.applyConstrain(T,$).zoom;U=p.aq(ie-f)}return{easeFunc:($,ie,he,Ae)=>{t.setZoom($===1?C:f+p.at(ie));const ce=$===1?T:Xt(t.worldSize,D.add(B.mult(he)).mult(ie));t.setLocationAtPoint(t.renderWorldCopies?ce.wrap():ce,Ae)},scaleOfZoom:G,targetCenter:T,scaleOfMinZoom:U,pixelPathLength:N}}}class bi{constructor(t,n,h){this.blendFunction=t,this.blendColor=n,this.mask=h}}bi.Replace=[1,0],bi.disabled=new bi(bi.Replace,p.bp.transparent,[!1,!1,!1,!1]),bi.unblended=new bi(bi.Replace,p.bp.transparent,[!0,!0,!0,!0]),bi.alphaBlended=new bi([1,771],p.bp.transparent,[!0,!0,!0,!0]);const nn=2305;class wi{constructor(t,n,h){this.enable=t,this.mode=n,this.frontFace=h}}wi.disabled=new wi(!1,1029,nn),wi.backCCW=new wi(!0,1029,nn),wi.frontCCW=new wi(!0,1028,nn);class ri{constructor(t,n,h){this.func=t,this.mask=n,this.range=h}}ri.ReadOnly=!1,ri.ReadWrite=!0,ri.disabled=new ri(519,ri.ReadOnly,[0,1]);const Aa=7680;class Ci{constructor(t,n,h,f,x,T){this.test=t,this.ref=n,this.mask=h,this.fail=f,this.depthFail=x,this.pass=T}}Ci.disabled=new Ci({func:519,mask:0},0,0,Aa,Aa,Aa);const Da=new WeakMap;function Xn(y){var t;if(Da.has(y))return Da.get(y);{const n=(t=y.getParameter(y.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return Da.set(y,n),n}}class oo{get awaitingQuery(){return!!this._readbackQueue}constructor(t){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=t;const n=t.context,h=n.gl;this._texFormat=h.RGBA,this._texType=h.UNSIGNED_BYTE;const f=new p.aW;f.emplaceBack(-1,-1),f.emplaceBack(2,-1),f.emplaceBack(-1,2);const x=new p.aY;x.emplaceBack(0,1,2),this._fullscreenTriangle=new Ki(n.createVertexBuffer(f,Zs.members),n.createIndexBuffer(x),p.aX.simpleSegment(0,0,f.length,x.length)),this._resultBuffer=new Uint8Array(4),n.activeTexture.set(h.TEXTURE1);const T=h.createTexture();h.bindTexture(h.TEXTURE_2D,T),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.NEAREST),h.texImage2D(h.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=n.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(T),Xn(h)&&(this._pbo=h.createBuffer(),h.bindBuffer(h.PIXEL_PACK_BUFFER,this._pbo),h.bufferData(h.PIXEL_PACK_BUFFER,4,h.STREAM_READ),h.bindBuffer(h.PIXEL_PACK_BUFFER,null))}destroy(){const t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,n){const h=this._updateCount;return this._readbackQueue?h>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():h>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,n),this._updateCount++,this._measuredError}_bindFramebuffer(){const t=this._cachedRenderContext.context,n=t.gl;t.activeTexture.set(n.TEXTURE1),n.bindTexture(n.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,n){const h=this._cachedRenderContext.context,f=h.gl;if(this._bindFramebuffer(),h.viewport.set([0,0,this._texWidth,this._texHeight]),h.clear({color:p.bp.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(h,f.TRIANGLES,ri.disabled,Ci.disabled,bi.unblended,wi.disabled,((x,T)=>({u_input:x,u_output_expected:T}))(t,n),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&Xn(f)){f.bindBuffer(f.PIXEL_PACK_BUFFER,this._pbo),f.readBuffer(f.COLOR_ATTACHMENT0),f.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),f.bindBuffer(f.PIXEL_PACK_BUFFER,null);const x=f.fenceSync(f.SYNC_GPU_COMMANDS_COMPLETE,0);f.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:x}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&Xn(t)){const n=t.clientWaitSync(this._readbackQueue.sync,0,0);if(n===t.WAIT_FAILED)return p.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(n===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=oo._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let n=0;return n+=t[0]/256,n+=t[1]/65536,n+=t[2]/16777216,t[3]<127&&(n=-n),n/128}}const Kn=p.a5/128;function ka(y,t){const n=y.granularity!==void 0?Math.max(y.granularity,1):1,h=n+(y.generateBorders?2:0),f=n+(y.extendToNorthPole||y.generateBorders?1:0)+(y.extendToSouthPole||y.generateBorders?1:0),x=h+1,T=f+1,C=y.generateBorders?-1:0,D=y.generateBorders||y.extendToNorthPole?-1:0,B=n+(y.generateBorders?1:0),N=n+(y.generateBorders||y.extendToSouthPole?1:0),G=x*T,U=h*f*6,$=x*T>65536;if($&&t==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const ie=$||t==="32bit",he=new Int16Array(2*G);let Ae=0;for(let Pe=D;Pe<=N;Pe++)for(let _e=C;_e<=B;_e++){let we=_e/n*p.a5;_e===-1&&(we=-Kn),_e===n+1&&(we=p.a5+Kn);let Ce=Pe/n*p.a5;Pe===-1&&(Ce=y.extendToNorthPole?p.br:-Kn),Pe===n+1&&(Ce=y.extendToSouthPole?p.bs:p.a5+Kn),he[Ae++]=we,he[Ae++]=Ce}const ce=ie?new Uint32Array(U):new Uint16Array(U);let ye=0;for(let Pe=0;Pe<f;Pe++)for(let _e=0;_e<h;_e++){const we=_e+1+Pe*x,Ce=_e+(Pe+1)*x,be=_e+1+(Pe+1)*x;ce[ye++]=_e+Pe*x,ce[ye++]=Ce,ce[ye++]=we,ce[ye++]=we,ce[ye++]=Ce,ce[ye++]=be}return{vertices:he.buffer.slice(0),indices:ce.buffer.slice(0),uses32bitIndices:ie}}const fa=new p.aV({fill:new p.bt(128,2),line:new p.bt(512,0),tile:new p.bt(128,32),stencil:new p.bt(128,1),circle:3});class Bn{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return Li.projectionGlobe}get vertexShaderPreludeCode(){return Li.projectionMercator.vertexSource}get subdivisionGranularity(){return fa}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(t){this._errorMeasurement||(this._errorMeasurement=new oo(t));const n=p.X(this._errorQueryLatitudeDegrees),h=2*Math.atan(Math.exp(Math.PI-n*Math.PI*2))-.5*Math.PI,f=this._errorMeasurement.updateErrorLoop(n,h),x=Gt();f!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=f,this._errorMeasurementLastChangeTime=x);const T=Math.min(Math.max((x-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=p.bu(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,p.bv(T))}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,n,h,f,x){const T=(x==="stencil"?fa.stencil:fa.tile).getGranularityForZoomLevel(n.z);return this._getMesh(t,{granularity:T,generateBorders:h,extendToNorthPole:n.y===0&&f,extendToSouthPole:n.y===(1<<n.z)-1&&f})}_getMesh(t,n){const h=this._getMeshKey(n);if(h in this._tileMeshCache)return this._tileMeshCache[h];const f=(function(x,T){const C=ka(T,"16bit"),D=p.aW.deserialize({arrayBuffer:C.vertices,length:C.vertices.byteLength/2/2}),B=p.aY.deserialize({arrayBuffer:C.indices,length:C.indices.byteLength/2/3});return new Ki(x.createVertexBuffer(D,Zs.members),x.createIndexBuffer(B),p.aX.simpleSegment(0,0,D.length,B.length))})(t,n);return this._tileMeshCache[h]=f,f}recalculate(t){}hasTransition(){const t=Gt();let n=!1;return n=n||(t-this._errorMeasurementLastChangeTime)/1e3<.7,n=n||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,n}setErrorQueryLatitudeDegrees(t){this._errorQueryLatitudeDegrees=t}}const Wo=new p.t({type:new p.D(p.u.projection.type)});class Gs extends p.E{constructor(t){super(),this._transitionable=new p.x(Wo,void 0),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new p.H(0)),this._mercatorProjection=new Lr,this._verticalPerspectiveProjection=new Bn}get transitionState(){const t=this.properties.get("type");if(typeof t=="string"&&t==="mercator")return 0;if(typeof t=="string"&&t==="vertical-perspective")return 1;if(t instanceof p.bw){if(t.from==="vertical-perspective"&&t.to==="mercator")return 1-t.transition;if(t.from==="mercator"&&t.to==="vertical-perspective")return t.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(t){this._mercatorProjection.updateGPUdependent(t),this._verticalPerspectiveProjection.updateGPUdependent(t)}getMeshFromTileID(t,n,h,f,x){return this.currentProjection.getMeshFromTileID(t,n,h,f,x)}setProjection(t){this._transitionable.setValue("type",(t==null?void 0:t.type)||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}setErrorQueryLatitudeDegrees(t){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(t),this._mercatorProjection.setErrorQueryLatitudeDegrees(t)}}function xr(y){const t=ao(y.worldSize,y.center.lat);return 2*Math.PI*t}function ys(y,t,n,h,f){const x=1/(1<<f),T=t/p.a5*x+h*x,C=p.by((y/p.a5*x+n*x)*Math.PI*2+Math.PI,2*Math.PI),D=2*Math.atan(Math.exp(Math.PI-T*Math.PI*2))-.5*Math.PI,B=Math.cos(D),N=new Float64Array(3);return N[0]=Math.sin(C)*B,N[1]=Math.sin(D),N[2]=Math.cos(C)*B,N}function ir(y){return(function(t,n){const h=Math.cos(n),f=new Float64Array(3);return f[0]=Math.sin(t)*h,f[1]=Math.sin(n),f[2]=Math.cos(t)*h,f})(y.lng*Math.PI/180,y.lat*Math.PI/180)}function ao(y,t){return y/(2*Math.PI)/Math.cos(t*Math.PI/180)}function yl(y){const t=Math.asin(y[1])/Math.PI*180,n=Math.sqrt(y[0]*y[0]+y[2]*y[2]);if(n>1e-6){const h=y[0]/n,f=Math.acos(y[2]/n),x=(h>0?f:-f)/Math.PI*180;return new p.V(p.W(x,-180,180),t)}return new p.V(0,t)}function Qo(y){return Math.cos(y*Math.PI/180)}function dr(y,t){const n=Qo(y),h=Qo(t);return p.at(h/n)}function jl(y,t){const n=y.rotate(t.bearingInRadians),h=t.zoom+dr(t.center.lat,0),f=p.bu(1/Qo(t.center.lat),1/Qo(Math.min(Math.abs(t.center.lat),60)),p.bx(h,7,3,0,1)),x=360/xr({worldSize:t.worldSize,center:{lat:t.center.lat}});return new p.V(t.center.lng-n.x*x*f,p.an(t.center.lat+n.y*x,-p.ao,p.ao))}function vl(y){const t=.5*y,n=Math.sin(t),h=Math.cos(t);return Math.log(n+h)-Math.log(h-n)}function Ya(y,t,n,h){const f=y.lat+n*h;if(Math.abs(n)>1){const x=(Math.sign(y.lat+n)!==Math.sign(y.lat)?-Math.abs(y.lat):Math.abs(y.lat))*Math.PI/180,T=Math.abs(y.lat+n)*Math.PI/180,C=vl(x+h*(T-x)),D=vl(x),B=vl(T);return new p.V(y.lng+t*((C-D)/(B-D)),f)}return new p.V(y.lng+t*h,f)}class uu{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;const t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,n,h,f){const x=`${t.z}_${t.x}_${t.y}_${f!=null&&f.terrain?"t":""}`,T=this._cache.get(x);if(T)return T;const C=this._cachePrevious.get(x);if(C)return this._cache.set(x,C),C;const D=this._boundingVolumeFactory(t,n,h,f);return this._cache.set(x,D),this._hadAnyChanges=!0,D}}class Mo{constructor(t,n,h,f){this.min=h,this.max=f,this.points=t,this.planes=n}static fromAabb(t,n){const h=[];for(let f=0;f<8;f++)h.push([1&~f?t[0]:n[0],(f>>1&1)==1?n[1]:t[1],(f>>2&1)==1?n[2]:t[2]]);return new Mo(h,[[-1,0,0,n[0]],[1,0,0,-t[0]],[0,-1,0,n[1]],[0,1,0,-t[1]],[0,0,-1,n[2]],[0,0,1,-t[2]]],t,n)}static fromCenterSizeAngles(t,n,h){const f=p.bB([],h[0],h[1],h[2]),x=p.bC([],[n[0],0,0],f),T=p.bC([],[0,n[1],0],f),C=p.bC([],[0,0,n[2]],f),D=[...t],B=[...t];for(let G=0;G<8;G++)for(let U=0;U<3;U++){const $=t[U]+x[U]*(1&~G?-1:1)+T[U]*((G>>1&1)==1?1:-1)+C[U]*((G>>2&1)==1?1:-1);D[U]=Math.min(D[U],$),B[U]=Math.max(B[U],$)}const N=[];for(let G=0;G<8;G++){const U=[...t];p.b0(U,U,p.a$([],x,1&~G?-1:1)),p.b0(U,U,p.a$([],T,(G>>1&1)==1?1:-1)),p.b0(U,U,p.a$([],C,(G>>2&1)==1?1:-1)),N.push(U)}return new Mo(N,[[...x,-p.b5(x,N[0])],[...T,-p.b5(T,N[0])],[...C,-p.b5(C,N[0])],[-x[0],-x[1],-x[2],-p.b5(x,N[7])],[-T[0],-T[1],-T[2],-p.b5(T,N[7])],[-C[0],-C[1],-C[2],-p.b5(C,N[7])]],D,B)}intersectsFrustum(t){let n=!0;const h=this.points.length,f=this.planes.length,x=t.planes.length,T=t.points.length;for(let C=0;C<x;C++){const D=t.planes[C];let B=0;for(let N=0;N<h;N++){const G=this.points[N];D[0]*G[0]+D[1]*G[1]+D[2]*G[2]+D[3]>=0&&B++}if(B===0)return 0;B<h&&(n=!1)}if(n)return 2;for(let C=0;C<f;C++){const D=this.planes[C];let B=0;for(let N=0;N<T;N++){const G=t.points[N];D[0]*G[0]+D[1]*G[1]+D[2]*G[2]+D[3]>=0&&B++}if(B===0)return 0}return 1}intersectsPlane(t){const n=this.points.length;let h=0;for(let f=0;f<n;f++){const x=this.points[f];t[0]*x[0]+t[1]*x[1]+t[2]*x[2]+t[3]>=0&&h++}return h===n?2:h===0?0:1}}function za(y,t,n){const h=y-t;return h<0?-h:Math.max(0,h-n)}function lo(y,t,n,h,f){const x=y-n;let T;return T=x<0?Math.min(-x,1+x-f):x>1?Math.min(Math.max(x-f,0),1-x):0,Math.max(T,za(t,h,f))}class vs{constructor(){this._boundingVolumeCache=new uu(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,n,h,f){const x=1<<h.z,T=1/x,C=h.x/x,D=h.y/x;let B=2;return B=Math.min(B,lo(t,n,C,D,T)),B=Math.min(B,lo(t,n,C+.5,-D-T,T)),B=Math.min(B,lo(t,n,C+.5,2-D-T,T)),B}getWrap(t,n,h){const f=1<<n.z,x=1/f,T=n.x/f,C=za(t.x,T,x),D=za(t.x,T-1,x),B=za(t.x,T+1,x),N=Math.min(C,D,B);return N===B?1:N===D?-1:0}allowVariableZoom(t,n){return Wi(t,n)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,n,h,f){return this._boundingVolumeCache.getTileBoundingVolume(t,n,h,f)}_computeTileBoundingVolume(t,n,h,f){var x,T;let C=0,D=0;if(f!=null&&f.terrain){const B=new p.a2(t.z,n,t.z,t.x,t.y),N=f.terrain.getMinMaxElevation(B);C=(x=N.minElevation)!==null&&x!==void 0?x:Math.min(0,h),D=(T=N.maxElevation)!==null&&T!==void 0?T:Math.max(0,h)}if(C/=p.bE,D/=p.bE,C+=1,D+=1,t.z<=0)return Mo.fromAabb([-D,-D,-D],[D,D,D]);if(t.z===1)return Mo.fromAabb([t.x===0?-D:0,t.y===0?0:-D,-D],[t.x===0?0:D,t.y===0?D:0,D]);{const B=[ys(0,0,t.x,t.y,t.z),ys(p.a5,0,t.x,t.y,t.z),ys(p.a5,p.a5,t.x,t.y,t.z),ys(0,p.a5,t.x,t.y,t.z)],N=[];for(const $e of B)N.push(p.a$([],$e,D));if(D!==C)for(const $e of B)N.push(p.a$([],$e,C));t.y===0&&N.push([0,1,0]),t.y===(1<<t.z)-1&&N.push([0,-1,0]);const G=[1,1,1],U=[-1,-1,-1];for(const $e of N)for(let Ye=0;Ye<3;Ye++)G[Ye]=Math.min(G[Ye],$e[Ye]),U[Ye]=Math.max(U[Ye],$e[Ye]);const $=ys(p.a5/2,p.a5/2,t.x,t.y,t.z),ie=p.b4([],[0,1,0],$);p.b3(ie,ie);const he=p.b4([],$,ie);p.b3(he,he);const Ae=p.b4([],B[2],B[1]);p.b3(Ae,Ae);const ce=p.b4([],B[0],B[3]);p.b3(ce,ce),N.push(p.a$([],$,D)),t.y>=(1<<t.z)/2&&N.push(p.a$([],ys(p.a5/2,0,t.x,t.y,t.z),D)),t.y<(1<<t.z)/2&&N.push(p.a$([],ys(p.a5/2,p.a5,t.x,t.y,t.z),D));const ye=La($,N),Pe=La(he,N),_e=[-$[0],-$[1],-$[2],ye.max],we=[$[0],$[1],$[2],-ye.min],Ce=[-he[0],-he[1],-he[2],Pe.max],be=[he[0],he[1],he[2],-Pe.min],Le=[...Ae,0],Ke=[...ce,0],He=[];return t.y===0?He.push(p.bD(Ke,Le,_e),p.bD(Ke,Le,we)):He.push(p.bD(Ce,Le,_e),p.bD(Ce,Le,we),p.bD(Ce,Ke,_e),p.bD(Ce,Ke,we)),t.y===(1<<t.z)-1?He.push(p.bD(Ke,Le,_e),p.bD(Ke,Le,we)):He.push(p.bD(be,Le,_e),p.bD(be,Le,we),p.bD(be,Ke,_e),p.bD(be,Ke,we)),new Mo(He,[_e,we,Ce,be,Le,Ke],G,U)}}}function La(y,t){let n=1/0,h=-1/0;for(const f of t){const x=p.b5(y,f);n=Math.min(n,x),h=Math.max(h,x)}return{min:n,max:h}}class qs{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,n,h){return this._helper.interpolatePadding(t,n,h)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n){this._helper.resize(t,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,n){this._helper.overrideNearFarZ(t,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t){this._cachedClippingPlane=p.bF(),this._projectionMatrix=p.bj(),this._globeViewProjMatrix32f=p.bi(),this._globeViewProjMatrixNoCorrection=p.bj(),this._globeViewProjMatrixNoCorrectionInverted=p.bj(),this._globeProjMatrixInverted=p.bj(),this._cameraPosition=p.bz(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(n,h)=>{const f=p.an(n.lat,-p.ao,p.ao),x=p.an(+h,this.minZoom+dr(0,f),this.maxZoom);return{center:new p.V(n.lng,f),zoom:x}},this.applyConstrain=(n,h)=>this._helper.applyConstrain(n,h),this._helper=new $n({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,h)=>this.defaultConstrain(n,h)},t),this._coveringTilesDetailsProvider=new vs}clone(){const t=new qs;return t.apply(this,!1),t}apply(t,n,h){this._globeLatitudeErrorCorrectionRadians=h||0,this._helper.apply(t,n)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const t=p.bz();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){const{overscaledTileID:n,applyGlobeMatrix:h}=t,f=this._helper.getMercatorTileCoordinates(n);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:f,clippingPlane:this._cachedClippingPlane,projectionTransition:h?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){const n=this.pitchInRadians,h=this.cameraToCenterDistance/t,f=Math.sin(n)*h,x=Math.cos(n)*h+1,T=1/Math.sqrt(f*f+x*x)*1;let C=-f,D=x;const B=Math.sqrt(C*C+D*D);C/=B,D/=B;const N=[0,C,D];p.bG(N,N,[0,0,0],-this.bearingInRadians),p.bH(N,N,[0,0,0],-1*this.center.lat*Math.PI/180),p.bI(N,N,[0,0,0],this.center.lng*Math.PI/180);const G=1/p.b7(N);return p.a$(N,N,G),[...N,-T*G]}isLocationOccluded(t){return!this.isSurfacePointVisible(ir(t))}transformLightDirection(t){const n=this._helper._center.lng*Math.PI/180,h=this._helper._center.lat*Math.PI/180,f=Math.cos(h),x=[Math.sin(n)*f,Math.sin(h),Math.cos(n)*f],T=[x[2],0,-x[0]],C=[0,0,0];p.b4(C,T,x),p.b3(T,T),p.b3(C,C);const D=[0,0,0];return p.b3(D,[T[0]*t[0]+C[0]*t[1]+x[0]*t[2],T[1]*t[0]+C[1]*t[1]+x[1]*t[2],T[2]*t[0]+C[2]*t[1]+x[2]*t[2]]),D}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,n,h){const f=(function(C,D,B){const N=1/(1<<B.z);return new p.a9(C/p.a5*N+B.x*N,D/p.a5*N+B.y*N)})(t,n,h.canonical),x=(T=f.y,[p.by(f.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-T*Math.PI*2))-.5*Math.PI]);var T;return this.getCircleRadiusCorrection()/Math.cos(x[1])}projectTileCoordinates(t,n,h,f){const x=h.canonical,T=ys(t,n,x.x,x.y,x.z),C=1+(f?f(t,n):0)/p.bE,D=[T[0]*C,T[1]*C,T[2]*C,1];p.aH(D,D,this._globeViewProjMatrixNoCorrection);const B=this._cachedClippingPlane,N=B[0]*T[0]+B[1]*T[1]+B[2]*T[2]+B[3]<0;return{point:new p.P(D[0]/D[3],D[1]/D[3]),signedDistanceFromCamera:D[3],isOccluded:N}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const t=ao(this.worldSize,this.center.lat),n=p.bk(),h=p.bk();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),p.be(n,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const f=this.centerOffset;n[8]=2*-f.x/this._helper._width,n[9]=2*f.y/this._helper._height,this._projectionMatrix=p.bf(n),this._globeProjMatrixInverted=p.bk(),p.aB(this._globeProjMatrixInverted,n),p.O(n,n,[0,0,-this.cameraToCenterDistance]),p.bg(n,n,this.rollInRadians),p.bh(n,n,-this.pitchInRadians),p.bg(n,n,this.bearingInRadians),p.O(n,n,[0,0,-t]);const x=p.bz();x[0]=t,x[1]=t,x[2]=t,p.bh(h,n,this.center.lat*Math.PI/180),p.bJ(h,h,-this.center.lng*Math.PI/180),p.Q(h,h,x),this._globeViewProjMatrixNoCorrection=h,p.bh(n,n,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),p.bJ(n,n,-this.center.lng*Math.PI/180),p.Q(n,n,x),this._globeViewProjMatrix32f=new Float32Array(n),this._globeViewProjMatrixNoCorrectionInverted=p.bk(),p.aB(this._globeViewProjMatrixNoCorrectionInverted,h);const T=p.bz();this._cameraPosition=p.bz(),this._cameraPosition[2]=this.cameraToCenterDistance/t,p.bG(this._cameraPosition,this._cameraPosition,T,-this.rollInRadians),p.bH(this._cameraPosition,this._cameraPosition,T,this.pitchInRadians),p.bG(this._cameraPosition,this._cameraPosition,T,-this.bearingInRadians),p.b0(this._cameraPosition,this._cameraPosition,[0,0,1]),p.bH(this._cameraPosition,this._cameraPosition,T,-this.center.lat*Math.PI/180),p.bI(this._cameraPosition,this._cameraPosition,T,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);const C=p.bf(this._globeViewProjMatrixNoCorrectionInverted);p.Q(C,C,[1,1,-1]),this._cachedFrustum=Yn.fromInvProjectionMatrix(C,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){p.w("calculateFogMatrix is not supported on globe projection.");const n=p.bk();return p.ar(n),n}getVisibleUnwrappedCoordinates(t){return[new p.bc(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&p.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,n){if(!this._globeViewProjMatrixNoCorrection)return 1;const h=ir(t);p.a$(h,h,1+n/p.bE);const f=p.bF();return p.aH(f,[h[0],h[1],h[2],1],this._globeViewProjMatrixNoCorrection),f[2]/f[3]}populateCache(t){}getBounds(){const t=.5*this.width,n=.5*this.height,h=[new p.P(0,0),new p.P(t,0),new p.P(this.width,0),new p.P(this.width,n),new p.P(this.width,this.height),new p.P(t,this.height),new p.P(0,this.height),new p.P(0,n)],f=[];for(const G of h)f.push(this.unprojectScreenPoint(G));let x=0,T=0,C=0,D=0;const B=this.center;for(const G of f){const U=p.bK(B.lng,G.lng),$=p.bK(B.lat,G.lat);U<T&&(T=U),U>x&&(x=U),$<D&&(D=$),$>C&&(C=$)}const N=[B.lng+T,B.lat+D,B.lng+x,B.lat+C];return this.isSurfacePointOnScreen([0,1,0])&&(N[3]=90,N[0]=-180,N[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(N[1]=-90,N[0]=-180,N[2]=180),new Ui(N)}calculateCenterFromCameraLngLatAlt(t,n,h,f){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,h,f)}setLocationAtPoint(t,n){const h=ir(this.unprojectScreenPoint(n)),f=ir(t),x=p.bz();p.bL(x);const T=p.bz();p.bI(T,h,x,-this.center.lng*Math.PI/180),p.bH(T,T,x,this.center.lat*Math.PI/180);const C=f[0]*f[0]+f[2]*f[2],D=T[0]*T[0];if(C<D)return;const B=Math.sqrt(C-D),N=-B,G=p.bM(f[0],f[2],T[0],B),U=p.bM(f[0],f[2],T[0],N),$=p.bz();p.bI($,f,x,-G);const ie=p.bM($[1],$[2],T[1],T[2]),he=p.bz();p.bI(he,f,x,-U);const Ae=p.bM(he[1],he[2],T[1],T[2]),ce=.5*Math.PI,ye=ie>=-ce&&ie<=ce,Pe=Ae>=-ce&&Ae<=ce;let _e,we;if(ye&&Pe){const Ke=this.center.lng*Math.PI/180,He=this.center.lat*Math.PI/180;p.bN(G,Ke)+p.bN(ie,He)<p.bN(U,Ke)+p.bN(Ae,He)?(_e=G,we=ie):(_e=U,we=Ae)}else if(ye)_e=G,we=ie;else{if(!Pe)return;_e=U,we=Ae}const Ce=_e/Math.PI*180,be=we/Math.PI*180,Le=this.center.lat;this.setCenter(new p.V(Ce,p.an(be,-90,90))),this.setZoom(this.zoom+dr(Le,this.center.lat))}locationToScreenPoint(t,n){const h=ir(t);if(n){const f=n.getElevationForLngLatZoom(t,this._helper._tileZoom);p.a$(h,h,1+f/p.bE)}return this._projectSurfacePointToScreen(h)}_projectSurfacePointToScreen(t){const n=p.bF();return p.aH(n,[...t,1],this._globeViewProjMatrixNoCorrection),n[0]/=n[3],n[1]/=n[3],new p.P((.5*n[0]+.5)*this.width,(.5*-n[1]+.5)*this.height)}screenPointToMercatorCoordinate(t,n){if(n){const h=n.pointCoordinate(t);if(h)return h}return p.a9.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,n){var h;return(h=this.screenPointToMercatorCoordinate(t,n))===null||h===void 0?void 0:h.toLngLat()}isPointOnMapSurface(t,n){const h=this._cameraPosition,f=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(h,f)}getRayDirectionFromPixel(t){const n=p.bF();n[0]=t.x/this.width*2-1,n[1]=-1*(t.y/this.height*2-1),n[2]=1,n[3]=1,p.aH(n,n,this._globeViewProjMatrixNoCorrectionInverted),n[0]/=n[3],n[1]/=n[3],n[2]/=n[3];const h=p.bz();h[0]=n[0]-this._cameraPosition[0],h[1]=n[1]-this._cameraPosition[1],h[2]=n[2]-this._cameraPosition[2];const f=p.bz();return p.b3(f,h),f}isSurfacePointVisible(t){const n=this._cachedClippingPlane;return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;const n=p.bF();return p.aH(n,[...t,1],this._globeViewProjMatrixNoCorrection),n[0]/=n[3],n[1]/=n[3],n[2]/=n[3],n[0]>-1&&n[0]<1&&n[1]>-1&&n[1]<1&&n[2]>-1&&n[2]<1}rayPlanetIntersection(t,n){const h=p.b5(t,n),f=p.bz(),x=p.bz();p.a$(x,n,h),p.b2(f,t,x);const T=1-p.b5(f,f);if(T<0)return null;const C=p.b5(t,t)-1,D=-h+(h<0?1:-1)*Math.sqrt(T),B=C/D,N=D;return{tMin:Math.min(B,N),tMax:Math.max(B,N)}}unprojectScreenPoint(t){const n=this._cameraPosition,h=this.getRayDirectionFromPixel(t),f=this.rayPlanetIntersection(n,h);if(f){const N=p.bz();p.b0(N,n,[h[0]*f.tMin,h[1]*f.tMin,h[2]*f.tMin]);const G=p.bz();return p.b3(G,N),yl(G)}const x=this._cachedClippingPlane,T=x[0]*h[0]+x[1]*h[1]+x[2]*h[2],C=-p.bb(x,n)/T,D=p.bz();if(C>0)p.b0(D,n,[h[0]*C,h[1]*C,h[2]*C]);else{const N=p.bz();p.b0(N,n,[2*h[0],2*h[1],2*h[2]]);const G=p.bb(this._cachedClippingPlane,N);p.b2(D,N,[this._cachedClippingPlane[0]*G,this._cachedClippingPlane[1]*G,this._cachedClippingPlane[2]*G])}const B=(function(N){const G=p.bz();return G[0]=N[0]*-N[3],G[1]=N[1]*-N[3],G[2]=N[2]*-N[3],{center:G,radius:Math.sqrt(1-N[3]*N[3])}})(x);return yl((function(N,G,U){const $=p.bz();p.b2($,U,N);const ie=p.bz();return p.bA(ie,N,$,G/p.b9($)),ie})(B.center,B.radius,D))}getMatrixForModel(t,n){const h=p.V.convert(t),f=1/p.bE,x=p.bj();return p.bJ(x,x,h.lng/180*Math.PI),p.bh(x,x,-h.lat/180*Math.PI),p.O(x,x,[0,0,1+n/p.bE]),p.bh(x,x,.5*Math.PI),p.Q(x,x,[f,f,f]),x}getProjectionDataForCustomLayer(t=!0){const n=this.getProjectionData({overscaledTileID:new p.a2(0,0,0,0,0),applyGlobeMatrix:t});return n.tileMercatorCoords=[0,0,1,1],n}getFastPathSimpleProjectionMatrix(t){}}class An{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,n,h){return this._helper.interpolatePadding(t,n,h)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n,h=!0){this._helper.resize(t,n,h)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,n){this._helper.overrideNearFarZ(t,n)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t,n){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=n,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(n,h)=>this.currentTransform.defaultConstrain(n,h),this.applyConstrain=(n,h)=>this._helper.applyConstrain(n,h),this._helper=new $n({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,h)=>this.defaultConstrain(n,h)},t),this._globeness=1,this._mercatorTransform=new Po,this._verticalPerspectiveTransform=new qs}clone(){const t=new An;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this,!1),t}apply(t,n){this._helper.apply(t,n),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){const n=this._mercatorTransform.getProjectionData(t),h=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?h.mainMatrix:n.mainMatrix,clippingPlane:h.clippingPlane,tileMercatorCoords:h.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:n.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return p.bu(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return p.bu(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,n,h){const f=this._mercatorTransform.getPitchedTextCorrection(t,n,h),x=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,n,h);return p.bu(f,x,this._globeness)}projectTileCoordinates(t,n,h,f){return this.currentTransform.projectTileCoordinates(t,n,h,f)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,n){return this.currentTransform.lngLatToCameraDepth(t,n)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,n,h,f){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,h,f)}setLocationAtPoint(t,n){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(t,n),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(t,n),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(t,n){return this.currentTransform.locationToScreenPoint(t,n)}screenPointToMercatorCoordinate(t,n){return this.currentTransform.screenPointToMercatorCoordinate(t,n)}screenPointToLocation(t,n){return this.currentTransform.screenPointToLocation(t,n)}isPointOnMapSurface(t,n){return this.currentTransform.isPointOnMapSurface(t,n)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,n){return this.currentTransform.getMatrixForModel(t,n)}getProjectionDataForCustomLayer(t=!0){const n=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return n;const h=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return h.fallbackMatrix=n.mainMatrix,h}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}}class Ar{get useGlobeControls(){return!0}handlePanInertia(t,n){const h=jl(t,n);return Math.abs(h.lng-n.center.lng)>180&&(h.lng=n.center.lng+179.5*Math.sign(h.lng-n.center.lng)),{easingCenter:h,easingOffset:new p.P(0,0)}}handleMapControlsRollPitchBearingZoom(t,n){const h=t.around,f=n.screenPointToLocation(h);t.bearingDelta&&n.setBearing(n.bearing+t.bearingDelta),t.pitchDelta&&n.setPitch(n.pitch+t.pitchDelta),t.rollDelta&&n.setRoll(n.roll+t.rollDelta);const x=n.zoom;t.zoomDelta&&n.setZoom(n.zoom+t.zoomDelta);const T=n.zoom-x;if(T===0)return;const C=p.bK(n.center.lng,f.lng),D=C/(Math.abs(C/180)+1),B=p.bK(n.center.lat,f.lat),N=n.getRayDirectionFromPixel(h),G=n.cameraPosition,U=-1*p.b5(G,N),$=p.bz();p.b0($,G,[N[0]*U,N[1]*U,N[2]*U]);const ie=p.b7($)-1,he=Math.exp(.5*-Math.max(ie-.3,0)),Ae=ao(n.worldSize,n.center.lat)/Math.min(n.width,n.height),ce=p.bx(Ae,.9,.5,1,.25),ye=(1-p.aq(-T))*Math.min(he,ce),Pe=n.center.lat,_e=n.zoom,we=new p.V(n.center.lng+D*ye,p.an(n.center.lat+B*ye,-p.ao,p.ao));n.setLocationAtPoint(f,h);const Ce=n.center,be=p.bx(Math.abs(C),45,85,0,1),Le=p.bx(Ae,.75,.35,0,1),Ke=Math.pow(Math.max(be,Le),.25),He=p.bK(Ce.lng,we.lng),$e=p.bK(Ce.lat,we.lat);n.setCenter(new p.V(Ce.lng+He*Ke,Ce.lat+$e*Ke).wrap()),n.setZoom(_e+dr(Pe,n.center.lat))}handleMapControlsPan(t,n,h){if(!t.panDelta)return;const f=n.center.lat,x=n.zoom;n.setCenter(jl(t.panDelta,n).wrap()),n.setZoom(x+dr(f,n.center.lat))}cameraForBoxAndBearing(t,n,h,f,x){const T=Qr(t,n,h,f,x),C=n.left/x.width*2-1,D=(x.width-n.right)/x.width*2-1,B=n.top/x.height*-2+1,N=(x.height-n.bottom)/x.height*-2+1,G=p.bK(h.getWest(),h.getEast())<0,U=G?h.getEast():h.getWest(),$=G?h.getWest():h.getEast(),ie=Math.max(h.getNorth(),h.getSouth()),he=Math.min(h.getNorth(),h.getSouth()),Ae=U+.5*p.bK(U,$),ce=ie+.5*p.bK(ie,he),ye=x.clone();ye.setCenter(T.center),ye.setBearing(T.bearing),ye.setPitch(0),ye.setRoll(0),ye.setZoom(T.zoom);const Pe=ye.modelViewProjectionMatrix,_e=[ir(h.getNorthWest()),ir(h.getNorthEast()),ir(h.getSouthWest()),ir(h.getSouthEast()),ir(new p.V($,ce)),ir(new p.V(U,ce)),ir(new p.V(Ae,ie)),ir(new p.V(Ae,he))],we=ir(T.center);let Ce=Number.POSITIVE_INFINITY;for(const be of _e)C<0&&(Ce=Ar.getLesserNonNegativeNonNull(Ce,Ar.solveVectorScale(be,we,Pe,"x",C))),D>0&&(Ce=Ar.getLesserNonNegativeNonNull(Ce,Ar.solveVectorScale(be,we,Pe,"x",D))),B>0&&(Ce=Ar.getLesserNonNegativeNonNull(Ce,Ar.solveVectorScale(be,we,Pe,"y",B))),N<0&&(Ce=Ar.getLesserNonNegativeNonNull(Ce,Ar.solveVectorScale(be,we,Pe,"y",N)));if(Number.isFinite(Ce)&&Ce!==0)return T.zoom=ye.zoom+p.at(Ce),T;Ls()}handleJumpToCenterZoom(t,n){const h=t.center.lat,f=t.applyConstrain(n.center?p.V.convert(n.center):t.center,t.zoom).center;t.setCenter(f.wrap());const x=n.zoom!==void 0?+n.zoom:t.zoom+dr(h,f.lat);t.zoom!==x&&t.setZoom(x)}handleEaseTo(t,n){const h=t.zoom,f=t.center,x=t.padding,T={roll:t.roll,pitch:t.pitch,bearing:t.bearing},C={roll:n.roll===void 0?t.roll:n.roll,pitch:n.pitch===void 0?t.pitch:n.pitch,bearing:n.bearing===void 0?t.bearing:n.bearing},D=n.zoom!==void 0,B=!t.isPaddingEqual(n.padding);let N=!1;const G=n.center?p.V.convert(n.center):f,U=t.applyConstrain(G,h).center;Qn(t,U);const $=t.clone();$.setCenter(U),$.setZoom(D?+n.zoom:h+dr(f.lat,G.lat)),$.setBearing(n.bearing);const ie=new p.P(p.an(t.centerPoint.x+n.offsetAsPoint.x,0,t.width),p.an(t.centerPoint.y+n.offsetAsPoint.y,0,t.height));$.setLocationAtPoint(U,ie);const he=(n.offset&&n.offsetAsPoint.mag())>0?$.center:U,Ae=D?+n.zoom:h+dr(f.lat,he.lat),ce=h+dr(f.lat,0),ye=Ae+dr(he.lat,0),Pe=p.bK(f.lng,he.lng),_e=p.bK(f.lat,he.lat),we=p.aq(ye-ce);return N=Ae!==h,{easeFunc:Ce=>{if(p.bo(T,C)||Vl({startEulerAngles:T,endEulerAngles:C,tr:t,k:Ce,useSlerp:T.roll!=C.roll}),B&&t.interpolatePadding(x,n.padding,Ce),n.around)p.w("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(n.around,n.aroundPoint);else{const be=ye>ce?Math.min(2,we):Math.max(.5,we),Le=Math.pow(be,1-Ce),Ke=Ya(f,Pe,_e,Ce*Le);t.setCenter(Ke.wrap())}if(N){const be=p.G.number(ce,ye,Ce)+dr(0,t.center.lat);t.setZoom(be)}},isZooming:N,elevationCenter:he}}handleFlyTo(t,n){const h=n.zoom!==void 0,f=t.center,x=t.zoom,T=t.padding,C=!t.isPaddingEqual(n.padding),D=t.applyConstrain(p.V.convert(n.center||n.locationAtOffset),x).center,B=h?+n.zoom:t.zoom+dr(t.center.lat,D.lat),N=t.clone();N.setCenter(D),N.setZoom(B),N.setBearing(n.bearing);const G=new p.P(p.an(t.centerPoint.x+n.offsetAsPoint.x,0,t.width),p.an(t.centerPoint.y+n.offsetAsPoint.y,0,t.height));N.setLocationAtPoint(D,G);const U=N.center;Qn(t,U);const $=(function(_e,we,Ce){const be=ir(we),Le=ir(Ce),Ke=p.b5(be,Le),He=Math.acos(Ke),$e=xr(_e);return He/(2*Math.PI)*$e})(t,f,U),ie=x+dr(f.lat,0),he=B+dr(U.lat,0),Ae=p.aq(he-ie);let ce;if(typeof n.minZoom=="number"){const _e=+n.minZoom+dr(U.lat,0),we=Math.min(_e,ie,he)+dr(0,U.lat),Ce=t.applyConstrain(U,we).zoom+dr(U.lat,0);ce=p.aq(Ce-ie)}const ye=p.bK(f.lng,U.lng),Pe=p.bK(f.lat,U.lat);return{easeFunc:(_e,we,Ce,be)=>{const Le=Ya(f,ye,Pe,Ce);C&&t.interpolatePadding(T,n.padding,_e);const Ke=_e===1?U:Le;t.setCenter(Ke.wrap());const He=ie+p.at(we);t.setZoom(_e===1?B:He+dr(0,Ke.lat))},scaleOfZoom:Ae,targetCenter:U,scaleOfMinZoom:ce,pixelPathLength:$}}static solveVectorScale(t,n,h,f,x){const T=f==="x"?[h[0],h[4],h[8],h[12]]:[h[1],h[5],h[9],h[13]],C=[h[3],h[7],h[11],h[15]],D=t[0]*T[0]+t[1]*T[1]+t[2]*T[2],B=t[0]*C[0]+t[1]*C[1]+t[2]*C[2],N=n[0]*T[0]+n[1]*T[1]+n[2]*T[2],G=n[0]*C[0]+n[1]*C[1]+n[2]*C[2];return N+x*B===D+x*G||C[3]*(D-N)+T[3]*(G-B)+D*G==N*B?null:(N+T[3]-x*G-x*C[3])/(N-D-x*G+x*B)}static getLesserNonNegativeNonNull(t,n){return n!==null&&n>=0&&n<t?n:t}}class xl{constructor(t){this._globe=t,this._mercatorCameraHelper=new hi,this._verticalPerspectiveCameraHelper=new Ar}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,n){return this.currentHelper.handlePanInertia(t,n)}handleMapControlsRollPitchBearingZoom(t,n){return this.currentHelper.handleMapControlsRollPitchBearingZoom(t,n)}handleMapControlsPan(t,n,h){this.currentHelper.handleMapControlsPan(t,n,h)}cameraForBoxAndBearing(t,n,h,f,x){return this.currentHelper.cameraForBoxAndBearing(t,n,h,f,x)}handleJumpToCenterZoom(t,n){this.currentHelper.handleJumpToCenterZoom(t,n)}handleEaseTo(t,n){return this.currentHelper.handleEaseTo(t,n)}handleFlyTo(t,n){return this.currentHelper.handleFlyTo(t,n)}}const Eo=(y,t)=>p.B(y,t&&t.filter((n=>n.identifier!=="source.canvas"))),So=p.bO();class Jn extends p.E{constructor(t,n={}){var h,f;super(),this._rtlPluginLoaded=()=>{for(const T in this.tileManagers){const C=this.tileManagers[T].getSource().type;C!=="vector"&&C!=="geojson"||this.tileManagers[T].reload()}},this.map=t,this.dispatcher=new us(yo(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",((T,C)=>this.getGlyphs(T,C))),this.dispatcher.registerMessageHandler("GI",((T,C)=>this.getImages(T,C))),this.dispatcher.registerMessageHandler("GDA",((T,C)=>this.getDashes(T,C))),this.imageManager=new Ji,this.imageManager.setEventedParent(this);const x=((h=t._container)===null||h===void 0?void 0:h.lang)||typeof document<"u"&&((f=document.documentElement)===null||f===void 0?void 0:f.lang)||void 0;this.glyphManager=new Hr(t._requestManager,n.localIdeographFontFamily,x),this.lineAtlas=new Wr(256,512),this.crossTileSymbolIndex=new Wn,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",p.bP()),Fe().on(Me,this._rtlPluginLoaded),this.on("data",(T=>{if(T.dataType!=="source"||T.sourceDataType!=="metadata")return;const C=this.tileManagers[T.sourceId];if(!C)return;const D=C.getSource();if(D&&D.vectorLayerIds)for(const B in this._layers){const N=this._layers[B];N.source===D.id&&this._validateLayer(N)}}))}_setInitialValues(){var t;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new p.bQ,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new(((t=this.crossTileSymbolIndex)===null||t===void 0?void 0:t.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(t,n){var h,f,x;this._checkLoaded();const T=n===null?(x=(f=(h=this.stylesheet.state)===null||h===void 0?void 0:h[t])===null||f===void 0?void 0:f.default)!==null&&x!==void 0?x:null:n;if(p.bR(T,this._globalState[t]))return this;this._globalState[t]=T,this._applyGlobalStateChanges([t])}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();const n=[];for(const h in t)!p.bR(this._globalState[h],t[h].default)&&(n.push(h),this._globalState[h]=t[h].default);this._applyGlobalStateChanges(n)}_applyGlobalStateChanges(t){if(t.length===0)return;const n=new Set,h={};for(const f of t){h[f]=this._globalState[f];for(const x in this._layers){const T=this._layers[x],C=T.getLayoutAffectingGlobalStateRefs(),D=T.getPaintAffectingGlobalStateRefs(),B=T.getVisibilityAffectingGlobalStateRefs();if(C.has(f)&&n.add(T.source),D.has(f))for(const{name:N,value:G}of D.get(f))this._updatePaintProperty(T,N,G);B!=null&&B.has(f)&&(T.recalculateVisibility(),this._updateLayer(T))}}this.dispatcher.broadcast("UGS",h);for(const f in this.tileManagers)n.has(f)&&(this._reloadSource(f),this._changed=!0)}loadURL(t,n={},h){this.fire(new p.l("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const f=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const x=this._loadStyleRequest;p.j(f,this._loadStyleRequest).then((T=>{this._loadStyleRequest=null,this._load(T.data,n,h)})).catch((T=>{this._loadStyleRequest=null,T&&!x.signal.aborted&&this.fire(new p.k(T))}))}loadJSON(t,n={},h){this.fire(new p.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,zr.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(t,n,h)})).catch((()=>{}))}loadEmpty(){this.fire(new p.l("dataloading",{dataType:"style"})),this._load(So,{validate:!1})}_load(t,n,h){var f,x;let T=n.transformStyle?n.transformStyle(h,t):t;if(!n.validate||!Eo(this,p.C(T))){T=Object.assign({},T),this._loaded=!0,this.stylesheet=T;for(const C in T.sources)this.addSource(C,T.sources[C],{validate:!1});T.sprite?this._loadSprite(T.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(T.glyphs),this._createLayers(),this.light=new Yt(this.stylesheet.light),this._setProjectionInternal(((f=this.stylesheet.projection)===null||f===void 0?void 0:f.type)||"mercator"),this.sky=new Mr(this.stylesheet.sky),this.map.setTerrain((x=this.stylesheet.terrain)!==null&&x!==void 0?x:null),this.fire(new p.l("data",{dataType:"style"})),this.fire(new p.l("style.load"))}}_createLayers(){var t,n,h;const f=p.bS(this.stylesheet.layers);this.setGlobalState((t=this.stylesheet.state)!==null&&t!==void 0?t:null),this.dispatcher.broadcast("SL",f),this._order=f.map((x=>x.id)),this._layers={},this._serializedLayers=null;for(const x of f){const T=p.bT(x,this._globalState);if(T.setEventedParent(this,{layer:{id:x.id}}),this._layers[x.id]=T,p.bU(T)&&this.tileManagers[T.source]){const C=(h=(n=x.paint)===null||n===void 0?void 0:n["raster-fade-duration"])!==null&&h!==void 0?h:T.paint.get("raster-fade-duration");this.tileManagers[T.source].setRasterFadeDuration(C)}}}_loadSprite(t,n=!1,h=void 0){this.imageManager.setLoaded(!1);const f=new AbortController;let x;this._spriteRequest=f,(function(T,C,D,B){return p._(this,void 0,void 0,(function*(){const N=Vs(T),G=D>1?"@2x":"",U={},$={};for(const{id:ie,url:he}of N){const Ae=C.transformRequest(Cs(he,G,".json"),"SpriteJSON");U[ie]=p.j(Ae,B);const ce=C.transformRequest(Cs(he,G,".png"),"SpriteImage");$[ie]=En.getImage(ce,B)}return yield Promise.all([...Object.values(U),...Object.values($)]),(function(ie,he){return p._(this,void 0,void 0,(function*(){const Ae={};for(const ce in ie){Ae[ce]={};const ye=zr.getImageCanvasContext((yield he[ce]).data),Pe=(yield ie[ce]).data;for(const _e in Pe){const{width:we,height:Ce,x:be,y:Le,sdf:Ke,pixelRatio:He,stretchX:$e,stretchY:Ye,content:xt,textFitWidth:wt,textFitHeight:pt}=Pe[_e];Ae[ce][_e]={data:null,pixelRatio:He,sdf:Ke,stretchX:$e,stretchY:Ye,content:xt,textFitWidth:wt,textFitHeight:pt,spriteData:{width:we,height:Ce,x:be,y:Le,context:ye}}}}return Ae}))})(U,$)}))})(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((T=>{if(this._spriteRequest=null,T)for(const C in T){this._spritesImagesIds[C]=[];const D=this._spritesImagesIds[C]?this._spritesImagesIds[C].filter((B=>!(B in T))):[];for(const B of D)this.imageManager.removeImage(B),this._changedImages[B]=!0;for(const B in T[C]){const N=C==="default"?B:`${C}:${B}`;this._spritesImagesIds[C].push(N),N in this.imageManager.images?this.imageManager.updateImage(N,T[C][B],!1):this.imageManager.addImage(N,T[C][B]),n&&(this._changedImages[N]=!0)}}})).catch((T=>{this._spriteRequest=null,x=T,f.signal.aborted||this.fire(new p.k(x))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.l("data",{dataType:"style"})),h&&h(x)}))}_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("SI",this._availableImages),this.fire(new p.l("data",{dataType:"style"}))}_validateLayer(t){const n=this.tileManagers[t.source];if(!n)return;const h=t.sourceLayer;if(!h)return;const f=n.getSource();(f.type==="geojson"||f.vectorLayerIds&&f.vectorLayerIds.indexOf(h)===-1)&&this.fire(new p.k(new Error(`Source layer "${h}" does not exist on source "${f.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.tileManagers)if(!this.tileManagers[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t,n=!1){const h=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n?p.bV(h):h);const f=[];for(const x of t)if(h[x]){const T=n?p.bV(h[x]):h[x];f.push(T)}return f}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const h of n){const f=this._layers[h];f.type!=="custom"&&(t[h]=f.serialize())}return t}hasTransitions(){var t,n,h;if(!((t=this.light)===null||t===void 0)&&t.hasTransition()||!((n=this.sky)===null||n===void 0)&&n.hasTransition()||!((h=this.projection)===null||h===void 0)&&h.hasTransition())return!0;for(const f in this.tileManagers)if(this.tileManagers[f].hasTransition())return!0;for(const f in this._layers)if(this._layers[f].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(n){const f=Object.keys(this._updatedLayers),x=Object.keys(this._removedLayers);(f.length||x.length)&&this._updateWorkerLayers(f,x);for(const T in this._updatedSources){const C=this._updatedSources[T];if(C==="reload")this._reloadSource(T);else{if(C!=="clear")throw new Error(`Invalid action ${C}`);this._clearSource(T)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const T in this._updatedPaintProps)this._layers[T].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const h={};for(const f in this.tileManagers){const x=this.tileManagers[f];h[f]=x.used,x.used=!1}for(const f of this._order){const x=this._layers[f];x.recalculate(t,this._availableImages),!x.isHidden(t.zoom)&&x.source&&(this.tileManagers[x.source].used=!0)}for(const f in h){const x=this.tileManagers[f];!!h[f]!=!!x.used&&x.fire(new p.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:f}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,n&&this.fire(new p.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.tileManagers)this.tileManagers[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){var h;this._checkLoaded();const f=this.serialize();if(t=n.transformStyle?n.transformStyle(f,t):t,((h=n.validate)===null||h===void 0||h)&&Eo(this,p.C(t)))return!1;(t=p.bV(t)).layers=p.bS(t.layers);const x=p.bW(f,t),T=this._getOperationsToPerform(x);if(T.unimplemented.length>0)throw new Error(`Unimplemented: ${T.unimplemented.join(", ")}.`);if(T.operations.length===0)return!1;for(const C of T.operations)C();return this.stylesheet=t,this._serializedLayers=null,this.fire(new p.l("style.load",{style:this})),!0}_getOperationsToPerform(t){const n=[],h=[];for(const f of t)switch(f.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":n.push((()=>this.addLayer.apply(this,f.args)));break;case"removeLayer":n.push((()=>this.removeLayer.apply(this,f.args)));break;case"setPaintProperty":n.push((()=>this.setPaintProperty.apply(this,f.args)));break;case"setLayoutProperty":n.push((()=>this.setLayoutProperty.apply(this,f.args)));break;case"setFilter":n.push((()=>this.setFilter.apply(this,f.args)));break;case"addSource":n.push((()=>this.addSource.apply(this,f.args)));break;case"removeSource":n.push((()=>this.removeSource.apply(this,f.args)));break;case"setLayerZoomRange":n.push((()=>this.setLayerZoomRange.apply(this,f.args)));break;case"setLight":n.push((()=>this.setLight.apply(this,f.args)));break;case"setGeoJSONSourceData":n.push((()=>this.setGeoJSONSourceData.apply(this,f.args)));break;case"setGlyphs":n.push((()=>this.setGlyphs.apply(this,f.args)));break;case"setSprite":n.push((()=>this.setSprite.apply(this,f.args)));break;case"setTerrain":n.push((()=>this.map.setTerrain.apply(this,f.args)));break;case"setSky":n.push((()=>this.setSky.apply(this,f.args)));break;case"setProjection":this.setProjection.apply(this,f.args);break;case"setGlobalState":n.push((()=>this.setGlobalState.apply(this,f.args)));break;case"setTransition":n.push((()=>{}));break;default:h.push(f.command)}return{operations:n,unimplemented:h}}addImage(t,n){if(this.getImage(t))return this.fire(new p.k(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new p.k(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,h={}){if(this._checkLoaded(),this.tileManagers[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(p.C.source,`sources.${t}`,n,null,h))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const f=this.tileManagers[t]=new Qi(t,n,this.dispatcher);f.style=this,f.setEventedParent(this,(()=>({isSourceLoaded:f.loaded(),source:f.serialize(),sourceId:t}))),f.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw new Error("There is no source with this ID");for(const h in this._layers)if(this._layers[h].source===t)return this.fire(new p.k(new Error(`Source "${t}" cannot be removed while layer "${h}" is using it.`)));const n=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],n.fire(new p.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const h=this.tileManagers[t].getSource();if(h.type!=="geojson")throw new Error(`geojsonSource.type is ${h.type}, which is !== 'geojson`);h.setData(n),this._changed=!0}getSource(t){return this.tileManagers[t]&&this.tileManagers[t].getSource()}addLayer(t,n,h={}){this._checkLoaded();const f=t.id;if(this.getLayer(f))return void this.fire(new p.k(new Error(`Layer "${f}" already exists on this map.`)));let x;if(t.type==="custom"){if(Eo(this,p.bX(t)))return;x=p.bT(t,this._globalState)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(f,t.source),t=p.bV(t),t=p.e(t,{source:f})),this._validate(p.C.layer,`layers.${f}`,t,{arrayIndex:-1},h))return;x=p.bT(t,this._globalState),this._validateLayer(x),x.setEventedParent(this,{layer:{id:f}})}const T=n?this._order.indexOf(n):this._order.length;if(n&&T===-1)this.fire(new p.k(new Error(`Cannot add layer "${f}" before non-existing layer "${n}".`)));else{if(this._order.splice(T,0,f),this._layerOrderChanged=!0,this._layers[f]=x,this._removedLayers[f]&&x.source&&x.type!=="custom"){const C=this._removedLayers[f];delete this._removedLayers[f],C.type!==x.type?this._updatedSources[x.source]="clear":(this._updatedSources[x.source]="reload",this.tileManagers[x.source].pause())}this._updateLayer(x),x.onAdd&&x.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new p.k(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const h=this._order.indexOf(t);this._order.splice(h,1);const f=n?this._order.indexOf(n):this._order.length;n&&f===-1?this.fire(new p.k(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(f,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new p.k(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const h=this._order.indexOf(t);this._order.splice(h,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,h){this._checkLoaded();const f=this.getLayer(t);f?f.minzoom===n&&f.maxzoom===h||(n!=null&&(f.minzoom=n),h!=null&&(f.maxzoom=h),this._updateLayer(f)):this.fire(new p.k(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,h={}){this._checkLoaded();const f=this.getLayer(t);if(f){if(!p.bR(f.filter,n))return n==null?(f.setFilter(void 0),void this._updateLayer(f)):void(this._validate(p.C.filter,`layers.${f.id}.filter`,n,null,h)||(f.setFilter(p.bV(n)),this._updateLayer(f)))}else this.fire(new p.k(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return p.bV(this.getLayer(t).filter)}setLayoutProperty(t,n,h,f={}){this._checkLoaded();const x=this.getLayer(t);x?p.bR(x.getLayoutProperty(n),h)||(x.setLayoutProperty(n,h,f),this._updateLayer(x)):this.fire(new p.k(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const h=this.getLayer(t);if(h)return h.getLayoutProperty(n);this.fire(new p.k(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,h,f={}){this._checkLoaded();const x=this.getLayer(t);x?p.bR(x.getPaintProperty(n),h)||this._updatePaintProperty(x,n,h,f):this.fire(new p.k(new Error(`Cannot style non-existing layer "${t}".`)))}_updatePaintProperty(t,n,h,f={}){t.setPaintProperty(n,h,f)&&this._updateLayer(t),p.bU(t)&&n==="raster-fade-duration"&&this.tileManagers[t.source].setRasterFadeDuration(h),this._changed=!0,this._updatedPaintProps[t.id]=!0,this._serializedLayers=null}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const h=t.source,f=t.sourceLayer,x=this.tileManagers[h];if(x===void 0)return void this.fire(new p.k(new Error(`The source '${h}' does not exist in the map's style.`)));const T=x.getSource().type;T==="geojson"&&f?this.fire(new p.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):T!=="vector"||f?(t.id===void 0&&this.fire(new p.k(new Error("The feature id parameter must be provided."))),x.setFeatureState(f,t.id,n)):this.fire(new p.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const h=t.source,f=this.tileManagers[h];if(f===void 0)return void this.fire(new p.k(new Error(`The source '${h}' does not exist in the map's style.`)));const x=f.getSource().type,T=x==="vector"?t.sourceLayer:void 0;x!=="vector"||T?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new p.k(new Error("A feature id is required to remove its specific state property."))):f.removeFeatureState(T,t.id,n):this.fire(new p.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,h=t.sourceLayer,f=this.tileManagers[n];if(f!==void 0)return f.getSource().type!=="vector"||h?(t.id===void 0&&this.fire(new p.k(new Error("The feature id parameter must be provided."))),f.getFeatureState(h,t.id)):void this.fire(new p.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new p.k(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return p.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=p.bY(this.tileManagers,(x=>x.serialize())),n=this._serializeByIds(this._order,!0),h=this.map.getTerrain()||void 0,f=this.stylesheet;return p.bZ({version:f.version,name:f.name,metadata:f.metadata,light:f.light,sky:f.sky,center:f.center,zoom:f.zoom,bearing:f.bearing,pitch:f.pitch,sprite:f.sprite,glyphs:f.glyphs,transition:f.transition,projection:f.projection,sources:t,layers:n,terrain:h},(x=>x!==void 0))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.tileManagers[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.tileManagers[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=T=>this._layers[T].type==="fill-extrusion",h={},f=[];for(let T=this._order.length-1;T>=0;T--){const C=this._order[T];if(n(C)){h[C]=T;for(const D of t){const B=D[C];if(B)for(const N of B)f.push(N)}}}f.sort(((T,C)=>C.intersectionZ-T.intersectionZ));const x=[];for(let T=this._order.length-1;T>=0;T--){const C=this._order[T];if(n(C))for(let D=f.length-1;D>=0;D--){const B=f[D].feature;if(h[B.layer.id]<T)break;x.push(B),f.pop()}else for(const D of t){const B=D[C];if(B)for(const N of B)x.push(N.feature)}}return x}queryRenderedFeatures(t,n,h){n&&n.filter&&this._validate(p.C.filter,"queryRenderedFeatures.filter",n.filter,null,n);const f={};if(n&&n.layers){if(!(Array.isArray(n.layers)||n.layers instanceof Set))return this.fire(new p.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const B of n.layers){const N=this._layers[B];if(!N)return this.fire(new p.k(new Error(`The layer '${B}' does not exist in the map's style and cannot be queried for features.`))),[];f[N.source]=!0}}const x=[];n.availableImages=this._availableImages;const T=this._serializedAllLayers(),C=n.layers instanceof Set?n.layers:Array.isArray(n.layers)?new Set(n.layers):null,D=Object.assign(Object.assign({},n),{layers:C,globalState:this._globalState});for(const B in this.tileManagers)n.layers&&!f[B]||x.push(Vo(this.tileManagers[B],this._layers,T,t,D,h,this.map.terrain?(N,G,U)=>this.map.terrain.getElevation(N,G,U):void 0));return this.placement&&x.push((function(B,N,G,U,$,ie,he){const Ae={},ce=ie.queryRenderedSymbols(U),ye=[];for(const Pe of Object.keys(ce).map(Number))ye.push(he[Pe]);ye.sort(en);for(const Pe of ye){const _e=Pe.featureIndex.lookupSymbolFeatures(ce[Pe.bucketInstanceId],N,Pe.bucketIndex,Pe.sourceLayerIndex,{filterSpec:$.filter,globalState:$.globalState},$.layers,$.availableImages,B);for(const we in _e){const Ce=Ae[we]=Ae[we]||[],be=_e[we];be.sort(((Le,Ke)=>{const He=Pe.featureSortOrder;if(He){const $e=He.indexOf(Le.featureIndex);return He.indexOf(Ke.featureIndex)-$e}return Ke.featureIndex-Le.featureIndex}));for(const Le of be)Ce.push(Le)}}return(function(Pe,_e,we){for(const Ce in Pe)for(const be of Pe[Ce])hs(be,we[_e[Ce].source]);return Pe})(Ae,B,G)})(this._layers,T,this.tileManagers,t,D,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(x)}querySourceFeatures(t,n){n!=null&&n.filter&&this._validate(p.C.filter,"querySourceFeatures.filter",n.filter,null,n);const h=this.tileManagers[t];return h?(function(f,x){const T=f.getRenderableIds().map((B=>f.getTileByID(B))),C=[],D={};for(let B=0;B<T.length;B++){const N=T[B],G=N.tileID.canonical.key;D[G]||(D[G]=!0,N.querySourceFeatures(C,x))}return C})(h,n?Object.assign(Object.assign({},n),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const h=this.light.getLight();let f=!1;for(const T in t)if(!p.bR(t[T],h[T])){f=!0;break}if(!f)return;const x={now:Gt(),transition:p.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(x)}getProjection(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.projection}setProjection(t){if(this._checkLoaded(),this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=t,this._setProjectionInternal(t.type)}getSky(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.sky}setSky(t,n={}){this._checkLoaded();const h=this.getSky();let f=!1;if(!t&&!h)return;if(t&&!h)f=!0;else if(!t&&h)f=!0;else for(const T in t)if(!p.bR(t[T],h[T])){f=!0;break}if(!f)return;const x={now:Gt(),transition:p.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,n),this.sky.updateTransitions(x)}_setProjectionInternal(t){const n=(function(h,f){const x={constrainOverride:f};if(Array.isArray(h)){const T=new Gs({type:h});return{projection:T,transform:new An(x),cameraHelper:new xl(T)}}switch(h){case"mercator":return{projection:new Lr,transform:new Po(x),cameraHelper:new hi};case"globe":{const T=new Gs({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:T,transform:new An(x),cameraHelper:new xl(T)}}case"vertical-perspective":return{projection:new Bn,transform:new qs(x),cameraHelper:new Ar};default:return p.w(`Unknown projection name: ${h}. Falling back to mercator projection.`),{projection:new Lr,transform:new Po(x),cameraHelper:new hi}}})(t,this.map.transformConstrain);this.projection=n.projection,this.map.migrateProjection(n.transform,n.cameraHelper);for(const h in this.tileManagers)this.tileManagers[h].reload()}_validate(t,n,h,f,x={}){return(!x||x.validate!==!1)&&Eo(this,t.call(p.C,p.e({key:n,style:this.serialize(),value:h,styleSpec:p.u},f)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),Fe().off(Me,this._rtlPluginLoaded);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.tileManagers){const h=this.tileManagers[n];h.setEventedParent(null),h.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.tileManagers[t].clearTiles()}_reloadSource(t){this.tileManagers[t].resume(),this.tileManagers[t].reload()}_updateSources(t){for(const n in this.tileManagers)this.tileManagers[n].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.tileManagers)this._reloadSource(t)}_updatePlacement(t,n,h,f,x=!1){let T=!1,C=!1;const D={};for(const B of this._order){const N=this._layers[B];if(N.type!=="symbol")continue;if(!D[N.source]){const U=this.tileManagers[N.source];D[N.source]=U.getRenderableIds(!0).map(($=>U.getTileByID($))).sort((($,ie)=>ie.tileID.overscaledZ-$.tileID.overscaledZ||($.tileID.isLessThan(ie.tileID)?-1:1)))}const G=this.crossTileSymbolIndex.addLayer(N,D[N.source],t.center.lng);T=T||G}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((x=x||this._layerOrderChanged||h===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(Gt(),t.zoom))&&(this.pauseablePlacement=new Vi(t,this.map.terrain,this._order,x,n,h,f,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,D),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(Gt()),C=!0),T&&this.pauseablePlacement.placement.setStale()),C||T)for(const B of this._order){const N=this._layers[B];N.type==="symbol"&&this.placement.updateLayerOpacities(N,D[N.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(Gt())}_releaseSymbolFadeTiles(){for(const t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles()}getImages(t,n){return p._(this,void 0,void 0,(function*(){const h=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();const f=this.tileManagers[n.source];return f&&f.setDependencies(n.tileID.key,n.type,n.icons),h}))}getGlyphs(t,n){return p._(this,void 0,void 0,(function*(){const h=yield this.glyphManager.getGlyphs(n.stacks),f=this.tileManagers[n.source];return f&&f.setDependencies(n.tileID.key,n.type,[""]),h}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(p.C.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}getDashes(t,n){return p._(this,void 0,void 0,(function*(){const h={};for(const[f,x]of Object.entries(n.dashes))h[f]=this.lineAtlas.getDash(x.dasharray,x.round);return h}))}addSprite(t,n,h={},f){this._checkLoaded();const x=[{id:t,url:n}],T=[...Vs(this.stylesheet.sprite),...x];this._validate(p.C.sprite,"sprite",T,null,h)||(this.stylesheet.sprite=T,this._loadSprite(x,!0,f))}removeSprite(t){this._checkLoaded();const n=Vs(this.stylesheet.sprite);if(n.find((h=>h.id===t))){if(this._spritesImagesIds[t])for(const h of this._spritesImagesIds[t])this.imageManager.removeImage(h),this._changedImages[h]=!0;n.splice(n.findIndex((h=>h.id===t)),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new p.l("data",{dataType:"style"}))}else this.fire(new p.k(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return Vs(this.stylesheet.sprite)}setSprite(t,n={},h){this._checkLoaded(),t&&this._validate(p.C.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,h):(this._unloadSprite(),h&&h(null)))}destroy(){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null);for(const t in this.tileManagers){const n=this.tileManagers[t];n.setEventedParent(null),n.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(const t in this._layers){const n=this._layers[t];n.setEventedParent(null),n.onRemove&&n.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}}var hu=p.aU([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class da{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,h,f,x,T,C,D,B){this.context=t;let N=this.boundPaintVertexBuffers.length!==f.length;for(let G=0;!N&&G<f.length;G++)this.boundPaintVertexBuffers[G]!==f[G]&&(N=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==h||N||this.boundIndexBuffer!==x||this.boundVertexOffset!==T||this.boundDynamicVertexBuffer!==C||this.boundDynamicVertexBuffer2!==D||this.boundDynamicVertexBuffer3!==B?this.freshBind(n,h,f,x,T,C,D,B):(t.bindVertexArray.set(this.vao),C&&C.bind(),x&&x.dynamicDraw&&x.bind(),D&&D.bind(),B&&B.bind())}freshBind(t,n,h,f,x,T,C,D){const B=t.numAttributes,N=this.context,G=N.gl;this.vao&&this.destroy(),this.vao=N.createVertexArray(),N.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=h,this.boundIndexBuffer=f,this.boundVertexOffset=x,this.boundDynamicVertexBuffer=T,this.boundDynamicVertexBuffer2=C,this.boundDynamicVertexBuffer3=D,n.enableAttributes(G,t);for(const U of h)U.enableAttributes(G,t);T&&T.enableAttributes(G,t),C&&C.enableAttributes(G,t),D&&D.enableAttributes(G,t),n.bind(),n.setVertexAttribPointers(G,t,x);for(const U of h)U.bind(),U.setVertexAttribPointers(G,t,x);T&&(T.bind(),T.setVertexAttribPointers(G,t,x)),f&&f.bind(),C&&(C.bind(),C.setVertexAttribPointers(G,t,x)),D&&(D.bind(),D.setVertexAttribPointers(G,t,x)),N.currentNumAttributes=B}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const bl=(y,t,n,h,f)=>({u_texture:0,u_ele_delta:y,u_fog_matrix:t,u_fog_color:n?n.properties.get("fog-color"):p.bp.white,u_fog_ground_blend:n?n.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:f?0:n?n.calculateFogBlendOpacity(h):0,u_horizon_color:n?n.properties.get("horizon-color"):p.bp.white,u_horizon_fog_blend:n?n.properties.get("horizon-fog-blend"):1,u_is_globe_mode:f?1:0}),pa={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function Rn(y){const t=[];for(let n=0;n<y.length;n++){if(y[n]===null)continue;const h=y[n].split(" ");t.push(h.pop())}return t}class $o{constructor(t,n,h,f,x,T,C,D,B=[]){const N=t.gl;this.program=N.createProgram();const G=Rn(n.staticAttributes),U=h?h.getBinderAttributes():[],$=G.concat(U),ie=Li.prelude.staticUniforms?Rn(Li.prelude.staticUniforms):[],he=C.staticUniforms?Rn(C.staticUniforms):[],Ae=n.staticUniforms?Rn(n.staticUniforms):[],ce=h?h.getBinderUniforms():[],ye=ie.concat(he).concat(Ae).concat(ce),Pe=[];for(const He of ye)Pe.indexOf(He)<0&&Pe.push(He);const _e=h?h.defines():[];Xn(N)&&_e.unshift("#version 300 es"),x&&_e.push("#define OVERDRAW_INSPECTOR;"),T&&_e.push("#define TERRAIN3D;"),D&&_e.push(D),B&&_e.push(...B);let we=_e.concat(Li.prelude.fragmentSource,C.fragmentSource,n.fragmentSource).join(` 811 + `),Ce=_e.concat(Li.prelude.vertexSource,C.vertexSource,n.vertexSource).join(` 812 + `);Xn(N)||(we=(function(He){return He.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")})(we),Ce=(function(He){return He.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")})(Ce));const be=N.createShader(N.FRAGMENT_SHADER);if(N.isContextLost())return void(this.failedToCreate=!0);if(N.shaderSource(be,we),N.compileShader(be),!N.getShaderParameter(be,N.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${N.getShaderInfoLog(be)}`);N.attachShader(this.program,be);const Le=N.createShader(N.VERTEX_SHADER);if(N.isContextLost())return void(this.failedToCreate=!0);if(N.shaderSource(Le,Ce),N.compileShader(Le),!N.getShaderParameter(Le,N.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${N.getShaderInfoLog(Le)}`);N.attachShader(this.program,Le),this.attributes={};const Ke={};this.numAttributes=$.length;for(let He=0;He<this.numAttributes;He++)$[He]&&(N.bindAttribLocation(this.program,He,$[He]),this.attributes[$[He]]=He);if(N.linkProgram(this.program),!N.getProgramParameter(this.program,N.LINK_STATUS))throw new Error(`Program failed to link: ${N.getProgramInfoLog(this.program)}`);N.deleteShader(Le),N.deleteShader(be);for(let He=0;He<Pe.length;He++){const $e=Pe[He];if($e&&!Ke[$e]){const Ye=N.getUniformLocation(this.program,$e);Ye&&(Ke[$e]=Ye)}}this.fixedUniforms=f(t,Ke),this.terrainUniforms=((He,$e)=>({u_depth:new p.b_(He,$e.u_depth),u_terrain:new p.b_(He,$e.u_terrain),u_terrain_dim:new p.bq(He,$e.u_terrain_dim),u_terrain_matrix:new p.c0(He,$e.u_terrain_matrix),u_terrain_unpack:new p.c1(He,$e.u_terrain_unpack),u_terrain_exaggeration:new p.bq(He,$e.u_terrain_exaggeration)}))(t,Ke),this.projectionUniforms=((He,$e)=>({u_projection_matrix:new p.c0(He,$e.u_projection_matrix),u_projection_tile_mercator_coords:new p.c1(He,$e.u_projection_tile_mercator_coords),u_projection_clipping_plane:new p.c1(He,$e.u_projection_clipping_plane),u_projection_transition:new p.bq(He,$e.u_projection_transition),u_projection_fallback_matrix:new p.c0(He,$e.u_projection_fallback_matrix)}))(t,Ke),this.binderUniforms=h?h.getUniforms(t,Ke):[]}draw(t,n,h,f,x,T,C,D,B,N,G,U,$,ie,he,Ae,ce,ye,Pe){const _e=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(h),t.setStencilMode(f),t.setColorMode(x),t.setCullFace(T),D){t.activeTexture.set(_e.TEXTURE2),_e.bindTexture(_e.TEXTURE_2D,D.depthTexture),t.activeTexture.set(_e.TEXTURE3),_e.bindTexture(_e.TEXTURE_2D,D.texture);for(const Ce in this.terrainUniforms)this.terrainUniforms[Ce].set(D[Ce])}if(B)for(const Ce in B)this.projectionUniforms[pa[Ce]].set(B[Ce]);if(C)for(const Ce in this.fixedUniforms)this.fixedUniforms[Ce].set(C[Ce]);Ae&&Ae.setUniforms(t,this.binderUniforms,ie,{zoom:he});let we=0;switch(n){case _e.LINES:we=2;break;case _e.TRIANGLES:we=3;break;case _e.LINE_STRIP:we=1}for(const Ce of $.get()){const be=Ce.vaos||(Ce.vaos={});(be[N]||(be[N]=new da)).bind(t,this,G,Ae?Ae.getPaintVertexBuffers():[],U,Ce.vertexOffset,ce,ye,Pe),_e.drawElements(n,Ce.primitiveLength*we,_e.UNSIGNED_SHORT,Ce.primitiveOffset*we*2)}}}function Zl(y,t,n){const h=1/p.aN(n,1,t.transform.tileZoom),f=Math.pow(2,n.tileID.overscaledZ),x=n.tileSize*Math.pow(2,t.transform.tileZoom)/f,T=x*(n.tileID.canonical.x+n.tileID.wrap*f),C=x*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[h,y.fromScale,y.toScale],u_fade:y.t,u_pixel_coord_upper:[T>>16,C>>16],u_pixel_coord_lower:[65535&T,65535&C]}}const cs=(y,t,n,h)=>{const f=y.style.light,x=f.properties.get("position"),T=[x.x,x.y,x.z],C=p.c4();f.properties.get("anchor")==="viewport"&&p.c5(C,y.transform.bearingInRadians),p.c6(T,T,C);const D=y.transform.transformLightDirection(T),B=f.properties.get("color");return{u_lightpos:T,u_lightpos_globe:D,u_lightintensity:f.properties.get("intensity"),u_lightcolor:[B.r,B.g,B.b],u_vertical_gradient:+t,u_opacity:n,u_fill_translate:h}},wl=(y,t,n,h,f,x,T)=>p.e(cs(y,t,n,h),Zl(x,y,T),{u_height_factor:-Math.pow(2,f.overscaledZ)/T.tileSize/8}),Hs=(y,t,n,h)=>p.e(Zl(t,y,n),{u_fill_translate:h}),Xa=(y,t)=>({u_world:y,u_fill_translate:t}),Ws=(y,t,n,h,f)=>p.e(Hs(y,t,n,f),{u_world:h}),$i=(y,t,n,h,f)=>{const x=y.transform;let T,C,D=0;if(n.paint.get("circle-pitch-alignment")==="map"){const B=p.aN(t,1,x.zoom);T=!0,C=[B,B],D=B/(p.a5*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*f}else T=!1,C=x.pixelsToGLUnits;return{u_camera_to_center_distance:x.cameraToCenterDistance,u_scale_with_map:+(n.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+T,u_device_pixel_ratio:y.pixelRatio,u_extrude_scale:C,u_globe_extrude_scale:D,u_translate:h}},Qs=y=>({u_pixel_extrude_scale:[1/y.width,1/y.height]}),Tl=y=>({u_viewport_size:[y.width,y.height]}),Bs=(y,t=1)=>({u_color:y,u_overlay:0,u_overlay_scale:t}),uo=(y,t,n,h)=>{const f=p.aN(y,1,t)/(p.a5*Math.pow(2,y.tileID.overscaledZ))*2*Math.PI*h;return{u_extrude_scale:p.aN(y,1,t),u_intensity:n,u_globe_extrude_scale:f}},Ul=(y,t,n,h)=>{const f=p.N();p.c7(f,0,y.width,y.height,0,0,1);const x=y.context.gl;return{u_matrix:f,u_world:[x.drawingBufferWidth,x.drawingBufferHeight],u_image:n,u_color_ramp:h,u_opacity:t.paint.get("heatmap-opacity")}},ma=(y,t,n)=>{const h=n.paint.get("hillshade-accent-color");let f;switch(n.paint.get("hillshade-method")){case"basic":f=4;break;case"combined":f=1;break;case"igor":f=2;break;case"multidirectional":f=3;break;default:f=0}const x=n.getIlluminationProperties();for(let T=0;T<x.directionRadians.length;T++)n.paint.get("hillshade-illumination-anchor")==="viewport"&&(x.directionRadians[T]+=y.transform.bearingInRadians);return{u_image:0,u_latrange:Ir(0,t.tileID),u_exaggeration:n.paint.get("hillshade-exaggeration"),u_altitudes:x.altitudeRadians,u_azimuths:x.directionRadians,u_accent:h,u_method:f,u_highlights:x.highlightColor,u_shadows:x.shadowColor}},cu=(y,t)=>{const n=t.stride,h=p.N();return p.c7(h,0,p.a5,-p.a5,0,0,1),p.O(h,h,[0,-p.a5,0]),{u_matrix:h,u_image:1,u_dimension:[n,n],u_zoom:y.overscaledZ,u_unpack:t.getUnpackVector()}};function Ir(y,t){const n=Math.pow(2,t.canonical.z),h=t.canonical.y;return[new p.a9(0,h/n).toLngLat().lat,new p.a9(0,(h+1)/n).toLngLat().lat]}const Ka=(y,t,n=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:n,u_opacity:y.paint.get("color-relief-opacity")}),yn=(y,t,n,h)=>{const f=y.transform;return{u_translation:ho(y,t,n),u_ratio:h/p.aN(t,1,f.zoom),u_device_pixel_ratio:y.pixelRatio,u_units_to_pixels:[1/f.pixelsToGLUnits[0],1/f.pixelsToGLUnits[1]]}},Gl=(y,t,n,h,f)=>p.e(yn(y,t,n,h),{u_image:0,u_image_height:f}),As=(y,t,n,h,f)=>{const x=y.transform,T=Fn(t,x);return{u_translation:ho(y,t,n),u_texsize:t.imageAtlasTexture.size,u_ratio:h/p.aN(t,1,x.zoom),u_device_pixel_ratio:y.pixelRatio,u_image:0,u_scale:[T,f.fromScale,f.toScale],u_fade:f.t,u_units_to_pixels:[1/x.pixelsToGLUnits[0],1/x.pixelsToGLUnits[1]]}},Ba=(y,t,n,h,f)=>{const x=Fn(t,y.transform);return p.e(yn(y,t,n,h),{u_tileratio:x,u_crossfade_from:f.fromScale,u_crossfade_to:f.toScale,u_image:0,u_mix:f.t,u_lineatlas_width:y.lineAtlas.width,u_lineatlas_height:y.lineAtlas.height})},vn=(y,t,n,h,f,x)=>{const T=Fn(t,y.transform);return p.e(yn(y,t,n,h),{u_image:0,u_image_height:x,u_tileratio:T,u_crossfade_from:f.fromScale,u_crossfade_to:f.toScale,u_image_dash:1,u_mix:f.t,u_lineatlas_width:y.lineAtlas.width,u_lineatlas_height:y.lineAtlas.height})};function Fn(y,t){return 1/p.aN(y,1,t.tileZoom)}function ho(y,t,n){return p.aO(y.transform,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const $s=(y,t,n,h,f)=>{return{u_tl_parent:y,u_scale_parent:t,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.opacity*h.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:h.paint.get("raster-brightness-min"),u_brightness_high:h.paint.get("raster-brightness-max"),u_saturation_factor:(T=h.paint.get("raster-saturation"),T>0?1-1/(1.001-T):-T),u_contrast_factor:(x=h.paint.get("raster-contrast"),x>0?1/(1-x):1+x),u_spin_weights:xs(h.paint.get("raster-hue-rotate")),u_coords_top:[f[0].x,f[0].y,f[1].x,f[1].y],u_coords_bottom:[f[3].x,f[3].y,f[2].x,f[2].y]};var x,T};function xs(y){y*=Math.PI/180;const t=Math.sin(y),n=Math.cos(y);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const fs=(y,t,n,h,f,x,T,C,D,B,N,G,U)=>{const $=T.transform;return{u_is_size_zoom_constant:+(y==="constant"||y==="source"),u_is_size_feature_constant:+(y==="constant"||y==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:$.cameraToCenterDistance,u_pitch:$.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:$.width/$.height,u_fade_change:T.options.fadeDuration?T.symbolFadeChange:1,u_label_plane_matrix:C,u_coord_matrix:D,u_is_text:+N,u_pitch_with_map:+h,u_is_along_line:f,u_is_variable_anchor:x,u_texsize:G,u_texture:0,u_translation:B,u_pitched_scale:U}},Yo=(y,t,n,h,f,x,T,C,D,B,N,G,U,$)=>{const ie=T.transform;return p.e(fs(y,t,n,h,f,x,T,C,D,B,N,G,$),{u_gamma_scale:h?Math.cos(ie.pitch*Math.PI/180)*ie.cameraToCenterDistance:1,u_device_pixel_ratio:T.pixelRatio,u_is_halo:1})},Ys=(y,t,n,h,f,x,T,C,D,B,N,G,U)=>p.e(Yo(y,t,n,h,f,x,T,C,D,B,!0,N,0,U),{u_texsize_icon:G,u_texture_icon:1}),Ja=(y,t)=>({u_opacity:y,u_color:t}),Pl=(y,t,n,h,f)=>p.e((function(x,T,C,D){const B=C.imageManager.getPattern(x.from.toString()),N=C.imageManager.getPattern(x.to.toString()),{width:G,height:U}=C.imageManager.getPixelSize(),$=Math.pow(2,D.tileID.overscaledZ),ie=D.tileSize*Math.pow(2,C.transform.tileZoom)/$,he=ie*(D.tileID.canonical.x+D.tileID.wrap*$),Ae=ie*D.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:B.tl,u_pattern_br_a:B.br,u_pattern_tl_b:N.tl,u_pattern_br_b:N.br,u_texsize:[G,U],u_mix:T.t,u_pattern_size_a:B.displaySize,u_pattern_size_b:N.displaySize,u_scale_a:T.fromScale,u_scale_b:T.toScale,u_tile_units_to_pixels:1/p.aN(D,1,C.transform.tileZoom),u_pixel_coord_upper:[he>>16,Ae>>16],u_pixel_coord_lower:[65535&he,65535&Ae]}})(n,f,t,h),{u_opacity:y}),Ra=(y,t)=>{},Au={fillExtrusion:(y,t)=>({u_lightpos:new p.c2(y,t.u_lightpos),u_lightpos_globe:new p.c2(y,t.u_lightpos_globe),u_lightintensity:new p.bq(y,t.u_lightintensity),u_lightcolor:new p.c2(y,t.u_lightcolor),u_vertical_gradient:new p.bq(y,t.u_vertical_gradient),u_opacity:new p.bq(y,t.u_opacity),u_fill_translate:new p.c3(y,t.u_fill_translate)}),fillExtrusionPattern:(y,t)=>({u_lightpos:new p.c2(y,t.u_lightpos),u_lightpos_globe:new p.c2(y,t.u_lightpos_globe),u_lightintensity:new p.bq(y,t.u_lightintensity),u_lightcolor:new p.c2(y,t.u_lightcolor),u_vertical_gradient:new p.bq(y,t.u_vertical_gradient),u_height_factor:new p.bq(y,t.u_height_factor),u_opacity:new p.bq(y,t.u_opacity),u_fill_translate:new p.c3(y,t.u_fill_translate),u_image:new p.b_(y,t.u_image),u_texsize:new p.c3(y,t.u_texsize),u_pixel_coord_upper:new p.c3(y,t.u_pixel_coord_upper),u_pixel_coord_lower:new p.c3(y,t.u_pixel_coord_lower),u_scale:new p.c2(y,t.u_scale),u_fade:new p.bq(y,t.u_fade)}),fill:(y,t)=>({u_fill_translate:new p.c3(y,t.u_fill_translate)}),fillPattern:(y,t)=>({u_image:new p.b_(y,t.u_image),u_texsize:new p.c3(y,t.u_texsize),u_pixel_coord_upper:new p.c3(y,t.u_pixel_coord_upper),u_pixel_coord_lower:new p.c3(y,t.u_pixel_coord_lower),u_scale:new p.c2(y,t.u_scale),u_fade:new p.bq(y,t.u_fade),u_fill_translate:new p.c3(y,t.u_fill_translate)}),fillOutline:(y,t)=>({u_world:new p.c3(y,t.u_world),u_fill_translate:new p.c3(y,t.u_fill_translate)}),fillOutlinePattern:(y,t)=>({u_world:new p.c3(y,t.u_world),u_image:new p.b_(y,t.u_image),u_texsize:new p.c3(y,t.u_texsize),u_pixel_coord_upper:new p.c3(y,t.u_pixel_coord_upper),u_pixel_coord_lower:new p.c3(y,t.u_pixel_coord_lower),u_scale:new p.c2(y,t.u_scale),u_fade:new p.bq(y,t.u_fade),u_fill_translate:new p.c3(y,t.u_fill_translate)}),circle:(y,t)=>({u_camera_to_center_distance:new p.bq(y,t.u_camera_to_center_distance),u_scale_with_map:new p.b_(y,t.u_scale_with_map),u_pitch_with_map:new p.b_(y,t.u_pitch_with_map),u_extrude_scale:new p.c3(y,t.u_extrude_scale),u_device_pixel_ratio:new p.bq(y,t.u_device_pixel_ratio),u_globe_extrude_scale:new p.bq(y,t.u_globe_extrude_scale),u_translate:new p.c3(y,t.u_translate)}),collisionBox:(y,t)=>({u_pixel_extrude_scale:new p.c3(y,t.u_pixel_extrude_scale)}),collisionCircle:(y,t)=>({u_viewport_size:new p.c3(y,t.u_viewport_size)}),debug:(y,t)=>({u_color:new p.b$(y,t.u_color),u_overlay:new p.b_(y,t.u_overlay),u_overlay_scale:new p.bq(y,t.u_overlay_scale)}),depth:Ra,clippingMask:Ra,heatmap:(y,t)=>({u_extrude_scale:new p.bq(y,t.u_extrude_scale),u_intensity:new p.bq(y,t.u_intensity),u_globe_extrude_scale:new p.bq(y,t.u_globe_extrude_scale)}),heatmapTexture:(y,t)=>({u_matrix:new p.c0(y,t.u_matrix),u_world:new p.c3(y,t.u_world),u_image:new p.b_(y,t.u_image),u_color_ramp:new p.b_(y,t.u_color_ramp),u_opacity:new p.bq(y,t.u_opacity)}),hillshade:(y,t)=>({u_image:new p.b_(y,t.u_image),u_latrange:new p.c3(y,t.u_latrange),u_exaggeration:new p.bq(y,t.u_exaggeration),u_altitudes:new p.c9(y,t.u_altitudes),u_azimuths:new p.c9(y,t.u_azimuths),u_accent:new p.b$(y,t.u_accent),u_method:new p.b_(y,t.u_method),u_shadows:new p.c8(y,t.u_shadows),u_highlights:new p.c8(y,t.u_highlights)}),hillshadePrepare:(y,t)=>({u_matrix:new p.c0(y,t.u_matrix),u_image:new p.b_(y,t.u_image),u_dimension:new p.c3(y,t.u_dimension),u_zoom:new p.bq(y,t.u_zoom),u_unpack:new p.c1(y,t.u_unpack)}),colorRelief:(y,t)=>({u_image:new p.b_(y,t.u_image),u_unpack:new p.c1(y,t.u_unpack),u_dimension:new p.c3(y,t.u_dimension),u_elevation_stops:new p.b_(y,t.u_elevation_stops),u_color_stops:new p.b_(y,t.u_color_stops),u_color_ramp_size:new p.b_(y,t.u_color_ramp_size),u_opacity:new p.bq(y,t.u_opacity)}),line:(y,t)=>({u_translation:new p.c3(y,t.u_translation),u_ratio:new p.bq(y,t.u_ratio),u_device_pixel_ratio:new p.bq(y,t.u_device_pixel_ratio),u_units_to_pixels:new p.c3(y,t.u_units_to_pixels)}),lineGradient:(y,t)=>({u_translation:new p.c3(y,t.u_translation),u_ratio:new p.bq(y,t.u_ratio),u_device_pixel_ratio:new p.bq(y,t.u_device_pixel_ratio),u_units_to_pixels:new p.c3(y,t.u_units_to_pixels),u_image:new p.b_(y,t.u_image),u_image_height:new p.bq(y,t.u_image_height)}),linePattern:(y,t)=>({u_translation:new p.c3(y,t.u_translation),u_texsize:new p.c3(y,t.u_texsize),u_ratio:new p.bq(y,t.u_ratio),u_device_pixel_ratio:new p.bq(y,t.u_device_pixel_ratio),u_image:new p.b_(y,t.u_image),u_units_to_pixels:new p.c3(y,t.u_units_to_pixels),u_scale:new p.c2(y,t.u_scale),u_fade:new p.bq(y,t.u_fade)}),lineSDF:(y,t)=>({u_translation:new p.c3(y,t.u_translation),u_ratio:new p.bq(y,t.u_ratio),u_device_pixel_ratio:new p.bq(y,t.u_device_pixel_ratio),u_units_to_pixels:new p.c3(y,t.u_units_to_pixels),u_image:new p.b_(y,t.u_image),u_mix:new p.bq(y,t.u_mix),u_tileratio:new p.bq(y,t.u_tileratio),u_crossfade_from:new p.bq(y,t.u_crossfade_from),u_crossfade_to:new p.bq(y,t.u_crossfade_to),u_lineatlas_width:new p.bq(y,t.u_lineatlas_width),u_lineatlas_height:new p.bq(y,t.u_lineatlas_height)}),lineGradientSDF:(y,t)=>({u_translation:new p.c3(y,t.u_translation),u_ratio:new p.bq(y,t.u_ratio),u_device_pixel_ratio:new p.bq(y,t.u_device_pixel_ratio),u_units_to_pixels:new p.c3(y,t.u_units_to_pixels),u_image:new p.b_(y,t.u_image),u_image_height:new p.bq(y,t.u_image_height),u_tileratio:new p.bq(y,t.u_tileratio),u_crossfade_from:new p.bq(y,t.u_crossfade_from),u_crossfade_to:new p.bq(y,t.u_crossfade_to),u_image_dash:new p.b_(y,t.u_image_dash),u_mix:new p.bq(y,t.u_mix),u_lineatlas_width:new p.bq(y,t.u_lineatlas_width),u_lineatlas_height:new p.bq(y,t.u_lineatlas_height)}),raster:(y,t)=>({u_tl_parent:new p.c3(y,t.u_tl_parent),u_scale_parent:new p.bq(y,t.u_scale_parent),u_buffer_scale:new p.bq(y,t.u_buffer_scale),u_fade_t:new p.bq(y,t.u_fade_t),u_opacity:new p.bq(y,t.u_opacity),u_image0:new p.b_(y,t.u_image0),u_image1:new p.b_(y,t.u_image1),u_brightness_low:new p.bq(y,t.u_brightness_low),u_brightness_high:new p.bq(y,t.u_brightness_high),u_saturation_factor:new p.bq(y,t.u_saturation_factor),u_contrast_factor:new p.bq(y,t.u_contrast_factor),u_spin_weights:new p.c2(y,t.u_spin_weights),u_coords_top:new p.c1(y,t.u_coords_top),u_coords_bottom:new p.c1(y,t.u_coords_bottom)}),symbolIcon:(y,t)=>({u_is_size_zoom_constant:new p.b_(y,t.u_is_size_zoom_constant),u_is_size_feature_constant:new p.b_(y,t.u_is_size_feature_constant),u_size_t:new p.bq(y,t.u_size_t),u_size:new p.bq(y,t.u_size),u_camera_to_center_distance:new p.bq(y,t.u_camera_to_center_distance),u_pitch:new p.bq(y,t.u_pitch),u_rotate_symbol:new p.b_(y,t.u_rotate_symbol),u_aspect_ratio:new p.bq(y,t.u_aspect_ratio),u_fade_change:new p.bq(y,t.u_fade_change),u_label_plane_matrix:new p.c0(y,t.u_label_plane_matrix),u_coord_matrix:new p.c0(y,t.u_coord_matrix),u_is_text:new p.b_(y,t.u_is_text),u_pitch_with_map:new p.b_(y,t.u_pitch_with_map),u_is_along_line:new p.b_(y,t.u_is_along_line),u_is_variable_anchor:new p.b_(y,t.u_is_variable_anchor),u_texsize:new p.c3(y,t.u_texsize),u_texture:new p.b_(y,t.u_texture),u_translation:new p.c3(y,t.u_translation),u_pitched_scale:new p.bq(y,t.u_pitched_scale)}),symbolSDF:(y,t)=>({u_is_size_zoom_constant:new p.b_(y,t.u_is_size_zoom_constant),u_is_size_feature_constant:new p.b_(y,t.u_is_size_feature_constant),u_size_t:new p.bq(y,t.u_size_t),u_size:new p.bq(y,t.u_size),u_camera_to_center_distance:new p.bq(y,t.u_camera_to_center_distance),u_pitch:new p.bq(y,t.u_pitch),u_rotate_symbol:new p.b_(y,t.u_rotate_symbol),u_aspect_ratio:new p.bq(y,t.u_aspect_ratio),u_fade_change:new p.bq(y,t.u_fade_change),u_label_plane_matrix:new p.c0(y,t.u_label_plane_matrix),u_coord_matrix:new p.c0(y,t.u_coord_matrix),u_is_text:new p.b_(y,t.u_is_text),u_pitch_with_map:new p.b_(y,t.u_pitch_with_map),u_is_along_line:new p.b_(y,t.u_is_along_line),u_is_variable_anchor:new p.b_(y,t.u_is_variable_anchor),u_texsize:new p.c3(y,t.u_texsize),u_texture:new p.b_(y,t.u_texture),u_gamma_scale:new p.bq(y,t.u_gamma_scale),u_device_pixel_ratio:new p.bq(y,t.u_device_pixel_ratio),u_is_halo:new p.b_(y,t.u_is_halo),u_translation:new p.c3(y,t.u_translation),u_pitched_scale:new p.bq(y,t.u_pitched_scale)}),symbolTextAndIcon:(y,t)=>({u_is_size_zoom_constant:new p.b_(y,t.u_is_size_zoom_constant),u_is_size_feature_constant:new p.b_(y,t.u_is_size_feature_constant),u_size_t:new p.bq(y,t.u_size_t),u_size:new p.bq(y,t.u_size),u_camera_to_center_distance:new p.bq(y,t.u_camera_to_center_distance),u_pitch:new p.bq(y,t.u_pitch),u_rotate_symbol:new p.b_(y,t.u_rotate_symbol),u_aspect_ratio:new p.bq(y,t.u_aspect_ratio),u_fade_change:new p.bq(y,t.u_fade_change),u_label_plane_matrix:new p.c0(y,t.u_label_plane_matrix),u_coord_matrix:new p.c0(y,t.u_coord_matrix),u_is_text:new p.b_(y,t.u_is_text),u_pitch_with_map:new p.b_(y,t.u_pitch_with_map),u_is_along_line:new p.b_(y,t.u_is_along_line),u_is_variable_anchor:new p.b_(y,t.u_is_variable_anchor),u_texsize:new p.c3(y,t.u_texsize),u_texsize_icon:new p.c3(y,t.u_texsize_icon),u_texture:new p.b_(y,t.u_texture),u_texture_icon:new p.b_(y,t.u_texture_icon),u_gamma_scale:new p.bq(y,t.u_gamma_scale),u_device_pixel_ratio:new p.bq(y,t.u_device_pixel_ratio),u_is_halo:new p.b_(y,t.u_is_halo),u_translation:new p.c3(y,t.u_translation),u_pitched_scale:new p.bq(y,t.u_pitched_scale)}),background:(y,t)=>({u_opacity:new p.bq(y,t.u_opacity),u_color:new p.b$(y,t.u_color)}),backgroundPattern:(y,t)=>({u_opacity:new p.bq(y,t.u_opacity),u_image:new p.b_(y,t.u_image),u_pattern_tl_a:new p.c3(y,t.u_pattern_tl_a),u_pattern_br_a:new p.c3(y,t.u_pattern_br_a),u_pattern_tl_b:new p.c3(y,t.u_pattern_tl_b),u_pattern_br_b:new p.c3(y,t.u_pattern_br_b),u_texsize:new p.c3(y,t.u_texsize),u_mix:new p.bq(y,t.u_mix),u_pattern_size_a:new p.c3(y,t.u_pattern_size_a),u_pattern_size_b:new p.c3(y,t.u_pattern_size_b),u_scale_a:new p.bq(y,t.u_scale_a),u_scale_b:new p.bq(y,t.u_scale_b),u_pixel_coord_upper:new p.c3(y,t.u_pixel_coord_upper),u_pixel_coord_lower:new p.c3(y,t.u_pixel_coord_lower),u_tile_units_to_pixels:new p.bq(y,t.u_tile_units_to_pixels)}),terrain:(y,t)=>({u_texture:new p.b_(y,t.u_texture),u_ele_delta:new p.bq(y,t.u_ele_delta),u_fog_matrix:new p.c0(y,t.u_fog_matrix),u_fog_color:new p.b$(y,t.u_fog_color),u_fog_ground_blend:new p.bq(y,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new p.bq(y,t.u_fog_ground_blend_opacity),u_horizon_color:new p.b$(y,t.u_horizon_color),u_horizon_fog_blend:new p.bq(y,t.u_horizon_fog_blend),u_is_globe_mode:new p.bq(y,t.u_is_globe_mode)}),terrainDepth:(y,t)=>({u_ele_delta:new p.bq(y,t.u_ele_delta)}),terrainCoords:(y,t)=>({u_texture:new p.b_(y,t.u_texture),u_terrain_coords_id:new p.bq(y,t.u_terrain_coords_id),u_ele_delta:new p.bq(y,t.u_ele_delta)}),projectionErrorMeasurement:(y,t)=>({u_input:new p.bq(y,t.u_input),u_output_expected:new p.bq(y,t.u_output_expected)}),atmosphere:(y,t)=>({u_sun_pos:new p.c2(y,t.u_sun_pos),u_atmosphere_blend:new p.bq(y,t.u_atmosphere_blend),u_globe_position:new p.c2(y,t.u_globe_position),u_globe_radius:new p.bq(y,t.u_globe_radius),u_inv_proj_matrix:new p.c0(y,t.u_inv_proj_matrix)}),sky:(y,t)=>({u_sky_color:new p.b$(y,t.u_sky_color),u_horizon_color:new p.b$(y,t.u_horizon_color),u_horizon:new p.c3(y,t.u_horizon),u_horizon_normal:new p.c3(y,t.u_horizon_normal),u_sky_horizon_blend:new p.bq(y,t.u_sky_horizon_blend),u_sky_blend:new p.bq(y,t.u_sky_blend)})};class el{constructor(t,n,h){this.context=t;const f=t.gl;this.buffer=f.createBuffer(),this.dynamicDraw=!!h,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?f.DYNAMIC_DRAW:f.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ml={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class tl{constructor(t,n,h,f){this.length=n.length,this.attributes=h,this.itemSize=n.bytesPerElement,this.dynamicDraw=f,this.context=t;const x=t.gl;this.buffer=x.createBuffer(),t.bindVertexBuffer.set(this.buffer),x.bufferData(x.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?x.DYNAMIC_DRAW:x.STATIC_DRAW),this.dynamicDraw||delete n.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 n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let h=0;h<this.attributes.length;h++){const f=n.attributes[this.attributes[h].name];f!==void 0&&t.enableVertexAttribArray(f)}}setVertexAttribPointers(t,n,h){for(let f=0;f<this.attributes.length;f++){const x=this.attributes[f],T=n.attributes[x.name];T!==void 0&&t.vertexAttribPointer(T,x.components,t[Ml[x.type]],!1,this.itemSize,x.offset+this.itemSize*(h||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Ii{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 sn extends Ii{getDefault(){return p.bp.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class $r extends Ii{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class il extends Ii{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Xs extends Ii{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Xo extends Ii{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class _a extends Ii{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class ga extends Ii{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class fn extends Ii{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class ql extends Ii{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class Ko extends Ii{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class rl extends Ii{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class Rs extends Ii{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Fa extends Ii{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class es extends Ii{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class ya extends Ii{getDefault(){return p.bp.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Oa extends Ii{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class va extends Ii{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class xa extends Ii{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class co extends Ii{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class ba extends Ii{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class nl extends Ii{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class gi extends Ii{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class sl extends Ii{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class El extends Ii{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Fs extends Ii{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class Jo extends Ii{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Hl extends Ii{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Wl extends Ii{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const h=this.gl;Xn(h)?h.bindVertexArray(t):(n=h.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class Ql extends Ii{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class $l extends Ii{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class ol extends Ii{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class ds extends Ii{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class u extends ds{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class v extends ds{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class E extends ds{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}const R="Framebuffer is not complete";class q{constructor(t,n,h,f,x){this.context=t,this.width=n,this.height=h;const T=t.gl,C=this.framebuffer=T.createFramebuffer();if(this.colorAttachment=new u(t,C),f)this.depthAttachment=x?new E(t,C):new v(t,C);else if(x)throw new Error("Stencil cannot be set without depth");if(T.checkFramebufferStatus(T.FRAMEBUFFER)!==T.FRAMEBUFFER_COMPLETE)throw new Error(R)}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const h=this.depthAttachment.get();h&&t.deleteRenderbuffer(h)}t.deleteFramebuffer(this.framebuffer)}}class ne{constructor(t){var n,h;if(this.gl=t,this.clearColor=new sn(this),this.clearDepth=new $r(this),this.clearStencil=new il(this),this.colorMask=new Xs(this),this.depthMask=new Xo(this),this.stencilMask=new _a(this),this.stencilFunc=new ga(this),this.stencilOp=new fn(this),this.stencilTest=new ql(this),this.depthRange=new Ko(this),this.depthTest=new rl(this),this.depthFunc=new Rs(this),this.blend=new Fa(this),this.blendFunc=new es(this),this.blendColor=new ya(this),this.blendEquation=new Oa(this),this.cullFace=new va(this),this.cullFaceSide=new xa(this),this.frontFace=new co(this),this.program=new ba(this),this.activeTexture=new nl(this),this.viewport=new gi(this),this.bindFramebuffer=new sl(this),this.bindRenderbuffer=new El(this),this.bindTexture=new Fs(this),this.bindVertexBuffer=new Jo(this),this.bindElementBuffer=new Hl(this),this.bindVertexArray=new Wl(this),this.pixelStoreUnpack=new Ql(this),this.pixelStoreUnpackPremultiplyAlpha=new $l(this),this.pixelStoreUnpackFlipY=new ol(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),Xn(t)){this.HALF_FLOAT=t.HALF_FLOAT;const f=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=t.RGBA16F)!==null&&n!==void 0?n:f==null?void 0:f.RGBA16F_EXT,this.RGB16F=(h=t.RGB16F)!==null&&h!==void 0?h:f==null?void 0:f.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const f=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=f==null?void 0:f.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,n){return new el(this,t,n)}createVertexBuffer(t,n,h){return new tl(this,t,n,h)}createRenderbuffer(t,n,h){const f=this.gl,x=f.createRenderbuffer();return this.bindRenderbuffer.set(x),f.renderbufferStorage(f.RENDERBUFFER,t,n,h),this.bindRenderbuffer.set(null),x}createFramebuffer(t,n,h,f){return new q(this,t,n,h,f)}clear({color:t,depth:n,stencil:h}){const f=this.gl;let x=0;t&&(x|=f.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(x|=f.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),h!==void 0&&(x|=f.STENCIL_BUFFER_BIT,this.clearStencil.set(h),this.stencilMask.set(255)),f.clear(x)}setCullFace(t){t.enable===!1?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(t){p.bR(t.blendFunction,bi.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return Xn(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))===null||t===void 0?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var n;return Xn(this.gl)?this.gl.deleteVertexArray(t):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0?void 0:n.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}let Ee;function Ze(y,t,n,h,f){const x=y.context,T=y.transform,C=x.gl,D=y.useProgram("collisionBox"),B=[];let N=0,G=0;for(let ce=0;ce<h.length;ce++){const ye=h[ce],Pe=t.getTile(ye).getBucket(n);if(!Pe)continue;const _e=f?Pe.textCollisionBox:Pe.iconCollisionBox,we=Pe.collisionCircleArray;we.length>0&&(B.push({circleArray:we,circleOffset:G,coord:ye}),N+=we.length/4,G=N),_e&&D.draw(x,C.LINES,ri.disabled,Ci.disabled,y.colorModeForRenderPass(),wi.disabled,Qs(y.transform),y.style.map.terrain&&y.style.map.terrain.getTerrainData(ye),T.getProjectionData({overscaledTileID:ye,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),n.id,_e.layoutVertexBuffer,_e.indexBuffer,_e.segments,null,y.transform.zoom,null,null,_e.collisionVertexBuffer)}if(!f||!B.length)return;const U=y.useProgram("collisionCircle"),$=new p.ca;$.resize(4*N),$._trim();let ie=0;for(const ce of B)for(let ye=0;ye<ce.circleArray.length/4;ye++){const Pe=4*ye,_e=ce.circleArray[Pe+0],we=ce.circleArray[Pe+1],Ce=ce.circleArray[Pe+2],be=ce.circleArray[Pe+3];$.emplace(ie++,_e,we,Ce,be,0),$.emplace(ie++,_e,we,Ce,be,1),$.emplace(ie++,_e,we,Ce,be,2),$.emplace(ie++,_e,we,Ce,be,3)}(!Ee||Ee.length<2*N)&&(Ee=(function(ce){const ye=2*ce,Pe=new p.cc;Pe.resize(ye),Pe._trim();for(let _e=0;_e<ye;_e++){const we=6*_e;Pe.uint16[we+0]=4*_e+0,Pe.uint16[we+1]=4*_e+1,Pe.uint16[we+2]=4*_e+2,Pe.uint16[we+3]=4*_e+2,Pe.uint16[we+4]=4*_e+3,Pe.uint16[we+5]=4*_e+0}return Pe})(N));const he=x.createIndexBuffer(Ee,!0),Ae=x.createVertexBuffer($,p.cb.members,!0);for(const ce of B){const ye=Tl(y.transform);U.draw(x,C.TRIANGLES,ri.disabled,Ci.disabled,y.colorModeForRenderPass(),wi.disabled,ye,y.style.map.terrain&&y.style.map.terrain.getTerrainData(ce.coord),null,n.id,Ae,he,p.aX.simpleSegment(0,2*ce.circleOffset,ce.circleArray.length,ce.circleArray.length/2),null,y.transform.zoom,null,null,null)}Ae.destroy(),he.destroy()}const tt=p.ar(new Float32Array(16));function gt(y,t,n,h,f,x){const{horizontalAlign:T,verticalAlign:C}=p.aS(y);return new p.P((-(T-.5)*t/f+h[0])*x,(-(C-.5)*n/f+h[1])*x)}function Rt(y,t,n,h,f,x){const T=t.tileAnchorPoint.add(new p.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let C=h.mult(x);n||(C=C.rotate(-f));const D=T.add(C);return ni(D.x,D.y,t.pitchedLabelPlaneMatrix,t.getElevation).point}if(n){const C=Ft(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(y),D=Math.atan(C.y/C.x)+(C.x<0?Math.PI:0);return y.add(h.rotate(D))}return y.add(h)}function Jt(y,t,n,h,f,x,T,C,D,B,N,G){const U=y.text.placedSymbolArray,$=y.text.dynamicLayoutVertexArray,ie=y.icon.dynamicLayoutVertexArray,he={};$.clear();for(let Ae=0;Ae<U.length;Ae++){const ce=U.get(Ae),ye=ce.hidden||!ce.crossTileID||y.allowVerticalPlacement&&!ce.placedOrientation?null:h[ce.crossTileID];if(ye){const Pe=new p.P(ce.anchorX,ce.anchorY),_e={getElevation:G,width:f.width,height:f.height,pitchedLabelPlaneMatrix:x,pitchWithMap:n,transform:f,tileAnchorPoint:Pe,translation:B,unwrappedTileID:N},we=n?qt(Pe.x,Pe.y,_e):Ft(Pe.x,Pe.y,_e),Ce=Ea(f.cameraToCenterDistance,we.signedDistanceFromCamera);let be=p.aA(y.textSizeData,C,ce)*Ce/p.aM;n&&(be*=y.tilePixelRatio/T);const{width:Le,height:Ke,anchor:He,textOffset:$e,textBoxScale:Ye}=ye,xt=gt(He,Le,Ke,$e,Ye,be),wt=f.getPitchedTextCorrection(Pe.x+B[0],Pe.y+B[1],N),pt=Rt(we.point,_e,t,xt,-f.bearingInRadians,wt),Pt=y.allowVerticalPlacement&&ce.placedOrientation===p.az.vertical?Math.PI/2:0;for(let mi=0;mi<ce.numGlyphs;mi++)p.aG($,pt,Pt);D&&ce.associatedIconIndex>=0&&(he[ce.associatedIconIndex]={shiftedAnchor:pt,angle:Pt})}else Xi(ce.numGlyphs,$)}if(D){ie.clear();const Ae=y.icon.placedSymbolArray;for(let ce=0;ce<Ae.length;ce++){const ye=Ae.get(ce);if(ye.hidden)Xi(ye.numGlyphs,ie);else{const Pe=he[ce];if(Pe)for(let _e=0;_e<ye.numGlyphs;_e++)p.aG(ie,Pe.shiftedAnchor,Pe.angle);else Xi(ye.numGlyphs,ie)}}y.icon.dynamicLayoutVertexBuffer.updateData(ie)}y.text.dynamicLayoutVertexBuffer.updateData($)}function Ti(y,t,n){return n.iconsInText&&t?"symbolTextAndIcon":y?"symbolSDF":"symbolIcon"}function Zr(y,t,n,h,f,x,T,C,D,B,N,G,U){const $=y.context,ie=$.gl,he=y.transform,Ae=C==="map",ce=D==="map",ye=C!=="viewport"&&n.layout.get("symbol-placement")!=="point",Pe=Ae&&!ce&&!ye,_e=!n.layout.get("symbol-sort-key").isConstant();let we=!1;const Ce=y.getDepthModeForSublayer(0,ri.ReadOnly),be=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),Le=[],Ke=he.getCircleRadiusCorrection();for(const He of h){const $e=t.getTile(He),Ye=$e.getBucket(n);if(!Ye)continue;const xt=f?Ye.text:Ye.icon;if(!xt||!xt.segments.get().length||!xt.hasVisibleVertices)continue;const wt=xt.programConfigurations.get(n.id),pt=f||Ye.sdfIcons,Pt=f?Ye.textSizeData:Ye.iconSizeData,mi=ce||he.pitch!==0,sr=y.useProgram(Ti(pt,f,Ye),wt),Dr=p.ay(Pt,he.zoom),mr=y.style.map.terrain&&y.style.map.terrain.getTerrainData(He);let Rr,_r,Yr,Fr,rs=[0,0],dn=null;if(f)_r=$e.glyphAtlasTexture,Yr=ie.LINEAR,Rr=$e.glyphAtlasTexture.size,Ye.iconsInText&&(rs=$e.imageAtlasTexture.size,dn=$e.imageAtlasTexture,Fr=mi||y.options.rotating||y.options.zooming||Pt.kind==="composite"||Pt.kind==="camera"?ie.LINEAR:ie.NEAREST);else{const Tr=n.layout.get("icon-size").constantOr(0)!==1||Ye.iconsNeedLinear;_r=$e.imageAtlasTexture,Yr=pt||y.options.rotating||y.options.zooming||Tr||mi?ie.LINEAR:ie.NEAREST,Rr=$e.imageAtlasTexture.size}const an=p.aN($e,1,y.transform.zoom),ms=fi(Ae,y.transform,an),cl=p.N();p.aB(cl,ms);const Va=di(ce,Ae,y.transform,an),wa=p.aO(he,$e,x,T),eo=he.getProjectionData({overscaledTileID:He,applyGlobeMatrix:!U,applyTerrainMatrix:!0}),kl=be&&Ye.hasTextData(),Mu=n.layout.get("icon-text-fit")!=="none"&&kl&&Ye.hasIconData();if(ye){const Tr=y.style.map.terrain?(Vn,jn)=>y.style.map.terrain.getElevation(He,Vn,jn):null,gr=n.layout.get("text-rotation-alignment")==="map";kn(Ye,y,f,ms,cl,ce,B,gr,He.toUnwrapped(),he.width,he.height,wa,Tr)}const zl=f&&be||Mu,zo=ye||zl?tt:ce?ms:y.transform.clipSpaceToPixelsMatrix,Ta=pt&&n.paint.get(f?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let na;na=pt?Ye.iconsInText?Ys(Pt.kind,Dr,Pe,ce,ye,zl,y,zo,Va,wa,Rr,rs,Ke):Yo(Pt.kind,Dr,Pe,ce,ye,zl,y,zo,Va,wa,f,Rr,0,Ke):fs(Pt.kind,Dr,Pe,ce,ye,zl,y,zo,Va,wa,f,Rr,Ke);const sa={program:sr,buffers:xt,uniformValues:na,projectionData:eo,atlasTexture:_r,atlasTextureIcon:dn,atlasInterpolation:Yr,atlasInterpolationIcon:Fr,isSDF:pt,hasHalo:Ta};if(_e&&Ye.canOverlap){we=!0;const Tr=xt.segments.get();for(const gr of Tr)Le.push({segments:new p.aX([gr]),sortKey:gr.sortKey,state:sa,terrainData:mr})}else Le.push({segments:xt.segments,sortKey:0,state:sa,terrainData:mr})}we&&Le.sort(((He,$e)=>He.sortKey-$e.sortKey));for(const He of Le){const $e=He.state;if($.activeTexture.set(ie.TEXTURE0),$e.atlasTexture.bind($e.atlasInterpolation,ie.CLAMP_TO_EDGE),$e.atlasTextureIcon&&($.activeTexture.set(ie.TEXTURE1),$e.atlasTextureIcon&&$e.atlasTextureIcon.bind($e.atlasInterpolationIcon,ie.CLAMP_TO_EDGE)),$e.isSDF){const Ye=$e.uniformValues;$e.hasHalo&&(Ye.u_is_halo=1,Br($e.buffers,He.segments,n,y,$e.program,Ce,N,G,Ye,$e.projectionData,He.terrainData)),Ye.u_is_halo=0}Br($e.buffers,He.segments,n,y,$e.program,Ce,N,G,$e.uniformValues,$e.projectionData,He.terrainData)}}function Br(y,t,n,h,f,x,T,C,D,B,N){const G=h.context;f.draw(G,G.gl.TRIANGLES,x,T,C,wi.backCCW,D,N,B,n.id,y.layoutVertexBuffer,y.indexBuffer,t,n.paint,h.transform.zoom,y.programConfigurations.get(n.id),y.dynamicLayoutVertexBuffer,y.opacityVertexBuffer)}function ps(y,t,n,h,f){const x=y.context,T=x.gl,C=Ci.disabled,D=new bi([T.ONE,T.ONE],p.bp.transparent,[!0,!0,!0,!0]),B=t.getBucket(n);if(!B)return;const N=h.key;let G=n.heatmapFbos.get(N);G||(G=Ks(x,t.tileSize,t.tileSize),n.heatmapFbos.set(N,G)),x.bindFramebuffer.set(G.framebuffer),x.viewport.set([0,0,t.tileSize,t.tileSize]),x.clear({color:p.bp.transparent});const U=B.programConfigurations.get(n.id),$=y.useProgram("heatmap",U,!f),ie=y.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),he=y.style.map.terrain.getTerrainData(h);$.draw(x,T.TRIANGLES,ri.disabled,C,D,wi.disabled,uo(t,y.transform.zoom,n.paint.get("heatmap-intensity"),1),he,ie,n.id,B.layoutVertexBuffer,B.indexBuffer,B.segments,n.paint,y.transform.zoom,U)}function On(y,t,n,h,f){const x=y.context,T=x.gl,C=y.transform;x.setColorMode(y.colorModeForRenderPass());const D=al(x,t),B=n.key,N=t.heatmapFbos.get(B);if(!N)return;x.activeTexture.set(T.TEXTURE0),T.bindTexture(T.TEXTURE_2D,N.colorAttachment.get()),x.activeTexture.set(T.TEXTURE1),D.bind(T.LINEAR,T.CLAMP_TO_EDGE);const G=C.getProjectionData({overscaledTileID:n,applyTerrainMatrix:f,applyGlobeMatrix:!h});y.useProgram("heatmapTexture").draw(x,T.TRIANGLES,ri.disabled,Ci.disabled,y.colorModeForRenderPass(),wi.disabled,Ul(y,t,0,1),null,G,t.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments,t.paint,C.zoom),N.destroy(),t.heatmapFbos.delete(B)}function Ks(y,t,n){var h,f;const x=y.gl,T=x.createTexture();x.bindTexture(x.TEXTURE_2D,T),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,x.LINEAR),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,x.LINEAR);const C=(h=y.HALF_FLOAT)!==null&&h!==void 0?h:x.UNSIGNED_BYTE,D=(f=y.RGBA16F)!==null&&f!==void 0?f:x.RGBA;x.texImage2D(x.TEXTURE_2D,0,D,t,n,0,x.RGBA,C,null);const B=y.createFramebuffer(t,n,!1,!1);return B.colorAttachment.set(T),B}function al(y,t){return t.colorRampTexture||(t.colorRampTexture=new p.T(y,t.colorRamp,y.gl.RGBA)),t.colorRampTexture}function Yl(y,t,n,h,f,x,T,C){let D=256;if(f.stepInterpolant){const B=t.getSource().maxzoom,N=T.canonical.z===B?Math.ceil(1<<y.transform.maxZoom-T.canonical.z):1;D=p.an(p.ce(x.maxLineLength/p.a5*1024*N),256,n.maxTextureSize)}return C.gradient=p.cf({expression:f.gradientExpression(),evaluationKey:"lineProgress",resolution:D,image:C.gradient||void 0,clips:x.lineClipsArray}),C.texture?C.texture.update(C.gradient):C.texture=new p.T(n,C.gradient,h.RGBA),C.version=f.gradientVersion,C.texture}function Xl(y,t,n,h,f){y.activeTexture.set(t.TEXTURE0),n.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),h.updatePaintBuffers(f)}function br(y,t,n,h,f,x){(f||y.lineAtlas.dirty)&&(t.activeTexture.set(n.TEXTURE0),y.lineAtlas.bind(t)),h.updatePaintBuffers(x)}function ea(y,t,n,h,f,x,T){const C=x.gradients[f.id];let D=C.texture;f.gradientVersion!==C.version&&(D=Yl(y,t,n,h,f,x,T,C)),n.activeTexture.set(h.TEXTURE0),D.bind(f.stepInterpolant?h.NEAREST:h.LINEAR,h.CLAMP_TO_EDGE)}function Nn(y,t,n,h,f,x,T,C,D){const B=x.gradients[f.id];let N=B.texture;f.gradientVersion!==B.version&&(N=Yl(y,t,n,h,f,x,T,B)),n.activeTexture.set(h.TEXTURE0),N.bind(f.stepInterpolant?h.NEAREST:h.LINEAR,h.CLAMP_TO_EDGE),n.activeTexture.set(h.TEXTURE1),y.lineAtlas.bind(n),C.updatePaintBuffers(D)}function pr(y,t,n,h,f){if(!n||!h||!h.imageAtlas)return;const x=h.imageAtlas.patternPositions;let T=x[n.to.toString()],C=x[n.from.toString()];if(!T&&C&&(T=C),!C&&T&&(C=T),!T||!C){const D=f.getPaintProperty(t);T=x[D],C=x[D]}T&&C&&y.setConstantPatternPositions(T,C)}function nr(y,t,n,h,f,x,T,C){const D=y.context.gl,B="fill-pattern",N=n.paint.get(B),G=N&&N.constantOr(1),U=n.getCrossfadeParameters();let $,ie,he,Ae,ce;const ye=y.transform,Pe=n.paint.get("fill-translate"),_e=n.paint.get("fill-translate-anchor");T?(ie=G&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",$=D.LINES):(ie=G?"fillPattern":"fill",$=D.TRIANGLES);const we=N.constantOr(null);for(const Ce of h){const be=t.getTile(Ce);if(G&&!be.patternsLoaded())continue;const Le=be.getBucket(n);if(!Le)continue;const Ke=Le.programConfigurations.get(n.id),He=y.useProgram(ie,Ke),$e=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Ce);G&&(y.context.activeTexture.set(D.TEXTURE0),be.imageAtlasTexture.bind(D.LINEAR,D.CLAMP_TO_EDGE),Ke.updatePaintBuffers(U)),pr(Ke,B,we,be,n);const Ye=ye.getProjectionData({overscaledTileID:Ce,applyGlobeMatrix:!C,applyTerrainMatrix:!0}),xt=p.aO(ye,be,Pe,_e);if(T){Ae=Le.indexBuffer2,ce=Le.segments2;const pt=[D.drawingBufferWidth,D.drawingBufferHeight];he=ie==="fillOutlinePattern"&&G?Ws(y,U,be,pt,xt):Xa(pt,xt)}else Ae=Le.indexBuffer,ce=Le.segments,he=G?Hs(y,U,be,xt):{u_fill_translate:xt};const wt=y.stencilModeForClipping(Ce);He.draw(y.context,$,f,wt,x,wi.backCCW,he,$e,Ye,n.id,Le.layoutVertexBuffer,Ae,ce,n.paint,y.transform.zoom,Ke)}}function ll(y,t,n,h,f,x,T,C){const D=y.context,B=D.gl,N="fill-extrusion-pattern",G=n.paint.get(N),U=G.constantOr(1),$=n.getCrossfadeParameters(),ie=n.paint.get("fill-extrusion-opacity"),he=G.constantOr(null),Ae=y.transform;for(const ce of h){const ye=t.getTile(ce),Pe=ye.getBucket(n);if(!Pe)continue;const _e=y.style.map.terrain&&y.style.map.terrain.getTerrainData(ce),we=Pe.programConfigurations.get(n.id),Ce=y.useProgram(U?"fillExtrusionPattern":"fillExtrusion",we);U&&(y.context.activeTexture.set(B.TEXTURE0),ye.imageAtlasTexture.bind(B.LINEAR,B.CLAMP_TO_EDGE),we.updatePaintBuffers($));const be=Ae.getProjectionData({overscaledTileID:ce,applyGlobeMatrix:!C,applyTerrainMatrix:!0});pr(we,N,he,ye,n);const Le=p.aO(Ae,ye,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),Ke=n.paint.get("fill-extrusion-vertical-gradient"),He=U?wl(y,Ke,ie,Le,ce,$,ye):cs(y,Ke,ie,Le);Ce.draw(D,D.gl.TRIANGLES,f,x,T,wi.backCCW,He,_e,be,n.id,Pe.layoutVertexBuffer,Pe.indexBuffer,Pe.segments,n.paint,y.transform.zoom,we,y.style.map.terrain&&Pe.centroidVertexBuffer)}}function Co(y,t,n,h,f,x,T,C,D){var B;const N=y.style.projection,G=y.context,U=y.transform,$=G.gl,ie=[`#define NUM_ILLUMINATION_SOURCES ${n.paint.get("hillshade-highlight-color").values.length}`],he=y.useProgram("hillshade",null,!1,ie),Ae=!y.options.moving;for(const ce of h){const ye=t.getTile(ce),Pe=ye.fbo;if(!Pe)continue;const _e=N.getMeshFromTileID(G,ce.canonical,C,!0,"raster"),we=(B=y.style.map.terrain)===null||B===void 0?void 0:B.getTerrainData(ce);G.activeTexture.set($.TEXTURE0),$.bindTexture($.TEXTURE_2D,Pe.colorAttachment.get());const Ce=U.getProjectionData({overscaledTileID:ce,aligned:Ae,applyGlobeMatrix:!D,applyTerrainMatrix:!0});he.draw(G,$.TRIANGLES,x,f[ce.overscaledZ],T,wi.backCCW,ma(y,ye,n),we,Ce,n.id,_e.vertexBuffer,_e.indexBuffer,_e.segments)}}function Ao(y,t,n,h,f,x,T,C,D){var B;const N=y.style.projection,G=y.context,U=y.transform,$=G.gl,ie=y.useProgram("colorRelief"),he=!y.options.moving;let Ae=!0,ce=0;for(const ye of h){const Pe=t.getTile(ye),_e=Pe.dem;if(Ae){const He=$.getParameter($.MAX_TEXTURE_SIZE),{elevationTexture:$e,colorTexture:Ye}=n.getColorRampTextures(G,He,_e.getUnpackVector());G.activeTexture.set($.TEXTURE1),$e.bind($.NEAREST,$.CLAMP_TO_EDGE),G.activeTexture.set($.TEXTURE4),Ye.bind($.LINEAR,$.CLAMP_TO_EDGE),Ae=!1,ce=$e.size[0]}if(!_e||!_e.data)continue;const we=_e.stride,Ce=_e.getPixels();if(G.activeTexture.set($.TEXTURE0),G.pixelStoreUnpackPremultiplyAlpha.set(!1),Pe.demTexture=Pe.demTexture||y.getTileTexture(we),Pe.demTexture){const He=Pe.demTexture;He.update(Ce,{premultiply:!1}),He.bind($.LINEAR,$.CLAMP_TO_EDGE)}else Pe.demTexture=new p.T(G,Ce,$.RGBA,{premultiply:!1}),Pe.demTexture.bind($.LINEAR,$.CLAMP_TO_EDGE);const be=N.getMeshFromTileID(G,ye.canonical,C,!0,"raster"),Le=(B=y.style.map.terrain)===null||B===void 0?void 0:B.getTerrainData(ye),Ke=U.getProjectionData({overscaledTileID:ye,aligned:he,applyGlobeMatrix:!D,applyTerrainMatrix:!0});ie.draw(G,$.TRIANGLES,x,f[ye.overscaledZ],T,wi.backCCW,Ka(n,Pe.dem,ce),Le,Ke,n.id,be.vertexBuffer,be.indexBuffer,be.segments)}}const Ur=[new p.P(0,0),new p.P(p.a5,0),new p.P(p.a5,p.a5),new p.P(0,p.a5)];function ta(y,t,n,h,f,x,T,C,D=!1,B=!1){const N=h[h.length-1].overscaledZ,G=y.context,U=G.gl,$=y.useProgram("raster"),ie=y.transform,he=y.style.projection,Ae=y.colorModeForRenderPass(),ce=!y.options.moving,ye=n.paint.get("raster-opacity"),Pe=n.paint.get("raster-resampling"),_e=n.paint.get("raster-fade-duration"),we=!!y.style.map.terrain;for(const Ce of h){const be=y.getDepthModeForSublayer(Ce.overscaledZ-N,ye===1?ri.ReadWrite:ri.ReadOnly,U.LESS),Le=t.getTile(Ce),Ke=Pe==="nearest"?U.NEAREST:U.LINEAR;G.activeTexture.set(U.TEXTURE0),Le.texture.bind(Ke,U.CLAMP_TO_EDGE,U.LINEAR_MIPMAP_NEAREST),G.activeTexture.set(U.TEXTURE1);const{parentTile:He,parentScaleBy:$e,parentTopLeft:Ye,fadeValues:xt}=Kl(Le,t,_e,we);Le.fadeOpacity=xt.tileOpacity,He?(He.fadeOpacity=xt.parentTileOpacity,He.texture.bind(Ke,U.CLAMP_TO_EDGE,U.LINEAR_MIPMAP_NEAREST)):Le.texture.bind(Ke,U.CLAMP_TO_EDGE,U.LINEAR_MIPMAP_NEAREST),Le.texture.useMipmap&&G.extTextureFilterAnisotropic&&y.transform.pitch>20&&U.texParameterf(U.TEXTURE_2D,G.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,G.extTextureFilterAnisotropicMax);const wt=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Ce),pt=ie.getProjectionData({overscaledTileID:Ce,aligned:ce,applyGlobeMatrix:!B,applyTerrainMatrix:!0}),Pt=$s(Ye,$e,xt.fadeMix,n,C),mi=he.getMeshFromTileID(G,Ce.canonical,x,T,"raster");$.draw(G,U.TRIANGLES,be,f?f[Ce.overscaledZ]:Ci.disabled,Ae,D?wi.frontCCW:wi.backCCW,Pt,wt,pt,n.id,mi.vertexBuffer,mi.indexBuffer,mi.segments)}}function Kl(y,t,n,h){const f={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(n===0||h)return f;if(y.fadingParentID){const x=t.getLoadedTile(y.fadingParentID);if(!x)return f;const T=Math.pow(2,x.tileID.overscaledZ-y.tileID.overscaledZ),C=[y.tileID.canonical.x*T%1,y.tileID.canonical.y*T%1],D=(function(B,N,G){const U=Gt(),$=(U-N.timeAdded)/G,ie=B.fadingDirection===Qe.Incoming,he=p.an((U-B.timeAdded)/G,0,1),Ae=p.an(1-$,0,1),ce=ie?he:Ae;return{tileOpacity:ce,parentTileOpacity:ie?Ae:he,fadeMix:{opacity:1,mix:1-ce}}})(y,x,n);return{parentTile:x,parentScaleBy:T,parentTopLeft:C,fadeValues:D}}if(y.selfFading){const x=(function(T,C){const D=(Gt()-T.timeAdded)/C,B=p.an(D,0,1);return{tileOpacity:B,fadeMix:{opacity:B,mix:0}}})(y,n);return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:x}}return f}const fu=new p.bp(1,0,0,1),du=new p.bp(0,1,0,1),pu=new p.bp(0,0,1,1),mu=new p.bp(1,0,1,1),ia=new p.bp(0,1,1,1);function _u(y,t,n,h){Sl(y,0,t+n/2,y.transform.width,n,h)}function gu(y,t,n,h){Sl(y,t-n/2,0,n,y.transform.height,h)}function Sl(y,t,n,h,f,x){const T=y.context,C=T.gl;C.enable(C.SCISSOR_TEST),C.scissor(t*y.pixelRatio,n*y.pixelRatio,h*y.pixelRatio,f*y.pixelRatio),T.clear({color:x}),C.disable(C.SCISSOR_TEST)}function Fu(y,t,n){const h=y.context,f=h.gl,x=y.useProgram("debug"),T=ri.disabled,C=Ci.disabled,D=y.colorModeForRenderPass(),B="$debug",N=y.style.map.terrain&&y.style.map.terrain.getTerrainData(n);h.activeTexture.set(f.TEXTURE0);const G=t.getTileByID(n.key).latestRawTileData,U=Math.floor((G&&G.byteLength||0)/1024),$=t.getTile(n).tileSize,ie=512/Math.min($,512)*(n.overscaledZ/y.transform.zoom)*.5;let he=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(he+=` => ${n.overscaledZ}`),(function(ce,ye){ce.initDebugOverlayCanvas();const Pe=ce.debugOverlayCanvas,_e=ce.context.gl,we=ce.debugOverlayCanvas.getContext("2d");we.clearRect(0,0,Pe.width,Pe.height),we.shadowColor="white",we.shadowBlur=2,we.lineWidth=1.5,we.strokeStyle="white",we.textBaseline="top",we.font="bold 36px Open Sans, sans-serif",we.fillText(ye,5,5),we.strokeText(ye,5,5),ce.debugOverlayTexture.update(Pe),ce.debugOverlayTexture.bind(_e.LINEAR,_e.CLAMP_TO_EDGE)})(y,`${he} ${U}kB`);const Ae=y.transform.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!0,applyTerrainMatrix:!0});x.draw(h,f.TRIANGLES,T,C,bi.alphaBlended,wi.disabled,Bs(p.bp.transparent,ie),null,Ae,B,y.debugBuffer,y.quadTriangleIndexBuffer,y.debugSegments),x.draw(h,f.LINE_STRIP,T,C,D,wi.disabled,Bs(p.bp.red),N,Ae,B,y.debugBuffer,y.tileBorderIndexBuffer,y.debugSegments)}function Io(y,t,n,h){const{isRenderingGlobe:f}=h,x=y.context,T=x.gl,C=y.transform,D=y.colorModeForRenderPass(),B=y.getDepthModeFor3D(),N=y.useProgram("terrain");x.bindFramebuffer.set(null),x.viewport.set([0,0,y.width,y.height]);for(const G of n){const U=t.getTerrainMesh(G.tileID),$=y.renderToTexture.getTexture(G),ie=t.getTerrainData(G.tileID);x.activeTexture.set(T.TEXTURE0),T.bindTexture(T.TEXTURE_2D,$.texture);const he=t.getMeshFrameDelta(C.zoom),Ae=C.calculateFogMatrix(G.tileID.toUnwrapped()),ce=bl(he,Ae,y.style.sky,C.pitch,f),ye=C.getProjectionData({overscaledTileID:G.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});N.draw(x,T.TRIANGLES,B,Ci.disabled,D,wi.backCCW,ce,ie,ye,"terrain",U.vertexBuffer,U.indexBuffer,U.segments)}}function Js(y,t){if(!t.mesh){const n=new p.aW;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(1,1),n.emplaceBack(-1,1);const h=new p.aY;h.emplaceBack(0,1,2),h.emplaceBack(0,2,3),t.mesh=new Ki(y.createVertexBuffer(n,Zs.members),y.createIndexBuffer(h),p.aX.simpleSegment(0,0,n.length,h.length))}return t.mesh}class Qt{constructor(t,n){this.context=new ne(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:p.ar(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Qi.maxOverzooming+Qi.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Wn}resize(t,n,h){if(this.width=Math.floor(t*h),this.height=Math.floor(n*h),this.pixelRatio=h,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const f of this.style._order)this.style._layers[f].resize()}setup(){const t=this.context,n=new p.aW;n.emplaceBack(0,0),n.emplaceBack(p.a5,0),n.emplaceBack(0,p.a5),n.emplaceBack(p.a5,p.a5),this.tileExtentBuffer=t.createVertexBuffer(n,Zs.members),this.tileExtentSegments=p.aX.simpleSegment(0,0,4,2);const h=new p.aW;h.emplaceBack(0,0),h.emplaceBack(p.a5,0),h.emplaceBack(0,p.a5),h.emplaceBack(p.a5,p.a5),this.debugBuffer=t.createVertexBuffer(h,Zs.members),this.debugSegments=p.aX.simpleSegment(0,0,4,5);const f=new p.ch;f.emplaceBack(0,0,0,0),f.emplaceBack(p.a5,0,p.a5,0),f.emplaceBack(0,p.a5,0,p.a5),f.emplaceBack(p.a5,p.a5,p.a5,p.a5),this.rasterBoundsBuffer=t.createVertexBuffer(f,hu.members),this.rasterBoundsSegments=p.aX.simpleSegment(0,0,4,2);const x=new p.aW;x.emplaceBack(0,0),x.emplaceBack(p.a5,0),x.emplaceBack(0,p.a5),x.emplaceBack(p.a5,p.a5),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(x,Zs.members),this.rasterBoundsSegmentsPosOnly=p.aX.simpleSegment(0,0,4,5);const T=new p.aW;T.emplaceBack(0,0),T.emplaceBack(1,0),T.emplaceBack(0,1),T.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(T,Zs.members),this.viewportSegments=p.aX.simpleSegment(0,0,4,2);const C=new p.ci;C.emplaceBack(0),C.emplaceBack(1),C.emplaceBack(3),C.emplaceBack(2),C.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(C);const D=new p.aY;D.emplaceBack(1,0,2),D.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(D);const B=this.context.gl;this.stencilClearMode=new Ci({func:B.ALWAYS,mask:0},0,255,B.ZERO,B.ZERO,B.ZERO),this.tileExtentMesh=new Ki(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const h=p.N();p.c7(h,0,this.width,this.height,0,0,1),p.Q(h,h,[n.drawingBufferWidth,n.drawingBufferHeight,0]);const f={mainMatrix:h,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:h};this.useProgram("clippingMask",null,!0).draw(t,n.TRIANGLES,ri.disabled,this.stencilClearMode,bi.disabled,wi.disabled,null,null,f,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n,h){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source,this.nextStencilID+n.length>256&&this.clearStencil();const f=this.context;f.setColorMode(bi.disabled),f.setDepthMode(ri.disabled);const x={};for(const T of n)x[T.key]=this.nextStencilID++;this._renderTileMasks(x,n,h,!0),this._renderTileMasks(x,n,h,!1),this._tileClippingMaskIDs=x}_renderTileMasks(t,n,h,f){const x=this.context,T=x.gl,C=this.style.projection,D=this.transform,B=this.useProgram("clippingMask");for(const N of n){const G=t[N.key],U=this.style.map.terrain&&this.style.map.terrain.getTerrainData(N),$=C.getMeshFromTileID(this.context,N.canonical,f,!0,"stencil"),ie=D.getProjectionData({overscaledTileID:N,applyGlobeMatrix:!h,applyTerrainMatrix:!0});B.draw(x,T.TRIANGLES,ri.disabled,new Ci({func:T.ALWAYS,mask:0},G,255,T.KEEP,T.KEEP,T.REPLACE),bi.disabled,h?wi.disabled:wi.backCCW,null,U,ie,"$clipping",$.vertexBuffer,$.indexBuffer,$.segments)}}_renderTilesDepthBuffer(){const t=this.context,n=t.gl,h=this.style.projection,f=this.transform,x=this.useProgram("depth"),T=this.getDepthModeFor3D(),C=er(f,{tileSize:f.tileSize});for(const D of C){const B=this.style.map.terrain&&this.style.map.terrain.getTerrainData(D),N=h.getMeshFromTileID(this.context,D.canonical,!0,!0,"raster"),G=f.getProjectionData({overscaledTileID:D,applyGlobeMatrix:!0,applyTerrainMatrix:!0});x.draw(t,n.TRIANGLES,T,Ci.disabled,bi.disabled,wi.backCCW,null,B,G,"$clipping",N.vertexBuffer,N.indexBuffer,N.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new Ci({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Ci({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){const n=this.context.gl,h=t.sort(((T,C)=>C.overscaledZ-T.overscaledZ)),f=h[h.length-1].overscaledZ,x=h[0].overscaledZ-f+1;if(x>1){this.currentStencilSource=void 0,this.nextStencilID+x>256&&this.clearStencil();const T={};for(let C=0;C<x;C++)T[C+f]=new Ci({func:n.GEQUAL,mask:255},C+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=x,[T,h]}return[{[f]:Ci.disabled},h]}stencilConfigForOverlapTwoPass(t){const n=this.context.gl,h=t.sort(((T,C)=>C.overscaledZ-T.overscaledZ)),f=h[h.length-1].overscaledZ,x=h[0].overscaledZ-f+1;if(this.clearStencil(),x>1){const T={},C={};for(let D=0;D<x;D++)T[D+f]=new Ci({func:n.GREATER,mask:255},x+1+D,255,n.KEEP,n.KEEP,n.REPLACE),C[D+f]=new Ci({func:n.GREATER,mask:255},1+D,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID=2*x+1,[T,C,h]}return this.nextStencilID=3,[{[f]:new Ci({func:n.GREATER,mask:255},2,255,n.KEEP,n.KEEP,n.REPLACE)},{[f]:new Ci({func:n.GREATER,mask:255},1,255,n.KEEP,n.KEEP,n.REPLACE)},h]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new bi([t.CONSTANT_COLOR,t.ONE],new p.bp(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?bi.unblended:bi.alphaBlended}getDepthModeForSublayer(t,n,h){if(!this.opaquePassEnabledForLayer())return ri.disabled;const f=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new ri(h||this.context.gl.LEQUAL,n,[f,f])}getDepthModeFor3D(){return new ri(this.context.gl.LEQUAL,ri.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){var h,f;this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(Gt()),this.imageManager.beginFrame();const x=this.style._order,T=this.style.tileManagers,C={},D={},B={},N={isRenderingToTexture:!1,isRenderingGlobe:((h=t.projection)===null||h===void 0?void 0:h.transitionState)>0};for(const U in T){const $=T[U];$.used&&$.prepare(this.context),C[U]=$.getVisibleCoordinates(!1),D[U]=C[U].slice().reverse(),B[U]=$.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let U=0;U<x.length;U++)if(this.style._layers[x[U]].is3D()){this.opaquePassCutoff=U;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const U of x){const $=this.style._layers[U];if(!$.hasOffscreenPass()||$.isHidden(this.transform.zoom))continue;const ie=D[$.source];($.type==="custom"||ie.length)&&this.renderLayer(this,T[$.source],$,ie,N)}if((f=this.style.projection)===null||f===void 0||f.updateGPUdependent({context:this.context,useProgram:U=>this.useProgram(U)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?p.bp.black:p.bp.transparent,depth:1}),this.clearStencil(),this.style.sky&&(function(U,$){const ie=U.context,he=ie.gl,Ae=((Ce,be,Le)=>{const Ke=Math.cos(be.rollInRadians),He=Math.sin(be.rollInRadians),$e=Gi(be),Ye=be.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:Ce.properties.get("sky-color"),u_horizon_color:Ce.properties.get("horizon-color"),u_horizon:[(be.width/2-$e*He)*Le,(be.height/2+$e*Ke)*Le],u_horizon_normal:[-He,Ke],u_sky_horizon_blend:Ce.properties.get("sky-horizon-blend")*be.height/2*Le,u_sky_blend:Ye}})($,U.style.map.transform,U.pixelRatio),ce=new ri(he.LEQUAL,ri.ReadWrite,[0,1]),ye=Ci.disabled,Pe=U.colorModeForRenderPass(),_e=U.useProgram("sky"),we=Js(ie,$);_e.draw(ie,he.TRIANGLES,ce,ye,Pe,wi.disabled,Ae,null,void 0,"sky",we.vertexBuffer,we.indexBuffer,we.segments)})(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=x.length-1;this.currentLayer>=0;this.currentLayer--){const U=this.style._layers[x[this.currentLayer]],$=T[U.source],ie=C[U.source];this._renderTileClippingMasks(U,ie,!1),this.renderLayer(this,$,U,ie,N)}this.renderPass="translucent";let G=!1;for(this.currentLayer=0;this.currentLayer<x.length;this.currentLayer++){const U=this.style._layers[x[this.currentLayer]],$=T[U.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(U,N))continue;this.opaquePassEnabledForLayer()||G||(G=!0,N.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const ie=(U.type==="symbol"?B:D)[U.source];this._renderTileClippingMasks(U,C[U.source],!!this.renderToTexture),this.renderLayer(this,$,U,ie,N)}if(N.isRenderingGlobe&&(function(U,$,ie){const he=U.context,Ae=he.gl,ce=U.useProgram("atmosphere"),ye=new ri(Ae.LEQUAL,ri.ReadOnly,[0,1]),Pe=U.transform,_e=(function(Ye,xt){const wt=Ye.properties.get("position"),pt=[-wt.x,-wt.y,-wt.z],Pt=p.ar(new Float64Array(16));return Ye.properties.get("anchor")==="map"&&(p.bg(Pt,Pt,xt.rollInRadians),p.bh(Pt,Pt,-xt.pitchInRadians),p.bg(Pt,Pt,xt.bearingInRadians),p.bh(Pt,Pt,xt.center.lat*Math.PI/180),p.bJ(Pt,Pt,-xt.center.lng*Math.PI/180)),p.cg(pt,pt,Pt),pt})(ie,U.transform),we=Pe.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),Ce=$.properties.get("atmosphere-blend")*we.projectionTransition;if(Ce===0)return;const be=ao(Pe.worldSize,Pe.center.lat),Le=Pe.inverseProjectionMatrix,Ke=new Float64Array(4);Ke[3]=1,p.aH(Ke,Ke,Pe.modelViewProjectionMatrix),Ke[0]/=Ke[3],Ke[1]/=Ke[3],Ke[2]/=Ke[3],Ke[3]=1,p.aH(Ke,Ke,Le),Ke[0]/=Ke[3],Ke[1]/=Ke[3],Ke[2]/=Ke[3],Ke[3]=1;const He=((Ye,xt,wt,pt,Pt)=>({u_sun_pos:Ye,u_atmosphere_blend:xt,u_globe_position:wt,u_globe_radius:pt,u_inv_proj_matrix:Pt}))(_e,Ce,[Ke[0],Ke[1],Ke[2]],be,Le),$e=Js(he,$);ce.draw(he,Ae.TRIANGLES,ye,Ci.disabled,bi.alphaBlended,wi.disabled,He,null,null,"atmosphere",$e.vertexBuffer,$e.indexBuffer,$e.segments)})(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const U=(function($,ie){let he=null;const Ae=Object.values($._layers).flatMap((_e=>_e.source&&!_e.isHidden(ie)?[$.tileManagers[_e.source]]:[])),ce=Ae.filter((_e=>_e.getSource().type==="vector")),ye=Ae.filter((_e=>_e.getSource().type!=="vector")),Pe=_e=>{(!he||he.getSource().maxzoom<_e.getSource().maxzoom)&&(he=_e)};return ce.forEach((_e=>Pe(_e))),he||ye.forEach((_e=>Pe(_e))),he})(this.style,this.transform.zoom);U&&(function($,ie,he){for(let Ae=0;Ae<he.length;Ae++)Fu($,ie,he[Ae])})(this,U,U.getVisibleCoordinates())}this.options.showPadding&&(function(U){const $=U.transform.padding;_u(U,U.transform.height-($.top||0),3,fu),_u(U,$.bottom||0,3,du),gu(U,$.left||0,3,pu),gu(U,U.transform.width-($.right||0),3,mu);const ie=U.transform.centerPoint;(function(he,Ae,ce,ye){Sl(he,Ae-1,ce-10,2,20,ye),Sl(he,Ae-10,ce-1,20,2,ye)})(U,ie.x,U.transform.height-ie.y,ia)})(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const n=this.terrainFacilitator.matrix,h=this.transform.modelViewProjectionMatrix;let f=this.terrainFacilitator.dirty;f||(f=t?!p.cj(n,h):!p.ck(n,h)),f||(f=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),f&&(p.cl(n,h),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,(function(x,T){const C=x.context,D=C.gl,B=x.transform,N=bi.unblended,G=new ri(D.LEQUAL,ri.ReadWrite,[0,1]),U=T.tileManager.getRenderableTiles(),$=x.useProgram("terrainDepth");C.bindFramebuffer.set(T.getFramebuffer("depth").framebuffer),C.viewport.set([0,0,x.width/devicePixelRatio,x.height/devicePixelRatio]),C.clear({color:p.bp.transparent,depth:1});for(const ie of U){const he=T.getTerrainMesh(ie.tileID),Ae=T.getTerrainData(ie.tileID),ce=B.getProjectionData({overscaledTileID:ie.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),ye={u_ele_delta:T.getMeshFrameDelta(B.zoom)};$.draw(C,D.TRIANGLES,G,Ci.disabled,N,wi.backCCW,ye,Ae,ce,"terrain",he.vertexBuffer,he.indexBuffer,he.segments)}C.bindFramebuffer.set(null),C.viewport.set([0,0,x.width,x.height])})(this,this.style.map.terrain),(function(x,T){const C=x.context,D=C.gl,B=x.transform,N=bi.unblended,G=new ri(D.LEQUAL,ri.ReadWrite,[0,1]),U=T.getCoordsTexture(),$=T.tileManager.getRenderableTiles(),ie=x.useProgram("terrainCoords");C.bindFramebuffer.set(T.getFramebuffer("coords").framebuffer),C.viewport.set([0,0,x.width/devicePixelRatio,x.height/devicePixelRatio]),C.clear({color:p.bp.transparent,depth:1}),T.coordsIndex=[];for(const he of $){const Ae=T.getTerrainMesh(he.tileID),ce=T.getTerrainData(he.tileID);C.activeTexture.set(D.TEXTURE0),D.bindTexture(D.TEXTURE_2D,U.texture);const ye={u_terrain_coords_id:(255-T.coordsIndex.length)/255,u_texture:0,u_ele_delta:T.getMeshFrameDelta(B.zoom)},Pe=B.getProjectionData({overscaledTileID:he.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});ie.draw(C,D.TRIANGLES,G,Ci.disabled,N,wi.backCCW,ye,ce,Pe,"terrain",Ae.vertexBuffer,Ae.indexBuffer,Ae.segments),T.coordsIndex.push(he.tileID.key)}C.bindFramebuffer.set(null),C.viewport.set([0,0,x.width,x.height])})(this,this.style.map.terrain))}renderLayer(t,n,h,f,x){h.isHidden(this.transform.zoom)||(h.type==="background"||h.type==="custom"||(f||[]).length)&&(this.id=h.id,p.cm(h)?(function(T,C,D,B,N,G){if(T.renderPass!=="translucent")return;const{isRenderingToTexture:U}=G,$=Ci.disabled,ie=T.colorModeForRenderPass();(D._unevaluatedLayout.hasValue("text-variable-anchor")||D._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&(function(he,Ae,ce,ye,Pe,_e,we,Ce,be){const Le=Ae.transform,Ke=Ae.style.map.terrain,He=Pe==="map",$e=_e==="map";for(const Ye of he){const xt=ye.getTile(Ye),wt=xt.getBucket(ce);if(!wt||!wt.text||!wt.text.segments.get().length)continue;const pt=p.ay(wt.textSizeData,Le.zoom),Pt=p.aN(xt,1,Ae.transform.zoom),mi=fi(He,Ae.transform,Pt),sr=ce.layout.get("icon-text-fit")!=="none"&&wt.hasIconData();if(pt){const Dr=Math.pow(2,Le.zoom-xt.tileID.overscaledZ),mr=Ke?(Rr,_r)=>Ke.getElevation(Ye,Rr,_r):null;Jt(wt,He,$e,be,Le,mi,Dr,pt,sr,p.aO(Le,xt,we,Ce),Ye.toUnwrapped(),mr)}}})(B,T,D,C,D.layout.get("text-rotation-alignment"),D.layout.get("text-pitch-alignment"),D.paint.get("text-translate"),D.paint.get("text-translate-anchor"),N),D.paint.get("icon-opacity").constantOr(1)!==0&&Zr(T,C,D,B,!1,D.paint.get("icon-translate"),D.paint.get("icon-translate-anchor"),D.layout.get("icon-rotation-alignment"),D.layout.get("icon-pitch-alignment"),D.layout.get("icon-keep-upright"),$,ie,U),D.paint.get("text-opacity").constantOr(1)!==0&&Zr(T,C,D,B,!0,D.paint.get("text-translate"),D.paint.get("text-translate-anchor"),D.layout.get("text-rotation-alignment"),D.layout.get("text-pitch-alignment"),D.layout.get("text-keep-upright"),$,ie,U),C.map.showCollisionBoxes&&(Ze(T,C,D,B,!0),Ze(T,C,D,B,!1))})(t,n,h,f,this.style.placement.variableOffsets,x):p.cn(h)?(function(T,C,D,B,N){if(T.renderPass!=="translucent")return;const{isRenderingToTexture:G}=N,U=D.paint.get("circle-opacity"),$=D.paint.get("circle-stroke-width"),ie=D.paint.get("circle-stroke-opacity"),he=!D.layout.get("circle-sort-key").isConstant();if(U.constantOr(1)===0&&($.constantOr(1)===0||ie.constantOr(1)===0))return;const Ae=T.context,ce=Ae.gl,ye=T.transform,Pe=T.getDepthModeForSublayer(0,ri.ReadOnly),_e=Ci.disabled,we=T.colorModeForRenderPass(),Ce=[],be=ye.getCircleRadiusCorrection();for(let Le=0;Le<B.length;Le++){const Ke=B[Le],He=C.getTile(Ke),$e=He.getBucket(D);if(!$e)continue;const Ye=D.paint.get("circle-translate"),xt=D.paint.get("circle-translate-anchor"),wt=p.aO(ye,He,Ye,xt),pt=$e.programConfigurations.get(D.id),Pt=T.useProgram("circle",pt),mi=$e.layoutVertexBuffer,sr=$e.indexBuffer,Dr=T.style.map.terrain&&T.style.map.terrain.getTerrainData(Ke),mr={programConfiguration:pt,program:Pt,layoutVertexBuffer:mi,indexBuffer:sr,uniformValues:$i(T,He,D,wt,be),terrainData:Dr,projectionData:ye.getProjectionData({overscaledTileID:Ke,applyGlobeMatrix:!G,applyTerrainMatrix:!0})};if(he){const Rr=$e.segments.get();for(const _r of Rr)Ce.push({segments:new p.aX([_r]),sortKey:_r.sortKey,state:mr})}else Ce.push({segments:$e.segments,sortKey:0,state:mr})}he&&Ce.sort(((Le,Ke)=>Le.sortKey-Ke.sortKey));for(const Le of Ce){const{programConfiguration:Ke,program:He,layoutVertexBuffer:$e,indexBuffer:Ye,uniformValues:xt,terrainData:wt,projectionData:pt}=Le.state;He.draw(Ae,ce.TRIANGLES,Pe,_e,we,wi.backCCW,xt,wt,pt,D.id,$e,Ye,Le.segments,D.paint,T.transform.zoom,Ke)}})(t,n,h,f,x):p.co(h)?(function(T,C,D,B,N){if(D.paint.get("heatmap-opacity")===0)return;const G=T.context,{isRenderingToTexture:U,isRenderingGlobe:$}=N;if(T.style.map.terrain){for(const ie of B){const he=C.getTile(ie);C.hasRenderableParent(ie)||(T.renderPass==="offscreen"?ps(T,he,D,ie,$):T.renderPass==="translucent"&&On(T,D,ie,U,$))}G.viewport.set([0,0,T.width,T.height])}else T.renderPass==="offscreen"?(function(ie,he,Ae,ce){const ye=ie.context,Pe=ye.gl,_e=ie.transform,we=Ci.disabled,Ce=new bi([Pe.ONE,Pe.ONE],p.bp.transparent,[!0,!0,!0,!0]);(function(be,Le,Ke){const He=be.gl;be.activeTexture.set(He.TEXTURE1),be.viewport.set([0,0,Le.width/4,Le.height/4]);let $e=Ke.heatmapFbos.get(p.cd);$e?(He.bindTexture(He.TEXTURE_2D,$e.colorAttachment.get()),be.bindFramebuffer.set($e.framebuffer)):($e=Ks(be,Le.width/4,Le.height/4),Ke.heatmapFbos.set(p.cd,$e))})(ye,ie,Ae),ye.clear({color:p.bp.transparent});for(let be=0;be<ce.length;be++){const Le=ce[be];if(he.hasRenderableParent(Le))continue;const Ke=he.getTile(Le),He=Ke.getBucket(Ae);if(!He)continue;const $e=He.programConfigurations.get(Ae.id),Ye=ie.useProgram("heatmap",$e),xt=_e.getProjectionData({overscaledTileID:Le,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),wt=_e.getCircleRadiusCorrection();Ye.draw(ye,Pe.TRIANGLES,ri.disabled,we,Ce,wi.backCCW,uo(Ke,_e.zoom,Ae.paint.get("heatmap-intensity"),wt),null,xt,Ae.id,He.layoutVertexBuffer,He.indexBuffer,He.segments,Ae.paint,_e.zoom,$e)}ye.viewport.set([0,0,ie.width,ie.height])})(T,C,D,B):T.renderPass==="translucent"&&(function(ie,he){const Ae=ie.context,ce=Ae.gl;Ae.setColorMode(ie.colorModeForRenderPass());const ye=he.heatmapFbos.get(p.cd);ye&&(Ae.activeTexture.set(ce.TEXTURE0),ce.bindTexture(ce.TEXTURE_2D,ye.colorAttachment.get()),Ae.activeTexture.set(ce.TEXTURE1),al(Ae,he).bind(ce.LINEAR,ce.CLAMP_TO_EDGE),ie.useProgram("heatmapTexture").draw(Ae,ce.TRIANGLES,ri.disabled,Ci.disabled,ie.colorModeForRenderPass(),wi.disabled,Ul(ie,he,0,1),null,null,he.id,ie.viewportBuffer,ie.quadTriangleIndexBuffer,ie.viewportSegments,he.paint,ie.transform.zoom))})(T,D)})(t,n,h,f,x):p.cp(h)?(function(T,C,D,B,N){if(T.renderPass!=="translucent")return;const{isRenderingToTexture:G}=N,U=D.paint.get("line-opacity"),$=D.paint.get("line-width");if(U.constantOr(1)===0||$.constantOr(1)===0)return;const ie=T.getDepthModeForSublayer(0,ri.ReadOnly),he=T.colorModeForRenderPass(),Ae=D.paint.get("line-dasharray"),ce=Ae.constantOr(1),ye=D.paint.get("line-pattern"),Pe=ye.constantOr(1),_e=D.paint.get("line-gradient"),we=D.getCrossfadeParameters();let Ce;Ce=Pe?"linePattern":ce&&_e?"lineGradientSDF":ce?"lineSDF":_e?"lineGradient":"line";const be=T.context,Le=be.gl,Ke=T.transform;let He=!0;for(const $e of B){const Ye=C.getTile($e);if(Pe&&!Ye.patternsLoaded())continue;const xt=Ye.getBucket(D);if(!xt)continue;const wt=xt.programConfigurations.get(D.id),pt=T.context.program.get(),Pt=T.useProgram(Ce,wt),mi=He||Pt.program!==pt,sr=T.style.map.terrain&&T.style.map.terrain.getTerrainData($e),Dr=ye.constantOr(null),mr=Ae&&Ae.constantOr(null);if(Dr&&Ye.imageAtlas){const rs=Ye.imageAtlas,dn=rs.patternPositions[Dr.to.toString()],an=rs.patternPositions[Dr.from.toString()];dn&&an&&wt.setConstantPatternPositions(dn,an)}else if(mr){const rs=D.layout.get("line-cap")==="round",dn=T.lineAtlas.getDash(mr.to,rs),an=T.lineAtlas.getDash(mr.from,rs);wt.setConstantDashPositions(dn,an)}const Rr=Ke.getProjectionData({overscaledTileID:$e,applyGlobeMatrix:!G,applyTerrainMatrix:!0}),_r=Ke.getPixelScale();let Yr;Pe?(Yr=As(T,Ye,D,_r,we),Xl(be,Le,Ye,wt,we)):ce&&_e?(Yr=vn(T,Ye,D,_r,we,xt.lineClipsArray.length),Nn(T,C,be,Le,D,xt,$e,wt,we)):ce?(Yr=Ba(T,Ye,D,_r,we),br(T,be,Le,wt,mi,we)):_e?(Yr=Gl(T,Ye,D,_r,xt.lineClipsArray.length),ea(T,C,be,Le,D,xt,$e)):Yr=yn(T,Ye,D,_r);const Fr=T.stencilModeForClipping($e);Pt.draw(be,Le.TRIANGLES,ie,Fr,he,wi.disabled,Yr,sr,Rr,D.id,xt.layoutVertexBuffer,xt.indexBuffer,xt.segments,D.paint,T.transform.zoom,wt,xt.layoutVertexBuffer2),He=!1}})(t,n,h,f,x):p.cq(h)?(function(T,C,D,B,N){const G=D.paint.get("fill-color"),U=D.paint.get("fill-opacity");if(U.constantOr(1)===0)return;const{isRenderingToTexture:$}=N,ie=T.colorModeForRenderPass(),he=D.paint.get("fill-pattern"),Ae=T.opaquePassEnabledForLayer()&&!he.constantOr(1)&&G.constantOr(p.bp.transparent).a===1&&U.constantOr(0)===1?"opaque":"translucent";if(T.renderPass===Ae){const ce=T.getDepthModeForSublayer(1,T.renderPass==="opaque"?ri.ReadWrite:ri.ReadOnly);nr(T,C,D,B,ce,ie,!1,$)}if(T.renderPass==="translucent"&&D.paint.get("fill-antialias")){const ce=T.getDepthModeForSublayer(D.getPaintProperty("fill-outline-color")?2:0,ri.ReadOnly);nr(T,C,D,B,ce,ie,!0,$)}})(t,n,h,f,x):p.cr(h)?(function(T,C,D,B,N){const G=D.paint.get("fill-extrusion-opacity");if(G===0)return;const{isRenderingToTexture:U}=N;if(T.renderPass==="translucent"){const $=new ri(T.context.gl.LEQUAL,ri.ReadWrite,T.depthRangeFor3D);if(G!==1||D.paint.get("fill-extrusion-pattern").constantOr(1))ll(T,C,D,B,$,Ci.disabled,bi.disabled,U),ll(T,C,D,B,$,T.stencilModeFor3D(),T.colorModeForRenderPass(),U);else{const ie=T.colorModeForRenderPass();ll(T,C,D,B,$,Ci.disabled,ie,U)}}})(t,n,h,f,x):p.cs(h)?(function(T,C,D,B,N){if(T.renderPass!=="offscreen"&&T.renderPass!=="translucent")return;const{isRenderingToTexture:G}=N,U=T.context,$=T.style.projection.useSubdivision,ie=T.getDepthModeForSublayer(0,ri.ReadOnly),he=T.colorModeForRenderPass();if(T.renderPass==="offscreen")(function(Ae,ce,ye,Pe,_e,we,Ce){const be=Ae.context,Le=be.gl;for(const Ke of ye){const He=ce.getTile(Ke),$e=He.dem;if(!$e||!$e.data||!He.needsHillshadePrepare)continue;const Ye=$e.dim,xt=$e.stride,wt=$e.getPixels();if(be.activeTexture.set(Le.TEXTURE1),be.pixelStoreUnpackPremultiplyAlpha.set(!1),He.demTexture=He.demTexture||Ae.getTileTexture(xt),He.demTexture){const Pt=He.demTexture;Pt.update(wt,{premultiply:!1}),Pt.bind(Le.NEAREST,Le.CLAMP_TO_EDGE)}else He.demTexture=new p.T(be,wt,Le.RGBA,{premultiply:!1}),He.demTexture.bind(Le.NEAREST,Le.CLAMP_TO_EDGE);be.activeTexture.set(Le.TEXTURE0);let pt=He.fbo;if(!pt){const Pt=new p.T(be,{width:Ye,height:Ye,data:null},Le.RGBA);Pt.bind(Le.LINEAR,Le.CLAMP_TO_EDGE),pt=He.fbo=be.createFramebuffer(Ye,Ye,!0,!1),pt.colorAttachment.set(Pt.texture)}be.bindFramebuffer.set(pt.framebuffer),be.viewport.set([0,0,Ye,Ye]),Ae.useProgram("hillshadePrepare").draw(be,Le.TRIANGLES,_e,we,Ce,wi.disabled,cu(He.tileID,$e),null,null,Pe.id,Ae.rasterBoundsBuffer,Ae.quadTriangleIndexBuffer,Ae.rasterBoundsSegments),He.needsHillshadePrepare=!1}})(T,C,B,D,ie,Ci.disabled,he),U.viewport.set([0,0,T.width,T.height]);else if(T.renderPass==="translucent")if($){const[Ae,ce,ye]=T.stencilConfigForOverlapTwoPass(B);Co(T,C,D,ye,Ae,ie,he,!1,G),Co(T,C,D,ye,ce,ie,he,!0,G)}else{const[Ae,ce]=T.getStencilConfigForOverlapAndUpdateStencilID(B);Co(T,C,D,ce,Ae,ie,he,!1,G)}})(t,n,h,f,x):p.ct(h)?(function(T,C,D,B,N){if(T.renderPass!=="translucent"||!B.length)return;const{isRenderingToTexture:G}=N,U=T.style.projection.useSubdivision,$=T.getDepthModeForSublayer(0,ri.ReadOnly),ie=T.colorModeForRenderPass();if(U){const[he,Ae,ce]=T.stencilConfigForOverlapTwoPass(B);Ao(T,C,D,ce,he,$,ie,!1,G),Ao(T,C,D,ce,Ae,$,ie,!0,G)}else{const[he,Ae]=T.getStencilConfigForOverlapAndUpdateStencilID(B);Ao(T,C,D,Ae,he,$,ie,!1,G)}})(t,n,h,f,x):p.bU(h)?(function(T,C,D,B,N){if(T.renderPass!=="translucent"||D.paint.get("raster-opacity")===0||!B.length)return;const{isRenderingToTexture:G}=N,U=C.getSource(),$=T.style.projection.useSubdivision;if(U instanceof mn)ta(T,C,D,B,null,!1,!1,U.tileCoords,U.flippedWindingOrder,G);else if($){const[ie,he,Ae]=T.stencilConfigForOverlapTwoPass(B);ta(T,C,D,Ae,ie,!1,!0,Ur,!1,G),ta(T,C,D,Ae,he,!0,!0,Ur,!1,G)}else{const[ie,he]=T.getStencilConfigForOverlapAndUpdateStencilID(B);ta(T,C,D,he,ie,!1,!0,Ur,!1,G)}})(t,n,h,f,x):p.cu(h)?(function(T,C,D,B,N){const G=D.paint.get("background-color"),U=D.paint.get("background-opacity");if(U===0)return;const{isRenderingToTexture:$}=N,ie=T.context,he=ie.gl,Ae=T.style.projection,ce=T.transform,ye=ce.tileSize,Pe=D.paint.get("background-pattern");if(T.isPatternMissing(Pe))return;const _e=!Pe&&G.a===1&&U===1&&T.opaquePassEnabledForLayer()?"opaque":"translucent";if(T.renderPass!==_e)return;const we=Ci.disabled,Ce=T.getDepthModeForSublayer(0,_e==="opaque"?ri.ReadWrite:ri.ReadOnly),be=T.colorModeForRenderPass(),Le=T.useProgram(Pe?"backgroundPattern":"background"),Ke=B||er(ce,{tileSize:ye,terrain:T.style.map.terrain});Pe&&(ie.activeTexture.set(he.TEXTURE0),T.imageManager.bind(T.context));const He=D.getCrossfadeParameters();for(const $e of Ke){const Ye=ce.getProjectionData({overscaledTileID:$e,applyGlobeMatrix:!$,applyTerrainMatrix:!0}),xt=Pe?Pl(U,T,Pe,{tileID:$e,tileSize:ye},He):Ja(U,G),wt=T.style.map.terrain&&T.style.map.terrain.getTerrainData($e),pt=Ae.getMeshFromTileID(ie,$e.canonical,!1,!0,"raster");Le.draw(ie,he.TRIANGLES,Ce,we,be,wi.backCCW,xt,wt,Ye,D.id,pt.vertexBuffer,pt.indexBuffer,pt.segments)}})(t,0,h,f,x):p.cv(h)&&(function(T,C,D,B){const{isRenderingGlobe:N}=B,G=T.context,U=D.implementation,$=T.style.projection,ie=T.transform,he=ie.getProjectionDataForCustomLayer(N),Ae={farZ:ie.farZ,nearZ:ie.nearZ,fov:ie.fov*Math.PI/180,modelViewProjectionMatrix:ie.modelViewProjectionMatrix,projectionMatrix:ie.projectionMatrix,shaderData:{variantName:$.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793; 813 + uniform mat4 u_projection_matrix; 814 + ${$.shaderPreludeCode.vertexSource}`,define:$.shaderDefine},defaultProjectionData:he},ce=U.renderingMode?U.renderingMode:"2d";if(T.renderPass==="offscreen"){const ye=U.prerender;ye&&(T.setCustomLayerDefaults(),G.setColorMode(T.colorModeForRenderPass()),ye.call(U,G.gl,Ae),G.setDirty(),T.setBaseState())}else if(T.renderPass==="translucent"){T.setCustomLayerDefaults(),G.setColorMode(T.colorModeForRenderPass()),G.setStencilMode(Ci.disabled);const ye=ce==="3d"?T.getDepthModeFor3D():T.getDepthModeForSublayer(0,ri.ReadOnly);G.setDepthMode(ye),U.render(G.gl,Ae),G.setDirty(),T.setBaseState(),G.bindFramebuffer.set(null)}})(t,0,h,x))}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),h=this.imageManager.getPattern(t.to.toString());return!n||!h}useProgram(t,n,h=!1,f=[]){this.cache=this.cache||{};const x=!!this.style.map.terrain,T=this.style.projection,C=h?Li.projectionMercator:T.shaderPreludeCode,D=h?cn:T.shaderDefine,B=t+(n?n.cacheKey:"")+`/${h?gn:T.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(x?"/terrain":"")+(f?`/${f.join("/")}`:"");return this.cache[B]||(this.cache[B]=new $o(this.context,Li[t],n,Au[t],this._showOverdrawInspector,x,C,D,f)),this.cache[B]}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(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new p.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var t,n;if(this._tileTextures){for(const h in this._tileTextures){const f=this._tileTextures[h];if(f)for(const x of f)x.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&((t=this.tileExtentMesh.vertexBuffer)===null||t===void 0||t.destroy()),this.tileExtentMesh&&((n=this.tileExtentMesh.indexBuffer)===null||n===void 0||n.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(const h in this.cache){const f=this.cache[h];f&&f.program&&this.context.gl.deleteProgram(f.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}function ts(y,t){let n,h=!1,f=null,x=null;const T=()=>{f=null,h&&(y.apply(x,n),f=setTimeout(T,t),h=!1)};return(...C)=>(h=!0,x=this,n=C,f||T(),f)}class Wt{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let h;return n.split("&").map((f=>f.split("="))).forEach((f=>{f[0]===this._hashName&&(h=f)})),(h&&h[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(!this._isValidHash(n))return!1;const h=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:h,pitch:+(n[4]||0)}),!0},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{const n=this._getCurrentHash();if(n.length===0)return;const h=n.join("/");let f=h;f.split("&").length>0&&(f=f.split("&")[0]),this._hashName&&(f=`${this._hashName}=${h}`);let x=window.location.hash.replace(f,"");x.startsWith("#&")?x=x.slice(0,1)+x.slice(2):x==="#"&&(x="");let T=window.location.href.replace(/(#.+)?$/,x);T=T.replace("&&","&"),window.history.replaceState(window.history.state,null,T)},this._updateHash=ts(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}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()),this._removeHash(),delete this._map,this}getHashString(t){const n=this._map.getCenter(),h=Math.round(100*this._map.getZoom())/100,f=Math.ceil((h*Math.LN2+Math.log(512/360/.5))/Math.LN10),x=Math.pow(10,f),T=Math.round(n.lng*x)/x,C=Math.round(n.lat*x)/x,D=this._map.getBearing(),B=this._map.getPitch();let N="";if(N+=t?`/${T}/${C}/${h}`:`${h}/${C}/${T}`,(D||B)&&(N+="/"+Math.round(10*D)/10),B&&(N+=`/${Math.round(B)}`),this._hashName){const G=this._hashName;let U=!1;const $=window.location.hash.slice(1).split("&").map((ie=>{const he=ie.split("=")[0];return he===G?(U=!0,`${he}=${N}`):ie})).filter((ie=>ie));return U||$.push(`${G}=${N}`),`#${$.join("&")}`}return`#${N}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new p.V(+t[2],+t[1])}catch{return!1}const n=+t[0],h=+(t[3]||0),f=+(t[4]||0);return n>=this._map.getMinZoom()&&n<=this._map.getMaxZoom()&&h>=-180&&h<=180&&f>=this._map.getMinPitch()&&f<=this._map.getMaxPitch()}}const wr={linearity:.3,easing:p.cw(0,0,.3,1)},yu=p.e({deceleration:2500,maxSpeed:1400},wr),bs=p.e({deceleration:20,maxSpeed:1400},wr),xn=p.e({deceleration:1e3,maxSpeed:360},wr),Ou=p.e({deceleration:1e3,maxSpeed:90},wr),lr=p.e({deceleration:1e3,maxSpeed:360},wr);class ul{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Gt(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=Gt();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,roll:0,pan:new p.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:x}of this._inertiaBuffer)n.zoom+=x.zoomDelta||0,n.bearing+=x.bearingDelta||0,n.pitch+=x.pitchDelta||0,n.roll+=x.rollDelta||0,x.panDelta&&n.pan._add(x.panDelta),x.around&&(n.around=x.around),x.pinchAround&&(n.pinchAround=x.pinchAround);const h=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,f={};if(n.pan.mag()){const x=hl(n.pan.mag(),h,p.e({},yu,t||{})),T=n.pan.mult(x.amount/n.pan.mag()),C=this._map.cameraHelper.handlePanInertia(T,this._map.transform);f.center=C.easingCenter,f.offset=C.easingOffset,Do(f,x)}if(n.zoom){const x=hl(n.zoom,h,bs);f.zoom=this._map.transform.zoom+x.amount,Do(f,x)}if(n.bearing){const x=hl(n.bearing,h,xn);f.bearing=this._map.transform.bearing+p.an(x.amount,-179,179),Do(f,x)}if(n.pitch){const x=hl(n.pitch,h,Ou);f.pitch=this._map.transform.pitch+x.amount,Do(f,x)}if(n.roll){const x=hl(n.roll,h,lr);f.roll=this._map.transform.roll+p.an(x.amount,-179,179),Do(f,x)}if(f.zoom||f.bearing){const x=n.pinchAround===void 0?n.around:n.pinchAround;f.around=x?this._map.unproject(x):this._map.getCenter()}return this.clear(),p.e(f,{noMoveStart:!0})}}function Do(y,t){(!y.duration||y.duration<t.duration)&&(y.duration=t.duration,y.easing=t.easing)}function hl(y,t,n){const{maxSpeed:h,linearity:f,deceleration:x}=n,T=p.an(y*f/(t/1e3),-h,h),C=Math.abs(T)/(x*f);return{easing:n.easing,duration:1e3*C,amount:T*(C/2)}}class ht extends p.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,h,f={}){h=h instanceof MouseEvent?h:new MouseEvent(t,h);const x=rt.mousePos(n.getCanvas(),h),T=n.unproject(x);super(t,p.e({point:x,lngLat:T,originalEvent:h},f)),this._defaultPrevented=!1,this.target=n}}class yt extends p.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,h){const f=t==="touchend"?h.changedTouches:h.touches,x=rt.touchPos(n.getCanvasContainer(),f),T=x.map((D=>n.unproject(D))),C=x.reduce(((D,B,N,G)=>D.add(B.div(G.length))),new p.P(0,0));super(t,{points:x,point:C,lngLats:T,lngLat:n.unproject(C),originalEvent:h}),this._defaultPrevented=!1}}class Jl extends p.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,h){super(t,{originalEvent:h}),this._defaultPrevented=!1}}class Nu{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Jl(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new ht(t.type,this._map,t))}mouseup(t){this._map.fire(new ht(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new ht(t.type,this._map,t))}dblclick(t){return this._firePreventable(new ht(t.type,this._map,t))}mouseover(t){this._map.fire(new ht(t.type,this._map,t))}mouseout(t){this._map.fire(new ht(t.type,this._map,t))}touchstart(t){return this._firePreventable(new yt(t.type,this._map,t))}touchmove(t){this._map.fire(new yt(t.type,this._map,t))}touchend(t){this._map.fire(new yt(t.type,this._map,t))}touchcancel(t){this._map.fire(new yt(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class eu{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new ht(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ht("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new ht(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ra{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(t){return this.transform.screenPointToLocation(p.P.convert(t),this._map.terrain)}}class fo{constructor(t,n){this._map=t,this._tr=new ra(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(rt.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const h=n;if(this._lastPos.equals(h)||!this._box&&h.dist(this._startPos)<this._clickTolerance)return;const f=this._startPos;this._lastPos=h,this._box||(this._box=rt.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const x=Math.min(f.x,h.x),T=Math.max(f.x,h.x),C=Math.min(f.y,h.y),D=Math.max(f.y,h.y);rt.setTransform(this._box,`translate(${x}px,${C}px)`),this._box.style.width=T-x+"px",this._box.style.height=D-C+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const h=this._startPos,f=n;if(this.reset(),rt.suppressClick(),h.x!==f.x||h.y!==f.y)return this._map.fire(new p.l("boxzoomend",{originalEvent:t})),{cameraAnimation:x=>x.fitScreenCoordinates(h,f,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(rt.remove(this._box),this._box=null),rt.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new p.l(t,{originalEvent:n}))}}function bn(y,t){if(y.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${y.length}, points ${t.length}`);const n={};for(let h=0;h<y.length;h++)n[y[h].identifier]=t[h];return n}class kt{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,h){(this.centroid||h.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),h.length===this.numTouches&&(this.centroid=(function(f){const x=new p.P(0,0);for(const T of f)x._add(T);return x.div(f.length)})(n),this.touches=bn(h,n)))}touchmove(t,n,h){if(this.aborted||!this.centroid)return;const f=bn(h,n);for(const x in this.touches){const T=f[x];(!T||T.dist(this.touches[x])>30)&&(this.aborted=!0)}}touchend(t,n,h){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),h.length===0){const f=!this.aborted&&this.centroid;if(this.reset(),f)return f}}}class po{constructor(t){this.singleTap=new kt(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,h){this.singleTap.touchstart(t,n,h)}touchmove(t,n,h){this.singleTap.touchmove(t,n,h)}touchend(t,n,h){const f=this.singleTap.touchend(t,n,h);if(f){const x=t.timeStamp-this.lastTime<500,T=!this.lastTap||this.lastTap.dist(f)<30;if(x&&T||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=f,this.count===this.numTaps)return this.reset(),f}}}class l{constructor(t){this._tr=new ra(t),this._zoomIn=new po({numTouches:1,numTaps:2}),this._zoomOut=new po({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,h){this._zoomIn.touchstart(t,n,h),this._zoomOut.touchstart(t,n,h)}touchmove(t,n,h){this._zoomIn.touchmove(t,n,h),this._zoomOut.touchmove(t,n,h)}touchend(t,n,h){const f=this._zoomIn.touchend(t,n,h),x=this._zoomOut.touchend(t,n,h),T=this._tr;return f?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:C=>C.easeTo({duration:300,zoom:T.zoom+1,around:T.unproject(f)},{originalEvent:t})}):x?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:C=>C.easeTo({duration:300,zoom:T.zoom-1,around:T.unproject(x)},{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 a{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 n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.rollDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(n)?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const h=this._lastPoint;if(!h)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const f=Array.isArray(n)?n[0]:n;return!this._moved&&f.dist(h)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=f,this._move(h,f))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&rt.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 c=0,m=2,g={[c]:1,[m]:2};class w{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const n=rt.mouseButton(t);this._eventButton=n}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!(function(n,h){const f=g[h];return n.buttons===void 0||(n.buttons&f)!==f})(t,this._eventButton)}isValidEndEvent(t){return rt.mouseButton(t)===this._eventButton}}class P{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_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)}}class S{constructor(t=new w({checkCorrectEvent:()=>!0}),n=new P){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=n}_executeRelevantHandler(t,n,h){return t instanceof MouseEvent?n(t):typeof TouchEvent<"u"&&t instanceof TouchEvent?h(t):void 0}startMove(t){this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.startMove(n)),(n=>this.oneFingerTouchMoveStateManager.startMove(n)))}endMove(t){this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.endMove(n)),(n=>this.oneFingerTouchMoveStateManager.endMove(n)))}isValidStartEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidStartEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidStartEvent(n)))}isValidMoveEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidMoveEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(n)))}isValidEndEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidEndEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidEndEvent(n)))}}const z=y=>{y.mousedown=y.dragStart,y.mousemoveWindow=y.dragMove,y.mouseup=y.dragEnd,y.contextmenu=t=>{t.preventDefault()}};class O{constructor(t,n){this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new p.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,n,h){return this._calculateTransform(t,n,h)}touchmove(t,n,h){if(this._active){if(!this._shouldBePrevented(h.length))return t.preventDefault(),this._calculateTransform(t,n,h);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,n,h){this._calculateTransform(t,n,h),this._active&&this._shouldBePrevented(h.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,h){h.length>0&&(this._active=!0);const f=bn(h,n),x=new p.P(0,0),T=new p.P(0,0);let C=0;for(const B in f){const N=f[B],G=this._touches[B];G&&(x._add(N),T._add(N.sub(G)),C++,f[B]=N)}if(this._touches=f,this._shouldBePrevented(C)||!T.mag())return;const D=T.div(C);return this._sum._add(D),this._sum.mag()<this._clickTolerance?void 0:{around:x.div(C),panDelta:D}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Z{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,n,h){this._firstTwoTouches||h.length<2||(this._firstTwoTouches=[h[0].identifier,h[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,h){if(!this._firstTwoTouches)return;t.preventDefault();const[f,x]=this._firstTwoTouches,T=se(h,n,f),C=se(h,n,x);if(!T||!C)return;const D=this._aroundCenter?null:T.add(C).div(2);return this._move([T,C],D,t)}touchend(t,n,h){if(!this._firstTwoTouches)return;const[f,x]=this._firstTwoTouches,T=se(h,n,f),C=se(h,n,x);T&&C||(this._active&&rt.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function se(y,t,n){for(let h=0;h<y.length;h++)if(y[h].identifier===n)return t[h]}function pe(y,t){return Math.log(y/t)/Math.LN2}class de extends Z{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const h=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(pe(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:pe(this._distance,h),pinchAround:n}}}function me(y,t){return 180*y.angleWith(t)/Math.PI}class Ie extends Z{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,n,h){const f=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:me(this._vector,f),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,h=me(t,this._startVector);return Math.abs(h)<n}}function Be(y){return Math.abs(y.y)>Math.abs(y.x)}class Je extends Z{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,h){super.touchstart(t,n,h),this._currentTouchCount=h.length}_start(t){this._lastPoints=t,Be(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,h){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const f=t[0].sub(this._lastPoints[0]),x=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(f,x,h.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(f.y+x.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,h){if(this._valid!==void 0)return this._valid;const f=t.mag()>=2,x=n.mag()>=2;if(!f&&!x)return;if(!f||!x)return this._firstMove===void 0&&(this._firstMove=h),h-this._firstMove<100&&void 0;const T=t.y>0==n.y>0;return Be(t)&&Be(n)&&T}}const Oe={panStep:100,bearingStep:15,pitchStep:10};class ze{constructor(t){this._tr=new ra(t);const n=Oe;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,h=0,f=0,x=0,T=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?h=-1:(t.preventDefault(),x=-1);break;case 39:t.shiftKey?h=1:(t.preventDefault(),x=1);break;case 38:t.shiftKey?f=1:(t.preventDefault(),T=-1);break;case 40:t.shiftKey?f=-1:(t.preventDefault(),T=1);break;default:return}return this._rotationDisabled&&(h=0,f=0),{cameraAnimation:C=>{const D=this._tr;C.easeTo({duration:300,easeId:"keyboardHandler",easing:De,zoom:n?Math.round(D.zoom)+n*(t.shiftKey?2:1):D.zoom,bearing:D.bearing+h*this._bearingStep,pitch:D.pitch+f*this._pitchStep,offset:[-x*this._panStep,-T*this._panStep],center:D.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 De(y){return y*(2-y)}const bt=4.000244140625,Zt=1/450;class Nt{constructor(t,n){this._onTimeout=h=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(h)},this._map=t,this._tr=new ra(t),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Zt}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const h=Gt(),f=h-(this._lastWheelEventTime||0);this._lastWheelEventTime=h,n!==0&&n%bt==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":f>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(f*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_start(t){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 n=rt.mousePos(this._map.getCanvas(),t),h=this._tr;this._aroundPoint=this._aroundCenter?h.transform.locationToScreenPoint(p.V.convert(h.center)):n,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const C=t.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=C),typeof this._targetZoom=="number"&&(this._targetZoom+=C)}if(this._delta!==0){const C=this._type==="wheel"&&Math.abs(this._delta)>bt?this._wheelZoomRate:this._defaultZoomRate;let D=2/(1+Math.exp(-Math.abs(this._delta*C)));this._delta<0&&D!==0&&(D=1/D);const B=typeof this._targetZoom!="number"?t.scale:p.aq(this._targetZoom);this._targetZoom=t.applyConstrain(t.getCameraLngLat(),p.at(B*D)).zoom,this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom!="number"?t.zoom:this._targetZoom,h=this._startZoom,f=this._easing;let x,T=!1;if(this._type==="wheel"&&h&&f){const C=Gt()-this._lastWheelEventTime,D=Math.min((C+5)/200,1),B=f(D);x=p.G.number(h,n,B),D<1?this._frameId||(this._frameId=!0):T=!0}else x=n,T=!0;return this._active=!0,T&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=x,{noInertia:!0,needsRenderFrame:!T,zoomDelta:x-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=p.cy;if(this._prevEase){const h=this._prevEase,f=(Gt()-h.start)/h.duration,x=h.easing(f+.01)-h.easing(f),T=.27/Math.sqrt(x*x+1e-4)*.01,C=Math.sqrt(.0729-T*T);n=p.cw(T,C,.25,1)}return this._prevEase={start:Gt(),duration:t,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class ai{constructor(t,n){this._clickZoom=t,this._tapZoom=n}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 pi{constructor(t){this._tr=new ra(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:h=>{h.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Mi{constructor(){this._tap=new po({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,n,h){if(!this._swipePoint)if(this._tapTime){const f=n[0],x=t.timeStamp-this._tapTime<500,T=this._tapPoint.dist(f)<30;x&&T?h.length>0&&(this._swipePoint=f,this._swipeTouch=h[0].identifier):this.reset()}else this._tap.touchstart(t,n,h)}touchmove(t,n,h){if(this._tapTime){if(this._swipePoint){if(h[0].identifier!==this._swipeTouch)return;const f=n[0],x=f.y-this._swipePoint.y;return this._swipePoint=f,t.preventDefault(),this._active=!0,{zoomDelta:x/128}}}else this._tap.touchmove(t,n,h)}touchend(t,n,h){if(this._tapTime)this._swipePoint&&h.length===0&&this.reset();else{const f=this._tap.touchend(t,n,h);f&&(this._tapTime=t.timeStamp,this._tapPoint=f)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ei{constructor(t,n,h){this._el=t,this._mousePan=n,this._touchPan=h}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 Vt{constructor(t,n,h,f){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=n,this._mousePitch=h,this._mouseRoll=f}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class vt{constructor(t,n,h,f){this._el=t,this._touchZoom=n,this._touchRotate=h,this._tapDragZoom=f,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()}}class _t{constructor(t,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=t,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=rt.create("div","maplibregl-cooperative-gesture-screen",t);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const h=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),f=document.createElement("div");f.className="maplibregl-desktop-message",f.textContent=n,this._container.appendChild(f);const x=document.createElement("div");x.className="maplibregl-mobile-message",x.textContent=h,this._container.appendChild(x),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(rt.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,n){this._enabled&&(this._map.fire(new p.l("cooperativegestureprevented",{gestureType:t,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const Mt=y=>y.zoom||y.drag||y.roll||y.pitch||y.rotate;class li extends p.l{}function Yi(y){return y.panDelta&&y.panDelta.mag()||y.zoomDelta||y.bearingDelta||y.pitchDelta||y.rollDelta}class wn{constructor(t,n){this.handleWindowEvent=f=>{this.handleEvent(f,`${f.type}Window`)},this.handleEvent=(f,x)=>{if(f.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const T=f.type==="renderFrame"?void 0:f,C={needsRenderFrame:!1},D={},B={};for(const{handlerName:U,handler:$,allowed:ie}of this._handlers){if(!$.isEnabled())continue;let he;if(this._blockedByActive(B,ie,U))$.reset();else if($[x||f.type]){if(p.cz(f,x||f.type)){const Ae=rt.mousePos(this._map.getCanvas(),f);he=$[x||f.type](f,Ae)}else if(p.cA(f,x||f.type)){const Ae=this._getMapTouches(f.touches),ce=rt.touchPos(this._map.getCanvas(),Ae);he=$[x||f.type](f,ce,Ae)}else p.cB(x||f.type)||(he=$[x||f.type](f));this.mergeHandlerResult(C,D,he,U,T),he&&he.needsRenderFrame&&this._triggerRenderFrame()}(he||$.isActive())&&(B[U]=$)}const N={};for(const U in this._previousActiveHandlers)B[U]||(N[U]=T);this._previousActiveHandlers=B,(Object.keys(N).length||Yi(C))&&(this._changes.push([C,D,N]),this._triggerRenderFrame()),(Object.keys(B).length||Yi(C))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:G}=C;G&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],G(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ul(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const h=this._el;this._listeners=[[h,"touchstart",{passive:!0}],[h,"touchmove",{passive:!1}],[h,"touchend",void 0],[h,"touchcancel",void 0],[h,"mousedown",void 0],[h,"mousemove",void 0],[h,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[h,"mouseover",void 0],[h,"mouseout",void 0],[h,"dblclick",void 0],[h,"click",void 0],[h,"keydown",{capture:!1}],[h,"keyup",void 0],[h,"wheel",{passive:!1}],[h,"contextmenu",void 0],[window,"blur",void 0]];for(const[f,x,T]of this._listeners)rt.addEventListener(f,x,f===document?this.handleWindowEvent:this.handleEvent,T)}destroy(){for(const[t,n,h]of this._listeners)rt.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,h)}_addDefaultHandlers(t){const n=this._map,h=n.getCanvasContainer();this._add("mapEvent",new Nu(n,t));const f=n.boxZoom=new fo(n,t);this._add("boxZoom",f),t.interactive&&t.boxZoom&&f.enable();const x=n.cooperativeGestures=new _t(n,t.cooperativeGestures);this._add("cooperativeGestures",x),t.cooperativeGestures&&x.enable();const T=new l(n),C=new pi(n);n.doubleClickZoom=new ai(C,T),this._add("tapZoom",T),this._add("clickZoom",C),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const D=new Mi;this._add("tapDragZoom",D);const B=n.touchPitch=new Je(n);this._add("touchPitch",B),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const N=()=>n.project(n.getCenter()),G=(function({enable:_e,clickTolerance:we,aroundCenter:Ce=!0,minPixelCenterThreshold:be=100,rotateDegreesPerPixelMoved:Le=.8},Ke){const He=new w({checkCorrectEvent:$e=>rt.mouseButton($e)===0&&$e.ctrlKey||rt.mouseButton($e)===2&&!$e.ctrlKey});return new a({clickTolerance:we,move:($e,Ye)=>{const xt=Ke();if(Ce&&Math.abs(xt.y-$e.y)>be)return{bearingDelta:p.cx(new p.P($e.x,Ye.y),Ye,xt)};let wt=(Ye.x-$e.x)*Le;return Ce&&Ye.y<xt.y&&(wt=-wt),{bearingDelta:wt}},moveStateManager:He,enable:_e,assignEvents:z})})(t,N),U=(function({enable:_e,clickTolerance:we,pitchDegreesPerPixelMoved:Ce=-.5}){const be=new w({checkCorrectEvent:Le=>rt.mouseButton(Le)===0&&Le.ctrlKey||rt.mouseButton(Le)===2});return new a({clickTolerance:we,move:(Le,Ke)=>({pitchDelta:(Ke.y-Le.y)*Ce}),moveStateManager:be,enable:_e,assignEvents:z})})(t),$=(function({enable:_e,clickTolerance:we,rollDegreesPerPixelMoved:Ce=.3},be){const Le=new w({checkCorrectEvent:Ke=>rt.mouseButton(Ke)===2&&Ke.ctrlKey});return new a({clickTolerance:we,move:(Ke,He)=>{const $e=be();let Ye=(He.x-Ke.x)*Ce;return He.y<$e.y&&(Ye=-Ye),{rollDelta:Ye}},moveStateManager:Le,enable:_e,assignEvents:z})})(t,N);n.dragRotate=new Vt(t,G,U,$),this._add("mouseRotate",G,["mousePitch"]),this._add("mousePitch",U,["mouseRotate","mouseRoll"]),this._add("mouseRoll",$,["mousePitch"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const ie=(function({enable:_e,clickTolerance:we}){const Ce=new w({checkCorrectEvent:be=>rt.mouseButton(be)===0&&!be.ctrlKey});return new a({clickTolerance:we,move:(be,Le)=>({around:Le,panDelta:Le.sub(be)}),activateOnStart:!0,moveStateManager:Ce,enable:_e,assignEvents:z})})(t),he=new O(t,n);n.dragPan=new ei(h,ie,he),this._add("mousePan",ie),this._add("touchPan",he,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const Ae=new Ie,ce=new de;n.touchZoomRotate=new vt(h,ce,Ae,D),this._add("touchRotate",Ae,["touchPan","touchZoom"]),this._add("touchZoom",ce,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new eu(n));const ye=n.scrollZoom=new Nt(n,(()=>this._triggerRenderFrame()));this._add("scrollZoom",ye,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const Pe=n.keyboard=new ze(n);this._add("keyboard",Pe),t.interactive&&t.keyboard&&n.keyboard.enable()}_add(t,n,h){this._handlers.push({handlerName:t,handler:n,allowed:h}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.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!!Mt(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,h){for(const f in t)if(f!==h&&(!n||n.indexOf(f)<0))return!0;return!1}_getMapTouches(t){const n=[];for(const h of t)this._el.contains(h.target)&&n.push(h);return n}mergeHandlerResult(t,n,h,f,x){if(!h)return;p.e(t,h);const T={handlerName:f,originalEvent:h.originalEvent||x};h.zoomDelta!==void 0&&(n.zoom=T),h.panDelta!==void 0&&(n.drag=T),h.rollDelta!==void 0&&(n.roll=T),h.pitchDelta!==void 0&&(n.pitch=T),h.bearingDelta!==void 0&&(n.rotate=T)}_applyChanges(){const t={},n={},h={};for(const[f,x,T]of this._changes)f.panDelta&&(t.panDelta=(t.panDelta||new p.P(0,0))._add(f.panDelta)),f.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+f.zoomDelta),f.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+f.bearingDelta),f.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+f.pitchDelta),f.rollDelta&&(t.rollDelta=(t.rollDelta||0)+f.rollDelta),f.around!==void 0&&(t.around=f.around),f.pinchAround!==void 0&&(t.pinchAround=f.pinchAround),f.noInertia&&(t.noInertia=f.noInertia),p.e(n,x),p.e(h,T);this._updateMapTransform(t,n,h),this._changes=[]}_updateMapTransform(t,n,h){const f=this._map,x=f._getTransformForUpdate(),T=f.terrain;if(!(Yi(t)||T&&this._terrainMovement))return this._fireEvents(n,h,!0);f._stop(!0);let{panDelta:C,zoomDelta:D,bearingDelta:B,pitchDelta:N,rollDelta:G,around:U,pinchAround:$}=t;$!==void 0&&(U=$),U=U||f.transform.centerPoint,T&&!x.isPointOnMapSurface(U)&&(U=x.centerPoint);const ie={panDelta:C,zoomDelta:D,rollDelta:G,pitchDelta:N,bearingDelta:B,around:U};this._map.cameraHelper.useGlobeControls&&!x.isPointOnMapSurface(U)&&(U=x.centerPoint);const he=U.distSqr(x.centerPoint)<.01?x.center:x.screenPointToLocation(C?U.sub(C):U);this._handleMapControls({terrain:T,tr:x,deltasForHelper:ie,preZoomAroundLoc:he,combinedEventsInProgress:n,panDelta:C}),f._applyUpdatedTransform(x),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,h,!0)}_handleMapControls({terrain:t,tr:n,deltasForHelper:h,preZoomAroundLoc:f,combinedEventsInProgress:x,panDelta:T}){const C=this._map.cameraHelper;if(C.handleMapControlsRollPitchBearingZoom(h,n),t)return C.useGlobeControls?(this._terrainMovement||!x.drag&&!x.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void C.handleMapControlsPan(h,n,f)):this._terrainMovement||!x.drag&&!x.zoom?void(x.drag&&this._terrainMovement&&T?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(T))):C.handleMapControlsPan(h,n,f)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void C.handleMapControlsPan(h,n,f));C.handleMapControlsPan(h,n,f)}_fireEvents(t,n,h){const f=Mt(this._eventsInProgress),x=Mt(t),T={};for(const G in t){const{originalEvent:U}=t[G];this._eventsInProgress[G]||(T[`${G}start`]=U),this._eventsInProgress[G]=t[G]}!f&&x&&this._fireEvent("movestart",x.originalEvent);for(const G in T)this._fireEvent(G,T[G]);x&&this._fireEvent("move",x.originalEvent);for(const G in t){const{originalEvent:U}=t[G];this._fireEvent(G,U)}const C={};let D;for(const G in this._eventsInProgress){const{handlerName:U,originalEvent:$}=this._eventsInProgress[G];this._handlersById[U].isActive()||(delete this._eventsInProgress[G],D=n[U]||$,C[`${G}end`]=D)}for(const G in C)this._fireEvent(G,C[G]);const B=Mt(this._eventsInProgress),N=(f||x)&&!B;if(N&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const G=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&G.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(G)}if(h&&N){this._updatingCamera=!0;const G=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),U=$=>$!==0&&-this._bearingSnap<$&&$<this._bearingSnap;!G||!G.essential&&zr.prefersReducedMotion?(this._map.fire(new p.l("moveend",{originalEvent:D})),U(this._map.getBearing())&&this._map.resetNorth()):(U(G.bearing||this._map.getBearing())&&(G.bearing=0),G.freezeElevation=!0,this._map.easeTo(G,{originalEvent:D})),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new p.l(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new li("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class is extends p.E{constructor(t,n,h){super(),this._renderFrameCallback=()=>{const f=Math.min((Gt()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(f)),f<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=h.bearingSnap,this.cameraHelper=n,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(t,n){t.apply(this.transform,!0),this.transform=t,this.cameraHelper=n}getCenter(){return new p.V(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,n){return this.jumpTo({elevation:t},n),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,n,h){return t=p.P.convert(t).mult(-1),this.panTo(this.transform.center,p.e({offset:t},n),h)}panTo(t,n,h){return this.easeTo(p.e({center:t},n),h)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,h){return this.easeTo(p.e({zoom:t},n),h)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,n){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new p.l("movestart",n)).fire(new p.l("move",n)).fire(new p.l("moveend",n))),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,h){return this.easeTo(p.e({bearing:t},n),h)}resetNorth(t,n){return this.rotateTo(0,p.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(p.e({bearing:0,pitch:0,roll:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}getRoll(){return this.transform.roll}setRoll(t,n){return this.jumpTo({roll:t},n),this}cameraForBounds(t,n){t=Ui.convert(t).adjustAntiMeridian();const h=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),h,n)}_cameraForBoxAndBearing(t,n,h,f){const x={top:0,bottom:0,right:0,left:0};if(typeof(f=p.e({padding:x,offset:[0,0],maxZoom:this.transform.maxZoom},f)).padding=="number"){const B=f.padding;f.padding={top:B,bottom:B,right:B,left:B}}const T=p.e(x,f.padding);f.padding=T;const C=this.transform,D=new Ui(t,n);return this.cameraHelper.cameraForBoxAndBearing(f,T,D,h,C)}fitBounds(t,n,h){return this._fitInternal(this.cameraForBounds(t,n),n,h)}fitScreenCoordinates(t,n,h,f,x){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(p.P.convert(t)),this.transform.screenPointToLocation(p.P.convert(n)),h,f),f,x)}_fitInternal(t,n,h){return t?(delete(n=p.e(t,n)).padding,n.linear?this.easeTo(n,h):this.flyTo(n,h)):this}jumpTo(t,n){this.stop();const h=this._getTransformForUpdate();let f=!1,x=!1,T=!1;const C=h.zoom;this.cameraHelper.handleJumpToCenterZoom(h,t);const D=h.zoom!==C;return"elevation"in t&&h.elevation!==+t.elevation&&h.setElevation(+t.elevation),"bearing"in t&&h.bearing!==+t.bearing&&(f=!0,h.setBearing(+t.bearing)),"pitch"in t&&h.pitch!==+t.pitch&&(x=!0,h.setPitch(+t.pitch)),"roll"in t&&h.roll!==+t.roll&&(T=!0,h.setRoll(+t.roll)),t.padding==null||h.isPaddingEqual(t.padding)||h.setPadding(t.padding),this._applyUpdatedTransform(h),this.fire(new p.l("movestart",n)).fire(new p.l("move",n)),D&&this.fire(new p.l("zoomstart",n)).fire(new p.l("zoom",n)).fire(new p.l("zoomend",n)),f&&this.fire(new p.l("rotatestart",n)).fire(new p.l("rotate",n)).fire(new p.l("rotateend",n)),x&&this.fire(new p.l("pitchstart",n)).fire(new p.l("pitch",n)).fire(new p.l("pitchend",n)),T&&this.fire(new p.l("rollstart",n)).fire(new p.l("roll",n)).fire(new p.l("rollend",n)),this.fire(new p.l("moveend",n))}calculateCameraOptionsFromTo(t,n,h,f=0){const x=p.a9.fromLngLat(t,n),T=p.a9.fromLngLat(h,f),C=T.x-x.x,D=T.y-x.y,B=T.z-x.z,N=Math.hypot(C,D,B);if(N===0)throw new Error("Can't calculate camera options with same From and To");const G=Math.hypot(C,D),U=p.at(this.transform.cameraToCenterDistance/N/this.transform.tileSize),$=180*Math.atan2(C,-D)/Math.PI;let ie=180*Math.acos(G/N)/Math.PI;return ie=B<0?90-ie:90+ie,{center:T.toLngLat(),elevation:f,zoom:U,pitch:ie,bearing:$}}calculateCameraOptionsFromCameraLngLatAltRotation(t,n,h,f,x){const T=this.transform.calculateCenterFromCameraLngLatAlt(t,n,h,f);return{center:T.center,elevation:T.elevation,zoom:T.zoom,bearing:h,pitch:f,roll:x}}easeTo(t,n){this._stop(!1,t.easeId),((t=p.e({offset:[0,0],duration:500,easing:p.cy},t)).animate===!1||!t.essential&&zr.prefersReducedMotion)&&(t.duration=0);const h=this._getTransformForUpdate(),f=this.getBearing(),x=h.pitch,T=h.roll,C="bearing"in t?this._normalizeBearing(t.bearing,f):f,D="pitch"in t?+t.pitch:x,B="roll"in t?this._normalizeBearing(t.roll,T):T,N="padding"in t?t.padding:h.padding,G=p.P.convert(t.offset);let U,$;t.around&&(U=p.V.convert(t.around),$=h.locationToScreenPoint(U));const ie={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},he=this.cameraHelper.handleEaseTo(h,{bearing:C,pitch:D,roll:B,padding:N,around:U,aroundPoint:$,offsetAsPoint:G,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating=this._rotating||f!==C,this._pitching=this._pitching||D!==x,this._rolling=this._rolling||B!==T,this._padding=!h.isPaddingEqual(N),this._zooming=this._zooming||he.isZooming,this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ie),this.terrain&&this._prepareElevation(he.elevationCenter),this._ease((Ae=>{he.easeFunc(Ae),this.terrain&&!t.freezeElevation&&this._updateElevation(Ae),this._applyUpdatedTransform(h),this._fireMoveEvents(n)}),(Ae=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,Ae)}),t),this}_prepareEase(t,n,h={}){this._moving=!0,n||h.moving||this.fire(new p.l("movestart",t)),this._zooming&&!h.zooming&&this.fire(new p.l("zoomstart",t)),this._rotating&&!h.rotating&&this.fire(new p.l("rotatestart",t)),this._pitching&&!h.pitching&&this.fire(new p.l("pitchstart",t)),this._rolling&&!h.rolling&&this.fire(new p.l("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this._elevationStart!==void 0&&this._elevationCenter!==void 0||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){const h=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(h-(n-(h*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.setElevation(p.G.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};const n=t.getCameraLngLat(),h=t.getCameraAltitude(),f=this.terrain?this.terrain.getElevationForLngLatZoom(n,t.zoom):0;if(h<f){const x=this.calculateCameraOptionsFromTo(n,f,t.center,t.elevation);return{pitch:x.pitch,zoom:x.zoom}}return{}}_applyUpdatedTransform(t){const n=[];if(n.push((f=>this._elevateCameraIfInsideTerrain(f))),this.transformCameraUpdate&&n.push((f=>this.transformCameraUpdate(f))),!n.length)return;const h=t.clone();for(const f of n){const x=h.clone(),{center:T,zoom:C,roll:D,pitch:B,bearing:N,elevation:G}=f(x);T&&x.setCenter(T),G!==void 0&&x.setElevation(G),C!==void 0&&x.setZoom(C),D!==void 0&&x.setRoll(D),B!==void 0&&x.setPitch(B),N!==void 0&&x.setBearing(N),h.apply(x,!1)}this.transform.apply(h,!1)}_fireMoveEvents(t){this.fire(new p.l("move",t)),this._zooming&&this.fire(new p.l("zoom",t)),this._rotating&&this.fire(new p.l("rotate",t)),this._pitching&&this.fire(new p.l("pitch",t)),this._rolling&&this.fire(new p.l("roll",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const h=this._zooming,f=this._rotating,x=this._pitching,T=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,h&&this.fire(new p.l("zoomend",t)),f&&this.fire(new p.l("rotateend",t)),x&&this.fire(new p.l("pitchend",t)),T&&this.fire(new p.l("rollend",t)),this.fire(new p.l("moveend",t))}flyTo(t,n){if(!t.essential&&zr.prefersReducedMotion){const Ye=p.U(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(Ye,n)}this.stop(),t=p.e({offset:[0,0],speed:1.2,curve:1.42,easing:p.cy},t);const h=this._getTransformForUpdate(),f=h.bearing,x=h.pitch,T=h.roll,C=h.padding,D="bearing"in t?this._normalizeBearing(t.bearing,f):f,B="pitch"in t?+t.pitch:x,N="roll"in t?this._normalizeBearing(t.roll,T):T,G="padding"in t?t.padding:h.padding,U=p.P.convert(t.offset);let $=h.centerPoint.add(U);const ie=h.screenPointToLocation($),he=this.cameraHelper.handleFlyTo(h,{bearing:D,pitch:B,roll:N,padding:G,locationAtOffset:ie,offsetAsPoint:U,center:t.center,minZoom:t.minZoom,zoom:t.zoom});let Ae=t.curve;const ce=Math.max(h.width,h.height),ye=ce/he.scaleOfZoom,Pe=he.pixelPathLength;typeof he.scaleOfMinZoom=="number"&&(Ae=Math.sqrt(ce/he.scaleOfMinZoom/Pe*2));const _e=Ae*Ae;function we(Ye){const xt=(ye*ye-ce*ce+(Ye?-1:1)*_e*_e*Pe*Pe)/(2*(Ye?ye:ce)*_e*Pe);return Math.log(Math.sqrt(xt*xt+1)-xt)}function Ce(Ye){return(Math.exp(Ye)-Math.exp(-Ye))/2}function be(Ye){return(Math.exp(Ye)+Math.exp(-Ye))/2}const Le=we(!1);let Ke=function(Ye){return be(Le)/be(Le+Ae*Ye)},He=function(Ye){return ce*((be(Le)*(Ce(xt=Le+Ae*Ye)/be(xt))-Ce(Le))/_e)/Pe;var xt},$e=(we(!0)-Le)/Ae;if(Math.abs(Pe)<2e-6||!isFinite($e)){if(Math.abs(ce-ye)<1e-6)return this.easeTo(t,n);const Ye=ye<ce?-1:1;$e=Math.abs(Math.log(ye/ce))/Ae,He=()=>0,Ke=xt=>Math.exp(Ye*Ae*xt)}return t.duration="duration"in t?+t.duration:1e3*$e/("screenSpeed"in t?+t.screenSpeed/Ae:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=f!==D,this._pitching=B!==x,this._rolling=N!==T,this._padding=!h.isPaddingEqual(G),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(he.targetCenter),this._ease((Ye=>{const xt=Ye*$e,wt=1/Ke(xt),pt=He(xt);this._rotating&&h.setBearing(p.G.number(f,D,Ye)),this._pitching&&h.setPitch(p.G.number(x,B,Ye)),this._rolling&&h.setRoll(p.G.number(T,N,Ye)),this._padding&&(h.interpolatePadding(C,G,Ye),$=h.centerPoint.add(U)),he.easeFunc(Ye,wt,pt,$),this.terrain&&!t.freezeElevation&&this._updateElevation(Ye),this._applyUpdatedTransform(h),this._fireMoveEvents(n)}),(()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n)}),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){var h;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const f=this._onEaseEnd;delete this._onEaseEnd,f.call(this,n)}return t||(h=this.handlers)===null||h===void 0||h.stop(!1),this}_ease(t,n,h){h.animate===!1||h.duration===0?(t(1),n()):(this._easeStart=Gt(),this._easeOptions=h,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=p.W(t,-180,180);const h=Math.abs(t-n);return Math.abs(t-360-n)<h&&(t-=360),Math.abs(t+360-n)<h&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(p.V.convert(t),this.transform):null}}const ko={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class dh{constructor(t=ko){this._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")))},this._updateData=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?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"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=rt.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=rt.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=rt.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(){rt.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,n){const h=this._map._getUIString(`AttributionControl.${n}`);t.title=h,t.setAttribute("aria-label",h)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((f=>typeof f!="string"?"":f))):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const f=this._map.style.stylesheet;this.styleOwner=f.owner,this.styleId=f.id}const n=this._map.style.tileManagers;for(const f in n){const x=n[f];if(x.used||x.usedForTerrain){const T=x.getSource();T.attribution&&t.indexOf(T.attribution)<0&&t.push(T.attribution)}}t=t.filter((f=>String(f).trim())),t.sort(((f,x)=>f.length-x.length)),t=t.filter(((f,x)=>{for(let T=x+1;T<t.length;T++)if(t[T].indexOf(f)>=0)return!1;return!0}));const h=t.join(" | ");h!==this._attribHTML&&(this._attribHTML=h,t.length?(this._innerContainer.innerHTML=rt.sanitize(h),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Qh{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const h=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&h.classList.add("maplibregl-compact"):h.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=rt.create("div","maplibregl-ctrl");const n=rt.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){rt.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Ic{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,h=n?this._queue.concat(n):this._queue;for(const f of h)if(f.id===t)return void(f.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const h of n)if(!h.cancelled&&(h.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Dc=p.aU([{name:"a_pos3d",type:"Int16",components:3}]);class vu extends p.E{constructor(t){super(),this._lastTilesetChange=Gt(),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(t,n){this.tileManager.update(t,n),this._renderableTilesKeys=[];const h={};for(const f of er(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n,calculateTileZoom:this.tileManager._source.calculateTileZoom}))h[f.key]=!0,this._renderableTilesKeys.push(f.key),this._tiles[f.key]||(f.terrainRttPosMatrix32f=new Float64Array(16),p.c7(f.terrainRttPosMatrix32f,0,p.a5,p.a5,0,0,1),this._tiles[f.key]=new ft(f,this.tileSize),this._lastTilesetChange=Gt());for(const f in this._tiles)h[f]||delete this._tiles[f]}freeRtt(t){for(const n in this._tiles){const h=this._tiles[n];(!t||h.tileID.equals(t)||h.tileID.isChildOf(t)||t.isChildOf(h.tileID))&&(h.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,n){return n?this._getTerrainCoordsForTileRanges(t,n):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){const n={};for(const h of this._renderableTilesKeys){const f=this._tiles[h].tileID,x=t.clone(),T=p.bk();if(f.canonical.equals(t.canonical))p.c7(T,0,p.a5,p.a5,0,0,1);else if(f.canonical.isChildOf(t.canonical)){const C=f.canonical.z-t.canonical.z,D=f.canonical.x-(f.canonical.x>>C<<C),B=f.canonical.y-(f.canonical.y>>C<<C),N=p.a5>>C;p.c7(T,0,N,N,0,0,1),p.O(T,T,[-D*N,-B*N,0])}else{if(!t.canonical.isChildOf(f.canonical))continue;{const C=t.canonical.z-f.canonical.z,D=t.canonical.x-(t.canonical.x>>C<<C),B=t.canonical.y-(t.canonical.y>>C<<C),N=p.a5>>C;p.c7(T,0,p.a5,p.a5,0,0,1),p.O(T,T,[D*N,B*N,0]),p.Q(T,T,[1/2**C,1/2**C,0])}}x.terrainRttPosMatrix32f=new Float32Array(T),n[h]=x}return n}_getTerrainCoordsForTileRanges(t,n){const h={};for(const f of this._renderableTilesKeys){const x=this._tiles[f].tileID;if(!this._isWithinTileRanges(x,n))continue;const T=t.clone(),C=p.bk();if(x.canonical.z===t.canonical.z){const D=t.canonical.x-x.canonical.x+t.wrap*(1<<t.canonical.z),B=t.canonical.y-x.canonical.y;p.c7(C,0,p.a5,p.a5,0,0,1),p.O(C,C,[D*p.a5,B*p.a5,0])}else if(x.canonical.z>t.canonical.z){const D=x.canonical.z-t.canonical.z,B=x.canonical.x-(x.canonical.x>>D<<D)+t.wrap*(1<<x.canonical.z),N=x.canonical.y-(x.canonical.y>>D<<D),G=t.canonical.x-(x.canonical.x>>D),U=t.canonical.y-(x.canonical.y>>D),$=p.a5>>D;p.c7(C,0,$,$,0,0,1),p.O(C,C,[-B*$+G*p.a5,-N*$+U*p.a5,0])}else{const D=t.canonical.z-x.canonical.z,B=t.canonical.x-(t.canonical.x>>D<<D)+t.wrap*(1<<t.canonical.z),N=t.canonical.y-(t.canonical.y>>D<<D),G=(t.canonical.x>>D)-x.canonical.x,U=(t.canonical.y>>D)-x.canonical.y,$=p.a5<<D;p.c7(C,0,$,$,0,0,1),p.O(C,C,[B*p.a5+G*$,N*p.a5+U*$,0])}T.terrainRttPosMatrix32f=new Float32Array(C),h[f]=T}return h}getSourceTile(t,n){const h=this.tileManager._source;let f=t.overscaledZ-this.deltaZoom;if(f>h.maxzoom&&(f=h.maxzoom),f<h.minzoom)return;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(f).key);let x=this.findTileInCaches(this._sourceTileCache[t.key]);if(!(x!=null&&x.dem)&&n)for(;f>=h.minzoom&&!(x!=null&&x.dem);)x=this.findTileInCaches(t.scaledTo(f--).key);return x}findTileInCaches(t){let n=this.tileManager.getTileByID(t);return n||(n=this.tileManager._outOfViewCache.getByKey(t),n)}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,n){const h=n[t.canonical.z];return!!h&&(t.wrap>h.minWrap||t.wrap<h.maxWrap||t.canonical.x>=h.minTileXWrapped&&t.canonical.x<=h.maxTileXWrapped&&t.canonical.y>=h.minTileY&&t.canonical.y<=h.maxTileY)}}class Gr{constructor(t,n,h){this._meshCache={},this.painter=t,this.tileManager=new vu(n),this.options=h,this.exaggeration=typeof h.exaggeration=="number"?h.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,h,f=p.a5){var x;if(!(n>=0&&n<f&&h>=0&&h<f))return 0;const T=this.getTerrainData(t),C=(x=T.tile)===null||x===void 0?void 0:x.dem;if(!C)return 0;const D=p.cC([],[n/f*p.a5,h/f*p.a5],T.u_terrain_matrix),B=[D[0]*C.dim,D[1]*C.dim],N=Math.floor(B[0]),G=Math.floor(B[1]),U=B[0]-N,$=B[1]-G;return C.get(N,G)*(1-U)*(1-$)+C.get(N+1,G)*U*(1-$)+C.get(N,G+1)*(1-U)*$+C.get(N+1,G+1)*U*$}getElevationForLngLatZoom(t,n){if(!p.cD(n,t.wrap()))return 0;const{tileID:h,mercatorX:f,mercatorY:x}=this._getOverscaledTileIDFromLngLatZoom(t,n);return this.getElevation(h,f%p.a5,x%p.a5,p.a5)}getElevationForLngLat(t,n){const h=er(n,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this});let f=0;for(const x of h)x.canonical.z>f&&(f=Math.min(x.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,f)}getElevation(t,n,h,f=p.a5){return this.getDEMElevation(t,n,h,f)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const f=this.painter.context,x=new p.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new p.T(f,x,f.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new p.T(f,new p.R({width:1,height:1}),f.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(f.gl.NEAREST,f.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=p.ar([])}const n=this.tileManager.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const f=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new p.T(f,n.dem.getPixels(),f.gl.RGBA,{premultiply:!1}),n.demTexture.bind(f.gl.NEAREST,f.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const h=n&&n.toString()+n.tileID.key+t.key;if(h&&!this._demMatrixCache[h]){const f=this.tileManager.getSource().maxzoom;let x=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=f?x=t.canonical.z-f:p.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const T=t.canonical.x-(t.canonical.x>>x<<x),C=t.canonical.y-(t.canonical.y>>x<<x),D=p.cE(new Float64Array(16),[1/(p.a5<<x),1/(p.a5<<x),0]);p.O(D,D,[T*p.a5,C*p.a5,0]),this._demMatrixCache[t.key]={matrix:D,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:h?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(t){const n=this.painter,h=n.width/devicePixelRatio,f=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===h&&this._fbo.height===f||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new p.T(n.context,{width:h,height:f,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new p.T(n.context,{width:h,height:f,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(h,f,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,h,f))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let x=0,T=0;x<this._coordsTextureSize;x++)for(let C=0;C<this._coordsTextureSize;C++,T+=4)n[T+0]=255&C,n[T+1]=255&x,n[T+2]=C>>8<<4|x>>8,n[T+3]=0;const h=new p.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),f=new p.T(t,h,t.gl.RGBA,{premultiply:!1});return f.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=f,f}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const n=new Uint8Array(4),h=this.painter.context,f=h.gl,x=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),T=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),C=Math.round(this.painter.height/devicePixelRatio);h.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),f.readPixels(x,C-T-1,1,1,f.RGBA,f.UNSIGNED_BYTE,n),h.bindFramebuffer.set(null);const D=n[0]+(n[2]>>4<<8),B=n[1]+((15&n[2])<<8),N=this.coordsIndex[255-n[3]],G=N&&this.tileManager.getTileByID(N);if(!G)return null;const U=this._coordsTextureSize,$=(1<<G.tileID.canonical.z)*U;return new p.a9((G.tileID.canonical.x*U+D)/$+G.tileID.wrap,(G.tileID.canonical.y*U+B)/$,this.getElevation(G.tileID,D,B,U))}depthAtPoint(t){const n=new Uint8Array(4),h=this.painter.context,f=h.gl;return h.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),f.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,f.RGBA,f.UNSIGNED_BYTE,n),h.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(t){var n;const h=((n=this.painter.style.projection)===null||n===void 0?void 0:n.transitionState)>0,f=h&&t.canonical.y===0,x=h&&t.canonical.y===(1<<t.canonical.z)-1,T=`m_${f?"n":""}_${x?"s":""}`;if(this._meshCache[T])return this._meshCache[T];const C=this.painter.context,D=new p.cF,B=new p.aY,N=this.meshSize,G=p.a5/N,U=N*N;for(let be=0;be<=N;be++)for(let Le=0;Le<=N;Le++)D.emplaceBack(Le*G,be*G,0);for(let be=0;be<U;be+=N+1)for(let Le=0;Le<N;Le++)B.emplaceBack(Le+be,N+Le+be+1,N+Le+be+2),B.emplaceBack(Le+be,N+Le+be+2,Le+be+1);const $=D.length,ie=$+(N+1),he=(N+1)*N,Ae=f?p.br:0,ce=f?0:1,ye=x?p.bs:p.a5,Pe=x?0:1;for(let be=0;be<=N;be++)D.emplaceBack(be*G,Ae,ce);for(let be=0;be<=N;be++)D.emplaceBack(be*G,ye,Pe);for(let be=0;be<N;be++)B.emplaceBack(he+be,ie+be,ie+be+1),B.emplaceBack(he+be,ie+be+1,he+be+1),B.emplaceBack(0+be,$+be+1,$+be),B.emplaceBack(0+be,0+be+1,$+be+1);const _e=D.length,we=_e+2*(N+1);for(const be of[0,1])for(let Le=0;Le<=N;Le++)for(const Ke of[0,1])D.emplaceBack(be*p.a5,Le*G,Ke);for(let be=0;be<2*N;be+=2)B.emplaceBack(_e+be,_e+be+1,_e+be+3),B.emplaceBack(_e+be,_e+be+3,_e+be+2),B.emplaceBack(we+be,we+be+3,we+be+1),B.emplaceBack(we+be,we+be+2,we+be+3);const Ce=new Ki(C.createVertexBuffer(D,Dc.members),C.createIndexBuffer(B),p.aX.simpleSegment(0,0,D.length,B.length));return this._meshCache[T]=Ce,Ce}getMeshFrameDelta(t){return 2*Math.PI*p.bE/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,n){var h;if(!p.cD(n,t.wrap()))return 0;const{tileID:f}=this._getOverscaledTileIDFromLngLatZoom(t,n);return(h=this.getMinMaxElevation(f).minElevation)!==null&&h!==void 0?h:0}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,h={minElevation:null,maxElevation:null};return n&&n.dem&&(h.minElevation=n.dem.min*this.exaggeration,h.maxElevation=n.dem.max*this.exaggeration),h}_getOverscaledTileIDFromLngLatZoom(t,n){const h=p.a9.fromLngLat(t.wrap()),f=(1<<n)*p.a5,x=h.x*f,T=h.y*f,C=Math.floor(x/p.a5),D=Math.floor(T/p.a5);return{tileID:new p.a2(n,0,n,C,D),mercatorX:x,mercatorY:T}}}class on{constructor(t,n,h){this._context=t,this._size=n,this._tileSize=h,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),h=new p.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return h.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(h.texture),{id:t,fbo:n,texture:h,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((n=>t.id!==n)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];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)&&this._objects.some((t=>!t.inUse))===!1}}const Cl={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class xu{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new on(t.context,30,n.tileManager.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter((h=>!t._layers[h].isHidden(n))),this._coordsAscending={};for(const h in t.tileManagers){this._coordsAscending[h]={};const f=t.tileManagers[h].getVisibleCoordinates(),x=t.tileManagers[h].getSource(),T=x instanceof mn?x.terrainTileRanges:null;for(const C of f){const D=this.terrain.tileManager.getTerrainCoords(C,T);for(const B in D)this._coordsAscending[h][B]||(this._coordsAscending[h][B]=[]),this._coordsAscending[h][B].push(D[B])}}this._coordsAscendingStr={};for(const h of t._order){const f=t._layers[h],x=f.source;if(Cl[f.type]&&!this._coordsAscendingStr[x]){this._coordsAscendingStr[x]={};for(const T in this._coordsAscending[x])this._coordsAscendingStr[x][T]=this._coordsAscending[x][T].map((C=>C.key)).sort().join()}}for(const h of this._renderableTiles)for(const f in this._coordsAscendingStr){const x=this._coordsAscendingStr[f][h.tileID.key];x&&x!==h.rttCoords[f]&&(h.rtt=[])}}renderLayer(t,n){if(t.isHidden(this.painter.transform.zoom))return!1;const h=Object.assign(Object.assign({},n),{isRenderingToTexture:!0}),f=t.type,x=this.painter,T=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Cl[f]&&(this._prevType&&Cl[this._prevType]||this._stacks.push([]),this._prevType=f,this._stacks[this._stacks.length-1].push(t.id),!T))return!0;if(Cl[this._prevType]||Cl[f]&&T){this._prevType=f;const C=this._stacks.length-1,D=this._stacks[C]||[];for(const B of this._renderableTiles){if(this.pool.isFull()&&(Io(this.painter,this.terrain,this._rttTiles,h),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(B),B.rtt[C]){const G=this.pool.getObjectForId(B.rtt[C].id);if(G.stamp===B.rtt[C].stamp){this.pool.useObject(G);continue}}const N=this.pool.getOrCreateFreeObject();this.pool.useObject(N),this.pool.stampObject(N),B.rtt[C]={id:N.id,stamp:N.stamp},x.context.bindFramebuffer.set(N.fbo.framebuffer),x.context.clear({color:p.bp.transparent,stencil:0}),x.currentStencilSource=void 0;for(let G=0;G<D.length;G++){const U=x.style._layers[D[G]],$=U.source?this._coordsAscending[U.source][B.tileID.key]:[B.tileID];x.context.viewport.set([0,0,N.fbo.width,N.fbo.height]),x._renderTileClippingMasks(U,$,!0),x.renderLayer(x,x.style.tileManagers[U.source],U,$,h),U.source&&(B.rttCoords[U.source]=this._coordsAscendingStr[U.source][B.tileID.key])}}return Io(this.painter,this.terrain,this._rttTiles,h),this._rttTiles=[],this.pool.freeAllObjects(),Cl[f]}return!1}}const Vu={"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":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},ph=it,ju={hash:!1,interactive:!0,bearingSnap:7,attributionControl:ko,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:p.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0},mh={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class bu{constructor(t,n,h=!1){this.mousedown=x=>{this.startMove(x,rt.mousePos(this.element,x)),rt.addEventListener(window,"mousemove",this.mousemove),rt.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=x=>{this.move(x,rt.mousePos(this.element,x))},this.mouseup=x=>{this._rotatePitchHandler.dragEnd(x),this.offTemp()},this.touchstart=x=>{x.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=rt.touchPos(this.element,x.targetTouches)[0],this.startMove(x,this._startPos),rt.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),rt.addEventListener(window,"touchend",this.touchend))},this.touchmove=x=>{x.targetTouches.length!==1?this.reset():(this._lastPos=rt.touchPos(this.element,x.targetTouches)[0],this.move(x,this._lastPos))},this.touchend=x=>{x.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=n;const f=new S;this._rotatePitchHandler=new a({clickTolerance:3,move:(x,T)=>{const C=n.getBoundingClientRect(),D=new p.P((C.bottom-C.top)/2,(C.right-C.left)/2);return{bearingDelta:p.cx(new p.P(x.x,T.y),T,D),pitchDelta:h?-.5*(T.y-x.y):void 0}},moveStateManager:f,enable:!0,assignEvents:()=>{}}),this.map=t,rt.addEventListener(n,"mousedown",this.mousedown),rt.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),rt.addEventListener(n,"touchcancel",this.reset)}startMove(t,n){this._rotatePitchHandler.dragStart(t,n),rt.disableDrag()}move(t,n){const h=this.map,{bearingDelta:f,pitchDelta:x}=this._rotatePitchHandler.dragMove(t,n)||{};f&&h.setBearing(h.getBearing()+f),x&&h.setPitch(h.getPitch()+x)}off(){const t=this.element;rt.removeEventListener(t,"mousedown",this.mousedown),rt.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),rt.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),rt.removeEventListener(window,"touchend",this.touchend),rt.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){rt.enableDrag(),rt.removeEventListener(window,"mousemove",this.mousemove),rt.removeEventListener(window,"mouseup",this.mouseup),rt.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),rt.removeEventListener(window,"touchend",this.touchend)}}let Na;function Zu(y,t,n,h=!1){if(h||!n.getCoveringTilesDetailsProvider().allowWorldCopies())return y==null?void 0:y.wrap();const f=new p.V(y.lng,y.lat);if(y=new p.V(y.lng,y.lat),t){const x=new p.V(y.lng-360,y.lat),T=new p.V(y.lng+360,y.lat),C=n.locationToScreenPoint(y).distSqr(t);n.locationToScreenPoint(x).distSqr(t)<C?y=x:n.locationToScreenPoint(T).distSqr(t)<C&&(y=T)}for(;Math.abs(y.lng-n.center.lng)>180;){const x=n.locationToScreenPoint(y);if(x.x>=0&&x.y>=0&&x.x<=n.width&&x.y<=n.height)break;y.lng>n.center.lng?y.lng-=360:y.lng+=360}return y.lng!==f.lng&&n.isPointOnMapSurface(n.locationToScreenPoint(y))?y:f}const wu={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 Uu(y,t,n){const h=y.classList;for(const f in wu)h.remove(`maplibregl-${n}-anchor-${f}`);h.add(`maplibregl-${n}-anchor-${t}`)}class Tu extends p.E{constructor(t){if(super(),this._onKeyPress=n=>{const h=n.code,f=n.charCode||n.keyCode;h!=="Space"&&h!=="Enter"&&f!==32&&f!==13||this.togglePopup()},this._onMapClick=n=>{const h=n.originalEvent.target,f=this._element;this._popup&&(h===f||f.contains(h))&&this.togglePopup()},this._update=n=>{if(!this._map)return;const h=this._map.loaded()&&!this._map.isMoving();((n==null?void 0:n.type)==="terrain"||(n==null?void 0:n.type)==="render"&&!h)&&this._map.once("render",this._update),this._lngLat=Zu(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let f="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?f=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(f=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let x="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?x="rotateX(0deg)":this._pitchAlignment==="map"&&(x=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),rt.setTransform(this._element,`${wu[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${x} ${f}`),zr.frameAsync(new AbortController).then((()=>{this._updateOpacity(n&&n.type==="moveend")})).catch((()=>{}))},this._onMove=n=>{if(!this._isDragging){const h=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=h}this._isDragging&&(this._pos=n.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new p.l("dragstart"))),this.fire(new p.l("drag")))},this._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),this._state==="active"&&this.fire(new p.l("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.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))},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._subpixelPositioning=t&&t.subpixelPositioning||!1,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"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=p.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=rt.create("div");const n=rt.createNS("http://www.w3.org/2000/svg","svg"),h=41,f=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${h}px`),n.setAttributeNS(null,"width",`${f}px`),n.setAttributeNS(null,"viewBox",`0 0 ${f} ${h}`);const x=rt.createNS("http://www.w3.org/2000/svg","g");x.setAttributeNS(null,"stroke","none"),x.setAttributeNS(null,"stroke-width","1"),x.setAttributeNS(null,"fill","none"),x.setAttributeNS(null,"fill-rule","evenodd");const T=rt.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill-rule","nonzero");const C=rt.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"transform","translate(3.0, 29.0)"),C.setAttributeNS(null,"fill","#000000");const D=[{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 ce of D){const ye=rt.createNS("http://www.w3.org/2000/svg","ellipse");ye.setAttributeNS(null,"opacity","0.04"),ye.setAttributeNS(null,"cx","10.5"),ye.setAttributeNS(null,"cy","5.80029008"),ye.setAttributeNS(null,"rx",ce.rx),ye.setAttributeNS(null,"ry",ce.ry),C.appendChild(ye)}const B=rt.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"fill",this._color);const N=rt.createNS("http://www.w3.org/2000/svg","path");N.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"),B.appendChild(N);const G=rt.createNS("http://www.w3.org/2000/svg","g");G.setAttributeNS(null,"opacity","0.25"),G.setAttributeNS(null,"fill","#000000");const U=rt.createNS("http://www.w3.org/2000/svg","path");U.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"),G.appendChild(U);const $=rt.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"transform","translate(6.0, 7.0)"),$.setAttributeNS(null,"fill","#FFFFFF");const ie=rt.createNS("http://www.w3.org/2000/svg","g");ie.setAttributeNS(null,"transform","translate(8.0, 8.0)");const he=rt.createNS("http://www.w3.org/2000/svg","circle");he.setAttributeNS(null,"fill","#000000"),he.setAttributeNS(null,"opacity","0.25"),he.setAttributeNS(null,"cx","5.5"),he.setAttributeNS(null,"cy","5.5"),he.setAttributeNS(null,"r","5.4999962");const Ae=rt.createNS("http://www.w3.org/2000/svg","circle");Ae.setAttributeNS(null,"fill","#FFFFFF"),Ae.setAttributeNS(null,"cx","5.5"),Ae.setAttributeNS(null,"cy","5.5"),Ae.setAttributeNS(null,"r","5.4999962"),ie.appendChild(he),ie.appendChild(Ae),T.appendChild(C),T.appendChild(B),T.appendChild(G),T.appendChild($),T.appendChild(ie),n.appendChild(T),n.setAttributeNS(null,"height",h*this._scale+"px"),n.setAttributeNS(null,"width",f*this._scale+"px"),this._element.appendChild(n),this._offset=p.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(n=>{n.preventDefault()})),this._element.addEventListener("mousedown",(n=>{n.preventDefault()})),Uu(this._element,this._anchor,"marker"),t&&t.className)for(const n of t.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",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("terrain",this._update),this._map.off("projectiontransition",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),rt.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=p.V.convert(t),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 f=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[f,-1*(38.1-13.5+f)],"bottom-right":[-f,-1*(38.1-13.5+f)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var n,h;const f=(n=this._map)===null||n===void 0?void 0:n.terrain,x=this._map.transform.isLocationOccluded(this._lngLat);if(!f||x){const $=x?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==$&&(this._element.style.opacity=$))}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const T=this._map,C=T.terrain.depthAtPoint(this._pos),D=T.terrain.getElevationForLngLat(this._lngLat,T.transform);if(T.transform.lngLatToCameraDepth(this._lngLat,D)-C<.006)return void(this._element.style.opacity=this._opacity);const B=-this._offset.y/T.transform.pixelsPerMeter,N=Math.sin(T.getPitch()*Math.PI/180)*B,G=T.terrain.depthAtPoint(new p.P(this._pos.x,this._pos.y-this._offset.y)),U=T.transform.lngLatToCameraDepth(this._lngLat,D+N)-G>.006;!((h=this._popup)===null||h===void 0)&&h.isOpen()&&U&&this._popup.remove(),this._element.style.opacity=U?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=p.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}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&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,n){return(this._opacity===void 0||t===void 0&&n===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}const _h={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let tu=0,Il=!1;const gh={maxWidth:100,unit:"metric"};function Pu(y,t,n){const h=n&&n.maxWidth||100,f=y._container.clientHeight/2,x=y._container.clientWidth/2,T=y.unproject([x-h/2,f]),C=y.unproject([x+h/2,f]),D=Math.round(y.project(C).x-y.project(T).x),B=Math.min(h,D,y._container.clientWidth),N=T.distanceTo(C);if(n&&n.unit==="imperial"){const G=3.2808*N;G>5280?Dl(t,B,G/5280,y._getUIString("ScaleControl.Miles")):Dl(t,B,G,y._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Dl(t,B,N/1852,y._getUIString("ScaleControl.NauticalMiles")):N>=1e3?Dl(t,B,N/1e3,y._getUIString("ScaleControl.Kilometers")):Dl(t,B,N,y._getUIString("ScaleControl.Meters"))}function Dl(y,t,n,h){const f=(function(x){const T=Math.pow(10,`${Math.floor(x)}`.length-1);let C=x/T;return C=C>=10?10:C>=5?5:C>=3?3:C>=2?2:C>=1?1:(function(D){const B=Math.pow(10,Math.ceil(-Math.log(D)/Math.LN10));return Math.round(D*B)/B})(C),T*C})(n);y.style.width=t*(f/n)+"px",y.innerHTML=`${f}&nbsp;${h}`}const yh={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},Gu=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function qu(y){if(y){if(typeof y=="number"){const t=Math.round(Math.abs(y)/Math.SQRT2);return{center:new p.P(0,0),top:new p.P(0,y),"top-left":new p.P(t,t),"top-right":new p.P(-t,t),bottom:new p.P(0,-y),"bottom-left":new p.P(t,-t),"bottom-right":new p.P(-t,-t),left:new p.P(y,0),right:new p.P(-y,0)}}if(y instanceof p.P||Array.isArray(y)){const t=p.P.convert(y);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:p.P.convert(y.center||[0,0]),top:p.P.convert(y.top||[0,0]),"top-left":p.P.convert(y["top-left"]||[0,0]),"top-right":p.P.convert(y["top-right"]||[0,0]),bottom:p.P.convert(y.bottom||[0,0]),"bottom-left":p.P.convert(y["bottom-left"]||[0,0]),"bottom-right":p.P.convert(y["bottom-right"]||[0,0]),left:p.P.convert(y.left||[0,0]),right:p.P.convert(y.right||[0,0])}}return qu(new p.P(0,0))}const vh=it;W.AJAXError=p.cI,W.Event=p.l,W.Evented=p.E,W.LngLat=p.V,W.MercatorCoordinate=p.a9,W.Point=p.P,W.addProtocol=p.cJ,W.config=p.c,W.removeProtocol=p.cK,W.AttributionControl=dh,W.BoxZoomHandler=fo,W.CanvasSource=ee,W.CooperativeGesturesHandler=_t,W.DoubleClickZoomHandler=ai,W.DragPanHandler=ei,W.DragRotateHandler=Vt,W.EdgeInsets=Us,W.FullscreenControl=class extends p.E{constructor(y={}){super(),this._onFullscreenChange=()=>{var t;let n=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((t=n==null?void 0:n.shadowRoot)===null||t===void 0)&&t.fullscreenElement;)n=n.shadowRoot.fullscreenElement;n===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,y&&y.container&&(y.container instanceof HTMLElement?this._container=y.container:p.w("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(y){return this._map=y,this._container||(this._container=this._map.getContainer()),this._controlContainer=rt.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){rt.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const y=this._fullscreenButton=rt.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);rt.create("span","maplibregl-ctrl-icon",y).setAttribute("aria-hidden","true"),y.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const y=this._getTitle();this._fullscreenButton.setAttribute("aria-label",y),this._fullscreenButton.title=y}_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 p.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new p.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_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()}},W.GeoJSONSource=Ds,W.GeolocateControl=class extends p.E{constructor(y){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new p.l("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("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&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new p.l("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new p.V(t.coords.longitude,t.coords.latitude),h=t.coords.accuracy,f=this._map.getBearing(),x=p.e({bearing:f},this.options.fitBoundsOptions),T=Ui.fromLngLat(n,h);this._map.fitBounds(T,x,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new p.V(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=t=>{if(this._map){if(t.code===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._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&Il)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new p.l("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=rt.create("button","maplibregl-ctrl-geolocate",this._container),rt.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(t===!1){p.w("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=rt.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Tu({element:this._dotElement}),this._circleElement=rt.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Tu({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(n=>{const h=(n==null?void 0:n[0])instanceof ResizeObserverEntry;n.geolocateSource||this._watchState!=="ACTIVE_LOCK"||h||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new p.l("trackuserlocationend")),this.fire(new p.l("userlocationlostfocus")))}))}},this.options=p.e({},_h,y)}onAdd(y){return this._map=y,this._container=rt.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return p._(this,arguments,void 0,(function*(t=!1){if(Na!==void 0&&!t)return Na;if(window.navigator.permissions===void 0)return Na=!!window.navigator.geolocation,Na;try{Na=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Na=!!window.navigator.geolocation}return Na}))})().then((t=>this._finishSetupUI(t))),this._container}onRemove(){this._geolocationWatchID!==void 0&&(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(),rt.remove(this._container),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,tu=0,Il=!1}_isOutOfMapMaxBounds(y){const t=this._map.getMaxBounds(),n=y.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.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":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){const y=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&y))return;const t=this._map.project(y),n=this._map.unproject([t.x+100,t.y]),h=y.distanceTo(n)/100,f=2*this._accuracy/h;this._circleElement.style.width=`${f.toFixed(2)}px`,this._circleElement.style.height=`${f.toFixed(2)}px`}trigger(){if(!this._setup)return p.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 p.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":tu--,Il=!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 p.l("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 p.l("trackuserlocationstart")),this.fire(new p.l("userlocationfocus"));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(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let y;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),tu++,tu>1?(y={maximumAge:6e5,timeout:0},Il=!0):(y=this.options.positionOptions,Il=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,y)}}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)}},W.GlobeControl=class{constructor(){this._toggleProjection=()=>{var y;const t=(y=this._map.getProjection())===null||y===void 0?void 0:y.type;this._map.setProjection(t!=="mercator"&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var y;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((y=this._map.getProjection())===null||y===void 0?void 0:y.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(y){return this._map=y,this._container=rt.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=rt.create("button","maplibregl-ctrl-globe",this._container),rt.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){rt.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},W.Hash=Wt,W.ImageSource=mn,W.KeyboardHandler=ze,W.LngLatBounds=Ui,W.LogoControl=Qh,W.Map=class extends is{constructor(y){var t,n;p.cG.mark(p.cH.create);const h=Object.assign(Object.assign(Object.assign({},ju),y),{canvasContextAttributes:Object.assign(Object.assign({},ju.canvasContextAttributes),y.canvasContextAttributes)});if(h.minZoom!=null&&h.maxZoom!=null&&h.minZoom>h.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(h.minPitch!=null&&h.maxPitch!=null&&h.minPitch>h.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(h.minPitch!=null&&h.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(h.maxPitch!=null&&h.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const f=new Po,x=new hi;if(h.minZoom!==void 0&&f.setMinZoom(h.minZoom),h.maxZoom!==void 0&&f.setMaxZoom(h.maxZoom),h.minPitch!==void 0&&f.setMinPitch(h.minPitch),h.maxPitch!==void 0&&f.setMaxPitch(h.maxPitch),h.renderWorldCopies!==void 0&&f.setRenderWorldCopies(h.renderWorldCopies),h.transformConstrain!==null&&f.setConstrainOverride(h.transformConstrain),super(f,x,{bearingSnap:h.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Ic,this._controls=[],this._mapId=p.af(),this._lostContextStyle={style:null,images:null},this._contextLost=C=>{C.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy();for(const D of Object.values(this.style._layers))if(D.type==="custom"&&console.warn(`Custom layer with id '${D.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),D._listeners)for(const[B]of Object.entries(D._listeners))console.warn(`Custom layer with id '${D.id}' had event listeners for event '${B}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this._lostContextStyle=this._getStyleAndImages(),this.style.destroy(),this.style=null,this.fire(new p.l("webglcontextlost",{originalEvent:C}))},this._contextRestored=C=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new p.l("webglcontextrestored",{originalEvent:C}))},this._onMapScroll=C=>{if(C.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=h.interactive,this._maxTileCacheSize=h.maxTileCacheSize,this._maxTileCacheZoomLevels=h.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},h.canvasContextAttributes),this._trackResize=h.trackResize===!0,this._bearingSnap=h.bearingSnap,this._centerClampedToGround=h.centerClampedToGround,this._refreshExpiredTiles=h.refreshExpiredTiles===!0,this._fadeDuration=h.fadeDuration,this._crossSourceCollisions=h.crossSourceCollisions===!0,this._collectResourceTiming=h.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Vu),h.locale),this._clickTolerance=h.clickTolerance,this._overridePixelRatio=h.pixelRatio,this._maxCanvasSize=h.maxCanvasSize,this._zoomLevelsToOverscale=h.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=h.transformCameraUpdate,this.transformConstrain=h.transformConstrain,this.cancelPendingTileRequestsWhileZooming=h.cancelPendingTileRequestsWhileZooming===!0,h.reduceMotion!==void 0&&(zr.prefersReducedMotion=h.reduceMotion),this._imageQueueHandle=En.addThrottleControl((()=>this.isMoving())),this._requestManager=new Oo(h.transformRequest),typeof h.container=="string"){if(this._container=document.getElementById(h.container),!this._container)throw new Error(`Container '${h.container}' not found.`)}else{if(!(h.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=h.container}if(h.maxBounds&&this.setMaxBounds(h.maxBounds),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})),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let C=!1;const D=ts((B=>{this._trackResize&&!this._removed&&(this.resize(B),this.redraw())}),50);this._resizeObserver=new ResizeObserver((B=>{C?D(B):C=!0})),this._resizeObserver.observe(this._container)}this.handlers=new wn(this,h),this._hash=h.hash&&new Wt(typeof h.hash=="string"&&h.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:h.center,elevation:h.elevation,zoom:h.zoom,bearing:h.bearing,pitch:h.pitch,roll:h.roll}),h.bounds&&(this.resize(),this.fitBounds(h.bounds,p.e({},h.fitBoundsOptions,{duration:0}))));const T=typeof h.style=="string"||((n=(t=h.style)===null||t===void 0?void 0:t.projection)===null||n===void 0?void 0:n.type)!=="globe";this.resize(null,T),this._localIdeographFontFamily=h.localIdeographFontFamily,this._validateStyle=h.validateStyle,h.style&&this.setStyle(h.style,{localIdeographFontFamily:h.localIdeographFontFamily}),h.attributionControl&&this.addControl(new dh(typeof h.attributionControl=="boolean"?void 0:h.attributionControl)),h.maplibreLogo&&this.addControl(new Qh,h.logoPosition),this.on("style.load",(()=>{if(T||this._resizeTransform(),this.transform.unmodified){const C=p.U(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(C)}})),this.on("data",(C=>{this._update(C.dataType==="style"),this.fire(new p.l(`${C.dataType}data`,C))})),this.on("dataloading",(C=>{this.fire(new p.l(`${C.dataType}dataloading`,C))})),this.on("dataabort",(C=>{this.fire(new p.l("sourcedataabort",C))}))}_getMapId(){return this._mapId}setGlobalStateProperty(y,t){return this.style.setGlobalStateProperty(y,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(y,t){if(t===void 0&&(t=y.getDefaultPosition?y.getDefaultPosition():"top-right"),!y||!y.onAdd)return this.fire(new p.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=y.onAdd(this);this._controls.push(y);const h=this._controlPositions[t];return t.indexOf("bottom")!==-1?h.insertBefore(n,h.firstChild):h.appendChild(n),this}removeControl(y){if(!y||!y.onRemove)return this.fire(new p.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(y);return t>-1&&this._controls.splice(t,1),y.onRemove(this),this}hasControl(y){return this._controls.indexOf(y)>-1}coveringTiles(y){return er(this.transform,y)}calculateCameraOptionsFromTo(y,t,n,h){return h==null&&this.terrain&&(h=this.terrain.getElevationForLngLat(n,this.transform)),super.calculateCameraOptionsFromTo(y,t,n,h)}resize(y,t=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(t);const n=!this._moving;return n&&(this.stop(),this.fire(new p.l("movestart",y)).fire(new p.l("move",y))),this.fire(new p.l("resize",y)),n&&this.fire(new p.l("moveend",y)),this}_resizeInternal(y=!0){const[t,n]=this._containerDimensions(),h=this._getClampedPixelRatio(t,n);if(this._resizeCanvas(t,n,h),this.painter.resize(t,n,h),this.painter.overLimit()){const f=this.painter.context.gl;this._maxCanvasSize=[f.drawingBufferWidth,f.drawingBufferHeight];const x=this._getClampedPixelRatio(t,n);this._resizeCanvas(t,n,x),this.painter.resize(t,n,x)}this._resizeTransform(y)}_resizeTransform(y=!0){var t;const[n,h]=this._containerDimensions();this.transform.resize(n,h,y),(t=this._requestedCameraState)===null||t===void 0||t.resize(n,h,y)}_getClampedPixelRatio(y,t){const{0:n,1:h}=this._maxCanvasSize,f=this.getPixelRatio(),x=y*f,T=t*f;return Math.min(x>n?n/x:1,T>h?h/T:1)*f}getPixelRatio(){var y;return(y=this._overridePixelRatio)!==null&&y!==void 0?y:devicePixelRatio}setPixelRatio(y){this._overridePixelRatio=y,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(y){return this.transform.setMaxBounds(Ui.convert(y)),this._update()}setMinZoom(y){if((y=y??-2)>=-2&&y<=this.transform.maxZoom){const t=this._getTransformForUpdate();return t.setMinZoom(y),this._applyUpdatedTransform(t),this._update(),this}throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(y){if((y=y??22)>=this.transform.minZoom){const t=this._getTransformForUpdate();return t.setMaxZoom(y),this._applyUpdatedTransform(t),this._update(),this}throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(y){if((y=y??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(y>=0&&y<=this.transform.maxPitch)return this.transform.setMinPitch(y),this._update(),this.getPitch()<y&&this.setPitch(y),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(y){if((y=y??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(y>=this.transform.minPitch)return this.transform.setMaxPitch(y),this._update(),this.getPitch()>y&&this.setPitch(y),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(y){return this.transform.setRenderWorldCopies(y),this._update()}setTransformConstrain(y){return this.transform.setConstrainOverride(y),this._update()}project(y){return this.transform.locationToScreenPoint(p.V.convert(y),this.style&&this.terrain)}unproject(y){return this.transform.screenPointToLocation(p.P.convert(y),this.terrain)}isMoving(){var y;return this._moving||((y=this.handlers)===null||y===void 0?void 0:y.isMoving())}isZooming(){var y;return this._zooming||((y=this.handlers)===null||y===void 0?void 0:y.isZooming())}isRotating(){var y;return this._rotating||((y=this.handlers)===null||y===void 0?void 0:y.isRotating())}_createDelegatedListener(y,t,n){if(y==="mouseenter"||y==="mouseover"){let h=!1;return{layers:t,listener:n,delegates:{mousemove:x=>{const T=t.filter((D=>this.getLayer(D))),C=T.length!==0?this.queryRenderedFeatures(x.point,{layers:T}):[];C.length?h||(h=!0,n.call(this,new ht(y,this,x.originalEvent,{features:C}))):h=!1},mouseout:()=>{h=!1}}}}if(y==="mouseleave"||y==="mouseout"){let h=!1;return{layers:t,listener:n,delegates:{mousemove:T=>{const C=t.filter((D=>this.getLayer(D)));(C.length!==0?this.queryRenderedFeatures(T.point,{layers:C}):[]).length?h=!0:h&&(h=!1,n.call(this,new ht(y,this,T.originalEvent)))},mouseout:T=>{h&&(h=!1,n.call(this,new ht(y,this,T.originalEvent)))}}}}{const h=f=>{const x=t.filter((C=>this.getLayer(C))),T=x.length!==0?this.queryRenderedFeatures(f.point,{layers:x}):[];T.length&&(f.features=T,n.call(this,f),delete f.features)};return{layers:t,listener:n,delegates:{[y]:h}}}}_saveDelegatedListener(y,t){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[y]=this._delegatedListeners[y]||[],this._delegatedListeners[y].push(t)}_removeDelegatedListener(y,t,n){if(!this._delegatedListeners||!this._delegatedListeners[y])return;const h=this._delegatedListeners[y];for(let f=0;f<h.length;f++){const x=h[f];if(x.listener===n&&x.layers.length===t.length&&x.layers.every((T=>t.includes(T)))){for(const T in x.delegates)this.off(T,x.delegates[T]);return void h.splice(f,1)}}}on(y,t,n){if(n===void 0)return super.on(y,t);const h=typeof t=="string"?[t]:t,f=this._createDelegatedListener(y,h,n);this._saveDelegatedListener(y,f);for(const x in f.delegates)this.on(x,f.delegates[x]);return{unsubscribe:()=>{this._removeDelegatedListener(y,h,n)}}}once(y,t,n){if(n===void 0)return super.once(y,t);const h=typeof t=="string"?[t]:t,f=this._createDelegatedListener(y,h,n);for(const x in f.delegates){const T=f.delegates[x];f.delegates[x]=(...C)=>{this._removeDelegatedListener(y,h,n),T(...C)}}this._saveDelegatedListener(y,f);for(const x in f.delegates)this.once(x,f.delegates[x]);return this}off(y,t,n){return n===void 0?super.off(y,t):(this._removeDelegatedListener(y,typeof t=="string"?[t]:t,n),this)}queryRenderedFeatures(y,t){if(!this.style)return[];let n;const h=y instanceof p.P||Array.isArray(y),f=h?y:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(h?{}:y)||{},f instanceof p.P||typeof f[0]=="number")n=[p.P.convert(f)];else{const x=p.P.convert(f[0]),T=p.P.convert(f[1]);n=[x,new p.P(T.x,x.y),T,new p.P(x.x,T.y),x]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(y,t){return this.style.querySourceFeatures(y,t)}setStyle(y,t){return(t=p.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&y?(this._diffStyle(y,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(y,t))}setTransformRequest(y){return this._requestManager.setTransformRequest(y),this}_getUIString(y){const t=this._locale[y];if(t==null)throw new Error(`Missing UI string '${y}'`);return t}_updateStyle(y,t){var n,h;if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(y,t)));const f=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!y)),y?(this.style=new Jn(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof y=="string"?this.style.loadURL(y,t,f):this.style.loadJSON(y,t,f),this):((h=(n=this.style)===null||n===void 0?void 0:n.projection)===null||h===void 0||h.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Jn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(y,t){if(typeof y=="string"){const n=this._requestManager.transformRequest(y,"Style");p.j(n,new AbortController).then((h=>{this._updateDiff(h.data,t)})).catch((h=>{h&&this.fire(new p.k(h))}))}else typeof y=="object"&&this._updateDiff(y,t)}_updateDiff(y,t){try{this.style.setState(y,t)&&this._update(!0)}catch(n){p.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(y,t)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){return this.style?this.style.loaded():p.w("There is no style added to the map.")}addSource(y,t){return this._lazyInitEmptyStyle(),this.style.addSource(y,t),this._update(!0)}isSourceLoaded(y){const t=this.style&&this.style.tileManagers[y];if(t!==void 0)return t.loaded();this.fire(new p.k(new Error(`There is no tile manager with ID '${y}'`)))}setTerrain(y){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),y){const t=this.style.tileManagers[y.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${y.source}`);this.terrain===null&&t.reload();for(const n in this.style._layers){const h=this.style._layers[n];h.type==="hillshade"&&h.source===y.source&&p.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),h.type==="color-relief"&&h.source===y.source&&p.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Gr(this.painter,t,y),this.painter.renderToTexture=new xu(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=n=>{var h;n.dataType==="style"?this.terrain.tileManager.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==y.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((h=n.source)===null||h===void 0?void 0:h.type)==="image"?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.tileManager.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new p.l("terrain",{terrain:y})),this}getTerrain(){var y,t;return(t=(y=this.terrain)===null||y===void 0?void 0:y.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const y=this.style&&this.style.tileManagers;for(const t of Object.values(y))if(!t.areTilesLoaded())return!1;return!0}removeSource(y){return this.style.removeSource(y),this._update(!0)}getSource(y){return this.style.getSource(y)}setSourceTileLodParams(y,t,n){if(n){const h=this.getSource(n);if(!h)throw new Error(`There is no source with ID "${n}", cannot set LOD parameters`);h.calculateTileZoom=qi(Math.max(1,y),Math.max(1,t))}else for(const h in this.style.tileManagers)this.style.tileManagers[h].getSource().calculateTileZoom=qi(Math.max(1,y),Math.max(1,t));return this._update(!0),this}refreshTiles(y,t){const n=this.style.tileManagers[y];if(!n)throw new Error(`There is no tile manager with ID "${y}", cannot refresh tile`);t===void 0?n.reload(!0):n.refreshTiles(t.map((h=>new p.ac(h.z,h.x,h.y))))}addImage(y,t,n={}){const{pixelRatio:h=1,sdf:f=!1,stretchX:x,stretchY:T,content:C,textFitWidth:D,textFitHeight:B}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||p.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new p.k(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:N,height:G,data:U}=t,$=t;return this.style.addImage(y,{data:new p.R({width:N,height:G},new Uint8Array(U)),pixelRatio:h,stretchX:x,stretchY:T,content:C,textFitWidth:D,textFitHeight:B,sdf:f,version:0,userImage:$}),$.onAdd&&$.onAdd(this,y),this}}{const{width:N,height:G,data:U}=zr.getImageData(t);this.style.addImage(y,{data:new p.R({width:N,height:G},U),pixelRatio:h,stretchX:x,stretchY:T,content:C,textFitWidth:D,textFitHeight:B,sdf:f,version:0})}}updateImage(y,t){const n=this.style.getImage(y);if(!n)return this.fire(new p.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const h=t instanceof HTMLImageElement||p.b(t)?zr.getImageData(t):t,{width:f,height:x,data:T}=h;if(f===void 0||x===void 0)return this.fire(new p.k(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(f!==n.data.width||x!==n.data.height)return this.fire(new p.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const C=!(t instanceof HTMLImageElement||p.b(t));return n.data.replace(T,C),this.style.updateImage(y,n),this}getImage(y){return this.style.getImage(y)}hasImage(y){return y?!!this.style.getImage(y):(this.fire(new p.k(new Error("Missing required image id"))),!1)}removeImage(y){this.style.removeImage(y)}loadImage(y){return En.getImage(this._requestManager.transformRequest(y,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(y,t){return this._lazyInitEmptyStyle(),this.style.addLayer(y,t),this._update(!0)}moveLayer(y,t){return this.style.moveLayer(y,t),this._update(!0)}removeLayer(y){return this.style.removeLayer(y),this._update(!0)}getLayer(y){return this.style.getLayer(y)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(y,t,n){return this.style.setLayerZoomRange(y,t,n),this._update(!0)}setFilter(y,t,n={}){return this.style.setFilter(y,t,n),this._update(!0)}getFilter(y){return this.style.getFilter(y)}setPaintProperty(y,t,n,h={}){return this.style.setPaintProperty(y,t,n,h),this._update(!0)}getPaintProperty(y,t){return this.style.getPaintProperty(y,t)}setLayoutProperty(y,t,n,h={}){return this.style.setLayoutProperty(y,t,n,h),this._update(!0)}getLayoutProperty(y,t){return this.style.getLayoutProperty(y,t)}setGlyphs(y,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(y,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(y,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(y,t,n,(h=>{h||this._update(!0)})),this}removeSprite(y){return this._lazyInitEmptyStyle(),this.style.removeSprite(y),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(y,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(y,t,(n=>{n||this._update(!0)})),this}setLight(y,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(y,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(y,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(y,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(y,t){return this.style.setFeatureState(y,t),this._update()}removeFeatureState(y,t){return this.style.removeFeatureState(y,t),this._update()}getFeatureState(y){return this.style.getFeatureState(y)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let y=0,t=0;return this._container&&(y=this._container.clientWidth||400,t=this._container.clientHeight||300),[y,t]}_setupContainer(){const y=this._container;y.classList.add("maplibregl-map");const t=this._canvasContainer=rt.create("div","maplibregl-canvas-container",y);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=rt.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const n=this._containerDimensions(),h=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],h);const f=this._controlContainer=rt.create("div","maplibregl-control-container",y),x=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((T=>{x[T]=rt.create("div",`maplibregl-ctrl-${T} `,f)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(y,t,n){this._canvas.width=Math.floor(n*y),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${y}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const y=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let t=null;this._canvas.addEventListener("webglcontextcreationerror",(h=>{t={requestedAttributes:y},h&&(t.statusMessage=h.statusMessage,t.type=h.type)}),{once:!0});let n=null;if(n=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,y):this._canvas.getContext("webgl2",y)||this._canvas.getContext("webgl",y),!n){const h="Failed to initialize WebGL";throw t?(t.message=h,new Error(JSON.stringify(t))):new Error(h)}this.painter=new Qt(n,this.transform),Fo.testSupport(n)}migrateProjection(y,t){super.migrateProjection(y,t),this.painter.transform=y,this.fire(new p.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(y){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||y,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(y){return this._update(),this._renderTaskQueue.add(y)}_cancelRenderFrame(y){this._renderTaskQueue.remove(y)}_render(y){var t,n,h,f,x;const T=this._idleTriggered?this._fadeDuration:0,C=((t=this.style.projection)===null||t===void 0?void 0:t.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(y),this._removed)return;let D=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const G=this.transform.zoom,U=Gt();this.style.zoomHistory.update(G,U);const $=new p.H(G,{now:U,fadeDuration:T,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),ie=$.crossFadingFactor();ie===1&&ie===this._crossFadingFactor||(D=!0,this._crossFadingFactor=ie),this.style.update($)}const B=((n=this.style.projection)===null||n===void 0?void 0:n.transitionState)>0!==C;(h=this.style.projection)===null||h===void 0||h.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((f=this.style.projection)===null||f===void 0?void 0:f.transitionState,(x=this.style.projection)===null||x===void 0?void 0:x.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||B)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,T,this._crossSourceCollisions,B),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:T,showPadding:this.showPadding}),this.fire(new p.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,p.cG.mark(p.cH.load),this.fire(new p.l("load"))),this.style&&(this.style.hasTransitions()||D)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const N=this._sourcesDirty||this._styleDirty||this._placementDirty;return N||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new p.l("idle")),!this._loaded||this._fullyLoaded||N||(this._fullyLoaded=!0,p.cG.mark(p.cH.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var y;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),En.removeThrottleControl(this._imageQueueHandle),(y=this._resizeObserver)===null||y===void 0||y.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t!=null&&t.loseContext&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),rt.remove(this._canvasContainer),rt.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),p.cG.clearMetrics(),this._removed=!0,this.fire(new p.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,zr.frame(this._frameRequest,(y=>{p.cG.frame(y),this._frameRequest=null;try{this._render(y)}catch(t){if(!p.Z(t)&&!(function(n){return n.message===R})(t))throw t}}),(()=>{})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(y){this._showTileBoundaries!==y&&(this._showTileBoundaries=y,this._update())}get showPadding(){return!!this._showPadding}set showPadding(y){this._showPadding!==y&&(this._showPadding=y,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(y){this._showCollisionBoxes!==y&&(this._showCollisionBoxes=y,y?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(y){this._showOverdrawInspector!==y&&(this._showOverdrawInspector=y,this._update())}get repaint(){return!!this._repaint}set repaint(y){this._repaint!==y&&(this._repaint=y,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(y){this._vertices=y,this._update()}get version(){return ph}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(y){return this._lazyInitEmptyStyle(),this.style.setProjection(y),this._update(!0)}},W.MapMouseEvent=ht,W.MapTouchEvent=yt,W.MapWheelEvent=Jl,W.Marker=Tu,W.NavigationControl=class{constructor(y){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),h=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=h,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",h.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(t,n)=>{const h=this._map._getUIString(`NavigationControl.${n}`);t.title=h,t.setAttribute("aria-label",h)},this.options=p.e({},mh,y),this._container=rt.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),rt.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}))),rt.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=rt.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(y){return this._map=y,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.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new bu(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){rt.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.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(y,t){const n=rt.create("button",y,this._container);return n.type="button",n.addEventListener("click",t),n}},W.Popup=class extends p.E{constructor(y){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&rt.remove(this._content),this._container&&(rt.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),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new p.l("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=rt.create("div","maplibregl-popup",this._map.getContainer()),this._tip=rt.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const T of this.options.className.split(" "))this._container.classList.add(T);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=Zu(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!t)return;const n=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationToScreenPoint(this._lngLat));let h=this.options.anchor;const f=qu(this.options.offset);if(!h){const T=this._container.offsetWidth,C=this._container.offsetHeight,D=(function(N){var G,U,$,ie;return N?{top:(G=N.top)!==null&&G!==void 0?G:0,right:(U=N.right)!==null&&U!==void 0?U:0,bottom:($=N.bottom)!==null&&$!==void 0?$:0,left:(ie=N.left)!==null&&ie!==void 0?ie:0}:{top:0,right:0,bottom:0,left:0}})(this.options.padding);let B;B=n.y+f.bottom.y<C+D.top?["top"]:n.y>this._map.transform.height-C-D.bottom?["bottom"]:[],n.x<T/2+D.left?B.push("left"):n.x>this._map.transform.width-T/2-D.right&&B.push("right"),h=B.length===0?"bottom":B.join("-")}let x=n.add(f[h]);this.options.subpixelPositioning||(x=x.round()),rt.setTransform(this._container,`${wu[h]} translate(${x.x}px,${x.y}px)`),Uu(this._container,h,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=p.e(Object.create(yh),y)}addTo(y){return this._map&&this.remove(),this._map=y,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 p.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(y){return this._lngLat=p.V.convert(y),this._pos=null,this._flatPos=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._flatPos=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(y){return this.setDOMContent(document.createTextNode(y))}setHTML(y){const t=document.createDocumentFragment(),n=document.createElement("body");let h;for(n.innerHTML=y;h=n.firstChild,h;)t.appendChild(h);return this.setDOMContent(t)}getMaxWidth(){var y;return(y=this._container)===null||y===void 0?void 0:y.style.maxWidth}setMaxWidth(y){return this.options.maxWidth=y,this._update(),this}setDOMContent(y){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=rt.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(y),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(y){return this._container&&this._container.classList.add(y),this}removeClassName(y){return this._container&&this._container.classList.remove(y),this}setOffset(y){return this.options.offset=y,this._update(),this}toggleClassName(y){if(this._container)return this._container.classList.toggle(y)}setSubpixelPositioning(y){this.options.subpixelPositioning=y}setPadding(y){this.options.padding=y,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=rt.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const y=this._container.querySelector(Gu);y&&y.focus()}},W.RasterDEMTileSource=tn,W.RasterTileSource=Zo,W.ScaleControl=class{constructor(y){this._onMove=()=>{Pu(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,Pu(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},gh),y)}getDefaultPosition(){return"bottom-left"}onAdd(y){return this._map=y,this._container=rt.create("div","maplibregl-ctrl maplibregl-ctrl-scale",y.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){rt.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},W.ScrollZoomHandler=Nt,W.Style=Jn,W.TerrainControl=class{constructor(y){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._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.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=y}onAdd(y){return this._map=y,this._container=rt.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=rt.create("button","maplibregl-ctrl-terrain",this._container),rt.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(){rt.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},W.TwoFingersTouchPitchHandler=Je,W.TwoFingersTouchRotateHandler=Ie,W.TwoFingersTouchZoomHandler=de,W.TwoFingersTouchZoomRotateHandler=vt,W.VectorTileSource=jo,W.VideoSource=Ne,W.addSourceType=(y,t)=>p._(void 0,void 0,void 0,(function*(){if(le(y))throw new Error(`A source type called "${y}" already exists.`);((n,h)=>{K[n]=h})(y,t)})),W.clearPrewarmedResources=function(){const y=hn;y&&(y.isPreloaded()&&y.numActive()===1?(y.release(or),hn=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()"))},W.createTileMesh=ka,W.getMaxParallelImageRequests=function(){return p.c.MAX_PARALLEL_IMAGE_REQUESTS},W.getRTLTextPluginStatus=function(){return Fe().getRTLTextPluginStatus()},W.getVersion=function(){return vh},W.getWorkerCount=function(){return xi.workerCount},W.getWorkerUrl=function(){return p.c.WORKER_URL},W.importScriptInWorkers=function(y){return No().broadcast("IS",y)},W.isTimeFrozen=function(){return Mn.isFrozen()},W.now=Gt,W.prewarm=function(){yo().acquire(or)},W.restoreNow=function(){Mn.restoreNow()},W.setMaxParallelImageRequests=function(y){p.c.MAX_PARALLEL_IMAGE_REQUESTS=y},W.setNow=function(y){Mn.setNow(y)},W.setRTLTextPlugin=function(y,t){return Fe().setRTLTextPlugin(y,t)},W.setWorkerCount=function(y){xi.workerCount=y},W.setWorkerUrl=function(y){p.c.WORKER_URL=y}}));var ct=fe;return ct}))})(Tc)),Tc.exports}var yp=bg();const wg=Jd(yp),Sg=Kd({__proto__:null,default:wg},[yp]),Cg=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{Eg as a,Cg as b,Mg as h,Pg as l,Sg as m};
+1
static/js/profile-cropper-DwPaCPSP.js
··· 1 + import{loadCropper as h}from"./index-Bcnf8oUZ.js";import"./main-CuQd5Sql.js";let r=null,o=null,m=!1;async function b(){const i=document.getElementById("avatar-input"),d=document.getElementById("banner-input");if(!i&&!d||m)return;m=!0;const t=await h();i&&w(i,t),d&&y(d,t)}function w(i,d){const t=document.getElementById("avatar-canvas"),s=document.getElementById("avatar-crop");!t||!s||(i.addEventListener("change",n=>{var p;const a=(p=n.target.files)==null?void 0:p[0];if(!a)return;const l=new FileReader;l.onload=u=>{var g;const e=new Image;e.onload=()=>{t.width=e.width,t.height=e.height,t.style.display="block",s.style.display="inline-block";const f=t.getContext("2d");f&&f.drawImage(e,0,0),r&&r.destroy(),r=new d(t,{aspectRatio:1,viewMode:1})},e.src=(g=u.target)==null?void 0:g.result},l.readAsDataURL(a)}),s.addEventListener("click",()=>{r&&r.getCroppedCanvas({width:400,height:400}).toBlob(n=>{if(!n)return;const c=new FormData;c.append("avatar",n,"avatar.png"),fetch("/settings/avatar",{method:"POST",body:c}).then(a=>{a.ok&&window.location.reload()})},"image/png")}))}function y(i,d){const t=document.getElementById("banner-canvas"),s=document.getElementById("banner-crop");!t||!s||(i.addEventListener("change",n=>{var p;const a=(p=n.target.files)==null?void 0:p[0];if(!a)return;const l=new FileReader;l.onload=u=>{var g;const e=new Image;e.onload=()=>{t.width=e.width,t.height=e.height,t.style.display="block",s.style.display="inline-block";const f=t.getContext("2d");f&&f.drawImage(e,0,0),o&&o.destroy(),o=new d(t,{aspectRatio:16/9,viewMode:1})},e.src=(g=u.target)==null?void 0:g.result},l.readAsDataURL(a)}),s.addEventListener("click",()=>{o&&o.getCroppedCanvas({width:1600,height:900}).toBlob(n=>{if(!n)return;const c=new FormData;c.append("banner",n,"banner.png"),fetch("/settings/banner",{method:"POST",body:c}).then(a=>{a.ok&&window.location.reload()})},"image/png")}))}function I(){r&&(r.destroy(),r=null),o&&(o.destroy(),o=null),m=!1}export{I as destroyProfileCropper,b as initProfileCropper};
+3 -5
templates/en-us/bare.html
··· 6 6 <title>{% block title %}Smoke Signal{% endblock %}</title> 7 7 <link rel="stylesheet" href="/static/bulma.min.css"> 8 8 <link rel="stylesheet" href="/static/fontawesome.min.css"> 9 + <link rel="stylesheet" href="/static/{{ bundle_css }}"> 9 10 <meta name="htmx-config" content='{"globalViewTransitions":true}'> 10 11 <link rel="icon" type="image/x-icon" href="/favicon.ico"> 11 - <script src="/static/htmx.js"></script> 12 - <script src="/static/loading-states.js"></script> 13 - <script src="/static/sse.js"></script> 14 - <script src="/static/site.js"></script> 12 + <script type="module" src="/static/{{ bundle_js }}"></script> 15 13 {% block head %} 16 14 {% endblock %} 17 15 <meta name="theme-color" content="#00d1b2"> ··· 22 20 {% include 'en-us/footer.html' %} 23 21 </body> 24 22 25 - </html> 23 + </html>
+3 -6
templates/en-us/base.html
··· 10 10 {% endif %} 11 11 <link rel="stylesheet" href="/static/fontawesome.min.css"> 12 12 <link rel="stylesheet" href="/static/bulma.min.css"> 13 + <link rel="stylesheet" href="/static/{{ bundle_css }}"> 13 14 <link rel="manifest" href="/static/manifest.webmanifest" /> 14 15 <link rel="icon" href="/static/favicon.ico"> 15 16 <link rel="apple-touch-icon" href="/static/apple-touch-icon.png"> 16 17 <link rel="apple-touch-icon-precomposed" href="/static/apple-touch-icon-precomposed.png"> 17 - <script src="/static/htmx.js"></script> 18 - <script src="/static/loading-states.js"></script> 19 - <script src="/static/sse.js"></script> 20 - <script defer src="/static/alpine.js"></script> 21 - <script src="/static/site.js"></script> 18 + <script type="module" src="/static/{{ bundle_js }}"></script> 22 19 {% block head %} 23 20 {% endblock %} 24 21 <meta name="theme-color" content="#00d1b2"> ··· 29 26 {% include 'en-us/footer.html' %} 30 27 </body> 31 28 32 - </html> 29 + </html>
-4
templates/en-us/create_event.partial.html
··· 717 717 </form> 718 718 </div> 719 719 720 - <!-- Cropper.js --> 721 - <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.6.1/cropper.min.css"/> 722 - <script src="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.6.1/cropper.min.js"></script> 723 - 724 720 <script> 725 721 function eventForm() { 726 722 return {
-305
templates/en-us/index.common.html
··· 1 1 {%- from "pagination.html" import view_pagination -%} 2 2 3 - <link rel="stylesheet" href="/static/maplibre-gl.css" /> 4 - <style> 5 - #globe-map { 6 - height: 400px; 7 - border-radius: 8px; 8 - overflow: hidden; 9 - z-index: 1; 10 - } 11 - .globe-controls { 12 - display: flex; 13 - gap: 0.5rem; 14 - flex-wrap: wrap; 15 - margin-top: 0.75rem; 16 - } 17 - .globe-controls .button { 18 - font-size: 0.75rem; 19 - } 20 - .maplibregl-popup-content { 21 - background: rgba(22, 33, 62, 0.95); 22 - color: white; 23 - padding: 10px 14px; 24 - border-radius: 6px; 25 - font-size: 13px; 26 - } 27 - .maplibregl-popup-anchor-bottom .maplibregl-popup-tip { 28 - border-top-color: rgba(22, 33, 62, 0.95); 29 - } 30 - .maplibregl-popup-close-button { 31 - color: white; 32 - font-size: 16px; 33 - } 34 - </style> 35 - 36 3 {# <section class="section pb-0"> 37 4 <div class="container"> 38 5 <h1 class="title is-1">Smoke Signal</h1> ··· 335 302 })(); 336 303 </script> 337 304 338 - <script> 339 - (function() { 340 - const mapContainer = document.getElementById('globe-map'); 341 - const statusEl = document.getElementById('globe-status'); 342 - if (!mapContainer) return; 343 - 344 - // Dynamic script loader for HTMX compatibility 345 - function loadScript(src) { 346 - return new Promise((resolve, reject) => { 347 - // Check if already loaded 348 - if (document.querySelector(`script[src="${src}"]`)) { 349 - resolve(); 350 - return; 351 - } 352 - const script = document.createElement('script'); 353 - script.src = src; 354 - script.onload = resolve; 355 - script.onerror = reject; 356 - document.head.appendChild(script); 357 - }); 358 - } 359 - 360 - async function loadDependencies() { 361 - const scripts = []; 362 - if (typeof maplibregl === 'undefined') { 363 - scripts.push(loadScript('/static/maplibre-gl.js')); 364 - } 365 - if (typeof h3 === 'undefined') { 366 - scripts.push(loadScript('/static/h3-js.umd.js')); 367 - } 368 - await Promise.all(scripts); 369 - } 370 - 371 - let map = null; 372 - let popup = null; 373 - 374 - // Convert value to HSL color (blue to yellow gradient) 375 - function valueToColor(value, maxValue) { 376 - if (maxValue === 0) return 'hsl(240, 70%, 50%)'; 377 - const ratio = value / maxValue; 378 - const hue = 240 - (ratio * 180); // 240 (blue) to 60 (yellow) 379 - return `hsl(${hue}, 70%, 50%)`; 380 - } 381 - 382 - // Convert H3 cell to GeoJSON Feature 383 - function h3ToGeoJsonFeature(bucket, maxTotal) { 384 - const boundary = h3.cellToBoundary(bucket.key); 385 - const center = h3.cellToLatLng(bucket.key); 386 - 387 - // Convert H3 [lat, lng] to GeoJSON [lng, lat] 388 - const coordinates = boundary.map(([lat, lng]) => [lng, lat]); 389 - coordinates.push(coordinates[0]); // Close the ring 390 - 391 - return { 392 - type: 'Feature', 393 - properties: { 394 - id: bucket.key, 395 - event_count: bucket.event_count, 396 - lfg_count: bucket.lfg_count, 397 - total: bucket.total, 398 - centerLat: center[0], 399 - centerLng: center[1], 400 - color: valueToColor(bucket.total, maxTotal) 401 - }, 402 - geometry: { 403 - type: 'Polygon', 404 - coordinates: [coordinates] 405 - } 406 - }; 407 - } 408 - 409 - function initGlobe() { 410 - map = new maplibregl.Map({ 411 - container: 'globe-map', 412 - style: { 413 - version: 8, 414 - projection: { type: 'globe' }, 415 - sources: { 416 - 'carto-voyager': { 417 - type: 'raster', 418 - tiles: [ 419 - 'https://a.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png', 420 - 'https://b.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png', 421 - 'https://c.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png' 422 - ], 423 - tileSize: 256, 424 - attribution: '&copy; <a href="https://carto.com/attributions">CARTO</a>' 425 - } 426 - }, 427 - layers: [ 428 - { 429 - id: 'background', 430 - type: 'background', 431 - paint: { 432 - 'background-color': '#e8e8e8' 433 - } 434 - }, 435 - { 436 - id: 'carto-voyager', 437 - type: 'raster', 438 - source: 'carto-voyager' 439 - } 440 - ] 441 - }, 442 - center: [-100, 40], 443 - zoom: 4, 444 - maxZoom: 8, 445 - minZoom: 1 446 - }); 447 - 448 - map.on('load', () => { 449 - // Add empty source for hex data 450 - map.addSource('hexagons', { 451 - type: 'geojson', 452 - data: { type: 'FeatureCollection', features: [] } 453 - }); 454 - 455 - // Add flat fill layer for hexagons 456 - map.addLayer({ 457 - id: 'hexagons-fill', 458 - type: 'fill', 459 - source: 'hexagons', 460 - paint: { 461 - 'fill-color': ['get', 'color'], 462 - 'fill-opacity': 0.4 463 - } 464 - }); 465 - 466 - // Add outline layer 467 - map.addLayer({ 468 - id: 'hexagons-outline', 469 - type: 'line', 470 - source: 'hexagons', 471 - paint: { 472 - 'line-color': '#333', 473 - 'line-width': 0.5, 474 - 'line-opacity': 0.4 475 - } 476 - }); 477 - 478 - // Initialize popup 479 - popup = new maplibregl.Popup({ 480 - closeButton: true, 481 - closeOnClick: false 482 - }); 483 - 484 - // Click handler for hexagons 485 - map.on('click', 'hexagons-fill', (e) => { 486 - if (e.features.length > 0) { 487 - const feature = e.features[0]; 488 - const props = feature.properties; 489 - 490 - let content = `<strong>Activity:</strong> ${props.total} total<br/>`; 491 - if (props.event_count > 0) { 492 - content += `${props.event_count} event${props.event_count === 1 ? '' : 's'}<br/>`; 493 - } 494 - if (props.lfg_count > 0) { 495 - content += `${props.lfg_count} ${props.lfg_count === 1 ? 'person' : 'people'} LFG`; 496 - } 497 - 498 - popup 499 - .setLngLat([props.centerLng, props.centerLat]) 500 - .setHTML(content) 501 - .addTo(map); 502 - } 503 - }); 504 - 505 - // Cursor style 506 - map.on('mouseenter', 'hexagons-fill', () => { 507 - map.getCanvas().style.cursor = 'pointer'; 508 - }); 509 - map.on('mouseleave', 'hexagons-fill', () => { 510 - map.getCanvas().style.cursor = ''; 511 - }); 512 - 513 - // Fetch globe aggregation data 514 - loadGlobeData(); 515 - }); 516 - 517 - // Focus button handlers 518 - document.getElementById('focus-north-america').addEventListener('click', () => { 519 - map.flyTo({ center: [-100, 40], zoom: 4, duration: 1500 }); 520 - }); 521 - 522 - document.getElementById('focus-europe').addEventListener('click', () => { 523 - map.flyTo({ center: [10, 50], zoom: 4, duration: 1500 }); 524 - }); 525 - 526 - document.getElementById('focus-world').addEventListener('click', () => { 527 - map.flyTo({ center: [0, 20], zoom: 2, duration: 1500 }); 528 - }); 529 - 530 - document.getElementById('focus-my-location').addEventListener('click', () => { 531 - const btn = document.getElementById('focus-my-location'); 532 - const originalHtml = btn.innerHTML; 533 - btn.innerHTML = '<span class="icon is-small"><i class="fas fa-spinner fa-pulse"></i></span><span>Locating...</span>'; 534 - btn.disabled = true; 535 - 536 - if (navigator.geolocation) { 537 - navigator.geolocation.getCurrentPosition( 538 - (position) => { 539 - map.flyTo({ 540 - center: [position.coords.longitude, position.coords.latitude], 541 - zoom: 8, 542 - duration: 1500 543 - }); 544 - btn.innerHTML = originalHtml; 545 - btn.disabled = false; 546 - }, 547 - (error) => { 548 - console.warn('Geolocation failed:', error.message); 549 - statusEl.textContent = 'Could not get your location.'; 550 - btn.innerHTML = originalHtml; 551 - btn.disabled = false; 552 - }, 553 - { timeout: 10000, maximumAge: 300000 } 554 - ); 555 - } else { 556 - statusEl.textContent = 'Geolocation not supported.'; 557 - btn.innerHTML = originalHtml; 558 - btn.disabled = false; 559 - } 560 - }); 561 - } 562 - 563 - function loadGlobeData() { 564 - fetch('/api/globe-aggregation?resolution=5') 565 - .then(response => response.json()) 566 - .then(data => { 567 - if (!data.buckets || data.buckets.length === 0) { 568 - statusEl.textContent = 'No activity found.'; 569 - return; 570 - } 571 - 572 - // Find max total for color scaling 573 - const maxTotal = Math.max(...data.buckets.map(b => b.total)); 574 - 575 - // Convert buckets to GeoJSON features 576 - const features = []; 577 - data.buckets.forEach(bucket => { 578 - try { 579 - features.push(h3ToGeoJsonFeature(bucket, maxTotal)); 580 - } catch (e) { 581 - console.warn('Failed to process hex:', bucket.key, e); 582 - } 583 - }); 584 - 585 - // Update map source 586 - map.getSource('hexagons').setData({ 587 - type: 'FeatureCollection', 588 - features: features 589 - }); 590 - 591 - const totalEvents = data.buckets.reduce((sum, b) => sum + b.event_count, 0); 592 - const totalLfg = data.buckets.reduce((sum, b) => sum + b.lfg_count, 0); 593 - statusEl.textContent = `${data.buckets.length} active regions: ${totalEvents} events, ${totalLfg} people LFG`; 594 - }) 595 - .catch(err => { 596 - console.error('Failed to load globe aggregation:', err); 597 - statusEl.textContent = 'Failed to load activity data.'; 598 - }); 599 - } 600 - 601 - // Load dependencies and initialize the globe 602 - loadDependencies() 603 - .then(() => initGlobe()) 604 - .catch(err => { 605 - console.error('Failed to load map dependencies:', err); 606 - statusEl.textContent = 'Failed to load map.'; 607 - }); 608 - })(); 609 - </script>
+1 -210
templates/en-us/lfg_form.common.html
··· 6 6 </h1> 7 7 <p class="subtitle">Find activity partners in your area</p> 8 8 9 - <div x-data="lfgForm()" class="box"> 9 + <div x-data="SmokesignalApp.lfgForm()" data-default-duration="{{ default_duration }}" class="box"> 10 10 <form @submit.prevent="submitForm()"> 11 11 12 12 <!-- Location Section --> ··· 118 118 </div> 119 119 </section> 120 120 121 - <script> 122 - function lfgForm() { 123 - // H3 resolution 7 gives ~5 km² area (roughly 1.2km edge) 124 - const H3_RESOLUTION = 7; 125 - 126 - return { 127 - latitude: '', 128 - longitude: '', 129 - h3Index: '', 130 - tags: [], 131 - tagInput: '', 132 - durationHours: '{{ default_duration }}', 133 - map: null, 134 - hexLayer: null, 135 - submitting: false, 136 - errors: { 137 - location: null, 138 - tags: null, 139 - duration: null, 140 - general: null 141 - }, 142 - 143 - init() { 144 - this.$nextTick(() => { 145 - this.initMap(); 146 - }); 147 - }, 148 - 149 - initMap() { 150 - // Initialize map centered on default location 151 - const defaultLat = 40.7128; 152 - const defaultLon = -74.0060; 153 - 154 - this.map = L.map('lfg-map').setView([defaultLat, defaultLon], 12); 155 - 156 - L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { 157 - attribution: '&copy; OpenStreetMap contributors' 158 - }).addTo(this.map); 159 - 160 - // Handle map clicks 161 - this.map.on('click', (e) => { 162 - this.handleMapClick(e.latlng.lat, e.latlng.lng); 163 - }); 164 - 165 - // Try to get user's location 166 - if (navigator.geolocation) { 167 - navigator.geolocation.getCurrentPosition((position) => { 168 - const lat = position.coords.latitude; 169 - const lon = position.coords.longitude; 170 - this.map.setView([lat, lon], 12); 171 - }, () => { 172 - // Geolocation denied or failed, use default 173 - }); 174 - } 175 - }, 176 - 177 - handleMapClick(lat, lon) { 178 - // Get H3 cell at resolution 5 179 - const clickedH3Index = h3.latLngToCell(lat, lon, H3_RESOLUTION); 180 - 181 - // Check if clicking on already selected cell - toggle off 182 - if (this.h3Index === clickedH3Index) { 183 - this.clearLocation(); 184 - return; 185 - } 186 - 187 - // Select new location 188 - this.selectLocation(clickedH3Index); 189 - this.errors.location = null; 190 - }, 191 - 192 - selectLocation(h3Index) { 193 - // Remove existing hex layer 194 - if (this.hexLayer) { 195 - this.map.removeLayer(this.hexLayer); 196 - } 197 - 198 - this.h3Index = h3Index; 199 - 200 - // Get boundary for drawing - h3.cellToBoundary returns [lat, lng] pairs 201 - const boundary = h3.cellToBoundary(h3Index); 202 - const latLngs = boundary.map(coord => [coord[0], coord[1]]); 203 - 204 - // Draw the hex with tooltip 205 - this.hexLayer = L.polygon(latLngs, { 206 - color: '#00d1b2', 207 - fillColor: '#00d1b2', 208 - fillOpacity: 0.3, 209 - weight: 3 210 - }).addTo(this.map); 211 - 212 - // Add tooltip to indicate it can be clicked to unselect 213 - this.hexLayer.bindTooltip('Click to unselect', { 214 - permanent: false, 215 - direction: 'center' 216 - }); 217 - 218 - // Handle click on the polygon to unselect 219 - this.hexLayer.on('click', () => { 220 - this.clearLocation(); 221 - }); 222 - 223 - // Get center coordinates for the API 224 - const center = h3.cellToLatLng(h3Index); 225 - this.latitude = center[0].toString(); 226 - this.longitude = center[1].toString(); 227 - }, 228 - 229 - clearLocation() { 230 - if (this.hexLayer) { 231 - this.map.removeLayer(this.hexLayer); 232 - this.hexLayer = null; 233 - } 234 - this.h3Index = ''; 235 - this.latitude = ''; 236 - this.longitude = ''; 237 - }, 238 - 239 - addTag() { 240 - const tag = this.tagInput.trim().replace(/[^a-zA-Z0-9-]/g, ''); 241 - // Check for duplicates case-insensitively 242 - const tagLower = tag.toLowerCase(); 243 - const isDuplicate = this.tags.some(t => t.toLowerCase() === tagLower); 244 - if (tag && !isDuplicate && this.tags.length < 10) { 245 - this.tags.push(tag); 246 - this.errors.tags = null; 247 - } 248 - this.tagInput = ''; 249 - }, 250 - 251 - addTagFromSuggestion(tag) { 252 - // Check for duplicates case-insensitively 253 - const tagLower = tag.toLowerCase(); 254 - const isDuplicate = this.tags.some(t => t.toLowerCase() === tagLower); 255 - if (!isDuplicate && this.tags.length < 10) { 256 - this.tags.push(tag); 257 - this.errors.tags = null; 258 - } 259 - }, 260 - 261 - removeTag(index) { 262 - this.tags.splice(index, 1); 263 - }, 264 - 265 - canSubmit() { 266 - return this.h3Index && this.tags.length >= 1; 267 - }, 268 - 269 - clearErrors() { 270 - this.errors = { 271 - location: null, 272 - tags: null, 273 - duration: null, 274 - general: null 275 - }; 276 - }, 277 - 278 - async submitForm() { 279 - if (!this.canSubmit() || this.submitting) return; 280 - 281 - this.clearErrors(); 282 - this.submitting = true; 283 - 284 - const payload = { 285 - latitude: parseFloat(this.latitude), 286 - longitude: parseFloat(this.longitude), 287 - tags: this.tags, 288 - duration_hours: parseInt(this.durationHours, 10) 289 - }; 290 - 291 - try { 292 - const response = await fetch('/lfg', { 293 - method: 'POST', 294 - headers: { 295 - 'Content-Type': 'application/json', 296 - }, 297 - body: JSON.stringify(payload) 298 - }); 299 - 300 - if (response.ok) { 301 - // Success - redirect to LFG page which will show matches view 302 - window.location.href = '/lfg'; 303 - } else { 304 - const data = await response.json(); 305 - if (data.error) { 306 - // Map error codes to fields 307 - if (data.error.includes('location') || data.error.includes('coordinate')) { 308 - this.errors.location = data.message || 'Invalid location'; 309 - } else if (data.error.includes('tag')) { 310 - this.errors.tags = data.message || 'Invalid tags'; 311 - } else if (data.error.includes('duration')) { 312 - this.errors.duration = data.message || 'Invalid duration'; 313 - } else { 314 - this.errors.general = data.message || 'An error occurred'; 315 - } 316 - } else { 317 - this.errors.general = 'An error occurred. Please try again.'; 318 - } 319 - } 320 - } catch (err) { 321 - console.error('LFG submission error:', err); 322 - this.errors.general = 'Network error. Please check your connection and try again.'; 323 - } finally { 324 - this.submitting = false; 325 - } 326 - } 327 - }; 328 - } 329 - </script>
-3
templates/en-us/lfg_form.html
··· 6 6 <meta property="og:description" content="Find activity partners in your area with Looking For Group"> 7 7 <meta property="og:site_name" content="Smoke Signal" /> 8 8 <meta property="og:type" content="website" /> 9 - <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" /> 10 - <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script> 11 - <script src="https://unpkg.com/h3-js@4"></script> 12 9 {% endblock %} 13 10 {% block content %} 14 11 {% include 'en-us/lfg_form.common.html' %}
+6 -65
templates/en-us/lfg_matches.common.html
··· 48 48 <span class="icon"><i class="fas fa-map"></i></span> 49 49 Activity 50 50 </h2> 51 - <div id="lfg-heatmap" style="height: 400px; border-radius: 6px;"></div> 51 + <div id="lfg-heatmap" 52 + style="height: 400px; border-radius: 6px;" 53 + data-lat="{{ latitude | default(40.7128) }}" 54 + data-lon="{{ longitude | default(-74.0060) }}" 55 + data-event-buckets="{{ event_buckets | tojson | e }}" 56 + data-profile-buckets="{{ profile_buckets | tojson | e }}"></div> 52 57 </div> 53 58 54 59 <!-- Two Column Layout --> ··· 128 133 </div> 129 134 </section> 130 135 131 - <script> 132 - document.addEventListener('DOMContentLoaded', function() { 133 - // Initialize map centered on user's LFG location 134 - const lat = {{ latitude | default(40.7128) }}; 135 - const lon = {{ longitude | default(-74.0060) }}; 136 - 137 - const map = L.map('lfg-heatmap').setView([lat, lon], 12); 138 - 139 - L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { 140 - attribution: '&copy; OpenStreetMap contributors' 141 - }).addTo(map); 142 - 143 - // Combine event and profile buckets into a single heatmap 144 - const eventBuckets = {{ event_buckets | tojson | safe }} || []; 145 - const profileBuckets = {{ profile_buckets | tojson | safe }} || []; 146 - 147 - // Merge buckets by H3 key 148 - const combinedBuckets = new Map(); 149 - eventBuckets.forEach(bucket => { 150 - const existing = combinedBuckets.get(bucket.key) || { events: 0, people: 0 }; 151 - existing.events = bucket.count; 152 - combinedBuckets.set(bucket.key, existing); 153 - }); 154 - profileBuckets.forEach(bucket => { 155 - const existing = combinedBuckets.get(bucket.key) || { events: 0, people: 0 }; 156 - existing.people = bucket.count; 157 - combinedBuckets.set(bucket.key, existing); 158 - }); 159 - 160 - // Calculate max combined count for intensity scaling 161 - let maxCount = 0; 162 - combinedBuckets.forEach(value => { 163 - const total = value.events + value.people; 164 - if (total > maxCount) maxCount = total; 165 - }); 166 - 167 - // Draw combined heatmap hexes 168 - combinedBuckets.forEach((value, key) => { 169 - try { 170 - const boundary = h3.cellToBoundary(key); 171 - const latLngs = boundary.map(coord => [coord[0], coord[1]]); 172 - const total = value.events + value.people; 173 - const intensity = Math.min(total / Math.max(maxCount, 1), 1); 174 - const opacity = 0.2 + (intensity * 0.5); 175 - 176 - // Build tooltip text 177 - const parts = []; 178 - if (value.events > 0) parts.push(`${value.events} event${value.events !== 1 ? 's' : ''}`); 179 - if (value.people > 0) parts.push(`${value.people} ${value.people !== 1 ? 'people' : 'person'}`); 180 - const tooltipText = parts.join(', '); 181 - 182 - L.polygon(latLngs, { 183 - color: '#3273dc', 184 - fillColor: '#3273dc', 185 - fillOpacity: opacity, 186 - weight: 1 187 - }).addTo(map).bindTooltip(tooltipText, { direction: 'center' }); 188 - } catch (e) { 189 - console.warn('Invalid H3 cell:', key); 190 - } 191 - }); 192 - 193 - }); 194 - </script>
-3
templates/en-us/lfg_matches.html
··· 6 6 <meta property="og:description" content="Find activity partners in your area with Looking For Group"> 7 7 <meta property="og:site_name" content="Smoke Signal" /> 8 8 <meta property="og:type" content="website" /> 9 - <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" /> 10 - <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script> 11 - <script src="https://unpkg.com/h3-js@4"></script> 12 9 {% endblock %} 13 10 {% block content %} 14 11 {% include 'en-us/lfg_matches.common.html' %}
+5 -126
templates/en-us/location.common.html
··· 1 - {% if is_h3_location %} 2 - <link rel="stylesheet" href="/static/leaflet.css" /> 3 - <style> 4 - #location-heatmap { 5 - height: 250px; 6 - border-radius: 8px; 7 - overflow: hidden; 8 - z-index: 1; 9 - } 10 - .h3-hex { 11 - stroke-width: 2; 12 - } 13 - .h3-hex-center { 14 - stroke-width: 2; 15 - } 16 - </style> 17 - {% endif %} 18 - 19 1 <section class="section"> 20 2 <div class="container"> 21 3 <nav class="breadcrumb" aria-label="breadcrumbs"> ··· 43 25 <span>Location Area</span> 44 26 </span> 45 27 </h3> 46 - <div id="location-heatmap"></div> 28 + <div id="location-heatmap" 29 + data-center-lat="{{ h3_info.center_lat }}" 30 + data-center-lon="{{ h3_info.center_lon }}" 31 + data-center-cell="{{ h3_info.cell_index }}" 32 + data-geo-buckets='{{ geo_buckets | tojson }}'></div> 47 33 {% endif %} 48 34 49 35 <div id="location-results"> ··· 115 101 </div> 116 102 </section> 117 103 118 - {% if is_h3_location and h3_info %} 119 - <script src="/static/leaflet.js"></script> 120 - <script src="/static/h3-js.umd.js"></script> 121 - <script> 122 - (function() { 123 - const mapContainer = document.getElementById('location-heatmap'); 124 - if (!mapContainer) return; 125 - 126 - const centerLat = {{ h3_info.center_lat }}; 127 - const centerLon = {{ h3_info.center_lon }}; 128 - const centerCell = "{{ h3_info.cell_index }}"; 129 - const geoBuckets = {{ geo_buckets | tojson }}; 130 - 131 - // Create map centered on the H3 cell 132 - const map = L.map('location-heatmap', { 133 - center: [centerLat, centerLon], 134 - zoom: 9, 135 - zoomControl: false, 136 - dragging: false, 137 - touchZoom: false, 138 - scrollWheelZoom: false, 139 - doubleClickZoom: false, 140 - boxZoom: false, 141 - keyboard: false, 142 - attributionControl: true 143 - }); 144 - 145 - // Add OpenStreetMap tiles 146 - L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { 147 - attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>', 148 - maxZoom: 19 149 - }).addTo(map); 150 - 151 - // Heatmap color scale from low (blue) to high (red) 152 - function getHeatmapColor(value, min, max) { 153 - if (max === min) return '#3273dc'; 154 - const ratio = (value - min) / (max - min); 155 - // Blue (#3273dc) -> Purple (#8957e5) -> Orange (#f39c12) -> Red (#e74c3c) 156 - if (ratio < 0.33) { 157 - const t = ratio / 0.33; 158 - return lerpColor('#3273dc', '#8957e5', t); 159 - } else if (ratio < 0.66) { 160 - const t = (ratio - 0.33) / 0.33; 161 - return lerpColor('#8957e5', '#f39c12', t); 162 - } else { 163 - const t = (ratio - 0.66) / 0.34; 164 - return lerpColor('#f39c12', '#e74c3c', t); 165 - } 166 - } 167 - 168 - function lerpColor(a, b, t) { 169 - const ah = parseInt(a.replace('#', ''), 16); 170 - const bh = parseInt(b.replace('#', ''), 16); 171 - const ar = ah >> 16, ag = (ah >> 8) & 0xff, ab = ah & 0xff; 172 - const br = bh >> 16, bg = (bh >> 8) & 0xff, bb = bh & 0xff; 173 - const rr = Math.round(ar + (br - ar) * t); 174 - const rg = Math.round(ag + (bg - ag) * t); 175 - const rb = Math.round(ab + (bb - ab) * t); 176 - return '#' + ((1 << 24) + (rr << 16) + (rg << 8) + rb).toString(16).slice(1); 177 - } 178 - 179 - // Only draw hexes with events 180 - if (geoBuckets && geoBuckets.length > 0) { 181 - const counts = geoBuckets.map(b => b.doc_count); 182 - const minCount = Math.min(...counts); 183 - const maxCount = Math.max(...counts); 184 - 185 - geoBuckets.forEach(bucket => { 186 - try { 187 - const cellIndex = bucket.key; 188 - const count = bucket.doc_count; 189 - const boundary = h3.cellToBoundary(cellIndex); 190 - const latLngs = boundary.map(coord => [coord[0], coord[1]]); 191 - 192 - const isCenter = cellIndex === centerCell; 193 - const color = getHeatmapColor(count, minCount, maxCount); 194 - 195 - const polygon = L.polygon(latLngs, { 196 - color: isCenter ? '#1a1a1a' : color, 197 - fillColor: color, 198 - fillOpacity: 0.5, 199 - weight: isCenter ? 3 : 2, 200 - className: isCenter ? 'h3-hex-center' : 'h3-hex' 201 - }).addTo(map); 202 - } catch (e) { 203 - console.warn('Failed to draw hex:', bucket.key, e); 204 - } 205 - }); 206 - 207 - // Fit bounds to show all hexes 208 - const allCoords = geoBuckets.flatMap(bucket => { 209 - try { 210 - return h3.cellToBoundary(bucket.key).map(coord => [coord[0], coord[1]]); 211 - } catch (e) { 212 - return []; 213 - } 214 - }); 215 - if (allCoords.length > 0) { 216 - map.fitBounds(allCoords, { padding: [10, 10] }); 217 - } 218 - } else { 219 - // No events - just show center marker 220 - L.marker([centerLat, centerLon]).addTo(map); 221 - } 222 - })(); 223 - </script> 224 - {% endif %}
-105
templates/en-us/settings.profile.html
··· 97 97 </div> 98 98 </div> 99 99 100 - <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.6.1/cropper.min.css"/> 101 - <script src="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.6.1/cropper.min.js"></script> 102 - <script> 103 - // Use window-scoped variables to avoid "duplicate variable" error when HTMX re-inserts this template 104 - if (typeof window.avatarCropper === 'undefined') window.avatarCropper = null; 105 - if (typeof window.bannerCropper === 'undefined') window.bannerCropper = null; 106 - 107 - document.getElementById('avatar-input').addEventListener('change', function(e) { 108 - const file = e.target.files[0]; 109 - if (!file) return; 110 - 111 - const reader = new FileReader(); 112 - reader.onload = function(event) { 113 - const canvas = document.getElementById('avatar-canvas'); 114 - const img = new Image(); 115 - img.onload = function() { 116 - canvas.width = img.width; 117 - canvas.height = img.height; 118 - canvas.style.display = 'block'; 119 - document.getElementById('avatar-crop').style.display = 'inline-block'; 120 - 121 - const ctx = canvas.getContext('2d'); 122 - ctx.drawImage(img, 0, 0); 123 - 124 - if (window.avatarCropper) window.avatarCropper.destroy(); 125 - window.avatarCropper = new Cropper(canvas, { 126 - aspectRatio: 1, 127 - viewMode: 1, 128 - }); 129 - }; 130 - img.src = event.target.result; 131 - }; 132 - reader.readAsDataURL(file); 133 - }); 134 - 135 - document.getElementById('banner-input').addEventListener('change', function(e) { 136 - const file = e.target.files[0]; 137 - if (!file) return; 138 - 139 - const reader = new FileReader(); 140 - reader.onload = function(event) { 141 - const canvas = document.getElementById('banner-canvas'); 142 - const img = new Image(); 143 - img.onload = function() { 144 - canvas.width = img.width; 145 - canvas.height = img.height; 146 - canvas.style.display = 'block'; 147 - document.getElementById('banner-crop').style.display = 'inline-block'; 148 - 149 - const ctx = canvas.getContext('2d'); 150 - ctx.drawImage(img, 0, 0); 151 - 152 - if (window.bannerCropper) window.bannerCropper.destroy(); 153 - window.bannerCropper = new Cropper(canvas, { 154 - aspectRatio: 16 / 9, 155 - viewMode: 1, 156 - }); 157 - }; 158 - img.src = event.target.result; 159 - }; 160 - reader.readAsDataURL(file); 161 - }); 162 - 163 - document.getElementById('avatar-crop').addEventListener('click', function() { 164 - if (!window.avatarCropper) return; 165 - 166 - window.avatarCropper.getCroppedCanvas({ 167 - width: 400, 168 - height: 400, 169 - }).toBlob(function(blob) { 170 - const formData = new FormData(); 171 - formData.append('avatar', blob, 'avatar.png'); 172 - 173 - fetch('/settings/avatar', { 174 - method: 'POST', 175 - body: formData, 176 - }).then(response => { 177 - if (response.ok) { 178 - window.location.reload(); 179 - } 180 - }); 181 - }, 'image/png'); 182 - }); 183 - 184 - document.getElementById('banner-crop').addEventListener('click', function() { 185 - if (!window.bannerCropper) return; 186 - 187 - window.bannerCropper.getCroppedCanvas({ 188 - width: 1600, 189 - height: 900, 190 - }).toBlob(function(blob) { 191 - const formData = new FormData(); 192 - formData.append('banner', blob, 'banner.png'); 193 - 194 - fetch('/settings/banner', { 195 - method: 'POST', 196 - body: formData, 197 - }).then(response => { 198 - if (response.ok) { 199 - window.location.reload(); 200 - } 201 - }); 202 - }, 'image/png'); 203 - }); 204 - </script>
+1 -262
templates/en-us/view_event.common.html
··· 3 3 <span class="icon"><i class="fa fa-circle-check"></i></span> 4 4 {%- endif -%} 5 5 {%- endmacro %} 6 - {% if event.geo_locations and event.geo_locations|length > 0 %} 7 - <link rel="stylesheet" href="/static/leaflet.css" /> 8 - {% endif %} 9 - <style> 10 - /* ============================================ 11 - MINIMAL CUSTOM STYLES 12 - Most styling uses Bulma CSS 1.0+ utilities 13 - Dark mode handled automatically by Bulma 14 - ============================================ */ 15 - 16 - /* Header Image - 16:9 Aspect Ratio */ 17 - .event-header-image { 18 - aspect-ratio: 16 / 9; 19 - overflow: hidden; 20 - } 21 - 22 - .event-header-image img { 23 - width: 100%; 24 - height: 100%; 25 - object-fit: cover; 26 - } 27 - 28 - /* Organizer Avatar */ 29 - .organizer-avatar { 30 - width: 80px; 31 - height: 80px; 32 - border-radius: 50%; 33 - object-fit: cover; 34 - flex-shrink: 0; 35 - border: 3px solid hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-border-l)); 36 - } 37 - 38 - /* RSVP Section - Uses Bulma scheme colors */ 39 - .rsvp-section { 40 - background: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-scheme-main-bis-l)); 41 - } 42 - 43 - /* RSVP State Colors - Border-left indicators with proper dark mode support */ 44 - .rsvp-message { 45 - border-left: 4px solid hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-border-l)); 46 - background-color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-background-l)); 47 - } 48 - 49 - .rsvp-message.is-success { 50 - border-left-color: hsl(var(--bulma-success-h), var(--bulma-success-s), var(--bulma-success-l)); 51 - } 52 - 53 - .rsvp-message.is-info { 54 - border-left-color: hsl(var(--bulma-info-h), var(--bulma-info-s), var(--bulma-info-l)); 55 - } 56 - 57 - .rsvp-message.is-warning { 58 - border-left-color: hsl(var(--bulma-warning-h), var(--bulma-warning-s), var(--bulma-warning-l)); 59 - } 60 - 61 - .rsvp-message.is-danger { 62 - border-left-color: hsl(var(--bulma-danger-h), var(--bulma-danger-s), var(--bulma-danger-l)); 63 - } 64 - 65 - .rsvp-message.is-neutral { 66 - border-left-color: hsl(var(--bulma-link-h), var(--bulma-link-s), var(--bulma-link-l)); 67 - } 68 - 69 - /* Location Badge Colors - Using Bulma color system with semantic colors */ 70 - .location-badge.is-virtual { 71 - background: hsl(var(--bulma-info-h), var(--bulma-info-s), var(--bulma-info-90-l)); 72 - color: hsl(var(--bulma-info-h), var(--bulma-info-s), var(--bulma-info-20-l)); 73 - } 74 - 75 - .location-badge.is-in-person { 76 - background: hsl(var(--bulma-warning-h), var(--bulma-warning-s), var(--bulma-warning-90-l)); 77 - color: hsl(var(--bulma-warning-h), var(--bulma-warning-s), var(--bulma-warning-20-l)); 78 - } 79 - 80 - .location-badge.is-hybrid { 81 - background: hsl(var(--bulma-link-h), var(--bulma-link-s), var(--bulma-link-90-l)); 82 - color: hsl(var(--bulma-link-h), var(--bulma-link-s), var(--bulma-link-20-l)); 83 - } 84 - 85 - /* Link Hover Effect - Uses scheme colors for dark mode compatibility */ 86 - .event-link { 87 - transition: all 0.2s; 88 - } 89 - 90 - .event-link:hover { 91 - background: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), calc(var(--bulma-scheme-main-l) + var(--bulma-hover-background-l-delta))); 92 - border-color: hsl(var(--bulma-link-h), var(--bulma-link-s), var(--bulma-link-l)); 93 - transform: translateX(2px); 94 - } 95 - 96 - /* Address Link Brand Colors - Adjusted for dark mode */ 97 - .address-link .fa-apple { 98 - color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-text-strong-l)); 99 - } 100 - 101 - .address-link .fa-google { 102 - color: #4285f4; /* Google brand color - keep consistent */ 103 - } 104 - 105 - /* Link Icon Background - Uses scheme colors */ 106 - .link-icon-bg { 107 - background: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-scheme-main-l)); 108 - } 109 - 110 - /* Section Divider - Uses Bulma border color */ 111 - .section-divider { 112 - border-color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-border-l)); 113 - } 114 - 115 - /* Address Box Border - Uses link color for emphasis */ 116 - .address-box-border { 117 - border-left-color: hsl(var(--bulma-link-h), var(--bulma-link-s), var(--bulma-link-l)); 118 - } 119 - 120 - /* Address Box - Better contrast for dark mode */ 121 - .address-box { 122 - background: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-scheme-main-bis-l)); 123 - } 124 - 125 - /* Event Details Box - Better contrast for dark mode */ 126 - .event-detail-box { 127 - background: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-background-l)); 128 - border-radius: 6px; 129 - } 130 - 131 - .event-detail-label { 132 - color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-text-weak-l)); 133 - } 134 - 135 - .event-detail-time { 136 - color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-text-l)); 137 - } 138 - 139 - .event-detail-icon { 140 - color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-text-weak-l)); 141 - } 142 - 143 - /* RSVP Message Secondary Text - Adapts to dark mode */ 144 - .rsvp-secondary-text { 145 - color: hsl(var(--bulma-scheme-h), var(--bulma-scheme-s), var(--bulma-text-weak-l)); 146 - opacity: 0.9; 147 - } 148 - 149 - /* Event Header */ 150 - .event-header-flex { 151 - display: flex; 152 - gap: 1.5rem; 153 - align-items: start; 154 - } 155 - 156 - /* Responsive adjustments */ 157 - @media (max-width: 768px) { 158 - .rsvp-controls { 159 - flex-direction: column; 160 - } 161 - .rsvp-controls .select, 162 - .rsvp-controls .button { 163 - width: 100%; 164 - } 165 - 166 - .organizer-avatar { 167 - width: 60px; 168 - height: 60px; 169 - } 170 - 171 - .event-header-flex { 172 - flex-wrap: wrap; 173 - margin-bottom: 1.5rem; 174 - } 175 - 176 - .event-header-flex > div:last-child { 177 - width: 100%; 178 - flex-direction: column; 179 - margin-top: 1rem; 180 - } 181 - 182 - .event-header-flex .button { 183 - width: 100%; 184 - } 185 - 186 - /* Add spacing after buttons on mobile */ 187 - .event-header-flex + .notification { 188 - margin-top: 1.5rem; 189 - } 190 - } 191 - 192 - /* Event Map Styles */ 193 - #event-map { 194 - z-index: 1; 195 - border-radius: 6px; 196 - overflow: hidden; 197 - } 198 - 199 - .h3-hex { 200 - fill-opacity: 0.2; 201 - stroke-width: 2; 202 - } 203 - </style> 204 6 205 7 <!-- Event Header --> 206 8 <section class="section pb-0"> ··· 671 473 672 474 <!-- Event Map --> 673 475 {% if event.geo_locations and event.geo_locations|length > 0 %} 674 - <div id="event-map" class="mt-4" style="height: 250px; border-radius: 6px; overflow: hidden;"></div> 476 + <div id="event-map" class="mt-4" style="height: 250px; border-radius: 6px; overflow: hidden;" data-geo-locations='{{ event.geo_locations | tojson }}'></div> 675 477 <ul class="help mt-2" style="list-style: none; margin: 0; padding: 0;"> 676 478 {% for geo in event.geo_locations %} 677 479 <li>{% if geo.name %}{{ geo.name }}: {% endif %}{{ geo.latitude }}, {{ geo.longitude }}</li> ··· 697 499 </div> 698 500 </section> 699 501 700 - {% if event.geo_locations and event.geo_locations|length > 0 %} 701 - <script src="/static/leaflet.js"></script> 702 - <script src="/static/h3-js.umd.js"></script> 703 - <script> 704 - document.addEventListener('DOMContentLoaded', function() { 705 - const H3_RESOLUTION = 9; 706 - 707 - // Geo locations data from template 708 - const geoLocations = [ 709 - {% for geo in event.geo_locations %} 710 - { lat: {{ geo.latitude }}, lng: {{ geo.longitude }}, name: {{ geo.name | tojson | default('null') }} }{% if not loop.last %},{% endif %} 711 - {% endfor %} 712 - ]; 713 - 714 - if (geoLocations.length === 0) return; 715 - 716 - // Calculate center of all locations for initial map view 717 - const avgLat = geoLocations.reduce((sum, loc) => sum + loc.lat, 0) / geoLocations.length; 718 - const avgLng = geoLocations.reduce((sum, loc) => sum + loc.lng, 0) / geoLocations.length; 719 - 720 - // Initialize map 721 - const map = L.map('event-map', { 722 - zoomControl: true, 723 - scrollWheelZoom: false, 724 - dragging: true, 725 - }).setView([avgLat, avgLng], 16); 726 - 727 - // Add OpenStreetMap tiles 728 - L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { 729 - attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>', 730 - maxZoom: 19 731 - }).addTo(map); 732 - 733 - // Collect all boundaries for fitting map bounds 734 - const allBounds = []; 735 - 736 - // Draw H3 hexagon for each geo location 737 - geoLocations.forEach(function(loc) { 738 - const h3Index = h3.latLngToCell(loc.lat, loc.lng, H3_RESOLUTION); 739 - const boundary = h3.cellToBoundary(h3Index); 740 - const latLngs = boundary.map(coord => [coord[0], coord[1]]); 741 - 742 - // Add to bounds 743 - latLngs.forEach(coord => allBounds.push(coord)); 744 - 745 - // Draw H3 hexagon 746 - L.polygon(latLngs, { 747 - color: '#3273dc', 748 - fillColor: '#3273dc', 749 - fillOpacity: 0.2, 750 - weight: 2, 751 - className: 'h3-hex' 752 - }).addTo(map); 753 - }); 754 - 755 - // Fit map to show all hexagons if there are multiple locations 756 - if (allBounds.length > 0) { 757 - const bounds = L.latLngBounds(allBounds); 758 - map.fitBounds(bounds, { padding: [20, 20] }); 759 - } 760 - }); 761 - </script> 762 - {% endif %}