maplibre-gl-raster 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +362 -0
  3. package/dist/LercDecode.es-CZm5toNk.js +442 -0
  4. package/dist/LercDecode.es-CZm5toNk.js.map +1 -0
  5. package/dist/RasterControl-B7XdXYSu.js +18838 -0
  6. package/dist/RasterControl-B7XdXYSu.js.map +1 -0
  7. package/dist/__vite-browser-external-BgMKmFg9.js +9 -0
  8. package/dist/__vite-browser-external-BgMKmFg9.js.map +1 -0
  9. package/dist/assets/LercDecode.es-Bvg6-wb5.js +442 -0
  10. package/dist/assets/LercDecode.es-Bvg6-wb5.js.map +1 -0
  11. package/dist/assets/__vite-browser-external-BgMKmFg9.js +9 -0
  12. package/dist/assets/__vite-browser-external-BgMKmFg9.js.map +1 -0
  13. package/dist/assets/chunk-FDOR9p9I.js +24 -0
  14. package/dist/assets/decode-BvR5vy7g.js +940 -0
  15. package/dist/assets/decode-BvR5vy7g.js.map +1 -0
  16. package/dist/assets/lerc-By2TvjAX.js +34 -0
  17. package/dist/assets/lerc-By2TvjAX.js.map +1 -0
  18. package/dist/assets/lzw-CQJJDca2.js +174 -0
  19. package/dist/assets/lzw-CQJJDca2.js.map +1 -0
  20. package/dist/assets/worker-C6cg9T3Y.js +51 -0
  21. package/dist/assets/worker-C6cg9T3Y.js.map +1 -0
  22. package/dist/assets/zstd-DBZv9xja.js +569 -0
  23. package/dist/assets/zstd-DBZv9xja.js.map +1 -0
  24. package/dist/chunk-FDOR9p9I.js +24 -0
  25. package/dist/decode-BMFOVF9X.js +1966 -0
  26. package/dist/decode-BMFOVF9X.js.map +1 -0
  27. package/dist/index.mjs +223 -0
  28. package/dist/index.mjs.map +1 -0
  29. package/dist/lerc-B7WY-v3y.js +34 -0
  30. package/dist/lerc-B7WY-v3y.js.map +1 -0
  31. package/dist/lzw-YEsReV21.js +174 -0
  32. package/dist/lzw-YEsReV21.js.map +1 -0
  33. package/dist/maplibre-gl-raster.css +670 -0
  34. package/dist/react.mjs +145 -0
  35. package/dist/react.mjs.map +1 -0
  36. package/dist/types/index.d.ts +649 -0
  37. package/dist/types/react.d.ts +477 -0
  38. package/dist/zstd-DBZv9xja.js +569 -0
  39. package/dist/zstd-DBZv9xja.js.map +1 -0
  40. package/package.json +125 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RasterControl-B7XdXYSu.js","names":["DEFAULT_MAX_ERROR","defaultProps","defaultProps","scale","invert","affine.invert","a","affine.a","e","affine.e","affine.apply","affine.translation","affine.compose","D2R","parser","wktParser","WGS84_ELLIPSOID_A","MAX_WEB_MERCATOR_LAT","makeClampedForwardTo3857","RADIANS_TO_DEGREES","DEGREES_TO_RADIANS","assert","create","glMatrix.ARRAY_TYPE","transformMat3","forEach","create","glMatrix.ARRAY_TYPE","length","normalize","dot","transformQuat","rotateX","rotateY","rotateZ","forEach","ZERO","vec3_angle","create","glMatrix.ARRAY_TYPE","invert","multiply","scale","mat3_determinant","vec2_transformMat3","vec3_transformMat3","create","glMatrix.ARRAY_TYPE","add","scale","length","squaredLength","normalize","dot","lerp","glMatrix.ARRAY_TYPE","identity","add","vec4.add","vec4.scale","vec4.dot","vec4.lerp","vec4.length","vec4.squaredLength","vec4.normalize","vec3.create","vec3.fromValues","vec3.dot","vec3.len","mat3.create","quat_length","quat_squaredLength","quat_dot","TWO_PI","scratchVector","scratchNormal","scratchVector2","mat4.getScaling","scratchVector3","scratchPlaneNormal","_MathUtils.EPSILON20","_MathUtils.EPSILON15","assert","DEGREES_TO_RADIANS","TILE_SIZE","TILE_SIZE","Tileset2D","decode","invert","scale","units","PrimeMeridian","parseProj","wkt","globals","wkt","projStr","sign","init","msfnz","forward","adjust_lon","tsfnz","inverse","phi2z","names","init","names","merc","longlat","names","Ellipsoid","datum","parseCode","Datum","dc_sphere","dc_eccentricity","projections","adjust_lon","toPoint","proj","adjust_axis","datum_transform","proj","proj4","forward","inverse","forward","MAX_ITER","pj_mlfn","init","pj_enfn","pj_mlfn","forward","adjust_lon","inverse","pj_inv_mlfn","sign","names","log1py","hypot","sinh","cosh","init","tmerc","gatg","clens","forward","adjust_lon","hypot","asinhy","clens_cmplx","inverse","sinh","names","adjust_lon","init","adjust_zone","etmerc","names","MAX_ITER","init","srat","forward","inverse","names","init","forward","adjust_lon","inverse","hypot","names","init","sign","msfnz","tsfnz","forward","adjust_lon","inverse","phi2z","names","init","forward","inverse","names","init","tsfnz","adjust_lon","forward","inverse","phi2z","names","init","msfnz","tsfnz","forward","sign","adjust_lon","inverse","phi2z","names","init","forward","adjust_lon","inverse","names","sign","init","e0fn","e1fn","e2fn","e3fn","mlfn","forward","adjust_lon","gN","inverse","imlfn","adjust_lat","names","init","qsfnz","forward","adjust_lon","inverse","names","init","msfnz","qsfnz","forward","adjust_lon","inverse","asinz","names","init","forward","adjust_lon","inverse","asinz","names","init","msfnz","forward","adjust_lon","qsfnz","inverse","iqsfnz","names","init","forward","adjust_lon","adjust_lat","inverse","names","MAX_ITER","init","e0fn","e1fn","e2fn","e3fn","mlfn","forward","adjust_lon","adjust_lat","gN","inverse","names","init","forward","inverse","names","init","forward","adjust_lon","inverse","names","init","pj_enfn","forward","adjust_lon","pj_mlfn","inverse","asinz","adjust_lat","pj_inv_mlfn","names","init","forward","adjust_lon","inverse","names","init","e0fn","e1fn","e2fn","e3fn","msfnz","mlfn","forward","adjust_lon","inverse","adjust_lat","imlfn","names","init","forward","adjust_lon","asinz","inverse","names","init","forward","adjust_lon","e0fn","e1fn","e2fn","e3fn","mlfn","inverse","asinz","imlfn","names","init","forward","adjust_lon","inverse","asinz","names","init","forward","inverse","names","init","forward","adjust_lon","inverse","names","init","forward","inverse","names","init","forward","inverse","hypot","names","init","forward","hypot","inverse","names","init","forward","adjust_lon","inverse","names","init","pj_enfn","pj_mlfn","adjust_lon","hypot","pj_inv_mlfn","adjust_lat","names","longLatNames","Proj","adjust_lon","tmerc","etmerc","utm","sterea","stere","somerc","omerc","lcc","krovak","cass","laea","aea","gnom","cea","eqc","poly","nzmg","mill","sinu","moll","eqdc","vandg","aeqd","ortho","qsc","robin","geocent","tpers","geos","eqearth","bonne","ob_tran","core","Proj","common","includedProjections","shader","shader","shader","MODULE_NAME","MODULE_NAME","makeClampedForwardTo3857"],"sources":["../node_modules/@developmentseed/deck.gl-raster/dist/layer-utils.js","../node_modules/@developmentseed/raster-reproject/dist/delatin.js","../node_modules/@developmentseed/deck.gl-raster/dist/gpu-modules/create-texture.js","../node_modules/@developmentseed/deck.gl-raster/dist/mesh-layer/mesh-layer-fragment.glsl.js","../node_modules/@developmentseed/deck.gl-raster/dist/mesh-layer/mesh-layer.js","../node_modules/@developmentseed/deck.gl-raster/dist/raster-layer.js","../node_modules/@developmentseed/deck.gl-raster/dist/raster-tileset/affine-tileset.js","../node_modules/@developmentseed/affine/dist/affine.js","../node_modules/@developmentseed/deck.gl-raster/dist/raster-tileset/affine-tileset-level.js","../node_modules/@developmentseed/proj/dist/meters-per-unit.js","../node_modules/wkt-parser/PROJJSONBuilderBase.js","../node_modules/wkt-parser/PROJJSONBuilder2015.js","../node_modules/wkt-parser/PROJJSONBuilder2019.js","../node_modules/wkt-parser/buildPROJJSON.js","../node_modules/wkt-parser/detectWKTVersion.js","../node_modules/wkt-parser/parser.js","../node_modules/wkt-parser/process.js","../node_modules/wkt-parser/util.js","../node_modules/wkt-parser/transformPROJJSON.js","../node_modules/wkt-parser/index.js","../node_modules/@developmentseed/proj/dist/parse-wkt.js","../node_modules/@developmentseed/proj/dist/registry.js","../node_modules/@developmentseed/proj/dist/transform-bounds.js","../node_modules/@developmentseed/proj/dist/web-mercator.js","../node_modules/@math.gl/culling/dist/constants.js","../node_modules/@math.gl/core/dist/lib/common.js","../node_modules/@math.gl/core/dist/classes/base/math-array.js","../node_modules/@math.gl/core/dist/lib/validators.js","../node_modules/@math.gl/core/dist/lib/assert.js","../node_modules/@math.gl/core/dist/classes/base/vector.js","../node_modules/@math.gl/core/dist/gl-matrix/common.js","../node_modules/@math.gl/core/dist/gl-matrix/vec2.js","../node_modules/@math.gl/core/dist/lib/gl-matrix-extras.js","../node_modules/@math.gl/core/dist/gl-matrix/vec3.js","../node_modules/@math.gl/core/dist/classes/vector3.js","../node_modules/@math.gl/core/dist/classes/vector4.js","../node_modules/@math.gl/core/dist/classes/base/matrix.js","../node_modules/@math.gl/core/dist/gl-matrix/mat3.js","../node_modules/@math.gl/core/dist/classes/matrix3.js","../node_modules/@math.gl/core/dist/gl-matrix/mat4.js","../node_modules/@math.gl/core/dist/gl-matrix/vec4.js","../node_modules/@math.gl/core/dist/gl-matrix/quat.js","../node_modules/@math.gl/core/dist/classes/quaternion.js","../node_modules/@math.gl/core/dist/lib/math-utils.js","../node_modules/@math.gl/culling/dist/lib/bounding-volumes/axis-aligned-bounding-box.js","../node_modules/@math.gl/culling/dist/lib/bounding-volumes/bounding-sphere.js","../node_modules/@math.gl/culling/dist/lib/bounding-volumes/oriented-bounding-box.js","../node_modules/@math.gl/culling/dist/lib/plane.js","../node_modules/@math.gl/culling/dist/lib/culling-volume.js","../node_modules/@math.gl/culling/dist/lib/perspective-off-center-frustum.js","../node_modules/@math.gl/culling/dist/lib/algorithms/bounding-sphere-from-points.js","../node_modules/@math.gl/culling/dist/lib/algorithms/compute-eigen-decomposition.js","../node_modules/@math.gl/culling/dist/lib/algorithms/bounding-box-from-points.js","../node_modules/@math.gl/web-mercator/dist/assert.js","../node_modules/@math.gl/web-mercator/dist/web-mercator-utils.js","../node_modules/@math.gl/web-mercator/dist/get-bounds.js","../node_modules/@developmentseed/deck.gl-raster/dist/raster-tileset/raster-tile-traversal.js","../node_modules/@developmentseed/deck.gl-raster/dist/raster-tileset/raster-tileset-2d.js","../node_modules/@developmentseed/deck.gl-raster/dist/raster-tile-layer/constants.js","../node_modules/@developmentseed/deck.gl-raster/dist/raster-tile-layer/raster-tile-layer.js","../node_modules/@developmentseed/geotiff/dist/colormap.js","../node_modules/@chunkd/middleware/build/src/middleware/cache.js","../node_modules/@chunkd/source/build/src/error.js","../node_modules/@chunkd/source/build/src/range.js","../node_modules/@chunkd/source/build/src/view.js","../node_modules/@chunkd/source/build/src/index.js","../node_modules/@chunkd/middleware/build/src/middleware/chunk.js","../node_modules/@chunkd/source-http/build/src/index.js","../node_modules/@chunkd/source-memory/build/src/index.js","../node_modules/@developmentseed/geotiff/dist/crs.js","../node_modules/@developmentseed/geotiff/dist/fetch.js","../node_modules/@developmentseed/geotiff/dist/gdal-metadata.js","../node_modules/@developmentseed/geotiff/dist/ifd.js","../node_modules/@developmentseed/geotiff/dist/transform.js","../node_modules/@developmentseed/geotiff/dist/overview.js","../node_modules/@developmentseed/geotiff/dist/geotiff.js","../node_modules/@developmentseed/geotiff/dist/pool/wrapper.js","../node_modules/@developmentseed/geotiff/dist/pool/pool.js","../node_modules/proj4/lib/global.js","../node_modules/proj4/lib/constants/values.js","../node_modules/proj4/lib/constants/PrimeMeridian.js","../node_modules/proj4/lib/constants/units.js","../node_modules/proj4/lib/match.js","../node_modules/proj4/lib/projString.js","../node_modules/proj4/lib/defs.js","../node_modules/proj4/lib/parseCode.js","../node_modules/proj4/lib/extend.js","../node_modules/proj4/lib/common/msfnz.js","../node_modules/proj4/lib/common/sign.js","../node_modules/proj4/lib/common/adjust_lon.js","../node_modules/proj4/lib/common/tsfnz.js","../node_modules/proj4/lib/common/phi2z.js","../node_modules/proj4/lib/projections/merc.js","../node_modules/proj4/lib/projections/longlat.js","../node_modules/proj4/lib/projections.js","../node_modules/proj4/lib/constants/Ellipsoid.js","../node_modules/proj4/lib/deriveConstants.js","../node_modules/proj4/lib/constants/Datum.js","../node_modules/proj4/lib/datum.js","../node_modules/proj4/lib/nadgrid.js","../node_modules/proj4/lib/Proj.js","../node_modules/proj4/lib/datumUtils.js","../node_modules/proj4/lib/datum_transform.js","../node_modules/proj4/lib/adjust_axis.js","../node_modules/proj4/lib/common/toPoint.js","../node_modules/proj4/lib/checkSanity.js","../node_modules/proj4/lib/transform.js","../node_modules/proj4/lib/core.js","../node_modules/mgrs/mgrs.js","../node_modules/proj4/lib/Point.js","../node_modules/proj4/lib/common/pj_enfn.js","../node_modules/proj4/lib/common/pj_mlfn.js","../node_modules/proj4/lib/common/pj_inv_mlfn.js","../node_modules/proj4/lib/projections/tmerc.js","../node_modules/proj4/lib/common/sinh.js","../node_modules/proj4/lib/common/hypot.js","../node_modules/proj4/lib/common/log1py.js","../node_modules/proj4/lib/common/asinhy.js","../node_modules/proj4/lib/common/gatg.js","../node_modules/proj4/lib/common/clens.js","../node_modules/proj4/lib/common/cosh.js","../node_modules/proj4/lib/common/clens_cmplx.js","../node_modules/proj4/lib/projections/etmerc.js","../node_modules/proj4/lib/common/adjust_zone.js","../node_modules/proj4/lib/projections/utm.js","../node_modules/proj4/lib/common/srat.js","../node_modules/proj4/lib/projections/gauss.js","../node_modules/proj4/lib/projections/sterea.js","../node_modules/proj4/lib/projections/stere.js","../node_modules/proj4/lib/projections/somerc.js","../node_modules/proj4/lib/projections/omerc.js","../node_modules/proj4/lib/projections/lcc.js","../node_modules/proj4/lib/projections/krovak.js","../node_modules/proj4/lib/common/mlfn.js","../node_modules/proj4/lib/common/e0fn.js","../node_modules/proj4/lib/common/e1fn.js","../node_modules/proj4/lib/common/e2fn.js","../node_modules/proj4/lib/common/e3fn.js","../node_modules/proj4/lib/common/gN.js","../node_modules/proj4/lib/common/adjust_lat.js","../node_modules/proj4/lib/common/imlfn.js","../node_modules/proj4/lib/projections/cass.js","../node_modules/proj4/lib/common/qsfnz.js","../node_modules/proj4/lib/projections/laea.js","../node_modules/proj4/lib/common/asinz.js","../node_modules/proj4/lib/projections/aea.js","../node_modules/proj4/lib/projections/gnom.js","../node_modules/proj4/lib/common/iqsfnz.js","../node_modules/proj4/lib/projections/cea.js","../node_modules/proj4/lib/projections/eqc.js","../node_modules/proj4/lib/projections/poly.js","../node_modules/proj4/lib/projections/nzmg.js","../node_modules/proj4/lib/projections/mill.js","../node_modules/proj4/lib/projections/sinu.js","../node_modules/proj4/lib/projections/moll.js","../node_modules/proj4/lib/projections/eqdc.js","../node_modules/proj4/lib/projections/vandg.js","../node_modules/proj4/lib/common/vincenty.js","../node_modules/proj4/lib/projections/aeqd.js","../node_modules/proj4/lib/projections/ortho.js","../node_modules/proj4/lib/projections/qsc.js","../node_modules/proj4/lib/projections/robin.js","../node_modules/proj4/lib/projections/geocent.js","../node_modules/proj4/lib/projections/tpers.js","../node_modules/proj4/lib/projections/geos.js","../node_modules/proj4/lib/projections/eqearth.js","../node_modules/proj4/lib/projections/bonne.js","../node_modules/proj4/lib/projections/ob_tran.js","../node_modules/proj4/projs.js","../node_modules/proj4/lib/index.js","../node_modules/@developmentseed/deck.gl-geotiff/dist/geotiff/geotiff.js","../node_modules/@developmentseed/deck.gl-raster/dist/gpu-modules/color/black-is-zero.js","../node_modules/@developmentseed/deck.gl-raster/dist/gpu-modules/color/cielab.js","../node_modules/@developmentseed/deck.gl-raster/dist/gpu-modules/color/cmyk.js","../node_modules/@developmentseed/deck.gl-raster/dist/gpu-modules/color/white-is-zero.js","../node_modules/@developmentseed/deck.gl-raster/dist/gpu-modules/colormap.js","../node_modules/@developmentseed/deck.gl-raster/dist/gpu-modules/colormap-names.js","../node_modules/@developmentseed/deck.gl-raster/dist/gpu-modules/composite-bands.js","../node_modules/@developmentseed/deck.gl-raster/dist/gpu-modules/create-colormap-texture.js","../node_modules/@developmentseed/deck.gl-raster/dist/gpu-modules/decode-colormap-sprite.js","../node_modules/@developmentseed/deck.gl-raster/dist/gpu-modules/filter-nodata.js","../node_modules/@developmentseed/deck.gl-raster/dist/gpu-modules/mask-texture.js","../node_modules/@developmentseed/deck.gl-geotiff/dist/geotiff/texture.js","../node_modules/@developmentseed/deck.gl-geotiff/dist/geotiff/render-pipeline.js","../node_modules/@developmentseed/deck.gl-geotiff/dist/geotiff-tileset.js","../node_modules/@developmentseed/deck.gl-geotiff/dist/cog-layer.js","../node_modules/@developmentseed/deck.gl-raster/dist/gpu-modules/colormaps.png","../src/lib/raster/colormaps.ts","../src/lib/raster/load-geotiff.ts","../src/lib/raster/stats.ts","../src/lib/raster/shader-modules.ts","../src/lib/raster/render-pipeline.ts","../src/lib/raster/tile-loader.ts","../src/lib/utils/helpers.ts","../src/lib/state/RasterLayer.ts","../src/lib/state/LayerManager.ts","../src/lib/ui/dom.ts","../src/lib/ui/AddDataSection.ts","../src/lib/ui/LayerList.ts","../src/lib/ui/BandHistogram.ts","../src/lib/ui/ColormapPicker.ts","../src/lib/ui/SettingsSection.ts","../src/lib/ui/PanelUI.ts","../src/lib/core/RasterControl.ts"],"sourcesContent":["import { PathLayer, TextLayer } from \"@deck.gl/layers\";\nexport function renderDebugTileOutline(id, tile, forwardTo4326) {\n const { projectedCorners } = tile;\n // Create a closed path in WGS84 projection around the tile bounds\n //\n // The tile has a `bbox` field which is already the bounding box in WGS84,\n // but that uses `transformBounds` and densifies edges. So the corners of\n // the bounding boxes don't line up with each other.\n //\n // In this case in the debug mode, it looks better if we ignore the actual\n // non-linearities of the edges and just draw a box connecting the\n // reprojected corners. In any case, the _image itself_ will be densified\n // on the edges as a feature of the mesh generation.\n const { topLeft, topRight, bottomRight, bottomLeft } = projectedCorners;\n const topLeftWgs84 = forwardTo4326(topLeft[0], topLeft[1]);\n const topRightWgs84 = forwardTo4326(topRight[0], topRight[1]);\n const bottomRightWgs84 = forwardTo4326(bottomRight[0], bottomRight[1]);\n const bottomLeftWgs84 = forwardTo4326(bottomLeft[0], bottomLeft[1]);\n const path = [\n topLeftWgs84,\n topRightWgs84,\n bottomRightWgs84,\n bottomLeftWgs84,\n topLeftWgs84,\n ];\n const center = [\n (topLeftWgs84[0] + bottomRightWgs84[0]) / 2,\n (topLeftWgs84[1] + bottomRightWgs84[1]) / 2,\n ];\n const labelLayer = new TextLayer({\n id: `${id}-label`,\n data: [\n {\n position: center,\n text: `x=${tile.index.x} y=${tile.index.y} z=${tile.index.z}`,\n },\n ],\n getColor: [255, 255, 255, 255],\n getSize: 24,\n sizeUnits: \"pixels\",\n outlineWidth: 3,\n outlineColor: [0, 0, 0, 255],\n fontSettings: { sdf: true },\n });\n const outlineLayer = new PathLayer({\n id,\n data: [path],\n getPath: (d) => d,\n getColor: [255, 0, 0, 255], // Red\n getWidth: 2,\n widthUnits: \"pixels\",\n pickable: false,\n });\n return [outlineLayer, labelLayer];\n}\n//# sourceMappingURL=layer-utils.js.map","/**\n * Define [**uv coordinates**](https://en.wikipedia.org/wiki/UV_mapping) as a float-valued image-local coordinate space where the top left is `(0, 0)` and the bottom right is `(1, 1)`.\n *\n * Define [**Barycentric coordinates**](https://en.wikipedia.org/wiki/Barycentric_coordinate_system) as float-valued triangle-local coordinates, represented as a 3-tuple of floats, where the tuple must add up to 1. The coordinate represents \"how close to each vertex\" a point in the interior of a triangle is. I.e. `(0, 0, 1)`, `(0, 1, 0)`, and `(1, 0, 0)` are all valid barycentric coordinates that define one of the three vertices. `(1/3, 1/3, 1/3)` represents the centroid of a triangle. `(1/2, 1/2, 0)` represents a point that is halfway between vertices `a` and `b` and has \"none\" of vertex `c`.\n *\n *\n * ## Changes\n *\n * - Delatin coordinates are in terms of pixel space whereas here we use uv space.\n *\n * Originally copied from https://github.com/mapbox/delatin under the ISC\n * license, then subject to further modifications.\n */\n/**\n * Barycentric sample points in uv space for where to sample reprojection\n * errors.\n */\n// TODO: Increase sampling density if uv area is large\n// Note: these sample points should never be an existing vertex (that is, no\n// vertex of a sample point should ever be `1`, such as `(0,0,1)`, because that\n// would try to sample exactly at an existing triangle vertex).\nconst SAMPLE_POINTS = [\n [1 / 3, 1 / 3, 1 / 3], // centroid\n [0.5, 0.5, 0], // edge 0–1\n [0.5, 0, 0.5], // edge 0–2\n [0, 0.5, 0.5], // edge 1–2\n];\nconst DEFAULT_MAX_ERROR = 0.125;\n/**\n * RasterReprojector performs a Delaunay triangulation-based reprojection of a\n * raster image.\n *\n * It takes as input a set of functions to associate pixel positions with\n * coordinates in the input and output CRS, as well as the dimensions of the\n * output image, and it produces a triangulated mesh that can be used to\n * reproject the input raster onto the output raster with bounded error.\n */\nexport class RasterReprojector {\n reprojectors;\n /** Width of the image in pixels */\n width;\n /** Height of the image in pixels */\n height;\n /**\n * UV vertex coordinates (x, y), i.e.\n * [x0, y0, x1, y1, ...]\n *\n * These coordinates are floats that range from [0, 1] in both X and Y.\n */\n uvs;\n /**\n * XY Positions in output CRS, computed via exact forward reprojection.\n */\n exactOutputPositions;\n /**\n * triangle vertex indices\n */\n triangles;\n _halfedges;\n /**\n * The UV texture coordinates of candidates found from\n * `findReprojectionCandidate`.\n *\n * Maybe in the future we'll want to store the barycentric coordinates instead\n * of just the uv coordinates?\n */\n _candidatesUV;\n _queueIndices;\n _queue;\n _errors;\n _pending;\n _pendingLen;\n constructor(reprojectors, width, height = width) {\n this.reprojectors = reprojectors;\n this.width = width;\n this.height = height;\n this.uvs = []; // vertex coordinates (x, y)\n this.exactOutputPositions = [];\n this.triangles = []; // mesh triangle indices\n // additional triangle data\n this._halfedges = [];\n this._candidatesUV = [];\n this._queueIndices = [];\n this._queue = []; // queue of added triangles\n this._errors = [];\n this._pending = []; // triangles pending addition to queue\n this._pendingLen = 0;\n // The two initial triangles cover the entire input texture in UV space, so\n // they range from [0, 0] to [1, 1] in u and v.\n const u1 = 1;\n const v1 = 1;\n const p0 = this._addPoint(0, 0);\n const p1 = this._addPoint(u1, 0);\n const p2 = this._addPoint(0, v1);\n const p3 = this._addPoint(u1, v1);\n // add initial two triangles\n const t0 = this._addTriangle(p3, p0, p2, -1, -1, -1);\n this._addTriangle(p0, p3, p1, t0, -1, -1);\n this._flush();\n }\n /**\n * Refine the mesh until its maximum error gets below the given one\n *\n * @param maxError The maximum reprojection error in input pixels that the mesh should achieve.\n * @param maxIterations Optional safeguard to prevent infinite loops in case of non-convergence. If the mesh fails to converge within this number of iterations, a warning will be logged and the function will return early.\n *\n * @return {[type]} [return description]\n */\n run(maxError = DEFAULT_MAX_ERROR, { maxIterations = 10000 } = {}) {\n if (maxError <= 0) {\n throw new Error(\"maxError must be positive\");\n }\n // Note: this primarily happens near the poles, where we'll essentially\n // never converge\n let iterations = 0;\n while (this.getMaxError() > maxError) {\n this.refine();\n if (++iterations > maxIterations) {\n console.warn(`RasterReprojector: mesh refinement did not converge after ${iterations} iterations (maxError=${maxError}, currentError=${this.getMaxError()})`);\n break;\n }\n }\n }\n // refine the mesh with a single point\n refine() {\n this._step();\n this._flush();\n }\n // max error of the current mesh\n getMaxError() {\n return this._errors[0];\n }\n // rasterize and queue all triangles that got added or updated in _step\n _flush() {\n for (let i = 0; i < this._pendingLen; i++) {\n const t = this._pending[i];\n this._findReprojectionCandidate(t);\n }\n this._pendingLen = 0;\n }\n /**\n * Conversion of upstream's `_findCandidate` for reprojection error handling.\n *\n * @param t The index (into `this.triangles`) of the pending triangle to process.\n *\n * @return Doesn't return; instead modifies internal state.\n */\n _findReprojectionCandidate(t) {\n // Find the three vertices of this triangle\n const a = 2 * this.triangles[t * 3 + 0];\n const b = 2 * this.triangles[t * 3 + 1];\n const c = 2 * this.triangles[t * 3 + 2];\n // Get the UV coordinates of each vertex\n const p0u = this.uvs[a];\n const p0v = this.uvs[a + 1];\n const p1u = this.uvs[b];\n const p1v = this.uvs[b + 1];\n const p2u = this.uvs[c];\n const p2v = this.uvs[c + 1];\n // Get the **known** output CRS positions of each vertex\n const out0x = this.exactOutputPositions[a];\n const out0y = this.exactOutputPositions[a + 1];\n const out1x = this.exactOutputPositions[b];\n const out1y = this.exactOutputPositions[b + 1];\n const out2x = this.exactOutputPositions[c];\n const out2y = this.exactOutputPositions[c + 1];\n // A running tally of the maximum pixel error of each of our candidate\n // points\n let maxError = 0;\n // The point in uv coordinates that produced the max error\n // Note that upstream also initializes the point of max error to [0, 0]\n let maxErrorU = 0;\n let maxErrorV = 0;\n // Recall that the sample point is in barycentric coordinates\n for (const samplePoint of SAMPLE_POINTS) {\n // Get the UV coordinates of the sample point\n const uvSampleU = barycentricMix(p0u, p1u, p2u, samplePoint[0], samplePoint[1], samplePoint[2]);\n const uvSampleV = barycentricMix(p0v, p1v, p2v, samplePoint[0], samplePoint[1], samplePoint[2]);\n // Get the output CRS coordinates of the sample point by bilinear\n // interpolation\n const outSampleX = barycentricMix(out0x, out1x, out2x, samplePoint[0], samplePoint[1], samplePoint[2]);\n const outSampleY = barycentricMix(out0y, out1y, out2y, samplePoint[0], samplePoint[1], samplePoint[2]);\n // Convert uv to pixel space\n const pixelExactX = uvSampleU * (this.width - 1);\n const pixelExactY = uvSampleV * (this.height - 1);\n // Reproject these linearly-interpolated coordinates **from target CRS\n // to input CRS**. This gives us the **exact position in input space**\n // of the linearly interpolated sample point in output space.\n const inputCRSSampled = this.reprojectors.inverseReproject(outSampleX, outSampleY);\n // Find the pixel coordinates of the sampled point by using the inverse\n // geotransform.\n const pixelSampled = this.reprojectors.inverseTransform(inputCRSSampled[0], inputCRSSampled[1]);\n // 4. error in pixel space\n const dx = pixelExactX - pixelSampled[0];\n const dy = pixelExactY - pixelSampled[1];\n const err = Math.hypot(dx, dy);\n if (err > maxError) {\n maxError = err;\n maxErrorU = uvSampleU;\n maxErrorV = uvSampleV;\n }\n }\n //////\n // Now we can resume with code from upstream's `_findCandidate` that\n // modifies the internal state of what triangles to subdivide.\n // Check that the max error point is not one of the existing triangle\n // vertices\n // TODO: perhaps we should use float precision epsilon here?\n if ((maxErrorU === p0u && maxErrorV === p0v) ||\n (maxErrorU === p1u && maxErrorV === p1v) ||\n (maxErrorU === p2u && maxErrorV === p2v)) {\n maxError = 0;\n }\n // update triangle metadata\n this._candidatesUV[2 * t] = maxErrorU;\n this._candidatesUV[2 * t + 1] = maxErrorV;\n // add triangle to priority queue\n this._queuePush(t, maxError);\n }\n // process the next triangle in the queue, splitting it with a new point\n _step() {\n // pop triangle with highest error from priority queue\n const t = this._queuePop();\n const e0 = t * 3 + 0;\n const e1 = t * 3 + 1;\n const e2 = t * 3 + 2;\n const p0 = this.triangles[e0];\n const p1 = this.triangles[e1];\n const p2 = this.triangles[e2];\n const au = this.uvs[2 * p0];\n const av = this.uvs[2 * p0 + 1];\n const bu = this.uvs[2 * p1];\n const bv = this.uvs[2 * p1 + 1];\n const cu = this.uvs[2 * p2];\n const cv = this.uvs[2 * p2 + 1];\n const pu = this._candidatesUV[2 * t];\n const pv = this._candidatesUV[2 * t + 1];\n const pn = this._addPoint(pu, pv);\n if (orient(au, av, bu, bv, pu, pv) === 0) {\n this._handleCollinear(pn, e0);\n }\n else if (orient(bu, bv, cu, cv, pu, pv) === 0) {\n this._handleCollinear(pn, e1);\n }\n else if (orient(cu, cv, au, av, pu, pv) === 0) {\n this._handleCollinear(pn, e2);\n }\n else {\n const h0 = this._halfedges[e0];\n const h1 = this._halfedges[e1];\n const h2 = this._halfedges[e2];\n const t0 = this._addTriangle(p0, p1, pn, h0, -1, -1, e0);\n const t1 = this._addTriangle(p1, p2, pn, h1, -1, t0 + 1);\n const t2 = this._addTriangle(p2, p0, pn, h2, t0 + 2, t1 + 1);\n this._legalize(t0);\n this._legalize(t1);\n this._legalize(t2);\n }\n }\n // add coordinates for a new vertex\n _addPoint(u, v) {\n const i = this.uvs.length >> 1;\n this.uvs.push(u, v);\n // compute and store exact output position via reprojection\n const pixelX = u * (this.width - 1);\n const pixelY = v * (this.height - 1);\n const inputPosition = this.reprojectors.forwardTransform(pixelX, pixelY);\n const exactOutputPosition = this.reprojectors.forwardReproject(inputPosition[0], inputPosition[1]);\n this.exactOutputPositions.push(exactOutputPosition[0], exactOutputPosition[1]);\n return i;\n }\n // add or update a triangle in the mesh\n _addTriangle(a, b, c, ab, bc, ca, e = this.triangles.length) {\n const t = e / 3; // new triangle index\n // add triangle vertices\n this.triangles[e + 0] = a;\n this.triangles[e + 1] = b;\n this.triangles[e + 2] = c;\n // add triangle halfedges\n this._halfedges[e + 0] = ab;\n this._halfedges[e + 1] = bc;\n this._halfedges[e + 2] = ca;\n // link neighboring halfedges\n if (ab >= 0) {\n this._halfedges[ab] = e + 0;\n }\n if (bc >= 0) {\n this._halfedges[bc] = e + 1;\n }\n if (ca >= 0) {\n this._halfedges[ca] = e + 2;\n }\n // init triangle metadata\n this._candidatesUV[2 * t + 0] = 0;\n this._candidatesUV[2 * t + 1] = 0;\n this._queueIndices[t] = -1;\n // add triangle to pending queue for later rasterization\n this._pending[this._pendingLen++] = t;\n // return first halfedge index\n return e;\n }\n _legalize(a) {\n // if the pair of triangles doesn't satisfy the Delaunay condition\n // (p1 is inside the circumcircle of [p0, pl, pr]), flip them,\n // then do the same check/flip recursively for the new pair of triangles\n //\n // pl pl\n // /||\\ / \\\n // al/ || \\bl al/ \\a\n // / || \\ / \\\n // / a||b \\ flip /___ar___\\\n // p0\\ || /p1 => p0\\---bl---/p1\n // \\ || / \\ /\n // ar\\ || /br b\\ /br\n // \\||/ \\ /\n // pr pr\n const b = this._halfedges[a];\n if (b < 0) {\n return;\n }\n const a0 = a - (a % 3);\n const b0 = b - (b % 3);\n const al = a0 + ((a + 1) % 3);\n const ar = a0 + ((a + 2) % 3);\n const bl = b0 + ((b + 2) % 3);\n const br = b0 + ((b + 1) % 3);\n const p0 = this.triangles[ar];\n const pr = this.triangles[a];\n const pl = this.triangles[al];\n const p1 = this.triangles[bl];\n const uvs = this.uvs;\n if (!inCircle(uvs[2 * p0], uvs[2 * p0 + 1], uvs[2 * pr], uvs[2 * pr + 1], uvs[2 * pl], uvs[2 * pl + 1], uvs[2 * p1], uvs[2 * p1 + 1])) {\n return;\n }\n const hal = this._halfedges[al];\n const har = this._halfedges[ar];\n const hbl = this._halfedges[bl];\n const hbr = this._halfedges[br];\n this._queueRemove(a0 / 3);\n this._queueRemove(b0 / 3);\n const t0 = this._addTriangle(p0, p1, pl, -1, hbl, hal, a0);\n const t1 = this._addTriangle(p1, p0, pr, t0, har, hbr, b0);\n this._legalize(t0 + 1);\n this._legalize(t1 + 2);\n }\n // handle a case where new vertex is on the edge of a triangle\n _handleCollinear(pn, a) {\n const a0 = a - (a % 3);\n const al = a0 + ((a + 1) % 3);\n const ar = a0 + ((a + 2) % 3);\n const p0 = this.triangles[ar];\n const pr = this.triangles[a];\n const pl = this.triangles[al];\n const hal = this._halfedges[al];\n const har = this._halfedges[ar];\n const b = this._halfedges[a];\n if (b < 0) {\n const t0 = this._addTriangle(pn, p0, pr, -1, har, -1, a0);\n const t1 = this._addTriangle(p0, pn, pl, t0, -1, hal);\n this._legalize(t0 + 1);\n this._legalize(t1 + 2);\n return;\n }\n const b0 = b - (b % 3);\n const bl = b0 + ((b + 2) % 3);\n const br = b0 + ((b + 1) % 3);\n const p1 = this.triangles[bl];\n const hbl = this._halfedges[bl];\n const hbr = this._halfedges[br];\n this._queueRemove(b0 / 3);\n const t0 = this._addTriangle(p0, pr, pn, har, -1, -1, a0);\n const t1 = this._addTriangle(pr, p1, pn, hbr, -1, t0 + 1, b0);\n const t2 = this._addTriangle(p1, pl, pn, hbl, -1, t1 + 1);\n const t3 = this._addTriangle(pl, p0, pn, hal, t0 + 2, t2 + 1);\n this._legalize(t0);\n this._legalize(t1);\n this._legalize(t2);\n this._legalize(t3);\n }\n // priority queue methods\n _queuePush(t, error) {\n const i = this._queue.length;\n this._queueIndices[t] = i;\n this._queue.push(t);\n this._errors.push(error);\n this._queueUp(i);\n }\n _queuePop() {\n const n = this._queue.length - 1;\n this._queueSwap(0, n);\n this._queueDown(0, n);\n return this._queuePopBack();\n }\n _queuePopBack() {\n const t = this._queue.pop();\n this._errors.pop();\n this._queueIndices[t] = -1;\n return t;\n }\n _queueRemove(t) {\n const i = this._queueIndices[t];\n if (i < 0) {\n const it = this._pending.indexOf(t);\n if (it !== -1) {\n this._pending[it] = this._pending[--this._pendingLen];\n }\n else {\n throw new Error(\"Broken triangulation (something went wrong).\");\n }\n return;\n }\n const n = this._queue.length - 1;\n if (n !== i) {\n this._queueSwap(i, n);\n if (!this._queueDown(i, n)) {\n this._queueUp(i);\n }\n }\n this._queuePopBack();\n }\n _queueLess(i, j) {\n return this._errors[i] > this._errors[j];\n }\n _queueSwap(i, j) {\n const pi = this._queue[i];\n const pj = this._queue[j];\n this._queue[i] = pj;\n this._queue[j] = pi;\n this._queueIndices[pi] = j;\n this._queueIndices[pj] = i;\n const e = this._errors[i];\n this._errors[i] = this._errors[j];\n this._errors[j] = e;\n }\n _queueUp(j0) {\n let j = j0;\n while (true) {\n const i = (j - 1) >> 1;\n if (i === j || !this._queueLess(j, i)) {\n break;\n }\n this._queueSwap(i, j);\n j = i;\n }\n }\n _queueDown(i0, n) {\n let i = i0;\n while (true) {\n const j1 = 2 * i + 1;\n if (j1 >= n || j1 < 0) {\n break;\n }\n const j2 = j1 + 1;\n let j = j1;\n if (j2 < n && this._queueLess(j2, j1)) {\n j = j2;\n }\n if (!this._queueLess(j, i)) {\n break;\n }\n this._queueSwap(i, j);\n i = j;\n }\n return i > i0;\n }\n}\nfunction orient(ax, ay, bx, by, cx, cy) {\n return (bx - cx) * (ay - cy) - (by - cy) * (ax - cx);\n}\nfunction inCircle(ax, ay, bx, by, cx, cy, px, py) {\n const dx = ax - px;\n const dy = ay - py;\n const ex = bx - px;\n const ey = by - py;\n const fx = cx - px;\n const fy = cy - py;\n const ap = dx * dx + dy * dy;\n const bp = ex * ex + ey * ey;\n const cp = fx * fx + fy * fy;\n return (dx * (ey * cp - bp * fy) -\n dy * (ex * cp - bp * fx) +\n ap * (ex * fy - ey * fx) <\n 0);\n}\n/**\n * Interpolate the value at a given barycentric coordinate within a triangle.\n *\n * I've seen the name \"mix\" used before in graphics programming to refer to\n * barycentric linear interpolation.\n *\n * Note: the caller must call this method twice: once for u and once again for\n * v. We do this because we want to avoid allocating an array for the return\n * value.\n */\nfunction barycentricMix(a, b, c, \n// Barycentric coordinates\nt0, t1, t2) {\n return t0 * a + t1 * b + t2 * c;\n}\n//# sourceMappingURL=delatin.js.map","/**\n * The base shader module for a render pipeline: samples a single input\n * texture into `color` so subsequent modules can transform it. Use this\n * when no decoding step (e.g. {@link CompositeBands}) is needed.\n */\nexport const CreateTexture = {\n name: \"create-texture-unorm\",\n inject: {\n \"fs:#decl\": `uniform sampler2D textureName;`,\n \"fs:DECKGL_FILTER_COLOR\": /* glsl */ `\n color = texture(textureName, geometry.uv);\n `,\n },\n getUniforms: (props) => {\n return {\n textureName: props.textureName,\n };\n },\n};\n//# sourceMappingURL=create-texture.js.map","/**\n * This is a vendored copy of the SimpleMeshLayer's fragment shader:\n * https://github.com/visgl/deck.gl/blob/a15c8cea047993c8a861bf542835c1988f30165c/modules/mesh-layers/src/simple-mesh-layer/simple-mesh-layer-fragment.glsl.ts\n * under the MIT license.\n *\n * We edited this to remove the hard-coded texture uniform because we want to\n * support integer and signed integer textures, not only normalized unsigned\n * textures.\n */\nexport default /* glsl */ `#version 300 es\n#define SHADER_NAME simple-mesh-layer-fs\n\nprecision highp float;\n\nin vec2 vTexCoord;\nin vec3 cameraPosition;\nin vec3 normals_commonspace;\nin vec4 position_commonspace;\nin vec4 vColor;\n\nout vec4 fragColor;\n\nvoid main(void) {\n geometry.uv = vTexCoord;\n\n vec3 normal;\n if (simpleMesh.flatShading) {\n\n normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));\n } else {\n normal = normals_commonspace;\n }\n\n // We initialize color here before passing into DECKGL_FILTER_COLOR\n vec4 color;\n DECKGL_FILTER_COLOR(color, geometry);\n\n vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);\n fragColor = vec4(lightColor, color.a * layer.opacity);\n}\n`;\n//# sourceMappingURL=mesh-layer-fragment.glsl.js.map","import { SimpleMeshLayer } from \"@deck.gl/mesh-layers\";\nimport { CreateTexture } from \"../gpu-modules/create-texture.js\";\nimport fs from \"./mesh-layer-fragment.glsl.js\";\nconst defaultProps = {\n ...SimpleMeshLayer.defaultProps,\n // Note: putting `image` in defaultProps causes Maplibre to fail to render\n // labels in interleaved mode 🤷‍♂️\n // image: { type: \"image\", value: null, async: true },\n renderPipeline: { type: \"array\", value: [], compare: true },\n // Disable lighting by default (avoids darkening raster)\n material: {\n ambient: 1.0,\n diffuse: 0.0,\n shininess: 0,\n specularColor: [0, 0, 0],\n },\n};\n/**\n * A small subclass of the SimpleMeshLayer to allow dynamic shader injections.\n *\n * In the future this may expand to diverge more from the SimpleMeshLayer, such\n * as allowing the texture to be a 2D _array_.\n */\nexport class MeshTextureLayer extends SimpleMeshLayer {\n static layerName = \"mesh-texture-layer\";\n static defaultProps = defaultProps;\n _resolveRenderPipeline() {\n const { image, renderPipeline } = this.props;\n const imageModule = image\n ? [{ module: CreateTexture, props: { textureName: image } }]\n : [];\n return [...imageModule, ...(renderPipeline ?? [])];\n }\n getShaders() {\n const upstreamShaders = super.getShaders();\n const modules = upstreamShaders.modules;\n for (const m of this._resolveRenderPipeline()) {\n modules.push(m.module);\n }\n return {\n ...upstreamShaders,\n // Override upstream's fragment shader with our copy with modified\n // injection points\n fs,\n modules,\n };\n }\n draw(opts) {\n const shaderProps = {};\n for (const m of this._resolveRenderPipeline()) {\n // Props should be keyed by module name\n shaderProps[m.module.name] = m.props || {};\n }\n for (const m of super.getModels()) {\n m.shaderInputs.setProps(shaderProps);\n }\n super.draw(opts);\n }\n}\n//# sourceMappingURL=mesh-layer.js.map","import { CompositeLayer } from \"@deck.gl/core\";\nimport { PolygonLayer } from \"@deck.gl/layers\";\nimport { RasterReprojector } from \"@developmentseed/raster-reproject\";\nimport { MeshTextureLayer } from \"./mesh-layer/mesh-layer.js\";\nconst DEFAULT_MAX_ERROR = 0.125;\nconst DEBUG_COLORS = [\n [252, 73, 163], // pink\n [255, 51, 204], // magenta-pink\n [204, 102, 255], // purple-ish\n [153, 51, 255], // deep purple\n [102, 204, 255], // sky blue\n [51, 153, 255], // clear blue\n [102, 255, 204], // teal\n [51, 255, 170], // aqua-teal\n [0, 255, 0], // lime green\n [51, 204, 51], // stronger green\n [255, 204, 102], // light orange\n [255, 179, 71], // golden-orange\n [255, 102, 102], // salmon\n [255, 80, 80], // red-salmon\n [255, 0, 0], // red\n [204, 0, 0], // crimson\n [255, 128, 0], // orange\n [255, 153, 51], // bright orange\n [255, 255, 102], // yellow\n [255, 255, 51], // lemon\n [0, 255, 255], // turquoise\n [0, 204, 255], // cyan\n];\nconst defaultProps = {\n // A prop with `type: \"image\"` gets converted to a texture automatically by\n // deck.gl (as long as async: true)\n image: { type: \"image\", value: null, async: true },\n renderPipeline: { type: \"array\", value: [], compare: true },\n debug: false,\n debugOpacity: 0.5,\n};\n/**\n * Generic deck.gl layer for rendering geospatial raster data with client-side,\n * GPU-based reprojection and custom processing pipelines.\n *\n * This is a composite layer that uses {@link RasterReprojector} to generate an adaptive mesh\n * that accurately represents the reprojected raster, then renders it using\n * {@link MeshTextureLayer} (a small wrapper around a deck.gl\n * {@link SimpleMeshLayer}).\n */\nexport class RasterLayer extends CompositeLayer {\n static layerName = \"RasterLayer\";\n static defaultProps = defaultProps;\n initializeState() {\n this.setState({});\n }\n updateState(params) {\n super.updateState(params);\n const { props, oldProps, changeFlags } = params;\n // Regenerate mesh if key properties change.\n // Compare reprojectionFns members individually since callers may create a\n // new wrapper object on every render even when the functions are stable.\n const reprojectionFnsChanged = props.reprojectionFns.forwardTransform !==\n oldProps.reprojectionFns?.forwardTransform ||\n props.reprojectionFns.inverseTransform !==\n oldProps.reprojectionFns?.inverseTransform ||\n props.reprojectionFns.forwardReproject !==\n oldProps.reprojectionFns?.forwardReproject ||\n props.reprojectionFns.inverseReproject !==\n oldProps.reprojectionFns?.inverseReproject;\n const needsMeshUpdate = Boolean(changeFlags.dataChanged) ||\n props.width !== oldProps.width ||\n props.height !== oldProps.height ||\n reprojectionFnsChanged ||\n props.maxError !== oldProps.maxError;\n if (needsMeshUpdate) {\n this._generateMesh();\n }\n }\n _generateMesh() {\n const { width, height, reprojectionFns, maxError = DEFAULT_MAX_ERROR, } = this.props;\n // The mesh is lined up with the upper and left edges of the raster. So if\n // we give the raster the same width and height as the number of pixels in\n // the image, it'll be omitting the last row and column of pixels.\n //\n // To account for this, we add 1 to both width and height when generating\n // the mesh. This also solves obvious gaps in between neighboring tiles in\n // the COGLayer.\n const reprojector = new RasterReprojector(reprojectionFns, width + 1, height + 1);\n reprojector.run(maxError);\n const { indices, positions, texCoords } = reprojectorToMesh(reprojector);\n this.setState({\n reprojector,\n mesh: {\n positions,\n indices,\n texCoords,\n },\n });\n }\n renderDebugLayer() {\n const { reprojector } = this.state;\n const { debugOpacity } = this.props;\n if (!reprojector) {\n return null;\n }\n return new PolygonLayer(this.getSubLayerProps({\n id: \"polygon\",\n // https://deck.gl/docs/developer-guide/performance#supply-binary-blobs-to-the-data-prop\n // This `data` gets passed into `getPolygon` with the row index.\n data: { reprojector, length: reprojector.triangles.length / 3 },\n getPolygon: (_, { index, data, }) => {\n const triangles = data.reprojector.triangles;\n const positions = reprojector.exactOutputPositions;\n const a = triangles[index * 3];\n const b = triangles[index * 3 + 1];\n const c = triangles[index * 3 + 2];\n return [\n [positions[a * 2], positions[a * 2 + 1]],\n [positions[b * 2], positions[b * 2 + 1]],\n [positions[c * 2], positions[c * 2 + 1]],\n [positions[a * 2], positions[a * 2 + 1]],\n ];\n },\n getFillColor: (_, { index, target }) => {\n const color = DEBUG_COLORS[index % DEBUG_COLORS.length];\n target[0] = color[0];\n target[1] = color[1];\n target[2] = color[2];\n target[3] = 255;\n return target;\n },\n getLineColor: [0, 0, 0],\n getLineWidth: 1,\n lineWidthUnits: \"pixels\",\n opacity: debugOpacity !== undefined && Number.isFinite(debugOpacity)\n ? Math.max(0, Math.min(1, debugOpacity))\n : 1,\n pickable: false,\n }));\n }\n renderLayers() {\n const { mesh } = this.state;\n const { debug, image, renderPipeline } = this.props;\n if (!mesh || (!image && (renderPipeline?.length ?? 0) === 0)) {\n return null;\n }\n const { indices, positions, texCoords } = mesh;\n const meshLayer = new MeshTextureLayer(this.getSubLayerProps({\n id: \"raster\",\n image,\n renderPipeline,\n // Dummy data because we're only rendering _one_ instance of this mesh\n // https://github.com/visgl/deck.gl/blob/93111b667b919148da06ff1918410cf66381904f/modules/geo-layers/src/terrain-layer/terrain-layer.ts#L241\n data: [1],\n mesh: {\n indices: { value: indices, size: 1 },\n attributes: {\n POSITION: {\n value: positions,\n size: 3,\n },\n TEXCOORD_0: {\n value: texCoords,\n size: 2,\n },\n },\n },\n // We're only rendering a single mesh, without instancing\n // https://github.com/visgl/deck.gl/blob/93111b667b919148da06ff1918410cf66381904f/modules/geo-layers/src/terrain-layer/terrain-layer.ts#L244\n _instanced: false,\n // Dummy accessors for the dummy data\n // We place our mesh at the coordinate origin\n getPosition: [0, 0, 0],\n // We give a white color to turn off color mixing with the texture\n getColor: [255, 255, 255],\n }));\n const layers = [meshLayer];\n if (debug) {\n const debugLayer = this.renderDebugLayer();\n if (debugLayer) {\n layers.push(debugLayer);\n }\n }\n return layers;\n }\n}\nfunction reprojectorToMesh(reprojector) {\n const numVertices = reprojector.uvs.length / 2;\n const positions = new Float32Array(numVertices * 3);\n const texCoords = new Float32Array(reprojector.uvs);\n for (let i = 0; i < numVertices; i++) {\n positions[i * 3] = reprojector.exactOutputPositions[i * 2];\n positions[i * 3 + 1] = reprojector.exactOutputPositions[i * 2 + 1];\n // z (flat on the ground)\n positions[i * 3 + 2] = 0;\n }\n // TODO: Consider using 16-bit indices if the mesh is small enough\n const indices = new Uint32Array(reprojector.triangles);\n return {\n indices,\n positions,\n texCoords,\n };\n}\n//# sourceMappingURL=raster-layer.js.map","/**\n * A {@link TilesetDescriptor} backed by per-level affine transforms.\n *\n * Derives `projectedBounds` from the coarsest level's array. Everything else\n * is passed through from the constructor options.\n */\nexport class AffineTileset {\n levels;\n projectTo3857;\n projectFrom3857;\n projectTo4326;\n projectFrom4326;\n projectedBounds;\n constructor(options) {\n if (options.levels.length === 0) {\n throw new Error(\"AffineTileset requires at least one level\");\n }\n this.levels = options.levels;\n this.projectTo3857 = options.projectTo3857;\n this.projectFrom3857 = options.projectFrom3857;\n this.projectTo4326 = options.projectTo4326;\n this.projectFrom4326 = options.projectFrom4326;\n this.projectedBounds = options.levels[0].projectedBounds;\n }\n}\n//# sourceMappingURL=affine-tileset.js.map","// Create a single identity array to reuse for all calls to `identity()`.\nconst ident = [1, 0, 0, 0, 1, 0];\n/**\n * Access the identity affine transform, which maps pixel coordinates to\n * themselves.\n *\n * @return The identity affine transform.\n */\nexport function identity() {\n return ident;\n}\n/**\n * Create a translation transform from an offset vector.\n *\n * @param xoff Translation offset in x direction.\n * @param yoff Translation offset in y direction.\n *\n * @return Transform that applies the given translation.\n */\nexport function translation(xoff, yoff) {\n return [1, 0, xoff, 0, 1, yoff];\n}\n/**\n * Create a scaling transform from a scalar or vector.\n *\n * You can pass either one or two scaling factors. Passing only a single scalar\n * value will scale in both dimensions equally. A vector scaling value scales\n * the dimensions independently.\n *\n * @param sx Scaling factor in x direction.\n * @param sy Scaling factor in y direction (defaults to sx if not provided).\n *\n * @return Transform that applies the given scaling.\n */\nexport function scale(sx, sy = sx) {\n return [sx, 0, 0, 0, sy, 0];\n}\n/**\n * Create a rotation transform.\n *\n * Rotates counter-clockwise by `angle` degrees about the given pivot point\n * (defaults to the origin `(0, 0)`). Ported from the Python\n * [`affine`](https://github.com/rasterio/affine) library.\n *\n * @param angle Rotation angle in degrees, counter-clockwise about the pivot.\n * @param pivot Optional pivot point `[px, py]`. Defaults to `[0, 0]`.\n *\n * @return Transform that applies the given rotation.\n */\nexport function rotation(angle, pivot = [0, 0]) {\n const [ca, sa] = cosSinDeg(angle);\n const [px, py] = pivot;\n if (px === 0 && py === 0) {\n return [ca, -sa, 0, sa, ca, 0];\n }\n // biome-ignore format: array\n return [\n ca, -sa, px - px * ca + py * sa,\n sa, ca, py - px * sa - py * ca,\n ];\n}\n/**\n * Return the cosine and sine of an angle in degrees, special-casing exact\n * multiples of 90° so right angles produce exact 0 / ±1 instead of the\n * floating-point error that `Math.cos(Math.PI/2)` etc. would emit.\n *\n * Ported from the Python `affine` library's `cos_sin_deg`.\n */\nfunction cosSinDeg(deg) {\n // JS `%` preserves the dividend's sign (`-90 % 360 === -90`), unlike\n // Python's modulo which normalizes to [0, 360). The `+ 360) % 360`\n // dance gives us Python-style wrapping so the right-angle short-circuits\n // below also fire for negative angles like `-90`.\n const wrapped = ((deg % 360) + 360) % 360;\n if (wrapped === 0) {\n return [1, 0];\n }\n if (wrapped === 90) {\n return [0, 1];\n }\n if (wrapped === 180) {\n return [-1, 0];\n }\n if (wrapped === 270) {\n return [0, -1];\n }\n const rad = (wrapped * Math.PI) / 180;\n return [Math.cos(rad), Math.sin(rad)];\n}\n/**\n * Apply a geotransform to a coordinate.\n *\n * That is, we apply this series of equations:\n *\n * ```\n * x_out = a * x + b * y + c\n * y_out = d * x + e * y + f\n * ```\n *\n * @param affine The affine transform to apply.\n * @param x The x coordinate.\n * @param y The y coordinate.\n *\n * @return The transformed coordinates.\n */\nexport function apply([a, b, c, d, e, f], x, y) {\n // biome-ignore format: array\n return [\n a * x + b * y + c,\n d * x + e * y + f\n ];\n}\n/**\n * Compose two affine transforms: A×B (apply B **first**, then A).\n *\n * This is equivalent to `a @ b` in Python's `affine` library, and is equivalent\n * to multiplying the 3×3 matrices:\n * ```\n * | a1 b1 c1 | | a2 b2 c2 |\n * | d1 e1 f1 | × | d2 e2 f2 |\n * | 0 0 1 | | 0 0 1 |\n * ```\n *\n * @param A The first affine transform to apply.\n * @param B The second affine transform to apply.\n *\n * @return The composed affine transform.\n */\nexport function compose([a1, b1, c1, d1, e1, f1], [a2, b2, c2, d2, e2, f2]) {\n return [\n a1 * a2 + b1 * d2,\n a1 * b2 + b1 * e2,\n a1 * c2 + b1 * f2 + c1,\n d1 * a2 + e1 * d2,\n d1 * b2 + e1 * e2,\n d1 * c2 + e1 * f2 + f1,\n ];\n}\n/**\n * Compute the inverse of an Affine.\n *\n * @param affine The affine transform to invert.\n * @return The inverted affine transform.\n * @throws If the transform is degenerate and cannot be inverted.\n */\nexport function invert([sa, sb, sc, sd, se, sf]) {\n const det = sa * se - sb * sd;\n if (det === 0) {\n throw new Error(\"Cannot invert degenerate transform\");\n }\n const idet = 1.0 / det;\n const ra = se * idet;\n const rb = -sb * idet;\n const rd = -sd * idet;\n const re = sa * idet;\n // biome-ignore format: array\n return [\n ra, rb, -sc * ra - sf * rb,\n rd, re, -sc * rd - sf * re\n ];\n}\n/** Get the 'a' component of an Affine transform. */\nexport function a(affine) {\n return affine[0];\n}\n/** Get the 'b' component of an Affine transform. */\nexport function b(affine) {\n return affine[1];\n}\n/** Get the 'c' component of an Affine transform. */\nexport function c(affine) {\n return affine[2];\n}\n/** Get the 'd' component of an Affine transform. */\nexport function d(affine) {\n return affine[3];\n}\n/** Get the 'e' component of an Affine transform. */\nexport function e(affine) {\n return affine[4];\n}\n/** Get the 'f' component of an Affine transform. */\nexport function f(affine) {\n return affine[5];\n}\n//# sourceMappingURL=affine.js.map","import * as affine from \"@developmentseed/affine\";\n/**\n * A {@link TilesetLevel} described by a single affine transform plus tile and\n * array sizes.\n *\n * This handles axis-aligned, rotated, skewed, and non-square-pixel grids\n * uniformly. Sources that fit this shape (tiled GeoTIFF overviews, GeoZarr\n * multiscales) can construct one of these per resolution level instead of\n * implementing {@link TilesetLevel} manually.\n */\nexport class AffineTilesetLevel {\n tileWidth;\n tileHeight;\n matrixWidth;\n matrixHeight;\n metersPerPixel;\n /**\n * Source-CRS bounding box of the level's array `[minX, minY, maxX, maxY]`.\n * Computed from the affine applied to the four array corners.\n */\n projectedBounds;\n _affine;\n _invAffine;\n constructor(options) {\n this._affine = options.affine;\n this._invAffine = affine.invert(options.affine);\n this.tileWidth = options.tileWidth;\n this.tileHeight = options.tileHeight;\n this.matrixWidth = Math.ceil(options.arrayWidth / options.tileWidth);\n this.matrixHeight = Math.ceil(options.arrayHeight / options.tileHeight);\n // Geometric mean of the two pixel-edge scales handles non-square pixels.\n const a = affine.a(options.affine);\n const e = affine.e(options.affine);\n this.metersPerPixel = Math.sqrt(Math.abs(a * e)) * options.mpu;\n const corners = [\n affine.apply(options.affine, 0, 0),\n affine.apply(options.affine, options.arrayWidth, 0),\n affine.apply(options.affine, 0, options.arrayHeight),\n affine.apply(options.affine, options.arrayWidth, options.arrayHeight),\n ];\n const xs = corners.map(([x]) => x);\n const ys = corners.map(([, y]) => y);\n this.projectedBounds = [\n Math.min(...xs),\n Math.min(...ys),\n Math.max(...xs),\n Math.max(...ys),\n ];\n }\n projectedTileCorners(col, row) {\n const tw = this.tileWidth;\n const th = this.tileHeight;\n const af = this._affine;\n return {\n topLeft: affine.apply(af, col * tw, row * th),\n topRight: affine.apply(af, (col + 1) * tw, row * th),\n bottomLeft: affine.apply(af, col * tw, (row + 1) * th),\n bottomRight: affine.apply(af, (col + 1) * tw, (row + 1) * th),\n };\n }\n tileTransform(col, row) {\n const tileOffset = affine.translation(col * this.tileWidth, row * this.tileHeight);\n const tileAffine = affine.compose(this._affine, tileOffset);\n const invTileAffine = affine.invert(tileAffine);\n return {\n forwardTransform: (x, y) => affine.apply(tileAffine, x, y),\n inverseTransform: (x, y) => affine.apply(invTileAffine, x, y),\n };\n }\n crsBoundsToTileRange(projectedMinX, projectedMinY, projectedMaxX, projectedMaxY) {\n // Map all four CRS corners through the inverse affine to get pixel coords,\n // then take the bbox in pixel space (handles rotation correctly).\n const inv = this._invAffine;\n const pixelCorners = [\n affine.apply(inv, projectedMinX, projectedMinY),\n affine.apply(inv, projectedMaxX, projectedMinY),\n affine.apply(inv, projectedMinX, projectedMaxY),\n affine.apply(inv, projectedMaxX, projectedMaxY),\n ];\n const xs = pixelCorners.map(([px]) => px);\n const ys = pixelCorners.map(([, py]) => py);\n const pixMinX = Math.min(...xs);\n const pixMaxX = Math.max(...xs);\n const pixMinY = Math.min(...ys);\n const pixMaxY = Math.max(...ys);\n const tw = this.tileWidth;\n const th = this.tileHeight;\n const maxColIdx = this.matrixWidth - 1;\n const maxRowIdx = this.matrixHeight - 1;\n // Asymmetric clamping: only clamp minCol/minRow up from below and\n // maxCol/maxRow down from above. If the bbox lies entirely outside the\n // array, this produces an empty range (min > max) so the consumer's\n // `for (i = min; i <= max; i++)` loop does nothing.\n const minCol = Math.max(0, Math.floor(pixMinX / tw));\n const maxCol = Math.min(maxColIdx, Math.floor(pixMaxX / tw));\n const minRow = Math.max(0, Math.floor(pixMinY / th));\n const maxRow = Math.min(maxRowIdx, Math.floor(pixMaxY / th));\n return { minCol, maxCol, minRow, maxRow };\n }\n}\n//# sourceMappingURL=affine-tileset-level.js.map","/**\n * Coefficient to convert the coordinate reference system (CRS)\n * units into meters (metersPerUnit).\n *\n * From note g in http://docs.opengeospatial.org/is/17-083r2/17-083r2.html#table_2:\n *\n * > If the CRS uses meters as units of measure for the horizontal dimensions,\n * > then metersPerUnit=1; if it has degrees, then metersPerUnit=2pa/360\n * > (a is the Earth maximum radius of the ellipsoid).\n *\n * @param unit - The unit of the CRS.\n * @param semiMajorAxis - The semi-major axis of the ellipsoid, required if unit is 'degree'.\n * @returns The meters per unit conversion factor.\n */\n// https://github.com/developmentseed/morecantile/blob/7c95a11c491303700d6e33e9c1607f2719584dec/morecantile/utils.py#L67-L90\nexport function metersPerUnit(unit, { semiMajorAxis } = {}) {\n unit = unit.toLowerCase();\n switch (unit) {\n case \"m\":\n case \"metre\":\n case \"meter\":\n case \"meters\":\n return 1;\n case \"foot\":\n return 0.3048;\n case \"us survey foot\":\n return 1200 / 3937;\n }\n if (unit === \"degree\") {\n // 2 * π * ellipsoid semi-major-axis / 360\n if (semiMajorAxis === undefined) {\n throw new Error(\"CRS with degrees unit requires ellipsoid semi-major-axis\");\n }\n return (2 * Math.PI * semiMajorAxis) / 360;\n }\n throw new Error(`Unsupported CRS units: ${unit} when computing metersPerUnit.`);\n}\n//# sourceMappingURL=meters-per-unit.js.map","class PROJJSONBuilderBase {\n static getId(node) {\n const idNode = node.find((child) => Array.isArray(child) && child[0] === 'ID');\n if (idNode && idNode.length >= 3) {\n return {\n authority: idNode[1],\n code: parseInt(idNode[2], 10),\n };\n }\n return null;\n }\n\n static convertUnit(node, type = 'unit') {\n if (!node || node.length < 3) {\n return { type, name: 'unknown', conversion_factor: null };\n }\n\n const name = node[1];\n const conversionFactor = parseFloat(node[2]) || null;\n\n const idNode = node.find((child) => Array.isArray(child) && child[0] === 'ID');\n const id = idNode\n ? {\n authority: idNode[1],\n code: parseInt(idNode[2], 10),\n }\n : null;\n\n return {\n type,\n name,\n conversion_factor: conversionFactor,\n id,\n };\n }\n\n static convertAxis(node) {\n const name = node[1] || 'Unknown';\n\n // Determine the direction\n let direction;\n const abbreviationMatch = name.match(/^\\((.)\\)$/); // Match abbreviations like \"(E)\" or \"(N)\"\n if (abbreviationMatch) {\n // Use the abbreviation to determine the direction\n const abbreviation = abbreviationMatch[1].toUpperCase();\n if (abbreviation === 'E') direction = 'east';\n else if (abbreviation === 'N') direction = 'north';\n else if (abbreviation === 'U') direction = 'up';\n else if (node[2]) direction = node[2];\n else throw new Error(`Unknown axis abbreviation: ${abbreviation}`);\n } else {\n // Use the explicit direction provided in the AXIS node\n direction = node[2] || 'unknown';\n }\n\n const orderNode = node.find((child) => Array.isArray(child) && child[0] === 'ORDER');\n const order = orderNode ? parseInt(orderNode[1], 10) : null;\n\n const unitNode = node.find(\n (child) =>\n Array.isArray(child) &&\n (child[0] === 'LENGTHUNIT' || child[0] === 'ANGLEUNIT' || child[0] === 'SCALEUNIT')\n );\n const unit = this.convertUnit(unitNode);\n\n return {\n name,\n direction, // Use the valid PROJJSON direction value\n unit,\n order,\n };\n }\n\n static extractAxes(node) {\n return node\n .filter((child) => Array.isArray(child) && child[0] === 'AXIS')\n .map((axis) => this.convertAxis(axis))\n .sort((a, b) => (a.order || 0) - (b.order || 0)); // Sort by the \"order\" property\n }\n\n static convert(node, result = {}) {\n\n switch (node[0]) {\n case 'PROJCRS':\n result.type = 'ProjectedCRS';\n result.name = node[1];\n result.base_crs = node.find((child) => Array.isArray(child) && child[0] === 'BASEGEOGCRS')\n ? this.convert(node.find((child) => Array.isArray(child) && child[0] === 'BASEGEOGCRS'))\n : null;\n result.conversion = node.find((child) => Array.isArray(child) && child[0] === 'CONVERSION')\n ? this.convert(node.find((child) => Array.isArray(child) && child[0] === 'CONVERSION'))\n : null;\n\n const csNode = node.find((child) => Array.isArray(child) && child[0] === 'CS');\n if (csNode) {\n result.coordinate_system = {\n type: csNode[1],\n axis: this.extractAxes(node),\n };\n }\n\n const lengthUnitNode = node.find((child) => Array.isArray(child) && child[0] === 'LENGTHUNIT');\n if (lengthUnitNode) {\n const unit = this.convertUnit(lengthUnitNode);\n result.coordinate_system.unit = unit; // Add unit to coordinate_system\n }\n\n result.id = this.getId(node);\n break;\n\n case 'BASEGEOGCRS':\n case 'GEOGCRS':\n case 'GEODCRS':\n result.type = node[0] === 'GEODCRS' ? 'GeodeticCRS' : 'GeographicCRS';\n result.name = node[1];\n \n // Handle DATUM or ENSEMBLE\n const datumOrEnsembleNode = node.find(\n (child) => Array.isArray(child) && (child[0] === 'DATUM' || child[0] === 'ENSEMBLE')\n );\n if (datumOrEnsembleNode) {\n const datumOrEnsemble = this.convert(datumOrEnsembleNode);\n if (datumOrEnsembleNode[0] === 'ENSEMBLE') {\n result.datum_ensemble = datumOrEnsemble;\n } else {\n result.datum = datumOrEnsemble;\n }\n const primem = node.find((child) => Array.isArray(child) && child[0] === 'PRIMEM');\n if (primem && primem[1] !== 'Greenwich') {\n datumOrEnsemble.prime_meridian = {\n name: primem[1],\n longitude: parseFloat(primem[2]),\n }\n }\n }\n \n result.coordinate_system = {\n type: 'ellipsoidal',\n axis: this.extractAxes(node),\n };\n \n result.id = this.getId(node);\n break;\n\n case 'DATUM':\n result.type = 'GeodeticReferenceFrame';\n result.name = node[1];\n result.ellipsoid = node.find((child) => Array.isArray(child) && child[0] === 'ELLIPSOID')\n ? this.convert(node.find((child) => Array.isArray(child) && child[0] === 'ELLIPSOID'))\n : null;\n break;\n \n case 'ENSEMBLE':\n result.type = 'DatumEnsemble';\n result.name = node[1];\n \n // Extract ensemble members\n result.members = node\n .filter((child) => Array.isArray(child) && child[0] === 'MEMBER')\n .map((member) => ({\n type: 'DatumEnsembleMember',\n name: member[1],\n id: this.getId(member), // Extract ID as { authority, code }\n }));\n \n // Extract accuracy\n const accuracyNode = node.find((child) => Array.isArray(child) && child[0] === 'ENSEMBLEACCURACY');\n if (accuracyNode) {\n result.accuracy = parseFloat(accuracyNode[1]);\n }\n \n // Extract ellipsoid\n const ellipsoidNode = node.find((child) => Array.isArray(child) && child[0] === 'ELLIPSOID');\n if (ellipsoidNode) {\n result.ellipsoid = this.convert(ellipsoidNode); // Convert the ellipsoid node\n }\n \n // Extract identifier for the ensemble\n result.id = this.getId(node);\n break;\n\n case 'ELLIPSOID':\n result.type = 'Ellipsoid';\n result.name = node[1];\n result.semi_major_axis = parseFloat(node[2]);\n result.inverse_flattening = parseFloat(node[3]);\n const units = node.find((child) => Array.isArray(child) && child[0] === 'LENGTHUNIT')\n ? this.convert(node.find((child) => Array.isArray(child) && child[0] === 'LENGTHUNIT'), result)\n : null;\n break;\n\n case 'CONVERSION':\n result.type = 'Conversion';\n result.name = node[1];\n result.method = node.find((child) => Array.isArray(child) && child[0] === 'METHOD')\n ? this.convert(node.find((child) => Array.isArray(child) && child[0] === 'METHOD'))\n : null;\n result.parameters = node\n .filter((child) => Array.isArray(child) && child[0] === 'PARAMETER')\n .map((param) => this.convert(param));\n break;\n\n case 'METHOD':\n result.type = 'Method';\n result.name = node[1];\n result.id = this.getId(node);\n break;\n\n case 'PARAMETER':\n result.type = 'Parameter';\n result.name = node[1];\n result.value = parseFloat(node[2]);\n result.unit = this.convertUnit(\n node.find(\n (child) =>\n Array.isArray(child) &&\n (child[0] === 'LENGTHUNIT' || child[0] === 'ANGLEUNIT' || child[0] === 'SCALEUNIT')\n )\n );\n result.id = this.getId(node);\n break;\n\n case 'BOUNDCRS':\n result.type = 'BoundCRS';\n\n // Process SOURCECRS\n const sourceCrsNode = node.find((child) => Array.isArray(child) && child[0] === 'SOURCECRS');\n if (sourceCrsNode) {\n const sourceCrsContent = sourceCrsNode.find((child) => Array.isArray(child));\n result.source_crs = sourceCrsContent ? this.convert(sourceCrsContent) : null;\n }\n\n // Process TARGETCRS\n const targetCrsNode = node.find((child) => Array.isArray(child) && child[0] === 'TARGETCRS');\n if (targetCrsNode) {\n const targetCrsContent = targetCrsNode.find((child) => Array.isArray(child));\n result.target_crs = targetCrsContent ? this.convert(targetCrsContent) : null;\n }\n\n // Process ABRIDGEDTRANSFORMATION\n const transformationNode = node.find((child) => Array.isArray(child) && child[0] === 'ABRIDGEDTRANSFORMATION');\n if (transformationNode) {\n result.transformation = this.convert(transformationNode);\n } else {\n result.transformation = null;\n }\n break;\n\n case 'ABRIDGEDTRANSFORMATION':\n result.type = 'Transformation';\n result.name = node[1];\n result.method = node.find((child) => Array.isArray(child) && child[0] === 'METHOD')\n ? this.convert(node.find((child) => Array.isArray(child) && child[0] === 'METHOD'))\n : null;\n\n result.parameters = node\n .filter((child) => Array.isArray(child) && (child[0] === 'PARAMETER' || child[0] === 'PARAMETERFILE'))\n .map((param) => {\n if (param[0] === 'PARAMETER') {\n return this.convert(param);\n } else if (param[0] === 'PARAMETERFILE') {\n return {\n name: param[1],\n value: param[2],\n id: {\n 'authority': 'EPSG',\n 'code': 8656\n }\n };\n }\n });\n\n // Adjust the Scale difference parameter if present\n if (result.parameters.length === 7) {\n const scaleDifference = result.parameters[6];\n if (scaleDifference.name === 'Scale difference') {\n scaleDifference.value = Math.round((scaleDifference.value - 1) * 1e12) / 1e6;\n }\n }\n\n result.id = this.getId(node);\n break;\n \n case 'AXIS':\n if (!result.coordinate_system) {\n result.coordinate_system = { type: 'unspecified', axis: [] };\n }\n result.coordinate_system.axis.push(this.convertAxis(node));\n break;\n \n case 'LENGTHUNIT':\n const unit = this.convertUnit(node, 'LinearUnit');\n if (result.coordinate_system && result.coordinate_system.axis) {\n result.coordinate_system.axis.forEach((axis) => {\n if (!axis.unit) {\n axis.unit = unit;\n }\n });\n }\n if (unit.conversion_factor && unit.conversion_factor !== 1) {\n if (result.semi_major_axis) {\n result.semi_major_axis = {\n value: result.semi_major_axis,\n unit,\n }\n }\n }\n break;\n\n default:\n result.keyword = node[0];\n break;\n }\n\n return result;\n }\n}\n\nexport default PROJJSONBuilderBase;","import PROJJSONBuilderBase from './PROJJSONBuilderBase.js';\n\nclass PROJJSONBuilder2015 extends PROJJSONBuilderBase {\n static convert(node, result = {}) {\n super.convert(node, result);\n\n // Skip `CS` and `USAGE` nodes for WKT2-2015\n if (result.coordinate_system && result.coordinate_system.subtype === 'Cartesian') {\n delete result.coordinate_system;\n }\n if (result.usage) {\n delete result.usage;\n }\n\n return result;\n }\n}\n\nexport default PROJJSONBuilder2015;","import PROJJSONBuilderBase from './PROJJSONBuilderBase.js';\n\nclass PROJJSONBuilder2019 extends PROJJSONBuilderBase {\n static convert(node, result = {}) {\n super.convert(node, result);\n\n // Handle `CS` node for WKT2-2019\n const csNode = node.find((child) => Array.isArray(child) && child[0] === 'CS');\n if (csNode) {\n result.coordinate_system = {\n subtype: csNode[1],\n axis: this.extractAxes(node),\n };\n }\n\n // Handle `USAGE` node for WKT2-2019\n const usageNode = node.find((child) => Array.isArray(child) && child[0] === 'USAGE');\n if (usageNode) {\n const scope = usageNode.find((child) => Array.isArray(child) && child[0] === 'SCOPE');\n const area = usageNode.find((child) => Array.isArray(child) && child[0] === 'AREA');\n const bbox = usageNode.find((child) => Array.isArray(child) && child[0] === 'BBOX');\n result.usage = {};\n if (scope) {\n result.usage.scope = scope[1];\n }\n if (area) {\n result.usage.area = area[1];\n }\n if (bbox) {\n result.usage.bbox = bbox.slice(1);\n }\n }\n\n return result;\n }\n}\n\nexport default PROJJSONBuilder2019;","import PROJJSONBuilder2015 from './PROJJSONBuilder2015.js';\nimport PROJJSONBuilder2019 from './PROJJSONBuilder2019.js';\n\n/**\n * Detects the WKT2 version based on the structure of the WKT.\n * @param {Array} root The root WKT array node.\n * @returns {string} The detected version (\"2015\" or \"2019\").\n */\nfunction detectWKT2Version(root) {\n // Check for WKT2-2019-specific nodes\n if (root.find((child) => Array.isArray(child) && child[0] === 'USAGE')) {\n return '2019'; // `USAGE` is specific to WKT2-2019\n }\n\n // Check for WKT2-2015-specific nodes\n if (root.find((child) => Array.isArray(child) && child[0] === 'CS')) {\n return '2015'; // `CS` is valid in both, but default to 2015 unless `USAGE` is present\n }\n\n if (root[0] === 'BOUNDCRS' || root[0] === 'PROJCRS' || root[0] === 'GEOGCRS') {\n return '2015'; // These are valid in both, but default to 2015\n }\n\n // Default to WKT2-2015 if no specific indicators are found\n return '2015';\n}\n\n/**\n * Builds a PROJJSON object from a WKT array structure.\n * @param {Array} root The root WKT array node.\n * @returns {Object} The PROJJSON object.\n */\nexport function buildPROJJSON(root) {\n const version = detectWKT2Version(root);\n const builder = version === '2019' ? PROJJSONBuilder2019 : PROJJSONBuilder2015;\n return builder.convert(root);\n}\n","/**\n * Detects whether the WKT string is WKT1 or WKT2.\n * @param {string} wkt The WKT string.\n * @returns {string} The detected version (\"WKT1\" or \"WKT2\").\n */\nexport function detectWKTVersion(wkt) {\n // Normalize the WKT string for easier keyword matching\n const normalizedWKT = wkt.toUpperCase();\n\n // Check for WKT2-specific keywords\n if (\n normalizedWKT.includes('PROJCRS') ||\n normalizedWKT.includes('GEOGCRS') ||\n normalizedWKT.includes('BOUNDCRS') ||\n normalizedWKT.includes('VERTCRS') ||\n normalizedWKT.includes('LENGTHUNIT') ||\n normalizedWKT.includes('ANGLEUNIT') ||\n normalizedWKT.includes('SCALEUNIT')\n ) {\n return 'WKT2';\n }\n\n // Check for WKT1-specific keywords\n if (\n normalizedWKT.includes('PROJCS') ||\n normalizedWKT.includes('GEOGCS') ||\n normalizedWKT.includes('LOCAL_CS') ||\n normalizedWKT.includes('VERT_CS') ||\n normalizedWKT.includes('UNIT')\n ) {\n return 'WKT1';\n }\n\n // Default to WKT1 if no specific indicators are found\n return 'WKT1';\n}","export default parseString;\n\nvar NEUTRAL = 1;\nvar KEYWORD = 2;\nvar NUMBER = 3;\nvar QUOTED = 4;\nvar AFTERQUOTE = 5;\nvar ENDED = -1;\nvar whitespace = /\\s/;\nvar latin = /[A-Za-z]/;\nvar keyword = /[A-Za-z84_]/;\nvar endThings = /[,\\]]/;\nvar digets = /[\\d\\.E\\-\\+]/;\n// const ignoredChar = /[\\s_\\-\\/\\(\\)]/g;\nfunction Parser(text) {\n if (typeof text !== 'string') {\n throw new Error('not a string');\n }\n this.text = text.trim();\n this.level = 0;\n this.place = 0;\n this.root = null;\n this.stack = [];\n this.currentObject = null;\n this.state = NEUTRAL;\n}\nParser.prototype.readCharicter = function() {\n var char = this.text[this.place++];\n if (this.state !== QUOTED) {\n while (whitespace.test(char)) {\n if (this.place >= this.text.length) {\n return;\n }\n char = this.text[this.place++];\n }\n }\n switch (this.state) {\n case NEUTRAL:\n return this.neutral(char);\n case KEYWORD:\n return this.keyword(char)\n case QUOTED:\n return this.quoted(char);\n case AFTERQUOTE:\n return this.afterquote(char);\n case NUMBER:\n return this.number(char);\n case ENDED:\n return;\n }\n};\nParser.prototype.afterquote = function(char) {\n if (char === '\"') {\n this.word += '\"';\n this.state = QUOTED;\n return;\n }\n if (endThings.test(char)) {\n this.word = this.word.trim();\n this.afterItem(char);\n return;\n }\n throw new Error('havn\\'t handled \"' +char + '\" in afterquote yet, index ' + this.place);\n};\nParser.prototype.afterItem = function(char) {\n if (char === ',') {\n if (this.word !== null) {\n this.currentObject.push(this.word);\n }\n this.word = null;\n this.state = NEUTRAL;\n return;\n }\n if (char === ']') {\n this.level--;\n if (this.word !== null) {\n this.currentObject.push(this.word);\n this.word = null;\n }\n this.state = NEUTRAL;\n this.currentObject = this.stack.pop();\n if (!this.currentObject) {\n this.state = ENDED;\n }\n\n return;\n }\n};\nParser.prototype.number = function(char) {\n if (digets.test(char)) {\n this.word += char;\n return;\n }\n if (endThings.test(char)) {\n this.word = parseFloat(this.word);\n this.afterItem(char);\n return;\n }\n throw new Error('havn\\'t handled \"' +char + '\" in number yet, index ' + this.place);\n};\nParser.prototype.quoted = function(char) {\n if (char === '\"') {\n this.state = AFTERQUOTE;\n return;\n }\n this.word += char;\n return;\n};\nParser.prototype.keyword = function(char) {\n if (keyword.test(char)) {\n this.word += char;\n return;\n }\n if (char === '[') {\n var newObjects = [];\n newObjects.push(this.word);\n this.level++;\n if (this.root === null) {\n this.root = newObjects;\n } else {\n this.currentObject.push(newObjects);\n }\n this.stack.push(this.currentObject);\n this.currentObject = newObjects;\n this.state = NEUTRAL;\n return;\n }\n if (endThings.test(char)) {\n this.afterItem(char);\n return;\n }\n throw new Error('havn\\'t handled \"' +char + '\" in keyword yet, index ' + this.place);\n};\nParser.prototype.neutral = function(char) {\n if (latin.test(char)) {\n this.word = char;\n this.state = KEYWORD;\n return;\n }\n if (char === '\"') {\n this.word = '';\n this.state = QUOTED;\n return;\n }\n if (digets.test(char)) {\n this.word = char;\n this.state = NUMBER;\n return;\n }\n if (endThings.test(char)) {\n this.afterItem(char);\n return;\n }\n throw new Error('havn\\'t handled \"' +char + '\" in neutral yet, index ' + this.place);\n};\nParser.prototype.output = function() {\n while (this.place < this.text.length) {\n this.readCharicter();\n }\n if (this.state === ENDED) {\n return this.root;\n }\n throw new Error('unable to parse string \"' +this.text + '\". State is ' + this.state);\n};\n\nfunction parseString(txt) {\n var parser = new Parser(txt);\n return parser.output();\n}\n","\n\nfunction mapit(obj, key, value) {\n if (Array.isArray(key)) {\n value.unshift(key);\n key = null;\n }\n var thing = key ? {} : obj;\n\n var out = value.reduce(function(newObj, item) {\n sExpr(item, newObj);\n return newObj\n }, thing);\n if (key) {\n obj[key] = out;\n }\n}\n\nexport function sExpr(v, obj) {\n if (!Array.isArray(v)) {\n obj[v] = true;\n return;\n }\n var key = v.shift();\n if (key === 'PARAMETER') {\n key = v.shift();\n }\n if (v.length === 1) {\n if (Array.isArray(v[0])) {\n obj[key] = {};\n sExpr(v[0], obj[key]);\n return;\n }\n obj[key] = v[0];\n return;\n }\n if (!v.length) {\n obj[key] = true;\n return;\n }\n if (key === 'TOWGS84') {\n obj[key] = v;\n return;\n }\n if (key === 'AXIS') {\n if (!(key in obj)) {\n obj[key] = [];\n }\n obj[key].push(v);\n return;\n }\n if (!Array.isArray(key)) {\n obj[key] = {};\n }\n\n var i;\n switch (key) {\n case 'UNIT':\n case 'PRIMEM':\n case 'VERT_DATUM':\n obj[key] = {\n name: v[0].toLowerCase(),\n convert: v[1]\n };\n if (v.length === 3) {\n sExpr(v[2], obj[key]);\n }\n return;\n case 'SPHEROID':\n case 'ELLIPSOID':\n obj[key] = {\n name: v[0],\n a: v[1],\n rf: v[2]\n };\n if (v.length === 4) {\n sExpr(v[3], obj[key]);\n }\n return;\n case 'EDATUM':\n case 'ENGINEERINGDATUM':\n case 'LOCAL_DATUM':\n case 'DATUM':\n case 'VERT_CS':\n case 'VERTCRS':\n case 'VERTICALCRS':\n v[0] = ['name', v[0]];\n mapit(obj, key, v);\n return;\n case 'COMPD_CS':\n case 'COMPOUNDCRS':\n case 'FITTED_CS':\n // the followings are the crs defined in\n // https://github.com/proj4js/proj4js/blob/1da4ed0b865d0fcb51c136090569210cdcc9019e/lib/parseCode.js#L11\n case 'PROJECTEDCRS':\n case 'PROJCRS':\n case 'GEOGCS':\n case 'GEOCCS':\n case 'PROJCS':\n case 'LOCAL_CS':\n case 'GEODCRS':\n case 'GEODETICCRS':\n case 'GEODETICDATUM':\n case 'ENGCRS':\n case 'ENGINEERINGCRS':\n v[0] = ['name', v[0]];\n mapit(obj, key, v);\n obj[key].type = key;\n return;\n default:\n i = -1;\n while (++i < v.length) {\n if (!Array.isArray(v[i])) {\n return sExpr(v, obj[key]);\n }\n }\n return mapit(obj, key, v);\n }\n}\n","var D2R = 0.01745329251994329577;\n\nexport function d2r(input) {\n return input * D2R;\n}\n\nexport function applyProjectionDefaults(wkt) {\n // Normalize projName for WKT2 compatibility\n const normalizedProjName = (wkt.projName || '').toLowerCase().replace(/_/g, ' ');\n\n if (wkt.long0 === undefined && wkt.longc !== undefined) {\n wkt.long0 = wkt.longc; // keep in the projection's native prime meridian frame\n }\n if (!wkt.lat_ts && wkt.lat1 && (normalizedProjName === 'stereographic south pole' || normalizedProjName === 'polar stereographic (variant b)')) {\n wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);\n wkt.lat_ts = wkt.lat1;\n delete wkt.lat1;\n } else if (!wkt.lat_ts && wkt.lat0 && (normalizedProjName === 'polar stereographic' || normalizedProjName === 'polar stereographic (variant a)')) {\n wkt.lat_ts = wkt.lat0;\n wkt.lat0 = d2r(wkt.lat0 > 0 ? 90 : -90);\n delete wkt.lat1;\n }\n}","import { applyProjectionDefaults } from './util.js';\n\n// Helper function to process units and to_meter\nfunction processUnit(unit) {\n let result = { units: null, to_meter: undefined };\n\n if (typeof unit === 'string') {\n result.units = unit.toLowerCase();\n if (result.units === 'metre') {\n result.units = 'meter'; // Normalize 'metre' to 'meter'\n }\n if (result.units === 'meter') {\n result.to_meter = 1; // Only set to_meter if units are 'meter'\n }\n } else if (unit && unit.name) {\n result.units = unit.name.toLowerCase();\n if (result.units === 'metre') {\n result.units = 'meter'; // Normalize 'metre' to 'meter'\n }\n result.to_meter = unit.conversion_factor;\n }\n\n return result;\n}\n\nfunction toValue(valueOrObject) {\n if (typeof valueOrObject === 'object') {\n return valueOrObject.value * valueOrObject.unit.conversion_factor;\n }\n return valueOrObject;\n}\n\nfunction calculateEllipsoid(value, result) {\n if (value.ellipsoid.radius) {\n result.a = value.ellipsoid.radius;\n result.rf = 0;\n } else {\n result.a = toValue(value.ellipsoid.semi_major_axis);\n if (value.ellipsoid.inverse_flattening !== undefined) {\n result.rf = value.ellipsoid.inverse_flattening;\n } else if (value.ellipsoid.semi_major_axis !== undefined && value.ellipsoid.semi_minor_axis !== undefined) {\n result.rf = result.a / (result.a - toValue(value.ellipsoid.semi_minor_axis));\n }\n }\n}\n\nexport function transformPROJJSON(projjson, result = {}) {\n if (!projjson || typeof projjson !== 'object') {\n return projjson; // Return primitive values as-is\n }\n\n if (projjson.type === 'BoundCRS') {\n transformPROJJSON(projjson.source_crs, result);\n\n if (projjson.transformation) {\n if (projjson.transformation.method && projjson.transformation.method.name === 'NTv2') {\n // Set nadgrids to the filename from the parameterfile\n result.nadgrids = projjson.transformation.parameters[0].value;\n } else {\n // Populate datum_params if no parameterfile is found\n result.datum_params = projjson.transformation.parameters.map((param) => param.value);\n }\n }\n return result; // Return early for BoundCRS\n }\n\n // Handle specific keys in PROJJSON\n Object.keys(projjson).forEach((key) => {\n const value = projjson[key];\n if (value === null) {\n return;\n }\n\n switch (key) {\n case 'name':\n if (result.srsCode) {\n break;\n }\n result.name = value;\n result.srsCode = value; // Map `name` to `srsCode`\n break;\n\n case 'type':\n if (value === 'GeographicCRS') {\n result.projName = 'longlat';\n } else if (value === 'GeodeticCRS') {\n if (projjson.coordinate_system && projjson.coordinate_system.subtype === 'Cartesian') {\n result.projName = 'geocent';\n } else {\n result.projName = 'longlat';\n }\n } else if (value === 'ProjectedCRS' && projjson.conversion && projjson.conversion.method) {\n result.projName = projjson.conversion.method.name; // Retain original capitalization\n }\n break;\n\n case 'datum':\n case 'datum_ensemble': // Handle both datum and ensemble\n if (value.ellipsoid) {\n // Extract ellipsoid properties\n result.ellps = value.ellipsoid.name;\n calculateEllipsoid(value, result);\n }\n if (value.prime_meridian) {\n result.from_greenwich = value.prime_meridian.longitude * Math.PI / 180; // Convert to radians\n }\n break;\n\n case 'ellipsoid':\n result.ellps = value.name;\n calculateEllipsoid(value, result);\n break;\n\n case 'prime_meridian':\n result.long0 = (value.longitude || 0) * Math.PI / 180; // Convert to radians\n break;\n\n case 'coordinate_system':\n if (value.axis) {\n const directionMap = {\n 'east': 'e',\n 'north': 'n',\n 'west': 'w',\n 'south': 's',\n 'up': 'u',\n 'down': 'd',\n 'geocentricx': 'e',\n 'geocentricy': 'n',\n 'geocentricz': 'u',\n };\n const mapped = value.axis.map((axis) => directionMap[axis.direction.toLowerCase()]);\n if (mapped.every(Boolean)) {\n result.axis = mapped.join('');\n if (result.axis.length === 2) {\n result.axis += 'u';\n }\n }\n\n if (value.unit) {\n const { units, to_meter } = processUnit(value.unit);\n result.units = units;\n result.to_meter = to_meter;\n } else if (value.axis[0] && value.axis[0].unit) {\n const { units, to_meter } = processUnit(value.axis[0].unit);\n result.units = units;\n result.to_meter = to_meter;\n }\n }\n break;\n \n case 'id':\n if (value.authority && value.code) {\n result.title = value.authority + ':' + value.code;\n }\n break;\n\n case 'conversion':\n if (value.method && value.method.name) {\n result.projName = value.method.name; // Retain original capitalization\n }\n if (value.parameters) {\n value.parameters.forEach((param) => {\n const paramName = param.name.toLowerCase().replace(/\\s+/g, '_');\n const paramValue = param.value;\n if (param.unit && param.unit.conversion_factor) {\n result[paramName] = paramValue * param.unit.conversion_factor; // Convert to radians or meters\n } else if (param.unit === 'degree') {\n result[paramName] = paramValue * Math.PI / 180; // Convert to radians\n } else {\n result[paramName] = paramValue;\n }\n });\n }\n break;\n\n case 'unit':\n if (value.name) {\n result.units = value.name.toLowerCase();\n if (result.units === 'metre') {\n result.units = 'meter';\n }\n }\n if (value.conversion_factor) {\n result.to_meter = value.conversion_factor;\n }\n break;\n\n case 'base_crs':\n transformPROJJSON(value, result); // Pass `result` directly\n result.datumCode = value.id ? value.id.authority + '_' + value.id.code : value.name; // Set datumCode\n break;\n\n default:\n // Ignore irrelevant or unneeded properties\n break;\n }\n });\n\n // Additional calculated properties\n if (result.latitude_of_false_origin !== undefined) {\n result.lat0 = result.latitude_of_false_origin; // Already in radians\n }\n if (result.longitude_of_false_origin !== undefined) {\n result.long0 = result.longitude_of_false_origin;\n }\n if (result.latitude_of_standard_parallel !== undefined) {\n result.lat0 = result.latitude_of_standard_parallel;\n result.lat1 = result.latitude_of_standard_parallel;\n }\n if (result.latitude_of_1st_standard_parallel !== undefined) {\n result.lat1 = result.latitude_of_1st_standard_parallel;\n }\n if (result.latitude_of_2nd_standard_parallel !== undefined) {\n result.lat2 = result.latitude_of_2nd_standard_parallel; \n }\n if (result.latitude_of_projection_centre !== undefined) {\n result.lat0 = result.latitude_of_projection_centre;\n }\n if (result.longitude_of_projection_centre !== undefined) {\n result.longc = result.longitude_of_projection_centre;\n }\n if (result.easting_at_false_origin !== undefined) {\n result.x0 = result.easting_at_false_origin;\n }\n if (result.northing_at_false_origin !== undefined) {\n result.y0 = result.northing_at_false_origin;\n }\n if (result.latitude_of_natural_origin !== undefined) {\n result.lat0 = result.latitude_of_natural_origin;\n }\n if (result.longitude_of_natural_origin !== undefined) {\n result.long0 = result.longitude_of_natural_origin;\n }\n if (result.longitude_of_origin !== undefined) {\n result.long0 = result.longitude_of_origin;\n }\n if (result.false_easting !== undefined) {\n result.x0 = result.false_easting;\n }\n if (result.easting_at_projection_centre) {\n result.x0 = result.easting_at_projection_centre;\n }\n if (result.false_northing !== undefined) {\n result.y0 = result.false_northing;\n }\n if (result.northing_at_projection_centre) {\n result.y0 = result.northing_at_projection_centre;\n }\n if (result.standard_parallel_1 !== undefined) {\n result.lat1 = result.standard_parallel_1;\n }\n if (result.standard_parallel_2 !== undefined) {\n result.lat2 = result.standard_parallel_2;\n }\n if (result.scale_factor_at_natural_origin !== undefined) {\n result.k0 = result.scale_factor_at_natural_origin;\n }\n if (result.scale_factor_at_projection_centre !== undefined) {\n result.k0 = result.scale_factor_at_projection_centre;\n }\n if (result.scale_factor_on_pseudo_standard_parallel !== undefined) { \n result.k0 = result.scale_factor_on_pseudo_standard_parallel;\n }\n if (result.azimuth !== undefined) {\n result.alpha = result.azimuth;\n }\n if (result.azimuth_at_projection_centre !== undefined) {\n result.alpha = result.azimuth_at_projection_centre;\n }\n if (result.angle_from_rectified_to_skew_grid) {\n result.rectified_grid_angle = result.angle_from_rectified_to_skew_grid;\n }\n\n // Apply projection defaults\n applyProjectionDefaults(result);\n\n return result;\n}","import { buildPROJJSON } from './buildPROJJSON.js';\nimport { detectWKTVersion } from './detectWKTVersion.js';\nimport parser from './parser.js';\nimport {sExpr} from './process.js';\nimport { transformPROJJSON } from './transformPROJJSON.js';\nimport { applyProjectionDefaults, d2r } from './util.js';\n\nvar knownTypes = ['PROJECTEDCRS', 'PROJCRS', 'GEOGCS', 'GEOCCS', 'PROJCS', 'LOCAL_CS', 'GEODCRS',\n 'GEODETICCRS', 'GEODETICDATUM', 'ENGCRS', 'ENGINEERINGCRS'];\n\nfunction rename(obj, params) {\n var outName = params[0];\n var inName = params[1];\n if (!(outName in obj) && (inName in obj)) {\n obj[outName] = obj[inName];\n if (params.length === 3) {\n obj[outName] = params[2](obj[outName]);\n }\n }\n}\n\nfunction cleanWKT(wkt) {\n var keys = Object.keys(wkt);\n for (var i = 0, ii = keys.length; i <ii; ++i) {\n var key = keys[i];\n // the followings are the crs defined in\n // https://github.com/proj4js/proj4js/blob/1da4ed0b865d0fcb51c136090569210cdcc9019e/lib/parseCode.js#L11\n if (knownTypes.indexOf(key) !== -1) {\n setPropertiesFromWkt(wkt[key]);\n }\n if (typeof wkt[key] === 'object') {\n cleanWKT(wkt[key]);\n }\n }\n}\n\nfunction setPropertiesFromWkt(wkt) {\n if (wkt.AUTHORITY) {\n var authority = Object.keys(wkt.AUTHORITY)[0];\n if (authority && authority in wkt.AUTHORITY) {\n wkt.title = authority + ':' + wkt.AUTHORITY[authority];\n }\n }\n if (wkt.type === 'GEOGCS') {\n wkt.projName = 'longlat';\n } else if (wkt.type === 'LOCAL_CS') {\n wkt.projName = 'identity';\n wkt.local = true;\n } else {\n if (typeof wkt.PROJECTION === 'object') {\n wkt.projName = Object.keys(wkt.PROJECTION)[0];\n } else {\n wkt.projName = wkt.PROJECTION;\n }\n }\n if (wkt.AXIS) {\n var axisOrder = '';\n for (var i = 0, ii = wkt.AXIS.length; i < ii; ++i) {\n var axis = [wkt.AXIS[i][0].toLowerCase(), wkt.AXIS[i][1].toLowerCase()];\n if (axis[0].indexOf('north') !== -1 || ((axis[0] === 'y' || axis[0] === 'lat') && axis[1] === 'north')) {\n axisOrder += 'n';\n } else if (axis[0].indexOf('south') !== -1 || ((axis[0] === 'y' || axis[0] === 'lat') && axis[1] === 'south')) {\n axisOrder += 's';\n } else if (axis[0].indexOf('east') !== -1 || ((axis[0] === 'x' || axis[0] === 'lon') && axis[1] === 'east')) {\n axisOrder += 'e';\n } else if (axis[0].indexOf('west') !== -1 || ((axis[0] === 'x' || axis[0] === 'lon') && axis[1] === 'west')) {\n axisOrder += 'w';\n }\n }\n if (axisOrder.length === 2) {\n axisOrder += 'u';\n }\n if (axisOrder.length === 3) {\n wkt.axis = axisOrder;\n }\n }\n if (wkt.UNIT) {\n wkt.units = wkt.UNIT.name.toLowerCase();\n if (wkt.units === 'metre') {\n wkt.units = 'meter';\n }\n if (wkt.UNIT.convert) {\n if (wkt.type === 'GEOGCS') {\n if (wkt.DATUM && wkt.DATUM.SPHEROID) {\n wkt.to_meter = wkt.UNIT.convert*wkt.DATUM.SPHEROID.a;\n }\n } else {\n wkt.to_meter = wkt.UNIT.convert;\n }\n }\n }\n var geogcs = wkt.GEOGCS;\n if (wkt.type === 'GEOGCS') {\n geogcs = wkt;\n }\n if (geogcs) {\n if (geogcs.PRIMEM && geogcs.PRIMEM.convert) {\n wkt.from_greenwich = d2r(geogcs.PRIMEM.convert);\n }\n if (geogcs.DATUM) {\n wkt.datumCode = geogcs.DATUM.name.toLowerCase();\n } else {\n wkt.datumCode = geogcs.name.toLowerCase();\n }\n if (wkt.datumCode.slice(0, 2) === 'd_') {\n wkt.datumCode = wkt.datumCode.slice(2);\n }\n if (wkt.datumCode === 'new_zealand_1949') {\n wkt.datumCode = 'nzgd49';\n }\n if (wkt.datumCode === 'wgs_1984' || wkt.datumCode === 'world_geodetic_system_1984') {\n if (wkt.PROJECTION === 'Mercator_Auxiliary_Sphere') {\n wkt.sphere = true;\n }\n wkt.datumCode = 'wgs84';\n }\n if (wkt.datumCode === 'belge_1972') {\n wkt.datumCode = 'rnb72';\n }\n if (geogcs.DATUM && geogcs.DATUM.SPHEROID) {\n wkt.ellps = geogcs.DATUM.SPHEROID.name.replace('_19', '').replace(/[Cc]larke\\_18/, 'clrk');\n if (wkt.ellps.toLowerCase().slice(0, 13) === 'international') {\n wkt.ellps = 'intl';\n }\n\n wkt.a = geogcs.DATUM.SPHEROID.a;\n wkt.rf = parseFloat(geogcs.DATUM.SPHEROID.rf);\n }\n\n if (geogcs.DATUM && geogcs.DATUM.TOWGS84) {\n wkt.datum_params = geogcs.DATUM.TOWGS84;\n }\n if (~wkt.datumCode.indexOf('osgb_1936')) {\n wkt.datumCode = 'osgb36';\n }\n if (~wkt.datumCode.indexOf('osni_1952')) {\n wkt.datumCode = 'osni52';\n }\n if (~wkt.datumCode.indexOf('tm65')\n || ~wkt.datumCode.indexOf('geodetic_datum_of_1965')) {\n wkt.datumCode = 'ire65';\n }\n if (wkt.datumCode === 'ch1903+') {\n wkt.datumCode = 'ch1903';\n }\n if (~wkt.datumCode.indexOf('israel')) {\n wkt.datumCode = 'isr93';\n }\n }\n if (wkt.b && !isFinite(wkt.b)) {\n wkt.b = wkt.a;\n }\n if (wkt.rectified_grid_angle) {\n wkt.rectified_grid_angle = d2r(wkt.rectified_grid_angle);\n }\n\n function toMeter(input) {\n var ratio = wkt.to_meter || 1;\n return input * ratio;\n }\n var renamer = function(a) {\n return rename(wkt, a);\n };\n var list = [\n ['standard_parallel_1', 'Standard_Parallel_1'],\n ['standard_parallel_1', 'Latitude of 1st standard parallel'],\n ['standard_parallel_2', 'Standard_Parallel_2'],\n ['standard_parallel_2', 'Latitude of 2nd standard parallel'],\n ['false_easting', 'False_Easting'],\n ['false_easting', 'False easting'],\n ['false-easting', 'Easting at false origin'],\n ['false_northing', 'False_Northing'],\n ['false_northing', 'False northing'],\n ['false_northing', 'Northing at false origin'],\n ['central_meridian', 'Central_Meridian'],\n ['central_meridian', 'Longitude of natural origin'],\n ['central_meridian', 'Longitude of false origin'],\n ['latitude_of_origin', 'Latitude_Of_Origin'],\n ['latitude_of_origin', 'Central_Parallel'],\n ['latitude_of_origin', 'Latitude of natural origin'],\n ['latitude_of_origin', 'Latitude of false origin'],\n ['scale_factor', 'Scale_Factor'],\n ['k0', 'scale_factor'],\n ['latitude_of_center', 'Latitude_Of_Center'],\n ['latitude_of_center', 'Latitude_of_center'],\n ['lat0', 'latitude_of_center', d2r],\n ['longitude_of_center', 'Longitude_Of_Center'],\n ['longitude_of_center', 'Longitude_of_center'],\n ['longc', 'longitude_of_center', d2r],\n ['x0', 'false_easting', toMeter],\n ['y0', 'false_northing', toMeter],\n ['long0', 'central_meridian', d2r],\n ['lat0', 'latitude_of_origin', d2r],\n ['lat0', 'standard_parallel_1', d2r],\n ['lat1', 'standard_parallel_1', d2r],\n ['lat2', 'standard_parallel_2', d2r],\n ['azimuth', 'Azimuth'],\n ['alpha', 'azimuth', d2r],\n ['srsCode', 'name']\n ];\n list.forEach(renamer);\n applyProjectionDefaults(wkt);\n}\nexport default function(wkt) {\n if (typeof wkt === 'object') {\n return transformPROJJSON(wkt);\n }\n const version = detectWKTVersion(wkt);\n var lisp = parser(wkt);\n if (version === 'WKT2') {\n const projjson = buildPROJJSON(lisp);\n return transformPROJJSON(projjson);\n }\n var type = lisp[0];\n var obj = {};\n sExpr(lisp, obj);\n cleanWKT(obj);\n return obj[type];\n}\n","import wktParser from \"wkt-parser\";\n/**\n * Parse a WKT string or PROJJSON object into a proj4-compatible projection\n * definition.\n *\n * This is a typed wrapper around the `wkt-parser` package.\n */\nexport function parseWkt(input) {\n const def = wktParser(input);\n // wkt-parser doesn't always resolve per-axis units from GeographicCRS\n // PROJJSON, leaving units: \"unknown\". longlat is always degrees by definition.\n if (def.projName === \"longlat\" && (!def.units || def.units === \"unknown\")) {\n def.units = \"degree\";\n def.to_meter = undefined;\n }\n return def;\n}\n//# sourceMappingURL=parse-wkt.js.map","import { parseWkt } from \"./parse-wkt.js\";\n/**\n * A global registry holding parsed projection definitions.\n */\nexport const PROJECTION_REGISTRY = new Map();\nexport async function epsgResolver(epsg) {\n const key = `EPSG:${epsg}`;\n const cachedProj = PROJECTION_REGISTRY.get(key);\n if (cachedProj !== undefined) {\n return cachedProj;\n }\n const projjson = await getProjjson(epsg);\n const proj = parseWkt(projjson);\n PROJECTION_REGISTRY.set(key, proj);\n return proj;\n}\n/** Query epsg.io for the PROJJSON corresponding to the given EPSG code. */\nasync function getProjjson(epsg) {\n const url = `https://epsg.io/${epsg}.json`;\n const resp = await fetch(url);\n if (!resp.ok) {\n throw new Error(`Failed to fetch PROJJSON from ${url}`);\n }\n return await resp.json();\n}\n//# sourceMappingURL=registry.js.map","/**\n * Transform boundary densifying the edges to account for nonlinear\n * transformations along these edges and extracting the outermost bounds.\n *\n * @param project - function that maps (x, y) in source CRS to (x, y) in target CRS\n * @param left - min X in source CRS\n * @param bottom - min Y in source CRS\n * @param right - max X in source CRS\n * @param top - max Y in source CRS\n * @param options.densifyPts - number of intermediate points along each edge (default 21)\n * @returns [minX, minY, maxX, maxY] in the target CRS\n */\nexport function transformBounds(project, left, bottom, right, top, options = {}) {\n const { densifyPts = 21 } = options;\n // Corners in order: bottom-left, bottom-right, top-right, top-left\n const cx = [left, right, right, left];\n const cy = [bottom, bottom, top, top];\n let outMinX = Infinity;\n let outMinY = Infinity;\n let outMaxX = -Infinity;\n let outMaxY = -Infinity;\n for (let i = 0; i < 4; i++) {\n const fromX = cx[i];\n const fromY = cy[i];\n const toX = cx[(i + 1) % 4];\n const toY = cy[(i + 1) % 4];\n // Include start corner + intermediate points (end corner is start of next edge)\n for (let j = 0; j <= densifyPts; j++) {\n const t = j / (densifyPts + 1);\n const [px, py] = project(fromX + (toX - fromX) * t, fromY + (toY - fromY) * t);\n if (px < outMinX) {\n outMinX = px;\n }\n if (py < outMinY) {\n outMinY = py;\n }\n if (px > outMaxX) {\n outMaxX = px;\n }\n if (py > outMaxY) {\n outMaxY = py;\n }\n }\n }\n return [outMinX, outMinY, outMaxX, outMaxY];\n}\n//# sourceMappingURL=transform-bounds.js.map","const WGS84_ELLIPSOID_A = 6378137;\n// Maximum latitude representable in Web Mercator (EPSG:3857), in degrees.\n// Beyond this, the Mercator projection is undefined.\nconst MAX_WEB_MERCATOR_LAT = 85.05112877980659;\n/**\n * Convert a WGS84 longitude/latitude to EPSG:3857 meters analytically.\n * Valid for latitudes in [-MAX_WEB_MERCATOR_LAT, MAX_WEB_MERCATOR_LAT].\n */\nfunction wgs84To3857(lon, lat) {\n const x = (lon * Math.PI * WGS84_ELLIPSOID_A) / 180;\n const latRad = (lat * Math.PI) / 180;\n const y = Math.log(Math.tan(Math.PI / 4 + latRad / 2)) * WGS84_ELLIPSOID_A;\n return [x, y];\n}\n/**\n * Wrap a proj4 forward projection to EPSG:3857 so that it never returns NaN.\n *\n * proj4 returns [NaN, NaN] for points at the poles (lat = ±90°) because the\n * Mercator projection is undefined there. The wrapper falls back to:\n * 1. Project the input to WGS84 via `forwardTo4326`\n * 2. Clamp the latitude to the Web Mercator limit (±85.05°)\n * 3. Convert analytically from WGS84 to EPSG:3857\n *\n * This correctly handles any input CRS, not just EPSG:4326.\n *\n * NOTE: An identical copy of this function lives in `raster-tile-traversal.ts`.\n * The two packages cannot share code due to their dependency relationship\n * (deck.gl-geotiff depends on deck.gl-raster, not vice versa). If this logic\n * changes, update both copies.\n *\n * Perhaps in the future we'll make a `@developmentseed/projections` package to\n * hold shared projection utilities like this. *\n */\nexport function makeClampedForwardTo3857(forwardTo3857, forwardTo4326) {\n return (x, y) => {\n const [px, py] = forwardTo3857(x, y);\n if (Number.isFinite(px) && Number.isFinite(py)) {\n return [px, py];\n }\n const [lon, lat] = forwardTo4326(x, y);\n const clampedLat = Math.max(-MAX_WEB_MERCATOR_LAT, Math.min(MAX_WEB_MERCATOR_LAT, lat));\n return wgs84To3857(lon, clampedLat);\n };\n}\n//# sourceMappingURL=web-mercator.js.map","// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport const INTERSECTION = {\n OUTSIDE: -1, // Represents that an object is not contained within the frustum.\n INTERSECTING: 0, // Represents that an object intersects one of the frustum's planes.\n INSIDE: 1 // Represents that an object is fully within the frustum.\n};\n//# sourceMappingURL=constants.js.map","// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nconst RADIANS_TO_DEGREES = (1 / Math.PI) * 180;\nconst DEGREES_TO_RADIANS = (1 / 180) * Math.PI;\nconst DEFAULT_CONFIG = {\n EPSILON: 1e-12,\n debug: false,\n precision: 4,\n printTypes: false,\n printDegrees: false,\n printRowMajor: true,\n _cartographicRadians: false\n};\n// Configuration is truly global as of v3.6 to ensure single config even if multiple copies of math.gl\n// Multiple copies of config can be quite tricky to debug...\nglobalThis.mathgl = globalThis.mathgl || { config: { ...DEFAULT_CONFIG } };\nexport const config = globalThis.mathgl.config;\nexport function configure(options) {\n // Only copy existing keys\n Object.assign(config, options);\n return config;\n}\n/**\n * Formats a value into a string\n * @param value\n * @param param1\n * @returns\n */\nexport function formatValue(value, { precision = config.precision } = {}) {\n value = round(value);\n // get rid of trailing zeros\n return `${parseFloat(value.toPrecision(precision))}`;\n}\n/**\n * Check if value is an \"array\"\n * Returns `true` if value is either an array or a typed array\n * Note: returns `false` for `ArrayBuffer` and `DataView` instances\n * @note isTypedArray and isNumericArray are often more useful in TypeScript\n */\nexport function isArray(value) {\n return Array.isArray(value) || (ArrayBuffer.isView(value) && !(value instanceof DataView));\n}\nexport function clone(array) {\n return 'clone' in array ? array.clone() : array.slice();\n}\nexport function toRadians(degrees) {\n return radians(degrees);\n}\nexport function toDegrees(radians) {\n return degrees(radians);\n}\nexport function radians(degrees, result) {\n return map(degrees, (degrees) => degrees * DEGREES_TO_RADIANS, result);\n}\nexport function degrees(radians, result) {\n return map(radians, (radians) => radians * RADIANS_TO_DEGREES, result);\n}\n/**\n * \"GLSL equivalent\" of `Math.sin`: Works on single values and vectors\n * @deprecated\n */\nexport function sin(radians, result) {\n return map(radians, (angle) => Math.sin(angle), result);\n}\n/**\n * \"GLSL equivalent\" of `Math.cos`: Works on single values and vectors\n * @deprecated\n */\nexport function cos(radians, result) {\n return map(radians, (angle) => Math.cos(angle), result);\n}\n/**\n * \"GLSL equivalent\" of `Math.tan`: Works on single values and vectors\n * @deprecated\n */\nexport function tan(radians, result) {\n return map(radians, (angle) => Math.tan(angle), result);\n}\n/**\n * \"GLSL equivalent\" of `Math.asin`: Works on single values and vectors\n * @deprecated\n */\nexport function asin(radians, result) {\n return map(radians, (angle) => Math.asin(angle), result);\n}\n/**\n * \"GLSL equivalent\" of `Math.acos`: Works on single values and vectors\n * @deprecated\n */\nexport function acos(radians, result) {\n return map(radians, (angle) => Math.acos(angle), result);\n}\n/**\n * \"GLSL equivalent\" of `Math.atan`: Works on single values and vectors\n * @deprecated\n */\nexport function atan(radians, result) {\n return map(radians, (angle) => Math.atan(angle), result);\n}\nexport function clamp(value, min, max) {\n return map(value, (value) => Math.max(min, Math.min(max, value)));\n}\nexport function lerp(a, b, t) {\n if (isArray(a)) {\n return a.map((ai, i) => lerp(ai, b[i], t));\n }\n return t * b + (1 - t) * a;\n}\n/* eslint-disable */\n/**\n * Compares any two math objects, using `equals` method if available.\n * @param a\n * @param b\n * @param epsilon\n * @returns\n */\nexport function equals(a, b, epsilon) {\n const oldEpsilon = config.EPSILON;\n if (epsilon) {\n config.EPSILON = epsilon;\n }\n try {\n if (a === b) {\n return true;\n }\n if (isArray(a) && isArray(b)) {\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; ++i) {\n // eslint-disable-next-line max-depth\n if (!equals(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n if (a && a.equals) {\n return a.equals(b);\n }\n if (b && b.equals) {\n return b.equals(a);\n }\n if (typeof a === 'number' && typeof b === 'number') {\n return Math.abs(a - b) <= config.EPSILON * Math.max(1, Math.abs(a), Math.abs(b));\n }\n return false;\n }\n finally {\n config.EPSILON = oldEpsilon;\n }\n}\nexport function exactEquals(a, b) {\n if (a === b) {\n return true;\n }\n if (a && typeof a === 'object' && b && typeof b === 'object') {\n if (a.constructor !== b.constructor) {\n return false;\n }\n if (a.exactEquals) {\n return a.exactEquals(b);\n }\n }\n if (isArray(a) && isArray(b)) {\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; ++i) {\n if (!exactEquals(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n return false;\n}\n/* eslint-enable */\nexport function withEpsilon(epsilon, func) {\n const oldPrecision = config.EPSILON;\n config.EPSILON = epsilon;\n let value;\n try {\n value = func();\n }\n finally {\n config.EPSILON = oldPrecision;\n }\n return value;\n}\n// HELPERS\nfunction round(value) {\n return Math.round(value / config.EPSILON) * config.EPSILON;\n}\n// If the array has a clone function, calls it, otherwise returns a copy\nfunction duplicateArray(array) {\n // @ts-expect-error We check for math.gl class methods\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n return array.clone ? array.clone() : new Array(array.length);\n}\n// If the argument value is an array, applies the func element wise,\n// otherwise applies func to the argument value\nfunction map(value, func, result) {\n if (isArray(value)) {\n const array = value;\n result = result || duplicateArray(array);\n for (let i = 0; i < result.length && i < array.length; ++i) {\n const val = typeof value === 'number' ? value : value[i];\n result[i] = func(val, i, result);\n }\n return result;\n }\n return func(value);\n}\n//# sourceMappingURL=common.js.map","// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { config, formatValue, equals, isArray } from \"../../lib/common.js\";\n/** Base class for vectors and matrices */\nexport class MathArray extends Array {\n // Common methods\n /**\n * Clone the current object\n * @returns a new copy of this object\n */\n clone() {\n // @ts-expect-error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.\n return new this.constructor().copy(this); // eslint-disable-line\n }\n fromArray(array, offset = 0) {\n for (let i = 0; i < this.ELEMENTS; ++i) {\n this[i] = array[i + offset];\n }\n return this.check();\n }\n toArray(targetArray = [], offset = 0) {\n for (let i = 0; i < this.ELEMENTS; ++i) {\n targetArray[offset + i] = this[i];\n }\n return targetArray;\n }\n toObject(targetObject) {\n return targetObject;\n }\n from(arrayOrObject) {\n return Array.isArray(arrayOrObject)\n ? this.copy(arrayOrObject)\n : // @ts-ignore\n this.fromObject(arrayOrObject);\n }\n to(arrayOrObject) {\n // @ts-ignore\n if (arrayOrObject === this) {\n return this;\n }\n // @ts-expect-error TS2339: Property 'toObject' does not exist on type 'MathArray'.\n return isArray(arrayOrObject) ? this.toArray(arrayOrObject) : this.toObject(arrayOrObject);\n }\n toTarget(target) {\n return target ? this.to(target) : this;\n }\n /** @deprecated */\n toFloat32Array() {\n return new Float32Array(this);\n }\n toString() {\n return this.formatString(config);\n }\n /** Formats string according to options */\n formatString(opts) {\n let string = '';\n for (let i = 0; i < this.ELEMENTS; ++i) {\n string += (i > 0 ? ', ' : '') + formatValue(this[i], opts);\n }\n return `${opts.printTypes ? this.constructor.name : ''}[${string}]`;\n }\n equals(array) {\n if (!array || this.length !== array.length) {\n return false;\n }\n for (let i = 0; i < this.ELEMENTS; ++i) {\n if (!equals(this[i], array[i])) {\n return false;\n }\n }\n return true;\n }\n exactEquals(array) {\n if (!array || this.length !== array.length) {\n return false;\n }\n for (let i = 0; i < this.ELEMENTS; ++i) {\n if (this[i] !== array[i]) {\n return false;\n }\n }\n return true;\n }\n // Modifiers\n /** Negates all values in this object */\n negate() {\n for (let i = 0; i < this.ELEMENTS; ++i) {\n this[i] = -this[i];\n }\n return this.check();\n }\n lerp(a, b, t) {\n if (t === undefined) {\n return this.lerp(this, a, b);\n }\n for (let i = 0; i < this.ELEMENTS; ++i) {\n const ai = a[i];\n const endValue = typeof b === 'number' ? b : b[i];\n this[i] = ai + t * (endValue - ai);\n }\n return this.check();\n }\n /** Minimal */\n min(vector) {\n for (let i = 0; i < this.ELEMENTS; ++i) {\n this[i] = Math.min(vector[i], this[i]);\n }\n return this.check();\n }\n /** Maximal */\n max(vector) {\n for (let i = 0; i < this.ELEMENTS; ++i) {\n this[i] = Math.max(vector[i], this[i]);\n }\n return this.check();\n }\n clamp(minVector, maxVector) {\n for (let i = 0; i < this.ELEMENTS; ++i) {\n this[i] = Math.min(Math.max(this[i], minVector[i]), maxVector[i]);\n }\n return this.check();\n }\n add(...vectors) {\n for (const vector of vectors) {\n for (let i = 0; i < this.ELEMENTS; ++i) {\n this[i] += vector[i];\n }\n }\n return this.check();\n }\n subtract(...vectors) {\n for (const vector of vectors) {\n for (let i = 0; i < this.ELEMENTS; ++i) {\n this[i] -= vector[i];\n }\n }\n return this.check();\n }\n scale(scale) {\n if (typeof scale === 'number') {\n for (let i = 0; i < this.ELEMENTS; ++i) {\n this[i] *= scale;\n }\n }\n else {\n for (let i = 0; i < this.ELEMENTS && i < scale.length; ++i) {\n this[i] *= scale[i];\n }\n }\n return this.check();\n }\n /**\n * Multiplies all elements by `scale`\n * Note: `Matrix4.multiplyByScalar` only scales its 3x3 \"minor\"\n */\n multiplyByScalar(scalar) {\n for (let i = 0; i < this.ELEMENTS; ++i) {\n this[i] *= scalar;\n }\n return this.check();\n }\n // Debug checks\n /** Throws an error if array length is incorrect or contains illegal values */\n check() {\n if (config.debug && !this.validate()) {\n throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);\n }\n return this;\n }\n /** Returns false if the array length is incorrect or contains illegal values */\n validate() {\n let valid = this.length === this.ELEMENTS;\n for (let i = 0; i < this.ELEMENTS; ++i) {\n valid = valid && Number.isFinite(this[i]);\n }\n return valid;\n }\n // three.js compatibility\n /** @deprecated */\n sub(a) {\n return this.subtract(a);\n }\n /** @deprecated */\n setScalar(a) {\n for (let i = 0; i < this.ELEMENTS; ++i) {\n this[i] = a;\n }\n return this.check();\n }\n /** @deprecated */\n addScalar(a) {\n for (let i = 0; i < this.ELEMENTS; ++i) {\n this[i] += a;\n }\n return this.check();\n }\n /** @deprecated */\n subScalar(a) {\n return this.addScalar(-a);\n }\n /** @deprecated */\n multiplyScalar(scalar) {\n // Multiplies all elements\n // `Matrix4.scale` only scales its 3x3 \"minor\"\n for (let i = 0; i < this.ELEMENTS; ++i) {\n this[i] *= scalar;\n }\n return this.check();\n }\n /** @deprecated */\n divideScalar(a) {\n return this.multiplyByScalar(1 / a);\n }\n /** @deprecated */\n clampScalar(min, max) {\n for (let i = 0; i < this.ELEMENTS; ++i) {\n this[i] = Math.min(Math.max(this[i], min), max);\n }\n return this.check();\n }\n /** @deprecated */\n get elements() {\n return this;\n }\n}\n//# sourceMappingURL=math-array.js.map","// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { config } from \"./common.js\";\nexport function validateVector(v, length) {\n if (v.length !== length) {\n return false;\n }\n // Could be arguments \"array\" (v.every not availasble)\n for (let i = 0; i < v.length; ++i) {\n if (!Number.isFinite(v[i])) {\n return false;\n }\n }\n return true;\n}\nexport function checkNumber(value) {\n if (!Number.isFinite(value)) {\n throw new Error(`Invalid number ${JSON.stringify(value)}`);\n }\n return value;\n}\nexport function checkVector(v, length, callerName = '') {\n if (config.debug && !validateVector(v, length)) {\n throw new Error(`math.gl: ${callerName} some fields set to invalid numbers'`);\n }\n return v;\n}\nconst map = {};\nexport function deprecated(method, version) {\n if (!map[method]) {\n map[method] = true;\n // eslint-disable-next-line\n console.warn(`${method} has been removed in version ${version}, see upgrade guide for more information`);\n }\n}\n//# sourceMappingURL=validators.js.map","// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport function assert(condition, message) {\n if (!condition) {\n throw new Error(`math.gl assertion ${message}`);\n }\n}\n//# sourceMappingURL=assert.js.map","// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Copyright (c) 2017 Uber Technologies, Inc.\nimport { MathArray } from \"./math-array.js\";\nimport { checkNumber } from \"../../lib/validators.js\";\nimport { assert } from \"../../lib/assert.js\";\n/** Base class for vectors with at least 2 elements */\nexport class Vector extends MathArray {\n // ACCESSORS\n get x() {\n return this[0];\n }\n set x(value) {\n this[0] = checkNumber(value);\n }\n get y() {\n return this[1];\n }\n set y(value) {\n this[1] = checkNumber(value);\n }\n /**\n * Returns the length of the vector from the origin to the point described by this vector\n *\n * @note `length` is a reserved word for Arrays, so `v.length()` will return number of elements\n * Instead we provide `len` and `magnitude`\n */\n len() {\n return Math.sqrt(this.lengthSquared());\n }\n /**\n * Returns the length of the vector from the origin to the point described by this vector\n */\n magnitude() {\n return this.len();\n }\n /**\n * Returns the squared length of the vector from the origin to the point described by this vector\n */\n lengthSquared() {\n let length = 0;\n for (let i = 0; i < this.ELEMENTS; ++i) {\n length += this[i] * this[i];\n }\n return length;\n }\n /**\n * Returns the squared length of the vector from the origin to the point described by this vector\n */\n magnitudeSquared() {\n return this.lengthSquared();\n }\n distance(mathArray) {\n return Math.sqrt(this.distanceSquared(mathArray));\n }\n distanceSquared(mathArray) {\n let length = 0;\n for (let i = 0; i < this.ELEMENTS; ++i) {\n const dist = this[i] - mathArray[i];\n length += dist * dist;\n }\n return checkNumber(length);\n }\n dot(mathArray) {\n let product = 0;\n for (let i = 0; i < this.ELEMENTS; ++i) {\n product += this[i] * mathArray[i];\n }\n return checkNumber(product);\n }\n // MODIFIERS\n normalize() {\n const length = this.magnitude();\n if (length !== 0) {\n for (let i = 0; i < this.ELEMENTS; ++i) {\n this[i] /= length;\n }\n }\n return this.check();\n }\n multiply(...vectors) {\n for (const vector of vectors) {\n for (let i = 0; i < this.ELEMENTS; ++i) {\n this[i] *= vector[i];\n }\n }\n return this.check();\n }\n divide(...vectors) {\n for (const vector of vectors) {\n for (let i = 0; i < this.ELEMENTS; ++i) {\n this[i] /= vector[i];\n }\n }\n return this.check();\n }\n // THREE.js compatibility\n lengthSq() {\n return this.lengthSquared();\n }\n distanceTo(vector) {\n return this.distance(vector);\n }\n distanceToSquared(vector) {\n return this.distanceSquared(vector);\n }\n getComponent(i) {\n assert(i >= 0 && i < this.ELEMENTS, 'index is out of range');\n return checkNumber(this[i]);\n }\n setComponent(i, value) {\n assert(i >= 0 && i < this.ELEMENTS, 'index is out of range');\n this[i] = value;\n return this.check();\n }\n addVectors(a, b) {\n return this.copy(a).add(b);\n }\n subVectors(a, b) {\n return this.copy(a).subtract(b);\n }\n multiplyVectors(a, b) {\n return this.copy(a).multiply(b);\n }\n addScaledVector(a, b) {\n // @ts-expect-error error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.\n return this.add(new this.constructor(a).multiplyScalar(b));\n }\n}\n//# sourceMappingURL=vector.js.map","// @eslint-disable\n// @ts-nocheck\n/**\n * Common utilities\n * @module glMatrix\n */\n// Configuration Constants\nexport const EPSILON = 0.000001;\nexport let ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;\nexport const RANDOM = Math.random;\nexport const ANGLE_ORDER = 'zyx';\n/**\n * Symmetric round\n * see https://www.npmjs.com/package/round-half-up-symmetric#user-content-detailed-background\n *\n * @param {Number} a value to round\n */\nexport function round(a) {\n if (a >= 0)\n return Math.round(a);\n return a % 0.5 === 0 ? Math.floor(a) : Math.round(a);\n}\n/**\n * Sets the type of array used when creating new vectors and matrices\n *\n * @param {Float32ArrayConstructor | ArrayConstructor} type Array type, such as Float32Array or Array\n */\nexport function setMatrixArrayType(type) {\n ARRAY_TYPE = type;\n}\nconst degree = Math.PI / 180;\n/**\n * Convert Degree To Radian\n *\n * @param {Number} a Angle in Degrees\n */\nexport function toRadian(a) {\n return a * degree;\n}\n/**\n * Tests whether or not the arguments have approximately the same value, within an absolute\n * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less\n * than or equal to 1.0, and a relative tolerance is used for larger values)\n *\n * @param {Number} a The first number to test.\n * @param {Number} b The second number to test.\n * @returns {Boolean} True if the numbers are approximately equal, false otherwise.\n */\nexport function equals(a, b) {\n return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b));\n}\n//# sourceMappingURL=common.js.map","// @eslint-disable\n// @ts-nocheck\nimport * as glMatrix from './common.js';\n/**\n * 2 Dimensional Vector\n * @module vec2\n */\n/**\n * Creates a new, empty vec2\n *\n * @returns a new 2D vector\n */\nexport function create() {\n const out = new glMatrix.ARRAY_TYPE(2);\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n }\n return out;\n}\n/**\n * Creates a new vec2 initialized with values from an existing vector\n *\n * @param a vector to clone\n * @returns a new 2D vector\n */\nexport function clone(a) {\n const out = new glMatrix.ARRAY_TYPE(2);\n out[0] = a[0];\n out[1] = a[1];\n return out;\n}\n/**\n * Creates a new vec2 initialized with the given values\n *\n * @param x X component\n * @param y Y component\n * @returns a new 2D vector\n */\nexport function fromValues(x, y) {\n const out = new glMatrix.ARRAY_TYPE(2);\n out[0] = x;\n out[1] = y;\n return out;\n}\n/**\n * Copy the values from one vec2 to another\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a the source vector\n * @returns {NumericArray} out\n */\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n return out;\n}\n/**\n * Set the components of a vec2 to the given values\n *\n * @param {NumericArray} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @returns {NumericArray} out\n */\nexport function set(out, x, y) {\n out[0] = x;\n out[1] = y;\n return out;\n}\n/**\n * Adds two vec2's\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a the first operand\n * @param {Readonly<NumericArray>} b the second operand\n * @returns {NumericArray} out\n */\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n return out;\n}\n/**\n * Subtracts vector b from vector a\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a the first operand\n * @param {Readonly<NumericArray>} b the second operand\n * @returns {NumericArray} out\n */\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n return out;\n}\n/**\n * Multiplies two vec2's\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a the first operand\n * @param {Readonly<NumericArray>} b the second operand\n * @returns {NumericArray} out\n */\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n return out;\n}\n/**\n * Divides two vec2's\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a the first operand\n * @param {Readonly<NumericArray>} b the second operand\n * @returns {NumericArray} out\n */\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n return out;\n}\n/**\n * Math.ceil the components of a vec2\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a vector to ceil\n * @returns {NumericArray} out\n */\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n return out;\n}\n/**\n * Math.floor the components of a vec2\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a vector to floor\n * @returns {NumericArray} out\n */\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n return out;\n}\n/**\n * Returns the minimum of two vec2's\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a the first operand\n * @param {Readonly<NumericArray>} b the second operand\n * @returns {NumericArray} out\n */\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n return out;\n}\n/**\n * Returns the maximum of two vec2's\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a the first operand\n * @param {Readonly<NumericArray>} b the second operand\n * @returns {NumericArray} out\n */\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n return out;\n}\n/**\n * symmetric round the components of a vec2\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a vector to round\n * @returns {NumericArray} out\n */\nexport function round(out, a) {\n out[0] = glMatrix.round(a[0]);\n out[1] = glMatrix.round(a[1]);\n return out;\n}\n/**\n * Scales a vec2 by a scalar number\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {NumericArray} out\n */\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n return out;\n}\n/**\n * Adds two vec2's after scaling the second operand by a scalar value\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a the first operand\n * @param {Readonly<NumericArray>} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {NumericArray} out\n */\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n return out;\n}\n/**\n * Calculates the euclidian distance between two vec2's\n *\n * @param {Readonly<NumericArray>} a the first operand\n * @param {Readonly<NumericArray>} b the second operand\n * @returns {Number} distance between a and b\n */\nexport function distance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n return Math.sqrt(x * x + y * y);\n}\n/**\n * Calculates the squared euclidian distance between two vec2's\n *\n * @param {Readonly<NumericArray>} a the first operand\n * @param {Readonly<NumericArray>} b the second operand\n * @returns {Number} squared distance between a and b\n */\nexport function squaredDistance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n return x * x + y * y;\n}\n/**\n * Calculates the length of a vec2\n *\n * @param {Readonly<NumericArray>} a vector to calculate length of\n * @returns {Number} length of a\n */\nexport function length(a) {\n const x = a[0];\n const y = a[1];\n return Math.sqrt(x * x + y * y);\n}\n/**\n * Calculates the squared length of a vec2\n *\n * @param {Readonly<NumericArray>} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\nexport function squaredLength(a) {\n const x = a[0];\n const y = a[1];\n return x * x + y * y;\n}\n/**\n * Negates the components of a vec2\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a vector to negate\n * @returns {NumericArray} out\n */\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n return out;\n}\n/**\n * Returns the inverse of the components of a vec2\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a vector to invert\n * @returns {NumericArray} out\n */\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n return out;\n}\n/**\n * Normalize a vec2\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a vector to normalize\n * @returns {NumericArray} out\n */\nexport function normalize(out, a) {\n const x = a[0];\n const y = a[1];\n let len = x * x + y * y;\n if (len > 0) {\n // TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n return out;\n}\n/**\n * Calculates the dot product of two vec2's\n *\n * @param {Readonly<NumericArray>} a the first operand\n * @param {Readonly<NumericArray>} b the second operand\n * @returns {Number} dot product of a and b\n */\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1];\n}\n/**\n * Computes the cross product of two vec2's\n * Note that the cross product must by definition produce a 3D vector\n *\n * @param {vec3} out the receiving vector\n * @param {Readonly<NumericArray>} a the first operand\n * @param {Readonly<NumericArray>} b the second operand\n * @returns {vec3} out\n */\nexport function cross(out, a, b) {\n const z = a[0] * b[1] - a[1] * b[0];\n out[0] = out[1] = 0;\n out[2] = z;\n return out;\n}\n/**\n * Performs a linear interpolation between two vec2's\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a the first operand\n * @param {Readonly<NumericArray>} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {NumericArray} out\n */\nexport function lerp(out, a, b, t) {\n const ax = a[0];\n const ay = a[1];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n return out;\n}\n/**\n * Generates a random vector with the given scale\n *\n * @param {NumericArray} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned\n * @returns {NumericArray} out\n */\nexport function random(out, scale) {\n scale = scale === undefined ? 1.0 : scale;\n const r = glMatrix.RANDOM() * 2.0 * Math.PI;\n out[0] = Math.cos(r) * scale;\n out[1] = Math.sin(r) * scale;\n return out;\n}\n/**\n * Transforms the vec2 with a mat2\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a the vector to transform\n * @param {ReadonlyMat2} m matrix to transform with\n * @returns {NumericArray} out\n */\nexport function transformMat2(out, a, m) {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n return out;\n}\n/**\n * Transforms the vec2 with a mat2d\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a the vector to transform\n * @param {ReadonlyMat2d} m matrix to transform with\n * @returns {NumericArray} out\n */\nexport function transformMat2d(out, a, m) {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[2] * y + m[4];\n out[1] = m[1] * x + m[3] * y + m[5];\n return out;\n}\n/**\n * Transforms the vec2 with a mat3\n * 3rd vector component is implicitly '1'\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a the vector to transform\n * @param {ReadonlyMat3} m matrix to transform with\n * @returns {NumericArray} out\n */\nexport function transformMat3(out, a, m) {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[3] * y + m[6];\n out[1] = m[1] * x + m[4] * y + m[7];\n return out;\n}\n/**\n * Transforms the vec2 with a mat4\n * 3rd vector component is implicitly '0'\n * 4th vector component is implicitly '1'\n *\n * @param {NumericArray} out the receiving vector\n * @param {Readonly<NumericArray>} a the vector to transform\n * @param {ReadonlyMat4} m matrix to transform with\n * @returns {NumericArray} out\n */\nexport function transformMat4(out, a, m) {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n return out;\n}\n/**\n * Rotate a 2D vector\n * @param {NumericArray} out The receiving vec2\n * @param {Readonly<NumericArray>} a The vec2 point to rotate\n * @param {Readonly<NumericArray>} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {NumericArray} out\n */\nexport function rotate(out, a, b, rad) {\n // Translate point to the origin\n const p0 = a[0] - b[0];\n const p1 = a[1] - b[1];\n const sinC = Math.sin(rad);\n const cosC = Math.cos(rad);\n // perform rotation and translate to correct position\n out[0] = p0 * cosC - p1 * sinC + b[0];\n out[1] = p0 * sinC + p1 * cosC + b[1];\n return out;\n}\n/**\n * Get the angle between two 2D vectors\n * @param {Readonly<NumericArray>} a The first operand\n * @param {Readonly<NumericArray>} b The second operand\n * @returns {Number} The angle in radians\n */\nexport function angle(a, b) {\n const x1 = a[0];\n const y1 = a[1];\n const x2 = b[0];\n const y2 = b[1];\n // mag is the product of the magnitudes of a and b\n const mag = Math.sqrt((x1 * x1 + y1 * y1) * (x2 * x2 + y2 * y2));\n // mag &&.. short circuits if mag == 0\n const cosine = mag && (x1 * x2 + y1 * y2) / mag;\n // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n}\n/**\n * Set the components of a vec2 to zero\n *\n * @param {NumericArray} out the receiving vector\n * @returns {NumericArray} out\n */\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n return out;\n}\n/**\n * Returns a string representation of a vector\n *\n * @param {Readonly<NumericArray>} a vector to represent as a string\n * @returns {String} string representation of the vector\n */\nexport function str(a) {\n return `vec2(${a[0]}, ${a[1]})`;\n}\n/**\n * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)\n *\n * @param {Readonly<NumericArray>} a The first vector.\n * @param {Readonly<NumericArray>} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1];\n}\n/**\n * Returns whether or not the vectors have approximately the same elements in the same position.\n *\n * @param {Readonly<NumericArray>} a The first vector.\n * @param {Readonly<NumericArray>} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\nexport function equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const b0 = b[0];\n const b1 = b[1];\n return (Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)));\n}\n/**\n * Alias for {@link vec2.length}\n * @function\n */\nexport const len = length;\n/**\n * Alias for {@link vec2.subtract}\n * @function\n */\nexport const sub = subtract;\n/**\n * Alias for {@link vec2.multiply}\n * @function\n */\nexport const mul = multiply;\n/**\n * Alias for {@link vec2.divide}\n * @function\n */\nexport const div = divide;\n/**\n * Alias for {@link vec2.distance}\n * @function\n */\nexport const dist = distance;\n/**\n * Alias for {@link vec2.squaredDistance}\n * @function\n */\nexport const sqrDist = squaredDistance;\n/**\n * Alias for {@link vec2.squaredLength}\n * @function\n */\nexport const sqrLen = squaredLength;\n/**\n * Perform some operation over an array of vec2s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\nexport const forEach = (function () {\n const vec = create();\n return function (a, stride, offset, count, fn, arg) {\n let i;\n let l;\n if (!stride) {\n stride = 2;\n }\n if (!offset) {\n offset = 0;\n }\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n }\n else {\n l = a.length;\n }\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n }\n return a;\n };\n})();\n//# sourceMappingURL=vec2.js.map","// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// vec2 additions\nexport function vec2_transformMat4AsVector(out, a, m) {\n const x = a[0];\n const y = a[1];\n const w = m[3] * x + m[7] * y || 1.0;\n out[0] = (m[0] * x + m[4] * y) / w;\n out[1] = (m[1] * x + m[5] * y) / w;\n return out;\n}\n// vec3 additions\n// Transform as vector, only uses 3x3 minor matrix\nexport function vec3_transformMat4AsVector(out, a, m) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = m[3] * x + m[7] * y + m[11] * z || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z) / w;\n return out;\n}\nexport function vec3_transformMat2(out, a, m) {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n out[2] = a[2];\n return out;\n}\n// vec4 additions\nexport function vec4_transformMat2(out, a, m) {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\nexport function vec4_transformMat3(out, a, m) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n out[0] = m[0] * x + m[3] * y + m[6] * z;\n out[1] = m[1] * x + m[4] * y + m[7] * z;\n out[2] = m[2] * x + m[5] * y + m[8] * z;\n out[3] = a[3];\n return out;\n}\n//# sourceMappingURL=gl-matrix-extras.js.map","// @eslint-disable\n// @ts-nocheck\nimport * as glMatrix from './common.js';\n/**\n * 3 Dimensional Vector\n * @module vec3\n */\n/**\n * Creates a new, empty vec3\n *\n * @returns {vec3} a new 3D vector\n */\nexport function create() {\n const out = new glMatrix.ARRAY_TYPE(3);\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n return out;\n}\n/**\n * Creates a new vec3 initialized with values from an existing vector\n *\n * @param {ReadonlyVec3} a vector to clone\n * @returns {vec3} a new 3D vector\n */\nexport function clone(a) {\n const out = new glMatrix.ARRAY_TYPE(3);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\n * Calculates the length of a vec3\n *\n * @param {ReadonlyVec3} a vector to calculate length of\n * @returns {Number} length of a\n */\nexport function length(a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n return Math.sqrt(x * x + y * y + z * z);\n}\n/**\n * Creates a new vec3 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} a new 3D vector\n */\nexport function fromValues(x, y, z) {\n const out = new glMatrix.ARRAY_TYPE(3);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\n * Copy the values from one vec3 to another\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the source vector\n * @returns {vec3} out\n */\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\n * Set the components of a vec3 to the given values\n *\n * @param {vec3} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} out\n */\nexport function set(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\n * Adds two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n}\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n}\n/**\n * Multiplies two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n}\n/**\n * Divides two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n}\n/**\n * Math.ceil the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to ceil\n * @returns {vec3} out\n */\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n return out;\n}\n/**\n * Math.floor the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to floor\n * @returns {vec3} out\n */\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n return out;\n}\n/**\n * Returns the minimum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n}\n/**\n * Returns the maximum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n}\n/**\n * symmetric round the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to round\n * @returns {vec3} out\n */\nexport function round(out, a) {\n out[0] = glMatrix.round(a[0]);\n out[1] = glMatrix.round(a[1]);\n out[2] = glMatrix.round(a[2]);\n return out;\n}\n/**\n * Scales a vec3 by a scalar number\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec3} out\n */\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n}\n/**\n * Adds two vec3's after scaling the second operand by a scalar value\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec3} out\n */\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n return out;\n}\n/**\n * Calculates the euclidian distance between two vec3's\n *\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {Number} distance between a and b\n */\nexport function distance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n return Math.sqrt(x * x + y * y + z * z);\n}\n/**\n * Calculates the squared euclidian distance between two vec3's\n *\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {Number} squared distance between a and b\n */\nexport function squaredDistance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n return x * x + y * y + z * z;\n}\n/**\n * Calculates the squared length of a vec3\n *\n * @param {ReadonlyVec3} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\nexport function squaredLength(a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n return x * x + y * y + z * z;\n}\n/**\n * Negates the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to negate\n * @returns {vec3} out\n */\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n}\n/**\n * Returns the inverse of the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to invert\n * @returns {vec3} out\n */\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n return out;\n}\n/**\n * Normalize a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to normalize\n * @returns {vec3} out\n */\nexport function normalize(out, a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n let len = x * x + y * y + z * z;\n if (len > 0) {\n // TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n return out;\n}\n/**\n * Calculates the dot product of two vec3's\n *\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {Number} dot product of a and b\n */\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n/**\n * Computes the cross product of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\nexport function cross(out, a, b) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n}\n/**\n * Performs a linear interpolation between two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\nexport function lerp(out, a, b, t) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n}\n/**\n * Performs a spherical linear interpolation between two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\nexport function slerp(out, a, b, t) {\n const angle = Math.acos(Math.min(Math.max(dot(a, b), -1), 1));\n const sinTotal = Math.sin(angle);\n const ratioA = Math.sin((1 - t) * angle) / sinTotal;\n const ratioB = Math.sin(t * angle) / sinTotal;\n out[0] = ratioA * a[0] + ratioB * b[0];\n out[1] = ratioA * a[1] + ratioB * b[1];\n out[2] = ratioA * a[2] + ratioB * b[2];\n return out;\n}\n/**\n * Performs a hermite interpolation with two control points\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {ReadonlyVec3} c the third operand\n * @param {ReadonlyVec3} d the fourth operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\nexport function hermite(out, a, b, c, d, t) {\n const factorTimes2 = t * t;\n const factor1 = factorTimes2 * (2 * t - 3) + 1;\n const factor2 = factorTimes2 * (t - 2) + t;\n const factor3 = factorTimes2 * (t - 1);\n const factor4 = factorTimes2 * (3 - 2 * t);\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\n * Performs a bezier interpolation with two control points\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {ReadonlyVec3} c the third operand\n * @param {ReadonlyVec3} d the fourth operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\nexport function bezier(out, a, b, c, d, t) {\n const inverseFactor = 1 - t;\n const inverseFactorTimesTwo = inverseFactor * inverseFactor;\n const factorTimes2 = t * t;\n const factor1 = inverseFactorTimesTwo * inverseFactor;\n const factor2 = 3 * t * inverseFactorTimesTwo;\n const factor3 = 3 * factorTimes2 * inverseFactor;\n const factor4 = factorTimes2 * t;\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec3} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned\n * @returns {vec3} out\n */\nexport function random(out, scale) {\n scale = scale === undefined ? 1.0 : scale;\n const r = glMatrix.RANDOM() * 2.0 * Math.PI;\n const z = glMatrix.RANDOM() * 2.0 - 1.0;\n const zScale = Math.sqrt(1.0 - z * z) * scale;\n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n}\n/**\n * Transforms the vec3 with a mat4.\n * 4th vector component is implicitly '1'\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyMat4} m matrix to transform with\n * @returns {vec3} out\n */\nexport function transformMat4(out, a, m) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n let w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n}\n/**\n * Transforms the vec3 with a mat3.\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyMat3} m the 3x3 matrix to transform with\n * @returns {vec3} out\n */\nexport function transformMat3(out, a, m) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n}\n/**\n * Transforms the vec3 with a quat\n * Can also be used for dual quaternions. (Multiply it with the real part)\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyQuat} q quaternion to transform with\n * @returns {vec3} out\n */\nexport function transformQuat(out, a, q) {\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n const x = a[0];\n const y = a[1];\n const z = a[2];\n // var qvec = [qx, qy, qz];\n // var uv = vec3.cross([], qvec, a);\n let uvx = qy * z - qz * y;\n let uvy = qz * x - qx * z;\n let uvz = qx * y - qy * x;\n // var uuv = vec3.cross([], qvec, uv);\n let uuvx = qy * uvz - qz * uvy;\n let uuvy = qz * uvx - qx * uvz;\n let uuvz = qx * uvy - qy * uvx;\n // vec3.scale(uv, uv, 2 * w);\n const w2 = qw * 2;\n uvx *= w2;\n uvy *= w2;\n uvz *= w2;\n // vec3.scale(uuv, uuv, 2);\n uuvx *= 2;\n uuvy *= 2;\n uuvz *= 2;\n // return vec3.add(out, a, vec3.add(out, uv, uuv));\n out[0] = x + uvx + uuvx;\n out[1] = y + uvy + uuvy;\n out[2] = z + uvz + uuvz;\n return out;\n}\n/**\n * Rotate a 3D vector around the x-axis\n * @param {vec3} out The receiving vec3\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec3} out\n */\nexport function rotateX(out, a, b, rad) {\n const p = [];\n const r = [];\n // Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n // perform rotation\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);\n // translate to correct position\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\n * Rotate a 3D vector around the y-axis\n * @param {vec3} out The receiving vec3\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec3} out\n */\nexport function rotateY(out, a, b, rad) {\n const p = [];\n const r = [];\n // Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n // perform rotation\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);\n // translate to correct position\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\n * Rotate a 3D vector around the z-axis\n * @param {vec3} out The receiving vec3\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec3} out\n */\nexport function rotateZ(out, a, b, rad) {\n const p = [];\n const r = [];\n // Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n // perform rotation\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2];\n // translate to correct position\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\n * Get the angle between two 3D vectors\n * @param {ReadonlyVec3} a The first operand\n * @param {ReadonlyVec3} b The second operand\n * @returns {Number} The angle in radians\n */\nexport function angle(a, b) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n}\n/**\n * Set the components of a vec3 to zero\n *\n * @param {vec3} out the receiving vector\n * @returns {vec3} out\n */\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n return out;\n}\n/**\n * Returns a string representation of a vector\n *\n * @param {ReadonlyVec3} a vector to represent as a string\n * @returns {String} string representation of the vector\n */\nexport function str(a) {\n return `vec3(${a[0]}, ${a[1]}, ${a[2]})`;\n}\n/**\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyVec3} a The first vector.\n * @param {ReadonlyVec3} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n/**\n * Returns whether or not the vectors have approximately the same elements in the same position.\n *\n * @param {ReadonlyVec3} a The first vector.\n * @param {ReadonlyVec3} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\nexport function equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n return (Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\n Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)));\n}\n/**\n * Alias for {@link vec3.subtract}\n * @function\n */\nexport const sub = subtract;\n/**\n * Alias for {@link vec3.multiply}\n * @function\n */\nexport const mul = multiply;\n/**\n * Alias for {@link vec3.divide}\n * @function\n */\nexport const div = divide;\n/**\n * Alias for {@link vec3.distance}\n * @function\n */\nexport const dist = distance;\n/**\n * Alias for {@link vec3.squaredDistance}\n * @function\n */\nexport const sqrDist = squaredDistance;\n/**\n * Alias for {@link vec3.length}\n * @function\n */\nexport const len = length;\n/**\n * Alias for {@link vec3.squaredLength}\n * @function\n */\nexport const sqrLen = squaredLength;\n/**\n * Perform some operation over an array of vec3s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\nexport const forEach = (function () {\n const vec = create();\n return function (a, stride, offset, count, fn, arg) {\n let i;\n let l;\n if (!stride) {\n stride = 3;\n }\n if (!offset) {\n offset = 0;\n }\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n }\n else {\n l = a.length;\n }\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n }\n return a;\n };\n})();\n//# sourceMappingURL=vec3.js.map","// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Copyright (c) 2017 Uber Technologies, Inc.\nimport { Vector } from \"./base/vector.js\";\nimport { config, isArray } from \"../lib/common.js\";\nimport { checkNumber } from \"../lib/validators.js\";\n// @ts-ignore gl-matrix types\nimport { angle as vec3_angle, cross as vec3_cross, rotateX as vec3_rotateX, rotateY as vec3_rotateY, rotateZ as vec3_rotateZ, transformMat4 as vec3_transformMat4, transformMat3 as vec3_transformMat3, transformQuat as vec3_transformQuat } from \"../gl-matrix/vec3.js\";\n/* eslint-disable camelcase */\nimport { vec3_transformMat2, vec3_transformMat4AsVector } from \"../lib/gl-matrix-extras.js\";\nconst ORIGIN = [0, 0, 0];\nlet ZERO;\n/**\n * Three-element vector class with common linear algebra operations.\n * Subclass of Array<number> meaning that it is highly compatible with other libraries\n */\nexport class Vector3 extends Vector {\n static get ZERO() {\n if (!ZERO) {\n ZERO = new Vector3(0, 0, 0);\n Object.freeze(ZERO);\n }\n return ZERO;\n }\n /**\n * @class\n * @param x\n * @param y\n * @param z\n */\n constructor(x = 0, y = 0, z = 0) {\n // PERF NOTE: initialize elements as double precision numbers\n super(-0, -0, -0);\n if (arguments.length === 1 && isArray(x)) {\n this.copy(x);\n }\n else {\n // this.set(x, y, z);\n if (config.debug) {\n checkNumber(x);\n checkNumber(y);\n checkNumber(z);\n }\n // @ts-expect-error TS2412: Property '0' of type 'number | [number, number, number]' is not assignable to numeric index type 'number'\n this[0] = x;\n this[1] = y;\n this[2] = z;\n }\n }\n set(x, y, z) {\n this[0] = x;\n this[1] = y;\n this[2] = z;\n return this.check();\n }\n copy(array) {\n this[0] = array[0];\n this[1] = array[1];\n this[2] = array[2];\n return this.check();\n }\n fromObject(object) {\n if (config.debug) {\n checkNumber(object.x);\n checkNumber(object.y);\n checkNumber(object.z);\n }\n this[0] = object.x;\n this[1] = object.y;\n this[2] = object.z;\n return this.check();\n }\n toObject(object) {\n object.x = this[0];\n object.y = this[1];\n object.z = this[2];\n return object;\n }\n // Getters/setters\n get ELEMENTS() {\n return 3;\n }\n get z() {\n return this[2];\n }\n set z(value) {\n this[2] = checkNumber(value);\n }\n // ACCESSORS\n angle(vector) {\n return vec3_angle(this, vector);\n }\n // MODIFIERS\n cross(vector) {\n vec3_cross(this, this, vector);\n return this.check();\n }\n rotateX({ radians, origin = ORIGIN }) {\n vec3_rotateX(this, this, origin, radians);\n return this.check();\n }\n rotateY({ radians, origin = ORIGIN }) {\n vec3_rotateY(this, this, origin, radians);\n return this.check();\n }\n rotateZ({ radians, origin = ORIGIN }) {\n vec3_rotateZ(this, this, origin, radians);\n return this.check();\n }\n // Transforms\n // transforms as point (4th component is implicitly 1)\n transform(matrix4) {\n return this.transformAsPoint(matrix4);\n }\n // transforms as point (4th component is implicitly 1)\n transformAsPoint(matrix4) {\n vec3_transformMat4(this, this, matrix4);\n return this.check();\n }\n // transforms as vector (4th component is implicitly 0, ignores translation. slightly faster)\n transformAsVector(matrix4) {\n vec3_transformMat4AsVector(this, this, matrix4);\n return this.check();\n }\n transformByMatrix3(matrix3) {\n vec3_transformMat3(this, this, matrix3);\n return this.check();\n }\n transformByMatrix2(matrix2) {\n vec3_transformMat2(this, this, matrix2);\n return this.check();\n }\n transformByQuaternion(quaternion) {\n vec3_transformQuat(this, this, quaternion);\n return this.check();\n }\n}\n//# sourceMappingURL=vector3.js.map","// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Copyright (c) 2017 Uber Technologies, Inc.\n/* eslint-disable camelcase */\nimport { transformMat4 as vec4_transformMat4, transformQuat as vec4_transformQuat } from \"../gl-matrix/vec3.js\";\nimport { vec4_transformMat2, vec4_transformMat3 } from \"../lib/gl-matrix-extras.js\";\nimport { Vector } from \"./base/vector.js\";\nimport { config, isArray } from \"../lib/common.js\";\nimport { checkNumber } from \"../lib/validators.js\";\nlet ZERO;\n/**\n * Four-element vector class with common linear algebra operations.\n * Subclass of Array<number> meaning that it is highly compatible with other libraries\n */\nexport class Vector4 extends Vector {\n static get ZERO() {\n if (!ZERO) {\n ZERO = new Vector4(0, 0, 0, 0);\n Object.freeze(ZERO);\n }\n return ZERO;\n }\n constructor(x = 0, y = 0, z = 0, w = 0) {\n // PERF NOTE: initialize elements as double precision numbers\n super(-0, -0, -0, -0);\n if (isArray(x) && arguments.length === 1) {\n this.copy(x);\n }\n else {\n // this.set(x, y, z, w);\n if (config.debug) {\n checkNumber(x);\n checkNumber(y);\n checkNumber(z);\n checkNumber(w);\n }\n this[0] = x;\n this[1] = y;\n this[2] = z;\n this[3] = w;\n }\n }\n set(x, y, z, w) {\n this[0] = x;\n this[1] = y;\n this[2] = z;\n this[3] = w;\n return this.check();\n }\n copy(array) {\n this[0] = array[0];\n this[1] = array[1];\n this[2] = array[2];\n this[3] = array[3];\n return this.check();\n }\n fromObject(object) {\n if (config.debug) {\n checkNumber(object.x);\n checkNumber(object.y);\n checkNumber(object.z);\n checkNumber(object.w);\n }\n this[0] = object.x;\n this[1] = object.y;\n this[2] = object.z;\n this[3] = object.w;\n return this;\n }\n toObject(object) {\n object.x = this[0];\n object.y = this[1];\n object.z = this[2];\n object.w = this[3];\n return object;\n }\n // Getters/setters\n /* eslint-disable no-multi-spaces, brace-style, no-return-assign */\n get ELEMENTS() {\n return 4;\n }\n get z() {\n return this[2];\n }\n set z(value) {\n this[2] = checkNumber(value);\n }\n get w() {\n return this[3];\n }\n set w(value) {\n this[3] = checkNumber(value);\n }\n transform(matrix4) {\n vec4_transformMat4(this, this, matrix4);\n return this.check();\n }\n transformByMatrix3(matrix3) {\n vec4_transformMat3(this, this, matrix3);\n return this.check();\n }\n transformByMatrix2(matrix2) {\n vec4_transformMat2(this, this, matrix2);\n return this.check();\n }\n transformByQuaternion(quaternion) {\n vec4_transformQuat(this, this, quaternion);\n return this.check();\n }\n // three.js compatibility\n applyMatrix4(m) {\n m.transform(this, this);\n return this;\n }\n}\n//# sourceMappingURL=vector4.js.map","// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Copyright (c) 2017 Uber Technologies, Inc.\nimport { MathArray } from \"./math-array.js\";\nimport { checkNumber } from \"../../lib/validators.js\";\nimport { config } from \"../../lib/common.js\";\n/** Base class for matrices */\nexport class Matrix extends MathArray {\n // fromObject(object) {\n // const array = object.elements;\n // return this.fromRowMajor(array);\n // }\n // toObject(object) {\n // const array = object.elements;\n // this.toRowMajor(array);\n // return object;\n // }\n // TODO better override formatString?\n toString() {\n let string = '[';\n if (config.printRowMajor) {\n string += 'row-major:';\n for (let row = 0; row < this.RANK; ++row) {\n for (let col = 0; col < this.RANK; ++col) {\n string += ` ${this[col * this.RANK + row]}`;\n }\n }\n }\n else {\n string += 'column-major:';\n for (let i = 0; i < this.ELEMENTS; ++i) {\n string += ` ${this[i]}`;\n }\n }\n string += ']';\n return string;\n }\n getElementIndex(row, col) {\n return col * this.RANK + row;\n }\n // By default assumes row major indices\n getElement(row, col) {\n return this[col * this.RANK + row];\n }\n // By default assumes row major indices\n setElement(row, col, value) {\n this[col * this.RANK + row] = checkNumber(value);\n return this;\n }\n getColumn(columnIndex, result = new Array(this.RANK).fill(-0)) {\n const firstIndex = columnIndex * this.RANK;\n for (let i = 0; i < this.RANK; ++i) {\n result[i] = this[firstIndex + i];\n }\n return result;\n }\n setColumn(columnIndex, columnVector) {\n const firstIndex = columnIndex * this.RANK;\n for (let i = 0; i < this.RANK; ++i) {\n this[firstIndex + i] = columnVector[i];\n }\n return this;\n }\n}\n//# sourceMappingURL=matrix.js.map","import * as glMatrix from './common.js';\n/**\n * 3x3 Matrix\n * @module mat3\n */\n/**\n * Creates a new identity mat3\n *\n * @returns {mat3} a new 3x3 matrix\n */\nexport function create() {\n const out = new glMatrix.ARRAY_TYPE(9);\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n }\n out[0] = 1;\n out[4] = 1;\n out[8] = 1;\n return out;\n}\n/**\n * Copies the upper-left 3x3 values into the given mat3.\n *\n * @param {mat3} out the receiving 3x3 matrix\n * @param {ReadonlyMat4} a the source 4x4 matrix\n * @returns {mat3} out\n */\nexport function fromMat4(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[4];\n out[4] = a[5];\n out[5] = a[6];\n out[6] = a[8];\n out[7] = a[9];\n out[8] = a[10];\n return out;\n}\n/**\n * Creates a new mat3 initialized with values from an existing matrix\n *\n * @param {ReadonlyMat3} a matrix to clone\n * @returns {mat3} a new 3x3 matrix\n */\nexport function clone(a) {\n const out = new glMatrix.ARRAY_TYPE(9);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\n * Copy the values from one mat3 to another\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the source matrix\n * @returns {mat3} out\n */\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\n * Create a new mat3 with the given values\n *\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m10 Component in column 1, row 0 position (index 3)\n * @param {Number} m11 Component in column 1, row 1 position (index 4)\n * @param {Number} m12 Component in column 1, row 2 position (index 5)\n * @param {Number} m20 Component in column 2, row 0 position (index 6)\n * @param {Number} m21 Component in column 2, row 1 position (index 7)\n * @param {Number} m22 Component in column 2, row 2 position (index 8)\n * @returns {mat3} A new mat3\n */\nexport function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n const out = new glMatrix.ARRAY_TYPE(9);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m10;\n out[4] = m11;\n out[5] = m12;\n out[6] = m20;\n out[7] = m21;\n out[8] = m22;\n return out;\n}\n/**\n * Set the components of a mat3 to the given values\n *\n * @param {mat3} out the receiving matrix\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m10 Component in column 1, row 0 position (index 3)\n * @param {Number} m11 Component in column 1, row 1 position (index 4)\n * @param {Number} m12 Component in column 1, row 2 position (index 5)\n * @param {Number} m20 Component in column 2, row 0 position (index 6)\n * @param {Number} m21 Component in column 2, row 1 position (index 7)\n * @param {Number} m22 Component in column 2, row 2 position (index 8)\n * @returns {mat3} out\n */\nexport function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m10;\n out[4] = m11;\n out[5] = m12;\n out[6] = m20;\n out[7] = m21;\n out[8] = m22;\n return out;\n}\n/**\n * Set a mat3 to the identity matrix\n *\n * @param {mat3} out the receiving matrix\n * @returns {mat3} out\n */\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\n * Transpose the values of a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the source matrix\n * @returns {mat3} out\n */\nexport function transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n const a01 = a[1];\n const a02 = a[2];\n const a12 = a[5];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a01;\n out[5] = a[7];\n out[6] = a02;\n out[7] = a12;\n }\n else {\n out[0] = a[0];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a[1];\n out[4] = a[4];\n out[5] = a[7];\n out[6] = a[2];\n out[7] = a[5];\n out[8] = a[8];\n }\n return out;\n}\n/**\n * Inverts a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the source matrix\n * @returns {mat3} out\n */\nexport function invert(out, a) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n const b01 = a22 * a11 - a12 * a21;\n const b11 = -a22 * a10 + a12 * a20;\n const b21 = a21 * a10 - a11 * a20;\n // Calculate the determinant\n let det = a00 * b01 + a01 * b11 + a02 * b21;\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n out[0] = b01 * det;\n out[1] = (-a22 * a01 + a02 * a21) * det;\n out[2] = (a12 * a01 - a02 * a11) * det;\n out[3] = b11 * det;\n out[4] = (a22 * a00 - a02 * a20) * det;\n out[5] = (-a12 * a00 + a02 * a10) * det;\n out[6] = b21 * det;\n out[7] = (-a21 * a00 + a01 * a20) * det;\n out[8] = (a11 * a00 - a01 * a10) * det;\n return out;\n}\n/**\n * Calculates the adjugate of a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the source matrix\n * @returns {mat3} out\n */\nexport function adjoint(out, a) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n out[0] = a11 * a22 - a12 * a21;\n out[1] = a02 * a21 - a01 * a22;\n out[2] = a01 * a12 - a02 * a11;\n out[3] = a12 * a20 - a10 * a22;\n out[4] = a00 * a22 - a02 * a20;\n out[5] = a02 * a10 - a00 * a12;\n out[6] = a10 * a21 - a11 * a20;\n out[7] = a01 * a20 - a00 * a21;\n out[8] = a00 * a11 - a01 * a10;\n return out;\n}\n/**\n * Calculates the determinant of a mat3\n *\n * @param {ReadonlyMat3} a the source matrix\n * @returns {Number} determinant of a\n */\nexport function determinant(a) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n return (a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20));\n}\n/**\n * Multiplies two mat3's\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the first operand\n * @param {ReadonlyMat3} b the second operand\n * @returns {mat3} out\n */\nexport function multiply(out, a, b) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b10 = b[3];\n const b11 = b[4];\n const b12 = b[5];\n const b20 = b[6];\n const b21 = b[7];\n const b22 = b[8];\n out[0] = b00 * a00 + b01 * a10 + b02 * a20;\n out[1] = b00 * a01 + b01 * a11 + b02 * a21;\n out[2] = b00 * a02 + b01 * a12 + b02 * a22;\n out[3] = b10 * a00 + b11 * a10 + b12 * a20;\n out[4] = b10 * a01 + b11 * a11 + b12 * a21;\n out[5] = b10 * a02 + b11 * a12 + b12 * a22;\n out[6] = b20 * a00 + b21 * a10 + b22 * a20;\n out[7] = b20 * a01 + b21 * a11 + b22 * a21;\n out[8] = b20 * a02 + b21 * a12 + b22 * a22;\n return out;\n}\n/**\n * Translate a mat3 by the given vector\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the matrix to translate\n * @param {ReadonlyVec2} v vector to translate by\n * @returns {mat3} out\n */\nexport function translate(out, a, v) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n const x = v[0];\n const y = v[1];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a10;\n out[4] = a11;\n out[5] = a12;\n out[6] = x * a00 + y * a10 + a20;\n out[7] = x * a01 + y * a11 + a21;\n out[8] = x * a02 + y * a12 + a22;\n return out;\n}\n/**\n * Rotates a mat3 by the given angle\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat3} out\n */\nexport function rotate(out, a, rad) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[3];\n const a11 = a[4];\n const a12 = a[5];\n const a20 = a[6];\n const a21 = a[7];\n const a22 = a[8];\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c * a00 + s * a10;\n out[1] = c * a01 + s * a11;\n out[2] = c * a02 + s * a12;\n out[3] = c * a10 - s * a00;\n out[4] = c * a11 - s * a01;\n out[5] = c * a12 - s * a02;\n out[6] = a20;\n out[7] = a21;\n out[8] = a22;\n return out;\n}\n/**\n * Scales the mat3 by the dimensions in the given vec2\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the matrix to scale\n * @param {ReadonlyVec2} v the vec2 to scale the matrix by\n * @returns {mat3} out\n **/\nexport function scale(out, a, v) {\n const x = v[0];\n const y = v[1];\n out[0] = x * a[0];\n out[1] = x * a[1];\n out[2] = x * a[2];\n out[3] = y * a[3];\n out[4] = y * a[4];\n out[5] = y * a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.translate(dest, dest, vec);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {ReadonlyVec2} v Translation vector\n * @returns {mat3} out\n */\nexport function fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = v[0];\n out[7] = v[1];\n out[8] = 1;\n return out;\n}\n/**\n * Creates a matrix from a given angle\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.rotate(dest, dest, rad);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat3} out\n */\nexport function fromRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = -s;\n out[4] = c;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat3.identity(dest);\n * mat3.scale(dest, dest, vec);\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {ReadonlyVec2} v Scaling vector\n * @returns {mat3} out\n */\nexport function fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = v[1];\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\n * Copies the values from a mat2d into a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat2d} a the matrix to copy\n * @returns {mat3} out\n **/\nexport function fromMat2d(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = 0;\n out[3] = a[2];\n out[4] = a[3];\n out[5] = 0;\n out[6] = a[4];\n out[7] = a[5];\n out[8] = 1;\n return out;\n}\n/**\n * Calculates a 3x3 matrix from the given quaternion\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {ReadonlyQuat} q Quaternion to create matrix from\n *\n * @returns {mat3} out\n */\nexport function fromQuat(out, q) {\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n out[0] = 1 - yy - zz;\n out[3] = yx - wz;\n out[6] = zx + wy;\n out[1] = yx + wz;\n out[4] = 1 - xx - zz;\n out[7] = zy - wx;\n out[2] = zx - wy;\n out[5] = zy + wx;\n out[8] = 1 - xx - yy;\n return out;\n}\n/**\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\n *\n * @param {mat3} out mat3 receiving operation result\n * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from\n *\n * @returns {mat3} out\n */\nexport function normalFromMat4(out, a) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const a30 = a[12];\n const a31 = a[13];\n const a32 = a[14];\n const a33 = a[15];\n const b00 = a00 * a11 - a01 * a10;\n const b01 = a00 * a12 - a02 * a10;\n const b02 = a00 * a13 - a03 * a10;\n const b03 = a01 * a12 - a02 * a11;\n const b04 = a01 * a13 - a03 * a11;\n const b05 = a02 * a13 - a03 * a12;\n const b06 = a20 * a31 - a21 * a30;\n const b07 = a20 * a32 - a22 * a30;\n const b08 = a20 * a33 - a23 * a30;\n const b09 = a21 * a32 - a22 * a31;\n const b10 = a21 * a33 - a23 * a31;\n const b11 = a22 * a33 - a23 * a32;\n // Calculate the determinant\n let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n return out;\n}\n/**\n * Generates a 2D projection matrix with the given bounds\n *\n * @param {mat3} out mat3 frustum matrix will be written into\n * @param {number} width Width of your gl context\n * @param {number} height Height of gl context\n * @returns {mat3} out\n */\nexport function projection(out, width, height) {\n out[0] = 2 / width;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = -2 / height;\n out[5] = 0;\n out[6] = -1;\n out[7] = 1;\n out[8] = 1;\n return out;\n}\n/**\n * Returns a string representation of a mat3\n *\n * @param {ReadonlyMat3} a matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\nexport function str(a) {\n return `mat3(${a[0]}, ${a[1]}, ${a[2]}, ${a[3]}, ${a[4]}, ${a[5]}, ${a[6]}, ${a[7]}, ${a[8]})`;\n}\n/**\n * Returns Frobenius norm of a mat3\n *\n * @param {ReadonlyMat3} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nexport function frob(a) {\n return Math.sqrt(a[0] * a[0] +\n a[1] * a[1] +\n a[2] * a[2] +\n a[3] * a[3] +\n a[4] * a[4] +\n a[5] * a[5] +\n a[6] * a[6] +\n a[7] * a[7] +\n a[8] * a[8]);\n}\n/**\n * Adds two mat3's\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the first operand\n * @param {ReadonlyMat3} b the second operand\n * @returns {mat3} out\n */\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n return out;\n}\n/**\n * Subtracts matrix b from matrix a\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the first operand\n * @param {ReadonlyMat3} b the second operand\n * @returns {mat3} out\n */\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n return out;\n}\n/**\n * Multiply each element of the matrix by a scalar.\n *\n * @param {mat3} out the receiving matrix\n * @param {ReadonlyMat3} a the matrix to scale\n * @param {Number} b amount to scale the matrix's elements by\n * @returns {mat3} out\n */\nexport function multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n return out;\n}\n/**\n * Adds two mat3's after multiplying each element of the second operand by a scalar value.\n *\n * @param {mat3} out the receiving vector\n * @param {ReadonlyMat3} a the first operand\n * @param {ReadonlyMat3} b the second operand\n * @param {Number} scale the amount to scale b's elements by before adding\n * @returns {mat3} out\n */\nexport function multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n return out;\n}\n/**\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyMat3} a The first matrix.\n * @param {ReadonlyMat3} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\nexport function exactEquals(a, b) {\n return (a[0] === b[0] &&\n a[1] === b[1] &&\n a[2] === b[2] &&\n a[3] === b[3] &&\n a[4] === b[4] &&\n a[5] === b[5] &&\n a[6] === b[6] &&\n a[7] === b[7] &&\n a[8] === b[8]);\n}\n/**\n * Returns whether or not the matrices have approximately the same elements in the same position.\n *\n * @param {ReadonlyMat3} a The first matrix.\n * @param {ReadonlyMat3} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\nexport function equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const a6 = a[6];\n const a7 = a[7];\n const a8 = a[8];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n const b6 = b[6];\n const b7 = b[7];\n const b8 = b[8];\n return (Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\n Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\n Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&\n Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&\n Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) &&\n Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) &&\n Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) &&\n Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)));\n}\n/**\n * Alias for {@link mat3.multiply}\n * @function\n */\nexport const mul = multiply;\n/**\n * Alias for {@link mat3.subtract}\n * @function\n */\nexport const sub = subtract;\n//# sourceMappingURL=mat3.js.map","// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Copyright (c) 2017 Uber Technologies, Inc.\nimport { Matrix } from \"./base/matrix.js\";\nimport { checkVector } from \"../lib/validators.js\";\nimport { vec4_transformMat3 } from \"../lib/gl-matrix-extras.js\";\nimport { fromQuat as mat3_fromQuat, determinant as mat3_determinant, transpose as mat3_transpose, invert as mat3_invert, multiply as mat3_multiply, rotate as mat3_rotate, scale as mat3_scale, translate as mat3_translate } from \"../gl-matrix/mat3.js\";\nimport { transformMat3 as vec2_transformMat3 } from \"../gl-matrix/vec2.js\";\nimport { transformMat3 as vec3_transformMat3 } from \"../gl-matrix/vec3.js\";\n// eslint-disable-next-line no-shadow\nvar INDICES;\n(function (INDICES) {\n INDICES[INDICES[\"COL0ROW0\"] = 0] = \"COL0ROW0\";\n INDICES[INDICES[\"COL0ROW1\"] = 1] = \"COL0ROW1\";\n INDICES[INDICES[\"COL0ROW2\"] = 2] = \"COL0ROW2\";\n INDICES[INDICES[\"COL1ROW0\"] = 3] = \"COL1ROW0\";\n INDICES[INDICES[\"COL1ROW1\"] = 4] = \"COL1ROW1\";\n INDICES[INDICES[\"COL1ROW2\"] = 5] = \"COL1ROW2\";\n INDICES[INDICES[\"COL2ROW0\"] = 6] = \"COL2ROW0\";\n INDICES[INDICES[\"COL2ROW1\"] = 7] = \"COL2ROW1\";\n INDICES[INDICES[\"COL2ROW2\"] = 8] = \"COL2ROW2\";\n})(INDICES || (INDICES = {}));\nconst IDENTITY_MATRIX = Object.freeze([1, 0, 0, 0, 1, 0, 0, 0, 1]);\n/**\n * A 3x3 matrix with common linear algebra operations\n * Subclass of Array<number> meaning that it is highly compatible with other libraries\n */\nexport class Matrix3 extends Matrix {\n static get IDENTITY() {\n return getIdentityMatrix();\n }\n static get ZERO() {\n return getZeroMatrix();\n }\n get ELEMENTS() {\n return 9;\n }\n get RANK() {\n return 3;\n }\n get INDICES() {\n return INDICES;\n }\n constructor(array, ...args) {\n // PERF NOTE: initialize elements as double precision numbers\n super(-0, -0, -0, -0, -0, -0, -0, -0, -0);\n if (arguments.length === 1 && Array.isArray(array)) {\n this.copy(array);\n }\n else if (args.length > 0) {\n this.copy([array, ...args]);\n }\n else {\n this.identity();\n }\n }\n copy(array) {\n // Element wise copy for performance\n this[0] = array[0];\n this[1] = array[1];\n this[2] = array[2];\n this[3] = array[3];\n this[4] = array[4];\n this[5] = array[5];\n this[6] = array[6];\n this[7] = array[7];\n this[8] = array[8];\n return this.check();\n }\n // Constructors\n identity() {\n return this.copy(IDENTITY_MATRIX);\n }\n /**\n *\n * @param object\n * @returns self\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n fromObject(object) {\n return this.check();\n }\n /** Calculates a 3x3 matrix from the given quaternion\n * q quat Quaternion to create matrix from\n */\n fromQuaternion(q) {\n mat3_fromQuat(this, q);\n return this.check();\n }\n /**\n * accepts column major order, stores in column major order\n */\n // eslint-disable-next-line max-params\n set(m00, m10, m20, m01, m11, m21, m02, m12, m22) {\n this[0] = m00;\n this[1] = m10;\n this[2] = m20;\n this[3] = m01;\n this[4] = m11;\n this[5] = m21;\n this[6] = m02;\n this[7] = m12;\n this[8] = m22;\n return this.check();\n }\n /**\n * accepts row major order, stores as column major\n */\n // eslint-disable-next-line max-params\n setRowMajor(m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n this[0] = m00;\n this[1] = m10;\n this[2] = m20;\n this[3] = m01;\n this[4] = m11;\n this[5] = m21;\n this[6] = m02;\n this[7] = m12;\n this[8] = m22;\n return this.check();\n }\n // Accessors\n determinant() {\n return mat3_determinant(this);\n }\n // Modifiers\n transpose() {\n mat3_transpose(this, this);\n return this.check();\n }\n /** Invert a matrix. Note that this can fail if the matrix is not invertible */\n invert() {\n mat3_invert(this, this);\n return this.check();\n }\n // Operations\n multiplyLeft(a) {\n mat3_multiply(this, a, this);\n return this.check();\n }\n multiplyRight(a) {\n mat3_multiply(this, this, a);\n return this.check();\n }\n rotate(radians) {\n mat3_rotate(this, this, radians);\n return this.check();\n }\n scale(factor) {\n if (Array.isArray(factor)) {\n mat3_scale(this, this, factor);\n }\n else {\n mat3_scale(this, this, [factor, factor]);\n }\n return this.check();\n }\n translate(vec) {\n mat3_translate(this, this, vec);\n return this.check();\n }\n // Transforms\n transform(vector, result) {\n let out;\n switch (vector.length) {\n case 2:\n out = vec2_transformMat3(result || [-0, -0], vector, this);\n break;\n case 3:\n out = vec3_transformMat3(result || [-0, -0, -0], vector, this);\n break;\n case 4:\n out = vec4_transformMat3(result || [-0, -0, -0, -0], vector, this);\n break;\n default:\n throw new Error('Illegal vector');\n }\n checkVector(out, vector.length);\n return out;\n }\n /** @deprecated */\n transformVector(vector, result) {\n return this.transform(vector, result);\n }\n /** @deprecated */\n transformVector2(vector, result) {\n return this.transform(vector, result);\n }\n /** @deprecated */\n transformVector3(vector, result) {\n return this.transform(vector, result);\n }\n}\nlet ZERO_MATRIX3;\nlet IDENTITY_MATRIX3 = null;\nfunction getZeroMatrix() {\n if (!ZERO_MATRIX3) {\n ZERO_MATRIX3 = new Matrix3([0, 0, 0, 0, 0, 0, 0, 0, 0]);\n Object.freeze(ZERO_MATRIX3);\n }\n return ZERO_MATRIX3;\n}\nfunction getIdentityMatrix() {\n if (!IDENTITY_MATRIX3) {\n IDENTITY_MATRIX3 = new Matrix3();\n Object.freeze(IDENTITY_MATRIX3);\n }\n return IDENTITY_MATRIX3;\n}\n//# sourceMappingURL=matrix3.js.map","// @eslint-disable\n// @ts-nocheck\nimport * as glMatrix from './common.js';\n/**\n * 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied.\n * @module mat4\n */\n/**\n * Creates a new identity mat4\n *\n * @returns a new 4x4 matrix\n */\nexport function create() {\n const out = new glMatrix.ARRAY_TYPE(16);\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n }\n out[0] = 1;\n out[5] = 1;\n out[10] = 1;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a new mat4 initialized with values from an existing matrix\n *\n * @param {ReadonlyMat4} a matrix to clone\n * @returns {mat4} a new 4x4 matrix\n */\nexport function clone(a) {\n const out = new glMatrix.ARRAY_TYPE(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\n * Copy the values from one mat4 to another\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\n * Create a new mat4 with the given values\n *\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\n * @returns {mat4} A new mat4\n */\nexport function fromValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n const out = new glMatrix.ARRAY_TYPE(16);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\n * Set the components of a mat4 to the given values\n *\n * @param {mat4} out the receiving matrix\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\n * @returns {mat4} out\n */\nexport function set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\n * Set a mat4 to the identity matrix\n *\n * @param {mat4} out the receiving matrix\n * @returns {mat4} out\n */\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Transpose the values of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\nexport function transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a12 = a[6];\n const a13 = a[7];\n const a23 = a[11];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n }\n else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n return out;\n}\n/**\n * Inverts a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\nexport function invert(out, a) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const a30 = a[12];\n const a31 = a[13];\n const a32 = a[14];\n const a33 = a[15];\n const b00 = a00 * a11 - a01 * a10;\n const b01 = a00 * a12 - a02 * a10;\n const b02 = a00 * a13 - a03 * a10;\n const b03 = a01 * a12 - a02 * a11;\n const b04 = a01 * a13 - a03 * a11;\n const b05 = a02 * a13 - a03 * a12;\n const b06 = a20 * a31 - a21 * a30;\n const b07 = a20 * a32 - a22 * a30;\n const b08 = a20 * a33 - a23 * a30;\n const b09 = a21 * a32 - a22 * a31;\n const b10 = a21 * a33 - a23 * a31;\n const b11 = a22 * a33 - a23 * a32;\n // Calculate the determinant\n let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n return out;\n}\n/**\n * Calculates the adjugate of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\nexport function adjoint(out, a) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const a30 = a[12];\n const a31 = a[13];\n const a32 = a[14];\n const a33 = a[15];\n const b00 = a00 * a11 - a01 * a10;\n const b01 = a00 * a12 - a02 * a10;\n const b02 = a00 * a13 - a03 * a10;\n const b03 = a01 * a12 - a02 * a11;\n const b04 = a01 * a13 - a03 * a11;\n const b05 = a02 * a13 - a03 * a12;\n const b06 = a20 * a31 - a21 * a30;\n const b07 = a20 * a32 - a22 * a30;\n const b08 = a20 * a33 - a23 * a30;\n const b09 = a21 * a32 - a22 * a31;\n const b10 = a21 * a33 - a23 * a31;\n const b11 = a22 * a33 - a23 * a32;\n out[0] = a11 * b11 - a12 * b10 + a13 * b09;\n out[1] = a02 * b10 - a01 * b11 - a03 * b09;\n out[2] = a31 * b05 - a32 * b04 + a33 * b03;\n out[3] = a22 * b04 - a21 * b05 - a23 * b03;\n out[4] = a12 * b08 - a10 * b11 - a13 * b07;\n out[5] = a00 * b11 - a02 * b08 + a03 * b07;\n out[6] = a32 * b02 - a30 * b05 - a33 * b01;\n out[7] = a20 * b05 - a22 * b02 + a23 * b01;\n out[8] = a10 * b10 - a11 * b08 + a13 * b06;\n out[9] = a01 * b08 - a00 * b10 - a03 * b06;\n out[10] = a30 * b04 - a31 * b02 + a33 * b00;\n out[11] = a21 * b02 - a20 * b04 - a23 * b00;\n out[12] = a11 * b07 - a10 * b09 - a12 * b06;\n out[13] = a00 * b09 - a01 * b07 + a02 * b06;\n out[14] = a31 * b01 - a30 * b03 - a32 * b00;\n out[15] = a20 * b03 - a21 * b01 + a22 * b00;\n return out;\n}\n/**\n * Calculates the determinant of a mat4\n *\n * @param {ReadonlyMat4} a the source matrix\n * @returns {Number} determinant of a\n */\nexport function determinant(a) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const a30 = a[12];\n const a31 = a[13];\n const a32 = a[14];\n const a33 = a[15];\n const b0 = a00 * a11 - a01 * a10;\n const b1 = a00 * a12 - a02 * a10;\n const b2 = a01 * a12 - a02 * a11;\n const b3 = a20 * a31 - a21 * a30;\n const b4 = a20 * a32 - a22 * a30;\n const b5 = a21 * a32 - a22 * a31;\n const b6 = a00 * b5 - a01 * b4 + a02 * b3;\n const b7 = a10 * b5 - a11 * b4 + a12 * b3;\n const b8 = a20 * b2 - a21 * b1 + a22 * b0;\n const b9 = a30 * b2 - a31 * b1 + a32 * b0;\n // Calculate the determinant\n return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9;\n}\n/**\n * Multiplies two mat4s\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\nexport function multiply(out, a, b) {\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n const a30 = a[12];\n const a31 = a[13];\n const a32 = a[14];\n const a33 = a[15];\n // Cache only the current line of the second matrix\n let b0 = b[0];\n let b1 = b[1];\n let b2 = b[2];\n let b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n}\n/**\n * Translate a mat4 by the given vector\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to translate\n * @param {ReadonlyVec3} v vector to translate by\n * @returns {mat4} out\n */\nexport function translate(out, a, v) {\n const x = v[0];\n const y = v[1];\n const z = v[2];\n let a00;\n let a01;\n let a02;\n let a03;\n let a10;\n let a11;\n let a12;\n let a13;\n let a20;\n let a21;\n let a22;\n let a23;\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n }\n else {\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a03;\n out[4] = a10;\n out[5] = a11;\n out[6] = a12;\n out[7] = a13;\n out[8] = a20;\n out[9] = a21;\n out[10] = a22;\n out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n return out;\n}\n/**\n * Scales the mat4 by the dimensions in the given vec3 not using vectorization\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to scale\n * @param {ReadonlyVec3} v the vec3 to scale the matrix by\n * @returns {mat4} out\n **/\nexport function scale(out, a, v) {\n const x = v[0];\n const y = v[1];\n const z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\n * Rotates a mat4 by the given angle around the given axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @param {ReadonlyVec3} axis the axis to rotate around\n * @returns {mat4} out\n */\nexport function rotate(out, a, rad, axis) {\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n let len = Math.sqrt(x * x + y * y + z * z);\n let c;\n let s;\n let t;\n let a00;\n let a01;\n let a02;\n let a03;\n let a10;\n let a11;\n let a12;\n let a13;\n let a20;\n let a21;\n let a22;\n let a23;\n let b00;\n let b01;\n let b02;\n let b10;\n let b11;\n let b12;\n let b20;\n let b21;\n let b22;\n if (len < glMatrix.EPSILON) {\n return null;\n }\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n // Construct the elements of the rotation matrix\n b00 = x * x * t + c;\n b01 = y * x * t + z * s;\n b02 = z * x * t - y * s;\n b10 = x * y * t - z * s;\n b11 = y * y * t + c;\n b12 = z * y * t + x * s;\n b20 = x * z * t + y * s;\n b21 = y * z * t - x * s;\n b22 = z * z * t + c;\n // Perform rotation-specific matrix multiplication\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n return out;\n}\n/**\n * Rotates a matrix by the given angle around the X axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nexport function rotateX(out, a, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n // Perform axis-specific matrix multiplication\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n}\n/**\n * Rotates a matrix by the given angle around the Y axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nexport function rotateY(out, a, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a20 = a[8];\n const a21 = a[9];\n const a22 = a[10];\n const a23 = a[11];\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n // Perform axis-specific matrix multiplication\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n}\n/**\n * Rotates a matrix by the given angle around the Z axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nexport function rotateZ(out, a, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[4];\n const a11 = a[5];\n const a12 = a[6];\n const a13 = a[7];\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n // Perform axis-specific matrix multiplication\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n}\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, dest, vec);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {ReadonlyVec3} v Translation vector\n * @returns {mat4} out\n */\nexport function fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.scale(dest, dest, vec);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {ReadonlyVec3} v Scaling vector\n * @returns {mat4} out\n */\nexport function fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = v[1];\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = v[2];\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a given angle around a given axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotate(dest, dest, rad, axis);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @param {ReadonlyVec3} axis the axis to rotate around\n * @returns {mat4} out\n */\nexport function fromRotation(out, rad, axis) {\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n let len = Math.sqrt(x * x + y * y + z * z);\n let c;\n let s;\n let t;\n if (len < glMatrix.EPSILON) {\n return null;\n }\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n // Perform rotation-specific matrix multiplication\n out[0] = x * x * t + c;\n out[1] = y * x * t + z * s;\n out[2] = z * x * t - y * s;\n out[3] = 0;\n out[4] = x * y * t - z * s;\n out[5] = y * y * t + c;\n out[6] = z * y * t + x * s;\n out[7] = 0;\n out[8] = x * z * t + y * s;\n out[9] = y * z * t - x * s;\n out[10] = z * z * t + c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from the given angle around the X axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateX(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nexport function fromXRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n // Perform axis-specific matrix multiplication\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = c;\n out[6] = s;\n out[7] = 0;\n out[8] = 0;\n out[9] = -s;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from the given angle around the Y axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateY(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nexport function fromYRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n // Perform axis-specific matrix multiplication\n out[0] = c;\n out[1] = 0;\n out[2] = -s;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = s;\n out[9] = 0;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from the given angle around the Z axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateZ(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nexport function fromZRotation(out, rad) {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n // Perform axis-specific matrix multiplication\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = 0;\n out[4] = -s;\n out[5] = c;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a quaternion rotation and vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {ReadonlyVec3} v Translation vector\n * @returns {mat4} out\n */\nexport function fromRotationTranslation(out, q, v) {\n // Quaternion math\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const xy = x * y2;\n const xz = x * z2;\n const yy = y * y2;\n const yz = y * z2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\n * Creates a new mat4 from a dual quat.\n *\n * @param {mat4} out Matrix\n * @param {ReadonlyQuat2} a Dual Quaternion\n * @returns {mat4} mat4 receiving operation result\n */\nexport function fromQuat2(out, a) {\n const translation = new glMatrix.ARRAY_TYPE(3);\n const bx = -a[0];\n const by = -a[1];\n const bz = -a[2];\n const bw = a[3];\n const ax = a[4];\n const ay = a[5];\n const az = a[6];\n const aw = a[7];\n const magnitude = bx * bx + by * by + bz * bz + bw * bw;\n // Only scale if it makes sense\n if (magnitude > 0) {\n translation[0] = ((ax * bw + aw * bx + ay * bz - az * by) * 2) / magnitude;\n translation[1] = ((ay * bw + aw * by + az * bx - ax * bz) * 2) / magnitude;\n translation[2] = ((az * bw + aw * bz + ax * by - ay * bx) * 2) / magnitude;\n }\n else {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n }\n fromRotationTranslation(out, a, translation);\n return out;\n}\n/**\n * Returns the translation vector component of a transformation\n * matrix. If a matrix is built with fromRotationTranslation,\n * the returned vector will be the same as the translation vector\n * originally supplied.\n * @param {vec3} out Vector to receive translation component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {vec3} out\n */\nexport function getTranslation(out, mat) {\n out[0] = mat[12];\n out[1] = mat[13];\n out[2] = mat[14];\n return out;\n}\n/**\n * Returns the scaling factor component of a transformation\n * matrix. If a matrix is built with fromRotationTranslationScale\n * with a normalized Quaternion paramter, the returned vector will be\n * the same as the scaling vector\n * originally supplied.\n * @param {vec3} out Vector to receive scaling factor component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {vec3} out\n */\nexport function getScaling(out, mat) {\n const m11 = mat[0];\n const m12 = mat[1];\n const m13 = mat[2];\n const m21 = mat[4];\n const m22 = mat[5];\n const m23 = mat[6];\n const m31 = mat[8];\n const m32 = mat[9];\n const m33 = mat[10];\n out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\n out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\n out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\n return out;\n}\n/**\n * Returns a quaternion representing the rotational component\n * of a transformation matrix. If a matrix is built with\n * fromRotationTranslation, the returned quaternion will be the\n * same as the quaternion originally supplied.\n * @param {quat} out Quaternion to receive the rotation component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {quat} out\n */\nexport function getRotation(out, mat) {\n const scaling = new glMatrix.ARRAY_TYPE(3);\n getScaling(scaling, mat);\n const is1 = 1 / scaling[0];\n const is2 = 1 / scaling[1];\n const is3 = 1 / scaling[2];\n const sm11 = mat[0] * is1;\n const sm12 = mat[1] * is2;\n const sm13 = mat[2] * is3;\n const sm21 = mat[4] * is1;\n const sm22 = mat[5] * is2;\n const sm23 = mat[6] * is3;\n const sm31 = mat[8] * is1;\n const sm32 = mat[9] * is2;\n const sm33 = mat[10] * is3;\n const trace = sm11 + sm22 + sm33;\n let S = 0;\n if (trace > 0) {\n S = Math.sqrt(trace + 1.0) * 2;\n out[3] = 0.25 * S;\n out[0] = (sm23 - sm32) / S;\n out[1] = (sm31 - sm13) / S;\n out[2] = (sm12 - sm21) / S;\n }\n else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\n out[3] = (sm23 - sm32) / S;\n out[0] = 0.25 * S;\n out[1] = (sm12 + sm21) / S;\n out[2] = (sm31 + sm13) / S;\n }\n else if (sm22 > sm33) {\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\n out[3] = (sm31 - sm13) / S;\n out[0] = (sm12 + sm21) / S;\n out[1] = 0.25 * S;\n out[2] = (sm23 + sm32) / S;\n }\n else {\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\n out[3] = (sm12 - sm21) / S;\n out[0] = (sm31 + sm13) / S;\n out[1] = (sm23 + sm32) / S;\n out[2] = 0.25 * S;\n }\n return out;\n}\n/**\n * Decomposes a transformation matrix into its rotation, translation\n * and scale components. Returns only the rotation component\n * @param {quat} out_r Quaternion to receive the rotation component\n * @param {vec3} out_t Vector to receive the translation vector\n * @param {vec3} out_s Vector to receive the scaling factor\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @returns {quat} out_r\n */\nexport function decompose(out_r, out_t, out_s, mat) {\n out_t[0] = mat[12];\n out_t[1] = mat[13];\n out_t[2] = mat[14];\n const m11 = mat[0];\n const m12 = mat[1];\n const m13 = mat[2];\n const m21 = mat[4];\n const m22 = mat[5];\n const m23 = mat[6];\n const m31 = mat[8];\n const m32 = mat[9];\n const m33 = mat[10];\n out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13);\n out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23);\n out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);\n const is1 = 1 / out_s[0];\n const is2 = 1 / out_s[1];\n const is3 = 1 / out_s[2];\n const sm11 = m11 * is1;\n const sm12 = m12 * is2;\n const sm13 = m13 * is3;\n const sm21 = m21 * is1;\n const sm22 = m22 * is2;\n const sm23 = m23 * is3;\n const sm31 = m31 * is1;\n const sm32 = m32 * is2;\n const sm33 = m33 * is3;\n const trace = sm11 + sm22 + sm33;\n let S = 0;\n if (trace > 0) {\n S = Math.sqrt(trace + 1.0) * 2;\n out_r[3] = 0.25 * S;\n out_r[0] = (sm23 - sm32) / S;\n out_r[1] = (sm31 - sm13) / S;\n out_r[2] = (sm12 - sm21) / S;\n }\n else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\n out_r[3] = (sm23 - sm32) / S;\n out_r[0] = 0.25 * S;\n out_r[1] = (sm12 + sm21) / S;\n out_r[2] = (sm31 + sm13) / S;\n }\n else if (sm22 > sm33) {\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\n out_r[3] = (sm31 - sm13) / S;\n out_r[0] = (sm12 + sm21) / S;\n out_r[1] = 0.25 * S;\n out_r[2] = (sm23 + sm32) / S;\n }\n else {\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\n out_r[3] = (sm12 - sm21) / S;\n out_r[0] = (sm31 + sm13) / S;\n out_r[1] = (sm23 + sm32) / S;\n out_r[2] = 0.25 * S;\n }\n return out_r;\n}\n/**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale)\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {ReadonlyVec3} v Translation vector\n * @param {ReadonlyVec3} s Scaling vector\n * @returns {mat4} out\n */\nexport function fromRotationTranslationScale(out, q, v, s) {\n // Quaternion math\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const xy = x * y2;\n const xz = x * z2;\n const yy = y * y2;\n const yz = y * z2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n const sx = s[0];\n const sy = s[1];\n const sz = s[2];\n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * mat4.translate(dest, origin);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale)\n * mat4.translate(dest, negativeOrigin);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {ReadonlyVec3} v Translation vector\n * @param {ReadonlyVec3} s Scaling vector\n * @param {ReadonlyVec3} o The origin vector around which to scale and rotate\n * @returns {mat4} out\n */\nexport function fromRotationTranslationScaleOrigin(out, q, v, s, o) {\n // Quaternion math\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const xy = x * y2;\n const xz = x * z2;\n const yy = y * y2;\n const yz = y * z2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n const sx = s[0];\n const sy = s[1];\n const sz = s[2];\n const ox = o[0];\n const oy = o[1];\n const oz = o[2];\n const out0 = (1 - (yy + zz)) * sx;\n const out1 = (xy + wz) * sx;\n const out2 = (xz - wy) * sx;\n const out4 = (xy - wz) * sy;\n const out5 = (1 - (xx + zz)) * sy;\n const out6 = (yz + wx) * sy;\n const out8 = (xz + wy) * sz;\n const out9 = (yz - wx) * sz;\n const out10 = (1 - (xx + yy)) * sz;\n out[0] = out0;\n out[1] = out1;\n out[2] = out2;\n out[3] = 0;\n out[4] = out4;\n out[5] = out5;\n out[6] = out6;\n out[7] = 0;\n out[8] = out8;\n out[9] = out9;\n out[10] = out10;\n out[11] = 0;\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\n out[15] = 1;\n return out;\n}\n/**\n * Calculates a 4x4 matrix from the given quaternion\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {ReadonlyQuat} q Quaternion to create matrix from\n *\n * @returns {mat4} out\n */\nexport function fromQuat(out, q) {\n const x = q[0];\n const y = q[1];\n const z = q[2];\n const w = q[3];\n const x2 = x + x;\n const y2 = y + y;\n const z2 = z + z;\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Generates a frustum matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {Number} left Left bound of the frustum\n * @param {Number} right Right bound of the frustum\n * @param {Number} bottom Bottom bound of the frustum\n * @param {Number} top Top bound of the frustum\n * @param {Number} near Near bound of the frustum\n * @param {Number} far Far bound of the frustum\n * @returns {mat4} out\n */\nexport function frustum(out, left, right, bottom, top, near, far) {\n const rl = 1 / (right - left);\n const tb = 1 / (top - bottom);\n const nf = 1 / (near - far);\n out[0] = near * 2 * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = near * 2 * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = far * near * 2 * nf;\n out[15] = 0;\n return out;\n}\n/**\n * Generates a perspective projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fovy Vertical field of view in radians\n * @param {number} aspect Aspect ratio. typically viewport width/height\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum, can be null or Infinity\n * @returns {mat4} out\n */\nexport function perspectiveNO(out, fovy, aspect, near, far) {\n const f = 1.0 / Math.tan(fovy / 2);\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n if (far != null && far !== Infinity) {\n const nf = 1 / (near - far);\n out[10] = (far + near) * nf;\n out[14] = 2 * far * near * nf;\n }\n else {\n out[10] = -1;\n out[14] = -2 * near;\n }\n return out;\n}\n/**\n * Alias for {@link mat4.perspectiveNO}\n * @function\n */\nexport const perspective = perspectiveNO;\n/**\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fovy Vertical field of view in radians\n * @param {number} aspect Aspect ratio. typically viewport width/height\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum, can be null or Infinity\n * @returns {mat4} out\n */\nexport function perspectiveZO(out, fovy, aspect, near, far) {\n const f = 1.0 / Math.tan(fovy / 2);\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n if (far != null && far !== Infinity) {\n const nf = 1 / (near - far);\n out[10] = far * nf;\n out[14] = far * near * nf;\n }\n else {\n out[10] = -1;\n out[14] = -near;\n }\n return out;\n}\n/**\n * Generates a perspective projection matrix with the given field of view.\n * This is primarily useful for generating projection matrices to be used\n * with the still experiemental WebVR API.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\nexport function perspectiveFromFieldOfView(out, fov, near, far) {\n const upTan = Math.tan((fov.upDegrees * Math.PI) / 180.0);\n const downTan = Math.tan((fov.downDegrees * Math.PI) / 180.0);\n const leftTan = Math.tan((fov.leftDegrees * Math.PI) / 180.0);\n const rightTan = Math.tan((fov.rightDegrees * Math.PI) / 180.0);\n const xScale = 2.0 / (leftTan + rightTan);\n const yScale = 2.0 / (upTan + downTan);\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = (upTan - downTan) * yScale * 0.5;\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = (far * near) / (near - far);\n out[15] = 0.0;\n return out;\n}\n/**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} left Left bound of the frustum\n * @param {number} right Right bound of the frustum\n * @param {number} bottom Bottom bound of the frustum\n * @param {number} top Top bound of the frustum\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\nexport function orthoNO(out, left, right, bottom, top, near, far) {\n const lr = 1 / (left - right);\n const bt = 1 / (bottom - top);\n const nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n}\n/**\n * Alias for {@link mat4.orthoNO}\n * @function\n */\nexport const ortho = orthoNO;\n/**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} left Left bound of the frustum\n * @param {number} right Right bound of the frustum\n * @param {number} bottom Bottom bound of the frustum\n * @param {number} top Top bound of the frustum\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\nexport function orthoZO(out, left, right, bottom, top, near, far) {\n const lr = 1 / (left - right);\n const bt = 1 / (bottom - top);\n const nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = near * nf;\n out[15] = 1;\n return out;\n}\n/**\n * Generates a look-at matrix with the given eye position, focal point, and up axis.\n * If you want a matrix that actually makes an object look at another object, you should use targetTo instead.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {ReadonlyVec3} eye Position of the viewer\n * @param {ReadonlyVec3} center Point the viewer is looking at\n * @param {ReadonlyVec3} up vec3 pointing up\n * @returns {mat4} out\n */\nexport function lookAt(out, eye, center, up) {\n let len;\n let x0;\n let x1;\n let x2;\n let y0;\n let y1;\n let y2;\n let z0;\n let z1;\n let z2;\n const eyex = eye[0];\n const eyey = eye[1];\n const eyez = eye[2];\n const upx = up[0];\n const upy = up[1];\n const upz = up[2];\n const centerx = center[0];\n const centery = center[1];\n const centerz = center[2];\n if (Math.abs(eyex - centerx) < glMatrix.EPSILON &&\n Math.abs(eyey - centery) < glMatrix.EPSILON &&\n Math.abs(eyez - centerz) < glMatrix.EPSILON) {\n return identity(out);\n }\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n }\n else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n }\n else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n return out;\n}\n/**\n * Generates a matrix that makes something look at something else.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {ReadonlyVec3} eye Position of the viewer\n * @param {ReadonlyVec3} center Point the viewer is looking at\n * @param {ReadonlyVec3} up vec3 pointing up\n * @returns {mat4} out\n */\nexport function targetTo(out, eye, target, up) {\n const eyex = eye[0];\n const eyey = eye[1];\n const eyez = eye[2];\n const upx = up[0];\n const upy = up[1];\n const upz = up[2];\n let z0 = eyex - target[0];\n let z1 = eyey - target[1];\n let z2 = eyez - target[2];\n let len = z0 * z0 + z1 * z1 + z2 * z2;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n }\n let x0 = upy * z2 - upz * z1;\n let x1 = upz * z0 - upx * z2;\n let x2 = upx * z1 - upy * z0;\n len = x0 * x0 + x1 * x1 + x2 * x2;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n out[0] = x0;\n out[1] = x1;\n out[2] = x2;\n out[3] = 0;\n out[4] = z1 * x2 - z2 * x1;\n out[5] = z2 * x0 - z0 * x2;\n out[6] = z0 * x1 - z1 * x0;\n out[7] = 0;\n out[8] = z0;\n out[9] = z1;\n out[10] = z2;\n out[11] = 0;\n out[12] = eyex;\n out[13] = eyey;\n out[14] = eyez;\n out[15] = 1;\n return out;\n}\n/**\n * Returns a string representation of a mat4\n *\n * @param {ReadonlyMat4} a matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\nexport function str(a) {\n return `mat4(${a[0]}, ${a[1]}, ${a[2]}, ${a[3]}, ${a[4]}, ${a[5]}, ${a[6]}, ${a[7]}, ${a[8]}, ${a[9]}, ${a[10]}, ${a[11]}, ${a[12]}, ${a[13]}, ${a[14]}, ${a[15]})`;\n}\n/**\n * Returns Frobenius norm of a mat4\n *\n * @param {ReadonlyMat4} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nexport function frob(a) {\n return Math.sqrt(a[0] * a[0] +\n a[1] * a[1] +\n a[2] * a[2] +\n a[3] * a[3] +\n a[4] * a[4] +\n a[5] * a[5] +\n a[6] * a[6] +\n a[7] * a[7] +\n a[8] * a[8] +\n a[9] * a[9] +\n a[10] * a[10] +\n a[11] * a[11] +\n a[12] * a[12] +\n a[13] * a[13] +\n a[14] * a[14] +\n a[15] * a[15]);\n}\n/**\n * Adds two mat4's\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n out[9] = a[9] + b[9];\n out[10] = a[10] + b[10];\n out[11] = a[11] + b[11];\n out[12] = a[12] + b[12];\n out[13] = a[13] + b[13];\n out[14] = a[14] + b[14];\n out[15] = a[15] + b[15];\n return out;\n}\n/**\n * Subtracts matrix b from matrix a\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n out[9] = a[9] - b[9];\n out[10] = a[10] - b[10];\n out[11] = a[11] - b[11];\n out[12] = a[12] - b[12];\n out[13] = a[13] - b[13];\n out[14] = a[14] - b[14];\n out[15] = a[15] - b[15];\n return out;\n}\n/**\n * Multiply each element of the matrix by a scalar.\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to scale\n * @param {Number} b amount to scale the matrix's elements by\n * @returns {mat4} out\n */\nexport function multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n out[9] = a[9] * b;\n out[10] = a[10] * b;\n out[11] = a[11] * b;\n out[12] = a[12] * b;\n out[13] = a[13] * b;\n out[14] = a[14] * b;\n out[15] = a[15] * b;\n return out;\n}\n/**\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\n *\n * @param {mat4} out the receiving vector\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @param {Number} scale the amount to scale b's elements by before adding\n * @returns {mat4} out\n */\nexport function multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n out[9] = a[9] + b[9] * scale;\n out[10] = a[10] + b[10] * scale;\n out[11] = a[11] + b[11] * scale;\n out[12] = a[12] + b[12] * scale;\n out[13] = a[13] + b[13] * scale;\n out[14] = a[14] + b[14] * scale;\n out[15] = a[15] + b[15] * scale;\n return out;\n}\n/**\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyMat4} a The first matrix.\n * @param {ReadonlyMat4} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\nexport function exactEquals(a, b) {\n return (a[0] === b[0] &&\n a[1] === b[1] &&\n a[2] === b[2] &&\n a[3] === b[3] &&\n a[4] === b[4] &&\n a[5] === b[5] &&\n a[6] === b[6] &&\n a[7] === b[7] &&\n a[8] === b[8] &&\n a[9] === b[9] &&\n a[10] === b[10] &&\n a[11] === b[11] &&\n a[12] === b[12] &&\n a[13] === b[13] &&\n a[14] === b[14] &&\n a[15] === b[15]);\n}\n/**\n * Returns whether or not the matrices have approximately the same elements in the same position.\n *\n * @param {ReadonlyMat4} a The first matrix.\n * @param {ReadonlyMat4} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\nexport function equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const a6 = a[6];\n const a7 = a[7];\n const a8 = a[8];\n const a9 = a[9];\n const a10 = a[10];\n const a11 = a[11];\n const a12 = a[12];\n const a13 = a[13];\n const a14 = a[14];\n const a15 = a[15];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\n const b6 = b[6];\n const b7 = b[7];\n const b8 = b[8];\n const b9 = b[9];\n const b10 = b[10];\n const b11 = b[11];\n const b12 = b[12];\n const b13 = b[13];\n const b14 = b[14];\n const b15 = b[15];\n return (Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\n Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\n Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&\n Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&\n Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) &&\n Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) &&\n Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) &&\n Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)) &&\n Math.abs(a9 - b9) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a9), Math.abs(b9)) &&\n Math.abs(a10 - b10) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a10), Math.abs(b10)) &&\n Math.abs(a11 - b11) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a11), Math.abs(b11)) &&\n Math.abs(a12 - b12) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a12), Math.abs(b12)) &&\n Math.abs(a13 - b13) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a13), Math.abs(b13)) &&\n Math.abs(a14 - b14) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a14), Math.abs(b14)) &&\n Math.abs(a15 - b15) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a15), Math.abs(b15)));\n}\n/**\n * Alias for {@link mat4.multiply}\n * @function\n */\nexport const mul = multiply;\n/**\n * Alias for {@link mat4.subtract}\n * @function\n */\nexport const sub = subtract;\n//# sourceMappingURL=mat4.js.map","// @eslint-disable\n// @ts-nocheck\nimport * as glMatrix from './common.js';\n/**\n * 4 Dimensional Vector\n * @module vec4\n */\n/**\n * Creates a new, empty vec4\n *\n * @returns {vec4} a new 4D vector\n */\nexport function create() {\n const out = new glMatrix.ARRAY_TYPE(4);\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n }\n return out;\n}\n/**\n * Creates a new vec4 initialized with values from an existing vector\n *\n * @param {ReadonlyVec4} a vector to clone\n * @returns {vec4} a new 4D vector\n */\nexport function clone(a) {\n const out = new glMatrix.ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\n * Creates a new vec4 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {vec4} a new 4D vector\n */\nexport function fromValues(x, y, z, w) {\n const out = new glMatrix.ARRAY_TYPE(4);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\n * Copy the values from one vec4 to another\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the source vector\n * @returns {vec4} out\n */\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\n * Set the components of a vec4 to the given values\n *\n * @param {vec4} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {vec4} out\n */\nexport function set(out, x, y, z, w) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\n * Adds two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n}\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n}\n/**\n * Multiplies two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n out[3] = a[3] * b[3];\n return out;\n}\n/**\n * Divides two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n out[3] = a[3] / b[3];\n return out;\n}\n/**\n * Math.ceil the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to ceil\n * @returns {vec4} out\n */\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n out[3] = Math.ceil(a[3]);\n return out;\n}\n/**\n * Math.floor the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to floor\n * @returns {vec4} out\n */\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n out[3] = Math.floor(a[3]);\n return out;\n}\n/**\n * Returns the minimum of two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n}\n/**\n * Returns the maximum of two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n}\n/**\n * symmetric round the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to round\n * @returns {vec4} out\n */\nexport function round(out, a) {\n out[0] = glMatrix.round(a[0]);\n out[1] = glMatrix.round(a[1]);\n out[2] = glMatrix.round(a[2]);\n out[3] = glMatrix.round(a[3]);\n return out;\n}\n/**\n * Scales a vec4 by a scalar number\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec4} out\n */\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n}\n/**\n * Adds two vec4's after scaling the second operand by a scalar value\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec4} out\n */\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n}\n/**\n * Calculates the euclidian distance between two vec4's\n *\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {Number} distance between a and b\n */\nexport function distance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n const w = b[3] - a[3];\n return Math.sqrt(x * x + y * y + z * z + w * w);\n}\n/**\n * Calculates the squared euclidian distance between two vec4's\n *\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {Number} squared distance between a and b\n */\nexport function squaredDistance(a, b) {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n const w = b[3] - a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\n * Calculates the length of a vec4\n *\n * @param {ReadonlyVec4} a vector to calculate length of\n * @returns {Number} length of a\n */\nexport function length(a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n return Math.sqrt(x * x + y * y + z * z + w * w);\n}\n/**\n * Calculates the squared length of a vec4\n *\n * @param {ReadonlyVec4} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\nexport function squaredLength(a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\n * Negates the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to negate\n * @returns {vec4} out\n */\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = -a[3];\n return out;\n}\n/**\n * Returns the inverse of the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to invert\n * @returns {vec4} out\n */\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n out[3] = 1.0 / a[3];\n return out;\n}\n/**\n * Normalize a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to normalize\n * @returns {vec4} out\n */\nexport function normalize(out, a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n let len = x * x + y * y + z * z + w * w;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n out[0] = x * len;\n out[1] = y * len;\n out[2] = z * len;\n out[3] = w * len;\n return out;\n}\n/**\n * Calculates the dot product of two vec4's\n *\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {Number} dot product of a and b\n */\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n}\n/**\n * Returns the cross-product of three vectors in a 4-dimensional space\n *\n * @param {ReadonlyVec4} result the receiving vector\n * @param {ReadonlyVec4} U the first vector\n * @param {ReadonlyVec4} V the second vector\n * @param {ReadonlyVec4} W the third vector\n * @returns {vec4} result\n */\nexport function cross(out, u, v, w) {\n const A = v[0] * w[1] - v[1] * w[0];\n const B = v[0] * w[2] - v[2] * w[0];\n const C = v[0] * w[3] - v[3] * w[0];\n const D = v[1] * w[2] - v[2] * w[1];\n const E = v[1] * w[3] - v[3] * w[1];\n const F = v[2] * w[3] - v[3] * w[2];\n const G = u[0];\n const H = u[1];\n const I = u[2];\n const J = u[3];\n out[0] = H * F - I * E + J * D;\n out[1] = -(G * F) + I * C - J * B;\n out[2] = G * E - H * C + J * A;\n out[3] = -(G * D) + H * B - I * A;\n return out;\n}\n/**\n * Performs a linear interpolation between two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec4} out\n */\nexport function lerp(out, a, b, t) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n}\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec4} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned\n * @returns {vec4} out\n */\nexport function random(out, scale) {\n scale = scale === undefined ? 1.0 : scale;\n // Marsaglia, George. Choosing a Point from the Surface of a\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\n // http://projecteuclid.org/euclid.aoms/1177692644;\n let v1;\n let v2;\n let v3;\n let v4;\n let s1;\n let s2;\n do {\n v1 = glMatrix.RANDOM() * 2 - 1;\n v2 = glMatrix.RANDOM() * 2 - 1;\n s1 = v1 * v1 + v2 * v2;\n } while (s1 >= 1);\n do {\n v3 = glMatrix.RANDOM() * 2 - 1;\n v4 = glMatrix.RANDOM() * 2 - 1;\n s2 = v3 * v3 + v4 * v4;\n } while (s2 >= 1);\n const d = Math.sqrt((1 - s1) / s2);\n out[0] = scale * v1;\n out[1] = scale * v2;\n out[2] = scale * v3 * d;\n out[3] = scale * v4 * d;\n return out;\n}\n/**\n * Transforms the vec4 with a mat4.\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the vector to transform\n * @param {ReadonlyMat4} m matrix to transform with\n * @returns {vec4} out\n */\nexport function transformMat4(out, a, m) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}\n/**\n * Transforms the vec4 with a quat\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the vector to transform\n * @param {ReadonlyQuat} q quaternion to transform with\n * @returns {vec4} out\n */\nexport function transformQuat(out, a, q) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n // calculate quat * vec\n const ix = qw * x + qy * z - qz * y;\n const iy = qw * y + qz * x - qx * z;\n const iz = qw * z + qx * y - qy * x;\n const iw = -qx * x - qy * y - qz * z;\n // calculate result * inverse quat\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n out[3] = a[3];\n return out;\n}\n/**\n * Set the components of a vec4 to zero\n *\n * @param {vec4} out the receiving vector\n * @returns {vec4} out\n */\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n return out;\n}\n/**\n * Returns a string representation of a vector\n *\n * @param {ReadonlyVec4} a vector to represent as a string\n * @returns {String} string representation of the vector\n */\nexport function str(a) {\n return `vec4(${a[0]}, ${a[1]}, ${a[2]}, ${a[3]})`;\n}\n/**\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyVec4} a The first vector.\n * @param {ReadonlyVec4} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n/**\n * Returns whether or not the vectors have approximately the same elements in the same position.\n *\n * @param {ReadonlyVec4} a The first vector.\n * @param {ReadonlyVec4} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\nexport function equals(a, b) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n return (Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\n Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\n Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)));\n}\n/**\n * Alias for {@link vec4.subtract}\n * @function\n */\nexport const sub = subtract;\n/**\n * Alias for {@link vec4.multiply}\n * @function\n */\nexport const mul = multiply;\n/**\n * Alias for {@link vec4.divide}\n * @function\n */\nexport const div = divide;\n/**\n * Alias for {@link vec4.distance}\n * @function\n */\nexport const dist = distance;\n/**\n * Alias for {@link vec4.squaredDistance}\n * @function\n */\nexport const sqrDist = squaredDistance;\n/**\n * Alias for {@link vec4.length}\n * @function\n */\nexport const len = length;\n/**\n * Alias for {@link vec4.squaredLength}\n * @function\n */\nexport const sqrLen = squaredLength;\n/**\n * Perform some operation over an array of vec4s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\nexport const forEach = (function () {\n const vec = create();\n return function (a, stride, offset, count, fn, arg) {\n let i;\n let l;\n if (!stride) {\n stride = 4;\n }\n if (!offset) {\n offset = 0;\n }\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n }\n else {\n l = a.length;\n }\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n vec[3] = a[i + 3];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n a[i + 3] = vec[3];\n }\n return a;\n };\n})();\n//# sourceMappingURL=vec4.js.map","// @eslint-disable\n// @ts-nocheck\nimport * as glMatrix from './common.js';\nimport * as mat3 from './mat3.js';\nimport * as vec3 from './vec3.js';\nimport * as vec4 from './vec4.js';\n// const glMatrix: {EPSILON = 0.000001};\n/**\n * Quaternion in the format XYZW\n * @module quat\n */\n/**\n * Creates a new identity quat\n *\n * @returns {quat} a new quaternion\n */\nexport function create() {\n const out = new glMatrix.ARRAY_TYPE(4);\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n out[3] = 1;\n return out;\n}\n/**\n * Set a quat to the identity quaternion\n *\n * @param {quat} out the receiving quaternion\n * @returns {quat} out\n */\nexport function identity(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n}\n/**\n * Sets a quat from the given angle and rotation axis,\n * then returns it.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyVec3} axis the axis around which to rotate\n * @param {Number} rad the angle in radians\n * @returns {quat} out\n **/\nexport function setAxisAngle(out, axis, rad) {\n rad = rad * 0.5;\n const s = Math.sin(rad);\n out[0] = s * axis[0];\n out[1] = s * axis[1];\n out[2] = s * axis[2];\n out[3] = Math.cos(rad);\n return out;\n}\n/**\n * Gets the rotation axis and angle for a given\n * quaternion. If a quaternion is created with\n * setAxisAngle, this method will return the same\n * values as providied in the original parameter list\n * OR functionally equivalent values.\n * Example: The quaternion formed by axis [0, 0, 1] and\n * angle -90 is the same as the quaternion formed by\n * [0, 0, 1] and 270. This method favors the latter.\n * @param {vec3} out_axis Vector receiving the axis of rotation\n * @param {ReadonlyQuat} q Quaternion to be decomposed\n * @return {Number} Angle, in radians, of the rotation\n */\nexport function getAxisAngle(out_axis, q) {\n const rad = Math.acos(q[3]) * 2.0;\n const s = Math.sin(rad / 2.0);\n if (s > glMatrix.EPSILON) {\n out_axis[0] = q[0] / s;\n out_axis[1] = q[1] / s;\n out_axis[2] = q[2] / s;\n }\n else {\n // If s is zero, return any axis (no rotation - axis does not matter)\n out_axis[0] = 1;\n out_axis[1] = 0;\n out_axis[2] = 0;\n }\n return rad;\n}\n/**\n * Gets the angular distance between two unit quaternions\n *\n * @param {ReadonlyQuat} a Origin unit quaternion\n * @param {ReadonlyQuat} b Destination unit quaternion\n * @return {Number} Angle, in radians, between the two quaternions\n */\nexport function getAngle(a, b) {\n const dotproduct = dot(a, b);\n return Math.acos(2 * dotproduct * dotproduct - 1);\n}\n/**\n * Multiplies two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @returns {quat} out\n */\nexport function multiply(out, a, b) {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n}\n/**\n * Rotates a quaternion by the given angle about the X axis\n *\n * @param {quat} out quat receiving operation result\n * @param {ReadonlyQuat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nexport function rotateX(out, a, rad) {\n rad *= 0.5;\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const bx = Math.sin(rad);\n const bw = Math.cos(rad);\n out[0] = ax * bw + aw * bx;\n out[1] = ay * bw + az * bx;\n out[2] = az * bw - ay * bx;\n out[3] = aw * bw - ax * bx;\n return out;\n}\n/**\n * Rotates a quaternion by the given angle about the Y axis\n *\n * @param {quat} out quat receiving operation result\n * @param {ReadonlyQuat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nexport function rotateY(out, a, rad) {\n rad *= 0.5;\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const by = Math.sin(rad);\n const bw = Math.cos(rad);\n out[0] = ax * bw - az * by;\n out[1] = ay * bw + aw * by;\n out[2] = az * bw + ax * by;\n out[3] = aw * bw - ay * by;\n return out;\n}\n/**\n * Rotates a quaternion by the given angle about the Z axis\n *\n * @param {quat} out quat receiving operation result\n * @param {ReadonlyQuat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nexport function rotateZ(out, a, rad) {\n rad *= 0.5;\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n const bz = Math.sin(rad);\n const bw = Math.cos(rad);\n out[0] = ax * bw + ay * bz;\n out[1] = ay * bw - ax * bz;\n out[2] = az * bw + aw * bz;\n out[3] = aw * bw - az * bz;\n return out;\n}\n/**\n * Calculates the W component of a quat from the X, Y, and Z components.\n * Assumes that quaternion is 1 unit in length.\n * Any existing W component will be ignored.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate W component of\n * @returns {quat} out\n */\nexport function calculateW(out, a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\n return out;\n}\n/**\n * Calculate the exponential of a unit quaternion.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate the exponential of\n * @returns {quat} out\n */\nexport function exp(out, a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n const r = Math.sqrt(x * x + y * y + z * z);\n const et = Math.exp(w);\n const s = r > 0 ? (et * Math.sin(r)) / r : 0;\n out[0] = x * s;\n out[1] = y * s;\n out[2] = z * s;\n out[3] = et * Math.cos(r);\n return out;\n}\n/**\n * Calculate the natural logarithm of a unit quaternion.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate the exponential of\n * @returns {quat} out\n */\nexport function ln(out, a) {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = a[3];\n const r = Math.sqrt(x * x + y * y + z * z);\n const t = r > 0 ? Math.atan2(r, w) / r : 0;\n out[0] = x * t;\n out[1] = y * t;\n out[2] = z * t;\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\n return out;\n}\n/**\n * Calculate the scalar power of a unit quaternion.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate the exponential of\n * @param {Number} b amount to scale the quaternion by\n * @returns {quat} out\n */\nexport function pow(out, a, b) {\n ln(out, a);\n scale(out, out, b);\n exp(out, out);\n return out;\n}\n/**\n * Performs a spherical linear interpolation between two quat\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {quat} out\n */\nexport function slerp(out, a, b, t) {\n // benchmarks:\n // http://jsperf.com/quaternion-slerp-implementations\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n let bx = b[0];\n let by = b[1];\n let bz = b[2];\n let bw = b[3];\n let cosom;\n let omega;\n let scale0;\n let scale1;\n let sinom;\n // calc cosine\n cosom = ax * bx + ay * by + az * bz + aw * bw;\n // adjust signs (if necessary)\n if (cosom < 0.0) {\n cosom = -cosom;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n // calculate coefficients\n if (1.0 - cosom > glMatrix.EPSILON) {\n // standard case (slerp)\n omega = Math.acos(cosom);\n sinom = Math.sin(omega);\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n }\n else {\n // \"from\" and \"to\" quaternions are very close\n // ... so we can do a linear interpolation\n scale0 = 1.0 - t;\n scale1 = t;\n }\n // calculate final values\n out[0] = scale0 * ax + scale1 * bx;\n out[1] = scale0 * ay + scale1 * by;\n out[2] = scale0 * az + scale1 * bz;\n out[3] = scale0 * aw + scale1 * bw;\n return out;\n}\n/**\n * Generates a random unit quaternion\n *\n * @param {quat} out the receiving quaternion\n * @returns {quat} out\n */\n// export function random(out) {\n// // Implementation of http://planning.cs.uiuc.edu/node198.html\n// // TODO: Calling random 3 times is probably not the fastest solution\n// let u1 = glMatrix.RANDOM();\n// let u2 = glMatrix.RANDOM();\n// let u3 = glMatrix.RANDOM();\n// let sqrt1MinusU1 = Math.sqrt(1 - u1);\n// let sqrtU1 = Math.sqrt(u1);\n// out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\n// out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\n// out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\n// out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\n// return out;\n// }\n/**\n * Calculates the inverse of a quat\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate inverse of\n * @returns {quat} out\n */\nexport function invert(out, a) {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1.0 / dot : 0;\n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\n out[0] = -a0 * invDot;\n out[1] = -a1 * invDot;\n out[2] = -a2 * invDot;\n out[3] = a3 * invDot;\n return out;\n}\n/**\n * Calculates the conjugate of a quat\n * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quat to calculate conjugate of\n * @returns {quat} out\n */\nexport function conjugate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n return out;\n}\n/**\n * Creates a quaternion from the given 3x3 rotation matrix.\n *\n * NOTE: The resultant quaternion is not normalized, so you should be sure\n * to renormalize the quaternion yourself where necessary.\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyMat3} m rotation matrix\n * @returns {quat} out\n * @function\n */\nexport function fromMat3(out, m) {\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n const fTrace = m[0] + m[4] + m[8];\n let fRoot;\n if (fTrace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\n out[3] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot; // 1/(4w)\n out[0] = (m[5] - m[7]) * fRoot;\n out[1] = (m[6] - m[2]) * fRoot;\n out[2] = (m[1] - m[3]) * fRoot;\n }\n else {\n // |w| <= 1/2\n let i = 0;\n if (m[4] > m[0])\n i = 1;\n if (m[8] > m[i * 3 + i])\n i = 2;\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\n out[i] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot;\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\n }\n return out;\n}\n/**\n * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.\n *\n * @param {quat} out the receiving quaternion\n * @param {Number} x Angle to rotate around X axis in degrees.\n * @param {Number} y Angle to rotate around Y axis in degrees.\n * @param {Number} z Angle to rotate around Z axis in degrees.\n * @param {'zyx'|'xyz'|'yxz'|'yzx'|'zxy'|'zyx'} order Intrinsic order for conversion, default is zyx.\n * @returns {quat} out\n * @function\n */\n// export function fromEuler(out, x, y, z, order = glMatrix.ANGLE_ORDER) {\n// let halfToRad = Math.PI / 360;\n// x *= halfToRad;\n// z *= halfToRad;\n// y *= halfToRad;\n// let sx = Math.sin(x);\n// let cx = Math.cos(x);\n// let sy = Math.sin(y);\n// let cy = Math.cos(y);\n// let sz = Math.sin(z);\n// let cz = Math.cos(z);\n// switch (order) {\n// case \"xyz\":\n// out[0] = sx * cy * cz + cx * sy * sz;\n// out[1] = cx * sy * cz - sx * cy * sz;\n// out[2] = cx * cy * sz + sx * sy * cz;\n// out[3] = cx * cy * cz - sx * sy * sz;\n// break;\n// case \"xzy\":\n// out[0] = sx * cy * cz - cx * sy * sz;\n// out[1] = cx * sy * cz - sx * cy * sz;\n// out[2] = cx * cy * sz + sx * sy * cz;\n// out[3] = cx * cy * cz + sx * sy * sz;\n// break;\n// case \"yxz\":\n// out[0] = sx * cy * cz + cx * sy * sz;\n// out[1] = cx * sy * cz - sx * cy * sz;\n// out[2] = cx * cy * sz - sx * sy * cz;\n// out[3] = cx * cy * cz + sx * sy * sz;\n// break;\n// case \"yzx\":\n// out[0] = sx * cy * cz + cx * sy * sz;\n// out[1] = cx * sy * cz + sx * cy * sz;\n// out[2] = cx * cy * sz - sx * sy * cz;\n// out[3] = cx * cy * cz - sx * sy * sz;\n// break;\n// case \"zxy\":\n// out[0] = sx * cy * cz - cx * sy * sz;\n// out[1] = cx * sy * cz + sx * cy * sz;\n// out[2] = cx * cy * sz + sx * sy * cz;\n// out[3] = cx * cy * cz - sx * sy * sz;\n// break;\n// case \"zyx\":\n// out[0] = sx * cy * cz - cx * sy * sz;\n// out[1] = cx * sy * cz + sx * cy * sz;\n// out[2] = cx * cy * sz - sx * sy * cz;\n// out[3] = cx * cy * cz + sx * sy * sz;\n// break;\n// default:\n// throw new Error('Unknown angle order ' + order);\n// }\n// return out;\n// }\n/**\n * Returns a string representation of a quaternion\n *\n * @param {ReadonlyQuat} a vector to represent as a string\n * @returns {String} string representation of the vector\n */\nexport function str(a) {\n return `quat(${a[0]}, ${a[1]}, ${a[2]}, ${a[3]})`;\n}\n/**\n * Creates a new quat initialized with values from an existing quaternion\n *\n * @param {ReadonlyQuat} a quaternion to clone\n * @returns {quat} a new quaternion\n * @function\n */\nexport const clone = vec4.clone;\n/**\n * Creates a new quat initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {quat} a new quaternion\n * @function\n */\nexport const fromValues = vec4.fromValues;\n/**\n * Copy the values from one quat to another\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the source quaternion\n * @returns {quat} out\n * @function\n */\nexport const copy = vec4.copy;\n/**\n * Set the components of a quat to the given values\n *\n * @param {quat} out the receiving quaternion\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {quat} out\n * @function\n */\nexport const set = vec4.set;\n/**\n * Adds two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @returns {quat} out\n * @function\n */\nexport const add = vec4.add;\n/**\n * Alias for {@link quat.multiply}\n * @function\n */\nexport const mul = multiply;\n/**\n * Scales a quat by a scalar number\n *\n * @param {quat} out the receiving vector\n * @param {ReadonlyQuat} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {quat} out\n * @function\n */\nexport const scale = vec4.scale;\n/**\n * Calculates the dot product of two quat's\n *\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @returns {Number} dot product of a and b\n * @function\n */\nexport const dot = vec4.dot;\n/**\n * Performs a linear interpolation between two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {quat} out\n * @function\n */\nexport const lerp = vec4.lerp;\n/**\n * Calculates the length of a quat\n *\n * @param {ReadonlyQuat} a vector to calculate length of\n * @returns {Number} length of a\n */\nexport const length = vec4.length;\n/**\n * Alias for {@link quat.length}\n * @function\n */\nexport const len = length;\n/**\n * Calculates the squared length of a quat\n *\n * @param {ReadonlyQuat} a vector to calculate squared length of\n * @returns {Number} squared length of a\n * @function\n */\nexport const squaredLength = vec4.squaredLength;\n/**\n * Alias for {@link quat.squaredLength}\n * @function\n */\nexport const sqrLen = squaredLength;\n/**\n * Normalize a quat\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a quaternion to normalize\n * @returns {quat} out\n * @function\n */\nexport const normalize = vec4.normalize;\n/**\n * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyQuat} a The first quaternion.\n * @param {ReadonlyQuat} b The second quaternion.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\nexport const exactEquals = vec4.exactEquals;\n/**\n * Returns whether or not the quaternions point approximately to the same direction.\n *\n * Both quaternions are assumed to be unit length.\n *\n * @param {ReadonlyQuat} a The first unit quaternion.\n * @param {ReadonlyQuat} b The second unit quaternion.\n * @returns {Boolean} True if the quaternions are equal, false otherwise.\n */\nexport function equals(a, b) {\n return Math.abs(vec4.dot(a, b)) >= 1 - glMatrix.EPSILON;\n}\n/**\n * Sets a quaternion to represent the shortest rotation from one\n * vector to another.\n *\n * Both vectors are assumed to be unit length.\n *\n * @param {quat} out the receiving quaternion.\n * @param {ReadonlyVec3} a the initial vector\n * @param {ReadonlyVec3} b the destination vector\n * @returns {quat} out\n */\nexport const rotationTo = (function () {\n const tmpvec3 = vec3.create();\n const xUnitVec3 = vec3.fromValues(1, 0, 0);\n const yUnitVec3 = vec3.fromValues(0, 1, 0);\n return function (out, a, b) {\n const dot = vec3.dot(a, b);\n if (dot < -0.999999) {\n vec3.cross(tmpvec3, xUnitVec3, a);\n if (vec3.len(tmpvec3) < 0.000001)\n vec3.cross(tmpvec3, yUnitVec3, a);\n vec3.normalize(tmpvec3, tmpvec3);\n setAxisAngle(out, tmpvec3, Math.PI);\n return out;\n }\n else if (dot > 0.999999) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n }\n vec3.cross(tmpvec3, a, b);\n out[0] = tmpvec3[0];\n out[1] = tmpvec3[1];\n out[2] = tmpvec3[2];\n out[3] = 1 + dot;\n return normalize(out, out);\n };\n})();\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param {quat} out the receiving quaternion\n * @param {ReadonlyQuat} a the first operand\n * @param {ReadonlyQuat} b the second operand\n * @param {ReadonlyQuat} c the third operand\n * @param {ReadonlyQuat} d the fourth operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {quat} out\n */\nexport const sqlerp = (function () {\n const temp1 = create();\n const temp2 = create();\n return function (out, a, b, c, d, t) {\n slerp(temp1, a, d, t);\n slerp(temp2, b, c, t);\n slerp(out, temp1, temp2, 2 * t * (1 - t));\n return out;\n };\n})();\n/**\n * Sets the specified quaternion with values corresponding to the given\n * axes. Each axis is a vec3 and is expected to be unit length and\n * perpendicular to all other specified axes.\n *\n * @param {ReadonlyVec3} view the vector representing the viewing direction\n * @param {ReadonlyVec3} right the vector representing the local \"right\" direction\n * @param {ReadonlyVec3} up the vector representing the local \"up\" direction\n * @returns {quat} out\n */\nexport const setAxes = (function () {\n const matr = mat3.create();\n return function (out, view, right, up) {\n matr[0] = right[0];\n matr[3] = right[1];\n matr[6] = right[2];\n matr[1] = up[0];\n matr[4] = up[1];\n matr[7] = up[2];\n matr[2] = -view[0];\n matr[5] = -view[1];\n matr[8] = -view[2];\n return normalize(out, fromMat3(out, matr));\n };\n})();\n//# sourceMappingURL=quat.js.map","// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Copyright (c) 2017 Uber Technologies, Inc.\nimport { MathArray } from \"./base/math-array.js\";\nimport { checkNumber, checkVector } from \"../lib/validators.js\";\nimport { Vector4 } from \"./vector4.js\";\n// @ts-ignore gl-matrix types...\nimport { fromMat3 as quat_fromMat3, setAxisAngle as quat_setAxisAngle, identity as quat_identity, length as quat_length, squaredLength as quat_squaredLength, dot as quat_dot, \n// getAxisAngle as quat_getAxisAngle,\nrotationTo as quat_rotationTo, add as quat_add, calculateW as quat_calculateW, conjugate as quat_conjugate, invert as quat_invert, lerp as quat_lerp, multiply as quat_multiply, rotateX as quat_rotateX, rotateY as quat_rotateY, rotateZ as quat_rotateZ, scale as quat_scale, slerp as quat_slerp } from \"../gl-matrix/quat.js\";\n// @ts-ignore gl-matrix types...\nimport { transformQuat as vec4_transformQuat } from \"../gl-matrix/vec4.js\";\nconst IDENTITY_QUATERNION = [0, 0, 0, 1];\nexport class Quaternion extends MathArray {\n constructor(x = 0, y = 0, z = 0, w = 1) {\n // PERF NOTE: initialize elements as double precision numbers\n super(-0, -0, -0, -0);\n // eslint-disable-next-line prefer-rest-params\n if (Array.isArray(x) && arguments.length === 1) {\n this.copy(x);\n }\n else {\n this.set(x, y, z, w);\n }\n }\n copy(array) {\n this[0] = array[0];\n this[1] = array[1];\n this[2] = array[2];\n this[3] = array[3];\n return this.check();\n }\n set(x, y, z, w) {\n this[0] = x;\n this[1] = y;\n this[2] = z;\n this[3] = w;\n return this.check();\n }\n fromObject(object) {\n this[0] = object.x;\n this[1] = object.y;\n this[2] = object.z;\n this[3] = object.w;\n return this.check();\n }\n /**\n * Creates a quaternion from the given 3x3 rotation matrix.\n * NOTE: The resultant quaternion is not normalized, so you should\n * be sure to renormalize the quaternion yourself where necessary.\n * @param m\n * @returns\n */\n fromMatrix3(m) {\n quat_fromMat3(this, m);\n return this.check();\n }\n fromAxisRotation(axis, rad) {\n quat_setAxisAngle(this, axis, rad);\n return this.check();\n }\n /** Set a quat to the identity quaternion */\n identity() {\n quat_identity(this);\n return this.check();\n }\n // Set the components of a quat to the given values\n // set(i, j, k, l) {\n // quat_set(this, i, j, k, l);\n // return this.check();\n // }\n // Sets a quat from the given angle and rotation axis, then returns it.\n setAxisAngle(axis, rad) {\n return this.fromAxisRotation(axis, rad);\n }\n // Getters/setters\n get ELEMENTS() {\n return 4;\n }\n get x() {\n return this[0];\n }\n set x(value) {\n this[0] = checkNumber(value);\n }\n get y() {\n return this[1];\n }\n set y(value) {\n this[1] = checkNumber(value);\n }\n get z() {\n return this[2];\n }\n set z(value) {\n this[2] = checkNumber(value);\n }\n get w() {\n return this[3];\n }\n set w(value) {\n this[3] = checkNumber(value);\n }\n // Calculates the length of a quat\n len() {\n return quat_length(this);\n }\n // Calculates the squared length of a quat\n lengthSquared() {\n return quat_squaredLength(this);\n }\n // Calculates the dot product of two quat's\n // @return {Number}\n dot(a) {\n return quat_dot(this, a);\n }\n // Gets the rotation axis and angle for a given quaternion.\n // If a quaternion is created with setAxisAngle, this method will\n // return the same values as providied in the original parameter\n // list OR functionally equivalent values.\n // Example: The quaternion formed by axis [0, 0, 1] and angle -90\n // is the same as the quaternion formed by [0, 0, 1] and 270.\n // This method favors the latter.\n // @return {{[x,y,z], Number}}\n // getAxisAngle() {\n // const axis = [];\n // // const angle = quat_getAxisAngle(axis, this);\n // return {axis, angle};\n // }\n // MODIFIERS\n // Sets a quaternion to represent the shortest rotation from one vector\n // to another. Both vectors are assumed to be unit length.\n rotationTo(vectorA, vectorB) {\n quat_rotationTo(this, vectorA, vectorB);\n return this.check();\n }\n // Sets the specified quaternion with values corresponding to the given axes.\n // Each axis is a vec3 and is expected to be unit length and perpendicular\n // to all other specified axes.\n // setAxes() {\n // Number\n // }\n // Performs a spherical linear interpolation with two control points\n // sqlerp() {\n // Number;\n // }\n // Adds two quat's\n add(a) {\n quat_add(this, this, a);\n return this.check();\n }\n // Calculates the W component of a quat from the X, Y, and Z components.\n // Any existing W component will be ignored.\n calculateW() {\n quat_calculateW(this, this);\n return this.check();\n }\n // Calculates the conjugate of a quat If the quaternion is normalized,\n // this function is faster than quat_invert and produces the same result.\n conjugate() {\n quat_conjugate(this, this);\n return this.check();\n }\n // Calculates the inverse of a quat\n invert() {\n quat_invert(this, this);\n return this.check();\n }\n // Performs a linear interpolation between two quat's\n lerp(a, b, t) {\n if (t === undefined) {\n return this.lerp(this, a, b);\n }\n quat_lerp(this, a, b, t);\n return this.check();\n }\n // Multiplies two quat's\n multiplyRight(a) {\n quat_multiply(this, this, a);\n return this.check();\n }\n multiplyLeft(a) {\n quat_multiply(this, a, this);\n return this.check();\n }\n // Normalize a quat\n normalize() {\n // Handle 0 case\n const length = this.len();\n const l = length > 0 ? 1 / length : 0;\n this[0] = this[0] * l;\n this[1] = this[1] * l;\n this[2] = this[2] * l;\n this[3] = this[3] * l;\n // Set to [0, 0, 0, 1] if length is 0\n if (length === 0) {\n this[3] = 1;\n }\n return this.check();\n }\n // Rotates a quaternion by the given angle about the X axis\n rotateX(rad) {\n quat_rotateX(this, this, rad);\n return this.check();\n }\n // Rotates a quaternion by the given angle about the Y axis\n rotateY(rad) {\n quat_rotateY(this, this, rad);\n return this.check();\n }\n // Rotates a quaternion by the given angle about the Z axis\n rotateZ(rad) {\n quat_rotateZ(this, this, rad);\n return this.check();\n }\n // Scales a quat by a scalar number\n scale(b) {\n quat_scale(this, this, b);\n return this.check();\n }\n // Performs a spherical linear interpolation between two quat\n slerp(arg0, arg1, arg2) {\n let start;\n let target;\n let ratio;\n // eslint-disable-next-line prefer-rest-params\n switch (arguments.length) {\n case 1: // Deprecated signature ({start, target, ratio})\n // eslint-disable-next-line prefer-rest-params\n ({\n start = IDENTITY_QUATERNION,\n target,\n ratio\n } = arg0);\n break;\n case 2: // THREE.js compatibility signature (target, ration)\n start = this; // eslint-disable-line\n target = arg0;\n ratio = arg1;\n break;\n default:\n // Default signature: (start, target, ratio)\n start = arg0;\n target = arg1;\n ratio = arg2;\n }\n quat_slerp(this, start, target, ratio);\n return this.check();\n }\n transformVector4(vector, result = new Vector4()) {\n vec4_transformQuat(result, vector, this);\n return checkVector(result, 4);\n }\n // THREE.js Math API compatibility\n lengthSq() {\n return this.lengthSquared();\n }\n setFromAxisAngle(axis, rad) {\n return this.setAxisAngle(axis, rad);\n }\n premultiply(a) {\n return this.multiplyLeft(a);\n }\n multiply(a) {\n return this.multiplyRight(a);\n }\n}\n//# sourceMappingURL=quaternion.js.map","// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// NOTE: Added to make Cesium-derived test cases work\n// TODO: Determine if/how to keep\nexport const EPSILON1 = 1e-1;\nexport const EPSILON2 = 1e-2;\nexport const EPSILON3 = 1e-3;\nexport const EPSILON4 = 1e-4;\nexport const EPSILON5 = 1e-5;\nexport const EPSILON6 = 1e-6;\nexport const EPSILON7 = 1e-7;\nexport const EPSILON8 = 1e-8;\nexport const EPSILON9 = 1e-9;\nexport const EPSILON10 = 1e-10;\nexport const EPSILON11 = 1e-11;\nexport const EPSILON12 = 1e-12;\nexport const EPSILON13 = 1e-13;\nexport const EPSILON14 = 1e-14;\nexport const EPSILON15 = 1e-15;\nexport const EPSILON16 = 1e-16;\nexport const EPSILON17 = 1e-17;\nexport const EPSILON18 = 1e-18;\nexport const EPSILON19 = 1e-19;\nexport const EPSILON20 = 1e-20;\nexport const PI_OVER_TWO = Math.PI / 2;\nexport const PI_OVER_FOUR = Math.PI / 4;\nexport const PI_OVER_SIX = Math.PI / 6;\nexport const TWO_PI = Math.PI * 2;\n//# sourceMappingURL=math-utils.js.map","// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\nimport { Vector3 } from '@math.gl/core';\nimport { INTERSECTION } from \"../../constants.js\";\nconst scratchVector = new Vector3();\nconst scratchNormal = new Vector3();\n/**\n * An axis aligned bounding box - aligned with coordinate axes\n * @see BoundingVolume\n * @see BoundingRectangle\n * @see OrientedBoundingBox\n */\nexport class AxisAlignedBoundingBox {\n /**\n * Creates an instance of an AxisAlignedBoundingBox from the minimum and maximum points along the x, y, and z axes.\n * @param minimum=[0, 0, 0] The minimum point along the x, y, and z axes.\n * @param maximum=[0, 0, 0] The maximum point along the x, y, and z axes.\n * @param center The center of the box; automatically computed if not supplied.\n */\n constructor(minimum = [0, 0, 0], maximum = [0, 0, 0], center) {\n // If center was not defined, compute it.\n center = center || scratchVector.copy(minimum).add(maximum).scale(0.5);\n this.center = new Vector3(center);\n this.halfDiagonal = new Vector3(maximum).subtract(this.center);\n /**\n * The minimum point defining the bounding box.\n * @type {Vector3}\n * @default {@link 0, 0, 0}\n */\n this.minimum = new Vector3(minimum);\n /**\n * The maximum point defining the bounding box.\n * @type {Vector3}\n * @default {@link 0, 0, 0}\n */\n this.maximum = new Vector3(maximum);\n }\n /**\n * Duplicates a AxisAlignedBoundingBox instance.\n *\n * @returns {AxisAlignedBoundingBox} A new AxisAlignedBoundingBox instance.\n */\n clone() {\n return new AxisAlignedBoundingBox(this.minimum, this.maximum, this.center);\n }\n /**\n * Compares the provided AxisAlignedBoundingBox componentwise and returns\n * <code>true</code> if they are equal, <code>false</code> otherwise.\n *\n * @param {AxisAlignedBoundingBox} [right] The second AxisAlignedBoundingBox to compare with.\n * @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.\n */\n equals(right) {\n return (this === right ||\n (Boolean(right) && this.minimum.equals(right.minimum) && this.maximum.equals(right.maximum)));\n }\n /**\n * Applies a 4x4 affine transformation matrix to a bounding sphere.\n * @param transform The transformation matrix to apply to the bounding sphere.\n * @returns itself, i.e. the modified BoundingVolume.\n */\n transform(transform) {\n this.center.transformAsPoint(transform);\n // TODO - this.halfDiagonal.transformAsVector(transform);\n this.halfDiagonal.transform(transform);\n this.minimum.transform(transform);\n this.maximum.transform(transform);\n return this;\n }\n /**\n * Determines which side of a plane a box is located.\n */\n intersectPlane(plane) {\n const { halfDiagonal } = this;\n const normal = scratchNormal.from(plane.normal);\n const e = halfDiagonal.x * Math.abs(normal.x) +\n halfDiagonal.y * Math.abs(normal.y) +\n halfDiagonal.z * Math.abs(normal.z);\n const s = this.center.dot(normal) + plane.distance; // signed distance from center\n if (s - e > 0) {\n return INTERSECTION.INSIDE;\n }\n if (s + e < 0) {\n // Not in front because normals point inward\n return INTERSECTION.OUTSIDE;\n }\n return INTERSECTION.INTERSECTING;\n }\n /** Computes the estimated distance from the closest point on a bounding box to a point. */\n distanceTo(point) {\n return Math.sqrt(this.distanceSquaredTo(point));\n }\n /** Computes the estimated distance squared from the closest point on a bounding box to a point. */\n distanceSquaredTo(point) {\n const offset = scratchVector.from(point).subtract(this.center);\n const { halfDiagonal } = this;\n let distanceSquared = 0.0;\n let d;\n d = Math.abs(offset.x) - halfDiagonal.x;\n if (d > 0) {\n distanceSquared += d * d;\n }\n d = Math.abs(offset.y) - halfDiagonal.y;\n if (d > 0) {\n distanceSquared += d * d;\n }\n d = Math.abs(offset.z) - halfDiagonal.z;\n if (d > 0) {\n distanceSquared += d * d;\n }\n return distanceSquared;\n }\n}\n//# sourceMappingURL=axis-aligned-bounding-box.js.map","// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\nimport { Vector3, mat4 } from '@math.gl/core';\nimport { INTERSECTION } from \"../../constants.js\";\nconst scratchVector = new Vector3();\nconst scratchVector2 = new Vector3();\n/** A BoundingSphere */\nexport class BoundingSphere {\n /** Creates a bounding sphere */\n constructor(center = [0, 0, 0], radius = 0.0) {\n this.radius = -0;\n this.center = new Vector3();\n this.fromCenterRadius(center, radius);\n }\n /** Sets the bounding sphere from `center` and `radius`. */\n fromCenterRadius(center, radius) {\n this.center.from(center);\n this.radius = radius;\n return this;\n }\n /**\n * Computes a bounding sphere from the corner points of an axis-aligned bounding box. The sphere\n * tightly and fully encompasses the box.\n */\n fromCornerPoints(corner, oppositeCorner) {\n oppositeCorner = scratchVector.from(oppositeCorner);\n this.center = new Vector3().from(corner).add(oppositeCorner).scale(0.5);\n this.radius = this.center.distance(oppositeCorner);\n return this;\n }\n /** Compares the provided BoundingSphere component wise */\n equals(right) {\n return (this === right ||\n (Boolean(right) && this.center.equals(right.center) && this.radius === right.radius));\n }\n /** Duplicates a BoundingSphere instance. */\n clone() {\n return new BoundingSphere(this.center, this.radius);\n }\n /** Computes a bounding sphere that contains both the left and right bounding spheres. */\n union(boundingSphere) {\n const leftCenter = this.center;\n const leftRadius = this.radius;\n const rightCenter = boundingSphere.center;\n const rightRadius = boundingSphere.radius;\n const toRightCenter = scratchVector.copy(rightCenter).subtract(leftCenter);\n const centerSeparation = toRightCenter.magnitude();\n if (leftRadius >= centerSeparation + rightRadius) {\n // Left sphere wins.\n return this.clone();\n }\n if (rightRadius >= centerSeparation + leftRadius) {\n // Right sphere wins.\n return boundingSphere.clone();\n }\n // There are two tangent points, one on far side of each sphere.\n const halfDistanceBetweenTangentPoints = (leftRadius + centerSeparation + rightRadius) * 0.5;\n // Compute the center point halfway between the two tangent points.\n scratchVector2\n .copy(toRightCenter)\n .scale((-leftRadius + halfDistanceBetweenTangentPoints) / centerSeparation)\n .add(leftCenter);\n this.center.copy(scratchVector2);\n this.radius = halfDistanceBetweenTangentPoints;\n return this;\n }\n /** Computes a bounding sphere by enlarging the provided sphere to contain the provided point. */\n expand(point) {\n const scratchPoint = scratchVector.from(point);\n const radius = scratchPoint.subtract(this.center).magnitude();\n if (radius > this.radius) {\n this.radius = radius;\n }\n return this;\n }\n // BoundingVolume interface\n /**\n * Applies a 4x4 affine transformation matrix to a bounding sphere.\n * @param sphere The bounding sphere to apply the transformation to.\n * @param transform The transformation matrix to apply to the bounding sphere.\n * @returns self.\n */\n transform(transform) {\n this.center.transform(transform);\n const scale = mat4.getScaling(scratchVector, transform);\n this.radius = Math.max(scale[0], Math.max(scale[1], scale[2])) * this.radius;\n return this;\n }\n /** Computes the estimated distance squared from the closest point on a bounding sphere to a point. */\n distanceSquaredTo(point) {\n const d = this.distanceTo(point);\n return d * d;\n }\n /** Computes the estimated distance from the closest point on a bounding sphere to a point. */\n distanceTo(point) {\n const scratchPoint = scratchVector.from(point);\n const delta = scratchPoint.subtract(this.center);\n return Math.max(0, delta.len() - this.radius);\n }\n /** Determines which side of a plane a sphere is located. */\n intersectPlane(plane) {\n const center = this.center;\n const radius = this.radius;\n const normal = plane.normal;\n const distanceToPlane = normal.dot(center) + plane.distance;\n // The center point is negative side of the plane normal\n if (distanceToPlane < -radius) {\n return INTERSECTION.OUTSIDE;\n }\n // The center point is positive side of the plane, but radius extends beyond it; partial overlap\n if (distanceToPlane < radius) {\n return INTERSECTION.INTERSECTING;\n }\n // The center point and radius is positive side of the plane\n return INTERSECTION.INSIDE;\n }\n}\n//# sourceMappingURL=bounding-sphere.js.map","// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\nimport { Vector3, Matrix3, Quaternion } from '@math.gl/core';\nimport { BoundingSphere } from \"./bounding-sphere.js\";\nimport { INTERSECTION } from \"../../constants.js\";\nconst scratchVector3 = new Vector3();\nconst scratchOffset = new Vector3();\nconst scratchVectorU = new Vector3();\nconst scratchVectorV = new Vector3();\nconst scratchVectorW = new Vector3();\nconst scratchCorner = new Vector3();\nconst scratchToCenter = new Vector3();\nconst MATRIX3 = {\n COLUMN0ROW0: 0,\n COLUMN0ROW1: 1,\n COLUMN0ROW2: 2,\n COLUMN1ROW0: 3,\n COLUMN1ROW1: 4,\n COLUMN1ROW2: 5,\n COLUMN2ROW0: 6,\n COLUMN2ROW1: 7,\n COLUMN2ROW2: 8\n};\n/**\n * An OrientedBoundingBox of some object is a closed and convex cuboid.\n * It can provide a tighter bounding volume than `BoundingSphere` or\n * `AxisAlignedBoundingBox` in many cases.\n */\nexport class OrientedBoundingBox {\n constructor(center = [0, 0, 0], halfAxes = [0, 0, 0, 0, 0, 0, 0, 0, 0]) {\n this.center = new Vector3().from(center);\n this.halfAxes = new Matrix3(halfAxes);\n }\n /** Returns an array with three halfSizes for the bounding box */\n get halfSize() {\n const xAxis = this.halfAxes.getColumn(0);\n const yAxis = this.halfAxes.getColumn(1);\n const zAxis = this.halfAxes.getColumn(2);\n return [new Vector3(xAxis).len(), new Vector3(yAxis).len(), new Vector3(zAxis).len()];\n }\n /** Returns a quaternion describing the orientation of the bounding box */\n get quaternion() {\n const xAxis = this.halfAxes.getColumn(0);\n const yAxis = this.halfAxes.getColumn(1);\n const zAxis = this.halfAxes.getColumn(2);\n const normXAxis = new Vector3(xAxis).normalize();\n const normYAxis = new Vector3(yAxis).normalize();\n const normZAxis = new Vector3(zAxis).normalize();\n return new Quaternion().fromMatrix3(new Matrix3([...normXAxis, ...normYAxis, ...normZAxis]));\n }\n /**\n * Create OrientedBoundingBox from quaternion based OBB,\n */\n fromCenterHalfSizeQuaternion(center, halfSize, quaternion) {\n const quaternionObject = new Quaternion(quaternion);\n const directionsMatrix = new Matrix3().fromQuaternion(quaternionObject);\n directionsMatrix[0] = directionsMatrix[0] * halfSize[0];\n directionsMatrix[1] = directionsMatrix[1] * halfSize[0];\n directionsMatrix[2] = directionsMatrix[2] * halfSize[0];\n directionsMatrix[3] = directionsMatrix[3] * halfSize[1];\n directionsMatrix[4] = directionsMatrix[4] * halfSize[1];\n directionsMatrix[5] = directionsMatrix[5] * halfSize[1];\n directionsMatrix[6] = directionsMatrix[6] * halfSize[2];\n directionsMatrix[7] = directionsMatrix[7] * halfSize[2];\n directionsMatrix[8] = directionsMatrix[8] * halfSize[2];\n this.center = new Vector3().from(center);\n this.halfAxes = directionsMatrix;\n return this;\n }\n /** Duplicates a OrientedBoundingBox instance. */\n clone() {\n return new OrientedBoundingBox(this.center, this.halfAxes);\n }\n /** Compares the provided OrientedBoundingBox component wise and returns */\n equals(right) {\n return (this === right ||\n (Boolean(right) && this.center.equals(right.center) && this.halfAxes.equals(right.halfAxes)));\n }\n /** Computes a tight-fitting bounding sphere enclosing the provided oriented bounding box. */\n getBoundingSphere(result = new BoundingSphere()) {\n const halfAxes = this.halfAxes;\n const u = halfAxes.getColumn(0, scratchVectorU);\n const v = halfAxes.getColumn(1, scratchVectorV);\n const w = halfAxes.getColumn(2, scratchVectorW);\n // Calculate \"corner\" vector\n const cornerVector = scratchVector3.copy(u).add(v).add(w);\n result.center.copy(this.center);\n result.radius = cornerVector.magnitude();\n return result;\n }\n /** Determines which side of a plane the oriented bounding box is located. */\n intersectPlane(plane) {\n const center = this.center;\n const normal = plane.normal;\n const halfAxes = this.halfAxes;\n const normalX = normal.x;\n const normalY = normal.y;\n const normalZ = normal.z;\n // Plane is used as if it is its normal; the first three components are assumed to be normalized\n const radEffective = Math.abs(normalX * halfAxes[MATRIX3.COLUMN0ROW0] +\n normalY * halfAxes[MATRIX3.COLUMN0ROW1] +\n normalZ * halfAxes[MATRIX3.COLUMN0ROW2]) +\n Math.abs(normalX * halfAxes[MATRIX3.COLUMN1ROW0] +\n normalY * halfAxes[MATRIX3.COLUMN1ROW1] +\n normalZ * halfAxes[MATRIX3.COLUMN1ROW2]) +\n Math.abs(normalX * halfAxes[MATRIX3.COLUMN2ROW0] +\n normalY * halfAxes[MATRIX3.COLUMN2ROW1] +\n normalZ * halfAxes[MATRIX3.COLUMN2ROW2]);\n const distanceToPlane = normal.dot(center) + plane.distance;\n if (distanceToPlane <= -radEffective) {\n // The entire box is on the negative side of the plane normal\n return INTERSECTION.OUTSIDE;\n }\n else if (distanceToPlane >= radEffective) {\n // The entire box is on the positive side of the plane normal\n return INTERSECTION.INSIDE;\n }\n return INTERSECTION.INTERSECTING;\n }\n /** Computes the estimated distance from the closest point on a bounding box to a point. */\n distanceTo(point) {\n return Math.sqrt(this.distanceSquaredTo(point));\n }\n /**\n * Computes the estimated distance squared from the closest point\n * on a bounding box to a point.\n * See Geometric Tools for Computer Graphics 10.4.2\n */\n distanceSquaredTo(point) {\n // Computes the estimated distance squared from the\n // closest point on a bounding box to a point.\n // See Geometric Tools for Computer Graphics 10.4.2\n const offset = scratchOffset.from(point).subtract(this.center);\n const halfAxes = this.halfAxes;\n const u = halfAxes.getColumn(0, scratchVectorU);\n const v = halfAxes.getColumn(1, scratchVectorV);\n const w = halfAxes.getColumn(2, scratchVectorW);\n const uHalf = u.magnitude();\n const vHalf = v.magnitude();\n const wHalf = w.magnitude();\n u.normalize();\n v.normalize();\n w.normalize();\n let distanceSquared = 0.0;\n let d;\n d = Math.abs(offset.dot(u)) - uHalf;\n if (d > 0) {\n distanceSquared += d * d;\n }\n d = Math.abs(offset.dot(v)) - vHalf;\n if (d > 0) {\n distanceSquared += d * d;\n }\n d = Math.abs(offset.dot(w)) - wHalf;\n if (d > 0) {\n distanceSquared += d * d;\n }\n return distanceSquared;\n }\n /**\n * The distances calculated by the vector from the center of the bounding box\n * to position projected onto direction.\n *\n * - If you imagine the infinite number of planes with normal direction,\n * this computes the smallest distance to the closest and farthest planes\n * from `position` that intersect the bounding box.\n *\n * @param position The position to calculate the distance from.\n * @param direction The direction from position.\n * @param result An Interval (array of length 2) to store the nearest and farthest distances.\n * @returns Interval (array of length 2) with nearest and farthest distances\n * on the bounding box from position in direction.\n */\n // eslint-disable-next-line max-statements\n computePlaneDistances(position, direction, result = [-0, -0]) {\n let minDist = Number.POSITIVE_INFINITY;\n let maxDist = Number.NEGATIVE_INFINITY;\n const center = this.center;\n const halfAxes = this.halfAxes;\n const u = halfAxes.getColumn(0, scratchVectorU);\n const v = halfAxes.getColumn(1, scratchVectorV);\n const w = halfAxes.getColumn(2, scratchVectorW);\n // project first corner\n const corner = scratchCorner.copy(u).add(v).add(w).add(center);\n const toCenter = scratchToCenter.copy(corner).subtract(position);\n let mag = direction.dot(toCenter);\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n // project second corner\n corner.copy(center).add(u).add(v).subtract(w);\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n // project third corner\n corner.copy(center).add(u).subtract(v).add(w);\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n // project fourth corner\n corner.copy(center).add(u).subtract(v).subtract(w);\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n // project fifth corner\n center.copy(corner).subtract(u).add(v).add(w);\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n // project sixth corner\n center.copy(corner).subtract(u).add(v).subtract(w);\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n // project seventh corner\n center.copy(corner).subtract(u).subtract(v).add(w);\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n // project eighth corner\n center.copy(corner).subtract(u).subtract(v).subtract(w);\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n result[0] = minDist;\n result[1] = maxDist;\n return result;\n }\n /**\n * Applies a 4x4 affine transformation matrix to a bounding sphere.\n * @param transform The transformation matrix to apply to the bounding sphere.\n * @returns itself, i.e. the modified BoundingVolume.\n */\n transform(transformation) {\n this.center.transformAsPoint(transformation);\n const xAxis = this.halfAxes.getColumn(0, scratchVectorU);\n xAxis.transformAsPoint(transformation);\n const yAxis = this.halfAxes.getColumn(1, scratchVectorV);\n yAxis.transformAsPoint(transformation);\n const zAxis = this.halfAxes.getColumn(2, scratchVectorW);\n zAxis.transformAsPoint(transformation);\n this.halfAxes = new Matrix3([...xAxis, ...yAxis, ...zAxis]);\n return this;\n }\n getTransform() {\n // const modelMatrix = Matrix4.fromRotationTranslation(this.boundingVolume.halfAxes, this.boundingVolume.center);\n // return modelMatrix;\n throw new Error('not implemented');\n }\n}\n//# sourceMappingURL=oriented-bounding-box.js.map","// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n/* eslint-disable */\nimport { Vector3, equals, assert } from '@math.gl/core';\nconst scratchPosition = new Vector3();\nconst scratchNormal = new Vector3();\n// A plane in Hessian Normal Form\nexport class Plane {\n constructor(normal = [0, 0, 1], distance = 0) {\n this.normal = new Vector3();\n this.distance = -0;\n this.fromNormalDistance(normal, distance);\n }\n /** Creates a plane from a normal and a distance from the origin. */\n fromNormalDistance(normal, distance) {\n assert(Number.isFinite(distance));\n this.normal.from(normal).normalize();\n this.distance = distance;\n return this;\n }\n /** Creates a plane from a normal and a point on the plane. */\n fromPointNormal(point, normal) {\n point = scratchPosition.from(point);\n this.normal.from(normal).normalize();\n const distance = -this.normal.dot(point);\n this.distance = distance;\n return this;\n }\n /** Creates a plane from the general equation */\n fromCoefficients(a, b, c, d) {\n this.normal.set(a, b, c);\n assert(equals(this.normal.len(), 1));\n this.distance = d;\n return this;\n }\n /** Duplicates a Plane instance. */\n clone() {\n return new Plane(this.normal, this.distance);\n }\n /** Compares the provided Planes by normal and distance */\n equals(right) {\n return equals(this.distance, right.distance) && equals(this.normal, right.normal);\n }\n /** Computes the signed shortest distance of a point to a plane.\n * The sign of the distance determines which side of the plane the point is on.\n */\n getPointDistance(point) {\n return this.normal.dot(point) + this.distance;\n }\n /** Transforms the plane by the given transformation matrix. */\n transform(matrix4) {\n const normal = scratchNormal.copy(this.normal).transformAsVector(matrix4).normalize();\n const point = this.normal.scale(-this.distance).transform(matrix4);\n return this.fromPointNormal(point, normal);\n }\n projectPointOntoPlane(point, result = [0, 0, 0]) {\n const scratchPoint = scratchPosition.from(point);\n // projectedPoint = point - (normal.point + scale) * normal\n const pointDistance = this.getPointDistance(scratchPoint);\n const scaledNormal = scratchNormal.copy(this.normal).scale(pointDistance);\n return scratchPoint.subtract(scaledNormal).to(result);\n }\n}\n//# sourceMappingURL=plane.js.map","// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n/* eslint-disable */\nimport { Vector3, assert } from '@math.gl/core';\nimport { INTERSECTION } from \"../constants.js\";\nimport { Plane } from \"./plane.js\";\n// X, Y, Z Unit vectors\nconst faces = [new Vector3([1, 0, 0]), new Vector3([0, 1, 0]), new Vector3([0, 0, 1])];\nconst scratchPlaneCenter = new Vector3();\nconst scratchPlaneNormal = new Vector3();\n// const scratchPlane = new Plane(new Vector3(1.0, 0.0, 0.0), 0.0);\n/** A culling volume defined by planes. */\nexport class CullingVolume {\n /**\n * Create a new `CullingVolume` bounded by an array of clipping planed\n * @param planes Array of clipping planes.\n * */\n constructor(planes = []) {\n this.planes = planes;\n }\n /**\n * Constructs a culling volume from a bounding sphere. Creates six planes that create a box containing the sphere.\n * The planes are aligned to the x, y, and z axes in world coordinates.\n */\n fromBoundingSphere(boundingSphere) {\n this.planes.length = 2 * faces.length;\n const center = boundingSphere.center;\n const radius = boundingSphere.radius;\n let planeIndex = 0;\n for (const faceNormal of faces) {\n let plane0 = this.planes[planeIndex];\n let plane1 = this.planes[planeIndex + 1];\n if (!plane0) {\n plane0 = this.planes[planeIndex] = new Plane();\n }\n if (!plane1) {\n plane1 = this.planes[planeIndex + 1] = new Plane();\n }\n const plane0Center = scratchPlaneCenter.copy(faceNormal).scale(-radius).add(center);\n // const plane0Distance = -faceNormal.dot(plane0Center);\n plane0.fromPointNormal(plane0Center, faceNormal);\n const plane1Center = scratchPlaneCenter.copy(faceNormal).scale(radius).add(center);\n const negatedFaceNormal = scratchPlaneNormal.copy(faceNormal).negate();\n // const plane1Distance = -negatedFaceNormal.dot(plane1Center);\n plane1.fromPointNormal(plane1Center, negatedFaceNormal);\n planeIndex += 2;\n }\n return this;\n }\n /** Determines whether a bounding volume intersects the culling volume. */\n computeVisibility(boundingVolume) {\n // const planes = this.planes;\n let intersect = INTERSECTION.INSIDE;\n for (const plane of this.planes) {\n const result = boundingVolume.intersectPlane(plane);\n switch (result) {\n case INTERSECTION.OUTSIDE:\n // We are done\n return INTERSECTION.OUTSIDE;\n case INTERSECTION.INTERSECTING:\n // If no other intersection is outside, return INTERSECTING\n intersect = INTERSECTION.INTERSECTING;\n break;\n default:\n }\n }\n return intersect;\n }\n /**\n * Determines whether a bounding volume intersects the culling volume.\n *\n * @param parentPlaneMask A bit mask from the boundingVolume's parent's check against the same culling\n * volume, such that if (planeMask & (1 << planeIndex) === 0), for k < 31, then\n * the parent (and therefore this) volume is completely inside plane[planeIndex]\n * and that plane check can be skipped.\n */\n computeVisibilityWithPlaneMask(boundingVolume, parentPlaneMask) {\n assert(Number.isFinite(parentPlaneMask), 'parentPlaneMask is required.');\n if (parentPlaneMask === CullingVolume.MASK_OUTSIDE ||\n parentPlaneMask === CullingVolume.MASK_INSIDE) {\n // parent is completely outside or completely inside, so this child is as well.\n return parentPlaneMask;\n }\n // Start with MASK_INSIDE (all zeros) so that after the loop, the return value can be compared with MASK_INSIDE.\n // (Because if there are fewer than 31 planes, the upper bits wont be changed.)\n let mask = CullingVolume.MASK_INSIDE;\n const planes = this.planes;\n for (let k = 0; k < this.planes.length; ++k) {\n // For k greater than 31 (since 31 is the maximum number of INSIDE/INTERSECTING bits we can store), skip the optimization.\n const flag = k < 31 ? 1 << k : 0;\n if (k < 31 && (parentPlaneMask & flag) === 0) {\n // boundingVolume is known to be INSIDE this plane.\n continue;\n }\n const plane = planes[k];\n const result = boundingVolume.intersectPlane(plane);\n if (result === INTERSECTION.OUTSIDE) {\n return CullingVolume.MASK_OUTSIDE;\n }\n else if (result === INTERSECTION.INTERSECTING) {\n mask |= flag;\n }\n }\n return mask;\n }\n}\n/**\n * For plane masks (as used in {@link CullingVolume#computeVisibilityWithPlaneMask}), this special value\n * represents the case where the object bounding volume is entirely outside the culling volume.\n */\nCullingVolume.MASK_OUTSIDE = 0xffffffff;\n/**\n * For plane masks (as used in {@link CullingVolume.prototype.computeVisibilityWithPlaneMask}), this value\n * represents the case where the object bounding volume is entirely inside the culling volume.\n */\nCullingVolume.MASK_INSIDE = 0x00000000;\n/**\n * For plane masks (as used in {@link CullingVolume.prototype.computeVisibilityWithPlaneMask}), this value\n * represents the case where the object bounding volume (may) intersect all planes of the culling volume.\n */\nCullingVolume.MASK_INDETERMINATE = 0x7fffffff;\n//# sourceMappingURL=culling-volume.js.map","// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n// Note: This class is still an experimental export, mainly used by other test cases\n// - It has not been fully adapted to math.gl conventions\n// - Documentation has not been ported\nimport { Vector3, Matrix4, assert } from '@math.gl/core';\nimport { CullingVolume } from \"./culling-volume.js\";\nimport { Plane } from \"./plane.js\";\nconst scratchPlaneUpVector = new Vector3();\nconst scratchPlaneRightVector = new Vector3();\nconst scratchPlaneNearCenter = new Vector3();\nconst scratchPlaneFarCenter = new Vector3();\nconst scratchPlaneNormal = new Vector3();\nexport class PerspectiveOffCenterFrustum {\n /**\n * The viewing frustum is defined by 6 planes.\n * Each plane is represented by a {@link Vector4} object, where the x, y, and z components\n * define the unit vector normal to the plane, and the w component is the distance of the\n * plane from the origin/camera position.\n *\n * @alias PerspectiveOffCenterFrustum\n *\n * @example\n * const frustum = new PerspectiveOffCenterFrustum({\n * left : -1.0,\n * right : 1.0,\n * top : 1.0,\n * bottom : -1.0,\n * near : 1.0,\n * far : 100.0\n * });\n *\n * @see PerspectiveFrustum\n */\n constructor(options = {}) {\n this._cullingVolume = new CullingVolume([\n new Plane(),\n new Plane(),\n new Plane(),\n new Plane(),\n new Plane(),\n new Plane()\n ]);\n this._perspectiveMatrix = new Matrix4();\n this._infinitePerspective = new Matrix4();\n const { near = 1.0, far = 500000000.0 } = options;\n this.left = options.left;\n this._left = undefined;\n this.right = options.right;\n this._right = undefined;\n this.top = options.top;\n this._top = undefined;\n this.bottom = options.bottom;\n this._bottom = undefined;\n this.near = near;\n this._near = near;\n this.far = far;\n this._far = far;\n }\n /**\n * Returns a duplicate of a PerspectiveOffCenterFrustum instance.\n * @returns {PerspectiveOffCenterFrustum} A new PerspectiveFrustum instance.\n * */\n clone() {\n return new PerspectiveOffCenterFrustum({\n right: this.right,\n left: this.left,\n top: this.top,\n bottom: this.bottom,\n near: this.near,\n far: this.far\n });\n }\n /**\n * Compares the provided PerspectiveOffCenterFrustum componentwise and returns\n * <code>true</code> if they are equal, <code>false</code> otherwise.\n *\n * @returns {Boolean} <code>true</code> if they are equal, <code>false</code> otherwise.\n */\n equals(other) {\n return (other &&\n other instanceof PerspectiveOffCenterFrustum &&\n this.right === other.right &&\n this.left === other.left &&\n this.top === other.top &&\n this.bottom === other.bottom &&\n this.near === other.near &&\n this.far === other.far);\n }\n /**\n * Gets the perspective projection matrix computed from the view frustum.\n * @memberof PerspectiveOffCenterFrustum.prototype\n * @type {Matrix4}\n *\n * @see PerspectiveOffCenterFrustum#infiniteProjectionMatrix\n */\n get projectionMatrix() {\n this._update();\n return this._perspectiveMatrix;\n }\n /**\n * Gets the perspective projection matrix computed from the view frustum with an infinite far plane.\n * @memberof PerspectiveOffCenterFrustum.prototype\n * @type {Matrix4}\n *\n * @see PerspectiveOffCenterFrustum#projectionMatrix\n */\n get infiniteProjectionMatrix() {\n this._update();\n return this._infinitePerspective;\n }\n /**\n * Creates a culling volume for this frustum.\n * @returns {CullingVolume} A culling volume at the given position and orientation.\n *\n * @example\n * // Check if a bounding volume intersects the frustum.\n * const cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);\n * const intersect = cullingVolume.computeVisibility(boundingVolume);\n */\n // eslint-disable-next-line complexity, max-statements\n computeCullingVolume(\n /** A Vector3 defines the eye position. */\n position, \n /** A Vector3 defines the view direction. */\n direction, \n /** A Vector3 defines the up direction. */\n up) {\n assert(position, 'position is required.');\n assert(direction, 'direction is required.');\n assert(up, 'up is required.');\n const planes = this._cullingVolume.planes;\n up = scratchPlaneUpVector.copy(up).normalize();\n const right = scratchPlaneRightVector.copy(direction).cross(up).normalize();\n const nearCenter = scratchPlaneNearCenter\n .copy(direction)\n .multiplyByScalar(this.near)\n .add(position);\n const farCenter = scratchPlaneFarCenter\n .copy(direction)\n .multiplyByScalar(this.far)\n .add(position);\n let normal = scratchPlaneNormal;\n // Left plane computation\n normal.copy(right).multiplyByScalar(this.left).add(nearCenter).subtract(position).cross(up);\n planes[0].fromPointNormal(position, normal);\n // Right plane computation\n normal\n .copy(right)\n .multiplyByScalar(this.right)\n .add(nearCenter)\n .subtract(position)\n .cross(up)\n .negate();\n planes[1].fromPointNormal(position, normal);\n // Bottom plane computation\n normal\n .copy(up)\n .multiplyByScalar(this.bottom)\n .add(nearCenter)\n .subtract(position)\n .cross(right)\n .negate();\n planes[2].fromPointNormal(position, normal);\n // Top plane computation\n normal.copy(up).multiplyByScalar(this.top).add(nearCenter).subtract(position).cross(right);\n planes[3].fromPointNormal(position, normal);\n normal = new Vector3().copy(direction);\n // Near plane computation\n planes[4].fromPointNormal(nearCenter, normal);\n // Far plane computation\n normal.negate();\n planes[5].fromPointNormal(farCenter, normal);\n return this._cullingVolume;\n }\n /**\n * Returns the pixel's width and height in meters.\n *\n * @returns {Vector2} The modified result parameter or a new instance of {@link Vector2} with the pixel's width and height in the x and y properties, respectively.\n *\n * @exception {DeveloperError} drawingBufferWidth must be greater than zero.\n * @exception {DeveloperError} drawingBufferHeight must be greater than zero.\n *\n * @example\n * // Example 1\n * // Get the width and height of a pixel.\n * const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 1.0, new Vector2());\n *\n * @example\n * // Example 2\n * // Get the width and height of a pixel if the near plane was set to 'distance'.\n * // For example, get the size of a pixel of an image on a billboard.\n * const position = camera.position;\n * const direction = camera.direction;\n * const toCenter = Vector3.subtract(primitive.boundingVolume.center, position, new Vector3()); // vector from camera to a primitive\n * const toCenterProj = Vector3.multiplyByScalar(direction, Vector3.dot(direction, toCenter), new Vector3()); // project vector onto camera direction vector\n * const distance = Vector3.magnitude(toCenterProj);\n * const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, distance, new Vector2());\n */\n getPixelDimensions(\n /** The width of the drawing buffer. */\n drawingBufferWidth, \n /** The height of the drawing buffer. */\n drawingBufferHeight, \n /** The distance to the near plane in meters. */\n distance, \n /** The object onto which to store the result. */\n result) {\n this._update();\n assert(Number.isFinite(drawingBufferWidth) && Number.isFinite(drawingBufferHeight));\n // 'Both drawingBufferWidth and drawingBufferHeight are required.'\n assert(drawingBufferWidth > 0);\n // 'drawingBufferWidth must be greater than zero.'\n assert(drawingBufferHeight > 0);\n // 'drawingBufferHeight must be greater than zero.'\n assert(distance > 0);\n // 'distance is required.');\n assert(result);\n // 'A result object is required.');\n const inverseNear = 1.0 / this.near;\n let tanTheta = this.top * inverseNear;\n const pixelHeight = (2.0 * distance * tanTheta) / drawingBufferHeight;\n tanTheta = this.right * inverseNear;\n const pixelWidth = (2.0 * distance * tanTheta) / drawingBufferWidth;\n result.x = pixelWidth;\n result.y = pixelHeight;\n return result;\n }\n // eslint-disable-next-line complexity, max-statements\n _update() {\n assert(Number.isFinite(this.right) &&\n Number.isFinite(this.left) &&\n Number.isFinite(this.top) &&\n Number.isFinite(this.bottom) &&\n Number.isFinite(this.near) &&\n Number.isFinite(this.far));\n // throw new DeveloperError('right, left, top, bottom, near, or far parameters are not set.');\n const { top, bottom, right, left, near, far } = this;\n if (top !== this._top ||\n bottom !== this._bottom ||\n left !== this._left ||\n right !== this._right ||\n near !== this._near ||\n far !== this._far) {\n assert(this.near > 0 && this.near < this.far, 'near must be greater than zero and less than far.');\n this._left = left;\n this._right = right;\n this._top = top;\n this._bottom = bottom;\n this._near = near;\n this._far = far;\n this._perspectiveMatrix = new Matrix4().frustum({\n left,\n right,\n bottom,\n top,\n near,\n far\n });\n this._infinitePerspective = new Matrix4().frustum({\n left,\n right,\n bottom,\n top,\n near,\n far: Infinity\n });\n }\n }\n}\n//# sourceMappingURL=perspective-off-center-frustum.js.map","// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\nimport { Vector3 } from '@math.gl/core';\nimport { BoundingSphere } from \"../bounding-volumes/bounding-sphere.js\";\n/* eslint-disable */\nconst fromPointsXMin = new Vector3();\nconst fromPointsYMin = new Vector3();\nconst fromPointsZMin = new Vector3();\nconst fromPointsXMax = new Vector3();\nconst fromPointsYMax = new Vector3();\nconst fromPointsZMax = new Vector3();\nconst fromPointsCurrentPos = new Vector3();\nconst fromPointsScratch = new Vector3();\nconst fromPointsRitterCenter = new Vector3();\nconst fromPointsMinBoxPt = new Vector3();\nconst fromPointsMaxBoxPt = new Vector3();\nconst fromPointsNaiveCenterScratch = new Vector3();\n// const volumeConstant = (4.0 / 3.0) * Math.PI;\n/**\n * Computes a tight-fitting bounding sphere enclosing a list of 3D Cartesian points.\n *\n * The bounding sphere is computed by running two algorithms, a naive algorithm and\n * Ritter's algorithm. The smaller of the two spheres is used to ensure a tight fit.\n * Bounding sphere computation article http://blogs.agi.com/insight3d/index.php/2008/02/04/a-bounding\n *\n * @param positions An array of points that the bounding sphere will enclose.\n * @param result Optional object onto which to store the result.\n * @returns The modified result parameter or a new `BoundingSphere` instance if not provided.\n */\nexport function makeBoundingSphereFromPoints(positions, result = new BoundingSphere()) {\n if (!positions || positions.length === 0) {\n return result.fromCenterRadius([0, 0, 0], 0);\n }\n const currentPos = fromPointsCurrentPos.copy(positions[0]);\n const xMin = fromPointsXMin.copy(currentPos);\n const yMin = fromPointsYMin.copy(currentPos);\n const zMin = fromPointsZMin.copy(currentPos);\n const xMax = fromPointsXMax.copy(currentPos);\n const yMax = fromPointsYMax.copy(currentPos);\n const zMax = fromPointsZMax.copy(currentPos);\n for (const position of positions) {\n currentPos.copy(position);\n const x = currentPos.x;\n const y = currentPos.y;\n const z = currentPos.z;\n // Store points containing the the smallest and largest components\n if (x < xMin.x) {\n xMin.copy(currentPos);\n }\n if (x > xMax.x) {\n xMax.copy(currentPos);\n }\n if (y < yMin.y) {\n yMin.copy(currentPos);\n }\n if (y > yMax.y) {\n yMax.copy(currentPos);\n }\n if (z < zMin.z) {\n zMin.copy(currentPos);\n }\n if (z > zMax.z) {\n zMax.copy(currentPos);\n }\n }\n // Compute x-, y-, and z-spans (Squared distances b/n each component's min. and max.).\n const xSpan = fromPointsScratch.copy(xMax).subtract(xMin).magnitudeSquared();\n const ySpan = fromPointsScratch.copy(yMax).subtract(yMin).magnitudeSquared();\n const zSpan = fromPointsScratch.copy(zMax).subtract(zMin).magnitudeSquared();\n // Set the diameter endpoints to the largest span.\n let diameter1 = xMin;\n let diameter2 = xMax;\n let maxSpan = xSpan;\n if (ySpan > maxSpan) {\n maxSpan = ySpan;\n diameter1 = yMin;\n diameter2 = yMax;\n }\n if (zSpan > maxSpan) {\n maxSpan = zSpan;\n diameter1 = zMin;\n diameter2 = zMax;\n }\n // Calculate the center of the initial sphere found by Ritter's algorithm\n const ritterCenter = fromPointsRitterCenter;\n ritterCenter.x = (diameter1.x + diameter2.x) * 0.5;\n ritterCenter.y = (diameter1.y + diameter2.y) * 0.5;\n ritterCenter.z = (diameter1.z + diameter2.z) * 0.5;\n // Calculate the radius of the initial sphere found by Ritter's algorithm\n let radiusSquared = fromPointsScratch.copy(diameter2).subtract(ritterCenter).magnitudeSquared();\n let ritterRadius = Math.sqrt(radiusSquared);\n // Find the center of the sphere found using the Naive method.\n const minBoxPt = fromPointsMinBoxPt;\n minBoxPt.x = xMin.x;\n minBoxPt.y = yMin.y;\n minBoxPt.z = zMin.z;\n const maxBoxPt = fromPointsMaxBoxPt;\n maxBoxPt.x = xMax.x;\n maxBoxPt.y = yMax.y;\n maxBoxPt.z = zMax.z;\n const naiveCenter = fromPointsNaiveCenterScratch\n .copy(minBoxPt)\n .add(maxBoxPt)\n .multiplyByScalar(0.5);\n // Begin 2nd pass to find naive radius and modify the ritter sphere.\n let naiveRadius = 0;\n for (const position of positions) {\n currentPos.copy(position);\n // Find the furthest point from the naive center to calculate the naive radius.\n const r = fromPointsScratch.copy(currentPos).subtract(naiveCenter).magnitude();\n if (r > naiveRadius) {\n naiveRadius = r;\n }\n // Make adjustments to the Ritter Sphere to include all points.\n const oldCenterToPointSquared = fromPointsScratch\n .copy(currentPos)\n .subtract(ritterCenter)\n .magnitudeSquared();\n if (oldCenterToPointSquared > radiusSquared) {\n const oldCenterToPoint = Math.sqrt(oldCenterToPointSquared);\n // Calculate new radius to include the point that lies outside\n ritterRadius = (ritterRadius + oldCenterToPoint) * 0.5;\n radiusSquared = ritterRadius * ritterRadius;\n // Calculate center of new Ritter sphere\n const oldToNew = oldCenterToPoint - ritterRadius;\n ritterCenter.x = (ritterRadius * ritterCenter.x + oldToNew * currentPos.x) / oldCenterToPoint;\n ritterCenter.y = (ritterRadius * ritterCenter.y + oldToNew * currentPos.y) / oldCenterToPoint;\n ritterCenter.z = (ritterRadius * ritterCenter.z + oldToNew * currentPos.z) / oldCenterToPoint;\n }\n }\n if (ritterRadius < naiveRadius) {\n ritterCenter.to(result.center);\n result.radius = ritterRadius;\n }\n else {\n naiveCenter.to(result.center);\n result.radius = naiveRadius;\n }\n return result;\n}\n//# sourceMappingURL=bounding-sphere-from-points.js.map","// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\nimport { Matrix3, _MathUtils } from '@math.gl/core';\nconst scratchMatrix = new Matrix3();\nconst scratchUnitary = new Matrix3();\nconst scratchDiagonal = new Matrix3();\nconst jMatrix = new Matrix3();\nconst jMatrixTranspose = new Matrix3();\n/**\n * Computes the eigenvectors and eigenvalues of a symmetric matrix.\n *\n * - Returns a diagonal matrix and unitary matrix such that:\n * `matrix = unitary matrix * diagonal matrix * transpose(unitary matrix)`\n * - The values along the diagonal of the diagonal matrix are the eigenvalues. The columns\n * of the unitary matrix are the corresponding eigenvectors.\n * - This routine was created based upon Matrix Computations, 3rd ed., by Golub and Van Loan,\n * section 8.4.3 The Classical Jacobi Algorithm\n *\n * @param matrix The 3x3 matrix to decompose into diagonal and unitary matrix. Expected to be symmetric.\n * @param result Optional object with unitary and diagonal properties which are matrices onto which to store the result.\n * @returns An object with unitary and diagonal properties which are the unitary and diagonal matrices, respectively.\n *\n * @example\n * const a = //... symmetric matrix\n * const result = {\n * unitary : new Matrix3(),\n * diagonal : new Matrix3()\n * };\n * computeEigenDecomposition(a, result);\n *\n * const unitaryTranspose = Matrix3.transpose(result.unitary, new Matrix3());\n * const b = Matrix3.multiply(result.unitary, result.diagonal, new Matrix3());\n * Matrix3.multiply(b, unitaryTranspose, b); // b is now equal to a\n *\n * const lambda = result.diagonal.getColumn(0, new Vector3()).x; // first eigenvalue\n * const v = result.unitary.getColumn(0, new Vector3()); // first eigenvector\n * const c = v.multiplyByScalar(lambda); // equal to v.transformByMatrix3(a)\n */\nexport function computeEigenDecomposition(matrix, \n// @ts-expect-error accept empty object type\nresult = {}) {\n const EIGEN_TOLERANCE = _MathUtils.EPSILON20;\n const EIGEN_MAX_SWEEPS = 10;\n let count = 0;\n let sweep = 0;\n const unitaryMatrix = scratchUnitary;\n const diagonalMatrix = scratchDiagonal;\n unitaryMatrix.identity();\n diagonalMatrix.copy(matrix);\n const epsilon = EIGEN_TOLERANCE * computeFrobeniusNorm(diagonalMatrix);\n while (sweep < EIGEN_MAX_SWEEPS && offDiagonalFrobeniusNorm(diagonalMatrix) > epsilon) {\n shurDecomposition(diagonalMatrix, jMatrix);\n jMatrixTranspose.copy(jMatrix).transpose();\n diagonalMatrix.multiplyRight(jMatrix);\n diagonalMatrix.multiplyLeft(jMatrixTranspose);\n unitaryMatrix.multiplyRight(jMatrix);\n if (++count > 2) {\n ++sweep;\n count = 0;\n }\n }\n result.unitary = unitaryMatrix.toTarget(result.unitary);\n result.diagonal = diagonalMatrix.toTarget(result.diagonal);\n return result;\n}\nfunction computeFrobeniusNorm(matrix) {\n let norm = 0.0;\n for (let i = 0; i < 9; ++i) {\n const temp = matrix[i];\n norm += temp * temp;\n }\n return Math.sqrt(norm);\n}\nconst rowVal = [1, 0, 0];\nconst colVal = [2, 2, 1];\n// Computes the \"off-diagonal\" Frobenius norm.\n// Assumes matrix is symmetric.\nfunction offDiagonalFrobeniusNorm(matrix) {\n let norm = 0.0;\n for (let i = 0; i < 3; ++i) {\n const temp = matrix[scratchMatrix.getElementIndex(colVal[i], rowVal[i])];\n norm += 2.0 * temp * temp;\n }\n return Math.sqrt(norm);\n}\n// The routine takes a matrix, which is assumed to be symmetric, and\n// finds the largest off-diagonal term, and then creates\n// a matrix (result) which can be used to help reduce it\n//\n// This routine was created based upon Matrix Computations, 3rd ed., by Golub and Van Loan,\n// section 8.4.2 The 2by2 Symmetric Schur Decomposition.\n//\n// eslint-disable-next-line max-statements\nfunction shurDecomposition(matrix, result) {\n const tolerance = _MathUtils.EPSILON15;\n let maxDiagonal = 0.0;\n let rotAxis = 1;\n // find pivot (rotAxis) based on max diagonal of matrix\n for (let i = 0; i < 3; ++i) {\n const temp = Math.abs(matrix[scratchMatrix.getElementIndex(colVal[i], rowVal[i])]);\n if (temp > maxDiagonal) {\n rotAxis = i;\n maxDiagonal = temp;\n }\n }\n const p = rowVal[rotAxis];\n const q = colVal[rotAxis];\n let c = 1.0;\n let s = 0.0;\n if (Math.abs(matrix[scratchMatrix.getElementIndex(q, p)]) > tolerance) {\n const qq = matrix[scratchMatrix.getElementIndex(q, q)];\n const pp = matrix[scratchMatrix.getElementIndex(p, p)];\n const qp = matrix[scratchMatrix.getElementIndex(q, p)];\n const tau = (qq - pp) / 2.0 / qp;\n let t;\n if (tau < 0.0) {\n t = -1.0 / (-tau + Math.sqrt(1.0 + tau * tau));\n }\n else {\n t = 1.0 / (tau + Math.sqrt(1.0 + tau * tau));\n }\n c = 1.0 / Math.sqrt(1.0 + t * t);\n s = t * c;\n }\n // Copy into result\n Matrix3.IDENTITY.to(result);\n result[scratchMatrix.getElementIndex(p, p)] = result[scratchMatrix.getElementIndex(q, q)] = c;\n result[scratchMatrix.getElementIndex(q, p)] = s;\n result[scratchMatrix.getElementIndex(p, q)] = -s;\n return result;\n}\n//# sourceMappingURL=compute-eigen-decomposition.js.map","// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\nimport { Vector3, Matrix3 } from '@math.gl/core';\nimport { computeEigenDecomposition } from \"./compute-eigen-decomposition.js\";\nimport { OrientedBoundingBox } from \"../bounding-volumes/oriented-bounding-box.js\";\nimport { AxisAlignedBoundingBox } from \"../bounding-volumes/axis-aligned-bounding-box.js\";\nconst scratchVector2 = new Vector3();\nconst scratchVector3 = new Vector3();\nconst scratchVector4 = new Vector3();\nconst scratchVector5 = new Vector3();\nconst scratchVector6 = new Vector3();\nconst scratchCovarianceResult = new Matrix3();\nconst scratchEigenResult = {\n diagonal: new Matrix3(),\n unitary: new Matrix3()\n};\n/**\n * Computes an instance of an OrientedBoundingBox of the given positions.\n *\n * This is an implementation of Stefan Gottschalk's Collision Queries using Oriented Bounding Boxes solution (PHD thesis).\n * Reference: http://gamma.cs.unc.edu/users/gottschalk/main.pdf\n */\n/* eslint-disable max-statements */\nexport function makeOrientedBoundingBoxFromPoints(positions, result = new OrientedBoundingBox()) {\n if (!positions || positions.length === 0) {\n result.halfAxes = new Matrix3([0, 0, 0, 0, 0, 0, 0, 0, 0]);\n result.center = new Vector3();\n return result;\n }\n const length = positions.length;\n const meanPoint = new Vector3(0, 0, 0);\n for (const position of positions) {\n meanPoint.add(position);\n }\n const invLength = 1.0 / length;\n meanPoint.multiplyByScalar(invLength);\n let exx = 0.0;\n let exy = 0.0;\n let exz = 0.0;\n let eyy = 0.0;\n let eyz = 0.0;\n let ezz = 0.0;\n for (const position of positions) {\n const p = scratchVector2.copy(position).subtract(meanPoint);\n exx += p.x * p.x;\n exy += p.x * p.y;\n exz += p.x * p.z;\n eyy += p.y * p.y;\n eyz += p.y * p.z;\n ezz += p.z * p.z;\n }\n exx *= invLength;\n exy *= invLength;\n exz *= invLength;\n eyy *= invLength;\n eyz *= invLength;\n ezz *= invLength;\n const covarianceMatrix = scratchCovarianceResult;\n covarianceMatrix[0] = exx;\n covarianceMatrix[1] = exy;\n covarianceMatrix[2] = exz;\n covarianceMatrix[3] = exy;\n covarianceMatrix[4] = eyy;\n covarianceMatrix[5] = eyz;\n covarianceMatrix[6] = exz;\n covarianceMatrix[7] = eyz;\n covarianceMatrix[8] = ezz;\n const { unitary } = computeEigenDecomposition(covarianceMatrix, scratchEigenResult);\n const rotation = result.halfAxes.copy(unitary);\n let v1 = rotation.getColumn(0, scratchVector4);\n let v2 = rotation.getColumn(1, scratchVector5);\n let v3 = rotation.getColumn(2, scratchVector6);\n let u1 = -Number.MAX_VALUE;\n let u2 = -Number.MAX_VALUE;\n let u3 = -Number.MAX_VALUE;\n let l1 = Number.MAX_VALUE;\n let l2 = Number.MAX_VALUE;\n let l3 = Number.MAX_VALUE;\n for (const position of positions) {\n scratchVector2.copy(position);\n u1 = Math.max(scratchVector2.dot(v1), u1);\n u2 = Math.max(scratchVector2.dot(v2), u2);\n u3 = Math.max(scratchVector2.dot(v3), u3);\n l1 = Math.min(scratchVector2.dot(v1), l1);\n l2 = Math.min(scratchVector2.dot(v2), l2);\n l3 = Math.min(scratchVector2.dot(v3), l3);\n }\n v1 = v1.multiplyByScalar(0.5 * (l1 + u1));\n v2 = v2.multiplyByScalar(0.5 * (l2 + u2));\n v3 = v3.multiplyByScalar(0.5 * (l3 + u3));\n result.center.copy(v1).add(v2).add(v3);\n const scale = scratchVector3.set(u1 - l1, u2 - l2, u3 - l3).multiplyByScalar(0.5);\n const scaleMatrix = new Matrix3([scale[0], 0, 0, 0, scale[1], 0, 0, 0, scale[2]]);\n result.halfAxes.multiplyRight(scaleMatrix);\n return result;\n}\n/**\n * Computes an instance of an AxisAlignedBoundingBox. The box is determined by\n * finding the points spaced the farthest apart on the x, y, and z axes.\n */\nexport function makeAxisAlignedBoundingBoxFromPoints(positions, result = new AxisAlignedBoundingBox()) {\n if (!positions || positions.length === 0) {\n result.minimum.set(0, 0, 0);\n result.maximum.set(0, 0, 0);\n result.center.set(0, 0, 0);\n result.halfDiagonal.set(0, 0, 0);\n return result;\n }\n let minimumX = positions[0][0];\n let minimumY = positions[0][1];\n let minimumZ = positions[0][2];\n let maximumX = positions[0][0];\n let maximumY = positions[0][1];\n let maximumZ = positions[0][2];\n for (const p of positions) {\n const x = p[0];\n const y = p[1];\n const z = p[2];\n minimumX = Math.min(x, minimumX);\n maximumX = Math.max(x, maximumX);\n minimumY = Math.min(y, minimumY);\n maximumY = Math.max(y, maximumY);\n minimumZ = Math.min(z, minimumZ);\n maximumZ = Math.max(z, maximumZ);\n }\n result.minimum.set(minimumX, minimumY, minimumZ);\n result.maximum.set(maximumX, maximumY, maximumZ);\n result.center.copy(result.minimum).add(result.maximum).scale(0.5);\n result.halfDiagonal.copy(result.maximum).subtract(result.center);\n return result;\n}\n//# sourceMappingURL=bounding-box-from-points.js.map","// 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 function assert(condition, message) {\n if (!condition) {\n throw new Error(message || '@math.gl/web-mercator: assertion failed.');\n }\n}\n//# sourceMappingURL=assert.js.map","// TODO - THE UTILITIES IN THIS FILE SHOULD BE IMPORTED FROM WEB-MERCATOR-VIEWPORT MODULE\nimport { createMat4, transformVector, clamp, log2 } from \"./math-utils.js\";\nimport { mat4, vec2, vec3 } from '@math.gl/core';\nimport { assert } from \"./assert.js\";\n// CONSTANTS\nconst PI = Math.PI;\nconst PI_4 = PI / 4;\nconst DEGREES_TO_RADIANS = PI / 180;\nconst RADIANS_TO_DEGREES = 180 / PI;\nconst TILE_SIZE = 512;\n// Average circumference (40075 km equatorial, 40007 km meridional)\nconst EARTH_CIRCUMFERENCE = 40.03e6;\n// Latitude that makes a square world, 2 * atan(E ** PI) - PI / 2\nexport const MAX_LATITUDE = 85.051129;\n// Mapbox default altitude\nexport const DEFAULT_ALTITUDE = 1.5;\n/** Logarithimic zoom to linear scale **/\nexport function zoomToScale(zoom) {\n return Math.pow(2, zoom);\n}\n/** Linear scale to logarithimic zoom **/\nexport function scaleToZoom(scale) {\n return log2(scale);\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 *\n * @param lngLat - [lng, lat] coordinates\n * Specifies a point on the sphere to project onto the map.\n * @return [x,y] coordinates.\n */\nexport function lngLatToWorld(lngLat) {\n const [lng, lat] = lngLat;\n assert(Number.isFinite(lng));\n assert(Number.isFinite(lat) && lat >= -90 && lat <= 90, 'invalid latitude');\n const lambda2 = lng * DEGREES_TO_RADIANS;\n const phi2 = lat * DEGREES_TO_RADIANS;\n const x = (TILE_SIZE * (lambda2 + PI)) / (2 * PI);\n const y = (TILE_SIZE * (PI + Math.log(Math.tan(PI_4 + phi2 * 0.5)))) / (2 * PI);\n return [x, y];\n}\n/**\n * Unproject world point [x,y] on map onto {lat, lon} on sphere\n *\n * @param xy - array with [x,y] members\n * representing point on projected map plane\n * @return - array with [x,y] 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 */\nexport function worldToLngLat(xy) {\n const [x, y] = xy;\n const lambda2 = (x / TILE_SIZE) * (2 * PI) - PI;\n const phi2 = 2 * (Math.atan(Math.exp((y / TILE_SIZE) * (2 * PI) - PI)) - PI_4);\n return [lambda2 * RADIANS_TO_DEGREES, phi2 * RADIANS_TO_DEGREES];\n}\n/**\n * Returns the zoom level that gives a 1 meter pixel at a certain latitude\n * 1 = C*cos(y)/2^z/TILE_SIZE = C*cos(y)/2^(z+9)\n */\nexport function getMeterZoom(options) {\n const { latitude } = options;\n assert(Number.isFinite(latitude));\n const latCosine = Math.cos(latitude * DEGREES_TO_RADIANS);\n return scaleToZoom(EARTH_CIRCUMFERENCE * latCosine) - 9;\n}\n/**\n * Calculate the conversion from meter to common units at a given latitude\n * This is a cheaper version of `getDistanceScales`\n * @param latitude center latitude in degrees\n * @returns common units per meter\n */\nexport function unitsPerMeter(latitude) {\n const latCosine = Math.cos(latitude * DEGREES_TO_RADIANS);\n return TILE_SIZE / EARTH_CIRCUMFERENCE / latCosine;\n}\n/**\n * Calculate distance scales in meters around current lat/lon, both for\n * degrees and pixels.\n * In mercator projection mode, the distance scales vary significantly\n * with latitude.\n */\nexport function getDistanceScales(options) {\n const { latitude, longitude, highPrecision = false } = options;\n assert(Number.isFinite(latitude) && Number.isFinite(longitude));\n const worldSize = TILE_SIZE;\n const latCosine = Math.cos(latitude * DEGREES_TO_RADIANS);\n /**\n * Number of pixels occupied by one degree longitude around current lat/lon:\n unitsPerDegreeX = d(lngLatToWorld([lng, lat])[0])/d(lng)\n = scale * TILE_SIZE * DEGREES_TO_RADIANS / (2 * PI)\n unitsPerDegreeY = d(lngLatToWorld([lng, lat])[1])/d(lat)\n = -scale * TILE_SIZE * DEGREES_TO_RADIANS / cos(lat * DEGREES_TO_RADIANS) / (2 * PI)\n */\n const unitsPerDegreeX = worldSize / 360;\n const unitsPerDegreeY = unitsPerDegreeX / latCosine;\n /**\n * Number of pixels occupied by one meter around current lat/lon:\n */\n const altUnitsPerMeter = worldSize / EARTH_CIRCUMFERENCE / latCosine;\n /**\n * LngLat: longitude -> east and latitude -> north (bottom left)\n * UTM meter offset: x -> east and y -> north (bottom left)\n * World space: x -> east and y -> south (top left)\n *\n * Y needs to be flipped when converting delta degree/meter to delta pixels\n */\n const result = {\n unitsPerMeter: [altUnitsPerMeter, altUnitsPerMeter, altUnitsPerMeter],\n metersPerUnit: [1 / altUnitsPerMeter, 1 / altUnitsPerMeter, 1 / altUnitsPerMeter],\n unitsPerDegree: [unitsPerDegreeX, unitsPerDegreeY, altUnitsPerMeter],\n degreesPerUnit: [1 / unitsPerDegreeX, 1 / unitsPerDegreeY, 1 / altUnitsPerMeter]\n };\n /**\n * Taylor series 2nd order for 1/latCosine\n f'(a) * (x - a)\n = d(1/cos(lat * DEGREES_TO_RADIANS))/d(lat) * dLat\n = DEGREES_TO_RADIANS * tan(lat * DEGREES_TO_RADIANS) / cos(lat * DEGREES_TO_RADIANS) * dLat\n */\n if (highPrecision) {\n const latCosine2 = (DEGREES_TO_RADIANS * Math.tan(latitude * DEGREES_TO_RADIANS)) / latCosine;\n const unitsPerDegreeY2 = (unitsPerDegreeX * latCosine2) / 2;\n const altUnitsPerDegree2 = (worldSize / EARTH_CIRCUMFERENCE) * latCosine2;\n const altUnitsPerMeter2 = (altUnitsPerDegree2 / unitsPerDegreeY) * altUnitsPerMeter;\n result.unitsPerDegree2 = [0, unitsPerDegreeY2, altUnitsPerDegree2];\n result.unitsPerMeter2 = [altUnitsPerMeter2, 0, altUnitsPerMeter2];\n }\n // Main results, used for converting meters to latlng deltas and scaling offsets\n return result;\n}\n/**\n * Offset a lng/lat position by meterOffset (northing, easting)\n */\nexport function addMetersToLngLat(lngLatZ, xyz) {\n const [longitude, latitude, z0] = lngLatZ;\n const [x, y, z] = xyz;\n // eslint-disable-next-line no-shadow\n const { unitsPerMeter, unitsPerMeter2 } = getDistanceScales({\n longitude,\n latitude,\n highPrecision: true\n });\n const worldspace = lngLatToWorld(lngLatZ);\n worldspace[0] += x * (unitsPerMeter[0] + unitsPerMeter2[0] * y);\n worldspace[1] += y * (unitsPerMeter[1] + unitsPerMeter2[1] * y);\n const newLngLat = worldToLngLat(worldspace);\n const newZ = (z0 || 0) + (z || 0);\n return Number.isFinite(z0) || Number.isFinite(z) ? [newLngLat[0], newLngLat[1], newZ] : newLngLat;\n}\n/**\n *\n * view and projection matrix creation is intentionally kept compatible with\n * mapbox-gl's implementation to ensure that seamless interoperation\n * with mapbox and react-map-gl. See: https://github.com/mapbox/mapbox-gl-js\n */\nexport function getViewMatrix(options) {\n const { \n // Viewport props\n height, pitch, bearing, altitude, \n // Pre-calculated parameters\n scale, center } = options;\n // VIEW MATRIX: PROJECTS MERCATOR WORLD COORDINATES\n // Note that mercator world coordinates typically need to be flipped\n //\n // Note: As usual, matrix operation orders should be read in reverse\n // since vectors will be multiplied from the right during transformation\n const vm = createMat4();\n // Move camera to altitude (along the pitch & bearing direction)\n mat4.translate(vm, vm, [0, 0, -altitude]);\n // Rotate by bearing, and then by pitch (which tilts the view)\n mat4.rotateX(vm, vm, -pitch * DEGREES_TO_RADIANS);\n mat4.rotateZ(vm, vm, bearing * DEGREES_TO_RADIANS);\n const relativeScale = scale / height;\n mat4.scale(vm, vm, [relativeScale, relativeScale, relativeScale]);\n if (center) {\n mat4.translate(vm, vm, vec3.negate([], center));\n }\n return vm;\n}\n/**\n * Calculates mapbox compatible projection matrix from parameters\n *\n * @param options.width Width of \"viewport\" or window\n * @param options.height Height of \"viewport\" or window\n * @param options.scale Scale at the current zoom\n * @param options.center Offset of the target, vec3 in world space\n * @param options.offset Offset of the focal point, vec2 in screen space\n * @param options.pitch Camera angle in degrees (0 is straight down)\n * @param options.fovy field of view in degrees\n * @param options.altitude if provided, field of view is calculated using `altitudeToFovy()`\n * @param options.nearZMultiplier control z buffer\n * @param options.farZMultiplier control z buffer\n * @returns project parameters object\n */\nexport function getProjectionParameters(options) {\n const { width, height, altitude, pitch = 0, offset, center, scale, nearZMultiplier = 1, farZMultiplier = 1 } = options;\n let { fovy = altitudeToFovy(DEFAULT_ALTITUDE) } = options;\n // For back-compatibility allow field of view to be\n // derived from altitude\n if (altitude !== undefined) {\n fovy = altitudeToFovy(altitude);\n }\n const fovRadians = fovy * DEGREES_TO_RADIANS;\n const pitchRadians = pitch * DEGREES_TO_RADIANS;\n // Distance from camera to the target\n const focalDistance = fovyToAltitude(fovy);\n let cameraToSeaLevelDistance = focalDistance;\n if (center) {\n cameraToSeaLevelDistance += (center[2] * scale) / Math.cos(pitchRadians) / height;\n }\n const fovAboveCenter = fovRadians * (0.5 + (offset ? offset[1] : 0) / height);\n // Find the distance from the center point to the center top\n // in focal distance units using law of sines.\n const topHalfSurfaceDistance = (Math.sin(fovAboveCenter) * cameraToSeaLevelDistance) /\n Math.sin(clamp(Math.PI / 2 - pitchRadians - fovAboveCenter, 0.01, Math.PI - 0.01));\n // Calculate z distance of the farthest fragment that should be rendered.\n const furthestDistance = Math.sin(pitchRadians) * topHalfSurfaceDistance + cameraToSeaLevelDistance;\n // Matches mapbox limit\n const horizonDistance = cameraToSeaLevelDistance * 10;\n // Calculate z value of the farthest fragment that should be rendered.\n const farZ = Math.min(furthestDistance * farZMultiplier, horizonDistance);\n return {\n fov: fovRadians,\n aspect: width / height,\n focalDistance,\n near: nearZMultiplier,\n far: farZ\n };\n}\n/**\n * CALCULATE PROJECTION MATRIX: PROJECTS FROM CAMERA (VIEW) SPACE TO CLIPSPACE\n *\n * To match mapbox's z buffer:\n * - \\<= 0.28: nearZMultiplier: 0.1, farZmultiplier: 1\n * - \\>= 0.29: nearZMultiplier: 1 / height, farZMultiplier: 1.01\n *\n * @param options Viewport options\n * @param options.width Width of \"viewport\" or window\n * @param options.height Height of \"viewport\" or window\n * @param options.scale Scale at the current zoom\n * @param options.center Offset of the target, vec3 in world space\n * @param options.offset Offset of the focal point, vec2 in screen space\n * @param options.pitch Camera angle in degrees (0 is straight down)\n * @param options.fovy field of view in degrees\n * @param options.altitude if provided, field of view is calculated using `altitudeToFovy()`\n * @param options.nearZMultiplier control z buffer\n * @param options.farZMultiplier control z buffer\n * @returns 4x4 projection matrix\n */\nexport function getProjectionMatrix(options) {\n const { fov, aspect, near, far } = getProjectionParameters(options);\n const projectionMatrix = mat4.perspective([], fov, // fov in radians\n aspect, // aspect ratio\n near, // near plane\n far // far plane\n );\n return projectionMatrix;\n}\n/**\n *\n * Convert an altitude to field of view such that the\n * focal distance is equal to the altitude\n *\n * @param altitude - altitude of camera in screen units\n * @return fovy field of view in degrees\n */\nexport function altitudeToFovy(altitude) {\n return 2 * Math.atan(0.5 / altitude) * RADIANS_TO_DEGREES;\n}\n/**\n *\n * Convert an field of view such that the\n * focal distance is equal to the altitude\n *\n * @param fovy - field of view in degrees\n * @return altitude altitude of camera in screen units\n */\nexport function fovyToAltitude(fovy) {\n return 0.5 / Math.tan(0.5 * fovy * DEGREES_TO_RADIANS);\n}\n// Project flat coordinates to pixels on screen.\nexport function worldToPixels(xyz, pixelProjectionMatrix) {\n const [x, y, z = 0] = xyz;\n assert(Number.isFinite(x) && Number.isFinite(y) && Number.isFinite(z));\n return transformVector(pixelProjectionMatrix, [x, y, z, 1]);\n}\n/**\n * Unproject pixels on screen to flat coordinates.\n *\n * @param xyz - pixel coordinate on screen.\n * @param pixelUnprojectionMatrix - unprojection matrix 4x4\n * @param targetZ - if pixel coordinate does not have a 3rd component (depth),\n * targetZ is used as the elevation plane to unproject onto\n * @return [x, y, Z] flat coordinates on 512*512 Mercator Zoom 0 tile.\n */\nexport function pixelsToWorld(xyz, pixelUnprojectionMatrix, targetZ = 0) {\n const [x, y, z] = xyz;\n assert(Number.isFinite(x) && Number.isFinite(y), 'invalid pixel coordinate');\n if (Number.isFinite(z)) {\n // Has depth component\n const coord = transformVector(pixelUnprojectionMatrix, [x, y, z, 1]);\n return coord;\n }\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 with z=0\n const coord0 = transformVector(pixelUnprojectionMatrix, [x, y, 0, 1]);\n const coord1 = transformVector(pixelUnprojectionMatrix, [x, y, 1, 1]);\n const z0 = coord0[2];\n const z1 = coord1[2];\n const t = z0 === z1 ? 0 : ((targetZ || 0) - z0) / (z1 - z0);\n return vec2.lerp([], coord0, coord1, t);\n}\n//# sourceMappingURL=web-mercator-utils.js.map","/* eslint-disable camelcase */\nimport { vec2 } from '@math.gl/core';\nimport { worldToLngLat } from \"./web-mercator-utils.js\";\nimport { transformVector } from \"./math-utils.js\";\nconst DEGREES_TO_RADIANS = Math.PI / 180;\n/*\n * Returns the quad at the intersection of the frustum and the given z plane\n * @param {WebMercatorViewport} viewport\n * @param {Number} z - elevation in meters\n */\nexport function getBounds(viewport, z = 0) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const { width, height, unproject } = viewport;\n const unprojectOps = { targetZ: z };\n const bottomLeft = unproject([0, height], unprojectOps);\n const bottomRight = unproject([width, height], unprojectOps);\n let topLeft;\n let topRight;\n const halfFov = viewport.fovy\n ? 0.5 * viewport.fovy * DEGREES_TO_RADIANS\n : Math.atan(0.5 / viewport.altitude);\n const angleToGround = (90 - viewport.pitch) * DEGREES_TO_RADIANS;\n // The top plane is parallel to the ground if halfFov == angleToGround\n if (halfFov > angleToGround - 0.01) {\n // intersect with the far plane\n topLeft = unprojectOnFarPlane(viewport, 0, z);\n topRight = unprojectOnFarPlane(viewport, width, z);\n }\n else {\n // intersect with the top plane\n topLeft = unproject([0, 0], unprojectOps);\n topRight = unproject([width, 0], unprojectOps);\n }\n return [bottomLeft, bottomRight, topRight, topLeft];\n}\n/*\n * Find a point on the far clipping plane of the viewport\n * @param {WebMercatorViewport} viewport\n * @param {Number} x - projected x in screen space\n * @param {Number} targetZ - the elevation of the point in meters\n */\nfunction unprojectOnFarPlane(viewport, x, targetZ) {\n const { pixelUnprojectionMatrix } = viewport;\n const coord0 = transformVector(pixelUnprojectionMatrix, [x, 0, 1, 1]);\n const coord1 = transformVector(pixelUnprojectionMatrix, [x, viewport.height, 1, 1]);\n const z = targetZ * viewport.distanceScales.unitsPerMeter[2];\n const t = (z - coord0[2]) / (coord1[2] - coord0[2]);\n const coord = vec2.lerp([], coord0, coord1, t);\n const result = worldToLngLat(coord);\n result.push(targetZ);\n return result;\n}\n//# sourceMappingURL=get-bounds.js.map","/**\n * This file implements tile traversal for generic 2D tilesets.\n *\n * The main algorithm works as follows:\n *\n * 1. Start at the root tile(s) (z=0, covers the entire image, but not\n * necessarily the whole world)\n * 2. Test if each tile is visible using viewport frustum culling\n * 3. For visible tiles, compute distance-based LOD (Level of Detail)\n * 4. If LOD is insufficient, recursively subdivide into child tiles\n * 5. Select tiles at appropriate zoom levels based on distance from camera\n *\n * The result is a set of tiles at varying zoom levels that efficiently\n * cover the visible area with appropriate detail.\n *\n * The traversal is driven by a {@link TilesetDescriptor}, which abstracts over\n * both OGC TileMatrixSet grids and Zarr multiscale pyramids.\n */\nimport { _GlobeViewport, assert } from \"@deck.gl/core\";\nimport { transformBounds } from \"@developmentseed/proj\";\nimport { CullingVolume, makeOrientedBoundingBoxFromPoints, Plane, } from \"@math.gl/culling\";\nimport { lngLatToWorld, worldToLngLat } from \"@math.gl/web-mercator\";\n/**\n * The size of the entire world in deck.gl's common coordinate space.\n *\n * The world always spans [0, 512] in both X and Y in Web Mercator common space.\n *\n * At zoom level 0, there is 1 tile that represents the whole world, so that tile is 512x512 units.\n * At zoom level z, there are 2^z tiles along each axis, so each tile is (512 / 2^z) units.\n *\n * The origin (0,0) is at the top-left corner, and (512,512) is at the\n * bottom-right.\n */\nconst TILE_SIZE = 512;\n// Reference points used to sample tile boundaries for bounding volume\n// calculation.\n//\n// In upstream deck.gl code, such reference points are only used in non-Web\n// Mercator projections because the OSM tiling scheme is designed for Web\n// Mercator and the OSM tile extents are already in Web Mercator projection. So\n// using Axis-Aligned bounding boxes based on tile extents is sufficient for\n// frustum culling in Web Mercator viewports.\n//\n// In upstream code these reference points are used for Globe View where the OSM\n// tile indices _projected into longitude-latitude bounds in Globe View space_\n// are no longer axis-aligned, and oriented bounding boxes must be used instead.\n//\n// In the context of generic tiling grids which are often not in Web Mercator\n// projection, we must use the reference points approach because the grid tiles\n// will never be exact axis aligned boxes in Web Mercator space.\n// For most tiles: sample 4 corners and center (5 points total)\nconst REF_POINTS_5 = [\n [0.5, 0.5], // center\n [0, 0], // top-left\n [0, 1], // bottom-left\n [1, 0], // top-right\n [1, 1], // bottom-right\n];\n// For higher detail: add 4 edge midpoints (9 points total)\nconst REF_POINTS_9 = REF_POINTS_5.concat([\n [0, 0.5], // left edge\n [0.5, 0], // top edge\n [1, 0.5], // right edge\n [0.5, 1], // bottom edge\n]);\n/** semi-major axis of the WGS84 ellipsoid\n *\n * EPSG:3857 also uses the WGS84 datum, so this is used for conversions from\n * 3857 to deck.gl common space (scaled to [0-512])\n */\nconst WGS84_ELLIPSOID_A = 6378137;\n/**\n * Full circumference of the EPSG:3857 Web Mercator world, in meters\n */\nconst EPSG_3857_CIRCUMFERENCE = 2 * Math.PI * WGS84_ELLIPSOID_A;\nconst EPSG_3857_HALF_CIRCUMFERENCE = EPSG_3857_CIRCUMFERENCE / 2;\n// Maximum latitude representable in Web Mercator (EPSG:3857), in degrees.\nconst MAX_WEB_MERCATOR_LAT = 85.05112877980659;\n/**\n * Raster Tile Node - represents a single tile in a tileset pyramid.\n *\n * Akin to the upstream OSMNode class.\n *\n * This node class uses the following coordinate system:\n *\n * - x: tile column (0 to TilesetLevel.matrixWidth, left to right)\n * - y: tile row (0 to TilesetLevel.matrixHeight, top to bottom)\n * - z: overview level. This assumes ordering where: 0 = coarsest, higher = finer\n */\nexport class RasterTileNode {\n /** Index across a row */\n x;\n /** Index down a column */\n y;\n /** Zoom index assumed to be (higher = finer detail) */\n z;\n descriptor;\n /**\n * Flag indicating whether any descendant of this tile is visible.\n *\n * Used to prevent loading parent tiles when children are visible (avoids\n * overdraw).\n */\n childVisible;\n /**\n * Flag indicating this tile should be rendered\n *\n * Set to `true` when this is the appropriate LOD for its distance from camera.\n */\n selected;\n /** A cache of the children of this node. */\n _children;\n /**\n * A cached bounding volume for this tile, used for frustum culling\n *\n * This stores the result of `getBoundingVolume`.\n */\n _boundingVolume;\n constructor(x, y, z, { descriptor }) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.descriptor = descriptor;\n }\n /** Get the level info for this tile's z index. */\n get level() {\n return this.descriptor.levels[this.z];\n }\n /** Get the children of this node.\n *\n * Find all tiles at level this.z + 1 whose spatial extent overlaps this tile.\n *\n * A tileset pyramid is not guaranteed to be a quadtree — it is a stack of\n * independent grids. We find children by mapping the parent tile's CRS bounds\n * into the child grid using {@link TilesetLevel.crsBoundsToTileRange}.\n */\n get children() {\n if (!this._children) {\n const maxZ = this.descriptor.levels.length - 1;\n if (this.z >= maxZ) {\n // Already at finest resolution, no children\n this._children = null;\n return null;\n }\n const childZ = this.z + 1;\n const childLevel = this.descriptor.levels[childZ];\n // Compute this tile's bounds in the source CRS\n const parentCorners = this.level.projectedTileCorners(this.x, this.y);\n const parentBounds = cornersToBounds(parentCorners);\n // Find overlapping child index range\n const { minCol, maxCol, minRow, maxRow } = childLevel.crsBoundsToTileRange(...parentBounds);\n const children = [];\n const { descriptor } = this;\n for (let y = minRow; y <= maxRow; y++) {\n for (let x = minCol; x <= maxCol; x++) {\n children.push(new RasterTileNode(x, y, childZ, { descriptor }));\n }\n }\n this._children = children.length > 0 ? children : null;\n }\n return this._children;\n }\n /**\n * Recursively traverse the tile pyramid to determine if this tile (or its\n * descendants) should be rendered.\n *\n * I.e. \"Given this tile node, should I render this tile, or should I recurse\n * into its children?\"\n *\n * The algorithm performs:\n * 1. Visibility culling - reject tiles outside the view frustum\n * 2. Bounds checking - reject tiles outside the specified geographic bounds\n * 3. LOD selection - choose appropriate zoom level based on distance from camera\n * 4. Recursive subdivision - if LOD is insufficient, test child tiles\n *\n * Additionally, there should never be overdraw, i.e. a tile should never be\n * rendered if any of its descendants are rendered.\n *\n * @returns true if this tile or any descendant is visible, false otherwise\n */\n update(params) {\n // Reset state\n this.childVisible = false;\n this.selected = false;\n const { viewport, cullingVolume, elevationBounds, minZ, maxZ = this.descriptor.levels.length - 1, project, bounds, } = params;\n // Get bounding volume for this tile\n const { boundingVolume, commonSpaceBounds } = this.getBoundingVolume(elevationBounds, project);\n // Step 1: Bounds checking\n // If geographic bounds are specified, reject tiles outside those bounds\n if (bounds && !this.insideBounds(bounds, commonSpaceBounds)) {\n return false;\n }\n // Frustum culling\n // Test if tile's bounding volume intersects the camera frustum\n // Returns: <0 if outside, 0 if intersecting, >0 if fully inside\n const isInside = cullingVolume.computeVisibility(boundingVolume);\n if (isInside < 0) {\n return false;\n }\n const children = this.children;\n // LOD (Level of Detail) selection (only if allowed at this level)\n // Only select this tile if no child is visible (prevents overlapping tiles)\n // \"When pitch is low, force selection at maxZ.\"\n if (!this.childVisible && this.z >= minZ) {\n const metersPerScreenPixel = getMetersPerPixelAtBoundingVolume(boundingVolume, viewport.zoom);\n const tileMetersPerPixel = this.level.metersPerPixel;\n if (tileMetersPerPixel <= metersPerScreenPixel ||\n this.z >= maxZ ||\n (children === null && this.z >= minZ)) {\n // \"Select this tile when its scale is at least as detailed as the screen.\"\n this.selected = true;\n return true;\n }\n }\n // LOD is not enough, recursively test child tiles\n //\n // Note that if `this.children` is `null`, then there are no children\n // available because we're already at the finest tile resolution available\n if (children && children.length > 0) {\n this.selected = false;\n let anyChildVisible = false;\n for (const child of children) {\n if (child.update(params)) {\n anyChildVisible = true;\n }\n }\n this.childVisible = anyChildVisible;\n return anyChildVisible;\n }\n return true;\n }\n /**\n * Collect all tiles marked as selected in the tree.\n * Recursively traverses the entire tree and gathers tiles where selected=true.\n *\n * @param result - Accumulator array for selected tiles\n * @returns Array of selected RasterTileNode tiles\n */\n getSelected(result = []) {\n if (this.selected) {\n result.push(this);\n }\n if (this._children) {\n for (const node of this._children) {\n node.getSelected(result);\n }\n }\n return result;\n }\n /**\n * Test if this tile intersects the specified bounds in Web Mercator space.\n * Used to filter tiles when only a specific geographic region is needed.\n *\n * @param bounds - [minX, minY, maxX, maxY] in Web Mercator units (0-512)\n * @returns true if tile overlaps the bounds\n */\n insideBounds(bounds, commonSpaceBounds) {\n const [minX, minY, maxX, maxY] = bounds;\n const [tileMinX, tileMinY, tileMaxX, tileMaxY] = commonSpaceBounds;\n const inside = tileMinX < maxX && tileMaxX > minX && tileMinY < maxY && tileMaxY > minY;\n return inside;\n }\n /**\n * Calculate the 3D bounding volume for this tile in deck.gl's common\n * coordinate space for frustum culling.\n *\n * TODO: In the future, we can add a fast path in the case that the source\n * tiling is already in EPSG:3857.\n */\n getBoundingVolume(zRange, project) {\n const cached = this._boundingVolume;\n if (cached &&\n cached.zRange[0] === zRange[0] &&\n cached.zRange[1] === zRange[1]) {\n return cached.result;\n }\n // Case 1: Globe view - need to construct an oriented bounding box from\n // reprojected sample points, but also using the `project` param\n if (project) {\n assert(false, \"TODO: implement getBoundingVolume in Globe view\");\n // Reproject positions to wgs84 instead, then pass them into `project`\n // return makeOrientedBoundingBoxFromPoints(refPointPositions);\n }\n // (Future) Case 2: Web Mercator input image, can directly compute AABB in\n // common space\n // (Future) Case 3: Source projection is already mercator, like UTM. We\n // don't need to sample from reference points, we can only use the 4\n // corners.\n // Case 4: Generic case - sample reference points and reproject to\n // Web Mercator, then convert to deck.gl common space\n const result = this._getGenericBoundingVolume(zRange);\n this._boundingVolume = { zRange, result };\n return result;\n }\n /**\n * Generic case - sample reference points and reproject to Web Mercator, then\n * convert to deck.gl common space\n *\n */\n _getGenericBoundingVolume(zRange) {\n const [minZ, maxZ] = zRange;\n const tileCorners = this.level.projectedTileCorners(this.x, this.y);\n const refPointsEPSG3857 = sampleReferencePointsInEPSG3857(REF_POINTS_9, tileCorners, this.descriptor.projectTo3857, this.descriptor.projectTo4326);\n const commonSpacePositions = refPointsEPSG3857.map((xy) => rescaleEPSG3857ToCommonSpace(xy));\n const refPointPositions = [];\n for (const p of commonSpacePositions) {\n refPointPositions.push([p[0], p[1], minZ]);\n if (minZ !== maxZ) {\n // Also sample at maximum elevation to capture the full 3D volume\n refPointPositions.push([p[0], p[1], maxZ]);\n }\n }\n // Compute [minx, miny, maxx, maxy] in common space for quick bounds check\n // TODO: this doesn't densify edges\n let minX = Number.POSITIVE_INFINITY;\n let minY = Number.POSITIVE_INFINITY;\n let maxX = Number.NEGATIVE_INFINITY;\n let maxY = Number.NEGATIVE_INFINITY;\n for (const [x, y] of commonSpacePositions) {\n if (x < minX) {\n minX = x;\n }\n if (y < minY) {\n minY = y;\n }\n if (x > maxX) {\n maxX = x;\n }\n if (y > maxY) {\n maxY = y;\n }\n }\n const commonSpaceBounds = [minX, minY, maxX, maxY];\n return {\n boundingVolume: makeOrientedBoundingBoxFromPoints(refPointPositions),\n commonSpaceBounds,\n };\n }\n}\n/**\n * Wrap a forward projection to EPSG:3857 so that it never returns NaN.\n *\n * proj4 returns [NaN, NaN] for points at the poles (lat = ±90°) because the\n * Mercator projection is undefined there. The wrapper falls back to:\n * 1. Project the input to WGS84 via `projectTo4326`\n * 2. Clamp the latitude to the Web Mercator limit (±85.05°)\n * 3. Convert analytically from WGS84 to EPSG:3857\n *\n * This correctly handles any input CRS, not just EPSG:4326.\n *\n * NOTE: An identical copy of this function lives in\n * `packages/deck.gl-geotiff/src/proj.ts` as `makeClampedForwardTo3857`.\n * The two packages cannot share code due to their dependency relationship\n * (deck.gl-geotiff depends on deck.gl-raster, not vice versa). If this logic\n * changes, update both copies.\n *\n * Perhaps in the future we'll make a `@developmentseed/projections` package to\n * hold shared projection utilities like this.\n */\nfunction makeClampedForwardTo3857(projectTo3857, projectTo4326) {\n return (x, y) => {\n const [px, py] = projectTo3857(x, y);\n if (Number.isFinite(px) && Number.isFinite(py)) {\n return [px, py];\n }\n const [lon, lat] = projectTo4326(x, y);\n const clampedLat = Math.max(-MAX_WEB_MERCATOR_LAT, Math.min(MAX_WEB_MERCATOR_LAT, lat));\n const latRad = (clampedLat * Math.PI) / 180;\n const x3857 = (lon * Math.PI * WGS84_ELLIPSOID_A) / 180;\n const y3857 = Math.log(Math.tan(Math.PI / 4 + latRad / 2)) * WGS84_ELLIPSOID_A;\n return [x3857, y3857];\n };\n}\n/**\n * Sample the selected reference points in EPSG:3857.\n *\n * Reference points are given as `[relX, relY]` fractions in `[0, 1]` and are\n * bilinearly interpolated across the tile's four CRS corners. For axis-aligned\n * tiles this is equivalent to the old AABB lerp; for rotated tiles it correctly\n * samples the actual quadrilateral rather than its bounding box.\n *\n * Note that EPSG:3857 is **not** the same as deck.gl's common space — deck.gl's\n * common space is 512 units wide, while EPSG:3857 uses meters.\n *\n * @param refPoints Reference points as `[relX, relY]` fractions in `[0, 1]`.\n * @param tileCorners The four CRS corners of the tile.\n */\nfunction sampleReferencePointsInEPSG3857(refPoints, tileCorners, projectTo3857, projectTo4326) {\n const { topLeft, topRight, bottomLeft, bottomRight } = tileCorners;\n const clampedProjectTo3857 = makeClampedForwardTo3857(projectTo3857, projectTo4326);\n const refPointPositions = [];\n for (const [relX, relY] of refPoints) {\n const [geoX, geoY] = bilerpPoint(topLeft, topRight, bottomLeft, bottomRight, relX, relY);\n refPointPositions.push(clampedProjectTo3857(geoX, geoY));\n }\n return refPointPositions;\n}\n/**\n * Rescale positions from EPSG:3857 into deck.gl's common space\n *\n * Similar to the upstream code here:\n * https://github.com/visgl/deck.gl/blob/b0134f025148b52b91320d16768ab5d14a745328/modules/geo-layers/src/tileset-2d/tile-2d-traversal.ts#L172-L177\n */\nfunction rescaleEPSG3857ToCommonSpace([x, y]) {\n // Clamp Y to Web Mercator bounds\n const clampedY = Math.max(-EPSG_3857_HALF_CIRCUMFERENCE, Math.min(EPSG_3857_HALF_CIRCUMFERENCE, y));\n return [\n (x / EPSG_3857_CIRCUMFERENCE + 0.5) * TILE_SIZE,\n (clampedY / EPSG_3857_CIRCUMFERENCE + 0.5) * TILE_SIZE,\n ];\n}\n/**\n * Above this root-tile count, `createRootTiles` culls to the viewport\n * before instantiation. Below it, every root tile is created and downstream\n * frustum culling filters the unused ones. Typical OGC pyramids have 1–a\n * few dozen tiles at z=0, so they stay on the unchanged path. Large\n * single-level zarr descriptors (e.g. AEF mosaic: ~15000 × 7000 ≈ 100M root\n * tiles) must take the culled path or instantiation hangs the page.\n */\nconst MAX_ROOT_TILES_NO_CULL = 100;\n/**\n * Build the list of root (z=0) `RasterTileNode`s for the traversal.\n *\n * Small root matrices (≤ {@link MAX_ROOT_TILES_NO_CULL}) are enumerated\n * directly — traditional pyramids with a 1×1 or 4×5 root grid skip any\n * projection work and keep bit-identical behavior to the pre-optimization\n * traversal.\n *\n * Large root matrices are culled to the intersection of the dataset extent\n * (`datasetWgs84Bounds`) and the viewport's WGS84 bounds, projected into\n * the source CRS via `transformBounds` (which densifies the edges so a\n * curving projection doesn't escape the 4-corner hull). If the viewport\n * and dataset don't overlap, an empty array is returned and the rest of\n * the traversal short-circuits.\n *\n * Exported for unit testing.\n */\nexport function createRootTiles(opts) {\n const { descriptor, viewport, datasetWgs84Bounds } = opts;\n const rootLevel = descriptor.levels[0];\n const roots = [];\n const rootTileCount = rootLevel.matrixWidth * rootLevel.matrixHeight;\n if (rootTileCount <= MAX_ROOT_TILES_NO_CULL) {\n // Small root matrix → enumerate every tile; downstream frustum culling\n // handles the small amount of waste.\n for (let y = 0; y < rootLevel.matrixHeight; y++) {\n for (let x = 0; x < rootLevel.matrixWidth; x++) {\n roots.push(new RasterTileNode(x, y, 0, { descriptor }));\n }\n }\n return roots;\n }\n // Large root matrix → intersect dataset extent with viewport, project\n // to source CRS, use the root level's tile-range helper.\n const vpBounds = viewport.getBounds();\n const cullBounds = [\n Math.max(datasetWgs84Bounds[0], vpBounds[0]),\n Math.max(datasetWgs84Bounds[1], vpBounds[1]),\n Math.min(datasetWgs84Bounds[2], vpBounds[2]),\n Math.min(datasetWgs84Bounds[3], vpBounds[3]),\n ];\n if (cullBounds[0] > cullBounds[2] || cullBounds[1] > cullBounds[3]) {\n return roots;\n }\n const [minX, minY, maxX, maxY] = transformBounds(descriptor.projectFrom4326, cullBounds[0], cullBounds[1], cullBounds[2], cullBounds[3]);\n const rootRange = rootLevel.crsBoundsToTileRange(minX, minY, maxX, maxY);\n for (let y = rootRange.minRow; y <= rootRange.maxRow; y++) {\n for (let x = rootRange.minCol; x <= rootRange.maxCol; x++) {\n roots.push(new RasterTileNode(x, y, 0, { descriptor }));\n }\n }\n return roots;\n}\n/**\n * Get tile indices visible in viewport.\n *\n * Uses frustum culling driven by a {@link TilesetDescriptor}, which abstracts\n * over OGC TileMatrixSet grids and Zarr multiscale pyramids.\n *\n * Overview levels follow the descriptor ordering: index 0 = coarsest, higher = finer.\n */\nexport function getTileIndices(descriptor, opts) {\n const { viewport, maxZ, zRange, wgs84Bounds } = opts;\n // Only define `project` function for Globe viewports, same as upstream\n const project = viewport instanceof _GlobeViewport && viewport.resolution\n ? viewport.projectPosition\n : null;\n // Get the culling volume of the current camera\n // Same as upstream code\n const planes = Object.values(viewport.getFrustumPlanes()).map(({ normal, distance }) => new Plane(normal.clone().negate(), distance));\n const cullingVolume = new CullingVolume(planes);\n // Project zRange from meters to common space\n const unitsPerMeter = viewport.distanceScales.unitsPerMeter[2];\n const elevationMin = (zRange && zRange[0] * unitsPerMeter) || 0;\n const elevationMax = (zRange && zRange[1] * unitsPerMeter) || 0;\n // Upstream deck.gl had a pitch-based optimization here, that took a long time\n // to debug and understand why it doesn't apply for our use case.\n //\n // Their code was:\n //\n // ```ts\n // const minZ =\n // viewport instanceof WebMercatorViewport && viewport.pitch <= 60 ? maxZ : 0;\n // ```\n //\n // Which can be understood as:\n //\n // > Optimization: For low-pitch views, only consider tiles at maxZ level\n // > At low pitch (top-down view), all tiles are roughly the same distance,\n // > so we don't need the LOD pyramid - just use the finest level\n //\n // > `minZ` is the lowest zoom level where LOD adjustment is allowed\n // > Below `minZ`, tiles skip the distance-based LOD test entirely\n //\n // However, this relies on a very specific assumption: In Web Mercator, OSM\n // tiles already match screen resolution at a given zoom.\n //\n // In our case we want LOD to be evaluated at **all** levels, so we set the\n // minZ to 0\n const minZ = 0;\n const [minLng, minLat, maxLng, maxLat] = wgs84Bounds;\n const bottomLeft = lngLatToWorld([minLng, minLat]);\n const topRight = lngLatToWorld([maxLng, maxLat]);\n const bounds = [\n bottomLeft[0],\n bottomLeft[1],\n topRight[0],\n topRight[1],\n ];\n const roots = createRootTiles({\n descriptor,\n viewport,\n datasetWgs84Bounds: wgs84Bounds,\n });\n // Traverse and update visibility\n const traversalParams = {\n viewport,\n project,\n cullingVolume,\n elevationBounds: [elevationMin, elevationMax],\n minZ,\n maxZ,\n bounds,\n };\n for (const root of roots) {\n root.update(traversalParams);\n }\n // Collect selected tiles\n const selectedNodes = [];\n for (const root of roots) {\n root.getSelected(selectedNodes);\n }\n return selectedNodes;\n}\n/**\n * Compute the meters per pixel at a given latitude and zoom level.\n *\n * Taken from https://github.com/visgl/deck.gl/blob/b0134f025148b52b91320d16768ab5d14a745328/modules/widgets/src/scale-widget.tsx#L133C1-L144C1\n *\n * @param latitude - The current latitude.\n * @param zoom - The current zoom level.\n * @returns The number of meters per pixel.\n */\nfunction getMetersPerPixel(latitude, zoom) {\n const earthCircumference = 40075016.686;\n return ((earthCircumference * Math.cos((latitude * Math.PI) / 180)) /\n 2 ** (zoom + 8));\n}\nfunction getMetersPerPixelAtBoundingVolume(boundingVolume, zoom) {\n const [_lng, lat] = worldToLngLat(boundingVolume.center);\n return getMetersPerPixel(lat, zoom);\n}\n/**\n * Compute the axis-aligned bounding box of a rotated tile rectangle.\n */\nfunction cornersToBounds({ topLeft, topRight, bottomLeft, bottomRight, }) {\n const xs = [topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]];\n const ys = [topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]];\n return [Math.min(...xs), Math.min(...ys), Math.max(...xs), Math.max(...ys)];\n}\n/**\n * Bilinearly interpolate a 2D point over a unit square.\n *\n * Given four corner points of a quadrilateral, this evaluates the bilinear\n * interpolation at normalized coordinates `(x, y)` ∈ [0, 1]². The mapping is:\n *\n * p(x, y) =\n * p00 * (1 - x) * (1 - y) +\n * p10 * x * (1 - y) +\n * p01 * (1 - x) * y +\n * p11 * x * y\n *\n * where:\n * - `p00` corresponds to (x=0, y=0) (top-left)\n * - `p10` corresponds to (x=1, y=0) (top-right)\n * - `p01` corresponds to (x=0, y=1) (bottom-left)\n * - `p11` corresponds to (x=1, y=1) (bottom-right)\n *\n * This performs interpolation in Euclidean space (component-wise on x/y),\n * producing a bilinear mapping from the unit square to the quadrilateral\n * defined by the four input points.\n *\n * @param p00 - Point at (0, 0), typically top-left.\n * @param p10 - Point at (1, 0), typically top-right.\n * @param p01 - Point at (0, 1), typically bottom-left.\n * @param p11 - Point at (1, 1), typically bottom-right.\n * @param x - Normalized horizontal coordinate in [0, 1].\n * @param y - Normalized vertical coordinate in [0, 1].\n * @returns Interpolated 2D point `[x, y]`.\n *\n * @remarks\n * - Reduces to linear interpolation along edges when `x = 0/1` or `y = 0/1`.\n * - Produces an affine mapping only if the four points form a parallelogram;\n * otherwise the interior mapping is bilinear (not affine).\n * - No CRS or geodesic behavior is implied; inputs are treated as Cartesian\n * coordinates.\n */\nfunction bilerpPoint(p00, p10, p01, p11, x, y) {\n const w00 = (1 - x) * (1 - y);\n const w10 = x * (1 - y);\n const w01 = (1 - x) * y;\n const w11 = x * y;\n return [\n p00[0] * w00 + p10[0] * w10 + p01[0] * w01 + p11[0] * w11,\n p00[1] * w00 + p10[1] * w10 + p01[1] * w01 + p11[1] * w11,\n ];\n}\n//# sourceMappingURL=raster-tile-traversal.js.map","/**\n * RasterTileset2D - Generic tile traversal over a tile pyramid with Frustum\n * Culling\n *\n * This version properly implements frustum culling and bounding volume calculations\n * following the pattern from deck.gl's OSM tile indexing.\n */\nimport { _Tileset2D as Tileset2D } from \"@deck.gl/geo-layers\";\nimport { transformBounds } from \"@developmentseed/proj\";\nimport { getTileIndices } from \"./raster-tile-traversal.js\";\n/**\n * A generic tileset implementation organized according to the OGC\n * [TileMatrixSet](https://docs.ogc.org/is/17-083r4/17-083r4.html)\n * specification.\n *\n * Handles tile lifecycle, caching, and viewport-based loading.\n */\nexport class RasterTileset2D extends Tileset2D {\n descriptor;\n wgs84Bounds;\n constructor(opts, descriptor) {\n super(opts);\n this.descriptor = descriptor;\n const rawBounds = transformBounds(this.descriptor.projectTo4326, ...this.descriptor.projectedBounds);\n // Web Mercator cannot represent latitudes outside ~±85.051°, and the\n // downstream tile traversal calls `lngLatToWorld` on these bounds which\n // asserts against that range. Global data at ±90° (e.g. reanalysis grids)\n // would otherwise crash tile selection. Clamp here; any polar rows beyond\n // ±MAX_LAT are unreachable on a Mercator map anyway.\n const MAX_LAT = 85.0511287798066;\n this.wgs84Bounds = [\n rawBounds[0],\n Math.max(rawBounds[1], -MAX_LAT),\n rawBounds[2],\n Math.min(rawBounds[3], MAX_LAT),\n ];\n }\n /**\n * Get tile indices visible in viewport\n * Uses frustum culling similar to OSM implementation\n *\n * Overviews follow TileMatrixSet ordering: index 0 = coarsest, higher = finer\n *\n * `minZoom` and `maxZoom` gate against `viewport.zoom` (not the tileset\n * z-index, which is an overview level in our descriptor). When the\n * viewport zoom is outside these bounds this method returns an empty\n * list — no new tile fetches, and because deck.gl's `updateTileStates`\n * marks unselected cached tiles invisible, no rendering either.\n * `visibleMinZoom` / `visibleMaxZoom` (deck.gl 9.3+) are deliberately\n * not honored: their documented \"fetch but don't render\" semantic\n * requires a notion of clamping to a coarser z, which doesn't\n * generalize to descriptors with sparse or single overviews. See\n * `dev-docs/zoom-terminology.md` for the rationale.\n */\n getTileIndices(opts) {\n const { viewport, minZoom } = opts;\n if (typeof minZoom === \"number\" && viewport.zoom < minZoom) {\n return [];\n }\n const maxAvailableZ = this.descriptor.levels.length - 1;\n const maxZ = typeof opts.maxZoom === \"number\"\n ? Math.min(opts.maxZoom, maxAvailableZ)\n : maxAvailableZ;\n const tileIndices = getTileIndices(this.descriptor, {\n viewport,\n maxZ,\n zRange: opts.zRange ?? null,\n wgs84Bounds: this.wgs84Bounds,\n });\n return tileIndices;\n }\n getTileId(index) {\n return `${index.x}-${index.y}-${index.z}`;\n }\n getParentIndex(index) {\n if (index.z === 0) {\n // Already at coarsest level\n return index;\n }\n const currentOverview = this.descriptor.levels[index.z];\n const parentOverview = this.descriptor.levels[index.z - 1];\n // Decimation is the number of child tiles that fit across one parent tile.\n // Must use tile footprint (cellSize × tileWidth/Height), not cellSize alone,\n // because tileWidth can change between levels (e.g. the last Sentinel-2\n // overview doubles tileWidth while halving cellSize, giving a 1:1 spatial\n // mapping where decimation = 1).\n const parentFootprintX = parentOverview.metersPerPixel * parentOverview.tileWidth;\n const parentFootprintY = parentOverview.metersPerPixel * parentOverview.tileHeight;\n const currentFootprintX = currentOverview.metersPerPixel * currentOverview.tileWidth;\n const currentFootprintY = currentOverview.metersPerPixel * currentOverview.tileHeight;\n const decimationX = parentFootprintX / currentFootprintX;\n const decimationY = parentFootprintY / currentFootprintY;\n return {\n x: Math.floor(index.x / decimationX),\n y: Math.floor(index.y / decimationY),\n z: index.z - 1,\n };\n }\n getTileZoom(index) {\n return index.z;\n }\n getTileMetadata(index) {\n const { x, y, z } = index;\n const levelDescriptor = this.descriptor.levels[z];\n const { tileHeight, tileWidth } = levelDescriptor;\n const { topLeft, topRight, bottomLeft, bottomRight } = levelDescriptor.projectedTileCorners(x, y);\n // Return the projected bounds as four corners\n // This preserves rotation/skew information\n const projectedCorners = {\n topLeft,\n topRight,\n bottomLeft,\n bottomRight,\n };\n // Also compute axis-aligned bounding box for compatibility\n const projectedBounds = [\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 // deck.gl's Tile2DHeader uses `bbox` (GeoBoundingBox) for screen-space\n // culling in filterSubLayer → isTileVisible. Without this, all tiles\n // would pass (or fail) the cull-rect test and the refinementStrategy\n // (best-available) would not show parent tiles correctly.\n const [west, south, east, north] = transformBounds(this.descriptor.projectTo4326, ...projectedBounds);\n return {\n bbox: {\n west,\n south,\n east,\n north,\n },\n projectedBbox: {\n left: projectedBounds[0],\n bottom: projectedBounds[1],\n right: projectedBounds[2],\n top: projectedBounds[3],\n },\n projectedCorners,\n tileWidth,\n tileHeight,\n };\n }\n}\n//# sourceMappingURL=raster-tileset-2d.js.map","/** Size of deck.gl's common coordinate space in world units.\n *\n * At zoom 0, one tile covers the whole world (512×512 units); at zoom z, each\n * tile is 512/2^z units.\n */\nexport const TILE_SIZE = 512;\n/** Size of the globe in web mercator meters. */\nexport const WEB_MERCATOR_METER_CIRCUMFERENCE = 40075016.686;\n/** Scale factor for converting EPSG:3857 meters into deck.gl world units (512×512). */\nexport const WEB_MERCATOR_TO_WORLD_SCALE = TILE_SIZE / WEB_MERCATOR_METER_CIRCUMFERENCE;\n//# sourceMappingURL=constants.js.map","import { CompositeLayer } from \"@deck.gl/core\";\nimport { TileLayer } from \"@deck.gl/geo-layers\";\nimport { renderDebugTileOutline } from \"../layer-utils.js\";\nimport { RasterLayer } from \"../raster-layer.js\";\nimport { RasterTileset2D } from \"../raster-tileset/index.js\";\nimport { TILE_SIZE, WEB_MERCATOR_TO_WORLD_SCALE } from \"./constants.js\";\nconst defaultProps = {\n ...TileLayer.defaultProps,\n maxError: 0.125,\n debug: false,\n debugOpacity: 0.5,\n};\n/**\n * Base layer that renders a tiled raster source driven by a generic\n * {@link TilesetDescriptor}.\n *\n * Usable directly (provide `tilesetDescriptor`, `getTileData`, and `renderTile`\n * as props) or as a base class (override the protected `_tilesetDescriptor`,\n * `_getTileDataCallback`, `_renderTileCallback` accessors to source them from\n * state).\n *\n * The generic `ExtraProps` parameter lets a subclass redeclare any of the\n * overridable fields with a domain-specific signature (e.g. `COGLayer`'s\n * `getTileData(image, options)`).\n */\nexport class RasterTileLayer extends CompositeLayer {\n static layerName = \"RasterTileLayer\";\n static defaultProps = defaultProps;\n /**\n * The currently effective {@link TilesetDescriptor}.\n *\n * Subclasses override this to return a descriptor built from their own\n * async-parsed state. Returns `undefined` while the source is still\n * loading; `renderLayers()` returns `null` in that case.\n *\n * The inline cast to `RasterTileLayerProps<DataT>` is required because\n * `tilesetDescriptor` is declared on `ExtraProps`, not on the base's\n * `RasterTileLayerBaseProps`. For direct use the default `ExtraProps`\n * brings it in; for subclass use this method is overridden and the cast\n * is never reached.\n */\n _tilesetDescriptor() {\n return this.props\n .tilesetDescriptor;\n }\n /**\n * The currently effective tile-fetch callback.\n *\n * Subclasses override this to adapt their user-facing `getTileData`\n * signature into the base's `(tile, options) => Promise<DataT>` shape.\n * Returns `undefined` when the callback is not yet available.\n */\n _getTileDataCallback() {\n return this.props.getTileData;\n }\n /**\n * The currently effective per-tile render callback.\n *\n * Subclasses override this to thread their user-facing `renderTile` and\n * any inferred default. Returns `undefined` when no callback is available.\n */\n _renderTileCallback() {\n return this.props.renderTile;\n }\n renderLayers() {\n const descriptor = this._tilesetDescriptor();\n const getTileData = this._getTileDataCallback();\n const renderTile = this._renderTileCallback();\n if (!descriptor || !getTileData || !renderTile) {\n return null;\n }\n return this._renderTileLayer(descriptor, getTileData, renderTile);\n }\n _renderTileLayer(descriptor, getTileData, renderTile) {\n class TilesetFactory extends RasterTileset2D {\n constructor(opts) {\n super(opts, descriptor);\n }\n }\n const { tileSize, zoomOffset, maxZoom, minZoom, extent, debounceTime, maxCacheSize, maxCacheByteSize, maxRequests, refinementStrategy, updateTriggers, } = this.props;\n return new TileLayer({\n id: `raster-tile-layer-${this.id}`,\n TilesetClass: TilesetFactory,\n getTileData: (tile) => this._wrapGetTileData(tile, getTileData),\n renderSubLayers: (props) => this._renderSubLayers(props, descriptor, renderTile),\n updateTriggers: {\n renderSubLayers: updateTriggers?.renderTile,\n },\n tileSize,\n zoomOffset,\n maxZoom,\n minZoom,\n extent,\n debounceTime,\n maxCacheSize,\n maxCacheByteSize,\n maxRequests,\n refinementStrategy,\n });\n }\n async _wrapGetTileData(tile, getTileData) {\n const { signal: tileSignal } = tile;\n const userSignal = this.props.signal;\n const signal = userSignal && tileSignal\n ? AbortSignal.any([userSignal, tileSignal])\n : (userSignal ?? tileSignal);\n const options = {\n device: this.context.device,\n signal,\n };\n return getTileData(tile, options);\n }\n _renderSubLayers(props, descriptor, renderTile) {\n const { maxError, debug, debugOpacity } = this.props;\n const tile = props.tile;\n const layers = [];\n if (debug) {\n layers.push(...renderDebugTileOutline(`${this.id}-${tile.id}-bounds`, tile, descriptor.projectTo4326));\n }\n if (!props.data) {\n return layers;\n }\n const { x, y, z } = tile.index;\n const level = descriptor.levels[z];\n if (!level) {\n return layers;\n }\n const { forwardTransform, inverseTransform } = level.tileTransform(x, y);\n const tileResult = renderTile(props.data);\n if (!tileResult) {\n return layers;\n }\n const { image, renderPipeline } = tileResult;\n const { width, height } = props.data;\n const isGlobe = this.context.viewport.resolution !== undefined;\n const reprojectionFns = isGlobe\n ? {\n forwardTransform,\n inverseTransform,\n forwardReproject: descriptor.projectTo4326,\n inverseReproject: descriptor.projectFrom4326,\n }\n : {\n forwardTransform,\n inverseTransform,\n forwardReproject: descriptor.projectTo3857,\n inverseReproject: descriptor.projectFrom3857,\n };\n const deckProjectionProps = isGlobe\n ? {}\n : {\n coordinateSystem: \"cartesian\",\n coordinateOrigin: [TILE_SIZE / 2, TILE_SIZE / 2, 0],\n // biome-ignore format: array\n modelMatrix: [\n WEB_MERCATOR_TO_WORLD_SCALE, 0, 0, 0,\n 0, WEB_MERCATOR_TO_WORLD_SCALE, 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1,\n ],\n };\n const rasterLayer = new RasterLayer(this.getSubLayerProps({\n id: `${props.id}-raster`,\n width,\n height,\n // Passing `image: undefined` explicitly would trip isAsyncPropLoading\n // and cause a transient black flash (see issue #376).\n ...(image !== undefined && { image }),\n renderPipeline,\n maxError,\n reprojectionFns,\n debug,\n debugOpacity,\n ...deckProjectionProps,\n }));\n return [rasterLayer, ...layers];\n }\n}\n//# sourceMappingURL=raster-tile-layer.js.map","/**\n * Parse the GeoTIFF `ColorMap` tag into an ImageData.\n *\n * @param cmap The colormap array from the GeoTIFF `ColorMap` tag.\n * @param nodata Optional index of the nodata value in the colormap.\n *\n * @return The parsed colormap as an ImageData object.\n */\nexport function parseColormap(cmap, nodata) {\n // TODO: test colormap handling on a 16-bit image with 2^16 entries?\n const size = cmap.length / 3;\n const rgba = new Uint8ClampedArray(size * 4);\n const rOffset = 0;\n const gOffset = size;\n const bOffset = size * 2;\n // Note: >> 8 is needed to convert from 16-bit to 8-bit color values\n // It just divides by 256 and floors to nearest integer\n for (let i = 0; i < size; i++) {\n rgba[4 * i + 0] = cmap[rOffset + i] >> 8;\n rgba[4 * i + 1] = cmap[gOffset + i] >> 8;\n rgba[4 * i + 2] = cmap[bOffset + i] >> 8;\n // Full opacity\n rgba[4 * i + 3] = 255;\n }\n if (nodata !== undefined) {\n // Set nodata value to be fully transparent\n rgba[4 * nodata + 3] = 0;\n }\n return new ImageData(rgba, size, 1);\n}\n//# sourceMappingURL=colormap.js.map","export class SourceCache {\n name = 'source:cache';\n maxSize;\n /** Number of bytes cached in cacheA, when this overflows maxSize cacheA is moved to cacheB and cacheB is dropped */\n size = 0;\n /** Number of times `this.cacheB` has been cleared */\n resets = 0;\n /** Primary cache of objects */\n cacheA = new Map();\n cacheB = new Map();\n /** List of protocols to cache */\n protocols;\n constructor(opts) {\n this.maxSize = opts.size;\n this.protocols = new Set(opts.protocols ?? []);\n }\n fetch(req, next) {\n if (this.protocols.size > 0 && !this.protocols.has(req.source.url.protocol))\n return next(req);\n if (req.length == null)\n return next(req);\n const cacheKey = `${req.source.url.toString()}@${req.offset}+${req.length}`;\n let existing = this.cacheA.get(cacheKey);\n if (existing) {\n existing.hits++;\n return existing.promise;\n }\n existing = this.cacheB.get(cacheKey);\n if (existing) {\n existing.hits++;\n existing.saves++;\n this.size += existing.size;\n this.cacheA.set(cacheKey, existing);\n return existing.promise;\n }\n existing = { promise: next(req), hits: 0, saves: 0, size: req.length };\n this.size += existing.size;\n if (this.size > this.maxSize) {\n this.size = existing.size;\n this.cacheB = this.cacheA;\n this.cacheA = new Map();\n this.resets++;\n }\n this.cacheA.set(cacheKey, existing);\n return existing.promise;\n }\n}\n//# sourceMappingURL=cache.js.map","export class SourceError extends Error {\n /** Status code for the error eg 403 - Forbidden vs 404 Not found */\n code;\n /** URL that the status code came from */\n url;\n /** File system that triggered the error */\n source;\n constructor(msg, code, source, cause) {\n super(msg, { cause });\n this.code = code;\n this.url = source.url;\n this.source = source;\n /** Helper to determine if this class is a SourceError, useful for when `instanceof` fails */\n Object.defineProperty(this, '_sourceError', {\n enumerable: false, // hide it from for..in\n value: 'SourceError',\n });\n }\n /** Check that a unknown is a FsError */\n static is(e) {\n if (e instanceof SourceError)\n return true;\n // Sometimes instanceof fails, so fall back to checking for a `_sourceError` key\n if (typeof e !== 'object')\n return false;\n if (e == null)\n return false;\n return '_sourceError' in e && e['_sourceError'] === 'SourceError';\n }\n}\n//# sourceMappingURL=error.js.map","export const ContentRange = {\n /** Convert a offset/length to a range request\n *\n * @example\n * ```typescript\n * ContentRange.toRange(10) // \"bytes=10\"\n * ContentRange.toRange(0, 1024) // \"bytes=0-1023\"\n * ```\n */\n toRange(offset, length) {\n if (length == null)\n return `bytes=${offset}`;\n if (offset < 0)\n throw new Error('Cannot read from remote source with negative offset and length');\n return `bytes=${offset}-${offset + length - 1}`;\n },\n /**\n * Parse a Content-Range header to extract the size of the source\n *\n * @example\n * ```typescript\n * ContentRange.parseRange(\"bytes 200-1000/67589\"); // 67589\n * ```\n * @throws if range is not a Content-Range with size\n */\n parseSize(range) {\n const [unit, chunks] = range.split(' ');\n if (unit !== 'bytes')\n throw new Error('Failed to parse content-range: ' + range);\n if (chunks == null)\n throw new Error('Failed to parse content-range: ' + range);\n const [, size] = chunks.split('/');\n const result = Number(size);\n if (isNaN(result))\n throw new Error('Failed to parse content-range: ' + range);\n return result;\n },\n};\n//# sourceMappingURL=range.js.map","/**\n * Wrap a source with middleware to modify requests to the sources\n *\n * @see {@link SourceMiddleware}\n * @see @chunkd/middle for example middleware\n */\nexport class SourceView {\n source;\n middleware;\n static is(s) {\n if ('middleware' in s)\n return true;\n return false;\n }\n constructor(source, middleware = []) {\n this.source = source;\n this.middleware = middleware;\n }\n get type() {\n return this.source.type;\n }\n get url() {\n return this.source.url;\n }\n get metadata() {\n return this.source.metadata;\n }\n head(options) {\n return this.source.head(options);\n }\n async fetch(offset, length, options) {\n const middleware = this.middleware;\n if (middleware == null || middleware.length === 0)\n return this.source.fetch(offset, length, options);\n const handler = (req) => this.source.fetch(req.offset, req.length, options);\n return this.run(handler, offset, length, options);\n }\n /** Run a request using all the middleware */\n async run(handler, offset, length, options) {\n const middleware = this.middleware;\n if (middleware == null)\n return handler({ source: this, offset, length, signal: options?.signal });\n function runMiddleware(middleware, next) {\n return (req) => middleware.fetch(req, next);\n }\n for (let i = middleware.length - 1; i >= 0; i--)\n handler = runMiddleware(middleware[i], handler);\n return handler({ source: this, offset, length, signal: options?.signal });\n }\n}\n//# sourceMappingURL=view.js.map","export { SourceError } from './error.js';\nexport { ContentRange } from './range.js';\nexport { SourceView } from './view.js';\nexport function tryParseUrl(s) {\n try {\n return new URL(s);\n }\n catch (e) {\n return null;\n }\n}\n//# sourceMappingURL=index.js.map","import { ContentRange, SourceError } from '@chunkd/source';\n/**\n * Chunk requests into requests of specific byte sizes\n * If a request is split into smaller chunks should that be re-run as smaller requests and combined later\n *\n * This can **GREATLY** increase cache hits when using a @see {SourceCache}\n */\nexport class SourceChunk {\n name = 'source:chunk';\n /** Number of bytes to chunk requests into */\n chunkSize;\n constructor(opts) {\n this.chunkSize = opts.size ?? 32 * 1024;\n }\n async fetch(req, next) {\n // Reading from the end\n if (req.offset < 0)\n return next(req);\n // Reading entire file, no need to chunk it\n if (req.length == null)\n return next(req);\n const startChunkId = Math.floor(req.offset / this.chunkSize);\n const endChunkId = Math.ceil((req.offset + req.length) / this.chunkSize);\n // Do no try and read past the end of the file\n const maxSize = req.source.metadata?.size;\n if (maxSize != null && req.offset + req.length > maxSize) {\n throw new SourceError(`Request outside of bounds ${ContentRange.toRange(req.offset, req.length)}`, 416, req.source);\n }\n const startByte = startChunkId * this.chunkSize;\n const endByte = maxSize != null ? Math.min(endChunkId * this.chunkSize, maxSize) : endChunkId * this.chunkSize;\n const maxLength = endByte - startByte;\n const chunkOffset = req.offset - startByte;\n const chunkCount = endChunkId - startChunkId;\n // If there are multiple chunks required should it be split into multiple requests\n if (chunkCount > 1) {\n const bytes = await this.fetchChunks(req, startChunkId, endChunkId);\n return bytes.slice(chunkOffset, chunkOffset + req.length);\n }\n // Request is already requesting a exact chunk no need to slice buffers or modify the request\n if (req.offset === startByte && req.length === maxLength)\n return next(req);\n const buffer = await next({ ...req, offset: startByte, length: maxLength });\n return buffer.slice(chunkOffset, chunkOffset + req.length);\n }\n async fetchChunks(req, startId, endId) {\n const promises = [];\n const maxEndByte = req.source.metadata?.size ?? endId * this.chunkSize;\n for (let chunk = startId; chunk < endId; chunk++) {\n const startByte = chunk * this.chunkSize;\n const endByte = Math.min(startByte + this.chunkSize, maxEndByte);\n const chunkLength = endByte - startByte;\n promises.push(req.source.fetch(chunk * this.chunkSize, chunkLength, req.signal ? { signal: req.signal } : undefined));\n }\n const results = await Promise.all(promises);\n const outputBuffer = new Uint8Array(promises.length * this.chunkSize);\n for (let i = 0; i < results.length; i++) {\n outputBuffer.set(new Uint8Array(results[i]), i * this.chunkSize);\n }\n return outputBuffer.buffer;\n }\n}\n//# sourceMappingURL=chunk.js.map","import { ContentRange, SourceError } from '@chunkd/source';\n/** Load the ETag and content-range from the response */\nexport function getMetadataFromResponse(response) {\n const metadata = {};\n const contentLength = response.headers.get('content-length');\n if (contentLength)\n metadata.size = parseInt(contentLength);\n const contentRange = response.headers.get('content-range');\n if (contentRange != null)\n metadata.size = ContentRange.parseSize(contentRange);\n metadata.eTag = response.headers.get('etag') ?? undefined;\n metadata.contentType = response.headers.get('content-type') ?? undefined;\n metadata.contentDisposition = response.headers.get('content-disposition') ?? undefined;\n metadata.cacheControl = response.headers.get('cache-control') ?? undefined;\n metadata.contentEncoding = response.headers.get('content-encoding') ?? undefined;\n return metadata;\n}\nexport class SourceHttp {\n constructor(url, headers) {\n this.type = 'http';\n this.url = typeof url === 'string' ? SourceHttp.tryUrl(url) : url;\n this.headers = headers;\n }\n /** Attempt to parse a relative string into a URL */\n static tryUrl(s) {\n try {\n return new URL(s);\n }\n catch (_e) {\n if (typeof document !== 'undefined')\n return new URL(s, document.baseURI);\n // Should these throw if import.meta.url is not a http?\n return new URL(s, import.meta.url);\n }\n }\n head() {\n if (this._head)\n return this._head;\n this._head = SourceHttp.fetch(this.url, { method: 'HEAD', headers: this.headers }).then((res) => {\n if (!res.ok) {\n delete this._head;\n throw new Error(`Failed to HEAD ${this.url.href}`, { cause: { statusCode: res.status, msg: res.statusText } });\n }\n this.metadata = getMetadataFromResponse(res);\n return this.metadata;\n });\n return this._head;\n }\n async fetch(offset, length, options) {\n try {\n const headers = { range: ContentRange.toRange(offset, length), ...this.headers };\n const response = await SourceHttp.fetch(this.url, { headers, signal: options?.signal });\n if (!response.ok) {\n throw new SourceError(`Failed to fetch ${this.url.href} ${headers.range}`, response.status, this, new Error(response.statusText));\n }\n const metadata = getMetadataFromResponse(response);\n if (this.metadata == null) {\n this.metadata = metadata;\n }\n else if (this.metadata.eTag && this.metadata.eTag !== metadata.eTag) {\n // ETag has changed since the last read!\n throw new SourceError(`ETag conflict ${this.url.href} ${headers.range} expected: ${this.metadata.eTag} got: ${metadata.eTag}`, 409, this);\n }\n return response.arrayBuffer();\n }\n catch (e) {\n if (SourceError.is(e) && e.source === this)\n throw e;\n throw new SourceError(`Failed to fetch: ${this.url.href}`, 500, this, e);\n }\n }\n}\n// Allow overwriting the fetcher used (eg testing/node-js)\nSourceHttp.fetch = (a, b) => fetch(a, b);\n//# sourceMappingURL=index.js.map","import { ContentRange, SourceError, tryParseUrl } from '@chunkd/source';\nfunction parseMemoryUrl(s) {\n if (typeof s !== 'string')\n return s;\n const url = tryParseUrl(s);\n if (url)\n return url;\n return new URL('memory://' + s);\n}\nexport class SourceMemory {\n url;\n type = 'memory';\n data;\n metadata;\n static toArrayBuffer(buf) {\n if (buf instanceof ArrayBuffer)\n return buf;\n if (buf.byteLength === buf.buffer.byteLength)\n return buf.buffer;\n return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);\n }\n constructor(url, bytes) {\n const buf = SourceMemory.toArrayBuffer(bytes ?? new Uint8Array());\n this.url = parseMemoryUrl(url);\n this.data = buf;\n this.metadata = { size: buf.byteLength };\n }\n head() {\n return Promise.resolve({ size: this.data.byteLength });\n }\n fetch(offset, length) {\n if (offset < 0)\n offset = this.data.byteLength + offset;\n if (offset > this.data.byteLength) {\n throw new SourceError(`Read offset outside of file bounds range:${ContentRange.toRange(offset, length)} fileSize:${this.data.byteLength}`, 416, this);\n }\n return Promise.resolve(this.data.slice(offset, length == null ? undefined : offset + length));\n }\n}\n//# sourceMappingURL=index.js.map","// ── Constants ─────────────────────────────────────────────────────────────────\nconst PROJJSON_SCHEMA = \"https://proj.org/schemas/v0.7/projjson.schema.json\";\nconst MODEL_TYPE_PROJECTED = 1;\nconst MODEL_TYPE_GEOGRAPHIC = 2;\nconst USER_DEFINED = 32767;\n// GeoTIFF coordinate transformation type codes (GeoKey 3075)\n// http://geotiff.maptools.org/spec/geotiff6.html#6.3.3.3\nconst CT_TRANSVERSE_MERCATOR = 1;\nconst CT_TRANSVERSE_MERCATOR_SOUTH = 2;\nconst CT_OBLIQUE_MERCATOR = 3;\nconst CT_OBLIQUE_MERCATOR_LABORDE = 4;\nconst CT_OBLIQUE_MERCATOR_ROSENMUND = 5;\nconst CT_OBLIQUE_MERCATOR_SPHERICAL = 6;\nconst CT_MERCATOR = 7;\nconst CT_LAMBERT_CONFORMAL_CONIC_2SP = 8;\nconst CT_LAMBERT_CONFORMAL_CONIC_1SP = 9;\nconst CT_LAMBERT_AZIMUTHAL_EQUAL_AREA = 10;\nconst CT_ALBERS_EQUAL_AREA = 11;\nconst CT_AZIMUTHAL_EQUIDISTANT = 12;\nconst CT_STEREOGRAPHIC = 14;\nconst CT_POLAR_STEREOGRAPHIC = 15;\nconst CT_OBLIQUE_STEREOGRAPHIC = 16;\nconst CT_EQUIRECTANGULAR = 17;\nconst CT_CASSINI_SOLDNER = 18;\nconst CT_ORTHOGRAPHIC = 21;\nconst CT_POLYCONIC = 22;\nconst CT_SINUSOIDAL = 24;\nconst CT_NEW_ZEALAND_MAP_GRID = 26;\nconst CT_TRANSVERSE_MERCATOR_SOUTH_ORIENTED = 27;\nconst ANGULAR_UNIT_DEGREE = 9102;\nconst ANGULAR_UNIT_RADIAN = 9101;\nconst ANGULAR_UNIT_GRAD = 9105;\nconst ANGULAR_UNIT = {\n [ANGULAR_UNIT_DEGREE]: \"degree\",\n [ANGULAR_UNIT_RADIAN]: \"radian\",\n [ANGULAR_UNIT_GRAD]: \"grad\",\n};\nconst LINEAR_UNIT_METRE = 9001;\nconst LINEAR_UNIT_FOOT = 9002;\nconst LINEAR_UNIT_US_SURVEY_FOOT = 9003;\nconst US_SURVEY_FOOT = {\n type: \"LinearUnit\",\n name: \"US survey foot\",\n conversion_factor: 0.30480060960121924,\n};\nconst LINEAR_UNIT = {\n [LINEAR_UNIT_METRE]: \"metre\",\n [LINEAR_UNIT_FOOT]: \"foot\",\n [LINEAR_UNIT_US_SURVEY_FOOT]: US_SURVEY_FOOT,\n};\n/**\n * Parse a CRS from a GeoKeyDirectory.\n *\n * Returns the EPSG code as a number for EPSG-coded CRSes (letting the caller\n * decide how to resolve it), or a PROJJSON object built from the geo keys for\n * user-defined CRSes.\n */\nexport function crsFromGeoKeys(gkd) {\n const modelType = gkd.modelType;\n if (modelType === MODEL_TYPE_PROJECTED) {\n return _projectedCrs(gkd);\n }\n if (modelType === MODEL_TYPE_GEOGRAPHIC) {\n return _geographicCrs(gkd);\n }\n throw new Error(`Unsupported GeoTIFF model type: ${modelType}`);\n}\nfunction _geographicCrs(gkd) {\n const epsg = gkd.geodeticCRS;\n if (epsg !== null && epsg !== USER_DEFINED) {\n return epsg;\n }\n return _buildGeographicCrs(gkd, PROJJSON_SCHEMA);\n}\nfunction _projectedCrs(gkd) {\n const epsg = gkd.projectedCRS;\n if (epsg !== null && epsg !== USER_DEFINED) {\n return epsg;\n }\n return _buildProjectedCrs(gkd);\n}\nfunction _buildGeographicCrs(gkd, schema) {\n const ellipsoid = _buildEllipsoid(gkd);\n let pmName = \"Greenwich\";\n let pmLongitude = 0.0;\n if (gkd.primeMeridian !== null && gkd.primeMeridian !== USER_DEFINED) {\n pmName = `EPSG:${gkd.primeMeridian}`;\n }\n else if (gkd.primeMeridianLongitude !== null) {\n pmLongitude = gkd.primeMeridianLongitude;\n pmName = \"User-defined\";\n }\n let datum;\n if (gkd.geodeticDatum !== null && gkd.geodeticDatum !== USER_DEFINED) {\n datum = {\n type: \"GeodeticReferenceFrame\",\n name: `Unknown datum based upon EPSG ${gkd.geodeticDatum} ellipsoid`,\n };\n }\n else {\n datum = {\n type: \"GeodeticReferenceFrame\",\n name: gkd.geodeticCitation ?? \"User-defined\",\n ellipsoid,\n prime_meridian: { name: pmName, longitude: pmLongitude },\n };\n }\n const crs = {\n type: \"GeographicCRS\",\n name: gkd.geodeticCitation ?? \"User-defined\",\n datum,\n coordinate_system: _geographicCs(gkd),\n };\n if (schema !== undefined) {\n crs.$schema = schema;\n }\n return crs;\n}\nfunction _buildProjectedCrs(gkd) {\n // Always build the base CRS from geo keys — the geodeticCRS EPSG code inside\n // a user-defined projected CRS is informational, not a fetch target.\n const baseCrs = _buildGeographicCrs(gkd);\n const conversion = _buildConversion(gkd);\n const cs = _projectedCs(gkd);\n return {\n type: \"ProjectedCRS\",\n $schema: PROJJSON_SCHEMA,\n name: gkd.projectedCitation ?? gkd.citation ?? \"User-defined\",\n base_crs: baseCrs,\n conversion,\n coordinate_system: cs,\n };\n}\nfunction _buildEllipsoid(gkd) {\n if (gkd.ellipsoid !== null && gkd.ellipsoid !== USER_DEFINED) {\n const ellipsoid = {\n name: `EPSG ellipsoid ${gkd.ellipsoid}`,\n };\n if (gkd.ellipsoidSemiMajorAxis !== null) {\n ellipsoid.semi_major_axis = gkd.ellipsoidSemiMajorAxis;\n }\n if (gkd.ellipsoidInvFlattening !== null) {\n ellipsoid.inverse_flattening = gkd.ellipsoidInvFlattening;\n }\n else if (gkd.ellipsoidSemiMinorAxis !== null) {\n ellipsoid.semi_minor_axis = gkd.ellipsoidSemiMinorAxis;\n }\n return ellipsoid;\n }\n if (gkd.ellipsoidSemiMajorAxis === null) {\n throw new Error(\"User-defined ellipsoid requires ellipsoidSemiMajorAxis\");\n }\n const ellipsoid = {\n name: gkd.geodeticCitation ?? \"User-defined\",\n semi_major_axis: gkd.ellipsoidSemiMajorAxis,\n };\n if (gkd.ellipsoidInvFlattening !== null) {\n ellipsoid.inverse_flattening = gkd.ellipsoidInvFlattening;\n }\n else if (gkd.ellipsoidSemiMinorAxis !== null) {\n ellipsoid.semi_minor_axis = gkd.ellipsoidSemiMinorAxis;\n }\n else {\n throw new Error(\"User-defined ellipsoid requires ellipsoidInvFlattening or ellipsoidSemiMinorAxis\");\n }\n return ellipsoid;\n}\nfunction _buildConversion(gkd) {\n const ct = gkd.projMethod;\n if (ct === null) {\n throw new Error(\"User-defined projected CRS requires projMethod\");\n }\n const angular = (name, value, default_ = 0.0) => ({\n name,\n value: value ?? default_,\n unit: \"degree\",\n });\n const linear = (name, value, default_ = 0.0) => ({\n name,\n value: value ?? default_,\n unit: \"metre\",\n });\n const scale = (name, value, default_ = 1.0) => ({\n name,\n value: value ?? default_,\n unit: \"unity\",\n });\n switch (ct) {\n case CT_TRANSVERSE_MERCATOR:\n case CT_TRANSVERSE_MERCATOR_SOUTH:\n case CT_TRANSVERSE_MERCATOR_SOUTH_ORIENTED: {\n const name = ct === CT_TRANSVERSE_MERCATOR\n ? \"Transverse Mercator\"\n : \"Transverse Mercator (South Orientated)\";\n return {\n name,\n method: { name },\n parameters: [\n angular(\"Latitude of natural origin\", gkd.projNatOriginLat),\n angular(\"Longitude of natural origin\", gkd.projNatOriginLong),\n scale(\"Scale factor at natural origin\", gkd.projScaleAtNatOrigin),\n linear(\"False easting\", gkd.projFalseEasting),\n linear(\"False northing\", gkd.projFalseNorthing),\n ],\n };\n }\n case CT_OBLIQUE_MERCATOR:\n case CT_OBLIQUE_MERCATOR_LABORDE:\n case CT_OBLIQUE_MERCATOR_ROSENMUND:\n case CT_OBLIQUE_MERCATOR_SPHERICAL: {\n const name = \"Hotine Oblique Mercator (variant B)\";\n return {\n name,\n method: { name },\n parameters: [\n angular(\"Latitude of projection centre\", gkd.projCenterLat),\n angular(\"Longitude of projection centre\", gkd.projCenterLong),\n angular(\"Azimuth of initial line\", gkd.projAzimuthAngle),\n angular(\"Angle from Rectified to Skew Grid\", gkd.projAzimuthAngle),\n scale(\"Scale factor on initial line\", gkd.projScaleAtCenter),\n linear(\"Easting at projection centre\", gkd.projCenterEasting),\n linear(\"Northing at projection centre\", gkd.projCenterNorthing),\n ],\n };\n }\n case CT_MERCATOR: {\n const name = \"Mercator (variant A)\";\n return {\n name,\n method: { name },\n parameters: [\n angular(\"Latitude of natural origin\", gkd.projNatOriginLat),\n angular(\"Longitude of natural origin\", gkd.projNatOriginLong),\n scale(\"Scale factor at natural origin\", gkd.projScaleAtNatOrigin),\n linear(\"False easting\", gkd.projFalseEasting),\n linear(\"False northing\", gkd.projFalseNorthing),\n ],\n };\n }\n case CT_LAMBERT_CONFORMAL_CONIC_2SP: {\n const name = \"Lambert Conic Conformal (2SP)\";\n return {\n name,\n method: { name },\n parameters: [\n angular(\"Latitude of false origin\", gkd.projFalseOriginLat ?? gkd.projNatOriginLat),\n angular(\"Longitude of false origin\", gkd.projFalseOriginLong ?? gkd.projNatOriginLong),\n angular(\"Latitude of 1st standard parallel\", gkd.projStdParallel1),\n angular(\"Latitude of 2nd standard parallel\", gkd.projStdParallel2),\n linear(\"Easting at false origin\", gkd.projFalseOriginEasting ?? gkd.projFalseEasting),\n linear(\"Northing at false origin\", gkd.projFalseOriginNorthing ?? gkd.projFalseNorthing),\n ],\n };\n }\n case CT_LAMBERT_CONFORMAL_CONIC_1SP: {\n const name = \"Lambert Conic Conformal (1SP)\";\n return {\n name,\n method: { name },\n parameters: [\n angular(\"Latitude of natural origin\", gkd.projNatOriginLat),\n angular(\"Longitude of natural origin\", gkd.projNatOriginLong),\n scale(\"Scale factor at natural origin\", gkd.projScaleAtNatOrigin),\n linear(\"False easting\", gkd.projFalseEasting),\n linear(\"False northing\", gkd.projFalseNorthing),\n ],\n };\n }\n case CT_LAMBERT_AZIMUTHAL_EQUAL_AREA: {\n const name = \"Lambert Azimuthal Equal Area\";\n return {\n name,\n method: { name },\n parameters: [\n angular(\"Latitude of natural origin\", gkd.projCenterLat),\n angular(\"Longitude of natural origin\", gkd.projCenterLong),\n linear(\"False easting\", gkd.projFalseEasting),\n linear(\"False northing\", gkd.projFalseNorthing),\n ],\n };\n }\n case CT_ALBERS_EQUAL_AREA: {\n const name = \"Albers Equal Area\";\n return {\n name,\n method: { name },\n parameters: [\n angular(\"Latitude of false origin\", gkd.projFalseOriginLat ?? gkd.projNatOriginLat),\n angular(\"Longitude of false origin\", gkd.projFalseOriginLong ?? gkd.projNatOriginLong),\n angular(\"Latitude of 1st standard parallel\", gkd.projStdParallel1),\n angular(\"Latitude of 2nd standard parallel\", gkd.projStdParallel2),\n linear(\"Easting at false origin\", gkd.projFalseOriginEasting ?? gkd.projFalseEasting),\n linear(\"Northing at false origin\", gkd.projFalseOriginNorthing ?? gkd.projFalseNorthing),\n ],\n };\n }\n case CT_AZIMUTHAL_EQUIDISTANT: {\n const name = \"Modified Azimuthal Equidistant\";\n return {\n name,\n method: { name },\n parameters: [\n angular(\"Latitude of natural origin\", gkd.projCenterLat),\n angular(\"Longitude of natural origin\", gkd.projCenterLong),\n linear(\"False easting\", gkd.projFalseEasting),\n linear(\"False northing\", gkd.projFalseNorthing),\n ],\n };\n }\n case CT_STEREOGRAPHIC: {\n const name = \"Stereographic\";\n return {\n name,\n method: { name },\n parameters: [\n angular(\"Latitude of natural origin\", gkd.projCenterLat),\n angular(\"Longitude of natural origin\", gkd.projCenterLong),\n scale(\"Scale factor at natural origin\", gkd.projScaleAtCenter),\n linear(\"False easting\", gkd.projFalseEasting),\n linear(\"False northing\", gkd.projFalseNorthing),\n ],\n };\n }\n case CT_POLAR_STEREOGRAPHIC: {\n const name = \"Polar Stereographic (variant B)\";\n return {\n name,\n method: { name },\n parameters: [\n angular(\"Latitude of standard parallel\", gkd.projNatOriginLat ?? gkd.projStdParallel1),\n angular(\"Longitude of origin\", gkd.projStraightVertPoleLong ?? gkd.projNatOriginLong),\n linear(\"False easting\", gkd.projFalseEasting),\n linear(\"False northing\", gkd.projFalseNorthing),\n ],\n };\n }\n case CT_OBLIQUE_STEREOGRAPHIC: {\n const name = \"Oblique Stereographic\";\n return {\n name,\n method: { name },\n parameters: [\n angular(\"Latitude of natural origin\", gkd.projCenterLat),\n angular(\"Longitude of natural origin\", gkd.projCenterLong),\n scale(\"Scale factor at natural origin\", gkd.projScaleAtCenter),\n linear(\"False easting\", gkd.projFalseEasting),\n linear(\"False northing\", gkd.projFalseNorthing),\n ],\n };\n }\n case CT_EQUIRECTANGULAR: {\n const name = \"Equidistant Cylindrical\";\n return {\n name,\n method: { name },\n parameters: [\n angular(\"Latitude of 1st standard parallel\", gkd.projStdParallel1 ?? gkd.projCenterLat),\n angular(\"Longitude of natural origin\", gkd.projCenterLong),\n linear(\"False easting\", gkd.projFalseEasting),\n linear(\"False northing\", gkd.projFalseNorthing),\n ],\n };\n }\n case CT_CASSINI_SOLDNER: {\n const name = \"Cassini-Soldner\";\n return {\n name,\n method: { name },\n parameters: [\n angular(\"Latitude of natural origin\", gkd.projNatOriginLat),\n angular(\"Longitude of natural origin\", gkd.projNatOriginLong),\n linear(\"False easting\", gkd.projFalseEasting),\n linear(\"False northing\", gkd.projFalseNorthing),\n ],\n };\n }\n case CT_POLYCONIC: {\n const name = \"American Polyconic\";\n return {\n name,\n method: { name },\n parameters: [\n angular(\"Latitude of natural origin\", gkd.projNatOriginLat),\n angular(\"Longitude of natural origin\", gkd.projNatOriginLong),\n linear(\"False easting\", gkd.projFalseEasting),\n linear(\"False northing\", gkd.projFalseNorthing),\n ],\n };\n }\n case CT_SINUSOIDAL: {\n const name = \"Sinusoidal\";\n return {\n name,\n method: { name },\n parameters: [\n angular(\"Longitude of natural origin\", gkd.projCenterLong),\n linear(\"False easting\", gkd.projFalseEasting),\n linear(\"False northing\", gkd.projFalseNorthing),\n ],\n };\n }\n case CT_ORTHOGRAPHIC: {\n const name = \"Orthographic\";\n return {\n name,\n method: { name },\n parameters: [\n angular(\"Latitude of natural origin\", gkd.projCenterLat),\n angular(\"Longitude of natural origin\", gkd.projCenterLong),\n linear(\"False easting\", gkd.projFalseEasting),\n linear(\"False northing\", gkd.projFalseNorthing),\n ],\n };\n }\n case CT_NEW_ZEALAND_MAP_GRID: {\n const name = \"New Zealand Map Grid\";\n return {\n name,\n method: { name },\n parameters: [\n angular(\"Latitude of natural origin\", gkd.projNatOriginLat),\n angular(\"Longitude of natural origin\", gkd.projNatOriginLong),\n linear(\"False easting\", gkd.projFalseEasting),\n linear(\"False northing\", gkd.projFalseNorthing),\n ],\n };\n }\n default:\n throw new Error(`Unsupported coordinate transformation type: ${ct}`);\n }\n}\nfunction _geographicCs(gkd) {\n const unit = ANGULAR_UNIT[gkd.angularUnits ?? ANGULAR_UNIT_DEGREE] ?? \"degree\";\n return {\n subtype: \"ellipsoidal\",\n axis: [\n {\n name: \"Geodetic latitude\",\n abbreviation: \"Lat\",\n direction: \"north\",\n unit,\n },\n {\n name: \"Geodetic longitude\",\n abbreviation: \"Lon\",\n direction: \"east\",\n unit,\n },\n ],\n };\n}\nfunction _projectedCs(gkd) {\n const unit = LINEAR_UNIT[gkd.projLinearUnits ?? LINEAR_UNIT_METRE] ?? \"metre\";\n return {\n subtype: \"Cartesian\",\n axis: [\n { name: \"Easting\", abbreviation: \"E\", direction: \"east\", unit },\n { name: \"Northing\", abbreviation: \"N\", direction: \"north\", unit },\n ],\n };\n}\n//# sourceMappingURL=crs.js.map","import { Compression, PlanarConfiguration, TiffTag } from \"@cogeotiff/core\";\nimport { compose, translation } from \"@developmentseed/affine\";\nimport { decode } from \"./decode.js\";\nexport async function fetchTile(self, x, y, { boundless = true, pool, signal, } = {}) {\n const tileFetch = fetchCogBytes(self, x, y, { signal });\n const maskFetch = self.maskImage != null\n ? getTile(self.maskImage, x, y, self.dataSource, { signal })\n : Promise.resolve(null);\n const [tileBytes, maskBytes] = await Promise.all([tileFetch, maskFetch]);\n const { bitsPerSample: bitsPerSamples, predictor, planarConfiguration, sampleFormat: sampleFormats, lercParameters, } = self.cachedTags;\n const { sampleFormat, bitsPerSample } = getUniqueSampleFormat(sampleFormats, bitsPerSamples);\n const tileTransform = compose(self.transform, translation(x * self.tileWidth, y * self.tileHeight));\n const samplesPerPixel = self.image.value(TiffTag.SamplesPerPixel) ?? 1;\n const decoderMetadata = {\n sampleFormat,\n bitsPerSample,\n samplesPerPixel,\n width: self.tileWidth,\n height: self.tileHeight,\n predictor,\n planarConfiguration,\n lercParameters,\n };\n const [decodedPixels, mask] = await Promise.all([\n decodeTile(tileBytes, decoderMetadata, pool),\n maskBytes != null && self.maskImage != null\n ? decodeMask(maskBytes, self.maskImage, pool)\n : Promise.resolve(null),\n ]);\n const array = {\n ...decodedPixels,\n count: samplesPerPixel,\n height: self.tileHeight,\n width: self.tileWidth,\n mask,\n transform: tileTransform,\n crs: self.crs,\n nodata: self.nodata,\n };\n return {\n x,\n y,\n array: boundless === true ? array : clipToImageBounds(self, x, y, array),\n };\n}\n/**\n * Fetch multiple tiles from a GeoTIFF or Overview in parallel.\n *\n * The benefit of using this over multiple calls to {@link fetchTile} is that\n * a future implementation can coalesce requests for tiles stored contiguously\n * on disk, reducing the number of HTTP range requests. For now, this simply\n * calls {@link fetchTile} in parallel for each coordinate.\n *\n * @param self - The GeoTIFF or Overview to fetch tiles from.\n * @param xy - Array of `[x, y]` tile coordinates.\n * @param options - Optional parameters (same as {@link fetchTile}).\n * @returns Array of {@link Tile} objects in the same order as `xy`.\n *\n * @see {@link fetchTile} for single-tile fetching.\n */\nexport async function fetchTiles(self, xy, { boundless = true, pool, signal, } = {}) {\n // TODO: coalesce contiguous byte ranges for fewer HTTP requests\n return Promise.all(xy.map(([x, y]) => fetchTile(self, x, y, { boundless, pool, signal })));\n}\nasync function decodeMask(mask, maskImage, pool) {\n const maskSampleFormats = maskImage.value(TiffTag.SampleFormat) ?? [1];\n const maskBitsPerSample = maskImage.value(TiffTag.BitsPerSample) ?? [8];\n const { sampleFormat, bitsPerSample } = getUniqueSampleFormat(maskSampleFormats, new Uint16Array(maskBitsPerSample));\n const { width, height } = maskImage.tileSize;\n const metadata = {\n sampleFormat,\n bitsPerSample,\n samplesPerPixel: maskImage.value(TiffTag.SamplesPerPixel) ?? 1,\n width,\n height,\n predictor: maskImage.value(TiffTag.Predictor) ?? 1,\n planarConfiguration: maskImage.value(TiffTag.PlanarConfiguration) ??\n PlanarConfiguration.Contig,\n };\n const decoderFn = (bytes, compression, meta) => pool\n ? pool.decode(bytes, compression, meta)\n : decode(bytes, compression, meta);\n const { bytes, compression } = mask;\n const decoded = await decoderFn(bytes, compression, metadata);\n const data = decoded.layout === \"pixel-interleaved\" ? decoded.data : decoded.bands[0];\n if (data instanceof Uint8Array) {\n return data;\n }\n throw new Error(\"Expected mask data to decode to Uint8Array\");\n}\nasync function decodeTile(tile, metadata, pool) {\n const decoderFn = (bytes, compression, meta) => pool\n ? pool.decode(bytes, compression, meta)\n : decode(bytes, compression, meta);\n if (Array.isArray(tile)) {\n // Band-separate: each element is one band's compressed tile\n const bandMetadata = { ...metadata, samplesPerPixel: 1 };\n const decodedBands = await Promise.all(tile.map(({ bytes, compression }) => decoderFn(bytes, compression, bandMetadata)));\n const bands = decodedBands.map((result) => result.layout === \"band-separate\" ? result.bands[0] : result.data);\n return { layout: \"band-separate\", bands };\n }\n else {\n // Pixel-interleaved: single compressed buffer covering all bands\n // interleaved\n const { bytes, compression } = tile;\n return decoderFn(bytes, compression, metadata);\n }\n}\n/** Fetch bytes from a COG, handling whether pixel/band interleaving. */\nasync function fetchCogBytes(self, x, y, { signal, } = {}) {\n switch (self.cachedTags.planarConfiguration) {\n case PlanarConfiguration.Contig: {\n const tile = await getTile(self.image, x, y, self.dataSource, { signal });\n if (tile === null) {\n throw new Error(`Tile at (${x}, ${y}) not found`);\n }\n return tile;\n }\n case PlanarConfiguration.Separate:\n return await fetchBandSeparateTileBytes(self, x, y, { signal });\n default:\n throw new Error(`Unsupported PlanarConfiguration: ${self.cachedTags.planarConfiguration}`);\n }\n}\nasync function findBandSeparateTileByteRanges(self, x, y) {\n // TODO: error here if user-provided band-indexes are out of bounds\n const { x: tilesPerRow, y: tilesPerColumn } = self.image.tileCount;\n const tilesPerBand = tilesPerRow * tilesPerColumn;\n const numBands = self.cachedTags.samplesPerPixel;\n const tileSizes = [...Array(numBands).keys()].map((band) => {\n const bandIdx = band * tilesPerBand + y * tilesPerRow + x;\n return self.image.getTileSize(bandIdx);\n });\n return Promise.all(tileSizes);\n}\nasync function fetchBandSeparateTileBytes(self, x, y, { signal, } = {}) {\n const byteRanges = await findBandSeparateTileByteRanges(self, x, y);\n const buffers = byteRanges.map(async ({ offset, imageSize }) => {\n const tile = await getBytes(self.image, offset, imageSize, self.dataSource, { signal });\n if (tile === null) {\n throw new Error(`Tile at (${x}, ${y}) not found`);\n }\n return tile;\n });\n return Promise.all(buffers);\n}\n/**\n * Load a tile into a ArrayBuffer\n *\n * if the tile compression is JPEG, This will also apply the JPEG compression tables to the resulting ArrayBuffer see {@link getJpegHeader}\n *\n * Though this function lives upstream in @cogeotiff/core, we vendor it here so\n * that we can use a custom fetch.\n *\n * This is to separate the source used for fetching header/IFD data (which is\n * typically small and benefits from caching) from the source used for fetching\n * tile data (which can be large and should avoid unnecessary copying through\n * cache layers).\n */\nasync function getTile(image, x, y, source, options) {\n const { size, tileSize: tiles } = image;\n if (tiles == null) {\n throw new Error(\"Tiff is not tiled\");\n }\n // TODO support GhostOptionTileOrder\n const nyTiles = Math.ceil(size.height / tiles.height);\n const nxTiles = Math.ceil(size.width / tiles.width);\n if (x >= nxTiles || y >= nyTiles) {\n throw new Error(`Tile index is outside of range x:${x} >= ${nxTiles} or y:${y} >= ${nyTiles}`);\n }\n const idx = y * nxTiles + x;\n const totalTiles = nxTiles * nyTiles;\n if (idx >= totalTiles) {\n throw new Error(`Tile index is outside of tile range: ${idx} >= ${totalTiles}`);\n }\n const { offset, imageSize } = await image.getTileSize(idx);\n return getBytes(image, offset, imageSize, source, options);\n}\n/** Read image bytes at the given offset.\n *\n * Though this function lives upstream in @cogeotiff/core, we vendor it here so\n * that we can use a custom fetch.\n *\n * This is to separate the source used for fetching header/IFD data (which is\n * typically small and benefits from caching) from the source used for fetching\n * tile data (which can be large and should avoid unnecessary copying through\n * cache layers).\n */\nasync function getBytes(image, offset, byteCount, source, options) {\n if (byteCount === 0) {\n return null;\n }\n const bytes = await source.fetch(offset, byteCount, options);\n if (bytes.byteLength < byteCount) {\n throw new Error(`Failed to fetch bytes from offset:${offset} wanted:${byteCount} got:${bytes.byteLength}`);\n }\n const compression = image.value(TiffTag.Compression) ?? Compression.None;\n if (compression === Compression.Jpeg) {\n return {\n bytes: image.getJpegHeader(bytes),\n compression,\n };\n }\n return { bytes, compression };\n}\n/**\n * Clip a decoded tile array to the valid image bounds.\n *\n * Edge tiles in a COG are always encoded at the full tile size, with the\n * out-of-bounds region zero-padded. When `boundless=false` is requested, this\n * function copies only the valid pixel sub-rectangle into a new typed array,\n * returning a `RasterArray` whose `width`/`height` match the actual image\n * content rather than the tile dimensions.\n *\n * Interior tiles (where the tile fits entirely within the image) are returned\n * unchanged.\n */\nfunction clipToImageBounds(self, x, y, array) {\n const { width: clippedWidth, height: clippedHeight } = self.image.getTileBounds(x, y);\n // Interior tile — nothing to clip.\n if (clippedWidth === self.tileWidth && clippedHeight === self.tileHeight) {\n return array;\n }\n const clippedMask = array.mask\n ? clipRows(array.mask, self.tileWidth, clippedWidth, clippedHeight, 1)\n : array.mask;\n if (array.layout === \"pixel-interleaved\") {\n const { count, data } = array;\n const clipped = clipRows(data, self.tileWidth, clippedWidth, clippedHeight, count);\n return {\n ...array,\n width: clippedWidth,\n height: clippedHeight,\n data: clipped,\n mask: clippedMask,\n };\n }\n // band-separate\n const { bands } = array;\n const clippedBands = bands.map((band) => clipRows(band, self.tileWidth, clippedWidth, clippedHeight, 1));\n return {\n ...array,\n width: clippedWidth,\n height: clippedHeight,\n bands: clippedBands,\n mask: clippedMask,\n };\n}\n/**\n * Copy rows from a strided typed array, keeping only `clippedWidth * samplesPerPixel`\n * values per row out of `tileWidth * samplesPerPixel`.\n */\nfunction clipRows(src, tileWidth, clippedWidth, clippedHeight, samplesPerPixel) {\n const srcStride = tileWidth * samplesPerPixel;\n const dstStride = clippedWidth * samplesPerPixel;\n // @ts-expect-error — typed array constructors are not in a common interface\n const dst = new src.constructor(dstStride * clippedHeight);\n for (let r = 0; r < clippedHeight; r++) {\n dst.set(src.subarray(r * srcStride, r * srcStride + dstStride), r * dstStride);\n }\n return dst;\n}\nfunction getUniqueSampleFormat(sampleFormats, bitsPerSamples) {\n const uniqueSampleFormats = new Set(sampleFormats);\n const uniqueBitsPerSample = new Set(bitsPerSamples);\n if (uniqueSampleFormats.size > 1) {\n throw new Error(\"Multiple sample formats are not supported.\");\n }\n if (uniqueBitsPerSample.size > 1) {\n throw new Error(\"Multiple bits per sample values are not supported.\");\n }\n const sampleFormat = sampleFormats[0];\n const bitsPerSample = bitsPerSamples[0];\n if (sampleFormat === undefined || bitsPerSample === undefined) {\n throw new Error(\"SampleFormat and BitsPerSample arrays cannot be empty.\");\n }\n return {\n sampleFormat,\n bitsPerSample,\n };\n}\n//# sourceMappingURL=fetch.js.map","export function parseGDALMetadata(gdalMetadata, { count }) {\n if (gdalMetadata == null) {\n return null;\n }\n const parser = new DOMParser();\n const doc = parser.parseFromString(gdalMetadata, \"text/xml\");\n const root = doc.documentElement;\n if (root.tagName !== \"GDALMetadata\") {\n throw new Error(\"Not a GDALMetadata XML block\");\n }\n const bandStatistics = new Map();\n const offsets = Array(count).fill(0);\n const scales = Array(count).fill(1);\n const getOrCreateBand = (sample) => {\n const idx = parseInt(sample, 10) + 1; // 1-based\n if (!bandStatistics.has(idx)) {\n bandStatistics.set(idx, {\n max: null,\n min: null,\n mean: null,\n std: null,\n validPercent: null,\n });\n }\n return bandStatistics.get(idx);\n };\n for (const elem of Array.from(root.querySelectorAll(\"Item\"))) {\n const name = elem.getAttribute(\"name\");\n const sample = elem.getAttribute(\"sample\");\n const text = elem.textContent ?? \"\";\n if (sample === null) {\n continue;\n }\n switch (name) {\n case \"STATISTICS_MAXIMUM\":\n getOrCreateBand(sample).max = parseFloat(text);\n break;\n case \"STATISTICS_MEAN\":\n getOrCreateBand(sample).mean = parseFloat(text);\n break;\n case \"STATISTICS_MINIMUM\":\n getOrCreateBand(sample).min = parseFloat(text);\n break;\n case \"STATISTICS_STDDEV\":\n getOrCreateBand(sample).std = parseFloat(text);\n break;\n case \"STATISTICS_VALID_PERCENT\":\n getOrCreateBand(sample).validPercent = parseFloat(text);\n break;\n case \"OFFSET\":\n offsets[parseInt(sample, 10)] = parseFloat(text);\n break;\n case \"SCALE\":\n scales[parseInt(sample, 10)] = parseFloat(text);\n break;\n }\n }\n return { bandStatistics, offsets, scales };\n}\n//# sourceMappingURL=gdal-metadata.js.map","import { Predictor, SampleFormat, TiffTag, TiffTagGeo } from \"@cogeotiff/core\";\n/** Pre-fetch TIFF tags for easier visualization. */\nexport async function prefetchTags(image) {\n // Compression is pre-fetched in init\n const compression = image.value(TiffTag.Compression);\n if (compression === null) {\n throw new Error(\"Compression tag should always exist.\");\n }\n const [bitsPerSample, colorMap, gdalNoData, gdalMetadata, lercParameters, modelPixelScale, modelTiepoint, modelTransformation, photometric, planarConfiguration, predictor, sampleFormat, samplesPerPixel, tileByteCounts, tileOffsets,] = await Promise.all([\n image.fetch(TiffTag.BitsPerSample),\n image.fetch(TiffTag.ColorMap),\n image.fetch(TiffTag.GdalNoData),\n image.fetch(TiffTag.GdalMetadata),\n image.fetch(TiffTag.LercParameters),\n image.fetch(TiffTag.ModelPixelScale),\n image.fetch(TiffTag.ModelTiePoint),\n image.fetch(TiffTag.ModelTransformation),\n image.fetch(TiffTag.Photometric),\n image.fetch(TiffTag.PlanarConfiguration),\n image.fetch(TiffTag.Predictor),\n image.fetch(TiffTag.SampleFormat),\n image.fetch(TiffTag.SamplesPerPixel),\n // Pre-fetch tile offsets and byte counts. If we don't prefetch them,\n // TiffImage.getTileSize will have to fetch them for each tile, which\n // results in many redundant requests.\n image.fetch(TiffTag.TileByteCounts),\n image.fetch(TiffTag.TileOffsets),\n ]);\n const missingTag = (tagName) => {\n throw new Error(`${tagName} tag should always exist.`);\n };\n if (bitsPerSample === null) {\n missingTag(\"BitsPerSample\");\n }\n if (samplesPerPixel === null) {\n missingTag(\"SamplesPerPixel\");\n }\n if (planarConfiguration === null) {\n missingTag(\"PlanarConfiguration\");\n }\n if (photometric === null) {\n missingTag(\"Photometric\");\n }\n return {\n bitsPerSample: new Uint16Array(bitsPerSample),\n colorMap: colorMap ? new Uint16Array(colorMap) : undefined,\n compression,\n gdalMetadata,\n lercParameters,\n modelTiepoint,\n modelPixelScale,\n modelTransformation,\n nodata: gdalNoData !== null ? Number(gdalNoData) : null,\n photometric,\n planarConfiguration,\n predictor: predictor ?? Predictor.None,\n // Uint is the default sample format according to the spec\n // https://web.archive.org/web/20240329145340/https://www.awaresystems.be/imaging/tiff/tifftags/sampleformat.html\n sampleFormat: sampleFormat ?? [SampleFormat.Uint],\n samplesPerPixel,\n tileByteCounts,\n tileOffsets,\n };\n}\nexport function extractGeoKeyDirectory(image) {\n const geo = (key) => image.valueGeo(key) ?? null;\n return {\n // Configuration keys\n modelType: geo(TiffTagGeo.GTModelTypeGeoKey),\n rasterType: geo(TiffTagGeo.GTRasterTypeGeoKey),\n citation: geo(TiffTagGeo.GTCitationGeoKey),\n // Geographic CRS keys\n geodeticCRS: geo(TiffTagGeo.GeodeticCRSGeoKey),\n geodeticCitation: geo(TiffTagGeo.GeodeticCitationGeoKey),\n geodeticDatum: geo(TiffTagGeo.GeodeticDatumGeoKey),\n primeMeridian: geo(TiffTagGeo.PrimeMeridianGeoKey),\n linearUnits: geo(TiffTagGeo.GeogLinearUnitsGeoKey),\n linearUnitSize: geo(TiffTagGeo.GeogLinearUnitSizeGeoKey),\n angularUnits: geo(TiffTagGeo.GeogAngularUnitsGeoKey),\n angularUnitSize: geo(TiffTagGeo.GeogAngularUnitSizeGeoKey),\n ellipsoid: geo(TiffTagGeo.EllipsoidGeoKey),\n ellipsoidSemiMajorAxis: geo(TiffTagGeo.EllipsoidSemiMajorAxisGeoKey),\n ellipsoidSemiMinorAxis: geo(TiffTagGeo.EllipsoidSemiMinorAxisGeoKey),\n ellipsoidInvFlattening: geo(TiffTagGeo.EllipsoidInvFlatteningGeoKey),\n azimuthUnits: geo(TiffTagGeo.GeogAzimuthUnitsGeoKey),\n primeMeridianLongitude: geo(TiffTagGeo.PrimeMeridianLongitudeGeoKey),\n toWGS84: geo(TiffTagGeo.GeogTOWGS84GeoKey),\n // Projected CRS keys\n projectedCRS: geo(TiffTagGeo.ProjectedCRSGeoKey),\n projectedCitation: geo(TiffTagGeo.ProjectedCitationGeoKey),\n projection: geo(TiffTagGeo.ProjectionGeoKey),\n projMethod: geo(TiffTagGeo.ProjMethodGeoKey),\n projLinearUnits: geo(TiffTagGeo.ProjLinearUnitsGeoKey),\n projLinearUnitSize: geo(TiffTagGeo.ProjLinearUnitSizeGeoKey),\n projStdParallel1: geo(TiffTagGeo.ProjStdParallel1GeoKey),\n projStdParallel2: geo(TiffTagGeo.ProjStdParallel2GeoKey),\n projNatOriginLong: geo(TiffTagGeo.ProjNatOriginLongGeoKey),\n projNatOriginLat: geo(TiffTagGeo.ProjNatOriginLatGeoKey),\n projFalseEasting: geo(TiffTagGeo.ProjFalseEastingGeoKey),\n projFalseNorthing: geo(TiffTagGeo.ProjFalseNorthingGeoKey),\n projFalseOriginLong: geo(TiffTagGeo.ProjFalseOriginLongGeoKey),\n projFalseOriginLat: geo(TiffTagGeo.ProjFalseOriginLatGeoKey),\n projFalseOriginEasting: geo(TiffTagGeo.ProjFalseOriginEastingGeoKey),\n projFalseOriginNorthing: geo(TiffTagGeo.ProjFalseOriginNorthingGeoKey),\n projCenterLong: geo(TiffTagGeo.ProjCenterLongGeoKey),\n projCenterLat: geo(TiffTagGeo.ProjCenterLatGeoKey),\n projCenterEasting: geo(TiffTagGeo.ProjCenterEastingGeoKey),\n projCenterNorthing: geo(TiffTagGeo.ProjCenterNorthingGeoKey),\n projScaleAtNatOrigin: geo(TiffTagGeo.ProjScaleAtNatOriginGeoKey),\n projScaleAtCenter: geo(TiffTagGeo.ProjScaleAtCenterGeoKey),\n projAzimuthAngle: geo(TiffTagGeo.ProjAzimuthAngleGeoKey),\n projStraightVertPoleLong: geo(TiffTagGeo.ProjStraightVertPoleLongGeoKey),\n projRectifiedGridAngle: geo(TiffTagGeo.ProjRectifiedGridAngleGeoKey),\n // Vertical CRS keys\n verticalCRS: geo(TiffTagGeo.VerticalGeoKey),\n verticalCitation: geo(TiffTagGeo.VerticalCitationGeoKey),\n verticalDatum: geo(TiffTagGeo.VerticalDatumGeoKey),\n verticalUnits: geo(TiffTagGeo.VerticalUnitsGeoKey),\n };\n}\n//# sourceMappingURL=ifd.js.map","import { RasterTypeKey } from \"@cogeotiff/core\";\nimport { apply, compose, invert, translation } from \"@developmentseed/affine\";\nexport function createTransform({ modelTiepoint, modelPixelScale, modelTransformation, rasterType, }) {\n let transform;\n if (modelTiepoint && modelPixelScale) {\n transform = createFromModelTiepointAndPixelScale(modelTiepoint, modelPixelScale);\n }\n else if (modelTransformation) {\n transform = createFromModelTransformation(modelTransformation);\n }\n else {\n throw new Error(\"The image does not have an affine transformation.\");\n }\n // Offset transform by half pixel for point-interpreted rasters.\n if (rasterType === RasterTypeKey.PixelIsPoint) {\n transform = compose(transform, translation(-0.5, -0.5));\n }\n return transform;\n}\nfunction createFromModelTiepointAndPixelScale(modelTiepoint, modelPixelScale) {\n const xOrigin = modelTiepoint[3];\n const yOrigin = modelTiepoint[4];\n const xResolution = modelPixelScale[0];\n const yResolution = -modelPixelScale[1];\n return [xResolution, 0, xOrigin, 0, yResolution, yOrigin];\n}\nfunction createFromModelTransformation(modelTransformation) {\n // ModelTransformation is a 4x4 matrix in row-major order\n // [0 1 2 3 ] [a b 0 c]\n // [4 5 6 7 ] = [d e 0 f]\n // [8 9 10 11] [0 0 1 0]\n // [12 13 14 15] [0 0 0 1]\n const xOrigin = modelTransformation[3];\n const yOrigin = modelTransformation[7];\n const rowRotation = modelTransformation[1];\n const colRotation = modelTransformation[4];\n const xResolution = modelTransformation[0];\n const yResolution = modelTransformation[5];\n return [xResolution, rowRotation, xOrigin, colRotation, yResolution, yOrigin];\n}\n/**\n * Get the (row, col) pixel index containing the geographic coordinate (x, y).\n *\n * @param x x coordinate in the CRS.\n * @param y y coordinate in the CRS.\n * @param op Rounding function applied to fractional pixel indices.\n * Defaults to Math.floor.\n * @returns [row, col] pixel indices.\n */\nexport function index(self, x, y, op = Math.floor) {\n const inv = invert(self.transform);\n const [col, row] = apply(inv, x, y);\n return [op(row), op(col)];\n}\n/**\n * Get the geographic (x, y) coordinate of the pixel at (row, col).\n *\n * @param row Pixel row.\n * @param col Pixel column.\n * @param offset Which part of the pixel to return. Defaults to \"center\".\n * @returns [x, y] in the CRS.\n */\nexport function xy(self, row, col, offset = \"center\") {\n let c;\n let r;\n switch (offset) {\n case \"center\":\n c = col + 0.5;\n r = row + 0.5;\n break;\n case \"ul\":\n c = col;\n r = row;\n break;\n case \"ur\":\n c = col + 1;\n r = row;\n break;\n case \"ll\":\n c = col;\n r = row + 1;\n break;\n case \"lr\":\n c = col + 1;\n r = row + 1;\n break;\n }\n return apply(self.transform, c, r);\n}\n//# sourceMappingURL=transform.js.map","import { compose, scale } from \"@developmentseed/affine\";\nimport { fetchTile, fetchTiles } from \"./fetch.js\";\nimport { index, xy } from \"./transform.js\";\n/**\n * A single resolution level of a GeoTIFF — either the full-resolution image\n * or a reduced-resolution overview. Pairs the data IFD with its\n * corresponding mask IFD (if any).\n */\nexport class Overview {\n cachedTags;\n /** The data source used for fetching tile data. */\n dataSource;\n /** A reference to the parent GeoTIFF object. */\n geotiff;\n /** The GeoKeyDirectory of the primary IFD. */\n gkd;\n /** The data IFD for this resolution level. */\n image;\n /** The IFD for the mask associated with this overview level, if any. */\n maskImage = null;\n constructor(geotiff, gkd, image, maskImage, cachedTags, dataSource) {\n this.geotiff = geotiff;\n this.gkd = gkd;\n this.image = image;\n this.maskImage = maskImage;\n this.cachedTags = cachedTags;\n this.dataSource = dataSource;\n }\n /**\n * The CRS parsed from the GeoKeyDirectory.\n *\n * Returns an EPSG code (number) for EPSG-coded CRSes, or a PROJJSON object\n * for user-defined CRSes. The result is cached after the first access.\n *\n * See also {@link GeoTIFF.epsg} for the EPSG code directly from the TIFF tags.\n */\n get crs() {\n return this.geotiff.crs;\n }\n /** Image height in pixels. */\n get height() {\n return this.image.size.height;\n }\n /** The no data value, or null if not set. */\n get nodata() {\n return this.geotiff.nodata;\n }\n /** The number of tiles in the x and y directions */\n get tileCount() {\n return this.image.tileCount;\n }\n /** Tile height in pixels. */\n get tileHeight() {\n return this.image.tileSize.height;\n }\n /** Tile width in pixels. */\n get tileWidth() {\n return this.image.tileSize.width;\n }\n /**\n * Return the dataset's georeferencing transformation matrix.\n */\n get transform() {\n const fullTransform = this.geotiff.transform;\n const scaleX = this.geotiff.width / this.width;\n const scaleY = this.geotiff.height / this.height;\n return compose(fullTransform, scale(scaleX, scaleY));\n }\n /** Image width in pixels. */\n get width() {\n return this.image.size.width;\n }\n /** Fetch a single tile from the full-resolution image.\n *\n * @param x The tile column index (0-based).\n * @param y The tile row index (0-based).\n * @param options Optional parameters for fetching the tile.\n * @param options.boundless Whether to clip tiles that are partially outside the image bounds. When `true`, no clipping is applied and edge tiles are returned at the full nominal tile size. Defaults to `true`.\n * @param options.pool An optional {@link DecoderPool} for decoding the tile data. If not provided, a new decoder will be created for each tile.\n * @param options.signal An optional {@link AbortSignal} to cancel the fetch request.\n */\n async fetchTile(x, y, options = {}) {\n return await fetchTile(this, x, y, options);\n }\n /**\n * Fetch multiple tiles in parallel.\n *\n * A future implementation may coalesce contiguous byte ranges to reduce\n * the number of HTTP requests.\n *\n * @param xy - Array of `[x, y]` tile coordinates.\n * @param options - Optional parameters (same as {@link fetchTile}).\n * @returns Array of {@link Tile} objects in the same order as `xy`.\n *\n * @see {@link fetchTile} for single-tile fetching.\n */\n async fetchTiles(xy, options = {}) {\n return await fetchTiles(this, xy, options);\n }\n // TiledMixin\n // Transform mixin\n /**\n * Get the (row, col) pixel index containing the geographic coordinate (x, y).\n *\n * @param x x coordinate in the CRS.\n * @param y y coordinate in the CRS.\n * @param op Rounding function applied to fractional pixel indices.\n * Defaults to Math.floor.\n * @returns [row, col] pixel indices.\n */\n index(x, y, op = Math.floor) {\n return index(this, x, y, op);\n }\n /**\n * Get the geographic (x, y) coordinate of the pixel at (row, col).\n *\n * @param row Pixel row.\n * @param col Pixel column.\n * @param offset Which part of the pixel to return. Defaults to \"center\".\n * @returns [x, y] in the CRS.\n */\n xy(row, col, offset = \"center\") {\n return xy(this, row, col, offset);\n }\n}\n//# sourceMappingURL=overview.js.map","import { SourceCache, SourceChunk } from \"@chunkd/middleware\";\nimport { SourceView } from \"@chunkd/source\";\nimport { SourceHttp } from \"@chunkd/source-http\";\nimport { SourceMemory } from \"@chunkd/source-memory\";\nimport { Photometric, SubFileType, Tiff, TiffTag } from \"@cogeotiff/core\";\nimport { crsFromGeoKeys } from \"./crs.js\";\nimport { fetchTile, fetchTiles } from \"./fetch.js\";\nimport { parseGDALMetadata } from \"./gdal-metadata.js\";\nimport { extractGeoKeyDirectory, prefetchTags } from \"./ifd.js\";\nimport { Overview } from \"./overview.js\";\nimport { createTransform, index, xy } from \"./transform.js\";\n/**\n * A high-level GeoTIFF abstraction built on\n * {@link https://github.com/blacha/cogeotiff | @cogeotiff/core}'s `Tiff` and\n * `TiffImage` classes.\n *\n * This class separates data IFDs from mask IFDs, pairs them by resolution\n * level, and exposes sorted overviews. Intentionally mirrors the Python\n * {@link https://github.com/developmentseed/async-geotiff | async-geotiff} API\n * as closely as possible.\n *\n * Construct via {@link GeoTIFF.fromUrl}, {@link GeoTIFF.fromArrayBuffer},\n * {@link GeoTIFF.open} or {@link GeoTIFF.fromTiff}.\n *\n * @see {@link Overview} for reduced-resolution overview images.\n */\nexport class GeoTIFF {\n /**\n * Reduced-resolution overview levels, sorted finest-to-coarsest.\n *\n * Does not include the full-resolution image — use {@link fetchTile} on the\n * GeoTIFF instance itself for that.\n */\n overviews;\n /** A cached CRS value. */\n _crs;\n /** Cached TIFF tags that are pre-fetched when opening the GeoTIFF. */\n cachedTags;\n /** The data source used for fetching tile data.\n *\n * This is typically the raw source (e.g. HTTP or memory) rather than a\n * layered source with caching and chunking, to avoid unnecessary copying of\n * tile data through cache layers.\n */\n dataSource;\n /** The underlying Tiff instance. */\n tiff;\n /** The primary (full-resolution) TiffImage. */\n image;\n /** The mask IFD of the full-resolution GeoTIFF, if any. */\n maskImage;\n /** The GeoKeyDirectory of the primary IFD. */\n gkd;\n /** Parsed GDALMetadata tag, if present. */\n gdalMetadata;\n constructor(tiff, image, maskImage, gkd, overviews, cachedTags, dataSource, gdalMetadata) {\n this.tiff = tiff;\n this.image = image;\n this.maskImage = maskImage;\n this.gkd = gkd;\n this.overviews = overviews;\n this.cachedTags = cachedTags;\n this.dataSource = dataSource;\n this.gdalMetadata = gdalMetadata;\n }\n /**\n * Open a GeoTIFF from a @cogeotiff/core Source.\n *\n * This creates and initialises the underlying Tiff, then classifies IFDs.\n *\n * @param options.dataSource A source for fetching tile data. This is separate from the source used to construct the TIFF to allow for separate caching implementations.\n * @param options.headerSource The source used to construct the TIFF. This is typically a layered source with caching and chunking, to optimise access to TIFF tags and IFDs.\n * @param options.prefetch Number of bytes to prefetch when reading TIFF tags and IFDs. Defaults to 32KB, which is enough for most tags and small IFDs. Increase if you have many tags or large IFDs.\n */\n static async open(options) {\n const { dataSource, headerSource, prefetch = 32 * 1024 } = options;\n const tiff = await Tiff.create(headerSource, {\n defaultReadSize: prefetch,\n });\n return GeoTIFF.fromTiff(tiff, dataSource);\n }\n /**\n * Create a GeoTIFF from an already-initialised Tiff instance.\n *\n * All IFDs are walked; mask IFDs are matched to data IFDs by matching\n * (width, height). Overviews are sorted from finest to coarsest resolution.\n *\n * @param dataSource A source for fetching tile data. This is separate from the source used to construct the TIFF to allow for separate caching implementations.\n */\n static async fromTiff(tiff, dataSource) {\n const images = tiff.images;\n if (images.length === 0) {\n throw new Error(\"TIFF does not contain any IFDs\");\n }\n // Force loading of important tags in sub-images\n // https://github.com/blacha/cogeotiff/blob/4781a6375adf419da9f0319d15c8a67284dfb0c4/packages/core/src/tiff.image.ts#L72-L88\n await Promise.all(images.map((image) => image.init(true)));\n const primaryImage = images[0];\n const gkd = extractGeoKeyDirectory(primaryImage);\n // Classify IFDs (skipping index 0) into data and mask buckets\n // keyed by \"width,height\".\n const dataIFDs = new Map();\n const maskIFDs = new Map();\n for (let i = 1; i < images.length; i++) {\n const image = images[i];\n const size = image.size;\n const key = `${size.width},${size.height}`;\n if (isMaskIfd(image)) {\n maskIFDs.set(key, image);\n }\n else {\n dataIFDs.set(key, image);\n }\n }\n // Find the primary mask, if any.\n const primaryKey = `${primaryImage.size.width},${primaryImage.size.height}`;\n const primaryMask = maskIFDs.get(primaryKey) ?? null;\n // Build reduced-resolution Overview instances, sorted by pixel count\n // descending (finest first).\n const dataEntries = Array.from(dataIFDs.entries());\n dataEntries.sort((a, b) => {\n const sa = a[1].size;\n const sb = b[1].size;\n return sb.width * sb.height - sa.width * sa.height;\n });\n const cachedTags = await prefetchTags(primaryImage);\n const gdalMetadata = parseGDALMetadata(cachedTags.gdalMetadata, {\n count: cachedTags.samplesPerPixel,\n });\n // Two-phase construction: create the GeoTIFF first (with empty overviews),\n // then build Overviews that reference back to it.\n const geotiff = new GeoTIFF(tiff, primaryImage, primaryMask, gkd, [], cachedTags, dataSource, gdalMetadata);\n const overviews = dataEntries.map(([key, dataImage]) => {\n const maskImage = maskIFDs.get(key) ?? null;\n return new Overview(geotiff, gkd, dataImage, maskImage, cachedTags, dataSource);\n });\n // Mutate the readonly field — safe here because we're still in the factory.\n geotiff.overviews = overviews;\n return geotiff;\n }\n /**\n * Create a GeoTIFF from an ArrayBuffer containing the entire file.\n *\n * This is a convenience method that wraps the ArrayBuffer in a memory source\n * and calls {@link GeoTIFF.open}. For large files, consider using\n * {@link GeoTIFF.fromUrl} or {@link GeoTIFF.open} with a chunked HTTP source\n * to avoid loading the entire file into memory at once.\n *\n * @param input The ArrayBuffer containing the GeoTIFF file data.\n * @returns A Promise that resolves to a GeoTIFF instance.\n */\n static async fromArrayBuffer(input) {\n const source = new SourceMemory(\"memory://input.tif\", input);\n return await GeoTIFF.open({\n dataSource: source,\n headerSource: source,\n });\n }\n /**\n * Create a new GeoTIFF from a URL.\n *\n * @param url The URL of the GeoTIFF to open.\n * @param options Optional parameters for chunk size and cache size.\n * @param options.chunkSize The minimum size for each request made to the source while reading header metadata. Defaults to 32KB.\n * @param options.cacheSize The size of the cache for recently accessed header chunks. Currently no caching is applied to data fetches. Defaults to 1MB.\n * @returns A Promise that resolves to a GeoTIFF instance.\n */\n static async fromUrl(url, { chunkSize = 32 * 1024, cacheSize = 1024 * 1024, } = {}) {\n const source = new SourceHttp(url, {});\n // Figure out optimal defaults in light of\n // https://github.com/blacha/cogeotiff/issues/1431\n // Defaulting to 32KB chunks is too small for tile data.\n // https://github.com/developmentseed/deck.gl-raster/issues/294\n // read files in chunks\n const chunk = new SourceChunk({ size: chunkSize });\n // 10MB cache for recently accessed chunks\n const cache = new SourceCache({ size: cacheSize });\n const view = new SourceView(source, [chunk, cache]);\n return await GeoTIFF.open({\n // Use raw source for tile data to avoid unnecessary copying through the\n // cache and chunk layers.\n dataSource: source,\n headerSource: view,\n });\n }\n // ── Properties from the primary image ─────────────────────────────────\n /**\n * The CRS parsed from the GeoKeyDirectory.\n *\n * Returns an EPSG code (number) for EPSG-coded CRSes, or a PROJJSON object\n * for user-defined CRSes. The result is cached after the first access.\n *\n * See also {@link GeoTIFF.epsg} for the EPSG code directly from the TIFF tags.\n */\n get crs() {\n if (this._crs === undefined) {\n this._crs = crsFromGeoKeys(this.gkd);\n }\n return this._crs;\n }\n /** Image width in pixels. */\n get width() {\n return this.image.size.width;\n }\n /** Image height in pixels. */\n get height() {\n return this.image.size.height;\n }\n /** The number of tiles in the x and y directions */\n get tileCount() {\n return this.image.tileCount;\n }\n /** Tile width in pixels. */\n get tileWidth() {\n return this.image.tileSize.width;\n }\n /** Tile height in pixels. */\n get tileHeight() {\n return this.image.tileSize.height;\n }\n /** The no data value, or null if not set. */\n get nodata() {\n return this.image.noData;\n }\n /** Whether the primary image is tiled. */\n get isTiled() {\n return this.image.isTiled();\n }\n /**\n * The pre-existing statistics for each band, if available.\n *\n * Extracted from the GDALMetadata TIFF tag; never computed on demand.\n * Keys are **1-based** band indices to match GDAL's convention.\n *\n * Returns `null` if no statistics are stored in the file.\n */\n get storedStats() {\n const stats = this.gdalMetadata?.bandStatistics;\n return stats && stats.size > 0 ? stats : null;\n }\n /**\n * The offset for each band (0-indexed), defaulting to 0.\n *\n * Extracted from the GDALMetadata TIFF tag.\n */\n get offsets() {\n return this.gdalMetadata?.offsets ?? Array(this.count).fill(0);\n }\n /**\n * The scale for each band (0-indexed), defaulting to 1.\n *\n * Extracted from the GDALMetadata TIFF tag.\n */\n get scales() {\n return this.gdalMetadata?.scales ?? Array(this.count).fill(1);\n }\n /** Number of bands (samples per pixel). */\n get count() {\n return this.image.value(TiffTag.SamplesPerPixel) ?? 1;\n }\n /** Bounding box [minX, minY, maxX, maxY] in the CRS. */\n get bbox() {\n return this.image.bbox;\n }\n /**\n * Return the dataset's georeferencing transformation matrix.\n */\n get transform() {\n const { modelPixelScale, modelTiepoint, modelTransformation } = this.cachedTags;\n return createTransform({\n modelTiepoint,\n modelPixelScale,\n modelTransformation,\n rasterType: this.gkd.rasterType,\n });\n }\n // Mixins\n /** Fetch a single tile from the full-resolution image.\n *\n * @param x The tile column index (0-based).\n * @param y The tile row index (0-based).\n * @param options Optional parameters for fetching the tile.\n * @param options.boundless Whether to clip tiles that are partially outside the image bounds. When `true`, no clipping is applied and edge tiles are returned at the full nominal tile size. Defaults to `true`.\n * @param options.pool An optional {@link DecoderPool} for decoding the tile data. If not provided, a new decoder will be created for each tile.\n * @param options.signal An optional {@link AbortSignal} to cancel the fetch request.\n */\n async fetchTile(x, y, options = {}) {\n return await fetchTile(this, x, y, options);\n }\n /**\n * Fetch multiple tiles in parallel.\n *\n * A future implementation may coalesce contiguous byte ranges to reduce\n * the number of HTTP requests.\n *\n * @param xy - Array of `[x, y]` tile coordinates.\n * @param options - Optional parameters (same as {@link fetchTile}).\n * @returns Array of {@link Tile} objects in the same order as `xy`.\n *\n * @see {@link fetchTile} for single-tile fetching.\n */\n async fetchTiles(xy, options = {}) {\n return await fetchTiles(this, xy, options);\n }\n // Transform mixin\n /**\n * Get the (row, col) pixel index containing the geographic coordinate (x, y).\n *\n * @param x x coordinate in the CRS.\n * @param y y coordinate in the CRS.\n * @param op Rounding function applied to fractional pixel indices.\n * Defaults to Math.floor.\n * @returns [row, col] pixel indices.\n */\n index(x, y, op = Math.floor) {\n return index(this, x, y, op);\n }\n /**\n * Get the geographic (x, y) coordinate of the pixel at (row, col).\n *\n * @param row Pixel row.\n * @param col Pixel column.\n * @param offset Which part of the pixel to return. Defaults to \"center\".\n * @returns [x, y] in the CRS.\n */\n xy(row, col, offset = \"center\") {\n return xy(this, row, col, offset);\n }\n}\n/**\n * Determine whether a TiffImage is a mask IFD.\n *\n * A mask IFD has SubFileType with the Mask bit set (value 4) AND\n * PhotometricInterpretation === Mask (4).\n */\nexport function isMaskIfd(image) {\n const subFileType = image.value(TiffTag.SubFileType);\n const photometric = image.value(TiffTag.Photometric);\n return (subFileType !== null &&\n (subFileType & SubFileType.Mask) !== 0 &&\n photometric === Photometric.Mask);\n}\n//# sourceMappingURL=geotiff.js.map","/** Collect the transferable ArrayBuffers from a DecodedPixels. */\nexport function collectTransferables(pixels) {\n if (pixels.layout === \"pixel-interleaved\") {\n return [pixels.data.buffer];\n }\n return pixels.bands.map((b) => b.buffer);\n}\n/**\n * Wraps a Worker, tracking in-flight jobs and routing responses via jobId.\n */\nexport class WorkerWrapper {\n worker;\n jobIdCounter = 0;\n jobs = new Map();\n constructor(worker) {\n this.worker = worker;\n this.worker.addEventListener(\"message\", (e) => this.onMessage(e));\n }\n get jobCount() {\n return this.jobs.size;\n }\n onMessage(e) {\n const { jobId, error, pixels } = e.data;\n const job = this.jobs.get(jobId);\n this.jobs.delete(jobId);\n if (!job) {\n return;\n }\n if (error) {\n job.reject(new Error(error));\n }\n else {\n job.resolve(pixels);\n }\n }\n submitJob(request, transferables) {\n const jobId = this.jobIdCounter++;\n return new Promise((resolve, reject) => {\n this.jobs.set(jobId, { resolve, reject });\n this.worker.postMessage({ ...request, jobId }, { transfer: transferables });\n });\n }\n terminate() {\n this.worker.terminate();\n }\n}\n//# sourceMappingURL=wrapper.js.map","import { decode } from \"../decode.js\";\nimport { WorkerWrapper } from \"./wrapper.js\";\nconst defaultSize = typeof navigator !== \"undefined\" ? (navigator.hardwareConcurrency ?? 2) : 2;\n/**\n * Manages a pool of Web Workers for off-main-thread tile decoding.\n *\n * Use {@link defaultDecoderPool} to create a pool backed by the built-in,\n * default decompressors.\n *\n * When no `createWorker` factory is provided, decoding falls back to the main\n * thread. This lets the pool be constructed unconditionally and wired up with\n * a worker later (or never, for SSR / Node environments).\n */\nexport class DecoderPool {\n workerWrappers;\n constructor(options = {}) {\n const { size = defaultSize, createWorker } = options;\n this.workerWrappers = [];\n if (createWorker && size > 0) {\n for (let i = 0; i < size; i++) {\n this.workerWrappers.push(new WorkerWrapper(createWorker()));\n }\n }\n }\n /** True when workers are available for off-main-thread decoding. */\n get hasWorkers() {\n return this.workerWrappers.length > 0;\n }\n /**\n * Decode a compressed tile buffer.\n *\n * When workers are available, the compressed `bytes` buffer is transferred\n * zero-copy to the least-loaded worker. The returned `DecodedPixels` typed\n * array buffers are transferred back to the main thread.\n *\n * When no workers are available, decoding runs on the main thread via the\n * normal `decode()` path.\n */\n async decode(bytes, compression, metadata) {\n if (!this.hasWorkers) {\n return decode(bytes, compression, metadata);\n }\n const worker = this.leastLoaded();\n const request = {\n compression: compression,\n metadata,\n buffer: bytes,\n };\n const array = await worker.submitJob(request, [bytes]);\n return array;\n }\n /** Terminate all workers and release resources. */\n destroy() {\n for (const w of this.workerWrappers) {\n w.terminate();\n }\n this.workerWrappers.length = 0;\n }\n leastLoaded() {\n let best = this.workerWrappers[0];\n for (let i = 1; i < this.workerWrappers.length; i++) {\n if (this.workerWrappers[i].jobCount < best.jobCount) {\n best = this.workerWrappers[i];\n }\n }\n return best;\n }\n}\n/**\n * A default DecoderPool instance.\n *\n * It will be created on first call of `defaultDecoderPool`.\n */\nlet DEFAULT_POOL = null;\n/**\n * Create a default `DecoderPool` backed by the built-in worker.\n *\n * A cached decoder pool instance is returned on subsequent calls.\n *\n * You may want to create it lazily (rather than as a module-level singleton)\n * to keep the `new URL(…, import.meta.url)` out of the module's static\n * initialisation, so bundlers that build IIFE/UMD outputs don't try to inline\n * the worker at build time.\n *\n * @example\n * Create a default decoder pool:\n * ```\n * const pool = defaultDecoderPool();\n * ```\n */\nexport function defaultDecoderPool() {\n if (DEFAULT_POOL !== null) {\n return DEFAULT_POOL;\n }\n DEFAULT_POOL = new DecoderPool({\n createWorker: () => new Worker(new URL(\"./worker.js\", import.meta.url), { type: \"module\" }),\n });\n return DEFAULT_POOL;\n}\n//# sourceMappingURL=pool.js.map","export default function (defs) {\n defs('EPSG:4326', '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees');\n defs('EPSG:4269', '+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees');\n defs('EPSG:3857', '+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs');\n // UTM WGS84\n for (var i = 1; i <= 60; ++i) {\n defs('EPSG:' + (32600 + i), '+proj=utm +zone=' + i + ' +datum=WGS84 +units=m');\n defs('EPSG:' + (32700 + i), '+proj=utm +zone=' + i + ' +south +datum=WGS84 +units=m');\n }\n defs('EPSG:5041', '+title=WGS 84 / UPS North (E,N) +proj=stere +lat_0=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m');\n defs('EPSG:5042', '+title=WGS 84 / UPS South (E,N) +proj=stere +lat_0=-90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m');\n\n defs.WGS84 = defs['EPSG:4326'];\n defs['EPSG:3785'] = defs['EPSG:3857']; // maintain backward compat, official code is 3857\n defs.GOOGLE = defs['EPSG:3857'];\n defs['EPSG:900913'] = defs['EPSG:3857'];\n defs['EPSG:102113'] = defs['EPSG:3857'];\n}\n","export var PJD_3PARAM = 1;\nexport var PJD_7PARAM = 2;\nexport var PJD_GRIDSHIFT = 3;\nexport var PJD_WGS84 = 4; // WGS84 or equivalent\nexport var PJD_NODATUM = 5; // WGS84 or equivalent\nexport var SRS_WGS84_SEMIMAJOR = 6378137.0; // only used in grid shift transforms\nexport var SRS_WGS84_SEMIMINOR = 6356752.314; // only used in grid shift transforms\nexport var SRS_WGS84_ESQUARED = 0.0066943799901413165; // only used in grid shift transforms\nexport var SEC_TO_RAD = 4.84813681109535993589914102357e-6;\nexport var HALF_PI = Math.PI / 2;\n// ellipoid pj_set_ell.c\nexport var SIXTH = 0.1666666666666666667;\n/* 1/6 */\nexport var RA4 = 0.04722222222222222222;\n/* 17/360 */\nexport var RA6 = 0.02215608465608465608;\nexport var EPSLN = 1.0e-10;\n// you'd think you could use Number.EPSILON above but that makes\n// Mollweide get into an infinate loop.\n\nexport var D2R = 0.01745329251994329577;\nexport var R2D = 57.29577951308232088;\nexport var FORTPI = Math.PI / 4;\nexport var TWO_PI = Math.PI * 2;\n// SPI is slightly greater than Math.PI, so values that exceed the -180..180\n// degree range by a tiny amount don't get wrapped. This prevents points that\n// have drifted from their original location along the 180th meridian (due to\n// floating point error) from changing their sign.\nexport var SPI = 3.14159265359;\n","var primeMeridian = {};\n\nprimeMeridian.greenwich = 0.0; // \"0dE\",\nprimeMeridian.lisbon = -9.131906111111; // \"9d07'54.862\\\"W\",\nprimeMeridian.paris = 2.337229166667; // \"2d20'14.025\\\"E\",\nprimeMeridian.bogota = -74.080916666667; // \"74d04'51.3\\\"W\",\nprimeMeridian.madrid = -3.687938888889; // \"3d41'16.58\\\"W\",\nprimeMeridian.rome = 12.452333333333; // \"12d27'8.4\\\"E\",\nprimeMeridian.bern = 7.439583333333; // \"7d26'22.5\\\"E\",\nprimeMeridian.jakarta = 106.807719444444; // \"106d48'27.79\\\"E\",\nprimeMeridian.ferro = -17.666666666667; // \"17d40'W\",\nprimeMeridian.brussels = 4.367975; // \"4d22'4.71\\\"E\",\nprimeMeridian.stockholm = 18.058277777778; // \"18d3'29.8\\\"E\",\nprimeMeridian.athens = 23.7163375; // \"23d42'58.815\\\"E\",\nprimeMeridian.oslo = 10.722916666667; // \"10d43'22.5\\\"E\"\n\nexport default primeMeridian;\n","export default {\n mm: { to_meter: 0.001 },\n cm: { to_meter: 0.01 },\n ft: { to_meter: 0.3048 },\n 'us-ft': { to_meter: 1200 / 3937 },\n fath: { to_meter: 1.8288 },\n kmi: { to_meter: 1852 },\n 'us-ch': { to_meter: 20.1168402336805 },\n 'us-mi': { to_meter: 1609.34721869444 },\n km: { to_meter: 1000 },\n 'ind-ft': { to_meter: 0.30479841 },\n 'ind-yd': { to_meter: 0.91439523 },\n mi: { to_meter: 1609.344 },\n yd: { to_meter: 0.9144 },\n ch: { to_meter: 20.1168 },\n link: { to_meter: 0.201168 },\n dm: { to_meter: 0.1 },\n in: { to_meter: 0.0254 },\n 'ind-ch': { to_meter: 20.11669506 },\n 'us-in': { to_meter: 0.025400050800101 },\n 'us-yd': { to_meter: 0.914401828803658 }\n};\n","var ignoredChar = /[\\s_\\-\\/\\(\\)]/g;\nexport default function match(obj, key) {\n if (obj[key]) {\n return obj[key];\n }\n var keys = Object.keys(obj);\n var lkey = key.toLowerCase().replace(ignoredChar, '');\n var i = -1;\n var testkey, processedKey;\n while (++i < keys.length) {\n testkey = keys[i];\n processedKey = testkey.toLowerCase().replace(ignoredChar, '');\n if (processedKey === lkey) {\n return obj[testkey];\n }\n }\n}\n","import { D2R } from './constants/values';\nimport PrimeMeridian from './constants/PrimeMeridian';\nimport units from './constants/units';\nimport match from './match';\n\n/**\n * @param {string} defData\n * @returns {import('./defs').ProjectionDefinition}\n */\nexport default function (defData) {\n /** @type {import('./defs').ProjectionDefinition} */\n var self = {};\n var paramObj = defData.split('+').map(function (v) {\n return v.trim();\n }).filter(function (a) {\n return a;\n }).reduce(function (p, a) {\n /** @type {Array<?>} */\n var split = a.split('=');\n split.push(true);\n p[split[0].toLowerCase()] = split[1];\n return p;\n }, {});\n var paramName, paramVal, paramOutname;\n var params = {\n proj: 'projName',\n datum: 'datumCode',\n rf: function (v) {\n self.rf = parseFloat(v);\n },\n lat_0: function (v) {\n self.lat0 = v * D2R;\n },\n lat_1: function (v) {\n self.lat1 = v * D2R;\n },\n lat_2: function (v) {\n self.lat2 = v * D2R;\n },\n lat_ts: function (v) {\n self.lat_ts = v * D2R;\n },\n lon_0: function (v) {\n self.long0 = v * D2R;\n },\n lon_1: function (v) {\n self.long1 = v * D2R;\n },\n lon_2: function (v) {\n self.long2 = v * D2R;\n },\n alpha: function (v) {\n self.alpha = parseFloat(v) * D2R;\n },\n gamma: function (v) {\n self.rectified_grid_angle = parseFloat(v) * D2R;\n },\n lonc: function (v) {\n self.longc = v * D2R;\n },\n x_0: function (v) {\n self.x0 = parseFloat(v);\n },\n y_0: function (v) {\n self.y0 = parseFloat(v);\n },\n k_0: function (v) {\n self.k0 = parseFloat(v);\n },\n k: function (v) {\n self.k0 = parseFloat(v);\n },\n a: function (v) {\n self.a = parseFloat(v);\n },\n b: function (v) {\n self.b = parseFloat(v);\n },\n r: function (v) {\n self.a = self.b = parseFloat(v);\n },\n r_a: function () {\n self.R_A = true;\n },\n zone: function (v) {\n self.zone = parseInt(v, 10);\n },\n south: function () {\n self.utmSouth = true;\n },\n towgs84: function (v) {\n self.datum_params = v.split(',').map(function (a) {\n return parseFloat(a);\n });\n },\n to_meter: function (v) {\n self.to_meter = parseFloat(v);\n },\n units: function (v) {\n self.units = v;\n var unit = match(units, v);\n if (unit) {\n self.to_meter = unit.to_meter;\n }\n },\n from_greenwich: function (v) {\n self.from_greenwich = v * D2R;\n },\n pm: function (v) {\n var pm = match(PrimeMeridian, v);\n self.from_greenwich = (pm ? pm : parseFloat(v)) * D2R;\n },\n nadgrids: function (v) {\n if (v === '@null') {\n self.datumCode = 'none';\n } else {\n self.nadgrids = v;\n }\n },\n axis: function (v) {\n var legalAxis = 'ewnsud';\n if (v.length === 3 && legalAxis.indexOf(v.substr(0, 1)) !== -1 && legalAxis.indexOf(v.substr(1, 1)) !== -1 && legalAxis.indexOf(v.substr(2, 1)) !== -1) {\n self.axis = v;\n }\n },\n approx: function () {\n self.approx = true;\n },\n over: function () {\n self.over = true;\n }\n };\n for (paramName in paramObj) {\n paramVal = paramObj[paramName];\n if (paramName in params) {\n paramOutname = params[paramName];\n if (typeof paramOutname === 'function') {\n paramOutname(paramVal);\n } else {\n self[paramOutname] = paramVal;\n }\n } else {\n self[paramName] = paramVal;\n }\n }\n if (typeof self.datumCode === 'string' && self.datumCode !== 'WGS84') {\n self.datumCode = self.datumCode.toLowerCase();\n }\n self['projStr'] = defData;\n return self;\n}\n","import globals from './global';\nimport parseProj from './projString';\nimport wkt from 'wkt-parser';\n\n/**\n * @typedef {Object} ProjectionDefinition\n * @property {string} title\n * @property {string} [projName]\n * @property {string} [ellps]\n * @property {import('./Proj.js').DatumDefinition} [datum]\n * @property {string} [datumName]\n * @property {number} [rf]\n * @property {number} [lat0]\n * @property {number} [lat1]\n * @property {number} [lat2]\n * @property {number} [lat_ts]\n * @property {number} [long0]\n * @property {number} [long1]\n * @property {number} [long2]\n * @property {number} [alpha]\n * @property {number} [longc]\n * @property {number} [x0]\n * @property {number} [y0]\n * @property {number} [k0]\n * @property {number} [a]\n * @property {number} [b]\n * @property {true} [R_A]\n * @property {number} [zone]\n * @property {true} [utmSouth]\n * @property {string|Array<number>} [datum_params]\n * @property {number} [to_meter]\n * @property {string} [units]\n * @property {number} [from_greenwich]\n * @property {string} [datumCode]\n * @property {string} [nadgrids]\n * @property {string} [axis]\n * @property {boolean} [sphere]\n * @property {number} [rectified_grid_angle]\n * @property {boolean} [approx]\n * @property {boolean} [over]\n * @property {string} [projStr]\n * @property {<T extends import('./core').TemplateCoordinates>(coordinates: T, enforceAxis?: boolean) => T} inverse\n * @property {<T extends import('./core').TemplateCoordinates>(coordinates: T, enforceAxis?: boolean) => T} forward\n */\n\n/**\n * @overload\n * @param {string} name\n * @param {string|ProjectionDefinition|import('./core.js').PROJJSONDefinition} projection\n * @returns {void}\n */\n/**\n * @overload\n * @param {Array<[string, string]>} name\n * @returns {Array<ProjectionDefinition|undefined>}\n */\n/**\n * @overload\n * @param {string} name\n * @returns {ProjectionDefinition}\n */\n\n/**\n * @param {string | Array<Array<string>> | Partial<Record<'EPSG'|'ESRI'|'IAU2000', ProjectionDefinition>>} name\n * @returns {ProjectionDefinition | Array<ProjectionDefinition|undefined> | void}\n */\nfunction defs(name) {\n /* global console */\n var that = this;\n if (arguments.length === 2) {\n var def = arguments[1];\n if (typeof def === 'string') {\n if (def.charAt(0) === '+') {\n defs[/** @type {string} */ (name)] = parseProj(arguments[1]);\n } else {\n defs[/** @type {string} */ (name)] = wkt(arguments[1]);\n }\n } else if (def && typeof def === 'object' && !('projName' in def)) {\n // PROJJSON\n defs[/** @type {string} */ (name)] = wkt(arguments[1]);\n } else {\n defs[/** @type {string} */ (name)] = def;\n if (!def) {\n delete defs[/** @type {string} */ (name)];\n }\n }\n } else if (arguments.length === 1) {\n if (Array.isArray(name)) {\n return name.map(function (v) {\n if (Array.isArray(v)) {\n return defs.apply(that, v);\n } else {\n return defs(v);\n }\n });\n } else if (typeof name === 'string') {\n if (name in defs) {\n return defs[name];\n }\n } else if ('EPSG' in name) {\n defs['EPSG:' + name.EPSG] = name;\n } else if ('ESRI' in name) {\n defs['ESRI:' + name.ESRI] = name;\n } else if ('IAU2000' in name) {\n defs['IAU2000:' + name.IAU2000] = name;\n } else {\n console.log(name);\n }\n return;\n }\n}\nglobals(defs);\nexport default defs;\n","import defs from './defs';\nimport wkt from 'wkt-parser';\nimport projStr from './projString';\nimport match from './match';\nfunction testObj(code) {\n return typeof code === 'string';\n}\nfunction testDef(code) {\n return code in defs;\n}\nfunction testWKT(code) {\n return (code.indexOf('+') !== 0 && code.indexOf('[') !== -1) || (typeof code === 'object' && !('srsCode' in code));\n}\nvar codes = ['3857', '900913', '3785', '102113'];\nfunction checkMercator(item) {\n if (item.title) {\n return item.title.toLowerCase().indexOf('epsg:') === 0 && codes.indexOf(item.title.substr(5)) > -1;\n }\n var auth = match(item, 'authority');\n if (!auth) {\n return;\n }\n var code = match(auth, 'epsg');\n return code && codes.indexOf(code) > -1;\n}\nfunction checkProjStr(item) {\n var ext = match(item, 'extension');\n if (!ext) {\n return;\n }\n return match(ext, 'proj4');\n}\nfunction testProj(code) {\n return code[0] === '+';\n}\n/**\n * @param {string | import('./core').PROJJSONDefinition | import('./defs').ProjectionDefinition} code\n * @returns {import('./defs').ProjectionDefinition}\n */\nfunction parse(code) {\n let out;\n if (testObj(code)) {\n // check to see if this is a WKT string\n if (testDef(code)) {\n out = defs[code];\n } else if (testWKT(code)) {\n out = wkt(code);\n var maybeProjStr = checkProjStr(out);\n if (maybeProjStr) {\n out = projStr(maybeProjStr);\n }\n } else if (testProj(code)) {\n out = projStr(code);\n }\n } else if (!('projName' in code)) {\n out = wkt(code);\n } else {\n out = code;\n }\n // test for special Web Mercator case, due to this being a very common and often malformed\n return out && checkMercator(out) ? defs['EPSG:3857'] : out;\n}\n\nexport default parse;\n","export default function (destination, source) {\n destination = destination || {};\n var value, property;\n if (!source) {\n return destination;\n }\n for (property in source) {\n value = source[property];\n if (value !== undefined) {\n destination[property] = value;\n }\n }\n return destination;\n}\n","export default function (eccent, sinphi, cosphi) {\n var con = eccent * sinphi;\n return cosphi / (Math.sqrt(1 - con * con));\n}\n","export default function (x) {\n return x < 0 ? -1 : 1;\n}\n","import { TWO_PI, SPI } from '../constants/values';\nimport sign from './sign';\n\nexport default function (x, skipAdjust) {\n if (skipAdjust) {\n return x;\n }\n return (Math.abs(x) <= SPI) ? x : (x - (sign(x) * TWO_PI));\n}\n","import { HALF_PI } from '../constants/values';\n\nexport default function (eccent, phi, sinphi) {\n var con = eccent * sinphi;\n var com = 0.5 * eccent;\n con = Math.pow(((1 - con) / (1 + con)), com);\n return (Math.tan(0.5 * (HALF_PI - phi)) / con);\n}\n","import { HALF_PI } from '../constants/values';\n\nexport default function (eccent, ts) {\n var eccnth = 0.5 * eccent;\n var con, dphi;\n var phi = HALF_PI - 2 * Math.atan(ts);\n for (var i = 0; i <= 15; i++) {\n con = eccent * Math.sin(phi);\n dphi = HALF_PI - 2 * Math.atan(ts * (Math.pow(((1 - con) / (1 + con)), eccnth))) - phi;\n phi += dphi;\n if (Math.abs(dphi) <= 0.0000000001) {\n return phi;\n }\n }\n // console.log(\"phi2z has NoConvergence\");\n return -9999;\n}\n","import msfnz from '../common/msfnz';\n\nimport adjust_lon from '../common/adjust_lon';\nimport tsfnz from '../common/tsfnz';\nimport phi2z from '../common/phi2z';\nimport { FORTPI, R2D, EPSLN, HALF_PI } from '../constants/values';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} es\n * @property {number} e\n * @property {number} k\n */\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n var con = this.b / this.a;\n this.es = 1 - con * con;\n if (!('x0' in this)) {\n this.x0 = 0;\n }\n if (!('y0' in this)) {\n this.y0 = 0;\n }\n this.e = Math.sqrt(this.es);\n if (this.lat_ts) {\n if (this.sphere) {\n this.k0 = Math.cos(this.lat_ts);\n } else {\n this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));\n }\n } else {\n if (!this.k0) {\n if (this.k) {\n this.k0 = this.k;\n } else {\n this.k0 = 1;\n }\n }\n }\n}\n\n/* Mercator forward equations--mapping lat,long to x,y\n -------------------------------------------------- */\n\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n // convert to radians\n if (lat * R2D > 90 && lat * R2D < -90 && lon * R2D > 180 && lon * R2D < -180) {\n return null;\n }\n\n var x, y;\n if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {\n return null;\n } else {\n if (this.sphere) {\n x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0, this.over);\n y = this.y0 + this.a * this.k0 * Math.log(Math.tan(FORTPI + 0.5 * lat));\n } else {\n var sinphi = Math.sin(lat);\n var ts = tsfnz(this.e, lat, sinphi);\n x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0, this.over);\n y = this.y0 - this.a * this.k0 * Math.log(ts);\n }\n p.x = x;\n p.y = y;\n return p;\n }\n}\n\n/* Mercator inverse equations--mapping x,y to lat/long\n -------------------------------------------------- */\nexport function inverse(p) {\n var x = p.x - this.x0;\n var y = p.y - this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lat = HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));\n } else {\n var ts = Math.exp(-y / (this.a * this.k0));\n lat = phi2z(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n }\n lon = adjust_lon(this.long0 + x / (this.a * this.k0), this.over);\n\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = ['Mercator', 'Popular Visualisation Pseudo Mercator', 'Mercator_1SP', 'Mercator_Auxiliary_Sphere', 'Mercator_Variant_A', 'merc'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","export function init() {\n // no-op for longlat\n}\n\nfunction identity(pt) {\n return pt;\n}\nexport { identity as forward };\nexport { identity as inverse };\nexport var names = ['longlat', 'identity'];\nexport default {\n init: init,\n forward: identity,\n inverse: identity,\n names: names\n};\n","import merc from './projections/merc';\nimport longlat from './projections/longlat';\n/** @type {Array<Partial<import('./Proj').default>>} */\nvar projs = [merc, longlat];\nvar names = {};\nvar projStore = [];\n\n/**\n * @param {import('./Proj').default} proj\n * @param {number} i\n */\nexport function add(proj, i) {\n var len = projStore.length;\n if (!proj.names) {\n console.log(i);\n return true;\n }\n projStore[len] = proj;\n proj.names.forEach(function (n) {\n names[n.toLowerCase()] = len;\n });\n return this;\n}\n\nexport function getNormalizedProjName(n) {\n return n.replace(/[-\\(\\)\\s]+/g, ' ').trim().replace(/ /g, '_');\n}\n\n/**\n * Get a projection by name.\n * @param {string} name\n * @returns {import('./Proj').default|false}\n */\nexport function get(name) {\n if (!name) {\n return false;\n }\n var n = name.toLowerCase();\n if (typeof names[n] !== 'undefined' && projStore[names[n]]) {\n return projStore[names[n]];\n }\n n = getNormalizedProjName(n);\n if (n in names && projStore[names[n]]) {\n return projStore[names[n]];\n }\n}\n\nexport function start() {\n projs.forEach(add);\n}\nexport default {\n start: start,\n add: add,\n get: get\n};\n","var ellipsoids = {\n MERIT: {\n a: 6378137,\n rf: 298.257,\n ellipseName: 'MERIT 1983'\n },\n SGS85: {\n a: 6378136,\n rf: 298.257,\n ellipseName: 'Soviet Geodetic System 85'\n },\n GRS80: {\n a: 6378137,\n rf: 298.257222101,\n ellipseName: 'GRS 1980(IUGG, 1980)'\n },\n IAU76: {\n a: 6378140,\n rf: 298.257,\n ellipseName: 'IAU 1976'\n },\n airy: {\n a: 6377563.396,\n b: 6356256.91,\n ellipseName: 'Airy 1830'\n },\n APL4: {\n a: 6378137,\n rf: 298.25,\n ellipseName: 'Appl. Physics. 1965'\n },\n NWL9D: {\n a: 6378145,\n rf: 298.25,\n ellipseName: 'Naval Weapons Lab., 1965'\n },\n mod_airy: {\n a: 6377340.189,\n b: 6356034.446,\n ellipseName: 'Modified Airy'\n },\n andrae: {\n a: 6377104.43,\n rf: 300,\n ellipseName: 'Andrae 1876 (Den., Iclnd.)'\n },\n aust_SA: {\n a: 6378160,\n rf: 298.25,\n ellipseName: 'Australian Natl & S. Amer. 1969'\n },\n GRS67: {\n a: 6378160,\n rf: 298.247167427,\n ellipseName: 'GRS 67(IUGG 1967)'\n },\n bessel: {\n a: 6377397.155,\n rf: 299.1528128,\n ellipseName: 'Bessel 1841'\n },\n bess_nam: {\n a: 6377483.865,\n rf: 299.1528128,\n ellipseName: 'Bessel 1841 (Namibia)'\n },\n clrk66: {\n a: 6378206.4,\n b: 6356583.8,\n ellipseName: 'Clarke 1866'\n },\n clrk80: {\n a: 6378249.145,\n rf: 293.4663,\n ellipseName: 'Clarke 1880 mod.'\n },\n clrk80ign: {\n a: 6378249.2,\n b: 6356515,\n rf: 293.4660213,\n ellipseName: 'Clarke 1880 (IGN)'\n },\n clrk58: {\n a: 6378293.645208759,\n rf: 294.2606763692654,\n ellipseName: 'Clarke 1858'\n },\n CPM: {\n a: 6375738.7,\n rf: 334.29,\n ellipseName: 'Comm. des Poids et Mesures 1799'\n },\n delmbr: {\n a: 6376428,\n rf: 311.5,\n ellipseName: 'Delambre 1810 (Belgium)'\n },\n engelis: {\n a: 6378136.05,\n rf: 298.2566,\n ellipseName: 'Engelis 1985'\n },\n evrst30: {\n a: 6377276.345,\n rf: 300.8017,\n ellipseName: 'Everest 1830'\n },\n evrst48: {\n a: 6377304.063,\n rf: 300.8017,\n ellipseName: 'Everest 1948'\n },\n evrst56: {\n a: 6377301.243,\n rf: 300.8017,\n ellipseName: 'Everest 1956'\n },\n evrst69: {\n a: 6377295.664,\n rf: 300.8017,\n ellipseName: 'Everest 1969'\n },\n evrstSS: {\n a: 6377298.556,\n rf: 300.8017,\n ellipseName: 'Everest (Sabah & Sarawak)'\n },\n fschr60: {\n a: 6378166,\n rf: 298.3,\n ellipseName: 'Fischer (Mercury Datum) 1960'\n },\n fschr60m: {\n a: 6378155,\n rf: 298.3,\n ellipseName: 'Fischer 1960'\n },\n fschr68: {\n a: 6378150,\n rf: 298.3,\n ellipseName: 'Fischer 1968'\n },\n helmert: {\n a: 6378200,\n rf: 298.3,\n ellipseName: 'Helmert 1906'\n },\n hough: {\n a: 6378270,\n rf: 297,\n ellipseName: 'Hough'\n },\n intl: {\n a: 6378388,\n rf: 297,\n ellipseName: 'International 1909 (Hayford)'\n },\n kaula: {\n a: 6378163,\n rf: 298.24,\n ellipseName: 'Kaula 1961'\n },\n lerch: {\n a: 6378139,\n rf: 298.257,\n ellipseName: 'Lerch 1979'\n },\n mprts: {\n a: 6397300,\n rf: 191,\n ellipseName: 'Maupertius 1738'\n },\n new_intl: {\n a: 6378157.5,\n b: 6356772.2,\n ellipseName: 'New International 1967'\n },\n plessis: {\n a: 6376523,\n rf: 6355863,\n ellipseName: 'Plessis 1817 (France)'\n },\n krass: {\n a: 6378245,\n rf: 298.3,\n ellipseName: 'Krassovsky, 1942'\n },\n SEasia: {\n a: 6378155,\n b: 6356773.3205,\n ellipseName: 'Southeast Asia'\n },\n walbeck: {\n a: 6376896,\n b: 6355834.8467,\n ellipseName: 'Walbeck'\n },\n WGS60: {\n a: 6378165,\n rf: 298.3,\n ellipseName: 'WGS 60'\n },\n WGS66: {\n a: 6378145,\n rf: 298.25,\n ellipseName: 'WGS 66'\n },\n WGS7: {\n a: 6378135,\n rf: 298.26,\n ellipseName: 'WGS 72'\n },\n WGS84: {\n a: 6378137,\n rf: 298.257223563,\n ellipseName: 'WGS 84'\n },\n sphere: {\n a: 6370997,\n b: 6370997,\n ellipseName: 'Normal Sphere (r=6370997)'\n }\n};\n\nexport default ellipsoids;\n","import { SIXTH, RA4, RA6, EPSLN } from './constants/values';\nimport { default as Ellipsoid } from './constants/Ellipsoid';\nimport match from './match';\n\nconst WGS84 = Ellipsoid.WGS84; // default ellipsoid\n\nexport function eccentricity(a, b, rf, R_A) {\n var a2 = a * a; // used in geocentric\n var b2 = b * b; // used in geocentric\n var es = (a2 - b2) / a2; // e ^ 2\n var e = 0;\n if (R_A) {\n a *= 1 - es * (SIXTH + es * (RA4 + es * RA6));\n a2 = a * a;\n es = 0;\n } else {\n e = Math.sqrt(es); // eccentricity\n }\n var ep2 = (a2 - b2) / b2; // used in geocentric\n return {\n es: es,\n e: e,\n ep2: ep2\n };\n}\nexport function sphere(a, b, rf, ellps, sphere) {\n if (!a) { // do we have an ellipsoid?\n var ellipse = match(Ellipsoid, ellps);\n if (!ellipse) {\n ellipse = WGS84;\n }\n a = ellipse.a;\n b = ellipse.b;\n rf = ellipse.rf;\n }\n\n if (rf && !b) {\n b = (1.0 - 1.0 / rf) * a;\n }\n if (rf === 0 || Math.abs(a - b) < EPSLN) {\n sphere = true;\n b = a;\n }\n return {\n a: a,\n b: b,\n rf: rf,\n sphere: sphere\n };\n}\n","var datums = {\n wgs84: {\n towgs84: '0,0,0',\n ellipse: 'WGS84',\n datumName: 'WGS84'\n },\n ch1903: {\n towgs84: '674.374,15.056,405.346',\n ellipse: 'bessel',\n datumName: 'swiss'\n },\n ggrs87: {\n towgs84: '-199.87,74.79,246.62',\n ellipse: 'GRS80',\n datumName: 'Greek_Geodetic_Reference_System_1987'\n },\n nad83: {\n towgs84: '0,0,0',\n ellipse: 'GRS80',\n datumName: 'North_American_Datum_1983'\n },\n nad27: {\n nadgrids: '@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat',\n ellipse: 'clrk66',\n datumName: 'North_American_Datum_1927'\n },\n potsdam: {\n towgs84: '598.1,73.7,418.2,0.202,0.045,-2.455,6.7',\n ellipse: 'bessel',\n datumName: 'Potsdam Rauenberg 1950 DHDN'\n },\n carthage: {\n towgs84: '-263.0,6.0,431.0',\n ellipse: 'clark80',\n datumName: 'Carthage 1934 Tunisia'\n },\n hermannskogel: {\n towgs84: '577.326,90.129,463.919,5.137,1.474,5.297,2.4232',\n ellipse: 'bessel',\n datumName: 'Hermannskogel'\n },\n mgi: {\n towgs84: '577.326,90.129,463.919,5.137,1.474,5.297,2.4232',\n ellipse: 'bessel',\n datumName: 'Militar-Geographische Institut'\n },\n osni52: {\n towgs84: '482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15',\n ellipse: 'airy',\n datumName: 'Irish National'\n },\n ire65: {\n towgs84: '482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15',\n ellipse: 'mod_airy',\n datumName: 'Ireland 1965'\n },\n rassadiran: {\n towgs84: '-133.63,-157.5,-158.62',\n ellipse: 'intl',\n datumName: 'Rassadiran'\n },\n nzgd49: {\n towgs84: '59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993',\n ellipse: 'intl',\n datumName: 'New Zealand Geodetic Datum 1949'\n },\n osgb36: {\n towgs84: '446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894',\n ellipse: 'airy',\n datumName: 'Ordnance Survey of Great Britain 1936'\n },\n s_jtsk: {\n towgs84: '589,76,480',\n ellipse: 'bessel',\n datumName: 'S-JTSK (Ferro)'\n },\n beduaram: {\n towgs84: '-106,-87,188',\n ellipse: 'clrk80',\n datumName: 'Beduaram'\n },\n gunung_segara: {\n towgs84: '-403,684,41',\n ellipse: 'bessel',\n datumName: 'Gunung Segara Jakarta'\n },\n rnb72: {\n towgs84: '106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1',\n ellipse: 'intl',\n datumName: 'Reseau National Belge 1972'\n },\n EPSG_5451: {\n towgs84: '6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649'\n },\n IGNF_LURESG: {\n towgs84: '-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43'\n },\n EPSG_4614: {\n towgs84: '-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065'\n },\n EPSG_4615: {\n towgs84: '-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748'\n },\n ESRI_37241: {\n towgs84: '-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031'\n },\n ESRI_37249: {\n towgs84: '-440.296,58.548,296.265,1.128,10.202,4.559,-0.438'\n },\n ESRI_37245: {\n towgs84: '-511.151,-181.269,139.609,1.05,2.703,1.798,3.071'\n },\n EPSG_4178: {\n towgs84: '24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01'\n },\n EPSG_4622: {\n towgs84: '-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984'\n },\n EPSG_4625: {\n towgs84: '126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227'\n },\n EPSG_5252: {\n towgs84: '0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439'\n },\n EPSG_4314: {\n towgs84: '597.1,71.4,412.1,0.894,0.068,-1.563,7.58'\n },\n EPSG_4282: {\n towgs84: '-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166'\n },\n EPSG_4231: {\n towgs84: '-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218'\n },\n EPSG_4274: {\n towgs84: '-230.994,102.591,25.199,0.633,-0.239,0.9,1.95'\n },\n EPSG_4134: {\n towgs84: '-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006'\n },\n EPSG_4254: {\n towgs84: '18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013'\n },\n EPSG_4159: {\n towgs84: '-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175'\n },\n EPSG_4687: {\n towgs84: '0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093'\n },\n EPSG_4227: {\n towgs84: '-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225'\n },\n EPSG_4746: {\n towgs84: '599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46'\n },\n EPSG_4745: {\n towgs84: '612.4,77,440.2,-0.054,0.057,-2.797,2.55'\n },\n EPSG_6311: {\n towgs84: '8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926'\n },\n EPSG_4289: {\n towgs84: '565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244'\n },\n EPSG_4230: {\n towgs84: '-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4'\n },\n EPSG_4154: {\n towgs84: '-123.02,-158.95,-168.47'\n },\n EPSG_4156: {\n towgs84: '570.8,85.7,462.8,4.998,1.587,5.261,3.56'\n },\n EPSG_4299: {\n towgs84: '482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15'\n },\n EPSG_4179: {\n towgs84: '33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84'\n },\n EPSG_4313: {\n towgs84: '-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747'\n },\n EPSG_4194: {\n towgs84: '163.511,127.533,-159.789'\n },\n EPSG_4195: {\n towgs84: '105,326,-102.5'\n },\n EPSG_4196: {\n towgs84: '-45,417,-3.5'\n },\n EPSG_4611: {\n towgs84: '-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246'\n },\n EPSG_4633: {\n towgs84: '137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824'\n },\n EPSG_4641: {\n towgs84: '-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993'\n },\n EPSG_4643: {\n towgs84: '-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002'\n },\n EPSG_4300: {\n towgs84: '482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15'\n },\n EPSG_4188: {\n towgs84: '482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15'\n },\n EPSG_4660: {\n towgs84: '982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805'\n },\n EPSG_4662: {\n towgs84: '97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259'\n },\n EPSG_3906: {\n towgs84: '577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664'\n },\n EPSG_4307: {\n towgs84: '-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547'\n },\n EPSG_6892: {\n towgs84: '-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686'\n },\n EPSG_4690: {\n towgs84: '221.597,152.441,176.523,2.403,1.3893,0.884,11.4648'\n },\n EPSG_4691: {\n towgs84: '218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817'\n },\n EPSG_4629: {\n towgs84: '72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653'\n },\n EPSG_4630: {\n towgs84: '165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111'\n },\n EPSG_4692: {\n towgs84: '217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093'\n },\n EPSG_9333: {\n towgs84: '0,0,0,-0.008393,0.000749,-0.010276,0'\n },\n EPSG_9059: {\n towgs84: '0,0,0'\n },\n EPSG_4312: {\n towgs84: '601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887'\n },\n EPSG_4123: {\n towgs84: '-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496'\n },\n EPSG_4309: {\n towgs84: '-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365'\n },\n ESRI_104106: {\n towgs84: '-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058'\n },\n EPSG_4281: {\n towgs84: '-219.247,-73.802,269.529'\n },\n EPSG_4322: {\n towgs84: '0,0,4.5'\n },\n EPSG_4324: {\n towgs84: '0,0,1.9'\n },\n EPSG_4284: {\n towgs84: '43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549'\n },\n EPSG_4277: {\n towgs84: '446.448,-125.157,542.06,0.15,0.247,0.842,-20.489'\n },\n EPSG_4207: {\n towgs84: '-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46'\n },\n EPSG_4688: {\n towgs84: '347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647'\n },\n EPSG_4689: {\n towgs84: '410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218'\n },\n EPSG_4720: {\n towgs84: '0,0,4.5'\n },\n EPSG_4273: {\n towgs84: '278.3,93,474.5,7.889,0.05,-6.61,6.21'\n },\n EPSG_4240: {\n towgs84: '204.64,834.74,293.8'\n },\n EPSG_4817: {\n towgs84: '278.3,93,474.5,7.889,0.05,-6.61,6.21'\n },\n ESRI_104131: {\n towgs84: '426.62,142.62,460.09,4.98,4.49,-12.42,-17.1'\n },\n EPSG_4265: {\n towgs84: '-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68'\n },\n EPSG_4263: {\n towgs84: '-111.92,-87.85,114.5,1.875,0.202,0.219,0.032'\n },\n EPSG_4298: {\n towgs84: '-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536'\n },\n EPSG_4270: {\n towgs84: '-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424'\n },\n EPSG_4229: {\n towgs84: '-121.8,98.1,-10.7'\n },\n EPSG_4220: {\n towgs84: '-55.5,-348,-229.2'\n },\n EPSG_4214: {\n towgs84: '12.646,-155.176,-80.863'\n },\n EPSG_4232: {\n towgs84: '-345,3,223'\n },\n EPSG_4238: {\n towgs84: '-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037'\n },\n EPSG_4168: {\n towgs84: '-170,33,326'\n },\n EPSG_4131: {\n towgs84: '199,931,318.9'\n },\n EPSG_4152: {\n towgs84: '-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0'\n },\n EPSG_5228: {\n towgs84: '572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378'\n },\n EPSG_8351: {\n towgs84: '485.021,169.465,483.839,7.786342,4.397554,4.102655,0'\n },\n EPSG_4683: {\n towgs84: '-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06'\n },\n EPSG_4133: {\n towgs84: '0,0,0'\n },\n EPSG_7373: {\n towgs84: '0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693'\n },\n EPSG_9075: {\n towgs84: '-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0'\n },\n EPSG_9072: {\n towgs84: '-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0'\n },\n EPSG_9294: {\n towgs84: '1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388'\n },\n EPSG_4212: {\n towgs84: '-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492'\n },\n EPSG_4191: {\n towgs84: '-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703'\n },\n EPSG_4237: {\n towgs84: '52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191'\n },\n EPSG_4740: {\n towgs84: '-1.08,-0.27,-0.9'\n },\n EPSG_4124: {\n towgs84: '419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496'\n },\n EPSG_5681: {\n towgs84: '584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922'\n },\n EPSG_4141: {\n towgs84: '23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262'\n },\n EPSG_4204: {\n towgs84: '-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194'\n },\n EPSG_4319: {\n towgs84: '226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798'\n },\n EPSG_4200: {\n towgs84: '24.82,-131.21,-82.66'\n },\n EPSG_4130: {\n towgs84: '0,0,0'\n },\n EPSG_4127: {\n towgs84: '-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359'\n },\n EPSG_4149: {\n towgs84: '674.374,15.056,405.346'\n },\n EPSG_4617: {\n towgs84: '-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0'\n },\n EPSG_4663: {\n towgs84: '-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485'\n },\n EPSG_4664: {\n towgs84: '-211.939,137.626,58.3,-0.089,0.251,0.079,0.384'\n },\n EPSG_4665: {\n towgs84: '-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048'\n },\n EPSG_4666: {\n towgs84: '631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43'\n },\n EPSG_4756: {\n towgs84: '-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188'\n },\n EPSG_4723: {\n towgs84: '-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925'\n },\n EPSG_4726: {\n towgs84: '8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081'\n },\n EPSG_4267: {\n towgs84: '-8.0,160.0,176.0'\n },\n EPSG_5365: {\n towgs84: '-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693'\n },\n EPSG_4218: {\n towgs84: '304.5,306.5,-318.1'\n },\n EPSG_4242: {\n towgs84: '-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95'\n },\n EPSG_4216: {\n towgs84: '-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289'\n },\n ESRI_104105: {\n towgs84: '631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43'\n },\n ESRI_104129: {\n towgs84: '0,0,0'\n },\n EPSG_4673: {\n towgs84: '174.05,-25.49,112.57'\n },\n EPSG_4202: {\n towgs84: '-124,-60,154'\n },\n EPSG_4203: {\n towgs84: '-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191'\n },\n EPSG_3819: {\n towgs84: '595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408'\n },\n EPSG_8694: {\n towgs84: '-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169'\n },\n EPSG_4145: {\n towgs84: '275.57,676.78,229.6'\n },\n EPSG_4283: {\n towgs84: '0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994'\n },\n EPSG_4317: {\n towgs84: '2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063'\n },\n EPSG_4272: {\n towgs84: '59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993'\n },\n EPSG_4248: {\n towgs84: '-307.7,265.3,-363.5'\n },\n EPSG_5561: {\n towgs84: '24,-121,-76'\n },\n EPSG_5233: {\n towgs84: '-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338'\n },\n ESRI_104130: {\n towgs84: '-86,-98,-119'\n },\n ESRI_104102: {\n towgs84: '682,-203,480'\n },\n ESRI_37207: {\n towgs84: '7,-10,-26'\n },\n EPSG_4675: {\n towgs84: '59.935,118.4,-10.871'\n },\n ESRI_104109: {\n towgs84: '-89.121,-348.182,260.871'\n },\n ESRI_104112: {\n towgs84: '-185.583,-230.096,281.361'\n },\n ESRI_104113: {\n towgs84: '25.1,-275.6,222.6'\n },\n IGNF_WGS72G: {\n towgs84: '0,12,6'\n },\n IGNF_NTFG: {\n towgs84: '-168,-60,320'\n },\n IGNF_EFATE57G: {\n towgs84: '-127,-769,472'\n },\n IGNF_PGP50G: {\n towgs84: '324.8,153.6,172.1'\n },\n IGNF_REUN47G: {\n towgs84: '94,-948,-1262'\n },\n IGNF_CSG67G: {\n towgs84: '-186,230,110'\n },\n IGNF_GUAD48G: {\n towgs84: '-467,-16,-300'\n },\n IGNF_TAHI51G: {\n towgs84: '162,117,154'\n },\n IGNF_TAHAAG: {\n towgs84: '65,342,77'\n },\n IGNF_NUKU72G: {\n towgs84: '84,274,65'\n },\n IGNF_PETRELS72G: {\n towgs84: '365,194,166'\n },\n IGNF_WALL78G: {\n towgs84: '253,-133,-127'\n },\n IGNF_MAYO50G: {\n towgs84: '-382,-59,-262'\n },\n IGNF_TANNAG: {\n towgs84: '-139,-967,436'\n },\n IGNF_IGN72G: {\n towgs84: '-13,-348,292'\n },\n IGNF_ATIGG: {\n towgs84: '1118,23,66'\n },\n IGNF_FANGA84G: {\n towgs84: '150.57,158.33,118.32'\n },\n IGNF_RUSAT84G: {\n towgs84: '202.13,174.6,-15.74'\n },\n IGNF_KAUE70G: {\n towgs84: '126.74,300.1,-75.49'\n },\n IGNF_MOP90G: {\n towgs84: '-10.8,-1.8,12.77'\n },\n IGNF_MHPF67G: {\n towgs84: '338.08,212.58,-296.17'\n },\n IGNF_TAHI79G: {\n towgs84: '160.61,116.05,153.69'\n },\n IGNF_ANAA92G: {\n towgs84: '1.5,3.84,4.81'\n },\n IGNF_MARQUI72G: {\n towgs84: '330.91,-13.92,58.56'\n },\n IGNF_APAT86G: {\n towgs84: '143.6,197.82,74.05'\n },\n IGNF_TUBU69G: {\n towgs84: '237.17,171.61,-77.84'\n },\n IGNF_STPM50G: {\n towgs84: '11.363,424.148,373.13'\n },\n EPSG_4150: {\n towgs84: '674.374,15.056,405.346'\n },\n EPSG_4754: {\n towgs84: '-208.4058,-109.8777,-2.5764'\n },\n ESRI_104101: {\n towgs84: '372.87,149.23,585.29'\n },\n EPSG_4693: {\n towgs84: '0,-0.15,0.68'\n },\n EPSG_6207: {\n towgs84: '293.17,726.18,245.36'\n },\n EPSG_4153: {\n towgs84: '-133.63,-157.5,-158.62'\n },\n EPSG_4132: {\n towgs84: '-241.54,-163.64,396.06'\n },\n EPSG_4221: {\n towgs84: '-154.5,150.7,100.4'\n },\n EPSG_4266: {\n towgs84: '-80.7,-132.5,41.1'\n },\n EPSG_4193: {\n towgs84: '-70.9,-151.8,-41.4'\n },\n EPSG_5340: {\n towgs84: '-0.41,0.46,-0.35'\n },\n EPSG_4246: {\n towgs84: '-294.7,-200.1,525.5'\n },\n EPSG_4318: {\n towgs84: '-3.2,-5.7,2.8'\n },\n EPSG_4121: {\n towgs84: '-199.87,74.79,246.62'\n },\n EPSG_4223: {\n towgs84: '-260.1,5.5,432.2'\n },\n EPSG_4158: {\n towgs84: '-0.465,372.095,171.736'\n },\n EPSG_4285: {\n towgs84: '-128.16,-282.42,21.93'\n },\n EPSG_4613: {\n towgs84: '-404.78,685.68,45.47'\n },\n EPSG_4607: {\n towgs84: '195.671,332.517,274.607'\n },\n EPSG_4475: {\n towgs84: '-381.788,-57.501,-256.673'\n },\n EPSG_4208: {\n towgs84: '-157.84,308.54,-146.6'\n },\n EPSG_4743: {\n towgs84: '70.995,-335.916,262.898'\n },\n EPSG_4710: {\n towgs84: '-323.65,551.39,-491.22'\n },\n EPSG_7881: {\n towgs84: '-0.077,0.079,0.086'\n },\n EPSG_4682: {\n towgs84: '283.729,735.942,261.143'\n },\n EPSG_4739: {\n towgs84: '-156,-271,-189'\n },\n EPSG_4679: {\n towgs84: '-80.01,253.26,291.19'\n },\n EPSG_4750: {\n towgs84: '-56.263,16.136,-22.856'\n },\n EPSG_4644: {\n towgs84: '-10.18,-350.43,291.37'\n },\n EPSG_4695: {\n towgs84: '-103.746,-9.614,-255.95'\n },\n EPSG_4292: {\n towgs84: '-355,21,72'\n },\n EPSG_4302: {\n towgs84: '-61.702,284.488,472.052'\n },\n EPSG_4143: {\n towgs84: '-124.76,53,466.79'\n },\n EPSG_4606: {\n towgs84: '-153,153,307'\n },\n EPSG_4699: {\n towgs84: '-770.1,158.4,-498.2'\n },\n EPSG_4247: {\n towgs84: '-273.5,110.6,-357.9'\n },\n EPSG_4160: {\n towgs84: '8.88,184.86,106.69'\n },\n EPSG_4161: {\n towgs84: '-233.43,6.65,173.64'\n },\n EPSG_9251: {\n towgs84: '-9.5,122.9,138.2'\n },\n EPSG_9253: {\n towgs84: '-78.1,101.6,133.3'\n },\n EPSG_4297: {\n towgs84: '-198.383,-240.517,-107.909'\n },\n EPSG_4269: {\n towgs84: '0,0,0'\n },\n EPSG_4301: {\n towgs84: '-147,506,687'\n },\n EPSG_4618: {\n towgs84: '-59,-11,-52'\n },\n EPSG_4612: {\n towgs84: '0,0,0'\n },\n EPSG_4678: {\n towgs84: '44.585,-131.212,-39.544'\n },\n EPSG_4250: {\n towgs84: '-130,29,364'\n },\n EPSG_4144: {\n towgs84: '214,804,268'\n },\n EPSG_4147: {\n towgs84: '-17.51,-108.32,-62.39'\n },\n EPSG_4259: {\n towgs84: '-254.1,-5.36,-100.29'\n },\n EPSG_4164: {\n towgs84: '-76,-138,67'\n },\n EPSG_4211: {\n towgs84: '-378.873,676.002,-46.255'\n },\n EPSG_4182: {\n towgs84: '-422.651,-172.995,84.02'\n },\n EPSG_4224: {\n towgs84: '-143.87,243.37,-33.52'\n },\n EPSG_4225: {\n towgs84: '-205.57,168.77,-4.12'\n },\n EPSG_5527: {\n towgs84: '-67.35,3.88,-38.22'\n },\n EPSG_4752: {\n towgs84: '98,390,-22'\n },\n EPSG_4310: {\n towgs84: '-30,190,89'\n },\n EPSG_9248: {\n towgs84: '-192.26,65.72,132.08'\n },\n EPSG_4680: {\n towgs84: '124.5,-63.5,-281'\n },\n EPSG_4701: {\n towgs84: '-79.9,-158,-168.9'\n },\n EPSG_4706: {\n towgs84: '-146.21,112.63,4.05'\n },\n EPSG_4805: {\n towgs84: '682,-203,480'\n },\n EPSG_4201: {\n towgs84: '-165,-11,206'\n },\n EPSG_4210: {\n towgs84: '-157,-2,-299'\n },\n EPSG_4183: {\n towgs84: '-104,167,-38'\n },\n EPSG_4139: {\n towgs84: '11,72,-101'\n },\n EPSG_4668: {\n towgs84: '-86,-98,-119'\n },\n EPSG_4717: {\n towgs84: '-2,151,181'\n },\n EPSG_4732: {\n towgs84: '102,52,-38'\n },\n EPSG_4280: {\n towgs84: '-377,681,-50'\n },\n EPSG_4209: {\n towgs84: '-138,-105,-289'\n },\n EPSG_4261: {\n towgs84: '31,146,47'\n },\n EPSG_4658: {\n towgs84: '-73,46,-86'\n },\n EPSG_4721: {\n towgs84: '265.025,384.929,-194.046'\n },\n EPSG_4222: {\n towgs84: '-136,-108,-292'\n },\n EPSG_4601: {\n towgs84: '-255,-15,71'\n },\n EPSG_4602: {\n towgs84: '725,685,536'\n },\n EPSG_4603: {\n towgs84: '72,213.7,93'\n },\n EPSG_4605: {\n towgs84: '9,183,236'\n },\n EPSG_4621: {\n towgs84: '137,248,-430'\n },\n EPSG_4657: {\n towgs84: '-28,199,5'\n },\n EPSG_4316: {\n towgs84: '103.25,-100.4,-307.19'\n },\n EPSG_4642: {\n towgs84: '-13,-348,292'\n },\n EPSG_4698: {\n towgs84: '145,-187,103'\n },\n EPSG_4192: {\n towgs84: '-206.1,-174.7,-87.7'\n },\n EPSG_4311: {\n towgs84: '-265,120,-358'\n },\n EPSG_4135: {\n towgs84: '58,-283,-182'\n },\n ESRI_104138: {\n towgs84: '198,-226,-347'\n },\n EPSG_4245: {\n towgs84: '-11,851,5'\n },\n EPSG_4142: {\n towgs84: '-125,53,467'\n },\n EPSG_4213: {\n towgs84: '-106,-87,188'\n },\n EPSG_4253: {\n towgs84: '-133,-77,-51'\n },\n EPSG_4129: {\n towgs84: '-132,-110,-335'\n },\n EPSG_4713: {\n towgs84: '-77,-128,142'\n },\n EPSG_4239: {\n towgs84: '217,823,299'\n },\n EPSG_4146: {\n towgs84: '295,736,257'\n },\n EPSG_4155: {\n towgs84: '-83,37,124'\n },\n EPSG_4165: {\n towgs84: '-173,253,27'\n },\n EPSG_4672: {\n towgs84: '175,-38,113'\n },\n EPSG_4236: {\n towgs84: '-637,-549,-203'\n },\n EPSG_4251: {\n towgs84: '-90,40,88'\n },\n EPSG_4271: {\n towgs84: '-2,374,172'\n },\n EPSG_4175: {\n towgs84: '-88,4,101'\n },\n EPSG_4716: {\n towgs84: '298,-304,-375'\n },\n EPSG_4315: {\n towgs84: '-23,259,-9'\n },\n EPSG_4744: {\n towgs84: '-242.2,-144.9,370.3'\n },\n EPSG_4244: {\n towgs84: '-97,787,86'\n },\n EPSG_4293: {\n towgs84: '616,97,-251'\n },\n EPSG_4714: {\n towgs84: '-127,-769,472'\n },\n EPSG_4736: {\n towgs84: '260,12,-147'\n },\n EPSG_6883: {\n towgs84: '-235,-110,393'\n },\n EPSG_6894: {\n towgs84: '-63,176,185'\n },\n EPSG_4205: {\n towgs84: '-43,-163,45'\n },\n EPSG_4256: {\n towgs84: '41,-220,-134'\n },\n EPSG_4262: {\n towgs84: '639,405,60'\n },\n EPSG_4604: {\n towgs84: '174,359,365'\n },\n EPSG_4169: {\n towgs84: '-115,118,426'\n },\n EPSG_4620: {\n towgs84: '-106,-129,165'\n },\n EPSG_4184: {\n towgs84: '-203,141,53'\n },\n EPSG_4616: {\n towgs84: '-289,-124,60'\n },\n EPSG_9403: {\n towgs84: '-307,-92,127'\n },\n EPSG_4684: {\n towgs84: '-133,-321,50'\n },\n EPSG_4708: {\n towgs84: '-491,-22,435'\n },\n EPSG_4707: {\n towgs84: '114,-116,-333'\n },\n EPSG_4709: {\n towgs84: '145,75,-272'\n },\n EPSG_4712: {\n towgs84: '-205,107,53'\n },\n EPSG_4711: {\n towgs84: '124,-234,-25'\n },\n EPSG_4718: {\n towgs84: '230,-199,-752'\n },\n EPSG_4719: {\n towgs84: '211,147,111'\n },\n EPSG_4724: {\n towgs84: '208,-435,-229'\n },\n EPSG_4725: {\n towgs84: '189,-79,-202'\n },\n EPSG_4735: {\n towgs84: '647,1777,-1124'\n },\n EPSG_4722: {\n towgs84: '-794,119,-298'\n },\n EPSG_4728: {\n towgs84: '-307,-92,127'\n },\n EPSG_4734: {\n towgs84: '-632,438,-609'\n },\n EPSG_4727: {\n towgs84: '912,-58,1227'\n },\n EPSG_4729: {\n towgs84: '185,165,42'\n },\n EPSG_4730: {\n towgs84: '170,42,84'\n },\n EPSG_4733: {\n towgs84: '276,-57,149'\n },\n ESRI_37218: {\n towgs84: '230,-199,-752'\n },\n ESRI_37240: {\n towgs84: '-7,215,225'\n },\n ESRI_37221: {\n towgs84: '252,-209,-751'\n },\n ESRI_4305: {\n towgs84: '-123,-206,219'\n },\n ESRI_104139: {\n towgs84: '-73,-247,227'\n },\n EPSG_4748: {\n towgs84: '51,391,-36'\n },\n EPSG_4219: {\n towgs84: '-384,664,-48'\n },\n EPSG_4255: {\n towgs84: '-333,-222,114'\n },\n EPSG_4257: {\n towgs84: '-587.8,519.75,145.76'\n },\n EPSG_4646: {\n towgs84: '-963,510,-359'\n },\n EPSG_6881: {\n towgs84: '-24,-203,268'\n },\n EPSG_6882: {\n towgs84: '-183,-15,273'\n },\n EPSG_4715: {\n towgs84: '-104,-129,239'\n },\n IGNF_RGF93GDD: {\n towgs84: '0,0,0'\n },\n IGNF_RGM04GDD: {\n towgs84: '0,0,0'\n },\n IGNF_RGSPM06GDD: {\n towgs84: '0,0,0'\n },\n IGNF_RGTAAF07GDD: {\n towgs84: '0,0,0'\n },\n IGNF_RGFG95GDD: {\n towgs84: '0,0,0'\n },\n IGNF_RGNCG: {\n towgs84: '0,0,0'\n },\n IGNF_RGPFGDD: {\n towgs84: '0,0,0'\n },\n IGNF_ETRS89G: {\n towgs84: '0,0,0'\n },\n IGNF_RGR92GDD: {\n towgs84: '0,0,0'\n },\n EPSG_4173: {\n towgs84: '0,0,0'\n },\n EPSG_4180: {\n towgs84: '0,0,0'\n },\n EPSG_4619: {\n towgs84: '0,0,0'\n },\n EPSG_4667: {\n towgs84: '0,0,0'\n },\n EPSG_4075: {\n towgs84: '0,0,0'\n },\n EPSG_6706: {\n towgs84: '0,0,0'\n },\n EPSG_7798: {\n towgs84: '0,0,0'\n },\n EPSG_4661: {\n towgs84: '0,0,0'\n },\n EPSG_4669: {\n towgs84: '0,0,0'\n },\n EPSG_8685: {\n towgs84: '0,0,0'\n },\n EPSG_4151: {\n towgs84: '0,0,0'\n },\n EPSG_9702: {\n towgs84: '0,0,0'\n },\n EPSG_4758: {\n towgs84: '0,0,0'\n },\n EPSG_4761: {\n towgs84: '0,0,0'\n },\n EPSG_4765: {\n towgs84: '0,0,0'\n },\n EPSG_8997: {\n towgs84: '0,0,0'\n },\n EPSG_4023: {\n towgs84: '0,0,0'\n },\n EPSG_4670: {\n towgs84: '0,0,0'\n },\n EPSG_4694: {\n towgs84: '0,0,0'\n },\n EPSG_4148: {\n towgs84: '0,0,0'\n },\n EPSG_4163: {\n towgs84: '0,0,0'\n },\n EPSG_4167: {\n towgs84: '0,0,0'\n },\n EPSG_4189: {\n towgs84: '0,0,0'\n },\n EPSG_4190: {\n towgs84: '0,0,0'\n },\n EPSG_4176: {\n towgs84: '0,0,0'\n },\n EPSG_4659: {\n towgs84: '0,0,0'\n },\n EPSG_3824: {\n towgs84: '0,0,0'\n },\n EPSG_3889: {\n towgs84: '0,0,0'\n },\n EPSG_4046: {\n towgs84: '0,0,0'\n },\n EPSG_4081: {\n towgs84: '0,0,0'\n },\n EPSG_4558: {\n towgs84: '0,0,0'\n },\n EPSG_4483: {\n towgs84: '0,0,0'\n },\n EPSG_5013: {\n towgs84: '0,0,0'\n },\n EPSG_5264: {\n towgs84: '0,0,0'\n },\n EPSG_5324: {\n towgs84: '0,0,0'\n },\n EPSG_5354: {\n towgs84: '0,0,0'\n },\n EPSG_5371: {\n towgs84: '0,0,0'\n },\n EPSG_5373: {\n towgs84: '0,0,0'\n },\n EPSG_5381: {\n towgs84: '0,0,0'\n },\n EPSG_5393: {\n towgs84: '0,0,0'\n },\n EPSG_5489: {\n towgs84: '0,0,0'\n },\n EPSG_5593: {\n towgs84: '0,0,0'\n },\n EPSG_6135: {\n towgs84: '0,0,0'\n },\n EPSG_6365: {\n towgs84: '0,0,0'\n },\n EPSG_5246: {\n towgs84: '0,0,0'\n },\n EPSG_7886: {\n towgs84: '0,0,0'\n },\n EPSG_8431: {\n towgs84: '0,0,0'\n },\n EPSG_8427: {\n towgs84: '0,0,0'\n },\n EPSG_8699: {\n towgs84: '0,0,0'\n },\n EPSG_8818: {\n towgs84: '0,0,0'\n },\n EPSG_4757: {\n towgs84: '0,0,0'\n },\n EPSG_9140: {\n towgs84: '0,0,0'\n },\n EPSG_8086: {\n towgs84: '0,0,0'\n },\n EPSG_4686: {\n towgs84: '0,0,0'\n },\n EPSG_4737: {\n towgs84: '0,0,0'\n },\n EPSG_4702: {\n towgs84: '0,0,0'\n },\n EPSG_4747: {\n towgs84: '0,0,0'\n },\n EPSG_4749: {\n towgs84: '0,0,0'\n },\n EPSG_4674: {\n towgs84: '0,0,0'\n },\n EPSG_4755: {\n towgs84: '0,0,0'\n },\n EPSG_4759: {\n towgs84: '0,0,0'\n },\n EPSG_4762: {\n towgs84: '0,0,0'\n },\n EPSG_4763: {\n towgs84: '0,0,0'\n },\n EPSG_4764: {\n towgs84: '0,0,0'\n },\n EPSG_4166: {\n towgs84: '0,0,0'\n },\n EPSG_4170: {\n towgs84: '0,0,0'\n },\n EPSG_5546: {\n towgs84: '0,0,0'\n },\n EPSG_7844: {\n towgs84: '0,0,0'\n },\n EPSG_4818: {\n towgs84: '589,76,480'\n },\n EPSG_10328: {\n towgs84: '0,0,0'\n },\n EPSG_9782: {\n towgs84: '0,0,0'\n },\n EPSG_9777: {\n towgs84: '0,0,0'\n },\n EPSG_10690: {\n towgs84: '0,0,0'\n },\n EPSG_10639: {\n towgs84: '0,0,0'\n },\n EPSG_10739: {\n towgs84: '0,0,0'\n },\n EPSG_7686: {\n towgs84: '0,0,0'\n },\n EPSG_8900: {\n towgs84: '0,0,0'\n },\n EPSG_5886: {\n towgs84: '0,0,0'\n },\n EPSG_7683: {\n towgs84: '0,0,0'\n },\n EPSG_6668: {\n towgs84: '0,0,0'\n },\n EPSG_20046: {\n towgs84: '0,0,0'\n },\n EPSG_10299: {\n towgs84: '0,0,0'\n },\n EPSG_10310: {\n towgs84: '0,0,0'\n },\n EPSG_10475: {\n towgs84: '0,0,0'\n },\n EPSG_4742: {\n towgs84: '0,0,0'\n },\n EPSG_10671: {\n towgs84: '0,0,0'\n },\n EPSG_10762: {\n towgs84: '0,0,0'\n },\n EPSG_10725: {\n towgs84: '0,0,0'\n },\n EPSG_10791: {\n towgs84: '0,0,0'\n },\n EPSG_10800: {\n towgs84: '0,0,0'\n },\n EPSG_10305: {\n towgs84: '0,0,0'\n },\n EPSG_10941: {\n towgs84: '0,0,0'\n },\n EPSG_10968: {\n towgs84: '0,0,0'\n },\n EPSG_10875: {\n towgs84: '0,0,0'\n },\n EPSG_6318: {\n towgs84: '0,0,0'\n },\n EPSG_10910: {\n towgs84: '0,0,0'\n }\n};\n\nfor (var key in datums) {\n var datum = datums[key];\n if (!datum.datumName) {\n continue;\n }\n datums[datum.datumName] = datum;\n}\n\nexport default datums;\n","import { PJD_3PARAM, PJD_7PARAM, PJD_GRIDSHIFT, PJD_WGS84, PJD_NODATUM, SEC_TO_RAD } from './constants/values';\n\nfunction datum(datumCode, datum_params, a, b, es, ep2, nadgrids) {\n var out = {};\n\n if (datumCode === undefined || datumCode === 'none') {\n out.datum_type = PJD_NODATUM;\n } else {\n out.datum_type = PJD_WGS84;\n }\n\n if (datum_params) {\n out.datum_params = datum_params.map(parseFloat);\n if (out.datum_params[0] !== 0 || out.datum_params[1] !== 0 || out.datum_params[2] !== 0) {\n out.datum_type = PJD_3PARAM;\n }\n if (out.datum_params.length > 3) {\n if (out.datum_params[3] !== 0 || out.datum_params[4] !== 0 || out.datum_params[5] !== 0 || out.datum_params[6] !== 0) {\n out.datum_type = PJD_7PARAM;\n out.datum_params[3] *= SEC_TO_RAD;\n out.datum_params[4] *= SEC_TO_RAD;\n out.datum_params[5] *= SEC_TO_RAD;\n out.datum_params[6] = (out.datum_params[6] / 1000000.0) + 1.0;\n }\n }\n }\n\n if (nadgrids) {\n out.datum_type = PJD_GRIDSHIFT;\n out.grids = nadgrids;\n }\n out.a = a; // datum object also uses these values\n out.b = b;\n out.es = es;\n out.ep2 = ep2;\n return out;\n}\n\nexport default datum;\n","/**\n * Resources for details of NTv2 file formats:\n * - https://web.archive.org/web/20140127204822if_/http://www.mgs.gov.on.ca:80/stdprodconsume/groups/content/@mgs/@iandit/documents/resourcelist/stel02_047447.pdf\n * - http://mimaka.com/help/gs/html/004_NTV2%20Data%20Format.htm\n */\n\n/**\n * @typedef {Object} NadgridInfo\n * @property {string} name The name of the NAD grid or 'null' if not specified.\n * @property {boolean} mandatory Indicates if the grid is mandatory (true) or optional (false).\n * @property {*} grid The loaded NAD grid object, or null if not loaded or not applicable.\n * @property {boolean} isNull True if the grid is explicitly 'null', otherwise false.\n */\n\n/**\n * @typedef {Object} NTV2GridOptions\n * @property {boolean} [includeErrorFields=true] Whether to include error fields in the subgrids.\n */\n\n/**\n * @typedef {Object} NadgridHeader\n * @property {number} [nFields] Number of fields in the header.\n * @property {number} [nSubgridFields] Number of fields in each subgrid header.\n * @property {number} nSubgrids Number of subgrids in the file.\n * @property {string} [shiftType] Type of shift (e.g., \"SECONDS\").\n * @property {number} [fromSemiMajorAxis] Source ellipsoid semi-major axis.\n * @property {number} [fromSemiMinorAxis] Source ellipsoid semi-minor axis.\n * @property {number} [toSemiMajorAxis] Target ellipsoid semi-major axis.\n * @property {number} [toSemiMinorAxis] Target ellipsoid semi-minor axis.\n */\n\n/**\n * @typedef {Object} Subgrid\n * @property {Array<number>} ll Lower left corner of the grid in radians [longitude, latitude].\n * @property {Array<number>} del Grid spacing in radians [longitude interval, latitude interval].\n * @property {Array<number>} lim Number of columns in the grid [longitude columns, latitude columns].\n * @property {number} [count] Total number of grid nodes.\n * @property {Array} cvs Mapped node values for the grid.\n */\n\n/** @typedef {{header: NadgridHeader, subgrids: Array<Subgrid>}} NADGrid */\n\n/**\n * @typedef {Object} GeoTIFF\n * @property {() => Promise<number>} getImageCount - Returns the number of images in the GeoTIFF.\n * @property {(index: number) => Promise<GeoTIFFImage>} getImage - Returns a GeoTIFFImage for the given index.\n */\n\n/**\n * @typedef {Object} GeoTIFFImage\n * @property {() => number} getWidth - Returns the width of the image.\n * @property {() => number} getHeight - Returns the height of the image.\n * @property {() => number[]} getBoundingBox - Returns the bounding box as [minX, minY, maxX, maxY] in degrees.\n * @property {() => Promise<ArrayLike<ArrayLike<number>>>} readRasters - Returns the raster data as an array of bands.\n * @property {Object} fileDirectory - The file directory object containing metadata.\n * @property {Object} fileDirectory.ModelPixelScale - The pixel scale array [scaleX, scaleY, scaleZ] in degrees.\n */\n\nvar loadedNadgrids = {};\n\n/**\n * @overload\n * @param {string} key - The key to associate with the loaded grid.\n * @param {ArrayBuffer} data - The NTv2 grid data as an ArrayBuffer.\n * @param {NTV2GridOptions} [options] - Optional parameters for loading the grid.\n * @returns {NADGrid} - The loaded NAD grid information.\n */\n/**\n * @overload\n * @param {string} key - The key to associate with the loaded grid.\n * @param {GeoTIFF} data - The GeoTIFF instance to read the grid from.\n * @returns {{ready: Promise<NADGrid>}} - A promise that resolves to the loaded grid information.\n */\n/**\n * Load either a NTv2 file (.gsb) or a Geotiff (.tif) to a key that can be used in a proj string like +nadgrids=<key>. Pass the NTv2 file\n * as an ArrayBuffer. Pass Geotiff as a GeoTIFF instance from the geotiff.js library.\n * @param {string} key - The key to associate with the loaded grid.\n * @param {ArrayBuffer|GeoTIFF} data The data to load, either an ArrayBuffer for NTv2 or a GeoTIFF instance.\n * @param {NTV2GridOptions} [options] Optional parameters.\n * @returns {{ready: Promise<NADGrid>}|NADGrid} - A promise that resolves to the loaded grid information.\n */\nexport default function nadgrid(key, data, options) {\n if (data instanceof ArrayBuffer) {\n return readNTV2Grid(key, data, options);\n }\n return { ready: readGeotiffGrid(key, data) };\n}\n\n/**\n * @param {string} key The key to associate with the loaded grid.\n * @param {ArrayBuffer} data The NTv2 grid data as an ArrayBuffer.\n * @param {NTV2GridOptions} [options] Optional parameters for loading the grid.\n * @returns {NADGrid} The loaded NAD grid information.\n */\nfunction readNTV2Grid(key, data, options) {\n var includeErrorFields = true;\n if (options !== undefined && options.includeErrorFields === false) {\n includeErrorFields = false;\n }\n var view = new DataView(data);\n var isLittleEndian = detectLittleEndian(view);\n var header = readHeader(view, isLittleEndian);\n var subgrids = readSubgrids(view, header, isLittleEndian, includeErrorFields);\n var nadgrid = { header: header, subgrids: subgrids };\n loadedNadgrids[key] = nadgrid;\n return nadgrid;\n}\n\n/**\n * @param {string} key The key to associate with the loaded grid.\n * @param {GeoTIFF} tiff The GeoTIFF instance to read the grid from.\n * @returns {Promise<NADGrid>} A promise that resolves to the loaded NAD grid information.\n */\nasync function readGeotiffGrid(key, tiff) {\n var subgrids = [];\n var subGridCount = await tiff.getImageCount();\n // proj produced tiff grid shift files appear to organize lower res subgrids first, higher res/ child subgrids last.\n for (var subgridIndex = subGridCount - 1; subgridIndex >= 0; subgridIndex--) {\n var image = await tiff.getImage(subgridIndex);\n\n var rasters = await image.readRasters();\n var data = rasters;\n var lim = [image.getWidth(), image.getHeight()];\n var imageBBoxRadians = image.getBoundingBox().map(degreesToRadians);\n var del = [image.fileDirectory.ModelPixelScale[0], image.fileDirectory.ModelPixelScale[1]].map(degreesToRadians);\n\n var maxX = imageBBoxRadians[0] + (lim[0] - 1) * del[0];\n var minY = imageBBoxRadians[3] - (lim[1] - 1) * del[1];\n\n var latitudeOffsetBand = data[0];\n var longitudeOffsetBand = data[1];\n var nodes = [];\n\n for (let i = lim[1] - 1; i >= 0; i--) {\n for (let j = lim[0] - 1; j >= 0; j--) {\n var index = i * lim[0] + j;\n nodes.push([-secondsToRadians(longitudeOffsetBand[index]), secondsToRadians(latitudeOffsetBand[index])]);\n }\n }\n\n subgrids.push({\n del: del,\n lim: lim,\n ll: [-maxX, minY],\n cvs: nodes\n });\n }\n\n var tifGrid = {\n header: {\n nSubgrids: subGridCount\n },\n subgrids: subgrids\n };\n loadedNadgrids[key] = tifGrid;\n return tifGrid;\n};\n\n/**\n * Given a proj4 value for nadgrids, return an array of loaded grids\n * @param {string} nadgrids A comma-separated list of grid names, optionally prefixed with '@' to indicate optional grids.\n * @returns\n */\nexport function getNadgrids(nadgrids) {\n // Format details: http://proj.maptools.org/gen_parms.html\n if (nadgrids === undefined) {\n return null;\n }\n var grids = nadgrids.split(',');\n return grids.map(parseNadgridString);\n}\n\n/**\n * @param {string} value The nadgrid string to get information for.\n * @returns {NadgridInfo|null} An object with grid information, or null if the input is empty.\n */\nfunction parseNadgridString(value) {\n if (value.length === 0) {\n return null;\n }\n var optional = value[0] === '@';\n if (optional) {\n value = value.slice(1);\n }\n if (value === 'null') {\n return { name: 'null', mandatory: !optional, grid: null, isNull: true };\n }\n return {\n name: value,\n mandatory: !optional,\n grid: loadedNadgrids[value] || null,\n isNull: false\n };\n}\n\nfunction degreesToRadians(degrees) {\n return (degrees) * Math.PI / 180;\n}\n\nfunction secondsToRadians(seconds) {\n return (seconds / 3600) * Math.PI / 180;\n}\n\nfunction detectLittleEndian(view) {\n var nFields = view.getInt32(8, false);\n if (nFields === 11) {\n return false;\n }\n nFields = view.getInt32(8, true);\n if (nFields !== 11) {\n console.warn('Failed to detect nadgrid endian-ness, defaulting to little-endian');\n }\n return true;\n}\n\nfunction readHeader(view, isLittleEndian) {\n return {\n nFields: view.getInt32(8, isLittleEndian),\n nSubgridFields: view.getInt32(24, isLittleEndian),\n nSubgrids: view.getInt32(40, isLittleEndian),\n shiftType: decodeString(view, 56, 56 + 8).trim(),\n fromSemiMajorAxis: view.getFloat64(120, isLittleEndian),\n fromSemiMinorAxis: view.getFloat64(136, isLittleEndian),\n toSemiMajorAxis: view.getFloat64(152, isLittleEndian),\n toSemiMinorAxis: view.getFloat64(168, isLittleEndian)\n };\n}\n\nfunction decodeString(view, start, end) {\n return String.fromCharCode.apply(null, new Uint8Array(view.buffer.slice(start, end)));\n}\n\nfunction readSubgrids(view, header, isLittleEndian, includeErrorFields) {\n var gridOffset = 176;\n var grids = [];\n for (var i = 0; i < header.nSubgrids; i++) {\n var subHeader = readGridHeader(view, gridOffset, isLittleEndian);\n var nodes = readGridNodes(view, gridOffset, subHeader, isLittleEndian, includeErrorFields);\n var lngColumnCount = Math.round(\n 1 + (subHeader.upperLongitude - subHeader.lowerLongitude) / subHeader.longitudeInterval);\n var latColumnCount = Math.round(\n 1 + (subHeader.upperLatitude - subHeader.lowerLatitude) / subHeader.latitudeInterval);\n // Proj4 operates on radians whereas the coordinates are in seconds in the grid\n grids.push({\n ll: [secondsToRadians(subHeader.lowerLongitude), secondsToRadians(subHeader.lowerLatitude)],\n del: [secondsToRadians(subHeader.longitudeInterval), secondsToRadians(subHeader.latitudeInterval)],\n lim: [lngColumnCount, latColumnCount],\n count: subHeader.gridNodeCount,\n cvs: mapNodes(nodes)\n });\n var rowSize = 16;\n if (includeErrorFields === false) {\n rowSize = 8;\n }\n gridOffset += 176 + subHeader.gridNodeCount * rowSize;\n }\n return grids;\n}\n\n/**\n * @param {*} nodes\n * @returns Array<Array<number>>\n */\nfunction mapNodes(nodes) {\n return nodes.map(function (r) {\n return [secondsToRadians(r.longitudeShift), secondsToRadians(r.latitudeShift)];\n });\n}\n\nfunction readGridHeader(view, offset, isLittleEndian) {\n return {\n name: decodeString(view, offset + 8, offset + 16).trim(),\n parent: decodeString(view, offset + 24, offset + 24 + 8).trim(),\n lowerLatitude: view.getFloat64(offset + 72, isLittleEndian),\n upperLatitude: view.getFloat64(offset + 88, isLittleEndian),\n lowerLongitude: view.getFloat64(offset + 104, isLittleEndian),\n upperLongitude: view.getFloat64(offset + 120, isLittleEndian),\n latitudeInterval: view.getFloat64(offset + 136, isLittleEndian),\n longitudeInterval: view.getFloat64(offset + 152, isLittleEndian),\n gridNodeCount: view.getInt32(offset + 168, isLittleEndian)\n };\n}\n\nfunction readGridNodes(view, offset, gridHeader, isLittleEndian, includeErrorFields) {\n var nodesOffset = offset + 176;\n var gridRecordLength = 16;\n\n if (includeErrorFields === false) {\n gridRecordLength = 8;\n }\n\n var gridShiftRecords = [];\n for (var i = 0; i < gridHeader.gridNodeCount; i++) {\n var record = {\n latitudeShift: view.getFloat32(nodesOffset + i * gridRecordLength, isLittleEndian),\n longitudeShift: view.getFloat32(nodesOffset + i * gridRecordLength + 4, isLittleEndian)\n\n };\n\n if (includeErrorFields !== false) {\n record.latitudeAccuracy = view.getFloat32(nodesOffset + i * gridRecordLength + 8, isLittleEndian);\n record.longitudeAccuracy = view.getFloat32(nodesOffset + i * gridRecordLength + 12, isLittleEndian);\n }\n\n gridShiftRecords.push(record);\n }\n return gridShiftRecords;\n}\n","import parseCode from './parseCode';\nimport extend from './extend';\nimport projections from './projections';\nimport { sphere as dc_sphere, eccentricity as dc_eccentricity } from './deriveConstants';\nimport Datum from './constants/Datum';\nimport datum from './datum';\nimport match from './match';\nimport { getNadgrids } from './nadgrid';\n\n/**\n * @typedef {Object} DatumDefinition\n * @property {number} datum_type - The type of datum.\n * @property {number} a - Semi-major axis of the ellipsoid.\n * @property {number} b - Semi-minor axis of the ellipsoid.\n * @property {number} es - Eccentricity squared of the ellipsoid.\n * @property {number} ep2 - Second eccentricity squared of the ellipsoid.\n */\n\n/**\n * @param {string | import('./core').PROJJSONDefinition | import('./defs').ProjectionDefinition} srsCode\n * @param {(errorMessage?: string, instance?: Projection) => void} [callback]\n */\nfunction Projection(srsCode, callback) {\n if (!(this instanceof Projection)) {\n return new Projection(srsCode);\n }\n /** @type {<T extends import('./core').TemplateCoordinates>(coordinates: T, enforceAxis?: boolean) => T} */\n this.forward = null;\n /** @type {<T extends import('./core').TemplateCoordinates>(coordinates: T, enforceAxis?: boolean) => T} */\n this.inverse = null;\n /** @type {function(): void} */\n this.init = null;\n /** @type {string} */\n this.name;\n /** @type {Array<string>} */\n this.names = null;\n /** @type {string} */\n this.title;\n callback = callback || function (error) {\n if (error) {\n throw error;\n }\n };\n var json = parseCode(srsCode);\n if (typeof json !== 'object') {\n callback('Could not parse to valid json: ' + srsCode);\n return;\n }\n var ourProj = Projection.projections.get(json.projName);\n if (!ourProj) {\n callback('Could not get projection name from: ' + srsCode);\n return;\n }\n if (json.datumCode && json.datumCode !== 'none') {\n var datumDef = match(Datum, json.datumCode);\n if (datumDef) {\n json.datum_params = json.datum_params || (datumDef.towgs84 ? datumDef.towgs84.split(',') : null);\n json.ellps = datumDef.ellipse;\n json.datumName = datumDef.datumName ? datumDef.datumName : json.datumCode;\n }\n }\n json.k0 = json.k0 || 1.0;\n json.axis = json.axis || 'enu';\n json.ellps = json.ellps || 'wgs84';\n json.lat1 = json.lat1 || json.lat0; // Lambert_Conformal_Conic_1SP, for example, needs this\n\n var sphere_ = dc_sphere(json.a, json.b, json.rf, json.ellps, json.sphere);\n var ecc = dc_eccentricity(sphere_.a, sphere_.b, sphere_.rf, json.R_A);\n var nadgrids = getNadgrids(json.nadgrids);\n /** @type {DatumDefinition} */\n var datumObj = json.datum || datum(json.datumCode, json.datum_params, sphere_.a, sphere_.b, ecc.es, ecc.ep2,\n nadgrids);\n\n extend(this, json); // transfer everything over from the projection because we don't know what we'll need\n extend(this, ourProj); // transfer all the methods from the projection\n\n // copy the 4 things over we calculated in deriveConstants.sphere\n this.a = sphere_.a;\n this.b = sphere_.b;\n this.rf = sphere_.rf;\n this.sphere = sphere_.sphere;\n\n // copy the 3 things we calculated in deriveConstants.eccentricity\n this.es = ecc.es;\n this.e = ecc.e;\n this.ep2 = ecc.ep2;\n\n // add in the datum object\n this.datum = datumObj;\n\n // init the projection\n if ('init' in this && typeof this.init === 'function') {\n this.init();\n }\n\n // legecy callback from back in the day when it went to spatialreference.org\n callback(null, this);\n}\nProjection.projections = projections;\nProjection.projections.start();\nexport default Projection;\n","'use strict';\nimport { PJD_3PARAM, PJD_7PARAM, HALF_PI } from './constants/values';\nexport function compareDatums(source, dest) {\n if (source.datum_type !== dest.datum_type) {\n return false; // false, datums are not equal\n } else if (source.a !== dest.a || Math.abs(source.es - dest.es) > 0.000000000050) {\n // the tolerance for es is to ensure that GRS80 and WGS84\n // are considered identical\n return false;\n } else if (source.datum_type === PJD_3PARAM) {\n return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2]);\n } else if (source.datum_type === PJD_7PARAM) {\n return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2] && source.datum_params[3] === dest.datum_params[3] && source.datum_params[4] === dest.datum_params[4] && source.datum_params[5] === dest.datum_params[5] && source.datum_params[6] === dest.datum_params[6]);\n } else {\n return true; // datums are equal\n }\n} // cs_compare_datums()\n\n/*\n * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates\n * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z),\n * according to the current ellipsoid parameters.\n *\n * Latitude : Geodetic latitude in radians (input)\n * Longitude : Geodetic longitude in radians (input)\n * Height : Geodetic height, in meters (input)\n * X : Calculated Geocentric X coordinate, in meters (output)\n * Y : Calculated Geocentric Y coordinate, in meters (output)\n * Z : Calculated Geocentric Z coordinate, in meters (output)\n *\n */\nexport function geodeticToGeocentric(p, es, a) {\n var Longitude = p.x;\n var Latitude = p.y;\n var Height = p.z ? p.z : 0; // Z value not always supplied\n\n var Rn; /* Earth radius at location */\n var Sin_Lat; /* Math.sin(Latitude) */\n var Sin2_Lat; /* Square of Math.sin(Latitude) */\n var Cos_Lat; /* Math.cos(Latitude) */\n\n /*\n ** Don't blow up if Latitude is just a little out of the value\n ** range as it may just be a rounding issue. Also removed longitude\n ** test, it should be wrapped by Math.cos() and Math.sin(). NFW for PROJ.4, Sep/2001.\n */\n if (Latitude < -HALF_PI && Latitude > -1.001 * HALF_PI) {\n Latitude = -HALF_PI;\n } else if (Latitude > HALF_PI && Latitude < 1.001 * HALF_PI) {\n Latitude = HALF_PI;\n } else if (Latitude < -HALF_PI) {\n /* Latitude out of range */\n // ..reportError('geocent:lat out of range:' + Latitude);\n return { x: -Infinity, y: -Infinity, z: p.z };\n } else if (Latitude > HALF_PI) {\n /* Latitude out of range */\n return { x: Infinity, y: Infinity, z: p.z };\n }\n\n if (Longitude > Math.PI) {\n Longitude -= (2 * Math.PI);\n }\n Sin_Lat = Math.sin(Latitude);\n Cos_Lat = Math.cos(Latitude);\n Sin2_Lat = Sin_Lat * Sin_Lat;\n Rn = a / (Math.sqrt(1.0e0 - es * Sin2_Lat));\n return {\n x: (Rn + Height) * Cos_Lat * Math.cos(Longitude),\n y: (Rn + Height) * Cos_Lat * Math.sin(Longitude),\n z: ((Rn * (1 - es)) + Height) * Sin_Lat\n };\n} // cs_geodetic_to_geocentric()\n\nexport function geocentricToGeodetic(p, es, a, b) {\n /* local defintions and variables */\n /* end-criterium of loop, accuracy of sin(Latitude) */\n var genau = 1e-12;\n var genau2 = (genau * genau);\n var maxiter = 30;\n\n var P; /* distance between semi-minor axis and location */\n var RR; /* distance between center and location */\n var CT; /* sin of geocentric latitude */\n var ST; /* cos of geocentric latitude */\n var RX;\n var RK;\n var RN; /* Earth radius at location */\n var CPHI0; /* cos of start or old geodetic latitude in iterations */\n var SPHI0; /* sin of start or old geodetic latitude in iterations */\n var CPHI; /* cos of searched geodetic latitude */\n var SPHI; /* sin of searched geodetic latitude */\n var SDPHI; /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */\n var iter; /* # of continous iteration, max. 30 is always enough (s.a.) */\n\n var X = p.x;\n var Y = p.y;\n var Z = p.z ? p.z : 0.0; // Z value not always supplied\n var Longitude;\n var Latitude;\n var Height;\n\n P = Math.sqrt(X * X + Y * Y);\n RR = Math.sqrt(X * X + Y * Y + Z * Z);\n\n /* special cases for latitude and longitude */\n if (P / a < genau) {\n /* special case, if P=0. (X=0., Y=0.) */\n Longitude = 0.0;\n\n /* if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis\n * of ellipsoid (=center of mass), Latitude becomes PI/2 */\n if (RR / a < genau) {\n Latitude = HALF_PI;\n Height = -b;\n return {\n x: p.x,\n y: p.y,\n z: p.z\n };\n }\n } else {\n /* ellipsoidal (geodetic) longitude\n * interval: -PI < Longitude <= +PI */\n Longitude = Math.atan2(Y, X);\n }\n\n /* --------------------------------------------------------------\n * Following iterative algorithm was developped by\n * \"Institut for Erdmessung\", University of Hannover, July 1988.\n * Internet: www.ife.uni-hannover.de\n * Iterative computation of CPHI,SPHI and Height.\n * Iteration of CPHI and SPHI to 10**-12 radian resp.\n * 2*10**-7 arcsec.\n * --------------------------------------------------------------\n */\n CT = Z / RR;\n ST = P / RR;\n RX = 1.0 / Math.sqrt(1.0 - es * (2.0 - es) * ST * ST);\n CPHI0 = ST * (1.0 - es) * RX;\n SPHI0 = CT * RX;\n iter = 0;\n\n /* loop to find sin(Latitude) resp. Latitude\n * until |sin(Latitude(iter)-Latitude(iter-1))| < genau */\n do {\n iter++;\n RN = a / Math.sqrt(1.0 - es * SPHI0 * SPHI0);\n\n /* ellipsoidal (geodetic) height */\n Height = P * CPHI0 + Z * SPHI0 - RN * (1.0 - es * SPHI0 * SPHI0);\n\n RK = es * RN / (RN + Height);\n RX = 1.0 / Math.sqrt(1.0 - RK * (2.0 - RK) * ST * ST);\n CPHI = ST * (1.0 - RK) * RX;\n SPHI = CT * RX;\n SDPHI = SPHI * CPHI0 - CPHI * SPHI0;\n CPHI0 = CPHI;\n SPHI0 = SPHI;\n }\n while (SDPHI * SDPHI > genau2 && iter < maxiter);\n\n /* ellipsoidal (geodetic) latitude */\n Latitude = Math.atan(SPHI / Math.abs(CPHI));\n return {\n x: Longitude,\n y: Latitude,\n z: Height\n };\n} // cs_geocentric_to_geodetic()\n\n/****************************************************************/\n// pj_geocentic_to_wgs84( p )\n// p = point to transform in geocentric coordinates (x,y,z)\n\n/** point object, nothing fancy, just allows values to be\n passed back and forth by reference rather than by value.\n Other point classes may be used as long as they have\n x and y properties, which will get modified in the transform method.\n*/\nexport function geocentricToWgs84(p, datum_type, datum_params) {\n if (datum_type === PJD_3PARAM) {\n // if( x[io] === HUGE_VAL )\n // continue;\n return {\n x: p.x + datum_params[0],\n y: p.y + datum_params[1],\n z: p.z + datum_params[2]\n };\n } else if (datum_type === PJD_7PARAM) {\n var Dx_BF = datum_params[0];\n var Dy_BF = datum_params[1];\n var Dz_BF = datum_params[2];\n var Rx_BF = datum_params[3];\n var Ry_BF = datum_params[4];\n var Rz_BF = datum_params[5];\n var M_BF = datum_params[6];\n // if( x[io] === HUGE_VAL )\n // continue;\n return {\n x: M_BF * (p.x - Rz_BF * p.y + Ry_BF * p.z) + Dx_BF,\n y: M_BF * (Rz_BF * p.x + p.y - Rx_BF * p.z) + Dy_BF,\n z: M_BF * (-Ry_BF * p.x + Rx_BF * p.y + p.z) + Dz_BF\n };\n }\n} // cs_geocentric_to_wgs84\n\n/****************************************************************/\n// pj_geocentic_from_wgs84()\n// coordinate system definition,\n// point to transform in geocentric coordinates (x,y,z)\nexport function geocentricFromWgs84(p, datum_type, datum_params) {\n if (datum_type === PJD_3PARAM) {\n // if( x[io] === HUGE_VAL )\n // continue;\n return {\n x: p.x - datum_params[0],\n y: p.y - datum_params[1],\n z: p.z - datum_params[2]\n };\n } else if (datum_type === PJD_7PARAM) {\n var Dx_BF = datum_params[0];\n var Dy_BF = datum_params[1];\n var Dz_BF = datum_params[2];\n var Rx_BF = datum_params[3];\n var Ry_BF = datum_params[4];\n var Rz_BF = datum_params[5];\n var M_BF = datum_params[6];\n var x_tmp = (p.x - Dx_BF) / M_BF;\n var y_tmp = (p.y - Dy_BF) / M_BF;\n var z_tmp = (p.z - Dz_BF) / M_BF;\n // if( x[io] === HUGE_VAL )\n // continue;\n\n return {\n x: x_tmp + Rz_BF * y_tmp - Ry_BF * z_tmp,\n y: -Rz_BF * x_tmp + y_tmp + Rx_BF * z_tmp,\n z: Ry_BF * x_tmp - Rx_BF * y_tmp + z_tmp\n };\n } // cs_geocentric_from_wgs84()\n}\n","import {\n PJD_3PARAM,\n PJD_7PARAM,\n PJD_GRIDSHIFT,\n PJD_NODATUM,\n R2D,\n SRS_WGS84_ESQUARED,\n SRS_WGS84_SEMIMAJOR, SRS_WGS84_SEMIMINOR\n} from './constants/values';\n\nimport { geodeticToGeocentric, geocentricToGeodetic, geocentricToWgs84, geocentricFromWgs84, compareDatums } from './datumUtils';\nimport adjust_lon from './common/adjust_lon';\nfunction checkParams(type) {\n return (type === PJD_3PARAM || type === PJD_7PARAM);\n}\n\nexport default function (source, dest, point) {\n // Short cut if the datums are identical.\n if (compareDatums(source, dest)) {\n return point; // in this case, zero is sucess,\n // whereas cs_compare_datums returns 1 to indicate TRUE\n // confusing, should fix this\n }\n\n // Explicitly skip datum transform by setting 'datum=none' as parameter for either source or dest\n if (source.datum_type === PJD_NODATUM || dest.datum_type === PJD_NODATUM) {\n return point;\n }\n\n // If this datum requires grid shifts, then apply it to geodetic coordinates.\n var source_a = source.a;\n var source_es = source.es;\n if (source.datum_type === PJD_GRIDSHIFT) {\n var gridShiftCode = applyGridShift(source, false, point);\n if (gridShiftCode !== 0) {\n return undefined;\n }\n source_a = SRS_WGS84_SEMIMAJOR;\n source_es = SRS_WGS84_ESQUARED;\n }\n\n var dest_a = dest.a;\n var dest_b = dest.b;\n var dest_es = dest.es;\n if (dest.datum_type === PJD_GRIDSHIFT) {\n dest_a = SRS_WGS84_SEMIMAJOR;\n dest_b = SRS_WGS84_SEMIMINOR;\n dest_es = SRS_WGS84_ESQUARED;\n }\n\n // Do we need to go through geocentric coordinates?\n if (source_es === dest_es && source_a === dest_a && !checkParams(source.datum_type) && !checkParams(dest.datum_type)) {\n return point;\n }\n\n // Convert to geocentric coordinates.\n point = geodeticToGeocentric(point, source_es, source_a);\n // Convert between datums\n if (checkParams(source.datum_type)) {\n point = geocentricToWgs84(point, source.datum_type, source.datum_params);\n }\n if (checkParams(dest.datum_type)) {\n point = geocentricFromWgs84(point, dest.datum_type, dest.datum_params);\n }\n point = geocentricToGeodetic(point, dest_es, dest_a, dest_b);\n\n if (dest.datum_type === PJD_GRIDSHIFT) {\n var destGridShiftResult = applyGridShift(dest, true, point);\n if (destGridShiftResult !== 0) {\n return undefined;\n }\n }\n\n return point;\n}\n\nexport function applyGridShift(source, inverse, point) {\n if (source.grids === null || source.grids.length === 0) {\n console.log('Grid shift grids not found');\n return -1;\n }\n var input = { x: -point.x, y: point.y };\n var output = { x: Number.NaN, y: Number.NaN };\n var attemptedGrids = [];\n outer:\n for (var i = 0; i < source.grids.length; i++) {\n var grid = source.grids[i];\n attemptedGrids.push(grid.name);\n if (grid.isNull) {\n output = input;\n break;\n }\n if (grid.grid === null) {\n if (grid.mandatory) {\n console.log('Unable to find mandatory grid \\'' + grid.name + '\\'');\n return -1;\n }\n continue;\n }\n var subgrids = grid.grid.subgrids;\n for (var j = 0, jj = subgrids.length; j < jj; j++) {\n var subgrid = subgrids[j];\n // skip tables that don't match our point at all\n var epsilon = (Math.abs(subgrid.del[1]) + Math.abs(subgrid.del[0])) / 10000.0;\n var minX = subgrid.ll[0] - epsilon;\n var minY = subgrid.ll[1] - epsilon;\n var maxX = subgrid.ll[0] + (subgrid.lim[0] - 1) * subgrid.del[0] + epsilon;\n var maxY = subgrid.ll[1] + (subgrid.lim[1] - 1) * subgrid.del[1] + epsilon;\n if (minY > input.y || minX > input.x || maxY < input.y || maxX < input.x) {\n continue;\n }\n output = applySubgridShift(input, inverse, subgrid);\n if (!isNaN(output.x)) {\n break outer;\n }\n }\n }\n if (isNaN(output.x)) {\n console.log('Failed to find a grid shift table for location \\''\n + -input.x * R2D + ' ' + input.y * R2D + ' tried: \\'' + attemptedGrids + '\\'');\n return -1;\n }\n point.x = -output.x;\n point.y = output.y;\n return 0;\n}\n\nfunction applySubgridShift(pin, inverse, ct) {\n var val = { x: Number.NaN, y: Number.NaN };\n if (isNaN(pin.x)) {\n return val;\n }\n var tb = { x: pin.x, y: pin.y };\n tb.x -= ct.ll[0];\n tb.y -= ct.ll[1];\n tb.x = adjust_lon(tb.x - Math.PI) + Math.PI;\n var t = nadInterpolate(tb, ct);\n if (inverse) {\n if (isNaN(t.x)) {\n return val;\n }\n t.x = tb.x - t.x;\n t.y = tb.y - t.y;\n var i = 9, tol = 1e-12;\n var dif, del;\n do {\n del = nadInterpolate(t, ct);\n if (isNaN(del.x)) {\n console.log('Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.');\n break;\n }\n dif = { x: tb.x - (del.x + t.x), y: tb.y - (del.y + t.y) };\n t.x += dif.x;\n t.y += dif.y;\n } while (i-- && Math.abs(dif.x) > tol && Math.abs(dif.y) > tol);\n if (i < 0) {\n console.log('Inverse grid shift iterator failed to converge.');\n return val;\n }\n val.x = adjust_lon(t.x + ct.ll[0]);\n val.y = t.y + ct.ll[1];\n } else {\n if (!isNaN(t.x)) {\n val.x = pin.x + t.x;\n val.y = pin.y + t.y;\n }\n }\n return val;\n}\n\nfunction nadInterpolate(pin, ct) {\n var t = { x: pin.x / ct.del[0], y: pin.y / ct.del[1] };\n var indx = { x: Math.floor(t.x), y: Math.floor(t.y) };\n var frct = { x: t.x - 1.0 * indx.x, y: t.y - 1.0 * indx.y };\n var val = { x: Number.NaN, y: Number.NaN };\n var inx;\n if (indx.x < 0 || indx.x >= ct.lim[0]) {\n return val;\n }\n if (indx.y < 0 || indx.y >= ct.lim[1]) {\n return val;\n }\n inx = (indx.y * ct.lim[0]) + indx.x;\n var f00 = { x: ct.cvs[inx][0], y: ct.cvs[inx][1] };\n inx++;\n var f10 = { x: ct.cvs[inx][0], y: ct.cvs[inx][1] };\n inx += ct.lim[0];\n var f11 = { x: ct.cvs[inx][0], y: ct.cvs[inx][1] };\n inx--;\n var f01 = { x: ct.cvs[inx][0], y: ct.cvs[inx][1] };\n var m11 = frct.x * frct.y, m10 = frct.x * (1.0 - frct.y),\n m00 = (1.0 - frct.x) * (1.0 - frct.y), m01 = (1.0 - frct.x) * frct.y;\n val.x = (m00 * f00.x + m10 * f10.x + m01 * f01.x + m11 * f11.x);\n val.y = (m00 * f00.y + m10 * f10.y + m01 * f01.y + m11 * f11.y);\n return val;\n}\n","export default function (crs, denorm, point) {\n var xin = point.x,\n yin = point.y,\n zin = point.z || 0.0;\n var v, t, i;\n /** @type {import(\"./core\").InterfaceCoordinates} */\n var out = {};\n for (i = 0; i < 3; i++) {\n if (denorm && i === 2 && point.z === undefined) {\n continue;\n }\n if (i === 0) {\n v = xin;\n if ('ew'.indexOf(crs.axis[i]) !== -1) {\n t = 'x';\n } else {\n t = 'y';\n }\n } else if (i === 1) {\n v = yin;\n if ('ns'.indexOf(crs.axis[i]) !== -1) {\n t = 'y';\n } else {\n t = 'x';\n }\n } else {\n v = zin;\n t = 'z';\n }\n switch (crs.axis[i]) {\n case 'e':\n out[t] = v;\n break;\n case 'w':\n out[t] = -v;\n break;\n case 'n':\n out[t] = v;\n break;\n case 's':\n out[t] = -v;\n break;\n case 'u':\n if (point[t] !== undefined) {\n out.z = v;\n }\n break;\n case 'd':\n if (point[t] !== undefined) {\n out.z = -v;\n }\n break;\n default:\n // console.log(\"ERROR: unknow axis (\"+crs.axis[i]+\") - check definition of \"+crs.projName);\n return null;\n }\n }\n return out;\n}\n","/**\n * @param {Array<number>} array\n * @returns {import(\"../core\").InterfaceCoordinates}\n */\nexport default function (array) {\n var out = {\n x: array[0],\n y: array[1]\n };\n if (array.length > 2) {\n out.z = array[2];\n }\n if (array.length > 3) {\n out.m = array[3];\n }\n return out;\n}\n","export default function (point) {\n checkCoord(point.x);\n checkCoord(point.y);\n}\nfunction checkCoord(num) {\n if (typeof Number.isFinite === 'function') {\n if (Number.isFinite(num)) {\n return;\n }\n throw new TypeError('coordinates must be finite numbers');\n }\n if (typeof num !== 'number' || num !== num || !isFinite(num)) {\n throw new TypeError('coordinates must be finite numbers');\n }\n}\n","import { D2R, R2D, PJD_3PARAM, PJD_7PARAM, PJD_GRIDSHIFT } from './constants/values';\nimport datum_transform from './datum_transform';\nimport adjust_axis from './adjust_axis';\nimport proj from './Proj';\nimport toPoint from './common/toPoint';\nimport checkSanity from './checkSanity';\n\nfunction checkNotWGS(source, dest) {\n return (\n (source.datum.datum_type === PJD_3PARAM || source.datum.datum_type === PJD_7PARAM || source.datum.datum_type === PJD_GRIDSHIFT) && dest.datumCode !== 'WGS84')\n || ((dest.datum.datum_type === PJD_3PARAM || dest.datum.datum_type === PJD_7PARAM || dest.datum.datum_type === PJD_GRIDSHIFT) && source.datumCode !== 'WGS84');\n}\n\n/**\n * @param {import('./defs').ProjectionDefinition} source\n * @param {import('./defs').ProjectionDefinition} dest\n * @param {import('./core').TemplateCoordinates} point\n * @param {boolean} enforceAxis\n * @returns {import('./core').InterfaceCoordinates | undefined}\n */\nexport default function transform(source, dest, point, enforceAxis) {\n var wgs84;\n if (Array.isArray(point)) {\n point = toPoint(point);\n } else {\n // Clone the point object so inputs don't get modified\n point = {\n x: point.x,\n y: point.y,\n z: point.z,\n m: point.m\n };\n }\n var hasZ = point.z !== undefined;\n checkSanity(point);\n // Workaround for datum shifts towgs84, if either source or destination projection is not wgs84\n if (source.datum && dest.datum && checkNotWGS(source, dest)) {\n wgs84 = new proj('WGS84');\n point = transform(source, wgs84, point, enforceAxis);\n source = wgs84;\n }\n // DGR, 2010/11/12\n if (enforceAxis && source.axis !== 'enu') {\n point = adjust_axis(source, false, point);\n }\n // Transform source points to long/lat, if they aren't already.\n if (source.projName === 'longlat') {\n point = {\n x: point.x * D2R,\n y: point.y * D2R,\n z: point.z || 0\n };\n } else {\n if (source.to_meter) {\n point = {\n x: point.x * source.to_meter,\n y: point.y * source.to_meter,\n z: point.z || 0\n };\n }\n point = source.inverse(point); // Convert Cartesian to longlat\n if (!point) {\n return;\n }\n }\n // Adjust for the prime meridian if necessary\n if (source.from_greenwich) {\n point.x += source.from_greenwich;\n }\n\n // Convert datums if needed, and if possible.\n point = datum_transform(source.datum, dest.datum, point);\n if (!point) {\n return;\n }\n\n point = /** @type {import('./core').InterfaceCoordinates} */ (point);\n\n // Adjust for the prime meridian if necessary\n if (dest.from_greenwich) {\n point = {\n x: point.x - dest.from_greenwich,\n y: point.y,\n z: point.z || 0\n };\n }\n\n if (dest.projName === 'longlat') {\n // convert radians to decimal degrees\n point = {\n x: point.x * R2D,\n y: point.y * R2D,\n z: point.z || 0\n };\n } else { // else project\n point = dest.forward(point);\n if (dest.to_meter) {\n point = {\n x: point.x / dest.to_meter,\n y: point.y / dest.to_meter,\n z: point.z || 0\n };\n }\n }\n\n // DGR, 2010/11/12\n if (enforceAxis && dest.axis !== 'enu') {\n return adjust_axis(dest, true, point);\n }\n\n if (point && !hasZ && dest.projName !== 'geocent') {\n delete point.z;\n }\n return point;\n}\n","import proj from './Proj';\nimport transform from './transform';\nvar wgs84 = proj('WGS84');\n\n/**\n * @typedef {{x: number, y: number, z?: number, m?: number}} InterfaceCoordinates\n */\n\n/**\n * @typedef {Array<number> | InterfaceCoordinates} TemplateCoordinates\n */\n\n/**\n * @typedef {Object} Converter\n * @property {<T extends TemplateCoordinates>(coordinates: T, enforceAxis?: boolean) => T} forward\n * @property {<T extends TemplateCoordinates>(coordinates: T, enforceAxis?: boolean) => T} inverse\n * @property {proj} [oProj]\n */\n\n/**\n * @typedef {Object} PROJJSONDefinition\n * @property {string} [$schema]\n * @property {string} type\n * @property {string} [name]\n * @property {{authority: string, code: number}} [id]\n * @property {string} [scope]\n * @property {string} [area]\n * @property {{south_latitude: number, west_longitude: number, north_latitude: number, east_longitude: number}} [bbox]\n * @property {PROJJSONDefinition[]} [components]\n * @property {{type: string, name: string}} [datum]\n * @property {{\n * name: string,\n * members: Array<{\n * name: string,\n * id?: {authority: string, code: number}\n * }>,\n * ellipsoid?: {\n * name: string,\n * semi_major_axis: number,\n * inverse_flattening?: number\n * },\n * accuracy?: string,\n * id?: {authority: string, code: number}\n * }} [datum_ensemble]\n * @property {{\n * subtype: string,\n * axis: Array<{\n * name: string,\n * abbreviation?: string,\n * direction: string,\n * unit: string\n * }>\n * }} [coordinate_system]\n * @property {{\n * name: string,\n * method: {name: string},\n * parameters: Array<{\n * name: string,\n * value: number,\n * unit?: string\n * }>\n * }} [conversion]\n * @property {{\n * name: string,\n * method: {name: string},\n * parameters: Array<{\n * name: string,\n * value: number,\n * unit?: string,\n * type?: string,\n * file_name?: string\n * }>\n * }} [transformation]\n */\n\n/**\n * @template {TemplateCoordinates} T\n * @param {proj} from\n * @param {proj} to\n * @param {T} coords\n * @param {boolean} [enforceAxis]\n * @returns {T}\n */\nfunction transformer(from, to, coords, enforceAxis) {\n var transformedArray, out, keys;\n if (Array.isArray(coords)) {\n transformedArray = transform(from, to, coords, enforceAxis) || { x: NaN, y: NaN };\n if (coords.length > 2) {\n if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {\n if (typeof transformedArray.z === 'number') {\n return /** @type {T} */ ([transformedArray.x, transformedArray.y, transformedArray.z].concat(coords.slice(3)));\n } else {\n return /** @type {T} */ ([transformedArray.x, transformedArray.y, coords[2]].concat(coords.slice(3)));\n }\n } else {\n return /** @type {T} */ ([transformedArray.x, transformedArray.y].concat(coords.slice(2)));\n }\n } else {\n return /** @type {T} */ ([transformedArray.x, transformedArray.y]);\n }\n } else {\n out = transform(from, to, coords, enforceAxis);\n keys = Object.keys(coords);\n if (keys.length === 2) {\n return /** @type {T} */ (out);\n }\n keys.forEach(function (key) {\n if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {\n if (key === 'x' || key === 'y' || key === 'z') {\n return;\n }\n } else {\n if (key === 'x' || key === 'y') {\n return;\n }\n }\n out[key] = coords[key];\n });\n return /** @type {T} */ (out);\n }\n}\n\n/**\n * @param {proj | string | PROJJSONDefinition | Converter} item\n * @returns {import('./Proj').default}\n */\nfunction checkProj(item) {\n if (item instanceof proj) {\n return item;\n }\n if (typeof item === 'object' && 'oProj' in item) {\n return item.oProj;\n }\n return proj(/** @type {string | PROJJSONDefinition} */ (item));\n}\n\n/**\n * @overload\n * @param {string | PROJJSONDefinition | proj} toProj\n * @returns {Converter}\n */\n/**\n * @overload\n * @param {string | PROJJSONDefinition | proj} fromProj\n * @param {string | PROJJSONDefinition | proj} toProj\n * @returns {Converter}\n */\n/**\n * @template {TemplateCoordinates} T\n * @overload\n * @param {string | PROJJSONDefinition | proj} toProj\n * @param {T} coord\n * @returns {T}\n */\n/**\n * @template {TemplateCoordinates} T\n * @overload\n * @param {string | PROJJSONDefinition | proj} fromProj\n * @param {string | PROJJSONDefinition | proj} toProj\n * @param {T} coord\n * @returns {T}\n */\n/**\n * @template {TemplateCoordinates} T\n * @param {string | PROJJSONDefinition | proj} fromProjOrToProj\n * @param {string | PROJJSONDefinition | proj | TemplateCoordinates} [toProjOrCoord]\n * @param {T} [coord]\n * @returns {T|Converter}\n */\nfunction proj4(fromProjOrToProj, toProjOrCoord, coord) {\n /** @type {proj} */\n var fromProj;\n /** @type {proj} */\n var toProj;\n var single = false;\n /** @type {Converter} */\n var obj;\n if (typeof toProjOrCoord === 'undefined') {\n toProj = checkProj(fromProjOrToProj);\n fromProj = wgs84;\n single = true;\n } else if (typeof /** @type {?} */ (toProjOrCoord).x !== 'undefined' || Array.isArray(toProjOrCoord)) {\n coord = /** @type {T} */ (/** @type {?} */ (toProjOrCoord));\n toProj = checkProj(fromProjOrToProj);\n fromProj = wgs84;\n single = true;\n }\n if (!fromProj) {\n fromProj = checkProj(fromProjOrToProj);\n }\n if (!toProj) {\n toProj = checkProj(/** @type {string | PROJJSONDefinition | proj } */ (toProjOrCoord));\n }\n if (coord) {\n return transformer(fromProj, toProj, coord);\n } else {\n obj = {\n /**\n * @template {TemplateCoordinates} T\n * @param {T} coords\n * @param {boolean=} enforceAxis\n * @returns {T}\n */\n forward: function (coords, enforceAxis) {\n return transformer(fromProj, toProj, coords, enforceAxis);\n },\n /**\n * @template {TemplateCoordinates} T\n * @param {T} coords\n * @param {boolean=} enforceAxis\n * @returns {T}\n */\n inverse: function (coords, enforceAxis) {\n return transformer(toProj, fromProj, coords, enforceAxis);\n }\n };\n if (single) {\n obj.oProj = toProj;\n }\n return obj;\n }\n}\n\nexport default proj4;\n","\n\n\n/**\n * UTM zones are grouped, and assigned to one of a group of 6\n * sets.\n *\n * {int} @private\n */\nvar NUM_100K_SETS = 6;\n\n/**\n * The column letters (for easting) of the lower left value, per\n * set.\n *\n * {string} @private\n */\nvar SET_ORIGIN_COLUMN_LETTERS = 'AJSAJS';\n\n/**\n * The row letters (for northing) of the lower left value, per\n * set.\n *\n * {string} @private\n */\nvar SET_ORIGIN_ROW_LETTERS = 'AFAFAF';\n\nvar A = 65; // A\nvar I = 73; // I\nvar O = 79; // O\nvar V = 86; // V\nvar Z = 90; // Z\nexport default {\n forward: forward,\n inverse: inverse,\n toPoint: toPoint\n};\n/**\n * Conversion of lat/lon to MGRS.\n *\n * @param {object} ll Object literal with lat and lon properties on a\n * WGS84 ellipsoid.\n * @param {int} accuracy Accuracy in digits (5 for 1 m, 4 for 10 m, 3 for\n * 100 m, 2 for 1000 m or 1 for 10000 m). Optional, default is 5.\n * @return {string} the MGRS string for the given location and accuracy.\n */\nexport function forward(ll, accuracy) {\n accuracy = accuracy || 5; // default accuracy 1m\n return encode(LLtoUTM({\n lat: ll[1],\n lon: ll[0]\n }), accuracy);\n};\n\n/**\n * Conversion of MGRS to lat/lon.\n *\n * @param {string} mgrs MGRS string.\n * @return {array} An array with left (longitude), bottom (latitude), right\n * (longitude) and top (latitude) values in WGS84, representing the\n * bounding box for the provided MGRS reference.\n */\nexport function inverse(mgrs) {\n var bbox = UTMtoLL(decode(mgrs.toUpperCase()));\n if (bbox.lat && bbox.lon) {\n return [bbox.lon, bbox.lat, bbox.lon, bbox.lat];\n }\n return [bbox.left, bbox.bottom, bbox.right, bbox.top];\n};\n\nexport function toPoint(mgrs) {\n var bbox = UTMtoLL(decode(mgrs.toUpperCase()));\n if (bbox.lat && bbox.lon) {\n return [bbox.lon, bbox.lat];\n }\n return [(bbox.left + bbox.right) / 2, (bbox.top + bbox.bottom) / 2];\n};\n/**\n * Conversion from degrees to radians.\n *\n * @private\n * @param {number} deg the angle in degrees.\n * @return {number} the angle in radians.\n */\nfunction degToRad(deg) {\n return (deg * (Math.PI / 180.0));\n}\n\n/**\n * Conversion from radians to degrees.\n *\n * @private\n * @param {number} rad the angle in radians.\n * @return {number} the angle in degrees.\n */\nfunction radToDeg(rad) {\n return (180.0 * (rad / Math.PI));\n}\n\n/**\n * Converts a set of Longitude and Latitude co-ordinates to UTM\n * using the WGS84 ellipsoid.\n *\n * @private\n * @param {object} ll Object literal with lat and lon properties\n * representing the WGS84 coordinate to be converted.\n * @return {object} Object literal containing the UTM value with easting,\n * northing, zoneNumber and zoneLetter properties, and an optional\n * accuracy property in digits. Returns null if the conversion failed.\n */\nfunction LLtoUTM(ll) {\n var Lat = ll.lat;\n var Long = ll.lon;\n var a = 6378137.0; //ellip.radius;\n var eccSquared = 0.00669438; //ellip.eccsq;\n var k0 = 0.9996;\n var LongOrigin;\n var eccPrimeSquared;\n var N, T, C, A, M;\n var LatRad = degToRad(Lat);\n var LongRad = degToRad(Long);\n var LongOriginRad;\n var ZoneNumber;\n // (int)\n ZoneNumber = Math.floor((Long + 180) / 6) + 1;\n\n //Make sure the longitude 180.00 is in Zone 60\n if (Long === 180) {\n ZoneNumber = 60;\n }\n\n // Special zone for Norway\n if (Lat >= 56.0 && Lat < 64.0 && Long >= 3.0 && Long < 12.0) {\n ZoneNumber = 32;\n }\n\n // Special zones for Svalbard\n if (Lat >= 72.0 && Lat < 84.0) {\n if (Long >= 0.0 && Long < 9.0) {\n ZoneNumber = 31;\n }\n else if (Long >= 9.0 && Long < 21.0) {\n ZoneNumber = 33;\n }\n else if (Long >= 21.0 && Long < 33.0) {\n ZoneNumber = 35;\n }\n else if (Long >= 33.0 && Long < 42.0) {\n ZoneNumber = 37;\n }\n }\n\n LongOrigin = (ZoneNumber - 1) * 6 - 180 + 3; //+3 puts origin\n // in middle of\n // zone\n LongOriginRad = degToRad(LongOrigin);\n\n eccPrimeSquared = (eccSquared) / (1 - eccSquared);\n\n N = a / Math.sqrt(1 - eccSquared * Math.sin(LatRad) * Math.sin(LatRad));\n T = Math.tan(LatRad) * Math.tan(LatRad);\n C = eccPrimeSquared * Math.cos(LatRad) * Math.cos(LatRad);\n A = Math.cos(LatRad) * (LongRad - LongOriginRad);\n\n M = a * ((1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256) * LatRad - (3 * eccSquared / 8 + 3 * eccSquared * eccSquared / 32 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(2 * LatRad) + (15 * eccSquared * eccSquared / 256 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(4 * LatRad) - (35 * eccSquared * eccSquared * eccSquared / 3072) * Math.sin(6 * LatRad));\n\n var UTMEasting = (k0 * N * (A + (1 - T + C) * A * A * A / 6.0 + (5 - 18 * T + T * T + 72 * C - 58 * eccPrimeSquared) * A * A * A * A * A / 120.0) + 500000.0);\n\n var UTMNorthing = (k0 * (M + N * Math.tan(LatRad) * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24.0 + (61 - 58 * T + T * T + 600 * C - 330 * eccPrimeSquared) * A * A * A * A * A * A / 720.0)));\n if (Lat < 0.0) {\n UTMNorthing += 10000000.0; //10000000 meter offset for\n // southern hemisphere\n }\n\n return {\n northing: Math.round(UTMNorthing),\n easting: Math.round(UTMEasting),\n zoneNumber: ZoneNumber,\n zoneLetter: getLetterDesignator(Lat)\n };\n}\n\n/**\n * Converts UTM coords to lat/long, using the WGS84 ellipsoid. This is a convenience\n * class where the Zone can be specified as a single string eg.\"60N\" which\n * is then broken down into the ZoneNumber and ZoneLetter.\n *\n * @private\n * @param {object} utm An object literal with northing, easting, zoneNumber\n * and zoneLetter properties. If an optional accuracy property is\n * provided (in meters), a bounding box will be returned instead of\n * latitude and longitude.\n * @return {object} An object literal containing either lat and lon values\n * (if no accuracy was provided), or top, right, bottom and left values\n * for the bounding box calculated according to the provided accuracy.\n * Returns null if the conversion failed.\n */\nfunction UTMtoLL(utm) {\n\n var UTMNorthing = utm.northing;\n var UTMEasting = utm.easting;\n var zoneLetter = utm.zoneLetter;\n var zoneNumber = utm.zoneNumber;\n // check the ZoneNummber is valid\n if (zoneNumber < 0 || zoneNumber > 60) {\n return null;\n }\n\n var k0 = 0.9996;\n var a = 6378137.0; //ellip.radius;\n var eccSquared = 0.00669438; //ellip.eccsq;\n var eccPrimeSquared;\n var e1 = (1 - Math.sqrt(1 - eccSquared)) / (1 + Math.sqrt(1 - eccSquared));\n var N1, T1, C1, R1, D, M;\n var LongOrigin;\n var mu, phi1Rad;\n\n // remove 500,000 meter offset for longitude\n var x = UTMEasting - 500000.0;\n var y = UTMNorthing;\n\n // We must know somehow if we are in the Northern or Southern\n // hemisphere, this is the only time we use the letter So even\n // if the Zone letter isn't exactly correct it should indicate\n // the hemisphere correctly\n if (zoneLetter < 'N') {\n y -= 10000000.0; // remove 10,000,000 meter offset used\n // for southern hemisphere\n }\n\n // There are 60 zones with zone 1 being at West -180 to -174\n LongOrigin = (zoneNumber - 1) * 6 - 180 + 3; // +3 puts origin\n // in middle of\n // zone\n\n eccPrimeSquared = (eccSquared) / (1 - eccSquared);\n\n M = y / k0;\n mu = M / (a * (1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256));\n\n phi1Rad = mu + (3 * e1 / 2 - 27 * e1 * e1 * e1 / 32) * Math.sin(2 * mu) + (21 * e1 * e1 / 16 - 55 * e1 * e1 * e1 * e1 / 32) * Math.sin(4 * mu) + (151 * e1 * e1 * e1 / 96) * Math.sin(6 * mu);\n // double phi1 = ProjMath.radToDeg(phi1Rad);\n\n N1 = a / Math.sqrt(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad));\n T1 = Math.tan(phi1Rad) * Math.tan(phi1Rad);\n C1 = eccPrimeSquared * Math.cos(phi1Rad) * Math.cos(phi1Rad);\n R1 = a * (1 - eccSquared) / Math.pow(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad), 1.5);\n D = x / (N1 * k0);\n\n var lat = phi1Rad - (N1 * Math.tan(phi1Rad) / R1) * (D * D / 2 - (5 + 3 * T1 + 10 * C1 - 4 * C1 * C1 - 9 * eccPrimeSquared) * D * D * D * D / 24 + (61 + 90 * T1 + 298 * C1 + 45 * T1 * T1 - 252 * eccPrimeSquared - 3 * C1 * C1) * D * D * D * D * D * D / 720);\n lat = radToDeg(lat);\n\n var lon = (D - (1 + 2 * T1 + C1) * D * D * D / 6 + (5 - 2 * C1 + 28 * T1 - 3 * C1 * C1 + 8 * eccPrimeSquared + 24 * T1 * T1) * D * D * D * D * D / 120) / Math.cos(phi1Rad);\n lon = LongOrigin + radToDeg(lon);\n\n var result;\n if (utm.accuracy) {\n var topRight = UTMtoLL({\n northing: utm.northing + utm.accuracy,\n easting: utm.easting + utm.accuracy,\n zoneLetter: utm.zoneLetter,\n zoneNumber: utm.zoneNumber\n });\n result = {\n top: topRight.lat,\n right: topRight.lon,\n bottom: lat,\n left: lon\n };\n }\n else {\n result = {\n lat: lat,\n lon: lon\n };\n }\n return result;\n}\n\n/**\n * Calculates the MGRS letter designator for the given latitude.\n *\n * @private\n * @param {number} lat The latitude in WGS84 to get the letter designator\n * for.\n * @return {char} The letter designator.\n */\nfunction getLetterDesignator(lat) {\n //This is here as an error flag to show that the Latitude is\n //outside MGRS limits\n var LetterDesignator = 'Z';\n\n if ((84 >= lat) && (lat >= 72)) {\n LetterDesignator = 'X';\n }\n else if ((72 > lat) && (lat >= 64)) {\n LetterDesignator = 'W';\n }\n else if ((64 > lat) && (lat >= 56)) {\n LetterDesignator = 'V';\n }\n else if ((56 > lat) && (lat >= 48)) {\n LetterDesignator = 'U';\n }\n else if ((48 > lat) && (lat >= 40)) {\n LetterDesignator = 'T';\n }\n else if ((40 > lat) && (lat >= 32)) {\n LetterDesignator = 'S';\n }\n else if ((32 > lat) && (lat >= 24)) {\n LetterDesignator = 'R';\n }\n else if ((24 > lat) && (lat >= 16)) {\n LetterDesignator = 'Q';\n }\n else if ((16 > lat) && (lat >= 8)) {\n LetterDesignator = 'P';\n }\n else if ((8 > lat) && (lat >= 0)) {\n LetterDesignator = 'N';\n }\n else if ((0 > lat) && (lat >= -8)) {\n LetterDesignator = 'M';\n }\n else if ((-8 > lat) && (lat >= -16)) {\n LetterDesignator = 'L';\n }\n else if ((-16 > lat) && (lat >= -24)) {\n LetterDesignator = 'K';\n }\n else if ((-24 > lat) && (lat >= -32)) {\n LetterDesignator = 'J';\n }\n else if ((-32 > lat) && (lat >= -40)) {\n LetterDesignator = 'H';\n }\n else if ((-40 > lat) && (lat >= -48)) {\n LetterDesignator = 'G';\n }\n else if ((-48 > lat) && (lat >= -56)) {\n LetterDesignator = 'F';\n }\n else if ((-56 > lat) && (lat >= -64)) {\n LetterDesignator = 'E';\n }\n else if ((-64 > lat) && (lat >= -72)) {\n LetterDesignator = 'D';\n }\n else if ((-72 > lat) && (lat >= -80)) {\n LetterDesignator = 'C';\n }\n return LetterDesignator;\n}\n\n/**\n * Encodes a UTM location as MGRS string.\n *\n * @private\n * @param {object} utm An object literal with easting, northing,\n * zoneLetter, zoneNumber\n * @param {number} accuracy Accuracy in digits (1-5).\n * @return {string} MGRS string for the given UTM location.\n */\nfunction encode(utm, accuracy) {\n // prepend with leading zeroes\n var seasting = \"00000\" + utm.easting,\n snorthing = \"00000\" + utm.northing;\n\n return utm.zoneNumber + utm.zoneLetter + get100kID(utm.easting, utm.northing, utm.zoneNumber) + seasting.substr(seasting.length - 5, accuracy) + snorthing.substr(snorthing.length - 5, accuracy);\n}\n\n/**\n * Get the two letter 100k designator for a given UTM easting,\n * northing and zone number value.\n *\n * @private\n * @param {number} easting\n * @param {number} northing\n * @param {number} zoneNumber\n * @return the two letter 100k designator for the given UTM location.\n */\nfunction get100kID(easting, northing, zoneNumber) {\n var setParm = get100kSetForZone(zoneNumber);\n var setColumn = Math.floor(easting / 100000);\n var setRow = Math.floor(northing / 100000) % 20;\n return getLetter100kID(setColumn, setRow, setParm);\n}\n\n/**\n * Given a UTM zone number, figure out the MGRS 100K set it is in.\n *\n * @private\n * @param {number} i An UTM zone number.\n * @return {number} the 100k set the UTM zone is in.\n */\nfunction get100kSetForZone(i) {\n var setParm = i % NUM_100K_SETS;\n if (setParm === 0) {\n setParm = NUM_100K_SETS;\n }\n\n return setParm;\n}\n\n/**\n * Get the two-letter MGRS 100k designator given information\n * translated from the UTM northing, easting and zone number.\n *\n * @private\n * @param {number} column the column index as it relates to the MGRS\n * 100k set spreadsheet, created from the UTM easting.\n * Values are 1-8.\n * @param {number} row the row index as it relates to the MGRS 100k set\n * spreadsheet, created from the UTM northing value. Values\n * are from 0-19.\n * @param {number} parm the set block, as it relates to the MGRS 100k set\n * spreadsheet, created from the UTM zone. Values are from\n * 1-60.\n * @return two letter MGRS 100k code.\n */\nfunction getLetter100kID(column, row, parm) {\n // colOrigin and rowOrigin are the letters at the origin of the set\n var index = parm - 1;\n var colOrigin = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(index);\n var rowOrigin = SET_ORIGIN_ROW_LETTERS.charCodeAt(index);\n\n // colInt and rowInt are the letters to build to return\n var colInt = colOrigin + column - 1;\n var rowInt = rowOrigin + row;\n var rollover = false;\n\n if (colInt > Z) {\n colInt = colInt - Z + A - 1;\n rollover = true;\n }\n\n if (colInt === I || (colOrigin < I && colInt > I) || ((colInt > I || colOrigin < I) && rollover)) {\n colInt++;\n }\n\n if (colInt === O || (colOrigin < O && colInt > O) || ((colInt > O || colOrigin < O) && rollover)) {\n colInt++;\n\n if (colInt === I) {\n colInt++;\n }\n }\n\n if (colInt > Z) {\n colInt = colInt - Z + A - 1;\n }\n\n if (rowInt > V) {\n rowInt = rowInt - V + A - 1;\n rollover = true;\n }\n else {\n rollover = false;\n }\n\n if (((rowInt === I) || ((rowOrigin < I) && (rowInt > I))) || (((rowInt > I) || (rowOrigin < I)) && rollover)) {\n rowInt++;\n }\n\n if (((rowInt === O) || ((rowOrigin < O) && (rowInt > O))) || (((rowInt > O) || (rowOrigin < O)) && rollover)) {\n rowInt++;\n\n if (rowInt === I) {\n rowInt++;\n }\n }\n\n if (rowInt > V) {\n rowInt = rowInt - V + A - 1;\n }\n\n var twoLetter = String.fromCharCode(colInt) + String.fromCharCode(rowInt);\n return twoLetter;\n}\n\n/**\n * Decode the UTM parameters from a MGRS string.\n *\n * @private\n * @param {string} mgrsString an UPPERCASE coordinate string is expected.\n * @return {object} An object literal with easting, northing, zoneLetter,\n * zoneNumber and accuracy (in meters) properties.\n */\nfunction decode(mgrsString) {\n\n if (mgrsString && mgrsString.length === 0) {\n throw (\"MGRSPoint coverting from nothing\");\n }\n\n var length = mgrsString.length;\n\n var hunK = null;\n var sb = \"\";\n var testChar;\n var i = 0;\n\n // get Zone number\n while (!(/[A-Z]/).test(testChar = mgrsString.charAt(i))) {\n if (i >= 2) {\n throw (\"MGRSPoint bad conversion from: \" + mgrsString);\n }\n sb += testChar;\n i++;\n }\n\n var zoneNumber = parseInt(sb, 10);\n\n if (i === 0 || i + 3 > length) {\n // A good MGRS string has to be 4-5 digits long,\n // ##AAA/#AAA at least.\n throw (\"MGRSPoint bad conversion from: \" + mgrsString);\n }\n\n var zoneLetter = mgrsString.charAt(i++);\n\n // Should we check the zone letter here? Why not.\n if (zoneLetter <= 'A' || zoneLetter === 'B' || zoneLetter === 'Y' || zoneLetter >= 'Z' || zoneLetter === 'I' || zoneLetter === 'O') {\n throw (\"MGRSPoint zone letter \" + zoneLetter + \" not handled: \" + mgrsString);\n }\n\n hunK = mgrsString.substring(i, i += 2);\n\n var set = get100kSetForZone(zoneNumber);\n\n var east100k = getEastingFromChar(hunK.charAt(0), set);\n var north100k = getNorthingFromChar(hunK.charAt(1), set);\n\n // We have a bug where the northing may be 2000000 too low.\n // How\n // do we know when to roll over?\n\n while (north100k < getMinNorthing(zoneLetter)) {\n north100k += 2000000;\n }\n\n // calculate the char index for easting/northing separator\n var remainder = length - i;\n\n if (remainder % 2 !== 0) {\n throw (\"MGRSPoint has to have an even number \\nof digits after the zone letter and two 100km letters - front \\nhalf for easting meters, second half for \\nnorthing meters\" + mgrsString);\n }\n\n var sep = remainder / 2;\n\n var sepEasting = 0.0;\n var sepNorthing = 0.0;\n var accuracyBonus, sepEastingString, sepNorthingString, easting, northing;\n if (sep > 0) {\n accuracyBonus = 100000.0 / Math.pow(10, sep);\n sepEastingString = mgrsString.substring(i, i + sep);\n sepEasting = parseFloat(sepEastingString) * accuracyBonus;\n sepNorthingString = mgrsString.substring(i + sep);\n sepNorthing = parseFloat(sepNorthingString) * accuracyBonus;\n }\n\n easting = sepEasting + east100k;\n northing = sepNorthing + north100k;\n\n return {\n easting: easting,\n northing: northing,\n zoneLetter: zoneLetter,\n zoneNumber: zoneNumber,\n accuracy: accuracyBonus\n };\n}\n\n/**\n * Given the first letter from a two-letter MGRS 100k zone, and given the\n * MGRS table set for the zone number, figure out the easting value that\n * should be added to the other, secondary easting value.\n *\n * @private\n * @param {char} e The first letter from a two-letter MGRS 100´k zone.\n * @param {number} set The MGRS table set for the zone number.\n * @return {number} The easting value for the given letter and set.\n */\nfunction getEastingFromChar(e, set) {\n // colOrigin is the letter at the origin of the set for the\n // column\n var curCol = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(set - 1);\n var eastingValue = 100000.0;\n var rewindMarker = false;\n\n while (curCol !== e.charCodeAt(0)) {\n curCol++;\n if (curCol === I) {\n curCol++;\n }\n if (curCol === O) {\n curCol++;\n }\n if (curCol > Z) {\n if (rewindMarker) {\n throw (\"Bad character: \" + e);\n }\n curCol = A;\n rewindMarker = true;\n }\n eastingValue += 100000.0;\n }\n\n return eastingValue;\n}\n\n/**\n * Given the second letter from a two-letter MGRS 100k zone, and given the\n * MGRS table set for the zone number, figure out the northing value that\n * should be added to the other, secondary northing value. You have to\n * remember that Northings are determined from the equator, and the vertical\n * cycle of letters mean a 2000000 additional northing meters. This happens\n * approx. every 18 degrees of latitude. This method does *NOT* count any\n * additional northings. You have to figure out how many 2000000 meters need\n * to be added for the zone letter of the MGRS coordinate.\n *\n * @private\n * @param {char} n Second letter of the MGRS 100k zone\n * @param {number} set The MGRS table set number, which is dependent on the\n * UTM zone number.\n * @return {number} The northing value for the given letter and set.\n */\nfunction getNorthingFromChar(n, set) {\n\n if (n > 'V') {\n throw (\"MGRSPoint given invalid Northing \" + n);\n }\n\n // rowOrigin is the letter at the origin of the set for the\n // column\n var curRow = SET_ORIGIN_ROW_LETTERS.charCodeAt(set - 1);\n var northingValue = 0.0;\n var rewindMarker = false;\n\n while (curRow !== n.charCodeAt(0)) {\n curRow++;\n if (curRow === I) {\n curRow++;\n }\n if (curRow === O) {\n curRow++;\n }\n // fixing a bug making whole application hang in this loop\n // when 'n' is a wrong character\n if (curRow > V) {\n if (rewindMarker) { // making sure that this loop ends\n throw (\"Bad character: \" + n);\n }\n curRow = A;\n rewindMarker = true;\n }\n northingValue += 100000.0;\n }\n\n return northingValue;\n}\n\n/**\n * The function getMinNorthing returns the minimum northing value of a MGRS\n * zone.\n *\n * Ported from Geotrans' c Lattitude_Band_Value structure table.\n *\n * @private\n * @param {char} zoneLetter The MGRS zone to get the min northing for.\n * @return {number}\n */\nfunction getMinNorthing(zoneLetter) {\n var northing;\n switch (zoneLetter) {\n case 'C':\n northing = 1100000.0;\n break;\n case 'D':\n northing = 2000000.0;\n break;\n case 'E':\n northing = 2800000.0;\n break;\n case 'F':\n northing = 3700000.0;\n break;\n case 'G':\n northing = 4600000.0;\n break;\n case 'H':\n northing = 5500000.0;\n break;\n case 'J':\n northing = 6400000.0;\n break;\n case 'K':\n northing = 7300000.0;\n break;\n case 'L':\n northing = 8200000.0;\n break;\n case 'M':\n northing = 9100000.0;\n break;\n case 'N':\n northing = 0.0;\n break;\n case 'P':\n northing = 800000.0;\n break;\n case 'Q':\n northing = 1700000.0;\n break;\n case 'R':\n northing = 2600000.0;\n break;\n case 'S':\n northing = 3500000.0;\n break;\n case 'T':\n northing = 4400000.0;\n break;\n case 'U':\n northing = 5300000.0;\n break;\n case 'V':\n northing = 6200000.0;\n break;\n case 'W':\n northing = 7000000.0;\n break;\n case 'X':\n northing = 7900000.0;\n break;\n default:\n northing = -1.0;\n }\n if (northing >= 0.0) {\n return northing;\n }\n else {\n throw (\"Invalid zone letter: \" + zoneLetter);\n }\n\n}\n","import { toPoint, forward } from 'mgrs';\n\n/**\n * @deprecated v3.0.0 - use proj4.toPoint instead\n * @param {number | import('./core').TemplateCoordinates | string} x\n * @param {number} [y]\n * @param {number} [z]\n */\nfunction Point(x, y, z) {\n if (!(this instanceof Point)) {\n return new Point(x, y, z);\n }\n if (Array.isArray(x)) {\n this.x = x[0];\n this.y = x[1];\n this.z = x[2] || 0.0;\n } else if (typeof x === 'object') {\n this.x = x.x;\n this.y = x.y;\n this.z = x.z || 0.0;\n } else if (typeof x === 'string' && typeof y === 'undefined') {\n var coords = x.split(',');\n this.x = parseFloat(coords[0]);\n this.y = parseFloat(coords[1]);\n this.z = parseFloat(coords[2]) || 0.0;\n } else {\n this.x = x;\n this.y = y;\n this.z = z || 0.0;\n }\n console.warn('proj4.Point will be removed in version 3, use proj4.toPoint');\n}\n\nPoint.fromMGRS = function (mgrsStr) {\n return new Point(toPoint(mgrsStr));\n};\nPoint.prototype.toMGRS = function (accuracy) {\n return forward([this.x, this.y], accuracy);\n};\nexport default Point;\n","var C00 = 1;\nvar C02 = 0.25;\nvar C04 = 0.046875;\nvar C06 = 0.01953125;\nvar C08 = 0.01068115234375;\nvar C22 = 0.75;\nvar C44 = 0.46875;\nvar C46 = 0.01302083333333333333;\nvar C48 = 0.00712076822916666666;\nvar C66 = 0.36458333333333333333;\nvar C68 = 0.00569661458333333333;\nvar C88 = 0.3076171875;\n\nexport default function (es) {\n var en = [];\n en[0] = C00 - es * (C02 + es * (C04 + es * (C06 + es * C08)));\n en[1] = es * (C22 - es * (C04 + es * (C06 + es * C08)));\n var t = es * es;\n en[2] = t * (C44 - es * (C46 + es * C48));\n t *= es;\n en[3] = t * (C66 - es * C68);\n en[4] = t * es * C88;\n return en;\n}\n","export default function (phi, sphi, cphi, en) {\n cphi *= sphi;\n sphi *= sphi;\n return (en[0] * phi - cphi * (en[1] + sphi * (en[2] + sphi * (en[3] + sphi * en[4]))));\n}\n","import pj_mlfn from './pj_mlfn';\nimport { EPSLN } from '../constants/values';\n\nvar MAX_ITER = 20;\n\nexport default function (arg, es, en) {\n var k = 1 / (1 - es);\n var phi = arg;\n for (var i = MAX_ITER; i; --i) { /* rarely goes over 2 iterations */\n var s = Math.sin(phi);\n var t = 1 - es * s * s;\n // t = this.pj_mlfn(phi, s, Math.cos(phi), en) - arg;\n // phi -= t * (t * Math.sqrt(t)) * k;\n t = (pj_mlfn(phi, s, Math.cos(phi), en) - arg) * (t * Math.sqrt(t)) * k;\n phi -= t;\n if (Math.abs(t) < EPSLN) {\n return phi;\n }\n }\n // ..reportError(\"cass:pj_inv_mlfn: Convergence error\");\n return phi;\n}\n","// Heavily based on this tmerc projection implementation\n// https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/tmerc.js\n\nimport pj_enfn from '../common/pj_enfn';\nimport pj_mlfn from '../common/pj_mlfn';\nimport pj_inv_mlfn from '../common/pj_inv_mlfn';\nimport adjust_lon from '../common/adjust_lon';\n\nimport { EPSLN, HALF_PI } from '../constants/values';\nimport sign from '../common/sign';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} es\n * @property {Array<number>} en\n * @property {number} ml0\n */\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n this.x0 = this.x0 !== undefined ? this.x0 : 0;\n this.y0 = this.y0 !== undefined ? this.y0 : 0;\n this.long0 = this.long0 !== undefined ? this.long0 : 0;\n this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;\n\n if (this.es) {\n this.en = pj_enfn(this.es);\n this.ml0 = pj_mlfn(this.lat0, Math.sin(this.lat0), Math.cos(this.lat0), this.en);\n }\n}\n\n/**\n Transverse Mercator Forward - long/lat to x/y\n long/lat in radians\n */\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n\n var delta_lon = adjust_lon(lon - this.long0, this.over);\n var con;\n var x, y;\n var sin_phi = Math.sin(lat);\n var cos_phi = Math.cos(lat);\n\n if (!this.es) {\n var b = cos_phi * Math.sin(delta_lon);\n\n if ((Math.abs(Math.abs(b) - 1)) < EPSLN) {\n return (93);\n } else {\n x = 0.5 * this.a * this.k0 * Math.log((1 + b) / (1 - b)) + this.x0;\n y = cos_phi * Math.cos(delta_lon) / Math.sqrt(1 - Math.pow(b, 2));\n b = Math.abs(y);\n\n if (b >= 1) {\n if ((b - 1) > EPSLN) {\n return (93);\n } else {\n y = 0;\n }\n } else {\n y = Math.acos(y);\n }\n\n if (lat < 0) {\n y = -y;\n }\n\n y = this.a * this.k0 * (y - this.lat0) + this.y0;\n }\n } else {\n var al = cos_phi * delta_lon;\n var als = Math.pow(al, 2);\n var c = this.ep2 * Math.pow(cos_phi, 2);\n var cs = Math.pow(c, 2);\n var tq = Math.abs(cos_phi) > EPSLN ? Math.tan(lat) : 0;\n var t = Math.pow(tq, 2);\n var ts = Math.pow(t, 2);\n con = 1 - this.es * Math.pow(sin_phi, 2);\n al = al / Math.sqrt(con);\n var ml = pj_mlfn(lat, sin_phi, cos_phi, this.en);\n\n x = this.a * (this.k0 * al * (1\n + als / 6 * (1 - t + c\n + als / 20 * (5 - 18 * t + ts + 14 * c - 58 * t * c\n + als / 42 * (61 + 179 * ts - ts * t - 479 * t)))))\n + this.x0;\n\n y = this.a * (this.k0 * (ml - this.ml0\n + sin_phi * delta_lon * al / 2 * (1\n + als / 12 * (5 - t + 9 * c + 4 * cs\n + als / 30 * (61 + ts - 58 * t + 270 * c - 330 * t * c\n + als / 56 * (1385 + 543 * ts - ts * t - 3111 * t))))))\n + this.y0;\n }\n\n p.x = x;\n p.y = y;\n\n return p;\n}\n\n/**\n Transverse Mercator Inverse - x/y to long/lat\n */\nexport function inverse(p) {\n var con, phi;\n var lat, lon;\n var x = (p.x - this.x0) * (1 / this.a);\n var y = (p.y - this.y0) * (1 / this.a);\n\n if (!this.es) {\n var f = Math.exp(x / this.k0);\n var g = 0.5 * (f - 1 / f);\n var temp = this.lat0 + y / this.k0;\n var h = Math.cos(temp);\n con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));\n lat = Math.asin(con);\n\n if (y < 0) {\n lat = -lat;\n }\n\n if ((g === 0) && (h === 0)) {\n lon = 0;\n } else {\n lon = adjust_lon(Math.atan2(g, h) + this.long0, this.over);\n }\n } else { // ellipsoidal form\n con = this.ml0 + y / this.k0;\n phi = pj_inv_mlfn(con, this.es, this.en);\n\n if (Math.abs(phi) < HALF_PI) {\n var sin_phi = Math.sin(phi);\n var cos_phi = Math.cos(phi);\n var tan_phi = Math.abs(cos_phi) > EPSLN ? Math.tan(phi) : 0;\n var c = this.ep2 * Math.pow(cos_phi, 2);\n var cs = Math.pow(c, 2);\n var t = Math.pow(tan_phi, 2);\n var ts = Math.pow(t, 2);\n con = 1 - this.es * Math.pow(sin_phi, 2);\n var d = x * Math.sqrt(con) / this.k0;\n var ds = Math.pow(d, 2);\n con = con * tan_phi;\n\n lat = phi - (con * ds / (1 - this.es)) * 0.5 * (1\n - ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs\n - ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c\n - ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));\n\n lon = adjust_lon(this.long0 + (d * (1\n - ds / 6 * (1 + 2 * t + c\n - ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c\n - ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi), this.over);\n } else {\n lat = HALF_PI * sign(y);\n lon = 0;\n }\n }\n\n p.x = lon;\n p.y = lat;\n\n return p;\n}\n\nexport var names = ['Fast_Transverse_Mercator', 'Fast Transverse Mercator'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","export default function (x) {\n var r = Math.exp(x);\n r = (r - 1 / r) / 2;\n return r;\n}\n","export default function (x, y) {\n x = Math.abs(x);\n y = Math.abs(y);\n var a = Math.max(x, y);\n var b = Math.min(x, y) / (a ? a : 1);\n\n return a * Math.sqrt(1 + Math.pow(b, 2));\n}\n","export default function (x) {\n var y = 1 + x;\n var z = y - 1;\n\n return z === 0 ? x : x * Math.log(y) / z;\n}\n","import hypot from './hypot';\nimport log1py from './log1py';\n\nexport default function (x) {\n var y = Math.abs(x);\n y = log1py(y * (1 + y / (hypot(1, y) + 1)));\n\n return x < 0 ? -y : y;\n}\n","export default function (pp, B) {\n var cos_2B = 2 * Math.cos(2 * B);\n var i = pp.length - 1;\n var h1 = pp[i];\n var h2 = 0;\n var h;\n\n while (--i >= 0) {\n h = -h2 + cos_2B * h1 + pp[i];\n h2 = h1;\n h1 = h;\n }\n\n return (B + h * Math.sin(2 * B));\n}\n","export default function (pp, arg_r) {\n var r = 2 * Math.cos(arg_r);\n var i = pp.length - 1;\n var hr1 = pp[i];\n var hr2 = 0;\n var hr;\n\n while (--i >= 0) {\n hr = -hr2 + r * hr1 + pp[i];\n hr2 = hr1;\n hr1 = hr;\n }\n\n return Math.sin(arg_r) * hr;\n}\n","export default function (x) {\n var r = Math.exp(x);\n r = (r + 1 / r) / 2;\n return r;\n}\n","import sinh from './sinh';\nimport cosh from './cosh';\n\nexport default function (pp, arg_r, arg_i) {\n var sin_arg_r = Math.sin(arg_r);\n var cos_arg_r = Math.cos(arg_r);\n var sinh_arg_i = sinh(arg_i);\n var cosh_arg_i = cosh(arg_i);\n var r = 2 * cos_arg_r * cosh_arg_i;\n var i = -2 * sin_arg_r * sinh_arg_i;\n var j = pp.length - 1;\n var hr = pp[j];\n var hi1 = 0;\n var hr1 = 0;\n var hi = 0;\n var hr2;\n var hi2;\n\n while (--j >= 0) {\n hr2 = hr1;\n hi2 = hi1;\n hr1 = hr;\n hi1 = hi;\n hr = -hr2 + r * hr1 - i * hi1 + pp[j];\n hi = -hi2 + i * hr1 + r * hi1;\n }\n\n r = sin_arg_r * cosh_arg_i;\n i = cos_arg_r * sinh_arg_i;\n\n return [r * hr - i * hi, r * hi + i * hr];\n}\n","// Heavily based on this etmerc projection implementation\n// https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/etmerc.js\n\nimport tmerc from '../projections/tmerc';\nimport sinh from '../common/sinh';\nimport hypot from '../common/hypot';\nimport asinhy from '../common/asinhy';\nimport gatg from '../common/gatg';\nimport clens from '../common/clens';\nimport clens_cmplx from '../common/clens_cmplx';\nimport adjust_lon from '../common/adjust_lon';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} es\n * @property {Array<number>} cbg\n * @property {Array<number>} cgb\n * @property {Array<number>} utg\n * @property {Array<number>} gtu\n * @property {number} Qn\n * @property {number} Zb\n */\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n if (!this.approx && (isNaN(this.es) || this.es <= 0)) {\n throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION[\"Fast_Transverse_Mercator\"] in the WKT.');\n }\n if (this.approx) {\n // When '+approx' is set, use tmerc instead\n tmerc.init.apply(this);\n this.forward = tmerc.forward;\n this.inverse = tmerc.inverse;\n }\n\n this.x0 = this.x0 !== undefined ? this.x0 : 0;\n this.y0 = this.y0 !== undefined ? this.y0 : 0;\n this.long0 = this.long0 !== undefined ? this.long0 : 0;\n this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;\n\n this.cgb = [];\n this.cbg = [];\n this.utg = [];\n this.gtu = [];\n\n var f = this.es / (1 + Math.sqrt(1 - this.es));\n var n = f / (2 - f);\n var np = n;\n\n this.cgb[0] = n * (2 + n * (-2 / 3 + n * (-2 + n * (116 / 45 + n * (26 / 45 + n * (-2854 / 675))))));\n this.cbg[0] = n * (-2 + n * (2 / 3 + n * (4 / 3 + n * (-82 / 45 + n * (32 / 45 + n * (4642 / 4725))))));\n\n np = np * n;\n this.cgb[1] = np * (7 / 3 + n * (-8 / 5 + n * (-227 / 45 + n * (2704 / 315 + n * (2323 / 945)))));\n this.cbg[1] = np * (5 / 3 + n * (-16 / 15 + n * (-13 / 9 + n * (904 / 315 + n * (-1522 / 945)))));\n\n np = np * n;\n this.cgb[2] = np * (56 / 15 + n * (-136 / 35 + n * (-1262 / 105 + n * (73814 / 2835))));\n this.cbg[2] = np * (-26 / 15 + n * (34 / 21 + n * (8 / 5 + n * (-12686 / 2835))));\n\n np = np * n;\n this.cgb[3] = np * (4279 / 630 + n * (-332 / 35 + n * (-399572 / 14175)));\n this.cbg[3] = np * (1237 / 630 + n * (-12 / 5 + n * (-24832 / 14175)));\n\n np = np * n;\n this.cgb[4] = np * (4174 / 315 + n * (-144838 / 6237));\n this.cbg[4] = np * (-734 / 315 + n * (109598 / 31185));\n\n np = np * n;\n this.cgb[5] = np * (601676 / 22275);\n this.cbg[5] = np * (444337 / 155925);\n\n np = Math.pow(n, 2);\n this.Qn = this.k0 / (1 + n) * (1 + np * (1 / 4 + np * (1 / 64 + np / 256)));\n\n this.utg[0] = n * (-0.5 + n * (2 / 3 + n * (-37 / 96 + n * (1 / 360 + n * (81 / 512 + n * (-96199 / 604800))))));\n this.gtu[0] = n * (0.5 + n * (-2 / 3 + n * (5 / 16 + n * (41 / 180 + n * (-127 / 288 + n * (7891 / 37800))))));\n\n this.utg[1] = np * (-1 / 48 + n * (-1 / 15 + n * (437 / 1440 + n * (-46 / 105 + n * (1118711 / 3870720)))));\n this.gtu[1] = np * (13 / 48 + n * (-3 / 5 + n * (557 / 1440 + n * (281 / 630 + n * (-1983433 / 1935360)))));\n\n np = np * n;\n this.utg[2] = np * (-17 / 480 + n * (37 / 840 + n * (209 / 4480 + n * (-5569 / 90720))));\n this.gtu[2] = np * (61 / 240 + n * (-103 / 140 + n * (15061 / 26880 + n * (167603 / 181440))));\n\n np = np * n;\n this.utg[3] = np * (-4397 / 161280 + n * (11 / 504 + n * (830251 / 7257600)));\n this.gtu[3] = np * (49561 / 161280 + n * (-179 / 168 + n * (6601661 / 7257600)));\n\n np = np * n;\n this.utg[4] = np * (-4583 / 161280 + n * (108847 / 3991680));\n this.gtu[4] = np * (34729 / 80640 + n * (-3418889 / 1995840));\n\n np = np * n;\n this.utg[5] = np * (-20648693 / 638668800);\n this.gtu[5] = np * (212378941 / 319334400);\n\n var Z = gatg(this.cbg, this.lat0);\n this.Zb = -this.Qn * (Z + clens(this.gtu, 2 * Z));\n}\n\nexport function forward(p) {\n var Ce = adjust_lon(p.x - this.long0, this.over);\n var Cn = p.y;\n\n Cn = gatg(this.cbg, Cn);\n var sin_Cn = Math.sin(Cn);\n var cos_Cn = Math.cos(Cn);\n var sin_Ce = Math.sin(Ce);\n var cos_Ce = Math.cos(Ce);\n\n Cn = Math.atan2(sin_Cn, cos_Ce * cos_Cn);\n Ce = Math.atan2(sin_Ce * cos_Cn, hypot(sin_Cn, cos_Cn * cos_Ce));\n Ce = asinhy(Math.tan(Ce));\n\n var tmp = clens_cmplx(this.gtu, 2 * Cn, 2 * Ce);\n\n Cn = Cn + tmp[0];\n Ce = Ce + tmp[1];\n\n var x;\n var y;\n\n if (Math.abs(Ce) <= 2.623395162778) {\n x = this.a * (this.Qn * Ce) + this.x0;\n y = this.a * (this.Qn * Cn + this.Zb) + this.y0;\n } else {\n x = Infinity;\n y = Infinity;\n }\n\n p.x = x;\n p.y = y;\n\n return p;\n}\n\nexport function inverse(p) {\n var Ce = (p.x - this.x0) * (1 / this.a);\n var Cn = (p.y - this.y0) * (1 / this.a);\n\n Cn = (Cn - this.Zb) / this.Qn;\n Ce = Ce / this.Qn;\n\n var lon;\n var lat;\n\n if (Math.abs(Ce) <= 2.623395162778) {\n var tmp = clens_cmplx(this.utg, 2 * Cn, 2 * Ce);\n\n Cn = Cn + tmp[0];\n Ce = Ce + tmp[1];\n Ce = Math.atan(sinh(Ce));\n\n var sin_Cn = Math.sin(Cn);\n var cos_Cn = Math.cos(Cn);\n var sin_Ce = Math.sin(Ce);\n var cos_Ce = Math.cos(Ce);\n\n Cn = Math.atan2(sin_Cn * cos_Ce, hypot(sin_Ce, cos_Ce * cos_Cn));\n Ce = Math.atan2(sin_Ce, cos_Ce * cos_Cn);\n\n lon = adjust_lon(Ce + this.long0, this.over);\n lat = gatg(this.cgb, Cn);\n } else {\n lon = Infinity;\n lat = Infinity;\n }\n\n p.x = lon;\n p.y = lat;\n\n return p;\n}\n\nexport var names = ['Extended_Transverse_Mercator', 'Extended Transverse Mercator', 'etmerc', 'Transverse_Mercator', 'Transverse Mercator', 'Gauss Kruger', 'Gauss_Kruger', 'tmerc'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import adjust_lon from './adjust_lon';\n\nexport default function (zone, lon) {\n if (zone === undefined) {\n zone = Math.floor((adjust_lon(lon) + Math.PI) * 30 / Math.PI) + 1;\n\n if (zone < 0) {\n return 0;\n } else if (zone > 60) {\n return 60;\n }\n }\n return zone;\n}\n","import adjust_zone from '../common/adjust_zone';\nimport etmerc from './etmerc';\nexport var dependsOn = 'etmerc';\nimport { D2R } from '../constants/values';\n\n/** @this {import('../defs.js').ProjectionDefinition} */\nexport function init() {\n var zone = adjust_zone(this.zone, this.long0);\n if (zone === undefined) {\n throw new Error('unknown utm zone');\n }\n this.lat0 = 0;\n this.long0 = ((6 * Math.abs(zone)) - 183) * D2R;\n this.x0 = 500000;\n this.y0 = this.utmSouth ? 10000000 : 0;\n this.k0 = 0.9996;\n\n etmerc.init.apply(this);\n this.forward = etmerc.forward;\n this.inverse = etmerc.inverse;\n}\n\nexport var names = ['Universal Transverse Mercator System', 'utm'];\nexport default {\n init: init,\n names: names,\n dependsOn: dependsOn\n};\n","export default function (esinp, exp) {\n return (Math.pow((1 - esinp) / (1 + esinp), exp));\n}\n","import srat from '../common/srat';\nvar MAX_ITER = 20;\nimport { HALF_PI, FORTPI } from '../constants/values';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} rc\n * @property {number} C\n * @property {number} phic0\n * @property {number} ratexp\n * @property {number} K\n * @property {number} e\n * @property {number} es\n */\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n var sphi = Math.sin(this.lat0);\n var cphi = Math.cos(this.lat0);\n cphi *= cphi;\n this.rc = Math.sqrt(1 - this.es) / (1 - this.es * sphi * sphi);\n this.C = Math.sqrt(1 + this.es * cphi * cphi / (1 - this.es));\n this.phic0 = Math.asin(sphi / this.C);\n this.ratexp = 0.5 * this.C * this.e;\n this.K = Math.tan(0.5 * this.phic0 + FORTPI) / (Math.pow(Math.tan(0.5 * this.lat0 + FORTPI), this.C) * srat(this.e * sphi, this.ratexp));\n}\n\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n\n p.y = 2 * Math.atan(this.K * Math.pow(Math.tan(0.5 * lat + FORTPI), this.C) * srat(this.e * Math.sin(lat), this.ratexp)) - HALF_PI;\n p.x = this.C * lon;\n return p;\n}\n\nexport function inverse(p) {\n var DEL_TOL = 1e-14;\n var lon = p.x / this.C;\n var lat = p.y;\n var num = Math.pow(Math.tan(0.5 * lat + FORTPI) / this.K, 1 / this.C);\n for (var i = MAX_ITER; i > 0; --i) {\n lat = 2 * Math.atan(num * srat(this.e * Math.sin(p.y), -0.5 * this.e)) - HALF_PI;\n if (Math.abs(lat - p.y) < DEL_TOL) {\n break;\n }\n p.y = lat;\n }\n /* convergence failed */\n if (!i) {\n return null;\n }\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = ['gauss'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import gauss from './gauss';\nimport adjust_lon from '../common/adjust_lon';\nimport hypot from '../common/hypot';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} sinc0\n * @property {number} cosc0\n * @property {number} R2\n * @property {number} rc\n * @property {number} phic0\n */\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n gauss.init.apply(this);\n if (!this.rc) {\n return;\n }\n this.sinc0 = Math.sin(this.phic0);\n this.cosc0 = Math.cos(this.phic0);\n this.R2 = 2 * this.rc;\n if (!this.title) {\n this.title = 'Oblique Stereographic Alternative';\n }\n}\n\nexport function forward(p) {\n var sinc, cosc, cosl, k;\n p.x = adjust_lon(p.x - this.long0, this.over);\n gauss.forward.apply(this, [p]);\n sinc = Math.sin(p.y);\n cosc = Math.cos(p.y);\n cosl = Math.cos(p.x);\n k = this.k0 * this.R2 / (1 + this.sinc0 * sinc + this.cosc0 * cosc * cosl);\n p.x = k * cosc * Math.sin(p.x);\n p.y = k * (this.cosc0 * sinc - this.sinc0 * cosc * cosl);\n p.x = this.a * p.x + this.x0;\n p.y = this.a * p.y + this.y0;\n return p;\n}\n\nexport function inverse(p) {\n var sinc, cosc, lon, lat, rho;\n p.x = (p.x - this.x0) / this.a;\n p.y = (p.y - this.y0) / this.a;\n\n p.x /= this.k0;\n p.y /= this.k0;\n if ((rho = hypot(p.x, p.y))) {\n var c = 2 * Math.atan2(rho, this.R2);\n sinc = Math.sin(c);\n cosc = Math.cos(c);\n lat = Math.asin(cosc * this.sinc0 + p.y * sinc * this.cosc0 / rho);\n lon = Math.atan2(p.x * sinc, rho * this.cosc0 * cosc - p.y * this.sinc0 * sinc);\n } else {\n lat = this.phic0;\n lon = 0;\n }\n\n p.x = lon;\n p.y = lat;\n gauss.inverse.apply(this, [p]);\n p.x = adjust_lon(p.x + this.long0, this.over);\n return p;\n}\n\nexport var names = ['Stereographic_North_Pole', 'Oblique_Stereographic', 'sterea', 'Oblique Stereographic Alternative', 'Double_Stereographic'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import { EPSLN, HALF_PI } from '../constants/values';\n\nimport sign from '../common/sign';\nimport msfnz from '../common/msfnz';\nimport tsfnz from '../common/tsfnz';\nimport phi2z from '../common/phi2z';\nimport adjust_lon from '../common/adjust_lon';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} coslat0\n * @property {number} sinlat0\n * @property {number} ms1\n * @property {number} X0\n * @property {number} cosX0\n * @property {number} sinX0\n * @property {number} con\n * @property {number} cons\n * @property {number} e\n */\n\nexport function ssfn_(phit, sinphi, eccen) {\n sinphi *= eccen;\n return (Math.tan(0.5 * (HALF_PI + phit)) * Math.pow((1 - sinphi) / (1 + sinphi), 0.5 * eccen));\n}\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n // setting default parameters\n this.x0 = this.x0 || 0;\n this.y0 = this.y0 || 0;\n this.lat0 = this.lat0 || 0;\n this.long0 = this.long0 || 0;\n\n this.coslat0 = Math.cos(this.lat0);\n this.sinlat0 = Math.sin(this.lat0);\n if (this.sphere) {\n if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {\n this.k0 = 0.5 * (1 + sign(this.lat0) * Math.sin(this.lat_ts));\n }\n } else {\n if (Math.abs(this.coslat0) <= EPSLN) {\n if (this.lat0 > 0) {\n // North pole\n // trace('stere:north pole');\n this.con = 1;\n } else {\n // South pole\n // trace('stere:south pole');\n this.con = -1;\n }\n }\n this.cons = Math.sqrt(Math.pow(1 + this.e, 1 + this.e) * Math.pow(1 - this.e, 1 - this.e));\n if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN && Math.abs(Math.cos(this.lat_ts)) > EPSLN) {\n // When k0 is 1 (default value) and lat_ts is a vaild number and lat0 is at a pole and lat_ts is not at a pole\n // Recalculate k0 using formula 21-35 from p161 of Snyder, 1987\n this.k0 = 0.5 * this.cons * msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)) / tsfnz(this.e, this.con * this.lat_ts, this.con * Math.sin(this.lat_ts));\n }\n this.ms1 = msfnz(this.e, this.sinlat0, this.coslat0);\n this.X0 = 2 * Math.atan(ssfn_(this.lat0, this.sinlat0, this.e)) - HALF_PI;\n this.cosX0 = Math.cos(this.X0);\n this.sinX0 = Math.sin(this.X0);\n }\n}\n\n// Stereographic forward equations--mapping lat,long to x,y\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n var sinlat = Math.sin(lat);\n var coslat = Math.cos(lat);\n var A, X, sinX, cosX, ts, rh;\n var dlon = adjust_lon(lon - this.long0, this.over);\n\n if (Math.abs(Math.abs(lon - this.long0) - Math.PI) <= EPSLN && Math.abs(lat + this.lat0) <= EPSLN) {\n // case of the origine point\n // trace('stere:this is the origin point');\n p.x = NaN;\n p.y = NaN;\n return p;\n }\n if (this.sphere) {\n // trace('stere:sphere case');\n A = 2 * this.k0 / (1 + this.sinlat0 * sinlat + this.coslat0 * coslat * Math.cos(dlon));\n p.x = this.a * A * coslat * Math.sin(dlon) + this.x0;\n p.y = this.a * A * (this.coslat0 * sinlat - this.sinlat0 * coslat * Math.cos(dlon)) + this.y0;\n return p;\n } else {\n X = 2 * Math.atan(ssfn_(lat, sinlat, this.e)) - HALF_PI;\n cosX = Math.cos(X);\n sinX = Math.sin(X);\n if (Math.abs(this.coslat0) <= EPSLN) {\n ts = tsfnz(this.e, lat * this.con, this.con * sinlat);\n rh = 2 * this.a * this.k0 * ts / this.cons;\n p.x = this.x0 + rh * Math.sin(lon - this.long0);\n p.y = this.y0 - this.con * rh * Math.cos(lon - this.long0);\n // trace(p.toString());\n return p;\n } else if (Math.abs(this.sinlat0) < EPSLN) {\n // Eq\n // trace('stere:equateur');\n A = 2 * this.a * this.k0 / (1 + cosX * Math.cos(dlon));\n p.y = A * sinX;\n } else {\n // other case\n // trace('stere:normal case');\n A = 2 * this.a * this.k0 * this.ms1 / (this.cosX0 * (1 + this.sinX0 * sinX + this.cosX0 * cosX * Math.cos(dlon)));\n p.y = A * (this.cosX0 * sinX - this.sinX0 * cosX * Math.cos(dlon)) + this.y0;\n }\n p.x = A * cosX * Math.sin(dlon) + this.x0;\n }\n // trace(p.toString());\n return p;\n}\n\n//* Stereographic inverse equations--mapping x,y to lat/long\nexport function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat, ts, ce, Chi;\n var rh = Math.sqrt(p.x * p.x + p.y * p.y);\n if (this.sphere) {\n var c = 2 * Math.atan(rh / (2 * this.a * this.k0));\n lon = this.long0;\n lat = this.lat0;\n if (rh <= EPSLN) {\n p.x = lon;\n p.y = lat;\n return p;\n }\n lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);\n if (Math.abs(this.coslat0) < EPSLN) {\n if (this.lat0 > 0) {\n lon = adjust_lon(this.long0 + Math.atan2(p.x, -1 * p.y), this.over);\n } else {\n lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y), this.over);\n }\n } else {\n lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c)), this.over);\n }\n p.x = lon;\n p.y = lat;\n return p;\n } else {\n if (Math.abs(this.coslat0) <= EPSLN) {\n if (rh <= EPSLN) {\n lat = this.lat0;\n lon = this.long0;\n p.x = lon;\n p.y = lat;\n // trace(p.toString());\n return p;\n }\n p.x *= this.con;\n p.y *= this.con;\n ts = rh * this.cons / (2 * this.a * this.k0);\n lat = this.con * phi2z(this.e, ts);\n lon = this.con * adjust_lon(this.con * this.long0 + Math.atan2(p.x, -1 * p.y), this.over);\n } else {\n ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));\n lon = this.long0;\n if (rh <= EPSLN) {\n Chi = this.X0;\n } else {\n Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);\n lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce)), this.over);\n }\n lat = -1 * phi2z(this.e, Math.tan(0.5 * (HALF_PI + Chi)));\n }\n }\n p.x = lon;\n p.y = lat;\n\n // trace(p.toString());\n return p;\n}\n\nexport var names = ['stere', 'Stereographic_South_Pole', 'Polar_Stereographic_variant_A', 'Polar_Stereographic_variant_B', 'Polar_Stereographic'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names,\n ssfn_: ssfn_\n};\n","/*\n references:\n Formules et constantes pour le Calcul pour la\n projection cylindrique conforme à axe oblique et pour la transformation entre\n des systèmes de référence.\n http://www.swisstopo.admin.ch/internet/swisstopo/fr/home/topics/survey/sys/refsys/switzerland.parsysrelated1.31216.downloadList.77004.DownloadFile.tmp/swissprojectionfr.pdf\n */\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} lambda0\n * @property {number} e\n * @property {number} R\n * @property {number} b0\n * @property {number} K\n */\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n var phy0 = this.lat0;\n this.lambda0 = this.long0;\n var sinPhy0 = Math.sin(phy0);\n var semiMajorAxis = this.a;\n var invF = this.rf;\n var flattening = 1 / invF;\n var e2 = 2 * flattening - Math.pow(flattening, 2);\n var e = this.e = Math.sqrt(e2);\n this.R = this.k0 * semiMajorAxis * Math.sqrt(1 - e2) / (1 - e2 * Math.pow(sinPhy0, 2));\n this.alpha = Math.sqrt(1 + e2 / (1 - e2) * Math.pow(Math.cos(phy0), 4));\n this.b0 = Math.asin(sinPhy0 / this.alpha);\n var k1 = Math.log(Math.tan(Math.PI / 4 + this.b0 / 2));\n var k2 = Math.log(Math.tan(Math.PI / 4 + phy0 / 2));\n var k3 = Math.log((1 + e * sinPhy0) / (1 - e * sinPhy0));\n this.K = k1 - this.alpha * k2 + this.alpha * e / 2 * k3;\n}\n\nexport function forward(p) {\n var Sa1 = Math.log(Math.tan(Math.PI / 4 - p.y / 2));\n var Sa2 = this.e / 2 * Math.log((1 + this.e * Math.sin(p.y)) / (1 - this.e * Math.sin(p.y)));\n var S = -this.alpha * (Sa1 + Sa2) + this.K;\n\n // spheric latitude\n var b = 2 * (Math.atan(Math.exp(S)) - Math.PI / 4);\n\n // spheric longitude\n var I = this.alpha * (p.x - this.lambda0);\n\n // psoeudo equatorial rotation\n var rotI = Math.atan(Math.sin(I) / (Math.sin(this.b0) * Math.tan(b) + Math.cos(this.b0) * Math.cos(I)));\n\n var rotB = Math.asin(Math.cos(this.b0) * Math.sin(b) - Math.sin(this.b0) * Math.cos(b) * Math.cos(I));\n\n p.y = this.R / 2 * Math.log((1 + Math.sin(rotB)) / (1 - Math.sin(rotB))) + this.y0;\n p.x = this.R * rotI + this.x0;\n return p;\n}\n\nexport function inverse(p) {\n var Y = p.x - this.x0;\n var X = p.y - this.y0;\n\n var rotI = Y / this.R;\n var rotB = 2 * (Math.atan(Math.exp(X / this.R)) - Math.PI / 4);\n\n var b = Math.asin(Math.cos(this.b0) * Math.sin(rotB) + Math.sin(this.b0) * Math.cos(rotB) * Math.cos(rotI));\n var I = Math.atan(Math.sin(rotI) / (Math.cos(this.b0) * Math.cos(rotI) - Math.sin(this.b0) * Math.tan(rotB)));\n\n var lambda = this.lambda0 + I / this.alpha;\n\n var S = 0;\n var phy = b;\n var prevPhy = -1000;\n var iteration = 0;\n while (Math.abs(phy - prevPhy) > 0.0000001) {\n if (++iteration > 20) {\n // ...reportError(\"omercFwdInfinity\");\n return;\n }\n // S = Math.log(Math.tan(Math.PI / 4 + phy / 2));\n S = 1 / this.alpha * (Math.log(Math.tan(Math.PI / 4 + b / 2)) - this.K) + this.e * Math.log(Math.tan(Math.PI / 4 + Math.asin(this.e * Math.sin(phy)) / 2));\n prevPhy = phy;\n phy = 2 * Math.atan(Math.exp(S)) - Math.PI / 2;\n }\n\n p.x = lambda;\n p.y = phy;\n return p;\n}\n\nexport var names = ['somerc'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import tsfnz from '../common/tsfnz';\nimport adjust_lon from '../common/adjust_lon';\nimport phi2z from '../common/phi2z';\nimport { EPSLN, HALF_PI, TWO_PI, FORTPI } from '../constants/values';\nimport { getNormalizedProjName } from '../projections';\n\n/**\n * @typedef {Object} LocalThis\n * @property {boolean} no_off\n * @property {boolean} no_rot\n * @property {number} rectified_grid_angle\n * @property {number} es\n * @property {number} A\n * @property {number} B\n * @property {number} E\n * @property {number} e\n * @property {number} lam0\n * @property {number} singam\n * @property {number} cosgam\n * @property {number} sinrot\n * @property {number} cosrot\n * @property {number} rB\n * @property {number} ArB\n * @property {number} BrA\n * @property {number} u_0\n * @property {number} v_pole_n\n * @property {number} v_pole_s\n */\n\nvar TOL = 1e-7;\n\nfunction isTypeA(P) {\n var typeAProjections = ['Hotine_Oblique_Mercator', 'Hotine_Oblique_Mercator_variant_A', 'Hotine_Oblique_Mercator_Azimuth_Natural_Origin'];\n var projectionName = typeof P.projName === 'object' ? Object.keys(P.projName)[0] : P.projName;\n\n return 'no_uoff' in P || 'no_off' in P || typeAProjections.indexOf(projectionName) !== -1 || typeAProjections.indexOf(getNormalizedProjName(projectionName)) !== -1;\n}\n\n/**\n * Initialize the Oblique Mercator projection\n * @this {import('../defs.js').ProjectionDefinition & LocalThis}\n */\nexport function init() {\n var con, com, cosph0, D, F, H, L, sinph0, p, J, gamma = 0,\n gamma0, lamc = 0, lam1 = 0, lam2 = 0, phi1 = 0, phi2 = 0, alpha_c = 0;\n\n // only Type A uses the no_off or no_uoff property\n // https://github.com/OSGeo/proj.4/issues/104\n this.no_off = isTypeA(this);\n this.no_rot = 'no_rot' in this;\n\n var alp = false;\n if ('alpha' in this) {\n alp = true;\n }\n\n var gam = false;\n if ('rectified_grid_angle' in this) {\n gam = true;\n }\n\n if (alp) {\n alpha_c = this.alpha;\n }\n\n if (gam) {\n gamma = this.rectified_grid_angle;\n }\n\n if (alp || gam) {\n lamc = this.longc;\n } else {\n lam1 = this.long1;\n phi1 = this.lat1;\n lam2 = this.long2;\n phi2 = this.lat2;\n\n if (Math.abs(phi1 - phi2) <= TOL || (con = Math.abs(phi1)) <= TOL\n || Math.abs(con - HALF_PI) <= TOL || Math.abs(Math.abs(this.lat0) - HALF_PI) <= TOL\n || Math.abs(Math.abs(phi2) - HALF_PI) <= TOL) {\n throw new Error();\n }\n }\n\n var one_es = 1.0 - this.es;\n com = Math.sqrt(one_es);\n\n if (Math.abs(this.lat0) > EPSLN) {\n sinph0 = Math.sin(this.lat0);\n cosph0 = Math.cos(this.lat0);\n con = 1 - this.es * sinph0 * sinph0;\n this.B = cosph0 * cosph0;\n this.B = Math.sqrt(1 + this.es * this.B * this.B / one_es);\n this.A = this.B * this.k0 * com / con;\n D = this.B * com / (cosph0 * Math.sqrt(con));\n F = D * D - 1;\n\n if (F <= 0) {\n F = 0;\n } else {\n F = Math.sqrt(F);\n if (this.lat0 < 0) {\n F = -F;\n }\n }\n\n this.E = F += D;\n this.E *= Math.pow(tsfnz(this.e, this.lat0, sinph0), this.B);\n } else {\n this.B = 1 / com;\n this.A = this.k0;\n this.E = D = F = 1;\n }\n\n if (alp || gam) {\n if (alp) {\n gamma0 = Math.asin(Math.sin(alpha_c) / D);\n if (!gam) {\n gamma = alpha_c;\n }\n } else {\n gamma0 = gamma;\n alpha_c = Math.asin(D * Math.sin(gamma0));\n }\n this.lam0 = lamc - Math.asin(0.5 * (F - 1 / F) * Math.tan(gamma0)) / this.B;\n } else {\n H = Math.pow(tsfnz(this.e, phi1, Math.sin(phi1)), this.B);\n L = Math.pow(tsfnz(this.e, phi2, Math.sin(phi2)), this.B);\n F = this.E / H;\n p = (L - H) / (L + H);\n J = this.E * this.E;\n J = (J - L * H) / (J + L * H);\n con = lam1 - lam2;\n\n if (con < -Math.PI) {\n lam2 -= TWO_PI;\n } else if (con > Math.PI) {\n lam2 += TWO_PI;\n }\n\n this.lam0 = adjust_lon(0.5 * (lam1 + lam2) - Math.atan(J * Math.tan(0.5 * this.B * (lam1 - lam2)) / p) / this.B, this.over);\n gamma0 = Math.atan(2 * Math.sin(this.B * adjust_lon(lam1 - this.lam0, this.over)) / (F - 1 / F));\n gamma = alpha_c = Math.asin(D * Math.sin(gamma0));\n }\n\n this.singam = Math.sin(gamma0);\n this.cosgam = Math.cos(gamma0);\n this.sinrot = Math.sin(gamma);\n this.cosrot = Math.cos(gamma);\n\n this.rB = 1 / this.B;\n this.ArB = this.A * this.rB;\n this.BrA = 1 / this.ArB;\n\n if (this.no_off) {\n this.u_0 = 0;\n } else {\n this.u_0 = Math.abs(this.ArB * Math.atan(Math.sqrt(D * D - 1) / Math.cos(alpha_c)));\n\n if (this.lat0 < 0) {\n this.u_0 = -this.u_0;\n }\n }\n\n F = 0.5 * gamma0;\n this.v_pole_n = this.ArB * Math.log(Math.tan(FORTPI - F));\n this.v_pole_s = this.ArB * Math.log(Math.tan(FORTPI + F));\n}\n\n/* Oblique Mercator forward equations--mapping lat,long to x,y\n ---------------------------------------------------------- */\nexport function forward(p) {\n var coords = {};\n var S, T, U, V, W, temp, u, v;\n p.x = p.x - this.lam0;\n\n if (Math.abs(Math.abs(p.y) - HALF_PI) > EPSLN) {\n W = this.E / Math.pow(tsfnz(this.e, p.y, Math.sin(p.y)), this.B);\n\n temp = 1 / W;\n S = 0.5 * (W - temp);\n T = 0.5 * (W + temp);\n V = Math.sin(this.B * p.x);\n U = (S * this.singam - V * this.cosgam) / T;\n\n if (Math.abs(Math.abs(U) - 1.0) < EPSLN) {\n throw new Error();\n }\n\n v = 0.5 * this.ArB * Math.log((1 - U) / (1 + U));\n temp = Math.cos(this.B * p.x);\n\n if (Math.abs(temp) < TOL) {\n u = this.A * p.x;\n } else {\n u = this.ArB * Math.atan2((S * this.cosgam + V * this.singam), temp);\n }\n } else {\n v = p.y > 0 ? this.v_pole_n : this.v_pole_s;\n u = this.ArB * p.y;\n }\n\n if (this.no_rot) {\n coords.x = u;\n coords.y = v;\n } else {\n u -= this.u_0;\n coords.x = v * this.cosrot + u * this.sinrot;\n coords.y = u * this.cosrot - v * this.sinrot;\n }\n\n coords.x = (this.a * coords.x + this.x0);\n coords.y = (this.a * coords.y + this.y0);\n\n return coords;\n}\n\nexport function inverse(p) {\n var u, v, Qp, Sp, Tp, Vp, Up;\n var coords = {};\n\n p.x = (p.x - this.x0) * (1.0 / this.a);\n p.y = (p.y - this.y0) * (1.0 / this.a);\n\n if (this.no_rot) {\n v = p.y;\n u = p.x;\n } else {\n v = p.x * this.cosrot - p.y * this.sinrot;\n u = p.y * this.cosrot + p.x * this.sinrot + this.u_0;\n }\n\n Qp = Math.exp(-this.BrA * v);\n Sp = 0.5 * (Qp - 1 / Qp);\n Tp = 0.5 * (Qp + 1 / Qp);\n Vp = Math.sin(this.BrA * u);\n Up = (Vp * this.cosgam + Sp * this.singam) / Tp;\n\n if (Math.abs(Math.abs(Up) - 1) < EPSLN) {\n coords.x = 0;\n coords.y = Up < 0 ? -HALF_PI : HALF_PI;\n } else {\n coords.y = this.E / Math.sqrt((1 + Up) / (1 - Up));\n coords.y = phi2z(this.e, Math.pow(coords.y, 1 / this.B));\n\n if (coords.y === Infinity) {\n throw new Error();\n }\n\n coords.x = -this.rB * Math.atan2((Sp * this.cosgam - Vp * this.singam), Math.cos(this.BrA * u));\n }\n\n coords.x += this.lam0;\n\n return coords;\n}\n\nexport var names = ['Hotine_Oblique_Mercator', 'Hotine Oblique Mercator', 'Hotine_Oblique_Mercator_variant_A', 'Hotine_Oblique_Mercator_Variant_B', 'Hotine_Oblique_Mercator_Azimuth_Natural_Origin', 'Hotine_Oblique_Mercator_Two_Point_Natural_Origin', 'Hotine_Oblique_Mercator_Azimuth_Center', 'Oblique_Mercator', 'omerc'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import msfnz from '../common/msfnz';\nimport tsfnz from '../common/tsfnz';\nimport sign from '../common/sign';\nimport adjust_lon from '../common/adjust_lon';\nimport phi2z from '../common/phi2z';\nimport { HALF_PI, EPSLN } from '../constants/values';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} e\n * @property {number} ns\n * @property {number} f0\n * @property {number} rh\n */\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n // double lat0; /* the reference latitude */\n // double long0; /* the reference longitude */\n // double lat1; /* first standard parallel */\n // double lat2; /* second standard parallel */\n // double r_maj; /* major axis */\n // double r_min; /* minor axis */\n // double false_east; /* x offset in meters */\n // double false_north; /* y offset in meters */\n\n // the above value can be set with proj4.defs\n // example: proj4.defs(\"EPSG:2154\",\"+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs\");\n\n if (!this.lat2) {\n this.lat2 = this.lat1;\n } // if lat2 is not defined\n if (!this.k0) {\n this.k0 = 1;\n }\n this.x0 = this.x0 || 0;\n this.y0 = this.y0 || 0;\n // Standard Parallels cannot be equal and on opposite sides of the equator\n if (Math.abs(this.lat1 + this.lat2) < EPSLN) {\n return;\n }\n\n var temp = this.b / this.a;\n this.e = Math.sqrt(1 - temp * temp);\n\n var sin1 = Math.sin(this.lat1);\n var cos1 = Math.cos(this.lat1);\n var ms1 = msfnz(this.e, sin1, cos1);\n var ts1 = tsfnz(this.e, this.lat1, sin1);\n\n var sin2 = Math.sin(this.lat2);\n var cos2 = Math.cos(this.lat2);\n var ms2 = msfnz(this.e, sin2, cos2);\n var ts2 = tsfnz(this.e, this.lat2, sin2);\n\n var ts0 = Math.abs(Math.abs(this.lat0) - HALF_PI) < EPSLN\n ? 0 // Handle poles by setting ts0 to 0\n : tsfnz(this.e, this.lat0, Math.sin(this.lat0));\n\n if (Math.abs(this.lat1 - this.lat2) > EPSLN) {\n this.ns = Math.log(ms1 / ms2) / Math.log(ts1 / ts2);\n } else {\n this.ns = sin1;\n }\n if (isNaN(this.ns)) {\n this.ns = sin1;\n }\n this.f0 = ms1 / (this.ns * Math.pow(ts1, this.ns));\n this.rh = this.a * this.f0 * Math.pow(ts0, this.ns);\n if (!this.title) {\n this.title = 'Lambert Conformal Conic';\n }\n}\n\n// Lambert Conformal conic forward equations--mapping lat,long to x,y\n// -----------------------------------------------------------------\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n\n // singular cases :\n if (Math.abs(2 * Math.abs(lat) - Math.PI) <= EPSLN) {\n lat = sign(lat) * (HALF_PI - 2 * EPSLN);\n }\n\n var con = Math.abs(Math.abs(lat) - HALF_PI);\n var ts, rh1;\n if (con > EPSLN) {\n ts = tsfnz(this.e, lat, Math.sin(lat));\n rh1 = this.a * this.f0 * Math.pow(ts, this.ns);\n } else {\n con = lat * this.ns;\n if (con <= 0) {\n return null;\n }\n rh1 = 0;\n }\n var theta = this.ns * adjust_lon(lon - this.long0, this.over);\n p.x = this.k0 * (rh1 * Math.sin(theta)) + this.x0;\n p.y = this.k0 * (this.rh - rh1 * Math.cos(theta)) + this.y0;\n\n return p;\n}\n\n// Lambert Conformal Conic inverse equations--mapping x,y to lat/long\n// -----------------------------------------------------------------\nexport function inverse(p) {\n var rh1, con, ts;\n var lat, lon;\n var x = (p.x - this.x0) / this.k0;\n var y = (this.rh - (p.y - this.y0) / this.k0);\n if (this.ns > 0) {\n rh1 = Math.sqrt(x * x + y * y);\n con = 1;\n } else {\n rh1 = -Math.sqrt(x * x + y * y);\n con = -1;\n }\n var theta = 0;\n if (rh1 !== 0) {\n theta = Math.atan2((con * x), (con * y));\n }\n if ((rh1 !== 0) || (this.ns > 0)) {\n con = 1 / this.ns;\n ts = Math.pow((rh1 / (this.a * this.f0)), con);\n lat = phi2z(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n } else {\n lat = -HALF_PI;\n }\n lon = adjust_lon(theta / this.ns + this.long0, this.over);\n\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = [\n 'Lambert Tangential Conformal Conic Projection',\n 'Lambert_Conformal_Conic',\n 'Lambert_Conformal_Conic_1SP',\n 'Lambert_Conformal_Conic_2SP',\n 'lcc',\n 'Lambert Conic Conformal (1SP)',\n 'Lambert Conic Conformal (2SP)'\n];\n\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import adjust_lon from '../common/adjust_lon';\n\nexport function init() {\n this.a = 6377397.155;\n this.es = 0.006674372230614;\n this.e = Math.sqrt(this.es);\n if (!this.lat0) {\n this.lat0 = 0.863937979737193;\n }\n if (!this.long0) {\n this.long0 = 0.7417649320975901 - 0.308341501185665; // 42.5° from Ferro = 24.833° from Greenwich\n }\n /* if scale not set default to 0.9999 */\n if (!this.k0) {\n this.k0 = 0.9999;\n }\n this.s45 = 0.785398163397448; /* 45 */\n this.s90 = 2 * this.s45;\n this.fi0 = this.lat0;\n this.e2 = this.es;\n this.e = Math.sqrt(this.e2);\n this.alfa = Math.sqrt(1 + (this.e2 * Math.pow(Math.cos(this.fi0), 4)) / (1 - this.e2));\n this.uq = 1.04216856380474;\n this.u0 = Math.asin(Math.sin(this.fi0) / this.alfa);\n this.g = Math.pow((1 + this.e * Math.sin(this.fi0)) / (1 - this.e * Math.sin(this.fi0)), this.alfa * this.e / 2);\n this.k = Math.tan(this.u0 / 2 + this.s45) / Math.pow(Math.tan(this.fi0 / 2 + this.s45), this.alfa) * this.g;\n this.k1 = this.k0;\n this.n0 = this.a * Math.sqrt(1 - this.e2) / (1 - this.e2 * Math.pow(Math.sin(this.fi0), 2));\n this.s0 = 1.37008346281555;\n this.n = Math.sin(this.s0);\n this.ro0 = this.k1 * this.n0 / Math.tan(this.s0);\n this.ad = this.s90 - this.uq;\n}\n\n/* ellipsoid */\n/* calculate xy from lat/lon */\n/* Constants, identical to inverse transform function */\nexport function forward(p) {\n var gfi, u, deltav, s, d, eps, ro;\n var lon = p.x;\n var lat = p.y;\n var delta_lon = adjust_lon(lon - this.long0, this.over);\n /* Transformation */\n gfi = Math.pow(((1 + this.e * Math.sin(lat)) / (1 - this.e * Math.sin(lat))), (this.alfa * this.e / 2));\n u = 2 * (Math.atan(this.k * Math.pow(Math.tan(lat / 2 + this.s45), this.alfa) / gfi) - this.s45);\n deltav = -delta_lon * this.alfa;\n s = Math.asin(Math.cos(this.ad) * Math.sin(u) + Math.sin(this.ad) * Math.cos(u) * Math.cos(deltav));\n d = Math.asin(Math.cos(u) * Math.sin(deltav) / Math.cos(s));\n eps = this.n * d;\n ro = this.ro0 * Math.pow(Math.tan(this.s0 / 2 + this.s45), this.n) / Math.pow(Math.tan(s / 2 + this.s45), this.n);\n p.y = ro * Math.cos(eps) / 1;\n p.x = ro * Math.sin(eps) / 1;\n\n if (!this.czech) {\n p.y *= -1;\n p.x *= -1;\n }\n return (p);\n}\n\n/* calculate lat/lon from xy */\nexport function inverse(p) {\n var u, deltav, s, d, eps, ro, fi1;\n var ok;\n\n /* Transformation */\n /* revert y, x */\n var tmp = p.x;\n p.x = p.y;\n p.y = tmp;\n if (!this.czech) {\n p.y *= -1;\n p.x *= -1;\n }\n ro = Math.sqrt(p.x * p.x + p.y * p.y);\n eps = Math.atan2(p.y, p.x);\n d = eps / Math.sin(this.s0);\n s = 2 * (Math.atan(Math.pow(this.ro0 / ro, 1 / this.n) * Math.tan(this.s0 / 2 + this.s45)) - this.s45);\n u = Math.asin(Math.cos(this.ad) * Math.sin(s) - Math.sin(this.ad) * Math.cos(s) * Math.cos(d));\n deltav = Math.asin(Math.cos(s) * Math.sin(d) / Math.cos(u));\n p.x = this.long0 - deltav / this.alfa;\n fi1 = u;\n ok = 0;\n var iter = 0;\n do {\n p.y = 2 * (Math.atan(Math.pow(this.k, -1 / this.alfa) * Math.pow(Math.tan(u / 2 + this.s45), 1 / this.alfa) * Math.pow((1 + this.e * Math.sin(fi1)) / (1 - this.e * Math.sin(fi1)), this.e / 2)) - this.s45);\n if (Math.abs(fi1 - p.y) < 0.0000000001) {\n ok = 1;\n }\n fi1 = p.y;\n iter += 1;\n } while (ok === 0 && iter < 15);\n if (iter >= 15) {\n return null;\n }\n\n return (p);\n}\n\nexport var names = ['Krovak', 'Krovak Modified', 'Krovak (North Orientated)', 'Krovak Modified (North Orientated)', 'krovak'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","export default function (e0, e1, e2, e3, phi) {\n return (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi));\n}\n","export default function (x) {\n return (1 - 0.25 * x * (1 + x / 16 * (3 + 1.25 * x)));\n}\n","export default function (x) {\n return (0.375 * x * (1 + 0.25 * x * (1 + 0.46875 * x)));\n}\n","export default function (x) {\n return (0.05859375 * x * x * (1 + 0.75 * x));\n}\n","export default function (x) {\n return (x * x * x * (35 / 3072));\n}\n","export default function (a, e, sinphi) {\n var temp = e * sinphi;\n return a / Math.sqrt(1 - temp * temp);\n}\n","import { HALF_PI } from '../constants/values';\nimport sign from './sign';\n\nexport default function (x) {\n return (Math.abs(x) < HALF_PI) ? x : (x - (sign(x) * Math.PI));\n}\n","export default function (ml, e0, e1, e2, e3) {\n var phi;\n var dphi;\n\n phi = ml / e0;\n for (var i = 0; i < 15; i++) {\n dphi = (ml - (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi))) / (e0 - 2 * e1 * Math.cos(2 * phi) + 4 * e2 * Math.cos(4 * phi) - 6 * e3 * Math.cos(6 * phi));\n phi += dphi;\n if (Math.abs(dphi) <= 0.0000000001) {\n return phi;\n }\n }\n\n // ..reportError(\"IMLFN-CONV:Latitude failed to converge after 15 iterations\");\n return NaN;\n}\n","import mlfn from '../common/mlfn';\nimport e0fn from '../common/e0fn';\nimport e1fn from '../common/e1fn';\nimport e2fn from '../common/e2fn';\nimport e3fn from '../common/e3fn';\nimport gN from '../common/gN';\nimport adjust_lon from '../common/adjust_lon';\nimport adjust_lat from '../common/adjust_lat';\nimport imlfn from '../common/imlfn';\nimport { HALF_PI, EPSLN } from '../constants/values';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} es\n * @property {number} e0\n * @property {number} e1\n * @property {number} e2\n * @property {number} e3\n * @property {number} ml0\n */\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n if (!this.sphere) {\n this.e0 = e0fn(this.es);\n this.e1 = e1fn(this.es);\n this.e2 = e2fn(this.es);\n this.e3 = e3fn(this.es);\n this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);\n }\n}\n\n/* Cassini forward equations--mapping lat,long to x,y\n ----------------------------------------------------------------------- */\nexport function forward(p) {\n /* Forward equations\n ----------------- */\n var x, y;\n var lam = p.x;\n var phi = p.y;\n lam = adjust_lon(lam - this.long0, this.over);\n\n if (this.sphere) {\n x = this.a * Math.asin(Math.cos(phi) * Math.sin(lam));\n y = this.a * (Math.atan2(Math.tan(phi), Math.cos(lam)) - this.lat0);\n } else {\n // ellipsoid\n var sinphi = Math.sin(phi);\n var cosphi = Math.cos(phi);\n var nl = gN(this.a, this.e, sinphi);\n var tl = Math.tan(phi) * Math.tan(phi);\n var al = lam * Math.cos(phi);\n var asq = al * al;\n var cl = this.es * cosphi * cosphi / (1 - this.es);\n var ml = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);\n\n x = nl * al * (1 - asq * tl * (1 / 6 - (8 - tl + 8 * cl) * asq / 120));\n y = ml - this.ml0 + nl * sinphi / cosphi * asq * (0.5 + (5 - tl + 6 * cl) * asq / 24);\n }\n\n p.x = x + this.x0;\n p.y = y + this.y0;\n return p;\n}\n\n/* Inverse equations\n ----------------- */\nexport function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var x = p.x / this.a;\n var y = p.y / this.a;\n var phi, lam;\n\n if (this.sphere) {\n var dd = y + this.lat0;\n phi = Math.asin(Math.sin(dd) * Math.cos(x));\n lam = Math.atan2(Math.tan(x), Math.cos(dd));\n } else {\n /* ellipsoid */\n var ml1 = this.ml0 / this.a + y;\n var phi1 = imlfn(ml1, this.e0, this.e1, this.e2, this.e3);\n if (Math.abs(Math.abs(phi1) - HALF_PI) <= EPSLN) {\n p.x = this.long0;\n p.y = HALF_PI;\n if (y < 0) {\n p.y *= -1;\n }\n return p;\n }\n var nl1 = gN(this.a, this.e, Math.sin(phi1));\n\n var rl1 = nl1 * nl1 * nl1 / this.a / this.a * (1 - this.es);\n var tl1 = Math.pow(Math.tan(phi1), 2);\n var dl = x * this.a / nl1;\n var dsq = dl * dl;\n phi = phi1 - nl1 * Math.tan(phi1) / rl1 * dl * dl * (0.5 - (1 + 3 * tl1) * dl * dl / 24);\n lam = dl * (1 - dsq * (tl1 / 3 + (1 + 3 * tl1) * tl1 * dsq / 15)) / Math.cos(phi1);\n }\n\n p.x = adjust_lon(lam + this.long0, this.over);\n p.y = adjust_lat(phi);\n return p;\n}\n\nexport var names = ['Cassini', 'Cassini_Soldner', 'cass'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","export default function (eccent, sinphi) {\n var con;\n if (eccent > 1.0e-7) {\n con = eccent * sinphi;\n return ((1 - eccent * eccent) * (sinphi / (1 - con * con) - (0.5 / eccent) * Math.log((1 - con) / (1 + con))));\n } else {\n return (2 * sinphi);\n }\n}\n","import { HALF_PI, EPSLN, FORTPI } from '../constants/values';\n\nimport qsfnz from '../common/qsfnz';\nimport adjust_lon from '../common/adjust_lon';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} mode\n * @property {Array<number>} apa\n * @property {number} dd\n * @property {number} e\n * @property {number} es\n * @property {number} mmf\n * @property {number} rq\n * @property {number} qp\n * @property {number} sinb1\n * @property {number} cosb1\n * @property {number} ymf\n * @property {number} xmf\n * @property {number} sinph0\n * @property {number} cosph0\n */\n\n/*\n reference\n \"New Equal-Area Map Projections for Noncircular Regions\", John P. Snyder,\n The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.\n */\n\nexport var S_POLE = 1;\nexport var N_POLE = 2;\nexport var EQUIT = 3;\nexport var OBLIQ = 4;\n\n/**\n * Initialize the Lambert Azimuthal Equal Area projection\n * @this {import('../defs.js').ProjectionDefinition & LocalThis}\n */\nexport function init() {\n var t = Math.abs(this.lat0);\n if (Math.abs(t - HALF_PI) < EPSLN) {\n this.mode = this.lat0 < 0 ? S_POLE : N_POLE;\n } else if (Math.abs(t) < EPSLN) {\n this.mode = EQUIT;\n } else {\n this.mode = OBLIQ;\n }\n if (this.es > 0) {\n var sinphi;\n\n this.qp = qsfnz(this.e, 1);\n this.mmf = 0.5 / (1 - this.es);\n this.apa = authset(this.es);\n switch (this.mode) {\n case N_POLE:\n this.dd = 1;\n break;\n case S_POLE:\n this.dd = 1;\n break;\n case EQUIT:\n this.rq = Math.sqrt(0.5 * this.qp);\n this.dd = 1 / this.rq;\n this.xmf = 1;\n this.ymf = 0.5 * this.qp;\n break;\n case OBLIQ:\n this.rq = Math.sqrt(0.5 * this.qp);\n sinphi = Math.sin(this.lat0);\n this.sinb1 = qsfnz(this.e, sinphi) / this.qp;\n this.cosb1 = Math.sqrt(1 - this.sinb1 * this.sinb1);\n this.dd = Math.cos(this.lat0) / (Math.sqrt(1 - this.es * sinphi * sinphi) * this.rq * this.cosb1);\n this.ymf = (this.xmf = this.rq) / this.dd;\n this.xmf *= this.dd;\n break;\n }\n } else {\n if (this.mode === OBLIQ) {\n this.sinph0 = Math.sin(this.lat0);\n this.cosph0 = Math.cos(this.lat0);\n }\n }\n}\n\n/* Lambert Azimuthal Equal Area forward equations--mapping lat,long to x,y\n ----------------------------------------------------------------------- */\nexport function forward(p) {\n /* Forward equations\n ----------------- */\n var x, y, coslam, sinlam, sinphi, q, sinb, cosb, b, cosphi;\n var lam = p.x;\n var phi = p.y;\n\n lam = adjust_lon(lam - this.long0, this.over);\n if (this.sphere) {\n sinphi = Math.sin(phi);\n cosphi = Math.cos(phi);\n coslam = Math.cos(lam);\n if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {\n y = (this.mode === this.EQUIT) ? 1 + cosphi * coslam : 1 + this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;\n if (y <= EPSLN) {\n return null;\n }\n y = Math.sqrt(2 / y);\n x = y * cosphi * Math.sin(lam);\n y *= (this.mode === this.EQUIT) ? sinphi : this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;\n } else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {\n if (this.mode === this.N_POLE) {\n coslam = -coslam;\n }\n if (Math.abs(phi + this.lat0) < EPSLN) {\n return null;\n }\n y = FORTPI - phi * 0.5;\n y = 2 * ((this.mode === this.S_POLE) ? Math.cos(y) : Math.sin(y));\n x = y * Math.sin(lam);\n y *= coslam;\n }\n } else {\n sinb = 0;\n cosb = 0;\n b = 0;\n coslam = Math.cos(lam);\n sinlam = Math.sin(lam);\n sinphi = Math.sin(phi);\n q = qsfnz(this.e, sinphi);\n if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {\n sinb = q / this.qp;\n cosb = Math.sqrt(1 - sinb * sinb);\n }\n switch (this.mode) {\n case this.OBLIQ:\n b = 1 + this.sinb1 * sinb + this.cosb1 * cosb * coslam;\n break;\n case this.EQUIT:\n b = 1 + cosb * coslam;\n break;\n case this.N_POLE:\n b = HALF_PI + phi;\n q = this.qp - q;\n break;\n case this.S_POLE:\n b = phi - HALF_PI;\n q = this.qp + q;\n break;\n }\n if (Math.abs(b) < EPSLN) {\n return null;\n }\n switch (this.mode) {\n case this.OBLIQ:\n case this.EQUIT:\n b = Math.sqrt(2 / b);\n if (this.mode === this.OBLIQ) {\n y = this.ymf * b * (this.cosb1 * sinb - this.sinb1 * cosb * coslam);\n } else {\n y = (b = Math.sqrt(2 / (1 + cosb * coslam))) * sinb * this.ymf;\n }\n x = this.xmf * b * cosb * sinlam;\n break;\n case this.N_POLE:\n case this.S_POLE:\n if (q >= 0) {\n x = (b = Math.sqrt(q)) * sinlam;\n y = coslam * ((this.mode === this.S_POLE) ? b : -b);\n } else {\n x = y = 0;\n }\n break;\n }\n }\n\n p.x = this.a * x + this.x0;\n p.y = this.a * y + this.y0;\n return p;\n}\n\n/* Inverse equations\n ----------------- */\nexport function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var x = p.x / this.a;\n var y = p.y / this.a;\n var lam, phi, cCe, sCe, q, rho, ab;\n if (this.sphere) {\n var cosz = 0,\n rh, sinz = 0;\n\n rh = Math.sqrt(x * x + y * y);\n phi = rh * 0.5;\n if (phi > 1) {\n return null;\n }\n phi = 2 * Math.asin(phi);\n if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {\n sinz = Math.sin(phi);\n cosz = Math.cos(phi);\n }\n switch (this.mode) {\n case this.EQUIT:\n phi = (Math.abs(rh) <= EPSLN) ? 0 : Math.asin(y * sinz / rh);\n x *= sinz;\n y = cosz * rh;\n break;\n case this.OBLIQ:\n phi = (Math.abs(rh) <= EPSLN) ? this.lat0 : Math.asin(cosz * this.sinph0 + y * sinz * this.cosph0 / rh);\n x *= sinz * this.cosph0;\n y = (cosz - Math.sin(phi) * this.sinph0) * rh;\n break;\n case this.N_POLE:\n y = -y;\n phi = HALF_PI - phi;\n break;\n case this.S_POLE:\n phi -= HALF_PI;\n break;\n }\n lam = (y === 0 && (this.mode === this.EQUIT || this.mode === this.OBLIQ)) ? 0 : Math.atan2(x, y);\n } else {\n ab = 0;\n if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {\n x /= this.dd;\n y *= this.dd;\n rho = Math.sqrt(x * x + y * y);\n if (rho < EPSLN) {\n p.x = this.long0;\n p.y = this.lat0;\n return p;\n }\n sCe = 2 * Math.asin(0.5 * rho / this.rq);\n cCe = Math.cos(sCe);\n x *= (sCe = Math.sin(sCe));\n if (this.mode === this.OBLIQ) {\n ab = cCe * this.sinb1 + y * sCe * this.cosb1 / rho;\n q = this.qp * ab;\n y = rho * this.cosb1 * cCe - y * this.sinb1 * sCe;\n } else {\n ab = y * sCe / rho;\n q = this.qp * ab;\n y = rho * cCe;\n }\n } else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {\n if (this.mode === this.N_POLE) {\n y = -y;\n }\n q = (x * x + y * y);\n if (!q) {\n p.x = this.long0;\n p.y = this.lat0;\n return p;\n }\n ab = 1 - q / this.qp;\n if (this.mode === this.S_POLE) {\n ab = -ab;\n }\n }\n lam = Math.atan2(x, y);\n phi = authlat(Math.asin(ab), this.apa);\n }\n\n p.x = adjust_lon(this.long0 + lam, this.over);\n p.y = phi;\n return p;\n}\n\n/* determine latitude from authalic latitude */\nvar P00 = 0.33333333333333333333;\n\nvar P01 = 0.17222222222222222222;\nvar P02 = 0.10257936507936507936;\nvar P10 = 0.06388888888888888888;\nvar P11 = 0.06640211640211640211;\nvar P20 = 0.01641501294219154443;\n\nfunction authset(es) {\n var t;\n var APA = [];\n APA[0] = es * P00;\n t = es * es;\n APA[0] += t * P01;\n APA[1] = t * P10;\n t *= es;\n APA[0] += t * P02;\n APA[1] += t * P11;\n APA[2] = t * P20;\n return APA;\n}\n\nfunction authlat(beta, APA) {\n var t = beta + beta;\n return (beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t));\n}\n\nexport var names = ['Lambert Azimuthal Equal Area', 'Lambert_Azimuthal_Equal_Area', 'laea'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names,\n S_POLE: S_POLE,\n N_POLE: N_POLE,\n EQUIT: EQUIT,\n OBLIQ: OBLIQ\n};\n","export default function (x) {\n if (Math.abs(x) > 1) {\n x = (x > 1) ? 1 : -1;\n }\n return Math.asin(x);\n}\n","import msfnz from '../common/msfnz';\nimport qsfnz from '../common/qsfnz';\nimport adjust_lon from '../common/adjust_lon';\nimport asinz from '../common/asinz';\nimport { EPSLN } from '../constants/values';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} temp\n * @property {number} es\n * @property {number} e3\n * @property {number} sin_po\n * @property {number} cos_po\n * @property {number} t1\n * @property {number} con\n * @property {number} ms1\n * @property {number} qs1\n * @property {number} t2\n * @property {number} ms2\n * @property {number} qs2\n * @property {number} t3\n * @property {number} qs0\n * @property {number} ns0\n * @property {number} c\n * @property {number} rh\n * @property {number} sin_phi\n * @property {number} cos_phi\n */\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n if (Math.abs(this.lat1 + this.lat2) < EPSLN) {\n return;\n }\n this.temp = this.b / this.a;\n this.es = 1 - Math.pow(this.temp, 2);\n this.e3 = Math.sqrt(this.es);\n\n this.sin_po = Math.sin(this.lat1);\n this.cos_po = Math.cos(this.lat1);\n this.t1 = this.sin_po;\n this.con = this.sin_po;\n this.ms1 = msfnz(this.e3, this.sin_po, this.cos_po);\n this.qs1 = qsfnz(this.e3, this.sin_po);\n\n this.sin_po = Math.sin(this.lat2);\n this.cos_po = Math.cos(this.lat2);\n this.t2 = this.sin_po;\n this.ms2 = msfnz(this.e3, this.sin_po, this.cos_po);\n this.qs2 = qsfnz(this.e3, this.sin_po);\n\n this.sin_po = Math.sin(this.lat0);\n this.cos_po = Math.cos(this.lat0);\n this.t3 = this.sin_po;\n this.qs0 = qsfnz(this.e3, this.sin_po);\n\n if (Math.abs(this.lat1 - this.lat2) > EPSLN) {\n this.ns0 = (this.ms1 * this.ms1 - this.ms2 * this.ms2) / (this.qs2 - this.qs1);\n } else {\n this.ns0 = this.con;\n }\n this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1;\n this.rh = this.a * Math.sqrt(this.c - this.ns0 * this.qs0) / this.ns0;\n}\n\n/* Albers Conical Equal Area forward equations--mapping lat,long to x,y\n ------------------------------------------------------------------- */\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n\n this.sin_phi = Math.sin(lat);\n this.cos_phi = Math.cos(lat);\n\n var qs = qsfnz(this.e3, this.sin_phi);\n var rh1 = this.a * Math.sqrt(this.c - this.ns0 * qs) / this.ns0;\n var theta = this.ns0 * adjust_lon(lon - this.long0, this.over);\n var x = rh1 * Math.sin(theta) + this.x0;\n var y = this.rh - rh1 * Math.cos(theta) + this.y0;\n\n p.x = x;\n p.y = y;\n return p;\n}\n\nexport function inverse(p) {\n var rh1, qs, con, theta, lon, lat;\n\n p.x -= this.x0;\n p.y = this.rh - p.y + this.y0;\n if (this.ns0 >= 0) {\n rh1 = Math.sqrt(p.x * p.x + p.y * p.y);\n con = 1;\n } else {\n rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);\n con = -1;\n }\n theta = 0;\n if (rh1 !== 0) {\n theta = Math.atan2(con * p.x, con * p.y);\n }\n con = rh1 * this.ns0 / this.a;\n if (this.sphere) {\n lat = Math.asin((this.c - con * con) / (2 * this.ns0));\n } else {\n qs = (this.c - con * con) / this.ns0;\n lat = this.phi1z(this.e3, qs);\n }\n\n lon = adjust_lon(theta / this.ns0 + this.long0, this.over);\n p.x = lon;\n p.y = lat;\n return p;\n}\n\n/* Function to compute phi1, the latitude for the inverse of the\n Albers Conical Equal-Area projection.\n------------------------------------------- */\nexport function phi1z(eccent, qs) {\n var sinphi, cosphi, con, com, dphi;\n var phi = asinz(0.5 * qs);\n if (eccent < EPSLN) {\n return phi;\n }\n\n var eccnts = eccent * eccent;\n for (var i = 1; i <= 25; i++) {\n sinphi = Math.sin(phi);\n cosphi = Math.cos(phi);\n con = eccent * sinphi;\n com = 1 - con * con;\n dphi = 0.5 * com * com / cosphi * (qs / (1 - eccnts) - sinphi / com + 0.5 / eccent * Math.log((1 - con) / (1 + con)));\n phi = phi + dphi;\n if (Math.abs(dphi) <= 1e-7) {\n return phi;\n }\n }\n return null;\n}\n\nexport var names = ['Albers_Conic_Equal_Area', 'Albers_Equal_Area', 'Albers', 'aea'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names,\n phi1z: phi1z\n};\n","import adjust_lon from '../common/adjust_lon';\nimport asinz from '../common/asinz';\nimport { EPSLN } from '../constants/values';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} sin_p14\n * @property {number} cos_p14\n * @property {number} infinity_dist\n * @property {number} rc\n */\n\n/**\n reference:\n Wolfram Mathworld \"Gnomonic Projection\"\n http://mathworld.wolfram.com/GnomonicProjection.html\n Accessed: 12th November 2009\n @this {import('../defs.js').ProjectionDefinition & LocalThis}\n */\nexport function init() {\n /* Place parameters in static storage for common use\n ------------------------------------------------- */\n this.sin_p14 = Math.sin(this.lat0);\n this.cos_p14 = Math.cos(this.lat0);\n // Approximation for projecting points to the horizon (infinity)\n this.infinity_dist = 1000 * this.a;\n this.rc = 1;\n}\n\n/* Gnomonic forward equations--mapping lat,long to x,y\n --------------------------------------------------- */\nexport function forward(p) {\n var sinphi, cosphi; /* sin and cos value */\n var dlon; /* delta longitude value */\n var coslon; /* cos of longitude */\n var ksp; /* scale factor */\n var g;\n var x, y;\n var lon = p.x;\n var lat = p.y;\n /* Forward equations\n ----------------- */\n dlon = adjust_lon(lon - this.long0, this.over);\n\n sinphi = Math.sin(lat);\n cosphi = Math.cos(lat);\n\n coslon = Math.cos(dlon);\n g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;\n ksp = 1;\n if ((g > 0) || (Math.abs(g) <= EPSLN)) {\n x = this.x0 + this.a * ksp * cosphi * Math.sin(dlon) / g;\n y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon) / g;\n } else {\n // Point is in the opposing hemisphere and is unprojectable\n // We still need to return a reasonable point, so we project\n // to infinity, on a bearing\n // equivalent to the northern hemisphere equivalent\n // This is a reasonable approximation for short shapes and lines that\n // straddle the horizon.\n\n x = this.x0 + this.infinity_dist * cosphi * Math.sin(dlon);\n y = this.y0 + this.infinity_dist * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);\n }\n p.x = x;\n p.y = y;\n return p;\n}\n\nexport function inverse(p) {\n var rh; /* Rho */\n var sinc, cosc;\n var c;\n var lon, lat;\n\n /* Inverse equations\n ----------------- */\n p.x = (p.x - this.x0) / this.a;\n p.y = (p.y - this.y0) / this.a;\n\n p.x /= this.k0;\n p.y /= this.k0;\n\n if ((rh = Math.sqrt(p.x * p.x + p.y * p.y))) {\n c = Math.atan2(rh, this.rc);\n sinc = Math.sin(c);\n cosc = Math.cos(c);\n\n lat = asinz(cosc * this.sin_p14 + (p.y * sinc * this.cos_p14) / rh);\n lon = Math.atan2(p.x * sinc, rh * this.cos_p14 * cosc - p.y * this.sin_p14 * sinc);\n lon = adjust_lon(this.long0 + lon, this.over);\n } else {\n lat = this.phic0;\n lon = 0;\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = ['gnom'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import { HALF_PI } from '../constants/values';\n\nexport default function (eccent, q) {\n var temp = 1 - (1 - eccent * eccent) / (2 * eccent) * Math.log((1 - eccent) / (1 + eccent));\n if (Math.abs(Math.abs(q) - temp) < 1.0E-6) {\n if (q < 0) {\n return (-1 * HALF_PI);\n } else {\n return HALF_PI;\n }\n }\n // var phi = 0.5* q/(1-eccent*eccent);\n var phi = Math.asin(0.5 * q);\n var dphi;\n var sin_phi;\n var cos_phi;\n var con;\n for (var i = 0; i < 30; i++) {\n sin_phi = Math.sin(phi);\n cos_phi = Math.cos(phi);\n con = eccent * sin_phi;\n dphi = Math.pow(1 - con * con, 2) / (2 * cos_phi) * (q / (1 - eccent * eccent) - sin_phi / (1 - con * con) + 0.5 / eccent * Math.log((1 - con) / (1 + con)));\n phi += dphi;\n if (Math.abs(dphi) <= 0.0000000001) {\n return phi;\n }\n }\n\n // console.log(\"IQSFN-CONV:Latitude failed to converge after 30 iterations\");\n return NaN;\n}\n","import adjust_lon from '../common/adjust_lon';\nimport qsfnz from '../common/qsfnz';\nimport msfnz from '../common/msfnz';\nimport iqsfnz from '../common/iqsfnz';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} e\n */\n\n/**\n reference:\n \"Cartographic Projection Procedures for the UNIX Environment-\n A User's Manual\" by Gerald I. Evenden,\n USGS Open File Report 90-284and Release 4 Interim Reports (2003)\n @this {import('../defs.js').ProjectionDefinition & LocalThis}\n*/\nexport function init() {\n // no-op\n if (!this.sphere) {\n this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));\n }\n}\n\n/* Cylindrical Equal Area forward equations--mapping lat,long to x,y\n ------------------------------------------------------------ */\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n var x, y;\n /* Forward equations\n ----------------- */\n var dlon = adjust_lon(lon - this.long0, this.over);\n if (this.sphere) {\n x = this.x0 + this.a * dlon * Math.cos(this.lat_ts);\n y = this.y0 + this.a * Math.sin(lat) / Math.cos(this.lat_ts);\n } else {\n var qs = qsfnz(this.e, Math.sin(lat));\n x = this.x0 + this.a * this.k0 * dlon;\n y = this.y0 + this.a * qs * 0.5 / this.k0;\n }\n\n p.x = x;\n p.y = y;\n return p;\n}\n\n/* Cylindrical Equal Area inverse equations--mapping x,y to lat/long\n ------------------------------------------------------------ */\nexport function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lon = adjust_lon(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts), this.over);\n lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts));\n } else {\n lat = iqsfnz(this.e, 2 * p.y * this.k0 / this.a);\n lon = adjust_lon(this.long0 + p.x / (this.a * this.k0), this.over);\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = ['cea'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import adjust_lon from '../common/adjust_lon';\nimport adjust_lat from '../common/adjust_lat';\n\nexport function init() {\n this.x0 = this.x0 || 0;\n this.y0 = this.y0 || 0;\n this.lat0 = this.lat0 || 0;\n this.long0 = this.long0 || 0;\n this.lat_ts = this.lat_ts || 0;\n this.title = this.title || 'Equidistant Cylindrical (Plate Carre)';\n\n this.rc = Math.cos(this.lat_ts);\n}\n\n// forward equations--mapping lat,long to x,y\n// -----------------------------------------------------------------\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n\n var dlon = adjust_lon(lon - this.long0, this.over);\n var dlat = adjust_lat(lat - this.lat0);\n p.x = this.x0 + (this.a * dlon * this.rc);\n p.y = this.y0 + (this.a * dlat);\n return p;\n}\n\n// inverse equations--mapping x,y to lat/long\n// -----------------------------------------------------------------\nexport function inverse(p) {\n var x = p.x;\n var y = p.y;\n\n p.x = adjust_lon(this.long0 + ((x - this.x0) / (this.a * this.rc)), this.over);\n p.y = adjust_lat(this.lat0 + ((y - this.y0) / (this.a)));\n return p;\n}\n\nexport var names = ['Equirectangular', 'Equidistant_Cylindrical', 'Equidistant_Cylindrical_Spherical', 'eqc'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import e0fn from '../common/e0fn';\nimport e1fn from '../common/e1fn';\nimport e2fn from '../common/e2fn';\nimport e3fn from '../common/e3fn';\nimport adjust_lon from '../common/adjust_lon';\nimport adjust_lat from '../common/adjust_lat';\nimport mlfn from '../common/mlfn';\nimport { EPSLN } from '../constants/values';\n\nimport gN from '../common/gN';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} temp\n * @property {number} es\n * @property {number} e\n * @property {number} e0\n * @property {number} e1\n * @property {number} e2\n * @property {number} e3\n * @property {number} ml0\n */\n\nvar MAX_ITER = 20;\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n /* Place parameters in static storage for common use\n ------------------------------------------------- */\n this.temp = this.b / this.a;\n this.es = 1 - Math.pow(this.temp, 2); // devait etre dans tmerc.js mais n y est pas donc je commente sinon retour de valeurs nulles\n this.e = Math.sqrt(this.es);\n this.e0 = e0fn(this.es);\n this.e1 = e1fn(this.es);\n this.e2 = e2fn(this.es);\n this.e3 = e3fn(this.es);\n this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0); // si que des zeros le calcul ne se fait pas\n}\n\n/* Polyconic forward equations--mapping lat,long to x,y\n --------------------------------------------------- */\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n var x, y, el;\n var dlon = adjust_lon(lon - this.long0, this.over);\n el = dlon * Math.sin(lat);\n if (this.sphere) {\n if (Math.abs(lat) <= EPSLN) {\n x = this.a * dlon;\n y = -1 * this.a * this.lat0;\n } else {\n x = this.a * Math.sin(el) / Math.tan(lat);\n y = this.a * (adjust_lat(lat - this.lat0) + (1 - Math.cos(el)) / Math.tan(lat));\n }\n } else {\n if (Math.abs(lat) <= EPSLN) {\n x = this.a * dlon;\n y = -1 * this.ml0;\n } else {\n var nl = gN(this.a, this.e, Math.sin(lat)) / Math.tan(lat);\n x = nl * Math.sin(el);\n y = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, lat) - this.ml0 + nl * (1 - Math.cos(el));\n }\n }\n p.x = x + this.x0;\n p.y = y + this.y0;\n return p;\n}\n\n/* Inverse equations\n ----------------- */\nexport function inverse(p) {\n var lon, lat, x, y, i;\n var al, bl;\n var phi, dphi;\n x = p.x - this.x0;\n y = p.y - this.y0;\n\n if (this.sphere) {\n if (Math.abs(y + this.a * this.lat0) <= EPSLN) {\n lon = adjust_lon(x / this.a + this.long0, this.over);\n lat = 0;\n } else {\n al = this.lat0 + y / this.a;\n bl = x * x / this.a / this.a + al * al;\n phi = al;\n var tanphi;\n for (i = MAX_ITER; i; --i) {\n tanphi = Math.tan(phi);\n dphi = -1 * (al * (phi * tanphi + 1) - phi - 0.5 * (phi * phi + bl) * tanphi) / ((phi - al) / tanphi - 1);\n phi += dphi;\n if (Math.abs(dphi) <= EPSLN) {\n lat = phi;\n break;\n }\n }\n lon = adjust_lon(this.long0 + (Math.asin(x * Math.tan(phi) / this.a)) / Math.sin(lat), this.over);\n }\n } else {\n if (Math.abs(y + this.ml0) <= EPSLN) {\n lat = 0;\n lon = adjust_lon(this.long0 + x / this.a, this.over);\n } else {\n al = (this.ml0 + y) / this.a;\n bl = x * x / this.a / this.a + al * al;\n phi = al;\n var cl, mln, mlnp, ma;\n var con;\n for (i = MAX_ITER; i; --i) {\n con = this.e * Math.sin(phi);\n cl = Math.sqrt(1 - con * con) * Math.tan(phi);\n mln = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);\n mlnp = this.e0 - 2 * this.e1 * Math.cos(2 * phi) + 4 * this.e2 * Math.cos(4 * phi) - 6 * this.e3 * Math.cos(6 * phi);\n ma = mln / this.a;\n dphi = (al * (cl * ma + 1) - ma - 0.5 * cl * (ma * ma + bl)) / (this.es * Math.sin(2 * phi) * (ma * ma + bl - 2 * al * ma) / (4 * cl) + (al - ma) * (cl * mlnp - 2 / Math.sin(2 * phi)) - mlnp);\n phi -= dphi;\n if (Math.abs(dphi) <= EPSLN) {\n lat = phi;\n break;\n }\n }\n\n // lat=phi4z(this.e,this.e0,this.e1,this.e2,this.e3,al,bl,0,0);\n cl = Math.sqrt(1 - this.es * Math.pow(Math.sin(lat), 2)) * Math.tan(lat);\n lon = adjust_lon(this.long0 + Math.asin(x * cl / this.a) / Math.sin(lat), this.over);\n }\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = ['Polyconic', 'American_Polyconic', 'poly'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import { SEC_TO_RAD } from '../constants/values';\n\n/*\n reference\n Department of Land and Survey Technical Circular 1973/32\n http://www.linz.govt.nz/docs/miscellaneous/nz-map-definition.pdf\n OSG Technical Report 4.1\n http://www.linz.govt.nz/docs/miscellaneous/nzmg.pdf\n */\n\n/**\n * iterations: Number of iterations to refine inverse transform.\n * 0 -> km accuracy\n * 1 -> m accuracy -- suitable for most mapping applications\n * 2 -> mm accuracy\n */\nexport var iterations = 1;\n\nexport function init() {\n this.A = [];\n this.A[1] = 0.6399175073;\n this.A[2] = -0.1358797613;\n this.A[3] = 0.063294409;\n this.A[4] = -0.02526853;\n this.A[5] = 0.0117879;\n this.A[6] = -0.0055161;\n this.A[7] = 0.0026906;\n this.A[8] = -0.001333;\n this.A[9] = 0.00067;\n this.A[10] = -0.00034;\n\n this.B_re = [];\n this.B_im = [];\n this.B_re[1] = 0.7557853228;\n this.B_im[1] = 0;\n this.B_re[2] = 0.249204646;\n this.B_im[2] = 0.003371507;\n this.B_re[3] = -0.001541739;\n this.B_im[3] = 0.041058560;\n this.B_re[4] = -0.10162907;\n this.B_im[4] = 0.01727609;\n this.B_re[5] = -0.26623489;\n this.B_im[5] = -0.36249218;\n this.B_re[6] = -0.6870983;\n this.B_im[6] = -1.1651967;\n\n this.C_re = [];\n this.C_im = [];\n this.C_re[1] = 1.3231270439;\n this.C_im[1] = 0;\n this.C_re[2] = -0.577245789;\n this.C_im[2] = -0.007809598;\n this.C_re[3] = 0.508307513;\n this.C_im[3] = -0.112208952;\n this.C_re[4] = -0.15094762;\n this.C_im[4] = 0.18200602;\n this.C_re[5] = 1.01418179;\n this.C_im[5] = 1.64497696;\n this.C_re[6] = 1.9660549;\n this.C_im[6] = 2.5127645;\n\n this.D = [];\n this.D[1] = 1.5627014243;\n this.D[2] = 0.5185406398;\n this.D[3] = -0.03333098;\n this.D[4] = -0.1052906;\n this.D[5] = -0.0368594;\n this.D[6] = 0.007317;\n this.D[7] = 0.01220;\n this.D[8] = 0.00394;\n this.D[9] = -0.0013;\n}\n\n/**\n New Zealand Map Grid Forward - long/lat to x/y\n long/lat in radians\n */\nexport function forward(p) {\n var n;\n var lon = p.x;\n var lat = p.y;\n\n var delta_lat = lat - this.lat0;\n var delta_lon = lon - this.long0;\n\n // 1. Calculate d_phi and d_psi ... // and d_lambda\n // For this algorithm, delta_latitude is in seconds of arc x 10-5, so we need to scale to those units. Longitude is radians.\n var d_phi = delta_lat / SEC_TO_RAD * 1E-5;\n var d_lambda = delta_lon;\n var d_phi_n = 1; // d_phi^0\n\n var d_psi = 0;\n for (n = 1; n <= 10; n++) {\n d_phi_n = d_phi_n * d_phi;\n d_psi = d_psi + this.A[n] * d_phi_n;\n }\n\n // 2. Calculate theta\n var th_re = d_psi;\n var th_im = d_lambda;\n\n // 3. Calculate z\n var th_n_re = 1;\n var th_n_im = 0; // theta^0\n var th_n_re1;\n var th_n_im1;\n\n var z_re = 0;\n var z_im = 0;\n for (n = 1; n <= 6; n++) {\n th_n_re1 = th_n_re * th_re - th_n_im * th_im;\n th_n_im1 = th_n_im * th_re + th_n_re * th_im;\n th_n_re = th_n_re1;\n th_n_im = th_n_im1;\n z_re = z_re + this.B_re[n] * th_n_re - this.B_im[n] * th_n_im;\n z_im = z_im + this.B_im[n] * th_n_re + this.B_re[n] * th_n_im;\n }\n\n // 4. Calculate easting and northing\n p.x = (z_im * this.a) + this.x0;\n p.y = (z_re * this.a) + this.y0;\n\n return p;\n}\n\n/**\n New Zealand Map Grid Inverse - x/y to long/lat\n */\nexport function inverse(p) {\n var n;\n var x = p.x;\n var y = p.y;\n\n var delta_x = x - this.x0;\n var delta_y = y - this.y0;\n\n // 1. Calculate z\n var z_re = delta_y / this.a;\n var z_im = delta_x / this.a;\n\n // 2a. Calculate theta - first approximation gives km accuracy\n var z_n_re = 1;\n var z_n_im = 0; // z^0\n var z_n_re1;\n var z_n_im1;\n\n var th_re = 0;\n var th_im = 0;\n for (n = 1; n <= 6; n++) {\n z_n_re1 = z_n_re * z_re - z_n_im * z_im;\n z_n_im1 = z_n_im * z_re + z_n_re * z_im;\n z_n_re = z_n_re1;\n z_n_im = z_n_im1;\n th_re = th_re + this.C_re[n] * z_n_re - this.C_im[n] * z_n_im;\n th_im = th_im + this.C_im[n] * z_n_re + this.C_re[n] * z_n_im;\n }\n\n // 2b. Iterate to refine the accuracy of the calculation\n // 0 iterations gives km accuracy\n // 1 iteration gives m accuracy -- good enough for most mapping applications\n // 2 iterations bives mm accuracy\n for (var i = 0; i < this.iterations; i++) {\n var th_n_re = th_re;\n var th_n_im = th_im;\n var th_n_re1;\n var th_n_im1;\n\n var num_re = z_re;\n var num_im = z_im;\n for (n = 2; n <= 6; n++) {\n th_n_re1 = th_n_re * th_re - th_n_im * th_im;\n th_n_im1 = th_n_im * th_re + th_n_re * th_im;\n th_n_re = th_n_re1;\n th_n_im = th_n_im1;\n num_re = num_re + (n - 1) * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);\n num_im = num_im + (n - 1) * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);\n }\n\n th_n_re = 1;\n th_n_im = 0;\n var den_re = this.B_re[1];\n var den_im = this.B_im[1];\n for (n = 2; n <= 6; n++) {\n th_n_re1 = th_n_re * th_re - th_n_im * th_im;\n th_n_im1 = th_n_im * th_re + th_n_re * th_im;\n th_n_re = th_n_re1;\n th_n_im = th_n_im1;\n den_re = den_re + n * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);\n den_im = den_im + n * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);\n }\n\n // Complex division\n var den2 = den_re * den_re + den_im * den_im;\n th_re = (num_re * den_re + num_im * den_im) / den2;\n th_im = (num_im * den_re - num_re * den_im) / den2;\n }\n\n // 3. Calculate d_phi ... // and d_lambda\n var d_psi = th_re;\n var d_lambda = th_im;\n var d_psi_n = 1; // d_psi^0\n\n var d_phi = 0;\n for (n = 1; n <= 9; n++) {\n d_psi_n = d_psi_n * d_psi;\n d_phi = d_phi + this.D[n] * d_psi_n;\n }\n\n // 4. Calculate latitude and longitude\n // d_phi is calcuated in second of arc * 10^-5, so we need to scale back to radians. d_lambda is in radians.\n var lat = this.lat0 + (d_phi * SEC_TO_RAD * 1E5);\n var lon = this.long0 + d_lambda;\n\n p.x = lon;\n p.y = lat;\n\n return p;\n}\n\nexport var names = ['New_Zealand_Map_Grid', 'nzmg'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import adjust_lon from '../common/adjust_lon';\n\n/*\n reference\n \"New Equal-Area Map Projections for Noncircular Regions\", John P. Snyder,\n The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.\n */\n\n/* Initialize the Miller Cylindrical projection\n ------------------------------------------- */\nexport function init() {\n // no-op\n}\n\n/* Miller Cylindrical forward equations--mapping lat,long to x,y\n ------------------------------------------------------------ */\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n /* Forward equations\n ----------------- */\n var dlon = adjust_lon(lon - this.long0, this.over);\n var x = this.x0 + this.a * dlon;\n var y = this.y0 + this.a * Math.log(Math.tan((Math.PI / 4) + (lat / 2.5))) * 1.25;\n\n p.x = x;\n p.y = y;\n return p;\n}\n\n/* Miller Cylindrical inverse equations--mapping x,y to lat/long\n ------------------------------------------------------------ */\nexport function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n\n var lon = adjust_lon(this.long0 + p.x / this.a, this.over);\n var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);\n\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = ['Miller_Cylindrical', 'mill'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import adjust_lon from '../common/adjust_lon';\nimport adjust_lat from '../common/adjust_lat';\nimport pj_enfn from '../common/pj_enfn';\nvar MAX_ITER = 20;\nimport pj_mlfn from '../common/pj_mlfn';\nimport pj_inv_mlfn from '../common/pj_inv_mlfn';\nimport { EPSLN, HALF_PI } from '../constants/values';\n\nimport asinz from '../common/asinz';\n\n/**\n * @typedef {Object} LocalThis\n * @property {Array<number>} en\n * @property {number} n\n * @property {number} m\n * @property {number} C_y\n * @property {number} C_x\n * @property {number} es\n */\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n /* Place parameters in static storage for common use\n ------------------------------------------------- */\n this.long0 = this.long0 || 0;\n\n if (!this.sphere) {\n this.en = pj_enfn(this.es);\n } else {\n this.n = 1;\n this.m = 0;\n this.es = 0;\n this.C_y = Math.sqrt((this.m + 1) / this.n);\n this.C_x = this.C_y / (this.m + 1);\n }\n}\n\n/* Sinusoidal forward equations--mapping lat,long to x,y\n ----------------------------------------------------- */\nexport function forward(p) {\n var x, y;\n var lon = p.x;\n var lat = p.y;\n /* Forward equations\n ----------------- */\n lon = adjust_lon(lon - this.long0, this.over);\n\n if (this.sphere) {\n if (!this.m) {\n lat = this.n !== 1 ? Math.asin(this.n * Math.sin(lat)) : lat;\n } else {\n var k = this.n * Math.sin(lat);\n for (var i = MAX_ITER; i; --i) {\n var V = (this.m * lat + Math.sin(lat) - k) / (this.m + Math.cos(lat));\n lat -= V;\n if (Math.abs(V) < EPSLN) {\n break;\n }\n }\n }\n x = this.a * this.C_x * lon * (this.m + Math.cos(lat));\n y = this.a * this.C_y * lat;\n } else {\n var s = Math.sin(lat);\n var c = Math.cos(lat);\n y = this.a * pj_mlfn(lat, s, c, this.en);\n x = this.a * lon * c / Math.sqrt(1 - this.es * s * s);\n }\n\n p.x = x;\n p.y = y;\n return p;\n}\n\nexport function inverse(p) {\n var lat, temp, lon, s;\n\n p.x -= this.x0;\n lon = p.x / this.a;\n p.y -= this.y0;\n lat = p.y / this.a;\n\n if (this.sphere) {\n lat /= this.C_y;\n lon = lon / (this.C_x * (this.m + Math.cos(lat)));\n if (this.m) {\n lat = asinz((this.m * lat + Math.sin(lat)) / this.n);\n } else if (this.n !== 1) {\n lat = asinz(Math.sin(lat) / this.n);\n }\n lon = adjust_lon(lon + this.long0, this.over);\n lat = adjust_lat(lat);\n } else {\n lat = pj_inv_mlfn(p.y / this.a, this.es, this.en);\n s = Math.abs(lat);\n if (s < HALF_PI) {\n s = Math.sin(lat);\n temp = this.long0 + p.x * Math.sqrt(1 - this.es * s * s) / (this.a * Math.cos(lat));\n // temp = this.long0 + p.x / (this.a * Math.cos(lat));\n lon = adjust_lon(temp, this.over);\n } else if ((s - EPSLN) < HALF_PI) {\n lon = this.long0;\n }\n }\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = ['Sinusoidal', 'sinu'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import adjust_lon from '../common/adjust_lon';\nimport { EPSLN } from '../constants/values';\n\n/** @this {import('../defs.js').ProjectionDefinition} */\nexport function init() {\n this.x0 = this.x0 !== undefined ? this.x0 : 0;\n this.y0 = this.y0 !== undefined ? this.y0 : 0;\n this.long0 = this.long0 !== undefined ? this.long0 : 0;\n}\n\n/* Mollweide forward equations--mapping lat,long to x,y\n ---------------------------------------------------- */\nexport function forward(p) {\n /* Forward equations\n ----------------- */\n var lon = p.x;\n var lat = p.y;\n\n var delta_lon = adjust_lon(lon - this.long0, this.over);\n var theta = lat;\n var con = Math.PI * Math.sin(lat);\n\n /* Iterate using the Newton-Raphson method to find theta\n ----------------------------------------------------- */\n while (true) {\n var delta_theta = -(theta + Math.sin(theta) - con) / (1 + Math.cos(theta));\n theta += delta_theta;\n if (Math.abs(delta_theta) < EPSLN) {\n break;\n }\n }\n theta /= 2;\n\n /* If the latitude is 90 deg, force the x coordinate to be \"0 + false easting\"\n this is done here because of precision problems with \"cos(theta)\"\n -------------------------------------------------------------------------- */\n if (Math.PI / 2 - Math.abs(lat) < EPSLN) {\n delta_lon = 0;\n }\n var x = 0.900316316158 * this.a * delta_lon * Math.cos(theta) + this.x0;\n var y = 1.4142135623731 * this.a * Math.sin(theta) + this.y0;\n\n p.x = x;\n p.y = y;\n return p;\n}\n\nexport function inverse(p) {\n var theta;\n var arg;\n\n /* Inverse equations\n ----------------- */\n p.x -= this.x0;\n p.y -= this.y0;\n arg = p.y / (1.4142135623731 * this.a);\n\n /* Because of division by zero problems, 'arg' can not be 1. Therefore\n a number very close to one is used instead.\n ------------------------------------------------------------------- */\n if (Math.abs(arg) > 0.999999999999) {\n arg = 0.999999999999;\n }\n theta = Math.asin(arg);\n var lon = adjust_lon(this.long0 + (p.x / (0.900316316158 * this.a * Math.cos(theta))), this.over);\n if (lon < (-Math.PI)) {\n lon = -Math.PI;\n }\n if (lon > Math.PI) {\n lon = Math.PI;\n }\n arg = (2 * theta + Math.sin(2 * theta)) / Math.PI;\n if (Math.abs(arg) > 1) {\n arg = 1;\n }\n var lat = Math.asin(arg);\n\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = ['Mollweide', 'moll'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import e0fn from '../common/e0fn';\nimport e1fn from '../common/e1fn';\nimport e2fn from '../common/e2fn';\nimport e3fn from '../common/e3fn';\nimport msfnz from '../common/msfnz';\nimport mlfn from '../common/mlfn';\nimport adjust_lon from '../common/adjust_lon';\nimport adjust_lat from '../common/adjust_lat';\nimport imlfn from '../common/imlfn';\nimport { EPSLN } from '../constants/values';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} temp\n * @property {number} es\n * @property {number} e\n * @property {number} e0\n * @property {number} e1\n * @property {number} e2\n * @property {number} e3\n * @property {number} sin_phi\n * @property {number} cos_phi\n * @property {number} ms1\n * @property {number} ml1\n * @property {number} ms2\n * @property {number} ml2\n * @property {number} ns\n * @property {number} g\n * @property {number} ml0\n * @property {number} rh\n */\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n /* Place parameters in static storage for common use\n ------------------------------------------------- */\n // Standard Parallels cannot be equal and on opposite sides of the equator\n if (Math.abs(this.lat1 + this.lat2) < EPSLN) {\n return;\n }\n this.lat2 = this.lat2 || this.lat1;\n this.temp = this.b / this.a;\n this.es = 1 - Math.pow(this.temp, 2);\n this.e = Math.sqrt(this.es);\n this.e0 = e0fn(this.es);\n this.e1 = e1fn(this.es);\n this.e2 = e2fn(this.es);\n this.e3 = e3fn(this.es);\n\n this.sin_phi = Math.sin(this.lat1);\n this.cos_phi = Math.cos(this.lat1);\n\n this.ms1 = msfnz(this.e, this.sin_phi, this.cos_phi);\n this.ml1 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat1);\n\n if (Math.abs(this.lat1 - this.lat2) < EPSLN) {\n this.ns = this.sin_phi;\n } else {\n this.sin_phi = Math.sin(this.lat2);\n this.cos_phi = Math.cos(this.lat2);\n this.ms2 = msfnz(this.e, this.sin_phi, this.cos_phi);\n this.ml2 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat2);\n this.ns = (this.ms1 - this.ms2) / (this.ml2 - this.ml1);\n }\n this.g = this.ml1 + this.ms1 / this.ns;\n this.ml0 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);\n this.rh = this.a * (this.g - this.ml0);\n}\n\n/* Equidistant Conic forward equations--mapping lat,long to x,y\n ----------------------------------------------------------- */\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n var rh1;\n\n /* Forward equations\n ----------------- */\n if (this.sphere) {\n rh1 = this.a * (this.g - lat);\n } else {\n var ml = mlfn(this.e0, this.e1, this.e2, this.e3, lat);\n rh1 = this.a * (this.g - ml);\n }\n var theta = this.ns * adjust_lon(lon - this.long0, this.over);\n var x = this.x0 + rh1 * Math.sin(theta);\n var y = this.y0 + this.rh - rh1 * Math.cos(theta);\n p.x = x;\n p.y = y;\n return p;\n}\n\n/* Inverse equations\n ----------------- */\nexport function inverse(p) {\n p.x -= this.x0;\n p.y = this.rh - p.y + this.y0;\n var con, rh1, lat, lon;\n if (this.ns >= 0) {\n rh1 = Math.sqrt(p.x * p.x + p.y * p.y);\n con = 1;\n } else {\n rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);\n con = -1;\n }\n var theta = 0;\n if (rh1 !== 0) {\n theta = Math.atan2(con * p.x, con * p.y);\n }\n\n if (this.sphere) {\n lon = adjust_lon(this.long0 + theta / this.ns, this.over);\n lat = adjust_lat(this.g - rh1 / this.a);\n p.x = lon;\n p.y = lat;\n return p;\n } else {\n var ml = this.g - rh1 / this.a;\n lat = imlfn(ml, this.e0, this.e1, this.e2, this.e3);\n lon = adjust_lon(this.long0 + theta / this.ns, this.over);\n p.x = lon;\n p.y = lat;\n return p;\n }\n}\n\nexport var names = ['Equidistant_Conic', 'eqdc'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import adjust_lon from '../common/adjust_lon';\n\nimport { HALF_PI, EPSLN } from '../constants/values';\n\nimport asinz from '../common/asinz';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} R - Radius of the Earth\n */\n\n/**\n * Initialize the Van Der Grinten projection\n * @this {import('../defs.js').ProjectionDefinition & LocalThis}\n */\nexport function init() {\n // this.R = 6370997; //Radius of earth\n this.R = this.a;\n}\n\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n\n /* Forward equations\n ----------------- */\n var dlon = adjust_lon(lon - this.long0, this.over);\n var x, y;\n\n if (Math.abs(lat) <= EPSLN) {\n x = this.x0 + this.R * dlon;\n y = this.y0;\n }\n var theta = asinz(2 * Math.abs(lat / Math.PI));\n if ((Math.abs(dlon) <= EPSLN) || (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN)) {\n x = this.x0;\n if (lat >= 0) {\n y = this.y0 + Math.PI * this.R * Math.tan(0.5 * theta);\n } else {\n y = this.y0 + Math.PI * this.R * -Math.tan(0.5 * theta);\n }\n // return(OK);\n }\n var al = 0.5 * Math.abs((Math.PI / dlon) - (dlon / Math.PI));\n var asq = al * al;\n var sinth = Math.sin(theta);\n var costh = Math.cos(theta);\n\n var g = costh / (sinth + costh - 1);\n var gsq = g * g;\n var m = g * (2 / sinth - 1);\n var msq = m * m;\n var con = Math.PI * this.R * (al * (g - msq) + Math.sqrt(asq * (g - msq) * (g - msq) - (msq + asq) * (gsq - msq))) / (msq + asq);\n if (dlon < 0) {\n con = -con;\n }\n x = this.x0 + con;\n // con = Math.abs(con / (Math.PI * this.R));\n var q = asq + g;\n con = Math.PI * this.R * (m * q - al * Math.sqrt((msq + asq) * (asq + 1) - q * q)) / (msq + asq);\n if (lat >= 0) {\n // y = this.y0 + Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);\n y = this.y0 + con;\n } else {\n // y = this.y0 - Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);\n y = this.y0 - con;\n }\n p.x = x;\n p.y = y;\n return p;\n}\n\n/* Van Der Grinten inverse equations--mapping x,y to lat/long\n --------------------------------------------------------- */\nexport function inverse(p) {\n var lon, lat;\n var xx, yy, xys, c1, c2, c3;\n var a1;\n var m1;\n var con;\n var th1;\n var d;\n\n /* inverse equations\n ----------------- */\n p.x -= this.x0;\n p.y -= this.y0;\n con = Math.PI * this.R;\n xx = p.x / con;\n yy = p.y / con;\n xys = xx * xx + yy * yy;\n c1 = -Math.abs(yy) * (1 + xys);\n c2 = c1 - 2 * yy * yy + xx * xx;\n c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;\n d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;\n a1 = (c1 - c2 * c2 / 3 / c3) / c3;\n m1 = 2 * Math.sqrt(-a1 / 3);\n con = ((3 * d) / a1) / m1;\n if (Math.abs(con) > 1) {\n if (con >= 0) {\n con = 1;\n } else {\n con = -1;\n }\n }\n th1 = Math.acos(con) / 3;\n if (p.y >= 0) {\n lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n } else {\n lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n }\n\n if (Math.abs(xx) < EPSLN) {\n lon = this.long0;\n } else {\n lon = adjust_lon(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx, this.over);\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = ['Van_der_Grinten_I', 'VanDerGrinten', 'Van_der_Grinten', 'vandg'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","/**\n * Calculates the inverse geodesic problem using Vincenty's formulae.\n * Computes the forward azimuth and ellipsoidal distance between two points\n * specified by latitude and longitude on the surface of an ellipsoid.\n *\n * @param {number} lat1 Latitude of the first point in radians.\n * @param {number} lon1 Longitude of the first point in radians.\n * @param {number} lat2 Latitude of the second point in radians.\n * @param {number} lon2 Longitude of the second point in radians.\n * @param {number} a Semi-major axis of the ellipsoid (meters).\n * @param {number} f Flattening of the ellipsoid.\n * @returns {{ azi1: number, s12: number }} An object containing:\n * - azi1: Forward azimuth from the first point to the second point (radians).\n * - s12: Ellipsoidal distance between the two points (meters).\n */\nexport function vincentyInverse(lat1, lon1, lat2, lon2, a, f) {\n const L = lon2 - lon1;\n const U1 = Math.atan((1 - f) * Math.tan(lat1));\n const U2 = Math.atan((1 - f) * Math.tan(lat2));\n const sinU1 = Math.sin(U1), cosU1 = Math.cos(U1);\n const sinU2 = Math.sin(U2), cosU2 = Math.cos(U2);\n\n let lambda = L, lambdaP, iterLimit = 100;\n let sinLambda, cosLambda, sinSigma, cosSigma, sigma, sinAlpha, cos2Alpha, cos2SigmaM, C;\n let uSq, A, B, deltaSigma, s;\n\n do {\n sinLambda = Math.sin(lambda);\n cosLambda = Math.cos(lambda);\n sinSigma = Math.sqrt(\n (cosU2 * sinLambda) * (cosU2 * sinLambda)\n + (cosU1 * sinU2 - sinU1 * cosU2 * cosLambda)\n * (cosU1 * sinU2 - sinU1 * cosU2 * cosLambda)\n );\n if (sinSigma === 0) {\n return { azi1: 0, s12: 0 }; // coincident points\n }\n cosSigma = sinU1 * sinU2 + cosU1 * cosU2 * cosLambda;\n sigma = Math.atan2(sinSigma, cosSigma);\n sinAlpha = cosU1 * cosU2 * sinLambda / sinSigma;\n cos2Alpha = 1 - sinAlpha * sinAlpha;\n cos2SigmaM = (cos2Alpha !== 0) ? (cosSigma - 2 * sinU1 * sinU2 / cos2Alpha) : 0;\n C = f / 16 * cos2Alpha * (4 + f * (4 - 3 * cos2Alpha));\n lambdaP = lambda;\n lambda = L + (1 - C) * f * sinAlpha\n * (sigma + C * sinSigma * (cos2SigmaM + C * cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM)));\n } while (Math.abs(lambda - lambdaP) > 1e-12 && --iterLimit > 0);\n\n if (iterLimit === 0) {\n return { azi1: NaN, s12: NaN }; // formula failed to converge\n }\n\n uSq = cos2Alpha * (a * a - (a * (1 - f)) * (a * (1 - f))) / ((a * (1 - f)) * (a * (1 - f)));\n A = 1 + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq)));\n B = uSq / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq)));\n deltaSigma = B * sinSigma * (cos2SigmaM + B / 4 * (cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM)\n - B / 6 * cos2SigmaM * (-3 + 4 * sinSigma * sinSigma) * (-3 + 4 * cos2SigmaM * cos2SigmaM)));\n\n s = (a * (1 - f)) * A * (sigma - deltaSigma);\n\n // Forward azimuth\n const azi1 = Math.atan2(cosU2 * sinLambda, cosU1 * sinU2 - sinU1 * cosU2 * cosLambda);\n\n return { azi1, s12: s };\n}\n\n/**\n * Solves the direct geodetic problem using Vincenty's formulae.\n * Given a starting point, initial azimuth, and distance, computes the destination point on the ellipsoid.\n *\n * @param {number} lat1 Latitude of the starting point in radians.\n * @param {number} lon1 Longitude of the starting point in radians.\n * @param {number} azi1 Initial azimuth (forward azimuth) in radians.\n * @param {number} s12 Distance to travel from the starting point in meters.\n * @param {number} a Semi-major axis of the ellipsoid in meters.\n * @param {number} f Flattening of the ellipsoid.\n * @returns {{lat2: number, lon2: number}} The latitude and longitude (in radians) of the destination point.\n */\nexport function vincentyDirect(lat1, lon1, azi1, s12, a, f) {\n const U1 = Math.atan((1 - f) * Math.tan(lat1));\n const sinU1 = Math.sin(U1), cosU1 = Math.cos(U1);\n const sinAlpha1 = Math.sin(azi1), cosAlpha1 = Math.cos(azi1);\n\n const sigma1 = Math.atan2(sinU1, cosU1 * cosAlpha1);\n const sinAlpha = cosU1 * sinAlpha1;\n const cos2Alpha = 1 - sinAlpha * sinAlpha;\n const uSq = cos2Alpha * (a * a - (a * (1 - f)) * (a * (1 - f))) / ((a * (1 - f)) * (a * (1 - f)));\n const A = 1 + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq)));\n const B = uSq / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq)));\n\n let sigma = s12 / ((a * (1 - f)) * A), sigmaP, iterLimit = 100;\n let cos2SigmaM, sinSigma, cosSigma, deltaSigma;\n\n do {\n cos2SigmaM = Math.cos(2 * sigma1 + sigma);\n sinSigma = Math.sin(sigma);\n cosSigma = Math.cos(sigma);\n deltaSigma = B * sinSigma * (cos2SigmaM + B / 4 * (cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM)\n - B / 6 * cos2SigmaM * (-3 + 4 * sinSigma * sinSigma) * (-3 + 4 * cos2SigmaM * cos2SigmaM)));\n sigmaP = sigma;\n sigma = s12 / ((a * (1 - f)) * A) + deltaSigma;\n } while (Math.abs(sigma - sigmaP) > 1e-12 && --iterLimit > 0);\n\n if (iterLimit === 0) {\n return { lat2: NaN, lon2: NaN };\n }\n\n const tmp = sinU1 * sinSigma - cosU1 * cosSigma * cosAlpha1;\n const lat2 = Math.atan2(\n sinU1 * cosSigma + cosU1 * sinSigma * cosAlpha1,\n (1 - f) * Math.sqrt(sinAlpha * sinAlpha + tmp * tmp)\n );\n const lambda = Math.atan2(\n sinSigma * sinAlpha1,\n cosU1 * cosSigma - sinU1 * sinSigma * cosAlpha1\n );\n const C = f / 16 * cos2Alpha * (4 + f * (4 - 3 * cos2Alpha));\n const L = lambda - (1 - C) * f * sinAlpha\n * (sigma + C * sinSigma * (cos2SigmaM + C * cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM)));\n const lon2 = lon1 + L;\n\n return { lat2, lon2 };\n}\n","import adjust_lon from '../common/adjust_lon';\nimport { HALF_PI, EPSLN } from '../constants/values';\nimport mlfn from '../common/mlfn';\nimport e0fn from '../common/e0fn';\nimport e1fn from '../common/e1fn';\nimport e2fn from '../common/e2fn';\nimport e3fn from '../common/e3fn';\nimport asinz from '../common/asinz';\nimport imlfn from '../common/imlfn';\nimport { vincentyDirect, vincentyInverse } from '../common/vincenty';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} es\n * @property {number} sin_p12\n * @property {number} cos_p12\n * @property {number} a\n * @property {number} f\n */\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n this.sin_p12 = Math.sin(this.lat0);\n this.cos_p12 = Math.cos(this.lat0);\n // flattening for ellipsoid\n this.f = this.es / (1 + Math.sqrt(1 - this.es));\n}\n\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n var sinphi = Math.sin(p.y);\n var cosphi = Math.cos(p.y);\n var dlon = adjust_lon(lon - this.long0, this.over);\n var e0, e1, e2, e3, Mlp, Ml, c, kp, cos_c, vars, azi1;\n if (this.sphere) {\n if (Math.abs(this.sin_p12 - 1) <= EPSLN) {\n // North Pole case\n p.x = this.x0 + this.a * (HALF_PI - lat) * Math.sin(dlon);\n p.y = this.y0 - this.a * (HALF_PI - lat) * Math.cos(dlon);\n return p;\n } else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {\n // South Pole case\n p.x = this.x0 + this.a * (HALF_PI + lat) * Math.sin(dlon);\n p.y = this.y0 + this.a * (HALF_PI + lat) * Math.cos(dlon);\n return p;\n } else {\n // default case\n cos_c = this.sin_p12 * sinphi + this.cos_p12 * cosphi * Math.cos(dlon);\n c = Math.acos(cos_c);\n kp = c ? c / Math.sin(c) : 1;\n p.x = this.x0 + this.a * kp * cosphi * Math.sin(dlon);\n p.y = this.y0 + this.a * kp * (this.cos_p12 * sinphi - this.sin_p12 * cosphi * Math.cos(dlon));\n return p;\n }\n } else {\n e0 = e0fn(this.es);\n e1 = e1fn(this.es);\n e2 = e2fn(this.es);\n e3 = e3fn(this.es);\n if (Math.abs(this.sin_p12 - 1) <= EPSLN) {\n // North Pole case\n Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);\n Ml = this.a * mlfn(e0, e1, e2, e3, lat);\n p.x = this.x0 + (Mlp - Ml) * Math.sin(dlon);\n p.y = this.y0 - (Mlp - Ml) * Math.cos(dlon);\n return p;\n } else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {\n // South Pole case\n Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);\n Ml = this.a * mlfn(e0, e1, e2, e3, lat);\n p.x = this.x0 + (Mlp + Ml) * Math.sin(dlon);\n p.y = this.y0 + (Mlp + Ml) * Math.cos(dlon);\n return p;\n } else {\n // Default case\n if (Math.abs(lon) < EPSLN && Math.abs(lat - this.lat0) < EPSLN) {\n p.x = p.y = 0;\n return p;\n }\n vars = vincentyInverse(this.lat0, this.long0, lat, lon, this.a, this.f);\n azi1 = vars.azi1;\n p.x = vars.s12 * Math.sin(azi1);\n p.y = vars.s12 * Math.cos(azi1);\n return p;\n }\n }\n}\n\nexport function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var rh, z, sinz, cosz, lon, lat, con, e0, e1, e2, e3, Mlp, M, azi1, s12, vars;\n if (this.sphere) {\n rh = Math.sqrt(p.x * p.x + p.y * p.y);\n if (rh > (2 * HALF_PI * this.a)) {\n return;\n }\n z = rh / this.a;\n\n sinz = Math.sin(z);\n cosz = Math.cos(z);\n\n lon = this.long0;\n if (Math.abs(rh) <= EPSLN) {\n lat = this.lat0;\n } else {\n lat = asinz(cosz * this.sin_p12 + (p.y * sinz * this.cos_p12) / rh);\n con = Math.abs(this.lat0) - HALF_PI;\n if (Math.abs(con) <= EPSLN) {\n if (this.lat0 >= 0) {\n lon = adjust_lon(this.long0 + Math.atan2(p.x, -p.y), this.over);\n } else {\n lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y), this.over);\n }\n } else {\n lon = adjust_lon(this.long0 + Math.atan2(p.x * sinz, rh * this.cos_p12 * cosz - p.y * this.sin_p12 * sinz), this.over);\n }\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n } else {\n e0 = e0fn(this.es);\n e1 = e1fn(this.es);\n e2 = e2fn(this.es);\n e3 = e3fn(this.es);\n if (Math.abs(this.sin_p12 - 1) <= EPSLN) {\n // North pole case\n Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);\n rh = Math.sqrt(p.x * p.x + p.y * p.y);\n M = Mlp - rh;\n lat = imlfn(M / this.a, e0, e1, e2, e3);\n lon = adjust_lon(this.long0 + Math.atan2(p.x, -1 * p.y), this.over);\n p.x = lon;\n p.y = lat;\n return p;\n } else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {\n // South pole case\n Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);\n rh = Math.sqrt(p.x * p.x + p.y * p.y);\n M = rh - Mlp;\n\n lat = imlfn(M / this.a, e0, e1, e2, e3);\n lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y), this.over);\n p.x = lon;\n p.y = lat;\n return p;\n } else {\n // default case\n azi1 = Math.atan2(p.x, p.y);\n s12 = Math.sqrt(p.x * p.x + p.y * p.y);\n vars = vincentyDirect(this.lat0, this.long0, azi1, s12, this.a, this.f);\n\n p.x = vars.lon2;\n p.y = vars.lat2;\n return p;\n }\n }\n}\n\nexport var names = ['Azimuthal_Equidistant', 'aeqd'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import adjust_lon from '../common/adjust_lon';\nimport asinz from '../common/asinz';\nimport { EPSLN, HALF_PI } from '../constants/values';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} sin_p14\n * @property {number} cos_p14\n */\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n // double temp; /* temporary variable */\n\n /* Place parameters in static storage for common use\n ------------------------------------------------- */\n this.sin_p14 = Math.sin(this.lat0 || 0);\n this.cos_p14 = Math.cos(this.lat0 || 0);\n}\n\n/* Orthographic forward equations--mapping lat,long to x,y\n --------------------------------------------------- */\nexport function forward(p) {\n var sinphi, cosphi; /* sin and cos value */\n var dlon; /* delta longitude value */\n var coslon; /* cos of longitude */\n var ksp; /* scale factor */\n var g, x, y;\n var lon = p.x;\n var lat = p.y;\n /* Forward equations\n ----------------- */\n dlon = adjust_lon(lon - (this.long0 || 0), this.over);\n\n sinphi = Math.sin(lat);\n cosphi = Math.cos(lat);\n\n coslon = Math.cos(dlon);\n g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;\n ksp = 1;\n if ((g > 0) || (Math.abs(g) <= EPSLN)) {\n x = this.a * ksp * cosphi * Math.sin(dlon);\n y = (this.y0 || 0) + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);\n }\n p.x = x;\n p.y = y;\n return p;\n}\n\nexport function inverse(p) {\n var rh; /* height above ellipsoid */\n var z; /* angle */\n var sinz, cosz; /* sin of z and cos of z */\n var con;\n var lon, lat;\n var long0, lat0;\n /* Inverse equations\n ----------------- */\n p.x -= this.x0 || 0;\n p.y -= this.y0 || 0;\n rh = Math.sqrt(p.x * p.x + p.y * p.y);\n z = asinz(rh / this.a);\n\n sinz = Math.sin(z);\n cosz = Math.cos(z);\n\n long0 = this.long0 || 0;\n lat0 = this.lat0 || 0;\n lon = long0;\n if (Math.abs(rh) <= EPSLN) {\n lat = lat0;\n p.x = lon;\n p.y = lat;\n return p;\n }\n lat = asinz(cosz * this.sin_p14 + (p.y * sinz * this.cos_p14) / rh);\n con = Math.abs(lat0) - HALF_PI;\n if (Math.abs(con) <= EPSLN) {\n if (lat0 >= 0) {\n lon = adjust_lon(long0 + Math.atan2(p.x, -p.y), this.over);\n } else {\n lon = adjust_lon(long0 - Math.atan2(-p.x, p.y), this.over);\n }\n p.x = lon;\n p.y = lat;\n return p;\n }\n lon = adjust_lon(long0 + Math.atan2((p.x * sinz), rh * this.cos_p14 * cosz - p.y * this.sin_p14 * sinz), this.over);\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = ['ortho'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","// QSC projection rewritten from the original PROJ4\n// https://github.com/OSGeo/proj.4/blob/master/src/PJ_qsc.c\n\nimport { EPSLN, TWO_PI, SPI, HALF_PI, FORTPI } from '../constants/values';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} face\n * @property {number} x0\n * @property {number} y0\n * @property {number} es\n * @property {number} one_minus_f\n * @property {number} one_minus_f_squared\n */\n\n/* constants */\nvar FACE_ENUM = {\n FRONT: 1,\n RIGHT: 2,\n BACK: 3,\n LEFT: 4,\n TOP: 5,\n BOTTOM: 6\n};\n\nvar AREA_ENUM = {\n AREA_0: 1,\n AREA_1: 2,\n AREA_2: 3,\n AREA_3: 4\n};\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n this.x0 = this.x0 || 0;\n this.y0 = this.y0 || 0;\n this.lat0 = this.lat0 || 0;\n this.long0 = this.long0 || 0;\n this.lat_ts = this.lat_ts || 0;\n this.title = this.title || 'Quadrilateralized Spherical Cube';\n\n /* Determine the cube face from the center of projection. */\n if (this.lat0 >= HALF_PI - FORTPI / 2.0) {\n this.face = FACE_ENUM.TOP;\n } else if (this.lat0 <= -(HALF_PI - FORTPI / 2.0)) {\n this.face = FACE_ENUM.BOTTOM;\n } else if (Math.abs(this.long0) <= FORTPI) {\n this.face = FACE_ENUM.FRONT;\n } else if (Math.abs(this.long0) <= HALF_PI + FORTPI) {\n this.face = this.long0 > 0.0 ? FACE_ENUM.RIGHT : FACE_ENUM.LEFT;\n } else {\n this.face = FACE_ENUM.BACK;\n }\n\n /* Fill in useful values for the ellipsoid <-> sphere shift\n * described in [LK12]. */\n if (this.es !== 0) {\n this.one_minus_f = 1 - (this.a - this.b) / this.a;\n this.one_minus_f_squared = this.one_minus_f * this.one_minus_f;\n }\n}\n\n// QSC forward equations--mapping lat,long to x,y\n// -----------------------------------------------------------------\nexport function forward(p) {\n var xy = { x: 0, y: 0 };\n var lat, lon;\n var theta, phi;\n var t, mu;\n /* nu; */\n var area = { value: 0 };\n\n // move lon according to projection's lon\n p.x -= this.long0;\n\n /* Convert the geodetic latitude to a geocentric latitude.\n * This corresponds to the shift from the ellipsoid to the sphere\n * described in [LK12]. */\n if (this.es !== 0) { // if (P->es != 0) {\n lat = Math.atan(this.one_minus_f_squared * Math.tan(p.y));\n } else {\n lat = p.y;\n }\n\n /* Convert the input lat, lon into theta, phi as used by QSC.\n * This depends on the cube face and the area on it.\n * For the top and bottom face, we can compute theta and phi\n * directly from phi, lam. For the other faces, we must use\n * unit sphere cartesian coordinates as an intermediate step. */\n lon = p.x; // lon = lp.lam;\n if (this.face === FACE_ENUM.TOP) {\n phi = HALF_PI - lat;\n if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {\n area.value = AREA_ENUM.AREA_0;\n theta = lon - HALF_PI;\n } else if (lon > HALF_PI + FORTPI || lon <= -(HALF_PI + FORTPI)) {\n area.value = AREA_ENUM.AREA_1;\n theta = (lon > 0.0 ? lon - SPI : lon + SPI);\n } else if (lon > -(HALF_PI + FORTPI) && lon <= -FORTPI) {\n area.value = AREA_ENUM.AREA_2;\n theta = lon + HALF_PI;\n } else {\n area.value = AREA_ENUM.AREA_3;\n theta = lon;\n }\n } else if (this.face === FACE_ENUM.BOTTOM) {\n phi = HALF_PI + lat;\n if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {\n area.value = AREA_ENUM.AREA_0;\n theta = -lon + HALF_PI;\n } else if (lon < FORTPI && lon >= -FORTPI) {\n area.value = AREA_ENUM.AREA_1;\n theta = -lon;\n } else if (lon < -FORTPI && lon >= -(HALF_PI + FORTPI)) {\n area.value = AREA_ENUM.AREA_2;\n theta = -lon - HALF_PI;\n } else {\n area.value = AREA_ENUM.AREA_3;\n theta = (lon > 0.0 ? -lon + SPI : -lon - SPI);\n }\n } else {\n var q, r, s;\n var sinlat, coslat;\n var sinlon, coslon;\n\n if (this.face === FACE_ENUM.RIGHT) {\n lon = qsc_shift_lon_origin(lon, +HALF_PI);\n } else if (this.face === FACE_ENUM.BACK) {\n lon = qsc_shift_lon_origin(lon, +SPI);\n } else if (this.face === FACE_ENUM.LEFT) {\n lon = qsc_shift_lon_origin(lon, -HALF_PI);\n }\n sinlat = Math.sin(lat);\n coslat = Math.cos(lat);\n sinlon = Math.sin(lon);\n coslon = Math.cos(lon);\n q = coslat * coslon;\n r = coslat * sinlon;\n s = sinlat;\n\n if (this.face === FACE_ENUM.FRONT) {\n phi = Math.acos(q);\n theta = qsc_fwd_equat_face_theta(phi, s, r, area);\n } else if (this.face === FACE_ENUM.RIGHT) {\n phi = Math.acos(r);\n theta = qsc_fwd_equat_face_theta(phi, s, -q, area);\n } else if (this.face === FACE_ENUM.BACK) {\n phi = Math.acos(-q);\n theta = qsc_fwd_equat_face_theta(phi, s, -r, area);\n } else if (this.face === FACE_ENUM.LEFT) {\n phi = Math.acos(-r);\n theta = qsc_fwd_equat_face_theta(phi, s, q, area);\n } else {\n /* Impossible */\n phi = theta = 0;\n area.value = AREA_ENUM.AREA_0;\n }\n }\n\n /* Compute mu and nu for the area of definition.\n * For mu, see Eq. (3-21) in [OL76], but note the typos:\n * compare with Eq. (3-14). For nu, see Eq. (3-38). */\n mu = Math.atan((12 / SPI) * (theta + Math.acos(Math.sin(theta) * Math.cos(FORTPI)) - HALF_PI));\n t = Math.sqrt((1 - Math.cos(phi)) / (Math.cos(mu) * Math.cos(mu)) / (1 - Math.cos(Math.atan(1 / Math.cos(theta)))));\n\n /* Apply the result to the real area. */\n if (area.value === AREA_ENUM.AREA_1) {\n mu += HALF_PI;\n } else if (area.value === AREA_ENUM.AREA_2) {\n mu += SPI;\n } else if (area.value === AREA_ENUM.AREA_3) {\n mu += 1.5 * SPI;\n }\n\n /* Now compute x, y from mu and nu */\n xy.x = t * Math.cos(mu);\n xy.y = t * Math.sin(mu);\n xy.x = xy.x * this.a + this.x0;\n xy.y = xy.y * this.a + this.y0;\n\n p.x = xy.x;\n p.y = xy.y;\n return p;\n}\n\n// QSC inverse equations--mapping x,y to lat/long\n// -----------------------------------------------------------------\nexport function inverse(p) {\n var lp = { lam: 0, phi: 0 };\n var mu, nu, cosmu, tannu;\n var tantheta, theta, cosphi, phi;\n var t;\n var area = { value: 0 };\n\n /* de-offset */\n p.x = (p.x - this.x0) / this.a;\n p.y = (p.y - this.y0) / this.a;\n\n /* Convert the input x, y to the mu and nu angles as used by QSC.\n * This depends on the area of the cube face. */\n nu = Math.atan(Math.sqrt(p.x * p.x + p.y * p.y));\n mu = Math.atan2(p.y, p.x);\n if (p.x >= 0.0 && p.x >= Math.abs(p.y)) {\n area.value = AREA_ENUM.AREA_0;\n } else if (p.y >= 0.0 && p.y >= Math.abs(p.x)) {\n area.value = AREA_ENUM.AREA_1;\n mu -= HALF_PI;\n } else if (p.x < 0.0 && -p.x >= Math.abs(p.y)) {\n area.value = AREA_ENUM.AREA_2;\n mu = (mu < 0.0 ? mu + SPI : mu - SPI);\n } else {\n area.value = AREA_ENUM.AREA_3;\n mu += HALF_PI;\n }\n\n /* Compute phi and theta for the area of definition.\n * The inverse projection is not described in the original paper, but some\n * good hints can be found here (as of 2011-12-14):\n * http://fits.gsfc.nasa.gov/fitsbits/saf.93/saf.9302\n * (search for \"Message-Id: <9302181759.AA25477 at fits.cv.nrao.edu>\") */\n t = (SPI / 12) * Math.tan(mu);\n tantheta = Math.sin(t) / (Math.cos(t) - (1 / Math.sqrt(2)));\n theta = Math.atan(tantheta);\n cosmu = Math.cos(mu);\n tannu = Math.tan(nu);\n cosphi = 1 - cosmu * cosmu * tannu * tannu * (1 - Math.cos(Math.atan(1 / Math.cos(theta))));\n if (cosphi < -1) {\n cosphi = -1;\n } else if (cosphi > +1) {\n cosphi = +1;\n }\n\n /* Apply the result to the real area on the cube face.\n * For the top and bottom face, we can compute phi and lam directly.\n * For the other faces, we must use unit sphere cartesian coordinates\n * as an intermediate step. */\n if (this.face === FACE_ENUM.TOP) {\n phi = Math.acos(cosphi);\n lp.phi = HALF_PI - phi;\n if (area.value === AREA_ENUM.AREA_0) {\n lp.lam = theta + HALF_PI;\n } else if (area.value === AREA_ENUM.AREA_1) {\n lp.lam = (theta < 0.0 ? theta + SPI : theta - SPI);\n } else if (area.value === AREA_ENUM.AREA_2) {\n lp.lam = theta - HALF_PI;\n } else /* area.value == AREA_ENUM.AREA_3 */ {\n lp.lam = theta;\n }\n } else if (this.face === FACE_ENUM.BOTTOM) {\n phi = Math.acos(cosphi);\n lp.phi = phi - HALF_PI;\n if (area.value === AREA_ENUM.AREA_0) {\n lp.lam = -theta + HALF_PI;\n } else if (area.value === AREA_ENUM.AREA_1) {\n lp.lam = -theta;\n } else if (area.value === AREA_ENUM.AREA_2) {\n lp.lam = -theta - HALF_PI;\n } else /* area.value == AREA_ENUM.AREA_3 */ {\n lp.lam = (theta < 0.0 ? -theta - SPI : -theta + SPI);\n }\n } else {\n /* Compute phi and lam via cartesian unit sphere coordinates. */\n var q, r, s;\n q = cosphi;\n t = q * q;\n if (t >= 1) {\n s = 0;\n } else {\n s = Math.sqrt(1 - t) * Math.sin(theta);\n }\n t += s * s;\n if (t >= 1) {\n r = 0;\n } else {\n r = Math.sqrt(1 - t);\n }\n /* Rotate q,r,s into the correct area. */\n if (area.value === AREA_ENUM.AREA_1) {\n t = r;\n r = -s;\n s = t;\n } else if (area.value === AREA_ENUM.AREA_2) {\n r = -r;\n s = -s;\n } else if (area.value === AREA_ENUM.AREA_3) {\n t = r;\n r = s;\n s = -t;\n }\n /* Rotate q,r,s into the correct cube face. */\n if (this.face === FACE_ENUM.RIGHT) {\n t = q;\n q = -r;\n r = t;\n } else if (this.face === FACE_ENUM.BACK) {\n q = -q;\n r = -r;\n } else if (this.face === FACE_ENUM.LEFT) {\n t = q;\n q = r;\n r = -t;\n }\n /* Now compute phi and lam from the unit sphere coordinates. */\n lp.phi = Math.acos(-s) - HALF_PI;\n lp.lam = Math.atan2(r, q);\n if (this.face === FACE_ENUM.RIGHT) {\n lp.lam = qsc_shift_lon_origin(lp.lam, -HALF_PI);\n } else if (this.face === FACE_ENUM.BACK) {\n lp.lam = qsc_shift_lon_origin(lp.lam, -SPI);\n } else if (this.face === FACE_ENUM.LEFT) {\n lp.lam = qsc_shift_lon_origin(lp.lam, +HALF_PI);\n }\n }\n\n /* Apply the shift from the sphere to the ellipsoid as described\n * in [LK12]. */\n if (this.es !== 0) {\n var invert_sign;\n var tanphi, xa;\n invert_sign = (lp.phi < 0 ? 1 : 0);\n tanphi = Math.tan(lp.phi);\n xa = this.b / Math.sqrt(tanphi * tanphi + this.one_minus_f_squared);\n lp.phi = Math.atan(Math.sqrt(this.a * this.a - xa * xa) / (this.one_minus_f * xa));\n if (invert_sign) {\n lp.phi = -lp.phi;\n }\n }\n\n lp.lam += this.long0;\n p.x = lp.lam;\n p.y = lp.phi;\n return p;\n}\n\n/* Helper function for forward projection: compute the theta angle\n * and determine the area number. */\nfunction qsc_fwd_equat_face_theta(phi, y, x, area) {\n var theta;\n if (phi < EPSLN) {\n area.value = AREA_ENUM.AREA_0;\n theta = 0.0;\n } else {\n theta = Math.atan2(y, x);\n if (Math.abs(theta) <= FORTPI) {\n area.value = AREA_ENUM.AREA_0;\n } else if (theta > FORTPI && theta <= HALF_PI + FORTPI) {\n area.value = AREA_ENUM.AREA_1;\n theta -= HALF_PI;\n } else if (theta > HALF_PI + FORTPI || theta <= -(HALF_PI + FORTPI)) {\n area.value = AREA_ENUM.AREA_2;\n theta = (theta >= 0.0 ? theta - SPI : theta + SPI);\n } else {\n area.value = AREA_ENUM.AREA_3;\n theta += HALF_PI;\n }\n }\n return theta;\n}\n\n/* Helper function: shift the longitude. */\nfunction qsc_shift_lon_origin(lon, offset) {\n var slon = lon + offset;\n if (slon < -SPI) {\n slon += TWO_PI;\n } else if (slon > +SPI) {\n slon -= TWO_PI;\n }\n return slon;\n}\n\nexport var names = ['Quadrilateralized Spherical Cube', 'Quadrilateralized_Spherical_Cube', 'qsc'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","// Robinson projection\n// Based on https://github.com/OSGeo/proj.4/blob/master/src/PJ_robin.c\n// Polynomial coeficients from http://article.gmane.org/gmane.comp.gis.proj-4.devel/6039\n\nimport { HALF_PI, D2R, R2D, EPSLN } from '../constants/values';\nimport adjust_lon from '../common/adjust_lon';\n\nvar COEFS_X = [\n [1.0000, 2.2199e-17, -7.15515e-05, 3.1103e-06],\n [0.9986, -0.000482243, -2.4897e-05, -1.3309e-06],\n [0.9954, -0.00083103, -4.48605e-05, -9.86701e-07],\n [0.9900, -0.00135364, -5.9661e-05, 3.6777e-06],\n [0.9822, -0.00167442, -4.49547e-06, -5.72411e-06],\n [0.9730, -0.00214868, -9.03571e-05, 1.8736e-08],\n [0.9600, -0.00305085, -9.00761e-05, 1.64917e-06],\n [0.9427, -0.00382792, -6.53386e-05, -2.6154e-06],\n [0.9216, -0.00467746, -0.00010457, 4.81243e-06],\n [0.8962, -0.00536223, -3.23831e-05, -5.43432e-06],\n [0.8679, -0.00609363, -0.000113898, 3.32484e-06],\n [0.8350, -0.00698325, -6.40253e-05, 9.34959e-07],\n [0.7986, -0.00755338, -5.00009e-05, 9.35324e-07],\n [0.7597, -0.00798324, -3.5971e-05, -2.27626e-06],\n [0.7186, -0.00851367, -7.01149e-05, -8.6303e-06],\n [0.6732, -0.00986209, -0.000199569, 1.91974e-05],\n [0.6213, -0.010418, 8.83923e-05, 6.24051e-06],\n [0.5722, -0.00906601, 0.000182, 6.24051e-06],\n [0.5322, -0.00677797, 0.000275608, 6.24051e-06]\n];\n\nvar COEFS_Y = [\n [-5.20417e-18, 0.0124, 1.21431e-18, -8.45284e-11],\n [0.0620, 0.0124, -1.26793e-09, 4.22642e-10],\n [0.1240, 0.0124, 5.07171e-09, -1.60604e-09],\n [0.1860, 0.0123999, -1.90189e-08, 6.00152e-09],\n [0.2480, 0.0124002, 7.10039e-08, -2.24e-08],\n [0.3100, 0.0123992, -2.64997e-07, 8.35986e-08],\n [0.3720, 0.0124029, 9.88983e-07, -3.11994e-07],\n [0.4340, 0.0123893, -3.69093e-06, -4.35621e-07],\n [0.4958, 0.0123198, -1.02252e-05, -3.45523e-07],\n [0.5571, 0.0121916, -1.54081e-05, -5.82288e-07],\n [0.6176, 0.0119938, -2.41424e-05, -5.25327e-07],\n [0.6769, 0.011713, -3.20223e-05, -5.16405e-07],\n [0.7346, 0.0113541, -3.97684e-05, -6.09052e-07],\n [0.7903, 0.0109107, -4.89042e-05, -1.04739e-06],\n [0.8435, 0.0103431, -6.4615e-05, -1.40374e-09],\n [0.8936, 0.00969686, -6.4636e-05, -8.547e-06],\n [0.9394, 0.00840947, -0.000192841, -4.2106e-06],\n [0.9761, 0.00616527, -0.000256, -4.2106e-06],\n [1.0000, 0.00328947, -0.000319159, -4.2106e-06]\n];\n\nvar FXC = 0.8487;\nvar FYC = 1.3523;\nvar C1 = R2D / 5; // rad to 5-degree interval\nvar RC1 = 1 / C1;\nvar NODES = 18;\n\nvar poly3_val = function (coefs, x) {\n return coefs[0] + x * (coefs[1] + x * (coefs[2] + x * coefs[3]));\n};\n\nvar poly3_der = function (coefs, x) {\n return coefs[1] + x * (2 * coefs[2] + x * 3 * coefs[3]);\n};\n\nfunction newton_rapshon(f_df, start, max_err, iters) {\n var x = start;\n for (; iters; --iters) {\n var upd = f_df(x);\n x -= upd;\n if (Math.abs(upd) < max_err) {\n break;\n }\n }\n return x;\n}\n\nexport function init() {\n this.x0 = this.x0 || 0;\n this.y0 = this.y0 || 0;\n this.long0 = this.long0 || 0;\n this.es = 0;\n this.title = this.title || 'Robinson';\n}\n\nexport function forward(ll) {\n var lon = adjust_lon(ll.x - this.long0, this.over);\n\n var dphi = Math.abs(ll.y);\n var i = Math.floor(dphi * C1);\n if (i < 0) {\n i = 0;\n } else if (i >= NODES) {\n i = NODES - 1;\n }\n dphi = R2D * (dphi - RC1 * i);\n var xy = {\n x: poly3_val(COEFS_X[i], dphi) * lon,\n y: poly3_val(COEFS_Y[i], dphi)\n };\n if (ll.y < 0) {\n xy.y = -xy.y;\n }\n\n xy.x = xy.x * this.a * FXC + this.x0;\n xy.y = xy.y * this.a * FYC + this.y0;\n return xy;\n}\n\nexport function inverse(xy) {\n var ll = {\n x: (xy.x - this.x0) / (this.a * FXC),\n y: Math.abs(xy.y - this.y0) / (this.a * FYC)\n };\n\n if (ll.y >= 1) { // pathologic case\n ll.x /= COEFS_X[NODES][0];\n ll.y = xy.y < 0 ? -HALF_PI : HALF_PI;\n } else {\n // find table interval\n var i = Math.floor(ll.y * NODES);\n if (i < 0) {\n i = 0;\n } else if (i >= NODES) {\n i = NODES - 1;\n }\n for (;;) {\n if (COEFS_Y[i][0] > ll.y) {\n --i;\n } else if (COEFS_Y[i + 1][0] <= ll.y) {\n ++i;\n } else {\n break;\n }\n }\n // linear interpolation in 5 degree interval\n var coefs = COEFS_Y[i];\n var t = 5 * (ll.y - coefs[0]) / (COEFS_Y[i + 1][0] - coefs[0]);\n // find t so that poly3_val(coefs, t) = ll.y\n t = newton_rapshon(function (x) {\n return (poly3_val(coefs, x) - ll.y) / poly3_der(coefs, x);\n }, t, EPSLN, 100);\n\n ll.x /= poly3_val(COEFS_X[i], t);\n ll.y = (5 * i + t) * D2R;\n if (xy.y < 0) {\n ll.y = -ll.y;\n }\n }\n\n ll.x = adjust_lon(ll.x + this.long0, this.over);\n return ll;\n}\n\nexport var names = ['Robinson', 'robin'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import {\n geodeticToGeocentric,\n geocentricToGeodetic\n} from '../datumUtils';\n\nexport function init() {\n this.name = 'geocent';\n}\n\nexport function forward(p) {\n var point = geodeticToGeocentric(p, this.es, this.a);\n return point;\n}\n\nexport function inverse(p) {\n var point = geocentricToGeodetic(p, this.es, this.a, this.b);\n return point;\n}\n\nexport var names = ['Geocentric', 'geocentric', 'geocent', 'Geocent'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import { D2R, HALF_PI, EPSLN } from '../constants/values';\nimport hypot from '../common/hypot';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} mode\n * @property {number} sinph0\n * @property {number} cosph0\n * @property {number} pn1\n * @property {number} h\n * @property {number} rp\n * @property {number} p\n * @property {number} h1\n * @property {number} pfact\n * @property {number} es\n * @property {number} tilt\n * @property {number} azi\n * @property {number} cg\n * @property {number} sg\n * @property {number} cw\n * @property {number} sw\n */\n\nvar mode = {\n N_POLE: 0,\n S_POLE: 1,\n EQUIT: 2,\n OBLIQ: 3\n};\n\nvar params = {\n h: { def: 100000, num: true }, // default is Karman line, no default in PROJ.7\n azi: { def: 0, num: true, degrees: true }, // default is North\n tilt: { def: 0, num: true, degrees: true }, // default is Nadir\n long0: { def: 0, num: true }, // default is Greenwich, conversion to rad is automatic\n lat0: { def: 0, num: true } // default is Equator, conversion to rad is automatic\n};\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n Object.keys(params).forEach(function (p) {\n if (typeof this[p] === 'undefined') {\n this[p] = params[p].def;\n } else if (params[p].num && isNaN(this[p])) {\n throw new Error('Invalid parameter value, must be numeric ' + p + ' = ' + this[p]);\n } else if (params[p].num) {\n this[p] = parseFloat(this[p]);\n }\n if (params[p].degrees) {\n this[p] = this[p] * D2R;\n }\n }.bind(this));\n\n if (Math.abs((Math.abs(this.lat0) - HALF_PI)) < EPSLN) {\n this.mode = this.lat0 < 0 ? mode.S_POLE : mode.N_POLE;\n } else if (Math.abs(this.lat0) < EPSLN) {\n this.mode = mode.EQUIT;\n } else {\n this.mode = mode.OBLIQ;\n this.sinph0 = Math.sin(this.lat0);\n this.cosph0 = Math.cos(this.lat0);\n }\n\n this.pn1 = this.h / this.a; // Normalize relative to the Earth's radius\n\n if (this.pn1 <= 0 || this.pn1 > 1e10) {\n throw new Error('Invalid height');\n }\n\n this.p = 1 + this.pn1;\n this.rp = 1 / this.p;\n this.h1 = 1 / this.pn1;\n this.pfact = (this.p + 1) * this.h1;\n this.es = 0;\n\n var omega = this.tilt;\n var gamma = this.azi;\n this.cg = Math.cos(gamma);\n this.sg = Math.sin(gamma);\n this.cw = Math.cos(omega);\n this.sw = Math.sin(omega);\n}\n\nexport function forward(p) {\n p.x -= this.long0;\n var sinphi = Math.sin(p.y);\n var cosphi = Math.cos(p.y);\n var coslam = Math.cos(p.x);\n var x, y;\n switch (this.mode) {\n case mode.OBLIQ:\n y = this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;\n break;\n case mode.EQUIT:\n y = cosphi * coslam;\n break;\n case mode.S_POLE:\n y = -sinphi;\n break;\n case mode.N_POLE:\n y = sinphi;\n break;\n }\n y = this.pn1 / (this.p - y);\n x = y * cosphi * Math.sin(p.x);\n\n switch (this.mode) {\n case mode.OBLIQ:\n y *= this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;\n break;\n case mode.EQUIT:\n y *= sinphi;\n break;\n case mode.N_POLE:\n y *= -(cosphi * coslam);\n break;\n case mode.S_POLE:\n y *= cosphi * coslam;\n break;\n }\n\n // Tilt\n var yt, ba;\n yt = y * this.cg + x * this.sg;\n ba = 1 / (yt * this.sw * this.h1 + this.cw);\n x = (x * this.cg - y * this.sg) * this.cw * ba;\n y = yt * ba;\n\n p.x = x * this.a;\n p.y = y * this.a;\n return p;\n}\n\nexport function inverse(p) {\n p.x /= this.a;\n p.y /= this.a;\n var r = { x: p.x, y: p.y };\n\n // Un-Tilt\n var bm, bq, yt;\n yt = 1 / (this.pn1 - p.y * this.sw);\n bm = this.pn1 * p.x * yt;\n bq = this.pn1 * p.y * this.cw * yt;\n p.x = bm * this.cg + bq * this.sg;\n p.y = bq * this.cg - bm * this.sg;\n\n var rh = hypot(p.x, p.y);\n if (Math.abs(rh) < EPSLN) {\n r.x = 0;\n r.y = p.y;\n } else {\n var cosz, sinz;\n sinz = 1 - rh * rh * this.pfact;\n sinz = (this.p - Math.sqrt(sinz)) / (this.pn1 / rh + rh / this.pn1);\n cosz = Math.sqrt(1 - sinz * sinz);\n switch (this.mode) {\n case mode.OBLIQ:\n r.y = Math.asin(cosz * this.sinph0 + p.y * sinz * this.cosph0 / rh);\n p.y = (cosz - this.sinph0 * Math.sin(r.y)) * rh;\n p.x *= sinz * this.cosph0;\n break;\n case mode.EQUIT:\n r.y = Math.asin(p.y * sinz / rh);\n p.y = cosz * rh;\n p.x *= sinz;\n break;\n case mode.N_POLE:\n r.y = Math.asin(cosz);\n p.y = -p.y;\n break;\n case mode.S_POLE:\n r.y = -Math.asin(cosz);\n break;\n }\n r.x = Math.atan2(p.x, p.y);\n }\n\n p.x = r.x + this.long0;\n p.y = r.y;\n return p;\n}\n\nexport var names = ['Tilted_Perspective', 'tpers'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import hypot from '../common/hypot';\n\n/**\n * @typedef {Object} LocalThis\n * @property {1 | 0} flip_axis\n * @property {number} h\n * @property {number} radius_g_1\n * @property {number} radius_g\n * @property {number} radius_p\n * @property {number} radius_p2\n * @property {number} radius_p_inv2\n * @property {'ellipse'|'sphere'} shape\n * @property {number} C\n * @property {string} sweep\n * @property {number} es\n */\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n this.flip_axis = (this.sweep === 'x' ? 1 : 0);\n this.h = Number(this.h);\n this.radius_g_1 = this.h / this.a;\n\n if (this.radius_g_1 <= 0 || this.radius_g_1 > 1e10) {\n throw new Error();\n }\n\n this.radius_g = 1.0 + this.radius_g_1;\n this.C = this.radius_g * this.radius_g - 1.0;\n\n if (this.es !== 0.0) {\n var one_es = 1.0 - this.es;\n var rone_es = 1 / one_es;\n\n this.radius_p = Math.sqrt(one_es);\n this.radius_p2 = one_es;\n this.radius_p_inv2 = rone_es;\n\n this.shape = 'ellipse'; // Use as a condition in the forward and inverse functions.\n } else {\n this.radius_p = 1.0;\n this.radius_p2 = 1.0;\n this.radius_p_inv2 = 1.0;\n\n this.shape = 'sphere'; // Use as a condition in the forward and inverse functions.\n }\n\n if (!this.title) {\n this.title = 'Geostationary Satellite View';\n }\n}\n\nfunction forward(p) {\n var lon = p.x;\n var lat = p.y;\n var tmp, v_x, v_y, v_z;\n lon = lon - this.long0;\n\n if (this.shape === 'ellipse') {\n lat = Math.atan(this.radius_p2 * Math.tan(lat));\n var r = this.radius_p / hypot(this.radius_p * Math.cos(lat), Math.sin(lat));\n\n v_x = r * Math.cos(lon) * Math.cos(lat);\n v_y = r * Math.sin(lon) * Math.cos(lat);\n v_z = r * Math.sin(lat);\n\n if (((this.radius_g - v_x) * v_x - v_y * v_y - v_z * v_z * this.radius_p_inv2) < 0.0) {\n p.x = Number.NaN;\n p.y = Number.NaN;\n return p;\n }\n\n tmp = this.radius_g - v_x;\n if (this.flip_axis) {\n p.x = this.radius_g_1 * Math.atan(v_y / hypot(v_z, tmp));\n p.y = this.radius_g_1 * Math.atan(v_z / tmp);\n } else {\n p.x = this.radius_g_1 * Math.atan(v_y / tmp);\n p.y = this.radius_g_1 * Math.atan(v_z / hypot(v_y, tmp));\n }\n } else if (this.shape === 'sphere') {\n tmp = Math.cos(lat);\n v_x = Math.cos(lon) * tmp;\n v_y = Math.sin(lon) * tmp;\n v_z = Math.sin(lat);\n tmp = this.radius_g - v_x;\n\n if (this.flip_axis) {\n p.x = this.radius_g_1 * Math.atan(v_y / hypot(v_z, tmp));\n p.y = this.radius_g_1 * Math.atan(v_z / tmp);\n } else {\n p.x = this.radius_g_1 * Math.atan(v_y / tmp);\n p.y = this.radius_g_1 * Math.atan(v_z / hypot(v_y, tmp));\n }\n }\n p.x = p.x * this.a;\n p.y = p.y * this.a;\n return p;\n}\n\nfunction inverse(p) {\n var v_x = -1.0;\n var v_y = 0.0;\n var v_z = 0.0;\n var a, b, det, k;\n\n p.x = p.x / this.a;\n p.y = p.y / this.a;\n\n if (this.shape === 'ellipse') {\n if (this.flip_axis) {\n v_z = Math.tan(p.y / this.radius_g_1);\n v_y = Math.tan(p.x / this.radius_g_1) * hypot(1.0, v_z);\n } else {\n v_y = Math.tan(p.x / this.radius_g_1);\n v_z = Math.tan(p.y / this.radius_g_1) * hypot(1.0, v_y);\n }\n\n var v_zp = v_z / this.radius_p;\n a = v_y * v_y + v_zp * v_zp + v_x * v_x;\n b = 2 * this.radius_g * v_x;\n det = (b * b) - 4 * a * this.C;\n\n if (det < 0.0) {\n p.x = Number.NaN;\n p.y = Number.NaN;\n return p;\n }\n\n k = (-b - Math.sqrt(det)) / (2.0 * a);\n v_x = this.radius_g + k * v_x;\n v_y *= k;\n v_z *= k;\n\n p.x = Math.atan2(v_y, v_x);\n p.y = Math.atan(v_z * Math.cos(p.x) / v_x);\n p.y = Math.atan(this.radius_p_inv2 * Math.tan(p.y));\n } else if (this.shape === 'sphere') {\n if (this.flip_axis) {\n v_z = Math.tan(p.y / this.radius_g_1);\n v_y = Math.tan(p.x / this.radius_g_1) * Math.sqrt(1.0 + v_z * v_z);\n } else {\n v_y = Math.tan(p.x / this.radius_g_1);\n v_z = Math.tan(p.y / this.radius_g_1) * Math.sqrt(1.0 + v_y * v_y);\n }\n\n a = v_y * v_y + v_z * v_z + v_x * v_x;\n b = 2 * this.radius_g * v_x;\n det = (b * b) - 4 * a * this.C;\n if (det < 0.0) {\n p.x = Number.NaN;\n p.y = Number.NaN;\n return p;\n }\n\n k = (-b - Math.sqrt(det)) / (2.0 * a);\n v_x = this.radius_g + k * v_x;\n v_y *= k;\n v_z *= k;\n\n p.x = Math.atan2(v_y, v_x);\n p.y = Math.atan(v_z * Math.cos(p.x) / v_x);\n }\n p.x = p.x + this.long0;\n return p;\n}\n\nexport var names = ['Geostationary Satellite View', 'Geostationary_Satellite', 'geos'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","/**\n * Copyright 2018 Bernie Jenny, Monash University, Melbourne, Australia.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * Equal Earth is a projection inspired by the Robinson projection, but unlike\n * the Robinson projection retains the relative size of areas. The projection\n * was designed in 2018 by Bojan Savric, Tom Patterson and Bernhard Jenny.\n *\n * Publication:\n * Bojan Savric, Tom Patterson & Bernhard Jenny (2018). The Equal Earth map\n * projection, International Journal of Geographical Information Science,\n * DOI: 10.1080/13658816.2018.1504949\n *\n * Code released August 2018\n * Ported to JavaScript and adapted for mapshaper-proj by Matthew Bloch August 2018\n * Modified for proj4js by Andreas Hocevar by Andreas Hocevar March 2024\n */\n\nimport adjust_lon from '../common/adjust_lon';\n\nvar A1 = 1.340264,\n A2 = -0.081106,\n A3 = 0.000893,\n A4 = 0.003796,\n M = Math.sqrt(3) / 2.0;\n\nexport function init() {\n this.es = 0;\n this.long0 = this.long0 !== undefined ? this.long0 : 0;\n this.x0 = this.x0 !== undefined ? this.x0 : 0;\n this.y0 = this.y0 !== undefined ? this.y0 : 0;\n}\n\nexport function forward(p) {\n var lam = adjust_lon(p.x - this.long0, this.over);\n var phi = p.y;\n var paramLat = Math.asin(M * Math.sin(phi)),\n paramLatSq = paramLat * paramLat,\n paramLatPow6 = paramLatSq * paramLatSq * paramLatSq;\n p.x = lam * Math.cos(paramLat)\n / (M * (A1 + 3 * A2 * paramLatSq + paramLatPow6 * (7 * A3 + 9 * A4 * paramLatSq)));\n p.y = paramLat * (A1 + A2 * paramLatSq + paramLatPow6 * (A3 + A4 * paramLatSq));\n\n p.x = this.a * p.x + this.x0;\n p.y = this.a * p.y + this.y0;\n return p;\n}\n\nexport function inverse(p) {\n p.x = (p.x - this.x0) / this.a;\n p.y = (p.y - this.y0) / this.a;\n\n var EPS = 1e-9,\n NITER = 12,\n paramLat = p.y,\n paramLatSq, paramLatPow6, fy, fpy, dlat, i;\n\n for (i = 0; i < NITER; ++i) {\n paramLatSq = paramLat * paramLat;\n paramLatPow6 = paramLatSq * paramLatSq * paramLatSq;\n fy = paramLat * (A1 + A2 * paramLatSq + paramLatPow6 * (A3 + A4 * paramLatSq)) - p.y;\n fpy = A1 + 3 * A2 * paramLatSq + paramLatPow6 * (7 * A3 + 9 * A4 * paramLatSq);\n paramLat -= dlat = fy / fpy;\n if (Math.abs(dlat) < EPS) {\n break;\n }\n }\n paramLatSq = paramLat * paramLat;\n paramLatPow6 = paramLatSq * paramLatSq * paramLatSq;\n p.x = M * p.x * (A1 + 3 * A2 * paramLatSq + paramLatPow6 * (7 * A3 + 9 * A4 * paramLatSq))\n / Math.cos(paramLat);\n p.y = Math.asin(Math.sin(paramLat) / M);\n\n p.x = adjust_lon(p.x + this.long0, this.over);\n return p;\n}\n\nexport var names = ['eqearth', 'Equal Earth', 'Equal_Earth'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import adjust_lat from '../common/adjust_lat';\nimport adjust_lon from '../common/adjust_lon';\nimport hypot from '../common/hypot';\nimport pj_enfn from '../common/pj_enfn';\nimport pj_inv_mlfn from '../common/pj_inv_mlfn';\nimport pj_mlfn from '../common/pj_mlfn';\nimport { HALF_PI } from '../constants/values';\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} phi1\n * @property {number} cphi1\n * @property {number} es\n * @property {Array<number>} en\n * @property {number} m1\n * @property {number} am1\n */\n\nvar EPS10 = 1e-10;\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n var c;\n\n this.phi1 = this.lat1;\n if (Math.abs(this.phi1) < EPS10) {\n throw new Error();\n }\n if (this.es) {\n this.en = pj_enfn(this.es);\n this.m1 = pj_mlfn(this.phi1, this.am1 = Math.sin(this.phi1),\n c = Math.cos(this.phi1), this.en);\n this.am1 = c / (Math.sqrt(1 - this.es * this.am1 * this.am1) * this.am1);\n this.inverse = e_inv;\n this.forward = e_fwd;\n } else {\n if (Math.abs(this.phi1) + EPS10 >= HALF_PI) {\n this.cphi1 = 0;\n } else {\n this.cphi1 = 1 / Math.tan(this.phi1);\n }\n this.inverse = s_inv;\n this.forward = s_fwd;\n }\n}\n\nfunction e_fwd(p) {\n var lam = adjust_lon(p.x - (this.long0 || 0), this.over);\n var phi = p.y;\n var rh, E, c;\n rh = this.am1 + this.m1 - pj_mlfn(phi, E = Math.sin(phi), c = Math.cos(phi), this.en);\n E = c * lam / (rh * Math.sqrt(1 - this.es * E * E));\n p.x = rh * Math.sin(E);\n p.y = this.am1 - rh * Math.cos(E);\n\n p.x = this.a * p.x + (this.x0 || 0);\n p.y = this.a * p.y + (this.y0 || 0);\n return p;\n}\n\nfunction e_inv(p) {\n p.x = (p.x - (this.x0 || 0)) / this.a;\n p.y = (p.y - (this.y0 || 0)) / this.a;\n\n var s, rh, lam, phi;\n rh = hypot(p.x, p.y = this.am1 - p.y);\n phi = pj_inv_mlfn(this.am1 + this.m1 - rh, this.es, this.en);\n if ((s = Math.abs(phi)) < HALF_PI) {\n s = Math.sin(phi);\n lam = rh * Math.atan2(p.x, p.y) * Math.sqrt(1 - this.es * s * s) / Math.cos(phi);\n } else if (Math.abs(s - HALF_PI) <= EPS10) {\n lam = 0;\n } else {\n throw new Error();\n }\n p.x = adjust_lon(lam + (this.long0 || 0), this.over);\n p.y = adjust_lat(phi);\n return p;\n}\n\nfunction s_fwd(p) {\n var lam = adjust_lon(p.x - (this.long0 || 0), this.over);\n var phi = p.y;\n var E, rh;\n rh = this.cphi1 + this.phi1 - phi;\n if (Math.abs(rh) > EPS10) {\n p.x = rh * Math.sin(E = lam * Math.cos(phi) / rh);\n p.y = this.cphi1 - rh * Math.cos(E);\n } else {\n p.x = p.y = 0;\n }\n\n p.x = this.a * p.x + (this.x0 || 0);\n p.y = this.a * p.y + (this.y0 || 0);\n return p;\n}\n\nfunction s_inv(p) {\n p.x = (p.x - (this.x0 || 0)) / this.a;\n p.y = (p.y - (this.y0 || 0)) / this.a;\n\n var lam, phi;\n var rh = hypot(p.x, p.y = this.cphi1 - p.y);\n phi = this.cphi1 + this.phi1 - rh;\n if (Math.abs(phi) > HALF_PI) {\n throw new Error();\n }\n if (Math.abs(Math.abs(phi) - HALF_PI) <= EPS10) {\n lam = 0;\n } else {\n lam = rh * Math.atan2(p.x, p.y) / Math.cos(phi);\n }\n p.x = adjust_lon(lam + (this.long0 || 0), this.over);\n p.y = adjust_lat(phi);\n return p;\n}\n\nexport var names = ['bonne', 'Bonne (Werner lat_1=90)'];\nexport default {\n init: init,\n names: names\n};\n","import adjust_lon from '../common/adjust_lon';\nimport { D2R, R2D, HALF_PI, EPSLN } from '../constants/values';\nimport Proj from '../Proj';\nimport { names as longLatNames } from './longlat';\n\n/**\n Original projection implementation:\n https://github.com/OSGeo/PROJ/blob/46c47e9adf6376ae06afabe5d24a0016a05ced82/src/projections/ob_tran.cpp\n\n Documentation:\n https://proj.org/operations/projections/ob_tran.html\n\n References/Formulas:\n https://pubs.usgs.gov/pp/1395/report.pdf\n\n Examples:\n +proj=ob_tran +o_proj=moll +o_lat_p=45 +o_lon_p=-90\n +proj=ob_tran +o_proj=moll +o_lat_p=45 +o_lon_p=-90 +lon_0=60\n +proj=ob_tran +o_proj=moll +o_lat_p=45 +o_lon_p=-90 +lon_0=-90\n*/\n\nconst projectionType = {\n OBLIQUE: {\n forward: forwardOblique,\n inverse: inverseOblique\n },\n TRANSVERSE: {\n forward: forwardTransverse,\n inverse: inverseTransverse\n }\n};\n\n/**\n * @typedef {Object} LocalThis\n * @property {number} lamp\n * @property {number} cphip\n * @property {number} sphip\n * @property {Object} projectionType\n * @property {string | undefined} o_proj\n * @property {string | undefined} o_lon_p\n * @property {string | undefined} o_lat_p\n * @property {string | undefined} o_alpha\n * @property {string | undefined} o_lon_c\n * @property {string | undefined} o_lat_c\n * @property {string | undefined} o_lon_1\n * @property {string | undefined} o_lat_1\n * @property {string | undefined} o_lon_2\n * @property {string | undefined} o_lat_2\n * @property {number | undefined} oLongP\n * @property {number | undefined} oLatP\n * @property {number | undefined} oAlpha\n * @property {number | undefined} oLongC\n * @property {number | undefined} oLatC\n * @property {number | undefined} oLong1\n * @property {number | undefined} oLat1\n * @property {number | undefined} oLong2\n * @property {number | undefined} oLat2\n * @property {boolean} isIdentity\n * @property {import('..').Converter} obliqueProjection\n *\n */\n\n/**\n * Parameters can be from the following sets:\n * New pole --> o_lat_p, o_lon_p\n * Rotate about point --> o_alpha, o_lon_c, o_lat_c\n * New equator points --> lon_1, lat_1, lon_2, lat_2\n *\n * Per the original source code, the parameter sets are\n * checked in the order of the object below.\n */\nconst paramSets = {\n ROTATE: {\n o_alpha: 'oAlpha',\n o_lon_c: 'oLongC',\n o_lat_c: 'oLatC'\n },\n NEW_POLE: {\n o_lat_p: 'oLatP',\n o_lon_p: 'oLongP'\n },\n NEW_EQUATOR: {\n o_lon_1: 'oLong1',\n o_lat_1: 'oLat1',\n o_lon_2: 'oLong2',\n o_lat_2: 'oLat2'\n }\n};\n\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function init() {\n this.x0 = this.x0 || 0;\n this.y0 = this.y0 || 0;\n this.long0 = this.long0 || 0;\n this.title = this.title || 'General Oblique Transformation';\n this.isIdentity = longLatNames.includes(this.o_proj);\n\n /** Verify required parameters exist */\n if (!this.o_proj) {\n throw new Error('Missing parameter: o_proj');\n }\n\n if (this.o_proj === `ob_tran`) {\n throw new Error('Invalid value for o_proj: ' + this.o_proj);\n }\n\n const newProjStr = this.projStr.replace('+proj=ob_tran', '').replace('+o_proj=', '+proj=').trim();\n\n /** @type {import('../defs.js').ProjectionDefinition} */\n const oProj = Proj(newProjStr);\n if (!oProj) {\n throw new Error('Invalid parameter: o_proj. Unknown projection ' + this.o_proj);\n }\n oProj.long0 = 0; // we handle long0 before/after forward/inverse\n this.obliqueProjection = oProj;\n\n let matchedSet;\n const paramSetsKeys = Object.keys(paramSets);\n\n /**\n * parse strings, convert to radians, throw on NaN\n * @param {string} name\n * @returns {number | undefined}\n */\n const parseParam = (name) => {\n if (typeof this[name] === `undefined`) {\n return undefined;\n }\n const val = parseFloat(this[name]) * D2R;\n if (isNaN(val)) {\n throw new Error('Invalid value for ' + name + ': ' + this[name]);\n }\n return val;\n };\n\n for (let i = 0; i < paramSetsKeys.length; i++) {\n const setKey = paramSetsKeys[i];\n const set = paramSets[setKey];\n const params = Object.entries(set);\n const setHasParams = params.some(\n ([p]) => typeof this[p] !== 'undefined'\n );\n if (!setHasParams) {\n continue;\n }\n matchedSet = set;\n for (let ii = 0; ii < params.length; ii++) {\n const [inputParam, param] = params[ii];\n const val = parseParam(inputParam);\n if (typeof val === 'undefined') {\n throw new Error('Missing parameter: ' + inputParam + '.');\n }\n this[param] = val;\n }\n break;\n }\n\n if (!matchedSet) {\n throw new Error('No valid parameters provided for ob_tran projection.');\n }\n\n const { lamp, phip } = createRotation(this, matchedSet);\n this.lamp = lamp;\n\n if (Math.abs(phip) > EPSLN) {\n this.cphip = Math.cos(phip);\n this.sphip = Math.sin(phip);\n this.projectionType = projectionType.OBLIQUE;\n } else {\n this.projectionType = projectionType.TRANSVERSE;\n }\n}\n\n// ob_tran forward equations--mapping (lat,long) to (x,y)\n// transverse (90 degrees from normal orientation) - forwardTransverse\n// or oblique (arbitrary angle) used based on parameters - forwardOblique\n// -----------------------------------------------------------------\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function forward(p) {\n return this.projectionType.forward(this, p);\n}\n\n// inverse equations--mapping (x,y) to (lat,long)\n// transverse: inverseTransverse\n// oblique: inverseOblique\n// -----------------------------------------------------------------\n/** @this {import('../defs.js').ProjectionDefinition & LocalThis} */\nexport function inverse(p) {\n return this.projectionType.inverse(this, p);\n}\n\n/**\n * @param {import('../defs.js').ProjectionDefinition & LocalThis} params - Initialized projection definition\n * @param {Object} how - Transformation method\n * @returns {{phip: number, lamp: number}}\n */\nfunction createRotation(params, how) {\n let phip, lamp;\n if (how === paramSets.ROTATE) {\n let lamc = params.oLongC;\n let phic = params.oLatC;\n let alpha = params.oAlpha;\n if (Math.abs(Math.abs(phic) - HALF_PI) <= EPSLN) {\n throw new Error('Invalid value for o_lat_c: ' + params.o_lat_c + ' should be < 90°');\n }\n lamp = lamc + Math.atan2(-1 * Math.cos(alpha), -1 * Math.sin(alpha) * Math.sin(phic));\n phip = Math.asin(Math.cos(phic) * Math.sin(alpha));\n } else if (how === paramSets.NEW_POLE) {\n lamp = params.oLongP;\n phip = params.oLatP;\n } else {\n let lam1 = params.oLong1;\n let phi1 = params.oLat1;\n let lam2 = params.oLong2;\n let phi2 = params.oLat2;\n let con = Math.abs(phi1);\n\n if (Math.abs(phi1) > HALF_PI - EPSLN) {\n throw new Error('Invalid value for o_lat_1: ' + params.o_lat_1 + ' should be < 90°');\n }\n\n if (Math.abs(phi2) > HALF_PI - EPSLN) {\n throw new Error('Invalid value for o_lat_2: ' + params.o_lat_2 + ' should be < 90°');\n }\n\n if (Math.abs(phi1 - phi2) < EPSLN) {\n throw new Error('Invalid value for o_lat_1 and o_lat_2: o_lat_1 should be different from o_lat_2');\n }\n if (con < EPSLN) {\n throw new Error('Invalid value for o_lat_1: o_lat_1 should be different from zero');\n }\n\n lamp = Math.atan2(\n (Math.cos(phi1) * Math.sin(phi2) * Math.cos(lam1))\n - (Math.sin(phi1) * Math.cos(phi2) * Math.cos(lam2)),\n (Math.sin(phi1) * Math.cos(phi2) * Math.sin(lam2))\n - (Math.cos(phi1) * Math.sin(phi2) * Math.sin(lam1))\n );\n\n phip = Math.atan(-1 * Math.cos(lamp - lam1) / Math.tan(phi1));\n }\n\n return { lamp, phip };\n}\n\n/**\n * Forward (lng, lat) to (x, y) for oblique case\n * @param {import('../defs.js').ProjectionDefinition & LocalThis} self\n * @param {{x: number, y: number}} lp - lambda, phi\n */\nfunction forwardOblique(self, lp) {\n let { x: lam, y: phi } = lp;\n lam += self.long0;\n const coslam = Math.cos(lam);\n const sinphi = Math.sin(phi);\n const cosphi = Math.cos(phi);\n\n lp.x = adjust_lon(\n Math.atan2(\n cosphi * Math.sin(lam),\n (self.sphip * cosphi * coslam) + (self.cphip * sinphi)\n ) + self.lamp\n );\n lp.y = Math.asin(\n (self.sphip * sinphi) - (self.cphip * cosphi * coslam)\n );\n\n const result = self.obliqueProjection.forward(lp);\n if (self.isIdentity) {\n result.x *= R2D;\n result.y *= R2D;\n }\n return result;\n}\n\n/**\n * Forward (lng, lat) to (x, y) for transverse case\n * @param {import('../defs.js').ProjectionDefinition & LocalThis} self\n * @param {{x: number, y: number}} lp - lambda, phi\n */\nfunction forwardTransverse(self, lp) {\n let { x: lam, y: phi } = lp;\n lam += self.long0;\n const cosphi = Math.cos(phi);\n const coslam = Math.cos(lam);\n lp.x = adjust_lon(\n Math.atan2(\n cosphi * Math.sin(lam),\n Math.sin(phi)\n ) + self.lamp\n );\n lp.y = Math.asin(-1 * cosphi * coslam);\n\n const result = self.obliqueProjection.forward(lp);\n\n if (self.isIdentity) {\n result.x *= R2D;\n result.y *= R2D;\n }\n return result;\n}\n\n/**\n * Inverse (x, y) to (lng, lat) for oblique case\n * @param {import('../defs.js').ProjectionDefinition & LocalThis} self\n * @param {{x: number, y: number}} lp - lambda, phi\n */\nfunction inverseOblique(self, lp) {\n if (self.isIdentity) {\n lp.x *= D2R;\n lp.y *= D2R;\n }\n\n const innerLp = self.obliqueProjection.inverse(lp);\n let { x: lam, y: phi } = innerLp;\n\n if (lam < Number.MAX_VALUE) {\n lam -= self.lamp;\n const coslam = Math.cos(lam);\n const sinphi = Math.sin(phi);\n const cosphi = Math.cos(phi);\n lp.x = Math.atan2(\n cosphi * Math.sin(lam),\n (self.sphip * cosphi * coslam) - (self.cphip * sinphi)\n );\n lp.y = Math.asin(\n (self.sphip * sinphi) + (self.cphip * cosphi * coslam)\n );\n }\n\n lp.x = adjust_lon(lp.x + self.long0);\n return lp;\n}\n\n/**\n * Inverse (x, y) to (lng, lat) for transverse case\n * @param {import('../defs.js').ProjectionDefinition & LocalThis} self\n * @param {{x: number, y: number}} lp - lambda, phi\n */\nfunction inverseTransverse(self, lp) {\n if (self.isIdentity) {\n lp.x *= D2R;\n lp.y *= D2R;\n }\n\n const innerLp = self.obliqueProjection.inverse(lp);\n let { x: lam, y: phi } = innerLp;\n\n if (lam < Number.MAX_VALUE) {\n const cosphi = Math.cos(phi);\n lam -= self.lamp;\n lp.x = Math.atan2(\n cosphi * Math.sin(lam),\n -1 * Math.sin(phi)\n );\n lp.y = Math.asin(\n cosphi * Math.cos(lam)\n );\n }\n\n lp.x = adjust_lon(lp.x + self.long0);\n return lp;\n}\n\nexport var names = ['General Oblique Transformation', 'General_Oblique_Transformation', 'ob_tran'];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import tmerc from './lib/projections/tmerc';\nimport etmerc from './lib/projections/etmerc';\nimport utm from './lib/projections/utm';\nimport sterea from './lib/projections/sterea';\nimport stere from './lib/projections/stere';\nimport somerc from './lib/projections/somerc';\nimport omerc from './lib/projections/omerc';\nimport lcc from './lib/projections/lcc';\nimport krovak from './lib/projections/krovak';\nimport cass from './lib/projections/cass';\nimport laea from './lib/projections/laea';\nimport aea from './lib/projections/aea';\nimport gnom from './lib/projections/gnom';\nimport cea from './lib/projections/cea';\nimport eqc from './lib/projections/eqc';\nimport poly from './lib/projections/poly';\nimport nzmg from './lib/projections/nzmg';\nimport mill from './lib/projections/mill';\nimport sinu from './lib/projections/sinu';\nimport moll from './lib/projections/moll';\nimport eqdc from './lib/projections/eqdc';\nimport vandg from './lib/projections/vandg';\nimport aeqd from './lib/projections/aeqd';\nimport ortho from './lib/projections/ortho';\nimport qsc from './lib/projections/qsc';\nimport robin from './lib/projections/robin';\nimport geocent from './lib/projections/geocent';\nimport tpers from './lib/projections/tpers';\nimport geos from './lib/projections/geos';\nimport eqearth from './lib/projections/eqearth';\nimport bonne from './lib/projections/bonne';\nimport ob_tran from './lib/projections/ob_tran';\nexport default function (proj4) {\n proj4.Proj.projections.add(tmerc);\n proj4.Proj.projections.add(etmerc);\n proj4.Proj.projections.add(utm);\n proj4.Proj.projections.add(sterea);\n proj4.Proj.projections.add(stere);\n proj4.Proj.projections.add(somerc);\n proj4.Proj.projections.add(omerc);\n proj4.Proj.projections.add(lcc);\n proj4.Proj.projections.add(krovak);\n proj4.Proj.projections.add(cass);\n proj4.Proj.projections.add(laea);\n proj4.Proj.projections.add(aea);\n proj4.Proj.projections.add(gnom);\n proj4.Proj.projections.add(cea);\n proj4.Proj.projections.add(eqc);\n proj4.Proj.projections.add(poly);\n proj4.Proj.projections.add(nzmg);\n proj4.Proj.projections.add(mill);\n proj4.Proj.projections.add(sinu);\n proj4.Proj.projections.add(moll);\n proj4.Proj.projections.add(eqdc);\n proj4.Proj.projections.add(vandg);\n proj4.Proj.projections.add(aeqd);\n proj4.Proj.projections.add(ortho);\n proj4.Proj.projections.add(qsc);\n proj4.Proj.projections.add(robin);\n proj4.Proj.projections.add(geocent);\n proj4.Proj.projections.add(tpers);\n proj4.Proj.projections.add(geos);\n proj4.Proj.projections.add(eqearth);\n proj4.Proj.projections.add(bonne);\n proj4.Proj.projections.add(ob_tran);\n}\n","import core from './core';\nimport Proj from './Proj';\nimport Point from './Point';\nimport common from './common/toPoint';\nimport defs from './defs';\nimport nadgrid from './nadgrid';\nimport transform from './transform';\nimport mgrs from 'mgrs';\nimport includedProjections from '../projs';\n\n/**\n * @typedef {Object} Mgrs\n * @property {(lonlat: [number, number]) => string} forward\n * @property {(mgrsString: string) => [number, number, number, number]} inverse\n * @property {(mgrsString: string) => [number, number]} toPoint\n */\n\n/**\n * @typedef {import('./defs').ProjectionDefinition} ProjectionDefinition\n * @typedef {import('./core').TemplateCoordinates} TemplateCoordinates\n * @typedef {import('./core').InterfaceCoordinates} InterfaceCoordinates\n * @typedef {import('./core').Converter} Converter\n * @typedef {import('./Proj').DatumDefinition} DatumDefinition\n */\n\n/**\n * @template {import('./core').TemplateCoordinates} T\n * @type {core<T> & {defaultDatum: string, Proj: typeof Proj, WGS84: Proj, Point: typeof Point, toPoint: typeof common, defs: typeof defs, nadgrid: typeof nadgrid, transform: typeof transform, mgrs: Mgrs, version: string}}\n */\nconst proj4 = Object.assign(core, {\n defaultDatum: 'WGS84',\n Proj,\n WGS84: new Proj('WGS84'),\n Point,\n toPoint: common,\n defs,\n nadgrid,\n transform,\n mgrs,\n version: '__VERSION__'\n});\nincludedProjections(proj4);\nexport default proj4;\n","// Utilities for interacting with a GeoTIFF\nimport { GeoTIFF } from \"@developmentseed/geotiff\";\n/**\n * Add an alpha channel to an RGB image array.\n *\n * Only supports input arrays with 3 (RGB) or 4 (RGBA) channels. If the input is\n * already RGBA, it is returned unchanged.\n */\nexport function addAlphaChannel(rgbImage) {\n const { height, width } = rgbImage;\n if (rgbImage.layout === \"band-separate\") {\n // This should be pretty easy to do by just returning an additional array of\n // 255s\n // But not sure if we'll want to do that, because it's fine to upload 3\n // separate textures.\n throw new Error(\"Band-separate images not yet implemented.\");\n }\n if (rgbImage.data.length === height * width * 4) {\n // Already has alpha channel\n return rgbImage;\n }\n else if (rgbImage.data.length === height * width * 3) {\n // Need to add alpha channel\n const rgbaLength = (rgbImage.data.length / 3) * 4;\n const isUint16 = rgbImage.data instanceof Uint16Array;\n const rgbaArray = isUint16\n ? new Uint16Array(rgbaLength)\n : new Uint8ClampedArray(rgbaLength);\n const maxAlpha = isUint16 ? 65535 : 255;\n for (let i = 0; i < rgbImage.data.length / 3; ++i) {\n rgbaArray[i * 4] = rgbImage.data[i * 3];\n rgbaArray[i * 4 + 1] = rgbImage.data[i * 3 + 1];\n rgbaArray[i * 4 + 2] = rgbImage.data[i * 3 + 2];\n rgbaArray[i * 4 + 3] = maxAlpha;\n }\n return {\n ...rgbImage,\n count: 4,\n data: rgbaArray,\n };\n }\n else {\n throw new Error(`Unexpected number of channels in raster data: ${rgbImage.data.length / (height * width)}`);\n }\n}\nexport async function fetchGeoTIFF(input) {\n if (typeof input === \"string\" || input instanceof URL) {\n return await GeoTIFF.fromUrl(input);\n }\n if (input instanceof ArrayBuffer) {\n return await GeoTIFF.fromArrayBuffer(input);\n }\n return input;\n}\n/**\n * Calculate the WGS84 bounding box of a GeoTIFF image\n */\nexport function getGeographicBounds(geotiff, converter) {\n const [minX, minY, maxX, maxY] = geotiff.bbox;\n // Reproject all four corners to handle rotation/skew\n const corners = [\n converter.forward([minX, minY]), // bottom-left\n converter.forward([maxX, minY]), // bottom-right\n converter.forward([maxX, maxY]), // top-right\n converter.forward([minX, maxY]), // top-left\n ];\n // Find the bounding box that encompasses all reprojected corners\n const lons = corners.map((c) => c[0]);\n const lats = corners.map((c) => c[1]);\n const west = Math.min(...lons);\n const south = Math.min(...lats);\n const east = Math.max(...lons);\n const north = Math.max(...lats);\n // Return bounds in MapLibre format: [[west, south], [east, north]]\n return { west, south, east, north };\n}\n//# sourceMappingURL=geotiff.js.map","const shader = /* glsl */ `\n vec3 black_zero_to_rgb(float value) {\n return vec3(value, value, value);\n }\n`;\n/**\n * A shader module that converts single-band grayscale data to RGB by\n * broadcasting the input value (0 = black, 1 = white) into all three\n * channels. Matches TIFF `PhotometricInterpretation = 1` (BlackIsZero).\n */\nexport const BlackIsZero = {\n name: \"black-is-zero\",\n inject: {\n \"fs:#decl\": shader,\n \"fs:DECKGL_FILTER_COLOR\": /* glsl */ `\n color.rgb = black_zero_to_rgb(color.r);\n `,\n },\n};\n//# sourceMappingURL=black-is-zero.js.map","const shader = /* glsl */ `\n const vec3 D65 = vec3(\n 0.95047, // Xn\n 1.00000, // Yn\n 1.08883 // Zn\n );\n\n vec3 cielabToRgb(vec3 labTex) {\n // labTex in [0,1] from RGB8 texture\n float L = labTex.r * 255.0;\n float a = (labTex.g - 0.5) * 255.0;\n float b = (labTex.b - 0.5) * 255.0;\n\n float y = (L + 16.0) / 116.0;\n float x = (a / 500.0) + y;\n float z = y - (b / 200.0);\n\n vec3 xyz;\n vec3 v = vec3(x, y, z);\n vec3 v3 = v * v * v;\n\n xyz = D65 * mix(\n (v - 16.0 / 116.0) / 7.787,\n v3,\n step(0.008856, v3)\n );\n\n vec3 rgb = mat3(\n 3.2406, -1.5372, -0.4986,\n -0.9689, 1.8758, 0.0415,\n 0.0557, -0.2040, 1.0570\n ) * xyz;\n\n // sRGB gamma\n rgb = mix(\n 12.92 * rgb,\n 1.055 * pow(rgb, vec3(1.0 / 2.4)) - 0.055,\n step(0.0031308, rgb)\n );\n\n return clamp(rgb, 0.0, 1.0);\n }\n`;\n/**\n * A shader module that converts CIE L\\*a\\*b\\* input (RGB channels read as L,\n * a, b on a D65 white point) to sRGB. For TIFFs with\n * `PhotometricInterpretation = 8` (CIELab).\n */\nexport const cieLabToRGB = {\n name: \"cielab-to-rgb\",\n inject: {\n \"fs:#decl\": shader,\n \"fs:DECKGL_FILTER_COLOR\": /* glsl */ `\n color.rgb = cielabToRgb(color);\n `,\n },\n};\n//# sourceMappingURL=cielab.js.map","const shader = /* glsl */ `\n vec3 cmykToRgb(vec4 cmyk) {\n // cmyk in [0.0, 1.0]\n float invK = 1.0 - cmyk.a;\n\n return vec3(\n (1.0 - cmyk.r) * invK,\n (1.0 - cmyk.g) * invK,\n (1.0 - cmyk.b) * invK\n );\n }\n`;\n/**\n * A shader module that converts CMYK input (RGBA channels read as C, M, Y,\n * K) to RGB. For TIFFs with `PhotometricInterpretation = 5` (Separated /\n * CMYK).\n */\nexport const CMYKToRGB = {\n name: \"cmyk-to-rgb\",\n inject: {\n \"fs:#decl\": shader,\n \"fs:DECKGL_FILTER_COLOR\": /* glsl */ `\n color.rgb = cmykToRgb(color);\n `,\n },\n};\n//# sourceMappingURL=cmyk.js.map","const shader = /* glsl */ `\n vec3 white_zero_to_rgb(float value) {\n return vec3(1.0 - value, 1.0 - value, 1.0 - value);\n }\n`;\n/**\n * A shader module that converts single-band grayscale data to RGB by\n * broadcasting the inverted input value (0 = white, 1 = black) into all\n * three channels. Matches TIFF `PhotometricInterpretation = 0` (WhiteIsZero).\n */\nexport const WhiteIsZero = {\n name: \"white-is-zero\",\n inject: {\n \"fs:#decl\": shader,\n \"fs:DECKGL_FILTER_COLOR\": /* glsl */ `\n color.rgb = white_zero_to_rgb(color.r);\n `,\n },\n};\n//# sourceMappingURL=white-is-zero.js.map","const MODULE_NAME = \"colormap\";\n/**\n * A shader module that injects a 2D-array colormap texture and samples one\n * layer per fragment, indexed by `colormapIndex`.\n */\nexport const Colormap = {\n name: MODULE_NAME,\n fs: `\\\nuniform ${MODULE_NAME}Uniforms {\n int colormapIndex;\n float reversed;\n} ${MODULE_NAME};\n`,\n inject: {\n \"fs:#decl\": `\\\nprecision highp sampler2DArray;\nuniform sampler2DArray colormapTexture;\n`,\n \"fs:DECKGL_FILTER_COLOR\": /* glsl */ `\n float idx = mix(color.r, 1.0 - color.r, ${MODULE_NAME}.reversed);\n color = texture(\n colormapTexture,\n vec3(idx, 0.5, float(${MODULE_NAME}.colormapIndex))\n );\n `,\n },\n uniformTypes: {\n colormapIndex: \"i32\",\n reversed: \"f32\",\n },\n getUniforms: (props) => {\n return {\n colormapTexture: props.colormapTexture,\n colormapIndex: props.colormapIndex ?? 0,\n reversed: props.reversed ?? false,\n };\n },\n};\n//# sourceMappingURL=colormap.js.map","// Generated by scripts/generate_colormaps.py. Do not edit by hand.\n/**\n * Mapping from matplotlib / rio-tiler colormap name to its layer index in\n * the shipped `colormaps.png` sprite. Pass values from this object as the\n * `colormapIndex` prop of the {@link Colormap} shader module:\n *\n * ```ts\n * { module: Colormap, props: {\n * colormapTexture,\n * colormapIndex: COLORMAP_INDEX.viridis,\n * } }\n * ```\n *\n * Names are sorted alphabetically. Reversed variants (`_r` suffix) are not\n * listed separately — use the module's `reversed` uniform to flip a\n * colormap at render time instead of binding a distinct layer.\n */\nexport const COLORMAP_INDEX = {\n accent: 0,\n afmhot: 1,\n algae: 2,\n amp: 3,\n autumn: 4,\n balance: 5,\n binary: 6,\n blues: 7,\n bone: 8,\n brbg: 9,\n brg: 10,\n bugn: 11,\n bupu: 12,\n bwr: 13,\n cfastie: 14,\n cividis: 15,\n cmrmap: 16,\n cool: 17,\n coolwarm: 18,\n copper: 19,\n cubehelix: 20,\n curl: 21,\n dark2: 22,\n deep: 23,\n delta: 24,\n dense: 25,\n diff: 26,\n flag: 27,\n gist_earth: 28,\n gist_gray: 29,\n gist_heat: 30,\n gist_ncar: 31,\n gist_rainbow: 32,\n gist_stern: 33,\n gist_yarg: 34,\n gnbu: 35,\n gnuplot: 36,\n gnuplot2: 37,\n gray: 38,\n greens: 39,\n greys: 40,\n haline: 41,\n hot: 42,\n hsv: 43,\n ice: 44,\n inferno: 45,\n jet: 46,\n magma: 47,\n matter: 48,\n nipy_spectral: 49,\n ocean: 50,\n oranges: 51,\n orrd: 52,\n oxy: 53,\n paired: 54,\n pastel1: 55,\n pastel2: 56,\n phase: 57,\n pink: 58,\n piyg: 59,\n plasma: 60,\n prgn: 61,\n prism: 62,\n pubu: 63,\n pubugn: 64,\n puor: 65,\n purd: 66,\n purples: 67,\n rain: 68,\n rainbow: 69,\n rdbu: 70,\n rdgy: 71,\n rdpu: 72,\n rdylbu: 73,\n rdylgn: 74,\n reds: 75,\n rplumbo: 76,\n schwarzwald: 77,\n seismic: 78,\n set1: 79,\n set2: 80,\n set3: 81,\n solar: 82,\n spectral: 83,\n speed: 84,\n spring: 85,\n summer: 86,\n tab10: 87,\n tab20: 88,\n tab20b: 89,\n tab20c: 90,\n tarn: 91,\n tempo: 92,\n terrain: 93,\n thermal: 94,\n topo: 95,\n turbid: 96,\n turbo: 97,\n twilight: 98,\n twilight_shifted: 99,\n viridis: 100,\n winter: 101,\n wistia: 102,\n ylgn: 103,\n ylgnbu: 104,\n ylorbr: 105,\n ylorrd: 106,\n};\n//# sourceMappingURL=colormap-names.js.map","/**\n * Maximum number of band texture slots supported by {@link CompositeBands}.\n */\nexport const MAX_BAND_SLOTS = 4;\nconst MODULE_NAME = \"compositeBands\";\n/**\n * A shader module that samples up to 4 band textures with per-band UV\n * transforms and composites them into a `vec4` color.\n *\n * Uses fixed uniform slots (`band0`–`band3`) for textures (bound via\n * `getUniforms`) and a uniform block for scalar values (`uvTransform0`–\n * `uvTransform3`, `channelMap`).\n *\n * @see {@link CompositeBandsProps}\n * @see {@link buildCompositeBandsProps} for a helper that maps named bands\n * to slot indices.\n */\nexport const CompositeBands = {\n name: MODULE_NAME,\n // Texture samplers — declared via inject, bound via getUniforms\n inject: {\n \"fs:#decl\": /* glsl */ `\nuniform sampler2D band0;\nuniform sampler2D band1;\nuniform sampler2D band2;\nuniform sampler2D band3;\n\nvec2 compositeBands_applyUv(vec2 uv, vec4 transform) {\n return uv * transform.zw + transform.xy;\n}\n\nfloat compositeBands_sampleSlot(int slot, vec2 uv) {\n if (slot == 0) return texture(band0, compositeBands_applyUv(uv, ${MODULE_NAME}.uvTransform0)).r;\n if (slot == 1) return texture(band1, compositeBands_applyUv(uv, ${MODULE_NAME}.uvTransform1)).r;\n if (slot == 2) return texture(band2, compositeBands_applyUv(uv, ${MODULE_NAME}.uvTransform2)).r;\n if (slot == 3) return texture(band3, compositeBands_applyUv(uv, ${MODULE_NAME}.uvTransform3)).r;\n return 0.0;\n}\n`,\n \"fs:DECKGL_FILTER_COLOR\": /* glsl */ `\n float r = ${MODULE_NAME}.channelMap.r >= 0 ? compositeBands_sampleSlot(${MODULE_NAME}.channelMap.r, geometry.uv) : 0.0;\n float g = ${MODULE_NAME}.channelMap.g >= 0 ? compositeBands_sampleSlot(${MODULE_NAME}.channelMap.g, geometry.uv) : 0.0;\n float b = ${MODULE_NAME}.channelMap.b >= 0 ? compositeBands_sampleSlot(${MODULE_NAME}.channelMap.b, geometry.uv) : 0.0;\n float a = ${MODULE_NAME}.channelMap.a >= 0 ? compositeBands_sampleSlot(${MODULE_NAME}.channelMap.a, geometry.uv) : 1.0;\n color = vec4(r, g, b, a);\n`,\n },\n // Scalar uniforms — declared via fs uniform block + uniformTypes\n fs: `\\\nuniform ${MODULE_NAME}Uniforms {\n vec4 uvTransform0;\n vec4 uvTransform1;\n vec4 uvTransform2;\n vec4 uvTransform3;\n ivec4 channelMap;\n} ${MODULE_NAME};\n`,\n uniformTypes: {\n uvTransform0: \"vec4<f32>\",\n uvTransform1: \"vec4<f32>\",\n uvTransform2: \"vec4<f32>\",\n uvTransform3: \"vec4<f32>\",\n channelMap: \"vec4<i32>\",\n },\n getUniforms: (props) => {\n return {\n // Texture bindings\n band0: props.band0,\n band1: props.band1,\n band2: props.band2,\n band3: props.band3,\n // Scalar uniforms (uniform block)\n uvTransform0: props.uvTransform0 ?? [0, 0, 1, 1],\n uvTransform1: props.uvTransform1 ?? [0, 0, 1, 1],\n uvTransform2: props.uvTransform2 ?? [0, 0, 1, 1],\n uvTransform3: props.uvTransform3 ?? [0, 0, 1, 1],\n channelMap: props.channelMap ?? [0, 1, 2, -1],\n };\n },\n};\n/**\n * Maps named bands and their UV transforms to {@link CompositeBandsProps}\n * slot indices.\n *\n * Assigns each unique band name to a fixed slot (0–3), builds the\n * `channelMap` that maps RGBA output channels to slots, and fills unused\n * slots with a placeholder texture to satisfy WebGL binding requirements.\n *\n * @param mapping - Which named band goes to which RGBA channel.\n * @param bands - Map of band name to texture + UV transform.\n * @returns Props ready to pass to `{ module: CompositeBands, props: ... }`.\n *\n * @see {@link CompositeBands}\n */\nexport function buildCompositeBandsProps(mapping, bands) {\n // Collect unique band names in mapping order and assign slot indices\n const slotNames = [];\n const slotIndex = new Map();\n for (const name of [mapping.r, mapping.g, mapping.b, mapping.a]) {\n if (name && !slotIndex.has(name)) {\n if (slotNames.length >= MAX_BAND_SLOTS) {\n throw new Error(`CompositeBands supports at most ${MAX_BAND_SLOTS} band slots`);\n }\n slotIndex.set(name, slotNames.length);\n slotNames.push(name);\n }\n }\n function slotFor(name) {\n return name ? (slotIndex.get(name) ?? -1) : -1;\n }\n const props = {\n channelMap: [\n slotFor(mapping.r),\n slotFor(mapping.g),\n slotFor(mapping.b),\n slotFor(mapping.a),\n ],\n };\n // Get the first texture to use as a placeholder for unused slots.\n // WebGL requires all declared samplers to have a valid texture bound,\n // even if the channelMap never references them.\n const firstBandName = slotNames[0];\n if (!firstBandName) {\n throw new Error(\"At least one band is required\");\n }\n const firstTexture = bands.get(firstBandName).texture;\n for (const [name, slot] of slotIndex) {\n const band = bands.get(name);\n if (!band) {\n throw new Error(`Band \"${name}\" not found in fetched bands`);\n }\n props[`band${slot}`] = band.texture;\n props[`uvTransform${slot}`] = band.uvTransform;\n }\n // Fill unused slots with the first texture as a placeholder\n for (let i = slotNames.length; i < MAX_BAND_SLOTS; i++) {\n props[`band${i}`] = firstTexture;\n }\n return props;\n}\n//# sourceMappingURL=composite-bands.js.map","/**\n * Upload a decoded colormap sprite to the GPU as a 2D array texture.\n *\n * The image must be exactly 256 pixels wide; each row becomes one layer\n * of the returned `Texture` (`dimension: \"2d-array\"`, `format:\n * \"rgba8unorm\"`). Use the result as the `colormapTexture` prop of the\n * `Colormap` shader module.\n *\n * Synchronous — pair with `decodeColormapSprite` when you have a URL or\n * raw bytes rather than an already-decoded `ImageData`.\n *\n * @throws when `imageData.width` is not 256.\n */\nexport function createColormapTexture(device, imageData) {\n if (imageData.width !== 256) {\n throw new Error(`Expected a 256-pixel-wide colormap sprite, got width ${imageData.width}.`);\n }\n // ImageData row-major layout (RGBA row 0, RGBA row 1, …) matches luma.gl's\n // 2D-array upload layout (layer-major). Each layer is one image row and\n // exactly one texel tall, so no re-packing is needed.\n const bytes = new Uint8Array(imageData.data.buffer, imageData.data.byteOffset, imageData.data.byteLength);\n return device.createTexture({\n dimension: \"2d-array\",\n format: \"rgba8unorm\",\n width: 256,\n height: 1,\n depth: imageData.height,\n data: bytes,\n mipLevels: 1,\n sampler: {\n minFilter: \"linear\",\n magFilter: \"linear\",\n // Clamp in every axis so an out-of-range colormapIndex yields an\n // edge color rather than wrapping to an unrelated colormap.\n addressModeU: \"clamp-to-edge\",\n addressModeV: \"clamp-to-edge\",\n addressModeW: \"clamp-to-edge\",\n },\n });\n}\n//# sourceMappingURL=create-colormap-texture.js.map","/**\n * Decode a colormap sprite image into `ImageData`. Does not require a GPU\n * `Device`, so it can run during app startup in parallel with the\n * device-creation path; pair with `createColormapTexture` once the device\n * is available.\n *\n * Supported source forms:\n * - `ArrayBuffer` / `Uint8Array`: wrapped in a `Blob` and decoded via\n * `createImageBitmap`.\n * - `ImageBitmap`: drawn into an `OffscreenCanvas` to extract pixels.\n *\n * To decode from a URL, fetch the bytes first:\n *\n * ```ts\n * const bytes = await (await fetch(colormapsUrl)).arrayBuffer();\n * const imageData = await decodeColormapSprite(bytes);\n * ```\n *\n * Avoiding a `string` overload here keeps the helper from having to\n * disambiguate URL / base64 / data-URL inputs.\n */\nexport async function decodeColormapSprite(source) {\n const bitmap = await sourceToImageBitmap(source);\n try {\n return bitmapToImageData(bitmap);\n }\n finally {\n bitmap.close();\n }\n}\nasync function sourceToImageBitmap(source) {\n if (source instanceof ImageBitmap) {\n return source;\n }\n // `BlobPart` is strict about `Uint8Array<ArrayBufferLike>` vs\n // `Uint8Array<ArrayBuffer>` in TS 5+. At runtime both an `ArrayBuffer`\n // and any `Uint8Array` are valid blob inputs; the cast sidesteps the\n // overly-narrow typing.\n const blob = new Blob([source]);\n return createImageBitmap(blob);\n}\nfunction bitmapToImageData(bitmap) {\n const canvas = new OffscreenCanvas(bitmap.width, bitmap.height);\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) {\n throw new Error(\"Failed to obtain 2D context for decoding the colormap sprite.\");\n }\n ctx.drawImage(bitmap, 0, 0);\n return ctx.getImageData(0, 0, bitmap.width, bitmap.height);\n}\n//# sourceMappingURL=decode-colormap-sprite.js.map","/** This module name must be consistent */\nconst MODULE_NAME = \"nodata\";\nconst uniformBlock = `\\\nuniform ${MODULE_NAME}Uniforms {\n float value;\n} ${MODULE_NAME};\n`;\n/**\n * A shader module that filters out (discards) pixels whose value matches the\n * provided nodata value.\n */\nexport const FilterNoDataVal = {\n name: MODULE_NAME,\n fs: uniformBlock,\n inject: {\n \"fs:DECKGL_FILTER_COLOR\": /* glsl */ `\n if (color.r == nodata.value) {\n discard;\n }\n `,\n },\n uniformTypes: {\n value: \"f32\",\n },\n getUniforms: (props) => {\n return {\n value: props.value,\n };\n },\n};\n//# sourceMappingURL=filter-nodata.js.map","/**\n * A shader module that discards fragments where a separate single-channel\n * mask texture reads zero. Useful for COG / GeoTIFF transparency masks\n * stored as a sibling IFD.\n *\n * Compares directly against 0.0; assumes the mask is sampled with nearest-\n * neighbor filtering so there are no interpolated intermediate values.\n */\nexport const MaskTexture = {\n name: \"mask-texture\",\n inject: {\n \"fs:#decl\": `uniform sampler2D maskTexture;`,\n \"fs:DECKGL_FILTER_COLOR\": /* glsl */ `\n float maskValue = texture(maskTexture, geometry.uv).r;\n if (maskValue == 0.0) {\n discard;\n }\n `,\n },\n getUniforms: (props) => {\n return {\n maskTexture: props.maskTexture,\n };\n },\n};\n//# sourceMappingURL=mask-texture.js.map","import { SampleFormat } from \"@cogeotiff/core\";\n/**\n * Infers texture properties from a GeoTIFF image and its associated data.\n */\nexport function createTextureProps(geotiff, data, options) {\n const { samplesPerPixel, bitsPerSample, sampleFormat } = geotiff.cachedTags;\n const textureFormat = inferTextureFormat(samplesPerPixel, bitsPerSample, sampleFormat);\n return {\n data,\n format: textureFormat,\n width: options.width,\n height: options.height,\n };\n}\n/**\n * Infer the TextureFormat given values from GeoTIFF tags.\n */\nexport function inferTextureFormat(samplesPerPixel, bitsPerSample, sampleFormat) {\n const channelCount = verifySamplesPerPixel(samplesPerPixel);\n const bitWidth = verifyIdenticalBitsPerSample(bitsPerSample);\n const scalarKind = inferScalarKind(sampleFormat);\n const formatKey = `${channelCount}:${scalarKind}:${bitWidth}`;\n const format = FORMAT_TABLE[formatKey];\n if (!format) {\n throw new Error(`Unsupported texture format for SamplesPerPixel=${samplesPerPixel}, BitsPerSample=${bitsPerSample}, SampleFormat=${sampleFormat}`);\n }\n return format;\n}\nfunction verifySamplesPerPixel(samplesPerPixel) {\n if (samplesPerPixel === 1 ||\n samplesPerPixel === 2 ||\n samplesPerPixel === 3 ||\n samplesPerPixel === 4) {\n return samplesPerPixel;\n }\n throw new Error(`Unsupported SamplesPerPixel ${samplesPerPixel}. Only 1, 2, 3, or 4 are supported.`);\n}\nfunction verifyIdenticalBitsPerSample(bitsPerSample) {\n // bitsPerSamples is non-empty\n const first = bitsPerSample[0];\n for (let i = 1; i < bitsPerSample.length; i++) {\n if (bitsPerSample[i] !== first) {\n throw new Error(`Unsupported varying BitsPerSample ${bitsPerSample}. All samples must have the same bit width.`);\n }\n }\n if (first !== 8 && first !== 16 && first !== 32) {\n throw new Error(`Unsupported BitsPerSample ${first}. Only 8, 16, or 32 are supported.`);\n }\n return first;\n}\n/**\n * Map the geotiff tag SampleFormat to known kinds of scalars\n */\nfunction inferScalarKind(sampleFormat) {\n // Only support identical SampleFormats for all samples\n const first = sampleFormat[0];\n for (let i = 1; i < sampleFormat.length; i++) {\n if (sampleFormat[i] !== first) {\n throw new Error(`Unsupported varying SampleFormat ${sampleFormat}. All samples must have the same format.`);\n }\n }\n switch (first) {\n case SampleFormat.Uint:\n return \"unorm\";\n case SampleFormat.Int:\n return \"sint\";\n case SampleFormat.Float:\n return \"float\";\n default:\n throw new Error(`Unsupported SampleFormat ${sampleFormat}`);\n }\n}\n/**\n * A mapping of our texture format \"key\" to allowed TextureFormats defined by\n * luma.gl.\n *\n * See https://luma.gl/docs/api-reference/core/texture-formats for details on\n * texture formats.\n *\n * You can use `device.isTextureFormatSupported(format)` check if it is possible\n * to create and sample textures with a specific texture format on your current\n * device.\n *\n * This explicit mapping ensures that Typescript can verify that all keys\n * correspond to valid TextureFormats.\n */\nconst FORMAT_TABLE = {\n // 1 byte per pixel\n \"1:sint:8\": \"r8sint\",\n \"1:uint:8\": \"r8uint\",\n \"1:unorm:8\": \"r8unorm\",\n // 2 bytes per pixel (one channel)\n \"1:float:16\": \"r16float\",\n \"1:sint:16\": \"r16sint\",\n \"1:uint:16\": \"r16uint\",\n \"1:unorm:16\": \"r16unorm\",\n // 2 bytes per pixel (two channels)\n \"2:sint:8\": \"rg8sint\",\n \"2:uint:8\": \"rg8uint\",\n \"2:unorm:8\": \"rg8unorm\",\n // 4 bytes per pixel (one channel)\n \"1:float:32\": \"r32float\",\n \"1:sint:32\": \"r32sint\",\n \"1:uint:32\": \"r32uint\",\n // 4 bytes per pixel (two channels)\n \"2:float:16\": \"rg16float\",\n \"2:sint:16\": \"rg16sint\",\n \"2:uint:16\": \"rg16uint\",\n \"2:unorm:16\": \"rg16unorm\",\n // 4 bytes per pixel (four channels)\n \"4:sint:8\": \"rgba8sint\",\n \"4:uint:8\": \"rgba8uint\",\n \"4:unorm:8\": \"rgba8unorm\",\n // 6 bytes per pixel (three channels)\n // Note: this is supported on WebGL2 but not supported on WebGPU\n // I expect actual switch to WebGPU to be quite a ways off still\n \"3:uint:16\": \"rgb16unorm-webgl\",\n // 8 bytes per pixel (two channels)\n \"2:float:32\": \"rg32float\",\n \"2:sint:32\": \"rg32sint\",\n \"2:uint:32\": \"rg32uint\",\n // 8 bytes per pixel (four channels)\n \"4:float:16\": \"rgba16float\",\n \"4:sint:16\": \"rgba16sint\",\n \"4:uint:16\": \"rgba16uint\",\n \"4:unorm:16\": \"rgba16unorm\",\n // 12 bytes per pixel (three channels)\n \"3:float:32\": \"rgb32float-webgl\",\n // 16 bytes per pixel (four channels)\n \"4:float:32\": \"rgba32float\",\n \"4:sint:32\": \"rgba32sint\",\n \"4:uint:32\": \"rgba32uint\",\n};\n//# sourceMappingURL=texture.js.map","import { Photometric, SampleFormat } from \"@cogeotiff/core\";\nimport { BlackIsZero, CMYKToRGB, Colormap, CreateTexture, cieLabToRGB, FilterNoDataVal, MaskTexture, WhiteIsZero, } from \"@developmentseed/deck.gl-raster/gpu-modules\";\nimport { parseColormap } from \"@developmentseed/geotiff\";\nimport { addAlphaChannel } from \"./geotiff.js\";\nimport { inferTextureFormat } from \"./texture.js\";\nexport function inferRenderPipeline(geotiff, device) {\n const { sampleFormat } = geotiff.cachedTags;\n if (sampleFormat === null) {\n throw new Error(\"SampleFormat tag is required to infer render pipeline\");\n }\n switch (sampleFormat[0]) {\n // Unsigned integers\n case SampleFormat.Uint:\n return createUnormPipeline(geotiff, device);\n }\n throw new Error(`Inferring render pipeline for non-unsigned integers not yet supported. Found SampleFormat: ${sampleFormat}`);\n}\n/**\n * Create pipeline for visualizing unsigned-integer data.\n */\nfunction createUnormPipeline(geotiff, device) {\n const { bitsPerSample, colorMap, photometric, sampleFormat, samplesPerPixel, nodata, } = geotiff.cachedTags;\n const renderPipeline = [\n {\n module: CreateTexture,\n props: {\n textureName: (data) => data.texture,\n },\n },\n ];\n if (nodata !== null) {\n // Since values are 0-1 for unorm textures, scale nodata to [0, 1]\n const maxVal = 2 ** bitsPerSample[0] - 1;\n const noDataScaled = nodata / maxVal;\n renderPipeline.push({\n module: FilterNoDataVal,\n props: { value: noDataScaled },\n });\n }\n if (geotiff.maskImage !== null) {\n renderPipeline.push({\n module: MaskTexture,\n props: {\n // TODO: how to handle if mask failed to load and is undefined here\n maskTexture: (data) => data.mask,\n },\n });\n }\n const toRGBModule = photometricInterpretationToRGB({\n count: samplesPerPixel,\n photometric,\n device,\n colorMap,\n });\n if (toRGBModule) {\n renderPipeline.push(toRGBModule);\n }\n // For palette images, use nearest-neighbor sampling\n const samplerOptions = photometric === Photometric.Palette\n ? {\n magFilter: \"nearest\",\n minFilter: \"nearest\",\n }\n : {\n magFilter: \"linear\",\n minFilter: \"linear\",\n };\n const getTileData = async (image, options) => {\n const { device, x, y, signal, pool } = options;\n const tile = await image.fetchTile(x, y, {\n boundless: false,\n pool,\n signal,\n });\n let { array } = tile;\n const { width, height, mask } = array;\n let numSamples = samplesPerPixel;\n if (samplesPerPixel === 3) {\n // WebGL2 doesn't have an RGB-only texture format; it requires RGBA.\n array = addAlphaChannel(array);\n numSamples = 4;\n }\n if (array.layout === \"band-separate\") {\n throw new Error(\"Band-separate images not yet implemented.\");\n }\n const textureFormat = inferTextureFormat(\n // Add one sample for added alpha channel\n numSamples, bitsPerSample, sampleFormat);\n let byteLength = array.data.byteLength;\n const texture = device.createTexture({\n data: array.data,\n format: textureFormat,\n width,\n height,\n // Use nearest filtering for the mask to avoid interpolated edges/halos\n sampler: {\n minFilter: \"nearest\",\n magFilter: \"nearest\",\n },\n });\n let maskTexture;\n if (mask !== null) {\n maskTexture = device.createTexture({\n data: mask,\n // Single-channel 8-bit texture for the mask\n format: \"r8unorm\",\n width,\n height,\n sampler: samplerOptions,\n });\n byteLength += mask.byteLength;\n }\n return {\n texture,\n mask: maskTexture,\n byteLength,\n height: array.height,\n width: array.width,\n };\n };\n const renderTile = (tileData) => {\n return {\n renderPipeline: renderPipeline.map((m, _i) => resolveModule(m, tileData)),\n };\n };\n return { getTileData, renderTile };\n}\nfunction photometricInterpretationToRGB({ count, colorMap, device, photometric, }) {\n if (count === 3 || count === 4) {\n // Always interpret 3-band or 4-band images as RGB/RGBA\n return null;\n }\n switch (photometric) {\n case Photometric.MinIsWhite: {\n return {\n module: WhiteIsZero,\n };\n }\n case Photometric.MinIsBlack: {\n return {\n module: BlackIsZero,\n };\n }\n case Photometric.Rgb:\n return null;\n case Photometric.Palette: {\n if (!colorMap) {\n throw new Error(\"ColorMap is required for PhotometricInterpretation Palette\");\n }\n const { data, width, height } = parseColormap(colorMap);\n const cmapTexture = device.createTexture({\n dimension: \"2d-array\",\n data,\n format: \"rgba8unorm\",\n width,\n height,\n depth: 1,\n mipLevels: 1,\n sampler: {\n minFilter: \"nearest\",\n magFilter: \"nearest\",\n addressModeU: \"clamp-to-edge\",\n addressModeV: \"clamp-to-edge\",\n addressModeW: \"clamp-to-edge\",\n },\n });\n return {\n module: Colormap,\n props: {\n colormapTexture: cmapTexture,\n },\n };\n }\n // Not sure why cogeotiff calls this \"Separated\", but it means CMYK\n case Photometric.Separated:\n return {\n module: CMYKToRGB,\n };\n case Photometric.Ycbcr:\n // @developmentseed/geotiff currently uses canvas to parse JPEG-compressed\n // YCbCr images, which means the YCbCr->RGB conversion is already done by\n // the browser's image decoder\n return null;\n case Photometric.Cielab:\n return {\n module: cieLabToRGB,\n };\n default:\n throw new Error(`Unsupported PhotometricInterpretation ${photometric}`);\n }\n}\n/**\n * If any prop of any module is a function, replace that prop value with the\n * result of that function\n */\nfunction resolveModule(m, data) {\n const { module, props } = m;\n if (!props) {\n return { module };\n }\n const resolvedProps = {};\n for (const [key, value] of Object.entries(props)) {\n const newValue = typeof value === \"function\" ? value(data) : value;\n if (newValue !== undefined) {\n resolvedProps[key] = newValue;\n }\n }\n return { module, props: resolvedProps };\n}\n//# sourceMappingURL=render-pipeline.js.map","import { AffineTileset, AffineTilesetLevel, } from \"@developmentseed/deck.gl-raster\";\n/**\n * Build an {@link AffineTileset} {@link TilesetDescriptor} from a {@link GeoTIFF}.\n *\n * Produces one {@link AffineTilesetLevel} per overview plus a final entry for\n * the full-resolution image. Levels are emitted coarsest first.\n *\n * Replaces the previous `generateTileMatrixSet` + `TileMatrixSetAdaptor`\n * pipeline. Because {@link AffineTilesetLevel} is parameterized by an\n * arbitrary affine, this works correctly for COGs with rotated, skewed, or\n * non-square-pixel geotransforms.\n *\n * @param geotiff The opened GeoTIFF.\n * @param opts Projection functions and meters-per-CRS-unit.\n */\nexport function geoTiffToDescriptor(geotiff, opts) {\n // GeoTIFF.overviews is sorted finest-to-coarsest. Reverse for coarsest-first\n // and append the full-resolution image as the finest level.\n const images = [\n ...[...geotiff.overviews].reverse(),\n geotiff,\n ];\n const levels = images.map((img) => new AffineTilesetLevel({\n affine: img.transform,\n arrayWidth: img.width,\n arrayHeight: img.height,\n tileWidth: img.tileWidth,\n tileHeight: img.tileHeight,\n mpu: opts.mpu,\n }));\n return new AffineTileset({\n levels,\n projectTo3857: opts.projectTo3857,\n projectFrom3857: opts.projectFrom3857,\n projectTo4326: opts.projectTo4326,\n projectFrom4326: opts.projectFrom4326,\n });\n}\n//# sourceMappingURL=geotiff-tileset.js.map","import { RasterTileLayer } from \"@developmentseed/deck.gl-raster\";\nimport { defaultDecoderPool } from \"@developmentseed/geotiff\";\nimport { epsgResolver, makeClampedForwardTo3857, metersPerUnit, parseWkt, } from \"@developmentseed/proj\";\nimport proj4 from \"proj4\";\nimport { fetchGeoTIFF, getGeographicBounds } from \"./geotiff/geotiff.js\";\nimport { inferRenderPipeline } from \"./geotiff/render-pipeline.js\";\nimport { geoTiffToDescriptor } from \"./geotiff-tileset.js\";\n/**\n * COGLayer renders a COG using a tiled approach with reprojection.\n */\nexport class COGLayer extends RasterTileLayer {\n static layerName = \"COGLayer\";\n // COGLayer's getTileData signature differs from the base class's, so\n // `DefaultProps<COGLayerProps>` is not assignable to\n // `DefaultProps<RasterTileLayerProps>`. Cast to the base static-side type\n // to keep inheritance happy. The only COG-specific default is\n // `epsgResolver`; all behavior still flows from the base class.\n static defaultProps = {\n ...RasterTileLayer.defaultProps,\n epsgResolver,\n };\n initializeState() {\n this.setState({});\n }\n updateState(params) {\n super.updateState(params);\n const { props, oldProps, changeFlags } = params;\n const needsUpdate = Boolean(changeFlags.dataChanged) || props.geotiff !== oldProps.geotiff;\n if (needsUpdate) {\n // Clear stale state so renderLayers returns null until the new GeoTIFF is\n // ready\n this.clearState();\n this._parseGeoTIFF();\n }\n }\n clearState() {\n this.setState({\n geotiff: undefined,\n tilesetDescriptor: undefined,\n defaultGetTileData: undefined,\n defaultRenderTile: undefined,\n });\n }\n async _parseGeoTIFF() {\n const geotiff = await fetchGeoTIFF(this.props.geotiff);\n const crs = geotiff.crs;\n const sourceProjection = typeof crs === \"number\"\n ? await this.props.epsgResolver(crs)\n : parseWkt(crs);\n // @ts-expect-error - proj4 typings are incomplete and don't support\n // wkt-parser input\n const converter4326 = proj4(sourceProjection, \"EPSG:4326\");\n const projectTo4326 = (x, y) => converter4326.forward([x, y], false);\n const projectFrom4326 = (x, y) => converter4326.inverse([x, y], false);\n // @ts-expect-error - proj4 typings are incomplete and don't support\n // wkt-parser input\n const converter3857 = proj4(sourceProjection, \"EPSG:3857\");\n const projectTo3857 = makeClampedForwardTo3857((x, y) => converter3857.forward([x, y], false), projectTo4326);\n const projectFrom3857 = (x, y) => converter3857.inverse([x, y], false);\n const units = sourceProjection.units;\n if (!units) {\n throw new Error(\"Source projection is missing 'units' property, cannot compute meters per unit\");\n }\n const mpu = metersPerUnit(units, {\n semiMajorAxis: sourceProjection.datum?.a ?? sourceProjection.a,\n });\n const tilesetDescriptor = geoTiffToDescriptor(geotiff, {\n projectTo4326,\n projectFrom4326,\n projectTo3857,\n projectFrom3857,\n mpu,\n });\n if (this.props.onGeoTIFFLoad) {\n const geographicBounds = getGeographicBounds(geotiff, converter4326);\n this.props.onGeoTIFFLoad(geotiff, {\n projection: sourceProjection,\n geographicBounds,\n });\n }\n let defaultGetTileData;\n let defaultRenderTile;\n if (!this.props.getTileData || !this.props.renderTile) {\n ({ getTileData: defaultGetTileData, renderTile: defaultRenderTile } =\n inferRenderPipeline(geotiff, this.context.device));\n }\n this.setState({\n geotiff,\n tilesetDescriptor,\n defaultGetTileData,\n defaultRenderTile,\n });\n }\n _tilesetDescriptor() {\n return this.state.tilesetDescriptor;\n }\n /**\n * Adapts the user-facing `(image, { x, y, ... }) => Promise<DataT>` signature\n * into RasterTileLayer's `(tile, { signal, device }) => Promise<DataT>`.\n */\n _getTileDataCallback() {\n const geotiff = this.state.geotiff;\n if (!geotiff) {\n return undefined;\n }\n const userFn = this.props.getTileData ?? this.state.defaultGetTileData;\n if (!userFn) {\n return undefined;\n }\n const wrapped = async (tile, options) => {\n const { x, y, z } = tile.index;\n // Levels are emitted coarsest-first with the full-res geotiff appended\n // last, so z === overviews.length picks the full-res image and lower z\n // picks the corresponding overview from the finest-first list.\n const image = z === geotiff.overviews.length\n ? geotiff\n : geotiff.overviews[geotiff.overviews.length - 1 - z];\n return userFn(image, {\n device: options.device,\n x,\n y,\n signal: options.signal,\n pool: this.props.pool ?? defaultDecoderPool(),\n });\n };\n return wrapped;\n }\n _renderTileCallback() {\n const userFn = this.props.renderTile ?? this.state.defaultRenderTile;\n if (!userFn) {\n return undefined;\n }\n return userFn;\n }\n}\n//# sourceMappingURL=cog-layer.js.map","export default \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAABrCAYAAACYNlxLAABBh0lEQVR4nO19C7BuV1nYt/f/n3NvbhJykyBJIBAIguQBN5eIoEajqGAsZbBpJyO2jkzBR9U6SsWWkQZaio6MMlLBMiOWWhTHtLRNpUJFAxl5DZibEAiEgMGQ0BgeyQ25j3POv/fX+V5rfWvttfe/97nncRPyn1nne6+19/7/vfd6fOv7qms/di3CLn6uvOef7GbzcOVZ1+9q+/WVZ+9q+9/5C+fsavvvfeuhXW3/0I/93q62/65TX7Kr7VcAgDX9EHex0EHMdpGua4CqBpjVgpfKI1VO/K7BzOHVgKwkn2o/tY0ttq/8r8Lw5NeRyUuyh699ddvaIUREQGyBYKuwSyMgtNA6GUGhnT44/SBXHqT1JW2xzLcr7UXdIb38WNLj8HWZDteU1RFkSTslub8WUldar9Bc6AkbcM8nPUjoFgEatfH2gU/6qie8lA5FbeSYIp+6egHXYjomQ1foX8RFx5SNJ0V4ldHgaQz8Li2dz5Sfyc0Oorxbl/LsIDMdX1c4kcwWvJ47zxQOyRRmxxAvaNq2l0u1KS/wkzYdz9WJvXapvtejPz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nuC934/r4nTdNmS8ej/HXYdtHPS/rTmxSVtZJts/ajRx+ji4NuMLwLDZex051SjzXlv8ptOFri73GUgRi63lFfvoA6LUPEY679hxB2eXqy4v9JMaWKfqk+/8BV++WvQyT7iEAAAAASUVORK5CYII=\"","import { COLORMAP_INDEX } from '@developmentseed/deck.gl-raster/gpu-modules';\nimport colormapsPngUrl from '@developmentseed/deck.gl-raster/gpu-modules/colormaps.png';\n\n/** URL (or, in library builds, an inlined data URI) of the colormap sprite:\n * a 256px-wide vertical strip with one row per named colormap, in the order\n * given by `COLORMAP_INDEX`. */\nexport { colormapsPngUrl };\n\nexport type ColormapOption = {\n name: string;\n label: string;\n rowIndex: number;\n reversed?: boolean;\n};\n\n/** Alphabetical list of the named colormaps shipped in the sprite. */\nexport const COLORMAP_NAMES = Object.keys(COLORMAP_INDEX).sort();\n\n/** Number of rows in the colormap sprite. */\nexport const COLORMAP_ROW_COUNT = Object.keys(COLORMAP_INDEX).length;\n\n/** Picker-ready options: name, display label, and the sprite row to\n * preview. */\nexport const COLORMAP_OPTIONS: ColormapOption[] = COLORMAP_NAMES.map(\n (name) => ({\n name,\n label: name,\n rowIndex: (COLORMAP_INDEX as Record<string, number>)[name],\n }),\n);\n","import { SourceCache, SourceChunk } from '@chunkd/middleware';\nimport { SourceView } from '@chunkd/source';\nimport { SourceHttp } from '@chunkd/source-http';\nimport { GeoTIFF } from '@developmentseed/geotiff';\n\n/**\n * COG access pattern is hundreds of distinct Range requests against the\n * same URL. Chrome's HTTP cache serializes lookups on a single I/O thread\n * and evaluates `If-Range`/`If-None-Match` validators per request, which\n * shows up as multi-hundred-millisecond \"Stalled\" time per chunk in the\n * Network panel — frequently *longer* than the actual network round-trip.\n *\n * `cache: \"no-store\"` skips both reads and writes against that machinery.\n * We don't lose anything: the @chunkd `SourceCache` middleware caches\n * header chunks in memory, deck.gl's tile cache holds decoded tile data\n * in JS heap, so the browser's disk cache was only ever helping on full\n * page reloads — and even then, partial-content (206) responses cache\n * poorly against subsequent Range requests for *different* byte ranges\n * of the same URL.\n *\n * `SourceHttp.fetch` is the upstream's documented override hook for\n * customising the fetcher; defaults to `(a, b) => fetch(a, b)`. Setting\n * it once at module load applies to every SourceHttp / CorsSafeSourceHttp\n * instance.\n */\nSourceHttp.fetch = (url, opts) =>\n fetch(url as URL | string, { ...opts, cache: 'no-store' });\n\n/**\n * SourceHttp variant that resists the bogus `metadata.size` value the upstream\n * class records when the HTTP server returns 206 Partial Content but doesn't\n * expose `Content-Range` via CORS.\n *\n * Background. `getMetadataFromResponse` reads `content-length` first, then\n * overrides with `content-range` if present. `Content-Length` is a CORS-\n * safelisted response header (always readable from JS); `Content-Range` is\n * not. Many S3 buckets (and others) don't include\n * `Access-Control-Expose-Headers: Content-Range` in their CORS config, so\n * `response.headers.get(\"content-range\")` returns null and `metadata.size`\n * gets stuck at `Content-Length` of the 206 — which is the chunk size, not\n * the file size.\n *\n * Downstream, `getMaxLength(offset, length)` clamps to `size - offset`. When\n * the IFD chain points past the assumed file end, that returns a NEGATIVE\n * length that propagates into a malformed `bytes=START-END` Range header\n * (end < start). S3 ignores the bad range and serves the entire file with\n * status 200. For a large COG that's a full-file download per page load.\n *\n * We can't repair `Content-Range` from the browser (CORS forbids it) and\n * some buckets also block HEAD preflight. The least invasive fix: after each\n * fetch, if `metadata.size` was just initialised to a value equal to the\n * length we requested, treat it as bogus and clear it. With `size` unset,\n * `getMaxLength` returns the requested length unchanged and the chunk\n * middleware computes valid Range headers.\n *\n * Remove this once @developmentseed/geotiff (or @chunkd/source-http) lands a\n * fix for the underlying behavior.\n */\nclass CorsSafeSourceHttp extends SourceHttp {\n async fetch(\n offset: number,\n length?: number,\n options?: { signal: AbortSignal },\n ): Promise<ArrayBuffer> {\n const wasMetadata = this.metadata;\n const result = await super.fetch(offset, length, options);\n if (\n wasMetadata == null &&\n this.metadata != null &&\n length != null &&\n this.metadata.size === length\n ) {\n // Overwrite the in-place mutation done by the parent class. Cast away\n // the readonly-ish nature of metadata; we own this instance.\n (this.metadata as { size?: number }).size = undefined;\n }\n return result;\n }\n}\n\n// Match @developmentseed/geotiff's `GeoTIFF.fromUrl` defaults so we don't\n// over-fetch on first byte. The CorsSafeSourceHttp patch above handles the\n// upstream `metadata.size` bug, so a small initial chunk is safe.\nconst CHUNK_SIZE = 32 * 1024;\nconst CACHE_SIZE = 1024 * 1024;\n\nconst inflight = new Map<string, Promise<GeoTIFF>>();\n\n/**\n * Open a GeoTIFF from a URL (http(s) or blob:). Equivalent to\n * `GeoTIFF.fromUrl(url)` plus the CORS workaround above. Dedupes concurrent\n * requests for the same URL so double-invoked effects don't kick off two\n * parallel reads; entries are dropped once settled so the map stays bounded.\n */\nexport function loadGeoTIFF(url: string): Promise<GeoTIFF> {\n const existing = inflight.get(url);\n if (existing) return existing;\n\n const promise = (async () => {\n const source = new CorsSafeSourceHttp(url, {});\n const view = new SourceView(source, [\n new SourceChunk({ size: CHUNK_SIZE }),\n new SourceCache({ size: CACHE_SIZE }),\n ]);\n return await GeoTIFF.open({\n dataSource: source,\n headerSource: view,\n });\n })();\n\n inflight.set(url, promise);\n promise.finally(() => inflight.delete(url)).catch(() => {});\n return promise;\n}\n","import { TiffTag } from '@cogeotiff/core';\nimport type {\n GeoTIFF,\n Overview,\n RasterArray,\n} from '@developmentseed/geotiff';\n\n/**\n * Parse band descriptions from the GDAL_METADATA XML tag. Looks for\n * `<Item name=\"DESCRIPTION\" sample=\"N\">name</Item>` (and a few common\n * aliases) and returns a 1-indexed band → name map. The geotiff package\n * surfaces statistics from this XML but not descriptions, so we re-parse.\n */\nexport function readBandNames(tiff: GeoTIFF): Map<number, string> | null {\n const xml = tiff.image.value(TiffTag.GdalMetadata);\n if (typeof xml !== 'string' || xml.length === 0) return null;\n const doc = new DOMParser().parseFromString(xml, 'text/xml');\n const out = new Map<number, string>();\n for (const item of Array.from(doc.querySelectorAll('Item'))) {\n const name = item.getAttribute('name');\n const sample = item.getAttribute('sample');\n if (sample === null) continue;\n if (name !== 'DESCRIPTION' && name !== 'BAND_NAME') continue;\n const text = item.textContent?.trim() ?? '';\n if (!text) continue;\n const idx = parseInt(sample, 10) + 1;\n if (Number.isFinite(idx) && idx > 0) out.set(idx, text);\n }\n return out.size > 0 ? out : null;\n}\n\nconst HISTOGRAM_BINS = 128;\n\nexport type BandStats = {\n min: number;\n max: number;\n /** Bin counts evenly distributed over [min, max]. Length = HISTOGRAM_BINS. */\n histogram: number[];\n};\n\nexport type AutoStats = {\n /** 1-indexed band → stats map. Null when stats are unknown. */\n perBand: Map<number, BandStats> | null;\n /** A reasonable global stats block to fall back on (averaged min/max,\n * summed histogram bins). */\n global: BandStats | null;\n};\n\nconst NULL_STATS: AutoStats = { perBand: null, global: null };\n\nfunction averageStats(stats: BandStats[]): BandStats {\n let lo = 0;\n let hi = 0;\n const summedHistogram = new Array<number>(HISTOGRAM_BINS).fill(0);\n for (const s of stats) {\n lo += s.min;\n hi += s.max;\n for (let i = 0; i < HISTOGRAM_BINS; i++) {\n summedHistogram[i] += s.histogram[i] ?? 0;\n }\n }\n return {\n min: lo / stats.length,\n max: hi / stats.length,\n histogram: summedHistogram,\n };\n}\n\n/**\n * Linear-interpolated percentile from a histogram. `p` is in [0, 1]. Used\n * to derive default rescale ranges (typically [0.02, 0.98]) without storing\n * raw samples.\n */\nexport function percentileFromHistogram(stats: BandStats, p: number): number {\n const total = stats.histogram.reduce((a, b) => a + b, 0);\n if (total === 0) return p < 0.5 ? stats.min : stats.max;\n const target = total * p;\n let acc = 0;\n const range = stats.max - stats.min;\n if (range <= 0) return stats.min;\n const binWidth = range / stats.histogram.length;\n for (let i = 0; i < stats.histogram.length; i++) {\n const count = stats.histogram[i];\n if (acc + count >= target) {\n const fraction = count > 0 ? (target - acc) / count : 0;\n return stats.min + (i + fraction) * binWidth;\n }\n acc += count;\n }\n return stats.max;\n}\n\n/** Bin a single band's values into a histogram with `min` / `max` as edges. */\nfunction buildHistogram(\n iter: Iterable<number>,\n min: number,\n max: number,\n nodata: number | null,\n): number[] {\n const bins = new Array<number>(HISTOGRAM_BINS).fill(0);\n if (max <= min) return bins;\n const scale = HISTOGRAM_BINS / (max - min);\n for (const v of iter) {\n if (nodata !== null && v === nodata) continue;\n if (!Number.isFinite(v)) continue;\n let idx = Math.floor((v - min) * scale);\n if (idx < 0) idx = 0;\n if (idx >= HISTOGRAM_BINS) idx = HISTOGRAM_BINS - 1;\n bins[idx]++;\n }\n return bins;\n}\n\n/** Read per-band min/max from GDAL_METADATA tags if the COG carries them.\n * GDAL stats don't include histograms, so this returns stats with\n * empty bin arrays — the coarsest-overview pass populates them. */\nfunction fromGdalMetadata(tiff: GeoTIFF): AutoStats {\n const stored = tiff.storedStats;\n if (!stored) return NULL_STATS;\n const perBand = new Map<number, BandStats>();\n for (const [band, stats] of stored) {\n if (stats.min !== null && stats.max !== null) {\n perBand.set(band, {\n min: stats.min,\n max: stats.max,\n histogram: new Array<number>(HISTOGRAM_BINS).fill(0),\n });\n }\n }\n if (perBand.size === 0) return NULL_STATS;\n return { perBand, global: averageStats([...perBand.values()]) };\n}\n\n/** Upper bound on tiles read from the coarsest IFD during auto-stats. For\n * properly-pyramided COGs the coarsest level is just a few tiles and the\n * cap never trips. For COGs without a deep overview pyramid (so the\n * coarsest is the primary at full size), the cap keeps layer-load from\n * trying to download the entire image. */\nexport const MAX_SAMPLE_TILES = 64;\n\nfunction* iterBand(arr: RasterArray, b: number): Generator<number> {\n if (arr.layout === 'band-separate') {\n const data = arr.bands[b];\n for (let i = 0; i < data.length; i++) yield data[i] as number;\n } else {\n const data = arr.data;\n for (let i = b; i < data.length; i += arr.count) yield data[i] as number;\n }\n}\n\n/** Pick which tiles of the coarsest IFD to read. Below the cap we read all\n * of them for an exact min/max; above the cap we fall back to a 3×3\n * spatial sample (corners + edge midpoints + center, deduplicated). */\nexport function pickSampleCoords(grid: {\n x: number;\n y: number;\n}): Array<[number, number]> {\n if (grid.x <= 0 || grid.y <= 0) return [];\n if (grid.x * grid.y <= MAX_SAMPLE_TILES) {\n const out: Array<[number, number]> = [];\n for (let y = 0; y < grid.y; y++) {\n for (let x = 0; x < grid.x; x++) {\n out.push([x, y]);\n }\n }\n return out;\n }\n const xs = Array.from(\n new Set([0, Math.floor(grid.x / 2), grid.x - 1]),\n ).filter((n) => n >= 0 && n < grid.x);\n const ys = Array.from(\n new Set([0, Math.floor(grid.y / 2), grid.y - 1]),\n ).filter((n) => n >= 0 && n < grid.y);\n const out: Array<[number, number]> = [];\n for (const y of ys) {\n for (const x of xs) {\n out.push([x, y]);\n }\n }\n return out;\n}\n\n/** Read author-supplied per-band min/max from GDAL_METADATA. Returns\n * null when the tag is absent or contains no usable ranges. Used to\n * anchor histogram bin edges in {@link fromSampledTiles} so we trust\n * the author's range instead of deriving it from a sample. */\nfunction readGdalRanges(\n tiff: GeoTIFF,\n): Map<number, { min: number; max: number }> | null {\n const stored = tiff.storedStats;\n if (!stored) return null;\n const out = new Map<number, { min: number; max: number }>();\n for (const [band, stats] of stored) {\n if (stats.min !== null && stats.max !== null && stats.min < stats.max) {\n out.set(band, { min: stats.min, max: stats.max });\n }\n }\n return out.size > 0 ? out : null;\n}\n\n/** Snapshot the in-progress per-band stats so observers see fresh refs\n * and re-render. Cheap: HISTOGRAM_BINS numbers per band, ~handful of\n * bands. */\nfunction snapshotStats(perBand: Map<number, BandStats>): AutoStats {\n const out = new Map<number, BandStats>();\n for (const [k, v] of perBand) {\n out.set(k, { min: v.min, max: v.max, histogram: [...v.histogram] });\n }\n return { perBand: out, global: averageStats([...out.values()]) };\n}\n\n/** Streaming variant: known bin edges from GDAL priors mean we can bin\n * each tile as it arrives, drop the tile's array immediately, and emit\n * a partial AutoStats so the histogram chart fills in tile-by-tile.\n * Bands not present in `priors` are omitted from the stats. */\nasync function streamingFromTiles(\n source: GeoTIFF | Overview,\n coords: Array<[number, number]>,\n priors: ReadonlyMap<number, { min: number; max: number }>,\n signal: AbortSignal,\n onProgress: ((partial: AutoStats) => void) | undefined,\n): Promise<AutoStats> {\n const perBand = new Map<number, BandStats>();\n let initialized = false;\n\n for (const [x, y] of coords) {\n if (signal.aborted) return NULL_STATS;\n const tile = await source.fetchTile(x, y, { signal, boundless: false });\n const arr = tile.array;\n\n if (!initialized) {\n for (let b = 0; b < arr.count; b++) {\n const prior = priors.get(b + 1);\n if (!prior) continue;\n perBand.set(b + 1, {\n min: prior.min,\n max: prior.max,\n histogram: new Array<number>(HISTOGRAM_BINS).fill(0),\n });\n }\n initialized = true;\n if (perBand.size === 0) return NULL_STATS;\n }\n\n for (const [band, stats] of perBand) {\n const b = band - 1;\n if (b < 0 || b >= arr.count) continue;\n const range = stats.max - stats.min;\n if (range <= 0) continue;\n const scale = HISTOGRAM_BINS / range;\n for (const v of iterBand(arr, b)) {\n if (arr.nodata !== null && v === arr.nodata) continue;\n if (!Number.isFinite(v)) continue;\n let idx = Math.floor((v - stats.min) * scale);\n if (idx < 0) idx = 0;\n if (idx >= HISTOGRAM_BINS) idx = HISTOGRAM_BINS - 1;\n stats.histogram[idx]++;\n }\n }\n\n if (onProgress && !signal.aborted) onProgress(snapshotStats(perBand));\n }\n\n if (perBand.size === 0) return NULL_STATS;\n return snapshotStats(perBand);\n}\n\n/** Batch variant: no priors → unknown bin edges → must hold all tile\n * arrays in memory, run min/max scan (pass 1) then histogram bin (pass\n * 2). Cannot emit progressive snapshots because bin edges aren't stable\n * until pass 1 finishes. */\nasync function batchFromTiles(\n source: GeoTIFF | Overview,\n coords: Array<[number, number]>,\n signal: AbortSignal,\n): Promise<AutoStats> {\n const tiles: RasterArray[] = [];\n for (const [x, y] of coords) {\n if (signal.aborted) return NULL_STATS;\n const tile = await source.fetchTile(x, y, { signal, boundless: false });\n tiles.push(tile.array);\n }\n if (signal.aborted || tiles.length === 0) return NULL_STATS;\n\n const bandCount = tiles[0].count;\n const perBand = new Map<number, BandStats>();\n for (let b = 0; b < bandCount; b++) {\n let min = Number.POSITIVE_INFINITY;\n let max = Number.NEGATIVE_INFINITY;\n let any = false;\n for (const arr of tiles) {\n for (const v of iterBand(arr, b)) {\n if (arr.nodata !== null && v === arr.nodata) continue;\n if (!Number.isFinite(v)) continue;\n if (v < min) min = v;\n if (v > max) max = v;\n any = true;\n }\n }\n if (!any || !(min < max)) continue;\n\n const histogram = buildHistogram(\n (function* () {\n for (const arr of tiles) {\n for (const v of iterBand(arr, b)) {\n if (arr.nodata !== null && v === arr.nodata) continue;\n if (!Number.isFinite(v)) continue;\n yield v;\n }\n }\n })(),\n min,\n max,\n null,\n );\n perBand.set(b + 1, { min, max, histogram });\n }\n if (perBand.size === 0) return NULL_STATS;\n return { perBand, global: averageStats([...perBand.values()]) };\n}\n\n/** Sample tiles from the coarsest IFD to compute per-band min/max and a\n * 128-bin histogram per band. Reads every tile of the coarsest level\n * (which is, by definition, the smallest), capped at\n * {@link MAX_SAMPLE_TILES}; degrades to a 3×3 spatial sample beyond the\n * cap so a COG without a proper overview pyramid doesn't trigger a full\n * download. Falls back to the primary image when the COG has no overviews\n * at all (e.g. a single-tile slice from a pre-sliced pyramid like\n * EOxCloudless's `/z/x/y.tif` outputs).\n *\n * Dispatches to streaming (priors known) or batch (priors unknown).\n * Streaming emits partial AutoStats via `onProgress` after each tile so\n * the histogram UI fills in incrementally. */\nasync function fromSampledTiles(\n tiff: GeoTIFF,\n signal: AbortSignal,\n priors: ReadonlyMap<number, { min: number; max: number }> | null,\n onProgress: ((partial: AutoStats) => void) | undefined,\n): Promise<AutoStats> {\n const ovs = tiff.overviews;\n const source: GeoTIFF | Overview =\n ovs.length > 0 ? ovs[ovs.length - 1] : tiff;\n const coords = pickSampleCoords(source.tileCount);\n if (coords.length === 0) return NULL_STATS;\n\n if (priors) {\n return streamingFromTiles(source, coords, priors, signal, onProgress);\n }\n return batchFromTiles(source, coords, signal);\n}\n\n/** Compute auto-stats for a GeoTIFF. Prefers author-supplied min/max\n * from GDAL_METADATA when present (cheap, exact, anchors the rescale\n * window to whatever the author intended) and uses sampled tiles to\n * populate the histogram bins around that range. Without GDAL stats,\n * derives min/max from the same samples in a two-pass scan. Falls back\n * to GDAL min/max with empty histograms only if sampling fails entirely.\n *\n * When `onProgress` is supplied AND GDAL priors are present, the\n * histogram fills in tile-by-tile and `onProgress` fires with a partial\n * AutoStats snapshot after each tile is binned. Without priors, the\n * callback never fires (bin edges aren't stable until both passes\n * finish); the caller still receives the final stats via the resolved\n * Promise. Caller guards against stale results. */\nexport async function computeAutoStats(\n tiff: GeoTIFF,\n signal: AbortSignal,\n onProgress?: (partial: AutoStats) => void,\n): Promise<AutoStats> {\n const priors = readGdalRanges(tiff);\n const sampled = await fromSampledTiles(tiff, signal, priors, onProgress);\n if (sampled.perBand) return sampled;\n // Last-resort fallback: GDAL stats without histograms.\n return fromGdalMetadata(tiff);\n}\n","/**\n * Custom luma.gl shader modules that fill in capabilities not shipped by\n * `@developmentseed/deck.gl-raster/gpu-modules`. They follow the same\n * `{ name, fs, inject, uniformTypes, getUniforms }` shape as the upstream\n * modules so they slot into a `RasterModule[]` render pipeline directly.\n *\n * GLSL is injected at deck.gl's `DECKGL_FILTER_COLOR` extension point, which\n * runs after the upstream `CompositeBands` (or `CreateTexture`) has populated\n * `color`. Order matters: rescale → gamma → sigmoidal contrast is the\n * standard rio-color / marblecutter chain.\n */\n\ntype RescaleProps = { rescaleMin: [number, number, number]; rescaleMax: [number, number, number] };\ntype GammaProps = { gamma: number };\ntype LogStretchProps = { strength: number };\n\n/** Discards pixels whose red channel is NaN. Float32 COGs commonly use\n * NaN as the nodata sentinel, but the upstream `FilterNoDataVal` does an\n * `==` comparison which IEEE 754 says is always false for NaN. Use this\n * module instead when the COG's declared nodata value is NaN. */\nexport const FilterNaN = {\n name: 'filterNaN',\n inject: {\n 'fs:DECKGL_FILTER_COLOR': `\n if (isnan(color.r)) {\n discard;\n }\n`,\n },\n} as const;\n\n/** Per-channel `LinearRescale`. Same idea as the shipped `LinearRescale`,\n * but min/max are vec3 so each band gets its own range. */\nexport const PerBandLinearRescale = {\n name: 'perBandRescale',\n fs: `uniform perBandRescaleUniforms {\n vec3 rescaleMin;\n vec3 rescaleMax;\n} perBandRescale;\n`,\n inject: {\n 'fs:DECKGL_FILTER_COLOR': `\n color.rgb = clamp(\n (color.rgb - perBandRescale.rescaleMin) /\n max(perBandRescale.rescaleMax - perBandRescale.rescaleMin, vec3(1e-9)),\n 0.0, 1.0);\n`,\n },\n uniformTypes: {\n rescaleMin: 'vec3<f32>',\n rescaleMax: 'vec3<f32>',\n },\n getUniforms: (props: Partial<RescaleProps>) => ({\n rescaleMin: props.rescaleMin ?? [0, 0, 0],\n rescaleMax: props.rescaleMax ?? [1, 1, 1],\n }),\n} as const;\n\n/** Power-law gamma correction. `gamma > 1` lifts shadows; `< 1` deepens them.\n * Apply post-rescale (input expected in 0..1). */\nexport const Gamma = {\n name: 'gammaModule',\n fs: `uniform gammaModuleUniforms {\n float gammaValue;\n} gammaModule;\n`,\n inject: {\n 'fs:DECKGL_FILTER_COLOR': `\n color.rgb = pow(clamp(color.rgb, 0.0, 1.0), vec3(1.0 / max(gammaModule.gammaValue, 0.0001)));\n`,\n },\n uniformTypes: {\n gammaValue: 'f32',\n },\n getUniforms: (props: Partial<GammaProps>) => ({\n gammaValue: props.gamma ?? 1.0,\n }),\n} as const;\n\n/** Square-root stretch on rescaled [0, 1] values. Expands the lower half\n * of the range into more colormap area; gentler than `LogStretch`. Apply\n * post-rescale, before gamma/sigmoidal. */\nexport const SqrtStretch = {\n name: 'sqrtStretch',\n inject: {\n 'fs:DECKGL_FILTER_COLOR': `\n color.rgb = sqrt(clamp(color.rgb, 0.0, 1.0));\n`,\n },\n} as const;\n\n/** Logarithmic stretch on rescaled [0, 1] values. Maps `x → log(1 + k*x) /\n * log(1 + k)` so 0 stays at 0 and 1 stays at 1. `k` controls steepness:\n * higher k → more aggressive expansion of low values. k=99 is a strong\n * but stable default that handles heavy positive skew. */\nexport const LogStretch = {\n name: 'logStretch',\n fs: `uniform logStretchUniforms {\n float strength;\n} logStretch;\n`,\n inject: {\n 'fs:DECKGL_FILTER_COLOR': `\n {\n float k = max(logStretch.strength, 0.0001);\n vec3 x = clamp(color.rgb, 0.0, 1.0);\n color.rgb = log(1.0 + k * x) / log(1.0 + k);\n }\n`,\n },\n uniformTypes: {\n strength: 'f32',\n },\n getUniforms: (props: Partial<LogStretchProps>) => ({\n strength: props.strength ?? 99,\n }),\n} as const;\n","import type {\n RasterModule,\n RenderTileResult,\n} from '@developmentseed/deck.gl-raster';\nimport {\n buildCompositeBandsProps,\n COLORMAP_INDEX,\n Colormap,\n CompositeBands,\n FilterNoDataVal,\n} from '@developmentseed/deck.gl-raster/gpu-modules';\nimport type { Texture } from '@luma.gl/core';\nimport type { RasterLayerState } from '../core/types';\nimport {\n percentileFromHistogram,\n type AutoStats,\n type BandStats,\n} from './stats';\nimport {\n FilterNaN,\n Gamma,\n LogStretch,\n PerBandLinearRescale,\n SqrtStretch,\n} from './shader-modules';\nimport type { MultiBandTileData } from './tile-loader';\n\ntype Range = [number, number];\ntype Vec3 = [number, number, number];\n\nconst RESCALE_EPSILON = 1e-9;\nexport const DEFAULT_PERCENTILE_LO = 0.02;\nexport const DEFAULT_PERCENTILE_HI = 0.98;\n\nconst safeRange = ([lo, hi]: Range): Range =>\n lo === hi ? [lo, lo + RESCALE_EPSILON] : [lo, hi];\n\n/** 2–98% percentile range from a band's histogram. Falls back to [min, max]\n * if the histogram is empty (e.g. GDAL_METADATA-only stats with no overview\n * sample). Mirrors the displayed default in the settings UI. */\nexport function autoRangeFor(stats: BandStats): Range {\n const hasBins = stats.histogram.some((b) => b > 0);\n if (!hasBins) return [stats.min, stats.max];\n return [\n percentileFromHistogram(stats, DEFAULT_PERCENTILE_LO),\n percentileFromHistogram(stats, DEFAULT_PERCENTILE_HI),\n ];\n}\n\nexport function statsForBand(\n autoStats: AutoStats | null,\n band: number,\n): BandStats | null {\n if (!autoStats?.perBand) return autoStats?.global ?? null;\n return autoStats.perBand.get(band) ?? autoStats.global ?? null;\n}\n\n/** Resolve a per-channel rescale window broadcast across 3 GPU channels.\n * For single-band rendering all three channels carry the same band value\n * (see `pickMapping`), so passing vec3(v,v,v) to `PerBandLinearRescale`\n * gives mathematically identical output to the scalar `LinearRescale`.\n *\n * Override precedence: `state.rescale` (broadcast its first pair if it\n * has fewer pairs than channels), then per-band auto-stats percentile,\n * then [0, 1]. Returns null only when `state.rescale` is unset AND\n * autoStats can't supply any band — caller should skip the module. */\nfunction effectiveRescale(\n state: RasterLayerState,\n autoStats: AutoStats | null,\n bands: number[],\n): { mins: Vec3; maxs: Vec3 } | null {\n const pickAuto = (i: number): Range => {\n const band = bands[i] ?? bands[bands.length - 1] ?? 1;\n const stats = statsForBand(autoStats, band);\n return stats ? safeRange(autoRangeFor(stats)) : [0, 1];\n };\n const overrides = state.rescale;\n const pickOverride = (i: number): Range =>\n safeRange(overrides![i < overrides!.length ? i : 0]);\n\n let r: Range, g: Range, b: Range;\n if (overrides && overrides.length > 0) {\n r = pickOverride(0);\n g = pickOverride(1);\n b = pickOverride(2);\n } else {\n if (!autoStats?.perBand && !autoStats?.global) return null;\n r = pickAuto(0);\n g = pickAuto(1);\n b = pickAuto(2);\n }\n return {\n mins: [r[0], g[0], b[0]],\n maxs: [r[1], g[1], b[1]],\n };\n}\n\n/** Push the optional adjustments common to RGB and single-band modes,\n * in canonical order: stretch curve → gamma. Both expect input clamped\n * to 0..1, which the preceding rescale module guarantees. */\nfunction pushAdjustments(state: RasterLayerState, pipeline: RasterModule[]): void {\n if (state.stretch === 'log') {\n pipeline.push({ module: LogStretch, props: { strength: 99 } });\n } else if (state.stretch === 'sqrt') {\n pipeline.push({ module: SqrtStretch });\n }\n if (state.gamma !== 1) {\n pipeline.push({ module: Gamma, props: { gamma: state.gamma } });\n }\n}\n\nfunction effectiveNodata(\n state: RasterLayerState,\n perTileNodata: number | null,\n): number | null {\n if (state.nodata === 'off') return null;\n if (typeof state.nodata === 'number') return state.nodata;\n // 'auto' → use the value the COG declares for this tile.\n return perTileNodata;\n}\n\n/** Build the nodata-discard module appropriate for the chosen value.\n * Float32 COGs frequently use NaN as the nodata sentinel; FilterNoDataVal's\n * `color.r == nodata` comparison is always false for NaN per IEEE 754, so\n * we route NaN nodata through a custom isnan() shader instead. */\nfunction nodataModule(\n nodata: number,\n sampleScale: number,\n): RasterModule | null {\n if (Number.isNaN(nodata)) {\n return { module: FilterNaN };\n }\n if (!Number.isFinite(nodata)) return null;\n return {\n module: FilterNoDataVal,\n props: { value: nodata / sampleScale },\n };\n}\n\n/** Pick an existing band name from `data.bands`, falling back to the first\n * cached band (or null if none). Used to clamp user-selected indexes to\n * what was actually fetched. */\nfunction pickBand(\n data: MultiBandTileData,\n preferred: number | undefined,\n): string | null {\n if (preferred != null) {\n const key = String(preferred);\n if (data.bands.has(key)) return key;\n }\n const first = data.bands.keys().next();\n return first.done ? null : first.value;\n}\n\ntype RenderTileMode =\n | { kind: 'rgb' }\n | { kind: 'single'; colormapTexture: Texture; colormapIndex: number }\n | { kind: 'palette'; colormapTexture: Texture };\n\n/** Resolve the CompositeBands {r,g,b} mapping. RGB picks each requested\n * band independently (g/b optional — falls back to r); single-band\n * broadcasts one band into all three channels so the colormap can\n * sample `color.r`. Returns null when the required first band isn't\n * available (caller should bail with an empty pipeline). */\nfunction pickMapping(\n data: MultiBandTileData,\n requested: number[],\n mode: RenderTileMode['kind'],\n): { r: string; g?: string; b?: string } | null {\n if (mode === 'single' || mode === 'palette') {\n const band = pickBand(data, requested[0]);\n return band ? { r: band, g: band, b: band } : null;\n }\n const r = pickBand(data, requested[0]);\n if (!r) return null;\n const mapping: { r: string; g?: string; b?: string } = { r };\n const g = pickBand(data, requested[1]);\n if (g) mapping.g = g;\n const b = pickBand(data, requested[2]);\n if (b) mapping.b = b;\n return mapping;\n}\n\n/** Shared renderTile builder. Handles both RGB and single-band paths\n * via a discriminated `mode`. The two paths differ only in: (a) which\n * bands feed CompositeBands, (b) whether a Colormap module is appended\n * at the end. Rescale, nodata, stretch, gamma all flow through the\n * same code regardless of mode. */\nfunction buildRenderTile(\n state: RasterLayerState,\n autoStats: AutoStats | null,\n mode: RenderTileMode,\n) {\n return function renderTile(data: MultiBandTileData): RenderTileResult {\n if (data.bands.size === 0) return { renderPipeline: [] };\n const requested =\n mode.kind === 'rgb'\n ? (state.bands ?? [1, 2, 3])\n : [state.bands?.[0] ?? 1];\n const mapping = pickMapping(data, requested, mode.kind);\n if (!mapping) return { renderPipeline: [] };\n\n const compositeProps = buildCompositeBandsProps(mapping, data.bands);\n const pipeline: RasterModule[] = [\n { module: CompositeBands, props: compositeProps },\n ];\n\n // Filter nodata BEFORE any rescale / gamma / colormap so the comparison\n // happens against the texture's native sample value. NaN nodata uses the\n // custom isnan() shader; everything else uses FilterNoDataVal with the\n // value normalized into the GPU's sample space (uint8 255 → 1.0 for\n // r8unorm).\n const nodata = effectiveNodata(state, data.nodata);\n let explicitNodataModule: RasterModule | null = null;\n if (nodata !== null) {\n explicitNodataModule = nodataModule(nodata, data.sampleScale);\n if (explicitNodataModule) pipeline.push(explicitNodataModule);\n }\n\n // Implicit NaN-as-nodata for float COGs. IEEE-754 NaN is invalid by\n // definition, and GDAL/QGIS treat it as transparent even when the file\n // declares no GDAL_NODATA tag (e.g. Sentinel-2 derivatives that mask\n // outside-swath pixels with NaN). Gated on float textures via sampleScale\n // (r8unorm uint8 textures can't carry NaN), and skipped when the user\n // explicitly set nodata to \"off\" or when FilterNaN is already in the\n // pipeline (state.nodata was numerically NaN).\n const isFloatTexture = data.sampleScale === 1;\n const filterNaNAlreadyPushed = explicitNodataModule?.module === FilterNaN;\n if (isFloatTexture && state.nodata !== 'off' && !filterNaNAlreadyPushed) {\n pipeline.push({ module: FilterNaN });\n }\n\n if (mode.kind === 'palette') {\n // Palette indices are categorical: skip the user rescale / stretch /\n // gamma chain and map index 0..255 onto the 256-texel color table.\n // For r8unorm textures (sampleScale 255) this rescale is the identity;\n // for float-uploaded data it normalizes the raw index into [0, 1].\n const max = 255 / data.sampleScale;\n pipeline.push({\n module: PerBandLinearRescale,\n props: {\n rescaleMin: [0, 0, 0],\n rescaleMax: [max, max, max],\n },\n });\n pipeline.push({\n module: Colormap,\n props: {\n colormapTexture: mode.colormapTexture,\n colormapIndex: 0,\n reversed: false,\n },\n });\n return { renderPipeline: pipeline };\n }\n\n const rescale = effectiveRescale(state, autoStats, requested);\n if (rescale) {\n pipeline.push({\n module: PerBandLinearRescale,\n props: {\n rescaleMin: [\n rescale.mins[0] / data.sampleScale,\n rescale.mins[1] / data.sampleScale,\n rescale.mins[2] / data.sampleScale,\n ],\n rescaleMax: [\n rescale.maxs[0] / data.sampleScale,\n rescale.maxs[1] / data.sampleScale,\n rescale.maxs[2] / data.sampleScale,\n ],\n },\n });\n }\n\n pushAdjustments(state, pipeline);\n\n if (mode.kind === 'single') {\n pipeline.push({\n module: Colormap,\n props: {\n colormapTexture: mode.colormapTexture,\n colormapIndex: mode.colormapIndex,\n reversed: false,\n },\n });\n }\n\n return { renderPipeline: pipeline };\n };\n}\n\n/** RGB renderTile: composes user-selected bands into RGB via\n * `CompositeBands`, then rescales and discards nodata. Re-renders without\n * a re-fetch when the selection changes (within the cached band set). */\nexport function buildRgbCompositeRenderTile(\n state: RasterLayerState,\n autoStats: AutoStats | null,\n) {\n return buildRenderTile(state, autoStats, { kind: 'rgb' });\n}\n\n/** Single-band renderTile. Uses CompositeBands to broadcast one band into\n * all RGB output channels (so the colormap can sample `color.r`), then\n * rescales, colormaps, and discards nodata. */\nexport function buildSingleCompositeRenderTile(\n state: RasterLayerState,\n colormapTexture: Texture,\n autoStats: AutoStats | null,\n) {\n const name = (state.colormap ?? 'gray').toLowerCase();\n const colormapIndex =\n (COLORMAP_INDEX as Record<string, number>)[name] ?? COLORMAP_INDEX.gray;\n return buildRenderTile(state, autoStats, {\n kind: 'single',\n colormapTexture,\n colormapIndex,\n });\n}\n\n/** Palette renderTile: looks the band's raw index values up in the image's\n * embedded color table (a 256x1 2D-array texture). Rescale / stretch / gamma\n * are skipped — palette indices are categorical. */\nexport function buildPaletteCompositeRenderTile(\n state: RasterLayerState,\n paletteTexture: Texture,\n) {\n return buildRenderTile(state, null, {\n kind: 'palette',\n colormapTexture: paletteTexture,\n });\n}\n","import type { GetTileDataOptions } from '@developmentseed/deck.gl-geotiff';\nimport type {\n GeoTIFF,\n Overview,\n RasterArray,\n RasterTypedArray,\n} from '@developmentseed/geotiff';\nimport type { Texture, TextureFormat } from '@luma.gl/core';\n\n/** Mirrors `MAX_BAND_SLOTS` in deck.gl-raster's `composite-bands.ts`, which\n * isn't re-exported from the package entry. The CompositeBands shader has\n * 4 fixed band texture slots. */\nexport const MAX_BAND_SLOTS = 4;\n\n/** UV transform vec4 = (offsetX, offsetY, scaleX, scaleY). Identity since\n * we never reproject within a tile. */\ntype UvTransform = [number, number, number, number];\nconst IDENTITY_UV: UvTransform = [0, 0, 1, 1];\n\nexport type MultiBandTileData = {\n /** One r-channel texture per fetched band, keyed by 1-based band index\n * as a string so it can flow into `buildCompositeBandsProps`. */\n bands: Map<string, { texture: Texture; uvTransform: UvTransform }>;\n width: number;\n height: number;\n byteLength: number;\n nodata: number | null;\n /**\n * Divisor that maps source-space sample values to the value the GPU\n * fragment shader actually reads for this tile's textures. For\n * `r8unorm` the GPU normalizes uint8 0..255 into 0..1, so source-unit\n * comparisons and rescale ranges (e.g. nodata=255, rescale=[0,255])\n * must be divided by 255 before being passed to a shader uniform.\n * For `r16float` / `r32float` the value is uploaded as (or as an\n * encoding of) the original source float, so the divisor is 1.\n */\n sampleScale: number;\n};\n\n/**\n * Best-effort GPU-texture cleanup. `RasterTileLayer` doesn't surface\n * `onTileUnload`, so we can't deterministically destroy textures when\n * deck.gl evicts a tile. The next-best thing is a `FinalizationRegistry`\n * that fires when the tile data object is GC'd, which in practice happens\n * shortly after eviction. Unfreed textures leak GPU memory; the registry\n * bounds the leak instead of eliminating it.\n */\nconst tileFinalizer =\n typeof FinalizationRegistry !== 'undefined'\n ? new FinalizationRegistry<Texture[]>((textures) => {\n for (const t of textures) {\n try {\n t.destroy();\n } catch {\n // best-effort\n }\n }\n })\n : null;\n\nfunction singleBandFormat(data: RasterTypedArray): TextureFormat {\n if (data instanceof Uint8Array || data instanceof Uint8ClampedArray) {\n return 'r8unorm';\n }\n // Anything else → r32float. Full precision; the right answer for\n // both float COGs and integer-encoded reflectance/elevation. r16float\n // via JS-side half-float encoding would halve GPU memory but the\n // precision rounding breaks nodata equality (encoded -9999 ≠ uniform\n // -9999) and quantizes values too coarsely for accurate rescale on\n // data spanning > 2048 in magnitude.\n return 'r32float';\n}\n\n/** Divisor that converts source-unit sample values into the value the GPU\n * shader reads after sampling. See `MultiBandTileData.sampleScale`. */\nfunction sampleScaleForFormat(format: TextureFormat): number {\n return format === 'r8unorm' ? 255 : 1;\n}\n\n/** Cast non-Float32 source data to Float32 for upload into r32float\n * textures. r8unorm passes Uint8Array straight through. */\nfunction coerceForFormat(\n array: RasterTypedArray,\n format: TextureFormat,\n): RasterTypedArray {\n if (format !== 'r32float') return array;\n if (array instanceof Float32Array) return array;\n return Float32Array.from(array);\n}\n\nfunction extractBand(\n data: RasterTypedArray,\n band: number,\n count: number,\n): RasterTypedArray {\n const pixels = data.length / count;\n const Ctor = data.constructor as new (length: number) => RasterTypedArray;\n const out = new Ctor(pixels);\n for (let i = 0; i < pixels; i++) {\n out[i] = data[i * count + band] as number;\n }\n return out;\n}\n\n/**\n * Build a getTileData callback that fetches the COG tile once and uploads\n * each band in `bandIndexes` (1-indexed) as its own r-channel texture.\n * Render pipelines can then swizzle channels via `CompositeBands` without\n * a re-fetch.\n *\n * The CompositeBands shader has {@link MAX_BAND_SLOTS} fixed slots, so the\n * caller is responsible for keeping `bandIndexes.length <= MAX_BAND_SLOTS`.\n * Indexes that exceed the COG's actual band count are silently skipped.\n */\nexport function makeMultiBandTileLoader(bandIndexes: number[]) {\n return async function getTileData(\n image: GeoTIFF | Overview,\n options: GetTileDataOptions,\n ): Promise<MultiBandTileData> {\n const { device, x, y, signal } = options;\n const tile = await image.fetchTile(x, y, { signal, boundless: false });\n const array: RasterArray = tile.array;\n const bands = new Map<\n string,\n { texture: Texture; uvTransform: UvTransform }\n >();\n let totalBytes = 0;\n let sampleScale = 1;\n for (const idx of bandIndexes) {\n const i = idx - 1;\n if (i < 0 || i >= array.count) continue;\n const bandData: RasterTypedArray =\n array.layout === 'band-separate'\n ? array.bands[i]\n : extractBand(array.data as RasterTypedArray, i, array.count);\n const format = singleBandFormat(bandData);\n const data = coerceForFormat(bandData, format);\n sampleScale = sampleScaleForFormat(format);\n const texture = device.createTexture({\n data,\n format,\n width: array.width,\n height: array.height,\n });\n bands.set(String(idx), { texture, uvTransform: IDENTITY_UV });\n // Use the *post-coercion* per-element byte size so deck.gl's tile\n // cache budget reflects the actual buffer allocated. coerceForFormat\n // upcasts int16/uint16 to Float32 (4 bytes).\n totalBytes += array.width * array.height * data.BYTES_PER_ELEMENT;\n }\n const result: MultiBandTileData = {\n bands,\n width: array.width,\n height: array.height,\n byteLength: totalBytes,\n nodata: array.nodata,\n sampleScale,\n };\n if (tileFinalizer && bands.size > 0) {\n tileFinalizer.register(\n result,\n Array.from(bands.values(), (v) => v.texture),\n );\n }\n return result;\n };\n}\n","/**\n * Clamps a value between a minimum and maximum.\n *\n * @param value - The value to clamp\n * @param min - The minimum allowed value\n * @param max - The maximum allowed value\n * @returns The clamped value\n *\n * @example\n * ```typescript\n * clamp(5, 0, 10); // returns 5\n * clamp(-5, 0, 10); // returns 0\n * clamp(15, 0, 10); // returns 10\n * ```\n */\nexport function clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\n/**\n * Formats a numeric value with appropriate decimal places based on step size.\n *\n * @param value - The value to format\n * @param step - The step size to determine decimal places\n * @returns The formatted value as a string\n *\n * @example\n * ```typescript\n * formatNumericValue(5, 1); // returns \"5\"\n * formatNumericValue(0.5, 0.1); // returns \"0.5\"\n * formatNumericValue(0.55, 0.01); // returns \"0.55\"\n * ```\n */\nexport function formatNumericValue(value: number, step: number): string {\n if (step === 0) return value.toString();\n const decimals = Math.max(0, -Math.floor(Math.log10(step)));\n return value.toFixed(decimals);\n}\n\n/**\n * Generates a unique ID string.\n *\n * @param prefix - Optional prefix for the ID\n * @returns A unique ID string\n *\n * @example\n * ```typescript\n * generateId('control'); // returns \"control-abc123\"\n * generateId(); // returns \"abc123\"\n * ```\n */\nexport function generateId(prefix?: string): string {\n const id = Math.random().toString(36).substring(2, 9);\n return prefix ? `${prefix}-${id}` : id;\n}\n\n/**\n * Debounces a function call.\n *\n * @param fn - The function to debounce\n * @param delay - The delay in milliseconds\n * @returns A debounced version of the function\n *\n * @example\n * ```typescript\n * const debouncedUpdate = debounce(() => updateMap(), 100);\n * window.addEventListener('resize', debouncedUpdate);\n * ```\n */\nexport function debounce<T extends (...args: unknown[]) => void>(\n fn: T,\n delay: number\n): (...args: Parameters<T>) => void {\n let timeoutId: ReturnType<typeof setTimeout> | null = null;\n\n return (...args: Parameters<T>) => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n timeoutId = setTimeout(() => {\n fn(...args);\n timeoutId = null;\n }, delay);\n };\n}\n\n/**\n * Throttles a function call.\n *\n * @param fn - The function to throttle\n * @param limit - The minimum time between calls in milliseconds\n * @returns A throttled version of the function\n *\n * @example\n * ```typescript\n * const throttledScroll = throttle(() => handleScroll(), 100);\n * window.addEventListener('scroll', throttledScroll);\n * ```\n */\nexport function throttle<T extends (...args: unknown[]) => void>(\n fn: T,\n limit: number\n): (...args: Parameters<T>) => void {\n let inThrottle = false;\n\n return (...args: Parameters<T>) => {\n if (!inThrottle) {\n fn(...args);\n inThrottle = true;\n setTimeout(() => {\n inThrottle = false;\n }, limit);\n }\n };\n}\n\n/**\n * Creates a CSS class string from an object of class names.\n *\n * @param classes - Object with class names as keys and boolean values\n * @returns A space-separated string of class names\n *\n * @example\n * ```typescript\n * classNames({ active: true, disabled: false, visible: true });\n * // returns \"active visible\"\n * ```\n */\nexport function classNames(classes: Record<string, boolean>): string {\n return Object.entries(classes)\n .filter(([, value]) => value)\n .map(([key]) => key)\n .join(' ');\n}\n","import type { GeoTIFF } from '@developmentseed/geotiff';\nimport type { Texture } from '@luma.gl/core';\nimport type {\n RasterLayerInfo,\n RasterLayerSource,\n RasterLayerState,\n} from '../core/types';\nimport type { AutoStats } from '../raster/stats';\n\n/** Geographic (WGS84) bounds of a layer, as reported by COGLayer. */\nexport type GeographicBounds = {\n west: number;\n south: number;\n east: number;\n north: number;\n};\n\n/** Default visualization state for a freshly added layer. Mode/bands are\n * re-picked automatically once the band count is known (unless the caller\n * supplied them explicitly); single-band rasters default to the image's\n * embedded color table when present ('palette') or grayscale otherwise. */\nexport const DEFAULT_LAYER_STATE: RasterLayerState = {\n mode: 'rgb',\n bands: [1, 2, 3],\n rescale: null,\n colormap: 'gray',\n nodata: 'auto',\n opacity: 1,\n gamma: 1,\n stretch: 'linear',\n visible: true,\n};\n\n/**\n * Creates a complete layer state from optional overrides.\n *\n * @param overrides - Partial state merged over the defaults\n * @returns A fully populated RasterLayerState\n */\nexport function createLayerState(\n overrides?: Partial<RasterLayerState>,\n): RasterLayerState {\n return { ...DEFAULT_LAYER_STATE, ...overrides };\n}\n\n/**\n * Internal record for a managed raster layer. The public surface exposes\n * {@link RasterLayerInfo} snapshots derived via {@link toLayerInfo}.\n */\nexport interface RasterLayer {\n id: string;\n name: string;\n source: RasterLayerSource;\n /** URL handed to loadGeoTIFF (the objectUrl for local files). */\n url: string;\n state: RasterLayerState;\n /** Whether the caller explicitly chose mode/bands (suppresses auto-pick). */\n userPickedMode: boolean;\n geotiff: GeoTIFF | null;\n autoStats: AutoStats | null;\n bandCount: number | null;\n bandNames: globalThis.Map<number, string> | null;\n /** Embedded TIFF color table (256x1 RGBA), when the image carries one. */\n palette: ImageData | null;\n /** GPU upload of {@link palette}; created lazily once a device exists. */\n paletteTexture: Texture | null;\n /** Map style layer id to insert the raster beneath, when set. */\n beforeId: string | null;\n bounds: GeographicBounds | null;\n /** Fit the map to the layer bounds once loaded. */\n zoomTo: boolean;\n loading: boolean;\n error: Error | null;\n /** Aborts in-flight stats sampling when the layer is removed. */\n abort: AbortController;\n}\n\n/**\n * Derives the public snapshot for a layer.\n *\n * @param layer - Internal layer record\n * @returns A read-only info object safe to hand to consumers\n */\nexport function toLayerInfo(layer: RasterLayer): RasterLayerInfo {\n return {\n id: layer.id,\n name: layer.name,\n source: layer.source,\n bandCount: layer.bandCount,\n bandNames: layer.bandNames ? new Map(layer.bandNames) : null,\n beforeId: layer.beforeId,\n state: { ...layer.state },\n };\n}\n\n/**\n * Derives a display name from a URL or file name: the last path segment\n * without query string.\n *\n * @param source - URL string or file name\n * @returns A short human-readable layer name\n */\nexport function deriveLayerName(source: string): string {\n try {\n const path = source.includes('://')\n ? new URL(source).pathname\n : source;\n const segment = path.split('/').filter(Boolean).pop();\n return segment ? decodeURIComponent(segment) : source;\n } catch {\n return source;\n }\n}\n","import { MapboxOverlay } from '@deck.gl/mapbox';\nimport { COGLayer } from '@developmentseed/deck.gl-geotiff';\nimport {\n createColormapTexture,\n decodeColormapSprite,\n} from '@developmentseed/deck.gl-raster/gpu-modules';\nimport { parseColormap, type GeoTIFF } from '@developmentseed/geotiff';\nimport type { Device, Texture } from '@luma.gl/core';\nimport type { Map as MapLibreMap } from 'maplibre-gl';\nimport type { AddRasterOptions, RasterLayerState } from '../core/types';\nimport { colormapsPngUrl } from '../raster/colormaps';\nimport { loadGeoTIFF as defaultLoadGeoTIFF } from '../raster/load-geotiff';\nimport {\n buildPaletteCompositeRenderTile,\n buildRgbCompositeRenderTile,\n buildSingleCompositeRenderTile,\n} from '../raster/render-pipeline';\nimport {\n computeAutoStats as defaultComputeAutoStats,\n readBandNames,\n type AutoStats,\n} from '../raster/stats';\nimport {\n makeMultiBandTileLoader,\n MAX_BAND_SLOTS,\n type MultiBandTileData,\n} from '../raster/tile-loader';\nimport { generateId } from '../utils/helpers';\nimport {\n createLayerState,\n deriveLayerName,\n type GeographicBounds,\n type RasterLayer,\n} from './RasterLayer';\n\n// Module-scope so the getTileData identity stays stable for the lifetime of\n// the page. deck.gl's TileLayer treats a changed getTileData reference as\n// cache-invalidating, so allocating a fresh closure per rebuild would refetch\n// tiles on every state change (opacity drag, band swap, etc.). All layers\n// share one loader that always fetches the first up-to-4 bands.\nconst FETCHED_BANDS = Array.from({ length: MAX_BAND_SLOTS }, (_, i) => i + 1);\nconst getTileData = makeMultiBandTileLoader(FETCHED_BANDS);\n\n/** Uploads an embedded color table as a 2D-array texture for the Colormap\n * shader module. Unlike `createColormapTexture` (which uses linear filtering\n * for smooth continuous colormaps), palette lookups must be NEAREST-filtered:\n * the shader samples at index/255, which lands between texel centers, and\n * linear filtering would blend each class color with its neighbors — mostly\n * unused black entries in typical land-cover palettes. */\nfunction createPaletteTexture(device: Device, palette: ImageData): Texture {\n const bytes = new Uint8Array(\n palette.data.buffer,\n palette.data.byteOffset,\n palette.data.byteLength,\n );\n return device.createTexture({\n dimension: '2d-array',\n format: 'rgba8unorm',\n width: palette.width,\n height: 1,\n depth: 1,\n data: bytes,\n mipLevels: 1,\n sampler: {\n minFilter: 'nearest',\n magFilter: 'nearest',\n addressModeU: 'clamp-to-edge',\n addressModeV: 'clamp-to-edge',\n addressModeW: 'clamp-to-edge',\n },\n });\n}\n\n/** Parses the TIFF's embedded color table (ColorMap tag) into a 256x1 RGBA\n * ImageData, marking the declared nodata index transparent. Returns null\n * when the tag is absent or the palette isn't 8-bit (256 entries) — the GPU\n * colormap texture path only supports 256-texel tables. */\nfunction extractPalette(tiff: GeoTIFF): ImageData | null {\n const cmap = tiff.cachedTags?.colorMap;\n if (!cmap || cmap.length !== 256 * 3) return null;\n const nodata = tiff.nodata;\n const nodataIndex =\n nodata !== null && Number.isInteger(nodata) && nodata >= 0 && nodata < 256\n ? nodata\n : undefined;\n try {\n return parseColormap(cmap, nodataIndex);\n } catch {\n return null;\n }\n}\n\n/** Events emitted by the LayerManager. */\nexport type LayerManagerEvent =\n | 'rasteradd'\n | 'rasterremove'\n | 'rasterchange'\n | 'rasterselect'\n | 'error';\n\n/** Payload passed to LayerManager event handlers. */\nexport interface LayerManagerEventData {\n type: LayerManagerEvent;\n layerId?: string;\n error?: Error;\n}\n\nexport type LayerManagerEventHandler = (event: LayerManagerEventData) => void;\n\n/** Minimal overlay surface the manager drives. MapboxOverlay satisfies it;\n * tests inject a recorder. */\nexport interface OverlayLike {\n setProps(props: { layers?: unknown[] }): void;\n}\n\n/** Injectable collaborators, overridable in unit tests so no network or\n * WebGL is touched under jsdom. */\nexport interface LayerManagerDeps {\n loadGeoTIFF: (url: string) => Promise<GeoTIFF>;\n computeAutoStats: (\n tiff: GeoTIFF,\n signal: AbortSignal,\n onProgress?: (partial: AutoStats) => void,\n ) => Promise<AutoStats>;\n /** Creates the deck.gl overlay and adds it to the map. */\n createOverlay: (\n map: MapLibreMap,\n options: { interleaved: boolean; onDeviceInitialized: (d: Device) => void },\n ) => OverlayLike;\n /** Removes a previously created overlay from the map. */\n removeOverlay: (map: MapLibreMap, overlay: OverlayLike) => void;\n}\n\nconst DEFAULT_DEPS: LayerManagerDeps = {\n loadGeoTIFF: defaultLoadGeoTIFF,\n computeAutoStats: defaultComputeAutoStats,\n createOverlay: (map, options) => {\n const overlay = new MapboxOverlay({\n interleaved: options.interleaved,\n layers: [],\n onDeviceInitialized: options.onDeviceInitialized,\n });\n map.addControl(overlay);\n return overlay;\n },\n removeOverlay: (map, overlay) => {\n map.removeControl(overlay as unknown as MapboxOverlay);\n },\n};\n\n/**\n * Owns the raster layer list and the shared deck.gl overlay.\n *\n * Responsibilities:\n * - lazily creates one MapboxOverlay on first addRaster\n * - loads GeoTIFFs (with the CORS workaround) and computes auto-stats\n * - auto-picks mode/bands from the band count\n * - rebuilds the COGLayer array (stable per-layer ids preserve tile caches)\n * - emits rasteradd / rasterremove / rasterchange / rasterselect / error\n */\nexport class LayerManager {\n private _map: MapLibreMap;\n private _interleaved: boolean;\n private _deps: LayerManagerDeps;\n private _layers: RasterLayer[] = [];\n private _selectedId: string | null = null;\n private _overlay: OverlayLike | null = null;\n private _device: Device | null = null;\n private _colormapTexture: Texture | null = null;\n private _handlers = new globalThis.Map<\n LayerManagerEvent,\n Set<LayerManagerEventHandler>\n >();\n private _destroyed = false;\n\n /**\n * Creates a LayerManager bound to a map.\n *\n * @param map - The MapLibre GL map instance\n * @param options - Overlay options (interleaved rendering)\n * @param deps - Injectable collaborators for testing\n */\n constructor(\n map: MapLibreMap,\n options?: { interleaved?: boolean },\n deps?: Partial<LayerManagerDeps>,\n ) {\n this._map = map;\n this._interleaved = options?.interleaved ?? true;\n this._deps = { ...DEFAULT_DEPS, ...deps };\n }\n\n /** The id of the layer currently selected for editing, or null. */\n get selectedId(): string | null {\n return this._selectedId;\n }\n\n /** All managed layers in draw order (first = bottom). */\n getLayers(): RasterLayer[] {\n return [...this._layers];\n }\n\n /** Looks up a layer by id. */\n getLayer(id: string): RasterLayer | undefined {\n return this._layers.find((l) => l.id === id);\n }\n\n /**\n * Adds a raster layer from a remote URL or a local File.\n *\n * The layer appears in the list immediately (loading state) and renders\n * once the GeoTIFF header loads. Resolves with the layer id after the\n * header loads; rejects (and emits 'error') when loading fails.\n *\n * @param source - COG URL or a local GeoTIFF File\n * @param options - Id/name/state overrides and zoom behavior\n * @returns The new layer's id\n */\n async addRaster(\n source: string | File,\n options?: AddRasterOptions,\n ): Promise<string> {\n const id = options?.id ?? generateId('raster');\n if (this.getLayer(id)) {\n throw new Error(`Raster layer id \"${id}\" already exists`);\n }\n const isFile = typeof source !== 'string';\n const url = isFile ? URL.createObjectURL(source) : source;\n const layer: RasterLayer = {\n id,\n name:\n options?.name ?? deriveLayerName(isFile ? source.name : source),\n source: isFile\n ? { kind: 'file', fileName: source.name, objectUrl: url }\n : { kind: 'url', url },\n url,\n state: createLayerState(options?.state),\n userPickedMode:\n options?.state?.mode !== undefined || options?.state?.bands !== undefined,\n geotiff: null,\n autoStats: null,\n bandCount: null,\n bandNames: null,\n palette: null,\n paletteTexture: null,\n beforeId: options?.beforeId?.trim() || null,\n bounds: null,\n zoomTo: options?.zoomTo ?? true,\n loading: true,\n error: null,\n abort: new AbortController(),\n };\n\n this._layers.push(layer);\n this._ensureOverlay();\n this.select(layer.id);\n this._emit({ type: 'rasteradd', layerId: layer.id });\n\n try {\n const tiff = await this._deps.loadGeoTIFF(url);\n if (this._destroyed || !this.getLayer(layer.id)) return layer.id;\n layer.geotiff = tiff;\n layer.bandCount = tiff.count;\n layer.bandNames = readBandNames(tiff);\n layer.palette = extractPalette(tiff);\n layer.loading = false;\n if (!layer.userPickedMode) {\n // 1 or 2 bands → single + colormap. RGB on 2 bands leaves blue empty.\n if (tiff.count >= 3) {\n layer.state.mode = 'rgb';\n layer.state.bands = [1, 2, 3];\n } else {\n layer.state.mode = 'single';\n layer.state.bands = [1];\n // Prefer the image's embedded color table when it carries one;\n // otherwise the 'gray' default from DEFAULT_LAYER_STATE applies.\n if (layer.palette) layer.state.colormap = 'palette';\n }\n }\n this._rebuild();\n this._emit({ type: 'rasterchange', layerId: layer.id });\n this._computeStats(layer);\n return layer.id;\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err));\n if (!this._destroyed && this.getLayer(layer.id)) {\n layer.loading = false;\n layer.error = error;\n this._emit({ type: 'error', layerId: layer.id, error });\n this._emit({ type: 'rasterchange', layerId: layer.id });\n }\n throw error;\n }\n }\n\n /**\n * Removes a layer, aborting any in-flight stats sampling and revoking the\n * blob URL for local files.\n *\n * @param id - The layer id\n */\n removeRaster(id: string): void {\n const index = this._layers.findIndex((l) => l.id === id);\n if (index === -1) return;\n const [layer] = this._layers.splice(index, 1);\n layer.abort.abort();\n if (layer.source.kind === 'file') {\n URL.revokeObjectURL(layer.source.objectUrl);\n }\n this._destroyPaletteTexture(layer);\n if (this._selectedId === id) {\n this.select(this._layers[this._layers.length - 1]?.id ?? null);\n }\n this._rebuild();\n this._emit({ type: 'rasterremove', layerId: id });\n }\n\n /**\n * Merges a partial visualization state into a layer and re-renders.\n *\n * @param id - The layer id\n * @param patch - State fields to update\n */\n setState(id: string, patch: Partial<RasterLayerState>): void {\n const layer = this.getLayer(id);\n if (!layer) return;\n if (patch.mode !== undefined || patch.bands !== undefined) {\n layer.userPickedMode = true;\n }\n layer.state = { ...layer.state, ...patch };\n this._rebuild();\n this._emit({ type: 'rasterchange', layerId: id });\n }\n\n /**\n * Shows or hides a layer.\n *\n * @param id - The layer id\n * @param visible - Whether the layer should render\n */\n setVisible(id: string, visible: boolean): void {\n this.setState(id, { visible });\n }\n\n /**\n * Selects the layer whose settings the panel edits.\n *\n * @param id - The layer id, or null to clear the selection\n */\n select(id: string | null): void {\n if (id !== null && !this.getLayer(id)) return;\n if (this._selectedId === id) return;\n this._selectedId = id;\n this._emit({ type: 'rasterselect', layerId: id ?? undefined });\n }\n\n /**\n * Fits the map view to a layer's geographic bounds (known once the\n * GeoTIFF loads).\n *\n * @param id - The layer id\n */\n zoomTo(id: string): void {\n const layer = this.getLayer(id);\n if (!layer?.bounds) return;\n this._fitBounds(layer.bounds);\n }\n\n /**\n * Moves a layer to a new position in the draw order.\n *\n * @param id - The layer id\n * @param toIndex - Target index (0 = bottom)\n */\n reorder(id: string, toIndex: number): void {\n const from = this._layers.findIndex((l) => l.id === id);\n if (from === -1) return;\n const to = Math.max(0, Math.min(this._layers.length - 1, toIndex));\n if (from === to) return;\n const [layer] = this._layers.splice(from, 1);\n this._layers.splice(to, 0, layer);\n this._rebuild();\n this._emit({ type: 'rasterchange', layerId: id });\n }\n\n /**\n * Registers an event handler.\n *\n * @param event - Event type\n * @param handler - Callback\n */\n on(event: LayerManagerEvent, handler: LayerManagerEventHandler): void {\n if (!this._handlers.has(event)) this._handlers.set(event, new Set());\n this._handlers.get(event)!.add(handler);\n }\n\n /**\n * Removes an event handler.\n *\n * @param event - Event type\n * @param handler - Callback to remove\n */\n off(event: LayerManagerEvent, handler: LayerManagerEventHandler): void {\n this._handlers.get(event)?.delete(handler);\n }\n\n /**\n * Tears down the manager: aborts stats, revokes blob URLs, and removes\n * the overlay from the map.\n */\n destroy(): void {\n this._destroyed = true;\n for (const layer of this._layers) {\n layer.abort.abort();\n if (layer.source.kind === 'file') {\n URL.revokeObjectURL(layer.source.objectUrl);\n }\n this._destroyPaletteTexture(layer);\n }\n this._layers = [];\n this._selectedId = null;\n if (this._overlay) {\n this._deps.removeOverlay(this._map, this._overlay);\n this._overlay = null;\n }\n this._handlers.clear();\n }\n\n private _destroyPaletteTexture(layer: RasterLayer): void {\n if (!layer.paletteTexture) return;\n try {\n layer.paletteTexture.destroy();\n } catch {\n // best-effort\n }\n layer.paletteTexture = null;\n }\n\n private _emit(data: Omit<LayerManagerEventData, 'type'> & { type: LayerManagerEvent }): void {\n const handlers = this._handlers.get(data.type);\n if (handlers) {\n handlers.forEach((handler) => handler(data));\n }\n }\n\n private _ensureOverlay(): void {\n if (this._overlay) return;\n this._overlay = this._deps.createOverlay(this._map, {\n interleaved: this._interleaved,\n onDeviceInitialized: (device) => {\n this._device = device;\n void this._loadColormapTexture();\n },\n });\n }\n\n /** Fetch + decode the colormap sprite once per device, then re-render so\n * single-band layers pick up their colormap (they fall back to RGB\n * rendering until the texture is ready). */\n private async _loadColormapTexture(): Promise<void> {\n if (!this._device || this._colormapTexture) return;\n try {\n const resp = await fetch(colormapsPngUrl);\n const bytes = await resp.arrayBuffer();\n const image = await decodeColormapSprite(bytes);\n if (this._destroyed || !this._device) return;\n this._colormapTexture = createColormapTexture(this._device, image);\n this._rebuild();\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err));\n this._emit({ type: 'error', error });\n }\n }\n\n private _computeStats(layer: RasterLayer): void {\n if (!layer.geotiff) return;\n const signal = layer.abort.signal;\n void (async () => {\n try {\n const stats = await this._deps.computeAutoStats(\n layer.geotiff!,\n signal,\n (partial) => {\n if (signal.aborted || this._destroyed) return;\n layer.autoStats = partial;\n this._rebuild();\n this._emit({ type: 'rasterchange', layerId: layer.id });\n },\n );\n if (signal.aborted || this._destroyed) return;\n layer.autoStats = stats;\n this._rebuild();\n this._emit({ type: 'rasterchange', layerId: layer.id });\n } catch {\n // Stats are an enhancement; rendering falls back to [0, 1] rescale.\n }\n })();\n }\n\n private _fitBounds(bounds: GeographicBounds): void {\n this._map.fitBounds(\n [\n [bounds.west, bounds.south],\n [bounds.east, bounds.north],\n ],\n { padding: 40, duration: 800 },\n );\n }\n\n /** Re-derives the deck.gl layer array from current layer states and pushes\n * it to the overlay. Layer ids are stable so deck.gl preserves each\n * layer's tile cache across rebuilds. */\n private _rebuild(): void {\n if (!this._overlay) return;\n const layers = this._layers\n .filter((l) => l.geotiff && l.state.visible)\n .map((l) => this._buildCogLayer(l));\n this._overlay.setProps({ layers });\n }\n\n private _buildCogLayer(layer: RasterLayer): COGLayer<MultiBandTileData> {\n const renderTile = this._renderTileFor(layer);\n\n // beforeId is read by @deck.gl/mapbox's MapboxOverlay in interleaved\n // mode but missing from COGLayer's narrower props type — build the props\n // as a const so structural assignability applies instead of the\n // excess-property check. Only forward ids that exist in the current\n // style; a stale id would make the overlay throw on the next style event.\n const cogProps = {\n id: layer.id,\n geotiff: layer.geotiff!,\n opacity: layer.state.opacity,\n getTileData,\n renderTile,\n beforeId: this._resolveBeforeId(layer.beforeId),\n onGeoTIFFLoad: (\n _tiff: GeoTIFF,\n options: { geographicBounds: GeographicBounds },\n ) => {\n layer.bounds = options.geographicBounds;\n if (layer.zoomTo) {\n layer.zoomTo = false;\n this._fitBounds(layer.bounds);\n }\n },\n };\n return new COGLayer(cogProps);\n }\n\n /** Returns the beforeId only when that layer exists in the map's current\n * style (warns otherwise). */\n private _resolveBeforeId(beforeId: string | null): string | undefined {\n if (!beforeId) return undefined;\n try {\n if (this._map.getLayer(beforeId)) return beforeId;\n } catch {\n return undefined;\n }\n console.warn(\n `maplibre-gl-raster: beforeId layer \"${beforeId}\" not found in the map style; drawing the raster on top.`,\n );\n return undefined;\n }\n\n /** Picks the render pipeline for a layer: embedded palette lookup, named\n * colormap, or RGB compositing. GPU-texture-dependent paths fall back to\n * RGB until the device / textures are ready. */\n private _renderTileFor(layer: RasterLayer) {\n if (layer.state.mode === 'single') {\n if (layer.state.colormap === 'palette' && layer.palette) {\n if (!layer.paletteTexture && this._device) {\n try {\n layer.paletteTexture = createPaletteTexture(\n this._device,\n layer.palette,\n );\n } catch (err) {\n // Drop the palette so we stop retrying and fall back to the\n // named-colormap path on the next rebuild.\n layer.palette = null;\n const error = err instanceof Error ? err : new Error(String(err));\n this._emit({ type: 'error', layerId: layer.id, error });\n }\n }\n if (layer.paletteTexture) {\n return buildPaletteCompositeRenderTile(\n layer.state,\n layer.paletteTexture,\n );\n }\n } else if (this._colormapTexture) {\n return buildSingleCompositeRenderTile(\n layer.state,\n this._colormapTexture,\n layer.autoStats,\n );\n }\n }\n return buildRgbCompositeRenderTile(layer.state, layer.autoStats);\n }\n}\n","/**\n * Tiny imperative DOM helpers used by the panel UI components. They replace\n * the JSX layer of the cog-viewer implementation this plugin is ported from.\n */\n\ntype ElProps = {\n className?: string;\n text?: string;\n title?: string;\n type?: string;\n value?: string;\n placeholder?: string;\n ariaLabel?: string;\n disabled?: boolean;\n attrs?: Record<string, string>;\n};\n\n/**\n * Creates an HTML element with common props and children.\n *\n * @param tag - HTML tag name\n * @param props - className/text/title/aria-label/attrs shorthands\n * @param children - Nodes or strings appended in order\n * @returns The created element\n */\nexport function el<K extends keyof HTMLElementTagNameMap>(\n tag: K,\n props?: ElProps,\n ...children: (Node | string)[]\n): HTMLElementTagNameMap[K] {\n const node = document.createElement(tag);\n if (props) {\n if (props.className) node.className = props.className;\n if (props.text !== undefined) node.textContent = props.text;\n if (props.title) node.title = props.title;\n if (props.ariaLabel) node.setAttribute('aria-label', props.ariaLabel);\n if (props.type && 'type' in node) {\n (node as unknown as { type: string }).type = props.type;\n }\n if (props.value !== undefined && 'value' in node) {\n (node as unknown as { value: string }).value = props.value;\n }\n if (props.placeholder && 'placeholder' in node) {\n (node as unknown as { placeholder: string }).placeholder = props.placeholder;\n }\n if (props.disabled !== undefined && 'disabled' in node) {\n (node as unknown as { disabled: boolean }).disabled = props.disabled;\n }\n if (props.attrs) {\n for (const [name, value] of Object.entries(props.attrs)) {\n node.setAttribute(name, value);\n }\n }\n }\n node.append(...children);\n return node;\n}\n\nconst SVG_NS = 'http://www.w3.org/2000/svg';\n\n/**\n * Creates an SVG element with attributes.\n *\n * @param tag - SVG tag name\n * @param attrs - Attributes applied via setAttribute\n * @returns The created SVG element\n */\nexport function svgEl<K extends keyof SVGElementTagNameMap>(\n tag: K,\n attrs?: Record<string, string | number>,\n): SVGElementTagNameMap[K] {\n const node = document.createElementNS(SVG_NS, tag);\n if (attrs) {\n for (const [name, value] of Object.entries(attrs)) {\n node.setAttribute(name, String(value));\n }\n }\n return node;\n}\n\n/**\n * Removes all children from a node.\n *\n * @param node - The node to clear\n */\nexport function clearEl(node: HTMLElement): void {\n while (node.firstChild) node.removeChild(node.firstChild);\n}\n\n/**\n * Builds a labeled form field: a caption row plus arbitrary content. Help\n * text becomes a native tooltip on the caption.\n *\n * @param label - Caption text\n * @param content - Field body element\n * @param help - Optional tooltip text\n * @returns The field wrapper element\n */\nexport function field(\n label: string,\n content: HTMLElement,\n help?: string,\n): HTMLElement {\n const caption = el('span', {\n className: 'mlr-field-label',\n text: label,\n title: help,\n });\n return el('div', { className: 'mlr-field' }, caption, content);\n}\n\n/**\n * Builds a <select> from options and wires a change handler.\n *\n * @param options - Value/label pairs\n * @param value - Initially selected value\n * @param onChange - Change callback with the selected value\n * @param ariaLabel - Accessible name\n * @returns The select element\n */\nexport function select(\n options: { value: string; label: string }[],\n value: string,\n onChange: (next: string) => void,\n ariaLabel?: string,\n): HTMLSelectElement {\n const node = el('select', { className: 'mlr-select', ariaLabel });\n for (const opt of options) {\n const option = el('option', { text: opt.label });\n option.value = opt.value;\n node.appendChild(option);\n }\n node.value = value;\n node.addEventListener('change', () => onChange(node.value));\n return node;\n}\n\n/**\n * Formats a number for display in a numeric input. Trims to 2 decimals for\n * |n| >= 1 and 4 significant digits below that, matching typical COG ranges.\n *\n * @param n - The number to format\n * @returns A compact numeric value\n */\nexport function fmtNumber(n: number): number {\n if (!Number.isFinite(n)) return 0;\n const abs = Math.abs(n);\n if (abs >= 1) return Number(n.toFixed(2));\n return Number(n.toPrecision(4));\n}\n","import { el } from './dom';\n\nexport type AddDataSectionOptions = {\n /** Prefills the URL input (not loaded until the user clicks Load). */\n initialUrl?: string;\n /** Called with a remote COG URL and the optional before-layer id. */\n onAddUrl: (url: string, beforeId?: string) => void;\n /** Called with a locally selected or dropped GeoTIFF file and the\n * optional before-layer id. */\n onAddFile: (file: File, beforeId?: string) => void;\n};\n\n/**\n * \"Add data\" section: URL input + Load button, plus a drop zone that accepts\n * `.tif` / `.tiff` files via click-to-browse or drag-and-drop. Ported from\n * cog-viewer's EmptyState.\n */\nexport class AddDataSection {\n /** Root element to insert into the panel. */\n readonly el: HTMLElement;\n\n /**\n * Creates the section.\n *\n * @param options - URL / file callbacks\n */\n constructor(options: AddDataSectionOptions) {\n // The accept attribute is advisory (and drag-drop bypasses it entirely),\n // so filter by extension before handing files to the raster loader.\n const isTiff = (file: File): boolean => /\\.tiff?$/i.test(file.name);\n const input = el('input', {\n className: 'mlr-input',\n type: 'text',\n placeholder: 'https://…/cog.tif',\n value: options.initialUrl ?? '',\n ariaLabel: 'raster-url',\n });\n const loadBtn = el('button', {\n className: 'mlr-button',\n type: 'button',\n text: 'Load',\n disabled: input.value.trim().length === 0,\n ariaLabel: 'load-url',\n });\n input.addEventListener('input', () => {\n loadBtn.disabled = input.value.trim().length === 0;\n });\n\n // Optional: insert the raster beneath an existing style layer (e.g. a\n // symbol layer) so labels stay readable.\n const beforeIdInput = el('input', {\n className: 'mlr-input',\n type: 'text',\n placeholder: 'Before layer id (optional)',\n ariaLabel: 'before-id',\n title:\n 'Id of an existing map layer to insert the raster beneath (e.g. a label layer). Leave empty to draw on top.',\n });\n const currentBeforeId = () => beforeIdInput.value.trim() || undefined;\n\n const submitUrl = () => {\n const url = input.value.trim();\n if (!url) return;\n input.value = '';\n loadBtn.disabled = true;\n options.onAddUrl(url, currentBeforeId());\n };\n loadBtn.addEventListener('click', submitUrl);\n input.addEventListener('keydown', (e) => {\n if (e.key === 'Enter') submitUrl();\n });\n\n const urlRow = el('div', { className: 'mlr-row' }, input, loadBtn);\n\n const fileInput = el('input', {\n type: 'file',\n ariaLabel: 'raster-file',\n attrs: { accept: '.tif,.tiff' },\n });\n fileInput.style.display = 'none';\n fileInput.addEventListener('change', () => {\n const f = fileInput.files?.[0];\n if (f && isTiff(f)) options.onAddFile(f, currentBeforeId());\n fileInput.value = '';\n });\n\n const dropZone = el(\n 'div',\n {\n className: 'mlr-drop-zone',\n text: 'Drop a .tif file here, or click to browse',\n attrs: { role: 'button', tabindex: '0' },\n },\n fileInput,\n );\n dropZone.addEventListener('click', () => fileInput.click());\n dropZone.addEventListener('keydown', (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n fileInput.click();\n }\n });\n dropZone.addEventListener('dragover', (e) => {\n e.preventDefault();\n dropZone.classList.add('dragover');\n });\n dropZone.addEventListener('dragleave', () => {\n dropZone.classList.remove('dragover');\n });\n dropZone.addEventListener('drop', (e) => {\n e.preventDefault();\n dropZone.classList.remove('dragover');\n const f = e.dataTransfer?.files[0];\n if (f && isTiff(f)) options.onAddFile(f, currentBeforeId());\n });\n\n this.el = el(\n 'div',\n { className: 'mlr-section mlr-add-data' },\n el('div', { className: 'mlr-section-title', text: 'Add data' }),\n urlRow,\n dropZone,\n beforeIdInput,\n );\n }\n}\n","import type { RasterLayer } from '../state/RasterLayer';\nimport { clearEl, el } from './dom';\n\nexport type LayerListOptions = {\n onSelect: (id: string) => void;\n onToggleVisible: (id: string, visible: boolean) => void;\n onZoomTo: (id: string) => void;\n onMove: (id: string, direction: -1 | 1) => void;\n onRemove: (id: string) => void;\n};\n\n/**\n * Layer list section: one row per raster layer with visibility checkbox,\n * selectable name, zoom-to, reorder (up/down), and remove actions. The list\n * is displayed top layer first (reverse of draw order) to match common GIS\n * layer-panel conventions.\n */\nexport class LayerList {\n /** Root element to insert into the panel. */\n readonly el: HTMLElement;\n private _list: HTMLElement;\n private _options: LayerListOptions;\n\n /**\n * Creates the list.\n *\n * @param options - Row action callbacks\n */\n constructor(options: LayerListOptions) {\n this._options = options;\n this._list = el('div', { className: 'mlr-layer-list' });\n this.el = el(\n 'div',\n { className: 'mlr-section' },\n el('div', { className: 'mlr-section-title', text: 'Layers' }),\n this._list,\n );\n }\n\n /**\n * Re-renders all rows.\n *\n * @param layers - Layers in draw order (first = bottom)\n * @param selectedId - Currently selected layer id\n */\n update(layers: RasterLayer[], selectedId: string | null): void {\n clearEl(this._list);\n if (layers.length === 0) {\n this._list.appendChild(\n el('div', {\n className: 'mlr-empty',\n text: 'No layers yet. Add a COG URL or drop a GeoTIFF above.',\n }),\n );\n return;\n }\n // Top of the list = top of the draw order.\n for (let i = layers.length - 1; i >= 0; i--) {\n this._list.appendChild(this._buildRow(layers[i], i, layers.length, selectedId));\n }\n }\n\n private _buildRow(\n layer: RasterLayer,\n index: number,\n count: number,\n selectedId: string | null,\n ): HTMLElement {\n const { onSelect, onToggleVisible, onZoomTo, onMove, onRemove } =\n this._options;\n\n const visible = el('input', {\n type: 'checkbox',\n ariaLabel: `visible-${layer.name}`,\n title: 'Show / hide layer',\n });\n visible.checked = layer.state.visible;\n visible.addEventListener('change', () =>\n onToggleVisible(layer.id, visible.checked),\n );\n\n const status = layer.loading\n ? ' (loading…)'\n : layer.error\n ? ' (failed)'\n : '';\n const name = el('button', {\n className: 'mlr-layer-name',\n type: 'button',\n text: `${layer.name}${status}`,\n title: layer.error ? layer.error.message : layer.name,\n });\n name.addEventListener('click', () => onSelect(layer.id));\n\n const zoom = this._iconButton('⌖', 'Zoom to layer', () =>\n onZoomTo(layer.id),\n );\n zoom.disabled = !layer.bounds;\n const up = this._iconButton('↑', 'Move layer up', () =>\n onMove(layer.id, 1),\n );\n up.disabled = index >= count - 1;\n const down = this._iconButton('↓', 'Move layer down', () =>\n onMove(layer.id, -1),\n );\n down.disabled = index <= 0;\n const remove = this._iconButton('×', 'Remove layer', () =>\n onRemove(layer.id),\n );\n\n const row = el(\n 'div',\n { className: 'mlr-layer-row' },\n visible,\n name,\n zoom,\n up,\n down,\n remove,\n );\n if (layer.id === selectedId) row.classList.add('selected');\n if (layer.error) row.classList.add('errored');\n return row;\n }\n\n private _iconButton(\n glyph: string,\n title: string,\n onClick: () => void,\n ): HTMLButtonElement {\n const btn = el('button', {\n className: 'mlr-icon-button',\n type: 'button',\n text: glyph,\n title,\n ariaLabel: title,\n });\n btn.addEventListener('click', onClick);\n return btn;\n }\n}\n","import type { BandStats } from '../raster/stats';\nimport { el, svgEl } from './dom';\n\nconst HANDLE_SIZE = 12;\n\nexport type BandHistogramOptions = {\n /** CSS color for the histogram bars. RGB rows pass channel-tinted colors;\n * single-band defaults to a neutral dark. */\n color?: string;\n height?: number;\n /** Optional label rendered above the chart (e.g. \"R\", \"G\", \"B\"). */\n label?: string;\n /** Called continuously while a handle is dragged. */\n onChange: (next: [number, number]) => void;\n /** Drag lifecycle hooks so the host can defer re-renders mid-drag. */\n onDragStart?: () => void;\n onDragEnd?: () => void;\n};\n\n/**\n * SVG histogram + HTML handle overlays for a rescale range, ported from\n * cog-viewer's React BandHistogram to imperative DOM. The SVG bars stretch\n * to fill the width via `preserveAspectRatio=\"none\"`; the handles themselves\n * are absolutely-positioned `<div>`s so they stay perfectly circular\n * regardless of the container's aspect ratio.\n *\n * Bar heights use log(1+count) so heavily skewed distributions (a single\n * huge bin near zero plus a long thin tail) stay readable.\n */\nexport class BandHistogram {\n /** Root element to insert into the panel. */\n readonly el: HTMLElement;\n\n private _opts: Required<Pick<BandHistogramOptions, 'color' | 'height'>> &\n BandHistogramOptions;\n private _wrap: HTMLElement;\n private _svg: SVGSVGElement;\n private _barsGroup: SVGGElement;\n private _selectionRect: SVGRectElement;\n private _loHandle: HTMLElement;\n private _hiHandle: HTMLElement;\n private _stats: BandStats | null = null;\n private _value: [number, number] = [0, 1];\n private _dragging: 'lo' | 'hi' | null = null;\n\n /**\n * Creates the histogram widget.\n *\n * @param options - Colors, sizing, and change callbacks\n */\n constructor(options: BandHistogramOptions) {\n // The default is a CSS variable so the neutral single-band histogram\n // follows the light/dark theme; colors are applied via style properties\n // (not SVG presentation attributes) because var() only resolves in CSS.\n this._opts = {\n color: 'var(--mlr-histogram-neutral)',\n height: 64,\n ...options,\n };\n const height = this._opts.height;\n\n this._svg = svgEl('svg', {\n viewBox: `0 0 100 ${height}`,\n preserveAspectRatio: 'none',\n width: '100%',\n height,\n });\n this._svg.classList.add('mlr-histogram-svg');\n\n const bg = svgEl('rect', { width: 100, height, class: 'mlr-histogram-bg' });\n this._barsGroup = svgEl('g');\n this._barsGroup.style.fill = this._opts.color;\n this._selectionRect = svgEl('rect', {\n x: 0,\n y: 0,\n width: 0,\n height,\n opacity: 0.12,\n });\n this._selectionRect.style.fill = this._opts.color;\n this._svg.append(bg, this._barsGroup, this._selectionRect);\n\n this._loHandle = this._makeHandle('lo');\n this._hiHandle = this._makeHandle('hi');\n\n this._wrap = el('div', { className: 'mlr-histogram-wrap' });\n this._wrap.style.height = `${height}px`;\n this._wrap.append(this._svg, this._loHandle, this._hiHandle);\n\n this._wrap.addEventListener('pointerdown', this._onBackgroundDown);\n this._wrap.addEventListener('pointermove', this._onPointerMove);\n this._wrap.addEventListener('pointerup', this._onPointerUp);\n this._wrap.addEventListener('pointercancel', this._onPointerUp);\n\n const children: HTMLElement[] = [];\n if (this._opts.label) {\n const label = el('span', {\n className: 'mlr-histogram-label',\n text: this._opts.label,\n });\n label.style.color = this._opts.color;\n children.push(label);\n }\n children.push(this._wrap);\n this.el = el('div', { className: 'mlr-histogram' }, ...children);\n }\n\n /**\n * Updates the displayed stats and selection range.\n *\n * @param stats - Band min/max + histogram bins\n * @param value - Current [lo, hi] selection in source units\n */\n update(stats: BandStats, value: [number, number]): void {\n const statsChanged = stats !== this._stats;\n this._stats = stats;\n this._value = value;\n if (statsChanged) this._drawBars();\n this._positionHandles();\n }\n\n /** Sets only the selection range (e.g. while typing in the numeric\n * inputs). */\n setValue(value: [number, number]): void {\n this._value = value;\n this._positionHandles();\n }\n\n private _makeHandle(which: 'lo' | 'hi'): HTMLElement {\n const handle = el('div', { className: 'mlr-histogram-handle' });\n handle.dataset.handle = which;\n handle.style.width = `${HANDLE_SIZE}px`;\n handle.style.height = `${HANDLE_SIZE}px`;\n handle.style.borderColor = this._opts.color;\n handle.addEventListener('pointerdown', (e) => {\n e.preventDefault();\n e.stopPropagation();\n (e.currentTarget as Element).setPointerCapture?.(e.pointerId);\n this._beginDrag(which);\n });\n handle.addEventListener('pointermove', this._onPointerMove);\n handle.addEventListener('pointerup', this._onPointerUp);\n handle.addEventListener('pointercancel', this._onPointerUp);\n return handle;\n }\n\n private _beginDrag(which: 'lo' | 'hi'): void {\n this._dragging = which;\n this._wrap.classList.add('dragging');\n this._opts.onDragStart?.();\n }\n\n private _endDrag(): void {\n if (!this._dragging) return;\n this._dragging = null;\n this._wrap.classList.remove('dragging');\n this._opts.onDragEnd?.();\n }\n\n /** Click on the chart background → snap nearest handle and continue as a\n * drag. */\n private _onBackgroundDown = (e: PointerEvent): void => {\n const target = e.target as HTMLElement;\n if (target.dataset?.handle) return;\n if (!this._stats) return;\n const v = this._xToValue(e.clientX);\n const [lo, hi] = this._sortedValue();\n const which: 'lo' | 'hi' =\n Math.abs(v - lo) <= Math.abs(v - hi) ? 'lo' : 'hi';\n this._applyDrag(which, v);\n (e.currentTarget as Element).setPointerCapture?.(e.pointerId);\n this._beginDrag(which);\n };\n\n private _onPointerMove = (e: PointerEvent): void => {\n if (!this._dragging) return;\n this._applyDrag(this._dragging, this._xToValue(e.clientX));\n };\n\n private _onPointerUp = (e: PointerEvent): void => {\n if (!this._dragging) return;\n (e.currentTarget as Element).releasePointerCapture?.(e.pointerId);\n this._endDrag();\n };\n\n private _applyDrag(which: 'lo' | 'hi', v: number): void {\n const [lo, hi] = this._sortedValue();\n const next: [number, number] =\n which === 'lo' ? [Math.min(v, hi), hi] : [lo, Math.max(v, lo)];\n this._value = next;\n this._positionHandles();\n this._opts.onChange(next);\n }\n\n private _sortedValue(): [number, number] {\n return [\n Math.min(this._value[0], this._value[1]),\n Math.max(this._value[0], this._value[1]),\n ];\n }\n\n private _toFrac(v: number): number {\n if (!this._stats) return 0;\n const range = this._stats.max - this._stats.min;\n const safeRange = range > 0 ? range : 1;\n return Math.max(0, Math.min(1, (v - this._stats.min) / safeRange));\n }\n\n private _xToValue(clientX: number): number {\n if (!this._stats) return 0;\n const rect = this._wrap.getBoundingClientRect();\n if (rect.width === 0) return this._stats.min;\n const fx = (clientX - rect.left) / rect.width;\n const range = this._stats.max - this._stats.min;\n const safeRange = range > 0 ? range : 1;\n return this._stats.min + Math.max(0, Math.min(1, fx)) * safeRange;\n }\n\n private _drawBars(): void {\n if (!this._stats) return;\n const height = this._opts.height;\n while (this._barsGroup.firstChild) {\n this._barsGroup.removeChild(this._barsGroup.firstChild);\n }\n let maxBin = 0;\n for (const c of this._stats.histogram) if (c > maxBin) maxBin = c;\n const logMaxBin = Math.log1p(maxBin) || 1;\n const w = 100 / this._stats.histogram.length;\n this._stats.histogram.forEach((count, i) => {\n const h = (Math.log1p(count) / logMaxBin) * (height - 4);\n if (h <= 0) return;\n this._barsGroup.appendChild(\n svgEl('rect', {\n x: i * w,\n y: height - h,\n width: w,\n height: h,\n opacity: 0.55,\n }),\n );\n });\n }\n\n private _positionHandles(): void {\n const [lo, hi] = this._sortedValue();\n const loFrac = this._toFrac(lo);\n const hiFrac = this._toFrac(hi);\n this._loHandle.style.left = `${loFrac * 100}%`;\n this._hiHandle.style.left = `${hiFrac * 100}%`;\n this._selectionRect.setAttribute('x', String(loFrac * 100));\n this._selectionRect.setAttribute('width', String((hiFrac - loFrac) * 100));\n }\n}\n","import { COLORMAP_OPTIONS, colormapsPngUrl } from '../raster/colormaps';\nimport type { BandStats } from '../raster/stats';\nimport { el, select } from './dom';\n\nconst PREVIEW_HEIGHT = 14;\nconst SPRITE_WIDTH = 256;\n\n/** Sentinel colormap name for the image's embedded color table. */\nexport const PALETTE_COLORMAP = 'palette';\n\n// The colormap sprite has one 1px-tall row per colormap. Decode it once;\n// previews blit a single source row so neighboring rows can never bleed in\n// (CSS background scaling interpolates across rows, producing artifacts).\nlet spritePromise: Promise<HTMLImageElement> | null = null;\nfunction loadSprite(): Promise<HTMLImageElement> {\n if (!spritePromise) {\n spritePromise = new Promise((resolve, reject) => {\n const img = new Image();\n img.onload = () => resolve(img);\n img.onerror = () => reject(new Error('Failed to load colormap sprite'));\n img.src = colormapsPngUrl;\n });\n }\n return spritePromise;\n}\n\nexport type ColormapPickerOptions = {\n /** Active colormap name (or {@link PALETTE_COLORMAP}). */\n value: string;\n onChange: (next: string) => void;\n /** The image's embedded color table; when present, an \"Image palette\"\n * option is offered (and previewed from this data). */\n palette?: ImageData | null;\n /** Sampled stats for the displayed band. When available, the palette\n * preview is restricted to index values that actually occur in the data\n * (land-cover palettes typically use a handful of the 256 entries). */\n stats?: BandStats | null;\n};\n\n/**\n * Derives the palette indices that occur in the sampled data: every integer\n * covered by a non-empty histogram bin, excluding fully transparent (nodata)\n * palette entries. Returns null when stats are unavailable or nothing\n * matches, in which case the full palette is shown.\n */\nfunction usedPaletteIndices(\n palette: ImageData,\n stats: BandStats | null | undefined,\n): number[] | null {\n if (!stats || stats.max < stats.min) return null;\n const bins = stats.histogram;\n if (!bins.some((c) => c > 0)) return null;\n const binWidth = (stats.max - stats.min) / bins.length || 1;\n const used = new Set<number>();\n for (let i = 0; i < bins.length; i++) {\n if (bins[i] <= 0) continue;\n const lo = Math.ceil(stats.min + i * binWidth);\n // Closed upper edge for the last bin so stats.max itself is included.\n const hi = Math.floor(\n i === bins.length - 1\n ? stats.max\n : stats.min + (i + 1) * binWidth - 1e-9,\n );\n for (let v = lo; v <= hi; v++) {\n if (v < 0 || v >= palette.width) continue;\n if (palette.data[v * 4 + 3] === 0) continue; // nodata entry\n used.add(v);\n }\n }\n return used.size > 0 ? [...used].sort((a, b) => a - b) : null;\n}\n\n/**\n * Colormap dropdown + canvas preview of the active selection.\n *\n * The preview is a 256x1 canvas stretched via CSS: exactly one sprite row\n * (or the layer's embedded palette) is drawn into it, so the upscale only\n * smooths horizontally and adjacent colormaps cannot bleed into the strip.\n */\nexport class ColormapPicker {\n /** Root element to insert into the panel. */\n readonly el: HTMLElement;\n private _select: HTMLSelectElement;\n private _canvas: HTMLCanvasElement;\n private _palette: ImageData | null;\n private _stats: BandStats | null;\n /** Guards async sprite draws against out-of-order completion. */\n private _drawToken = 0;\n\n /**\n * Creates the picker.\n *\n * @param options - Active value, change callback, optional embedded palette\n */\n constructor(options: ColormapPickerOptions) {\n this._palette = options.palette ?? null;\n this._stats = options.stats ?? null;\n\n const selectOptions = [\n ...(this._palette\n ? [{ value: PALETTE_COLORMAP, label: 'Image palette (default)' }]\n : []),\n ...COLORMAP_OPTIONS.map((o) => ({ value: o.name, label: o.label })),\n ];\n this._select = select(\n selectOptions,\n options.value,\n (next) => {\n void this._updatePreview(next);\n options.onChange(next);\n },\n 'colormap',\n );\n\n this._canvas = el('canvas', { className: 'mlr-colormap-preview' });\n this._canvas.width = SPRITE_WIDTH;\n this._canvas.height = 1;\n this._canvas.style.height = `${PREVIEW_HEIGHT}px`;\n\n this.el = el(\n 'div',\n { className: 'mlr-colormap-picker' },\n this._select,\n this._canvas,\n );\n void this._updatePreview(options.value);\n }\n\n /**\n * Sets the displayed colormap.\n *\n * @param value - Colormap name (or {@link PALETTE_COLORMAP})\n */\n update(value: string): void {\n void this._updatePreview(value);\n }\n\n private async _updatePreview(value: string): Promise<void> {\n const token = ++this._drawToken;\n const ctx = this._canvas.getContext('2d');\n if (!ctx) return;\n\n if (value === PALETTE_COLORMAP && this._palette) {\n this._select.value = PALETTE_COLORMAP;\n const indices = usedPaletteIndices(this._palette, this._stats);\n if (indices) {\n // Discrete swatches: one texel per value present in the data,\n // pixelated so class boundaries stay crisp when stretched.\n this._canvas.width = indices.length;\n this._canvas.style.imageRendering = 'pixelated';\n const data = this._palette.data;\n const strip = ctx.createImageData(indices.length, 1);\n indices.forEach((v, i) => {\n strip.data.set(data.subarray(v * 4, v * 4 + 4), i * 4);\n });\n ctx.putImageData(strip, 0, 0);\n } else {\n this._canvas.width = this._palette.width;\n this._canvas.style.imageRendering = '';\n ctx.putImageData(this._palette, 0, 0);\n }\n return;\n }\n\n // Unknown names fall back to the first option so the select and the\n // preview never go stale or out of sync.\n const active =\n COLORMAP_OPTIONS.find((o) => o.name === value) ?? COLORMAP_OPTIONS[0];\n this._select.value = active.name;\n try {\n const sprite = await loadSprite();\n if (token !== this._drawToken) return; // superseded by a newer draw\n this._canvas.width = SPRITE_WIDTH;\n this._canvas.style.imageRendering = '';\n ctx.clearRect(0, 0, SPRITE_WIDTH, 1);\n ctx.drawImage(sprite, 0, active.rowIndex, SPRITE_WIDTH, 1, 0, 0, SPRITE_WIDTH, 1);\n } catch {\n // Preview is cosmetic; the GPU colormap still applies.\n }\n }\n}\n","import type {\n RasterLayerState,\n RasterMode,\n RasterStretch,\n} from '../core/types';\nimport {\n autoRangeFor,\n statsForBand,\n} from '../raster/render-pipeline';\nimport type { AutoStats, BandStats } from '../raster/stats';\nimport { MAX_BAND_SLOTS } from '../raster/tile-loader';\nimport type { RasterLayer } from '../state/RasterLayer';\nimport { BandHistogram } from './BandHistogram';\nimport { ColormapPicker, PALETTE_COLORMAP } from './ColormapPicker';\nimport { clearEl, el, field, fmtNumber, select } from './dom';\n\nconst RGB_CHANNELS = [\n { label: 'R', color: '#d63838' },\n { label: 'G', color: '#2c8a2c' },\n { label: 'B', color: '#2a6db8' },\n] as const;\n\nconst HELP = {\n mode: 'RGB / composite picks one band per output channel for true- or false-color images. Single band sends one band through a colormap.',\n bandsRgb:\n 'Pick which band feeds each output channel. Native order is usually 1=red, 2=green, 3=blue; reorder to make false-color composites.',\n bandSingle: \"Which band's pixel values feed the colormap.\",\n rescale:\n 'Maps a window of source values to the colormap input. Drag the histogram handles, type values, or pick a preset.',\n colormap:\n 'Color lookup applied to the rescaled value (after the curve, before nodata).',\n nodata:\n \"Auto reads the nodata value from the COG's GDAL_NODATA tag (NaN counts as nodata for float data); Value lets you specify one in source units; Off renders every pixel.\",\n curve:\n 'How values inside the rescale window are distributed across the colormap. Log and Sqrt expand the lower part of the window.',\n gamma:\n 'Power-law correction applied after the curve. Gamma > 1 lifts shadows; gamma < 1 deepens them. 1.0 disables it. Double-click to reset.',\n opacity: 'Layer transparency, 0 (invisible) to 1 (fully opaque).',\n preset2to98:\n '2nd-98th percentile of pixel values. Ignores extreme outliers (the QGIS / rio-tiler default).',\n presetMinMax: 'Map the full pixel-value extent of the band.',\n} as const;\n\nconst PRESET_EPSILON = 1e-6;\nconst rangesMatch = (a: [number, number], b: [number, number]) =>\n Math.abs(a[0] - b[0]) < PRESET_EPSILON &&\n Math.abs(a[1] - b[1]) < PRESET_EPSILON;\n\ntype Preset = 'percentile' | 'minmax' | 'custom';\n\nfunction bandLabel(idx: number, names: Map<number, string> | null): string {\n const name = names?.get(idx);\n return name ? `${idx} — ${name}` : String(idx);\n}\n\n/** One histogram + min/max numeric inputs for a band's rescale range. */\nclass RescaleRow {\n readonly el: HTMLElement;\n private _hist: BandHistogram;\n private _histSlot: HTMLElement;\n private _minInput: HTMLInputElement;\n private _maxInput: HTMLInputElement;\n private _value: [number, number] = [0, 1];\n\n constructor(opts: {\n color: string;\n label?: string;\n ariaPrefix: string;\n onChange: (next: [number, number]) => void;\n onDragStart?: () => void;\n onDragEnd?: () => void;\n }) {\n this._hist = new BandHistogram({\n color: opts.color,\n label: opts.label,\n onChange: (next) => {\n this._value = next;\n this._syncInputs();\n opts.onChange(next);\n },\n onDragStart: opts.onDragStart,\n onDragEnd: opts.onDragEnd,\n });\n this._histSlot = el('div');\n\n this._minInput = el('input', {\n className: 'mlr-input',\n type: 'number',\n ariaLabel: `${opts.ariaPrefix}-min`,\n attrs: { step: 'any' },\n });\n this._maxInput = el('input', {\n className: 'mlr-input',\n type: 'number',\n ariaLabel: `${opts.ariaPrefix}-max`,\n attrs: { step: 'any' },\n });\n const onInput = () => {\n const next: [number, number] = [\n Number(this._minInput.value),\n Number(this._maxInput.value),\n ];\n this._value = next;\n this._hist.setValue(next);\n opts.onChange(next);\n };\n this._minInput.addEventListener('change', onInput);\n this._maxInput.addEventListener('change', onInput);\n\n const inputs = el(\n 'div',\n { className: 'mlr-row' },\n this._minInput,\n this._maxInput,\n );\n this.el = el(\n 'div',\n { className: 'mlr-rescale-row' },\n this._histSlot,\n inputs,\n );\n }\n\n update(stats: BandStats | null, value: [number, number]): void {\n this._value = value;\n if (stats) {\n if (!this._histSlot.contains(this._hist.el)) {\n this._histSlot.appendChild(this._hist.el);\n }\n this._hist.update(stats, value);\n } else if (this._hist.el.parentNode === this._histSlot) {\n this._histSlot.removeChild(this._hist.el);\n }\n this._syncInputs();\n }\n\n private _syncInputs(): void {\n this._minInput.value = String(fmtNumber(this._value[0]));\n this._maxInput.value = String(fmtNumber(this._value[1]));\n }\n}\n\n/**\n * Per-layer settings UI: mode, band selection, rescale (histogram +\n * presets), colormap, nodata, stretch curve, gamma, and opacity. A vanilla\n * DOM port of cog-viewer's ControlsPanel scoped to the selected layer.\n *\n * Re-render strategy: the section fully rebuilds on selection / structural\n * changes; continuous controls (sliders, histogram drags) update state with\n * a self-apply guard so the host can skip re-rendering mid-interaction.\n */\nexport class SettingsSection {\n /** Root element to insert into the panel. */\n readonly el: HTMLElement;\n private _body: HTMLElement;\n private _title: HTMLElement;\n private _getLayer: () => RasterLayer | null;\n private _setState: (patch: Partial<RasterLayerState>) => void;\n private _applying = false;\n private _dragCount = 0;\n private _dirty = false;\n /** Collapsed/expanded state of the Rescale section, preserved across the\n * full re-renders this section performs on every structural change. */\n private _rescaleOpen = true;\n\n /**\n * Creates the section.\n *\n * @param getLayer - Returns the currently selected layer (or null)\n * @param setState - Applies a state patch to the selected layer\n */\n constructor(\n getLayer: () => RasterLayer | null,\n setState: (patch: Partial<RasterLayerState>) => void,\n ) {\n this._getLayer = getLayer;\n this._setState = (patch) => {\n this._applying = true;\n try {\n setState(patch);\n } finally {\n this._applying = false;\n }\n };\n this._title = el('div', { className: 'mlr-section-title', text: 'Settings' });\n this._body = el('div', { className: 'mlr-settings-body' });\n this.el = el(\n 'div',\n { className: 'mlr-section mlr-settings' },\n this._title,\n this._body,\n );\n this.render();\n }\n\n /** Reacts to a LayerManager change event: rebuilds unless the change came\n * from this UI or a histogram drag is active (deferred until drag end). */\n notifyChange(): void {\n if (this._applying) return;\n if (this._dragCount > 0) {\n this._dirty = true;\n return;\n }\n this.render();\n }\n\n /** Fully rebuilds the section from the selected layer. */\n render(): void {\n const layer = this._getLayer();\n clearEl(this._body);\n this._dirty = false;\n\n if (!layer) {\n this.el.style.display = 'none';\n return;\n }\n this.el.style.display = '';\n this._title.textContent = `Settings — ${layer.name}`;\n\n if (layer.loading) {\n this._body.appendChild(\n el('div', { className: 'mlr-empty', text: 'Loading…' }),\n );\n return;\n }\n if (layer.error) {\n this._body.appendChild(\n el('div', {\n className: 'mlr-error',\n text: `Failed to load: ${layer.error.message}`,\n }),\n );\n return;\n }\n\n const state = layer.state;\n const mode: RasterMode = state.mode;\n const bandOptions = Array.from(\n { length: Math.min(layer.bandCount ?? MAX_BAND_SLOTS, MAX_BAND_SLOTS) },\n (_, i) => i + 1,\n );\n\n // The embedded color table maps raw index values directly to colors, so\n // rescale / curve / gamma have no effect while it is active.\n const paletteActive =\n mode === 'single' &&\n state.colormap === PALETTE_COLORMAP &&\n layer.palette !== null;\n\n this._body.appendChild(this._buildModeField(state, mode, bandOptions));\n this._body.appendChild(\n this._buildBandsField(layer, state, mode, bandOptions),\n );\n if (!paletteActive) {\n this._body.appendChild(this._buildRescaleField(layer, state, mode));\n }\n if (mode === 'single') {\n const picker = new ColormapPicker({\n value: state.colormap,\n palette: layer.palette,\n stats: statsForBand(layer.autoStats, state.bands[0] ?? 1),\n onChange: (name) => {\n this._setState({ colormap: name });\n // Switching to/from the palette shows/hides rescale-curve-gamma.\n this.render();\n },\n });\n this._body.appendChild(field('Colormap', picker.el, HELP.colormap));\n }\n this._body.appendChild(this._buildNodataField(state));\n if (!paletteActive) {\n this._body.appendChild(this._buildCurveField(state));\n this._body.appendChild(this._buildGammaField(state));\n }\n this._body.appendChild(this._buildOpacityField(state));\n }\n\n private _buildModeField(\n state: RasterLayerState,\n mode: RasterMode,\n bandOptions: number[],\n ): HTMLElement {\n // Clamp the RGB default to the bands that actually exist so 1- or\n // 2-band rasters don't get invalid indices written into state.\n const maxBand = bandOptions[bandOptions.length - 1] ?? 1;\n const rgbDefault = [1, 2, 3].map((b) => Math.min(b, maxBand));\n const modeSelect = select(\n [\n { value: 'rgb', label: 'RGB / composite' },\n { value: 'single', label: 'Single band + colormap' },\n ],\n mode,\n (next) => {\n this._setState({\n mode: next as RasterMode,\n bands: next === 'single' ? [state.bands[0] ?? 1] : rgbDefault,\n rescale: null,\n });\n this.render();\n },\n 'mode',\n );\n return field('Mode', modeSelect, HELP.mode);\n }\n\n private _buildBandsField(\n layer: RasterLayer,\n state: RasterLayerState,\n mode: RasterMode,\n bandOptions: number[],\n ): HTMLElement {\n const options = bandOptions.map((n) => ({\n value: String(n),\n label: bandLabel(n, layer.bandNames),\n }));\n if (mode === 'single') {\n const bandSelect = select(\n options,\n String(state.bands[0] ?? 1),\n (next) => {\n this._setState({ bands: [Number(next)] });\n this.render();\n },\n 'band',\n );\n return field('Band', bandSelect, HELP.bandSingle);\n }\n const row = el('div', { className: 'mlr-band-grid' });\n RGB_CHANNELS.forEach(({ label }, i) => {\n row.appendChild(\n select(\n options,\n String(state.bands[i] ?? bandOptions[0] ?? 1),\n (next) => {\n const bands = [...state.bands];\n bands[i] = Number(next);\n this._setState({ bands });\n this.render();\n },\n `band-${label.toLowerCase()}`,\n ),\n );\n });\n return field('Bands (R, G, B)', row, HELP.bandsRgb);\n }\n\n private _buildRescaleField(\n layer: RasterLayer,\n state: RasterLayerState,\n mode: RasterMode,\n ): HTMLElement {\n const autoStats: AutoStats | null = layer.autoStats;\n const channelCount = mode === 'single' ? 1 : 3;\n const bands = state.bands;\n\n const perBandStats: (BandStats | null)[] = Array.from(\n { length: channelCount },\n (_, i) => statsForBand(autoStats, bands[i] ?? bands[0] ?? 1),\n );\n const perBandPercentile: ([number, number] | null)[] = perBandStats.map(\n (s) => (s ? autoRangeFor(s) : null),\n );\n const perBandMinMax: ([number, number] | null)[] = perBandStats.map((s) =>\n s ? [s.min, s.max] : null,\n );\n const values: [number, number][] = Array.from(\n { length: channelCount },\n (_, i) => state.rescale?.[i] ?? perBandPercentile[i] ?? [0, 1],\n );\n\n const setChannel = (i: number, next: [number, number]) => {\n const out = values.map((v) => [...v] as [number, number]);\n out[i] = next;\n out.forEach((v, j) => {\n values[j] = v;\n });\n this._setState({ rescale: out });\n };\n\n const wrap = el('div', { className: 'mlr-rescale' });\n const rows: RescaleRow[] = [];\n for (let i = 0; i < channelCount; i++) {\n const channel = mode === 'single' ? null : RGB_CHANNELS[i];\n const row = new RescaleRow({\n color: channel?.color ?? 'var(--mlr-histogram-neutral)',\n label: channel?.label,\n ariaPrefix:\n mode === 'single'\n ? 'rescale'\n : `rescale-${channel!.label.toLowerCase()}`,\n onChange: (next) => setChannel(i, next),\n onDragStart: () => {\n this._dragCount++;\n },\n onDragEnd: () => {\n this._dragCount = Math.max(0, this._dragCount - 1);\n if (this._dirty) this.render();\n },\n });\n row.update(perBandStats[i], values[i]);\n rows.push(row);\n wrap.appendChild(row.el);\n }\n\n // Preset buttons (only when stats exist to derive them from).\n if (perBandStats.some((s) => s !== null)) {\n const isAuto = state.rescale === null;\n const current: ([number, number] | null)[] = state.rescale\n ? Array.from({ length: channelCount }, (_, i) => state.rescale![i] ?? null)\n : new Array(channelCount).fill(null);\n const matches = (preset: ([number, number] | null)[]) =>\n current.every((c, i) => {\n const p = preset[i];\n if (!c || !p) return false;\n return rangesMatch(c, p);\n });\n const active: Preset = isAuto\n ? 'percentile'\n : matches(perBandPercentile)\n ? 'percentile'\n : matches(perBandMinMax)\n ? 'minmax'\n : 'custom';\n\n const presetRow = el('div', { className: 'mlr-preset-row' });\n presetRow.appendChild(\n this._presetButton('2–98%', active === 'percentile', HELP.preset2to98, () => {\n this._setState({ rescale: null });\n this.render();\n }),\n );\n presetRow.appendChild(\n this._presetButton('Min/Max', active === 'minmax', HELP.presetMinMax, () => {\n this._setState({\n rescale: perBandMinMax.map<[number, number]>(\n (m, i) => m ?? values[i],\n ),\n });\n this.render();\n }),\n );\n wrap.appendChild(presetRow);\n }\n\n // Collapsible: histograms are tall, and users often only need them while\n // tuning. The open state persists across re-renders.\n const details = el('details', { className: 'mlr-field mlr-collapsible' });\n const summary = el('summary', {\n className: 'mlr-field-label',\n text: 'Rescale',\n title: HELP.rescale,\n });\n details.append(summary, wrap);\n details.open = this._rescaleOpen;\n details.addEventListener('toggle', () => {\n this._rescaleOpen = details.open;\n });\n return details;\n }\n\n private _buildNodataField(state: RasterLayerState): HTMLElement {\n const wrap = el('div', { className: 'mlr-row' });\n const modeValue =\n state.nodata === 'off'\n ? 'off'\n : state.nodata === 'auto'\n ? 'auto'\n : 'value';\n wrap.appendChild(\n select(\n [\n { value: 'auto', label: 'Auto (from COG)' },\n { value: 'value', label: 'Value' },\n { value: 'off', label: 'Off' },\n ],\n modeValue,\n (next) => {\n if (next === 'auto') this._setState({ nodata: 'auto' });\n else if (next === 'off') this._setState({ nodata: 'off' });\n else this._setState({ nodata: 0 });\n this.render();\n },\n 'nodata-mode',\n ),\n );\n if (typeof state.nodata === 'number') {\n const input = el('input', {\n className: 'mlr-input',\n type: 'number',\n value: String(state.nodata),\n ariaLabel: 'nodata-value',\n attrs: { step: 'any' },\n });\n input.addEventListener('change', () =>\n this._setState({ nodata: Number(input.value) }),\n );\n wrap.appendChild(input);\n }\n return field('Nodata', wrap, HELP.nodata);\n }\n\n private _buildCurveField(state: RasterLayerState): HTMLElement {\n const wrap = el('div', { className: 'mlr-preset-row' });\n const options: { value: RasterStretch; label: string }[] = [\n { value: 'linear', label: 'Linear' },\n { value: 'sqrt', label: 'Sqrt' },\n { value: 'log', label: 'Log' },\n ];\n for (const o of options) {\n wrap.appendChild(\n this._presetButton(o.label, state.stretch === o.value, undefined, () => {\n this._setState({ stretch: o.value });\n this.render();\n }),\n );\n }\n return field('Curve', wrap, HELP.curve);\n }\n\n private _buildGammaField(state: RasterLayerState): HTMLElement {\n const label = el('span', {\n className: 'mlr-field-label',\n text: `Gamma (${state.gamma.toFixed(2)})`,\n title: HELP.gamma,\n });\n const input = el('input', {\n type: 'range',\n className: 'mlr-slider',\n ariaLabel: 'gamma',\n attrs: { min: '0.1', max: '3', step: '0.05' },\n value: String(state.gamma),\n });\n input.addEventListener('input', () => {\n const gamma = Number(input.value);\n label.textContent = `Gamma (${gamma.toFixed(2)})`;\n this._setState({ gamma });\n });\n input.addEventListener('dblclick', () => {\n input.value = '1';\n label.textContent = 'Gamma (1.00)';\n this._setState({ gamma: 1 });\n });\n return el('div', { className: 'mlr-field' }, label, input);\n }\n\n private _buildOpacityField(state: RasterLayerState): HTMLElement {\n const label = el('span', {\n className: 'mlr-field-label',\n text: `Opacity (${state.opacity.toFixed(2)})`,\n title: HELP.opacity,\n });\n const input = el('input', {\n type: 'range',\n className: 'mlr-slider',\n ariaLabel: 'opacity',\n attrs: { min: '0', max: '1', step: '0.01' },\n value: String(state.opacity),\n });\n input.addEventListener('input', () => {\n const opacity = Number(input.value);\n label.textContent = `Opacity (${opacity.toFixed(2)})`;\n this._setState({ opacity });\n });\n return el('div', { className: 'mlr-field' }, label, input);\n }\n\n private _presetButton(\n label: string,\n active: boolean,\n help: string | undefined,\n onClick: () => void,\n ): HTMLButtonElement {\n const btn = el('button', {\n className: `mlr-preset-button${active ? ' active' : ''}`,\n type: 'button',\n text: label,\n title: help,\n attrs: { 'aria-pressed': String(active) },\n });\n btn.addEventListener('click', onClick);\n return btn;\n }\n}\n","import type { LayerManager } from '../state/LayerManager';\nimport { AddDataSection } from './AddDataSection';\nimport { el } from './dom';\nimport { LayerList } from './LayerList';\nimport { SettingsSection } from './SettingsSection';\n\n/**\n * Composes the panel content: Add data, Layers, and Settings sections.\n * Subscribes to LayerManager events to keep the sections in sync, and\n * delegates user actions back to the manager.\n */\nexport class PanelUI {\n private _manager: LayerManager;\n private _root: HTMLElement;\n private _layerList: LayerList;\n private _settings: SettingsSection;\n private _unsubscribe: (() => void)[] = [];\n\n /**\n * Builds the UI into a panel content container.\n *\n * @param container - The panel's content element\n * @param manager - The layer manager to drive\n * @param options - UI options (e.g. a URL to prefill the Add data input)\n */\n constructor(\n container: HTMLElement,\n manager: LayerManager,\n options?: { defaultUrl?: string },\n ) {\n this._manager = manager;\n\n const addData = new AddDataSection({\n initialUrl: options?.defaultUrl,\n onAddUrl: (url, beforeId) => {\n // Errors surface via the manager's 'error' event and the layer row.\n void this._manager.addRaster(url, { beforeId }).catch(() => {});\n },\n onAddFile: (file, beforeId) => {\n void this._manager.addRaster(file, { beforeId }).catch(() => {});\n },\n });\n\n this._layerList = new LayerList({\n // Clicking a layer selects it for editing and brings it into view.\n onSelect: (id) => {\n this._manager.select(id);\n this._manager.zoomTo(id);\n },\n onToggleVisible: (id, visible) => this._manager.setVisible(id, visible),\n onZoomTo: (id) => this._manager.zoomTo(id),\n onMove: (id, direction) => {\n const index = this._manager\n .getLayers()\n .findIndex((l) => l.id === id);\n if (index === -1) return;\n this._manager.reorder(id, index + direction);\n },\n onRemove: (id) => this._manager.removeRaster(id),\n });\n\n this._settings = new SettingsSection(\n () => {\n const id = this._manager.selectedId;\n return id ? (this._manager.getLayer(id) ?? null) : null;\n },\n (patch) => {\n const id = this._manager.selectedId;\n if (id) this._manager.setState(id, patch);\n },\n );\n\n this._root = el(\n 'div',\n { className: 'mlr-panel' },\n addData.el,\n this._layerList.el,\n this._settings.el,\n );\n container.appendChild(this._root);\n\n const onListChange = () => this._renderList();\n const onStructure = () => {\n this._renderList();\n this._settings.render();\n };\n const onChange = () => {\n this._renderList();\n this._settings.notifyChange();\n };\n manager.on('rasteradd', onStructure);\n manager.on('rasterremove', onStructure);\n manager.on('rasterselect', onStructure);\n manager.on('rasterchange', onChange);\n manager.on('error', onListChange);\n this._unsubscribe = [\n () => manager.off('rasteradd', onStructure),\n () => manager.off('rasterremove', onStructure),\n () => manager.off('rasterselect', onStructure),\n () => manager.off('rasterchange', onChange),\n () => manager.off('error', onListChange),\n ];\n\n this._renderList();\n this._settings.render();\n }\n\n /** Detaches event handlers and removes the UI from the DOM. */\n destroy(): void {\n for (const off of this._unsubscribe) off();\n this._unsubscribe = [];\n this._root.parentNode?.removeChild(this._root);\n }\n\n private _renderList(): void {\n this._layerList.update(this._manager.getLayers(), this._manager.selectedId);\n }\n}\n","import type { IControl, Map as MapLibreMap } from 'maplibre-gl';\nimport { LayerManager } from '../state/LayerManager';\nimport { toLayerInfo } from '../state/RasterLayer';\nimport { PanelUI } from '../ui/PanelUI';\nimport type {\n AddRasterOptions,\n RasterControlEvent,\n RasterControlEventHandler,\n RasterControlOptions,\n RasterControlState,\n RasterLayerInfo,\n RasterLayerState,\n} from './types';\n\n/**\n * Default options for the RasterControl\n */\nconst DEFAULT_OPTIONS: Required<RasterControlOptions> = {\n collapsed: true,\n position: 'top-right',\n title: 'Raster',\n panelWidth: 360,\n className: '',\n interleaved: true,\n defaultUrl: '',\n autoLoad: false,\n};\n\n/**\n * Event handlers map type\n */\ntype EventHandlersMap = globalThis.Map<RasterControlEvent, Set<RasterControlEventHandler>>;\n\n/**\n * A MapLibre GL control for visualizing local and remote raster datasets\n * (GeoTIFF / Cloud Optimized GeoTIFF). A collapsible button expands into a\n * panel with an \"Add data\" section (URL or local file), a layer list, and\n * per-layer rendering settings (bands, rescale histograms, colormaps,\n * nodata, stretch, gamma, opacity). Rendering uses a deck.gl COGLayer\n * pipeline on a shared MapboxOverlay.\n *\n * @example\n * ```typescript\n * const control = new RasterControl({ collapsed: false });\n * map.addControl(control, 'top-right');\n * await control.addRaster('https://example.com/data/cog.tif');\n * ```\n */\nexport class RasterControl implements IControl {\n private _map?: MapLibreMap;\n private _mapContainer?: HTMLElement;\n private _container?: HTMLElement;\n private _panel?: HTMLElement;\n private _options: Required<RasterControlOptions>;\n private _state: RasterControlState;\n private _eventHandlers: EventHandlersMap = new globalThis.Map();\n private _layerManager?: LayerManager;\n private _panelUI?: PanelUI;\n private _onReady: (() => void)[] = [];\n\n // Panel positioning handlers\n private _resizeHandler: (() => void) | null = null;\n private _mapResizeHandler: (() => void) | null = null;\n private _clickOutsideHandler: ((e: MouseEvent) => void) | null = null;\n\n /**\n * Creates a new RasterControl instance.\n *\n * @param options - Configuration options for the control\n */\n constructor(options?: Partial<RasterControlOptions>) {\n this._options = { ...DEFAULT_OPTIONS, ...options };\n this._state = {\n collapsed: this._options.collapsed,\n panelWidth: this._options.panelWidth,\n data: {},\n };\n }\n\n /**\n * Called when the control is added to the map.\n * Implements the IControl interface.\n *\n * @param map - The MapLibre GL map instance\n * @returns The control's container element\n */\n onAdd(map: MapLibreMap): HTMLElement {\n this._map = map;\n this._mapContainer = map.getContainer();\n this._container = this._createContainer();\n this._panel = this._createPanel();\n\n // Append panel to map container for independent positioning (avoids overlap with other controls)\n this._mapContainer.appendChild(this._panel);\n\n // Wire the raster machinery: one LayerManager (owning the deck.gl\n // overlay) plus the panel UI bound to it.\n this._layerManager = new LayerManager(map, {\n interleaved: this._options.interleaved,\n });\n this._forwardLayerManagerEvents(this._layerManager);\n const content = this._panel.querySelector<HTMLElement>(\n '.plugin-control-content',\n );\n const autoLoading = this._options.autoLoad && !!this._options.defaultUrl;\n if (content) {\n this._panelUI = new PanelUI(content, this._layerManager, {\n // When auto-loading, leave the input empty — the raster is already\n // on its way, and a prefilled Load button would just add a duplicate.\n defaultUrl: autoLoading ? '' : this._options.defaultUrl,\n });\n }\n if (autoLoading) {\n // Errors surface via the 'error' event and the layer row.\n void this._layerManager.addRaster(this._options.defaultUrl).catch(() => {});\n }\n\n // Flush addRaster calls made before the control was added to a map.\n const ready = this._onReady;\n this._onReady = [];\n for (const resolve of ready) resolve();\n\n // Setup event listeners for panel positioning and click-outside\n this._setupEventListeners();\n\n // Set initial panel state\n if (!this._state.collapsed) {\n this._panel.classList.add('expanded');\n // Update position after control is added to DOM\n requestAnimationFrame(() => {\n this._updatePanelPosition();\n });\n }\n\n return this._container;\n }\n\n /**\n * Called when the control is removed from the map.\n * Implements the IControl interface.\n */\n onRemove(): void {\n // Tear down the raster machinery first (removes the deck.gl overlay,\n // aborts in-flight loads, revokes blob URLs).\n this._panelUI?.destroy();\n this._panelUI = undefined;\n this._layerManager?.destroy();\n this._layerManager = undefined;\n\n // Remove event listeners\n if (this._resizeHandler) {\n window.removeEventListener('resize', this._resizeHandler);\n this._resizeHandler = null;\n }\n if (this._mapResizeHandler && this._map) {\n this._map.off('resize', this._mapResizeHandler);\n this._mapResizeHandler = null;\n }\n if (this._clickOutsideHandler) {\n document.removeEventListener('click', this._clickOutsideHandler);\n this._clickOutsideHandler = null;\n }\n\n // Remove panel from map container\n this._panel?.parentNode?.removeChild(this._panel);\n\n // Remove button container from control stack\n this._container?.parentNode?.removeChild(this._container);\n\n this._map = undefined;\n this._mapContainer = undefined;\n this._container = undefined;\n this._panel = undefined;\n this._eventHandlers.clear();\n }\n\n /**\n * Gets the current state of the control.\n *\n * @returns The current plugin state\n */\n getState(): RasterControlState {\n return { ...this._state };\n }\n\n /**\n * Updates the control state.\n *\n * @param newState - Partial state to merge with current state\n */\n setState(newState: Partial<RasterControlState>): void {\n this._state = { ...this._state, ...newState };\n this._emit('statechange');\n }\n\n /**\n * Toggles the collapsed state of the control panel.\n */\n toggle(): void {\n this._state.collapsed = !this._state.collapsed;\n\n if (this._panel) {\n if (this._state.collapsed) {\n this._panel.classList.remove('expanded');\n this._emit('collapse');\n } else {\n this._panel.classList.add('expanded');\n this._updatePanelPosition();\n this._emit('expand');\n }\n }\n\n this._emit('statechange');\n }\n\n /**\n * Expands the control panel.\n */\n expand(): void {\n if (this._state.collapsed) {\n this.toggle();\n }\n }\n\n /**\n * Collapses the control panel.\n */\n collapse(): void {\n if (!this._state.collapsed) {\n this.toggle();\n }\n }\n\n /**\n * Registers an event handler.\n *\n * @param event - The event type to listen for\n * @param handler - The callback function\n */\n on(event: RasterControlEvent, handler: RasterControlEventHandler): void {\n if (!this._eventHandlers.has(event)) {\n this._eventHandlers.set(event, new Set());\n }\n this._eventHandlers.get(event)!.add(handler);\n }\n\n /**\n * Removes an event handler.\n *\n * @param event - The event type\n * @param handler - The callback function to remove\n */\n off(event: RasterControlEvent, handler: RasterControlEventHandler): void {\n this._eventHandlers.get(event)?.delete(handler);\n }\n\n /**\n * Gets the map instance.\n *\n * @returns The MapLibre GL map instance or undefined if not added to a map\n */\n getMap(): MapLibreMap | undefined {\n return this._map;\n }\n\n /**\n * Gets the control container element.\n *\n * @returns The container element or undefined if not added to a map\n */\n getContainer(): HTMLElement | undefined {\n return this._container;\n }\n\n /**\n * Adds a raster layer from a remote COG URL or a local GeoTIFF File.\n *\n * The returned promise resolves with the layer id once the GeoTIFF header\n * loads (waiting for the control to be added to a map first, if needed)\n * and rejects when loading fails.\n *\n * @param source - COG URL or a local GeoTIFF File\n * @param options - Id/name/state overrides and zoom behavior\n * @returns The new layer's id\n */\n async addRaster(\n source: string | File,\n options?: AddRasterOptions,\n ): Promise<string> {\n if (!this._layerManager) {\n await new Promise<void>((resolve) => this._onReady.push(resolve));\n }\n return this._layerManager!.addRaster(source, options);\n }\n\n /**\n * Removes a raster layer.\n *\n * @param id - The layer id\n */\n removeRaster(id: string): void {\n this._layerManager?.removeRaster(id);\n }\n\n /**\n * Gets a snapshot of one raster layer.\n *\n * @param id - The layer id\n * @returns Layer info, or undefined when unknown\n */\n getRaster(id: string): RasterLayerInfo | undefined {\n const layer = this._layerManager?.getLayer(id);\n return layer ? toLayerInfo(layer) : undefined;\n }\n\n /**\n * Gets snapshots of all raster layers in draw order (first = bottom).\n *\n * @returns Layer info array\n */\n getRasters(): RasterLayerInfo[] {\n return this._layerManager?.getLayers().map(toLayerInfo) ?? [];\n }\n\n /**\n * Merges a partial visualization state into a layer (bands, rescale,\n * colormap, nodata, opacity, gamma, stretch, visible).\n *\n * @param id - The layer id\n * @param patch - State fields to update\n */\n setRasterState(id: string, patch: Partial<RasterLayerState>): void {\n this._layerManager?.setState(id, patch);\n }\n\n /**\n * Shows or hides a raster layer.\n *\n * @param id - The layer id\n * @param visible - Whether the layer should render\n */\n setVisible(id: string, visible: boolean): void {\n this._layerManager?.setVisible(id, visible);\n }\n\n /**\n * Selects the layer whose settings the panel edits.\n *\n * @param id - The layer id, or null to clear the selection\n */\n selectRaster(id: string | null): void {\n this._layerManager?.select(id);\n }\n\n /**\n * Fits the map view to a layer's bounds.\n *\n * @param id - The layer id\n */\n zoomToRaster(id: string): void {\n this._layerManager?.zoomTo(id);\n }\n\n /**\n * Moves a layer to a new position in the draw order.\n *\n * @param id - The layer id\n * @param toIndex - Target index (0 = bottom)\n */\n reorderRaster(id: string, toIndex: number): void {\n this._layerManager?.reorder(id, toIndex);\n }\n\n /** Re-emits LayerManager events through the control's event system. */\n private _forwardLayerManagerEvents(manager: LayerManager): void {\n for (const type of [\n 'rasteradd',\n 'rasterremove',\n 'rasterchange',\n 'rasterselect',\n 'error',\n ] as const) {\n manager.on(type, (e) =>\n this._emit(type, { layerId: e.layerId, error: e.error }),\n );\n }\n }\n\n /**\n * Emits an event to all registered handlers.\n *\n * @param event - The event type to emit\n * @param extra - Optional layerId/error payload for raster events\n */\n private _emit(\n event: RasterControlEvent,\n extra?: { layerId?: string; error?: Error },\n ): void {\n const handlers = this._eventHandlers.get(event);\n if (handlers) {\n const eventData = { type: event, state: this.getState(), ...extra };\n handlers.forEach((handler) => handler(eventData));\n }\n }\n\n /**\n * Creates the main container element for the control.\n * Contains a toggle button (29x29) matching navigation control size.\n *\n * @returns The container element\n */\n private _createContainer(): HTMLElement {\n const container = document.createElement('div');\n container.className = `maplibregl-ctrl maplibregl-ctrl-group plugin-control${\n this._options.className ? ` ${this._options.className}` : ''\n }`;\n\n // Create toggle button (29x29 to match navigation control)\n const toggleBtn = document.createElement('button');\n toggleBtn.className = 'plugin-control-toggle';\n toggleBtn.type = 'button';\n toggleBtn.setAttribute('aria-label', this._options.title);\n toggleBtn.innerHTML = `\n <span class=\"plugin-control-icon\">\n <svg viewBox=\"0 0 24 24\" width=\"22\" height=\"22\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"/>\n <circle cx=\"8.5\" cy=\"8.5\" r=\"1.5\"/>\n <polyline points=\"21 15 16 10 5 21\"/>\n </svg>\n </span>\n `;\n toggleBtn.addEventListener('click', () => this.toggle());\n\n container.appendChild(toggleBtn);\n\n return container;\n }\n\n /**\n * Creates the panel element with header and content areas.\n * Panel is positioned as a dropdown below the toggle button.\n *\n * @returns The panel element\n */\n private _createPanel(): HTMLElement {\n const panel = document.createElement('div');\n panel.className = 'plugin-control-panel';\n panel.style.width = `${this._options.panelWidth}px`;\n\n // Create header with title and close button\n const header = document.createElement('div');\n header.className = 'plugin-control-header';\n\n const title = document.createElement('span');\n title.className = 'plugin-control-title';\n title.textContent = this._options.title;\n\n const closeBtn = document.createElement('button');\n closeBtn.className = 'plugin-control-close';\n closeBtn.type = 'button';\n closeBtn.setAttribute('aria-label', 'Close panel');\n closeBtn.innerHTML = '&times;';\n closeBtn.addEventListener('click', () => this.collapse());\n\n header.appendChild(title);\n header.appendChild(closeBtn);\n\n // Content area — populated by PanelUI in onAdd.\n const content = document.createElement('div');\n content.className = 'plugin-control-content';\n\n panel.appendChild(header);\n panel.appendChild(content);\n\n return panel;\n }\n\n /**\n * Setup event listeners for panel positioning and click-outside behavior.\n */\n private _setupEventListeners(): void {\n // Click outside to close (check both container and panel since they're now separate)\n this._clickOutsideHandler = (e: MouseEvent) => {\n const target = e.target as Node;\n // Ignore clicks whose target was detached mid-event (e.g. a panel\n // button whose click handler re-rendered the settings UI) — contains()\n // would report false and wrongly collapse the panel.\n if (!target.isConnected) return;\n if (\n this._container &&\n this._panel &&\n !this._container.contains(target) &&\n !this._panel.contains(target)\n ) {\n this.collapse();\n }\n };\n document.addEventListener('click', this._clickOutsideHandler);\n\n // Update panel position on window resize\n this._resizeHandler = () => {\n if (!this._state.collapsed) {\n this._updatePanelPosition();\n }\n };\n window.addEventListener('resize', this._resizeHandler);\n\n // Update panel position on map resize (e.g., sidebar toggle)\n this._mapResizeHandler = () => {\n if (!this._state.collapsed) {\n this._updatePanelPosition();\n }\n };\n this._map?.on('resize', this._mapResizeHandler);\n }\n\n /**\n * Detect which corner the control is positioned in.\n *\n * @returns The position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n */\n private _getControlPosition(): 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' {\n const parent = this._container?.parentElement;\n if (!parent) return 'top-right'; // Default\n\n if (parent.classList.contains('maplibregl-ctrl-top-left')) return 'top-left';\n if (parent.classList.contains('maplibregl-ctrl-top-right')) return 'top-right';\n if (parent.classList.contains('maplibregl-ctrl-bottom-left')) return 'bottom-left';\n if (parent.classList.contains('maplibregl-ctrl-bottom-right')) return 'bottom-right';\n\n return 'top-right'; // Default\n }\n\n /**\n * Update the panel position based on button location and control corner.\n * Positions the panel next to the button, expanding in the appropriate direction.\n */\n private _updatePanelPosition(): void {\n if (!this._container || !this._panel || !this._mapContainer) return;\n\n // Get the toggle button (first child of container)\n const button = this._container.querySelector('.plugin-control-toggle');\n if (!button) return;\n\n const buttonRect = button.getBoundingClientRect();\n const mapRect = this._mapContainer.getBoundingClientRect();\n const position = this._getControlPosition();\n\n // Calculate button position relative to map container\n const buttonTop = buttonRect.top - mapRect.top;\n const buttonBottom = mapRect.bottom - buttonRect.bottom;\n const buttonLeft = buttonRect.left - mapRect.left;\n const buttonRight = mapRect.right - buttonRect.right;\n\n const panelGap = 5; // Gap between button and panel\n\n // Reset all positioning\n this._panel.style.top = '';\n this._panel.style.bottom = '';\n this._panel.style.left = '';\n this._panel.style.right = '';\n\n switch (position) {\n case 'top-left':\n // Panel expands down and to the right\n this._panel.style.top = `${buttonTop + buttonRect.height + panelGap}px`;\n this._panel.style.left = `${buttonLeft}px`;\n break;\n\n case 'top-right':\n // Panel expands down and to the left\n this._panel.style.top = `${buttonTop + buttonRect.height + panelGap}px`;\n this._panel.style.right = `${buttonRight}px`;\n break;\n\n case 'bottom-left':\n // Panel expands up and to the right\n this._panel.style.bottom = `${buttonBottom + buttonRect.height + panelGap}px`;\n this._panel.style.left = `${buttonLeft}px`;\n break;\n\n case 'bottom-right':\n // Panel expands up and to the left\n this._panel.style.bottom = `${buttonBottom + buttonRect.height + panelGap}px`;\n this._panel.style.right = `${buttonRight}px`;\n break;\n }\n }\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186],"mappings":";;;;;;;AACA,SAAgB,uBAAuB,IAAI,MAAM,eAAe;CAC5D,MAAM,EAAE,qBAAqB;CAW7B,MAAM,EAAE,SAAS,UAAU,aAAa,eAAe;CACvD,MAAM,eAAe,cAAc,QAAQ,IAAI,QAAQ,EAAE;CACzD,MAAM,gBAAgB,cAAc,SAAS,IAAI,SAAS,EAAE;CAC5D,MAAM,mBAAmB,cAAc,YAAY,IAAI,YAAY,EAAE;CAErE,MAAM,OAAO;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X;CACA,WAAW,EACT,SAAS,qEACX;CACA,WAAW,EACT,SAAS,sDACX;CACA,YAAY,EACV,SAAS,qDACX;CACA,YAAY,EACV,SAAS,oDACX;CACA,YAAY,EACV,SAAS,mDACX;CACA,WAAW,EACT,SAAS,8CACX;CACA,WAAW,EACT,SAAS,qDACX;CACA,WAAW,EACT,SAAS,sDACX;CACA,WAAW,EACT,SAAS,sDACX;CACA,WAAW,EACT,SAAS,2CACX;CACA,WAAW,EACT,SAAS,iDACX;CACA,WAAW,EACT,SAAS,2DACX;CACA,WAAW,EACT,SAAS,gDACX;CACA,WAAW,EACT,SAAS,wDACX;CACA,WAAW,EACT,SAAS,+CACX;CACA,WAAW,EACT,SAAS,wDACX;CACA,WAAW,EACT,SAAS,mDACX;CACA,WAAW,EACT,SAAS,mDACX;CACA,WAAW,EACT,SAAS,6CACX;CACA,WAAW,EACT,SAAS,0CACX;CACA,WAAW,EACT,SAAS,2DACX;CACA,WAAW,EACT,SAAS,iEACX;CACA,WAAW,EACT,SAAS,iDACX;CACA,WAAW,EACT,SAAS,0BACX;CACA,WAAW,EACT,SAAS,0CACX;CACA,WAAW,EACT,SAAS,+CACX;CACA,WAAW,EACT,SAAS,8CACX;CACA,WAAW,EACT,SAAS,2DACX;CACA,WAAW,EACT,SAAS,2BACX;CACA,WAAW,EACT,SAAS,iBACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,oEACX;CACA,WAAW,EACT,SAAS,yDACX;CACA,WAAW,EACT,SAAS,4DACX;CACA,WAAW,EACT,SAAS,6DACX;CACA,WAAW,EACT,SAAS,+CACX;CACA,WAAW,EACT,SAAS,+CACX;CACA,WAAW,EACT,SAAS,kEACX;CACA,WAAW,EACT,SAAS,wDACX;CACA,WAAW,EACT,SAAS,kEACX;CACA,WAAW,EACT,SAAS,2DACX;CACA,WAAW,EACT,SAAS,sDACX;CACA,WAAW,EACT,SAAS,qDACX;CACA,WAAW,EACT,SAAS,oDACX;CACA,WAAW,EACT,SAAS,sDACX;CACA,WAAW,EACT,SAAS,wDACX;CACA,WAAW,EACT,SAAS,qDACX;CACA,WAAW,EACT,SAAS,uCACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,qDACX;CACA,WAAW,EACT,SAAS,oDACX;CACA,WAAW,EACT,SAAS,sDACX;CACA,aAAa,EACX,SAAS,sDACX;CACA,WAAW,EACT,SAAS,2BACX;CACA,WAAW,EACT,SAAS,UACX;CACA,WAAW,EACT,SAAS,UACX;CACA,WAAW,EACT,SAAS,oDACX;CACA,WAAW,EACT,SAAS,mDACX;CACA,WAAW,EACT,SAAS,4CACX;CACA,WAAW,EACT,SAAS,6DACX;CACA,WAAW,EACT,SAAS,wDACX;CACA,WAAW,EACT,SAAS,UACX;CACA,WAAW,EACT,SAAS,uCACX;CACA,WAAW,EACT,SAAS,sBACX;CACA,WAAW,EACT,SAAS,uCACX;CACA,aAAa,EACX,SAAS,8CACX;CACA,WAAW,EACT,SAAS,8CACX;CACA,WAAW,EACT,SAAS,+CACX;CACA,WAAW,EACT,SAAS,kEACX;CACA,WAAW,EACT,SAAS,2DACX;CACA,WAAW,EACT,SAAS,oBACX;CACA,WAAW,EACT,SAAS,oBACX;CACA,WAAW,EACT,SAAS,0BACX;CACA,WAAW,EACT,SAAS,aACX;CACA,WAAW,EACT,SAAS,gDACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,gBACX;CACA,WAAW,EACT,SAAS,qDACX;CACA,WAAW,EACT,SAAS,mDACX;CACA,WAAW,EACT,SAAS,uDACX;CACA,WAAW,EACT,SAAS,iDACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,yDACX;CACA,WAAW,EACT,SAAS,qDACX;CACA,WAAW,EACT,SAAS,qDACX;CACA,WAAW,EACT,SAAS,8DACX;CACA,WAAW,EACT,SAAS,0DACX;CACA,WAAW,EACT,SAAS,sDACX;CACA,WAAW,EACT,SAAS,uDACX;CACA,WAAW,EACT,SAAS,mBACX;CACA,WAAW,EACT,SAAS,iEACX;CACA,WAAW,EACT,SAAS,0DACX;CACA,WAAW,EACT,SAAS,uDACX;CACA,WAAW,EACT,SAAS,oDACX;CACA,WAAW,EACT,SAAS,sDACX;CACA,WAAW,EACT,SAAS,uBACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,sDACX;CACA,WAAW,EACT,SAAS,yBACX;CACA,WAAW,EACT,SAAS,iDACX;CACA,WAAW,EACT,SAAS,sDACX;CACA,WAAW,EACT,SAAS,iDACX;CACA,WAAW,EACT,SAAS,sDACX;CACA,WAAW,EACT,SAAS,mDACX;CACA,WAAW,EACT,SAAS,4DACX;CACA,WAAW,EACT,SAAS,sDACX;CACA,WAAW,EACT,SAAS,mDACX;CACA,WAAW,EACT,SAAS,mBACX;CACA,WAAW,EACT,SAAS,4DACX;CACA,WAAW,EACT,SAAS,qBACX;CACA,WAAW,EACT,SAAS,iDACX;CACA,WAAW,EACT,SAAS,qDACX;CACA,aAAa,EACX,SAAS,mDACX;CACA,aAAa,EACX,SAAS,QACX;CACA,WAAW,EACT,SAAS,uBACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,mDACX;CACA,WAAW,EACT,SAAS,kDACX;CACA,WAAW,EACT,SAAS,sDACX;CACA,WAAW,EACT,SAAS,sBACX;CACA,WAAW,EACT,SAAS,iEACX;CACA,WAAW,EACT,SAAS,iEACX;CACA,WAAW,EACT,SAAS,6CACX;CACA,WAAW,EACT,SAAS,sBACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,4DACX;CACA,aAAa,EACX,SAAS,eACX;CACA,aAAa,EACX,SAAS,eACX;CACA,YAAY,EACV,SAAS,YACX;CACA,WAAW,EACT,SAAS,uBACX;CACA,aAAa,EACX,SAAS,2BACX;CACA,aAAa,EACX,SAAS,4BACX;CACA,aAAa,EACX,SAAS,oBACX;CACA,aAAa,EACX,SAAS,SACX;CACA,WAAW,EACT,SAAS,eACX;CACA,eAAe,EACb,SAAS,gBACX;CACA,aAAa,EACX,SAAS,oBACX;CACA,cAAc,EACZ,SAAS,gBACX;CACA,aAAa,EACX,SAAS,eACX;CACA,cAAc,EACZ,SAAS,gBACX;CACA,cAAc,EACZ,SAAS,cACX;CACA,aAAa,EACX,SAAS,YACX;CACA,cAAc,EACZ,SAAS,YACX;CACA,iBAAiB,EACf,SAAS,cACX;CACA,cAAc,EACZ,SAAS,gBACX;CACA,cAAc,EACZ,SAAS,gBACX;CACA,aAAa,EACX,SAAS,gBACX;CACA,aAAa,EACX,SAAS,eACX;CACA,YAAY,EACV,SAAS,aACX;CACA,eAAe,EACb,SAAS,uBACX;CACA,eAAe,EACb,SAAS,sBACX;CACA,cAAc,EACZ,SAAS,sBACX;CACA,aAAa,EACX,SAAS,mBACX;CACA,cAAc,EACZ,SAAS,wBACX;CACA,cAAc,EACZ,SAAS,uBACX;CACA,cAAc,EACZ,SAAS,gBACX;CACA,gBAAgB,EACd,SAAS,sBACX;CACA,cAAc,EACZ,SAAS,qBACX;CACA,cAAc,EACZ,SAAS,uBACX;CACA,cAAc,EACZ,SAAS,wBACX;CACA,WAAW,EACT,SAAS,yBACX;CACA,WAAW,EACT,SAAS,8BACX;CACA,aAAa,EACX,SAAS,uBACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,uBACX;CACA,WAAW,EACT,SAAS,yBACX;CACA,WAAW,EACT,SAAS,yBACX;CACA,WAAW,EACT,SAAS,qBACX;CACA,WAAW,EACT,SAAS,oBACX;CACA,WAAW,EACT,SAAS,qBACX;CACA,WAAW,EACT,SAAS,mBACX;CACA,WAAW,EACT,SAAS,sBACX;CACA,WAAW,EACT,SAAS,gBACX;CACA,WAAW,EACT,SAAS,uBACX;CACA,WAAW,EACT,SAAS,mBACX;CACA,WAAW,EACT,SAAS,yBACX;CACA,WAAW,EACT,SAAS,wBACX;CACA,WAAW,EACT,SAAS,uBACX;CACA,WAAW,EACT,SAAS,0BACX;CACA,WAAW,EACT,SAAS,4BACX;CACA,WAAW,EACT,SAAS,wBACX;CACA,WAAW,EACT,SAAS,0BACX;CACA,WAAW,EACT,SAAS,yBACX;CACA,WAAW,EACT,SAAS,qBACX;CACA,WAAW,EACT,SAAS,0BACX;CACA,WAAW,EACT,SAAS,iBACX;CACA,WAAW,EACT,SAAS,uBACX;CACA,WAAW,EACT,SAAS,yBACX;CACA,WAAW,EACT,SAAS,wBACX;CACA,WAAW,EACT,SAAS,0BACX;CACA,WAAW,EACT,SAAS,aACX;CACA,WAAW,EACT,SAAS,0BACX;CACA,WAAW,EACT,SAAS,oBACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,sBACX;CACA,WAAW,EACT,SAAS,sBACX;CACA,WAAW,EACT,SAAS,qBACX;CACA,WAAW,EACT,SAAS,sBACX;CACA,WAAW,EACT,SAAS,mBACX;CACA,WAAW,EACT,SAAS,oBACX;CACA,WAAW,EACT,SAAS,6BACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,0BACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,wBACX;CACA,WAAW,EACT,SAAS,uBACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,2BACX;CACA,WAAW,EACT,SAAS,0BACX;CACA,WAAW,EACT,SAAS,wBACX;CACA,WAAW,EACT,SAAS,uBACX;CACA,WAAW,EACT,SAAS,qBACX;CACA,WAAW,EACT,SAAS,aACX;CACA,WAAW,EACT,SAAS,aACX;CACA,WAAW,EACT,SAAS,uBACX;CACA,WAAW,EACT,SAAS,mBACX;CACA,WAAW,EACT,SAAS,oBACX;CACA,WAAW,EACT,SAAS,sBACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,aACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,aACX;CACA,WAAW,EACT,SAAS,aACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,iBACX;CACA,WAAW,EACT,SAAS,YACX;CACA,WAAW,EACT,SAAS,aACX;CACA,WAAW,EACT,SAAS,2BACX;CACA,WAAW,EACT,SAAS,iBACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,YACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,YACX;CACA,WAAW,EACT,SAAS,wBACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,sBACX;CACA,WAAW,EACT,SAAS,gBACX;CACA,WAAW,EACT,SAAS,eACX;CACA,aAAa,EACX,SAAS,gBACX;CACA,WAAW,EACT,SAAS,YACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,iBACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,aACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,iBACX;CACA,WAAW,EACT,SAAS,YACX;CACA,WAAW,EACT,SAAS,aACX;CACA,WAAW,EACT,SAAS,YACX;CACA,WAAW,EACT,SAAS,gBACX;CACA,WAAW,EACT,SAAS,aACX;CACA,WAAW,EACT,SAAS,sBACX;CACA,WAAW,EACT,SAAS,aACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,gBACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,gBACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,aACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,gBACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,gBACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,gBACX;CACA,WAAW,EACT,SAAS,cACX;CACA,WAAW,EACT,SAAS,gBACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,iBACX;CACA,WAAW,EACT,SAAS,gBACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,gBACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,aACX;CACA,WAAW,EACT,SAAS,YACX;CACA,WAAW,EACT,SAAS,cACX;CACA,YAAY,EACV,SAAS,gBACX;CACA,YAAY,EACV,SAAS,aACX;CACA,YAAY,EACV,SAAS,gBACX;CACA,WAAW,EACT,SAAS,gBACX;CACA,aAAa,EACX,SAAS,eACX;CACA,WAAW,EACT,SAAS,aACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,gBACX;CACA,WAAW,EACT,SAAS,uBACX;CACA,WAAW,EACT,SAAS,gBACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,eACX;CACA,WAAW,EACT,SAAS,gBACX;CACA,eAAe,EACb,SAAS,QACX;CACA,eAAe,EACb,SAAS,QACX;CACA,iBAAiB,EACf,SAAS,QACX;CACA,kBAAkB,EAChB,SAAS,QACX;CACA,gBAAgB,EACd,SAAS,QACX;CACA,YAAY,EACV,SAAS,QACX;CACA,cAAc,EACZ,SAAS,QACX;CACA,cAAc,EACZ,SAAS,QACX;CACA,eAAe,EACb,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,aACX;CACA,YAAY,EACV,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,YAAY,EACV,SAAS,QACX;CACA,YAAY,EACV,SAAS,QACX;CACA,YAAY,EACV,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,YAAY,EACV,SAAS,QACX;CACA,YAAY,EACV,SAAS,QACX;CACA,YAAY,EACV,SAAS,QACX;CACA,YAAY,EACV,SAAS,QACX;CACA,WAAW,EACT,SAAS,QACX;CACA,YAAY,EACV,SAAS,QACX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