{ "version": 3, "sources": ["index.js", "lib/init.js", "utils/log.js", "debug/loggers.js", "debug/index.js", "utils/json-loader.js", "shaderlib/index.js", "shaderlib/project/project.js", "shaderlib/misc/geometry.js", "lib/constants.js", "shaderlib/project/project.glsl.js", "shaderlib/project/viewport-uniforms.js", "utils/memoize.js", "shaderlib/project32/project32.js", "shaderlib/shadow/shadow.js", "shaderlib/picking/picking.js", "effects/lighting/ambient-light.js", "effects/lighting/directional-light.js", "effects/lighting/lighting-effect.js", "passes/pass.js", "passes/layers-pass.js", "passes/shadow-pass.js", "utils/typed-array-manager.js", "utils/math-utils.js", "viewports/viewport.js", "viewports/web-mercator-viewport.js", "shaderlib/project/project-functions.js", "effects/lighting/point-light.js", "effects/lighting/camera-light.js", "effects/lighting/sun-light.js", "effects/post-process-effect.js", "passes/screen-pass.js", "passes/pick-layers-pass.js", "lib/layer-manager.js", "lifecycle/constants.js", "utils/flatten.js", "lib/resource/resource.js", "lib/resource/resource-manager.js", "utils/deep-equal.js", "lib/view-manager.js", "utils/positions.js", "views/view.js", "controllers/map-controller.js", "transitions/transition.js", "controllers/transition-manager.js", "transitions/transition-interpolator.js", "utils/assert.js", "transitions/linear-interpolator.js", "controllers/controller.js", "controllers/view-state.js", "views/map-view.js", "lib/effect-manager.js", "passes/draw-layers-pass.js", "lib/deck-renderer.js", "lib/picking/query-object.js", "lib/picking/pick-info.js", "lib/deck-picker.js", "lib/widget-manager.js", "lib/tooltip.js", "lib/deck.js", "lib/attribute/data-column.js", "lib/attribute/gl-utils.js", "utils/iterable-utils.js", "utils/range.js", "lib/attribute/transition-settings.js", "lib/attribute/attribute.js", "transitions/gpu-interpolation-transition.js", "utils/array-utils.js", "transitions/gpu-transition-utils.js", "transitions/gpu-transition.js", "transitions/gpu-spring-transition.js", "lib/attribute/attribute-transition-manager.js", "lib/attribute/attribute-manager.js", "lib/layer.js", "transitions/cpu-interpolation-transition.js", "transitions/cpu-spring-transition.js", "lib/uniform-transition-manager.js", "lifecycle/props.js", "utils/count.js", "utils/shader.js", "utils/texture.js", "lifecycle/prop-types.js", "lifecycle/create-props.js", "lifecycle/component.js", "lifecycle/component-state.js", "lib/layer-state.js", "lib/composite-layer.js", "viewports/globe-viewport.js", "viewports/orbit-viewport.js", "viewports/orthographic-viewport.js", "viewports/first-person-viewport.js", "controllers/first-person-controller.js", "views/first-person-view.js", "controllers/orbit-controller.js", "views/orbit-view.js", "controllers/orthographic-controller.js", "views/orthographic-view.js", "controllers/globe-controller.js", "views/globe-view.js", "lib/layer-extension.js", "transitions/fly-to-interpolator.js", "utils/tesselator.js"], "sourcesContent": ["// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n/* eslint-disable max-len */\n// Intialize globals, extract version\nexport { VERSION } from \"./lib/init.js\";\n// Import shaderlib to make sure shader modules are initialized\nexport { getShaderAssembler } from \"./shaderlib/index.js\";\n// Core Library\nexport { COORDINATE_SYSTEM, OPERATION, UNIT } from \"./lib/constants.js\";\n// Effects\nexport { default as LightingEffect } from \"./effects/lighting/lighting-effect.js\";\nexport { AmbientLight } from \"./effects/lighting/ambient-light.js\";\nexport { DirectionalLight } from \"./effects/lighting/directional-light.js\";\nexport { PointLight } from \"./effects/lighting/point-light.js\";\nexport { default as _CameraLight } from \"./effects/lighting/camera-light.js\";\nexport { default as _SunLight } from \"./effects/lighting/sun-light.js\";\nexport { default as PostProcessEffect } from \"./effects/post-process-effect.js\";\n// Passes\nexport { default as _LayersPass } from \"./passes/layers-pass.js\";\nexport { default as _PickLayersPass } from \"./passes/pick-layers-pass.js\";\n// Experimental Pure JS (non-React) bindings\nexport { default as Deck } from \"./lib/deck.js\";\nexport { default as LayerManager } from \"./lib/layer-manager.js\";\nexport { default as Attribute } from \"./lib/attribute/attribute.js\";\nexport { default as AttributeManager } from \"./lib/attribute/attribute-manager.js\";\nexport { default as Layer } from \"./lib/layer.js\";\nexport { default as CompositeLayer } from \"./lib/composite-layer.js\";\nexport { default as DeckRenderer } from \"./lib/deck-renderer.js\";\n// Viewports\nexport { default as Viewport } from \"./viewports/viewport.js\";\nexport { default as WebMercatorViewport } from \"./viewports/web-mercator-viewport.js\";\nexport { default as _GlobeViewport } from \"./viewports/globe-viewport.js\";\nexport { default as OrbitViewport } from \"./viewports/orbit-viewport.js\";\nexport { default as OrthographicViewport } from \"./viewports/orthographic-viewport.js\";\nexport { default as FirstPersonViewport } from \"./viewports/first-person-viewport.js\";\n// Shader modules\nexport { picking, project, project32, gouraudLighting, phongLighting, shadow } from \"./shaderlib/index.js\";\nexport { default as View } from \"./views/view.js\";\nexport { default as MapView } from \"./views/map-view.js\";\nexport { default as FirstPersonView } from \"./views/first-person-view.js\";\nexport { default as OrbitView } from \"./views/orbit-view.js\";\nexport { default as OrthographicView } from \"./views/orthographic-view.js\";\nexport { default as _GlobeView } from \"./views/globe-view.js\";\n// Controllers\nexport { default as Controller } from \"./controllers/controller.js\";\nexport { default as MapController } from \"./controllers/map-controller.js\";\nexport { default as _GlobeController } from \"./controllers/globe-controller.js\";\nexport { default as FirstPersonController } from \"./controllers/first-person-controller.js\";\nexport { default as OrbitController } from \"./controllers/orbit-controller.js\";\nexport { default as OrthographicController } from \"./controllers/orthographic-controller.js\";\n// Extensions interface\nexport { default as LayerExtension } from \"./lib/layer-extension.js\";\n// Transitions\nexport { TRANSITION_EVENTS } from \"./controllers/transition-manager.js\";\nexport { default as TransitionInterpolator } from \"./transitions/transition-interpolator.js\";\nexport { default as LinearInterpolator } from \"./transitions/linear-interpolator.js\";\nexport { default as FlyToInterpolator } from \"./transitions/fly-to-interpolator.js\";\n// Layer utilities\nexport { default as log } from \"./utils/log.js\";\nexport { default as assert } from \"./utils/assert.js\";\nexport { createIterable } from \"./utils/iterable-utils.js\";\nexport { fp64LowPart } from \"./utils/math-utils.js\";\nexport { default as Tesselator } from \"./utils/tesselator.js\"; // Export? move to luma.gl or math.gl?\n// Experimental utilities\nexport { fillArray as _fillArray, flatten as _flatten } from \"./utils/flatten.js\"; // Export? move to luma.gl or math.gl?\nexport { count as _count } from \"./utils/count.js\";\nexport { deepEqual as _deepEqual } from \"./utils/deep-equal.js\";\nexport { default as _memoize } from \"./utils/memoize.js\";\nexport { mergeShaders as _mergeShaders } from \"./utils/shader.js\";\nexport { compareProps as _compareProps } from \"./lifecycle/props.js\";\n// INTERNAL, DO NOT USE\n// @deprecated internal do not use\nexport { default as _Component } from \"./lifecycle/component.js\";\n// @deprecated internal do not use\nexport { default as _ComponentState } from \"./lifecycle/component-state.js\";\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport { registerLoaders } from '@loaders.gl/core';\nimport { ImageLoader } from '@loaders.gl/images';\nimport log from \"../utils/log.js\";\nimport { register } from \"../debug/index.js\";\nimport jsonLoader from \"../utils/json-loader.js\";\nfunction checkVersion() {\n // Version detection using typescript plugin.\n // Fallback for tests and SSR since global variable is defined by esbuild.\n const version = typeof \"9.0.35\" !== 'undefined'\n ? \"9.0.35\" : globalThis.DECK_VERSION || 'untranspiled source';\n // Note: a `deck` object not created by deck.gl may exist in the global scope\n const existingVersion = globalThis.deck && globalThis.deck.VERSION;\n if (existingVersion && existingVersion !== version) {\n throw new Error(`deck.gl - multiple versions detected: ${existingVersion} vs ${version}`);\n }\n if (!existingVersion) {\n log.log(1, `deck.gl ${version}`)();\n globalThis.deck = {\n ...globalThis.deck,\n VERSION: version,\n version,\n log,\n // experimental\n _registerLoggers: register\n };\n registerLoaders([\n jsonLoader,\n // @ts-expect-error non-standard Loader format\n [ImageLoader, { imagebitmap: { premultiplyAlpha: 'none' } }]\n ]);\n }\n return version;\n}\nexport const VERSION = checkVersion();\n", "import { Log } from '@probe.gl/log';\nconst defaultLogger = new Log({ id: 'deck' });\nexport default defaultLogger;\n", "const logState = {\n attributeUpdateStart: -1,\n attributeManagerUpdateStart: -1,\n attributeUpdateMessages: []\n};\nconst LOG_LEVEL_MAJOR_UPDATE = 1; // Events with direct perf impact\nconst LOG_LEVEL_MINOR_UPDATE = 2; // Events that may affect perf\nconst LOG_LEVEL_UPDATE_DETAIL = 3;\nconst LOG_LEVEL_INFO = 4;\nconst LOG_LEVEL_DRAW = 2;\nexport const getLoggers = (log) => ({\n /* Layer events */\n 'layer.changeFlag': (layer, key, flags) => {\n log.log(LOG_LEVEL_UPDATE_DETAIL, `${layer.id} ${key}: `, flags[key])();\n },\n 'layer.initialize': layer => {\n log.log(LOG_LEVEL_MAJOR_UPDATE, `Initializing ${layer}`)();\n },\n 'layer.update': (layer, needsUpdate) => {\n if (needsUpdate) {\n const flags = layer.getChangeFlags();\n log.log(LOG_LEVEL_MINOR_UPDATE, `Updating ${layer} because: ${Object.keys(flags)\n .filter(key => flags[key])\n .join(', ')}`)();\n }\n else {\n log.log(LOG_LEVEL_INFO, `${layer} does not need update`)();\n }\n },\n 'layer.matched': (layer, changed) => {\n if (changed) {\n log.log(LOG_LEVEL_INFO, `Matched ${layer}, state transfered`)();\n }\n },\n 'layer.finalize': layer => {\n log.log(LOG_LEVEL_MAJOR_UPDATE, `Finalizing ${layer}`)();\n },\n /* CompositeLayer events */\n 'compositeLayer.renderLayers': (layer, updated, subLayers) => {\n if (updated) {\n log.log(LOG_LEVEL_MINOR_UPDATE, `Composite layer rendered new subLayers ${layer}`, subLayers)();\n }\n else {\n log.log(LOG_LEVEL_INFO, `Composite layer reused subLayers ${layer}`, subLayers)();\n }\n },\n /* LayerManager events */\n 'layerManager.setLayers': (layerManager, updated, layers) => {\n if (updated) {\n log.log(LOG_LEVEL_MINOR_UPDATE, `Updating ${layers.length} deck layers`)();\n }\n },\n 'layerManager.activateViewport': (layerManager, viewport) => {\n log.log(LOG_LEVEL_UPDATE_DETAIL, 'Viewport changed', viewport)();\n },\n /* AttributeManager events */\n 'attributeManager.invalidate': (attributeManager, trigger, attributeNames) => {\n log.log(LOG_LEVEL_MAJOR_UPDATE, attributeNames\n ? `invalidated attributes ${attributeNames} (${trigger}) for ${attributeManager.id}`\n : `invalidated all attributes for ${attributeManager.id}`)();\n },\n 'attributeManager.updateStart': attributeManager => {\n logState.attributeUpdateMessages.length = 0;\n logState.attributeManagerUpdateStart = Date.now();\n },\n 'attributeManager.updateEnd': (attributeManager, numInstances) => {\n const timeMs = Math.round(Date.now() - logState.attributeManagerUpdateStart);\n log.groupCollapsed(LOG_LEVEL_MINOR_UPDATE, `Updated attributes for ${numInstances} instances in ${attributeManager.id} in ${timeMs}ms`)();\n for (const updateMessage of logState.attributeUpdateMessages) {\n log.log(LOG_LEVEL_UPDATE_DETAIL, updateMessage)();\n }\n log.groupEnd(LOG_LEVEL_MINOR_UPDATE)();\n },\n /* Attribute events */\n 'attribute.updateStart': attribute => {\n logState.attributeUpdateStart = Date.now();\n },\n 'attribute.allocate': (attribute, numInstances) => {\n const message = `${attribute.id} allocated ${numInstances}`;\n logState.attributeUpdateMessages.push(message);\n },\n 'attribute.updateEnd': (attribute, numInstances) => {\n const timeMs = Math.round(Date.now() - logState.attributeUpdateStart);\n const message = `${attribute.id} updated ${numInstances} in ${timeMs}ms`;\n logState.attributeUpdateMessages.push(message);\n },\n /* Render events */\n 'deckRenderer.renderLayers': (deckRenderer, renderStats, opts) => {\n const { pass, redrawReason, stats } = opts;\n for (const status of renderStats) {\n const { totalCount, visibleCount, compositeCount, pickableCount } = status;\n const primitiveCount = totalCount - compositeCount;\n const hiddenCount = primitiveCount - visibleCount;\n log.log(LOG_LEVEL_DRAW, `RENDER #${deckRenderer.renderCount} \\\n ${visibleCount} (of ${totalCount} layers) to ${pass} because ${redrawReason} \\\n (${hiddenCount} hidden, ${compositeCount} composite ${pickableCount} pickable)`)();\n if (stats) {\n stats.get('Redraw Layers').add(visibleCount);\n }\n }\n }\n});\n", "import deckLog from \"../utils/log.js\";\nimport { getLoggers } from \"./loggers.js\";\n/* debug utility */\nlet loggers = {};\n// Conditionally load default loggers in development mode\n// eslint-disable-next-line\nif (process.env.NODE_ENV !== 'production') {\n loggers = getLoggers(deckLog);\n}\nexport function register(handlers) {\n loggers = handlers;\n}\nexport default function debug(eventType, arg1, arg2, arg3) {\n if (deckLog.level > 0 && loggers[eventType]) {\n // Not using rest parameters to defeat perf hit from array construction\n loggers[eventType].call(null, arg1, arg2, arg3);\n }\n}\n", "function isJSON(text) {\n const firstChar = text[0];\n const lastChar = text[text.length - 1];\n return (firstChar === '{' && lastChar === '}') || (firstChar === '[' && lastChar === ']');\n}\n// A light weight version instead of @loaders.gl/json (stream processing etc.)\nexport default {\n dataType: null,\n batchType: null,\n id: 'JSON',\n name: 'JSON',\n module: '',\n version: '',\n options: {},\n extensions: ['json', 'geojson'],\n mimeTypes: ['application/json', 'application/geo+json'],\n testText: isJSON,\n parseTextSync: JSON.parse\n};\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport { ShaderAssembler } from '@luma.gl/shadertools';\nimport { gouraudLighting, phongLighting } from '@luma.gl/shadertools';\nimport project from \"./project/project.js\";\nimport project32 from \"./project32/project32.js\";\nimport shadow from \"./shadow/shadow.js\";\nimport picking from \"./picking/picking.js\";\nconst DEFAULT_MODULES = [project];\nconst SHADER_HOOKS = [\n 'vs:DECKGL_FILTER_SIZE(inout vec3 size, VertexGeometry geometry)',\n 'vs:DECKGL_FILTER_GL_POSITION(inout vec4 position, VertexGeometry geometry)',\n 'vs:DECKGL_FILTER_COLOR(inout vec4 color, VertexGeometry geometry)',\n 'fs:DECKGL_FILTER_COLOR(inout vec4 color, FragmentGeometry geometry)'\n];\nexport function getShaderAssembler() {\n const shaderAssembler = ShaderAssembler.getDefaultShaderAssembler();\n for (const shaderModule of DEFAULT_MODULES) {\n // @ts-expect-error stricter luma gl types\n shaderAssembler.addDefaultModule(shaderModule);\n }\n for (const shaderHook of SHADER_HOOKS) {\n shaderAssembler.addShaderHook(shaderHook);\n }\n return shaderAssembler;\n}\nexport { picking, project, project32, gouraudLighting, phongLighting, shadow };\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport { fp32 } from '@luma.gl/shadertools';\nimport geometry from \"../misc/geometry.js\";\nimport projectShader from \"./project.glsl.js\";\nimport { getUniformsFromViewport } from \"./viewport-uniforms.js\";\nconst INITIAL_MODULE_OPTIONS = {};\nfunction getUniforms(opts = INITIAL_MODULE_OPTIONS) {\n if ('viewport' in opts) {\n return getUniformsFromViewport(opts);\n }\n return {};\n}\nexport default {\n name: 'project',\n dependencies: [fp32, geometry],\n vs: projectShader,\n getUniforms\n};\n", "const defines = '#define SMOOTH_EDGE_RADIUS 0.5';\nconst vs = `\n${defines}\n\nstruct VertexGeometry {\n vec4 position;\n vec3 worldPosition;\n vec3 worldPositionAlt;\n vec3 normal;\n vec2 uv;\n vec3 pickingColor;\n} geometry = VertexGeometry(\n vec4(0.0, 0.0, 1.0, 0.0),\n vec3(0.0),\n vec3(0.0),\n vec3(0.0),\n vec2(0.0),\n vec3(0.0)\n);\n`;\nconst fs = `\n${defines}\n\nstruct FragmentGeometry {\n vec2 uv;\n} geometry;\n\nfloat smoothedge(float edge, float x) {\n return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x);\n}\n`;\nexport default { name: 'geometry', vs, fs };\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n// Note: The numeric values here are matched by shader code in the\n// \"project\" and \"project64\" shader modules. Both places need to be\n// updated.\nimport log from \"../utils/log.js\";\n/**\n * The coordinate system that positions/dimensions are defined in.\n */\nexport const COORDINATE_SYSTEM = {\n /**\n * `LNGLAT` if rendering into a geospatial viewport, `CARTESIAN` otherwise\n */\n DEFAULT: -1,\n /**\n * Positions are interpreted as [longitude, latitude, elevation]\n * longitude/latitude are in degrees, elevation is in meters.\n * Dimensions are in meters.\n */\n LNGLAT: 1,\n /**\n * Positions are interpreted as [x, y, z] in meter offsets from the coordinate origin.\n * Dimensions are in meters.\n */\n METER_OFFSETS: 2,\n /**\n * Positions are interpreted as [deltaLng, deltaLat, elevation] from the coordinate origin.\n * deltaLng/deltaLat are in degrees, elevation is in meters.\n * Dimensions are in meters.\n */\n LNGLAT_OFFSETS: 3,\n /**\n * Positions and dimensions are in the common units of the viewport.\n */\n CARTESIAN: 0\n};\n// Deprecated\n/* eslint-disable accessor-pairs */\nObject.defineProperty(COORDINATE_SYSTEM, 'IDENTITY', {\n get: () => {\n log.deprecated('COORDINATE_SYSTEM.IDENTITY', 'COORDINATE_SYSTEM.CARTESIAN')();\n return 0;\n }\n});\n/* eslint-enable accessor-pairs */\n/**\n * How coordinates are transformed from the world space into the common space.\n */\nexport const PROJECTION_MODE = {\n /**\n * Render geospatial data in Web Mercator projection\n */\n WEB_MERCATOR: 1,\n /**\n * Render geospatial data as a 3D globe\n */\n GLOBE: 2,\n /**\n * (Internal use only) Web Mercator projection at high zoom\n */\n WEB_MERCATOR_AUTO_OFFSET: 4,\n /**\n * No transformation\n */\n IDENTITY: 0\n};\nexport const UNIT = {\n common: 0,\n meters: 1,\n pixels: 2\n};\nexport const EVENTS = {\n click: { handler: 'onClick' },\n panstart: { handler: 'onDragStart' },\n panmove: { handler: 'onDrag' },\n panend: { handler: 'onDragEnd' }\n};\n/**\n * @deprecated Use string constants directly\n */\nexport const OPERATION = {\n DRAW: 'draw',\n MASK: 'mask',\n TERRAIN: 'terrain'\n};\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport { COORDINATE_SYSTEM, PROJECTION_MODE, UNIT } from \"../../lib/constants.js\";\n// We are generating these from the js code in constants.js\nconst COORDINATE_SYSTEM_GLSL_CONSTANTS = Object.keys(COORDINATE_SYSTEM)\n .map(key => `const int COORDINATE_SYSTEM_${key} = ${COORDINATE_SYSTEM[key]};`)\n .join('');\nconst PROJECTION_MODE_GLSL_CONSTANTS = Object.keys(PROJECTION_MODE)\n .map(key => `const int PROJECTION_MODE_${key} = ${PROJECTION_MODE[key]};`)\n .join('');\nconst UNIT_GLSL_CONSTANTS = Object.keys(UNIT)\n .map(key => `const int UNIT_${key.toUpperCase()} = ${UNIT[key]};`)\n .join('');\nexport default `\\\n${COORDINATE_SYSTEM_GLSL_CONSTANTS}\n${PROJECTION_MODE_GLSL_CONSTANTS}\n${UNIT_GLSL_CONSTANTS}\nuniform int project_uCoordinateSystem;\nuniform int project_uProjectionMode;\nuniform float project_uScale;\nuniform bool project_uWrapLongitude;\nuniform vec3 project_uCommonUnitsPerMeter;\nuniform vec3 project_uCommonUnitsPerWorldUnit;\nuniform vec3 project_uCommonUnitsPerWorldUnit2;\nuniform vec4 project_uCenter;\nuniform mat4 project_uModelMatrix;\nuniform mat4 project_uViewProjectionMatrix;\nuniform vec2 project_uViewportSize;\nuniform float project_uDevicePixelRatio;\nuniform float project_uFocalDistance;\nuniform vec3 project_uCameraPosition;\nuniform vec3 project_uCoordinateOrigin;\nuniform vec3 project_uCommonOrigin;\nuniform bool project_uPseudoMeters;\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / (PI * 2.0);\nconst vec3 ZERO_64_LOW = vec3(0.0);\nconst float EARTH_RADIUS = 6370972.0;\nconst float GLOBE_RADIUS = 256.0;\nfloat project_size_at_latitude(float lat) {\nfloat y = clamp(lat, -89.9, 89.9);\nreturn 1.0 / cos(radians(y));\n}\nfloat project_size() {\nif (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR &&\nproject_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT &&\nproject_uPseudoMeters == false) {\nif (geometry.position.w == 0.0) {\nreturn project_size_at_latitude(geometry.worldPosition.y);\n}\nfloat y = geometry.position.y / TILE_SIZE * 2.0 - 1.0;\nfloat y2 = y * y;\nfloat y4 = y2 * y2;\nfloat y6 = y4 * y2;\nreturn 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6;\n}\nreturn 1.0;\n}\nfloat project_size_at_latitude(float meters, float lat) {\nreturn meters * project_uCommonUnitsPerMeter.z * project_size_at_latitude(lat);\n}\nfloat project_size(float meters) {\nreturn meters * project_uCommonUnitsPerMeter.z * project_size();\n}\nvec2 project_size(vec2 meters) {\nreturn meters * project_uCommonUnitsPerMeter.xy * project_size();\n}\nvec3 project_size(vec3 meters) {\nreturn meters * project_uCommonUnitsPerMeter * project_size();\n}\nvec4 project_size(vec4 meters) {\nreturn vec4(meters.xyz * project_uCommonUnitsPerMeter, meters.w);\n}\nmat3 project_get_orientation_matrix(vec3 up) {\nvec3 uz = normalize(up);\nvec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0));\nvec3 uy = cross(uz, ux);\nreturn mat3(ux, uy, uz);\n}\nbool project_needs_rotation(vec3 commonPosition, out mat3 transform) {\nif (project_uProjectionMode == PROJECTION_MODE_GLOBE) {\ntransform = project_get_orientation_matrix(commonPosition);\nreturn true;\n}\nreturn false;\n}\nvec3 project_normal(vec3 vector) {\nvec4 normal_modelspace = project_uModelMatrix * vec4(vector, 0.0);\nvec3 n = normalize(normal_modelspace.xyz * project_uCommonUnitsPerMeter);\nmat3 rotation;\nif (project_needs_rotation(geometry.position.xyz, rotation)) {\nn = rotation * n;\n}\nreturn n;\n}\nvec4 project_offset_(vec4 offset) {\nfloat dy = offset.y;\nvec3 commonUnitsPerWorldUnit = project_uCommonUnitsPerWorldUnit + project_uCommonUnitsPerWorldUnit2 * dy;\nreturn vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w);\n}\nvec2 project_mercator_(vec2 lnglat) {\nfloat x = lnglat.x;\nif (project_uWrapLongitude) {\nx = mod(x + 180., 360.0) - 180.;\n}\nfloat y = clamp(lnglat.y, -89.9, 89.9);\nreturn vec2(\nradians(x) + PI,\nPI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5))\n) * WORLD_SCALE;\n}\nvec3 project_globe_(vec3 lnglatz) {\nfloat lambda = radians(lnglatz.x);\nfloat phi = radians(lnglatz.y);\nfloat cosPhi = cos(phi);\nfloat D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS;\nreturn vec3(\nsin(lambda) * cosPhi,\n-cos(lambda) * cosPhi,\nsin(phi)\n) * D;\n}\nvec4 project_position(vec4 position, vec3 position64Low) {\nvec4 position_world = project_uModelMatrix * position;\nif (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR) {\nif (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\nreturn vec4(\nproject_mercator_(position_world.xy),\nproject_size_at_latitude(position_world.z, position_world.y),\nposition_world.w\n);\n}\nif (project_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {\nposition_world.xyz += project_uCoordinateOrigin;\n}\n}\nif (project_uProjectionMode == PROJECTION_MODE_GLOBE) {\nif (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\nreturn vec4(\nproject_globe_(position_world.xyz),\nposition_world.w\n);\n}\n}\nif (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {\nif (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\nif (abs(position_world.y - project_uCoordinateOrigin.y) > 0.25) {\nreturn vec4(\nproject_mercator_(position_world.xy) - project_uCommonOrigin.xy,\nproject_size(position_world.z),\nposition_world.w\n);\n}\n}\n}\nif (project_uProjectionMode == PROJECTION_MODE_IDENTITY ||\n(project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET &&\n(project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\nproject_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) {\nposition_world.xyz -= project_uCoordinateOrigin;\n}\nreturn project_offset_(position_world) + project_offset_(project_uModelMatrix * vec4(position64Low, 0.0));\n}\nvec4 project_position(vec4 position) {\nreturn project_position(position, ZERO_64_LOW);\n}\nvec3 project_position(vec3 position, vec3 position64Low) {\nvec4 projected_position = project_position(vec4(position, 1.0), position64Low);\nreturn projected_position.xyz;\n}\nvec3 project_position(vec3 position) {\nvec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW);\nreturn projected_position.xyz;\n}\nvec2 project_position(vec2 position) {\nvec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW);\nreturn projected_position.xy;\n}\nvec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) {\nreturn viewProjectionMatrix * position + center;\n}\nvec4 project_common_position_to_clipspace(vec4 position) {\nreturn project_common_position_to_clipspace(position, project_uViewProjectionMatrix, project_uCenter);\n}\nvec2 project_pixel_size_to_clipspace(vec2 pixels) {\nvec2 offset = pixels / project_uViewportSize * project_uDevicePixelRatio * 2.0;\nreturn offset * project_uFocalDistance;\n}\nfloat project_size_to_pixel(float meters) {\nreturn project_size(meters) * project_uScale;\n}\nfloat project_size_to_pixel(float size, int unit) {\nif (unit == UNIT_METERS) return project_size_to_pixel(size);\nif (unit == UNIT_COMMON) return size * project_uScale;\nreturn size;\n}\nfloat project_pixel_size(float pixels) {\nreturn pixels / project_uScale;\n}\nvec2 project_pixel_size(vec2 pixels) {\nreturn pixels / project_uScale;\n}\n`;\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n/* eslint-disable complexity, camelcase */\nimport { mat4, vec4 } from '@math.gl/core';\nimport { COORDINATE_SYSTEM, PROJECTION_MODE } from \"../../lib/constants.js\";\nimport memoize from \"../../utils/memoize.js\";\n// To quickly set a vector to zero\nconst ZERO_VECTOR = [0, 0, 0, 0];\n// 4x4 matrix that drops 4th component of vector\nconst VECTOR_TO_POINT_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0];\nconst IDENTITY_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\nconst DEFAULT_PIXELS_PER_UNIT2 = [0, 0, 0];\nconst DEFAULT_COORDINATE_ORIGIN = [0, 0, 0];\nconst getMemoizedViewportUniforms = memoize(calculateViewportUniforms);\nexport function getOffsetOrigin(viewport, coordinateSystem, coordinateOrigin = DEFAULT_COORDINATE_ORIGIN) {\n if (coordinateOrigin.length < 3) {\n coordinateOrigin = [coordinateOrigin[0], coordinateOrigin[1], 0];\n }\n let shaderCoordinateOrigin = coordinateOrigin;\n let geospatialOrigin;\n let offsetMode = true;\n if (coordinateSystem === COORDINATE_SYSTEM.LNGLAT_OFFSETS ||\n coordinateSystem === COORDINATE_SYSTEM.METER_OFFSETS) {\n geospatialOrigin = coordinateOrigin;\n }\n else {\n geospatialOrigin = viewport.isGeospatial\n ? // @ts-expect-error longitude and latitude are not defined on the base Viewport, but is expected on geospatial viewports\n [Math.fround(viewport.longitude), Math.fround(viewport.latitude), 0]\n : null;\n }\n switch (viewport.projectionMode) {\n case PROJECTION_MODE.WEB_MERCATOR:\n if (coordinateSystem === COORDINATE_SYSTEM.LNGLAT ||\n coordinateSystem === COORDINATE_SYSTEM.CARTESIAN) {\n geospatialOrigin = [0, 0, 0];\n offsetMode = false;\n }\n break;\n case PROJECTION_MODE.WEB_MERCATOR_AUTO_OFFSET:\n if (coordinateSystem === COORDINATE_SYSTEM.LNGLAT) {\n // viewport center in world space\n // @ts-expect-error when using LNGLAT coordinates, we expect the viewport to be geospatial, in which case geospatialOrigin is defined\n shaderCoordinateOrigin = geospatialOrigin;\n }\n else if (coordinateSystem === COORDINATE_SYSTEM.CARTESIAN) {\n // viewport center in common space\n shaderCoordinateOrigin = [\n Math.fround(viewport.center[0]),\n Math.fround(viewport.center[1]),\n 0\n ];\n // Geospatial origin (wgs84) must match shaderCoordinateOrigin (common)\n geospatialOrigin = viewport.unprojectPosition(shaderCoordinateOrigin);\n shaderCoordinateOrigin[0] -= coordinateOrigin[0];\n shaderCoordinateOrigin[1] -= coordinateOrigin[1];\n shaderCoordinateOrigin[2] -= coordinateOrigin[2];\n }\n break;\n case PROJECTION_MODE.IDENTITY:\n shaderCoordinateOrigin = viewport.position.map(Math.fround);\n shaderCoordinateOrigin[2] = shaderCoordinateOrigin[2] || 0;\n break;\n case PROJECTION_MODE.GLOBE:\n offsetMode = false;\n geospatialOrigin = null;\n break;\n default:\n // Unknown projection mode\n offsetMode = false;\n }\n return { geospatialOrigin, shaderCoordinateOrigin, offsetMode };\n}\n// The code that utilizes Matrix4 does the same calculation as their mat4 counterparts,\n// has lower performance but provides error checking.\nfunction calculateMatrixAndOffset(viewport, coordinateSystem, coordinateOrigin) {\n const { viewMatrixUncentered, projectionMatrix } = viewport;\n let { viewMatrix, viewProjectionMatrix } = viewport;\n let projectionCenter = ZERO_VECTOR;\n let originCommon = ZERO_VECTOR;\n let cameraPosCommon = viewport.cameraPosition;\n const { geospatialOrigin, shaderCoordinateOrigin, offsetMode } = getOffsetOrigin(viewport, coordinateSystem, coordinateOrigin);\n if (offsetMode) {\n // Calculate transformed projectionCenter (using 64 bit precision JS)\n // This is the key to offset mode precision\n // (avoids doing this addition in 32 bit precision in GLSL)\n // @ts-expect-error the 4th component is assigned below\n originCommon = viewport.projectPosition(geospatialOrigin || shaderCoordinateOrigin);\n cameraPosCommon = [\n cameraPosCommon[0] - originCommon[0],\n cameraPosCommon[1] - originCommon[1],\n cameraPosCommon[2] - originCommon[2]\n ];\n originCommon[3] = 1;\n // projectionCenter = new Matrix4(viewProjectionMatrix)\n // .transformVector([positionPixels[0], positionPixels[1], 0.0, 1.0]);\n projectionCenter = vec4.transformMat4([], originCommon, viewProjectionMatrix);\n // Always apply uncentered projection matrix if available (shader adds center)\n viewMatrix = viewMatrixUncentered || viewMatrix;\n // Zero out 4th coordinate (\"after\" model matrix) - avoids further translations\n // viewMatrix = new Matrix4(viewMatrixUncentered || viewMatrix)\n // .multiplyRight(VECTOR_TO_POINT_MATRIX);\n viewProjectionMatrix = mat4.multiply([], projectionMatrix, viewMatrix);\n viewProjectionMatrix = mat4.multiply([], viewProjectionMatrix, VECTOR_TO_POINT_MATRIX);\n }\n return {\n viewMatrix,\n viewProjectionMatrix,\n projectionCenter,\n originCommon,\n cameraPosCommon,\n shaderCoordinateOrigin,\n geospatialOrigin\n };\n}\n/**\n * Returns uniforms for shaders based on current projection\n * includes: projection matrix suitable for shaders\n *\n * TODO - Ensure this works with any viewport, not just WebMercatorViewports\n *\n * @param {WebMercatorViewport} viewport -\n * @return {Float32Array} - 4x4 projection matrix that can be used in shaders\n */\nexport function getUniformsFromViewport({ viewport, devicePixelRatio = 1, modelMatrix = null, \n// Match Layer.defaultProps\ncoordinateSystem = COORDINATE_SYSTEM.DEFAULT, coordinateOrigin = DEFAULT_COORDINATE_ORIGIN, autoWrapLongitude = false }) {\n if (coordinateSystem === COORDINATE_SYSTEM.DEFAULT) {\n coordinateSystem = viewport.isGeospatial\n ? COORDINATE_SYSTEM.LNGLAT\n : COORDINATE_SYSTEM.CARTESIAN;\n }\n const uniforms = getMemoizedViewportUniforms({\n viewport,\n devicePixelRatio,\n coordinateSystem,\n coordinateOrigin\n });\n uniforms.project_uWrapLongitude = autoWrapLongitude;\n uniforms.project_uModelMatrix = modelMatrix || IDENTITY_MATRIX;\n return uniforms;\n}\nfunction calculateViewportUniforms({ viewport, devicePixelRatio, coordinateSystem, coordinateOrigin }) {\n const { projectionCenter, viewProjectionMatrix, originCommon, cameraPosCommon, shaderCoordinateOrigin, geospatialOrigin } = calculateMatrixAndOffset(viewport, coordinateSystem, coordinateOrigin);\n // Calculate projection pixels per unit\n const distanceScales = viewport.getDistanceScales();\n const viewportSize = [\n viewport.width * devicePixelRatio,\n viewport.height * devicePixelRatio\n ];\n // Distance at which screen pixels are projected.\n // Used to scale sizes in clipspace to match screen pixels.\n // When using Viewport class's default projection matrix, this yields 1 for orthographic\n // and `viewport.focalDistance` for perspective views\n const focalDistance = vec4.transformMat4([], [0, 0, -viewport.focalDistance, 1], viewport.projectionMatrix)[3] || 1;\n const uniforms = {\n // Projection mode values\n project_uCoordinateSystem: coordinateSystem,\n project_uProjectionMode: viewport.projectionMode,\n project_uCoordinateOrigin: shaderCoordinateOrigin,\n project_uCommonOrigin: originCommon.slice(0, 3),\n project_uCenter: projectionCenter,\n // Backward compatibility\n // TODO: remove in v9\n // @ts-expect-error _pseudoMeters is only defined on WebMercator viewport\n project_uPseudoMeters: Boolean(viewport._pseudoMeters),\n // Screen size\n project_uViewportSize: viewportSize,\n project_uDevicePixelRatio: devicePixelRatio,\n project_uFocalDistance: focalDistance,\n project_uCommonUnitsPerMeter: distanceScales.unitsPerMeter,\n project_uCommonUnitsPerWorldUnit: distanceScales.unitsPerMeter,\n project_uCommonUnitsPerWorldUnit2: DEFAULT_PIXELS_PER_UNIT2,\n project_uScale: viewport.scale, // This is the mercator scale (2 ** zoom)\n project_uWrapLongitude: false,\n project_uViewProjectionMatrix: viewProjectionMatrix,\n project_uModelMatrix: IDENTITY_MATRIX,\n // This is for lighting calculations\n project_uCameraPosition: cameraPosCommon\n };\n if (geospatialOrigin) {\n // Get high-precision DistanceScales from geospatial viewport\n // TODO: stricter types in Viewport classes\n const distanceScalesAtOrigin = viewport.getDistanceScales(geospatialOrigin);\n switch (coordinateSystem) {\n case COORDINATE_SYSTEM.METER_OFFSETS:\n uniforms.project_uCommonUnitsPerWorldUnit = distanceScalesAtOrigin.unitsPerMeter;\n uniforms.project_uCommonUnitsPerWorldUnit2 = distanceScalesAtOrigin.unitsPerMeter2;\n break;\n case COORDINATE_SYSTEM.LNGLAT:\n case COORDINATE_SYSTEM.LNGLAT_OFFSETS:\n // @ts-expect-error _pseudoMeters only exists on WebMercatorView\n if (!viewport._pseudoMeters) {\n uniforms.project_uCommonUnitsPerMeter = distanceScalesAtOrigin.unitsPerMeter;\n }\n uniforms.project_uCommonUnitsPerWorldUnit = distanceScalesAtOrigin.unitsPerDegree;\n uniforms.project_uCommonUnitsPerWorldUnit2 = distanceScalesAtOrigin.unitsPerDegree2;\n break;\n // a.k.a \"preprojected\" positions\n case COORDINATE_SYSTEM.CARTESIAN:\n uniforms.project_uCommonUnitsPerWorldUnit = [1, 1, distanceScalesAtOrigin.unitsPerMeter[2]];\n uniforms.project_uCommonUnitsPerWorldUnit2 = [\n 0,\n 0,\n distanceScalesAtOrigin.unitsPerMeter2[2]\n ];\n break;\n default:\n break;\n }\n }\n return uniforms;\n}\n", "function isEqual(a, b) {\n if (a === b) {\n return true;\n }\n if (Array.isArray(a)) {\n // Special treatment for arrays: compare 1-level deep\n // This is to support equality of matrix/coordinate props\n const len = a.length;\n if (!b || b.length !== len) {\n return false;\n }\n for (let i = 0; i < len; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n }\n return false;\n}\n/**\n * Speed up consecutive function calls by caching the result of calls with identical input\n * https://en.wikipedia.org/wiki/Memoization\n * @param {function} compute - the function to be memoized\n */\nexport default function memoize(compute) {\n let cachedArgs = {};\n let cachedResult;\n return (args) => {\n for (const key in args) {\n if (!isEqual(args[key], cachedArgs[key])) {\n cachedResult = compute(args);\n cachedArgs = args;\n break;\n }\n }\n return cachedResult;\n };\n}\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport project from \"../project/project.js\";\nconst vs = `\nvec4 project_position_to_clipspace(\n vec3 position, vec3 position64Low, vec3 offset, out vec4 commonPosition\n) {\n vec3 projectedPosition = project_position(position, position64Low);\n mat3 rotation;\n if (project_needs_rotation(projectedPosition, rotation)) {\n // offset is specified as ENU\n // when in globe projection, rotate offset so that the ground alighs with the surface of the globe\n offset = rotation * offset;\n }\n commonPosition = vec4(projectedPosition + offset, 1.0);\n return project_common_position_to_clipspace(commonPosition);\n}\n\nvec4 project_position_to_clipspace(\n vec3 position, vec3 position64Low, vec3 offset\n) {\n vec4 commonPosition;\n return project_position_to_clipspace(position, position64Low, offset, commonPosition);\n}\n`;\nexport default {\n name: 'project32',\n dependencies: [project],\n vs\n};\n", "// Copyright (c) 2015-2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport { COORDINATE_SYSTEM, PROJECTION_MODE } from \"../../lib/constants.js\";\nimport project from \"../project/project.js\";\nimport { Vector3, Matrix4 } from '@math.gl/core';\nimport memoize from \"../../utils/memoize.js\";\nimport { pixelsToWorld } from '@math.gl/web-mercator';\nconst vs = `\nconst int max_lights = 2;\nuniform mat4 shadow_uViewProjectionMatrices[max_lights];\nuniform vec4 shadow_uProjectCenters[max_lights];\nuniform bool shadow_uDrawShadowMap;\nuniform bool shadow_uUseShadowMap;\nuniform int shadow_uLightId;\nuniform float shadow_uLightCount;\n\nout vec3 shadow_vPosition[max_lights];\n\nvec4 shadow_setVertexPosition(vec4 position_commonspace) {\n if (shadow_uDrawShadowMap) {\n return project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[shadow_uLightId], shadow_uProjectCenters[shadow_uLightId]);\n }\n if (shadow_uUseShadowMap) {\n for (int i = 0; i < max_lights; i++) {\n if(i < int(shadow_uLightCount)) {\n vec4 shadowMap_position = project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[i], shadow_uProjectCenters[i]);\n shadow_vPosition[i] = (shadowMap_position.xyz / shadowMap_position.w + 1.0) / 2.0;\n }\n }\n }\n return gl_Position;\n}\n`;\nconst fs = `\nconst int max_lights = 2;\nuniform bool shadow_uDrawShadowMap;\nuniform bool shadow_uUseShadowMap;\nuniform sampler2D shadow_uShadowMap0;\nuniform sampler2D shadow_uShadowMap1;\nuniform vec4 shadow_uColor;\nuniform float shadow_uLightCount;\n\nin vec3 shadow_vPosition[max_lights];\n\nconst vec4 bitPackShift = vec4(1.0, 255.0, 65025.0, 16581375.0);\nconst vec4 bitUnpackShift = 1.0 / bitPackShift;\nconst vec4 bitMask = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n\nfloat shadow_getShadowWeight(vec3 position, sampler2D shadowMap) {\n vec4 rgbaDepth = texture(shadowMap, position.xy);\n\n float z = dot(rgbaDepth, bitUnpackShift);\n return smoothstep(0.001, 0.01, position.z - z);\n}\n\nvec4 shadow_filterShadowColor(vec4 color) {\n if (shadow_uDrawShadowMap) {\n vec4 rgbaDepth = fract(gl_FragCoord.z * bitPackShift);\n rgbaDepth -= rgbaDepth.gbaa * bitMask;\n return rgbaDepth;\n }\n if (shadow_uUseShadowMap) {\n float shadowAlpha = 0.0;\n shadowAlpha += shadow_getShadowWeight(shadow_vPosition[0], shadow_uShadowMap0);\n if(shadow_uLightCount > 1.0) {\n shadowAlpha += shadow_getShadowWeight(shadow_vPosition[1], shadow_uShadowMap1);\n }\n shadowAlpha *= shadow_uColor.a / shadow_uLightCount;\n float blendedAlpha = shadowAlpha + color.a * (1.0 - shadowAlpha);\n\n return vec4(\n mix(color.rgb, shadow_uColor.rgb, shadowAlpha / blendedAlpha),\n blendedAlpha\n );\n }\n return color;\n}\n`;\nconst getMemoizedViewportCenterPosition = memoize(getViewportCenterPosition);\nconst getMemoizedViewProjectionMatrices = memoize(getViewProjectionMatrices);\nconst DEFAULT_SHADOW_COLOR = [0, 0, 0, 1.0];\nconst VECTOR_TO_POINT_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0];\nfunction screenToCommonSpace(xyz, pixelUnprojectionMatrix) {\n const [x, y, z] = xyz;\n const coord = pixelsToWorld([x, y, z], pixelUnprojectionMatrix);\n if (Number.isFinite(z)) {\n return coord;\n }\n return [coord[0], coord[1], 0];\n}\nfunction getViewportCenterPosition({ viewport, center }) {\n return new Matrix4(viewport.viewProjectionMatrix).invert().transform(center);\n}\nfunction getViewProjectionMatrices({ viewport, shadowMatrices }) {\n const projectionMatrices = [];\n const pixelUnprojectionMatrix = viewport.pixelUnprojectionMatrix;\n const farZ = viewport.isGeospatial ? undefined : 1;\n const corners = [\n [0, 0, farZ], // top left ground\n [viewport.width, 0, farZ], // top right ground\n [0, viewport.height, farZ], // bottom left ground\n [viewport.width, viewport.height, farZ], // bottom right ground\n [0, 0, -1], // top left near\n [viewport.width, 0, -1], // top right near\n [0, viewport.height, -1], // bottom left near\n [viewport.width, viewport.height, -1] // bottom right near\n ].map(pixel => \n // @ts-expect-error z may be undefined\n screenToCommonSpace(pixel, pixelUnprojectionMatrix));\n for (const shadowMatrix of shadowMatrices) {\n const viewMatrix = shadowMatrix.clone().translate(new Vector3(viewport.center).negate());\n const positions = corners.map(corner => viewMatrix.transform(corner));\n const projectionMatrix = new Matrix4().ortho({\n left: Math.min(...positions.map(position => position[0])),\n right: Math.max(...positions.map(position => position[0])),\n bottom: Math.min(...positions.map(position => position[1])),\n top: Math.max(...positions.map(position => position[1])),\n near: Math.min(...positions.map(position => -position[2])),\n far: Math.max(...positions.map(position => -position[2]))\n });\n projectionMatrices.push(projectionMatrix.multiplyRight(shadowMatrix));\n }\n return projectionMatrices;\n}\n/* eslint-disable camelcase */\n// eslint-disable-next-line complexity\nfunction createShadowUniforms(opts, context) {\n const { shadowEnabled = true } = opts;\n if (!shadowEnabled || !opts.shadowMatrices || !opts.shadowMatrices.length) {\n return {\n shadow_uDrawShadowMap: false,\n shadow_uUseShadowMap: false,\n shadow_uShadowMap0: opts.dummyShadowMap,\n shadow_uShadowMap1: opts.dummyShadowMap\n };\n }\n const uniforms = {\n shadow_uDrawShadowMap: Boolean(opts.drawToShadowMap),\n shadow_uUseShadowMap: opts.shadowMaps ? opts.shadowMaps.length > 0 : false,\n shadow_uColor: opts.shadowColor || DEFAULT_SHADOW_COLOR,\n shadow_uLightId: opts.shadowLightId || 0,\n shadow_uLightCount: opts.shadowMatrices.length\n };\n const center = getMemoizedViewportCenterPosition({\n viewport: opts.viewport,\n center: context.project_uCenter\n });\n const projectCenters = [];\n const viewProjectionMatrices = getMemoizedViewProjectionMatrices({\n shadowMatrices: opts.shadowMatrices,\n viewport: opts.viewport\n }).slice();\n for (let i = 0; i < opts.shadowMatrices.length; i++) {\n const viewProjectionMatrix = viewProjectionMatrices[i];\n const viewProjectionMatrixCentered = viewProjectionMatrix\n .clone()\n .translate(new Vector3(opts.viewport.center).negate());\n if (context.project_uCoordinateSystem === COORDINATE_SYSTEM.LNGLAT &&\n context.project_uProjectionMode === PROJECTION_MODE.WEB_MERCATOR) {\n viewProjectionMatrices[i] = viewProjectionMatrixCentered;\n projectCenters[i] = center;\n }\n else {\n viewProjectionMatrices[i] = viewProjectionMatrix\n .clone()\n .multiplyRight(VECTOR_TO_POINT_MATRIX);\n projectCenters[i] = viewProjectionMatrixCentered.transform(center);\n }\n }\n for (let i = 0; i < viewProjectionMatrices.length; i++) {\n uniforms[`shadow_uViewProjectionMatrices[${i}]`] = viewProjectionMatrices[i];\n uniforms[`shadow_uProjectCenters[${i}]`] = projectCenters[i];\n }\n for (let i = 0; i < 2; i++) {\n uniforms[`shadow_uShadowMap${i}`] =\n (opts.shadowMaps && opts.shadowMaps[i]) || opts.dummyShadowMap;\n }\n return uniforms;\n}\nexport default {\n name: 'shadow',\n dependencies: [project],\n vs,\n fs,\n inject: {\n 'vs:DECKGL_FILTER_GL_POSITION': `\n position = shadow_setVertexPosition(geometry.position);\n `,\n 'fs:DECKGL_FILTER_COLOR': `\n color = shadow_filterShadowColor(color);\n `\n },\n // @ts-expect-error stricter luma gl types\n getUniforms: (opts = {}, context = {}) => {\n if ('viewport' in opts &&\n (opts.drawToShadowMap || (opts.shadowMaps && opts.shadowMaps.length > 0))) {\n // @ts-expect-error if opts.viewport is defined, context should contain the project module's uniforms\n return createShadowUniforms(opts, context);\n }\n return {};\n }\n};\n", "import { picking } from '@luma.gl/shadertools';\nexport default {\n ...picking,\n defaultUniforms: { ...picking.defaultUniforms, useFloatColors: false },\n inject: {\n 'vs:DECKGL_FILTER_GL_POSITION': `\n // for picking depth values\n picking_setPickingAttribute(position.z / position.w);\n `,\n 'vs:DECKGL_FILTER_COLOR': `\n picking_setPickingColor(geometry.pickingColor);\n `,\n 'fs:DECKGL_FILTER_COLOR': {\n order: 99,\n injection: `\n // use highlight color if this fragment belongs to the selected object.\n color = picking_filterHighlightColor(color);\n\n // use picking color if rendering to picking FBO.\n color = picking_filterPickingColor(color);\n `\n }\n }\n};\n", "const DEFAULT_LIGHT_COLOR = [255, 255, 255];\nconst DEFAULT_LIGHT_INTENSITY = 1.0;\nlet idCount = 0;\nexport class AmbientLight {\n constructor(props = {}) {\n this.type = 'ambient';\n const { color = DEFAULT_LIGHT_COLOR } = props;\n const { intensity = DEFAULT_LIGHT_INTENSITY } = props;\n this.id = props.id || `ambient-${idCount++}`;\n this.color = color;\n this.intensity = intensity;\n }\n}\n", "import { Vector3 } from '@math.gl/core';\nconst DEFAULT_LIGHT_COLOR = [255, 255, 255];\nconst DEFAULT_LIGHT_INTENSITY = 1.0;\nconst DEFAULT_LIGHT_DIRECTION = [0.0, 0.0, -1.0];\nlet idCount = 0;\nexport class DirectionalLight {\n constructor(props = {}) {\n this.type = 'directional';\n const { color = DEFAULT_LIGHT_COLOR } = props;\n const { intensity = DEFAULT_LIGHT_INTENSITY } = props;\n const { direction = DEFAULT_LIGHT_DIRECTION } = props;\n const { _shadow = false } = props;\n this.id = props.id || `directional-${idCount++}`;\n this.color = color;\n this.intensity = intensity;\n this.type = 'directional';\n this.direction = new Vector3(direction).normalize().toArray();\n this.shadow = _shadow;\n }\n getProjectedLight(opts) {\n return this;\n }\n}\n", "import { AmbientLight } from \"./ambient-light.js\";\nimport { DirectionalLight } from \"./directional-light.js\";\nimport { Matrix4, Vector3 } from '@math.gl/core';\nimport ShadowPass from \"../../passes/shadow-pass.js\";\nimport shadow from \"../../shaderlib/shadow/shadow.js\";\nconst DEFAULT_AMBIENT_LIGHT_PROPS = { color: [255, 255, 255], intensity: 1.0 };\nconst DEFAULT_DIRECTIONAL_LIGHT_PROPS = [\n {\n color: [255, 255, 255],\n intensity: 1.0,\n direction: [-1, 3, -1]\n },\n {\n color: [255, 255, 255],\n intensity: 0.9,\n direction: [1, -8, -2.5]\n }\n];\nconst DEFAULT_SHADOW_COLOR = [0, 0, 0, 200 / 255];\n// Class to manage ambient, point and directional light sources in deck\nexport default class LightingEffect {\n constructor(props = {}) {\n this.id = 'lighting-effect';\n this.shadowColor = DEFAULT_SHADOW_COLOR;\n this.shadow = false;\n this.ambientLight = null;\n this.directionalLights = [];\n this.pointLights = [];\n this.shadowPasses = [];\n this.shadowMaps = [];\n this.dummyShadowMap = null;\n this.setProps(props);\n }\n setup(context) {\n this.context = context;\n const { device, deck } = context;\n if (this.shadow && !this.dummyShadowMap) {\n this._createShadowPasses(device);\n // @ts-expect-error stricter luma gl types\n deck._addDefaultShaderModule(shadow);\n this.dummyShadowMap = device.createTexture({\n width: 1,\n height: 1\n });\n }\n }\n setProps(props) {\n this.ambientLight = null;\n this.directionalLights = [];\n this.pointLights = [];\n for (const key in props) {\n const lightSource = props[key];\n switch (lightSource.type) {\n case 'ambient':\n this.ambientLight = lightSource;\n break;\n case 'directional':\n this.directionalLights.push(lightSource);\n break;\n case 'point':\n this.pointLights.push(lightSource);\n break;\n default:\n }\n }\n this._applyDefaultLights();\n this.shadow = this.directionalLights.some(light => light.shadow);\n if (this.context) {\n // Create resources if necessary\n this.setup(this.context);\n }\n this.props = props;\n }\n preRender({ layers, layerFilter, viewports, onViewportActive, views }) {\n if (!this.shadow)\n return;\n // create light matrix every frame to make sure always updated from light source\n this.shadowMatrices = this._calculateMatrices();\n for (let i = 0; i < this.shadowPasses.length; i++) {\n const shadowPass = this.shadowPasses[i];\n shadowPass.render({\n layers,\n layerFilter,\n viewports,\n onViewportActive,\n views,\n moduleParameters: {\n shadowLightId: i,\n dummyShadowMap: this.dummyShadowMap,\n shadowMatrices: this.shadowMatrices\n }\n });\n }\n }\n getModuleParameters(layer) {\n const parameters = this.shadow\n ? {\n shadowMaps: this.shadowMaps,\n dummyShadowMap: this.dummyShadowMap,\n shadowColor: this.shadowColor,\n shadowMatrices: this.shadowMatrices\n }\n : {};\n // when not rendering to screen, turn off lighting by adding empty light source object\n // lights shader module relies on the `lightSources` to turn on/off lighting\n parameters.lightSources = {\n ambientLight: this.ambientLight,\n directionalLights: this.directionalLights.map(directionalLight => directionalLight.getProjectedLight({ layer })),\n pointLights: this.pointLights.map(pointLight => pointLight.getProjectedLight({ layer }))\n };\n return parameters;\n }\n cleanup(context) {\n for (const shadowPass of this.shadowPasses) {\n shadowPass.delete();\n }\n this.shadowPasses.length = 0;\n this.shadowMaps.length = 0;\n if (this.dummyShadowMap) {\n this.dummyShadowMap.destroy();\n this.dummyShadowMap = null;\n // @ts-expect-error stricter luma gl types\n context.deck._removeDefaultShaderModule(shadow);\n }\n }\n _calculateMatrices() {\n const lightMatrices = [];\n for (const light of this.directionalLights) {\n const viewMatrix = new Matrix4().lookAt({\n eye: new Vector3(light.direction).negate()\n });\n lightMatrices.push(viewMatrix);\n }\n return lightMatrices;\n }\n _createShadowPasses(device) {\n for (let i = 0; i < this.directionalLights.length; i++) {\n const shadowPass = new ShadowPass(device);\n this.shadowPasses[i] = shadowPass;\n this.shadowMaps[i] = shadowPass.shadowMap;\n }\n }\n _applyDefaultLights() {\n const { ambientLight, pointLights, directionalLights } = this;\n if (!ambientLight && pointLights.length === 0 && directionalLights.length === 0) {\n this.ambientLight = new AmbientLight(DEFAULT_AMBIENT_LIGHT_PROPS);\n this.directionalLights.push(new DirectionalLight(DEFAULT_DIRECTIONAL_LIGHT_PROPS[0]), new DirectionalLight(DEFAULT_DIRECTIONAL_LIGHT_PROPS[1]));\n }\n }\n}\n", "/**\n * Base class for passes\n * @todo v9 - should the luma.gl RenderPass be owned by this class?\n * Currently owned by subclasses\n */\nexport default class Pass {\n /** Create a new Pass instance */\n constructor(device, props = { id: 'pass' }) {\n const { id } = props;\n this.id = id; // id of this pass\n this.device = device;\n this.props = { ...props };\n }\n setProps(props) {\n Object.assign(this.props, props);\n }\n render(params) { } // eslint-disable-line @typescript-eslint/no-empty-function\n cleanup() { } // eslint-disable-line @typescript-eslint/no-empty-function\n}\n", "import Pass from \"./pass.js\";\n/** A Pass that renders all layers */\nexport default class LayersPass extends Pass {\n constructor() {\n super(...arguments);\n this._lastRenderIndex = -1;\n }\n render(options) {\n // @ts-expect-error TODO - assuming WebGL context\n const [width, height] = this.device.canvasContext.getDrawingBufferSize();\n // Explicitly specify clearColor and clearDepth, overriding render pass defaults.\n const clearCanvas = options.clearCanvas ?? true;\n const clearColor = options.clearColor ?? (clearCanvas ? [0, 0, 0, 0] : false);\n const clearDepth = clearCanvas ? 1 : false;\n const clearStencil = clearCanvas ? 0 : false;\n const colorMask = options.colorMask ?? 0xf;\n const parameters = { viewport: [0, 0, width, height] };\n if (options.colorMask) {\n parameters.colorMask = colorMask;\n }\n if (options.scissorRect) {\n parameters.scissorRect = options.scissorRect;\n }\n const renderPass = this.device.beginRenderPass({\n framebuffer: options.target,\n parameters,\n clearColor,\n clearDepth,\n clearStencil\n });\n try {\n return this._drawLayers(renderPass, options);\n }\n finally {\n renderPass.end();\n }\n }\n /** Draw a list of layers in a list of viewports */\n _drawLayers(renderPass, options) {\n const { target, moduleParameters, viewports, views, onViewportActive, clearStack = true } = options;\n options.pass = options.pass || 'unknown';\n if (clearStack) {\n this._lastRenderIndex = -1;\n }\n const renderStats = [];\n for (const viewport of viewports) {\n const view = views && views[viewport.id];\n // Update context to point to this viewport\n onViewportActive?.(viewport);\n const drawLayerParams = this._getDrawLayerParams(viewport, options);\n // render this viewport\n const subViewports = viewport.subViewports || [viewport];\n for (const subViewport of subViewports) {\n const stats = this._drawLayersInViewport(renderPass, {\n target,\n moduleParameters,\n viewport: subViewport,\n view,\n pass: options.pass,\n layers: options.layers\n }, drawLayerParams);\n renderStats.push(stats);\n }\n }\n return renderStats;\n }\n // When a viewport contains multiple subviewports (e.g. repeated web mercator map),\n // this is only done once for the parent viewport\n /* Resolve the parameters needed to draw each layer */\n _getDrawLayerParams(viewport, { layers, pass, isPicking = false, layerFilter, cullRect, effects, moduleParameters }, \n /** Internal flag, true if only used to determine whether each layer should be drawn */\n evaluateShouldDrawOnly = false) {\n const drawLayerParams = [];\n const indexResolver = layerIndexResolver(this._lastRenderIndex + 1);\n const drawContext = {\n layer: layers[0],\n viewport,\n isPicking,\n renderPass: pass,\n cullRect\n };\n const layerFilterCache = {};\n for (let layerIndex = 0; layerIndex < layers.length; layerIndex++) {\n const layer = layers[layerIndex];\n // Check if we should draw layer\n const shouldDrawLayer = this._shouldDrawLayer(layer, drawContext, layerFilter, layerFilterCache);\n const layerParam = {\n shouldDrawLayer\n };\n if (shouldDrawLayer && !evaluateShouldDrawOnly) {\n // This is the \"logical\" index for ordering this layer in the stack\n // used to calculate polygon offsets\n // It can be the same as another layer\n layerParam.layerRenderIndex = indexResolver(layer, shouldDrawLayer);\n layerParam.moduleParameters = this._getModuleParameters(layer, effects, pass, moduleParameters);\n layerParam.layerParameters = {\n ...layer.context.deck?.props.parameters,\n ...this.getLayerParameters(layer, layerIndex, viewport)\n };\n }\n drawLayerParams[layerIndex] = layerParam;\n }\n return drawLayerParams;\n }\n // Draws a list of layers in one viewport\n // TODO - when picking we could completely skip rendering viewports that dont\n // intersect with the picking rect\n /* eslint-disable max-depth, max-statements */\n _drawLayersInViewport(renderPass, { layers, moduleParameters: globalModuleParameters, pass, target, viewport, view }, drawLayerParams) {\n const glViewport = getGLViewport(this.device, {\n moduleParameters: globalModuleParameters,\n target,\n viewport\n });\n // TODO v9 - remove WebGL specific logic\n if (view && view.props.clear) {\n const clearOpts = view.props.clear === true ? { color: true, depth: true } : view.props.clear;\n this.device.withParametersWebGL({\n scissorTest: true,\n scissor: glViewport\n }, () => this.device.clearWebGL(clearOpts));\n }\n // render layers in normal colors\n const renderStatus = {\n totalCount: layers.length,\n visibleCount: 0,\n compositeCount: 0,\n pickableCount: 0\n };\n renderPass.setParameters({ viewport: glViewport });\n // render layers in normal colors\n for (let layerIndex = 0; layerIndex < layers.length; layerIndex++) {\n const layer = layers[layerIndex];\n const { shouldDrawLayer, layerRenderIndex, moduleParameters, layerParameters } = drawLayerParams[layerIndex];\n // Calculate stats\n if (shouldDrawLayer && layer.props.pickable) {\n renderStatus.pickableCount++;\n }\n if (layer.isComposite) {\n renderStatus.compositeCount++;\n }\n else if (shouldDrawLayer) {\n // Draw the layer\n renderStatus.visibleCount++;\n this._lastRenderIndex = Math.max(this._lastRenderIndex, layerRenderIndex);\n // overwrite layer.context.viewport with the sub viewport\n moduleParameters.viewport = viewport;\n // TODO v9 - we are sending renderPass both as a parameter and through the context.\n // Long-term, it is likely better not to have user defined layer methods have to access\n // the \"global\" layer context.\n layer.context.renderPass = renderPass;\n try {\n layer._drawLayer({\n renderPass,\n moduleParameters,\n uniforms: { layerIndex: layerRenderIndex },\n parameters: layerParameters\n });\n }\n catch (err) {\n layer.raiseError(err, `drawing ${layer} to ${pass}`);\n }\n }\n }\n return renderStatus;\n }\n /* eslint-enable max-depth, max-statements */\n /* Methods for subclass overrides */\n shouldDrawLayer(layer) {\n return true;\n }\n getModuleParameters(layer, effects) {\n return null;\n }\n getLayerParameters(layer, layerIndex, viewport) {\n return layer.props.parameters;\n }\n /* Private */\n _shouldDrawLayer(layer, drawContext, layerFilter, layerFilterCache) {\n const shouldDrawLayer = layer.props.visible && this.shouldDrawLayer(layer);\n if (!shouldDrawLayer) {\n return false;\n }\n drawContext.layer = layer;\n let parent = layer.parent;\n while (parent) {\n // @ts-ignore\n if (!parent.props.visible || !parent.filterSubLayer(drawContext)) {\n return false;\n }\n drawContext.layer = parent;\n parent = parent.parent;\n }\n if (layerFilter) {\n const rootLayerId = drawContext.layer.id;\n if (!(rootLayerId in layerFilterCache)) {\n layerFilterCache[rootLayerId] = layerFilter(drawContext);\n }\n if (!layerFilterCache[rootLayerId]) {\n return false;\n }\n }\n // If a layer is drawn, update its viewportChanged flag\n layer.activateViewport(drawContext.viewport);\n return true;\n }\n _getModuleParameters(layer, effects, pass, overrides) {\n // @ts-expect-error TODO - assuming WebGL context\n const devicePixelRatio = this.device.canvasContext.cssToDeviceRatio();\n const moduleParameters = Object.assign(Object.create(layer.internalState?.propsInTransition || layer.props), {\n autoWrapLongitude: layer.wrapLongitude,\n viewport: layer.context.viewport,\n mousePosition: layer.context.mousePosition,\n picking: {\n isActive: 0\n },\n devicePixelRatio\n });\n if (effects) {\n for (const effect of effects) {\n Object.assign(moduleParameters, effect.getModuleParameters?.(layer));\n }\n }\n return Object.assign(moduleParameters, this.getModuleParameters(layer, effects), overrides);\n }\n}\n// If the _index prop is defined, return a layer index that's relative to its parent\n// Otherwise return the index of the layer among all rendered layers\n// This is done recursively, i.e. if the user overrides a layer's default index,\n// all its descendants will be resolved relative to that index.\n// This implementation assumes that parent layers always appear before its children\n// which is true if the layer array comes from the LayerManager\nexport function layerIndexResolver(startIndex = 0, layerIndices = {}) {\n const resolvers = {};\n const resolveLayerIndex = (layer, isDrawn) => {\n const indexOverride = layer.props._offset;\n const layerId = layer.id;\n const parentId = layer.parent && layer.parent.id;\n let index;\n if (parentId && !(parentId in layerIndices)) {\n // Populate layerIndices with the parent layer's index\n resolveLayerIndex(layer.parent, false);\n }\n if (parentId in resolvers) {\n const resolver = (resolvers[parentId] =\n resolvers[parentId] || layerIndexResolver(layerIndices[parentId], layerIndices));\n index = resolver(layer, isDrawn);\n resolvers[layerId] = resolver;\n }\n else if (Number.isFinite(indexOverride)) {\n index = indexOverride + (layerIndices[parentId] || 0);\n // Mark layer as needing its own resolver\n // We don't actually create it until it's used for the first time\n resolvers[layerId] = null;\n }\n else {\n index = startIndex;\n }\n if (isDrawn && index >= startIndex) {\n startIndex = index + 1;\n }\n layerIndices[layerId] = index;\n return index;\n };\n return resolveLayerIndex;\n}\n// Convert viewport top-left CSS coordinates to bottom up WebGL coordinates\nfunction getGLViewport(device, { moduleParameters, target, viewport }) {\n const pixelRatio = (moduleParameters && moduleParameters.devicePixelRatio) ||\n // @ts-expect-error TODO - assuming WebGL context\n device.canvasContext.cssToDeviceRatio();\n // Default framebuffer is used when writing to canvas\n // @ts-expect-error TODO - assuming WebGL context\n const [, drawingBufferHeight] = device.canvasContext.getDrawingBufferSize();\n const height = target ? target.height : drawingBufferHeight;\n // Convert viewport top-left CSS coordinates to bottom up WebGL coordinates\n const dimensions = viewport;\n return [\n dimensions.x * pixelRatio,\n height - (dimensions.y + dimensions.height) * pixelRatio,\n dimensions.width * pixelRatio,\n dimensions.height * pixelRatio\n ];\n}\n", "import LayersPass from \"./layers-pass.js\";\nexport default class ShadowPass extends LayersPass {\n constructor(device, props) {\n super(device, props);\n // The shadowMap texture\n this.shadowMap = device.createTexture({\n width: 1,\n height: 1,\n sampler: {\n minFilter: 'linear',\n magFilter: 'linear',\n addressModeU: 'clamp-to-edge',\n addressModeV: 'clamp-to-edge'\n }\n });\n // @ts-ignore\n this.depthBuffer = device.createTexture({\n format: 'depth16unorm',\n width: 1,\n height: 1,\n mipmaps: false,\n // TODO fix getWebGLTextureParameters() in luma to avoid passing deprecated parameters\n dataFormat: 6402, // gl.DEPTH_COMPONENT\n type: 5125 // gl.UNSIGNED_INT\n });\n this.fbo = device.createFramebuffer({\n id: 'shadowmap',\n width: 1,\n height: 1,\n colorAttachments: [this.shadowMap],\n // Depth attachment has to be specified for depth test to work\n depthStencilAttachment: this.depthBuffer\n });\n }\n render(params) {\n const target = this.fbo;\n // @ts-expect-error TODO - assuming WebGL context\n const pixelRatio = this.device.canvasContext.cssToDeviceRatio();\n const viewport = params.viewports[0];\n const width = viewport.width * pixelRatio;\n const height = viewport.height * pixelRatio;\n const clearColor = [1, 1, 1, 1];\n if (width !== target.width || height !== target.height) {\n target.resize({ width, height });\n }\n super.render({ ...params, clearColor, target, pass: 'shadow' });\n }\n getLayerParameters(layer, layerIndex, viewport) {\n return { ...layer.props.parameters, blend: false, depthRange: [0, 1], depthTest: true };\n }\n shouldDrawLayer(layer) {\n return layer.props.shadowEnabled !== false;\n }\n getModuleParameters() {\n return {\n drawToShadowMap: true\n };\n }\n delete() {\n if (this.fbo) {\n this.fbo.destroy();\n this.fbo = null;\n }\n if (this.shadowMap) {\n this.shadowMap.destroy();\n this.shadowMap = null;\n }\n if (this.depthBuffer) {\n this.depthBuffer.destroy();\n this.depthBuffer = null;\n }\n }\n}\n", "export class TypedArrayManager {\n constructor(options = {}) {\n this._pool = [];\n this.opts = { overAlloc: 2, poolSize: 100 };\n this.setOptions(options);\n }\n setOptions(options) {\n Object.assign(this.opts, options);\n }\n allocate(typedArray, count, { size = 1, type, padding = 0, copy = false, initialize = false, maxCount }) {\n const Type = type || (typedArray && typedArray.constructor) || Float32Array;\n const newSize = count * size + padding;\n if (ArrayBuffer.isView(typedArray)) {\n if (newSize <= typedArray.length) {\n return typedArray;\n }\n if (newSize * typedArray.BYTES_PER_ELEMENT <= typedArray.buffer.byteLength) {\n return new Type(typedArray.buffer, 0, newSize);\n }\n }\n let maxSize = Infinity;\n if (maxCount) {\n maxSize = maxCount * size + padding;\n }\n const newArray = this._allocate(Type, newSize, initialize, maxSize);\n if (typedArray && copy) {\n newArray.set(typedArray);\n }\n else if (!initialize) {\n // Hack - always initialize the first 4 elements. NaNs crash the Attribute validation\n newArray.fill(0, 0, 4);\n }\n this._release(typedArray);\n return newArray;\n }\n release(typedArray) {\n this._release(typedArray);\n }\n _allocate(Type, size, initialize, maxSize) {\n // Allocate at least one element to ensure a valid buffer\n let sizeToAllocate = Math.max(Math.ceil(size * this.opts.overAlloc), 1);\n // Don't over allocate after certain specified number of elements\n if (sizeToAllocate > maxSize) {\n sizeToAllocate = maxSize;\n }\n // Check if available in pool\n const pool = this._pool;\n const byteLength = Type.BYTES_PER_ELEMENT * sizeToAllocate;\n const i = pool.findIndex(b => b.byteLength >= byteLength);\n if (i >= 0) {\n // Create a new array using an existing buffer\n const array = new Type(pool.splice(i, 1)[0], 0, sizeToAllocate);\n if (initialize) {\n // Viewing a buffer with a different type may create NaNs\n array.fill(0);\n }\n return array;\n }\n return new Type(sizeToAllocate);\n }\n _release(typedArray) {\n if (!ArrayBuffer.isView(typedArray)) {\n return;\n }\n const pool = this._pool;\n const { buffer } = typedArray;\n // Save the buffer of the released array into the pool\n // Sort buffers by size\n // TODO - implement binary search?\n const { byteLength } = buffer;\n const i = pool.findIndex(b => b.byteLength >= byteLength);\n if (i < 0) {\n pool.push(buffer);\n }\n else if (i > 0 || pool.length < this.opts.poolSize) {\n pool.splice(i, 0, buffer);\n }\n if (pool.length > this.opts.poolSize) {\n // Drop the smallest one\n pool.shift();\n }\n }\n}\nexport default new TypedArrayManager();\n", "// Extensions to math.gl library. Intended to be folded back.\nimport typedArrayManager from \"./typed-array-manager.js\";\nimport { Vector3 } from '@math.gl/core';\n// Helper, avoids low-precision 32 bit matrices from gl-matrix mat4.create()\nexport function createMat4() {\n return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\n}\nexport function mod(value, divisor) {\n const modulus = value % divisor;\n return modulus < 0 ? divisor + modulus : modulus;\n}\n// Extract camera vectors (move to math library?)\nexport function getCameraPosition(viewMatrixInverse) {\n // Read the translation from the inverse view matrix\n return [viewMatrixInverse[12], viewMatrixInverse[13], viewMatrixInverse[14]];\n}\n// https://www.gamedevs.org/uploads/fast-extraction-viewing-frustum-planes-from-world-view-projection-matrix.pdf\nexport function getFrustumPlanes(viewProjectionMatrix) {\n return {\n left: getFrustumPlane(viewProjectionMatrix[3] + viewProjectionMatrix[0], viewProjectionMatrix[7] + viewProjectionMatrix[4], viewProjectionMatrix[11] + viewProjectionMatrix[8], viewProjectionMatrix[15] + viewProjectionMatrix[12]),\n right: getFrustumPlane(viewProjectionMatrix[3] - viewProjectionMatrix[0], viewProjectionMatrix[7] - viewProjectionMatrix[4], viewProjectionMatrix[11] - viewProjectionMatrix[8], viewProjectionMatrix[15] - viewProjectionMatrix[12]),\n bottom: getFrustumPlane(viewProjectionMatrix[3] + viewProjectionMatrix[1], viewProjectionMatrix[7] + viewProjectionMatrix[5], viewProjectionMatrix[11] + viewProjectionMatrix[9], viewProjectionMatrix[15] + viewProjectionMatrix[13]),\n top: getFrustumPlane(viewProjectionMatrix[3] - viewProjectionMatrix[1], viewProjectionMatrix[7] - viewProjectionMatrix[5], viewProjectionMatrix[11] - viewProjectionMatrix[9], viewProjectionMatrix[15] - viewProjectionMatrix[13]),\n near: getFrustumPlane(viewProjectionMatrix[3] + viewProjectionMatrix[2], viewProjectionMatrix[7] + viewProjectionMatrix[6], viewProjectionMatrix[11] + viewProjectionMatrix[10], viewProjectionMatrix[15] + viewProjectionMatrix[14]),\n far: getFrustumPlane(viewProjectionMatrix[3] - viewProjectionMatrix[2], viewProjectionMatrix[7] - viewProjectionMatrix[6], viewProjectionMatrix[11] - viewProjectionMatrix[10], viewProjectionMatrix[15] - viewProjectionMatrix[14])\n };\n}\nconst scratchVector = new Vector3();\nfunction getFrustumPlane(a, b, c, d) {\n scratchVector.set(a, b, c);\n const L = scratchVector.len();\n return { distance: d / L, normal: new Vector3(-a / L, -b / L, -c / L) };\n}\n/**\n * Calculate the low part of a WebGL 64 bit float\n * @param x {number} - the input float number\n * @returns {number} - the lower 32 bit of the number\n */\nexport function fp64LowPart(x) {\n return x - Math.fround(x);\n}\nlet scratchArray;\n/**\n * Split a Float64Array into a double-length Float32Array\n * @param typedArray\n * @param options\n * @param options.size - per attribute size\n * @param options.startIndex - start index in the source array\n * @param options.endIndex - end index in the source array\n * @returns {} - high part, low part for each attribute:\n [1xHi, 1yHi, 1zHi, 1xLow, 1yLow, 1zLow, 2xHi, ...]\n */\nexport function toDoublePrecisionArray(typedArray, options) {\n const { size = 1, startIndex = 0 } = options;\n const endIndex = options.endIndex !== undefined ? options.endIndex : typedArray.length;\n const count = (endIndex - startIndex) / size;\n scratchArray = typedArrayManager.allocate(scratchArray, count, {\n type: Float32Array,\n size: size * 2\n });\n let sourceIndex = startIndex;\n let targetIndex = 0;\n while (sourceIndex < endIndex) {\n for (let j = 0; j < size; j++) {\n const value = typedArray[sourceIndex++];\n scratchArray[targetIndex + j] = value;\n scratchArray[targetIndex + j + size] = fp64LowPart(value);\n }\n targetIndex += size * 2;\n }\n return scratchArray.subarray(0, count * size * 2);\n}\nexport function mergeBounds(boundsList) {\n let mergedBounds = null;\n let isMerged = false;\n for (const bounds of boundsList) {\n /* eslint-disable-next-line no-continue */\n if (!bounds)\n continue;\n if (!mergedBounds) {\n mergedBounds = bounds;\n }\n else {\n if (!isMerged) {\n // Copy to avoid mutating input bounds\n mergedBounds = [\n [mergedBounds[0][0], mergedBounds[0][1]],\n [mergedBounds[1][0], mergedBounds[1][1]]\n ];\n isMerged = true;\n }\n mergedBounds[0][0] = Math.min(mergedBounds[0][0], bounds[0][0]);\n mergedBounds[0][1] = Math.min(mergedBounds[0][1], bounds[0][1]);\n mergedBounds[1][0] = Math.max(mergedBounds[1][0], bounds[1][0]);\n mergedBounds[1][1] = Math.max(mergedBounds[1][1], bounds[1][1]);\n }\n }\n return mergedBounds;\n}\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport log from \"../utils/log.js\";\nimport { createMat4, getCameraPosition, getFrustumPlanes } from \"../utils/math-utils.js\";\nimport { Matrix4, Vector3, equals, clamp, mat4 } from '@math.gl/core';\nimport { getDistanceScales, getMeterZoom, lngLatToWorld, worldToLngLat, worldToPixels, pixelsToWorld } from '@math.gl/web-mercator';\nimport { PROJECTION_MODE } from \"../lib/constants.js\";\nconst DEGREES_TO_RADIANS = Math.PI / 180;\nconst IDENTITY = createMat4();\nconst ZERO_VECTOR = [0, 0, 0];\nconst DEFAULT_DISTANCE_SCALES = {\n unitsPerMeter: [1, 1, 1],\n metersPerUnit: [1, 1, 1]\n};\n// / Helpers\nfunction createProjectionMatrix({ width, height, orthographic, fovyRadians, focalDistance, padding, near, far }) {\n const aspect = width / height;\n const matrix = orthographic\n ? new Matrix4().orthographic({ fovy: fovyRadians, aspect, focalDistance, near, far })\n : new Matrix4().perspective({ fovy: fovyRadians, aspect, near, far });\n if (padding) {\n const { left = 0, right = 0, top = 0, bottom = 0 } = padding;\n const offsetX = clamp((left + width - right) / 2, 0, width) - width / 2;\n const offsetY = clamp((top + height - bottom) / 2, 0, height) - height / 2;\n // pixels to clip space\n matrix[8] -= (offsetX * 2) / width;\n matrix[9] += (offsetY * 2) / height;\n }\n return matrix;\n}\n/**\n * Manages coordinate system transformations.\n *\n * Note: The Viewport is immutable in the sense that it only has accessors.\n * A new viewport instance should be created if any parameters have changed.\n */\nclass Viewport {\n // eslint-disable-next-line complexity\n constructor(opts = {}) {\n this._frustumPlanes = {};\n // @ts-ignore\n this.id = opts.id || this.constructor.displayName || 'viewport';\n this.x = opts.x || 0;\n this.y = opts.y || 0;\n // Silently allow apps to send in w,h = 0,0\n this.width = opts.width || 1;\n this.height = opts.height || 1;\n this.zoom = opts.zoom || 0;\n this.padding = opts.padding;\n this.distanceScales = opts.distanceScales || DEFAULT_DISTANCE_SCALES;\n this.focalDistance = opts.focalDistance || 1;\n this.position = opts.position || ZERO_VECTOR;\n this.modelMatrix = opts.modelMatrix || null;\n const { longitude, latitude } = opts;\n this.isGeospatial = Number.isFinite(latitude) && Number.isFinite(longitude);\n this._initProps(opts);\n this._initMatrices(opts);\n // Bind methods for easy access\n this.equals = this.equals.bind(this);\n this.project = this.project.bind(this);\n this.unproject = this.unproject.bind(this);\n this.projectPosition = this.projectPosition.bind(this);\n this.unprojectPosition = this.unprojectPosition.bind(this);\n this.projectFlat = this.projectFlat.bind(this);\n this.unprojectFlat = this.unprojectFlat.bind(this);\n }\n get subViewports() {\n return null;\n }\n get metersPerPixel() {\n return this.distanceScales.metersPerUnit[2] / this.scale;\n }\n get projectionMode() {\n if (this.isGeospatial) {\n return this.zoom < 12\n ? PROJECTION_MODE.WEB_MERCATOR\n : PROJECTION_MODE.WEB_MERCATOR_AUTO_OFFSET;\n }\n return PROJECTION_MODE.IDENTITY;\n }\n // Two viewports are equal if width and height are identical, and if\n // their view and projection matrices are (approximately) equal.\n equals(viewport) {\n if (!(viewport instanceof Viewport)) {\n return false;\n }\n if (this === viewport) {\n return true;\n }\n return (viewport.width === this.width &&\n viewport.height === this.height &&\n viewport.scale === this.scale &&\n equals(viewport.projectionMatrix, this.projectionMatrix) &&\n equals(viewport.viewMatrix, this.viewMatrix));\n // TODO - check distance scales?\n }\n /**\n * Projects xyz (possibly latitude and longitude) to pixel coordinates in window\n * using viewport projection parameters\n * - [longitude, latitude] to [x, y]\n * - [longitude, latitude, Z] => [x, y, z]\n * Note: By default, returns top-left coordinates for canvas/SVG type render\n *\n * @param {Array} lngLatZ - [lng, lat] or [lng, lat, Z]\n * @param {Object} opts - options\n * @param {Object} opts.topLeft=true - Whether projected coords are top left\n * @return {Array} - [x, y] or [x, y, z] in top left coords\n */\n project(xyz, { topLeft = true } = {}) {\n const worldPosition = this.projectPosition(xyz);\n const coord = worldToPixels(worldPosition, this.pixelProjectionMatrix);\n const [x, y] = coord;\n const y2 = topLeft ? y : this.height - y;\n return xyz.length === 2 ? [x, y2] : [x, y2, coord[2]];\n }\n /**\n * Unproject pixel coordinates on screen onto world coordinates,\n * (possibly [lon, lat]) on map.\n * - [x, y] => [lng, lat]\n * - [x, y, z] => [lng, lat, Z]\n * @param {Array} xyz -\n * @param {Object} opts - options\n * @param {Object} opts.topLeft=true - Whether origin is top left\n * @return {Array|null} - [lng, lat, Z] or [X, Y, Z]\n */\n unproject(xyz, { topLeft = true, targetZ } = {}) {\n const [x, y, z] = xyz;\n const y2 = topLeft ? y : this.height - y;\n const targetZWorld = targetZ && targetZ * this.distanceScales.unitsPerMeter[2];\n const coord = pixelsToWorld([x, y2, z], this.pixelUnprojectionMatrix, targetZWorld);\n const [X, Y, Z] = this.unprojectPosition(coord);\n if (Number.isFinite(z)) {\n return [X, Y, Z];\n }\n return Number.isFinite(targetZ) ? [X, Y, targetZ] : [X, Y];\n }\n // NON_LINEAR PROJECTION HOOKS\n // Used for web meractor projection\n projectPosition(xyz) {\n const [X, Y] = this.projectFlat(xyz);\n const Z = (xyz[2] || 0) * this.distanceScales.unitsPerMeter[2];\n return [X, Y, Z];\n }\n unprojectPosition(xyz) {\n const [X, Y] = this.unprojectFlat(xyz);\n const Z = (xyz[2] || 0) * this.distanceScales.metersPerUnit[2];\n return [X, Y, Z];\n }\n /**\n * Project [lng,lat] on sphere onto [x,y] on 512*512 Mercator Zoom 0 tile.\n * Performs the nonlinear part of the web mercator projection.\n * Remaining projection is done with 4x4 matrices which also handles\n * perspective.\n * @param {Array} lngLat - [lng, lat] coordinates\n * Specifies a point on the sphere to project onto the map.\n * @return {Array} [x,y] coordinates.\n */\n projectFlat(xyz) {\n if (this.isGeospatial) {\n // Shader clamps latitude to +-89.9, see /shaderlib/project/project.glsl.js\n // lngLatToWorld([0, -89.9])[1] = -317.9934163758329\n // lngLatToWorld([0, 89.9])[1] = 829.9934163758271\n const result = lngLatToWorld(xyz);\n result[1] = clamp(result[1], -318, 830);\n return result;\n }\n return xyz;\n }\n /**\n * Unproject world point [x,y] on map onto {lat, lon} on sphere\n * @param {object|Vector} xy - object with {x,y} members\n * representing point on projected map plane\n * @return {GeoCoordinates} - object with {lat,lon} of point on sphere.\n * Has toArray method if you need a GeoJSON Array.\n * Per cartographic tradition, lat and lon are specified as degrees.\n */\n unprojectFlat(xyz) {\n if (this.isGeospatial) {\n return worldToLngLat(xyz);\n }\n return xyz;\n }\n /**\n * Get bounds of the current viewport\n * @return {Array} - [minX, minY, maxX, maxY]\n */\n getBounds(options = {}) {\n const unprojectOption = { targetZ: options.z || 0 };\n const topLeft = this.unproject([0, 0], unprojectOption);\n const topRight = this.unproject([this.width, 0], unprojectOption);\n const bottomLeft = this.unproject([0, this.height], unprojectOption);\n const bottomRight = this.unproject([this.width, this.height], unprojectOption);\n return [\n Math.min(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]),\n Math.min(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]),\n Math.max(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]),\n Math.max(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1])\n ];\n }\n getDistanceScales(coordinateOrigin) {\n if (coordinateOrigin) {\n return getDistanceScales({\n longitude: coordinateOrigin[0],\n latitude: coordinateOrigin[1],\n highPrecision: true\n });\n }\n return this.distanceScales;\n }\n containsPixel({ x, y, width = 1, height = 1 }) {\n return (x < this.x + this.width &&\n this.x < x + width &&\n y < this.y + this.height &&\n this.y < y + height);\n }\n // Extract frustum planes in common space\n getFrustumPlanes() {\n if (this._frustumPlanes.near) {\n // @ts-ignore\n return this._frustumPlanes;\n }\n Object.assign(this._frustumPlanes, getFrustumPlanes(this.viewProjectionMatrix));\n // @ts-ignore\n return this._frustumPlanes;\n }\n // EXPERIMENTAL METHODS\n /**\n * Needed by panning and linear transition\n * Pan the viewport to place a given world coordinate at screen point [x, y]\n *\n * @param {Array} coords - world coordinates\n * @param {Array} pixel - [x,y] coordinates on screen\n * @return {Object} props of the new viewport\n */\n panByPosition(coords, pixel) {\n return null;\n }\n // INTERNAL METHODS\n /* eslint-disable complexity, max-statements */\n _initProps(opts) {\n const longitude = opts.longitude;\n const latitude = opts.latitude;\n if (this.isGeospatial) {\n if (!Number.isFinite(opts.zoom)) {\n this.zoom = getMeterZoom({ latitude }) + Math.log2(this.focalDistance);\n }\n this.distanceScales = opts.distanceScales || getDistanceScales({ latitude, longitude });\n }\n const scale = Math.pow(2, this.zoom);\n this.scale = scale;\n const { position, modelMatrix } = opts;\n let meterOffset = ZERO_VECTOR;\n if (position) {\n meterOffset = modelMatrix\n ? new Matrix4(modelMatrix).transformAsVector(position, [])\n : position;\n }\n if (this.isGeospatial) {\n // Determine camera center in common space\n const center = this.projectPosition([longitude, latitude, 0]);\n this.center = new Vector3(meterOffset)\n // Convert to pixels in current zoom\n .scale(this.distanceScales.unitsPerMeter)\n .add(center);\n }\n else {\n this.center = this.projectPosition(meterOffset);\n }\n }\n /* eslint-enable complexity, max-statements */\n _initMatrices(opts) {\n const { \n // View matrix\n viewMatrix = IDENTITY, \n // Projection matrix\n projectionMatrix = null, \n // Projection matrix parameters, used if projectionMatrix not supplied\n orthographic = false, fovyRadians, fovy = 75, near = 0.1, // Distance of near clipping plane\n far = 1000, // Distance of far clipping plane\n padding = null, // Center offset in pixels\n focalDistance = 1 } = opts;\n this.viewMatrixUncentered = viewMatrix;\n // Make a centered version of the matrix for projection modes without an offset\n this.viewMatrix = new Matrix4()\n // Apply the uncentered view matrix\n .multiplyRight(viewMatrix)\n // And center it\n .translate(new Vector3(this.center).negate());\n this.projectionMatrix =\n projectionMatrix ||\n createProjectionMatrix({\n width: this.width,\n height: this.height,\n orthographic,\n fovyRadians: fovyRadians || fovy * DEGREES_TO_RADIANS,\n focalDistance,\n padding,\n near,\n far\n });\n // Note: As usual, matrix operations should be applied in \"reverse\" order\n // since vectors will be multiplied in from the right during transformation\n const vpm = createMat4();\n mat4.multiply(vpm, vpm, this.projectionMatrix);\n mat4.multiply(vpm, vpm, this.viewMatrix);\n this.viewProjectionMatrix = vpm;\n // console.log('VPM', this.viewMatrix, this.projectionMatrix, this.viewProjectionMatrix);\n // Calculate inverse view matrix\n this.viewMatrixInverse = mat4.invert([], this.viewMatrix) || this.viewMatrix;\n // Decompose camera parameters\n this.cameraPosition = getCameraPosition(this.viewMatrixInverse);\n /*\n * Builds matrices that converts preprojected lngLats to screen pixels\n * and vice versa.\n * Note: Currently returns bottom-left coordinates!\n * Note: Starts with the GL projection matrix and adds steps to the\n * scale and translate that matrix onto the window.\n * Note: WebGL controls clip space to screen projection with gl.viewport\n * and does not need this step.\n */\n // matrix for conversion from world location to screen (pixel) coordinates\n const viewportMatrix = createMat4(); // matrix from NDC to viewport.\n const pixelProjectionMatrix = createMat4(); // matrix from world space to viewport.\n mat4.scale(viewportMatrix, viewportMatrix, [this.width / 2, -this.height / 2, 1]);\n mat4.translate(viewportMatrix, viewportMatrix, [1, -1, 0]);\n mat4.multiply(pixelProjectionMatrix, viewportMatrix, this.viewProjectionMatrix);\n this.pixelProjectionMatrix = pixelProjectionMatrix;\n this.pixelUnprojectionMatrix = mat4.invert(createMat4(), this.pixelProjectionMatrix);\n if (!this.pixelUnprojectionMatrix) {\n log.warn('Pixel project matrix not invertible')();\n // throw new Error('Pixel project matrix not invertible');\n }\n }\n}\nViewport.displayName = 'Viewport';\nexport default Viewport;\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n// View and Projection Matrix calculations for mapbox-js style\n// map view properties\nimport Viewport from \"./viewport.js\";\nimport { pixelsToWorld, getViewMatrix, addMetersToLngLat, unitsPerMeter, getProjectionParameters, altitudeToFovy, fovyToAltitude, fitBounds, getBounds } from '@math.gl/web-mercator';\nimport { Matrix4, clamp, vec2 } from '@math.gl/core';\n/**\n * Manages transformations to/from WGS84 coordinates using the Web Mercator Projection.\n */\nclass WebMercatorViewport extends Viewport {\n /* eslint-disable complexity, max-statements */\n constructor(opts = {}) {\n const { latitude = 0, longitude = 0, zoom = 0, pitch = 0, bearing = 0, nearZMultiplier = 0.1, farZMultiplier = 1.01, nearZ, farZ, orthographic = false, projectionMatrix, repeat = false, worldOffset = 0, position, padding, \n // backward compatibility\n // TODO: remove in v9\n legacyMeterSizes = false } = opts;\n let { width, height, altitude = 1.5 } = opts;\n const scale = Math.pow(2, zoom);\n // Silently allow apps to send in 0,0 to facilitate isomorphic render etc\n width = width || 1;\n height = height || 1;\n let fovy;\n let projectionParameters = null;\n if (projectionMatrix) {\n altitude = projectionMatrix[5] / 2;\n fovy = altitudeToFovy(altitude);\n }\n else {\n if (opts.fovy) {\n fovy = opts.fovy;\n altitude = fovyToAltitude(fovy);\n }\n else {\n fovy = altitudeToFovy(altitude);\n }\n let offset;\n if (padding) {\n const { top = 0, bottom = 0 } = padding;\n offset = [0, clamp((top + height - bottom) / 2, 0, height) - height / 2];\n }\n projectionParameters = getProjectionParameters({\n width,\n height,\n scale,\n center: position && [0, 0, position[2] * unitsPerMeter(latitude)],\n offset,\n pitch,\n fovy,\n nearZMultiplier,\n farZMultiplier\n });\n if (Number.isFinite(nearZ)) {\n projectionParameters.near = nearZ;\n }\n if (Number.isFinite(farZ)) {\n projectionParameters.far = farZ;\n }\n }\n // The uncentered matrix allows us two move the center addition to the\n // shader (cheap) which gives a coordinate system that has its center in\n // the layer's center position. This makes rotations and other modelMatrx\n // transforms much more useful.\n let viewMatrixUncentered = getViewMatrix({\n height,\n pitch,\n bearing,\n scale,\n altitude\n });\n if (worldOffset) {\n const viewOffset = new Matrix4().translate([512 * worldOffset, 0, 0]);\n viewMatrixUncentered = viewOffset.multiplyLeft(viewMatrixUncentered);\n }\n super({\n ...opts,\n // x, y,\n width,\n height,\n // view matrix\n viewMatrix: viewMatrixUncentered,\n longitude,\n latitude,\n zoom,\n // projection matrix parameters\n ...projectionParameters,\n fovy,\n focalDistance: altitude\n });\n // Save parameters\n this.latitude = latitude;\n this.longitude = longitude;\n this.zoom = zoom;\n this.pitch = pitch;\n this.bearing = bearing;\n this.altitude = altitude;\n this.fovy = fovy;\n this.orthographic = orthographic;\n this._subViewports = repeat ? [] : null;\n this._pseudoMeters = legacyMeterSizes;\n Object.freeze(this);\n }\n /* eslint-enable complexity, max-statements */\n get subViewports() {\n if (this._subViewports && !this._subViewports.length) {\n // Cache sub viewports so that we only calculate them once\n const bounds = this.getBounds();\n const minOffset = Math.floor((bounds[0] + 180) / 360);\n const maxOffset = Math.ceil((bounds[2] - 180) / 360);\n for (let x = minOffset; x <= maxOffset; x++) {\n const offsetViewport = x\n ? new WebMercatorViewport({\n ...this,\n worldOffset: x\n })\n : this;\n this._subViewports.push(offsetViewport);\n }\n }\n return this._subViewports;\n }\n projectPosition(xyz) {\n if (this._pseudoMeters) {\n // Backward compatibility\n return super.projectPosition(xyz);\n }\n const [X, Y] = this.projectFlat(xyz);\n const Z = (xyz[2] || 0) * unitsPerMeter(xyz[1]);\n return [X, Y, Z];\n }\n unprojectPosition(xyz) {\n if (this._pseudoMeters) {\n // Backward compatibility\n return super.unprojectPosition(xyz);\n }\n const [X, Y] = this.unprojectFlat(xyz);\n const Z = (xyz[2] || 0) / unitsPerMeter(Y);\n return [X, Y, Z];\n }\n /**\n * Add a meter delta to a base lnglat coordinate, returning a new lnglat array\n *\n * Note: Uses simple linear approximation around the viewport center\n * Error increases with size of offset (roughly 1% per 100km)\n *\n * @param {[Number,Number]|[Number,Number,Number]) lngLatZ - base coordinate\n * @param {[Number,Number]|[Number,Number,Number]) xyz - array of meter deltas\n * @return {[Number,Number]|[Number,Number,Number]) array of [lng,lat,z] deltas\n */\n addMetersToLngLat(lngLatZ, xyz) {\n return addMetersToLngLat(lngLatZ, xyz);\n }\n panByPosition(coords, pixel) {\n const fromLocation = pixelsToWorld(pixel, this.pixelUnprojectionMatrix);\n const toLocation = this.projectFlat(coords);\n const translate = vec2.add([], toLocation, vec2.negate([], fromLocation));\n const newCenter = vec2.add([], this.center, translate);\n const [longitude, latitude] = this.unprojectFlat(newCenter);\n return { longitude, latitude };\n }\n getBounds(options = {}) {\n // @ts-ignore\n const corners = getBounds(this, options.z || 0);\n return [\n Math.min(corners[0][0], corners[1][0], corners[2][0], corners[3][0]),\n Math.min(corners[0][1], corners[1][1], corners[2][1], corners[3][1]),\n Math.max(corners[0][0], corners[1][0], corners[2][0], corners[3][0]),\n Math.max(corners[0][1], corners[1][1], corners[2][1], corners[3][1])\n ];\n }\n /**\n * Returns a new viewport that fit around the given rectangle.\n * Only supports non-perspective mode.\n */\n fitBounds(\n /** [[lon, lat], [lon, lat]] */\n bounds, options = {}) {\n const { width, height } = this;\n const { longitude, latitude, zoom } = fitBounds({ width, height, bounds, ...options });\n return new WebMercatorViewport({ width, height, longitude, latitude, zoom });\n }\n}\nWebMercatorViewport.displayName = 'WebMercatorViewport';\nexport default WebMercatorViewport;\n", "/**\n * Projection utils\n * TODO: move to Viewport class?\n */\nimport { COORDINATE_SYSTEM } from \"../../lib/constants.js\";\nimport { getOffsetOrigin } from \"./viewport-uniforms.js\";\nimport WebMercatorViewport from \"../../viewports/web-mercator-viewport.js\";\nimport { vec3, vec4 } from '@math.gl/core';\nimport { addMetersToLngLat } from '@math.gl/web-mercator';\nconst DEFAULT_COORDINATE_ORIGIN = [0, 0, 0];\n// In project.glsl, offset modes calculate z differently from LNG_LAT mode.\n// offset modes apply the y adjustment (unitsPerMeter2) when projecting z\n// LNG_LAT mode only use the linear scale.\nfunction lngLatZToWorldPosition(lngLatZ, viewport, offsetMode = false) {\n const p = viewport.projectPosition(lngLatZ);\n // TODO - avoid using instanceof\n if (offsetMode && viewport instanceof WebMercatorViewport) {\n const [longitude, latitude, z = 0] = lngLatZ;\n const distanceScales = viewport.getDistanceScales([longitude, latitude]);\n p[2] = z * distanceScales.unitsPerMeter[2];\n }\n return p;\n}\nfunction normalizeParameters(opts) {\n const { viewport, modelMatrix, coordinateOrigin } = opts;\n let { coordinateSystem, fromCoordinateSystem, fromCoordinateOrigin } = opts;\n if (coordinateSystem === COORDINATE_SYSTEM.DEFAULT) {\n coordinateSystem = viewport.isGeospatial\n ? COORDINATE_SYSTEM.LNGLAT\n : COORDINATE_SYSTEM.CARTESIAN;\n }\n if (fromCoordinateSystem === undefined) {\n fromCoordinateSystem = coordinateSystem;\n }\n if (fromCoordinateOrigin === undefined) {\n fromCoordinateOrigin = coordinateOrigin;\n }\n return {\n viewport,\n coordinateSystem,\n coordinateOrigin,\n modelMatrix,\n fromCoordinateSystem,\n fromCoordinateOrigin\n };\n}\n/** Get the common space position from world coordinates in the given coordinate system */\nexport function getWorldPosition(position, { viewport, modelMatrix, coordinateSystem, coordinateOrigin, offsetMode }) {\n let [x, y, z = 0] = position;\n if (modelMatrix) {\n [x, y, z] = vec4.transformMat4([], [x, y, z, 1.0], modelMatrix);\n }\n switch (coordinateSystem) {\n case COORDINATE_SYSTEM.LNGLAT:\n return lngLatZToWorldPosition([x, y, z], viewport, offsetMode);\n case COORDINATE_SYSTEM.LNGLAT_OFFSETS:\n return lngLatZToWorldPosition([x + coordinateOrigin[0], y + coordinateOrigin[1], z + (coordinateOrigin[2] || 0)], viewport, offsetMode);\n case COORDINATE_SYSTEM.METER_OFFSETS:\n return lngLatZToWorldPosition(addMetersToLngLat(coordinateOrigin, [x, y, z]), viewport, offsetMode);\n case COORDINATE_SYSTEM.CARTESIAN:\n default:\n return viewport.isGeospatial\n ? [x + coordinateOrigin[0], y + coordinateOrigin[1], z + coordinateOrigin[2]]\n : viewport.projectPosition([x, y, z]);\n }\n}\n/**\n * Equivalent to project_position in project.glsl\n * projects a user supplied position to world position directly with or without\n * a reference coordinate system\n */\nexport function projectPosition(position, params) {\n const { viewport, coordinateSystem, coordinateOrigin, modelMatrix, fromCoordinateSystem, fromCoordinateOrigin } = normalizeParameters(params);\n const { autoOffset = true } = params;\n const { geospatialOrigin = DEFAULT_COORDINATE_ORIGIN, shaderCoordinateOrigin = DEFAULT_COORDINATE_ORIGIN, offsetMode = false } = autoOffset ? getOffsetOrigin(viewport, coordinateSystem, coordinateOrigin) : {};\n const worldPosition = getWorldPosition(position, {\n viewport,\n modelMatrix,\n coordinateSystem: fromCoordinateSystem,\n coordinateOrigin: fromCoordinateOrigin,\n offsetMode\n });\n if (offsetMode) {\n const positionCommonSpace = viewport.projectPosition(geospatialOrigin || shaderCoordinateOrigin);\n vec3.sub(worldPosition, worldPosition, positionCommonSpace);\n }\n return worldPosition;\n}\n", "import { projectPosition } from \"../../shaderlib/project/project-functions.js\";\nimport { COORDINATE_SYSTEM } from \"../../lib/constants.js\";\nconst DEFAULT_LIGHT_COLOR = [255, 255, 255];\nconst DEFAULT_LIGHT_INTENSITY = 1.0;\nconst DEFAULT_ATTENUATION = [0, 0, 1];\nconst DEFAULT_LIGHT_POSITION = [0.0, 0.0, 1.0];\nlet idCount = 0;\nexport class PointLight {\n constructor(props = {}) {\n this.type = 'point';\n const { color = DEFAULT_LIGHT_COLOR } = props;\n const { intensity = DEFAULT_LIGHT_INTENSITY } = props;\n const { position = DEFAULT_LIGHT_POSITION } = props;\n this.id = props.id || `point-${idCount++}`;\n this.color = color;\n this.intensity = intensity;\n this.type = 'point';\n this.position = position;\n this.attenuation = getAttenuation(props);\n this.projectedLight = { ...this };\n }\n getProjectedLight({ layer }) {\n const { projectedLight } = this;\n const viewport = layer.context.viewport;\n const { coordinateSystem, coordinateOrigin } = layer.props;\n const position = projectPosition(this.position, {\n viewport,\n coordinateSystem,\n coordinateOrigin,\n fromCoordinateSystem: viewport.isGeospatial\n ? COORDINATE_SYSTEM.LNGLAT\n : COORDINATE_SYSTEM.CARTESIAN,\n fromCoordinateOrigin: [0, 0, 0]\n });\n projectedLight.color = this.color;\n projectedLight.intensity = this.intensity;\n projectedLight.position = position;\n return projectedLight;\n }\n}\nfunction getAttenuation(props) {\n if (props.attenuation) {\n return props.attenuation;\n }\n if ('intensity' in props) {\n return [0, 0, props.intensity || 0];\n }\n return DEFAULT_ATTENUATION;\n}\n", "/* eslint-disable camelcase */\nimport { PointLight } from \"./point-light.js\";\nimport { getUniformsFromViewport } from \"../../shaderlib/project/viewport-uniforms.js\";\nexport default class CameraLight extends PointLight {\n getProjectedLight({ layer }) {\n const { projectedLight } = this;\n const viewport = layer.context.viewport;\n const { coordinateSystem, coordinateOrigin, modelMatrix } = layer.props;\n const { project_uCameraPosition } = getUniformsFromViewport({\n viewport,\n modelMatrix,\n coordinateSystem,\n coordinateOrigin\n });\n projectedLight.color = this.color;\n projectedLight.intensity = this.intensity;\n projectedLight.position = project_uCameraPosition;\n return projectedLight;\n }\n}\n", "import { DirectionalLight } from \"./directional-light.js\";\nimport { getSunDirection } from '@math.gl/sun';\nexport default class SunLight extends DirectionalLight {\n constructor(opts) {\n super(opts);\n this.timestamp = opts.timestamp;\n }\n getProjectedLight({ layer }) {\n const { viewport } = layer.context;\n const isGlobe = viewport.resolution && viewport.resolution > 0;\n if (isGlobe) {\n // Rotate vector to align with the direction of the globe projection (up at lon:0,lat:0 is [0, -1, 0])\n const [x, y, z] = getSunDirection(this.timestamp, 0, 0);\n this.direction = [x, -z, y];\n }\n else {\n // @ts-expect-error longitude and latitude are not defined on all viewports\n const { latitude, longitude } = viewport;\n this.direction = getSunDirection(this.timestamp, latitude, longitude);\n }\n return this;\n }\n}\n", "import { normalizeShaderModule } from '@luma.gl/shadertools';\nimport ScreenPass from \"../passes/screen-pass.js\";\nexport default class PostProcessEffect {\n constructor(module, props) {\n this.id = `${module.name}-pass`;\n this.props = props;\n normalizeShaderModule(module);\n this.module = module;\n }\n setup({ device }) {\n this.passes = createPasses(device, this.module, this.id);\n }\n setProps(props) {\n this.props = props;\n }\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n preRender() { }\n postRender(params) {\n const passes = this.passes;\n const { target } = params;\n let inputBuffer = params.inputBuffer;\n let outputBuffer = params.swapBuffer;\n for (let index = 0; index < passes.length; index++) {\n const isLastPass = index === passes.length - 1;\n const renderToTarget = target !== undefined && isLastPass;\n if (renderToTarget) {\n outputBuffer = target;\n }\n const clearCanvas = !renderToTarget || Boolean(params.clearCanvas);\n const moduleSettings = {};\n const uniforms = this.module.passes[index].uniforms;\n moduleSettings[this.module.name] = { ...this.props, ...uniforms };\n passes[index].render({ clearCanvas, inputBuffer, outputBuffer, moduleSettings });\n const switchBuffer = outputBuffer;\n outputBuffer = inputBuffer;\n inputBuffer = switchBuffer;\n }\n return inputBuffer;\n }\n cleanup() {\n if (this.passes) {\n for (const pass of this.passes) {\n pass.delete();\n }\n this.passes = undefined;\n }\n }\n}\nfunction createPasses(device, module, id) {\n return module.passes.map((pass, index) => {\n const fs = getFragmentShaderForRenderPass(module, pass);\n const idn = `${id}-${index}`;\n return new ScreenPass(device, { id: idn, module, fs });\n });\n}\nconst FS_TEMPLATE_INPUTS = `\\\n#version 300 es\nuniform sampler2D texSrc;\nuniform vec2 texSize;\n\nin vec2 position;\nin vec2 coordinate;\nin vec2 uv;\n\nout vec4 fragColor;\n`;\nconst FILTER_FS_TEMPLATE = (func) => `\\\n${FS_TEMPLATE_INPUTS}\nvoid main() {\n fragColor = texture(texSrc, coordinate);\n fragColor = ${func}(fragColor, texSize, coordinate);\n}\n`;\nconst SAMPLER_FS_TEMPLATE = (func) => `\\\n${FS_TEMPLATE_INPUTS}\nvoid main() {\n fragColor = ${func}(texSrc, texSize, coordinate);\n}\n`;\nfunction getFragmentShaderForRenderPass(module, pass) {\n if (pass.filter) {\n const func = typeof pass.filter === 'string' ? pass.filter : `${module.name}_filterColor`;\n return FILTER_FS_TEMPLATE(func);\n }\n if (pass.sampler) {\n const func = typeof pass.sampler === 'string' ? pass.sampler : `${module.name}_sampleColor`;\n return SAMPLER_FS_TEMPLATE(func);\n }\n // console.error(`${module.name} no fragment shader generated`);\n return '';\n}\n", "// Attribution: This class and the multipass system were inspired by\n// the THREE.js EffectComposer and *Pass classes\nimport { ClipSpace } from '@luma.gl/engine';\nimport Pass from \"./pass.js\";\n/** A base render pass. */\nexport default class ScreenPass extends Pass {\n constructor(device, props) {\n super(device, props);\n const { module, fs, id } = props;\n const parameters = { depthWriteEnabled: false, depthCompare: 'always' };\n this.model = new ClipSpace(device, { id, fs, modules: [module], parameters });\n }\n render(params) {\n this._renderPass(this.device, params);\n }\n delete() {\n this.model.destroy();\n this.model = null;\n }\n // Private methods\n /**\n * Renders the pass.\n * This is an abstract method that should be overridden.\n * @param inputBuffer - Frame buffer that contains the result of the previous pass\n * @param outputBuffer - Frame buffer that serves as the output render target\n */\n _renderPass(device, options) {\n const { clearCanvas, inputBuffer, outputBuffer } = options;\n const texSize = [inputBuffer.width, inputBuffer.height];\n this.model.shaderInputs.setProps(options.moduleSettings);\n this.model.setBindings({ texSrc: inputBuffer.colorAttachments[0] });\n this.model.setUniforms({ texSize });\n const renderPass = this.device.beginRenderPass({\n framebuffer: outputBuffer,\n parameters: { viewport: [0, 0, ...texSize] },\n clearColor: clearCanvas ? [0, 0, 0, 0] : false,\n clearDepth: 1\n });\n this.model.draw(renderPass);\n renderPass.end();\n }\n}\n", "import LayersPass from \"./layers-pass.js\";\nimport log from \"../utils/log.js\";\nconst PICKING_BLENDING = {\n blendColorOperation: 'add',\n blendColorSrcFactor: 'one',\n blendColorDstFactor: 'zero',\n blendAlphaOperation: 'add',\n blendAlphaSrcFactor: 'constant-alpha',\n blendAlphaDstFactor: 'zero'\n};\nexport default class PickLayersPass extends LayersPass {\n constructor() {\n super(...arguments);\n this._colorEncoderState = null;\n }\n render(props) {\n if ('pickingFBO' in props) {\n // When drawing into an off-screen buffer, use the alpha channel to encode layer index\n return this._drawPickingBuffer(props);\n }\n // When drawing to screen (debug mode), do not use the alpha channel so that result is always visible\n return super.render(props);\n }\n // Private\n // Draws list of layers and viewports into the picking buffer\n // Note: does not sample the buffer, that has to be done by the caller\n _drawPickingBuffer({ layers, layerFilter, views, viewports, onViewportActive, pickingFBO, deviceRect: { x, y, width, height }, cullRect, effects, pass = 'picking', pickZ, moduleParameters }) {\n this.pickZ = pickZ;\n const colorEncoderState = this._resetColorEncoder(pickZ);\n const scissorRect = [x, y, width, height];\n // Make sure we clear scissor test and fbo bindings in case of exceptions\n // We are only interested in one pixel, no need to render anything else\n // Note that the callback here is called synchronously.\n // Set blend mode for picking\n // always overwrite existing pixel with [r,g,b,layerIndex]\n const renderStatus = super.render({\n target: pickingFBO,\n layers,\n layerFilter,\n views,\n viewports,\n onViewportActive,\n cullRect,\n effects: effects?.filter(e => e.useInPicking),\n pass,\n isPicking: true,\n moduleParameters,\n clearColor: [0, 0, 0, 0],\n colorMask: 0xf,\n scissorRect\n });\n // Clear the temp field\n this._colorEncoderState = null;\n const decodePickingColor = colorEncoderState && decodeColor.bind(null, colorEncoderState);\n return { decodePickingColor, stats: renderStatus };\n }\n shouldDrawLayer(layer) {\n const { pickable, operation } = layer.props;\n return ((pickable && operation.includes('draw')) ||\n operation.includes('terrain') ||\n operation.includes('mask'));\n }\n getModuleParameters() {\n return {\n picking: {\n isActive: 1,\n isAttribute: this.pickZ\n },\n // turn off lighting by adding empty light source object\n // lights shader module relies on the `lightSources` to turn on/off lighting\n lightSources: {}\n };\n }\n getLayerParameters(layer, layerIndex, viewport) {\n const pickParameters = {\n // TODO - When used as a custom layer in older Mapbox versions, context\n // state was dirty. Mapbox fixed that; we should test and remove the workaround.\n // https://github.com/mapbox/mapbox-gl-js/issues/7801\n depthMask: true,\n depthTest: true,\n depthRange: [0, 1],\n ...layer.props.parameters\n };\n const { pickable, operation } = layer.props;\n if (!this._colorEncoderState || operation.includes('terrain')) {\n pickParameters.blend = false;\n }\n else if (pickable && operation.includes('draw')) {\n Object.assign(pickParameters, PICKING_BLENDING);\n pickParameters.blend = true;\n pickParameters.blendColor = encodeColor(this._colorEncoderState, layer, viewport);\n }\n return pickParameters;\n }\n _resetColorEncoder(pickZ) {\n // Track encoded layer indices\n this._colorEncoderState = pickZ\n ? null\n : {\n byLayer: new Map(),\n byAlpha: []\n };\n // Temporarily store it on the instance so that it can be accessed by this.getLayerParameters\n return this._colorEncoderState;\n }\n}\n// Assign an unique alpha value for each pickable layer and track the encoding in the cache object\n// Returns normalized blend color\nfunction encodeColor(encoded, layer, viewport) {\n const { byLayer, byAlpha } = encoded;\n let a;\n // Encode layerIndex in the alpha channel\n // TODO - combine small layers to better utilize the picking color space\n let entry = byLayer.get(layer);\n if (entry) {\n entry.viewports.push(viewport);\n a = entry.a;\n }\n else {\n a = byLayer.size + 1;\n if (a <= 255) {\n entry = { a, layer, viewports: [viewport] };\n byLayer.set(layer, entry);\n byAlpha[a] = entry;\n }\n else {\n log.warn('Too many pickable layers, only picking the first 255')();\n a = 0;\n }\n }\n return [0, 0, 0, a / 255];\n}\n// Given a picked color, retrieve the corresponding layer and viewports from cache\nfunction decodeColor(encoded, pickedColor) {\n const entry = encoded.byAlpha[pickedColor[3]];\n return (entry && {\n pickedLayer: entry.layer,\n pickedViewports: entry.viewports,\n pickedObjectIndex: entry.layer.decodePickingColor(pickedColor)\n });\n}\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport { Timeline } from '@luma.gl/engine';\nimport { getShaderAssembler } from \"../shaderlib/index.js\";\nimport { LIFECYCLE } from \"../lifecycle/constants.js\";\nimport log from \"../utils/log.js\";\nimport debug from \"../debug/index.js\";\nimport { flatten } from \"../utils/flatten.js\";\nimport { Stats } from '@probe.gl/stats';\nimport ResourceManager from \"./resource/resource-manager.js\";\nimport Viewport from \"../viewports/viewport.js\";\nconst TRACE_SET_LAYERS = 'layerManager.setLayers';\nconst TRACE_ACTIVATE_VIEWPORT = 'layerManager.activateViewport';\nexport default class LayerManager {\n /**\n * @param device\n * @param param1\n */\n // eslint-disable-next-line\n constructor(device, props) {\n this._lastRenderedLayers = [];\n this._needsRedraw = false;\n this._needsUpdate = false;\n this._nextLayers = null;\n this._debug = false;\n // This flag is separate from _needsUpdate because it can be set during an update and should trigger another full update\n this._defaultShaderModulesChanged = false;\n //\n // INTERNAL METHODS\n //\n /** Make a viewport \"current\" in layer context, updating viewportChanged flags */\n this.activateViewport = (viewport) => {\n debug(TRACE_ACTIVATE_VIEWPORT, this, viewport);\n if (viewport) {\n this.context.viewport = viewport;\n }\n };\n const { deck, stats, viewport, timeline } = props || {};\n // Currently deck.gl expects the DeckGL.layers array to be different\n // whenever React rerenders. If the same layers array is used, the\n // LayerManager's diffing algorithm will generate a fatal error and\n // break the rendering.\n // `this._lastRenderedLayers` stores the UNFILTERED layers sent\n // down to LayerManager, so that `layers` reference can be compared.\n // If it's the same across two React render calls, the diffing logic\n // will be skipped.\n this.layers = [];\n this.resourceManager = new ResourceManager({ device, protocol: 'deck://' });\n this.context = {\n mousePosition: null,\n userData: {},\n layerManager: this,\n device,\n // @ts-expect-error\n gl: device?.gl,\n deck,\n shaderAssembler: getShaderAssembler(),\n defaultShaderModules: [],\n renderPass: undefined,\n stats: stats || new Stats({ id: 'deck.gl' }),\n // Make sure context.viewport is not empty on the first layer initialization\n viewport: viewport || new Viewport({ id: 'DEFAULT-INITIAL-VIEWPORT' }), // Current viewport, exposed to layers for project* function\n timeline: timeline || new Timeline(),\n resourceManager: this.resourceManager,\n onError: undefined\n };\n Object.seal(this);\n }\n /** Method to call when the layer manager is not needed anymore. */\n finalize() {\n this.resourceManager.finalize();\n // Finalize all layers\n for (const layer of this.layers) {\n this._finalizeLayer(layer);\n }\n }\n /** Check if a redraw is needed */\n needsRedraw(opts = { clearRedrawFlags: false }) {\n let redraw = this._needsRedraw;\n if (opts.clearRedrawFlags) {\n this._needsRedraw = false;\n }\n // This layers list doesn't include sublayers, relying on composite layers\n for (const layer of this.layers) {\n // Call every layer to clear their flags\n const layerNeedsRedraw = layer.getNeedsRedraw(opts);\n redraw = redraw || layerNeedsRedraw;\n }\n return redraw;\n }\n /** Check if a deep update of all layers is needed */\n needsUpdate() {\n if (this._nextLayers && this._nextLayers !== this._lastRenderedLayers) {\n // New layers array may be the same as the old one if `setProps` is called by React\n return 'layers changed';\n }\n if (this._defaultShaderModulesChanged) {\n return 'shader modules changed';\n }\n return this._needsUpdate;\n }\n /** Layers will be redrawn (in next animation frame) */\n setNeedsRedraw(reason) {\n this._needsRedraw = this._needsRedraw || reason;\n }\n /** Layers will be updated deeply (in next animation frame)\n Potentially regenerating attributes and sub layers */\n setNeedsUpdate(reason) {\n this._needsUpdate = this._needsUpdate || reason;\n }\n /** Gets a list of currently rendered layers. Optionally filter by id. */\n getLayers({ layerIds } = {}) {\n // Filtering by layerId compares beginning of strings, so that sublayers will be included\n // Dependes on the convention of adding suffixes to the parent's layer name\n return layerIds\n ? this.layers.filter(layer => layerIds.find(layerId => layer.id.indexOf(layerId) === 0))\n : this.layers;\n }\n /** Set props needed for layer rendering and picking. */\n setProps(props) {\n if ('debug' in props) {\n this._debug = props.debug;\n }\n // A way for apps to add data to context that can be accessed in layers\n if ('userData' in props) {\n this.context.userData = props.userData;\n }\n // New layers will be processed in `updateLayers` in the next update cycle\n if ('layers' in props) {\n this._nextLayers = props.layers;\n }\n if ('onError' in props) {\n this.context.onError = props.onError;\n }\n }\n /** Supply a new layer list, initiating sublayer generation and layer matching */\n setLayers(newLayers, reason) {\n debug(TRACE_SET_LAYERS, this, reason, newLayers);\n this._lastRenderedLayers = newLayers;\n const flatLayers = flatten(newLayers, Boolean);\n for (const layer of flatLayers) {\n layer.context = this.context;\n }\n this._updateLayers(this.layers, flatLayers);\n }\n /** Update layers from last cycle if `setNeedsUpdate()` has been called */\n updateLayers() {\n // NOTE: For now, even if only some layer has changed, we update all layers\n // to ensure that layer id maps etc remain consistent even if different\n // sublayers are rendered\n const reason = this.needsUpdate();\n if (reason) {\n this.setNeedsRedraw(`updating layers: ${reason}`);\n // Force a full update\n this.setLayers(this._nextLayers || this._lastRenderedLayers, reason);\n }\n // Updated, clear the backlog\n this._nextLayers = null;\n }\n /** Register a default shader module */\n addDefaultShaderModule(module) {\n const { defaultShaderModules } = this.context;\n if (!defaultShaderModules.find(m => m.name === module.name)) {\n defaultShaderModules.push(module);\n this._defaultShaderModulesChanged = true;\n }\n }\n /** Deregister a default shader module */\n removeDefaultShaderModule(module) {\n const { defaultShaderModules } = this.context;\n const i = defaultShaderModules.findIndex(m => m.name === module.name);\n if (i >= 0) {\n defaultShaderModules.splice(i, 1);\n this._defaultShaderModulesChanged = true;\n }\n }\n _handleError(stage, error, layer) {\n layer.raiseError(error, `${stage} of ${layer}`);\n }\n // TODO - mark layers with exceptions as bad and remove from rendering cycle?\n /** Match all layers, checking for caught errors\n to avoid having an exception in one layer disrupt other layers */\n _updateLayers(oldLayers, newLayers) {\n // Create old layer map\n const oldLayerMap = {};\n for (const oldLayer of oldLayers) {\n if (oldLayerMap[oldLayer.id]) {\n log.warn(`Multiple old layers with same id ${oldLayer.id}`)();\n }\n else {\n oldLayerMap[oldLayer.id] = oldLayer;\n }\n }\n if (this._defaultShaderModulesChanged) {\n for (const layer of oldLayers) {\n layer.setNeedsUpdate();\n layer.setChangeFlags({ extensionsChanged: true });\n }\n this._defaultShaderModulesChanged = false;\n }\n // Allocate array for generated layers\n const generatedLayers = [];\n // Match sublayers\n this._updateSublayersRecursively(newLayers, oldLayerMap, generatedLayers);\n // Finalize unmatched layers\n this._finalizeOldLayers(oldLayerMap);\n let needsUpdate = false;\n for (const layer of generatedLayers) {\n if (layer.hasUniformTransition()) {\n needsUpdate = `Uniform transition in ${layer}`;\n break;\n }\n }\n this._needsUpdate = needsUpdate;\n this.layers = generatedLayers;\n }\n /* eslint-disable complexity,max-statements */\n // Note: adds generated layers to `generatedLayers` array parameter\n _updateSublayersRecursively(newLayers, oldLayerMap, generatedLayers) {\n for (const newLayer of newLayers) {\n newLayer.context = this.context;\n // Given a new coming layer, find its matching old layer (if any)\n const oldLayer = oldLayerMap[newLayer.id];\n if (oldLayer === null) {\n // null, rather than undefined, means this id was originally there\n log.warn(`Multiple new layers with same id ${newLayer.id}`)();\n }\n // Remove the old layer from candidates, as it has been matched with this layer\n oldLayerMap[newLayer.id] = null;\n let sublayers = null;\n // We must not generate exceptions until after layer matching is complete\n try {\n if (this._debug && oldLayer !== newLayer) {\n newLayer.validateProps();\n }\n if (!oldLayer) {\n this._initializeLayer(newLayer);\n }\n else {\n this._transferLayerState(oldLayer, newLayer);\n this._updateLayer(newLayer);\n }\n generatedLayers.push(newLayer);\n // Call layer lifecycle method: render sublayers\n sublayers = newLayer.isComposite ? newLayer.getSubLayers() : null;\n // End layer lifecycle method: render sublayers\n }\n catch (err) {\n this._handleError('matching', err, newLayer); // Record first exception\n }\n if (sublayers) {\n this._updateSublayersRecursively(sublayers, oldLayerMap, generatedLayers);\n }\n }\n }\n /* eslint-enable complexity,max-statements */\n // Finalize any old layers that were not matched\n _finalizeOldLayers(oldLayerMap) {\n for (const layerId in oldLayerMap) {\n const layer = oldLayerMap[layerId];\n if (layer) {\n this._finalizeLayer(layer);\n }\n }\n }\n // / EXCEPTION SAFE LAYER ACCESS\n /** Safely initializes a single layer, calling layer methods */\n _initializeLayer(layer) {\n try {\n layer._initialize();\n layer.lifecycle = LIFECYCLE.INITIALIZED;\n }\n catch (err) {\n this._handleError('initialization', err, layer);\n // TODO - what should the lifecycle state be here? LIFECYCLE.INITIALIZATION_FAILED?\n }\n }\n /** Transfer state from one layer to a newer version */\n _transferLayerState(oldLayer, newLayer) {\n newLayer._transferState(oldLayer);\n newLayer.lifecycle = LIFECYCLE.MATCHED;\n if (newLayer !== oldLayer) {\n oldLayer.lifecycle = LIFECYCLE.AWAITING_GC;\n }\n }\n /** Safely updates a single layer, cleaning all flags */\n _updateLayer(layer) {\n try {\n layer._update();\n }\n catch (err) {\n this._handleError('update', err, layer);\n }\n }\n /** Safely finalizes a single layer, removing all resources */\n _finalizeLayer(layer) {\n this._needsRedraw = this._needsRedraw || `finalized ${layer}`;\n layer.lifecycle = LIFECYCLE.AWAITING_FINALIZATION;\n try {\n layer._finalize();\n layer.lifecycle = LIFECYCLE.FINALIZED;\n }\n catch (err) {\n this._handleError('finalization', err, layer);\n }\n }\n}\n", "export const LIFECYCLE = {\n NO_STATE: 'Awaiting state',\n MATCHED: 'Matched. State transferred from previous layer',\n INITIALIZED: 'Initialized',\n AWAITING_GC: 'Discarded. Awaiting garbage collection',\n AWAITING_FINALIZATION: 'No longer matched. Awaiting garbage collection',\n FINALIZED: 'Finalized! Awaiting garbage collection'\n};\n/* Secret props keys */\n// Symbols are non-enumerable by default, does not show in for...in or Object.keys\n// but are copied with Object.assign \u00AF\\_(\u30C4)_/\u00AF\n// Supported everywhere except IE11, can be polyfilled with core-js\nexport const COMPONENT_SYMBOL = Symbol.for('component');\nexport const PROP_TYPES_SYMBOL = Symbol.for('propTypes');\nexport const DEPRECATED_PROPS_SYMBOL = Symbol.for('deprecatedProps');\nexport const ASYNC_DEFAULTS_SYMBOL = Symbol.for('asyncPropDefaults');\nexport const ASYNC_ORIGINAL_SYMBOL = Symbol.for('asyncPropOriginal');\nexport const ASYNC_RESOLVED_SYMBOL = Symbol.for('asyncPropResolved');\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n/**\n * Flattens a nested array into a single level array,\n * or a single value into an array with one value\n * @example flatten([[1, [2]], [3], 4]) => [1, 2, 3, 4]\n * @example flatten(1) => [1]\n * @param array The array to flatten.\n * @param filter= - Optional predicate called on each `value` to\n * determine if it should be included (pushed onto) the resulting array.\n * @return Returns the new flattened array (new array or `result` if provided)\n */\nexport function flatten(array, filter = () => true) {\n // Wrap single object in array\n if (!Array.isArray(array)) {\n return filter(array) ? [array] : [];\n }\n // Deep flatten and filter the array\n return flattenArray(array, filter, []);\n}\n/** Deep flattens an array. Helper to `flatten`, see its parameters */\nfunction flattenArray(array, filter, result) {\n let index = -1;\n while (++index < array.length) {\n const value = array[index];\n if (Array.isArray(value)) {\n flattenArray(value, filter, result);\n }\n else if (filter(value)) {\n result.push(value);\n }\n }\n return result;\n}\n/** Uses copyWithin to significantly speed up typed array value filling */\nexport function fillArray({ target, source, start = 0, count = 1 }) {\n const length = source.length;\n const total = count * length;\n let copied = 0;\n for (let i = start; copied < length; copied++) {\n target[i++] = source[copied];\n }\n while (copied < total) {\n // If we have copied less than half, copy everything we got\n // else copy remaining in one operation\n if (copied < total - copied) {\n target.copyWithin(start + copied, start, start + copied);\n copied *= 2;\n }\n else {\n target.copyWithin(start + copied, start, start + total - copied);\n copied = total;\n }\n }\n return target;\n}\n", "import { load } from '@loaders.gl/core';\nexport default class Resource {\n constructor(id, data, context) {\n this._loadCount = 0;\n this._subscribers = new Set();\n this.id = id;\n this.context = context;\n this.setData(data);\n }\n // consumer: {onChange: Function}\n subscribe(consumer) {\n this._subscribers.add(consumer);\n }\n unsubscribe(consumer) {\n this._subscribers.delete(consumer);\n }\n inUse() {\n return this._subscribers.size > 0;\n }\n delete() {\n // Remove any resources created\n }\n getData() {\n return this.isLoaded\n ? this._error\n ? Promise.reject(this._error)\n : this._content\n : this._loader.then(() => this.getData());\n }\n setData(data, forceUpdate) {\n if (data === this._data && !forceUpdate) {\n return;\n }\n this._data = data;\n const loadCount = ++this._loadCount;\n let loader = data;\n if (typeof data === 'string') {\n loader = load(data);\n }\n if (loader instanceof Promise) {\n this.isLoaded = false;\n this._loader = loader\n .then(result => {\n // check if source has changed\n if (this._loadCount === loadCount) {\n this.isLoaded = true;\n this._error = undefined;\n this._content = result;\n }\n })\n .catch(error => {\n if (this._loadCount === loadCount) {\n this.isLoaded = true;\n this._error = error || true;\n }\n });\n }\n else {\n this.isLoaded = true;\n this._error = undefined;\n this._content = data;\n }\n for (const subscriber of this._subscribers) {\n subscriber.onChange(this.getData());\n }\n }\n}\n", "import Resource from \"./resource.js\";\nexport default class ResourceManager {\n constructor(props) {\n this.protocol = props.protocol || 'resource://';\n this._context = {\n device: props.device,\n // @ts-expect-error\n gl: props.device?.gl,\n resourceManager: this\n };\n this._resources = {};\n this._consumers = {};\n this._pruneRequest = null;\n }\n contains(resourceId) {\n if (resourceId.startsWith(this.protocol)) {\n return true;\n }\n return resourceId in this._resources;\n }\n add({ resourceId, data, forceUpdate = false, persistent = true }) {\n let res = this._resources[resourceId];\n if (res) {\n res.setData(data, forceUpdate);\n }\n else {\n res = new Resource(resourceId, data, this._context);\n this._resources[resourceId] = res;\n }\n // persistent resources can only be removed by calling `remove`\n // non-persistent resources may be released when there are no more consumers\n res.persistent = persistent;\n }\n remove(resourceId) {\n const res = this._resources[resourceId];\n if (res) {\n res.delete();\n delete this._resources[resourceId];\n }\n }\n unsubscribe({ consumerId }) {\n const consumer = this._consumers[consumerId];\n if (consumer) {\n for (const requestId in consumer) {\n const request = consumer[requestId];\n const resource = this._resources[request.resourceId];\n if (resource) {\n resource.unsubscribe(request);\n }\n }\n delete this._consumers[consumerId];\n this.prune();\n }\n }\n subscribe({ resourceId, onChange, consumerId, requestId = 'default' }) {\n const { _resources: resources, protocol } = this;\n if (resourceId.startsWith(protocol)) {\n resourceId = resourceId.replace(protocol, '');\n if (!resources[resourceId]) {\n // Add placeholder. When this resource becomes available, the consumer will be notified.\n this.add({ resourceId, data: null, persistent: false });\n }\n }\n const res = resources[resourceId];\n this._track(consumerId, requestId, res, onChange);\n if (res) {\n return res.getData();\n }\n return undefined;\n }\n prune() {\n if (!this._pruneRequest) {\n // prune() may be called multiple times in the same animation frame.\n // Batch multiple requests together\n // @ts-ignore setTimeout returns NodeJS.Timeout in node\n this._pruneRequest = setTimeout(() => this._prune(), 0);\n }\n }\n finalize() {\n for (const key in this._resources) {\n this._resources[key].delete();\n }\n }\n _track(consumerId, requestId, resource, onChange) {\n const consumers = this._consumers;\n const consumer = (consumers[consumerId] = consumers[consumerId] || {});\n let request = consumer[requestId];\n const oldResource = request && request.resourceId && this._resources[request.resourceId];\n if (oldResource) {\n oldResource.unsubscribe(request);\n this.prune();\n }\n if (resource) {\n if (request) {\n request.onChange = onChange;\n request.resourceId = resource.id;\n }\n else {\n request = {\n onChange,\n resourceId: resource.id\n };\n }\n consumer[requestId] = request;\n resource.subscribe(request);\n }\n }\n _prune() {\n this._pruneRequest = null;\n for (const key of Object.keys(this._resources)) {\n const res = this._resources[key];\n if (!res.persistent && !res.inUse()) {\n res.delete();\n delete this._resources[key];\n }\n }\n }\n}\n", "/**\n * Fast partial deep equal for prop.\n *\n * @param a Prop\n * @param b Prop to compare against `a`\n * @param depth Depth to which to recurse in nested Objects/Arrays. Use 0 (default) for shallow comparison, -1 for infinite depth\n */\n/* eslint-disable complexity */\nexport function deepEqual(a, b, depth) {\n if (a === b) {\n return true;\n }\n if (!depth || !a || !b) {\n return false;\n }\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (!deepEqual(a[i], b[i], depth - 1)) {\n return false;\n }\n }\n return true;\n }\n if (Array.isArray(b)) {\n return false;\n }\n if (typeof a === 'object' && typeof b === 'object') {\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n for (const key of aKeys) {\n if (!b.hasOwnProperty(key)) {\n return false;\n }\n if (!deepEqual(a[key], b[key], depth - 1)) {\n return false;\n }\n }\n return true;\n }\n return false;\n}\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport { deepEqual } from \"../utils/deep-equal.js\";\nimport log from \"../utils/log.js\";\nimport { flatten } from \"../utils/flatten.js\";\nexport default class ViewManager {\n constructor(props) {\n // List of view descriptors, gets re-evaluated when width/height changes\n this.views = [];\n this.width = 100;\n this.height = 100;\n this.viewState = {};\n this.controllers = {};\n this.timeline = props.timeline;\n this._viewports = []; // Generated viewports\n this._viewportMap = {};\n this._isUpdating = false;\n this._needsRedraw = 'First render';\n this._needsUpdate = 'Initialize';\n this._eventManager = props.eventManager;\n this._eventCallbacks = {\n onViewStateChange: props.onViewStateChange,\n onInteractionStateChange: props.onInteractionStateChange\n };\n Object.seal(this);\n // Init with default map viewport\n this.setProps(props);\n }\n /** Remove all resources and event listeners */\n finalize() {\n for (const key in this.controllers) {\n const controller = this.controllers[key];\n if (controller) {\n controller.finalize();\n }\n }\n this.controllers = {};\n }\n /** Check if a redraw is needed */\n needsRedraw(opts = { clearRedrawFlags: false }) {\n const redraw = this._needsRedraw;\n if (opts.clearRedrawFlags) {\n this._needsRedraw = false;\n }\n return redraw;\n }\n /** Mark the manager as dirty. Will rebuild all viewports and update controllers. */\n setNeedsUpdate(reason) {\n this._needsUpdate = this._needsUpdate || reason;\n this._needsRedraw = this._needsRedraw || reason;\n }\n /** Checks each viewport for transition updates */\n updateViewStates() {\n for (const viewId in this.controllers) {\n const controller = this.controllers[viewId];\n if (controller) {\n controller.updateTransition();\n }\n }\n }\n /** Get a set of viewports for a given width and height\n * TODO - Intention is for deck.gl to autodeduce width and height and drop the need for props\n * @param rect (object, optional) - filter the viewports\n * + not provided - return all viewports\n * + {x, y} - only return viewports that contain this pixel\n * + {x, y, width, height} - only return viewports that overlap with this rectangle\n */\n getViewports(rect) {\n if (rect) {\n return this._viewports.filter(viewport => viewport.containsPixel(rect));\n }\n return this._viewports;\n }\n /** Get a map of all views */\n getViews() {\n const viewMap = {};\n this.views.forEach(view => {\n viewMap[view.id] = view;\n });\n return viewMap;\n }\n /** Resolves a viewId string to a View */\n getView(viewId) {\n return this.views.find(view => view.id === viewId);\n }\n /** Returns the viewState for a specific viewId. Matches the viewState by\n 1. view.viewStateId\n 2. view.id\n 3. root viewState\n then applies the view's filter if any */\n getViewState(viewOrViewId) {\n const view = typeof viewOrViewId === 'string' ? this.getView(viewOrViewId) : viewOrViewId;\n // Backward compatibility: view state for single view\n const viewState = (view && this.viewState[view.getViewStateId()]) || this.viewState;\n return view ? view.filterViewState(viewState) : viewState;\n }\n getViewport(viewId) {\n return this._viewportMap[viewId];\n }\n /**\n * Unproject pixel coordinates on screen onto world coordinates,\n * (possibly [lon, lat]) on map.\n * - [x, y] => [lng, lat]\n * - [x, y, z] => [lng, lat, Z]\n * @param {Array} xyz -\n * @param {Object} opts - options\n * @param {Object} opts.topLeft=true - Whether origin is top left\n * @return {Array|null} - [lng, lat, Z] or [X, Y, Z]\n */\n unproject(xyz, opts) {\n const viewports = this.getViewports();\n const pixel = { x: xyz[0], y: xyz[1] };\n for (let i = viewports.length - 1; i >= 0; --i) {\n const viewport = viewports[i];\n if (viewport.containsPixel(pixel)) {\n const p = xyz.slice();\n p[0] -= viewport.x;\n p[1] -= viewport.y;\n return viewport.unproject(p, opts);\n }\n }\n return null;\n }\n /** Update the manager with new Deck props */\n setProps(props) {\n if (props.views) {\n this._setViews(props.views);\n }\n if (props.viewState) {\n this._setViewState(props.viewState);\n }\n if ('width' in props || 'height' in props) {\n this._setSize(props.width, props.height);\n }\n // Important: avoid invoking _update() inside itself\n // Nested updates result in unexpected side effects inside _rebuildViewports()\n // when using auto control in pure-js\n if (!this._isUpdating) {\n this._update();\n }\n }\n //\n // PRIVATE METHODS\n //\n _update() {\n this._isUpdating = true;\n // Only rebuild viewports if the update flag is set\n if (this._needsUpdate) {\n this._needsUpdate = false;\n this._rebuildViewports();\n }\n // If viewport transition(s) are triggered during viewports update, controller(s)\n // will immediately call `onViewStateChange` which calls `viewManager.setProps` again.\n if (this._needsUpdate) {\n this._needsUpdate = false;\n this._rebuildViewports();\n }\n this._isUpdating = false;\n }\n _setSize(width, height) {\n if (width !== this.width || height !== this.height) {\n this.width = width;\n this.height = height;\n this.setNeedsUpdate('Size changed');\n }\n }\n // Update the view descriptor list and set change flag if needed\n // Does not actually rebuild the `Viewport`s until `getViewports` is called\n _setViews(views) {\n views = flatten(views, Boolean);\n const viewsChanged = this._diffViews(views, this.views);\n if (viewsChanged) {\n this.setNeedsUpdate('views changed');\n }\n this.views = views;\n }\n _setViewState(viewState) {\n if (viewState) {\n // depth = 3 when comparing viewStates: viewId.position.0\n const viewStateChanged = !deepEqual(viewState, this.viewState, 3);\n if (viewStateChanged) {\n this.setNeedsUpdate('viewState changed');\n }\n this.viewState = viewState;\n }\n else {\n log.warn('missing `viewState` or `initialViewState`')();\n }\n }\n _createController(view, props) {\n const Controller = props.type;\n const controller = new Controller({\n timeline: this.timeline,\n eventManager: this._eventManager,\n // Set an internal callback that calls the prop callback if provided\n onViewStateChange: this._eventCallbacks.onViewStateChange,\n onStateChange: this._eventCallbacks.onInteractionStateChange,\n makeViewport: viewState => this.getView(view.id)?.makeViewport({\n viewState,\n width: this.width,\n height: this.height\n })\n });\n return controller;\n }\n _updateController(view, viewState, viewport, controller) {\n const controllerProps = view.controller;\n if (controllerProps && viewport) {\n const resolvedProps = {\n ...viewState,\n ...controllerProps,\n id: view.id,\n x: viewport.x,\n y: viewport.y,\n width: viewport.width,\n height: viewport.height\n };\n // Create controller if not already existing or if the type of the\n // controller has changed.\n if (!controller || controller.constructor !== controllerProps.type) {\n controller = this._createController(view, resolvedProps);\n }\n if (controller) {\n controller.setProps(resolvedProps);\n }\n return controller;\n }\n return null;\n }\n // Rebuilds viewports from descriptors towards a certain window size\n _rebuildViewports() {\n const { views } = this;\n const oldControllers = this.controllers;\n this._viewports = [];\n this.controllers = {};\n let invalidateControllers = false;\n // Create controllers in reverse order, so that views on top receive events first\n for (let i = views.length; i--;) {\n const view = views[i];\n const viewState = this.getViewState(view);\n const viewport = view.makeViewport({ viewState, width: this.width, height: this.height });\n let oldController = oldControllers[view.id];\n const hasController = Boolean(view.controller);\n if (hasController && !oldController) {\n // When a new controller is added, invalidate all controllers below it so that\n // events are registered in the correct order\n invalidateControllers = true;\n }\n if ((invalidateControllers || !hasController) && oldController) {\n // Remove and reattach invalidated controller\n oldController.finalize();\n oldController = null;\n }\n // Update the controller\n this.controllers[view.id] = this._updateController(view, viewState, viewport, oldController);\n if (viewport) {\n this._viewports.unshift(viewport);\n }\n }\n // Remove unused controllers\n for (const id in oldControllers) {\n const oldController = oldControllers[id];\n if (oldController && !this.controllers[id]) {\n oldController.finalize();\n }\n }\n this._buildViewportMap();\n }\n _buildViewportMap() {\n // Build a view id to view index\n this._viewportMap = {};\n this._viewports.forEach(viewport => {\n if (viewport.id) {\n // TODO - issue warning if multiple viewports use same id\n this._viewportMap[viewport.id] = this._viewportMap[viewport.id] || viewport;\n }\n });\n }\n // Check if viewport array has changed, returns true if any change\n // Note that descriptors can be the same\n _diffViews(newViews, oldViews) {\n if (newViews.length !== oldViews.length) {\n return true;\n }\n return newViews.some((_, i) => !newViews[i].equals(oldViews[i]));\n }\n}\n", "const PERCENT_OR_PIXELS_REGEX = /([0-9]+\\.?[0-9]*)(%|px)/;\n// Takes a number or a string of formats `50%`, `33.3%` or `200px`\nexport function parsePosition(value) {\n switch (typeof value) {\n case 'number':\n return {\n position: value,\n relative: false\n };\n case 'string':\n const match = PERCENT_OR_PIXELS_REGEX.exec(value);\n if (match && match.length >= 3) {\n const relative = match[2] === '%';\n const position = parseFloat(match[1]);\n return {\n position: relative ? position / 100 : position,\n relative\n };\n }\n // fallthrough\n default:\n // eslint-disable-line\n throw new Error(`Could not parse position string ${value}`);\n }\n}\nexport function getPosition(position, extent) {\n return position.relative ? Math.round(position.position * extent) : position.position;\n}\n", "import { parsePosition, getPosition } from \"../utils/positions.js\";\nimport { deepEqual } from \"../utils/deep-equal.js\";\nexport default class View {\n constructor(props) {\n const { id, x = 0, y = 0, width = '100%', height = '100%', padding = null } = props;\n // @ts-ignore\n this.id = id || this.constructor.displayName || 'view';\n this.props = { ...props, id: this.id };\n // Extents\n this._x = parsePosition(x);\n this._y = parsePosition(y);\n this._width = parsePosition(width);\n this._height = parsePosition(height);\n this._padding = padding && {\n left: parsePosition(padding.left || 0),\n right: parsePosition(padding.right || 0),\n top: parsePosition(padding.top || 0),\n bottom: parsePosition(padding.bottom || 0)\n };\n // Bind methods for easy access\n this.equals = this.equals.bind(this);\n Object.seal(this);\n }\n equals(view) {\n if (this === view) {\n return true;\n }\n // To correctly compare padding use depth=2\n return this.ViewportType === view.ViewportType && deepEqual(this.props, view.props, 2);\n }\n /** Make viewport from canvas dimensions and view state */\n makeViewport({ width, height, viewState }) {\n viewState = this.filterViewState(viewState);\n // Resolve relative viewport dimensions\n const viewportDimensions = this.getDimensions({ width, height });\n if (!viewportDimensions.height || !viewportDimensions.width) {\n return null;\n }\n return new this.ViewportType({ ...viewState, ...this.props, ...viewportDimensions });\n }\n getViewStateId() {\n const { viewState } = this.props;\n if (typeof viewState === 'string') {\n // if View.viewState is a string, return it\n return viewState;\n }\n return viewState?.id || this.id;\n }\n // Allows view to override (or completely define) viewState\n filterViewState(viewState) {\n if (this.props.viewState && typeof this.props.viewState === 'object') {\n // If we have specified an id, then intent is to override,\n // If not, completely specify the view state\n if (!this.props.viewState.id) {\n return this.props.viewState;\n }\n // Merge in all props from View's viewState, except id\n const newViewState = { ...viewState };\n for (const key in this.props.viewState) {\n if (key !== 'id') {\n newViewState[key] = this.props.viewState[key];\n }\n }\n return newViewState;\n }\n return viewState;\n }\n /** Resolve the dimensions of the view from overall canvas dimensions */\n getDimensions({ width, height }) {\n const dimensions = {\n x: getPosition(this._x, width),\n y: getPosition(this._y, height),\n width: getPosition(this._width, width),\n height: getPosition(this._height, height)\n };\n if (this._padding) {\n dimensions.padding = {\n left: getPosition(this._padding.left, width),\n top: getPosition(this._padding.top, height),\n right: getPosition(this._padding.right, width),\n bottom: getPosition(this._padding.bottom, height)\n };\n }\n return dimensions;\n }\n // Used by sub classes to resolve controller props\n get controller() {\n const opts = this.props.controller;\n if (!opts) {\n return null;\n }\n if (opts === true) {\n return { type: this.ControllerType };\n }\n if (typeof opts === 'function') {\n return { type: opts };\n }\n return { type: this.ControllerType, ...opts };\n }\n}\n", "import { clamp } from '@math.gl/core';\nimport Controller from \"./controller.js\";\nimport ViewState from \"./view-state.js\";\nimport { normalizeViewportProps } from '@math.gl/web-mercator';\nimport assert from \"../utils/assert.js\";\nimport LinearInterpolator from \"../transitions/linear-interpolator.js\";\nconst PITCH_MOUSE_THRESHOLD = 5;\nconst PITCH_ACCEL = 1.2;\n/* Utils */\nexport class MapState extends ViewState {\n constructor(options) {\n const { \n /** Mapbox viewport properties */\n /** The width of the viewport */\n width, \n /** The height of the viewport */\n height, \n /** The latitude at the center of the viewport */\n latitude, \n /** The longitude at the center of the viewport */\n longitude, \n /** The tile zoom level of the map. */\n zoom, \n /** The bearing of the viewport in degrees */\n bearing = 0, \n /** The pitch of the viewport in degrees */\n pitch = 0, \n /**\n * Specify the altitude of the viewport camera\n * Unit: map heights, default 1.5\n * Non-public API, see https://github.com/mapbox/mapbox-gl-js/issues/1137\n */\n altitude = 1.5, \n /** Viewport position */\n position = [0, 0, 0], \n /** Viewport constraints */\n maxZoom = 20, minZoom = 0, maxPitch = 60, minPitch = 0, \n /** Interaction states, required to calculate change during transform */\n /* The point on map being grabbed when the operation first started */\n startPanLngLat, \n /* Center of the zoom when the operation first started */\n startZoomLngLat, \n /* Pointer position when rotation started */\n startRotatePos, \n /** Bearing when current perspective rotate operation started */\n startBearing, \n /** Pitch when current perspective rotate operation started */\n startPitch, \n /** Zoom when current zoom operation started */\n startZoom, \n /** Normalize viewport props to fit map height into viewport */\n normalize = true } = options;\n assert(Number.isFinite(longitude)); // `longitude` must be supplied\n assert(Number.isFinite(latitude)); // `latitude` must be supplied\n assert(Number.isFinite(zoom)); // `zoom` must be supplied\n super({\n width,\n height,\n latitude,\n longitude,\n zoom,\n bearing,\n pitch,\n altitude,\n maxZoom,\n minZoom,\n maxPitch,\n minPitch,\n normalize,\n position\n }, {\n startPanLngLat,\n startZoomLngLat,\n startRotatePos,\n startBearing,\n startPitch,\n startZoom\n });\n this.makeViewport = options.makeViewport;\n }\n /**\n * Start panning\n * @param {[Number, Number]} pos - position on screen where the pointer grabs\n */\n panStart({ pos }) {\n return this._getUpdatedState({\n startPanLngLat: this._unproject(pos)\n });\n }\n /**\n * Pan\n * @param {[Number, Number]} pos - position on screen where the pointer is\n * @param {[Number, Number], optional} startPos - where the pointer grabbed at\n * the start of the operation. Must be supplied of `panStart()` was not called\n */\n pan({ pos, startPos }) {\n const startPanLngLat = this.getState().startPanLngLat || this._unproject(startPos);\n if (!startPanLngLat) {\n return this;\n }\n const viewport = this.makeViewport(this.getViewportProps());\n const newProps = viewport.panByPosition(startPanLngLat, pos);\n return this._getUpdatedState(newProps);\n }\n /**\n * End panning\n * Must call if `panStart()` was called\n */\n panEnd() {\n return this._getUpdatedState({\n startPanLngLat: null\n });\n }\n /**\n * Start rotating\n * @param {[Number, Number]} pos - position on screen where the center is\n */\n rotateStart({ pos }) {\n return this._getUpdatedState({\n startRotatePos: pos,\n startBearing: this.getViewportProps().bearing,\n startPitch: this.getViewportProps().pitch\n });\n }\n /**\n * Rotate\n * @param {[Number, Number]} pos - position on screen where the center is\n */\n rotate({ pos, deltaAngleX = 0, deltaAngleY = 0 }) {\n const { startRotatePos, startBearing, startPitch } = this.getState();\n if (!startRotatePos || startBearing === undefined || startPitch === undefined) {\n return this;\n }\n let newRotation;\n if (pos) {\n newRotation = this._getNewRotation(pos, startRotatePos, startPitch, startBearing);\n }\n else {\n newRotation = {\n bearing: startBearing + deltaAngleX,\n pitch: startPitch + deltaAngleY\n };\n }\n return this._getUpdatedState(newRotation);\n }\n /**\n * End rotating\n * Must call if `rotateStart()` was called\n */\n rotateEnd() {\n return this._getUpdatedState({\n startBearing: null,\n startPitch: null\n });\n }\n /**\n * Start zooming\n * @param {[Number, Number]} pos - position on screen where the center is\n */\n zoomStart({ pos }) {\n return this._getUpdatedState({\n startZoomLngLat: this._unproject(pos),\n startZoom: this.getViewportProps().zoom\n });\n }\n /**\n * Zoom\n * @param {[Number, Number]} pos - position on screen where the current center is\n * @param {[Number, Number]} startPos - the center position at\n * the start of the operation. Must be supplied of `zoomStart()` was not called\n * @param {Number} scale - a number between [0, 1] specifying the accumulated\n * relative scale.\n */\n zoom({ pos, startPos, scale }) {\n // Make sure we zoom around the current mouse position rather than map center\n let { startZoom, startZoomLngLat } = this.getState();\n if (!startZoomLngLat) {\n // We have two modes of zoom:\n // scroll zoom that are discrete events (transform from the current zoom level),\n // and pinch zoom that are continuous events (transform from the zoom level when\n // pinch started).\n // If startZoom state is defined, then use the startZoom state;\n // otherwise assume discrete zooming\n startZoom = this.getViewportProps().zoom;\n startZoomLngLat = this._unproject(startPos) || this._unproject(pos);\n }\n if (!startZoomLngLat) {\n return this;\n }\n const { maxZoom, minZoom } = this.getViewportProps();\n let zoom = startZoom + Math.log2(scale);\n zoom = clamp(zoom, minZoom, maxZoom);\n const zoomedViewport = this.makeViewport({ ...this.getViewportProps(), zoom });\n return this._getUpdatedState({\n zoom,\n ...zoomedViewport.panByPosition(startZoomLngLat, pos)\n });\n }\n /**\n * End zooming\n * Must call if `zoomStart()` was called\n */\n zoomEnd() {\n return this._getUpdatedState({\n startZoomLngLat: null,\n startZoom: null\n });\n }\n zoomIn(speed = 2) {\n return this._zoomFromCenter(speed);\n }\n zoomOut(speed = 2) {\n return this._zoomFromCenter(1 / speed);\n }\n moveLeft(speed = 100) {\n return this._panFromCenter([speed, 0]);\n }\n moveRight(speed = 100) {\n return this._panFromCenter([-speed, 0]);\n }\n moveUp(speed = 100) {\n return this._panFromCenter([0, speed]);\n }\n moveDown(speed = 100) {\n return this._panFromCenter([0, -speed]);\n }\n rotateLeft(speed = 15) {\n return this._getUpdatedState({\n bearing: this.getViewportProps().bearing - speed\n });\n }\n rotateRight(speed = 15) {\n return this._getUpdatedState({\n bearing: this.getViewportProps().bearing + speed\n });\n }\n rotateUp(speed = 10) {\n return this._getUpdatedState({\n pitch: this.getViewportProps().pitch + speed\n });\n }\n rotateDown(speed = 10) {\n return this._getUpdatedState({\n pitch: this.getViewportProps().pitch - speed\n });\n }\n shortestPathFrom(viewState) {\n // const endViewStateProps = new this.ControllerState(endProps).shortestPathFrom(startViewstate);\n const fromProps = viewState.getViewportProps();\n const props = { ...this.getViewportProps() };\n const { bearing, longitude } = props;\n if (Math.abs(bearing - fromProps.bearing) > 180) {\n props.bearing = bearing < 0 ? bearing + 360 : bearing - 360;\n }\n if (Math.abs(longitude - fromProps.longitude) > 180) {\n props.longitude = longitude < 0 ? longitude + 360 : longitude - 360;\n }\n return props;\n }\n // Apply any constraints (mathematical or defined by _viewportProps) to map state\n applyConstraints(props) {\n // Ensure zoom is within specified range\n const { maxZoom, minZoom, zoom } = props;\n props.zoom = clamp(zoom, minZoom, maxZoom);\n // Ensure pitch is within specified range\n const { maxPitch, minPitch, pitch } = props;\n props.pitch = clamp(pitch, minPitch, maxPitch);\n // Normalize viewport props to fit map height into viewport\n const { normalize = true } = props;\n if (normalize) {\n Object.assign(props, normalizeViewportProps(props));\n }\n return props;\n }\n /* Private methods */\n _zoomFromCenter(scale) {\n const { width, height } = this.getViewportProps();\n return this.zoom({\n pos: [width / 2, height / 2],\n scale\n });\n }\n _panFromCenter(offset) {\n const { width, height } = this.getViewportProps();\n return this.pan({\n startPos: [width / 2, height / 2],\n pos: [width / 2 + offset[0], height / 2 + offset[1]]\n });\n }\n _getUpdatedState(newProps) {\n // @ts-ignore\n return new this.constructor({\n makeViewport: this.makeViewport,\n ...this.getViewportProps(),\n ...this.getState(),\n ...newProps\n });\n }\n _unproject(pos) {\n const viewport = this.makeViewport(this.getViewportProps());\n // @ts-ignore\n return pos && viewport.unproject(pos);\n }\n _getNewRotation(pos, startPos, startPitch, startBearing) {\n const deltaX = pos[0] - startPos[0];\n const deltaY = pos[1] - startPos[1];\n const centerY = pos[1];\n const startY = startPos[1];\n const { width, height } = this.getViewportProps();\n const deltaScaleX = deltaX / width;\n let deltaScaleY = 0;\n if (deltaY > 0) {\n if (Math.abs(height - startY) > PITCH_MOUSE_THRESHOLD) {\n // Move from 0 to -1 as we drag upwards\n deltaScaleY = (deltaY / (startY - height)) * PITCH_ACCEL;\n }\n }\n else if (deltaY < 0) {\n if (startY > PITCH_MOUSE_THRESHOLD) {\n // Move from 0 to 1 as we drag upwards\n deltaScaleY = 1 - centerY / startY;\n }\n }\n // clamp deltaScaleY to [-1, 1] so that rotation is constrained between minPitch and maxPitch.\n // deltaScaleX does not need to be clamped as bearing does not have constraints.\n deltaScaleY = clamp(deltaScaleY, -1, 1);\n const { minPitch, maxPitch } = this.getViewportProps();\n const bearing = startBearing + 180 * deltaScaleX;\n let pitch = startPitch;\n if (deltaScaleY > 0) {\n // Gradually increase pitch\n pitch = startPitch + deltaScaleY * (maxPitch - startPitch);\n }\n else if (deltaScaleY < 0) {\n // Gradually decrease pitch\n pitch = startPitch - deltaScaleY * (minPitch - startPitch);\n }\n return {\n pitch,\n bearing\n };\n }\n}\nexport default class MapController extends Controller {\n constructor() {\n super(...arguments);\n this.ControllerState = MapState;\n this.transition = {\n transitionDuration: 300,\n transitionInterpolator: new LinearInterpolator({\n transitionProps: {\n compare: ['longitude', 'latitude', 'zoom', 'bearing', 'pitch', 'position'],\n required: ['longitude', 'latitude', 'zoom']\n }\n })\n };\n this.dragMode = 'pan';\n }\n setProps(props) {\n props.position = props.position || [0, 0, 0];\n const oldProps = this.props;\n super.setProps(props);\n const dimensionChanged = !oldProps || oldProps.height !== props.height;\n if (dimensionChanged) {\n // Dimensions changed, normalize the props\n this.updateViewport(new this.ControllerState({\n makeViewport: this.makeViewport,\n ...props,\n ...this.state\n }));\n }\n }\n}\n", "export default class Transition {\n /**\n * @params timeline {Timeline}\n */\n constructor(timeline) {\n this._inProgress = false;\n this._handle = null;\n this.time = 0;\n // @ts-expect-error\n this.settings = {\n duration: 0\n };\n this._timeline = timeline;\n }\n /* Public API */\n get inProgress() {\n return this._inProgress;\n }\n /**\n * (re)start this transition.\n * @params props {object} - optional overriding props. see constructor\n */\n start(settings) {\n this.cancel();\n // @ts-expect-error\n this.settings = settings;\n this._inProgress = true;\n this.settings.onStart?.(this);\n }\n /**\n * end this transition if it is in progress.\n */\n end() {\n if (this._inProgress) {\n this._timeline.removeChannel(this._handle);\n this._handle = null;\n this._inProgress = false;\n this.settings.onEnd?.(this);\n }\n }\n /**\n * cancel this transition if it is in progress.\n */\n cancel() {\n if (this._inProgress) {\n this.settings.onInterrupt?.(this);\n this._timeline.removeChannel(this._handle);\n this._handle = null;\n this._inProgress = false;\n }\n }\n /**\n * update this transition. Returns `true` if updated.\n */\n update() {\n if (!this._inProgress) {\n return false;\n }\n // It is important to initialize the handle during `update` instead of `start`.\n // The CPU time that the `start` frame takes should not be counted towards the duration.\n // On the other hand, `update` always happens during a render cycle. The clock starts when the\n // transition is rendered for the first time.\n if (this._handle === null) {\n const { _timeline: timeline, settings } = this;\n this._handle = timeline.addChannel({\n delay: timeline.getTime(),\n duration: settings.duration\n });\n }\n this.time = this._timeline.getTime(this._handle);\n // Call subclass method\n this._onUpdate();\n // Call user callback\n this.settings.onUpdate?.(this);\n // This only works if `settings.duration` is set\n // Spring transition must call `end` manually\n if (this._timeline.isFinished(this._handle)) {\n this.end();\n }\n return true;\n }\n /* Private API */\n _onUpdate() {\n // for subclass override\n }\n}\n", "import Transition from \"../transitions/transition.js\";\nconst noop = () => { };\n// Enums cannot be directly exported as they are not transpiled correctly into ES5, see https://github.com/visgl/deck.gl/issues/7130\nexport const TRANSITION_EVENTS = {\n BREAK: 1,\n SNAP_TO_END: 2,\n IGNORE: 3\n};\nconst DEFAULT_EASING = t => t;\nconst DEFAULT_INTERRUPTION = TRANSITION_EVENTS.BREAK;\nexport default class TransitionManager {\n constructor(opts) {\n this._onTransitionUpdate = transition => {\n // NOTE: Be cautious re-ordering statements in this function.\n const { time, settings: { interpolator, startProps, endProps, duration, easing } } = transition;\n const t = easing(time / duration);\n const viewport = interpolator.interpolateProps(startProps, endProps, t);\n // This gurantees all props (e.g. bearing, longitude) are normalized\n // So when viewports are compared they are in same range.\n this.propsInTransition = this.getControllerState({\n ...this.props,\n ...viewport\n }).getViewportProps();\n this.onViewStateChange({\n viewState: this.propsInTransition,\n oldViewState: this.props\n });\n };\n this.getControllerState = opts.getControllerState;\n this.propsInTransition = null;\n this.transition = new Transition(opts.timeline);\n this.onViewStateChange = opts.onViewStateChange || noop;\n this.onStateChange = opts.onStateChange || noop;\n }\n finalize() {\n this.transition.cancel();\n }\n // Returns current transitioned viewport.\n getViewportInTransition() {\n return this.propsInTransition;\n }\n // Process the vewiport change, either ignore or trigger a new transition.\n // Return true if a new transition is triggered, false otherwise.\n processViewStateChange(nextProps) {\n let transitionTriggered = false;\n const currentProps = this.props;\n // Set this.props here as '_triggerTransition' calls '_updateViewport' that uses this.props.\n this.props = nextProps;\n // NOTE: Be cautious re-ordering statements in this function.\n if (!currentProps || this._shouldIgnoreViewportChange(currentProps, nextProps)) {\n return false;\n }\n if (this._isTransitionEnabled(nextProps)) {\n let startProps = currentProps;\n if (this.transition.inProgress) {\n // @ts-expect-error\n const { interruption, endProps } = this.transition.settings;\n startProps = {\n ...currentProps,\n ...(interruption === TRANSITION_EVENTS.SNAP_TO_END\n ? endProps\n : this.propsInTransition || currentProps)\n };\n }\n this._triggerTransition(startProps, nextProps);\n transitionTriggered = true;\n }\n else {\n this.transition.cancel();\n }\n return transitionTriggered;\n }\n updateTransition() {\n this.transition.update();\n }\n // Helper methods\n _isTransitionEnabled(props) {\n const { transitionDuration, transitionInterpolator } = props;\n return ((transitionDuration > 0 || transitionDuration === 'auto') &&\n Boolean(transitionInterpolator));\n }\n _isUpdateDueToCurrentTransition(props) {\n if (this.transition.inProgress && this.propsInTransition) {\n // @ts-expect-error\n return this.transition.settings.interpolator.arePropsEqual(props, this.propsInTransition);\n }\n return false;\n }\n _shouldIgnoreViewportChange(currentProps, nextProps) {\n if (this.transition.inProgress) {\n // @ts-expect-error\n const transitionSettings = this.transition.settings;\n // Ignore update if it is requested to be ignored\n return (transitionSettings.interruption === TRANSITION_EVENTS.IGNORE ||\n // Ignore update if it is due to current active transition.\n this._isUpdateDueToCurrentTransition(nextProps));\n }\n if (this._isTransitionEnabled(nextProps)) {\n // Ignore if none of the viewport props changed.\n return nextProps.transitionInterpolator.arePropsEqual(currentProps, nextProps);\n }\n return true;\n }\n _triggerTransition(startProps, endProps) {\n const startViewstate = this.getControllerState(startProps);\n const endViewStateProps = this.getControllerState(endProps).shortestPathFrom(startViewstate);\n // update transitionDuration for 'auto' mode\n const transitionInterpolator = endProps.transitionInterpolator;\n const duration = transitionInterpolator.getDuration\n ? transitionInterpolator.getDuration(startProps, endProps)\n : endProps.transitionDuration;\n if (duration === 0) {\n return;\n }\n const initialProps = transitionInterpolator.initializeProps(startProps, endViewStateProps);\n this.propsInTransition = {};\n const transitionSettings = {\n duration,\n easing: endProps.transitionEasing || DEFAULT_EASING,\n interpolator: transitionInterpolator,\n interruption: endProps.transitionInterruption || DEFAULT_INTERRUPTION,\n startProps: initialProps.start,\n endProps: initialProps.end,\n onStart: endProps.onTransitionStart,\n onUpdate: this._onTransitionUpdate,\n onInterrupt: this._onTransitionEnd(endProps.onTransitionInterrupt),\n onEnd: this._onTransitionEnd(endProps.onTransitionEnd)\n };\n this.transition.start(transitionSettings);\n this.onStateChange({ inTransition: true });\n this.updateTransition();\n }\n _onTransitionEnd(callback) {\n return transition => {\n this.propsInTransition = null;\n this.onStateChange({\n inTransition: false,\n isZooming: false,\n isPanning: false,\n isRotating: false\n });\n callback?.(transition);\n };\n }\n}\n", "import { equals } from '@math.gl/core';\nimport assert from \"../utils/assert.js\";\nexport default class TransitionInterpolator {\n /**\n * @param opts {array|object}\n * @param opts.compare {array} - prop names used in equality check\n * @param opts.extract {array} - prop names needed for interpolation\n * @param opts.required {array} - prop names that must be supplied\n * alternatively, supply one list of prop names as `opts` if all of the above are the same.\n */\n constructor(opts) {\n const { compare, extract, required } = opts;\n this._propsToCompare = compare;\n this._propsToExtract = extract || compare;\n this._requiredProps = required;\n }\n /**\n * Checks if two sets of props need transition in between\n * @param currentProps {object} - a list of viewport props\n * @param nextProps {object} - a list of viewport props\n * @returns {bool} - true if two props are equivalent\n */\n arePropsEqual(currentProps, nextProps) {\n for (const key of this._propsToCompare) {\n if (!(key in currentProps) ||\n !(key in nextProps) ||\n !equals(currentProps[key], nextProps[key])) {\n return false;\n }\n }\n return true;\n }\n /**\n * Called before transition starts to validate/pre-process start and end props\n * @param startProps {object} - a list of starting viewport props\n * @param endProps {object} - a list of target viewport props\n * @returns {Object} {start, end} - start and end props to be passed\n * to `interpolateProps`\n */\n initializeProps(startProps, endProps) {\n const startViewStateProps = {};\n const endViewStateProps = {};\n for (const key of this._propsToExtract) {\n if (key in startProps || key in endProps) {\n startViewStateProps[key] = startProps[key];\n endViewStateProps[key] = endProps[key];\n }\n }\n this._checkRequiredProps(startViewStateProps);\n this._checkRequiredProps(endViewStateProps);\n return { start: startViewStateProps, end: endViewStateProps };\n }\n /**\n * Returns transition duration\n * @param startProps {object} - a list of starting viewport props\n * @param endProps {object} - a list of target viewport props\n * @returns {Number} - transition duration in milliseconds\n */\n getDuration(startProps, endProps) {\n return endProps.transitionDuration;\n }\n _checkRequiredProps(props) {\n if (!this._requiredProps) {\n return;\n }\n this._requiredProps.forEach(propName => {\n const value = props[propName];\n assert(Number.isFinite(value) || Array.isArray(value), `${propName} is required for transition`);\n });\n }\n}\n", "// Replacement for the external assert method to reduce bundle size\n// Note: We don't use the second \"message\" argument in calling code,\n// so no need to support it here\nexport default function assert(condition, message) {\n if (!condition) {\n throw new Error(message || 'deck.gl: assertion failed.');\n }\n}\n", "import TransitionInterpolator from \"./transition-interpolator.js\";\nimport { lerp } from '@math.gl/core';\nconst DEFAULT_PROPS = ['longitude', 'latitude', 'zoom', 'bearing', 'pitch'];\nconst DEFAULT_REQUIRED_PROPS = ['longitude', 'latitude', 'zoom'];\n/**\n * Performs linear interpolation of two view states.\n */\nexport default class LinearInterpolator extends TransitionInterpolator {\n /**\n * @param {Object} opts\n * @param {Array} opts.transitionProps - list of props to apply linear transition to.\n * @param {Array} opts.around - a screen point to zoom/rotate around.\n * @param {Function} opts.makeViewport - construct a viewport instance with given props.\n */\n constructor(opts = {}) {\n // Backward compatibility\n const transitionProps = Array.isArray(opts) ? opts : opts.transitionProps;\n const normalizedOpts = Array.isArray(opts) ? {} : opts;\n normalizedOpts.transitionProps = Array.isArray(transitionProps)\n ? {\n compare: transitionProps,\n required: transitionProps\n }\n : transitionProps || {\n compare: DEFAULT_PROPS,\n required: DEFAULT_REQUIRED_PROPS\n };\n super(normalizedOpts.transitionProps);\n this.opts = normalizedOpts;\n }\n initializeProps(startProps, endProps) {\n const result = super.initializeProps(startProps, endProps);\n const { makeViewport, around } = this.opts;\n if (makeViewport && around) {\n const startViewport = makeViewport(startProps);\n const endViewport = makeViewport(endProps);\n const aroundPosition = startViewport.unproject(around);\n result.start.around = around;\n Object.assign(result.end, {\n around: endViewport.project(aroundPosition),\n aroundPosition,\n width: endProps.width,\n height: endProps.height\n });\n }\n return result;\n }\n interpolateProps(startProps, endProps, t) {\n const propsInTransition = {};\n for (const key of this._propsToExtract) {\n propsInTransition[key] = lerp(startProps[key] || 0, endProps[key] || 0, t);\n }\n if (endProps.aroundPosition && this.opts.makeViewport) {\n // Linear transition should be performed in common space\n const viewport = this.opts.makeViewport({ ...endProps, ...propsInTransition });\n Object.assign(propsInTransition, viewport.panByPosition(endProps.aroundPosition, \n // anchor point in current screen coordinates\n lerp(startProps.around, endProps.around, t)));\n }\n return propsInTransition;\n }\n}\n", "// Copyright (c) 2015 Uber Technologies, Inc.\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n/* eslint-disable max-statements, complexity */\nimport TransitionManager from \"./transition-manager.js\";\nimport LinearInterpolator from \"../transitions/linear-interpolator.js\";\nconst NO_TRANSITION_PROPS = {\n transitionDuration: 0\n};\nconst DEFAULT_INERTIA = 300;\nconst INERTIA_EASING = t => 1 - (1 - t) * (1 - t);\nconst EVENT_TYPES = {\n WHEEL: ['wheel'],\n PAN: ['panstart', 'panmove', 'panend'],\n PINCH: ['pinchstart', 'pinchmove', 'pinchend'],\n TRIPLE_PAN: ['tripanstart', 'tripanmove', 'tripanend'],\n DOUBLE_TAP: ['doubletap'],\n KEYBOARD: ['keydown']\n};\nconst pinchEventWorkaround = {};\nexport default class Controller {\n constructor(opts) {\n this.state = {};\n this._events = {};\n this._interactionState = {\n isDragging: false\n };\n this._customEvents = [];\n this._eventStartBlocked = null;\n this._panMove = false;\n this.invertPan = false;\n this.dragMode = 'rotate';\n this.inertia = 0;\n this.scrollZoom = true;\n this.dragPan = true;\n this.dragRotate = true;\n this.doubleClickZoom = true;\n this.touchZoom = true;\n this.touchRotate = false;\n this.keyboard = true;\n this.transitionManager = new TransitionManager({\n ...opts,\n getControllerState: props => new this.ControllerState(props),\n onViewStateChange: this._onTransition.bind(this),\n onStateChange: this._setInteractionState.bind(this)\n });\n this.handleEvent = this.handleEvent.bind(this);\n this.eventManager = opts.eventManager;\n this.onViewStateChange = opts.onViewStateChange || (() => { });\n this.onStateChange = opts.onStateChange || (() => { });\n this.makeViewport = opts.makeViewport;\n }\n set events(customEvents) {\n this.toggleEvents(this._customEvents, false);\n this.toggleEvents(customEvents, true);\n this._customEvents = customEvents;\n // Make sure default events are not overwritten\n if (this.props) {\n this.setProps(this.props);\n }\n }\n finalize() {\n for (const eventName in this._events) {\n if (this._events[eventName]) {\n // @ts-ignore (2345) event type string cannot be assifned to enum\n // eslint-disable-next-line @typescript-eslint/unbound-method\n this.eventManager?.off(eventName, this.handleEvent);\n }\n }\n this.transitionManager.finalize();\n }\n /**\n * Callback for events\n */\n handleEvent(event) {\n // Force recalculate controller state\n this._controllerState = undefined;\n const eventStartBlocked = this._eventStartBlocked;\n switch (event.type) {\n case 'panstart':\n return eventStartBlocked ? false : this._onPanStart(event);\n case 'panmove':\n return this._onPan(event);\n case 'panend':\n return this._onPanEnd(event);\n case 'pinchstart':\n return eventStartBlocked ? false : this._onPinchStart(event);\n case 'pinchmove':\n return this._onPinch(event);\n case 'pinchend':\n return this._onPinchEnd(event);\n case 'tripanstart':\n return eventStartBlocked ? false : this._onTriplePanStart(event);\n case 'tripanmove':\n return this._onTriplePan(event);\n case 'tripanend':\n return this._onTriplePanEnd(event);\n case 'doubletap':\n return this._onDoubleTap(event);\n case 'wheel':\n return this._onWheel(event);\n case 'keydown':\n return this._onKeyDown(event);\n default:\n return false;\n }\n }\n /* Event utils */\n // Event object: http://hammerjs.github.io/api/#event-object\n get controllerState() {\n this._controllerState = this._controllerState || new this.ControllerState({\n makeViewport: this.makeViewport,\n ...this.props,\n ...this.state\n });\n return this._controllerState;\n }\n getCenter(event) {\n const { x, y } = this.props;\n const { offsetCenter } = event;\n return [offsetCenter.x - x, offsetCenter.y - y];\n }\n isPointInBounds(pos, event) {\n const { width, height } = this.props;\n if (event && event.handled) {\n return false;\n }\n const inside = pos[0] >= 0 && pos[0] <= width && pos[1] >= 0 && pos[1] <= height;\n if (inside && event) {\n event.stopPropagation();\n }\n return inside;\n }\n isFunctionKeyPressed(event) {\n const { srcEvent } = event;\n return Boolean(srcEvent.metaKey || srcEvent.altKey || srcEvent.ctrlKey || srcEvent.shiftKey);\n }\n isDragging() {\n return this._interactionState.isDragging || false;\n }\n // When a multi-touch event ends, e.g. pinch, not all pointers are lifted at the same time.\n // This triggers a brief `pan` event.\n // Calling this method will temporarily disable *start events to avoid conflicting transitions.\n blockEvents(timeout) {\n /* global setTimeout */\n const timer = setTimeout(() => {\n if (this._eventStartBlocked === timer) {\n this._eventStartBlocked = null;\n }\n }, timeout);\n this._eventStartBlocked = timer;\n }\n /**\n * Extract interactivity options\n */\n setProps(props) {\n if (props.dragMode) {\n this.dragMode = props.dragMode;\n }\n this.props = props;\n if (!('transitionInterpolator' in props)) {\n // Add default transition interpolator\n props.transitionInterpolator = this._getTransitionProps().transitionInterpolator;\n }\n this.transitionManager.processViewStateChange(props);\n const { inertia } = props;\n this.inertia = Number.isFinite(inertia) ? inertia : (inertia === true ? DEFAULT_INERTIA : 0);\n // TODO - make sure these are not reset on every setProps\n const { scrollZoom = true, dragPan = true, dragRotate = true, doubleClickZoom = true, touchZoom = true, touchRotate = false, keyboard = true } = props;\n // Register/unregister events\n const isInteractive = Boolean(this.onViewStateChange);\n this.toggleEvents(EVENT_TYPES.WHEEL, isInteractive && scrollZoom);\n // We always need the pan events to set the correct isDragging state, even if dragPan & dragRotate are both false\n this.toggleEvents(EVENT_TYPES.PAN, isInteractive);\n this.toggleEvents(EVENT_TYPES.PINCH, isInteractive && (touchZoom || touchRotate));\n this.toggleEvents(EVENT_TYPES.TRIPLE_PAN, isInteractive && touchRotate);\n this.toggleEvents(EVENT_TYPES.DOUBLE_TAP, isInteractive && doubleClickZoom);\n this.toggleEvents(EVENT_TYPES.KEYBOARD, isInteractive && keyboard);\n // Interaction toggles\n this.scrollZoom = scrollZoom;\n this.dragPan = dragPan;\n this.dragRotate = dragRotate;\n this.doubleClickZoom = doubleClickZoom;\n this.touchZoom = touchZoom;\n this.touchRotate = touchRotate;\n this.keyboard = keyboard;\n }\n updateTransition() {\n this.transitionManager.updateTransition();\n }\n toggleEvents(eventNames, enabled) {\n if (this.eventManager) {\n eventNames.forEach(eventName => {\n if (this._events[eventName] !== enabled) {\n this._events[eventName] = enabled;\n if (enabled) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n this.eventManager.on(eventName, this.handleEvent);\n }\n else {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n this.eventManager.off(eventName, this.handleEvent);\n }\n }\n });\n }\n }\n // Private Methods\n /* Callback util */\n // formats map state and invokes callback function\n updateViewport(newControllerState, extraProps = null, interactionState = {}) {\n const viewState = { ...newControllerState.getViewportProps(), ...extraProps };\n // TODO - to restore diffing, we need to include interactionState\n const changed = this.controllerState !== newControllerState;\n // const oldViewState = this.controllerState.getViewportProps();\n // const changed = Object.keys(viewState).some(key => oldViewState[key] !== viewState[key]);\n this.state = newControllerState.getState();\n this._setInteractionState(interactionState);\n if (changed) {\n const oldViewState = this.controllerState && this.controllerState.getViewportProps();\n if (this.onViewStateChange) {\n this.onViewStateChange({ viewState, interactionState: this._interactionState, oldViewState, viewId: this.props.id });\n }\n }\n }\n _onTransition(params) {\n this.onViewStateChange({ ...params, interactionState: this._interactionState, viewId: this.props.id });\n }\n _setInteractionState(newStates) {\n Object.assign(this._interactionState, newStates);\n this.onStateChange(this._interactionState);\n }\n /* Event handlers */\n // Default handler for the `panstart` event.\n _onPanStart(event) {\n const pos = this.getCenter(event);\n if (!this.isPointInBounds(pos, event)) {\n return false;\n }\n let alternateMode = this.isFunctionKeyPressed(event) || event.rightButton || false;\n if (this.invertPan || this.dragMode === 'pan') {\n // invertPan is replaced by props.dragMode, keeping for backward compatibility\n alternateMode = !alternateMode;\n }\n const newControllerState = this.controllerState[alternateMode ? 'panStart' : 'rotateStart']({\n pos\n });\n this._panMove = alternateMode;\n this.updateViewport(newControllerState, NO_TRANSITION_PROPS, { isDragging: true });\n return true;\n }\n // Default handler for the `panmove` and `panend` event.\n _onPan(event) {\n if (!this.isDragging()) {\n return false;\n }\n return this._panMove ? this._onPanMove(event) : this._onPanRotate(event);\n }\n _onPanEnd(event) {\n if (!this.isDragging()) {\n return false;\n }\n return this._panMove ? this._onPanMoveEnd(event) : this._onPanRotateEnd(event);\n }\n // Default handler for panning to move.\n // Called by `_onPan` when panning without function key pressed.\n _onPanMove(event) {\n if (!this.dragPan) {\n return false;\n }\n const pos = this.getCenter(event);\n const newControllerState = this.controllerState.pan({ pos });\n this.updateViewport(newControllerState, NO_TRANSITION_PROPS, {\n isDragging: true,\n isPanning: true\n });\n return true;\n }\n _onPanMoveEnd(event) {\n const { inertia } = this;\n if (this.dragPan && inertia && event.velocity) {\n const pos = this.getCenter(event);\n const endPos = [\n pos[0] + (event.velocityX * inertia) / 2,\n pos[1] + (event.velocityY * inertia) / 2\n ];\n const newControllerState = this.controllerState.pan({ pos: endPos }).panEnd();\n this.updateViewport(newControllerState, {\n ...this._getTransitionProps(),\n transitionDuration: inertia,\n transitionEasing: INERTIA_EASING\n }, {\n isDragging: false,\n isPanning: true\n });\n }\n else {\n const newControllerState = this.controllerState.panEnd();\n this.updateViewport(newControllerState, null, {\n isDragging: false,\n isPanning: false\n });\n }\n return true;\n }\n // Default handler for panning to rotate.\n // Called by `_onPan` when panning with function key pressed.\n _onPanRotate(event) {\n if (!this.dragRotate) {\n return false;\n }\n const pos = this.getCenter(event);\n const newControllerState = this.controllerState.rotate({ pos });\n this.updateViewport(newControllerState, NO_TRANSITION_PROPS, {\n isDragging: true,\n isRotating: true\n });\n return true;\n }\n _onPanRotateEnd(event) {\n const { inertia } = this;\n if (this.dragRotate && inertia && event.velocity) {\n const pos = this.getCenter(event);\n const endPos = [\n pos[0] + (event.velocityX * inertia) / 2,\n pos[1] + (event.velocityY * inertia) / 2\n ];\n const newControllerState = this.controllerState.rotate({ pos: endPos }).rotateEnd();\n this.updateViewport(newControllerState, {\n ...this._getTransitionProps(),\n transitionDuration: inertia,\n transitionEasing: INERTIA_EASING\n }, {\n isDragging: false,\n isRotating: true\n });\n }\n else {\n const newControllerState = this.controllerState.rotateEnd();\n this.updateViewport(newControllerState, null, {\n isDragging: false,\n isRotating: false\n });\n }\n return true;\n }\n // Default handler for the `wheel` event.\n _onWheel(event) {\n if (!this.scrollZoom) {\n return false;\n }\n const pos = this.getCenter(event);\n if (!this.isPointInBounds(pos, event)) {\n return false;\n }\n event.srcEvent.preventDefault();\n const { speed = 0.01, smooth = false } = this.scrollZoom === true ? {} : this.scrollZoom;\n const { delta } = event;\n // Map wheel delta to relative scale\n let scale = 2 / (1 + Math.exp(-Math.abs(delta * speed)));\n if (delta < 0 && scale !== 0) {\n scale = 1 / scale;\n }\n const newControllerState = this.controllerState.zoom({ pos, scale });\n this.updateViewport(newControllerState, { ...this._getTransitionProps({ around: pos }), transitionDuration: smooth ? 250 : 1 }, {\n isZooming: true,\n isPanning: true\n });\n return true;\n }\n _onTriplePanStart(event) {\n const pos = this.getCenter(event);\n if (!this.isPointInBounds(pos, event)) {\n return false;\n }\n const newControllerState = this.controllerState.rotateStart({ pos });\n this.updateViewport(newControllerState, NO_TRANSITION_PROPS, { isDragging: true });\n return true;\n }\n _onTriplePan(event) {\n if (!this.touchRotate) {\n return false;\n }\n if (!this.isDragging()) {\n return false;\n }\n const pos = this.getCenter(event);\n pos[0] -= event.deltaX;\n const newControllerState = this.controllerState.rotate({ pos });\n this.updateViewport(newControllerState, NO_TRANSITION_PROPS, {\n isDragging: true,\n isRotating: true\n });\n return true;\n }\n _onTriplePanEnd(event) {\n if (!this.isDragging()) {\n return false;\n }\n const { inertia } = this;\n if (this.touchRotate && inertia && event.velocityY) {\n const pos = this.getCenter(event);\n const endPos = [pos[0], (pos[1] += (event.velocityY * inertia) / 2)];\n const newControllerState = this.controllerState.rotate({ pos: endPos });\n this.updateViewport(newControllerState, {\n ...this._getTransitionProps(),\n transitionDuration: inertia,\n transitionEasing: INERTIA_EASING\n }, {\n isDragging: false,\n isRotating: true\n });\n this.blockEvents(inertia);\n }\n else {\n const newControllerState = this.controllerState.rotateEnd();\n this.updateViewport(newControllerState, null, {\n isDragging: false,\n isRotating: false\n });\n }\n return true;\n }\n // Default handler for the `pinchstart` event.\n _onPinchStart(event) {\n const pos = this.getCenter(event);\n if (!this.isPointInBounds(pos, event)) {\n return false;\n }\n const newControllerState = this.controllerState.zoomStart({ pos }).rotateStart({ pos });\n // hack - hammer's `rotation` field doesn't seem to produce the correct angle\n pinchEventWorkaround._startPinchRotation = event.rotation;\n pinchEventWorkaround._lastPinchEvent = event;\n this.updateViewport(newControllerState, NO_TRANSITION_PROPS, { isDragging: true });\n return true;\n }\n // Default handler for the `pinchmove` and `pinchend` events.\n _onPinch(event) {\n if (!this.touchZoom && !this.touchRotate) {\n return false;\n }\n if (!this.isDragging()) {\n return false;\n }\n let newControllerState = this.controllerState;\n if (this.touchZoom) {\n const { scale } = event;\n const pos = this.getCenter(event);\n newControllerState = newControllerState.zoom({ pos, scale });\n }\n if (this.touchRotate) {\n const { rotation } = event;\n newControllerState = newControllerState.rotate({\n deltaAngleX: pinchEventWorkaround._startPinchRotation - rotation\n });\n }\n this.updateViewport(newControllerState, NO_TRANSITION_PROPS, {\n isDragging: true,\n isPanning: this.touchZoom,\n isZooming: this.touchZoom,\n isRotating: this.touchRotate\n });\n pinchEventWorkaround._lastPinchEvent = event;\n return true;\n }\n _onPinchEnd(event) {\n if (!this.isDragging()) {\n return false;\n }\n const { inertia } = this;\n const { _lastPinchEvent } = pinchEventWorkaround;\n if (this.touchZoom && inertia && _lastPinchEvent && event.scale !== _lastPinchEvent.scale) {\n const pos = this.getCenter(event);\n let newControllerState = this.controllerState.rotateEnd();\n const z = Math.log2(event.scale);\n const velocityZ = (z - Math.log2(_lastPinchEvent.scale)) / (event.deltaTime - _lastPinchEvent.deltaTime);\n const endScale = Math.pow(2, z + (velocityZ * inertia) / 2);\n newControllerState = newControllerState.zoom({ pos, scale: endScale }).zoomEnd();\n this.updateViewport(newControllerState, {\n ...this._getTransitionProps({ around: pos }),\n transitionDuration: inertia,\n transitionEasing: INERTIA_EASING\n }, {\n isDragging: false,\n isPanning: this.touchZoom,\n isZooming: this.touchZoom,\n isRotating: false\n });\n this.blockEvents(inertia);\n }\n else {\n const newControllerState = this.controllerState.zoomEnd().rotateEnd();\n this.updateViewport(newControllerState, null, {\n isDragging: false,\n isPanning: false,\n isZooming: false,\n isRotating: false\n });\n }\n pinchEventWorkaround._startPinchRotation = null;\n pinchEventWorkaround._lastPinchEvent = null;\n return true;\n }\n // Default handler for the `doubletap` event.\n _onDoubleTap(event) {\n if (!this.doubleClickZoom) {\n return false;\n }\n const pos = this.getCenter(event);\n if (!this.isPointInBounds(pos, event)) {\n return false;\n }\n const isZoomOut = this.isFunctionKeyPressed(event);\n const newControllerState = this.controllerState.zoom({ pos, scale: isZoomOut ? 0.5 : 2 });\n this.updateViewport(newControllerState, this._getTransitionProps({ around: pos }), {\n isZooming: true,\n isPanning: true\n });\n this.blockEvents(100);\n return true;\n }\n // Default handler for the `keydown` event\n _onKeyDown(event) {\n if (!this.keyboard) {\n return false;\n }\n const funcKey = this.isFunctionKeyPressed(event);\n // @ts-ignore\n const { zoomSpeed, moveSpeed, rotateSpeedX, rotateSpeedY } = this.keyboard === true ? {} : this.keyboard;\n const { controllerState } = this;\n let newControllerState;\n const interactionState = {};\n switch (event.srcEvent.code) {\n case 'Minus':\n newControllerState = funcKey\n ? controllerState.zoomOut(zoomSpeed).zoomOut(zoomSpeed)\n : controllerState.zoomOut(zoomSpeed);\n interactionState.isZooming = true;\n break;\n case 'Equal':\n newControllerState = funcKey\n ? controllerState.zoomIn(zoomSpeed).zoomIn(zoomSpeed)\n : controllerState.zoomIn(zoomSpeed);\n interactionState.isZooming = true;\n break;\n case 'ArrowLeft':\n if (funcKey) {\n newControllerState = controllerState.rotateLeft(rotateSpeedX);\n interactionState.isRotating = true;\n }\n else {\n newControllerState = controllerState.moveLeft(moveSpeed);\n interactionState.isPanning = true;\n }\n break;\n case 'ArrowRight':\n if (funcKey) {\n newControllerState = controllerState.rotateRight(rotateSpeedX);\n interactionState.isRotating = true;\n }\n else {\n newControllerState = controllerState.moveRight(moveSpeed);\n interactionState.isPanning = true;\n }\n break;\n case 'ArrowUp':\n if (funcKey) {\n newControllerState = controllerState.rotateUp(rotateSpeedY);\n interactionState.isRotating = true;\n }\n else {\n newControllerState = controllerState.moveUp(moveSpeed);\n interactionState.isPanning = true;\n }\n break;\n case 'ArrowDown':\n if (funcKey) {\n newControllerState = controllerState.rotateDown(rotateSpeedY);\n interactionState.isRotating = true;\n }\n else {\n newControllerState = controllerState.moveDown(moveSpeed);\n interactionState.isPanning = true;\n }\n break;\n default:\n return false;\n }\n this.updateViewport(newControllerState, this._getTransitionProps(), interactionState);\n return true;\n }\n _getTransitionProps(opts) {\n const { transition } = this;\n if (!transition || !transition.transitionInterpolator) {\n return NO_TRANSITION_PROPS;\n }\n // Enables Transitions on double-tap and key-down events.\n return opts\n ? {\n ...transition,\n transitionInterpolator: new LinearInterpolator({\n ...opts,\n ...transition.transitionInterpolator.opts,\n makeViewport: this.controllerState.makeViewport\n })\n }\n : transition;\n }\n}\n", "export default class ViewState {\n constructor(props, state) {\n this._viewportProps = this.applyConstraints(props);\n this._state = state;\n }\n getViewportProps() {\n return this._viewportProps;\n }\n getState() {\n return this._state;\n }\n}\n", "import View from \"./view.js\";\nimport WebMercatorViewport from \"../viewports/web-mercator-viewport.js\";\nimport MapController from \"../controllers/map-controller.js\";\nclass MapView extends View {\n constructor(props = {}) {\n super(props);\n }\n get ViewportType() {\n return WebMercatorViewport;\n }\n get ControllerType() {\n return MapController;\n }\n}\nMapView.displayName = 'MapView';\nexport default MapView;\n", "import { deepEqual } from \"../utils/deep-equal.js\";\nimport LightingEffect from \"../effects/lighting/lighting-effect.js\";\nconst DEFAULT_LIGHTING_EFFECT = new LightingEffect();\n/** Sort two effects. Returns 0 if equal, negative if e1 < e2, positive if e1 > e2 */\nfunction compareEffects(e1, e2) {\n const o1 = e1.order ?? Infinity;\n const o2 = e2.order ?? Infinity;\n return o1 - o2;\n}\nexport default class EffectManager {\n constructor(context) {\n this._resolvedEffects = [];\n /** Effect instances and order preference pairs, sorted by order */\n this._defaultEffects = [];\n this.effects = [];\n this._context = context;\n this._needsRedraw = 'Initial render';\n this._setEffects([]);\n }\n /**\n * Register a new default effect, i.e. an effect presents regardless of user supplied props.effects\n */\n addDefaultEffect(effect) {\n const defaultEffects = this._defaultEffects;\n if (!defaultEffects.find(e => e.id === effect.id)) {\n const index = defaultEffects.findIndex(e => compareEffects(e, effect) > 0);\n if (index < 0) {\n defaultEffects.push(effect);\n }\n else {\n defaultEffects.splice(index, 0, effect);\n }\n effect.setup(this._context);\n this._setEffects(this.effects);\n }\n }\n setProps(props) {\n if ('effects' in props) {\n // Compare effects against each other shallowly\n if (!deepEqual(props.effects, this.effects, 1)) {\n this._setEffects(props.effects);\n }\n }\n }\n needsRedraw(opts = { clearRedrawFlags: false }) {\n const redraw = this._needsRedraw;\n if (opts.clearRedrawFlags) {\n this._needsRedraw = false;\n }\n return redraw;\n }\n getEffects() {\n return this._resolvedEffects;\n }\n _setEffects(effects) {\n const oldEffectsMap = {};\n for (const effect of this.effects) {\n oldEffectsMap[effect.id] = effect;\n }\n const nextEffects = [];\n for (const effect of effects) {\n const oldEffect = oldEffectsMap[effect.id];\n let effectToAdd = effect;\n if (oldEffect && oldEffect !== effect) {\n if (oldEffect.setProps) {\n oldEffect.setProps(effect.props);\n effectToAdd = oldEffect;\n }\n else {\n oldEffect.cleanup(this._context);\n }\n }\n else if (!oldEffect) {\n effect.setup(this._context);\n }\n nextEffects.push(effectToAdd);\n delete oldEffectsMap[effect.id];\n }\n for (const removedEffectId in oldEffectsMap) {\n oldEffectsMap[removedEffectId].cleanup(this._context);\n }\n this.effects = nextEffects;\n this._resolvedEffects = nextEffects.concat(this._defaultEffects);\n // Special case for lighting: only add default instance if no LightingEffect is specified\n if (!effects.some(effect => effect instanceof LightingEffect)) {\n this._resolvedEffects.push(DEFAULT_LIGHTING_EFFECT);\n }\n this._needsRedraw = 'effects changed';\n }\n finalize() {\n for (const effect of this._resolvedEffects) {\n effect.cleanup(this._context);\n }\n this.effects.length = 0;\n this._resolvedEffects.length = 0;\n this._defaultEffects.length = 0;\n }\n}\n", "import LayersPass from \"./layers-pass.js\";\nexport default class DrawLayersPass extends LayersPass {\n shouldDrawLayer(layer) {\n const { operation } = layer.props;\n return operation.includes('draw') || operation.includes('terrain');\n }\n}\n", "import debug from \"../debug/index.js\";\nimport DrawLayersPass from \"../passes/draw-layers-pass.js\";\nimport PickLayersPass from \"../passes/pick-layers-pass.js\";\nconst TRACE_RENDER_LAYERS = 'deckRenderer.renderLayers';\nexport default class DeckRenderer {\n constructor(device) {\n this.device = device;\n this.layerFilter = null;\n this.drawPickingColors = false;\n this.drawLayersPass = new DrawLayersPass(device);\n this.pickLayersPass = new PickLayersPass(device);\n this.renderCount = 0;\n this._needsRedraw = 'Initial render';\n this.renderBuffers = [];\n this.lastPostProcessEffect = null;\n }\n setProps(props) {\n if (this.layerFilter !== props.layerFilter) {\n this.layerFilter = props.layerFilter;\n this._needsRedraw = 'layerFilter changed';\n }\n if (this.drawPickingColors !== props.drawPickingColors) {\n this.drawPickingColors = props.drawPickingColors;\n this._needsRedraw = 'drawPickingColors changed';\n }\n }\n renderLayers(opts) {\n if (!opts.viewports.length) {\n return;\n }\n const layerPass = this.drawPickingColors ? this.pickLayersPass : this.drawLayersPass;\n const renderOpts = {\n layerFilter: this.layerFilter,\n isPicking: this.drawPickingColors,\n ...opts\n };\n if (renderOpts.effects) {\n this._preRender(renderOpts.effects, renderOpts);\n }\n const outputBuffer = this.lastPostProcessEffect ? this.renderBuffers[0] : renderOpts.target;\n if (this.lastPostProcessEffect) {\n renderOpts.clearColor = [0, 0, 0, 0];\n renderOpts.clearCanvas = true;\n }\n const renderStats = layerPass.render({ ...renderOpts, target: outputBuffer });\n if (renderOpts.effects) {\n this._postRender(renderOpts.effects, renderOpts);\n }\n this.renderCount++;\n debug(TRACE_RENDER_LAYERS, this, renderStats, opts);\n }\n needsRedraw(opts = { clearRedrawFlags: false }) {\n const redraw = this._needsRedraw;\n if (opts.clearRedrawFlags) {\n this._needsRedraw = false;\n }\n return redraw;\n }\n finalize() {\n const { renderBuffers } = this;\n for (const buffer of renderBuffers) {\n buffer.delete();\n }\n renderBuffers.length = 0;\n }\n _preRender(effects, opts) {\n this.lastPostProcessEffect = null;\n opts.preRenderStats = opts.preRenderStats || {};\n for (const effect of effects) {\n opts.preRenderStats[effect.id] = effect.preRender(opts);\n if (effect.postRender) {\n this.lastPostProcessEffect = effect.id;\n }\n }\n if (this.lastPostProcessEffect) {\n this._resizeRenderBuffers();\n }\n }\n _resizeRenderBuffers() {\n const { renderBuffers } = this;\n const size = this.device.canvasContext.getDrawingBufferSize();\n if (renderBuffers.length === 0) {\n [0, 1].map(i => {\n const texture = this.device.createTexture({\n sampler: { minFilter: 'linear', magFilter: 'linear' }\n });\n renderBuffers.push(this.device.createFramebuffer({\n id: `deck-renderbuffer-${i}`,\n colorAttachments: [texture]\n }));\n });\n }\n for (const buffer of renderBuffers) {\n buffer.resize(size);\n }\n }\n _postRender(effects, opts) {\n const { renderBuffers } = this;\n const params = {\n ...opts,\n inputBuffer: renderBuffers[0],\n swapBuffer: renderBuffers[1]\n };\n for (const effect of effects) {\n if (effect.postRender) {\n // If not the last post processing effect, unset the target so that\n // it only renders between the swap buffers\n params.target = effect.id === this.lastPostProcessEffect ? opts.target : undefined;\n const buffer = effect.postRender(params);\n // Buffer cannot be null if target is unset\n params.inputBuffer = buffer;\n params.swapBuffer = buffer === renderBuffers[0] ? renderBuffers[1] : renderBuffers[0];\n }\n }\n }\n}\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport log from \"../../utils/log.js\";\nconst NO_PICKED_OBJECT = {\n pickedColor: null,\n pickedObjectIndex: -1\n};\n/* eslint-disable max-depth, max-statements */\n/**\n * Pick at a specified pixel with a tolerance radius\n * Returns the closest object to the pixel in shape `{pickedColor, pickedLayer, pickedObjectIndex}`\n */\nexport function getClosestObject({ pickedColors, decodePickingColor, deviceX, deviceY, deviceRadius, deviceRect }) {\n // Traverse all pixels in picking results and find the one closest to the supplied\n // [deviceX, deviceY]\n const { x, y, width, height } = deviceRect;\n let minSquareDistanceToCenter = deviceRadius * deviceRadius;\n let closestPixelIndex = -1;\n let i = 0;\n for (let row = 0; row < height; row++) {\n const dy = row + y - deviceY;\n const dy2 = dy * dy;\n if (dy2 > minSquareDistanceToCenter) {\n // skip this row\n i += 4 * width;\n }\n else {\n for (let col = 0; col < width; col++) {\n // Decode picked layer from color\n const pickedLayerIndex = pickedColors[i + 3] - 1;\n if (pickedLayerIndex >= 0) {\n const dx = col + x - deviceX;\n const d2 = dx * dx + dy2;\n if (d2 <= minSquareDistanceToCenter) {\n minSquareDistanceToCenter = d2;\n closestPixelIndex = i;\n }\n }\n i += 4;\n }\n }\n }\n if (closestPixelIndex >= 0) {\n // Decode picked object index from color\n const pickedColor = pickedColors.slice(closestPixelIndex, closestPixelIndex + 4);\n const pickedObject = decodePickingColor(pickedColor);\n if (pickedObject) {\n const dy = Math.floor(closestPixelIndex / 4 / width);\n const dx = closestPixelIndex / 4 - dy * width;\n return {\n ...pickedObject,\n pickedColor,\n pickedX: x + dx,\n pickedY: y + dy\n };\n }\n log.error('Picked non-existent layer. Is picking buffer corrupt?')();\n }\n return NO_PICKED_OBJECT;\n}\n/**\n * Examines a picking buffer for unique colors\n * Returns array of unique objects in shape `{x, y, pickedColor, pickedLayer, pickedObjectIndex}`\n */\nexport function getUniqueObjects({ pickedColors, decodePickingColor }) {\n const uniqueColors = new Map();\n // Traverse all pixels in picking results and get unique colors\n if (pickedColors) {\n for (let i = 0; i < pickedColors.length; i += 4) {\n // Decode picked layer from color\n const pickedLayerIndex = pickedColors[i + 3] - 1;\n if (pickedLayerIndex >= 0) {\n const pickedColor = pickedColors.slice(i, i + 4);\n const colorKey = pickedColor.join(',');\n // eslint-disable-next-line\n if (!uniqueColors.has(colorKey)) {\n const pickedObject = decodePickingColor(pickedColor);\n // eslint-disable-next-line\n if (pickedObject) {\n uniqueColors.set(colorKey, {\n ...pickedObject,\n color: pickedColor\n });\n }\n else {\n log.error('Picked non-existent layer. Is picking buffer corrupt?')();\n }\n }\n }\n }\n }\n return Array.from(uniqueColors.values());\n}\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n/** Generates some basic information of the picking action: x, y, coordinates etc.\n * Regardless if anything is picked\n */\nexport function getEmptyPickingInfo({ pickInfo, viewports, pixelRatio, x, y, z }) {\n // If more than one viewports are used in the picking pass, locate the viewport that\n // drew the picked pixel\n let pickedViewport = viewports[0];\n if (viewports.length > 1) {\n // Find the viewport that contain the picked pixel\n pickedViewport = getViewportFromCoordinates(pickInfo?.pickedViewports || viewports, { x, y });\n }\n let coordinate;\n if (pickedViewport) {\n const point = [x - pickedViewport.x, y - pickedViewport.y];\n if (z !== undefined) {\n point[2] = z;\n }\n coordinate = pickedViewport.unproject(point);\n }\n return {\n color: null,\n layer: null,\n viewport: pickedViewport,\n index: -1,\n picked: false,\n x,\n y,\n pixel: [x, y],\n coordinate,\n devicePixel: pickInfo && 'pickedX' in pickInfo\n ? [pickInfo.pickedX, pickInfo.pickedY]\n : undefined,\n pixelRatio\n };\n}\n/* eslint-disable max-depth */\n/** Generates the picking info of a picking operation */\nexport function processPickInfo(opts) {\n const { pickInfo, lastPickedInfo, mode, layers } = opts;\n const { pickedColor, pickedLayer, pickedObjectIndex } = pickInfo;\n const affectedLayers = pickedLayer ? [pickedLayer] : [];\n if (mode === 'hover') {\n // only invoke onHover events if picked object has changed\n const lastPickedPixelIndex = lastPickedInfo.index;\n const lastPickedLayerId = lastPickedInfo.layerId;\n const pickedLayerId = pickedLayer ? pickedLayer.props.id : null;\n // proceed only if picked object changed\n if (pickedLayerId !== lastPickedLayerId || pickedObjectIndex !== lastPickedPixelIndex) {\n if (pickedLayerId !== lastPickedLayerId) {\n // We cannot store a ref to lastPickedLayer in the context because\n // the state of an outdated layer is no longer valid\n // and the props may have changed\n const lastPickedLayer = layers.find(layer => layer.props.id === lastPickedLayerId);\n if (lastPickedLayer) {\n // Let leave event fire before enter event\n affectedLayers.unshift(lastPickedLayer);\n }\n }\n // Update layer manager context\n lastPickedInfo.layerId = pickedLayerId;\n lastPickedInfo.index = pickedObjectIndex;\n lastPickedInfo.info = null;\n }\n }\n const baseInfo = getEmptyPickingInfo(opts);\n // Use a Map to store all picking infos.\n // The following two forEach loops are the result of\n // https://github.com/visgl/deck.gl/issues/443\n // Please be very careful when changing this pattern\n const infos = new Map();\n // Make sure infos always contain something even if no layer is affected\n infos.set(null, baseInfo);\n affectedLayers.forEach(layer => {\n let info = { ...baseInfo };\n if (layer === pickedLayer) {\n info.color = pickedColor;\n info.index = pickedObjectIndex;\n info.picked = true;\n }\n info = getLayerPickingInfo({ layer, info, mode });\n const rootLayer = info.layer;\n if (layer === pickedLayer && mode === 'hover') {\n lastPickedInfo.info = info;\n }\n // This guarantees that there will be only one copy of info for\n // one composite layer\n infos.set(rootLayer.id, info);\n if (mode === 'hover') {\n rootLayer.updateAutoHighlight(info);\n }\n });\n return infos;\n}\n/** Walk up the layer composite chain to populate the info object */\nexport function getLayerPickingInfo({ layer, info, mode }) {\n while (layer && info) {\n // For a composite layer, sourceLayer will point to the sublayer\n // where the event originates from.\n // It provides additional context for the composite layer's\n // getPickingInfo() method to populate the info object\n const sourceLayer = info.layer || null;\n info.sourceLayer = sourceLayer;\n info.layer = layer;\n // layer.pickLayer() function requires a non-null ```layer.state```\n // object to function properly. So the layer referenced here\n // must be the \"current\" layer, not an \"out-dated\" / \"invalidated\" layer\n info = layer.getPickingInfo({ info, mode, sourceLayer });\n layer = layer.parent;\n }\n return info;\n}\n/** Indentifies which viewport, if any corresponds to x and y\n If multiple viewports contain the target pixel, last viewport drawn is returend\n Returns first viewport if no match */\nfunction getViewportFromCoordinates(viewports, pixel) {\n // find the last viewport that contains the pixel\n for (let i = viewports.length - 1; i >= 0; i--) {\n const viewport = viewports[i];\n if (viewport.containsPixel(pixel)) {\n return viewport;\n }\n }\n return viewports[0];\n}\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport PickLayersPass from \"../passes/pick-layers-pass.js\";\nimport { getClosestObject, getUniqueObjects } from \"./picking/query-object.js\";\nimport { processPickInfo, getLayerPickingInfo, getEmptyPickingInfo } from \"./picking/pick-info.js\";\n/** Manages picking in a Deck context */\nexport default class DeckPicker {\n constructor(device) {\n this._pickable = true;\n this.device = device;\n this.pickLayersPass = new PickLayersPass(device);\n this.lastPickedInfo = {\n index: -1,\n layerId: null,\n info: null\n };\n }\n setProps(props) {\n if ('layerFilter' in props) {\n this.layerFilter = props.layerFilter;\n }\n if ('_pickable' in props) {\n this._pickable = props._pickable;\n }\n }\n finalize() {\n if (this.pickingFBO) {\n this.pickingFBO.destroy();\n }\n if (this.depthFBO) {\n this.depthFBO.destroy();\n }\n }\n /** Pick the closest info at given coordinate */\n pickObject(opts) {\n return this._pickClosestObject(opts);\n }\n /** Get all unique infos within a bounding box */\n pickObjects(opts) {\n return this._pickVisibleObjects(opts);\n }\n // Returns a new picking info object by assuming the last picked object is still picked\n getLastPickedObject({ x, y, layers, viewports }, lastPickedInfo = this.lastPickedInfo.info) {\n const lastPickedLayerId = lastPickedInfo && lastPickedInfo.layer && lastPickedInfo.layer.id;\n const lastPickedViewportId = lastPickedInfo && lastPickedInfo.viewport && lastPickedInfo.viewport.id;\n const layer = lastPickedLayerId ? layers.find(l => l.id === lastPickedLayerId) : null;\n const viewport = (lastPickedViewportId && viewports.find(v => v.id === lastPickedViewportId)) || viewports[0];\n const coordinate = viewport && viewport.unproject([x - viewport.x, y - viewport.y]);\n const info = {\n x,\n y,\n viewport,\n coordinate,\n layer\n };\n return { ...lastPickedInfo, ...info };\n }\n // Private\n /** Ensures that picking framebuffer exists and matches the canvas size */\n _resizeBuffer() {\n // Create a frame buffer if not already available\n if (!this.pickingFBO) {\n this.pickingFBO = this.device.createFramebuffer({\n colorAttachments: ['rgba8unorm'],\n depthStencilAttachment: 'depth16unorm'\n });\n if (this.device.isTextureFormatRenderable('rgba32float')) {\n const depthFBO = this.device.createFramebuffer({\n colorAttachments: ['rgba32float'],\n depthStencilAttachment: 'depth16unorm'\n });\n this.depthFBO = depthFBO;\n }\n }\n // Resize it to current canvas size (this is a noop if size hasn't changed)\n const { canvas } = this.device.getCanvasContext();\n this.pickingFBO?.resize({ width: canvas.width, height: canvas.height });\n this.depthFBO?.resize({ width: canvas.width, height: canvas.height });\n }\n /** Preliminary filtering of the layers list. Skid picking pass if no layer is pickable. */\n _getPickable(layers) {\n if (this._pickable === false) {\n return null;\n }\n const pickableLayers = layers.filter(layer => this.pickLayersPass.shouldDrawLayer(layer) && !layer.isComposite);\n return pickableLayers.length ? pickableLayers : null;\n }\n /** Pick the closest object at the given coordinate */\n // eslint-disable-next-line max-statements,complexity\n _pickClosestObject({ layers, views, viewports, x, y, radius = 0, depth = 1, mode = 'query', unproject3D, onViewportActive, effects }) {\n // @ts-expect-error TODO - assuming WebGL context\n const pixelRatio = this.device.canvasContext.cssToDeviceRatio();\n const pickableLayers = this._getPickable(layers);\n if (!pickableLayers || viewports.length === 0) {\n return {\n result: [],\n emptyInfo: getEmptyPickingInfo({ viewports, x, y, pixelRatio })\n };\n }\n this._resizeBuffer();\n // Convert from canvas top-left to WebGL bottom-left coordinates\n // Top-left coordinates [x, y] to bottom-left coordinates [deviceX, deviceY]\n // And compensate for pixelRatio\n // @ts-expect-error TODO - assuming WebGL context\n const devicePixelRange = this.device.canvasContext.cssToDevicePixels([x, y], true);\n const devicePixel = [\n devicePixelRange.x + Math.floor(devicePixelRange.width / 2),\n devicePixelRange.y + Math.floor(devicePixelRange.height / 2)\n ];\n const deviceRadius = Math.round(radius * pixelRatio);\n const { width, height } = this.pickingFBO;\n const deviceRect = this._getPickingRect({\n deviceX: devicePixel[0],\n deviceY: devicePixel[1],\n deviceRadius,\n deviceWidth: width,\n deviceHeight: height\n });\n const cullRect = {\n x: x - radius,\n y: y - radius,\n width: radius * 2 + 1,\n height: radius * 2 + 1\n };\n let infos;\n const result = [];\n const affectedLayers = new Set();\n for (let i = 0; i < depth; i++) {\n let pickInfo;\n if (deviceRect) {\n const pickedResult = this._drawAndSample({\n layers: pickableLayers,\n views,\n viewports,\n onViewportActive,\n deviceRect,\n cullRect,\n effects,\n pass: `picking:${mode}`\n });\n pickInfo = getClosestObject({\n ...pickedResult,\n deviceX: devicePixel[0],\n deviceY: devicePixel[1],\n deviceRadius,\n deviceRect\n });\n }\n else {\n pickInfo = {\n pickedColor: null,\n pickedObjectIndex: -1\n };\n }\n let z;\n if (pickInfo.pickedLayer && unproject3D && this.depthFBO) {\n const { pickedColors: pickedColors2 } = this._drawAndSample({\n layers: [pickInfo.pickedLayer],\n views,\n viewports,\n onViewportActive,\n deviceRect: {\n x: pickInfo.pickedX,\n y: pickInfo.pickedY,\n width: 1,\n height: 1\n },\n cullRect,\n effects,\n pass: `picking:${mode}:z`\n }, true);\n // picked value is in common space (pixels) from the camera target (viewport.position)\n // convert it to meters from the ground\n if (pickedColors2[3]) {\n z = pickedColors2[0];\n }\n }\n // Only exclude if we need to run picking again.\n // We need to run picking again if an object is detected AND\n // we have not exhausted the requested depth.\n if (pickInfo.pickedLayer && i + 1 < depth) {\n affectedLayers.add(pickInfo.pickedLayer);\n pickInfo.pickedLayer.disablePickingIndex(pickInfo.pickedObjectIndex);\n }\n // This logic needs to run even if no object is picked.\n infos = processPickInfo({\n pickInfo,\n lastPickedInfo: this.lastPickedInfo,\n mode,\n layers: pickableLayers,\n viewports,\n x,\n y,\n z,\n pixelRatio\n });\n for (const info of infos.values()) {\n if (info.layer) {\n result.push(info);\n }\n }\n // If no object is picked stop.\n if (!pickInfo.pickedColor) {\n break;\n }\n }\n // reset only affected buffers\n for (const layer of affectedLayers) {\n layer.restorePickingColors();\n }\n return { result, emptyInfo: infos.get(null) };\n }\n /** Pick all objects within the given bounding box */\n _pickVisibleObjects({ layers, views, viewports, x, y, width = 1, height = 1, mode = 'query', maxObjects = null, onViewportActive, effects }) {\n const pickableLayers = this._getPickable(layers);\n if (!pickableLayers || viewports.length === 0) {\n return [];\n }\n this._resizeBuffer();\n // Convert from canvas top-left to WebGL bottom-left coordinates\n // And compensate for pixelRatio\n // @ts-expect-error TODO - assuming WebGL context\n const pixelRatio = this.device.canvasContext.cssToDeviceRatio();\n // @ts-expect-error TODO - assuming WebGL context\n const leftTop = this.device.canvasContext.cssToDevicePixels([x, y], true);\n // take left and top (y inverted in device pixels) from start location\n const deviceLeft = leftTop.x;\n const deviceTop = leftTop.y + leftTop.height;\n // take right and bottom (y inverted in device pixels) from end location\n // @ts-expect-error TODO - assuming WebGL context\n const rightBottom = this.device.canvasContext.cssToDevicePixels([x + width, y + height], true);\n const deviceRight = rightBottom.x + rightBottom.width;\n const deviceBottom = rightBottom.y;\n const deviceRect = {\n x: deviceLeft,\n y: deviceBottom,\n // deviceTop and deviceRight represent the first pixel outside the desired rect\n width: deviceRight - deviceLeft,\n height: deviceTop - deviceBottom\n };\n const pickedResult = this._drawAndSample({\n layers: pickableLayers,\n views,\n viewports,\n onViewportActive,\n deviceRect,\n cullRect: { x, y, width, height },\n effects,\n pass: `picking:${mode}`\n });\n const pickInfos = getUniqueObjects(pickedResult);\n // `getUniqueObjects` dedup by picked color\n // However different picked color may be linked to the same picked object, e.g. stroke and fill of the same polygon\n // picked from different sub layers of a GeoJsonLayer\n // Here after resolving the picked index with `layer.getPickingInfo`, we need to dedup again by unique picked objects\n const uniquePickedObjects = new Map();\n const uniqueInfos = [];\n const limitMaxObjects = Number.isFinite(maxObjects);\n for (let i = 0; i < pickInfos.length; i++) {\n if (limitMaxObjects && uniqueInfos.length >= maxObjects) {\n break;\n }\n const pickInfo = pickInfos[i];\n let info = {\n color: pickInfo.pickedColor,\n layer: null,\n index: pickInfo.pickedObjectIndex,\n picked: true,\n x,\n y,\n pixelRatio\n };\n info = getLayerPickingInfo({ layer: pickInfo.pickedLayer, info, mode });\n // info.layer is always populated because it's a picked pixel\n const pickedLayerId = info.layer.id;\n if (!uniquePickedObjects.has(pickedLayerId)) {\n uniquePickedObjects.set(pickedLayerId, new Set());\n }\n const uniqueObjectsInLayer = uniquePickedObjects.get(pickedLayerId);\n // info.object may be null if the layer is using non-iterable data.\n // Fall back to using index as identifier.\n const pickedObjectKey = info.object ?? info.index;\n if (!uniqueObjectsInLayer.has(pickedObjectKey)) {\n uniqueObjectsInLayer.add(pickedObjectKey);\n uniqueInfos.push(info);\n }\n }\n return uniqueInfos;\n }\n _drawAndSample({ layers, views, viewports, onViewportActive, deviceRect, cullRect, effects, pass }, pickZ = false) {\n const pickingFBO = pickZ ? this.depthFBO : this.pickingFBO;\n const opts = {\n layers,\n layerFilter: this.layerFilter,\n views,\n viewports,\n onViewportActive,\n pickingFBO,\n deviceRect,\n cullRect,\n effects,\n pass,\n pickZ,\n preRenderStats: {}\n };\n for (const effect of effects) {\n if (effect.useInPicking) {\n opts.preRenderStats[effect.id] = effect.preRender(opts);\n }\n }\n const { decodePickingColor } = this.pickLayersPass.render(opts);\n // Read from an already rendered picking buffer\n // Returns an Uint8ClampedArray of picked pixels\n const { x, y, width, height } = deviceRect;\n const pickedColors = new (pickZ ? Float32Array : Uint8Array)(width * height * 4);\n this.device.readPixelsToArrayWebGL(pickingFBO, {\n sourceX: x,\n sourceY: y,\n sourceWidth: width,\n sourceHeight: height,\n target: pickedColors\n });\n return { pickedColors, decodePickingColor };\n }\n // Calculate a picking rect centered on deviceX and deviceY and clipped to device\n // Returns null if pixel is outside of device\n _getPickingRect({ deviceX, deviceY, deviceRadius, deviceWidth, deviceHeight }) {\n // Create a box of size `radius * 2 + 1` centered at [deviceX, deviceY]\n const x = Math.max(0, deviceX - deviceRadius);\n const y = Math.max(0, deviceY - deviceRadius);\n const width = Math.min(deviceWidth, deviceX + deviceRadius + 1) - x;\n const height = Math.min(deviceHeight, deviceY + deviceRadius + 1) - y;\n // x, y out of bounds.\n if (width <= 0 || height <= 0) {\n return null;\n }\n return { x, y, width, height };\n }\n}\n", "import { EVENTS } from \"./constants.js\";\nimport { deepEqual } from \"../utils/deep-equal.js\";\nconst PLACEMENTS = {\n 'top-left': { top: 0, left: 0 },\n 'top-right': { top: 0, right: 0 },\n 'bottom-left': { bottom: 0, left: 0 },\n 'bottom-right': { bottom: 0, right: 0 },\n fill: { top: 0, left: 0, bottom: 0, right: 0 }\n};\nconst DEFAULT_PLACEMENT = 'top-left';\nconst ROOT_CONTAINER_ID = '__root';\nexport class WidgetManager {\n constructor({ deck, parentElement }) {\n /** Widgets added via the imperative API */\n this.defaultWidgets = [];\n /** Widgets received from the declarative API */\n this.widgets = [];\n /** Resolved widgets from both imperative and declarative APIs */\n this.resolvedWidgets = [];\n /** Mounted HTML containers */\n this.containers = {};\n /** Viewport provided to widget on redraw */\n this.lastViewports = {};\n this.deck = deck;\n this.parentElement = parentElement;\n }\n getWidgets() {\n return this.resolvedWidgets;\n }\n /** Declarative API to configure widgets */\n setProps(props) {\n if (props.widgets && !deepEqual(props.widgets, this.widgets, 1)) {\n this._setWidgets(props.widgets);\n }\n }\n finalize() {\n for (const widget of this.getWidgets()) {\n this._remove(widget);\n }\n this.defaultWidgets.length = 0;\n this.resolvedWidgets.length = 0;\n for (const id in this.containers) {\n this.containers[id].remove();\n }\n }\n /** Imperative API. Widgets added this way are not affected by the declarative prop. */\n addDefault(widget) {\n if (!this.defaultWidgets.find(w => w.id === widget.id)) {\n this._add(widget);\n this.defaultWidgets.push(widget);\n // Update widget list\n this._setWidgets(this.widgets);\n }\n }\n /** Resolve widgets from the declarative prop */\n _setWidgets(nextWidgets) {\n const oldWidgetMap = {};\n for (const widget of this.resolvedWidgets) {\n oldWidgetMap[widget.id] = widget;\n }\n // Clear and rebuild the list\n this.resolvedWidgets.length = 0;\n // Add all default widgets\n for (const widget of this.defaultWidgets) {\n oldWidgetMap[widget.id] = null;\n this.resolvedWidgets.push(widget);\n }\n for (let widget of nextWidgets) {\n const oldWidget = oldWidgetMap[widget.id];\n if (!oldWidget) {\n // Widget is new\n this._add(widget);\n }\n else if (\n // Widget placement changed\n oldWidget.viewId !== widget.viewId ||\n oldWidget.placement !== widget.placement) {\n this._remove(oldWidget);\n this._add(widget);\n }\n else if (widget !== oldWidget) {\n // Widget props changed\n oldWidget.setProps(widget.props);\n widget = oldWidget;\n }\n // mark as matched\n oldWidgetMap[widget.id] = null;\n this.resolvedWidgets.push(widget);\n }\n for (const id in oldWidgetMap) {\n const oldWidget = oldWidgetMap[id];\n if (oldWidget) {\n // No longer exists\n this._remove(oldWidget);\n }\n }\n this.widgets = nextWidgets;\n }\n _add(widget) {\n const { viewId = null, placement = DEFAULT_PLACEMENT } = widget;\n const element = widget.onAdd({ deck: this.deck, viewId });\n if (element) {\n this._getContainer(viewId, placement).append(element);\n }\n widget._element = element;\n }\n _remove(widget) {\n widget.onRemove();\n if (widget._element) {\n widget._element.remove();\n }\n widget._element = undefined;\n }\n /* global document */\n _getContainer(viewId, placement) {\n const containerId = viewId || ROOT_CONTAINER_ID;\n let viewContainer = this.containers[containerId];\n if (!viewContainer) {\n viewContainer = document.createElement('div');\n viewContainer.style.pointerEvents = 'none';\n viewContainer.style.position = 'absolute';\n viewContainer.style.overflow = 'hidden';\n this.parentElement?.append(viewContainer);\n this.containers[containerId] = viewContainer;\n }\n let container = viewContainer.querySelector(`.${placement}`);\n if (!container) {\n container = document.createElement('div');\n container.className = placement;\n container.style.position = 'absolute';\n container.style.zIndex = '2';\n Object.assign(container.style, PLACEMENTS[placement]);\n viewContainer.append(container);\n }\n return container;\n }\n _updateContainers() {\n const canvasWidth = this.deck.width;\n const canvasHeight = this.deck.height;\n for (const id in this.containers) {\n const viewport = this.lastViewports[id] || null;\n const visible = id === ROOT_CONTAINER_ID || viewport;\n const container = this.containers[id];\n if (visible) {\n container.style.display = 'block';\n // Align the container with the view\n container.style.left = `${viewport ? viewport.x : 0}px`;\n container.style.top = `${viewport ? viewport.y : 0}px`;\n container.style.width = `${viewport ? viewport.width : canvasWidth}px`;\n container.style.height = `${viewport ? viewport.height : canvasHeight}px`;\n }\n else {\n container.style.display = 'none';\n }\n }\n }\n onRedraw({ viewports, layers }) {\n const viewportsById = viewports.reduce((acc, v) => {\n acc[v.id] = v;\n return acc;\n }, {});\n const { lastViewports } = this;\n for (const widget of this.getWidgets()) {\n const { viewId } = widget;\n if (viewId) {\n // Attached to a specific view\n const viewport = viewportsById[viewId];\n if (viewport) {\n if (widget.onViewportChange && !viewport.equals(lastViewports[viewId])) {\n widget.onViewportChange(viewport);\n }\n widget.onRedraw?.({ viewports: [viewport], layers });\n }\n }\n else {\n // Not attached to a specific view\n if (widget.onViewportChange) {\n for (const viewport of viewports) {\n // eslint-disable-next-line max-depth\n if (!viewport.equals(lastViewports[viewport.id])) {\n widget.onViewportChange(viewport);\n }\n }\n }\n widget.onRedraw?.({ viewports, layers });\n }\n }\n this.lastViewports = viewportsById;\n this._updateContainers();\n }\n onHover(info, event) {\n for (const widget of this.getWidgets()) {\n const { viewId } = widget;\n if (!viewId || viewId === info.viewport?.id) {\n widget.onHover?.(info, event);\n }\n }\n }\n onEvent(info, event) {\n const eventOptions = EVENTS[event.type];\n if (!eventOptions) {\n return;\n }\n for (const widget of this.getWidgets()) {\n const { viewId } = widget;\n if (!viewId || viewId === info.viewport?.id) {\n widget[eventOptions.handler]?.(info, event);\n }\n }\n }\n}\n", "/* global document */\nconst defaultStyle = {\n zIndex: '1',\n position: 'absolute',\n pointerEvents: 'none',\n color: '#a0a7b4',\n backgroundColor: '#29323c',\n padding: '10px',\n top: '0',\n left: '0',\n display: 'none'\n};\nexport default class Tooltip {\n constructor() {\n this.id = 'default-tooltip';\n this.placement = 'fill';\n this.props = {};\n this.isVisible = false;\n }\n onAdd({ deck }) {\n const el = document.createElement('div');\n el.className = 'deck-tooltip';\n Object.assign(el.style, defaultStyle);\n this.deck = deck;\n this.element = el;\n return el;\n }\n onRemove() {\n this.deck = undefined;\n this.element = undefined;\n }\n setProps() { }\n onViewportChange(viewport) {\n if (this.isVisible && viewport.id === this.lastViewport?.id && viewport !== this.lastViewport) {\n // Camera has moved, clear tooltip\n this.setTooltip(null);\n }\n }\n onHover(info) {\n const { deck } = this;\n const getTooltip = deck && deck.props.getTooltip;\n if (!getTooltip) {\n return;\n }\n const displayInfo = getTooltip(info);\n this.lastViewport = info.viewport;\n this.setTooltip(displayInfo, info.x, info.y);\n }\n setTooltip(displayInfo, x, y) {\n const el = this.element;\n if (!el) {\n return;\n }\n if (typeof displayInfo === 'string') {\n el.innerText = displayInfo;\n }\n else if (!displayInfo) {\n this.isVisible = false;\n el.style.display = 'none';\n return;\n }\n else {\n if (displayInfo.text) {\n el.innerText = displayInfo.text;\n }\n if (displayInfo.html) {\n el.innerHTML = displayInfo.html;\n }\n if (displayInfo.className) {\n el.className = displayInfo.className;\n }\n }\n this.isVisible = true;\n el.style.display = 'block';\n el.style.transform = `translate(${x}px, ${y}px)`;\n if (displayInfo && typeof displayInfo === 'object' && 'style' in displayInfo) {\n Object.assign(el.style, displayInfo.style);\n }\n }\n}\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport LayerManager from \"./layer-manager.js\";\nimport ViewManager from \"./view-manager.js\";\nimport MapView from \"../views/map-view.js\";\nimport EffectManager from \"./effect-manager.js\";\nimport DeckRenderer from \"./deck-renderer.js\";\nimport DeckPicker from \"./deck-picker.js\";\nimport { WidgetManager } from \"./widget-manager.js\";\nimport Tooltip from \"./tooltip.js\";\nimport log from \"../utils/log.js\";\nimport { deepEqual } from \"../utils/deep-equal.js\";\nimport typedArrayManager from \"../utils/typed-array-manager.js\";\nimport { VERSION } from \"./init.js\";\nimport { luma } from '@luma.gl/core';\nimport { WebGLDevice } from '@luma.gl/webgl';\nimport { Timeline } from '@luma.gl/engine';\nimport { AnimationLoop } from '@luma.gl/engine';\nimport { GL } from '@luma.gl/constants';\nimport { Stats } from '@probe.gl/stats';\nimport { EventManager } from 'mjolnir.js';\nimport assert from \"../utils/assert.js\";\nimport { EVENTS } from \"./constants.js\";\n/* global document */\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nfunction noop() { }\nconst getCursor = ({ isDragging }) => (isDragging ? 'grabbing' : 'grab');\nconst defaultProps = {\n id: '',\n width: '100%',\n height: '100%',\n style: null,\n viewState: null,\n initialViewState: null,\n pickingRadius: 0,\n layerFilter: null,\n parameters: {},\n parent: null,\n device: null,\n deviceProps: { type: 'webgl' },\n gl: null,\n glOptions: {},\n canvas: null,\n layers: [],\n effects: [],\n views: null,\n controller: null, // Rely on external controller, e.g. react-map-gl\n useDevicePixels: true,\n touchAction: 'none',\n eventRecognizerOptions: {},\n _framebuffer: null,\n _animate: false,\n _pickable: true,\n _typedArrayManagerProps: {},\n _customRender: null,\n widgets: [],\n onDeviceInitialized: noop,\n onWebGLInitialized: noop,\n onResize: noop,\n onViewStateChange: noop,\n onInteractionStateChange: noop,\n onBeforeRender: noop,\n onAfterRender: noop,\n onLoad: noop,\n onError: (error) => log.error(error.message, error.cause)(),\n onHover: null,\n onClick: null,\n onDragStart: null,\n onDrag: null,\n onDragEnd: null,\n _onMetrics: null,\n getCursor,\n getTooltip: null,\n debug: false,\n drawPickingColors: false\n};\n/* eslint-disable max-statements */\nclass Deck {\n constructor(props) {\n this.width = 0;\n this.height = 0;\n // Allows attaching arbitrary data to the instance\n this.userData = {};\n this.device = null;\n this.canvas = null;\n this.viewManager = null;\n this.layerManager = null;\n this.effectManager = null;\n this.deckRenderer = null;\n this.deckPicker = null;\n this.eventManager = null;\n this.widgetManager = null;\n this.tooltip = null;\n this.animationLoop = null;\n this.cursorState = {\n isHovering: false,\n isDragging: false\n };\n this.stats = new Stats({ id: 'deck.gl' });\n this.metrics = {\n fps: 0,\n setPropsTime: 0,\n updateAttributesTime: 0,\n framesRedrawn: 0,\n pickTime: 0,\n pickCount: 0,\n gpuTime: 0,\n gpuTimePerFrame: 0,\n cpuTime: 0,\n cpuTimePerFrame: 0,\n bufferMemory: 0,\n textureMemory: 0,\n renderbufferMemory: 0,\n gpuMemory: 0\n };\n this._metricsCounter = 0;\n this._needsRedraw = 'Initial render';\n this._pickRequest = {\n mode: 'hover',\n x: -1,\n y: -1,\n radius: 0,\n event: null\n };\n /**\n * Pick and store the object under the pointer on `pointerdown`.\n * This object is reused for subsequent `onClick` and `onDrag*` callbacks.\n */\n this._lastPointerDownInfo = null;\n // The `pointermove` event may fire multiple times in between two animation frames,\n // it's a waste of time to run picking without rerender. Instead we save the last pick\n // request and only do it once on the next animation frame.\n /** Internal use only: event handler for pointerdown */\n this._onPointerMove = (event) => {\n const { _pickRequest } = this;\n if (event.type === 'pointerleave') {\n _pickRequest.x = -1;\n _pickRequest.y = -1;\n _pickRequest.radius = 0;\n }\n else if (event.leftButton || event.rightButton) {\n // Do not trigger onHover callbacks if mouse button is down.\n return;\n }\n else {\n const pos = event.offsetCenter;\n // Do not trigger callbacks when click/hover position is invalid. Doing so will cause a\n // assertion error when attempting to unproject the position.\n if (!pos) {\n return;\n }\n _pickRequest.x = pos.x;\n _pickRequest.y = pos.y;\n _pickRequest.radius = this.props.pickingRadius;\n }\n if (this.layerManager) {\n this.layerManager.context.mousePosition = { x: _pickRequest.x, y: _pickRequest.y };\n }\n _pickRequest.event = event;\n };\n /** Internal use only: event handler for click & drag */\n this._onEvent = (event) => {\n const eventOptions = EVENTS[event.type];\n const pos = event.offsetCenter;\n if (!eventOptions || !pos || !this.layerManager) {\n return;\n }\n // Reuse last picked object\n const layers = this.layerManager.getLayers();\n const info = this.deckPicker.getLastPickedObject({\n x: pos.x,\n y: pos.y,\n layers,\n viewports: this.getViewports(pos)\n }, this._lastPointerDownInfo);\n const { layer } = info;\n const layerHandler = layer && (layer[eventOptions.handler] || layer.props[eventOptions.handler]);\n const rootHandler = this.props[eventOptions.handler];\n let handled = false;\n if (layerHandler) {\n handled = layerHandler.call(layer, info, event);\n }\n if (!handled) {\n rootHandler?.(info, event);\n this.widgetManager.onEvent(info, event);\n }\n };\n /** Internal use only: evnet handler for pointerdown */\n this._onPointerDown = (event) => {\n const pos = event.offsetCenter;\n const pickedInfo = this._pick('pickObject', 'pickObject Time', {\n x: pos.x,\n y: pos.y,\n radius: this.props.pickingRadius\n });\n this._lastPointerDownInfo = pickedInfo.result[0] || pickedInfo.emptyInfo;\n };\n // @ts-ignore views\n this.props = { ...defaultProps, ...props };\n props = this.props;\n if (props.viewState && props.initialViewState) {\n log.warn('View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.')();\n }\n this.viewState = this.props.initialViewState;\n // See if we already have a device\n if (props.device) {\n this.device = props.device;\n }\n else if (props.gl) {\n if (props.gl instanceof WebGLRenderingContext) {\n log.error('WebGL1 context not supported.')();\n }\n this.device = WebGLDevice.attach(props.gl);\n }\n let deviceOrPromise = this.device;\n if (!deviceOrPromise) {\n // TODO v9 should we install WebGL backend as default for now?\n luma.registerDevices([WebGLDevice]);\n deviceOrPromise = luma.createDevice({\n ...props.deviceProps,\n canvas: this._createCanvas(props)\n });\n }\n this.animationLoop = this._createAnimationLoop(deviceOrPromise, props);\n this.setProps(props);\n // UNSAFE/experimental prop: only set at initialization to avoid performance hit\n if (props._typedArrayManagerProps) {\n typedArrayManager.setOptions(props._typedArrayManagerProps);\n }\n this.animationLoop.start();\n }\n /** Stop rendering and dispose all resources */\n finalize() {\n this.animationLoop?.stop();\n this.animationLoop?.destroy();\n this.animationLoop = null;\n this._lastPointerDownInfo = null;\n this.layerManager?.finalize();\n this.layerManager = null;\n this.viewManager?.finalize();\n this.viewManager = null;\n this.effectManager?.finalize();\n this.effectManager = null;\n this.deckRenderer?.finalize();\n this.deckRenderer = null;\n this.deckPicker?.finalize();\n this.deckPicker = null;\n this.eventManager?.destroy();\n this.eventManager = null;\n this.widgetManager?.finalize();\n this.widgetManager = null;\n if (!this.props.canvas && !this.props.device && !this.props.gl && this.canvas) {\n // remove internally created canvas\n this.canvas.parentElement?.removeChild(this.canvas);\n this.canvas = null;\n }\n }\n /** Partially update props */\n setProps(props) {\n this.stats.get('setProps Time').timeStart();\n if ('onLayerHover' in props) {\n log.removed('onLayerHover', 'onHover')();\n }\n if ('onLayerClick' in props) {\n log.removed('onLayerClick', 'onClick')();\n }\n if (props.initialViewState &&\n // depth = 3 when comparing viewStates: viewId.position.0\n !deepEqual(this.props.initialViewState, props.initialViewState, 3)) {\n // Overwrite internal view state\n this.viewState = props.initialViewState;\n }\n // Merge with existing props\n Object.assign(this.props, props);\n // Update CSS size of canvas\n this._setCanvasSize(this.props);\n // We need to overwrite CSS style width and height with actual, numeric values\n const resolvedProps = Object.create(this.props);\n Object.assign(resolvedProps, {\n views: this._getViews(),\n width: this.width,\n height: this.height,\n viewState: this._getViewState()\n });\n // Update the animation loop\n this.animationLoop?.setProps(resolvedProps);\n // If initialized, update sub manager props\n if (this.layerManager) {\n this.viewManager.setProps(resolvedProps);\n // Make sure that any new layer gets initialized with the current viewport\n this.layerManager.activateViewport(this.getViewports()[0]);\n this.layerManager.setProps(resolvedProps);\n this.effectManager.setProps(resolvedProps);\n this.deckRenderer.setProps(resolvedProps);\n this.deckPicker.setProps(resolvedProps);\n this.widgetManager.setProps(resolvedProps);\n }\n this.stats.get('setProps Time').timeEnd();\n }\n // Public API\n /**\n * Check if a redraw is needed\n * @returns `false` or a string summarizing the redraw reason\n */\n needsRedraw(opts = { clearRedrawFlags: false }) {\n if (!this.layerManager) {\n // Not initialized or already finalized\n return false;\n }\n if (this.props._animate) {\n return 'Deck._animate';\n }\n let redraw = this._needsRedraw;\n if (opts.clearRedrawFlags) {\n this._needsRedraw = false;\n }\n const viewManagerNeedsRedraw = this.viewManager.needsRedraw(opts);\n const layerManagerNeedsRedraw = this.layerManager.needsRedraw(opts);\n const effectManagerNeedsRedraw = this.effectManager.needsRedraw(opts);\n const deckRendererNeedsRedraw = this.deckRenderer.needsRedraw(opts);\n redraw =\n redraw ||\n viewManagerNeedsRedraw ||\n layerManagerNeedsRedraw ||\n effectManagerNeedsRedraw ||\n deckRendererNeedsRedraw;\n return redraw;\n }\n /**\n * Redraw the GL context\n * @param reason If not provided, only redraw if deemed necessary. Otherwise redraw regardless of internal states.\n * @returns\n */\n redraw(reason) {\n if (!this.layerManager) {\n // Not yet initialized\n return;\n }\n // Check if we need to redraw\n let redrawReason = this.needsRedraw({ clearRedrawFlags: true });\n // User-supplied should take precedent, however the redraw flags get cleared regardless\n redrawReason = reason || redrawReason;\n if (!redrawReason) {\n return;\n }\n this.stats.get('Redraw Count').incrementCount();\n if (this.props._customRender) {\n this.props._customRender(redrawReason);\n }\n else {\n this._drawLayers(redrawReason);\n }\n }\n /** Flag indicating that the Deck instance has initialized its resources and it's safe to call public methods. */\n get isInitialized() {\n return this.viewManager !== null;\n }\n /** Get a list of views that are currently rendered */\n getViews() {\n assert(this.viewManager);\n return this.viewManager.views;\n }\n /** Get a list of viewports that are currently rendered.\n * @param rect If provided, only returns viewports within the given bounding box.\n */\n getViewports(rect) {\n assert(this.viewManager);\n return this.viewManager.getViewports(rect);\n }\n /** Get the current canvas element. */\n getCanvas() {\n return this.canvas;\n }\n /** Query the object rendered on top at a given point */\n pickObject(opts) {\n const infos = this._pick('pickObject', 'pickObject Time', opts).result;\n return infos.length ? infos[0] : null;\n }\n /* Query all rendered objects at a given point */\n pickMultipleObjects(opts) {\n opts.depth = opts.depth || 10;\n return this._pick('pickObject', 'pickMultipleObjects Time', opts).result;\n }\n /* Query all objects rendered on top within a bounding box */\n pickObjects(opts) {\n return this._pick('pickObjects', 'pickObjects Time', opts);\n }\n /** Experimental\n * Add a global resource for sharing among layers\n */\n _addResources(resources, forceUpdate = false) {\n for (const id in resources) {\n this.layerManager.resourceManager.add({ resourceId: id, data: resources[id], forceUpdate });\n }\n }\n /** Experimental\n * Remove a global resource\n */\n _removeResources(resourceIds) {\n for (const id of resourceIds) {\n this.layerManager.resourceManager.remove(id);\n }\n }\n /** Experimental\n * Register a default effect. Effects will be sorted by order, those with a low order will be rendered first\n */\n _addDefaultEffect(effect) {\n this.effectManager.addDefaultEffect(effect);\n }\n _addDefaultShaderModule(module) {\n this.layerManager.addDefaultShaderModule(module);\n }\n _removeDefaultShaderModule(module) {\n this.layerManager?.removeDefaultShaderModule(module);\n }\n _pick(method, statKey, opts) {\n assert(this.deckPicker);\n const { stats } = this;\n stats.get('Pick Count').incrementCount();\n stats.get(statKey).timeStart();\n const infos = this.deckPicker[method]({\n // layerManager, viewManager and effectManager are always defined if deckPicker is\n layers: this.layerManager.getLayers(opts),\n views: this.viewManager.getViews(),\n viewports: this.getViewports(opts),\n onViewportActive: this.layerManager.activateViewport,\n effects: this.effectManager.getEffects(),\n ...opts\n });\n stats.get(statKey).timeEnd();\n return infos;\n }\n /** Resolve props.canvas to element */\n _createCanvas(props) {\n let canvas = props.canvas;\n // TODO EventManager should accept element id\n if (typeof canvas === 'string') {\n canvas = document.getElementById(canvas);\n assert(canvas);\n }\n if (!canvas) {\n canvas = document.createElement('canvas');\n canvas.id = props.id || 'deckgl-overlay';\n const parent = props.parent || document.body;\n parent.appendChild(canvas);\n }\n Object.assign(canvas.style, props.style);\n return canvas;\n }\n /** Updates canvas width and/or height, if provided as props */\n _setCanvasSize(props) {\n if (!this.canvas) {\n return;\n }\n const { width, height } = props;\n // Set size ONLY if props are being provided, otherwise let canvas be layouted freely\n if (width || width === 0) {\n const cssWidth = Number.isFinite(width) ? `${width}px` : width;\n this.canvas.style.width = cssWidth;\n }\n if (height || height === 0) {\n const cssHeight = Number.isFinite(height) ? `${height}px` : height;\n // Note: position==='absolute' required for height 100% to work\n this.canvas.style.position = props.style?.position || 'absolute';\n this.canvas.style.height = cssHeight;\n }\n }\n /** If canvas size has changed, reads out the new size and update */\n _updateCanvasSize() {\n const { canvas } = this;\n if (!canvas) {\n return;\n }\n // Fallback to width/height when clientWidth/clientHeight are undefined (OffscreenCanvas).\n const newWidth = canvas.clientWidth ?? canvas.width;\n const newHeight = canvas.clientHeight ?? canvas.height;\n if (newWidth !== this.width || newHeight !== this.height) {\n // @ts-expect-error private assign to read-only property\n this.width = newWidth;\n // @ts-expect-error private assign to read-only property\n this.height = newHeight;\n this.viewManager?.setProps({ width: newWidth, height: newHeight });\n // Make sure that any new layer gets initialized with the current viewport\n this.layerManager?.activateViewport(this.getViewports()[0]);\n this.props.onResize({ width: newWidth, height: newHeight });\n }\n }\n _createAnimationLoop(deviceOrPromise, props) {\n const { \n // width,\n // height,\n gl, \n // deviceProps,\n // glOptions,\n // debug,\n onError, \n // onBeforeRender,\n // onAfterRender,\n useDevicePixels } = props;\n return new AnimationLoop({\n device: deviceOrPromise,\n useDevicePixels,\n // TODO v9\n autoResizeDrawingBuffer: !gl, // do not auto resize external context\n autoResizeViewport: false,\n // @ts-expect-error luma.gl needs to accept Promise return value\n onInitialize: context => this._setDevice(context.device),\n onRender: this._onRenderFrame.bind(this),\n // @ts-expect-error typing mismatch: AnimationLoop does not accept onError:null\n onError\n // onBeforeRender,\n // onAfterRender,\n });\n }\n // Get the most relevant view state: props.viewState, if supplied, shadows internal viewState\n // TODO: For backwards compatibility ensure numeric width and height is added to the viewState\n _getViewState() {\n return this.props.viewState || this.viewState;\n }\n // Get the view descriptor list\n _getViews() {\n const { views } = this.props;\n const normalizedViews = Array.isArray(views)\n ? views\n : // If null, default to a full screen map view port\n views\n ? [views]\n : [new MapView({ id: 'default-view' })];\n if (normalizedViews.length && this.props.controller) {\n // Backward compatibility: support controller prop\n normalizedViews[0].props.controller = this.props.controller;\n }\n return normalizedViews;\n }\n _onContextLost() {\n const { onError } = this.props;\n if (this.animationLoop && onError) {\n onError(new Error('WebGL context is lost'));\n }\n }\n /** Actually run picking */\n _pickAndCallback() {\n const { _pickRequest } = this;\n if (_pickRequest.event) {\n // Perform picking\n const { result, emptyInfo } = this._pick('pickObject', 'pickObject Time', _pickRequest);\n this.cursorState.isHovering = result.length > 0;\n // There are 4 possible scenarios:\n // result is [outInfo, pickedInfo] (moved from one pickable layer to another)\n // result is [outInfo] (moved outside of a pickable layer)\n // result is [pickedInfo] (moved into or over a pickable layer)\n // result is [] (nothing is or was picked)\n //\n // `layer.props.onHover` should be called on all affected layers (out/over)\n // `deck.props.onHover` should be called with the picked info if any, or empty info otherwise\n // `deck.props.getTooltip` should be called with the picked info if any, or empty info otherwise\n // Execute callbacks\n let pickedInfo = emptyInfo;\n let handled = false;\n for (const info of result) {\n pickedInfo = info;\n handled = info.layer?.onHover(info, _pickRequest.event) || handled;\n }\n if (!handled) {\n this.props.onHover?.(pickedInfo, _pickRequest.event);\n this.widgetManager.onHover(pickedInfo, _pickRequest.event);\n }\n // Clear pending pickRequest\n _pickRequest.event = null;\n }\n }\n _updateCursor() {\n const container = this.props.parent || this.canvas;\n if (container) {\n container.style.cursor = this.props.getCursor(this.cursorState);\n }\n }\n _setDevice(device) {\n this.device = device;\n if (!this.animationLoop) {\n // finalize() has been called\n return;\n }\n // if external context...\n if (!this.canvas) {\n this.canvas = this.device.canvasContext?.canvas;\n // TODO v9\n // ts-expect-error - Currently luma.gl v9 does not expose these options\n // All WebGLDevice contexts are instrumented, but it seems the device\n // should have a method to start state tracking even if not enabled?\n // instrumentGLContext(this.device.gl, {enable: true, copyState: true});\n }\n this.device.setParametersWebGL({\n blend: true,\n blendFunc: [770, 771, 1, 771],\n polygonOffsetFill: true,\n depthTest: true,\n depthFunc: 515\n });\n this.props.onDeviceInitialized(this.device);\n if (this.device instanceof WebGLDevice) {\n // Legacy callback - warn?\n this.props.onWebGLInitialized(this.device.gl);\n }\n // timeline for transitions\n const timeline = new Timeline();\n timeline.play();\n this.animationLoop.attachTimeline(timeline);\n this.eventManager = new EventManager(this.props.parent || this.canvas, {\n touchAction: this.props.touchAction,\n recognizerOptions: this.props.eventRecognizerOptions,\n events: {\n pointerdown: this._onPointerDown,\n pointermove: this._onPointerMove,\n pointerleave: this._onPointerMove\n }\n });\n for (const eventType in EVENTS) {\n this.eventManager.on(eventType, this._onEvent);\n }\n this.viewManager = new ViewManager({\n timeline,\n eventManager: this.eventManager,\n onViewStateChange: this._onViewStateChange.bind(this),\n onInteractionStateChange: this._onInteractionStateChange.bind(this),\n views: this._getViews(),\n viewState: this._getViewState(),\n width: this.width,\n height: this.height\n });\n // viewManager must be initialized before layerManager\n // layerManager depends on viewport created by viewManager.\n const viewport = this.viewManager.getViewports()[0];\n // Note: avoid React setState due GL animation loop / setState timing issue\n this.layerManager = new LayerManager(this.device, {\n deck: this,\n stats: this.stats,\n viewport,\n timeline\n });\n this.effectManager = new EffectManager({\n deck: this,\n device: this.device\n });\n this.deckRenderer = new DeckRenderer(this.device);\n this.deckPicker = new DeckPicker(this.device);\n this.widgetManager = new WidgetManager({\n deck: this,\n parentElement: this.canvas?.parentElement\n });\n this.widgetManager.addDefault(new Tooltip());\n this.setProps(this.props);\n this._updateCanvasSize();\n this.props.onLoad();\n }\n /** Internal only: default render function (redraw all layers and views) */\n _drawLayers(redrawReason, renderOptions) {\n const { device, gl } = this.layerManager.context;\n this.props.onBeforeRender({ device, gl });\n const opts = {\n target: this.props._framebuffer,\n layers: this.layerManager.getLayers(),\n viewports: this.viewManager.getViewports(),\n onViewportActive: this.layerManager.activateViewport,\n views: this.viewManager.getViews(),\n pass: 'screen',\n effects: this.effectManager.getEffects(),\n ...renderOptions\n };\n this.deckRenderer?.renderLayers(opts);\n if (opts.pass === 'screen') {\n // This method could be called when drawing to picking buffer, texture etc.\n // Only when drawing to screen, update all widgets (UI components)\n this.widgetManager.onRedraw({\n viewports: opts.viewports,\n layers: opts.layers\n });\n }\n this.props.onAfterRender({ device, gl });\n }\n // Callbacks\n _onRenderFrame() {\n this._getFrameStats();\n // Log perf stats every second\n if (this._metricsCounter++ % 60 === 0) {\n this._getMetrics();\n this.stats.reset();\n log.table(4, this.metrics)();\n // Experimental: report metrics\n if (this.props._onMetrics) {\n this.props._onMetrics(this.metrics);\n }\n }\n this._updateCanvasSize();\n this._updateCursor();\n // Update layers if needed (e.g. some async prop has loaded)\n // Note: This can trigger a redraw\n this.layerManager.updateLayers();\n // Perform picking request if any\n this._pickAndCallback();\n // Redraw if necessary\n this.redraw();\n // Update viewport transition if needed\n // Note: this can trigger `onViewStateChange`, and affect layers\n // We want to defer these changes to the next frame\n if (this.viewManager) {\n this.viewManager.updateViewStates();\n }\n }\n // Callbacks\n _onViewStateChange(params) {\n // Let app know that view state is changing, and give it a chance to change it\n const viewState = this.props.onViewStateChange(params) || params.viewState;\n // If initialViewState was set on creation, auto track position\n if (this.viewState) {\n this.viewState = { ...this.viewState, [params.viewId]: viewState };\n if (!this.props.viewState) {\n // Apply internal view state\n if (this.viewManager) {\n this.viewManager.setProps({ viewState: this.viewState });\n }\n }\n }\n }\n _onInteractionStateChange(interactionState) {\n this.cursorState.isDragging = interactionState.isDragging || false;\n this.props.onInteractionStateChange(interactionState);\n }\n _getFrameStats() {\n const { stats } = this;\n stats.get('frameRate').timeEnd();\n stats.get('frameRate').timeStart();\n // Get individual stats from luma.gl so reset works\n const animationLoopStats = this.animationLoop.stats;\n stats.get('GPU Time').addTime(animationLoopStats.get('GPU Time').lastTiming);\n stats.get('CPU Time').addTime(animationLoopStats.get('CPU Time').lastTiming);\n }\n _getMetrics() {\n const { metrics, stats } = this;\n metrics.fps = stats.get('frameRate').getHz();\n metrics.setPropsTime = stats.get('setProps Time').time;\n metrics.updateAttributesTime = stats.get('Update Attributes').time;\n metrics.framesRedrawn = stats.get('Redraw Count').count;\n metrics.pickTime =\n stats.get('pickObject Time').time +\n stats.get('pickMultipleObjects Time').time +\n stats.get('pickObjects Time').time;\n metrics.pickCount = stats.get('Pick Count').count;\n // Luma stats\n metrics.gpuTime = stats.get('GPU Time').time;\n metrics.cpuTime = stats.get('CPU Time').time;\n metrics.gpuTimePerFrame = stats.get('GPU Time').getAverageTime();\n metrics.cpuTimePerFrame = stats.get('CPU Time').getAverageTime();\n const memoryStats = luma.stats.get('Memory Usage');\n metrics.bufferMemory = memoryStats.get('Buffer Memory').count;\n metrics.textureMemory = memoryStats.get('Texture Memory').count;\n metrics.renderbufferMemory = memoryStats.get('Renderbuffer Memory').count;\n metrics.gpuMemory = memoryStats.get('GPU Memory').count;\n }\n}\nDeck.defaultProps = defaultProps;\n// This is used to defeat tree shaking of init.js\n// https://github.com/visgl/deck.gl/issues/3213\nDeck.VERSION = VERSION;\nexport default Deck;\n", "import { Buffer } from '@luma.gl/core';\nimport { typedArrayFromDataType, getBufferAttributeLayout, getStride, dataTypeFromTypedArray } from \"./gl-utils.js\";\nimport typedArrayManager from \"../../utils/typed-array-manager.js\";\nimport { toDoublePrecisionArray } from \"../../utils/math-utils.js\";\nimport log from \"../../utils/log.js\";\nfunction resolveShaderAttribute(baseAccessor, shaderAttributeOptions) {\n if (shaderAttributeOptions.offset) {\n log.removed('shaderAttribute.offset', 'vertexOffset, elementOffset')();\n }\n // All shader attributes share the parent's stride\n const stride = getStride(baseAccessor);\n // `vertexOffset` is used to access the neighboring vertex's value\n // e.g. `nextPositions` in polygon\n const vertexOffset = shaderAttributeOptions.vertexOffset !== undefined\n ? shaderAttributeOptions.vertexOffset\n : baseAccessor.vertexOffset || 0;\n // `elementOffset` is defined when shader attribute's size is smaller than the parent's\n // e.g. `translations` in transform matrix\n const elementOffset = shaderAttributeOptions.elementOffset || 0;\n const offset = \n // offsets defined by the attribute\n vertexOffset * stride +\n elementOffset * baseAccessor.bytesPerElement +\n // offsets defined by external buffers if any\n (baseAccessor.offset || 0);\n return {\n ...shaderAttributeOptions,\n offset,\n stride\n };\n}\nfunction resolveDoublePrecisionShaderAttributes(baseAccessor, shaderAttributeOptions) {\n const resolvedOptions = resolveShaderAttribute(baseAccessor, shaderAttributeOptions);\n return {\n high: resolvedOptions,\n low: {\n ...resolvedOptions,\n offset: resolvedOptions.offset + baseAccessor.size * 4\n }\n };\n}\nexport default class DataColumn {\n /* eslint-disable max-statements */\n constructor(device, opts, state) {\n this._buffer = null;\n this.device = device;\n this.id = opts.id || '';\n this.size = opts.size || 1;\n const logicalType = opts.logicalType || opts.type;\n const doublePrecision = logicalType === 'float64';\n let { defaultValue } = opts;\n defaultValue = Number.isFinite(defaultValue)\n ? [defaultValue]\n : defaultValue || new Array(this.size).fill(0);\n let bufferType;\n if (doublePrecision) {\n bufferType = 'float32';\n }\n else if (!logicalType && opts.isIndexed) {\n bufferType = 'uint32';\n }\n else {\n bufferType = logicalType || 'float32';\n }\n // This is the attribute type defined by the layer\n // If an external buffer is provided, this.type may be overwritten\n // But we always want to use defaultType for allocation\n let defaultType = typedArrayFromDataType(logicalType || bufferType);\n this.doublePrecision = doublePrecision;\n // `fp64: false` tells a double-precision attribute to allocate Float32Arrays\n // by default when using auto-packing. This is more efficient in use cases where\n // high precision is unnecessary, but the `64Low` attribute is still required\n // by the shader.\n if (doublePrecision && opts.fp64 === false) {\n defaultType = Float32Array;\n }\n this.value = null;\n this.settings = {\n ...opts,\n defaultType,\n defaultValue: defaultValue,\n logicalType,\n type: bufferType,\n normalized: bufferType.includes('norm'),\n size: this.size,\n bytesPerElement: defaultType.BYTES_PER_ELEMENT\n };\n this.state = {\n ...state,\n externalBuffer: null,\n bufferAccessor: this.settings,\n allocatedValue: null,\n numInstances: 0,\n bounds: null,\n constant: false\n };\n }\n /* eslint-enable max-statements */\n get isConstant() {\n return this.state.constant;\n }\n get buffer() {\n return this._buffer;\n }\n get byteOffset() {\n const accessor = this.getAccessor();\n if (accessor.vertexOffset) {\n return accessor.vertexOffset * getStride(accessor);\n }\n return 0;\n }\n get numInstances() {\n return this.state.numInstances;\n }\n set numInstances(n) {\n this.state.numInstances = n;\n }\n delete() {\n if (this._buffer) {\n this._buffer.delete();\n this._buffer = null;\n }\n typedArrayManager.release(this.state.allocatedValue);\n }\n getBuffer() {\n if (this.state.constant) {\n return null;\n }\n return this.state.externalBuffer || this._buffer;\n }\n getValue(attributeName = this.id, options = null) {\n const result = {};\n if (this.state.constant) {\n const value = this.value;\n if (options) {\n const shaderAttributeDef = resolveShaderAttribute(this.getAccessor(), options);\n const offset = shaderAttributeDef.offset / value.BYTES_PER_ELEMENT;\n const size = shaderAttributeDef.size || this.size;\n result[attributeName] = value.subarray(offset, offset + size);\n }\n else {\n result[attributeName] = value;\n }\n }\n else {\n result[attributeName] = this.getBuffer();\n }\n if (this.doublePrecision) {\n if (this.value instanceof Float64Array) {\n result[`${attributeName}64Low`] = result[attributeName];\n }\n else {\n // Disable fp64 low part\n result[`${attributeName}64Low`] = new Float32Array(this.size);\n }\n }\n return result;\n }\n _getBufferLayout(attributeName = this.id, options = null) {\n const accessor = this.getAccessor();\n const attributes = [];\n const result = {\n name: this.id,\n byteStride: getStride(accessor),\n attributes\n };\n if (this.doublePrecision) {\n const doubleShaderAttributeDefs = resolveDoublePrecisionShaderAttributes(accessor, options || {});\n attributes.push(getBufferAttributeLayout(attributeName, { ...accessor, ...doubleShaderAttributeDefs.high }), getBufferAttributeLayout(`${attributeName}64Low`, {\n ...accessor,\n ...doubleShaderAttributeDefs.low\n }));\n }\n else if (options) {\n const shaderAttributeDef = resolveShaderAttribute(accessor, options);\n attributes.push(getBufferAttributeLayout(attributeName, { ...accessor, ...shaderAttributeDef }));\n }\n else {\n attributes.push(getBufferAttributeLayout(attributeName, accessor));\n }\n return result;\n }\n setAccessor(accessor) {\n this.state.bufferAccessor = accessor;\n }\n getAccessor() {\n return this.state.bufferAccessor;\n }\n // Returns [min: Array(size), max: Array(size)]\n /* eslint-disable max-depth */\n getBounds() {\n if (this.state.bounds) {\n return this.state.bounds;\n }\n let result = null;\n if (this.state.constant && this.value) {\n const min = Array.from(this.value);\n result = [min, min];\n }\n else {\n const { value, numInstances, size } = this;\n const len = numInstances * size;\n if (value && len && value.length >= len) {\n const min = new Array(size).fill(Infinity);\n const max = new Array(size).fill(-Infinity);\n for (let i = 0; i < len;) {\n for (let j = 0; j < size; j++) {\n const v = value[i++];\n if (v < min[j])\n min[j] = v;\n if (v > max[j])\n max[j] = v;\n }\n }\n result = [min, max];\n }\n }\n this.state.bounds = result;\n return result;\n }\n // returns true if success\n // eslint-disable-next-line max-statements\n setData(data) {\n const { state } = this;\n let opts;\n if (ArrayBuffer.isView(data)) {\n opts = { value: data };\n }\n else if (data instanceof Buffer) {\n opts = { buffer: data };\n }\n else {\n opts = data;\n }\n const accessor = { ...this.settings, ...opts };\n if (ArrayBuffer.isView(opts.value)) {\n if (!opts.type) {\n // Deduce data type\n const is64Bit = this.doublePrecision && opts.value instanceof Float64Array;\n if (is64Bit) {\n accessor.type = 'float32';\n }\n else {\n const type = dataTypeFromTypedArray(opts.value);\n accessor.type = accessor.normalized ? type.replace('int', 'norm') : type;\n }\n }\n accessor.bytesPerElement = opts.value.BYTES_PER_ELEMENT;\n accessor.stride = getStride(accessor);\n }\n state.bounds = null; // clear cached bounds\n if (opts.constant) {\n // set constant\n let value = opts.value;\n value = this._normalizeValue(value, [], 0);\n if (this.settings.normalized) {\n value = this.normalizeConstant(value);\n }\n const hasChanged = !state.constant || !this._areValuesEqual(value, this.value);\n if (!hasChanged) {\n return false;\n }\n state.externalBuffer = null;\n state.constant = true;\n this.value = ArrayBuffer.isView(value) ? value : new Float32Array(value);\n }\n else if (opts.buffer) {\n const buffer = opts.buffer;\n state.externalBuffer = buffer;\n state.constant = false;\n this.value = opts.value || null;\n }\n else if (opts.value) {\n this._checkExternalBuffer(opts);\n let value = opts.value;\n state.externalBuffer = null;\n state.constant = false;\n this.value = value;\n let { buffer } = this;\n const stride = getStride(accessor);\n const byteOffset = (accessor.vertexOffset || 0) * stride;\n if (this.doublePrecision && value instanceof Float64Array) {\n value = toDoublePrecisionArray(value, accessor);\n }\n if (this.settings.isIndexed) {\n const ArrayType = this.settings.defaultType;\n if (value.constructor !== ArrayType) {\n // Cast the index buffer to expected type\n value = new ArrayType(value);\n }\n }\n // A small over allocation is used as safety margin\n // Shader attributes may try to access this buffer with bigger offsets\n const requiredBufferSize = value.byteLength + byteOffset + stride * 2;\n if (!buffer || buffer.byteLength < requiredBufferSize) {\n buffer = this._createBuffer(requiredBufferSize);\n }\n buffer.write(value, byteOffset);\n }\n this.setAccessor(accessor);\n return true;\n }\n updateSubBuffer(opts = {}) {\n this.state.bounds = null; // clear cached bounds\n const value = this.value;\n const { startOffset = 0, endOffset } = opts;\n this.buffer.write(this.doublePrecision && value instanceof Float64Array\n ? toDoublePrecisionArray(value, {\n size: this.size,\n startIndex: startOffset,\n endIndex: endOffset\n })\n : value.subarray(startOffset, endOffset), startOffset * value.BYTES_PER_ELEMENT + this.byteOffset);\n }\n allocate(numInstances, copy = false) {\n const { state } = this;\n const oldValue = state.allocatedValue;\n // Allocate at least one element to ensure a valid buffer\n const value = typedArrayManager.allocate(oldValue, numInstances + 1, {\n size: this.size,\n type: this.settings.defaultType,\n copy\n });\n this.value = value;\n const { byteOffset } = this;\n let { buffer } = this;\n if (!buffer || buffer.byteLength < value.byteLength + byteOffset) {\n buffer = this._createBuffer(value.byteLength + byteOffset);\n if (copy && oldValue) {\n // Upload the full existing attribute value to the GPU, so that updateBuffer\n // can choose to only update a partial range.\n // TODO - copy old buffer to new buffer on the GPU\n buffer.write(oldValue instanceof Float64Array ? toDoublePrecisionArray(oldValue, this) : oldValue, byteOffset);\n }\n }\n state.allocatedValue = value;\n state.constant = false;\n state.externalBuffer = null;\n this.setAccessor(this.settings);\n return true;\n }\n // PRIVATE HELPER METHODS\n _checkExternalBuffer(opts) {\n const { value } = opts;\n if (!ArrayBuffer.isView(value)) {\n throw new Error(`Attribute ${this.id} value is not TypedArray`);\n }\n const ArrayType = this.settings.defaultType;\n let illegalArrayType = false;\n if (this.doublePrecision) {\n // not 32bit or 64bit\n illegalArrayType = value.BYTES_PER_ELEMENT < 4;\n }\n if (illegalArrayType) {\n throw new Error(`Attribute ${this.id} does not support ${value.constructor.name}`);\n }\n if (!(value instanceof ArrayType) && this.settings.normalized && !('normalized' in opts)) {\n log.warn(`Attribute ${this.id} is normalized`)();\n }\n }\n // https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttribPointer\n normalizeConstant(value) {\n /* eslint-disable complexity */\n switch (this.settings.type) {\n case 'snorm8':\n // normalize [-128, 127] to [-1, 1]\n return new Float32Array(value).map(x => ((x + 128) / 255) * 2 - 1);\n case 'snorm16':\n // normalize [-32768, 32767] to [-1, 1]\n return new Float32Array(value).map(x => ((x + 32768) / 65535) * 2 - 1);\n case 'unorm8':\n // normalize [0, 255] to [0, 1]\n return new Float32Array(value).map(x => x / 255);\n case 'unorm16':\n // normalize [0, 65535] to [0, 1]\n return new Float32Array(value).map(x => x / 65535);\n default:\n // No normalization for gl.FLOAT and gl.HALF_FLOAT\n return value;\n }\n }\n /* check user supplied values and apply fallback */\n _normalizeValue(value, out, start) {\n const { defaultValue, size } = this.settings;\n if (Number.isFinite(value)) {\n out[start] = value;\n return out;\n }\n if (!value) {\n let i = size;\n while (--i >= 0) {\n out[start + i] = defaultValue[i];\n }\n return out;\n }\n // Important - switch cases are 5x more performant than a for loop!\n /* eslint-disable no-fallthrough, default-case */\n switch (size) {\n case 4:\n out[start + 3] = Number.isFinite(value[3]) ? value[3] : defaultValue[3];\n case 3:\n out[start + 2] = Number.isFinite(value[2]) ? value[2] : defaultValue[2];\n case 2:\n out[start + 1] = Number.isFinite(value[1]) ? value[1] : defaultValue[1];\n case 1:\n out[start + 0] = Number.isFinite(value[0]) ? value[0] : defaultValue[0];\n break;\n default:\n // In the rare case where the attribute size > 4, do it the slow way\n // This is used for e.g. transform matrices\n let i = size;\n while (--i >= 0) {\n out[start + i] = Number.isFinite(value[i]) ? value[i] : defaultValue[i];\n }\n }\n return out;\n }\n _areValuesEqual(value1, value2) {\n if (!value1 || !value2) {\n return false;\n }\n const { size } = this;\n for (let i = 0; i < size; i++) {\n if (value1[i] !== value2[i]) {\n return false;\n }\n }\n return true;\n }\n _createBuffer(byteLength) {\n if (this._buffer) {\n this._buffer.destroy();\n }\n const { isIndexed, type } = this.settings;\n this._buffer = this.device.createBuffer({\n ...this._buffer?.props,\n id: this.id,\n usage: isIndexed ? Buffer.INDEX : Buffer.VERTEX,\n indexType: isIndexed ? type : undefined,\n byteLength\n });\n return this._buffer;\n }\n}\n", "import { getTypedArrayFromDataType, getDataTypeFromTypedArray } from '@luma.gl/core';\nexport function typedArrayFromDataType(type) {\n // Sorted in some order of likelihood to reduce amount of comparisons\n switch (type) {\n case 'float64':\n return Float64Array;\n case 'uint8':\n case 'unorm8':\n return Uint8ClampedArray;\n default:\n return getTypedArrayFromDataType(type);\n }\n}\nexport const dataTypeFromTypedArray = getDataTypeFromTypedArray;\nexport function getBufferAttributeLayout(name, accessor) {\n return {\n attribute: name,\n // @ts-expect-error Not all combinations are valid vertex formats; it's up to DataColumn to ensure\n format: accessor.size > 1\n ? `${accessor.type}x${accessor.size}`\n : accessor.type,\n byteOffset: accessor.offset || 0\n // Note stride is set on the top level\n };\n}\nexport function getStride(accessor) {\n return accessor.stride || accessor.size * accessor.bytesPerElement;\n}\nexport function bufferLayoutEqual(accessor1, accessor2) {\n return (accessor1.type === accessor2.type &&\n accessor1.size === accessor2.size &&\n getStride(accessor1) === getStride(accessor2) &&\n (accessor1.offset || 0) === (accessor2.offset || 0));\n}\n", "const EMPTY_ARRAY = [];\nconst placeholderArray = [];\n/*\n * Create an Iterable\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols\n * and a \"context\" tracker from the given data\n */\nexport function createIterable(data, startRow = 0, endRow = Infinity) {\n let iterable = EMPTY_ARRAY;\n const objectInfo = {\n index: -1,\n data,\n // visitor can optionally utilize this to avoid constructing a new array for every object\n target: []\n };\n if (!data) {\n iterable = EMPTY_ARRAY;\n }\n else if (typeof data[Symbol.iterator] === 'function') {\n // data is already an iterable\n iterable = data;\n }\n else if (data.length > 0) {\n placeholderArray.length = data.length;\n iterable = placeholderArray;\n }\n if (startRow > 0 || Number.isFinite(endRow)) {\n iterable = (Array.isArray(iterable) ? iterable : Array.from(iterable)).slice(startRow, endRow);\n objectInfo.index = startRow - 1;\n }\n return { iterable, objectInfo };\n}\n/*\n * Returns true if data is an async iterable object\n */\nexport function isAsyncIterable(data) {\n return data && data[Symbol.asyncIterator];\n}\n/*\n * Create an accessor function from a flat buffer that yields the value at each object index\n */\nexport function getAccessorFromBuffer(typedArray, options) {\n const { size, stride, offset, startIndices, nested } = options;\n const bytesPerElement = typedArray.BYTES_PER_ELEMENT;\n const elementStride = stride ? stride / bytesPerElement : size;\n const elementOffset = offset ? offset / bytesPerElement : 0;\n const vertexCount = Math.floor((typedArray.length - elementOffset) / elementStride);\n return (_, { index, target }) => {\n if (!startIndices) {\n const sourceIndex = index * elementStride + elementOffset;\n for (let j = 0; j < size; j++) {\n target[j] = typedArray[sourceIndex + j];\n }\n return target;\n }\n const startIndex = startIndices[index];\n const endIndex = startIndices[index + 1] || vertexCount;\n let result;\n if (nested) {\n result = new Array(endIndex - startIndex);\n for (let i = startIndex; i < endIndex; i++) {\n const sourceIndex = i * elementStride + elementOffset;\n target = new Array(size);\n for (let j = 0; j < size; j++) {\n target[j] = typedArray[sourceIndex + j];\n }\n result[i - startIndex] = target;\n }\n }\n else if (elementStride === size) {\n result = typedArray.subarray(startIndex * size + elementOffset, endIndex * size + elementOffset);\n }\n else {\n result = new typedArray.constructor((endIndex - startIndex) * size);\n let targetIndex = 0;\n for (let i = startIndex; i < endIndex; i++) {\n const sourceIndex = i * elementStride + elementOffset;\n for (let j = 0; j < size; j++) {\n result[targetIndex++] = typedArray[sourceIndex + j];\n }\n }\n }\n return result;\n };\n}\n", "/*\n * range (Array)\n * + start (Number) - the start index (incl.)\n * + end (Number) - the end index (excl.)\n * rangeList (Array) - array of sorted, combined ranges\n */\nexport const EMPTY = [];\nexport const FULL = [[0, Infinity]];\n// Insert a range into a range collection\nexport function add(rangeList, range) {\n // Noop if range collection already covers all\n if (rangeList === FULL) {\n return rangeList;\n }\n // Validate the input range\n if (range[0] < 0) {\n range[0] = 0;\n }\n if (range[0] >= range[1]) {\n return rangeList;\n }\n // TODO - split off to tree-shakable Range class\n const newRangeList = [];\n const len = rangeList.length;\n let insertPosition = 0;\n for (let i = 0; i < len; i++) {\n const range0 = rangeList[i];\n if (range0[1] < range[0]) {\n // the current range is to the left of the new range\n newRangeList.push(range0);\n insertPosition = i + 1;\n }\n else if (range0[0] > range[1]) {\n // the current range is to the right of the new range\n newRangeList.push(range0);\n }\n else {\n range = [Math.min(range0[0], range[0]), Math.max(range0[1], range[1])];\n }\n }\n newRangeList.splice(insertPosition, 0, range);\n return newRangeList;\n}\n", "const DEFAULT_TRANSITION_SETTINGS = {\n interpolation: {\n duration: 0,\n easing: t => t\n },\n spring: {\n stiffness: 0.05,\n damping: 0.5\n }\n};\nexport function normalizeTransitionSettings(userSettings, layerSettings) {\n if (!userSettings) {\n return null;\n }\n if (Number.isFinite(userSettings)) {\n userSettings = { type: 'interpolation', duration: userSettings };\n }\n const type = userSettings.type || 'interpolation';\n return {\n ...DEFAULT_TRANSITION_SETTINGS[type],\n ...layerSettings,\n ...userSettings,\n type\n };\n}\n", "/* eslint-disable complexity */\nimport DataColumn from \"./data-column.js\";\nimport assert from \"../../utils/assert.js\";\nimport { createIterable, getAccessorFromBuffer } from \"../../utils/iterable-utils.js\";\nimport { fillArray } from \"../../utils/flatten.js\";\nimport * as range from \"../../utils/range.js\";\nimport { bufferLayoutEqual } from \"./gl-utils.js\";\nimport { normalizeTransitionSettings } from \"./transition-settings.js\";\nexport default class Attribute extends DataColumn {\n constructor(device, opts) {\n super(device, opts, {\n startIndices: null,\n lastExternalBuffer: null,\n binaryValue: null,\n binaryAccessor: null,\n needsUpdate: true,\n needsRedraw: false,\n layoutChanged: false,\n updateRanges: range.FULL\n });\n /** Legacy approach to set attribute value - read `isConstant` instead for attribute state */\n this.constant = false;\n // eslint-disable-next-line\n this.settings.update = opts.update || (opts.accessor ? this._autoUpdater : undefined);\n Object.seal(this.settings);\n Object.seal(this.state);\n // Check all fields and generate helpful error messages\n this._validateAttributeUpdaters();\n }\n get startIndices() {\n return this.state.startIndices;\n }\n set startIndices(layout) {\n this.state.startIndices = layout;\n }\n needsUpdate() {\n return this.state.needsUpdate;\n }\n needsRedraw({ clearChangedFlags = false } = {}) {\n const needsRedraw = this.state.needsRedraw;\n this.state.needsRedraw = needsRedraw && !clearChangedFlags;\n return needsRedraw;\n }\n layoutChanged() {\n return this.state.layoutChanged;\n }\n setAccessor(accessor) {\n var _a;\n (_a = this.state).layoutChanged || (_a.layoutChanged = !bufferLayoutEqual(accessor, this.getAccessor()));\n super.setAccessor(accessor);\n }\n getUpdateTriggers() {\n const { accessor } = this.settings;\n // Backards compatibility: allow attribute name to be used as update trigger key\n return [this.id].concat((typeof accessor !== 'function' && accessor) || []);\n }\n supportsTransition() {\n return Boolean(this.settings.transition);\n }\n // Resolve transition settings object if transition is enabled, otherwise `null`\n getTransitionSetting(opts) {\n if (!opts || !this.supportsTransition()) {\n return null;\n }\n const { accessor } = this.settings;\n // TODO: have the layer resolve these transition settings itself?\n const layerSettings = this.settings.transition;\n // these are the transition settings passed in by the user\n const userSettings = Array.isArray(accessor)\n ? // @ts-ignore\n opts[accessor.find(a => opts[a])]\n : // @ts-ignore\n opts[accessor];\n // Shorthand: use duration instead of parameter object\n return normalizeTransitionSettings(userSettings, layerSettings);\n }\n setNeedsUpdate(reason = this.id, dataRange) {\n this.state.needsUpdate = this.state.needsUpdate || reason;\n this.setNeedsRedraw(reason);\n if (dataRange) {\n const { startRow = 0, endRow = Infinity } = dataRange;\n this.state.updateRanges = range.add(this.state.updateRanges, [startRow, endRow]);\n }\n else {\n this.state.updateRanges = range.FULL;\n }\n }\n clearNeedsUpdate() {\n this.state.needsUpdate = false;\n this.state.updateRanges = range.EMPTY;\n }\n setNeedsRedraw(reason = this.id) {\n this.state.needsRedraw = this.state.needsRedraw || reason;\n }\n allocate(numInstances) {\n const { state, settings } = this;\n if (settings.noAlloc) {\n // Data is provided through a Buffer object.\n return false;\n }\n if (settings.update) {\n super.allocate(numInstances, state.updateRanges !== range.FULL);\n return true;\n }\n return false;\n }\n updateBuffer({ numInstances, data, props, context }) {\n if (!this.needsUpdate()) {\n return false;\n }\n const { state: { updateRanges }, settings: { update, noAlloc } } = this;\n let updated = true;\n if (update) {\n // Custom updater - typically for non-instanced layers\n for (const [startRow, endRow] of updateRanges) {\n update.call(context, this, { data, startRow, endRow, props, numInstances });\n }\n if (!this.value) {\n // no value was assigned during update\n }\n else if (this.constant ||\n !this.buffer ||\n this.buffer.byteLength < this.value.byteLength + this.byteOffset) {\n this.setData({\n value: this.value,\n constant: this.constant\n });\n // Setting attribute.constant in updater is a legacy approach that interferes with allocation in the next cycle\n // Respect it here but reset after use\n this.constant = false;\n }\n else {\n for (const [startRow, endRow] of updateRanges) {\n const startOffset = Number.isFinite(startRow) ? this.getVertexOffset(startRow) : 0;\n const endOffset = Number.isFinite(endRow)\n ? this.getVertexOffset(endRow)\n : noAlloc || !Number.isFinite(numInstances)\n ? this.value.length\n : numInstances * this.size;\n super.updateSubBuffer({ startOffset, endOffset });\n }\n }\n this._checkAttributeArray();\n }\n else {\n updated = false;\n }\n this.clearNeedsUpdate();\n this.setNeedsRedraw();\n return updated;\n }\n // Use generic value\n // Returns true if successful\n setConstantValue(value) {\n if (value === undefined || typeof value === 'function') {\n return false;\n }\n const hasChanged = this.setData({ constant: true, value });\n if (hasChanged) {\n this.setNeedsRedraw();\n }\n this.clearNeedsUpdate();\n return true;\n }\n // Use external buffer\n // Returns true if successful\n // eslint-disable-next-line max-statements\n setExternalBuffer(buffer) {\n const { state } = this;\n if (!buffer) {\n state.lastExternalBuffer = null;\n return false;\n }\n this.clearNeedsUpdate();\n if (state.lastExternalBuffer === buffer) {\n return true;\n }\n state.lastExternalBuffer = buffer;\n this.setNeedsRedraw();\n this.setData(buffer);\n return true;\n }\n // Binary value is a typed array packed from mapping the source data with the accessor\n // If the returned value from the accessor is the same as the attribute value, set it directly\n // Otherwise use the auto updater for transform/normalization\n setBinaryValue(buffer, startIndices = null) {\n const { state, settings } = this;\n if (!buffer) {\n state.binaryValue = null;\n state.binaryAccessor = null;\n return false;\n }\n if (settings.noAlloc) {\n // Let the layer handle this\n return false;\n }\n if (state.binaryValue === buffer) {\n this.clearNeedsUpdate();\n return true;\n }\n state.binaryValue = buffer;\n this.setNeedsRedraw();\n const needsUpdate = settings.transform || startIndices !== this.startIndices;\n if (needsUpdate) {\n if (ArrayBuffer.isView(buffer)) {\n buffer = { value: buffer };\n }\n const binaryValue = buffer;\n assert(ArrayBuffer.isView(binaryValue.value), `invalid ${settings.accessor}`);\n const needsNormalize = Boolean(binaryValue.size) && binaryValue.size !== this.size;\n state.binaryAccessor = getAccessorFromBuffer(binaryValue.value, {\n size: binaryValue.size || this.size,\n stride: binaryValue.stride,\n offset: binaryValue.offset,\n startIndices: startIndices,\n nested: needsNormalize\n });\n // Fall through to auto updater\n return false;\n }\n this.clearNeedsUpdate();\n this.setData(buffer);\n return true;\n }\n getVertexOffset(row) {\n const { startIndices } = this;\n const vertexIndex = startIndices\n ? row < startIndices.length\n ? startIndices[row]\n : this.numInstances\n : row;\n return vertexIndex * this.size;\n }\n getValue() {\n const shaderAttributeDefs = this.settings.shaderAttributes;\n const result = super.getValue();\n if (!shaderAttributeDefs) {\n return result;\n }\n for (const shaderAttributeName in shaderAttributeDefs) {\n Object.assign(result, super.getValue(shaderAttributeName, shaderAttributeDefs[shaderAttributeName]));\n }\n return result;\n }\n /** Generate WebGPU-style buffer layout descriptor from this attribute */\n getBufferLayout(\n /** A luma.gl Model-shaped object that supplies additional hint to attribute resolution */\n modelInfo) {\n // Clear change flag\n this.state.layoutChanged = false;\n const shaderAttributeDefs = this.settings.shaderAttributes;\n const result = super._getBufferLayout();\n const { stepMode } = this.settings;\n if (stepMode === 'dynamic') {\n // If model info is provided, use isInstanced flag to determine step mode\n // If no model info is provided, assume it's an instanced model (most common use case)\n result.stepMode = modelInfo ? (modelInfo.isInstanced ? 'instance' : 'vertex') : 'instance';\n }\n else {\n result.stepMode = stepMode ?? 'vertex';\n }\n if (!shaderAttributeDefs) {\n return result;\n }\n for (const shaderAttributeName in shaderAttributeDefs) {\n const map = super._getBufferLayout(shaderAttributeName, shaderAttributeDefs[shaderAttributeName]);\n // @ts-ignore\n result.attributes.push(...map.attributes);\n }\n return result;\n }\n /* eslint-disable max-depth, max-statements */\n _autoUpdater(attribute, { data, startRow, endRow, props, numInstances }) {\n if (attribute.constant) {\n return;\n }\n const { settings, state, value, size, startIndices } = attribute;\n const { accessor, transform } = settings;\n const accessorFunc = state.binaryAccessor ||\n // @ts-ignore\n (typeof accessor === 'function' ? accessor : props[accessor]);\n assert(typeof accessorFunc === 'function', `accessor \"${accessor}\" is not a function`);\n let i = attribute.getVertexOffset(startRow);\n const { iterable, objectInfo } = createIterable(data, startRow, endRow);\n for (const object of iterable) {\n objectInfo.index++;\n let objectValue = accessorFunc(object, objectInfo);\n if (transform) {\n // transform callbacks could be bound to a particular layer instance.\n // always point `this` to the current layer.\n objectValue = transform.call(this, objectValue);\n }\n if (startIndices) {\n const numVertices = (objectInfo.index < startIndices.length - 1\n ? startIndices[objectInfo.index + 1]\n : numInstances) - startIndices[objectInfo.index];\n if (objectValue && Array.isArray(objectValue[0])) {\n let startIndex = i;\n for (const item of objectValue) {\n attribute._normalizeValue(item, value, startIndex);\n startIndex += size;\n }\n }\n else if (objectValue && objectValue.length > size) {\n value.set(objectValue, i);\n }\n else {\n attribute._normalizeValue(objectValue, objectInfo.target, 0);\n fillArray({\n target: value,\n source: objectInfo.target,\n start: i,\n count: numVertices\n });\n }\n i += numVertices * size;\n }\n else {\n attribute._normalizeValue(objectValue, value, i);\n i += size;\n }\n }\n }\n /* eslint-enable max-depth, max-statements */\n // Validate deck.gl level fields\n _validateAttributeUpdaters() {\n const { settings } = this;\n // Check that 'update' is a valid function\n const hasUpdater = settings.noAlloc || typeof settings.update === 'function';\n if (!hasUpdater) {\n throw new Error(`Attribute ${this.id} missing update or accessor`);\n }\n }\n // check that the first few elements of the attribute are reasonable\n /* eslint-disable no-fallthrough */\n _checkAttributeArray() {\n const { value } = this;\n const limit = Math.min(4, this.size);\n if (value && value.length >= limit) {\n let valid = true;\n switch (limit) {\n case 4:\n valid = valid && Number.isFinite(value[3]);\n case 3:\n valid = valid && Number.isFinite(value[2]);\n case 2:\n valid = valid && Number.isFinite(value[1]);\n case 1:\n valid = valid && Number.isFinite(value[0]);\n break;\n default:\n valid = false;\n }\n if (!valid) {\n throw new Error(`Illegal attribute generated for ${this.id}`);\n }\n }\n }\n}\n", "import { BufferTransform } from '@luma.gl/engine';\nimport { fp64arithmetic } from '@luma.gl/shadertools';\nimport { GL } from '@luma.gl/constants';\nimport { getAttributeTypeFromSize, cycleBuffers, padBuffer, matchBuffer, getFloat32VertexFormat } from \"./gpu-transition-utils.js\";\nimport { GPUTransitionBase } from \"./gpu-transition.js\";\nexport default class GPUInterpolationTransition extends GPUTransitionBase {\n constructor({ device, attribute, timeline }) {\n super({ device, attribute, timeline });\n this.type = 'interpolation';\n this.transform = getTransform(device, attribute);\n }\n start(transitionSettings, numInstances) {\n const prevLength = this.currentLength;\n const prevStartIndices = this.currentStartIndices;\n super.start(transitionSettings, numInstances, transitionSettings.duration);\n if (transitionSettings.duration <= 0) {\n this.transition.cancel();\n return;\n }\n const { buffers, attribute } = this;\n // Alternate between two buffers when new transitions start.\n // Last destination buffer is used as an attribute (from state),\n // And the other buffer is now the current buffer.\n cycleBuffers(buffers);\n buffers[0] = padBuffer({\n device: this.device,\n buffer: buffers[0],\n attribute,\n fromLength: prevLength,\n toLength: this.currentLength,\n fromStartIndices: prevStartIndices,\n getData: transitionSettings.enter\n });\n buffers[1] = matchBuffer({\n device: this.device,\n source: buffers[0],\n target: buffers[1]\n });\n this.setBuffer(buffers[1]);\n const { transform } = this;\n const model = transform.model;\n let vertexCount = Math.floor(this.currentLength / attribute.size);\n if (useFp64(attribute)) {\n vertexCount /= 2;\n }\n model.setVertexCount(vertexCount);\n if (attribute.isConstant) {\n model.setAttributes({ aFrom: buffers[0] });\n model.setConstantAttributes({ aTo: attribute.value });\n }\n else {\n model.setAttributes({\n aFrom: buffers[0],\n aTo: attribute.getBuffer()\n });\n }\n transform.transformFeedback.setBuffers({ vCurrent: buffers[1] });\n }\n onUpdate() {\n const { duration, easing } = this.settings;\n const { time } = this.transition;\n let t = time / duration;\n if (easing) {\n t = easing(t);\n }\n const { model } = this.transform;\n model.setUniforms({ time: t });\n this.transform.run({ discard: true });\n }\n delete() {\n super.delete();\n this.transform.destroy();\n }\n}\nconst vs = `\\\n#version 300 es\n#define SHADER_NAME interpolation-transition-vertex-shader\n\nuniform float time;\nin ATTRIBUTE_TYPE aFrom;\nin ATTRIBUTE_TYPE aTo;\nout ATTRIBUTE_TYPE vCurrent;\n\nvoid main(void) {\n vCurrent = mix(aFrom, aTo, time);\n gl_Position = vec4(0.0);\n}\n`;\nconst vs64 = `\\\n#version 300 es\n#define SHADER_NAME interpolation-transition-vertex-shader\n\nuniform float time;\nin ATTRIBUTE_TYPE aFrom;\nin ATTRIBUTE_TYPE aFrom64Low;\nin ATTRIBUTE_TYPE aTo;\nin ATTRIBUTE_TYPE aTo64Low;\nout ATTRIBUTE_TYPE vCurrent;\nout ATTRIBUTE_TYPE vCurrent64Low;\n\nvec2 mix_fp64(vec2 a, vec2 b, float x) {\n vec2 range = sub_fp64(b, a);\n return sum_fp64(a, mul_fp64(range, vec2(x, 0.0)));\n}\n\nvoid main(void) {\n for (int i=0; i targetLength) {\n target.set(source.subarray(0, targetLength), start);\n return;\n }\n target.set(source, start);\n if (!getData) {\n return;\n }\n // source is not large enough to fill target space, call `getData` to get filler data\n let i = sourceLength;\n while (i < targetLength) {\n const datum = getData(i, source);\n for (let j = 0; j < size; j++) {\n target[start + i] = datum[j] || 0;\n i++;\n }\n }\n}\n/*\n * The padArray function stretches a source array to the size of a target array.\n The arrays can have internal structures (like the attributes of PathLayer and\n SolidPolygonLayer), defined by the optional sourceStartIndices and targetStartIndices parameters.\n If the target array is larger, the getData callback is used to fill in the blanks.\n */\nexport function padArray({ source, target, size, getData, sourceStartIndices, targetStartIndices }) {\n if (!sourceStartIndices || !targetStartIndices) {\n // Flat arrays\n padArrayChunk({\n source,\n target,\n size,\n getData\n });\n return target;\n }\n // Arrays have internal structure\n let sourceIndex = 0;\n let targetIndex = 0;\n const getChunkData = getData && ((i, chunk) => getData(i + targetIndex, chunk));\n const n = Math.min(sourceStartIndices.length, targetStartIndices.length);\n for (let i = 1; i < n; i++) {\n const nextSourceIndex = sourceStartIndices[i] * size;\n const nextTargetIndex = targetStartIndices[i] * size;\n padArrayChunk({\n source: source.subarray(sourceIndex, nextSourceIndex),\n target,\n start: targetIndex,\n end: nextTargetIndex,\n size,\n getData: getChunkData\n });\n sourceIndex = nextSourceIndex;\n targetIndex = nextTargetIndex;\n }\n if (targetIndex < target.length) {\n padArrayChunk({\n // @ts-ignore\n source: [],\n target,\n start: targetIndex,\n size,\n getData: getChunkData\n });\n }\n return target;\n}\n", "import { padArray } from \"../utils/array-utils.js\";\nimport Attribute from \"../lib/attribute/attribute.js\";\nimport { GL } from '@luma.gl/constants';\n/** Create a new empty attribute with the same settings: type, shader layout etc. */\nexport function cloneAttribute(attribute) {\n // `attribute.settings` is the original options passed when constructing the attribute.\n // This ensures that we set the proper `doublePrecision` flag and shader attributes.\n const { device, settings, value } = attribute;\n const newAttribute = new Attribute(device, settings);\n // Placeholder value - necessary for generating the correct buffer layout\n newAttribute.setData({\n value: value instanceof Float64Array ? new Float64Array(0) : new Float32Array(0),\n normalized: settings.normalized\n });\n return newAttribute;\n}\n/** Returns the GLSL attribute type for the given number of float32 components. */\nexport function getAttributeTypeFromSize(size) {\n switch (size) {\n case 1:\n return 'float';\n case 2:\n return 'vec2';\n case 3:\n return 'vec3';\n case 4:\n return 'vec4';\n default:\n throw new Error(`No defined attribute type for size \"${size}\"`);\n }\n}\n/** Returns the {@link VertexFormat} for the given number of float32 components. */\nexport function getFloat32VertexFormat(size) {\n switch (size) {\n case 1:\n return 'float32';\n case 2:\n return 'float32x2';\n case 3:\n return 'float32x3';\n case 4:\n return 'float32x4';\n default:\n throw new Error('invalid type size');\n }\n}\nexport function cycleBuffers(buffers) {\n buffers.push(buffers.shift());\n}\nexport function getAttributeBufferLength(attribute, numInstances) {\n const { doublePrecision, settings, value, size } = attribute;\n const multiplier = doublePrecision && value instanceof Float64Array ? 2 : 1;\n let maxVertexOffset = 0;\n const { shaderAttributes } = attribute.settings;\n if (shaderAttributes) {\n for (const shaderAttribute of Object.values(shaderAttributes)) {\n maxVertexOffset = Math.max(maxVertexOffset, shaderAttribute.vertexOffset ?? 0);\n }\n }\n return ((settings.noAlloc ? value.length : (numInstances + maxVertexOffset) * size) *\n multiplier);\n}\nexport function matchBuffer({ device, source, target }) {\n if (!target || target.byteLength < source.byteLength) {\n target?.destroy();\n target = device.createBuffer({\n byteLength: source.byteLength,\n usage: source.usage\n });\n }\n return target;\n}\n/* eslint-disable complexity */\n// This helper is used when transitioning attributes from a set of values in one buffer layout\n// to a set of values in a different buffer layout. (Buffer layouts are used when attribute values\n// within a buffer should be grouped for drawElements, like the Polygon layer.) For example, a\n// buffer layout of [3, 4] might have data [A1, A2, A3, B1, B2, B3, B4]. If it needs to transition\n// to a buffer layout of [4, 2], it should produce a buffer, using the transition setting's `enter`\n// function, that looks like this: [A1, A2, A3, A4 (user `enter` fn), B1, B2, 0]. Note: the final\n// 0 in this buffer is because we never shrink buffers, only grow them, for performance reasons.\n//\n// padBuffer may return either the original buffer, or a new buffer if the size of the original\n// was insufficient. Callers are responsible for disposing of the original buffer if needed.\nexport function padBuffer({ device, buffer, attribute, fromLength, toLength, fromStartIndices, getData = x => x }) {\n // TODO: move the precisionMultiplier logic to the attribute when retrieving\n // its `size` and `elementOffset`?\n const precisionMultiplier = attribute.doublePrecision && attribute.value instanceof Float64Array ? 2 : 1;\n const size = attribute.size * precisionMultiplier;\n const byteOffset = attribute.byteOffset;\n // Transform feedback can only write to float varyings\n // Attributes of format unorm8/uint8 (1 byte per element) etc will be padded to float32 (4 bytes per element)\n const targetByteOffset = attribute.settings.bytesPerElement < 4\n ? (byteOffset / attribute.settings.bytesPerElement) * 4\n : byteOffset;\n const toStartIndices = attribute.startIndices;\n const hasStartIndices = fromStartIndices && toStartIndices;\n const isConstant = attribute.isConstant;\n // check if buffer needs to be padded\n if (!hasStartIndices && buffer && fromLength >= toLength) {\n return buffer;\n }\n const ArrayType = attribute.value instanceof Float64Array\n ? Float32Array\n : attribute.value.constructor;\n const toData = isConstant\n ? attribute.value\n : // TODO(v9.1): Avoid non-portable synchronous reads.\n new ArrayType(attribute\n .getBuffer()\n .readSyncWebGL(byteOffset, toLength * ArrayType.BYTES_PER_ELEMENT).buffer);\n if (attribute.settings.normalized && !isConstant) {\n const getter = getData;\n getData = (value, chunk) => attribute.normalizeConstant(getter(value, chunk));\n }\n const getMissingData = isConstant\n ? (i, chunk) => getData(toData, chunk)\n : (i, chunk) => getData(toData.subarray(i + byteOffset, i + byteOffset + size), chunk);\n // TODO(v9.1): Avoid non-portable synchronous reads.\n const source = buffer\n ? new Float32Array(buffer.readSyncWebGL(targetByteOffset, fromLength * 4).buffer)\n : new Float32Array(0);\n const target = new Float32Array(toLength);\n padArray({\n source,\n target,\n sourceStartIndices: fromStartIndices,\n targetStartIndices: toStartIndices,\n size,\n getData: getMissingData\n });\n if (!buffer || buffer.byteLength < target.byteLength + targetByteOffset) {\n buffer?.destroy();\n buffer = device.createBuffer({\n byteLength: target.byteLength + targetByteOffset,\n usage: 35050\n });\n }\n buffer.write(target, targetByteOffset);\n return buffer;\n}\n", "import Transition from \"./transition.js\";\nimport { cloneAttribute, getAttributeBufferLength } from \"./gpu-transition-utils.js\";\nexport class GPUTransitionBase {\n constructor({ device, attribute, timeline }) {\n this.buffers = [];\n /** The vertex count of the last buffer.\n * Buffer may be larger than the actual length we want to use\n * because we only reallocate buffers when they grow, not when they shrink,\n * due to performance costs */\n this.currentLength = 0;\n this.device = device;\n this.transition = new Transition(timeline);\n this.attribute = attribute;\n this.attributeInTransition = cloneAttribute(attribute);\n this.currentStartIndices = attribute.startIndices;\n }\n get inProgress() {\n return this.transition.inProgress;\n }\n start(transitionSettings, numInstances, duration = Infinity) {\n this.settings = transitionSettings;\n this.currentStartIndices = this.attribute.startIndices;\n this.currentLength = getAttributeBufferLength(this.attribute, numInstances);\n this.transition.start({ ...transitionSettings, duration });\n }\n update() {\n const updated = this.transition.update();\n if (updated) {\n this.onUpdate();\n }\n return updated;\n }\n setBuffer(buffer) {\n this.attributeInTransition.setData({\n buffer,\n normalized: this.attribute.settings.normalized,\n // Retain placeholder value to generate correct shader layout\n value: this.attributeInTransition.value\n });\n }\n cancel() {\n this.transition.cancel();\n }\n delete() {\n this.cancel();\n for (const buffer of this.buffers) {\n buffer.destroy();\n }\n this.buffers.length = 0;\n }\n}\n", "import { BufferTransform } from '@luma.gl/engine';\nimport { padBuffer, matchBuffer, getAttributeTypeFromSize, getFloat32VertexFormat, cycleBuffers } from \"./gpu-transition-utils.js\";\nimport { GPUTransitionBase } from \"./gpu-transition.js\";\nexport default class GPUSpringTransition extends GPUTransitionBase {\n constructor({ device, attribute, timeline }) {\n super({ device, attribute, timeline });\n this.type = 'spring';\n this.texture = getTexture(device);\n this.framebuffer = getFramebuffer(device, this.texture);\n this.transform = getTransform(device, attribute);\n }\n start(transitionSettings, numInstances) {\n const prevLength = this.currentLength;\n const prevStartIndices = this.currentStartIndices;\n super.start(transitionSettings, numInstances);\n const { buffers, attribute } = this;\n for (let i = 0; i < 2; i++) {\n buffers[i] = padBuffer({\n device: this.device,\n buffer: buffers[i],\n attribute,\n fromLength: prevLength,\n toLength: this.currentLength,\n fromStartIndices: prevStartIndices,\n getData: transitionSettings.enter\n });\n }\n buffers[2] = matchBuffer({\n device: this.device,\n source: buffers[0],\n target: buffers[2]\n });\n this.setBuffer(buffers[1]);\n const { model } = this.transform;\n model.setVertexCount(Math.floor(this.currentLength / attribute.size));\n if (attribute.isConstant) {\n model.setConstantAttributes({ aTo: attribute.value });\n }\n else {\n model.setAttributes({ aTo: attribute.getBuffer() });\n }\n }\n onUpdate() {\n const { buffers, transform, framebuffer, transition } = this;\n const settings = this.settings;\n transform.model.setAttributes({\n aPrev: buffers[0],\n aCur: buffers[1]\n });\n transform.transformFeedback.setBuffers({ vNext: buffers[2] });\n transform.model.setUniforms({\n stiffness: settings.stiffness,\n damping: settings.damping\n });\n transform.run({\n framebuffer,\n discard: false,\n parameters: { viewport: [0, 0, 1, 1] },\n clearColor: [0, 0, 0, 0]\n });\n cycleBuffers(buffers);\n this.setBuffer(buffers[1]);\n const isTransitioning = this.device.readPixelsToArrayWebGL(framebuffer)[0] > 0;\n if (!isTransitioning) {\n transition.end();\n }\n }\n delete() {\n super.delete();\n this.transform.destroy();\n this.texture.destroy();\n this.framebuffer.destroy();\n }\n}\nconst vs = `\\\n#version 300 es\n#define SHADER_NAME spring-transition-vertex-shader\n\n#define EPSILON 0.00001\n\nuniform float stiffness;\nuniform float damping;\nin ATTRIBUTE_TYPE aPrev;\nin ATTRIBUTE_TYPE aCur;\nin ATTRIBUTE_TYPE aTo;\nout ATTRIBUTE_TYPE vNext;\nout float vIsTransitioningFlag;\n\nATTRIBUTE_TYPE getNextValue(ATTRIBUTE_TYPE cur, ATTRIBUTE_TYPE prev, ATTRIBUTE_TYPE dest) {\n ATTRIBUTE_TYPE velocity = cur - prev;\n ATTRIBUTE_TYPE delta = dest - cur;\n ATTRIBUTE_TYPE spring = delta * stiffness;\n ATTRIBUTE_TYPE damper = velocity * -1.0 * damping;\n return spring + damper + velocity + cur;\n}\n\nvoid main(void) {\n bool isTransitioning = length(aCur - aPrev) > EPSILON || length(aTo - aCur) > EPSILON;\n vIsTransitioningFlag = isTransitioning ? 1.0 : 0.0;\n\n vNext = getNextValue(aCur, aPrev, aTo);\n gl_Position = vec4(0, 0, 0, 1);\n gl_PointSize = 100.0;\n}\n`;\nconst fs = `\\\n#version 300 es\n#define SHADER_NAME spring-transition-is-transitioning-fragment-shader\n\nin float vIsTransitioningFlag;\n\nout vec4 fragColor;\n\nvoid main(void) {\n if (vIsTransitioningFlag == 0.0) {\n discard;\n }\n fragColor = vec4(1.0);\n}`;\nfunction getTransform(device, attribute) {\n const attributeType = getAttributeTypeFromSize(attribute.size);\n const format = getFloat32VertexFormat(attribute.size);\n return new BufferTransform(device, {\n vs,\n fs,\n bufferLayout: [\n { name: 'aPrev', format },\n { name: 'aCur', format },\n { name: 'aTo', format: attribute.getBufferLayout().attributes[0].format }\n ],\n varyings: ['vNext'],\n defines: { ATTRIBUTE_TYPE: attributeType },\n parameters: {\n depthCompare: 'always',\n blendColorOperation: 'max',\n blendColorSrcFactor: 'one',\n blendColorDstFactor: 'one',\n blendAlphaOperation: 'max',\n blendAlphaSrcFactor: 'one',\n blendAlphaDstFactor: 'one'\n }\n });\n}\nfunction getTexture(device) {\n return device.createTexture({\n data: new Uint8Array(4),\n format: 'rgba8unorm',\n mipmaps: false,\n // dataFormat: GL.RGBA,\n width: 1,\n height: 1\n });\n}\nfunction getFramebuffer(device, texture) {\n return device.createFramebuffer({\n id: 'spring-transition-is-transitioning-framebuffer',\n width: 1,\n height: 1,\n colorAttachments: [texture]\n });\n}\n", "// deck.gl, MIT license\nimport GPUInterpolationTransition from \"../../transitions/gpu-interpolation-transition.js\";\nimport GPUSpringTransition from \"../../transitions/gpu-spring-transition.js\";\nimport log from \"../../utils/log.js\";\nconst TRANSITION_TYPES = {\n interpolation: GPUInterpolationTransition,\n spring: GPUSpringTransition\n};\nexport default class AttributeTransitionManager {\n constructor(device, { id, timeline }) {\n if (!device)\n throw new Error('AttributeTransitionManager is constructed without device');\n this.id = id;\n this.device = device;\n this.timeline = timeline;\n this.transitions = {};\n this.needsRedraw = false;\n this.numInstances = 1;\n }\n finalize() {\n for (const attributeName in this.transitions) {\n this._removeTransition(attributeName);\n }\n }\n /* Public methods */\n // Called when attribute manager updates\n // Check the latest attributes for updates.\n update({ attributes, transitions, numInstances }) {\n // Transform class will crash if elementCount is 0\n this.numInstances = numInstances || 1;\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n const settings = attribute.getTransitionSetting(transitions);\n // this attribute might not support transitions?\n if (!settings)\n continue; // eslint-disable-line no-continue\n this._updateAttribute(attributeName, attribute, settings);\n }\n for (const attributeName in this.transitions) {\n const attribute = attributes[attributeName];\n if (!attribute || !attribute.getTransitionSetting(transitions)) {\n // Animated attribute has been removed\n this._removeTransition(attributeName);\n }\n }\n }\n // Returns `true` if attribute is transition-enabled\n hasAttribute(attributeName) {\n const transition = this.transitions[attributeName];\n return transition && transition.inProgress;\n }\n // Get all the animated attributes\n getAttributes() {\n const animatedAttributes = {};\n for (const attributeName in this.transitions) {\n const transition = this.transitions[attributeName];\n if (transition.inProgress) {\n animatedAttributes[attributeName] = transition.attributeInTransition;\n }\n }\n return animatedAttributes;\n }\n /* eslint-disable max-statements */\n // Called every render cycle, run transform feedback\n // Returns `true` if anything changes\n run() {\n if (this.numInstances === 0) {\n return false;\n }\n for (const attributeName in this.transitions) {\n const updated = this.transitions[attributeName].update();\n if (updated) {\n this.needsRedraw = true;\n }\n }\n const needsRedraw = this.needsRedraw;\n this.needsRedraw = false;\n return needsRedraw;\n }\n /* eslint-enable max-statements */\n /* Private methods */\n _removeTransition(attributeName) {\n this.transitions[attributeName].delete();\n delete this.transitions[attributeName];\n }\n // Check an attributes for updates\n // Returns a transition object if a new transition is triggered.\n _updateAttribute(attributeName, attribute, settings) {\n const transition = this.transitions[attributeName];\n // an attribute can change transition type when it updates\n // let's remove the transition when that happens so we can create the new transition type\n // TODO: when switching transition types, make sure to carry over the attribute's\n // previous buffers, currentLength, startIndices, etc, to be used as the starting point\n // for the next transition\n let isNew = !transition || transition.type !== settings.type;\n if (isNew) {\n if (transition) {\n this._removeTransition(attributeName);\n }\n const TransitionType = TRANSITION_TYPES[settings.type];\n if (TransitionType) {\n this.transitions[attributeName] = new TransitionType({\n attribute,\n timeline: this.timeline,\n device: this.device\n });\n }\n else {\n log.error(`unsupported transition type '${settings.type}'`)();\n isNew = false;\n }\n }\n if (isNew || attribute.needsRedraw()) {\n this.needsRedraw = true;\n this.transitions[attributeName].start(settings, this.numInstances);\n }\n }\n}\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n/* eslint-disable guard-for-in */\nimport Attribute from \"./attribute.js\";\nimport log from \"../../utils/log.js\";\nimport memoize from \"../../utils/memoize.js\";\nimport { mergeBounds } from \"../../utils/math-utils.js\";\nimport debug from \"../../debug/index.js\";\nimport AttributeTransitionManager from \"./attribute-transition-manager.js\";\nconst TRACE_INVALIDATE = 'attributeManager.invalidate';\nconst TRACE_UPDATE_START = 'attributeManager.updateStart';\nconst TRACE_UPDATE_END = 'attributeManager.updateEnd';\nconst TRACE_ATTRIBUTE_UPDATE_START = 'attribute.updateStart';\nconst TRACE_ATTRIBUTE_ALLOCATE = 'attribute.allocate';\nconst TRACE_ATTRIBUTE_UPDATE_END = 'attribute.updateEnd';\nexport default class AttributeManager {\n constructor(device, { id = 'attribute-manager', stats, timeline } = {}) {\n this.mergeBoundsMemoized = memoize(mergeBounds);\n this.id = id;\n this.device = device;\n this.attributes = {};\n this.updateTriggers = {};\n this.needsRedraw = true;\n this.userData = {};\n this.stats = stats;\n this.attributeTransitionManager = new AttributeTransitionManager(device, {\n id: `${id}-transitions`,\n timeline\n });\n // For debugging sanity, prevent uninitialized members\n Object.seal(this);\n }\n finalize() {\n for (const attributeName in this.attributes) {\n this.attributes[attributeName].delete();\n }\n this.attributeTransitionManager.finalize();\n }\n // Returns the redraw flag, optionally clearing it.\n // Redraw flag will be set if any attributes attributes changed since\n // flag was last cleared.\n //\n // @param {String} [clearRedrawFlags=false] - whether to clear the flag\n // @return {false|String} - reason a redraw is needed.\n getNeedsRedraw(opts = { clearRedrawFlags: false }) {\n const redraw = this.needsRedraw;\n this.needsRedraw = this.needsRedraw && !opts.clearRedrawFlags;\n return redraw && this.id;\n }\n // Sets the redraw flag.\n // @param {Boolean} redraw=true\n setNeedsRedraw() {\n this.needsRedraw = true;\n }\n // Adds attributes\n add(attributes) {\n this._add(attributes);\n }\n // Adds attributes\n addInstanced(attributes) {\n this._add(attributes, { stepMode: 'instance' });\n }\n /**\n * Removes attributes\n * Takes an array of attribute names and delete them from\n * the attribute map if they exists\n *\n * @example\n * attributeManager.remove(['position']);\n *\n * @param {Object} attributeNameArray - attribute name array (see above)\n */\n remove(attributeNameArray) {\n for (const name of attributeNameArray) {\n if (this.attributes[name] !== undefined) {\n this.attributes[name].delete();\n delete this.attributes[name];\n }\n }\n }\n // Marks an attribute for update\n invalidate(triggerName, dataRange) {\n const invalidatedAttributes = this._invalidateTrigger(triggerName, dataRange);\n // For performance tuning\n debug(TRACE_INVALIDATE, this, triggerName, invalidatedAttributes);\n }\n invalidateAll(dataRange) {\n for (const attributeName in this.attributes) {\n this.attributes[attributeName].setNeedsUpdate(attributeName, dataRange);\n }\n // For performance tuning\n debug(TRACE_INVALIDATE, this, 'all');\n }\n // Ensure all attribute buffers are updated from props or data.\n // eslint-disable-next-line complexity\n update({ data, numInstances, startIndices = null, transitions, props = {}, buffers = {}, context = {} }) {\n // keep track of whether some attributes are updated\n let updated = false;\n debug(TRACE_UPDATE_START, this);\n if (this.stats) {\n this.stats.get('Update Attributes').timeStart();\n }\n for (const attributeName in this.attributes) {\n const attribute = this.attributes[attributeName];\n const accessorName = attribute.settings.accessor;\n attribute.startIndices = startIndices;\n attribute.numInstances = numInstances;\n if (props[attributeName]) {\n log.removed(`props.${attributeName}`, `data.attributes.${attributeName}`)();\n }\n if (attribute.setExternalBuffer(buffers[attributeName])) {\n // Step 1: try update attribute directly from external buffers\n }\n else if (attribute.setBinaryValue(typeof accessorName === 'string' ? buffers[accessorName] : undefined, data.startIndices)) {\n // Step 2: try set packed value from external typed array\n }\n else if (typeof accessorName === 'string' &&\n !buffers[accessorName] &&\n attribute.setConstantValue(props[accessorName])) {\n // Step 3: try set constant value from props\n // Note: if buffers[accessorName] is supplied, ignore props[accessorName]\n // This may happen when setBinaryValue falls through to use the auto updater\n }\n else if (attribute.needsUpdate()) {\n // Step 4: update via updater callback\n updated = true;\n this._updateAttribute({\n attribute,\n numInstances,\n data,\n props,\n context\n });\n }\n this.needsRedraw = this.needsRedraw || attribute.needsRedraw();\n }\n if (updated) {\n // Only initiate alloc/update (and logging) if actually needed\n debug(TRACE_UPDATE_END, this, numInstances);\n }\n if (this.stats) {\n this.stats.get('Update Attributes').timeEnd();\n }\n this.attributeTransitionManager.update({\n attributes: this.attributes,\n numInstances,\n transitions\n });\n }\n // Update attribute transition to the current timestamp\n // Returns `true` if any transition is in progress\n updateTransition() {\n const { attributeTransitionManager } = this;\n const transitionUpdated = attributeTransitionManager.run();\n this.needsRedraw = this.needsRedraw || transitionUpdated;\n return transitionUpdated;\n }\n /**\n * Returns all attribute descriptors\n * Note: Format matches luma.gl Model/Program.setAttributes()\n * @return {Object} attributes - descriptors\n */\n getAttributes() {\n return { ...this.attributes, ...this.attributeTransitionManager.getAttributes() };\n }\n /**\n * Computes the spatial bounds of a given set of attributes\n */\n getBounds(attributeNames) {\n const bounds = attributeNames.map(attributeName => this.attributes[attributeName]?.getBounds());\n return this.mergeBoundsMemoized(bounds);\n }\n /**\n * Returns changed attribute descriptors\n * This indicates which WebGLBuffers need to be updated\n * @return {Object} attributes - descriptors\n */\n getChangedAttributes(opts = { clearChangedFlags: false }) {\n const { attributes, attributeTransitionManager } = this;\n const changedAttributes = { ...attributeTransitionManager.getAttributes() };\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n if (attribute.needsRedraw(opts) && !attributeTransitionManager.hasAttribute(attributeName)) {\n changedAttributes[attributeName] = attribute;\n }\n }\n return changedAttributes;\n }\n /** Generate WebGPU-style buffer layout descriptors from all attributes */\n getBufferLayouts(\n /** A luma.gl Model-shaped object that supplies additional hint to attribute resolution */\n modelInfo) {\n return Object.values(this.getAttributes()).map(attribute => attribute.getBufferLayout(modelInfo));\n }\n // PRIVATE METHODS\n /** Register new attributes */\n _add(\n /** A map from attribute name to attribute descriptors */\n attributes, \n /** Additional attribute settings to pass to all attributes */\n overrideOptions) {\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n const props = {\n ...attribute,\n id: attributeName,\n size: (attribute.isIndexed && 1) || attribute.size || 1,\n ...overrideOptions\n };\n // Initialize the attribute descriptor, with WebGL and metadata fields\n this.attributes[attributeName] = new Attribute(this.device, props);\n }\n this._mapUpdateTriggersToAttributes();\n }\n // build updateTrigger name to attribute name mapping\n _mapUpdateTriggersToAttributes() {\n const triggers = {};\n for (const attributeName in this.attributes) {\n const attribute = this.attributes[attributeName];\n attribute.getUpdateTriggers().forEach(triggerName => {\n if (!triggers[triggerName]) {\n triggers[triggerName] = [];\n }\n triggers[triggerName].push(attributeName);\n });\n }\n this.updateTriggers = triggers;\n }\n _invalidateTrigger(triggerName, dataRange) {\n const { attributes, updateTriggers } = this;\n const invalidatedAttributes = updateTriggers[triggerName];\n if (invalidatedAttributes) {\n invalidatedAttributes.forEach(name => {\n const attribute = attributes[name];\n if (attribute) {\n attribute.setNeedsUpdate(attribute.id, dataRange);\n }\n });\n }\n return invalidatedAttributes;\n }\n _updateAttribute(opts) {\n const { attribute, numInstances } = opts;\n debug(TRACE_ATTRIBUTE_UPDATE_START, attribute);\n if (attribute.constant) {\n // The attribute is flagged as constant outside of an update cycle\n // Skip allocation and updater call\n // @ts-ignore value can be set to an array by user but always cast to typed array during attribute update\n attribute.setConstantValue(attribute.value);\n return;\n }\n if (attribute.allocate(numInstances)) {\n debug(TRACE_ATTRIBUTE_ALLOCATE, attribute, numInstances);\n }\n // Calls update on any buffers that need update\n const updated = attribute.updateBuffer(opts);\n if (updated) {\n this.needsRedraw = true;\n debug(TRACE_ATTRIBUTE_UPDATE_END, attribute, numInstances);\n }\n }\n}\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n/* eslint-disable react/no-direct-mutation-state */\nimport { Buffer } from '@luma.gl/core';\nimport { COORDINATE_SYSTEM } from \"./constants.js\";\nimport AttributeManager from \"./attribute/attribute-manager.js\";\nimport UniformTransitionManager from \"./uniform-transition-manager.js\";\nimport { diffProps, validateProps } from \"../lifecycle/props.js\";\nimport { LIFECYCLE } from \"../lifecycle/constants.js\";\nimport { count } from \"../utils/count.js\";\nimport log from \"../utils/log.js\";\nimport debug from \"../debug/index.js\";\nimport assert from \"../utils/assert.js\";\nimport memoize from \"../utils/memoize.js\";\nimport { mergeShaders } from \"../utils/shader.js\";\nimport { projectPosition, getWorldPosition } from \"../shaderlib/project/project-functions.js\";\nimport typedArrayManager from \"../utils/typed-array-manager.js\";\nimport Component from \"../lifecycle/component.js\";\nimport LayerState from \"./layer-state.js\";\nimport { worldToPixels } from '@math.gl/web-mercator';\nimport { load } from '@loaders.gl/core';\nconst TRACE_CHANGE_FLAG = 'layer.changeFlag';\nconst TRACE_INITIALIZE = 'layer.initialize';\nconst TRACE_UPDATE = 'layer.update';\nconst TRACE_FINALIZE = 'layer.finalize';\nconst TRACE_MATCHED = 'layer.matched';\nconst MAX_PICKING_COLOR_CACHE_SIZE = 2 ** 24 - 1;\nconst EMPTY_ARRAY = Object.freeze([]);\n// Only compare the same two viewports once\nconst areViewportsEqual = memoize(({ oldViewport, viewport }) => {\n return oldViewport.equals(viewport);\n});\nlet pickingColorCache = new Uint8ClampedArray(0);\nconst defaultProps = {\n // data: Special handling for null, see below\n data: { type: 'data', value: EMPTY_ARRAY, async: true },\n dataComparator: { type: 'function', value: null, optional: true },\n _dataDiff: {\n type: 'function',\n // @ts-ignore __diff is not defined on data\n value: data => data && data.__diff,\n optional: true\n },\n dataTransform: { type: 'function', value: null, optional: true },\n onDataLoad: { type: 'function', value: null, optional: true },\n onError: { type: 'function', value: null, optional: true },\n fetch: {\n type: 'function',\n value: (url, { propName, layer, loaders, loadOptions, signal }) => {\n const { resourceManager } = layer.context;\n loadOptions = loadOptions || layer.getLoadOptions();\n loaders = loaders || layer.props.loaders;\n if (signal) {\n loadOptions = {\n ...loadOptions,\n fetch: {\n ...loadOptions?.fetch,\n signal\n }\n };\n }\n let inResourceManager = resourceManager.contains(url);\n if (!inResourceManager && !loadOptions) {\n // If there is no layer-specific load options, then attempt to cache this resource in the data manager\n resourceManager.add({ resourceId: url, data: load(url, loaders), persistent: false });\n inResourceManager = true;\n }\n if (inResourceManager) {\n return resourceManager.subscribe({\n resourceId: url,\n onChange: data => layer.internalState?.reloadAsyncProp(propName, data),\n consumerId: layer.id,\n requestId: propName\n });\n }\n return load(url, loaders, loadOptions);\n }\n },\n updateTriggers: {}, // Update triggers: a core change detection mechanism in deck.gl\n visible: true,\n pickable: false,\n opacity: { type: 'number', min: 0, max: 1, value: 1 },\n operation: 'draw',\n onHover: { type: 'function', value: null, optional: true },\n onClick: { type: 'function', value: null, optional: true },\n onDragStart: { type: 'function', value: null, optional: true },\n onDrag: { type: 'function', value: null, optional: true },\n onDragEnd: { type: 'function', value: null, optional: true },\n coordinateSystem: COORDINATE_SYSTEM.DEFAULT,\n coordinateOrigin: { type: 'array', value: [0, 0, 0], compare: true },\n modelMatrix: { type: 'array', value: null, compare: true, optional: true },\n wrapLongitude: false,\n positionFormat: 'XYZ',\n colorFormat: 'RGBA',\n parameters: { type: 'object', value: {}, optional: true, compare: 2 },\n loadOptions: { type: 'object', value: null, optional: true, ignore: true },\n transitions: null,\n extensions: [],\n loaders: { type: 'array', value: [], optional: true, ignore: true },\n // Offset depth based on layer index to avoid z-fighting.\n // Negative values pull layer towards the camera\n // https://www.opengl.org/archives/resources/faq/technical/polygonoffset.htm\n getPolygonOffset: {\n type: 'function',\n value: ({ layerIndex }) => [0, -layerIndex * 100]\n },\n // Selection/Highlighting\n highlightedObjectIndex: null,\n autoHighlight: false,\n highlightColor: { type: 'accessor', value: [0, 0, 128, 128] }\n};\nclass Layer extends Component {\n constructor() {\n super(...arguments);\n this.internalState = null;\n this.lifecycle = LIFECYCLE.NO_STATE; // Helps track and debug the life cycle of the layers\n this.parent = null;\n }\n static get componentName() {\n return Object.prototype.hasOwnProperty.call(this, 'layerName') ? this.layerName : '';\n }\n get root() {\n // eslint-disable-next-line\n let layer = this;\n while (layer.parent) {\n layer = layer.parent;\n }\n return layer;\n }\n toString() {\n const className = this.constructor.layerName || this.constructor.name;\n return `${className}({id: '${this.props.id}'})`;\n }\n // Public API for users\n /** Projects a point with current view state from the current layer's coordinate system to screen */\n project(xyz) {\n assert(this.internalState);\n const viewport = this.internalState.viewport || this.context.viewport;\n const worldPosition = getWorldPosition(xyz, {\n viewport,\n modelMatrix: this.props.modelMatrix,\n coordinateOrigin: this.props.coordinateOrigin,\n coordinateSystem: this.props.coordinateSystem\n });\n const [x, y, z] = worldToPixels(worldPosition, viewport.pixelProjectionMatrix);\n return xyz.length === 2 ? [x, y] : [x, y, z];\n }\n /** Unprojects a screen pixel to the current view's default coordinate system\n Note: this does not reverse `project`. */\n unproject(xy) {\n assert(this.internalState);\n const viewport = this.internalState.viewport || this.context.viewport;\n return viewport.unproject(xy);\n }\n /** Projects a point with current view state from the current layer's coordinate system to the world space */\n projectPosition(xyz, params) {\n assert(this.internalState);\n const viewport = this.internalState.viewport || this.context.viewport;\n return projectPosition(xyz, {\n viewport,\n modelMatrix: this.props.modelMatrix,\n coordinateOrigin: this.props.coordinateOrigin,\n coordinateSystem: this.props.coordinateSystem,\n ...params\n });\n }\n // Public API for custom layer implementation\n /** `true` if this layer renders other layers */\n get isComposite() {\n return false;\n }\n /** Updates selected state members and marks the layer for redraw */\n setState(partialState) {\n this.setChangeFlags({ stateChanged: true });\n Object.assign(this.state, partialState);\n this.setNeedsRedraw();\n }\n /** Sets the redraw flag for this layer, will trigger a redraw next animation frame */\n setNeedsRedraw() {\n if (this.internalState) {\n this.internalState.needsRedraw = true;\n }\n }\n /** Mark this layer as needs a deep update */\n setNeedsUpdate() {\n if (this.internalState) {\n this.context.layerManager.setNeedsUpdate(String(this));\n this.internalState.needsUpdate = true;\n }\n }\n /** Returns true if all async resources are loaded */\n get isLoaded() {\n return this.internalState ? !this.internalState.isAsyncPropLoading() : false;\n }\n /** Returns true if using shader-based WGS84 longitude wrapping */\n get wrapLongitude() {\n return this.props.wrapLongitude;\n }\n /** @deprecated Returns true if the layer is visible in the picking pass */\n isPickable() {\n return this.props.pickable && this.props.visible;\n }\n /** Returns an array of models used by this layer, can be overriden by layer subclass */\n getModels() {\n const state = this.state;\n return (state && (state.models || (state.model && [state.model]))) || [];\n }\n // TODO deprecate in favour of setShaderModuleProps\n /** Update shader module parameters */\n setModuleParameters(moduleParameters) {\n for (const model of this.getModels()) {\n model.updateModuleSettings(moduleParameters);\n }\n }\n /** Update shader input parameters */\n setShaderModuleProps(...props) {\n for (const model of this.getModels()) {\n model.shaderInputs.setProps(...props);\n }\n }\n /** Returns the attribute manager of this layer */\n getAttributeManager() {\n return this.internalState && this.internalState.attributeManager;\n }\n /** Returns the most recent layer that matched to this state\n (When reacting to an async event, this layer may no longer be the latest) */\n getCurrentLayer() {\n return this.internalState && this.internalState.layer;\n }\n /** Returns the default parse options for async props */\n getLoadOptions() {\n return this.props.loadOptions;\n }\n use64bitPositions() {\n const { coordinateSystem } = this.props;\n return (coordinateSystem === COORDINATE_SYSTEM.DEFAULT ||\n coordinateSystem === COORDINATE_SYSTEM.LNGLAT ||\n coordinateSystem === COORDINATE_SYSTEM.CARTESIAN);\n }\n // Event handling\n onHover(info, pickingEvent) {\n if (this.props.onHover) {\n return this.props.onHover(info, pickingEvent) || false;\n }\n return false;\n }\n onClick(info, pickingEvent) {\n if (this.props.onClick) {\n return this.props.onClick(info, pickingEvent) || false;\n }\n return false;\n }\n // Returns the picking color that doesn't match any subfeature\n // Use if some graphics do not belong to any pickable subfeature\n // @return {Array} - a black color\n nullPickingColor() {\n return [0, 0, 0];\n }\n // Returns the picking color that doesn't match any subfeature\n // Use if some graphics do not belong to any pickable subfeature\n encodePickingColor(i, target = []) {\n target[0] = (i + 1) & 255;\n target[1] = ((i + 1) >> 8) & 255;\n target[2] = (((i + 1) >> 8) >> 8) & 255;\n return target;\n }\n // Returns the index corresponding to a picking color that doesn't match any subfeature\n // @param {Uint8Array} color - color array to be decoded\n // @return {Array} - the decoded picking color\n decodePickingColor(color) {\n assert(color instanceof Uint8Array);\n const [i1, i2, i3] = color;\n // 1 was added to seperate from no selection\n const index = i1 + i2 * 256 + i3 * 65536 - 1;\n return index;\n }\n /** Deduces number of instances. Intention is to support:\n - Explicit setting of numInstances\n - Auto-deduction for ES6 containers that define a size member\n - Auto-deduction for Classic Arrays via the built-in length attribute\n - Auto-deduction via arrays */\n getNumInstances() {\n // First Check if app has provided an explicit value\n if (Number.isFinite(this.props.numInstances)) {\n return this.props.numInstances;\n }\n // Second check if the layer has set its own value\n if (this.state && this.state.numInstances !== undefined) {\n return this.state.numInstances;\n }\n // Use container library to get a count for any ES6 container or object\n return count(this.props.data);\n }\n /** Buffer layout describes how many attribute values are packed for each data object\n The default (null) is one value each object.\n Some data formats (e.g. paths, polygons) have various length. Their buffer layout\n is in the form of [L0, L1, L2, ...] */\n getStartIndices() {\n // First Check if startIndices is provided as an explicit value\n if (this.props.startIndices) {\n return this.props.startIndices;\n }\n // Second check if the layer has set its own value\n if (this.state && this.state.startIndices) {\n return this.state.startIndices;\n }\n return null;\n }\n // Default implementation\n getBounds() {\n return this.getAttributeManager()?.getBounds(['positions', 'instancePositions']);\n }\n getShaders(shaders) {\n shaders = mergeShaders(shaders, {\n disableWarnings: true,\n modules: this.context.defaultShaderModules\n });\n for (const extension of this.props.extensions) {\n shaders = mergeShaders(shaders, extension.getShaders.call(this, extension));\n }\n return shaders;\n }\n /** Controls if updateState should be called. By default returns true if any prop has changed */\n shouldUpdateState(params) {\n return params.changeFlags.propsOrDataChanged;\n }\n /** Default implementation, all attributes will be invalidated and updated when data changes */\n // eslint-disable-next-line complexity\n updateState(params) {\n const attributeManager = this.getAttributeManager();\n const { dataChanged } = params.changeFlags;\n if (dataChanged && attributeManager) {\n if (Array.isArray(dataChanged)) {\n // is partial update\n for (const dataRange of dataChanged) {\n attributeManager.invalidateAll(dataRange);\n }\n }\n else {\n attributeManager.invalidateAll();\n }\n }\n // Enable/disable picking buffer\n if (attributeManager) {\n const { props } = params;\n const hasPickingBuffer = this.internalState.hasPickingBuffer;\n const needsPickingBuffer = Number.isInteger(props.highlightedObjectIndex) ||\n props.pickable ||\n props.extensions.some(extension => extension.getNeedsPickingBuffer.call(this, extension));\n // Only generate picking buffer if needed\n if (hasPickingBuffer !== needsPickingBuffer) {\n this.internalState.hasPickingBuffer = needsPickingBuffer;\n const { pickingColors, instancePickingColors } = attributeManager.attributes;\n const pickingColorsAttribute = pickingColors || instancePickingColors;\n if (pickingColorsAttribute) {\n if (needsPickingBuffer && pickingColorsAttribute.constant) {\n pickingColorsAttribute.constant = false;\n attributeManager.invalidate(pickingColorsAttribute.id);\n }\n if (!pickingColorsAttribute.value && !needsPickingBuffer) {\n pickingColorsAttribute.constant = true;\n pickingColorsAttribute.value = [0, 0, 0];\n }\n }\n }\n }\n }\n /** Called once when layer is no longer matched and state will be discarded. Layers can destroy WebGL resources here. */\n finalizeState(context) {\n for (const model of this.getModels()) {\n model.destroy();\n }\n const attributeManager = this.getAttributeManager();\n if (attributeManager) {\n attributeManager.finalize();\n }\n if (this.context) {\n this.context.resourceManager.unsubscribe({ consumerId: this.id });\n }\n if (this.internalState) {\n this.internalState.uniformTransitions.clear();\n this.internalState.finalize();\n }\n }\n // If state has a model, draw it with supplied uniforms\n draw(opts) {\n for (const model of this.getModels()) {\n model.draw(opts);\n }\n }\n // called to populate the info object that is passed to the event handler\n // @return null to cancel event\n getPickingInfo({ info, mode, sourceLayer }) {\n const { index } = info;\n if (index >= 0) {\n // If props.data is an indexable array, get the object\n if (Array.isArray(this.props.data)) {\n info.object = this.props.data[index];\n }\n }\n return info;\n }\n // END LIFECYCLE METHODS\n // / INTERNAL METHODS - called by LayerManager, DeckRenderer and DeckPicker\n /** (Internal) Propagate an error event through the system */\n raiseError(error, message) {\n if (message) {\n // Duplicating error message for backward compatibility, see #7986\n // TODO - revisit in v9\n error = new Error(`${message}: ${error.message}`, { cause: error });\n }\n if (!this.props.onError?.(error)) {\n this.context?.onError?.(error, this);\n }\n }\n /** (Internal) Checks if this layer needs redraw */\n getNeedsRedraw(opts = { clearRedrawFlags: false }) {\n return this._getNeedsRedraw(opts);\n }\n /** (Internal) Checks if this layer needs a deep update */\n needsUpdate() {\n if (!this.internalState) {\n return false;\n }\n // Call subclass lifecycle method\n return (this.internalState.needsUpdate ||\n this.hasUniformTransition() ||\n this.shouldUpdateState(this._getUpdateParams()));\n // End lifecycle method\n }\n /** Checks if this layer has ongoing uniform transition */\n hasUniformTransition() {\n return this.internalState?.uniformTransitions.active || false;\n }\n /** Called when this layer is rendered into the given viewport */\n activateViewport(viewport) {\n if (!this.internalState) {\n return;\n }\n const oldViewport = this.internalState.viewport;\n this.internalState.viewport = viewport;\n if (!oldViewport || !areViewportsEqual({ oldViewport, viewport })) {\n this.setChangeFlags({ viewportChanged: true });\n if (this.isComposite) {\n if (this.needsUpdate()) {\n // Composite layers may add/remove sublayers on viewport change\n // Because we cannot change the layers list during a draw cycle, we don't want to update sublayers right away\n // This will not call update immediately, but mark the layerManager as needs update on the next frame\n this.setNeedsUpdate();\n }\n }\n else {\n this._update();\n }\n }\n }\n /** Default implementation of attribute invalidation, can be redefined */\n invalidateAttribute(name = 'all') {\n const attributeManager = this.getAttributeManager();\n if (!attributeManager) {\n return;\n }\n if (name === 'all') {\n attributeManager.invalidateAll();\n }\n else {\n attributeManager.invalidate(name);\n }\n }\n /** Send updated attributes to the WebGL model */\n updateAttributes(changedAttributes) {\n // If some buffer layout changed\n let bufferLayoutChanged = false;\n for (const id in changedAttributes) {\n if (changedAttributes[id].layoutChanged()) {\n bufferLayoutChanged = true;\n }\n }\n for (const model of this.getModels()) {\n this._setModelAttributes(model, changedAttributes, bufferLayoutChanged);\n }\n }\n /** Recalculate any attributes if needed */\n _updateAttributes() {\n const attributeManager = this.getAttributeManager();\n if (!attributeManager) {\n return;\n }\n const props = this.props;\n // Figure out data length\n const numInstances = this.getNumInstances();\n const startIndices = this.getStartIndices();\n attributeManager.update({\n data: props.data,\n numInstances,\n startIndices,\n props,\n transitions: props.transitions,\n // @ts-ignore (TS2339) property attribute is not present on some acceptable data types\n buffers: props.data.attributes,\n context: this\n });\n const changedAttributes = attributeManager.getChangedAttributes({ clearChangedFlags: true });\n this.updateAttributes(changedAttributes);\n }\n /** Update attribute transitions. This is called in drawLayer, no model updates required. */\n _updateAttributeTransition() {\n const attributeManager = this.getAttributeManager();\n if (attributeManager) {\n attributeManager.updateTransition();\n }\n }\n /** Update uniform (prop) transitions. This is called in updateState, may result in model updates. */\n _updateUniformTransition() {\n // @ts-ignore (TS2339) internalState is alwasy defined when this method is called\n const { uniformTransitions } = this.internalState;\n if (uniformTransitions.active) {\n // clone props\n const propsInTransition = uniformTransitions.update();\n const props = Object.create(this.props);\n for (const key in propsInTransition) {\n Object.defineProperty(props, key, { value: propsInTransition[key] });\n }\n return props;\n }\n return this.props;\n }\n /** Updater for the automatically populated instancePickingColors attribute */\n calculateInstancePickingColors(attribute, { numInstances }) {\n if (attribute.constant) {\n return;\n }\n // calculateInstancePickingColors always generates the same sequence.\n // pickingColorCache saves the largest generated sequence for reuse\n const cacheSize = Math.floor(pickingColorCache.length / 4);\n // Record when using the picking buffer cache, so that layers can always point at the most recently allocated cache\n // @ts-ignore (TS2531) internalState is always defined when this method is called\n this.internalState.usesPickingColorCache = true;\n if (cacheSize < numInstances) {\n if (numInstances > MAX_PICKING_COLOR_CACHE_SIZE) {\n log.warn('Layer has too many data objects. Picking might not be able to distinguish all objects.')();\n }\n pickingColorCache = typedArrayManager.allocate(pickingColorCache, numInstances, {\n size: 4,\n copy: true,\n maxCount: Math.max(numInstances, MAX_PICKING_COLOR_CACHE_SIZE)\n });\n // If the attribute is larger than the cache, resize the cache and populate the missing chunk\n const newCacheSize = Math.floor(pickingColorCache.length / 4);\n const pickingColor = [];\n for (let i = cacheSize; i < newCacheSize; i++) {\n this.encodePickingColor(i, pickingColor);\n pickingColorCache[i * 4 + 0] = pickingColor[0];\n pickingColorCache[i * 4 + 1] = pickingColor[1];\n pickingColorCache[i * 4 + 2] = pickingColor[2];\n }\n }\n attribute.value = pickingColorCache.subarray(0, numInstances * 4);\n }\n /** Apply changed attributes to model */\n _setModelAttributes(model, changedAttributes, bufferLayoutChanged = false) {\n if (!Object.keys(changedAttributes).length) {\n return;\n }\n if (bufferLayoutChanged) {\n // AttributeManager is always defined when this method is called\n const attributeManager = this.getAttributeManager();\n model.setBufferLayout(attributeManager.getBufferLayouts(model));\n // All attributes must be reset after buffer layout change\n changedAttributes = attributeManager.getAttributes();\n }\n // @ts-ignore luma.gl type issue\n const excludeAttributes = model.userData?.excludeAttributes || {};\n const attributeBuffers = {};\n const constantAttributes = {};\n for (const name in changedAttributes) {\n if (excludeAttributes[name]) {\n continue;\n }\n const values = changedAttributes[name].getValue();\n for (const attributeName in values) {\n const value = values[attributeName];\n if (value instanceof Buffer) {\n if (changedAttributes[name].settings.isIndexed) {\n model.setIndexBuffer(value);\n }\n else {\n attributeBuffers[attributeName] = value;\n }\n }\n else if (value) {\n constantAttributes[attributeName] = value;\n }\n }\n }\n // TODO - update buffer map?\n model.setAttributes(attributeBuffers);\n model.setConstantAttributes(constantAttributes);\n }\n /** (Internal) Sets the picking color at the specified index to null picking color. Used for multi-depth picking.\n This method may be overriden by layer implementations */\n disablePickingIndex(objectIndex) {\n const data = this.props.data;\n if (!('attributes' in data)) {\n this._disablePickingIndex(objectIndex);\n return;\n }\n // @ts-ignore (TS2531) this method is only called internally with attributeManager defined\n const { pickingColors, instancePickingColors } = this.getAttributeManager().attributes;\n const colors = pickingColors || instancePickingColors;\n const externalColorAttribute = colors && data.attributes && data.attributes[colors.id];\n if (externalColorAttribute && externalColorAttribute.value) {\n const values = externalColorAttribute.value;\n const objectColor = this.encodePickingColor(objectIndex);\n for (let index = 0; index < data.length; index++) {\n const i = colors.getVertexOffset(index);\n if (values[i] === objectColor[0] &&\n values[i + 1] === objectColor[1] &&\n values[i + 2] === objectColor[2]) {\n this._disablePickingIndex(index);\n }\n }\n }\n else {\n this._disablePickingIndex(objectIndex);\n }\n }\n // TODO - simplify subclassing interface\n _disablePickingIndex(objectIndex) {\n // @ts-ignore (TS2531) this method is only called internally with attributeManager defined\n const { pickingColors, instancePickingColors } = this.getAttributeManager().attributes;\n const colors = pickingColors || instancePickingColors;\n if (!colors) {\n return;\n }\n const start = colors.getVertexOffset(objectIndex);\n const end = colors.getVertexOffset(objectIndex + 1);\n // Fill the sub buffer with 0s, 1 byte per element\n colors.buffer.write(new Uint8Array(end - start), start);\n }\n /** (Internal) Re-enable all picking indices after multi-depth picking */\n restorePickingColors() {\n // @ts-ignore (TS2531) this method is only called internally with attributeManager defined\n const { pickingColors, instancePickingColors } = this.getAttributeManager().attributes;\n const colors = pickingColors || instancePickingColors;\n if (!colors) {\n return;\n }\n // The picking color cache may have been freed and then reallocated. This ensures we read from the currently allocated cache.\n if (\n // @ts-ignore (TS2531) this method is only called internally with internalState defined\n this.internalState.usesPickingColorCache &&\n colors.value.buffer !== pickingColorCache.buffer) {\n colors.value = pickingColorCache.subarray(0, colors.value.length);\n }\n colors.updateSubBuffer({ startOffset: 0 });\n }\n /* eslint-disable max-statements */\n /* (Internal) Called by layer manager when a new layer is found */\n _initialize() {\n assert(!this.internalState); // finalized layer cannot be reused\n assert(Number.isFinite(this.props.coordinateSystem)); // invalid coordinateSystem\n debug(TRACE_INITIALIZE, this);\n const attributeManager = this._getAttributeManager();\n if (attributeManager) {\n // All instanced layers get instancePickingColors attribute by default\n // Their shaders can use it to render a picking scene\n // TODO - this slightly slows down non instanced layers\n attributeManager.addInstanced({\n instancePickingColors: {\n type: 'uint8',\n size: 4,\n noAlloc: true,\n // Updaters are always called with `this` pointing to the layer\n // eslint-disable-next-line @typescript-eslint/unbound-method\n update: this.calculateInstancePickingColors\n }\n });\n }\n this.internalState = new LayerState({\n attributeManager,\n layer: this\n });\n this._clearChangeFlags(); // populate this.internalState.changeFlags\n this.state = {};\n // for backwards compatibility with older layers\n // TODO - remove in next release\n /* eslint-disable accessor-pairs */\n Object.defineProperty(this.state, 'attributeManager', {\n get: () => {\n log.deprecated('layer.state.attributeManager', 'layer.getAttributeManager()')();\n return attributeManager;\n }\n });\n /* eslint-enable accessor-pairs */\n this.internalState.uniformTransitions = new UniformTransitionManager(this.context.timeline);\n this.internalState.onAsyncPropUpdated = this._onAsyncPropUpdated.bind(this);\n // Ensure any async props are updated\n this.internalState.setAsyncProps(this.props);\n // Call subclass lifecycle methods\n this.initializeState(this.context);\n // Initialize extensions\n for (const extension of this.props.extensions) {\n extension.initializeState.call(this, this.context, extension);\n }\n // End subclass lifecycle methods\n // initializeState callback tends to clear state\n this.setChangeFlags({\n dataChanged: 'init',\n propsChanged: 'init',\n viewportChanged: true,\n extensionsChanged: true\n });\n this._update();\n }\n /** (Internal) Called by layer manager to transfer state from an old layer */\n _transferState(oldLayer) {\n debug(TRACE_MATCHED, this, this === oldLayer);\n const { state, internalState } = oldLayer;\n if (this === oldLayer) {\n return;\n }\n // Move internalState\n this.internalState = internalState;\n // Move state\n this.state = state;\n // We keep the state ref on old layers to support async actions\n // oldLayer.state = null;\n // Ensure any async props are updated\n this.internalState.setAsyncProps(this.props);\n this._diffProps(this.props, this.internalState.getOldProps());\n }\n /** (Internal) Called by layer manager when a new layer is added or an existing layer is matched with a new instance */\n _update() {\n // Call subclass lifecycle method\n const stateNeedsUpdate = this.needsUpdate();\n // End lifecycle method\n debug(TRACE_UPDATE, this, stateNeedsUpdate);\n if (!stateNeedsUpdate) {\n return;\n }\n const currentProps = this.props;\n const context = this.context;\n const internalState = this.internalState;\n const currentViewport = context.viewport;\n const propsInTransition = this._updateUniformTransition();\n internalState.propsInTransition = propsInTransition;\n // Overwrite this.context.viewport during update to use the last activated viewport on this layer\n // In multi-view applications, a layer may only be drawn in one of the views\n // Which would make the \"active\" viewport different from the shared context\n context.viewport = internalState.viewport || currentViewport;\n // Overwrite this.props during update to use in-transition prop values\n this.props = propsInTransition;\n try {\n const updateParams = this._getUpdateParams();\n const oldModels = this.getModels();\n // Safely call subclass lifecycle methods\n if (context.device) {\n this.updateState(updateParams);\n }\n else {\n try {\n this.updateState(updateParams);\n }\n catch (error) {\n // ignore error if gl context is missing\n }\n }\n // Execute extension updates\n for (const extension of this.props.extensions) {\n extension.updateState.call(this, updateParams, extension);\n }\n const modelChanged = this.getModels()[0] !== oldModels[0];\n this._postUpdate(updateParams, modelChanged);\n // End subclass lifecycle methods\n }\n finally {\n // Restore shared context\n context.viewport = currentViewport;\n this.props = currentProps;\n this._clearChangeFlags();\n internalState.needsUpdate = false;\n internalState.resetOldProps();\n }\n }\n /* eslint-enable max-statements */\n /** (Internal) Called by manager when layer is about to be disposed\n Note: not guaranteed to be called on application shutdown */\n _finalize() {\n debug(TRACE_FINALIZE, this);\n // Call subclass lifecycle method\n this.finalizeState(this.context);\n // Finalize extensions\n for (const extension of this.props.extensions) {\n extension.finalizeState.call(this, this.context, extension);\n }\n }\n // Calculates uniforms\n _drawLayer({ renderPass, moduleParameters = null, uniforms = {}, parameters = {} }) {\n this._updateAttributeTransition();\n const currentProps = this.props;\n const context = this.context;\n // Overwrite this.props during redraw to use in-transition prop values\n // `internalState.propsInTransition` could be missing if `updateState` failed\n // @ts-ignore (TS2339) internalState is alwasy defined when this method is called\n this.props = this.internalState.propsInTransition || currentProps;\n const opacity = this.props.opacity;\n // apply gamma to opacity to make it visually \"linear\"\n uniforms.opacity = Math.pow(opacity, 1 / 2.2);\n try {\n // TODO/ib - hack move to luma Model.draw\n if (moduleParameters) {\n const { isActive, isAttribute } = moduleParameters.picking;\n this.setModuleParameters(moduleParameters);\n this.setShaderModuleProps({ picking: { isActive, isAttribute } });\n }\n // Apply polygon offset to avoid z-fighting\n // TODO - move to draw-layers\n const { getPolygonOffset } = this.props;\n const offsets = (getPolygonOffset && getPolygonOffset(uniforms)) || [0, 0];\n context.device.setParametersWebGL({ polygonOffset: offsets });\n for (const model of this.getModels()) {\n model.setParameters(parameters);\n }\n // Call subclass lifecycle method\n context.device.withParametersWebGL(parameters, () => {\n const opts = { renderPass, moduleParameters, uniforms, parameters, context };\n // extensions\n for (const extension of this.props.extensions) {\n extension.draw.call(this, opts, extension);\n }\n this.draw(opts);\n });\n }\n finally {\n this.props = currentProps;\n }\n // End lifecycle method\n }\n // Helper methods\n /** Returns the current change flags */\n getChangeFlags() {\n return this.internalState?.changeFlags;\n }\n /* eslint-disable complexity */\n /** Dirty some change flags, will be handled by updateLayer */\n setChangeFlags(flags) {\n if (!this.internalState) {\n return;\n }\n const { changeFlags } = this.internalState;\n /* eslint-disable no-fallthrough, max-depth */\n for (const key in flags) {\n if (flags[key]) {\n let flagChanged = false;\n switch (key) {\n case 'dataChanged':\n // changeFlags.dataChanged may be `false`, a string (reason) or an array of ranges\n const dataChangedReason = flags[key];\n const prevDataChangedReason = changeFlags[key];\n if (dataChangedReason && Array.isArray(prevDataChangedReason)) {\n // Merge partial updates\n changeFlags.dataChanged = Array.isArray(dataChangedReason)\n ? prevDataChangedReason.concat(dataChangedReason)\n : dataChangedReason;\n flagChanged = true;\n }\n default:\n if (!changeFlags[key]) {\n changeFlags[key] = flags[key];\n flagChanged = true;\n }\n }\n if (flagChanged) {\n debug(TRACE_CHANGE_FLAG, this, key, flags);\n }\n }\n }\n /* eslint-enable no-fallthrough, max-depth */\n // Update composite flags\n const propsOrDataChanged = Boolean(changeFlags.dataChanged ||\n changeFlags.updateTriggersChanged ||\n changeFlags.propsChanged ||\n changeFlags.extensionsChanged);\n changeFlags.propsOrDataChanged = propsOrDataChanged;\n changeFlags.somethingChanged =\n propsOrDataChanged || changeFlags.viewportChanged || changeFlags.stateChanged;\n }\n /* eslint-enable complexity */\n /** Clear all changeFlags, typically after an update */\n _clearChangeFlags() {\n // @ts-ignore TS2531 this method can only be called internally with internalState assigned\n this.internalState.changeFlags = {\n dataChanged: false,\n propsChanged: false,\n updateTriggersChanged: false,\n viewportChanged: false,\n stateChanged: false,\n extensionsChanged: false,\n propsOrDataChanged: false,\n somethingChanged: false\n };\n }\n /** Compares the layers props with old props from a matched older layer\n and extracts change flags that describe what has change so that state\n can be update correctly with minimal effort */\n _diffProps(newProps, oldProps) {\n const changeFlags = diffProps(newProps, oldProps);\n // iterate over changedTriggers\n if (changeFlags.updateTriggersChanged) {\n for (const key in changeFlags.updateTriggersChanged) {\n if (changeFlags.updateTriggersChanged[key]) {\n this.invalidateAttribute(key);\n }\n }\n }\n // trigger uniform transitions\n if (changeFlags.transitionsChanged) {\n for (const key in changeFlags.transitionsChanged) {\n // prop changed and transition is enabled\n // @ts-ignore (TS2531) internalState is always defined when this method is called\n this.internalState.uniformTransitions.add(key, oldProps[key], newProps[key], newProps.transitions?.[key]);\n }\n }\n return this.setChangeFlags(changeFlags);\n }\n /** (Internal) called by layer manager to perform extra props validation (in development only) */\n validateProps() {\n validateProps(this.props);\n }\n /** (Internal) Called by deck picker when the hovered object changes to update the auto highlight */\n updateAutoHighlight(info) {\n if (this.props.autoHighlight && !Number.isInteger(this.props.highlightedObjectIndex)) {\n this._updateAutoHighlight(info);\n }\n }\n // May be overriden by subclasses\n // TODO - simplify subclassing interface\n /** Update picking module parameters to highlight the hovered object */\n _updateAutoHighlight(info) {\n const picking = {\n // @ts-expect-error stricter luma gl types\n highlightedObjectColor: info.picked ? info.color : null\n };\n const { highlightColor } = this.props;\n if (info.picked && typeof highlightColor === 'function') {\n // @ts-expect-error stricter luma gl types\n picking.highlightColor = highlightColor(info);\n }\n this.setShaderModuleProps({ picking });\n // setShaderModuleProps does not trigger redraw\n this.setNeedsRedraw();\n }\n /** Create new attribute manager */\n _getAttributeManager() {\n const context = this.context;\n return new AttributeManager(context.device, {\n id: this.props.id,\n stats: context.stats,\n timeline: context.timeline\n });\n }\n // Private methods\n /** Called after updateState to perform common tasks */\n _postUpdate(updateParams, forceUpdate) {\n const { props, oldProps } = updateParams;\n this.setNeedsRedraw();\n // Check if attributes need recalculation\n this._updateAttributes();\n // Note: Automatic instance count update only works for single layers\n const model = this.state.model;\n if (model?.isInstanced) {\n model.setInstanceCount(this.getNumInstances());\n }\n // Set picking module parameters to match props\n const { autoHighlight, highlightedObjectIndex, highlightColor } = props;\n if (forceUpdate ||\n oldProps.autoHighlight !== autoHighlight ||\n oldProps.highlightedObjectIndex !== highlightedObjectIndex ||\n oldProps.highlightColor !== highlightColor) {\n const picking = {};\n if (Array.isArray(highlightColor)) {\n // @ts-expect-error stricter luma gl types\n picking.highlightColor = highlightColor;\n }\n // highlightedObjectIndex will overwrite any settings from auto highlighting.\n // Do not reset unless the value has changed.\n if (forceUpdate ||\n oldProps.autoHighlight !== autoHighlight ||\n highlightedObjectIndex !== oldProps.highlightedObjectIndex) {\n // @ts-expect-error stricter luma gl types\n picking.highlightedObjectColor =\n Number.isFinite(highlightedObjectIndex) && highlightedObjectIndex >= 0\n ? this.encodePickingColor(highlightedObjectIndex)\n : null;\n }\n this.setShaderModuleProps({ picking });\n }\n }\n _getUpdateParams() {\n return {\n props: this.props,\n // @ts-ignore TS2531 this method can only be called internally with internalState assigned\n oldProps: this.internalState.getOldProps(),\n context: this.context,\n // @ts-ignore TS2531 this method can only be called internally with internalState assigned\n changeFlags: this.internalState.changeFlags\n };\n }\n /** Checks state of attributes and model */\n _getNeedsRedraw(opts) {\n // this method may be called by the render loop as soon a the layer\n // has been created, so guard against uninitialized state\n if (!this.internalState) {\n return false;\n }\n let redraw = false;\n redraw = redraw || (this.internalState.needsRedraw && this.id);\n // TODO - is attribute manager needed? - Model should be enough.\n const attributeManager = this.getAttributeManager();\n const attributeManagerNeedsRedraw = attributeManager\n ? attributeManager.getNeedsRedraw(opts)\n : false;\n redraw = redraw || attributeManagerNeedsRedraw;\n if (redraw) {\n for (const extension of this.props.extensions) {\n extension.onNeedsRedraw.call(this, extension);\n }\n }\n this.internalState.needsRedraw = this.internalState.needsRedraw && !opts.clearRedrawFlags;\n return redraw;\n }\n /** Callback when asyn prop is loaded */\n _onAsyncPropUpdated() {\n // @ts-ignore TS2531 this method can only be called internally with internalState assigned\n this._diffProps(this.props, this.internalState.getOldProps());\n this.setNeedsUpdate();\n }\n}\nLayer.defaultProps = defaultProps;\nLayer.layerName = 'Layer';\nexport default Layer;\n", "import { lerp } from '@math.gl/core';\nimport Transition from \"./transition.js\";\nexport default class CPUInterpolationTransition extends Transition {\n get value() {\n return this._value;\n }\n _onUpdate() {\n const { time, settings: { fromValue, toValue, duration, easing } } = this;\n const t = easing(time / duration);\n this._value = lerp(fromValue, toValue, t);\n }\n}\n", "import Transition from \"./transition.js\";\nconst EPSILON = 1e-5;\n/*\n * Calculate the next value in the spring transition\n * @param prev {Number} - previous value\n * @param cur {Number} - current value\n * @param dest {Number} - destination value\n * @param damping {Number}\n * @param stiffness {Number}\n */\nfunction updateSpringElement(prev, cur, dest, damping, stiffness) {\n const velocity = cur - prev;\n const delta = dest - cur;\n const spring = delta * stiffness;\n const damper = -velocity * damping;\n return spring + damper + velocity + cur;\n}\nfunction updateSpring(prev, cur, dest, damping, stiffness) {\n if (Array.isArray(dest)) {\n const next = [];\n for (let i = 0; i < dest.length; i++) {\n next[i] = updateSpringElement(prev[i], cur[i], dest[i], damping, stiffness);\n }\n return next;\n }\n return updateSpringElement(prev, cur, dest, damping, stiffness);\n}\n/*\n * Calculate the distance between two numbers or two vectors\n */\nfunction distance(value1, value2) {\n if (Array.isArray(value1)) {\n let distanceSquare = 0;\n for (let i = 0; i < value1.length; i++) {\n const d = value1[i] - value2[i];\n distanceSquare += d * d;\n }\n return Math.sqrt(distanceSquare);\n }\n return Math.abs(value1 - value2);\n}\nexport default class CPUSpringTransition extends Transition {\n get value() {\n return this._currValue;\n }\n _onUpdate() {\n // TODO - use timeline\n // const {time} = this;\n const { fromValue, toValue, damping, stiffness } = this.settings;\n const { _prevValue = fromValue, _currValue = fromValue } = this;\n let nextValue = updateSpring(_prevValue, _currValue, toValue, damping, stiffness);\n const delta = distance(nextValue, toValue);\n const velocity = distance(nextValue, _currValue);\n if (delta < EPSILON && velocity < EPSILON) {\n nextValue = toValue;\n this.end();\n }\n this._prevValue = _currValue;\n this._currValue = nextValue;\n }\n}\n", "import { normalizeTransitionSettings } from \"./attribute/transition-settings.js\";\nimport CPUInterpolationTransition from \"../transitions/cpu-interpolation-transition.js\";\nimport CPUSpringTransition from \"../transitions/cpu-spring-transition.js\";\nimport log from \"../utils/log.js\";\nconst TRANSITION_TYPES = {\n interpolation: CPUInterpolationTransition,\n spring: CPUSpringTransition\n};\nexport default class UniformTransitionManager {\n constructor(timeline) {\n this.transitions = new Map();\n this.timeline = timeline;\n }\n get active() {\n return this.transitions.size > 0;\n }\n add(key, fromValue, toValue, settings) {\n const { transitions } = this;\n if (transitions.has(key)) {\n const transition = transitions.get(key);\n // value may not be available if `update()` has not been called. Fallback to `fromValue`\n const { value = transition.settings.fromValue } = transition;\n // start from interrupted position\n fromValue = value;\n this.remove(key);\n }\n settings = normalizeTransitionSettings(settings);\n if (!settings) {\n return;\n }\n const TransitionType = TRANSITION_TYPES[settings.type];\n if (!TransitionType) {\n log.error(`unsupported transition type '${settings.type}'`)();\n return;\n }\n const transition = new TransitionType(this.timeline);\n transition.start({\n ...settings,\n fromValue,\n toValue\n });\n transitions.set(key, transition);\n }\n remove(key) {\n const { transitions } = this;\n if (transitions.has(key)) {\n transitions.get(key).cancel();\n transitions.delete(key);\n }\n }\n update() {\n const propsInTransition = {};\n for (const [key, transition] of this.transitions) {\n transition.update();\n propsInTransition[key] = transition.value;\n if (!transition.inProgress) {\n // transition ended\n this.remove(key);\n }\n }\n return propsInTransition;\n }\n clear() {\n for (const key of this.transitions.keys()) {\n this.remove(key);\n }\n }\n}\n", "import { PROP_TYPES_SYMBOL } from \"./constants.js\";\nexport function validateProps(props) {\n const propTypes = props[PROP_TYPES_SYMBOL];\n for (const propName in propTypes) {\n const propType = propTypes[propName];\n const { validate } = propType;\n if (validate && !validate(props[propName], propType)) {\n throw new Error(`Invalid prop ${propName}: ${props[propName]}`);\n }\n }\n}\n// Returns an object with \"change flags\", either false or strings indicating reason for change\nexport function diffProps(props, oldProps) {\n // First check if any props have changed (ignore props that will be examined separately)\n const propsChangedReason = compareProps({\n newProps: props,\n oldProps,\n propTypes: props[PROP_TYPES_SYMBOL],\n ignoreProps: { data: null, updateTriggers: null, extensions: null, transitions: null }\n });\n // Now check if any data related props have changed\n const dataChangedReason = diffDataProps(props, oldProps);\n // Check update triggers to determine if any attributes need regeneration\n // Note - if data has changed, all attributes will need regeneration, so skip this step\n let updateTriggersChangedReason = false;\n if (!dataChangedReason) {\n updateTriggersChangedReason = diffUpdateTriggers(props, oldProps);\n }\n return {\n dataChanged: dataChangedReason,\n propsChanged: propsChangedReason,\n updateTriggersChanged: updateTriggersChangedReason,\n extensionsChanged: diffExtensions(props, oldProps),\n transitionsChanged: diffTransitions(props, oldProps)\n };\n}\nfunction diffTransitions(props, oldProps) {\n if (!props.transitions) {\n return false;\n }\n const result = {};\n const propTypes = props[PROP_TYPES_SYMBOL];\n let changed = false;\n for (const key in props.transitions) {\n const propType = propTypes[key];\n const type = propType && propType.type;\n const isTransitionable = type === 'number' || type === 'color' || type === 'array';\n if (isTransitionable && comparePropValues(props[key], oldProps[key], propType)) {\n result[key] = true;\n changed = true;\n }\n }\n return changed ? result : false;\n}\n/**\n * Performs equality by iterating through keys on an object and returning false\n * when any key has values which are not strictly equal between the arguments.\n * @param {Object} opt.oldProps - object with old key/value pairs\n * @param {Object} opt.newProps - object with new key/value pairs\n * @param {Object} opt.ignoreProps={} - object, keys that should not be compared\n * @returns {null|String} - null when values of all keys are strictly equal.\n * if unequal, returns a string explaining what changed.\n */\n/* eslint-disable max-statements, max-depth, complexity */\n/*\n * Note: for better performance, this function assumes that both oldProps and newProps\n inherit the same prototype (defaultProps). That is, if neither object contains own\n property , assume `oldProps.` and `newProps.` are equal.\n */\nexport function compareProps({ newProps, oldProps, ignoreProps = {}, propTypes = {}, triggerName = 'props' }) {\n // shallow equality => deep equality\n if (oldProps === newProps) {\n return false;\n }\n // TODO - do we need these checks? Should never happen...\n if (typeof newProps !== 'object' || newProps === null) {\n return `${triggerName} changed shallowly`;\n }\n if (typeof oldProps !== 'object' || oldProps === null) {\n return `${triggerName} changed shallowly`;\n }\n // Compare explicitly defined new props against old/default values\n for (const key of Object.keys(newProps)) {\n if (!(key in ignoreProps)) {\n if (!(key in oldProps)) {\n return `${triggerName}.${key} added`;\n }\n const changed = comparePropValues(newProps[key], oldProps[key], propTypes[key]);\n if (changed) {\n return `${triggerName}.${key} ${changed}`;\n }\n }\n }\n // Test if any old props have been dropped\n for (const key of Object.keys(oldProps)) {\n if (!(key in ignoreProps)) {\n if (!(key in newProps)) {\n return `${triggerName}.${key} dropped`;\n }\n if (!Object.hasOwnProperty.call(newProps, key)) {\n // Compare dropped old prop against default value\n const changed = comparePropValues(newProps[key], oldProps[key], propTypes[key]);\n if (changed) {\n return `${triggerName}.${key} ${changed}`;\n }\n }\n }\n }\n return false;\n}\n/* eslint-enable max-statements, max-depth, complexity */\n// HELPERS\nfunction comparePropValues(newProp, oldProp, propType) {\n // If prop type has an equal function, invoke it\n let equal = propType && propType.equal;\n if (equal && !equal(newProp, oldProp, propType)) {\n return 'changed deeply';\n }\n if (!equal) {\n // If object has an equals function, invoke it\n equal = newProp && oldProp && newProp.equals;\n if (equal && !equal.call(newProp, oldProp)) {\n return 'changed deeply';\n }\n }\n if (!equal && oldProp !== newProp) {\n return 'changed shallowly';\n }\n return null;\n}\n// The comparison of the data prop requires special handling\n// the dataComparator should be used if supplied\nfunction diffDataProps(props, oldProps) {\n if (oldProps === null) {\n return 'oldProps is null, initial diff';\n }\n let dataChanged = false;\n // Support optional app defined comparison of data\n const { dataComparator, _dataDiff } = props;\n if (dataComparator) {\n if (!dataComparator(props.data, oldProps.data)) {\n dataChanged = 'Data comparator detected a change';\n }\n // Otherwise, do a shallow equal on props\n }\n else if (props.data !== oldProps.data) {\n dataChanged = 'A new data container was supplied';\n }\n if (dataChanged && _dataDiff) {\n dataChanged = _dataDiff(props.data, oldProps.data) || dataChanged;\n }\n return dataChanged;\n}\n// Checks if any update triggers have changed\n// also calls callback to invalidate attributes accordingly.\nfunction diffUpdateTriggers(props, oldProps) {\n if (oldProps === null) {\n return { all: true };\n }\n // If the 'all' updateTrigger fires, ignore testing others\n if ('all' in props.updateTriggers) {\n const diffReason = diffUpdateTrigger(props, oldProps, 'all');\n if (diffReason) {\n return { all: true };\n }\n }\n const reason = {};\n let changed = false;\n // If the 'all' updateTrigger didn't fire, need to check all others\n for (const triggerName in props.updateTriggers) {\n if (triggerName !== 'all') {\n const diffReason = diffUpdateTrigger(props, oldProps, triggerName);\n if (diffReason) {\n reason[triggerName] = true;\n changed = true;\n }\n }\n }\n return changed ? reason : false;\n}\n// Returns true if any extensions have changed\nfunction diffExtensions(props, oldProps) {\n if (oldProps === null) {\n return true;\n }\n const oldExtensions = oldProps.extensions;\n const { extensions } = props;\n if (extensions === oldExtensions) {\n return false;\n }\n if (!oldExtensions || !extensions) {\n return true;\n }\n if (extensions.length !== oldExtensions.length) {\n return true;\n }\n for (let i = 0; i < extensions.length; i++) {\n if (!extensions[i].equals(oldExtensions[i])) {\n return true;\n }\n }\n return false;\n}\nfunction diffUpdateTrigger(props, oldProps, triggerName) {\n let newTriggers = props.updateTriggers[triggerName];\n newTriggers = newTriggers === undefined || newTriggers === null ? {} : newTriggers;\n let oldTriggers = oldProps.updateTriggers[triggerName];\n oldTriggers = oldTriggers === undefined || oldTriggers === null ? {} : oldTriggers;\n const diffReason = compareProps({\n oldProps: oldTriggers,\n newProps: newTriggers,\n triggerName\n });\n return diffReason;\n}\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nconst ERR_NOT_OBJECT = 'count(): argument not an object';\nconst ERR_NOT_CONTAINER = 'count(): argument not a container';\n/**\n * Deduces numer of elements in a JavaScript container.\n * - Auto-deduction for ES6 containers that define a count() method\n * - Auto-deduction for ES6 containers that define a size member\n * - Auto-deduction for Classic Arrays via the built-in length attribute\n * - Also handles objects, although note that this an O(N) operation\n */\nexport function count(container) {\n if (!isObject(container)) {\n throw new Error(ERR_NOT_OBJECT);\n }\n // Check if ES6 collection \"count\" function is available\n if (typeof container.count === 'function') {\n return container.count();\n }\n // Check if ES6 collection \"size\" attribute is set\n if (Number.isFinite(container.size)) {\n return container.size;\n }\n // Check if array length attribute is set\n // Note: checking this last since some ES6 collections (Immutable.js)\n // emit profuse warnings when trying to access `length` attribute\n if (Number.isFinite(container.length)) {\n return container.length;\n }\n // Note that getting the count of an object is O(N)\n if (isPlainObject(container)) {\n return Object.keys(container).length;\n }\n throw new Error(ERR_NOT_CONTAINER);\n}\n/**\n * Checks if argument is a plain object (not a class or array etc)\n * @param {*} value - JavaScript value to be tested\n * @return {Boolean} - true if argument is a plain JavaScript object\n */\nfunction isPlainObject(value) {\n return value !== null && typeof value === 'object' && value.constructor === Object;\n}\n/**\n * Checks if argument is an indexable object (not a primitive value, nor null)\n * @param {*} value - JavaScript value to be tested\n * @return {Boolean} - true if argument is a JavaScript object\n */\nfunction isObject(value) {\n return value !== null && typeof value === 'object';\n}\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n// Merge two luma.gl shader descriptors\nexport function mergeShaders(target, source) {\n if (!source) {\n return target;\n }\n const result = { ...target, ...source };\n if ('defines' in source) {\n result.defines = { ...target.defines, ...source.defines };\n }\n if ('modules' in source) {\n result.modules = (target.modules || []).concat(source.modules);\n // Hack: prject32 and project64 cannot co-exist\n if (source.modules.some(module => module.name === 'project64')) {\n const index = result.modules.findIndex(module => module.name === 'project32');\n if (index >= 0) {\n result.modules.splice(index, 1);\n }\n }\n }\n if ('inject' in source) {\n if (!target.inject) {\n result.inject = source.inject;\n }\n else {\n const mergedInjection = { ...target.inject };\n for (const key in source.inject) {\n mergedInjection[key] = (mergedInjection[key] || '') + source.inject[key];\n }\n result.inject = mergedInjection;\n }\n }\n return result;\n}\n", "import { Texture } from '@luma.gl/core';\nconst DEFAULT_TEXTURE_PARAMETERS = {\n minFilter: 'linear',\n mipmapFilter: 'linear',\n magFilter: 'linear',\n addressModeU: 'clamp-to-edge',\n addressModeV: 'clamp-to-edge'\n};\n// Track the textures that are created by us. They need to be released when they are no longer used.\nconst internalTextures = {};\n/**\n *\n * @param owner\n * @param device\n * @param image could be one of:\n * - Texture\n * - Browser object: Image, ImageData, ImageData, HTMLCanvasElement, HTMLVideoElement, ImageBitmap\n * - Plain object: {width: , height: , data: }\n * @param parameters\n * @returns\n */\nexport function createTexture(owner, device, image, sampler) {\n if (image instanceof Texture) {\n // @ts-expect-error This type error seems like it shouldn't happen...\n return image;\n }\n else if (image.constructor && image.constructor.name !== 'Object') {\n // Browser object\n image = { data: image };\n }\n let samplerParameters = null;\n if (image.compressed) {\n samplerParameters = {\n minFilter: 'linear',\n mipmapFilter: image.data.length > 1 ? 'nearest' : 'linear'\n };\n }\n const texture = device.createTexture({\n ...image,\n sampler: {\n ...DEFAULT_TEXTURE_PARAMETERS,\n ...samplerParameters,\n ...sampler\n }\n });\n // Track this texture\n internalTextures[texture.id] = owner;\n return texture;\n}\nexport function destroyTexture(owner, texture) {\n if (!texture || !(texture instanceof Texture)) {\n return;\n }\n // Only delete the texture if requested by the same layer that created it\n if (internalTextures[texture.id] === owner) {\n texture.delete();\n delete internalTextures[texture.id];\n }\n}\n", "import { createTexture, destroyTexture } from \"../utils/texture.js\";\nimport { deepEqual } from \"../utils/deep-equal.js\";\nconst TYPE_DEFINITIONS = {\n boolean: {\n validate(value, propType) {\n return true;\n },\n equal(value1, value2, propType) {\n return Boolean(value1) === Boolean(value2);\n }\n },\n number: {\n validate(value, propType) {\n return (Number.isFinite(value) &&\n (!('max' in propType) || value <= propType.max) &&\n (!('min' in propType) || value >= propType.min));\n }\n },\n color: {\n validate(value, propType) {\n return ((propType.optional && !value) ||\n (isArray(value) && (value.length === 3 || value.length === 4)));\n },\n equal(value1, value2, propType) {\n return deepEqual(value1, value2, 1);\n }\n },\n accessor: {\n validate(value, propType) {\n const valueType = getTypeOf(value);\n return valueType === 'function' || valueType === getTypeOf(propType.value);\n },\n equal(value1, value2, propType) {\n if (typeof value2 === 'function') {\n return true;\n }\n return deepEqual(value1, value2, 1);\n }\n },\n array: {\n validate(value, propType) {\n return (propType.optional && !value) || isArray(value);\n },\n equal(value1, value2, propType) {\n const { compare } = propType;\n const depth = Number.isInteger(compare) ? compare : compare ? 1 : 0;\n return compare ? deepEqual(value1, value2, depth) : value1 === value2;\n }\n },\n object: {\n equal(value1, value2, propType) {\n if (propType.ignore) {\n return true;\n }\n const { compare } = propType;\n const depth = Number.isInteger(compare) ? compare : compare ? 1 : 0;\n return compare ? deepEqual(value1, value2, depth) : value1 === value2;\n }\n },\n function: {\n validate(value, propType) {\n return (propType.optional && !value) || typeof value === 'function';\n },\n equal(value1, value2, propType) {\n // Backward compatibility - {compare: true} and {ignore: false} are equivalent\n const shouldIgnore = !propType.compare && propType.ignore !== false;\n return shouldIgnore || value1 === value2;\n }\n },\n data: {\n transform: (value, propType, component) => {\n if (!value) {\n return value;\n }\n const { dataTransform } = component.props;\n if (dataTransform) {\n return dataTransform(value);\n }\n // Detect loaders.gl v4 table format\n if (typeof value.shape === 'string' &&\n value.shape.endsWith('-table') &&\n Array.isArray(value.data)) {\n return value.data;\n }\n return value;\n }\n },\n image: {\n transform: (value, propType, component) => {\n const context = component.context;\n if (!context || !context.device) {\n return null;\n }\n return createTexture(component.id, context.device, value, {\n ...propType.parameters,\n ...component.props.textureParameters\n });\n },\n release: (value, propType, component) => {\n destroyTexture(component.id, value);\n }\n }\n};\nexport function parsePropTypes(propDefs) {\n const propTypes = {};\n const defaultProps = {};\n const deprecatedProps = {};\n for (const [propName, propDef] of Object.entries(propDefs)) {\n const deprecated = propDef?.deprecatedFor;\n if (deprecated) {\n deprecatedProps[propName] = Array.isArray(deprecated) ? deprecated : [deprecated];\n }\n else {\n const propType = parsePropType(propName, propDef);\n propTypes[propName] = propType;\n defaultProps[propName] = propType.value;\n }\n }\n return { propTypes, defaultProps, deprecatedProps };\n}\n// Parses one property definition entry. Either contains:\n// * a valid prop type object ({type, ...})\n// * or just a default value, in which case type and name inference is used\nfunction parsePropType(name, propDef) {\n switch (getTypeOf(propDef)) {\n case 'object':\n return normalizePropDefinition(name, propDef);\n case 'array':\n return normalizePropDefinition(name, { type: 'array', value: propDef, compare: false });\n case 'boolean':\n return normalizePropDefinition(name, { type: 'boolean', value: propDef });\n case 'number':\n return normalizePropDefinition(name, { type: 'number', value: propDef });\n case 'function':\n // return guessFunctionType(name, propDef);\n return normalizePropDefinition(name, { type: 'function', value: propDef, compare: true });\n default:\n return { name, type: 'unknown', value: propDef };\n }\n}\nfunction normalizePropDefinition(name, propDef) {\n if (!('type' in propDef)) {\n if (!('value' in propDef)) {\n // If no type and value this object is likely the value\n return { name, type: 'object', value: propDef };\n }\n return { name, type: getTypeOf(propDef.value), ...propDef };\n }\n return { name, ...TYPE_DEFINITIONS[propDef.type], ...propDef };\n}\nfunction isArray(value) {\n return Array.isArray(value) || ArrayBuffer.isView(value);\n}\n// improved version of javascript typeof that can distinguish arrays and null values\nfunction getTypeOf(value) {\n if (isArray(value)) {\n return 'array';\n }\n if (value === null) {\n return 'null';\n }\n return typeof value;\n}\n", "import log from \"../utils/log.js\";\nimport { isAsyncIterable } from \"../utils/iterable-utils.js\";\nimport { parsePropTypes } from \"./prop-types.js\";\nimport { COMPONENT_SYMBOL, PROP_TYPES_SYMBOL, DEPRECATED_PROPS_SYMBOL, ASYNC_ORIGINAL_SYMBOL, ASYNC_RESOLVED_SYMBOL, ASYNC_DEFAULTS_SYMBOL } from \"./constants.js\";\nimport Component from \"./component.js\";\n// Create a property object\nexport function createProps(component, propObjects) {\n // Resolve extension value\n let extensions;\n for (let i = propObjects.length - 1; i >= 0; i--) {\n const props = propObjects[i];\n if ('extensions' in props) {\n // @ts-expect-error TS(2339) extensions not defined\n extensions = props.extensions;\n }\n }\n // Create a new prop object with empty default props object\n const propsPrototype = getPropsPrototype(component.constructor, extensions);\n // The true default props object will be found later\n const propsInstance = Object.create(propsPrototype);\n // Props need a back pointer to the owning component\n propsInstance[COMPONENT_SYMBOL] = component;\n // The supplied (original) values for those async props that are set to url strings or Promises.\n // In this case, the actual (i.e. resolved) values are looked up from component.internalState\n propsInstance[ASYNC_ORIGINAL_SYMBOL] = {};\n // Note: the actual (resolved) values for props that are NOT set to urls or Promises.\n // in this case the values are served directly from this map\n propsInstance[ASYNC_RESOLVED_SYMBOL] = {};\n // \"Copy\" all sync props\n for (let i = 0; i < propObjects.length; ++i) {\n const props = propObjects[i];\n // Do not use Object.assign here to avoid Symbols in props overwriting our private fields\n // This might happen if one of the arguments is another props instance\n for (const key in props) {\n propsInstance[key] = props[key];\n }\n }\n // Props must be immutable\n Object.freeze(propsInstance);\n return propsInstance;\n}\nconst MergedDefaultPropsCacheKey = '_mergedDefaultProps';\n// Return precalculated defaultProps and propType objects if available\n// build them if needed\nfunction getPropsPrototype(componentClass, extensions) {\n // Bail out if we're not looking at a component - for two reasons:\n // 1. There's no reason for an ancestor of component to have props\n // 2. If we don't bail out, we'll follow the prototype chain all the way back to the global\n // function prototype and add _mergedDefaultProps to it, which may break other frameworks\n // (e.g. the react-three-fiber reconciler)\n if (!(componentClass instanceof Component.constructor))\n return {};\n // A string that uniquely identifies the extensions involved\n let cacheKey = MergedDefaultPropsCacheKey;\n if (extensions) {\n for (const extension of extensions) {\n const ExtensionClass = extension.constructor;\n if (ExtensionClass) {\n cacheKey += `:${ExtensionClass.extensionName || ExtensionClass.name}`;\n }\n }\n }\n const defaultProps = getOwnProperty(componentClass, cacheKey);\n if (!defaultProps) {\n return (componentClass[cacheKey] = createPropsPrototypeAndTypes(componentClass, extensions || []));\n }\n return defaultProps;\n}\n// Build defaultProps and propType objects by walking component prototype chain\nfunction createPropsPrototypeAndTypes(componentClass, extensions) {\n const parent = componentClass.prototype;\n if (!parent) {\n return null;\n }\n const parentClass = Object.getPrototypeOf(componentClass);\n const parentDefaultProps = getPropsPrototype(parentClass);\n // Parse propTypes from Component.defaultProps\n const componentDefaultProps = getOwnProperty(componentClass, 'defaultProps') || {};\n const componentPropDefs = parsePropTypes(componentDefaultProps);\n // Merged default props object. Order: parent, self, extensions\n const defaultProps = Object.assign(Object.create(null), parentDefaultProps, componentPropDefs.defaultProps);\n // Merged prop type definitions. Order: parent, self, extensions\n const propTypes = Object.assign(Object.create(null), parentDefaultProps?.[PROP_TYPES_SYMBOL], componentPropDefs.propTypes);\n // Merged deprecation list. Order: parent, self, extensions\n const deprecatedProps = Object.assign(Object.create(null), parentDefaultProps?.[DEPRECATED_PROPS_SYMBOL], componentPropDefs.deprecatedProps);\n for (const extension of extensions) {\n const extensionDefaultProps = getPropsPrototype(extension.constructor);\n if (extensionDefaultProps) {\n Object.assign(defaultProps, extensionDefaultProps);\n Object.assign(propTypes, extensionDefaultProps[PROP_TYPES_SYMBOL]);\n Object.assign(deprecatedProps, extensionDefaultProps[DEPRECATED_PROPS_SYMBOL]);\n }\n }\n // Create any necessary property descriptors and create the default prop object\n // Assign merged default props\n createPropsPrototype(defaultProps, componentClass);\n // Add getters/setters for async props\n addAsyncPropsToPropPrototype(defaultProps, propTypes);\n // Add setters for deprecated props\n addDeprecatedPropsToPropPrototype(defaultProps, deprecatedProps);\n // Store the precalculated props\n defaultProps[PROP_TYPES_SYMBOL] = propTypes;\n defaultProps[DEPRECATED_PROPS_SYMBOL] = deprecatedProps;\n // Backwards compatibility\n // TODO: remove access of hidden property from the rest of the code base\n if (extensions.length === 0 && !hasOwnProperty(componentClass, '_propTypes')) {\n componentClass._propTypes = propTypes;\n }\n return defaultProps;\n}\n// Builds a pre-merged default props object that component props can inherit from\nfunction createPropsPrototype(defaultProps, componentClass) {\n // Avoid freezing `id` prop\n const id = getComponentName(componentClass);\n Object.defineProperties(defaultProps, {\n // `id` is treated specially because layer might need to override it\n id: {\n writable: true,\n value: id\n }\n });\n}\nfunction addDeprecatedPropsToPropPrototype(defaultProps, deprecatedProps) {\n for (const propName in deprecatedProps) {\n /* eslint-disable accessor-pairs */\n Object.defineProperty(defaultProps, propName, {\n enumerable: false,\n set(newValue) {\n const nameStr = `${this.id}: ${propName}`;\n for (const newPropName of deprecatedProps[propName]) {\n if (!hasOwnProperty(this, newPropName)) {\n this[newPropName] = newValue;\n }\n }\n log.deprecated(nameStr, deprecatedProps[propName].join('/'))();\n }\n });\n /* eslint-enable accessor-pairs */\n }\n}\n// Create descriptors for overridable props\nfunction addAsyncPropsToPropPrototype(defaultProps, propTypes) {\n const defaultValues = {};\n const descriptors = {};\n // Move async props into shadow values\n for (const propName in propTypes) {\n const propType = propTypes[propName];\n const { name, value } = propType;\n // Note: async is ES7 keyword, can't destructure\n if (propType.async) {\n defaultValues[name] = value;\n descriptors[name] = getDescriptorForAsyncProp(name);\n }\n }\n // Default \"resolved\" values for async props, returned if value not yet resolved/set.\n defaultProps[ASYNC_DEFAULTS_SYMBOL] = defaultValues;\n // Shadowed object, just to make sure \"early indexing\" into the instance does not fail\n defaultProps[ASYNC_ORIGINAL_SYMBOL] = {};\n Object.defineProperties(defaultProps, descriptors);\n}\n// Helper: Configures getter and setter for one async prop\nfunction getDescriptorForAsyncProp(name) {\n return {\n enumerable: true,\n // Save the provided value for async props in a special map\n set(newValue) {\n if (typeof newValue === 'string' ||\n newValue instanceof Promise ||\n isAsyncIterable(newValue)) {\n this[ASYNC_ORIGINAL_SYMBOL][name] = newValue;\n }\n else {\n this[ASYNC_RESOLVED_SYMBOL][name] = newValue;\n }\n },\n // Only the component's state knows the true value of async prop\n get() {\n if (this[ASYNC_RESOLVED_SYMBOL]) {\n // Prop value isn't async, so just return it\n if (name in this[ASYNC_RESOLVED_SYMBOL]) {\n const value = this[ASYNC_RESOLVED_SYMBOL][name];\n return value || this[ASYNC_DEFAULTS_SYMBOL][name];\n }\n if (name in this[ASYNC_ORIGINAL_SYMBOL]) {\n // It's an async prop value: look into component state\n const state = this[COMPONENT_SYMBOL] && this[COMPONENT_SYMBOL].internalState;\n if (state && state.hasAsyncProp(name)) {\n return state.getAsyncProp(name) || this[ASYNC_DEFAULTS_SYMBOL][name];\n }\n }\n }\n // the prop is not supplied, or\n // component not yet initialized/matched, return the component's default value for the prop\n return this[ASYNC_DEFAULTS_SYMBOL][name];\n }\n };\n}\n// HELPER METHODS\nfunction hasOwnProperty(object, prop) {\n return Object.prototype.hasOwnProperty.call(object, prop);\n}\n// Constructors have their super class constructors as prototypes\nfunction getOwnProperty(object, prop) {\n return hasOwnProperty(object, prop) && object[prop];\n}\nfunction getComponentName(componentClass) {\n const componentName = componentClass.componentName;\n if (!componentName) {\n log.warn(`${componentClass.name}.componentName not specified`)();\n }\n return componentName || componentClass.name;\n}\n", "import { COMPONENT_SYMBOL, PROP_TYPES_SYMBOL, ASYNC_ORIGINAL_SYMBOL, ASYNC_RESOLVED_SYMBOL, ASYNC_DEFAULTS_SYMBOL } from \"./constants.js\";\nimport { createProps } from \"./create-props.js\";\nlet counter = 0;\nclass Component {\n constructor(...propObjects) {\n // Merge supplied props with default props and freeze them.\n /* eslint-disable prefer-spread */\n this.props = createProps(this, propObjects);\n /* eslint-enable prefer-spread */\n this.id = this.props.id; // The layer's id, used for matching with layers from last render cycle\n this.count = counter++; // Keep track of how many layer instances you are generating\n }\n // clone this layer with modified props\n clone(newProps) {\n const { props } = this;\n // Async props cannot be copied with Object.assign, copy them separately\n const asyncProps = {};\n // See async props definition in create-props.js\n for (const key in props[ASYNC_DEFAULTS_SYMBOL]) {\n if (key in props[ASYNC_RESOLVED_SYMBOL]) {\n asyncProps[key] = props[ASYNC_RESOLVED_SYMBOL][key];\n }\n else if (key in props[ASYNC_ORIGINAL_SYMBOL]) {\n asyncProps[key] = props[ASYNC_ORIGINAL_SYMBOL][key];\n }\n }\n // Some custom layer implementation may not support multiple arguments in the constructor\n // @ts-ignore\n return new this.constructor({ ...props, ...asyncProps, ...newProps });\n }\n}\nComponent.componentName = 'Component';\nComponent.defaultProps = {};\nexport default Component;\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport { isAsyncIterable } from \"../utils/iterable-utils.js\";\nimport { COMPONENT_SYMBOL, PROP_TYPES_SYMBOL, ASYNC_ORIGINAL_SYMBOL, ASYNC_RESOLVED_SYMBOL, ASYNC_DEFAULTS_SYMBOL } from \"./constants.js\";\nconst EMPTY_PROPS = Object.freeze({});\nexport default class ComponentState {\n constructor(component) {\n this.component = component;\n this.asyncProps = {}; // Prop values that the layer sees\n this.onAsyncPropUpdated = () => { };\n this.oldProps = null; // Last props before update\n this.oldAsyncProps = null; // Last props before update, with async values copied.\n }\n finalize() {\n for (const propName in this.asyncProps) {\n const asyncProp = this.asyncProps[propName];\n if (asyncProp && asyncProp.type && asyncProp.type.release) {\n // Release any resources created by transforms\n asyncProp.type.release(asyncProp.resolvedValue, asyncProp.type, this.component);\n }\n }\n this.asyncProps = {};\n this.component = null;\n this.resetOldProps();\n }\n /* Layer-facing props API */\n getOldProps() {\n return this.oldAsyncProps || this.oldProps || EMPTY_PROPS;\n }\n resetOldProps() {\n this.oldAsyncProps = null;\n this.oldProps = this.component ? this.component.props : null;\n }\n // Checks if a prop is overridden\n hasAsyncProp(propName) {\n return propName in this.asyncProps;\n }\n // Returns value of an overriden prop\n getAsyncProp(propName) {\n const asyncProp = this.asyncProps[propName];\n return asyncProp && asyncProp.resolvedValue;\n }\n isAsyncPropLoading(propName) {\n if (propName) {\n const asyncProp = this.asyncProps[propName];\n return Boolean(asyncProp &&\n asyncProp.pendingLoadCount > 0 &&\n asyncProp.pendingLoadCount !== asyncProp.resolvedLoadCount);\n }\n for (const key in this.asyncProps) {\n if (this.isAsyncPropLoading(key)) {\n return true;\n }\n }\n return false;\n }\n // Without changing the original prop value, swap out the data resolution under the hood\n reloadAsyncProp(propName, value) {\n this._watchPromise(propName, Promise.resolve(value));\n }\n // Updates all async/overridden props (when new props come in)\n // Checks if urls have changed, starts loading, or removes override\n setAsyncProps(props) {\n this.component = props[COMPONENT_SYMBOL] || this.component;\n // NOTE: prop param and default values are only support for testing\n const resolvedValues = props[ASYNC_RESOLVED_SYMBOL] || {};\n const originalValues = props[ASYNC_ORIGINAL_SYMBOL] || props;\n const defaultValues = props[ASYNC_DEFAULTS_SYMBOL] || {};\n // TODO - use async props from the layer's prop types\n for (const propName in resolvedValues) {\n const value = resolvedValues[propName];\n this._createAsyncPropData(propName, defaultValues[propName]);\n this._updateAsyncProp(propName, value);\n // Use transformed value\n resolvedValues[propName] = this.getAsyncProp(propName);\n }\n for (const propName in originalValues) {\n const value = originalValues[propName];\n // Makes sure a record exists for this prop\n this._createAsyncPropData(propName, defaultValues[propName]);\n this._updateAsyncProp(propName, value);\n }\n }\n /* Placeholder methods for subclassing */\n _fetch(propName, url) {\n return null;\n }\n _onResolve(propName, value) { } // eslint-disable-line @typescript-eslint/no-empty-function\n _onError(propName, error) { } // eslint-disable-line @typescript-eslint/no-empty-function\n // Intercept strings (URLs) and Promises and activates loading and prop rewriting\n _updateAsyncProp(propName, value) {\n if (!this._didAsyncInputValueChange(propName, value)) {\n return;\n }\n // interpret value string as url and start a new load tracked by a promise\n if (typeof value === 'string') {\n value = this._fetch(propName, value);\n }\n // interprets promise and track the \"loading\"\n if (value instanceof Promise) {\n this._watchPromise(propName, value);\n return;\n }\n if (isAsyncIterable(value)) {\n this._resolveAsyncIterable(propName, value); // eslint-disable-line @typescript-eslint/no-floating-promises\n return;\n }\n // else, normal, non-async value. Just store value for now\n this._setPropValue(propName, value);\n }\n // Whenever async props are changing, we need to make a copy of oldProps\n // otherwise the prop rewriting will affect the value both in props and oldProps.\n // While the copy is relatively expensive, this only happens on load completion.\n _freezeAsyncOldProps() {\n if (!this.oldAsyncProps && this.oldProps) {\n // 1. inherit all synchronous props from oldProps\n // 2. reconfigure the async prop descriptors to fixed values\n this.oldAsyncProps = Object.create(this.oldProps);\n for (const propName in this.asyncProps) {\n Object.defineProperty(this.oldAsyncProps, propName, {\n enumerable: true,\n value: this.oldProps[propName]\n });\n }\n }\n }\n // Checks if an input value actually changed (to avoid reloading/rewatching promises/urls)\n _didAsyncInputValueChange(propName, value) {\n // @ts-ignore\n const asyncProp = this.asyncProps[propName];\n if (value === asyncProp.resolvedValue || value === asyncProp.lastValue) {\n return false;\n }\n asyncProp.lastValue = value;\n return true;\n }\n // Set normal, non-async value\n _setPropValue(propName, value) {\n // Save the current value before overwriting so that diffProps can access both\n this._freezeAsyncOldProps();\n const asyncProp = this.asyncProps[propName];\n if (asyncProp) {\n value = this._postProcessValue(asyncProp, value);\n asyncProp.resolvedValue = value;\n asyncProp.pendingLoadCount++;\n asyncProp.resolvedLoadCount = asyncProp.pendingLoadCount;\n }\n }\n // Set a just resolved async value, calling onAsyncPropUpdates if value changes asynchronously\n _setAsyncPropValue(propName, value, loadCount) {\n // Only update if loadCount is larger or equal to resolvedLoadCount\n // otherwise a more recent load has already completed\n const asyncProp = this.asyncProps[propName];\n if (asyncProp && loadCount >= asyncProp.resolvedLoadCount && value !== undefined) {\n // Save the current value before overwriting so that diffProps can access both\n this._freezeAsyncOldProps();\n asyncProp.resolvedValue = value;\n asyncProp.resolvedLoadCount = loadCount;\n // Call callback to inform listener\n this.onAsyncPropUpdated(propName, value);\n }\n }\n // Tracks a promise, sets the prop when loaded, handles load count\n _watchPromise(propName, promise) {\n const asyncProp = this.asyncProps[propName];\n if (asyncProp) {\n asyncProp.pendingLoadCount++;\n const loadCount = asyncProp.pendingLoadCount;\n promise\n .then(data => {\n if (!this.component) {\n // This component state has been finalized\n return;\n }\n data = this._postProcessValue(asyncProp, data);\n this._setAsyncPropValue(propName, data, loadCount);\n this._onResolve(propName, data);\n })\n .catch(error => {\n this._onError(propName, error);\n });\n }\n }\n async _resolveAsyncIterable(propName, iterable) {\n if (propName !== 'data') {\n // we only support data as async iterable\n this._setPropValue(propName, iterable);\n return;\n }\n const asyncProp = this.asyncProps[propName];\n if (!asyncProp) {\n return;\n }\n asyncProp.pendingLoadCount++;\n const loadCount = asyncProp.pendingLoadCount;\n let data = [];\n let count = 0;\n for await (const chunk of iterable) {\n if (!this.component) {\n // This component state has been finalized\n return;\n }\n // @ts-expect-error (2339) dataTransform is not decared in base component props\n const { dataTransform } = this.component.props;\n if (dataTransform) {\n data = dataTransform(chunk, data);\n }\n else {\n data = data.concat(chunk);\n }\n // Used by the default _dataDiff function\n Object.defineProperty(data, '__diff', {\n enumerable: false,\n value: [{ startRow: count, endRow: data.length }]\n });\n count = data.length;\n this._setAsyncPropValue(propName, data, loadCount);\n }\n this._onResolve(propName, data);\n }\n // Give the app a chance to post process the loaded data\n _postProcessValue(asyncProp, value) {\n const propType = asyncProp.type;\n if (propType && this.component) {\n if (propType.release) {\n propType.release(asyncProp.resolvedValue, propType, this.component);\n }\n if (propType.transform) {\n return propType.transform(value, propType, this.component);\n }\n }\n return value;\n }\n // Creating an asyncProp record if needed\n _createAsyncPropData(propName, defaultValue) {\n const asyncProp = this.asyncProps[propName];\n if (!asyncProp) {\n const propTypes = this.component && this.component.props[PROP_TYPES_SYMBOL];\n // assert(defaultValue !== undefined);\n this.asyncProps[propName] = {\n type: propTypes && propTypes[propName],\n lastValue: null,\n resolvedValue: defaultValue,\n pendingLoadCount: 0,\n resolvedLoadCount: 0\n };\n }\n }\n}\n", "// deck.gl, MIT license\nimport ComponentState from \"../lifecycle/component-state.js\";\nexport default class LayerState extends ComponentState {\n constructor({ attributeManager, layer }) {\n super(layer);\n this.attributeManager = attributeManager;\n this.needsRedraw = true;\n this.needsUpdate = true;\n this.subLayers = null;\n this.usesPickingColorCache = false;\n }\n get layer() {\n return this.component;\n }\n /* Override base Component methods with Layer-specific handling */\n _fetch(propName, url) {\n const layer = this.layer;\n const fetch = layer?.props.fetch;\n if (fetch) {\n return fetch(url, { propName, layer });\n }\n return super._fetch(propName, url);\n }\n _onResolve(propName, value) {\n const layer = this.layer;\n if (layer) {\n const onDataLoad = layer.props.onDataLoad;\n if (propName === 'data' && onDataLoad) {\n onDataLoad(value, { propName, layer });\n }\n }\n }\n _onError(propName, error) {\n const layer = this.layer;\n if (layer) {\n layer.raiseError(error, `loading ${propName} of ${this.layer}`);\n }\n }\n}\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport Layer from \"./layer.js\";\nimport debug from \"../debug/index.js\";\nimport { flatten } from \"../utils/flatten.js\";\nimport { PROP_TYPES_SYMBOL } from \"../lifecycle/constants.js\";\nconst TRACE_RENDER_LAYERS = 'compositeLayer.renderLayers';\nclass CompositeLayer extends Layer {\n /** `true` if this layer renders other layers */\n get isComposite() {\n return true;\n }\n /** Returns true if all async resources are loaded */\n get isLoaded() {\n return super.isLoaded && this.getSubLayers().every(layer => layer.isLoaded);\n }\n /** Return last rendered sub layers */\n getSubLayers() {\n return (this.internalState && this.internalState.subLayers) || [];\n }\n // initializeState is usually not needed for composite layers\n // Provide empty definition to disable check for missing definition\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n initializeState(context) { }\n /** Updates selected state members and marks the composite layer to need rerender */\n setState(updateObject) {\n super.setState(updateObject);\n // Trigger a layer update\n // Although conceptually layer.draw and compositeLayer.renderLayers are equivalent,\n // they are executed during different lifecycles.\n // draw can be called without calling updateState (e.g. most viewport changes),\n // while renderLayers can only be called during a recursive layer update.\n this.setNeedsUpdate();\n }\n /** called to augment the info object that is bubbled up from a sublayer\n override Layer.getPickingInfo() because decoding / setting uniform do\n not apply to a composite layer. */\n getPickingInfo({ info }) {\n const { object } = info;\n const isDataWrapped = object && object.__source && object.__source.parent && object.__source.parent.id === this.id;\n if (!isDataWrapped) {\n return info;\n }\n // override object with picked data\n info.object = object.__source.object;\n info.index = object.__source.index;\n return info;\n }\n /**\n * Filters sub layers at draw time. Return true if the sub layer should be drawn.\n */\n filterSubLayer(context) {\n return true;\n }\n /** Returns true if sub layer needs to be rendered */\n shouldRenderSubLayer(subLayerId, data) {\n return data && data.length;\n }\n /** Returns sub layer class for a specific sublayer */\n getSubLayerClass(subLayerId, DefaultLayerClass) {\n const { _subLayerProps: overridingProps } = this.props;\n return ((overridingProps &&\n overridingProps[subLayerId] &&\n overridingProps[subLayerId].type) ||\n DefaultLayerClass);\n }\n /** When casting user data into another format to pass to sublayers,\n add reference to the original object and object index */\n getSubLayerRow(row, sourceObject, sourceObjectIndex) {\n // @ts-ignore (TS2339) adding undefined property\n row.__source = {\n parent: this,\n object: sourceObject,\n index: sourceObjectIndex\n };\n return row;\n }\n /** Some composite layers cast user data into another format before passing to sublayers\n We need to unwrap them before calling the accessor so that they see the original data\n objects */\n getSubLayerAccessor(accessor) {\n if (typeof accessor === 'function') {\n const objectInfo = {\n index: -1,\n // @ts-ignore accessing resolved data\n data: this.props.data,\n target: []\n };\n return (x, i) => {\n if (x && x.__source) {\n objectInfo.index = x.__source.index;\n // @ts-ignore (TS2349) Out is never a function\n return accessor(x.__source.object, objectInfo);\n }\n // @ts-ignore (TS2349) Out is never a function\n return accessor(x, i);\n };\n }\n return accessor;\n }\n /** Returns sub layer props for a specific sublayer */\n // eslint-disable-next-line complexity\n getSubLayerProps(sublayerProps = {}) {\n const { opacity, pickable, visible, parameters, getPolygonOffset, highlightedObjectIndex, autoHighlight, highlightColor, coordinateSystem, coordinateOrigin, wrapLongitude, positionFormat, modelMatrix, extensions, fetch, operation, _subLayerProps: overridingProps } = this.props;\n const newProps = {\n id: '',\n updateTriggers: {},\n opacity,\n pickable,\n visible,\n parameters,\n getPolygonOffset,\n highlightedObjectIndex,\n autoHighlight,\n highlightColor,\n coordinateSystem,\n coordinateOrigin,\n wrapLongitude,\n positionFormat,\n modelMatrix,\n extensions,\n fetch,\n operation\n };\n const overridingSublayerProps = overridingProps && sublayerProps.id && overridingProps[sublayerProps.id];\n const overridingSublayerTriggers = overridingSublayerProps && overridingSublayerProps.updateTriggers;\n const sublayerId = sublayerProps.id || 'sublayer';\n if (overridingSublayerProps) {\n const propTypes = this.props[PROP_TYPES_SYMBOL];\n const subLayerPropTypes = sublayerProps.type ? sublayerProps.type._propTypes : {};\n for (const key in overridingSublayerProps) {\n const propType = subLayerPropTypes[key] || propTypes[key];\n // eslint-disable-next-line\n if (propType && propType.type === 'accessor') {\n overridingSublayerProps[key] = this.getSubLayerAccessor(overridingSublayerProps[key]);\n }\n }\n }\n Object.assign(newProps, sublayerProps, \n // experimental feature that allows users to override sublayer props via parent layer prop\n overridingSublayerProps);\n newProps.id = `${this.props.id}-${sublayerId}`;\n newProps.updateTriggers = {\n all: this.props.updateTriggers?.all,\n ...sublayerProps.updateTriggers,\n ...overridingSublayerTriggers\n };\n // Pass through extension props\n // @ts-ignore (TS2532) extensions is always defined after merging with default props\n for (const extension of extensions) {\n const passThroughProps = extension.getSubLayerProps.call(this, extension);\n if (passThroughProps) {\n Object.assign(newProps, passThroughProps, {\n updateTriggers: Object.assign(newProps.updateTriggers, passThroughProps.updateTriggers)\n });\n }\n }\n return newProps;\n }\n /** Update sub layers to highlight the hovered object */\n _updateAutoHighlight(info) {\n for (const layer of this.getSubLayers()) {\n layer.updateAutoHighlight(info);\n }\n }\n /** Override base Layer method */\n _getAttributeManager() {\n return null;\n }\n /** (Internal) Called after an update to rerender sub layers */\n _postUpdate(updateParams, forceUpdate) {\n // @ts-ignore (TS2531) this method is only called internally when internalState is defined\n let subLayers = this.internalState.subLayers;\n const shouldUpdate = !subLayers || this.needsUpdate();\n if (shouldUpdate) {\n const subLayersList = this.renderLayers();\n // Flatten the returned array, removing any null, undefined or false\n // this allows layers to render sublayers conditionally\n // (see CompositeLayer.renderLayers docs)\n subLayers = flatten(subLayersList, Boolean);\n // @ts-ignore (TS2531) this method is only called internally when internalState is defined\n this.internalState.subLayers = subLayers;\n }\n debug(TRACE_RENDER_LAYERS, this, shouldUpdate, subLayers);\n // populate reference to parent layer (this layer)\n // NOTE: needs to be done even when reusing layers as the parent may have changed\n for (const layer of subLayers) {\n layer.parent = this;\n }\n }\n}\nCompositeLayer.layerName = 'CompositeLayer';\nexport default CompositeLayer;\n", "import { Matrix4 } from '@math.gl/core';\nimport Viewport from \"./viewport.js\";\nimport { PROJECTION_MODE } from \"../lib/constants.js\";\nimport { vec3, vec4 } from '@math.gl/core';\nconst DEGREES_TO_RADIANS = Math.PI / 180;\nconst RADIANS_TO_DEGREES = 180 / Math.PI;\nconst EARTH_RADIUS = 6370972;\nconst GLOBE_RADIUS = 256;\nfunction getDistanceScales() {\n const unitsPerMeter = GLOBE_RADIUS / EARTH_RADIUS;\n const unitsPerDegree = (Math.PI / 180) * GLOBE_RADIUS;\n return {\n unitsPerMeter: [unitsPerMeter, unitsPerMeter, unitsPerMeter],\n unitsPerMeter2: [0, 0, 0],\n metersPerUnit: [1 / unitsPerMeter, 1 / unitsPerMeter, 1 / unitsPerMeter],\n unitsPerDegree: [unitsPerDegree, unitsPerDegree, unitsPerMeter],\n unitsPerDegree2: [0, 0, 0],\n degreesPerUnit: [1 / unitsPerDegree, 1 / unitsPerDegree, 1 / unitsPerMeter]\n };\n}\nexport default class GlobeViewport extends Viewport {\n constructor(opts = {}) {\n const { latitude = 0, longitude = 0, zoom = 0, nearZMultiplier = 0.1, farZMultiplier = 2, resolution = 10 } = opts;\n let { height, altitude = 1.5 } = opts;\n height = height || 1;\n altitude = Math.max(0.75, altitude);\n // Calculate view matrix\n const viewMatrix = new Matrix4().lookAt({ eye: [0, -altitude, 0], up: [0, 0, 1] });\n const scale = Math.pow(2, zoom);\n viewMatrix.rotateX(latitude * DEGREES_TO_RADIANS);\n viewMatrix.rotateZ(-longitude * DEGREES_TO_RADIANS);\n viewMatrix.scale(scale / height);\n const halfFov = Math.atan(0.5 / altitude);\n const relativeScale = (GLOBE_RADIUS * 2 * scale) / height;\n super({\n ...opts,\n // x, y, width,\n height,\n // view matrix\n viewMatrix,\n longitude,\n latitude,\n zoom,\n // projection matrix parameters\n distanceScales: getDistanceScales(),\n fovyRadians: halfFov * 2,\n focalDistance: altitude,\n near: nearZMultiplier,\n far: Math.min(2, 1 / relativeScale + 1) * altitude * farZMultiplier\n });\n this.latitude = latitude;\n this.longitude = longitude;\n this.resolution = resolution;\n }\n get projectionMode() {\n return PROJECTION_MODE.GLOBE;\n }\n getDistanceScales() {\n return this.distanceScales;\n }\n getBounds(options = {}) {\n const unprojectOption = { targetZ: options.z || 0 };\n const left = this.unproject([0, this.height / 2], unprojectOption);\n const top = this.unproject([this.width / 2, 0], unprojectOption);\n const right = this.unproject([this.width, this.height / 2], unprojectOption);\n const bottom = this.unproject([this.width / 2, this.height], unprojectOption);\n if (right[0] < this.longitude)\n right[0] += 360;\n if (left[0] > this.longitude)\n left[0] -= 360;\n return [\n Math.min(left[0], right[0], top[0], bottom[0]),\n Math.min(left[1], right[1], top[1], bottom[1]),\n Math.max(left[0], right[0], top[0], bottom[0]),\n Math.max(left[1], right[1], top[1], bottom[1])\n ];\n }\n unproject(xyz, { topLeft = true, targetZ } = {}) {\n const [x, y, z] = xyz;\n const y2 = topLeft ? y : this.height - y;\n const { pixelUnprojectionMatrix } = this;\n let coord;\n if (Number.isFinite(z)) {\n // Has depth component\n coord = transformVector(pixelUnprojectionMatrix, [x, y2, z, 1]);\n }\n else {\n // since we don't know the correct projected z value for the point,\n // unproject two points to get a line and then find the point on that line that intersects with the sphere\n const coord0 = transformVector(pixelUnprojectionMatrix, [x, y2, -1, 1]);\n const coord1 = transformVector(pixelUnprojectionMatrix, [x, y2, 1, 1]);\n const lt = ((targetZ || 0) / EARTH_RADIUS + 1) * GLOBE_RADIUS;\n const lSqr = vec3.sqrLen(vec3.sub([], coord0, coord1));\n const l0Sqr = vec3.sqrLen(coord0);\n const l1Sqr = vec3.sqrLen(coord1);\n const sSqr = (4 * l0Sqr * l1Sqr - (lSqr - l0Sqr - l1Sqr) ** 2) / 16;\n const dSqr = (4 * sSqr) / lSqr;\n const r0 = Math.sqrt(l0Sqr - dSqr);\n const dr = Math.sqrt(Math.max(0, lt * lt - dSqr));\n const t = (r0 - dr) / Math.sqrt(lSqr);\n coord = vec3.lerp([], coord0, coord1, t);\n }\n const [X, Y, Z] = this.unprojectPosition(coord);\n if (Number.isFinite(z)) {\n return [X, Y, Z];\n }\n return Number.isFinite(targetZ) ? [X, Y, targetZ] : [X, Y];\n }\n projectPosition(xyz) {\n const [lng, lat, Z = 0] = xyz;\n const lambda = lng * DEGREES_TO_RADIANS;\n const phi = lat * DEGREES_TO_RADIANS;\n const cosPhi = Math.cos(phi);\n const D = (Z / EARTH_RADIUS + 1) * GLOBE_RADIUS;\n return [Math.sin(lambda) * cosPhi * D, -Math.cos(lambda) * cosPhi * D, Math.sin(phi) * D];\n }\n unprojectPosition(xyz) {\n const [x, y, z] = xyz;\n const D = vec3.len(xyz);\n const phi = Math.asin(z / D);\n const lambda = Math.atan2(x, -y);\n const lng = lambda * RADIANS_TO_DEGREES;\n const lat = phi * RADIANS_TO_DEGREES;\n const Z = (D / GLOBE_RADIUS - 1) * EARTH_RADIUS;\n return [lng, lat, Z];\n }\n projectFlat(xyz) {\n return xyz;\n }\n unprojectFlat(xyz) {\n return xyz;\n }\n panByPosition(coords, pixel) {\n const fromPosition = this.unproject(pixel);\n return {\n longitude: coords[0] - fromPosition[0] + this.longitude,\n latitude: coords[1] - fromPosition[1] + this.latitude\n };\n }\n}\nfunction transformVector(matrix, vector) {\n const result = vec4.transformMat4([], vector, matrix);\n vec4.scale(result, result, 1 / result[3]);\n return result;\n}\n", "import Viewport from \"../viewports/viewport.js\";\nimport { Matrix4 } from '@math.gl/core';\nimport { pixelsToWorld, fovyToAltitude } from '@math.gl/web-mercator';\nconst DEGREES_TO_RADIANS = Math.PI / 180;\nfunction getViewMatrix({ height, focalDistance, orbitAxis, rotationX, rotationOrbit, zoom }) {\n // We position the camera so that one common space unit (world space unit scaled by zoom)\n // at the target maps to one screen pixel.\n // This is a similar technique to that used in web mercator projection\n // By doing so we are able to convert between common space and screen space sizes efficiently\n // in the vertex shader.\n const up = orbitAxis === 'Z' ? [0, 0, 1] : [0, 1, 0];\n const eye = orbitAxis === 'Z' ? [0, -focalDistance, 0] : [0, 0, focalDistance];\n const viewMatrix = new Matrix4().lookAt({ eye, up });\n viewMatrix.rotateX(rotationX * DEGREES_TO_RADIANS);\n if (orbitAxis === 'Z') {\n viewMatrix.rotateZ(rotationOrbit * DEGREES_TO_RADIANS);\n }\n else {\n viewMatrix.rotateY(rotationOrbit * DEGREES_TO_RADIANS);\n }\n // When height increases, we need to increase the distance from the camera to the target to\n // keep the 1:1 mapping. However, this also changes the projected depth of each position by\n // moving them further away between the near/far plane.\n // Without modifying the default near/far planes, we instead scale down the common space to\n // remove the distortion to the depth field.\n const projectionScale = Math.pow(2, zoom) / height;\n viewMatrix.scale(projectionScale);\n return viewMatrix;\n}\nexport default class OrbitViewport extends Viewport {\n constructor(props) {\n const { height, projectionMatrix, fovy = 50, // For setting camera position\n orbitAxis = 'Z', // Orbit axis with 360 degrees rotating freedom, can only be 'Y' or 'Z'\n target = [0, 0, 0], // Which point is camera looking at, default origin\n rotationX = 0, // Rotating angle around X axis\n rotationOrbit = 0, // Rotating angle around orbit axis\n zoom = 0 } = props;\n const focalDistance = projectionMatrix ? projectionMatrix[5] / 2 : fovyToAltitude(fovy);\n super({\n ...props,\n // in case viewState contains longitude/latitude values,\n // make sure that the base Viewport class does not treat this as a geospatial viewport\n longitude: undefined,\n viewMatrix: getViewMatrix({\n height: height || 1,\n focalDistance,\n orbitAxis,\n rotationX,\n rotationOrbit,\n zoom\n }),\n fovy,\n focalDistance,\n position: target,\n zoom\n });\n this.projectedCenter = this.project(this.center);\n }\n unproject(xyz, { topLeft = true } = {}) {\n const [x, y, z = this.projectedCenter[2]] = xyz;\n const y2 = topLeft ? y : this.height - y;\n const [X, Y, Z] = pixelsToWorld([x, y2, z], this.pixelUnprojectionMatrix);\n return [X, Y, Z];\n }\n panByPosition(coords, pixel) {\n const p0 = this.project(coords);\n const nextCenter = [\n this.width / 2 + p0[0] - pixel[0],\n this.height / 2 + p0[1] - pixel[1],\n this.projectedCenter[2]\n ];\n return {\n target: this.unproject(nextCenter)\n };\n }\n}\n", "import Viewport from \"../viewports/viewport.js\";\nimport { Matrix4, clamp, vec2 } from '@math.gl/core';\nimport { pixelsToWorld } from '@math.gl/web-mercator';\nconst viewMatrix = new Matrix4().lookAt({ eye: [0, 0, 1] });\nfunction getProjectionMatrix({ width, height, near, far, padding }) {\n let left = -width / 2;\n let right = width / 2;\n let bottom = -height / 2;\n let top = height / 2;\n if (padding) {\n const { left: l = 0, right: r = 0, top: t = 0, bottom: b = 0 } = padding;\n const offsetX = clamp((l + width - r) / 2, 0, width) - width / 2;\n const offsetY = clamp((t + height - b) / 2, 0, height) - height / 2;\n left -= offsetX;\n right -= offsetX;\n bottom += offsetY;\n top += offsetY;\n }\n return new Matrix4().ortho({\n left,\n right,\n bottom,\n top,\n near,\n far\n });\n}\nexport default class OrthographicViewport extends Viewport {\n constructor(props) {\n const { width, height, near = 0.1, far = 1000, zoom = 0, target = [0, 0, 0], padding = null, flipY = true } = props;\n const zoomX = Array.isArray(zoom) ? zoom[0] : zoom;\n const zoomY = Array.isArray(zoom) ? zoom[1] : zoom;\n const zoom_ = Math.min(zoomX, zoomY);\n const scale = Math.pow(2, zoom_);\n let distanceScales;\n if (zoomX !== zoomY) {\n const scaleX = Math.pow(2, zoomX);\n const scaleY = Math.pow(2, zoomY);\n distanceScales = {\n unitsPerMeter: [scaleX / scale, scaleY / scale, 1],\n metersPerUnit: [scale / scaleX, scale / scaleY, 1]\n };\n }\n super({\n ...props,\n // in case viewState contains longitude/latitude values,\n // make sure that the base Viewport class does not treat this as a geospatial viewport\n longitude: undefined,\n position: target,\n viewMatrix: viewMatrix.clone().scale([scale, scale * (flipY ? -1 : 1), scale]),\n projectionMatrix: getProjectionMatrix({\n width: width || 1,\n height: height || 1,\n padding,\n near,\n far\n }),\n zoom: zoom_,\n distanceScales\n });\n }\n projectFlat([X, Y]) {\n const { unitsPerMeter } = this.distanceScales;\n return [X * unitsPerMeter[0], Y * unitsPerMeter[1]];\n }\n unprojectFlat([x, y]) {\n const { metersPerUnit } = this.distanceScales;\n return [x * metersPerUnit[0], y * metersPerUnit[1]];\n }\n /* Needed by LinearInterpolator */\n panByPosition(coords, pixel) {\n const fromLocation = pixelsToWorld(pixel, this.pixelUnprojectionMatrix);\n const toLocation = this.projectFlat(coords);\n const translate = vec2.add([], toLocation, vec2.negate([], fromLocation));\n const newCenter = vec2.add([], this.center, translate);\n return { target: this.unprojectFlat(newCenter) };\n }\n}\n", "import Viewport from \"../viewports/viewport.js\";\nimport { getMeterZoom } from '@math.gl/web-mercator';\nimport { Matrix4, _SphericalCoordinates as SphericalCoordinates } from '@math.gl/core';\nexport default class FirstPersonViewport extends Viewport {\n constructor(props) {\n // TODO - push direction handling into Matrix4.lookAt\n const { longitude, latitude, modelMatrix, bearing = 0, pitch = 0, up = [0, 0, 1] } = props;\n // Always calculate direction from bearing and pitch\n const spherical = new SphericalCoordinates({\n bearing,\n // Avoid \"pixel project matrix not invertible\" error\n pitch: pitch === -90 ? 0.0001 : 90 + pitch\n });\n const dir = spherical.toVector3().normalize();\n // Direction is relative to model coordinates, of course\n const center = modelMatrix ? new Matrix4(modelMatrix).transformAsVector(dir) : dir;\n // Just the direction. All the positioning is done in viewport.js\n const zoom = Number.isFinite(latitude) ? getMeterZoom({ latitude: latitude }) : 0;\n const scale = Math.pow(2, zoom);\n const viewMatrix = new Matrix4().lookAt({ eye: [0, 0, 0], center, up }).scale(scale);\n super({\n ...props,\n zoom,\n viewMatrix\n });\n this.latitude = latitude;\n this.longitude = longitude;\n }\n}\n", "import Controller from \"./controller.js\";\nimport ViewState from \"./view-state.js\";\nimport { mod } from \"../utils/math-utils.js\";\nimport LinearInterpolator from \"../transitions/linear-interpolator.js\";\nimport { Vector3, _SphericalCoordinates as SphericalCoordinates, clamp } from '@math.gl/core';\nconst MOVEMENT_SPEED = 20;\nconst PAN_SPEED = 500;\nclass FirstPersonState extends ViewState {\n constructor(options) {\n const { \n /* Viewport arguments */\n width, // Width of viewport\n height, // Height of viewport\n // Position and orientation\n position = [0, 0, 0], // typically in meters from anchor point\n bearing = 0, // Rotation around y axis\n pitch = 0, // Rotation around x axis\n // Geospatial anchor\n longitude = null, latitude = null, maxPitch = 90, minPitch = -90, \n // Model state when the rotate operation first started\n startRotatePos, startBearing, startPitch, startZoomPosition, startPanPos, startPanPosition } = options;\n super({\n width,\n height,\n position,\n bearing,\n pitch,\n longitude,\n latitude,\n maxPitch,\n minPitch\n }, {\n startRotatePos,\n startBearing,\n startPitch,\n startZoomPosition,\n startPanPos,\n startPanPosition\n });\n this.makeViewport = options.makeViewport;\n }\n /* Public API */\n /**\n * Start panning\n * @param {[Number, Number]} pos - position on screen where the pointer grabs\n */\n panStart({ pos }) {\n const { position } = this.getViewportProps();\n return this._getUpdatedState({\n startPanPos: pos,\n startPanPosition: position\n });\n }\n /**\n * Pan\n * @param {[Number, Number]} pos - position on screen where the pointer is\n */\n pan({ pos }) {\n if (!pos) {\n return this;\n }\n const { startPanPos = [0, 0], startPanPosition = [0, 0] } = this.getState();\n const { width, height, bearing, pitch } = this.getViewportProps();\n const deltaScaleX = (PAN_SPEED * (pos[0] - startPanPos[0])) / width;\n const deltaScaleY = (PAN_SPEED * (pos[1] - startPanPos[1])) / height;\n const up = new SphericalCoordinates({ bearing, pitch });\n const forward = new SphericalCoordinates({ bearing, pitch: -90 });\n const yDirection = up.toVector3().normalize();\n const xDirection = forward.toVector3().cross(yDirection).normalize();\n return this._getUpdatedState({\n position: new Vector3(startPanPosition)\n .add(xDirection.scale(deltaScaleX))\n .add(yDirection.scale(deltaScaleY))\n });\n }\n /**\n * End panning\n * Must call if `panStart()` was called\n */\n panEnd() {\n return this._getUpdatedState({\n startPanPos: null,\n startPanPosition: null\n });\n }\n /**\n * Start rotating\n * @param {[Number, Number]} pos - position on screen where the pointer grabs\n */\n rotateStart({ pos }) {\n return this._getUpdatedState({\n startRotatePos: pos,\n startBearing: this.getViewportProps().bearing,\n startPitch: this.getViewportProps().pitch\n });\n }\n /**\n * Rotate\n * @param {[Number, Number]} pos - position on screen where the pointer is\n */\n rotate({ pos, deltaAngleX = 0, deltaAngleY = 0 }) {\n const { startRotatePos, startBearing, startPitch } = this.getState();\n const { width, height } = this.getViewportProps();\n if (!startRotatePos || startBearing === undefined || startPitch === undefined) {\n return this;\n }\n let newRotation;\n if (pos) {\n const deltaScaleX = (pos[0] - startRotatePos[0]) / width;\n const deltaScaleY = (pos[1] - startRotatePos[1]) / height;\n newRotation = {\n bearing: startBearing - deltaScaleX * 180,\n pitch: startPitch - deltaScaleY * 90\n };\n }\n else {\n newRotation = {\n bearing: startBearing - deltaAngleX,\n pitch: startPitch - deltaAngleY\n };\n }\n return this._getUpdatedState(newRotation);\n }\n /**\n * End rotating\n * Must call if `rotateStart()` was called\n */\n rotateEnd() {\n return this._getUpdatedState({\n startRotatePos: null,\n startBearing: null,\n startPitch: null\n });\n }\n /**\n * Start zooming\n * @param {[Number, Number]} pos - position on screen where the pointer grabs\n */\n zoomStart() {\n return this._getUpdatedState({\n startZoomPosition: this.getViewportProps().position\n });\n }\n /**\n * Zoom\n * @param {[Number, Number]} pos - position on screen where the current center is\n * @param {[Number, Number]} startPos - the center position at\n * the start of the operation. Must be supplied of `zoomStart()` was not called\n * @param {Number} scale - a number between [0, 1] specifying the accumulated\n * relative scale.\n */\n zoom({ pos, scale }) {\n const viewportProps = this.getViewportProps();\n const startZoomPosition = this.getState().startZoomPosition || viewportProps.position;\n const viewport = this.makeViewport(viewportProps);\n const { projectionMatrix, width } = viewport;\n const fovxRadians = 2.0 * Math.atan(1.0 / projectionMatrix[0]);\n const angle = fovxRadians * (pos[0] / width - 0.5);\n const direction = this.getDirection(true);\n return this._move(direction.rotateZ({ radians: -angle }), Math.log2(scale) * MOVEMENT_SPEED, startZoomPosition);\n }\n /**\n * End zooming\n * Must call if `zoomStart()` was called\n */\n zoomEnd() {\n return this._getUpdatedState({\n startZoomPosition: null\n });\n }\n moveLeft(speed = MOVEMENT_SPEED) {\n const direction = this.getDirection(true);\n return this._move(direction.rotateZ({ radians: Math.PI / 2 }), speed);\n }\n moveRight(speed = MOVEMENT_SPEED) {\n const direction = this.getDirection(true);\n return this._move(direction.rotateZ({ radians: -Math.PI / 2 }), speed);\n }\n // forward\n moveUp(speed = MOVEMENT_SPEED) {\n const direction = this.getDirection(true);\n return this._move(direction, speed);\n }\n // backward\n moveDown(speed = MOVEMENT_SPEED) {\n const direction = this.getDirection(true);\n return this._move(direction.negate(), speed);\n }\n rotateLeft(speed = 15) {\n return this._getUpdatedState({\n bearing: this.getViewportProps().bearing - speed\n });\n }\n rotateRight(speed = 15) {\n return this._getUpdatedState({\n bearing: this.getViewportProps().bearing + speed\n });\n }\n rotateUp(speed = 10) {\n return this._getUpdatedState({\n pitch: this.getViewportProps().pitch + speed\n });\n }\n rotateDown(speed = 10) {\n return this._getUpdatedState({\n pitch: this.getViewportProps().pitch - speed\n });\n }\n zoomIn(speed = MOVEMENT_SPEED) {\n return this._move(new Vector3(0, 0, 1), speed);\n }\n zoomOut(speed = MOVEMENT_SPEED) {\n return this._move(new Vector3(0, 0, -1), speed);\n }\n // shortest path between two view states\n shortestPathFrom(viewState) {\n const fromProps = viewState.getViewportProps();\n const props = { ...this.getViewportProps() };\n const { bearing, longitude } = props;\n if (Math.abs(bearing - fromProps.bearing) > 180) {\n props.bearing = bearing < 0 ? bearing + 360 : bearing - 360;\n }\n if (longitude !== null &&\n fromProps.longitude !== null &&\n Math.abs(longitude - fromProps.longitude) > 180) {\n props.longitude = longitude < 0 ? longitude + 360 : longitude - 360;\n }\n return props;\n }\n /* Private methods */\n _move(direction, speed, fromPosition = this.getViewportProps().position) {\n const delta = direction.scale(speed);\n return this._getUpdatedState({\n position: new Vector3(fromPosition).add(delta)\n });\n }\n getDirection(use2D = false) {\n const spherical = new SphericalCoordinates({\n bearing: this.getViewportProps().bearing,\n pitch: use2D ? 90 : 90 + this.getViewportProps().pitch\n });\n const direction = spherical.toVector3().normalize();\n return direction;\n }\n _getUpdatedState(newProps) {\n // Update _viewportProps\n return new FirstPersonState({\n makeViewport: this.makeViewport,\n ...this.getViewportProps(),\n ...this.getState(),\n ...newProps\n });\n }\n // Apply any constraints (mathematical or defined by _viewportProps) to map state\n applyConstraints(props) {\n // Ensure pitch and zoom are within specified range\n const { pitch, maxPitch, minPitch, longitude, bearing } = props;\n props.pitch = clamp(pitch, minPitch, maxPitch);\n // Normalize degrees\n if (longitude !== null && (longitude < -180 || longitude > 180)) {\n props.longitude = mod(longitude + 180, 360) - 180;\n }\n if (bearing < -180 || bearing > 180) {\n props.bearing = mod(bearing + 180, 360) - 180;\n }\n return props;\n }\n}\nexport default class FirstPersonController extends Controller {\n constructor() {\n super(...arguments);\n this.ControllerState = FirstPersonState;\n this.transition = {\n transitionDuration: 300,\n transitionInterpolator: new LinearInterpolator(['position', 'pitch', 'bearing'])\n };\n }\n}\n", "import View from \"./view.js\";\nimport FirstPersonViewport from \"../viewports/first-person-viewport.js\";\nimport FirstPersonController from \"../controllers/first-person-controller.js\";\nclass FirstPersonView extends View {\n constructor(props = {}) {\n super(props);\n }\n get ViewportType() {\n return FirstPersonViewport;\n }\n get ControllerType() {\n return FirstPersonController;\n }\n}\nFirstPersonView.displayName = 'FirstPersonView';\nexport default FirstPersonView;\n", "import { clamp } from '@math.gl/core';\nimport Controller from \"./controller.js\";\nimport ViewState from \"./view-state.js\";\nimport { mod } from \"../utils/math-utils.js\";\nimport LinearInterpolator from \"../transitions/linear-interpolator.js\";\nexport class OrbitState extends ViewState {\n constructor(options) {\n const { \n /* Viewport arguments */\n width, // Width of viewport\n height, // Height of viewport\n rotationX = 0, // Rotation around x axis\n rotationOrbit = 0, // Rotation around orbit axis\n target = [0, 0, 0], zoom = 0, \n /* Viewport constraints */\n minRotationX = -90, maxRotationX = 90, minZoom = -Infinity, maxZoom = Infinity, \n /** Interaction states, required to calculate change during transform */\n // Model state when the pan operation first started\n startPanPosition, \n // Model state when the rotate operation first started\n startRotatePos, startRotationX, startRotationOrbit, \n // Model state when the zoom operation first started\n startZoomPosition, startZoom } = options;\n super({\n width,\n height,\n rotationX,\n rotationOrbit,\n target,\n zoom,\n minRotationX,\n maxRotationX,\n minZoom,\n maxZoom\n }, {\n startPanPosition,\n startRotatePos,\n startRotationX,\n startRotationOrbit,\n startZoomPosition,\n startZoom\n });\n this.makeViewport = options.makeViewport;\n }\n /**\n * Start panning\n * @param {[Number, Number]} pos - position on screen where the pointer grabs\n */\n panStart({ pos }) {\n return this._getUpdatedState({\n startPanPosition: this._unproject(pos)\n });\n }\n /**\n * Pan\n * @param {[Number, Number]} pos - position on screen where the pointer is\n */\n pan({ pos, startPosition }) {\n const startPanPosition = this.getState().startPanPosition || startPosition;\n if (!startPanPosition) {\n return this;\n }\n const viewport = this.makeViewport(this.getViewportProps());\n const newProps = viewport.panByPosition(startPanPosition, pos);\n return this._getUpdatedState(newProps);\n }\n /**\n * End panning\n * Must call if `panStart()` was called\n */\n panEnd() {\n return this._getUpdatedState({\n startPanPosition: null\n });\n }\n /**\n * Start rotating\n * @param {[Number, Number]} pos - position on screen where the pointer grabs\n */\n rotateStart({ pos }) {\n return this._getUpdatedState({\n startRotatePos: pos,\n startRotationX: this.getViewportProps().rotationX,\n startRotationOrbit: this.getViewportProps().rotationOrbit\n });\n }\n /**\n * Rotate\n * @param {[Number, Number]} pos - position on screen where the pointer is\n */\n rotate({ pos, deltaAngleX = 0, deltaAngleY = 0 }) {\n const { startRotatePos, startRotationX, startRotationOrbit } = this.getState();\n const { width, height } = this.getViewportProps();\n if (!startRotatePos || startRotationX === undefined || startRotationOrbit === undefined) {\n return this;\n }\n let newRotation;\n if (pos) {\n let deltaScaleX = (pos[0] - startRotatePos[0]) / width;\n const deltaScaleY = (pos[1] - startRotatePos[1]) / height;\n if (startRotationX < -90 || startRotationX > 90) {\n // When looking at the \"back\" side of the scene, invert horizontal drag\n // so that the camera movement follows user input\n deltaScaleX *= -1;\n }\n newRotation = {\n rotationX: startRotationX + deltaScaleY * 180,\n rotationOrbit: startRotationOrbit + deltaScaleX * 180\n };\n }\n else {\n newRotation = {\n rotationX: startRotationX + deltaAngleY,\n rotationOrbit: startRotationOrbit + deltaAngleX\n };\n }\n return this._getUpdatedState(newRotation);\n }\n /**\n * End rotating\n * Must call if `rotateStart()` was called\n */\n rotateEnd() {\n return this._getUpdatedState({\n startRotationX: null,\n startRotationOrbit: null\n });\n }\n // shortest path between two view states\n shortestPathFrom(viewState) {\n const fromProps = viewState.getViewportProps();\n const props = { ...this.getViewportProps() };\n const { rotationOrbit } = props;\n if (Math.abs(rotationOrbit - fromProps.rotationOrbit) > 180) {\n props.rotationOrbit = rotationOrbit < 0 ? rotationOrbit + 360 : rotationOrbit - 360;\n }\n return props;\n }\n /**\n * Start zooming\n * @param {[Number, Number]} pos - position on screen where the pointer grabs\n */\n zoomStart({ pos }) {\n return this._getUpdatedState({\n startZoomPosition: this._unproject(pos),\n startZoom: this.getViewportProps().zoom\n });\n }\n /**\n * Zoom\n * @param {[Number, Number]} pos - position on screen where the current target is\n * @param {[Number, Number]} startPos - the target position at\n * the start of the operation. Must be supplied of `zoomStart()` was not called\n * @param {Number} scale - a number between [0, 1] specifying the accumulated\n * relative scale.\n */\n zoom({ pos, startPos, scale }) {\n let { startZoom, startZoomPosition } = this.getState();\n if (!startZoomPosition) {\n // We have two modes of zoom:\n // scroll zoom that are discrete events (transform from the current zoom level),\n // and pinch zoom that are continuous events (transform from the zoom level when\n // pinch started).\n // If startZoom state is defined, then use the startZoom state;\n // otherwise assume discrete zooming\n startZoom = this.getViewportProps().zoom;\n startZoomPosition = this._unproject(startPos) || this._unproject(pos);\n }\n if (!startZoomPosition) {\n return this;\n }\n const newZoom = this._calculateNewZoom({ scale, startZoom });\n const zoomedViewport = this.makeViewport({ ...this.getViewportProps(), zoom: newZoom });\n return this._getUpdatedState({\n zoom: newZoom,\n ...zoomedViewport.panByPosition(startZoomPosition, pos)\n });\n }\n /**\n * End zooming\n * Must call if `zoomStart()` was called\n */\n zoomEnd() {\n return this._getUpdatedState({\n startZoomPosition: null,\n startZoom: null\n });\n }\n zoomIn(speed = 2) {\n return this._getUpdatedState({\n zoom: this._calculateNewZoom({ scale: speed })\n });\n }\n zoomOut(speed = 2) {\n return this._getUpdatedState({\n zoom: this._calculateNewZoom({ scale: 1 / speed })\n });\n }\n moveLeft(speed = 50) {\n return this._panFromCenter([-speed, 0]);\n }\n moveRight(speed = 50) {\n return this._panFromCenter([speed, 0]);\n }\n moveUp(speed = 50) {\n return this._panFromCenter([0, -speed]);\n }\n moveDown(speed = 50) {\n return this._panFromCenter([0, speed]);\n }\n rotateLeft(speed = 15) {\n return this._getUpdatedState({\n rotationOrbit: this.getViewportProps().rotationOrbit - speed\n });\n }\n rotateRight(speed = 15) {\n return this._getUpdatedState({\n rotationOrbit: this.getViewportProps().rotationOrbit + speed\n });\n }\n rotateUp(speed = 10) {\n return this._getUpdatedState({\n rotationX: this.getViewportProps().rotationX - speed\n });\n }\n rotateDown(speed = 10) {\n return this._getUpdatedState({\n rotationX: this.getViewportProps().rotationX + speed\n });\n }\n /* Private methods */\n _unproject(pos) {\n const viewport = this.makeViewport(this.getViewportProps());\n // @ts-ignore\n return pos && viewport.unproject(pos);\n }\n // Calculates new zoom\n _calculateNewZoom({ scale, startZoom }) {\n const { maxZoom, minZoom } = this.getViewportProps();\n if (startZoom === undefined) {\n startZoom = this.getViewportProps().zoom;\n }\n const zoom = startZoom + Math.log2(scale);\n return clamp(zoom, minZoom, maxZoom);\n }\n _panFromCenter(offset) {\n const { width, height, target } = this.getViewportProps();\n return this.pan({\n startPosition: target,\n pos: [width / 2 + offset[0], height / 2 + offset[1]]\n });\n }\n _getUpdatedState(newProps) {\n // @ts-ignore\n return new this.constructor({\n makeViewport: this.makeViewport,\n ...this.getViewportProps(),\n ...this.getState(),\n ...newProps\n });\n }\n // Apply any constraints (mathematical or defined by _viewportProps) to map state\n applyConstraints(props) {\n // Ensure zoom is within specified range\n const { maxZoom, minZoom, zoom, maxRotationX, minRotationX, rotationOrbit } = props;\n props.zoom = Array.isArray(zoom)\n ? [clamp(zoom[0], minZoom, maxZoom), clamp(zoom[1], minZoom, maxZoom)]\n : clamp(zoom, minZoom, maxZoom);\n props.rotationX = clamp(props.rotationX, minRotationX, maxRotationX);\n if (rotationOrbit < -180 || rotationOrbit > 180) {\n props.rotationOrbit = mod(rotationOrbit + 180, 360) - 180;\n }\n return props;\n }\n}\nexport default class OrbitController extends Controller {\n constructor() {\n super(...arguments);\n this.ControllerState = OrbitState;\n this.transition = {\n transitionDuration: 300,\n transitionInterpolator: new LinearInterpolator({\n transitionProps: {\n compare: ['target', 'zoom', 'rotationX', 'rotationOrbit'],\n required: ['target', 'zoom']\n }\n })\n };\n }\n}\n", "import View from \"./view.js\";\nimport OrbitViewport from \"../viewports/orbit-viewport.js\";\nimport OrbitController from \"../controllers/orbit-controller.js\";\nclass OrbitView extends View {\n constructor(props = {}) {\n super(props);\n this.props.orbitAxis = props.orbitAxis || 'Z';\n }\n get ViewportType() {\n return OrbitViewport;\n }\n get ControllerType() {\n return OrbitController;\n }\n}\nOrbitView.displayName = 'OrbitView';\nexport default OrbitView;\n", "import { clamp } from '@math.gl/core';\nimport Controller from \"./controller.js\";\nimport { OrbitState } from \"./orbit-controller.js\";\nimport LinearInterpolator from \"../transitions/linear-interpolator.js\";\nclass OrthographicState extends OrbitState {\n constructor(props) {\n super(props);\n this.zoomAxis = props.zoomAxis || 'all';\n }\n _calculateNewZoom({ scale, startZoom }) {\n const { maxZoom, minZoom } = this.getViewportProps();\n if (startZoom === undefined) {\n startZoom = this.getViewportProps().zoom;\n }\n let deltaZoom = Math.log2(scale);\n if (Array.isArray(startZoom)) {\n let [newZoomX, newZoomY] = startZoom;\n switch (this.zoomAxis) {\n case 'X':\n // Scale x only\n newZoomX = clamp(newZoomX + deltaZoom, minZoom, maxZoom);\n break;\n case 'Y':\n // Scale y only\n newZoomY = clamp(newZoomY + deltaZoom, minZoom, maxZoom);\n break;\n default:\n // Lock aspect ratio\n let z = Math.min(newZoomX + deltaZoom, newZoomY + deltaZoom);\n if (z < minZoom) {\n deltaZoom += minZoom - z;\n }\n z = Math.max(newZoomX + deltaZoom, newZoomY + deltaZoom);\n if (z > maxZoom) {\n deltaZoom += maxZoom - z;\n }\n newZoomX += deltaZoom;\n newZoomY += deltaZoom;\n }\n return [newZoomX, newZoomY];\n }\n // Ignore `zoomAxis`\n // `LinearTransitionInterpolator` does not support interpolation between a number and an array\n // So if zoom is a number (legacy use case), new zoom still has to be a number\n return clamp(startZoom + deltaZoom, minZoom, maxZoom);\n }\n}\nexport default class OrthographicController extends Controller {\n constructor() {\n super(...arguments);\n this.ControllerState = OrthographicState;\n this.transition = {\n transitionDuration: 300,\n transitionInterpolator: new LinearInterpolator(['target', 'zoom'])\n };\n this.dragMode = 'pan';\n }\n _onPanRotate() {\n // No rotation in orthographic view\n return false;\n }\n}\n", "import View from \"./view.js\";\nimport OrthographicViewport from \"../viewports/orthographic-viewport.js\";\nimport OrthographicController from \"../controllers/orthographic-controller.js\";\nclass OrthographicView extends View {\n constructor(props = {}) {\n super(props);\n }\n get ViewportType() {\n return OrthographicViewport;\n }\n get ControllerType() {\n return OrthographicController;\n }\n}\nOrthographicView.displayName = 'OrthographicView';\nexport default OrthographicView;\n", "import { clamp } from '@math.gl/core';\nimport Controller from \"./controller.js\";\nimport { MapState } from \"./map-controller.js\";\nimport { mod } from \"../utils/math-utils.js\";\nimport LinearInterpolator from \"../transitions/linear-interpolator.js\";\nclass GlobeState extends MapState {\n // Apply any constraints (mathematical or defined by _viewportProps) to map state\n applyConstraints(props) {\n // Ensure zoom is within specified range\n const { maxZoom, minZoom, zoom } = props;\n props.zoom = clamp(zoom, minZoom, maxZoom);\n const { longitude, latitude } = props;\n if (longitude < -180 || longitude > 180) {\n props.longitude = mod(longitude + 180, 360) - 180;\n }\n props.latitude = clamp(latitude, -89, 89);\n return props;\n }\n}\nexport default class GlobeController extends Controller {\n constructor() {\n super(...arguments);\n this.ControllerState = GlobeState;\n this.transition = {\n transitionDuration: 300,\n transitionInterpolator: new LinearInterpolator(['longitude', 'latitude', 'zoom'])\n };\n this.dragMode = 'pan';\n }\n setProps(props) {\n super.setProps(props);\n // TODO - support pitching?\n this.dragRotate = false;\n this.touchRotate = false;\n }\n}\n", "import View from \"./view.js\";\nimport GlobeViewport from \"../viewports/globe-viewport.js\";\nimport GlobeController from \"../controllers/globe-controller.js\";\nclass GlobeView extends View {\n constructor(props = {}) {\n super(props);\n }\n get ViewportType() {\n return GlobeViewport;\n }\n get ControllerType() {\n return GlobeController;\n }\n}\nGlobeView.displayName = 'GlobeView';\nexport default GlobeView;\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport { deepEqual } from \"../utils/deep-equal.js\";\nclass LayerExtension {\n static get componentName() {\n return Object.prototype.hasOwnProperty.call(this, 'extensionName') ? this.extensionName : '';\n }\n constructor(opts) {\n if (opts) {\n this.opts = opts;\n }\n }\n /** Returns true if two extensions are equivalent */\n equals(extension) {\n if (this === extension) {\n return true;\n }\n // Compare extensions shallowly\n return this.constructor === extension.constructor && deepEqual(this.opts, extension.opts, 1);\n }\n /** Only called if attached to a primitive layer */\n getShaders(extension) {\n return null;\n }\n /** Only called if attached to a CompositeLayer */\n getSubLayerProps(extension) {\n const { defaultProps } = extension.constructor;\n const newProps = {\n updateTriggers: {}\n };\n /* eslint-disable max-depth */\n for (const key in defaultProps) {\n if (key in this.props) {\n const propDef = defaultProps[key];\n const propValue = this.props[key];\n newProps[key] = propValue;\n if (propDef && propDef.type === 'accessor') {\n newProps.updateTriggers[key] = this.props.updateTriggers[key];\n if (typeof propValue === 'function') {\n newProps[key] = this.getSubLayerAccessor(propValue);\n }\n }\n }\n }\n /* eslint-enable max-depth */\n return newProps;\n }\n /* eslint-disable @typescript-eslint/no-empty-function */\n initializeState(context, extension) { }\n updateState(params, extension) { }\n onNeedsRedraw(extension) { }\n getNeedsPickingBuffer(extension) {\n return false;\n }\n draw(params, extension) { }\n finalizeState(context, extension) { }\n}\nLayerExtension.defaultProps = {};\nLayerExtension.extensionName = 'LayerExtension';\nexport default LayerExtension;\n", "import TransitionInterpolator from \"./transition-interpolator.js\";\nimport { lerp } from '@math.gl/core';\nimport { flyToViewport, getFlyToDuration } from '@math.gl/web-mercator';\nconst LINEARLY_INTERPOLATED_PROPS = {\n bearing: 0,\n pitch: 0,\n position: [0, 0, 0]\n};\nconst DEFAULT_OPTS = {\n speed: 1.2,\n curve: 1.414\n};\n/**\n * This class adapts mapbox-gl-js Map#flyTo animation so it can be used in\n * react/redux architecture.\n * mapbox-gl-js flyTo : https://www.mapbox.com/mapbox-gl-js/api/#map#flyto.\n * It implements \u201CSmooth and efficient zooming and panning.\u201D algorithm by\n * \"Jarke J. van Wijk and Wim A.A. Nuij\"\n */\nexport default class FlyToInterpolator extends TransitionInterpolator {\n constructor(opts = {}) {\n super({\n compare: ['longitude', 'latitude', 'zoom', 'bearing', 'pitch', 'position'],\n extract: ['width', 'height', 'longitude', 'latitude', 'zoom', 'bearing', 'pitch', 'position'],\n required: ['width', 'height', 'latitude', 'longitude', 'zoom']\n });\n this.opts = { ...DEFAULT_OPTS, ...opts };\n }\n interpolateProps(startProps, endProps, t) {\n const viewport = flyToViewport(startProps, endProps, t, this.opts);\n // Linearly interpolate 'bearing', 'pitch' and 'position'.\n // If they are not supplied, they are interpreted as zeros in viewport calculation\n // (fallback defined in WebMercatorViewport)\n // Because there is no guarantee that the current controller's ViewState normalizes\n // these props, safe guard is needed to avoid generating NaNs\n for (const key in LINEARLY_INTERPOLATED_PROPS) {\n viewport[key] = lerp(startProps[key] || LINEARLY_INTERPOLATED_PROPS[key], endProps[key] || LINEARLY_INTERPOLATED_PROPS[key], t);\n }\n return viewport;\n }\n // computes the transition duration\n getDuration(startProps, endProps) {\n let { transitionDuration } = endProps;\n if (transitionDuration === 'auto') {\n // auto calculate duration based on start and end props\n transitionDuration = getFlyToDuration(startProps, endProps, this.opts);\n }\n return transitionDuration;\n }\n}\n", "// Copyright (c) 2015 - 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport { createIterable, getAccessorFromBuffer } from \"./iterable-utils.js\";\nimport defaultTypedArrayManager from \"./typed-array-manager.js\";\nimport assert from \"./assert.js\";\nimport { Buffer } from '@luma.gl/core';\nexport default class Tesselator {\n constructor(opts) {\n this.indexStarts = [0];\n this.vertexStarts = [0];\n this.vertexCount = 0;\n this.instanceCount = 0;\n const { attributes = {} } = opts;\n this.typedArrayManager = defaultTypedArrayManager;\n this.attributes = {};\n this._attributeDefs = attributes;\n this.opts = opts;\n this.updateGeometry(opts);\n }\n /* Public methods */\n updateGeometry(opts) {\n Object.assign(this.opts, opts);\n const { data, buffers = {}, getGeometry, geometryBuffer, positionFormat, dataChanged, normalize = true } = this.opts;\n this.data = data;\n this.getGeometry = getGeometry;\n this.positionSize =\n // @ts-ignore (2339) when geometryBuffer is a luma Buffer, size falls back to positionFormat\n (geometryBuffer && geometryBuffer.size) || (positionFormat === 'XY' ? 2 : 3);\n this.buffers = buffers;\n this.normalize = normalize;\n // Handle external logical value\n if (geometryBuffer) {\n assert(data.startIndices); // binary data missing startIndices\n this.getGeometry = this.getGeometryFromBuffer(geometryBuffer);\n if (!normalize) {\n // skip packing and set attribute value directly\n // TODO - avoid mutating user-provided object\n buffers.vertexPositions = geometryBuffer;\n }\n }\n this.geometryBuffer = buffers.vertexPositions;\n if (Array.isArray(dataChanged)) {\n // is partial update\n for (const dataRange of dataChanged) {\n this._rebuildGeometry(dataRange);\n }\n }\n else {\n this._rebuildGeometry();\n }\n }\n updatePartialGeometry({ startRow, endRow }) {\n this._rebuildGeometry({ startRow, endRow });\n }\n getGeometryFromBuffer(geometryBuffer) {\n const value = geometryBuffer.value || geometryBuffer;\n if (!ArrayBuffer.isView(value)) {\n // Cannot read binary geometries\n return null;\n }\n // @ts-ignore (2322) NumericArray not assignable to GeometryT\n return getAccessorFromBuffer(value, {\n size: this.positionSize,\n offset: geometryBuffer.offset,\n stride: geometryBuffer.stride,\n startIndices: this.data.startIndices\n });\n }\n /* Private utility methods */\n _allocate(instanceCount, copy) {\n // allocate attributes\n const { attributes, buffers, _attributeDefs, typedArrayManager } = this;\n for (const name in _attributeDefs) {\n if (name in buffers) {\n // Use external buffer\n typedArrayManager.release(attributes[name]);\n attributes[name] = null;\n }\n else {\n const def = _attributeDefs[name];\n // If dataRange is supplied, this is a partial update.\n // In case we need to reallocate the typed array, it will need the old values copied\n // before performing partial update.\n def.copy = copy;\n attributes[name] = typedArrayManager.allocate(attributes[name], instanceCount, def);\n }\n }\n }\n /**\n * Visit all objects\n * `data` is expected to be an iterable consistent with the base Layer expectation\n */\n _forEachGeometry(visitor, startRow, endRow) {\n const { data, getGeometry } = this;\n const { iterable, objectInfo } = createIterable(data, startRow, endRow);\n for (const object of iterable) {\n objectInfo.index++;\n const geometry = getGeometry ? getGeometry(object, objectInfo) : null;\n visitor(geometry, objectInfo.index);\n }\n }\n /* eslint-disable complexity,max-statements */\n _rebuildGeometry(dataRange) {\n if (!this.data) {\n return;\n }\n let { indexStarts, vertexStarts, instanceCount } = this;\n const { data, geometryBuffer } = this;\n const { startRow = 0, endRow = Infinity } = dataRange || {};\n const normalizedData = {};\n if (!dataRange) {\n // Full update - regenerate buffer layout from scratch\n indexStarts = [0];\n vertexStarts = [0];\n }\n if (this.normalize || !geometryBuffer) {\n this._forEachGeometry((geometry, dataIndex) => {\n const normalizedGeometry = geometry && this.normalizeGeometry(geometry);\n normalizedData[dataIndex] = normalizedGeometry;\n vertexStarts[dataIndex + 1] =\n vertexStarts[dataIndex] +\n (normalizedGeometry ? this.getGeometrySize(normalizedGeometry) : 0);\n }, startRow, endRow);\n // count instances\n instanceCount = vertexStarts[vertexStarts.length - 1];\n }\n else {\n // assume user provided data is already normalized\n vertexStarts = data.startIndices;\n instanceCount = vertexStarts[data.length] || 0;\n if (ArrayBuffer.isView(geometryBuffer)) {\n instanceCount = instanceCount || geometryBuffer.length / this.positionSize;\n }\n else if (geometryBuffer instanceof Buffer) {\n const byteStride = this.positionSize * 4;\n instanceCount = instanceCount || geometryBuffer.byteLength / byteStride;\n }\n else if (geometryBuffer.buffer) {\n const byteStride = geometryBuffer.stride || this.positionSize * 4;\n instanceCount = instanceCount || geometryBuffer.buffer.byteLength / byteStride;\n }\n else if (geometryBuffer.value) {\n const bufferValue = geometryBuffer.value;\n const elementStride = \n // @ts-ignore (2339) if stride is not specified, will fall through to positionSize\n geometryBuffer.stride / bufferValue.BYTES_PER_ELEMENT || this.positionSize;\n instanceCount = instanceCount || bufferValue.length / elementStride;\n }\n }\n // allocate attributes\n this._allocate(instanceCount, Boolean(dataRange));\n this.indexStarts = indexStarts;\n this.vertexStarts = vertexStarts;\n this.instanceCount = instanceCount;\n // @ts-ignore (2739) context will be populated in the loop\n const context = {};\n this._forEachGeometry((geometry, dataIndex) => {\n const normalizedGeometry = normalizedData[dataIndex] || geometry;\n context.vertexStart = vertexStarts[dataIndex];\n context.indexStart = indexStarts[dataIndex];\n const vertexEnd = dataIndex < vertexStarts.length - 1 ? vertexStarts[dataIndex + 1] : instanceCount;\n context.geometrySize = vertexEnd - vertexStarts[dataIndex];\n context.geometryIndex = dataIndex;\n this.updateGeometryAttributes(normalizedGeometry, context);\n }, startRow, endRow);\n this.vertexCount = indexStarts[indexStarts.length - 1];\n }\n}\n"], "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBA,kBAAgC;AAChC,oBAA4B;;;ACpB5B,iBAAoB;AACpB,IAAM,gBAAgB,IAAI,eAAI,EAAE,IAAI,OAAO,CAAC;AAC5C,IAAO,cAAQ;;;ACFf,IAAM,WAAW;AAAA,EACb,sBAAsB;AAAA,EACtB,6BAA6B;AAAA,EAC7B,yBAAyB,CAAC;AAC9B;AACA,IAAM,yBAAyB;AAC/B,IAAM,yBAAyB;AAC/B,IAAM,0BAA0B;AAChC,IAAM,iBAAiB;AACvB,IAAM,iBAAiB;AAChB,IAAM,aAAa,CAAC,SAAS;AAAA,EAEhC,oBAAoB,CAAC,OAAO,KAAK,UAAU;AACvC,QAAI,IAAI,yBAAyB,GAAG,MAAM,MAAM,SAAS,MAAM,IAAI,EAAE;AAAA,EACzE;AAAA,EACA,oBAAoB,WAAS;AACzB,QAAI,IAAI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ACnC,cAAM,gBAEN,eAAe,SAAS,YAAY,qBAAqB,KAAK;AAC9D,wBAAgB,iBAAiB,YAAY,SAAS;AAAA,MAC1D;AAAA,IACJ;AAEA,SAAK,UAAU,eAAe,QAAQ,SAAS,CAAC;AAChD,SAAK,cAAc;AACnB,SAAK,eAAe;AACpB,SAAK,gBAAgB;AAErB,UAAM,UAAU,CAAC;AACjB,SAAK,iBAAiB,CAAC,UAAU,cAAc;AAC3C,YAAM,qBAAqB,eAAe,cAAc;AACxD,cAAQ,cAAc,aAAa;AACnC,cAAQ,aAAa,YAAY;AACjC,YAAM,YAAY,YAAY,aAAa,SAAS,IAAI,aAAa,YAAY,KAAK;AACtF,cAAQ,eAAe,YAAY,aAAa;AAChD,cAAQ,gBAAgB;AACxB,WAAK,yBAAyB,oBAAoB,OAAO;AAAA,IAC7D,GAAG,UAAU,MAAM;AACnB,SAAK,cAAc,YAAY,YAAY,SAAS;AAAA,EACxD;AACJ;", "names": ["import_shadertools", "import_core", "viewMatrix", "vs", "import_core", "vs", "fs", "VECTOR_TO_POINT_MATRIX", "viewMatrix", "import_shadertools", "import_core", "DEFAULT_LIGHT_COLOR", "DEFAULT_LIGHT_INTENSITY", "idCount", "import_core", "DEFAULT_SHADOW_COLOR", "viewMatrix", "count", "import_core", "count", "import_core", "import_web_mercator", "ZERO_VECTOR", "viewMatrix", "import_web_mercator", "import_core", "import_core", "import_web_mercator", "DEFAULT_COORDINATE_ORIGIN", "DEFAULT_LIGHT_COLOR", "DEFAULT_LIGHT_INTENSITY", "idCount", "import_shadertools", "module", "fs", "module", "fs", "import_engine", "count", "import_core", "viewport", "module", "Controller", "import_core", "import_core", "import_core", "import_web_mercator", "import_core", "import_engine", "import_constants", "import_stats", "noop", "module", "import_core", "import_core", "import_engine", "import_shadertools", "import_constants", "import_constants", "vs", "import_engine", "getTransform", "vs", "fs", "import_core", "import_core", "TRANSITION_TYPES", "transition", "module", "import_core", "defaultProps", "defaultProps", "count", "import_web_mercator", "import_core", "EMPTY_ARRAY", "defaultProps", "picking", "TRACE_RENDER_LAYERS", "import_core", "import_core", "DEGREES_TO_RADIANS", "getDistanceScales", "unitsPerMeter", "viewMatrix", "import_core", "import_web_mercator", "DEGREES_TO_RADIANS", "getViewMatrix", "viewMatrix", "import_core", "import_web_mercator", "unitsPerMeter", "import_web_mercator", "import_core", "SphericalCoordinates", "viewMatrix", "import_core", "SphericalCoordinates", "import_core", "import_core", "import_core", "defaultProps", "import_core", "import_web_mercator", "import_core"] }