{
  "version": 3,
  "sources": ["../src/index.ts", "../src/utils/utils.ts", "../src/editable-layers/editable-geojson-layer.ts", "../src/edit-modes/geojson-edit-mode.ts", "../src/edit-modes/utils.ts", "../src/edit-modes/immutable-feature-collection.ts", "../src/edit-modes/view-mode.ts", "../src/edit-modes/translate-mode.ts", "../src/utils/translate-from-center.ts", "../src/edit-modes/modify-mode.ts", "../src/edit-modes/scale-mode.ts", "../src/edit-modes/rotate-mode.ts", "../src/edit-modes/duplicate-mode.ts", "../src/edit-modes/split-polygon-mode.ts", "../src/edit-modes/extrude-mode.ts", "../src/edit-modes/elevation-mode.ts", "../src/edit-modes/draw-point-mode.ts", "../src/edit-modes/draw-line-string-mode.ts", "../src/utils/memoize.ts", "../src/edit-modes/draw-polygon-mode.ts", "../src/edit-modes/draw-rectangle-mode.ts", "../src/edit-modes/two-click-polygon-mode.ts", "../src/edit-modes/draw-square-mode.ts", "../src/edit-modes/draw-rectangle-from-center-mode.ts", "../src/edit-modes/draw-square-from-center-mode.ts", "../src/edit-modes/draw-circle-from-center-mode.ts", "../src/edit-modes/draw-circle-by-diameter-mode.ts", "../src/edit-modes/draw-ellipse-by-bounding-box-mode.ts", "../src/edit-modes/three-click-polygon-mode.ts", "../src/edit-modes/draw-rectangle-using-three-points-mode.ts", "../src/edit-modes/draw-ellipse-using-three-points-mode.ts", "../src/edit-modes/draw-90degree-polygon-mode.ts", "../src/edit-modes/draw-polygon-by-dragging-mode.ts", "../src/edit-modes/snappable-mode.ts", "../src/edit-modes/transform-mode.ts", "../src/edit-modes/composite-mode.ts", "../src/edit-modes/delete-mode.ts", "../src/constants.ts", "../src/editable-layers/editable-layer.ts", "../src/editable-layers/editable-path-layer.ts", "../src/editable-layers/editable-h3-cluster-layer.ts", "../src/editable-layers/selection-layer.ts", "../src/editable-layers/elevated-edit-handle-layer.ts", "../src/widgets/edit-mode-tray-widget.tsx", "../src/widgets/editor-toolbar-widget.tsx", "../src/editable-layers/junction-scatterplot-layer.ts", "../src/edit-modes/resize-circle-mode.ts", "../src/edit-modes/extend-line-string-mode.ts", "../src/edit-modes/measure-distance-mode.ts", "../src/edit-modes/measure-area-mode.ts", "../src/edit-modes/measure-angle-mode.ts"],
  "sourcesContent": ["// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// Utils\nexport {toDeckColor} from './utils/utils';\n\n// Types\nexport type {Color, Style, Viewport} from './utils/types';\n\n// Layers\nexport {EditableGeoJsonLayer} from './editable-layers/editable-geojson-layer';\nexport {EditableH3ClusterLayer} from './editable-layers/editable-h3-cluster-layer';\nexport {SelectionLayer} from './editable-layers/selection-layer';\nexport {ElevatedEditHandleLayer} from './editable-layers/elevated-edit-handle-layer';\n\n// Widgets\nexport {EditModeTrayWidget} from './widgets/edit-mode-tray-widget';\nexport type {\n  EditModeTrayWidgetProps,\n  EditModeTrayWidgetModeOption,\n  EditModeTrayWidgetSelectEvent\n} from './widgets/edit-mode-tray-widget';\n\nexport {EditorToolbarWidget} from './widgets/editor-toolbar-widget';\nexport type {EditorToolbarWidgetProps, BooleanOperation} from './widgets/editor-toolbar-widget';\n\n// Layers move to deck.gl-community/layers?\nexport {JunctionScatterplotLayer} from './editable-layers/junction-scatterplot-layer';\n\n// Types\n\nimport * as utils from './utils/utils';\n\nexport {utils};\n\nexport {getPickedEditHandle, getEditHandlesForGeometry} from './edit-modes/utils';\n\nexport type {EditMode} from './edit-modes/edit-mode';\nexport type {GeoJsonEditModeType} from './edit-modes/geojson-edit-mode';\nexport type {GeoJsonEditModeConstructor} from './edit-modes/geojson-edit-mode';\n\nexport type {EditableGeoJsonLayerProps} from './editable-layers/editable-geojson-layer';\nexport type {SelectionLayerProps} from './editable-layers/selection-layer';\n\nexport {GeoJsonEditMode} from './edit-modes/geojson-edit-mode';\n\n// Alter modes\nexport {DeleteMode} from './edit-modes/delete-mode';\nexport {ModifyMode} from './edit-modes/modify-mode';\nexport {ResizeCircleMode} from './edit-modes/resize-circle-mode';\nexport {TranslateMode} from './edit-modes/translate-mode';\nexport {ScaleMode} from './edit-modes/scale-mode';\nexport {RotateMode} from './edit-modes/rotate-mode';\nexport {DuplicateMode} from './edit-modes/duplicate-mode';\nexport {ExtendLineStringMode} from './edit-modes/extend-line-string-mode';\nexport {SplitPolygonMode} from './edit-modes/split-polygon-mode';\nexport {ExtrudeMode} from './edit-modes/extrude-mode';\nexport {ElevationMode} from './edit-modes/elevation-mode';\nexport {TransformMode} from './edit-modes/transform-mode';\n\n// Draw modes\nexport {DrawPointMode} from './edit-modes/draw-point-mode';\nexport {DrawLineStringMode} from './edit-modes/draw-line-string-mode';\nexport {DrawPolygonMode} from './edit-modes/draw-polygon-mode';\nexport {DrawRectangleMode} from './edit-modes/draw-rectangle-mode';\nexport {DrawSquareMode} from './edit-modes/draw-square-mode';\nexport {DrawRectangleFromCenterMode} from './edit-modes/draw-rectangle-from-center-mode';\nexport {DrawSquareFromCenterMode} from './edit-modes/draw-square-from-center-mode';\nexport {DrawCircleByDiameterMode} from './edit-modes/draw-circle-by-diameter-mode';\nexport {DrawCircleFromCenterMode} from './edit-modes/draw-circle-from-center-mode';\nexport {DrawEllipseByBoundingBoxMode} from './edit-modes/draw-ellipse-by-bounding-box-mode';\nexport {DrawEllipseUsingThreePointsMode} from './edit-modes/draw-ellipse-using-three-points-mode';\nexport {DrawRectangleUsingThreePointsMode} from './edit-modes/draw-rectangle-using-three-points-mode';\nexport {Draw90DegreePolygonMode} from './edit-modes/draw-90degree-polygon-mode';\nexport {DrawPolygonByDraggingMode} from './edit-modes/draw-polygon-by-dragging-mode';\nexport {ImmutableFeatureCollection} from './edit-modes/immutable-feature-collection';\n\n// Other modes\nexport {ViewMode} from './edit-modes/view-mode';\nexport {MeasureDistanceMode} from './edit-modes/measure-distance-mode';\nexport {MeasureAreaMode} from './edit-modes/measure-area-mode';\nexport {MeasureAngleMode} from './edit-modes/measure-angle-mode';\nexport {CompositeMode} from './edit-modes/composite-mode';\nexport {SnappableMode} from './edit-modes/snappable-mode';\n\nexport type {\n  ScreenCoordinates,\n  EditAction,\n  Pick,\n  ClickEvent,\n  PointerMoveEvent,\n  StartDraggingEvent,\n  StopDraggingEvent,\n  DraggingEvent,\n  ModeProps,\n  GuideFeatureCollection,\n  // Viewport,\n  Tooltip\n} from './edit-modes/types';\n\nexport type {\n  Position,\n  SimpleFeature,\n  SimpleFeatureCollection,\n  SimpleGeometry,\n  SimpleGeometryCoordinates,\n  Point,\n  LineString,\n  Polygon,\n  MultiPoint,\n  MultiLineString,\n  MultiPolygon,\n  PolygonGeometry,\n  Feature,\n  FeatureCollection,\n  AnyGeoJson\n} from './utils/geojson-types';\n\n// Experimental\nexport {memoize as _memoize} from './utils/memoize';\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport destination from '@turf/destination';\nimport bearing from '@turf/bearing';\nimport pointToLineDistance from '@turf/point-to-line-distance';\nimport {point} from '@turf/helpers';\nimport {WebMercatorViewport} from '@math.gl/web-mercator';\nimport {Feature, LineString, Point, Position} from './geojson-types';\nimport {Viewport} from './types';\n\n// TODO edit-modes: delete and use edit-modes/utils instead\n\nexport type NearestPointType = Feature<Point, {dist: number; index: number}>;\n\nexport function toDeckColor(\n  color?: [number, number, number, number] | number,\n  defaultColor: [number, number, number, number] = [255, 0, 0, 255]\n): [number, number, number, number] {\n  if (!Array.isArray(color)) {\n    return defaultColor;\n  }\n  return [color[0] * 255, color[1] * 255, color[2] * 255, color[3] * 255];\n}\n\n//\n// a GeoJSON helper function that calls the provided function with\n// an argument that is the most deeply-nested array having elements\n// that are arrays of primitives as an argument, e.g.\n//\n// {\n//   \"type\": \"MultiPolygon\",\n//   \"coordinates\": [\n//       [\n//           [[30, 20], [45, 40], [10, 40], [30, 20]]\n//       ],\n//       [\n//           [[15, 5], [40, 10], [10, 20], [5, 10], [15, 5]]\n//       ]\n//   ]\n// }\n//\n// the function would be called on:\n//\n// [[30, 20], [45, 40], [10, 40], [30, 20]]\n//\n// and\n//\n// [[15, 5], [40, 10], [10, 20], [5, 10], [15, 5]]\n//\nexport function recursivelyTraverseNestedArrays(\n  array: Array<any>,\n  prefix: Array<number>,\n  fn: Function\n) {\n  if (!Array.isArray(array[0])) {\n    return true;\n  }\n  for (let i = 0; i < array.length; i++) {\n    if (recursivelyTraverseNestedArrays(array[i], [...prefix, i], fn)) {\n      fn(array, prefix);\n      break;\n    }\n  }\n  return false;\n}\n\nexport function generatePointsParallelToLinePoints(\n  p1: Position,\n  p2: Position,\n  mapCoords: Position\n): Position[] {\n  const lineString: LineString = {\n    type: 'LineString',\n    coordinates: [p1, p2]\n  };\n  const pt = point(mapCoords);\n  const ddistance = pointToLineDistance(pt, lineString);\n  const lineBearing = bearing(p1, p2);\n\n  // Check if current point is to the left or right of line\n  // Line from A=(x1,y1) to B=(x2,y2) a point P=(x,y)\n  // then (x\u2212x1)(y2\u2212y1)\u2212(y\u2212y1)(x2\u2212x1)\n  const isPointToLeftOfLine =\n    (mapCoords[0] - p1[0]) * (p2[1] - p1[1]) - (mapCoords[1] - p1[1]) * (p2[0] - p1[0]);\n\n  // Bearing to draw perpendicular to the line string\n  const orthogonalBearing = isPointToLeftOfLine < 0 ? lineBearing - 90 : lineBearing - 270;\n\n  // Get coordinates for the point p3 and p4 which are perpendicular to the lineString\n  // Add the distance as the current position moves away from the lineString\n  const p3 = destination(p2, ddistance, orthogonalBearing);\n  const p4 = destination(p1, ddistance, orthogonalBearing);\n  return [p3.geometry.coordinates, p4.geometry.coordinates] as [Position, Position];\n}\n\nexport function distance2d(x1: number, y1: number, x2: number, y2: number): number {\n  const dx = x1 - x2;\n  const dy = y1 - y2;\n  return Math.sqrt(dx * dx + dy * dy);\n}\n\nexport function mix(a: number, b: number, ratio: number): number {\n  return b * ratio + a * (1 - ratio);\n}\n\nexport function nearestPointOnProjectedLine(\n  line: Feature<LineString>,\n  inPoint: Feature<Point>,\n  viewport: Viewport\n): NearestPointType {\n  const wmViewport = new WebMercatorViewport(viewport);\n  // Project the line to viewport, then find the nearest point\n  const coordinates: Array<Array<number>> = line.geometry.coordinates as any;\n  const projectedCoords = coordinates.map(([x, y, z = 0]) => wmViewport.project([x, y, z]));\n  const [x, y] = wmViewport.project(inPoint.geometry.coordinates);\n  // console.log('projectedCoords', JSON.stringify(projectedCoords));\n\n  let minDistance = Infinity;\n  let minPointInfo = {};\n\n  projectedCoords.forEach(([x2, y2], index) => {\n    if (index === 0) {\n      return;\n    }\n\n    const [x1, y1] = projectedCoords[index - 1];\n\n    // line from projectedCoords[index - 1] to projectedCoords[index]\n    // convert to Ax + By + C = 0\n    const A = y1 - y2;\n    const B = x2 - x1;\n    const C = x1 * y2 - x2 * y1;\n\n    // https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line\n    const div = A * A + B * B;\n    const distance = Math.abs(A * x + B * y + C) / Math.sqrt(div);\n\n    // TODO: Check if inside bounds\n\n    if (distance < minDistance) {\n      minDistance = distance;\n      minPointInfo = {\n        index,\n        x0: (B * (B * x - A * y) - A * C) / div,\n        y0: (A * (-B * x + A * y) - B * C) / div\n      };\n    }\n  });\n  const {index, x0, y0} = minPointInfo as any;\n  const [x1, y1, z1 = 0] = projectedCoords[index - 1];\n  const [x2, y2, z2 = 0] = projectedCoords[index];\n\n  // calculate what ratio of the line we are on to find the proper z\n  const lineLength = distance2d(x1, y1, x2, y2);\n  const startToPointLength = distance2d(x1, y1, x0, y0);\n  const ratio = startToPointLength / lineLength;\n  const z0 = mix(z1, z2, ratio);\n\n  return {\n    type: 'Feature',\n    geometry: {\n      type: 'Point',\n      coordinates: wmViewport.unproject([x0, y0, z0])\n    },\n    properties: {\n      // TODO: calculate the distance in proper units\n      dist: minDistance,\n      index: index - 1\n    }\n  };\n}\n\n/**\n * Inserts toInsert string into base string before insertBefore string.\n * @param base A string to insert into.\n * @param insertBeforeText A sub string in `base` string to insert before.\n * @param toInsert A string to insert.\n * @returns Combined string. `base` string if `insertBefore` string isn't found.\n */\nexport function insertBefore(base: string, insertBeforeText: string, toInsert: string): string {\n  const at = base.indexOf(insertBeforeText);\n  if (at < 0) {\n    return base;\n  }\n  return base.slice(0, at) + toInsert + base.slice(at);\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* eslint-env browser */\n\nimport type {UpdateParameters, DefaultProps} from '@deck.gl/core';\nimport {GeoJsonLayer, ScatterplotLayer, IconLayer, TextLayer} from '@deck.gl/layers';\nimport {\n  EditAction,\n  ClickEvent,\n  StartDraggingEvent,\n  StopDraggingEvent,\n  DraggingEvent,\n  PointerMoveEvent,\n  DoubleClickEvent,\n  ModeProps\n} from '../edit-modes/types';\n\nimport {ViewMode} from '../edit-modes/view-mode';\nimport {TranslateMode} from '../edit-modes/translate-mode';\nimport {ModifyMode} from '../edit-modes/modify-mode';\nimport {ScaleMode} from '../edit-modes/scale-mode';\nimport {RotateMode} from '../edit-modes/rotate-mode';\nimport {DuplicateMode} from '../edit-modes/duplicate-mode';\nimport {SplitPolygonMode} from '../edit-modes/split-polygon-mode';\nimport {ExtrudeMode} from '../edit-modes/extrude-mode';\nimport {ElevationMode} from '../edit-modes/elevation-mode';\nimport {DrawPointMode} from '../edit-modes/draw-point-mode';\nimport {DrawLineStringMode} from '../edit-modes/draw-line-string-mode';\nimport {DrawPolygonMode} from '../edit-modes/draw-polygon-mode';\nimport {DrawRectangleMode} from '../edit-modes/draw-rectangle-mode';\nimport {DrawSquareMode} from '../edit-modes/draw-square-mode';\nimport {DrawRectangleFromCenterMode} from '../edit-modes/draw-rectangle-from-center-mode';\nimport {DrawSquareFromCenterMode} from '../edit-modes/draw-square-from-center-mode';\nimport {DrawCircleFromCenterMode} from '../edit-modes/draw-circle-from-center-mode';\nimport {DrawCircleByDiameterMode} from '../edit-modes/draw-circle-by-diameter-mode';\nimport {DrawEllipseByBoundingBoxMode} from '../edit-modes/draw-ellipse-by-bounding-box-mode';\nimport {DrawRectangleUsingThreePointsMode} from '../edit-modes/draw-rectangle-using-three-points-mode';\nimport {DrawEllipseUsingThreePointsMode} from '../edit-modes/draw-ellipse-using-three-points-mode';\nimport {Draw90DegreePolygonMode} from '../edit-modes/draw-90degree-polygon-mode';\nimport {DrawPolygonByDraggingMode} from '../edit-modes/draw-polygon-by-dragging-mode';\nimport {SnappableMode} from '../edit-modes/snappable-mode';\nimport {TransformMode} from '../edit-modes/transform-mode';\nimport {DeleteMode} from '../edit-modes/delete-mode';\nimport {GeoJsonEditModeType} from '../edit-modes/geojson-edit-mode';\n\nimport {Color} from '../utils/types';\nimport {PROJECTED_PIXEL_SIZE_MULTIPLIER} from '../constants';\n\nimport {EditableLayer, EditableLayerProps} from './editable-layer';\nimport {EditablePathLayer} from './editable-path-layer';\nimport {Feature, FeatureCollection} from '../utils/geojson-types';\n\nconst DEFAULT_LINE_COLOR: Color = [0x0, 0x0, 0x0, 0x99];\nconst DEFAULT_FILL_COLOR: Color = [0x0, 0x0, 0x0, 0x90];\nconst DEFAULT_SELECTED_LINE_COLOR: Color = [0x0, 0x0, 0x0, 0xff];\nconst DEFAULT_SELECTED_FILL_COLOR: Color = [0x0, 0x0, 0x90, 0x90];\nconst DEFAULT_TENTATIVE_LINE_COLOR: Color = [0x90, 0x90, 0x90, 0xff];\nconst DEFAULT_TENTATIVE_FILL_COLOR: Color = [0x90, 0x90, 0x90, 0x90];\nconst DEFAULT_EDITING_EXISTING_POINT_COLOR: Color = [0xc0, 0x0, 0x0, 0xff];\nconst DEFAULT_EDITING_INTERMEDIATE_POINT_COLOR: Color = [0x0, 0x0, 0x0, 0x80];\nconst DEFAULT_EDITING_SNAP_POINT_COLOR: Color = [0x7c, 0x00, 0xc0, 0xff];\nconst DEFAULT_EDITING_POINT_OUTLINE_COLOR: Color = [0xff, 0xff, 0xff, 0xff];\nconst DEFAULT_EDITING_EXISTING_POINT_RADIUS = 5;\nconst DEFAULT_EDITING_INTERMEDIATE_POINT_RADIUS = 3;\nconst DEFAULT_EDITING_SNAP_POINT_RADIUS = 7;\nconst DEFAULT_TOOLTIP_FONT_SIZE = 32 * PROJECTED_PIXEL_SIZE_MULTIPLIER;\n\nconst DEFAULT_EDIT_MODE = DrawPolygonMode;\n\nfunction guideAccessor(accessor) {\n  if (!accessor || typeof accessor !== 'function') {\n    return accessor;\n  }\n  return (guideMaybeWrapped) => accessor(unwrapGuide(guideMaybeWrapped));\n}\n\n// The object handed to us from deck.gl is different depending on the version of deck.gl used, unwrap as necessary\nfunction unwrapGuide(guideMaybeWrapped) {\n  if (guideMaybeWrapped.__source) {\n    return guideMaybeWrapped.__source.object;\n  } else if (guideMaybeWrapped.sourceFeature) {\n    return guideMaybeWrapped.sourceFeature.feature;\n  }\n  // It is not wrapped, return as is\n  return guideMaybeWrapped;\n}\n\nfunction getEditHandleColor(handle) {\n  switch (handle.properties.editHandleType) {\n    case 'existing':\n      return DEFAULT_EDITING_EXISTING_POINT_COLOR;\n    case 'snap-source':\n      return DEFAULT_EDITING_SNAP_POINT_COLOR;\n    case 'intermediate':\n    default:\n      return DEFAULT_EDITING_INTERMEDIATE_POINT_COLOR;\n  }\n}\n\nfunction getEditHandleOutlineColor(handle) {\n  return DEFAULT_EDITING_POINT_OUTLINE_COLOR;\n}\n\nfunction getEditHandleRadius(handle) {\n  switch (handle.properties.editHandleType) {\n    case 'existing':\n      return DEFAULT_EDITING_EXISTING_POINT_RADIUS;\n    case 'snap':\n      return DEFAULT_EDITING_SNAP_POINT_RADIUS;\n    case 'intermediate':\n    default:\n      return DEFAULT_EDITING_INTERMEDIATE_POINT_RADIUS;\n  }\n}\n\nexport type EditableGeoJsonLayerProps<DataT = any> = EditableLayerProps & {\n  data: DataT;\n  mode?: any;\n  modeConfig?: any;\n  selectedFeatureIndexes?: number[];\n  onEdit?: (editAction: EditAction<DataT>) => void;\n\n  pickable?: boolean;\n  pickingRadius?: number;\n  pickingDepth?: number;\n  fp64?: boolean;\n  filled?: boolean;\n  stroked?: boolean;\n  lineWidthScale?: number;\n  lineWidthMinPixels?: number;\n  lineWidthMaxPixels?: number;\n  pickingLineWidthExtraPixels?: number;\n  lineWidthUnits?: string;\n  lineJointRounded?: boolean;\n  lineCapRounded?: boolean;\n  lineMiterLimit?: number;\n  pointRadiusScale?: number;\n  pointRadiusMinPixels?: number;\n  pointRadiusMaxPixels?: number;\n\n  getLineColor?: Color | ((feature, isSelected, mode) => Color);\n  getFillColor?: Color | ((feature, isSelected, mode) => Color);\n  getRadius?: number | ((feature, isSelected, mode) => number);\n  getLineWidth?: number | ((feature, isSelected, mode) => number);\n\n  getTentativeLineColor?: Color | ((feature, isSelected, mode) => Color);\n  getTentativeFillColor?: Color | ((feature, isSelected, mode) => Color);\n  getTentativeLineWidth?: number | ((f) => number);\n\n  editHandleType?: string;\n\n  editHandlePointRadiusScale?: number;\n  editHandlePointOutline?: boolean;\n  editHandlePointStrokeWidth?: number;\n  editHandlePointRadiusUnits?: string;\n  editHandlePointRadiusMinPixels?: number;\n  editHandlePointRadiusMaxPixels?: number;\n  getEditHandlePointColor?: Color | ((handle) => Color);\n  getEditHandlePointOutlineColor?: Color | ((handle) => Color);\n  getEditHandlePointRadius?: number | ((handle) => number);\n\n  // icon handles\n  editHandleIconAtlas?: any;\n  editHandleIconMapping?: any;\n  editHandleIconSizeScale?: number;\n  editHandleIconSizeUnits?: string;\n  getEditHandleIcon?: (handle) => string;\n  getEditHandleIconSize?: number;\n  getEditHandleIconColor?: Color | ((handle) => Color);\n  getEditHandleIconAngle?: number | ((handle) => number);\n\n  // misc\n  billboard?: boolean;\n};\n\nconst defaultProps: DefaultProps<EditableGeoJsonLayerProps<any>> = {\n  mode: DEFAULT_EDIT_MODE,\n\n  // Edit and interaction events\n  onEdit: () => {},\n\n  pickable: true,\n  pickingRadius: 10,\n  pickingDepth: 5,\n  fp64: false,\n  filled: true,\n  stroked: true,\n  lineWidthScale: PROJECTED_PIXEL_SIZE_MULTIPLIER,\n  lineWidthMinPixels: 1,\n  lineWidthMaxPixels: Number.MAX_SAFE_INTEGER,\n  pickingLineWidthExtraPixels: 0,\n  lineWidthUnits: 'pixels',\n  lineJointRounded: false,\n  lineCapRounded: false,\n  lineMiterLimit: 4,\n  pointRadiusScale: 1,\n  pointRadiusMinPixels: 2,\n  pointRadiusMaxPixels: Number.MAX_SAFE_INTEGER,\n  getLineColor: (feature, isSelected, mode) =>\n    isSelected ? DEFAULT_SELECTED_LINE_COLOR : DEFAULT_LINE_COLOR,\n  getFillColor: (feature, isSelected, mode) =>\n    isSelected ? DEFAULT_SELECTED_FILL_COLOR : DEFAULT_FILL_COLOR,\n  getRadius: (f) =>\n    (f && f.properties && f.properties.radius) || (f && f.properties && f.properties.size) || 1,\n  getLineWidth: (f) => (f && f.properties && f.properties.lineWidth) || 3,\n\n  // Tentative feature rendering\n  getTentativeLineColor: (f) => DEFAULT_TENTATIVE_LINE_COLOR,\n  getTentativeFillColor: (f) => DEFAULT_TENTATIVE_FILL_COLOR,\n  getTentativeLineWidth: (f) => (f && f.properties && f.properties.lineWidth) || 3,\n\n  editHandleType: 'point',\n\n  // point handles\n  editHandlePointRadiusScale: 1,\n  editHandlePointOutline: true,\n  editHandlePointStrokeWidth: 2,\n  editHandlePointRadiusUnits: 'pixels',\n  editHandlePointRadiusMinPixels: 4,\n  editHandlePointRadiusMaxPixels: 8,\n  getEditHandlePointColor: getEditHandleColor,\n  getEditHandlePointOutlineColor: getEditHandleOutlineColor,\n  getEditHandlePointRadius: getEditHandleRadius,\n\n  // icon handles\n  editHandleIconAtlas: null,\n  editHandleIconMapping: null,\n  editHandleIconSizeScale: 1,\n  editHandleIconSizeUnits: 'pixels',\n  getEditHandleIcon: (handle) => handle.properties.editHandleType,\n  getEditHandleIconSize: 10,\n  getEditHandleIconColor: getEditHandleColor,\n  getEditHandleIconAngle: 0,\n\n  // misc\n  billboard: true\n};\n\n// Mapping of mode name to mode class (for legacy purposes)\nconst modeNameMapping = {\n  view: ViewMode,\n\n  // Alter modes\n  modify: ModifyMode,\n  translate: new SnappableMode(new TranslateMode()),\n\n  transform: new SnappableMode(new TransformMode()),\n  scale: ScaleMode,\n  rotate: RotateMode,\n  duplicate: DuplicateMode,\n  split: SplitPolygonMode,\n  extrude: ExtrudeMode,\n  elevation: ElevationMode,\n  delete: DeleteMode,\n\n  // Draw modes\n  drawPoint: DrawPointMode,\n  drawLineString: DrawLineStringMode,\n  drawPolygon: DrawPolygonMode,\n  drawRectangle: DrawRectangleMode,\n  drawSquare: DrawSquareMode,\n  drawRectangleFromCenter: DrawRectangleFromCenterMode,\n  drawSquareFromCenter: DrawSquareFromCenterMode,\n  drawCircleFromCenter: DrawCircleFromCenterMode,\n  drawCircleByBoundingBox: DrawCircleByDiameterMode,\n  drawEllipseByBoundingBox: DrawEllipseByBoundingBoxMode,\n  drawRectangleUsing3Points: DrawRectangleUsingThreePointsMode,\n  drawEllipseUsing3Points: DrawEllipseUsingThreePointsMode,\n  draw90DegreePolygon: Draw90DegreePolygonMode,\n  drawPolygonByDragging: DrawPolygonByDraggingMode\n};\n\nexport class EditableGeoJsonLayer extends EditableLayer<\n  FeatureCollection,\n  EditableGeoJsonLayerProps<FeatureCollection>\n> {\n  static layerName = 'EditableGeoJsonLayer';\n  static defaultProps = defaultProps;\n\n  state: EditableLayer['state'] & {\n    cursor?: 'grabbing' | 'grab' | null;\n    mode: GeoJsonEditModeType;\n    lastPointerMoveEvent: PointerMoveEvent;\n    tentativeFeature?: Feature;\n    editHandles: any[];\n    selectedFeatures: Feature[];\n  } = undefined!;\n\n  // setState: ($Shape<State>) => void;\n  renderLayers() {\n    const subLayerProps = this.getSubLayerProps({\n      id: 'geojson',\n\n      // Proxy most GeoJsonLayer props as-is\n      data: this.props.data,\n      fp64: this.props.fp64,\n      filled: this.props.filled,\n      stroked: this.props.stroked,\n      lineWidthScale: this.props.lineWidthScale,\n      lineWidthMinPixels: this.props.lineWidthMinPixels,\n      lineWidthMaxPixels: this.props.lineWidthMaxPixels,\n      lineWidthUnits: this.props.lineWidthUnits,\n      lineJointRounded: this.props.lineJointRounded,\n      lineCapRounded: this.props.lineCapRounded,\n      lineMiterLimit: this.props.lineMiterLimit,\n      pointRadiusScale: this.props.pointRadiusScale,\n      pointRadiusMinPixels: this.props.pointRadiusMinPixels,\n      pointRadiusMaxPixels: this.props.pointRadiusMaxPixels,\n      getLineColor: this.selectionAwareAccessor(this.props.getLineColor),\n      getFillColor: this.selectionAwareAccessor(this.props.getFillColor),\n      getPointRadius: this.selectionAwareAccessor(this.props.getRadius),\n      getLineWidth: this.selectionAwareAccessor(this.props.getLineWidth),\n\n      _subLayerProps: {\n        linestrings: {\n          billboard: this.props.billboard,\n          updateTriggers: {\n            // required to update dashed array attribute\n            all: [this.props.selectedFeatureIndexes, this.props.mode]\n          }\n        },\n        'polygons-stroke': {\n          billboard: this.props.billboard,\n          pickingLineWidthExtraPixels: this.props.pickingLineWidthExtraPixels,\n          type: EditablePathLayer,\n          updateTriggers: {\n            // required to update dashed array attribute\n            all: [this.props.selectedFeatureIndexes, this.props.mode]\n          }\n        }\n      },\n\n      updateTriggers: {\n        getLineColor: [\n          this.props.updateTriggers.getLineColor,\n          this.props.selectedFeatureIndexes,\n          this.props.mode\n        ],\n        getFillColor: [\n          this.props.updateTriggers.getFillColor,\n          this.props.selectedFeatureIndexes,\n          this.props.mode\n        ],\n        getPointRadius: [\n          this.props.updateTriggers.getPointRadius,\n          this.props.selectedFeatureIndexes,\n          this.props.mode\n        ],\n        getLineWidth: [\n          this.props.updateTriggers.getLineWidth,\n          this.props.selectedFeatureIndexes,\n          this.props.mode\n        ]\n      }\n    });\n\n    let layers: any = [new GeoJsonLayer(subLayerProps)];\n\n    layers = layers.concat(this.createGuidesLayers(), this.createTooltipsLayers());\n\n    return layers;\n  }\n\n  initializeState() {\n    super.initializeState();\n\n    this.setState({\n      selectedFeatures: [],\n      editHandles: []\n    });\n  }\n\n  // TODO: is this the best way to properly update state from an outside event handler?\n  shouldUpdateState(opts: any) {\n    // console.log(\n    //   'shouldUpdateState',\n    //   opts.changeFlags.propsOrDataChanged,\n    //   opts.changeFlags.stateChanged\n    // );\n    return super.shouldUpdateState(opts) || opts.changeFlags.stateChanged;\n  }\n\n  updateState({props, oldProps, changeFlags, context}: UpdateParameters<this>) {\n    super.updateState({oldProps, props, changeFlags, context});\n\n    if (changeFlags.propsOrDataChanged) {\n      const modePropChanged = Object.keys(oldProps).length === 0 || props.mode !== oldProps.mode;\n      if (modePropChanged) {\n        let mode: DrawPolygonMode;\n        if (typeof props.mode === 'function') {\n          // They passed a constructor/class, so new it up\n          const ModeConstructor = props.mode;\n          mode = new ModeConstructor();\n        } else if (typeof props.mode === 'string') {\n          // Lookup the mode based on its name (for backwards compatibility)\n          mode = modeNameMapping[props.mode];\n          // eslint-disable-next-line no-console\n          console.warn(\n            \"Deprecated use of passing `mode` as a string. Pass the mode's class constructor instead.\"\n          );\n        } else {\n          // Should be an instance of EditMode in this case\n          mode = props.mode;\n        }\n\n        if (!mode) {\n          console.warn(`No mode configured for ${String(props.mode)}`); // eslint-disable-line no-console,no-undef\n          // Use default mode\n          mode = new DEFAULT_EDIT_MODE();\n        }\n\n        if (mode !== this.state.mode) {\n          this.setState({mode, cursor: null});\n        }\n      }\n    }\n\n    let selectedFeatures = [];\n    if (\n      Array.isArray(props.selectedFeatureIndexes) &&\n      typeof props.data === 'object' &&\n      'features' in props.data\n    ) {\n      // TODO: needs improved testing, i.e. checking for duplicates, NaNs, out of range numbers, ...\n      const propsData = props.data;\n      selectedFeatures = props.selectedFeatureIndexes.map((elem) => propsData.features[elem]);\n    }\n\n    this.setState({selectedFeatures});\n  }\n\n  getModeProps<DataT>(props: EditableGeoJsonLayerProps<DataT>): ModeProps<DataT> {\n    return {\n      modeConfig: props.modeConfig,\n      data: props.data,\n      selectedIndexes: props.selectedFeatureIndexes,\n      lastPointerMoveEvent: this.state.lastPointerMoveEvent,\n      cursor: this.state.cursor,\n      onEdit: (editAction) => {\n        // Force a re-render\n        // This supports double-click where we need to ensure that there's a re-render between the two clicks\n        // even though the data wasn't changed, just the internal tentative feature.\n        this.setNeedsUpdate();\n        props.onEdit(editAction);\n      },\n      onUpdateCursor: (cursor: string | null | undefined) => {\n        this.setState({cursor});\n      }\n    };\n  }\n\n  selectionAwareAccessor(accessor: any) {\n    if (typeof accessor !== 'function') {\n      return accessor;\n    }\n    return (feature: Feature) =>\n      accessor(feature, this.isFeatureSelected(feature), this.props.mode);\n  }\n\n  isFeatureSelected(feature: Feature) {\n    if (!this.props.data || !this.props.selectedFeatureIndexes) {\n      return false;\n    }\n    if (!this.props.selectedFeatureIndexes.length) {\n      return false;\n    }\n\n    return this.state.selectedFeatures.includes(feature);\n  }\n\n  getPickingInfo({info, sourceLayer}: Record<string, any>) {\n    if (sourceLayer.id.endsWith('guides')) {\n      // If user is picking an editing handle, add additional data to the info\n      info.isGuide = true;\n    }\n\n    return info;\n  }\n\n  _updateAutoHighlight(info) {\n    // Extra handling for guides\n    if (info?.sourceLayer) {\n      if (info.isGuide) {\n        for (const layer of info.sourceLayer.getSubLayers()) {\n          layer.updateAutoHighlight(info);\n        }\n      } else {\n        info.sourceLayer.updateAutoHighlight(info);\n      }\n    }\n  }\n\n  createGuidesLayers() {\n    const mode = this.getActiveMode();\n    const guides: FeatureCollection = mode.getGuides(this.getModeProps(this.props));\n\n    if (!guides || !guides.features.length) {\n      return [];\n    }\n\n    const subLayerProps = {\n      linestrings: {\n        billboard: this.props.billboard,\n        autoHighlight: false\n      },\n      'polygons-fill': {\n        autoHighlight: false\n      },\n      'polygons-stroke': {\n        billboard: this.props.billboard\n      }\n    };\n\n    if (this.props.editHandleType === 'icon') {\n      subLayerProps['points-icon'] = {\n        type: IconLayer,\n        iconAtlas: this.props.editHandleIconAtlas,\n        iconMapping: this.props.editHandleIconMapping,\n        sizeUnits: this.props.editHandleIconSizeUnits,\n        sizeScale: this.props.editHandleIconSizeScale,\n        getIcon: guideAccessor(this.props.getEditHandleIcon),\n        getSize: guideAccessor(this.props.getEditHandleIconSize),\n        getColor: guideAccessor(this.props.getEditHandleIconColor),\n        getAngle: guideAccessor(this.props.getEditHandleIconAngle),\n        billboard: this.props.billboard\n      };\n    } else {\n      subLayerProps['points-circle'] = {\n        type: ScatterplotLayer,\n        radiusScale: this.props.editHandlePointRadiusScale,\n        stroked: this.props.editHandlePointOutline,\n        getLineWidth: this.props.editHandlePointStrokeWidth,\n        radiusUnits: this.props.editHandlePointRadiusUnits,\n        radiusMinPixels: this.props.editHandlePointRadiusMinPixels,\n        radiusMaxPixels: this.props.editHandlePointRadiusMaxPixels,\n        getRadius: guideAccessor(this.props.getEditHandlePointRadius),\n        getFillColor: guideAccessor(this.props.getEditHandlePointColor),\n        getLineColor: guideAccessor(this.props.getEditHandlePointOutlineColor),\n        billboard: this.props.billboard\n      };\n    }\n\n    const layer = new GeoJsonLayer(\n      this.getSubLayerProps({\n        id: 'guides',\n        data: guides,\n        fp64: this.props.fp64,\n        _subLayerProps: subLayerProps,\n        lineWidthScale: this.props.lineWidthScale,\n        lineWidthMinPixels: this.props.lineWidthMinPixels,\n        lineWidthMaxPixels: this.props.lineWidthMaxPixels,\n        lineWidthUnits: this.props.lineWidthUnits,\n        lineJointRounded: this.props.lineJointRounded,\n        lineCapRounded: this.props.lineCapRounded,\n        lineMiterLimit: this.props.lineMiterLimit,\n        getLineColor: guideAccessor(this.props.getTentativeLineColor),\n        getLineWidth: guideAccessor(this.props.getTentativeLineWidth),\n        getFillColor: guideAccessor(this.props.getTentativeFillColor),\n        pointType: this.props.editHandleType === 'icon' ? 'icon' : 'circle',\n        iconAtlas: this.props.editHandleIconAtlas\n      })\n    );\n\n    return [layer];\n  }\n\n  createTooltipsLayers() {\n    const mode = this.getActiveMode();\n    const tooltips = mode.getTooltips(this.getModeProps(this.props));\n\n    const layer = new TextLayer({\n      getSize: DEFAULT_TOOLTIP_FONT_SIZE,\n      ...this.getSubLayerProps({\n        id: 'tooltips',\n        data: tooltips\n      })\n    });\n\n    return [layer];\n  }\n\n  onLayerClick(event: ClickEvent): void {\n    this.getActiveMode().handleClick(event, this.getModeProps(this.props));\n  }\n\n  onLayerDoubleClick(event: DoubleClickEvent): void {\n    if (this.getActiveMode().handleDoubleClick) {\n      this.getActiveMode().handleDoubleClick(event, this.getModeProps(this.props));\n    }\n  }\n\n  onLayerKeyUp(event: KeyboardEvent): void {\n    this.getActiveMode().handleKeyUp(event, this.getModeProps(this.props));\n  }\n\n  onStartDragging(event: StartDraggingEvent): void {\n    this.getActiveMode().handleStartDragging(event, this.getModeProps(this.props));\n  }\n\n  onDragging(event: DraggingEvent): void {\n    this.getActiveMode().handleDragging(event, this.getModeProps(this.props));\n  }\n\n  onStopDragging(event: StopDraggingEvent): void {\n    this.getActiveMode().handleStopDragging(event, this.getModeProps(this.props));\n  }\n\n  onPointerMove(event: PointerMoveEvent): void {\n    this.setState({lastPointerMoveEvent: event});\n    this.getActiveMode().handlePointerMove(event, this.getModeProps(this.props));\n  }\n\n  getCursor({isDragging}: {isDragging: boolean}): null | 'grabbing' | 'grab' {\n    if (this.state === null || this.state === undefined) {\n      // Layer in 'Awaiting state'\n      return null;\n    }\n\n    let {cursor} = this.state;\n    if (!cursor) {\n      // default cursor\n      cursor = isDragging ? 'grabbing' : 'grab';\n    }\n    return cursor;\n  }\n\n  getActiveMode(): GeoJsonEditModeType {\n    return this.state.mode;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {featureCollection} from '@turf/helpers';\nimport turfUnion from '@turf/union';\nimport turfDifference from '@turf/difference';\nimport turfIntersect from '@turf/intersect';\nimport rewind from '@turf/rewind';\n\nimport {\n  EditAction,\n  ClickEvent,\n  PointerMoveEvent,\n  StartDraggingEvent,\n  StopDraggingEvent,\n  DraggingEvent,\n  Pick,\n  Tooltip,\n  ModeProps,\n  GuideFeatureCollection,\n  TentativeFeature\n} from './types';\nimport {\n  FeatureCollection,\n  Feature,\n  Polygon,\n  SimpleGeometry,\n  Position,\n  SimpleFeatureCollection,\n  SimpleFeature\n} from '../utils/geojson-types';\nimport {getPickedEditHandles, getNonGuidePicks} from './utils';\nimport {EditMode} from './edit-mode';\nimport {ImmutableFeatureCollection} from './immutable-feature-collection';\n\nexport type GeoJsonEditAction = EditAction<SimpleFeatureCollection>;\n\nconst DEFAULT_GUIDES: GuideFeatureCollection = {\n  type: 'FeatureCollection',\n  features: []\n};\nconst DEFAULT_TOOLTIPS: Tooltip[] = [];\n\n// Main interface for `EditMode`s that edit GeoJSON\nexport type GeoJsonEditModeType = EditMode<FeatureCollection, FeatureCollection>;\n\nexport interface GeoJsonEditModeConstructor {\n  new (): GeoJsonEditModeType;\n}\n\nexport class GeoJsonEditMode implements EditMode<FeatureCollection, GuideFeatureCollection> {\n  _clickSequence: Position[] = [];\n\n  getGuides(props: ModeProps<FeatureCollection>): GuideFeatureCollection {\n    return DEFAULT_GUIDES;\n  }\n\n  getTooltips(props: ModeProps<FeatureCollection>): Tooltip[] {\n    return DEFAULT_TOOLTIPS;\n  }\n\n  getSelectedFeature(props: ModeProps<SimpleFeatureCollection>): SimpleFeature | null | undefined {\n    if (props.selectedIndexes.length === 1) {\n      return props.data.features[props.selectedIndexes[0]];\n    }\n    return null;\n  }\n\n  getSelectedGeometry(\n    props: ModeProps<SimpleFeatureCollection>\n  ): SimpleGeometry | null | undefined {\n    const feature = this.getSelectedFeature(props);\n    if (feature) {\n      return feature.geometry;\n    }\n    return null;\n  }\n\n  getSelectedFeaturesAsFeatureCollection(\n    props: ModeProps<SimpleFeatureCollection>\n  ): SimpleFeatureCollection {\n    const {features} = props.data;\n    const selectedFeatures = props.selectedIndexes.map((selectedIndex) => features[selectedIndex]);\n    return {\n      type: 'FeatureCollection',\n      features: selectedFeatures\n    };\n  }\n\n  getClickSequence(): Position[] {\n    return this._clickSequence;\n  }\n\n  addClickSequence({mapCoords}: ClickEvent): void {\n    this._clickSequence.push(mapCoords);\n  }\n\n  resetClickSequence(): void {\n    this._clickSequence = [];\n  }\n\n  getTentativeGuide(props: ModeProps<FeatureCollection>): TentativeFeature | null | undefined {\n    const guides = this.getGuides(props);\n    return guides.features.find(\n      (f) => f.properties && f.properties.guideType === 'tentative'\n    ) as TentativeFeature;\n  }\n\n  isSelectionPicked(picks: Pick[], props: ModeProps<FeatureCollection>): boolean {\n    if (!picks.length) return false;\n    const pickedFeatures = getNonGuidePicks(picks).map(({index}) => index);\n    const pickedHandles = getPickedEditHandles(picks).map(\n      ({properties}) => properties.featureIndex\n    );\n    const pickedIndexes = new Set([...pickedFeatures, ...pickedHandles]);\n    return props.selectedIndexes.some((index) => pickedIndexes.has(index));\n  }\n\n  rewindPolygon(feature: SimpleFeature): SimpleFeature {\n    const {geometry} = feature;\n\n    const isPolygonal = geometry.type === 'Polygon' || geometry.type === 'MultiPolygon';\n    if (isPolygonal) {\n      return rewind(feature) as SimpleFeature;\n    }\n\n    return feature;\n  }\n\n  getAddFeatureAction(\n    featureOrGeometry: SimpleGeometry | Feature,\n    features: SimpleFeatureCollection,\n    featureProperties?: {}\n  ): GeoJsonEditAction {\n    // Unsure why flow can't deal with Geometry type, but there I fixed it\n    const featureOrGeometryAsAny: any = featureOrGeometry;\n    featureProperties = featureProperties || {};\n\n    const feature: any =\n      featureOrGeometryAsAny.type === 'Feature'\n        ? featureOrGeometryAsAny\n        : {\n            type: 'Feature',\n            properties: featureProperties,\n            geometry: featureOrGeometryAsAny\n          };\n\n    const rewindFeature = this.rewindPolygon(feature);\n    const updatedData = new ImmutableFeatureCollection(features)\n      .addFeature(rewindFeature)\n      .getObject();\n\n    return {\n      updatedData,\n      editType: 'addFeature',\n      editContext: {\n        featureIndexes: [updatedData.features.length - 1]\n      }\n    };\n  }\n\n  getAddManyFeaturesAction(\n    {features: featuresToAdd}: SimpleFeatureCollection,\n    features: SimpleFeatureCollection\n  ): GeoJsonEditAction {\n    let updatedData = new ImmutableFeatureCollection(features);\n    const initialIndex = updatedData.getObject().features.length;\n    const updatedIndexes: number[] = [];\n    for (const feature of featuresToAdd) {\n      const {properties, geometry} = feature;\n      const geometryAsAny: any = geometry;\n      updatedData = updatedData.addFeature({\n        type: 'Feature',\n        properties,\n        geometry: geometryAsAny\n      });\n      updatedIndexes.push(initialIndex + updatedIndexes.length);\n    }\n\n    return {\n      updatedData: updatedData.getObject(),\n      editType: 'addFeature',\n      editContext: {\n        featureIndexes: updatedIndexes\n      }\n    };\n  }\n\n  // eslint-disable-next-line complexity\n  getAddFeatureOrBooleanPolygonAction(\n    featureOrGeometry: Polygon | Feature,\n    props: ModeProps<SimpleFeatureCollection>,\n    featureProperties?: {}\n  ): GeoJsonEditAction | null | undefined {\n    const featureOrGeometryAsAny: any = featureOrGeometry;\n    featureProperties = featureProperties || {};\n\n    const selectedFeature = this.getSelectedFeature(props);\n    const {modeConfig} = props;\n    if (modeConfig && modeConfig.booleanOperation) {\n      if (\n        !selectedFeature ||\n        (selectedFeature.geometry.type !== 'Polygon' &&\n          selectedFeature.geometry.type !== 'MultiPolygon')\n      ) {\n        // eslint-disable-next-line no-console,no-undef\n        console.warn(\n          'booleanOperation only supported for single Polygon or MultiPolygon selection'\n        );\n        return null;\n      }\n\n      const feature =\n        featureOrGeometryAsAny.type === 'Feature'\n          ? featureOrGeometryAsAny\n          : {\n              type: 'Feature',\n              geometry: featureOrGeometryAsAny\n            };\n\n      let updatedGeometry;\n      if (modeConfig.booleanOperation === 'union') {\n        updatedGeometry = turfUnion(featureCollection([selectedFeature, feature]));\n      } else if (modeConfig.booleanOperation === 'difference') {\n        updatedGeometry = turfDifference(featureCollection([selectedFeature, feature]));\n      } else if (modeConfig.booleanOperation === 'intersection') {\n        updatedGeometry = turfIntersect(featureCollection([selectedFeature, feature]));\n      } else {\n        // eslint-disable-next-line no-console,no-undef\n        console.warn(`Invalid booleanOperation ${modeConfig.booleanOperation}`);\n        return null;\n      }\n\n      if (!updatedGeometry) {\n        // eslint-disable-next-line no-console,no-undef\n        console.warn('Canceling edit. Boolean operation erased entire polygon.');\n        return null;\n      }\n\n      const featureIndex = props.selectedIndexes[0];\n\n      const updatedData = new ImmutableFeatureCollection(props.data)\n        .replaceGeometry(featureIndex, updatedGeometry.geometry)\n        .getObject();\n\n      const editAction: GeoJsonEditAction = {\n        updatedData,\n        editType: 'unionGeometry',\n        editContext: {\n          featureIndexes: [featureIndex]\n        }\n      };\n\n      return editAction;\n    }\n    return this.getAddFeatureAction(featureOrGeometry, props.data, featureProperties);\n  }\n\n  createTentativeFeature(props: ModeProps<FeatureCollection>): TentativeFeature | null {\n    return null;\n  }\n\n  handleClick(event: ClickEvent, props: ModeProps<FeatureCollection>): void {}\n  handleDoubleClick(event: ClickEvent, props: ModeProps<FeatureCollection>): void {}\n\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>): void {\n    const tentativeFeature = this.createTentativeFeature(props);\n    if (tentativeFeature) {\n      props.onEdit({\n        updatedData: props.data,\n        editType: 'updateTentativeFeature',\n        editContext: {\n          feature: tentativeFeature\n        }\n      });\n    }\n  }\n  handleStartDragging(event: StartDraggingEvent, props: ModeProps<FeatureCollection>): void {}\n  handleStopDragging(event: StopDraggingEvent, props: ModeProps<FeatureCollection>): void {}\n  handleDragging(event: DraggingEvent, props: ModeProps<FeatureCollection>): void {}\n\n  handleKeyUp(event: KeyboardEvent, props: ModeProps<FeatureCollection>): void {\n    if (event.key === 'Escape') {\n      this.resetClickSequence();\n      props.onEdit({\n        // Because the new drawing feature is dropped, so the data will keep as the same.\n        updatedData: props.data,\n        editType: 'cancelFeature',\n        editContext: {}\n      });\n    }\n  }\n}\n\nexport function getIntermediatePosition(position1: Position, position2: Position): Position {\n  const intermediatePosition: Position = [\n    (position1[0] + position2[0]) / 2.0,\n    (position1[1] + position2[1]) / 2.0\n  ];\n\n  return intermediatePosition;\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable no-shadow */\n\nimport destination from '@turf/destination';\nimport bearing from '@turf/bearing';\nimport pointToLineDistance from '@turf/point-to-line-distance';\nimport {flattenEach} from '@turf/meta';\nimport {point} from '@turf/helpers';\nimport {getCoords} from '@turf/invariant';\nimport {WebMercatorViewport} from '@math.gl/web-mercator';\nimport {Viewport, Pick, EditHandleFeature, EditHandleType, StartDraggingEvent} from './types';\nimport {\n  SimpleGeometry,\n  Position,\n  Point,\n  LineString,\n  Polygon,\n  Feature,\n  SimpleGeometryCoordinates\n} from '../utils/geojson-types';\n\nexport type NearestPointType = Feature<Point, {dist: number; index: number}>;\n\nexport function toDeckColor(\n  color?: [number, number, number, number] | number,\n  defaultColor: [number, number, number, number] = [255, 0, 0, 255]\n): [number, number, number, number] {\n  if (!Array.isArray(color)) {\n    return defaultColor;\n  }\n  return [color[0] * 255, color[1] * 255, color[2] * 255, color[3] * 255];\n}\n\n//\n// a GeoJSON helper function that calls the provided function with\n// an argument that is the most deeply-nested array having elements\n// that are arrays of primitives as an argument, e.g.\n//\n// {\n//   \"type\": \"MultiPolygon\",\n//   \"coordinates\": [\n//       [\n//           [[30, 20], [45, 40], [10, 40], [30, 20]]\n//       ],\n//       [\n//           [[15, 5], [40, 10], [10, 20], [5, 10], [15, 5]]\n//       ]\n//   ]\n// }\n//\n// the function would be called on:\n//\n// [[30, 20], [45, 40], [10, 40], [30, 20]]\n//\n// and\n//\n// [[15, 5], [40, 10], [10, 20], [5, 10], [15, 5]]\n//\nexport function recursivelyTraverseNestedArrays(\n  array: Array<any>,\n  prefix: Array<number>,\n  fn: (array: Array<any>, prefix: number[]) => void\n) {\n  if (!Array.isArray(array[0])) {\n    return true;\n  }\n  for (let i = 0; i < array.length; i++) {\n    if (recursivelyTraverseNestedArrays(array[i], [...prefix, i], fn)) {\n      fn(array, prefix);\n      break;\n    }\n  }\n  return false;\n}\n\nexport function generatePointsParallelToLinePoints(\n  p1: Position,\n  p2: Position,\n  coords: Position\n): Position[] {\n  const lineString: LineString = {\n    type: 'LineString',\n    coordinates: [p1, p2]\n  };\n  const pt = point(coords);\n  const ddistance = pointToLineDistance(pt, lineString);\n  const lineBearing = bearing(p1, p2);\n\n  // Check if current point is to the left or right of line\n  // Line from A=(x1,y1) to B=(x2,y2) a point P=(x,y)\n  // then (x\u2212x1)(y2\u2212y1)\u2212(y\u2212y1)(x2\u2212x1)\n  const isPointToLeftOfLine =\n    (coords[0] - p1[0]) * (p2[1] - p1[1]) - (coords[1] - p1[1]) * (p2[0] - p1[0]);\n\n  // Bearing to draw perpendicular to the line string\n  const orthogonalBearing = isPointToLeftOfLine < 0 ? lineBearing - 90 : lineBearing - 270;\n\n  // Get coordinates for the point p3 and p4 which are perpendicular to the lineString\n  // Add the distance as the current position moves away from the lineString\n  const p3 = destination(p2, ddistance, orthogonalBearing);\n  const p4 = destination(p1, ddistance, orthogonalBearing);\n\n  return [p3.geometry.coordinates, p4.geometry.coordinates] as Position[];\n}\n\nexport function distance2d(x1: number, y1: number, x2: number, y2: number): number {\n  const dx = x1 - x2;\n  const dy = y1 - y2;\n  return Math.sqrt(dx * dx + dy * dy);\n}\n\nexport function mix(a: number, b: number, ratio: number): number {\n  return b * ratio + a * (1 - ratio);\n}\n\nexport function nearestPointOnProjectedLine(\n  line: Feature<LineString>,\n  inPoint: Feature<Point>,\n  viewport: Viewport\n): NearestPointType {\n  const wmViewport = new WebMercatorViewport(viewport);\n  // Project the line to viewport, then find the nearest point\n  const coordinates: Array<Array<number>> = line.geometry.coordinates as any;\n  const projectedCoords = coordinates.map(([x, y, z = 0]) => wmViewport.project([x, y, z]));\n  const [x, y] = wmViewport.project(inPoint.geometry.coordinates);\n  // console.log('projectedCoords', JSON.stringify(projectedCoords));\n\n  let minDistance = Infinity;\n  let minPointInfo = {};\n\n  projectedCoords.forEach(([x2, y2], index) => {\n    if (index === 0) {\n      return;\n    }\n\n    const [x1, y1] = projectedCoords[index - 1];\n\n    // line from projectedCoords[index - 1] to projectedCoords[index]\n    // convert to Ax + By + C = 0\n    const A = y1 - y2;\n    const B = x2 - x1;\n    const C = x1 * y2 - x2 * y1;\n\n    // https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line\n    const div = A * A + B * B;\n    const distance = Math.abs(A * x + B * y + C) / Math.sqrt(div);\n\n    // TODO: Check if inside bounds\n\n    if (distance < minDistance) {\n      minDistance = distance;\n      minPointInfo = {\n        index,\n        x0: (B * (B * x - A * y) - A * C) / div,\n        y0: (A * (-B * x + A * y) - B * C) / div\n      };\n    }\n  });\n  // @ts-expect-error TODO\n  const {index, x0, y0} = minPointInfo;\n  const [x1, y1, z1 = 0] = projectedCoords[index - 1];\n  const [x2, y2, z2 = 0] = projectedCoords[index];\n\n  // calculate what ratio of the line we are on to find the proper z\n  const lineLength = distance2d(x1, y1, x2, y2);\n  const startToPointLength = distance2d(x1, y1, x0, y0);\n  const ratio = startToPointLength / lineLength;\n  const z0 = mix(z1, z2, ratio);\n\n  return {\n    type: 'Feature',\n    geometry: {\n      type: 'Point',\n      coordinates: wmViewport.unproject([x0, y0, z0])\n    },\n    properties: {\n      // TODO: calculate the distance in proper units\n      dist: minDistance,\n      index: index - 1\n    }\n  };\n}\n\nexport function nearestPointOnLine( // <G extends LineString | MultiLineString>(\n  lines: Feature<LineString>,\n  inPoint: Feature<Point>,\n  viewport?: Viewport\n): NearestPointType {\n  let mercator;\n\n  if (viewport) {\n    mercator = new WebMercatorViewport(viewport);\n  }\n  let closestPoint: any = point([Infinity, Infinity], {\n    dist: Infinity\n  });\n\n  if (!lines.geometry?.coordinates.length || lines.geometry?.coordinates.length < 2) {\n    return closestPoint;\n  }\n\n  // eslint-disable-next-line max-statements, complexity\n  flattenEach(lines, (line: any) => {\n    const coords: any = getCoords(line);\n    const pointCoords: any = getCoords(inPoint);\n\n    let minDist;\n    let to;\n    let from;\n    let x;\n    let y;\n    let segmentIdx;\n    let dist;\n\n    if (coords.length > 1 && pointCoords.length) {\n      let lineCoordinates;\n      let pointCoordinate;\n\n      // If viewport is given, then translate these coordinates to pixels to increase precision\n      if (mercator) {\n        lineCoordinates = coords.map((lineCoordinate) => mercator.project(lineCoordinate));\n        pointCoordinate = mercator.project(pointCoords);\n      } else {\n        lineCoordinates = coords;\n        pointCoordinate = pointCoords;\n      }\n\n      for (let n = 1; n < lineCoordinates.length; n++) {\n        if (lineCoordinates[n][0] !== lineCoordinates[n - 1][0]) {\n          const slope =\n            (lineCoordinates[n][1] - lineCoordinates[n - 1][1]) /\n            (lineCoordinates[n][0] - lineCoordinates[n - 1][0]);\n          const inverseSlope = lineCoordinates[n][1] - slope * lineCoordinates[n][0];\n\n          dist =\n            Math.abs(slope * pointCoordinate[0] + inverseSlope - pointCoordinate[1]) /\n            Math.sqrt(slope * slope + 1);\n        } else dist = Math.abs(pointCoordinate[0] - lineCoordinates[n][0]);\n\n        // length^2 of line segment\n        const rl2 =\n          Math.pow(lineCoordinates[n][1] - lineCoordinates[n - 1][1], 2) +\n          Math.pow(lineCoordinates[n][0] - lineCoordinates[n - 1][0], 2);\n\n        // distance^2 of pt to end line segment\n        const ln2 =\n          Math.pow(lineCoordinates[n][1] - pointCoordinate[1], 2) +\n          Math.pow(lineCoordinates[n][0] - pointCoordinate[0], 2);\n\n        // distance^2 of pt to begin line segment\n        const lnm12 =\n          Math.pow(lineCoordinates[n - 1][1] - pointCoordinate[1], 2) +\n          Math.pow(lineCoordinates[n - 1][0] - pointCoordinate[0], 2);\n\n        // minimum distance^2 of pt to infinite line\n        const dist2 = Math.pow(dist, 2);\n\n        // calculated length^2 of line segment\n        const calcrl2 = ln2 - dist2 + lnm12 - dist2;\n\n        // redefine minimum distance to line segment (not infinite line) if necessary\n        if (calcrl2 > rl2) {\n          dist = Math.sqrt(Math.min(ln2, lnm12));\n        }\n\n        if (minDist === null || minDist === undefined || minDist > dist) {\n          // eslint-disable-next-line max-depth\n          if (calcrl2 > rl2) {\n            // eslint-disable-next-line max-depth\n            if (lnm12 < ln2) {\n              to = 0; // nearer to previous point\n              from = 1;\n            } else {\n              from = 0; // nearer to current point\n              to = 1;\n            }\n          } else {\n            // perpendicular from point intersects line segment\n            to = Math.sqrt(lnm12 - dist2) / Math.sqrt(rl2);\n            from = Math.sqrt(ln2 - dist2) / Math.sqrt(rl2);\n          }\n          minDist = dist;\n          segmentIdx = n;\n        }\n      }\n\n      const dx = lineCoordinates[segmentIdx - 1][0] - lineCoordinates[segmentIdx][0];\n      const dy = lineCoordinates[segmentIdx - 1][1] - lineCoordinates[segmentIdx][1];\n\n      x = lineCoordinates[segmentIdx - 1][0] - dx * to;\n      y = lineCoordinates[segmentIdx - 1][1] - dy * to;\n    }\n\n    // index needs to be -1 because we have to account for the shift from initial backscan\n    let snapPoint = {x, y, idx: segmentIdx - 1, to, from};\n\n    if (mercator) {\n      const pixelToLatLong = mercator.unproject([snapPoint.x, snapPoint.y]);\n      snapPoint = {\n        x: pixelToLatLong[0],\n        y: pixelToLatLong[1],\n        idx: segmentIdx - 1,\n        to,\n        from\n      };\n    }\n\n    closestPoint = point([snapPoint.x, snapPoint.y], {\n      dist: Math.abs(snapPoint.from - snapPoint.to),\n      index: snapPoint.idx\n    });\n  });\n\n  return closestPoint;\n}\n\nexport function getPickedEditHandle(\n  picks: Pick[] | null | undefined\n): EditHandleFeature | null | undefined {\n  const handles = getPickedEditHandles(picks);\n  return handles.length ? handles[0] : null;\n}\n\nexport function getPickedSnapSourceEditHandle(\n  picks: Pick[] | null | undefined\n): EditHandleFeature | null | undefined {\n  const handles = getPickedEditHandles(picks);\n  return handles.find((handle) => handle.properties.editHandleType === 'snap-source');\n}\n\nexport function getNonGuidePicks(picks: Pick[]): Pick[] {\n  return picks && picks.filter((pick) => !pick.isGuide);\n}\n\nexport function getPickedExistingEditHandle(\n  picks: Pick[] | null | undefined\n): EditHandleFeature | null | undefined {\n  const handles = getPickedEditHandles(picks);\n  return handles.find(\n    ({properties}) => properties.featureIndex >= 0 && properties.editHandleType === 'existing'\n  );\n}\n\nexport function getPickedIntermediateEditHandle(\n  picks: Pick[] | null | undefined\n): EditHandleFeature | null | undefined {\n  const handles = getPickedEditHandles(picks);\n  return handles.find(\n    ({properties}) => properties.featureIndex >= 0 && properties.editHandleType === 'intermediate'\n  );\n}\n\nexport function getPickedEditHandles(picks: Pick[] | null | undefined): EditHandleFeature[] {\n  const handles =\n    (picks &&\n      picks\n        .filter((pick) => pick.isGuide && pick.object.properties.guideType === 'editHandle')\n        .map((pick) => pick.object)) ||\n    [];\n\n  return handles;\n}\n\nexport function getEditHandlesForGeometry(\n  geometry: SimpleGeometry,\n  featureIndex: number,\n  editHandleType: EditHandleType = 'existing'\n): EditHandleFeature[] {\n  let handles: EditHandleFeature[] = [];\n\n  switch (geometry.type) {\n    case 'Point':\n      // positions are not nested\n      handles = [\n        {\n          type: 'Feature',\n          properties: {\n            guideType: 'editHandle',\n            editHandleType,\n            positionIndexes: [],\n            featureIndex\n          },\n          geometry: {\n            type: 'Point',\n            coordinates: geometry.coordinates\n          }\n        }\n      ];\n      break;\n    case 'MultiPoint':\n    case 'LineString':\n      // positions are nested 1 level\n      handles = handles.concat(\n        getEditHandlesForCoordinates(geometry.coordinates, [], featureIndex, editHandleType)\n      );\n      break;\n    case 'Polygon':\n    case 'MultiLineString':\n      // positions are nested 2 levels\n      for (let a = 0; a < geometry.coordinates.length; a++) {\n        handles = handles.concat(\n          getEditHandlesForCoordinates(geometry.coordinates[a], [a], featureIndex, editHandleType)\n        );\n        if (geometry.type === 'Polygon') {\n          // Don't repeat the first/last handle for Polygons\n          handles = handles.slice(0, -1);\n        }\n      }\n\n      break;\n    case 'MultiPolygon':\n      // positions are nested 3 levels\n      for (let a = 0; a < geometry.coordinates.length; a++) {\n        for (let b = 0; b < geometry.coordinates[a].length; b++) {\n          handles = handles.concat(\n            getEditHandlesForCoordinates(\n              geometry.coordinates[a][b],\n              [a, b],\n              featureIndex,\n              editHandleType\n            )\n          );\n          // Don't repeat the first/last handle for Polygons\n          handles = handles.slice(0, -1);\n        }\n      }\n\n      break;\n    default:\n      throw Error(`Unhandled geometry type: ${(geometry as {type: string}).type}`);\n  }\n\n  return handles;\n}\n\nfunction getEditHandlesForCoordinates(\n  coordinates: any[],\n  positionIndexPrefix: number[],\n  featureIndex: number,\n  editHandleType: EditHandleType = 'existing'\n): EditHandleFeature[] {\n  const editHandles: EditHandleFeature[] = [];\n  for (let i = 0; i < coordinates.length; i++) {\n    const position = coordinates[i] as Position;\n    editHandles.push({\n      type: 'Feature',\n      properties: {\n        guideType: 'editHandle',\n        positionIndexes: [...positionIndexPrefix, i],\n        featureIndex,\n        editHandleType\n      },\n      geometry: {\n        type: 'Point',\n        coordinates: position\n      }\n    });\n  }\n  return editHandles;\n}\n\n/**\n * Calculates coordinates for a feature preserving rectangular shape.\n * @param feature Feature before modification.\n * @param editHandleIndex Index of the point to modify.\n * @param coords New position for the point.\n * @returns Updated coordinates.\n */\nexport function updateRectanglePosition(\n  feature: Feature<Polygon>,\n  editHandleIndex: number,\n  coords: Position\n): Position[][] | null {\n  const coordinates = feature.geometry.coordinates;\n  if (!coordinates) {\n    return null;\n  }\n\n  const points = coordinates[0].slice(0, 4);\n  points[editHandleIndex % 4] = coords;\n\n  const p0 = points[(editHandleIndex + 2) % 4];\n  const p2 = points[editHandleIndex % 4];\n  points[(editHandleIndex + 1) % 4] = [p2[0], p0[1]];\n  points[(editHandleIndex + 3) % 4] = [p0[0], p2[1]];\n\n  return [[...points, points[0]]];\n}\n\n/** Creates a copy of feature's coordinates.\n * Each position in coordinates is transformed by calling the provided function.\n * @param coords Coordinates of a feature.\n * @param callback A function to transform each coordinate.\n * @retuns Transformed coordinates.\n */\nexport function mapCoords(\n  coords: SimpleGeometryCoordinates,\n  callback: (coords: Position) => Position\n): SimpleGeometryCoordinates {\n  if (typeof coords[0] === 'number') {\n    if (!isNaN(coords[0]) && isFinite(coords[0])) {\n      return callback(coords as Position);\n    }\n    return coords;\n  }\n\n  return (coords as Position[])\n    .map((coord) => {\n      return mapCoords(coord, callback) as Position;\n    })\n    .filter(Boolean);\n}\n\nexport function shouldCancelPan(event: StartDraggingEvent) {\n  return event.picks.length && event.picks.find((p) => p.featureType === 'points');\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n  SimpleFeatureCollection,\n  SimpleGeometry,\n  Polygon,\n  MultiLineString,\n  MultiPolygon,\n  Position,\n  SimpleFeature\n} from '../utils/geojson-types';\n\nexport class ImmutableFeatureCollection {\n  featureCollection: Readonly<SimpleFeatureCollection>;\n\n  constructor(featureCollection: SimpleFeatureCollection) {\n    this.featureCollection = featureCollection;\n  }\n\n  getObject() {\n    return this.featureCollection;\n  }\n\n  /**\n   * Replaces the position deeply nested withing the given feature's geometry.\n   * Works with Point, MultiPoint, LineString, MultiLineString, Polygon, and MultiPolygon.\n   *\n   * @param featureIndex The index of the feature to update\n   * @param positionIndexes An array containing the indexes of the position to replace\n   * @param updatedPosition The updated position to place in the result (i.e. [lng, lat])\n   *\n   * @returns A new `ImmutableFeatureCollection` with the given position replaced. Does not modify this `ImmutableFeatureCollection`.\n   */\n  replacePosition(\n    featureIndex: number,\n    positionIndexes: number[] | null | undefined,\n    updatedPosition: Position\n  ): ImmutableFeatureCollection {\n    const geometry = this.featureCollection.features[featureIndex].geometry;\n\n    const isPolygonal = geometry.type === 'Polygon' || geometry.type === 'MultiPolygon';\n    const updatedGeometry: any = {\n      ...geometry,\n      coordinates: immutablyReplacePosition(\n        geometry.coordinates,\n        positionIndexes,\n        updatedPosition,\n        isPolygonal\n      )\n    };\n\n    return this.replaceGeometry(featureIndex, updatedGeometry);\n  }\n\n  /**\n   * Removes a position deeply nested in a GeoJSON geometry coordinates array.\n   * Works with MultiPoint, LineString, MultiLineString, Polygon, and MultiPolygon.\n   *\n   * @param featureIndex The index of the feature to update\n   * @param positionIndexes An array containing the indexes of the postion to remove\n   *\n   * @returns A new `ImmutableFeatureCollection` with the given coordinate removed. Does not modify this `ImmutableFeatureCollection`.\n   *\n   */\n  // eslint-disable-next-line complexity\n  removePosition(\n    featureIndex: number,\n    positionIndexes: number[] | null | undefined\n  ): ImmutableFeatureCollection {\n    const geometry = this.featureCollection.features[featureIndex].geometry;\n\n    if (geometry.type === 'Point') {\n      throw Error(\"Can't remove a position from a Point or there'd be nothing left\");\n    }\n    if (\n      geometry.type === 'MultiPoint' && // only 1 point left\n      geometry.coordinates.length < 2\n    ) {\n      throw Error(\"Can't remove the last point of a MultiPoint or there'd be nothing left\");\n    }\n    if (\n      geometry.type === 'LineString' && // only 2 positions\n      geometry.coordinates.length < 3\n    ) {\n      throw Error(\"Can't remove position. LineString must have at least two positions\");\n    }\n    if (\n      geometry.type === 'Polygon' && // outer ring is a triangle\n      geometry.coordinates[0].length < 5 &&\n      Array.isArray(positionIndexes) && // trying to remove from outer ring\n      positionIndexes[0] === 0\n    ) {\n      throw Error(\"Can't remove position. Polygon's outer ring must have at least four positions\");\n    }\n    if (\n      geometry.type === 'MultiLineString' && // only 1 LineString left\n      geometry.coordinates.length === 1 && // only 2 positions\n      geometry.coordinates[0].length < 3\n    ) {\n      throw Error(\"Can't remove position. MultiLineString must have at least two positions\");\n    }\n    if (\n      geometry.type === 'MultiPolygon' && // only 1 polygon left\n      geometry.coordinates.length === 1 && // outer ring is a triangle\n      geometry.coordinates[0][0].length < 5 &&\n      Array.isArray(positionIndexes) && // trying to remove from first polygon\n      positionIndexes[0] === 0 && // trying to remove from outer ring\n      positionIndexes[1] === 0\n    ) {\n      throw Error(\n        \"Can't remove position. MultiPolygon's outer ring must have at least four positions\"\n      );\n    }\n\n    const isPolygonal = geometry.type === 'Polygon' || geometry.type === 'MultiPolygon';\n    const updatedGeometry: any = {\n      ...geometry,\n      coordinates: immutablyRemovePosition(geometry.coordinates, positionIndexes, isPolygonal)\n    };\n\n    // Handle cases where incomplete geometries need pruned (e.g. holes that were triangles)\n    pruneGeometryIfNecessary(updatedGeometry);\n\n    return this.replaceGeometry(featureIndex, updatedGeometry);\n  }\n\n  /**\n   * Adds a position deeply nested in a GeoJSON geometry coordinates array.\n   * Works with MultiPoint, LineString, MultiLineString, Polygon, and MultiPolygon.\n   *\n   * @param featureIndex The index of the feature to update\n   * @param positionIndexes An array containing the indexes of the position that will proceed the new position\n   * @param positionToAdd The new position to place in the result (i.e. [lng, lat])\n   *\n   * @returns A new `ImmutableFeatureCollection` with the given coordinate removed. Does not modify this `ImmutableFeatureCollection`.\n   */\n  addPosition(\n    featureIndex: number,\n    positionIndexes: number[] | null | undefined,\n    positionToAdd: Position\n  ): ImmutableFeatureCollection {\n    const geometry = this.featureCollection.features[featureIndex].geometry;\n\n    if (geometry.type === 'Point') {\n      throw new Error('Unable to add a position to a Point feature');\n    }\n\n    const isPolygonal = geometry.type === 'Polygon' || geometry.type === 'MultiPolygon';\n    const updatedGeometry: any = {\n      ...geometry,\n      coordinates: immutablyAddPosition(\n        geometry.coordinates,\n        positionIndexes,\n        positionToAdd,\n        isPolygonal\n      )\n    };\n\n    return this.replaceGeometry(featureIndex, updatedGeometry);\n  }\n\n  replaceGeometry(featureIndex: number, geometry: SimpleGeometry): ImmutableFeatureCollection {\n    const updatedFeature: any = {\n      ...this.featureCollection.features[featureIndex],\n      geometry\n    };\n\n    const updatedFeatureCollection = {\n      ...this.featureCollection,\n      features: [\n        ...this.featureCollection.features.slice(0, featureIndex),\n        updatedFeature,\n        ...this.featureCollection.features.slice(featureIndex + 1)\n      ]\n    };\n\n    return new ImmutableFeatureCollection(updatedFeatureCollection);\n  }\n\n  addFeature(feature: SimpleFeature): ImmutableFeatureCollection {\n    return this.addFeatures([feature]);\n  }\n\n  addFeatures(features: SimpleFeature[]): ImmutableFeatureCollection {\n    const updatedFeatureCollection = {\n      ...this.featureCollection,\n      features: [...this.featureCollection.features, ...features]\n    };\n\n    return new ImmutableFeatureCollection(updatedFeatureCollection);\n  }\n\n  deleteFeature(featureIndex: number) {\n    return this.deleteFeatures([featureIndex]);\n  }\n\n  deleteFeatures(featureIndexes: number[]) {\n    const features = [...this.featureCollection.features];\n    featureIndexes.sort();\n    for (let i = featureIndexes.length - 1; i >= 0; i--) {\n      const featureIndex = featureIndexes[i];\n      if (featureIndex >= 0 && featureIndex < features.length) {\n        features.splice(featureIndex, 1);\n      }\n    }\n\n    const updatedFeatureCollection = {\n      ...this.featureCollection,\n      features\n    };\n\n    return new ImmutableFeatureCollection(updatedFeatureCollection);\n  }\n}\n\nfunction getUpdatedPosition(updatedPosition: Position, previousPosition: Position): Position {\n  // This function checks if the updatedPosition is missing elevation\n  // and copies it from previousPosition\n  if (updatedPosition.length === 2 && previousPosition.length === 3) {\n    const elevation = (previousPosition as any)[2];\n    return [updatedPosition[0], updatedPosition[1], elevation];\n  }\n\n  return updatedPosition;\n}\n\nfunction immutablyReplacePosition(\n  coordinates: any,\n  positionIndexes: number[] | null | undefined,\n  updatedPosition: Position,\n  isPolygonal: boolean\n): any {\n  if (!positionIndexes) {\n    return coordinates;\n  }\n  if (positionIndexes.length === 0) {\n    return getUpdatedPosition(updatedPosition, coordinates);\n  }\n  if (positionIndexes.length === 1) {\n    const updated = [\n      ...coordinates.slice(0, positionIndexes[0]),\n      getUpdatedPosition(updatedPosition, coordinates[positionIndexes[0]]),\n      ...coordinates.slice(positionIndexes[0] + 1)\n    ];\n\n    if (\n      isPolygonal &&\n      (positionIndexes[0] === 0 || positionIndexes[0] === coordinates.length - 1)\n    ) {\n      // for polygons, the first point is repeated at the end of the array\n      // so, update it on both ends of the array\n      updated[0] = getUpdatedPosition(updatedPosition, coordinates[0]);\n      updated[coordinates.length - 1] = getUpdatedPosition(updatedPosition, coordinates[0]);\n    }\n    return updated;\n  }\n\n  // recursively update inner array\n  return [\n    ...coordinates.slice(0, positionIndexes[0]),\n    immutablyReplacePosition(\n      coordinates[positionIndexes[0]],\n      positionIndexes.slice(1, positionIndexes.length),\n      updatedPosition,\n      isPolygonal\n    ),\n    ...coordinates.slice(positionIndexes[0] + 1)\n  ];\n}\n\nfunction immutablyRemovePosition(\n  coordinates: any,\n  positionIndexes: number[] | null | undefined,\n  isPolygonal: boolean\n): any {\n  if (!positionIndexes) {\n    return coordinates;\n  }\n  if (positionIndexes.length === 0) {\n    throw Error('Must specify the index of the position to remove');\n  }\n  if (positionIndexes.length === 1) {\n    const updated = [\n      ...coordinates.slice(0, positionIndexes[0]),\n      ...coordinates.slice(positionIndexes[0] + 1)\n    ];\n\n    if (\n      isPolygonal &&\n      (positionIndexes[0] === 0 || positionIndexes[0] === coordinates.length - 1)\n    ) {\n      // for polygons, the first point is repeated at the end of the array\n      // so, if the first/last coordinate is to be removed, coordinates[1] will be the new first/last coordinate\n      if (positionIndexes[0] === 0) {\n        // change the last to be the same as the first\n        updated[updated.length - 1] = updated[0];\n      } else if (positionIndexes[0] === coordinates.length - 1) {\n        // change the first to be the same as the last\n        updated[0] = updated[updated.length - 1];\n      }\n    }\n    return updated;\n  }\n\n  // recursively update inner array\n  return [\n    ...coordinates.slice(0, positionIndexes[0]),\n    immutablyRemovePosition(\n      coordinates[positionIndexes[0]],\n      positionIndexes.slice(1, positionIndexes.length),\n      isPolygonal\n    ),\n    ...coordinates.slice(positionIndexes[0] + 1)\n  ];\n}\n\nfunction immutablyAddPosition(\n  coordinates: any,\n  positionIndexes: number[] | null | undefined,\n  positionToAdd: Position,\n  isPolygonal: boolean\n): any {\n  if (!positionIndexes) {\n    return coordinates;\n  }\n  if (positionIndexes.length === 0) {\n    throw Error('Must specify the index of the position to remove');\n  }\n  if (positionIndexes.length === 1) {\n    const updated = [\n      ...coordinates.slice(0, positionIndexes[0]),\n      positionToAdd,\n      ...coordinates.slice(positionIndexes[0])\n    ];\n    return updated;\n  }\n\n  // recursively update inner array\n  return [\n    ...coordinates.slice(0, positionIndexes[0]),\n    immutablyAddPosition(\n      coordinates[positionIndexes[0]],\n      positionIndexes.slice(1, positionIndexes.length),\n      positionToAdd,\n      isPolygonal\n    ),\n    ...coordinates.slice(positionIndexes[0] + 1)\n  ];\n}\n\nfunction pruneGeometryIfNecessary(geometry: SimpleGeometry) {\n  switch (geometry.type) {\n    case 'Polygon':\n      prunePolygonIfNecessary(geometry);\n      break;\n    case 'MultiLineString':\n      pruneMultiLineStringIfNecessary(geometry);\n      break;\n    case 'MultiPolygon':\n      pruneMultiPolygonIfNecessary(geometry);\n      break;\n    default:\n      // Not downgradable\n      break;\n  }\n}\n\nfunction prunePolygonIfNecessary(geometry: Polygon) {\n  const polygon = geometry.coordinates;\n\n  // If any hole is no longer a polygon, remove the hole entirely\n  for (let holeIndex = 1; holeIndex < polygon.length; holeIndex++) {\n    if (removeHoleIfNecessary(polygon, holeIndex)) {\n      // It was removed, so keep the index the same\n      holeIndex--;\n    }\n  }\n}\n\nfunction pruneMultiLineStringIfNecessary(geometry: MultiLineString) {\n  for (let lineStringIndex = 0; lineStringIndex < geometry.coordinates.length; lineStringIndex++) {\n    const lineString = geometry.coordinates[lineStringIndex];\n    if (lineString.length === 1) {\n      // Only a single position left on this LineString, so remove it (can't have Point in MultiLineString)\n      geometry.coordinates.splice(lineStringIndex, 1);\n      // Keep the index the same\n      lineStringIndex--;\n    }\n  }\n}\n\nfunction pruneMultiPolygonIfNecessary(geometry: MultiPolygon) {\n  for (let polygonIndex = 0; polygonIndex < geometry.coordinates.length; polygonIndex++) {\n    const polygon = geometry.coordinates[polygonIndex];\n    const outerRing = polygon[0];\n\n    // If the outer ring is no longer a polygon, remove the whole polygon\n    if (outerRing.length <= 3) {\n      geometry.coordinates.splice(polygonIndex, 1);\n      // It was removed, so keep the index the same\n      polygonIndex--;\n    }\n\n    for (let holeIndex = 1; holeIndex < polygon.length; holeIndex++) {\n      if (removeHoleIfNecessary(polygon, holeIndex)) {\n        // It was removed, so keep the index the same\n        holeIndex--;\n      }\n    }\n  }\n}\n\nfunction removeHoleIfNecessary(polygon: Polygon['coordinates'], holeIndex: number) {\n  const hole = polygon[holeIndex];\n  if (hole.length <= 3) {\n    polygon.splice(holeIndex, 1);\n    return true;\n  }\n  return false;\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {GeoJsonEditMode} from './geojson-edit-mode';\n\nexport class ViewMode extends GeoJsonEditMode {}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport turfBearing from '@turf/bearing';\nimport turfDistance from '@turf/distance';\nimport clone from '@turf/clone';\nimport {point} from '@turf/helpers';\nimport {WebMercatorViewport} from '@math.gl/web-mercator';\nimport {\n  FeatureCollection,\n  Position,\n  SimpleGeometry,\n  SimpleFeatureCollection\n} from '../utils/geojson-types';\nimport {\n  PointerMoveEvent,\n  StartDraggingEvent,\n  StopDraggingEvent,\n  DraggingEvent,\n  ModeProps\n} from './types';\nimport {mapCoords} from './utils';\nimport {translateFromCenter} from '../utils/translate-from-center';\nimport {GeoJsonEditMode, GeoJsonEditAction} from './geojson-edit-mode';\nimport {ImmutableFeatureCollection} from './immutable-feature-collection';\n\nexport class TranslateMode extends GeoJsonEditMode {\n  _geometryBeforeTranslate: SimpleFeatureCollection | null | undefined;\n  _isTranslatable: boolean = undefined!;\n\n  handleDragging(event: DraggingEvent, props: ModeProps<SimpleFeatureCollection>) {\n    if (!this._isTranslatable) {\n      // Nothing to do\n      return;\n    }\n\n    if (this._geometryBeforeTranslate) {\n      // Translate the geometry\n      const editAction = this.getTranslateAction(\n        event.pointerDownMapCoords,\n        event.mapCoords,\n        'translating',\n        props\n      );\n\n      if (editAction) {\n        props.onEdit(editAction);\n      }\n    }\n\n    // cancel map panning\n    event.cancelPan();\n  }\n\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>) {\n    this._isTranslatable = this.isSelectionPicked(event.pointerDownPicks || event.picks, props);\n\n    this.updateCursor(props);\n  }\n\n  handleStartDragging(event: StartDraggingEvent, props: ModeProps<SimpleFeatureCollection>) {\n    if (!this._isTranslatable) {\n      return;\n    }\n\n    event.cancelPan();\n    this._geometryBeforeTranslate = this.getSelectedFeaturesAsFeatureCollection(props);\n  }\n\n  handleStopDragging(event: StopDraggingEvent, props: ModeProps<SimpleFeatureCollection>) {\n    if (this._geometryBeforeTranslate) {\n      // Translate the geometry\n      const editAction = this.getTranslateAction(\n        event.pointerDownMapCoords,\n        event.mapCoords,\n        'translated',\n        props\n      );\n\n      if (editAction) {\n        props.onEdit(editAction);\n      }\n\n      this._geometryBeforeTranslate = null;\n    }\n  }\n\n  updateCursor(props: ModeProps<FeatureCollection>) {\n    if (this._isTranslatable) {\n      props.onUpdateCursor('move');\n    } else {\n      props.onUpdateCursor(null);\n    }\n  }\n\n  // eslint-disable-next-line max-statements\n  getTranslateAction(\n    startDragPoint: Position,\n    currentPoint: Position,\n    editType: string,\n    props: ModeProps<SimpleFeatureCollection>\n  ): GeoJsonEditAction | null | undefined {\n    if (!this._geometryBeforeTranslate) {\n      return null;\n    }\n\n    let updatedData = new ImmutableFeatureCollection(props.data);\n    const selectedIndexes = props.selectedIndexes;\n\n    const {viewport: viewportDesc, screenSpace} = props.modeConfig || {};\n\n    // move features without adapting to mercator projection\n    if (viewportDesc && screenSpace) {\n      const viewport = viewportDesc.project ? viewportDesc : new WebMercatorViewport(viewportDesc);\n\n      const from = viewport.project(startDragPoint);\n      const to = viewport.project(currentPoint);\n      const dx = to[0] - from[0];\n      const dy = to[1] - from[1];\n\n      for (let i = 0; i < selectedIndexes.length; i++) {\n        const selectedIndex = selectedIndexes[i];\n        const feature = this._geometryBeforeTranslate.features[i];\n\n        let coordinates = feature.geometry.coordinates;\n        if (coordinates) {\n          coordinates = mapCoords(coordinates, (coord) => {\n            const pixels = viewport.project(coord);\n            if (pixels) {\n              pixels[0] += dx;\n              pixels[1] += dy;\n              return viewport.unproject(pixels);\n            }\n            return null;\n          });\n\n          updatedData = updatedData.replaceGeometry(selectedIndex, {\n            type: feature.geometry.type,\n            coordinates\n          } as SimpleGeometry);\n        }\n      }\n    } else {\n      const p1 = point(startDragPoint);\n      const p2 = point(currentPoint);\n\n      const distanceMoved = turfDistance(p1, p2);\n      const direction = turfBearing(p1, p2);\n\n      const movedFeatures = this._geometryBeforeTranslate.features.map((feature) =>\n        translateFromCenter(clone(feature), distanceMoved, direction)\n      );\n\n      for (let i = 0; i < selectedIndexes.length; i++) {\n        const selectedIndex = selectedIndexes[i];\n        const movedFeature = movedFeatures[i];\n        updatedData = updatedData.replaceGeometry(selectedIndex, movedFeature.geometry);\n      }\n    }\n\n    return {\n      updatedData: updatedData.getObject(),\n      editType,\n      editContext: {\n        featureIndexes: selectedIndexes\n      }\n    };\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport turfCenter from '@turf/center';\nimport turfRhumbBearing from '@turf/rhumb-bearing';\nimport turfRhumbDistance from '@turf/rhumb-distance';\nimport turfRhumbDestination from '@turf/rhumb-destination';\nimport {mapCoords} from '../edit-modes/utils';\nimport type {SimpleFeature} from './geojson-types';\n\n// This function takes feature's center, moves it,\n// and builds new feature around it keeping the proportions\nexport function translateFromCenter(feature: SimpleFeature, distance: number, direction: number) {\n  const initialCenterPoint = turfCenter(feature);\n\n  const movedCenterPoint = turfRhumbDestination(initialCenterPoint, distance, direction);\n\n  const movedCoordinates = mapCoords(feature.geometry.coordinates, (coordinate) => {\n    const rhumbDistance = turfRhumbDistance(initialCenterPoint.geometry.coordinates, coordinate);\n    const rhumbDirection = turfRhumbBearing(initialCenterPoint.geometry.coordinates, coordinate);\n\n    const movedPosition = turfRhumbDestination(\n      movedCenterPoint.geometry.coordinates,\n      rhumbDistance,\n      rhumbDirection\n    ).geometry.coordinates;\n    return movedPosition;\n  });\n\n  feature.geometry.coordinates = movedCoordinates;\n\n  return feature;\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {point, lineString as toLineString} from '@turf/helpers';\nimport {\n  recursivelyTraverseNestedArrays,\n  nearestPointOnProjectedLine,\n  nearestPointOnLine,\n  getEditHandlesForGeometry,\n  getPickedEditHandles,\n  getPickedEditHandle,\n  getPickedExistingEditHandle,\n  getPickedIntermediateEditHandle,\n  updateRectanglePosition,\n  NearestPointType,\n  shouldCancelPan\n} from './utils';\nimport {\n  LineString,\n  Point,\n  Polygon,\n  FeatureCollection,\n  Feature,\n  SimpleFeatureCollection\n} from '../utils/geojson-types';\nimport {\n  ModeProps,\n  ClickEvent,\n  PointerMoveEvent,\n  StartDraggingEvent,\n  StopDraggingEvent,\n  DraggingEvent,\n  Viewport,\n  GuideFeatureCollection,\n  EditHandleFeature,\n  GuideFeature\n} from './types';\nimport {GeoJsonEditMode} from './geojson-edit-mode';\nimport {ImmutableFeatureCollection} from './immutable-feature-collection';\n\nexport class ModifyMode extends GeoJsonEditMode {\n  // eslint-disable-next-line complexity\n  getGuides(props: ModeProps<SimpleFeatureCollection>): GuideFeatureCollection {\n    const handles: GuideFeature[] = [];\n\n    const {data, lastPointerMoveEvent} = props;\n    const {features} = data;\n    const picks = lastPointerMoveEvent && lastPointerMoveEvent.picks;\n    const mapCoords = lastPointerMoveEvent && lastPointerMoveEvent.mapCoords;\n\n    for (const index of props.selectedIndexes) {\n      if (index < features.length) {\n        const {geometry} = features[index];\n        handles.push(...getEditHandlesForGeometry(geometry, index));\n      } else {\n        console.warn(`selectedFeatureIndexes out of range ${index}`); // eslint-disable-line no-console,no-undef\n      }\n    }\n\n    // intermediate edit handle\n    if (picks && picks.length && mapCoords) {\n      const existingEditHandle = getPickedExistingEditHandle(picks);\n      // don't show intermediate point when too close to an existing edit handle\n      const featureAsPick = !existingEditHandle && picks.find((pick) => !pick.isGuide);\n\n      // is the feature in the pick selected\n      if (\n        featureAsPick &&\n        !featureAsPick.object.geometry.type.includes('Point') &&\n        !(\n          props.modeConfig?.lockRectangles && featureAsPick.object.properties.shape === 'Rectangle'\n        ) &&\n        props.selectedIndexes.includes(featureAsPick.index)\n      ) {\n        let intermediatePoint: NearestPointType | null | undefined = null;\n        let positionIndexPrefix: number[] = [];\n        const referencePoint = point(mapCoords);\n        // process all lines of the (single) feature\n        recursivelyTraverseNestedArrays(\n          featureAsPick.object.geometry.coordinates,\n          [],\n          (lineString, prefix) => {\n            const lineStringFeature = toLineString(lineString);\n            const candidateIntermediatePoint = this.getNearestPoint(\n              lineStringFeature,\n              referencePoint,\n              props.modeConfig && props.modeConfig.viewport\n            );\n            if (\n              !intermediatePoint ||\n              candidateIntermediatePoint.properties.dist < intermediatePoint.properties.dist\n            ) {\n              intermediatePoint = candidateIntermediatePoint;\n              positionIndexPrefix = prefix;\n            }\n          }\n        );\n        // tack on the lone intermediate point to the set of handles\n        if (intermediatePoint) {\n          const {\n            geometry: {coordinates: position},\n            properties: {index}\n          } = intermediatePoint;\n          handles.push({\n            type: 'Feature',\n            properties: {\n              guideType: 'editHandle',\n              editHandleType: 'intermediate',\n              featureIndex: featureAsPick.index,\n              positionIndexes: [...positionIndexPrefix, index + 1]\n            },\n            geometry: {\n              type: 'Point',\n              coordinates: position\n            }\n          });\n        }\n      }\n    }\n\n    return {\n      type: 'FeatureCollection',\n      features: handles\n    };\n  }\n\n  // turf.js does not support elevation for nearestPointOnLine\n  getNearestPoint(\n    line: Feature<LineString>,\n    inPoint: Feature<Point>,\n    viewport: Viewport | null | undefined\n  ): NearestPointType {\n    const {coordinates} = line.geometry;\n    if (coordinates.some((coord) => coord.length > 2)) {\n      if (viewport) {\n        // This line has elevation, we need to use alternative algorithm\n        return nearestPointOnProjectedLine(line, inPoint, viewport);\n      }\n      // eslint-disable-next-line no-console,no-undef\n      console.log(\n        'Editing 3D point but modeConfig.viewport not provided. Falling back to 2D logic.'\n      );\n    }\n    return nearestPointOnLine(line, inPoint, viewport);\n  }\n\n  handleClick(event: ClickEvent, props: ModeProps<SimpleFeatureCollection>) {\n    const pickedExistingHandle = getPickedExistingEditHandle(event.picks);\n    const pickedIntermediateHandle = getPickedIntermediateEditHandle(event.picks);\n\n    if (pickedExistingHandle) {\n      const {featureIndex, positionIndexes} = pickedExistingHandle.properties;\n\n      const feature = props.data.features[featureIndex];\n      const canRemovePosition = !(\n        props.modeConfig?.lockRectangles && feature?.properties.shape === 'Rectangle'\n      );\n      if (canRemovePosition) {\n        let updatedData;\n        try {\n          updatedData = new ImmutableFeatureCollection(props.data)\n            .removePosition(featureIndex, positionIndexes)\n            .getObject();\n        } catch (ignored) {\n          // This happens if user attempts to remove the last point\n        }\n\n        if (updatedData) {\n          props.onEdit({\n            updatedData,\n            editType: 'removePosition',\n            editContext: {\n              featureIndexes: [featureIndex],\n              positionIndexes,\n              position: pickedExistingHandle.geometry.coordinates\n            }\n          });\n        }\n      }\n    } else if (pickedIntermediateHandle) {\n      const {featureIndex, positionIndexes} = pickedIntermediateHandle.properties;\n\n      const feature = props.data.features[featureIndex];\n      const canAddPosition = !(\n        props.modeConfig?.lockRectangles && feature?.properties.shape === 'Rectangle'\n      );\n\n      if (canAddPosition) {\n        const updatedData = new ImmutableFeatureCollection(props.data)\n          .addPosition(featureIndex, positionIndexes, pickedIntermediateHandle.geometry.coordinates)\n          .getObject();\n\n        if (updatedData) {\n          props.onEdit({\n            updatedData,\n            editType: 'addPosition',\n            editContext: {\n              featureIndexes: [featureIndex],\n              positionIndexes,\n              position: pickedIntermediateHandle.geometry.coordinates\n            }\n          });\n        }\n      }\n    }\n  }\n\n  handleDragging(event: DraggingEvent, props: ModeProps<SimpleFeatureCollection>): void {\n    const editHandle = getPickedEditHandle(event.pointerDownPicks);\n\n    if (editHandle) {\n      // Cancel map panning if pointer went down on an edit handle\n      event.cancelPan();\n\n      this._dragEditHandle('movePosition', props, editHandle, event);\n    }\n  }\n\n  _dragEditHandle(\n    editType: string,\n    props: ModeProps<SimpleFeatureCollection>,\n    editHandle: EditHandleFeature,\n    event: StopDraggingEvent | DraggingEvent\n  ) {\n    const editHandleProperties = editHandle.properties;\n    const editedFeature = props.data.features[editHandleProperties.featureIndex];\n\n    let updatedData;\n    if (props.modeConfig?.lockRectangles && editedFeature.properties.shape === 'Rectangle') {\n      const coordinates = updateRectanglePosition(\n        editedFeature as Feature<Polygon>,\n        editHandleProperties.positionIndexes[1],\n        event.mapCoords\n      ) as any; // TODO\n\n      updatedData = new ImmutableFeatureCollection(props.data)\n        .replaceGeometry(editHandleProperties.featureIndex, {coordinates, type: 'Polygon'})\n        .getObject();\n    } else {\n      updatedData = new ImmutableFeatureCollection(props.data)\n        .replacePosition(\n          editHandleProperties.featureIndex,\n          editHandleProperties.positionIndexes,\n          event.mapCoords\n        )\n        .getObject();\n    }\n\n    props.onEdit({\n      updatedData,\n      editType,\n      editContext: {\n        featureIndexes: [editHandleProperties.featureIndex],\n        positionIndexes: editHandleProperties.positionIndexes,\n        position: event.mapCoords\n      }\n    });\n  }\n\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>): void {\n    const cursor = this.getCursor(event);\n    props.onUpdateCursor(cursor);\n  }\n\n  handleStartDragging(event: StartDraggingEvent, props: ModeProps<SimpleFeatureCollection>) {\n    if (shouldCancelPan(event)) {\n      event.cancelPan();\n    }\n\n    const selectedFeatureIndexes = props.selectedIndexes;\n\n    const editHandle = getPickedIntermediateEditHandle(event.picks);\n    if (selectedFeatureIndexes.length && editHandle) {\n      const editHandleProperties = editHandle.properties;\n\n      const updatedData = new ImmutableFeatureCollection(props.data)\n        .addPosition(\n          editHandleProperties.featureIndex,\n          editHandleProperties.positionIndexes,\n          event.mapCoords\n        )\n        .getObject();\n\n      props.onEdit({\n        updatedData,\n        editType: 'addPosition',\n        editContext: {\n          featureIndexes: [editHandleProperties.featureIndex],\n          positionIndexes: editHandleProperties.positionIndexes,\n          position: event.mapCoords\n        }\n      });\n    }\n  }\n\n  handleStopDragging(event: StopDraggingEvent, props: ModeProps<SimpleFeatureCollection>) {\n    const selectedFeatureIndexes = props.selectedIndexes;\n    const editHandle = getPickedEditHandle(event.pointerDownPicks);\n    if (selectedFeatureIndexes.length && editHandle) {\n      this._dragEditHandle('finishMovePosition', props, editHandle, event);\n    }\n  }\n\n  getCursor(event: PointerMoveEvent): string | null | undefined {\n    const picks = (event && event.picks) || [];\n\n    const handlesPicked = getPickedEditHandles(picks);\n    if (handlesPicked.length) {\n      return 'cell';\n    }\n    return null;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport bbox from '@turf/bbox';\nimport turfCentroid from '@turf/centroid';\nimport turfBearing from '@turf/bearing';\nimport bboxPolygon from '@turf/bbox-polygon';\nimport {point, featureCollection} from '@turf/helpers';\nimport {polygonToLine} from '@turf/polygon-to-line';\nimport {coordEach} from '@turf/meta';\nimport turfDistance from '@turf/distance';\nimport turfTransformScale from '@turf/transform-scale';\nimport {getCoord, getGeom} from '@turf/invariant';\nimport {FeatureCollection, Position, SimpleFeatureCollection} from '../utils/geojson-types';\nimport {\n  ModeProps,\n  PointerMoveEvent,\n  StartDraggingEvent,\n  StopDraggingEvent,\n  DraggingEvent,\n  EditHandleFeature,\n  GuideFeatureCollection\n} from './types';\nimport {getPickedEditHandle} from './utils';\nimport {GeoJsonEditMode} from './geojson-edit-mode';\nimport {ImmutableFeatureCollection} from './immutable-feature-collection';\n\nexport class ScaleMode extends GeoJsonEditMode {\n  _geometryBeingScaled: SimpleFeatureCollection | null | undefined;\n  _selectedEditHandle: EditHandleFeature | null | undefined;\n  _cornerGuidePoints: Array<EditHandleFeature> = [];\n  _cursor: string | null | undefined;\n  _isScaling = false;\n\n  _isSinglePointGeometrySelected = (geometry: FeatureCollection | null | undefined): boolean => {\n    const {features} = geometry || {};\n    if (Array.isArray(features) && features.length === 1) {\n      const {type}: {type: string} = getGeom(features[0]);\n      return type === 'Point';\n    }\n    return false;\n  };\n\n  _getOppositeScaleHandle = (selectedHandle: EditHandleFeature): EditHandleFeature | null => {\n    const selectedHandleIndex =\n      selectedHandle &&\n      selectedHandle.properties &&\n      Array.isArray(selectedHandle.properties.positionIndexes) &&\n      selectedHandle.properties.positionIndexes[0];\n\n    if (typeof selectedHandleIndex !== 'number') {\n      return null;\n    }\n    const guidePointCount = this._cornerGuidePoints.length;\n    const oppositeIndex = (selectedHandleIndex + guidePointCount / 2) % guidePointCount;\n    return (\n      this._cornerGuidePoints.find((p) => {\n        if (!Array.isArray(p.properties.positionIndexes)) {\n          return false;\n        }\n        return p.properties.positionIndexes[0] === oppositeIndex;\n      }) || null\n    );\n  };\n\n  _getUpdatedData = (\n    props: ModeProps<SimpleFeatureCollection>,\n    editedData: SimpleFeatureCollection\n  ) => {\n    let updatedData = new ImmutableFeatureCollection(props.data);\n    const selectedIndexes = props.selectedIndexes;\n    for (let i = 0; i < selectedIndexes.length; i++) {\n      const selectedIndex = selectedIndexes[i];\n      const movedFeature = editedData.features[i];\n      updatedData = updatedData.replaceGeometry(selectedIndex, movedFeature.geometry);\n    }\n    return updatedData.getObject();\n  };\n\n  isEditHandleSelected = (): boolean => Boolean(this._selectedEditHandle);\n\n  getScaleAction = (\n    startDragPoint: Position,\n    currentPoint: Position,\n    editType: string,\n    props: ModeProps<SimpleFeatureCollection>\n  ) => {\n    if (!this._selectedEditHandle) {\n      return null;\n    }\n\n    const oppositeHandle = this._getOppositeScaleHandle(this._selectedEditHandle);\n    const origin = getCoord(oppositeHandle) as Position;\n\n    const scaleFactor = getScaleFactor(origin, startDragPoint, currentPoint);\n\n    const scaledFeatures = turfTransformScale(this._geometryBeingScaled, scaleFactor, {origin});\n\n    return {\n      updatedData: this._getUpdatedData(props, scaledFeatures),\n      editType,\n      editContext: {\n        featureIndexes: props.selectedIndexes\n      }\n    };\n  };\n\n  updateCursor = (props: ModeProps<SimpleFeatureCollection>) => {\n    if (this._selectedEditHandle) {\n      if (this._cursor) {\n        props.onUpdateCursor(this._cursor);\n      }\n      const cursorGeometry = this.getSelectedFeaturesAsFeatureCollection(props);\n\n      // Get resize cursor direction from the hovered scale editHandle (e.g. nesw or nwse)\n      const centroid = turfCentroid(cursorGeometry);\n      const bearing = turfBearing(centroid, this._selectedEditHandle);\n      const positiveBearing = bearing < 0 ? bearing + 180 : bearing;\n      if (\n        (positiveBearing >= 0 && positiveBearing <= 90) ||\n        (positiveBearing >= 180 && positiveBearing <= 270)\n      ) {\n        this._cursor = 'nesw-resize';\n        props.onUpdateCursor('nesw-resize');\n      } else {\n        this._cursor = 'nwse-resize';\n        props.onUpdateCursor('nwse-resize');\n      }\n    } else {\n      props.onUpdateCursor(null);\n      this._cursor = null;\n    }\n  };\n\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<SimpleFeatureCollection>) {\n    if (!this._isScaling) {\n      const selectedEditHandle = getPickedEditHandle(event.picks);\n      this._selectedEditHandle =\n        selectedEditHandle && selectedEditHandle.properties.editHandleType === 'scale'\n          ? selectedEditHandle\n          : null;\n\n      this.updateCursor(props);\n    }\n  }\n\n  handleStartDragging(event: StartDraggingEvent, props: ModeProps<SimpleFeatureCollection>) {\n    if (this._selectedEditHandle) {\n      event.cancelPan();\n      this._isScaling = true;\n      this._geometryBeingScaled = this.getSelectedFeaturesAsFeatureCollection(props);\n    }\n  }\n\n  handleDragging(event: DraggingEvent, props: ModeProps<SimpleFeatureCollection>) {\n    if (!this._isScaling) {\n      return;\n    }\n\n    props.onUpdateCursor(this._cursor);\n\n    const scaleAction = this.getScaleAction(\n      event.pointerDownMapCoords,\n      event.mapCoords,\n      'scaling',\n      props\n    );\n    if (scaleAction) {\n      props.onEdit(scaleAction);\n    }\n\n    event.cancelPan();\n  }\n\n  handleStopDragging(event: StopDraggingEvent, props: ModeProps<SimpleFeatureCollection>) {\n    if (this._isScaling) {\n      // Scale the geometry\n      const scaleAction = this.getScaleAction(\n        event.pointerDownMapCoords,\n        event.mapCoords,\n        'scaled',\n        props\n      );\n      if (scaleAction) {\n        props.onEdit(scaleAction);\n      }\n\n      props.onUpdateCursor(null);\n\n      this._geometryBeingScaled = null;\n      this._selectedEditHandle = null;\n      this._cursor = null;\n      this._isScaling = false;\n    }\n  }\n\n  getGuides(props: ModeProps<SimpleFeatureCollection>): GuideFeatureCollection {\n    this._cornerGuidePoints = [];\n    const selectedGeometry = this.getSelectedFeaturesAsFeatureCollection(props);\n\n    // Add buffer to the enveloping box if a single Point feature is selected\n    if (this._isSinglePointGeometrySelected(selectedGeometry)) {\n      return {type: 'FeatureCollection', features: []};\n    }\n\n    const boundingBox = bboxPolygon(bbox(selectedGeometry));\n    boundingBox.properties.mode = 'scale';\n    const cornerGuidePoints: EditHandleFeature[] = [];\n\n    coordEach(boundingBox, (coord, coordIndex) => {\n      if (coordIndex < 4) {\n        // Get corner midpoint guides from the enveloping box\n        const cornerPoint = point(coord, {\n          guideType: 'editHandle',\n          editHandleType: 'scale',\n          positionIndexes: [coordIndex]\n        });\n        cornerGuidePoints.push(cornerPoint as EditHandleFeature);\n      }\n    });\n\n    this._cornerGuidePoints = cornerGuidePoints;\n    // @ts-expect-error turf types diff\n    return featureCollection([polygonToLine(boundingBox), ...this._cornerGuidePoints]);\n  }\n}\n\nfunction getScaleFactor(centroid: Position, startDragPoint: Position, currentPoint: Position) {\n  const startDistance = turfDistance(centroid, startDragPoint);\n  const endDistance = turfDistance(centroid, currentPoint);\n  return endDistance / startDistance;\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport bbox from '@turf/bbox';\nimport turfCentroid from '@turf/centroid';\nimport turfBearing from '@turf/bearing';\nimport bboxPolygon from '@turf/bbox-polygon';\nimport turfDistance from '@turf/distance';\nimport {coordEach} from '@turf/meta';\nimport {getGeom} from '@turf/invariant';\nimport {point, featureCollection, lineString} from '@turf/helpers';\nimport turfTransformRotate from '@turf/transform-rotate';\nimport {polygonToLine} from '@turf/polygon-to-line';\nimport {\n  PointerMoveEvent,\n  StartDraggingEvent,\n  StopDraggingEvent,\n  DraggingEvent,\n  ModeProps,\n  EditHandleFeature,\n  GuideFeatureCollection\n} from './types';\nimport {getPickedEditHandle} from './utils';\nimport {FeatureCollection, Position, SimpleFeatureCollection} from '../utils/geojson-types';\nimport {GeoJsonEditMode, GeoJsonEditAction, getIntermediatePosition} from './geojson-edit-mode';\nimport {ImmutableFeatureCollection} from './immutable-feature-collection';\n\nexport class RotateMode extends GeoJsonEditMode {\n  _selectedEditHandle: EditHandleFeature | null | undefined;\n  _geometryBeingRotated: SimpleFeatureCollection | null | undefined;\n  _isRotating = false;\n\n  _isSinglePointGeometrySelected = (geometry: FeatureCollection | null | undefined): boolean => {\n    const {features} = geometry || {};\n    if (Array.isArray(features) && features.length === 1) {\n      const {type}: {type: string} = getGeom(features[0]);\n      return type === 'Point';\n    }\n    return false;\n  };\n\n  getIsRotating = () => this._isRotating;\n\n  getGuides(props: ModeProps<SimpleFeatureCollection>): GuideFeatureCollection {\n    const selectedGeometry =\n      this._geometryBeingRotated || this.getSelectedFeaturesAsFeatureCollection(props);\n\n    if (this._isSinglePointGeometrySelected(selectedGeometry)) {\n      return {type: 'FeatureCollection', features: []};\n    }\n\n    if (this._isRotating) {\n      // Display rotate pivot\n      return featureCollection([turfCentroid(selectedGeometry)]) as GuideFeatureCollection;\n    }\n\n    const boundingBox = bboxPolygon(bbox(selectedGeometry));\n\n    let previousCoord: Position | null = null;\n    let topEdgeMidpointCoords: Position | null = null;\n    let longestEdgeLength = 0;\n\n    coordEach(boundingBox, (coord: any) => {\n      if (previousCoord) {\n        const edgeMidpoint = getIntermediatePosition(coord, previousCoord);\n        if (!topEdgeMidpointCoords || edgeMidpoint[1] > topEdgeMidpointCoords[1]) {\n          // Get the top edge midpoint of the enveloping box\n          topEdgeMidpointCoords = edgeMidpoint;\n        }\n        // Get the length of the longest edge of the enveloping box\n        const edgeDistance = turfDistance(coord, previousCoord);\n        longestEdgeLength = Math.max(longestEdgeLength, edgeDistance);\n      }\n      previousCoord = coord;\n    });\n\n    // Scale the length of the line between the rotate handler and the enveloping box\n    // relative to the length of the longest edge of the enveloping box\n    const rotateHandleCoords = topEdgeMidpointCoords && [\n      topEdgeMidpointCoords[0],\n      topEdgeMidpointCoords[1] + longestEdgeLength / 1000\n    ];\n\n    const lineFromEnvelopeToRotateHandle = lineString([topEdgeMidpointCoords, rotateHandleCoords]);\n    const rotateHandle = point(rotateHandleCoords, {\n      guideType: 'editHandle',\n      editHandleType: 'rotate'\n    });\n\n    const outFeatures = [polygonToLine(boundingBox), rotateHandle, lineFromEnvelopeToRotateHandle];\n\n    // @ts-expect-error turf type diff\n    return featureCollection(outFeatures);\n  }\n\n  handleDragging(event: DraggingEvent, props: ModeProps<SimpleFeatureCollection>) {\n    if (!this._isRotating) {\n      return;\n    }\n\n    const rotateAction = this.getRotateAction(\n      event.pointerDownMapCoords,\n      event.mapCoords,\n      'rotating',\n      props\n    );\n    if (rotateAction) {\n      props.onEdit(rotateAction);\n    }\n\n    event.cancelPan();\n  }\n\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>) {\n    if (!this._isRotating) {\n      const selectedEditHandle = getPickedEditHandle(event.picks);\n      this._selectedEditHandle =\n        selectedEditHandle && selectedEditHandle.properties.editHandleType === 'rotate'\n          ? selectedEditHandle\n          : null;\n    }\n\n    this.updateCursor(props);\n  }\n\n  handleStartDragging(event: StartDraggingEvent, props: ModeProps<SimpleFeatureCollection>) {\n    if (this._selectedEditHandle) {\n      event.cancelPan();\n      this._isRotating = true;\n      this._geometryBeingRotated = this.getSelectedFeaturesAsFeatureCollection(props);\n    }\n  }\n\n  handleStopDragging(event: StopDraggingEvent, props: ModeProps<SimpleFeatureCollection>) {\n    if (this._isRotating) {\n      // Rotate the geometry\n      const rotateAction = this.getRotateAction(\n        event.pointerDownMapCoords,\n        event.mapCoords,\n        'rotated',\n        props\n      );\n\n      if (rotateAction) {\n        props.onEdit(rotateAction);\n      }\n\n      this._geometryBeingRotated = null;\n      this._selectedEditHandle = null;\n      this._isRotating = false;\n    }\n  }\n\n  updateCursor(props: ModeProps<FeatureCollection>) {\n    if (this._selectedEditHandle) {\n      // TODO: look at doing SVG cursors to get a better \"rotate\" cursor\n      props.onUpdateCursor('crosshair');\n    } else {\n      props.onUpdateCursor(null);\n    }\n  }\n\n  getRotateAction(\n    startDragPoint: Position,\n    currentPoint: Position,\n    editType: string,\n    props: ModeProps<SimpleFeatureCollection>\n  ): GeoJsonEditAction | null | undefined {\n    if (!this._geometryBeingRotated) {\n      return null;\n    }\n    const centroid = turfCentroid(this._geometryBeingRotated);\n    const angle = getRotationAngle(centroid.geometry.coordinates, startDragPoint, currentPoint);\n    const rotatedFeatures = turfTransformRotate(this._geometryBeingRotated, angle, {\n      pivot: centroid\n    });\n\n    let updatedData = new ImmutableFeatureCollection(props.data);\n\n    const selectedIndexes = props.selectedIndexes;\n    for (let i = 0; i < selectedIndexes.length; i++) {\n      const selectedIndex = selectedIndexes[i];\n      const movedFeature = rotatedFeatures.features[i];\n      updatedData = updatedData.replaceGeometry(selectedIndex, movedFeature.geometry);\n    }\n\n    return {\n      updatedData: updatedData.getObject(),\n      editType,\n      editContext: {\n        featureIndexes: selectedIndexes\n      }\n    };\n  }\n}\n\nfunction getRotationAngle(centroid: Position, startDragPoint: Position, currentPoint: Position) {\n  const bearing1 = turfBearing(centroid, startDragPoint);\n  const bearing2 = turfBearing(centroid, currentPoint);\n  return bearing2 - bearing1;\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {StartDraggingEvent, ModeProps} from './types';\nimport {FeatureCollection, SimpleFeatureCollection} from '../utils/geojson-types';\nimport {TranslateMode} from './translate-mode';\n\nexport class DuplicateMode extends TranslateMode {\n  handleStartDragging(event: StartDraggingEvent, props: ModeProps<SimpleFeatureCollection>) {\n    super.handleStartDragging(event, props);\n\n    if (this._geometryBeforeTranslate) {\n      props.onEdit(this.getAddManyFeaturesAction(this._geometryBeforeTranslate, props.data));\n    }\n  }\n\n  updateCursor(props: ModeProps<FeatureCollection>) {\n    if (this._isTranslatable) {\n      props.onUpdateCursor('copy');\n    } else {\n      props.onUpdateCursor(null);\n    }\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport booleanPointInPolygon from '@turf/boolean-point-in-polygon';\nimport turfDifference from '@turf/difference';\nimport turfBuffer from '@turf/buffer';\nimport lineIntersect from '@turf/line-intersect';\nimport type {Point} from 'geojson';\nimport {feature as turfFeature, featureCollection, lineString} from '@turf/helpers';\nimport turfBearing from '@turf/bearing';\nimport turfDistance from '@turf/distance';\nimport turfDestination from '@turf/destination';\nimport turfPolygonToLine from '@turf/polygon-to-line';\nimport nearestPointOnLine from '@turf/nearest-point-on-line';\nimport {generatePointsParallelToLinePoints} from './utils';\nimport {FeatureCollection, PolygonGeometry, SimpleFeatureCollection} from '../utils/geojson-types';\nimport {\n  ClickEvent,\n  PointerMoveEvent,\n  ModeProps,\n  GuideFeatureCollection,\n  TentativeFeature\n} from './types';\nimport {GeoJsonEditMode, GeoJsonEditAction} from './geojson-edit-mode';\nimport {ImmutableFeatureCollection} from './immutable-feature-collection';\n\nexport class SplitPolygonMode extends GeoJsonEditMode {\n  calculateMapCoords(\n    clickSequence: any,\n    mapCoords: any,\n    props: ModeProps<SimpleFeatureCollection>\n  ) {\n    const modeConfig = props.modeConfig;\n    if (!modeConfig || !modeConfig.lock90Degree || !clickSequence.length) {\n      return mapCoords;\n    }\n    if (clickSequence.length === 1) {\n      // if first point is clicked, then find closest polygon point and build ~90deg vector\n      const firstPoint = clickSequence[0];\n      const selectedGeometry = this.getSelectedGeometry(props);\n      const feature = turfPolygonToLine(selectedGeometry as PolygonGeometry);\n\n      const lines = feature.type === 'FeatureCollection' ? feature.features : [feature];\n      let minDistance = Number.MAX_SAFE_INTEGER;\n      let closestPoint: ReturnType<typeof nearestPointOnLine> | null = null;\n      // If Multipolygon, then we should find nearest polygon line and stick split to it.\n      lines.forEach((line) => {\n        const snapPoint = nearestPointOnLine(line, firstPoint);\n        const distanceFromOrigin = turfDistance(snapPoint, firstPoint);\n        if (minDistance > distanceFromOrigin) {\n          minDistance = distanceFromOrigin;\n          closestPoint = snapPoint;\n        }\n      });\n\n      if (closestPoint) {\n        // closest point is used as 90degree entry to the polygon\n        const lastBearing = turfBearing(firstPoint, closestPoint);\n        const currentDistance = turfDistance(firstPoint, mapCoords, {units: 'meters'});\n        return turfDestination(firstPoint, currentDistance, lastBearing, {\n          units: 'meters'\n        }).geometry.coordinates;\n      }\n      return mapCoords;\n    }\n    // Allow only 90 degree turns\n    const lastPoint = clickSequence[clickSequence.length - 1];\n    const [approximatePoint] = generatePointsParallelToLinePoints(\n      clickSequence[clickSequence.length - 2],\n      lastPoint,\n      mapCoords\n    );\n    // align point with current ground\n    const nearestPt = nearestPointOnLine(lineString([lastPoint, approximatePoint]), mapCoords)\n      .geometry.coordinates;\n    return nearestPt;\n  }\n\n  getGuides(props: ModeProps<SimpleFeatureCollection>): GuideFeatureCollection {\n    const clickSequence = this.getClickSequence();\n\n    const guides: GuideFeatureCollection = {\n      type: 'FeatureCollection',\n      features: []\n    };\n\n    if (clickSequence.length === 0 || !props.lastPointerMoveEvent) {\n      // nothing to do yet\n      return guides;\n    }\n\n    const {mapCoords} = props.lastPointerMoveEvent;\n\n    guides.features.push({\n      type: 'Feature',\n      properties: {\n        guideType: 'tentative'\n      },\n      geometry: {\n        type: 'LineString',\n        coordinates: [...clickSequence, this.calculateMapCoords(clickSequence, mapCoords, props)]\n      }\n    });\n\n    return guides;\n  }\n\n  handleClick(event: ClickEvent, props: ModeProps<SimpleFeatureCollection>) {\n    const tentativeFeature = this.getTentativeGuide(props);\n\n    const selectedGeometry = this.getSelectedGeometry(props);\n\n    if (!selectedGeometry) {\n      // eslint-disable-next-line no-console,no-undef\n      console.warn('A polygon must be selected for splitting');\n      return;\n    }\n\n    const clickSequence = this.getClickSequence();\n    if (tentativeFeature && tentativeFeature.geometry.type === 'LineString') {\n      clickSequence.push(\n        tentativeFeature.geometry.coordinates[tentativeFeature.geometry.coordinates.length - 1]\n      );\n    } else {\n      this.addClickSequence(event);\n    }\n\n    const pt: Point = {\n      type: 'Point',\n      coordinates: clickSequence[clickSequence.length - 1]\n    };\n\n    const isPointInPolygon = booleanPointInPolygon(pt, selectedGeometry as PolygonGeometry);\n    if (clickSequence.length > 1 && tentativeFeature && !isPointInPolygon) {\n      this.resetClickSequence();\n      // @ts-expect-error narrow type\n      const isLineInterectingWithPolygon = lineIntersect(tentativeFeature, selectedGeometry);\n      if (isLineInterectingWithPolygon.features.length === 0) {\n        return;\n      }\n\n      const editAction = this.splitPolygon(tentativeFeature, props);\n\n      if (editAction) {\n        props.onEdit(editAction);\n      }\n    }\n  }\n\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>) {\n    props.onUpdateCursor('cell');\n  }\n\n  splitPolygon(tentativeFeature: TentativeFeature, props: ModeProps<SimpleFeatureCollection>) {\n    const selectedGeometry = this.getSelectedGeometry(props);\n    const featureIndex = props.selectedIndexes[0];\n    const modeConfig = props.modeConfig || {};\n\n    // Default gap in between the polygon\n    let {gap = 0.1, units = 'centimeters'} = modeConfig;\n    if (gap === 0) {\n      gap = 0.1;\n      units = 'centimeters';\n    }\n\n    const buffer = turfBuffer(tentativeFeature, gap, {units});\n    const updatedGeometry = turfDifference(\n      featureCollection([turfFeature(selectedGeometry as PolygonGeometry), buffer])\n    );\n    if (!updatedGeometry) {\n      // eslint-disable-next-line no-console,no-undef\n      console.warn('Canceling edit. Split Polygon erased');\n      return null;\n    }\n\n    const {type, coordinates} = updatedGeometry.geometry;\n    let updatedCoordinates: any[] = []; // TODO\n    if (type === 'Polygon') {\n      // Update the coordinates as per Multipolygon\n      updatedCoordinates = coordinates.map((c) => [c]);\n    } else {\n      // Handle Case when Multipolygon has holes\n      updatedCoordinates = coordinates.reduce((agg, prev) => {\n        prev.forEach((p) => {\n          // @ts-expect-error revisit coordinates type here\n          agg.push([p]);\n        });\n        return agg;\n      }, []);\n    }\n\n    // Update the type to Mulitpolygon\n    const updatedData = new ImmutableFeatureCollection(props.data).replaceGeometry(featureIndex, {\n      type: 'MultiPolygon',\n      coordinates: updatedCoordinates\n    });\n\n    const editAction: GeoJsonEditAction = {\n      updatedData: updatedData.getObject(),\n      editType: 'split',\n      editContext: {\n        featureIndexes: [featureIndex]\n      }\n    };\n\n    return editAction;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport bearing from '@turf/bearing';\nimport {\n  generatePointsParallelToLinePoints,\n  getPickedEditHandle,\n  getPickedIntermediateEditHandle,\n  shouldCancelPan\n} from './utils';\nimport {SimpleFeatureCollection} from '../utils/geojson-types';\nimport {ModeProps, StartDraggingEvent, StopDraggingEvent, DraggingEvent} from './types';\nimport {ModifyMode} from './modify-mode';\nimport {ImmutableFeatureCollection} from './immutable-feature-collection';\n\nexport class ExtrudeMode extends ModifyMode {\n  // this mode is busted =(\n\n  isPointAdded = false;\n\n  handleDragging(event: DraggingEvent, props: ModeProps<SimpleFeatureCollection>): void {\n    const editHandle = getPickedEditHandle(event.pointerDownPicks);\n\n    if (editHandle) {\n      const {featureIndex} = editHandle.properties;\n      let {positionIndexes} = editHandle.properties;\n\n      const size = this.coordinatesSize(positionIndexes, featureIndex, props.data);\n      positionIndexes = this.isPointAdded\n        ? this.nextPositionIndexes(positionIndexes, size)\n        : positionIndexes;\n      // p1 and p1 are end points for edge\n      const p1 = this.getPointForPositionIndexes(\n        this.prevPositionIndexes(positionIndexes, size),\n        featureIndex,\n        props.data\n      );\n      const p2 = this.getPointForPositionIndexes(positionIndexes, featureIndex, props.data);\n      if (p1 && p2) {\n        // p3 and p4 are end points for moving (extruding) edge\n        const [p3, p4] = generatePointsParallelToLinePoints(p1, p2, event.mapCoords);\n\n        const updatedData = new ImmutableFeatureCollection(props.data)\n          .replacePosition(featureIndex, this.prevPositionIndexes(positionIndexes, size), p4)\n          .replacePosition(featureIndex, positionIndexes, p3)\n          .getObject();\n\n        props.onEdit({\n          updatedData,\n          editType: 'extruding',\n          editContext: {\n            featureIndexes: [featureIndex],\n            positionIndexes: this.nextPositionIndexes(positionIndexes, size),\n            position: p3\n          }\n        });\n\n        event.cancelPan();\n      }\n    }\n  }\n\n  handleStartDragging(event: StartDraggingEvent, props: ModeProps<SimpleFeatureCollection>) {\n    if (shouldCancelPan(event)) {\n      event.cancelPan();\n    }\n\n    const selectedFeatureIndexes = props.selectedIndexes;\n\n    const editHandle = getPickedIntermediateEditHandle(event.picks);\n    if (selectedFeatureIndexes.length && editHandle) {\n      const {positionIndexes, featureIndex} = editHandle.properties;\n\n      const size = this.coordinatesSize(positionIndexes, featureIndex, props.data);\n      // p1 and p1 are end points for edge\n      const p1 = this.getPointForPositionIndexes(\n        this.prevPositionIndexes(positionIndexes, size),\n        featureIndex,\n        props.data\n      );\n      const p2 = this.getPointForPositionIndexes(positionIndexes, featureIndex, props.data);\n\n      if (p1 && p2) {\n        let updatedData = new ImmutableFeatureCollection(props.data);\n        if (!this.isOrthogonal(positionIndexes, featureIndex, size, props.data)) {\n          updatedData = updatedData.addPosition(featureIndex, positionIndexes, p2);\n        }\n        if (\n          !this.isOrthogonal(\n            this.prevPositionIndexes(positionIndexes, size),\n            featureIndex,\n            size,\n            props.data\n          )\n        ) {\n          updatedData = updatedData.addPosition(featureIndex, positionIndexes, p1);\n          this.isPointAdded = true;\n        }\n\n        props.onEdit({\n          updatedData: updatedData.getObject(),\n          editType: 'startExtruding',\n          editContext: {\n            featureIndexes: [featureIndex],\n            positionIndexes,\n            position: p1\n          }\n        });\n      }\n    }\n  }\n\n  handleStopDragging(event: StopDraggingEvent, props: ModeProps<SimpleFeatureCollection>) {\n    const selectedFeatureIndexes = props.selectedIndexes;\n    const editHandle = getPickedEditHandle(event.pointerDownPicks);\n    if (selectedFeatureIndexes.length && editHandle) {\n      const {featureIndex} = editHandle.properties;\n      let {positionIndexes} = editHandle.properties;\n\n      const size = this.coordinatesSize(positionIndexes, featureIndex, props.data);\n      positionIndexes = this.isPointAdded\n        ? this.nextPositionIndexes(positionIndexes, size)\n        : positionIndexes;\n      // p1 and p1 are end points for edge\n      const p1 = this.getPointForPositionIndexes(\n        this.prevPositionIndexes(positionIndexes, size),\n        featureIndex,\n        props.data\n      );\n      const p2 = this.getPointForPositionIndexes(positionIndexes, featureIndex, props.data);\n\n      if (p1 && p2) {\n        // p3 and p4 are end points for new moved (extruded) edge\n        const [p3, p4] = generatePointsParallelToLinePoints(p1, p2, event.mapCoords);\n\n        const updatedData = new ImmutableFeatureCollection(props.data)\n          .replacePosition(featureIndex, this.prevPositionIndexes(positionIndexes, size), p4)\n          .replacePosition(featureIndex, positionIndexes, p3)\n          .getObject();\n\n        props.onEdit({\n          updatedData,\n          editType: 'extruded',\n          editContext: {\n            featureIndexes: [featureIndex],\n            positionIndexes,\n            position: p3\n          }\n        });\n      }\n    }\n    this.isPointAdded = false;\n  }\n\n  coordinatesSize(\n    positionIndexes: number[] | null | undefined,\n    featureIndex: number,\n    {features}: SimpleFeatureCollection\n  ) {\n    let size = 0;\n    if (Array.isArray(positionIndexes)) {\n      const feature = features[featureIndex];\n      const coordinates: any = feature.geometry.coordinates;\n      // for Multi polygons, length will be 3\n      if (positionIndexes.length === 3) {\n        const [a, b] = positionIndexes;\n        if (coordinates.length && coordinates[a].length) {\n          size = coordinates[a][b].length;\n        }\n      } else {\n        const [b] = positionIndexes;\n        if (coordinates.length && coordinates[b].length) {\n          size = coordinates[b].length;\n        }\n      }\n    }\n    return size;\n  }\n\n  getBearing(p1: any, p2: any) {\n    const angle = bearing(p1, p2);\n    if (angle < 0) {\n      return Math.floor(360 + angle);\n    }\n    return Math.floor(angle);\n  }\n\n  isOrthogonal(\n    positionIndexes: number[] | null | undefined,\n    featureIndex: number,\n    size: number,\n    features: SimpleFeatureCollection\n  ) {\n    if (!Array.isArray(positionIndexes)) {\n      return false;\n    }\n    if (positionIndexes[positionIndexes.length - 1] === size - 1) {\n      positionIndexes[positionIndexes.length - 1] = 0;\n    }\n    const prevPoint = this.getPointForPositionIndexes(\n      this.prevPositionIndexes(positionIndexes, size),\n      featureIndex,\n      features\n    );\n    const nextPoint = this.getPointForPositionIndexes(\n      this.nextPositionIndexes(positionIndexes, size),\n      featureIndex,\n      features\n    );\n    const currentPoint = this.getPointForPositionIndexes(positionIndexes, featureIndex, features);\n    const prevAngle = this.getBearing(currentPoint, prevPoint);\n    const nextAngle = this.getBearing(currentPoint, nextPoint);\n    return [89, 90, 91, 269, 270, 271].includes(Math.abs(prevAngle - nextAngle));\n  }\n\n  nextPositionIndexes(positionIndexes: number[] | null | undefined, size: number): number[] {\n    if (!Array.isArray(positionIndexes)) {\n      return [];\n    }\n    const next = [...positionIndexes];\n    if (next.length) {\n      next[next.length - 1] = next[next.length - 1] === size - 1 ? 0 : next[next.length - 1] + 1;\n    }\n    return next;\n  }\n\n  prevPositionIndexes(positionIndexes: number[] | null | undefined, size: number): number[] {\n    if (!Array.isArray(positionIndexes)) {\n      return [];\n    }\n    const prev = [...positionIndexes];\n    if (prev.length) {\n      prev[prev.length - 1] = prev[prev.length - 1] === 0 ? size - 2 : prev[prev.length - 1] - 1;\n    }\n    return prev;\n  }\n\n  getPointForPositionIndexes(\n    positionIndexes: number[] | null | undefined,\n    featureIndex: number,\n    {features}: SimpleFeatureCollection\n  ) {\n    let p1;\n    if (Array.isArray(positionIndexes)) {\n      const feature = features[featureIndex];\n      const coordinates: any = feature.geometry.coordinates;\n      // for Multi polygons, length will be 3\n      if (positionIndexes.length === 3) {\n        const [a, b, c] = positionIndexes;\n        if (coordinates.length && coordinates[a].length) {\n          p1 = coordinates[a][b][c];\n        }\n      } else {\n        const [b, c] = positionIndexes;\n        if (coordinates.length && coordinates[b].length) {\n          p1 = coordinates[b][c];\n        }\n      }\n    }\n    return p1;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {ModeProps, PointerMoveEvent, StopDraggingEvent} from './types';\nimport {Position, FeatureCollection} from '../utils/geojson-types';\nimport {getPickedEditHandle} from './utils';\nimport {ModifyMode} from './modify-mode';\n\nfunction defaultCalculateElevationChange({\n  pointerDownScreenCoords,\n  screenCoords\n}: {\n  pointerDownScreenCoords: Position;\n  screenCoords: Position;\n}) {\n  return 10 * (pointerDownScreenCoords[1] - screenCoords[1]);\n}\n\nexport class ElevationMode extends ModifyMode {\n  makeElevatedEvent(\n    event: PointerMoveEvent | StopDraggingEvent,\n    position: Position,\n    props: ModeProps<FeatureCollection>\n  ): Record<string, any> {\n    const {\n      minElevation = 0,\n      maxElevation = 20000,\n      calculateElevationChange = defaultCalculateElevationChange\n    } = props.modeConfig || {};\n\n    if (!event.pointerDownScreenCoords) {\n      return event;\n    }\n\n    // $FlowFixMe - really, I know it has something at index 2\n    let elevation = position.length === 3 ? position[2] : 0;\n\n    // calculateElevationChange is configurable because (at this time) modes are not aware of the viewport\n    elevation += calculateElevationChange({\n      pointerDownScreenCoords: event.pointerDownScreenCoords,\n      screenCoords: event.screenCoords\n    });\n    elevation = Math.min(elevation, maxElevation);\n    elevation = Math.max(elevation, minElevation);\n\n    return Object.assign({}, event, {\n      mapCoords: [position[0], position[1], elevation]\n    });\n  }\n\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>) {\n    const editHandle = getPickedEditHandle(event.pointerDownPicks);\n    const position = editHandle ? editHandle.geometry.coordinates : event.mapCoords;\n    // @ts-expect-error return type too wide\n    super.handlePointerMove(this.makeElevatedEvent(event, position, props), props);\n  }\n\n  handleStopDragging(event: StopDraggingEvent, props: ModeProps<FeatureCollection>) {\n    const editHandle = getPickedEditHandle(event.picks);\n    const position = editHandle ? editHandle.geometry.coordinates : event.mapCoords;\n    // @ts-expect-error return type too wide\n    super.handleStopDragging(this.makeElevatedEvent(event, position, props), props);\n  }\n\n  getCursor(event: PointerMoveEvent): string | null | undefined {\n    let cursor = super.getCursor(event);\n    if (cursor === 'cell') {\n      cursor = 'ns-resize';\n    }\n    return cursor;\n  }\n\n  static calculateElevationChangeWithViewport(\n    viewport: any,\n    {\n      pointerDownScreenCoords,\n      screenCoords\n    }: {\n      pointerDownScreenCoords: Position;\n      screenCoords: Position;\n    }\n  ): number {\n    // Source: https://gis.stackexchange.com/a/127949/111804\n    const metersPerPixel =\n      (156543.03392 * Math.cos((viewport.latitude * Math.PI) / 180)) / Math.pow(2, viewport.zoom);\n\n    return (metersPerPixel * (pointerDownScreenCoords[1] - screenCoords[1])) / 2;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {ClickEvent, PointerMoveEvent, ModeProps, TentativeFeature} from './types';\nimport {FeatureCollection, SimpleFeatureCollection, Point} from '../utils/geojson-types';\nimport {GeoJsonEditMode} from './geojson-edit-mode';\n\nexport class DrawPointMode extends GeoJsonEditMode {\n  createTentativeFeature(props: ModeProps<FeatureCollection>): TentativeFeature {\n    const {lastPointerMoveEvent} = props;\n    const lastCoords = lastPointerMoveEvent ? [lastPointerMoveEvent.mapCoords] : [];\n\n    return {\n      type: 'Feature',\n      properties: {\n        guideType: 'tentative'\n      },\n      geometry: {\n        type: 'Point',\n        coordinates: lastCoords[0]\n      }\n    };\n  }\n\n  handleClick({mapCoords}: ClickEvent, props: ModeProps<SimpleFeatureCollection>): void {\n    const geometry: Point = {\n      type: 'Point',\n      coordinates: mapCoords\n    };\n\n    props.onEdit(this.getAddFeatureAction(geometry, props.data));\n  }\n\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>) {\n    props.onUpdateCursor('cell');\n    super.handlePointerMove(event, props);\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport distance from '@turf/distance';\nimport {memoize} from '../utils/memoize';\nimport {\n  LineString,\n  FeatureCollection,\n  Position,\n  SimpleFeatureCollection\n} from '../utils/geojson-types';\nimport {\n  ClickEvent,\n  PointerMoveEvent,\n  ModeProps,\n  GuideFeatureCollection,\n  GuideFeature,\n  Tooltip,\n  DoubleClickEvent\n} from './types';\nimport {getPickedEditHandle} from './utils';\nimport {GeoJsonEditMode} from './geojson-edit-mode';\n\nexport class DrawLineStringMode extends GeoJsonEditMode {\n  // declaration of variables for the calculation of the distance of linestring\n  dist = 0;\n  position: Position = null!;\n  elems: Position[] = [];\n  handleClick(event: ClickEvent, props: ModeProps<SimpleFeatureCollection>) {\n    const {picks} = event;\n    const clickedEditHandle = getPickedEditHandle(picks);\n\n    let positionAdded = false;\n    if (!clickedEditHandle) {\n      // Don't add another point right next to an existing one\n      this.addClickSequence(event);\n      positionAdded = true;\n    }\n    const clickSequence = this.getClickSequence();\n\n    // check if the pointer is on editable state calculate the distance of new point\n    if (!clickedEditHandle) {\n      this.calculateInfoDraw(clickSequence);\n    }\n\n    if (\n      clickSequence.length > 1 &&\n      clickedEditHandle &&\n      Array.isArray(clickedEditHandle.properties.positionIndexes) &&\n      clickedEditHandle.properties.positionIndexes[0] === clickSequence.length - 1\n    ) {\n      // They clicked the last point (or double-clicked), so add the LineString\n      // reset distance to new calculate\n      this.dist = 0;\n      this.finishDrawing(props);\n    } else if (positionAdded) {\n      // new tentative point\n      props.onEdit({\n        // data is the same\n        updatedData: props.data,\n        editType: 'addTentativePosition',\n        editContext: {\n          position: event.mapCoords\n        }\n      });\n    }\n  }\n\n  handleDoubleClick(event: DoubleClickEvent, props: ModeProps<SimpleFeatureCollection>) {\n    this.finishDrawing(props);\n  }\n\n  finishDrawing(props: ModeProps<SimpleFeatureCollection>) {\n    const clickSequence = this.getClickSequence();\n    if (clickSequence.length > 1) {\n      const lineStringToAdd: LineString = {\n        type: 'LineString',\n        coordinates: [...clickSequence]\n      };\n      this.resetClickSequence();\n      const editAction = this.getAddFeatureAction(lineStringToAdd, props.data);\n      if (editAction) {\n        props.onEdit(editAction);\n      }\n    }\n  }\n\n  handleKeyUp(event: KeyboardEvent, props: ModeProps<SimpleFeatureCollection>) {\n    const {key} = event;\n    if (key === 'Enter') {\n      this.finishDrawing(props);\n    } else if (key === 'Escape') {\n      this.resetClickSequence();\n      props.onEdit({\n        // Because the new drawing feature is dropped, so the data will keep as the same.\n        updatedData: props.data,\n        editType: 'cancelFeature',\n        editContext: {}\n      });\n    }\n  }\n\n  getGuides(props: ModeProps<FeatureCollection>): GuideFeatureCollection {\n    const {lastPointerMoveEvent} = props;\n    const clickSequence = this.getClickSequence();\n\n    const lastCoords = lastPointerMoveEvent ? [lastPointerMoveEvent.mapCoords] : [];\n\n    const guides: GuideFeatureCollection = {\n      type: 'FeatureCollection',\n      features: []\n    };\n\n    let tentativeFeature;\n    if (clickSequence.length > 0) {\n      tentativeFeature = {\n        type: 'Feature',\n        properties: {\n          guideType: 'tentative'\n        },\n        geometry: {\n          type: 'LineString',\n          coordinates: [...clickSequence, ...lastCoords]\n        }\n      };\n    }\n\n    if (tentativeFeature) {\n      guides.features.push(tentativeFeature);\n    }\n\n    const editHandles: GuideFeature[] = clickSequence.map((clickedCoord, index) => ({\n      type: 'Feature',\n      properties: {\n        guideType: 'editHandle',\n        editHandleType: 'existing',\n        featureIndex: -1,\n        positionIndexes: [index]\n      },\n      geometry: {\n        type: 'Point',\n        coordinates: clickedCoord\n      }\n    }));\n\n    guides.features.push(...editHandles);\n    return guides;\n  }\n\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>) {\n    props.onUpdateCursor('cell');\n  }\n\n  /**\n   * define the default function to display the tooltip for\n   * nebula geometry mode type\n   * @param props properties of geometry nebula mode\n   */\n  getTooltips(props: ModeProps<FeatureCollection>): Tooltip[] {\n    return this._getTooltips({\n      modeConfig: props.modeConfig,\n      dist: this.dist\n    });\n  }\n\n  // utility function\n  calculateInfoDraw(clickSequence) {\n    // check if the selected points are at least 2\n    if (clickSequence.length > 1) {\n      // setting the last point\n      this.position = clickSequence[clickSequence.length - 1];\n      // calculate the new distance by adding the\n      // distance of the new drawn linestring\n      this.dist += distance(\n        clickSequence[clickSequence.length - 2],\n        clickSequence[clickSequence.length - 1]\n      );\n    }\n  }\n\n  /**\n   * redefine the tooltip of geometry\n   * @param modeConfig\n   * @param dist\n   */\n  _getTooltips = memoize(({modeConfig, dist}) => {\n    let tooltips: Tooltip[] = [];\n    const {formatTooltip} = modeConfig || {};\n    let text;\n    if (dist) {\n      if (formatTooltip) {\n        text = formatTooltip(dist);\n      } else {\n        // By default, round to 2 decimal places and append units\n        text = `Distance: ${parseFloat(dist).toFixed(2)} kilometers`;\n      }\n\n      tooltips = [\n        {\n          position: this.position,\n          text\n        }\n      ];\n    }\n    return tooltips;\n  });\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// port from @deck.gl/core\nfunction isEqual(a: any, b: any) {\n  if (a === b) {\n    return true;\n  }\n  if (Array.isArray(a)) {\n    // Special treatment for arrays: compare 1-level deep\n    // This is to support equality of matrix/coordinate props\n    const len = a.length;\n    if (!b || b.length !== len) {\n      return false;\n    }\n\n    for (let i = 0; i < len; i++) {\n      if (a[i] !== b[i]) {\n        return false;\n      }\n    }\n    return true;\n  }\n  return false;\n}\n\n/**\n * Speed up consecutive function calls by caching the result of calls with identical input\n * https://en.wikipedia.org/wiki/Memoization\n * @param {function} compute - the function to be memoized\n */\nexport function memoize(compute: Function) {\n  let cachedArgs = {};\n  let cachedResult;\n\n  return (args: any) => {\n    for (const key in args) {\n      if (!isEqual(args[key], cachedArgs[key])) {\n        cachedResult = compute(args);\n        cachedArgs = args;\n        break;\n      }\n    }\n    return cachedResult;\n  };\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {lineIntersect} from '@turf/line-intersect';\nimport {polygon as turfPolygon} from '@turf/helpers';\nimport {booleanWithin} from '@turf/boolean-within';\nimport type {Geometry} from 'geojson';\nimport {kinks} from '@turf/kinks';\n\nimport {\n  ClickEvent,\n  PointerMoveEvent,\n  ModeProps,\n  GuideFeatureCollection,\n  TentativeFeature,\n  GuideFeature,\n  DoubleClickEvent\n} from './types';\nimport {Position, FeatureCollection, SimpleFeatureCollection} from '../utils/geojson-types';\nimport {getPickedEditHandle} from './utils';\nimport {GeoJsonEditMode} from './geojson-edit-mode';\nimport {ImmutableFeatureCollection} from './immutable-feature-collection';\n\nexport class DrawPolygonMode extends GeoJsonEditMode {\n  holeSequence: Position[] = [];\n  isDrawingHole = false;\n\n  createTentativeFeature(props: ModeProps<FeatureCollection>): TentativeFeature {\n    const {lastPointerMoveEvent} = props;\n    const clickSequence = this.getClickSequence();\n    const holeSequence = this.holeSequence;\n    const lastCoords = lastPointerMoveEvent ? [lastPointerMoveEvent.mapCoords] : [];\n\n    let geometry: Geometry;\n\n    if (this.isDrawingHole && holeSequence.length > 1) {\n      geometry = {\n        type: 'Polygon',\n        coordinates: [\n          [...clickSequence, clickSequence[0]],\n          [...holeSequence, ...lastCoords, holeSequence[0]]\n        ]\n      };\n    } else if (clickSequence.length > 2) {\n      geometry = {\n        type: 'Polygon',\n        coordinates: [[...clickSequence, ...lastCoords, clickSequence[0]]]\n      };\n    } else {\n      geometry = {\n        type: 'LineString',\n        coordinates: [...clickSequence, ...lastCoords]\n      };\n    }\n\n    return {\n      type: 'Feature',\n      properties: {\n        guideType: 'tentative'\n      },\n      geometry\n    };\n  }\n\n  getGuides(props: ModeProps<FeatureCollection>): GuideFeatureCollection {\n    const guides: GuideFeatureCollection = {\n      type: 'FeatureCollection',\n      features: []\n    };\n\n    const tentative = this.createTentativeFeature(props);\n    if (tentative) guides.features.push(tentative);\n\n    const sequence = this.isDrawingHole ? this.holeSequence : this.getClickSequence();\n\n    const handles: GuideFeature[] = sequence.map((coord, index) => ({\n      type: 'Feature',\n      properties: {\n        guideType: 'editHandle',\n        editHandleType: 'existing',\n        featureIndex: -1,\n        positionIndexes: [index]\n      },\n      geometry: {\n        type: 'Point',\n        coordinates: coord\n      }\n    }));\n\n    guides.features.push(...handles);\n    return guides;\n  }\n\n  // eslint-disable-next-line complexity, max-statements\n  handleClick(event: ClickEvent, props: ModeProps<SimpleFeatureCollection>) {\n    const {picks} = event;\n    const clickedEditHandle = getPickedEditHandle(picks);\n    const clickSequence = this.getClickSequence();\n    const coords = event.mapCoords;\n\n    // Check if they clicked on an edit handle to complete the polygon\n    if (\n      !this.isDrawingHole &&\n      clickSequence.length > 2 &&\n      clickedEditHandle &&\n      Array.isArray(clickedEditHandle.properties.positionIndexes) &&\n      (clickedEditHandle.properties.positionIndexes[0] === 0 ||\n        clickedEditHandle.properties.positionIndexes[0] === clickSequence.length - 1)\n    ) {\n      // They clicked the first or last point, so complete the polygon\n      this.finishDrawing(props);\n      return;\n    }\n\n    // Check if they clicked near the first point to complete the polygon\n    if (!this.isDrawingHole && clickSequence.length > 2) {\n      if (isNearFirstPoint(coords, clickSequence[0])) {\n        this.finishDrawing(props);\n        this.resetClickSequence();\n        return;\n      }\n    }\n\n    if (this.isDrawingHole) {\n      const current = this.holeSequence;\n      current.push(coords);\n\n      if (current.length > 2) {\n        const poly: Geometry = {\n          type: 'Polygon',\n          coordinates: [\n            [...clickSequence, clickSequence[0]],\n            [...current, current[0]]\n          ]\n        };\n\n        this.resetClickSequence();\n        this.holeSequence = [];\n        this.isDrawingHole = false;\n\n        const editAction = this.getAddFeatureOrBooleanPolygonAction(poly, props);\n        if (editAction) props.onEdit(editAction);\n      }\n      return;\n    }\n\n    // Add the click if we didn't click on a handle\n    let positionAdded = false;\n    if (!clickedEditHandle) {\n      this.addClickSequence(event);\n      positionAdded = true;\n    }\n\n    if (positionAdded) {\n      // new tentative point\n      props.onEdit({\n        // data is the same\n        updatedData: props.data,\n        editType: 'addTentativePosition',\n        editContext: {\n          position: event.mapCoords\n        }\n      });\n    }\n  }\n\n  handleDoubleClick(_event: DoubleClickEvent, props: ModeProps<SimpleFeatureCollection>) {\n    this.finishDrawing(props);\n    this.resetClickSequence();\n  }\n\n  handleKeyUp(event: KeyboardEvent, props: ModeProps<SimpleFeatureCollection>) {\n    if (event.key === 'Enter') {\n      this.finishDrawing(props);\n      this.resetClickSequence();\n    } else if (event.key === 'Escape') {\n      this.resetClickSequence();\n      this.holeSequence = [];\n      this.isDrawingHole = false;\n\n      props.onEdit({\n        updatedData: props.data,\n        editType: 'cancelFeature',\n        editContext: {}\n      });\n    }\n  }\n\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>) {\n    props.onUpdateCursor('cell');\n    super.handlePointerMove(event, props);\n  }\n\n  // eslint-disable-next-line max-statements, complexity\n  finishDrawing(props: ModeProps<SimpleFeatureCollection>) {\n    const clickSequence = this.getClickSequence();\n    const polygon = [...clickSequence, clickSequence[0]];\n\n    const newPolygon = turfPolygon([polygon]);\n\n    const canAddHole = canAddHoleToPolygon(props);\n    const canOverlap = canPolygonOverlap(props);\n\n    // Check if the polygon intersects itself (excluding shared start/end point)\n    if (!canOverlap) {\n      const overlapping = kinks(newPolygon).features;\n\n      if (overlapping.length > 0) {\n        // \u274C Invalid polygon: overlaps\n        props.onEdit({\n          updatedData: props.data,\n          editType: 'invalidPolygon',\n          editContext: {reason: 'overlaps'}\n        });\n        this.resetClickSequence();\n        return;\n      }\n    }\n\n    if (canAddHole) {\n      const holeResult = this.tryAddHoleToExistingPolygon(newPolygon, polygon, props);\n      if (holeResult.handled) {\n        this.resetClickSequence();\n        return;\n      }\n    }\n\n    // If no valid hole was found, add the polygon as a new feature\n    const editAction = this.getAddFeatureOrBooleanPolygonAction(\n      {\n        type: 'Polygon',\n        coordinates: [[...this.getClickSequence(), this.getClickSequence()[0]]]\n      },\n      props\n    );\n    if (editAction) props.onEdit(editAction);\n    this.resetClickSequence();\n    return;\n  }\n\n  private tryAddHoleToExistingPolygon(\n    newPolygon: any,\n    polygon: Position[],\n    props: ModeProps<SimpleFeatureCollection>\n  ): {handled: boolean} {\n    for (const [featureIndex, feature] of props.data.features.entries()) {\n      if (feature.geometry.type === 'Polygon') {\n        const result = this.validateAndCreateHole(\n          feature,\n          featureIndex,\n          newPolygon,\n          polygon,\n          props\n        );\n        if (result.handled) {\n          return result;\n        }\n      }\n    }\n\n    return {handled: false};\n  }\n\n  private validateAndCreateHole(\n    feature: any,\n    featureIndex: number,\n    newPolygon: any,\n    polygon: Position[],\n    props: ModeProps<SimpleFeatureCollection>\n  ): {handled: boolean} {\n    const outer = turfPolygon(feature.geometry.coordinates);\n\n    // Check existing holes for conflicts\n    for (let i = 1; i < feature.geometry.coordinates.length; i++) {\n      const hole = turfPolygon([feature.geometry.coordinates[i]]);\n      const intersection = lineIntersect(hole, newPolygon);\n\n      if (intersection.features.length > 0) {\n        props.onEdit({\n          updatedData: props.data,\n          editType: 'invalidHole',\n          editContext: {reason: 'intersects-existing-hole'}\n        });\n        return {handled: true};\n      }\n\n      if (booleanWithin(hole, newPolygon) || booleanWithin(newPolygon, hole)) {\n        props.onEdit({\n          updatedData: props.data,\n          editType: 'invalidHole',\n          editContext: {reason: 'contains-or-contained-by-existing-hole'}\n        });\n        return {handled: true};\n      }\n    }\n\n    // Check outer polygon conflicts\n    const intersectionWithOuter = lineIntersect(outer, newPolygon);\n    if (intersectionWithOuter.features.length > 0) {\n      props.onEdit({\n        updatedData: props.data,\n        editType: 'invalidPolygon',\n        editContext: {reason: 'intersects-existing-polygon'}\n      });\n      return {handled: true};\n    }\n\n    if (booleanWithin(outer, newPolygon)) {\n      props.onEdit({\n        updatedData: props.data,\n        editType: 'invalidPolygon',\n        editContext: {reason: 'contains-existing-polygon'}\n      });\n      return {handled: true};\n    }\n\n    // Check if new polygon is within outer polygon (valid hole)\n    if (booleanWithin(newPolygon, outer)) {\n      const updatedData = new ImmutableFeatureCollection(props.data)\n        .replaceGeometry(featureIndex, {\n          ...feature.geometry,\n          coordinates: [...feature.geometry.coordinates, polygon]\n        })\n        .getObject();\n\n      props.onEdit({\n        updatedData,\n        editType: 'addHole',\n        editContext: {hole: newPolygon.geometry}\n      });\n      return {handled: true};\n    }\n    return {handled: false};\n  }\n}\n\n// Helper function to check if a point is near the first point in the sequence\nfunction isNearFirstPoint(click: Position, first: Position, threshold = 1e-4): boolean {\n  const dx = click[0] - first[0];\n  const dy = click[1] - first[1];\n  return dx * dx + dy * dy < threshold * threshold;\n}\n\n// Helper function to determine if a hole can be added to a polygon\nfunction canAddHoleToPolygon(props: ModeProps<FeatureCollection>): boolean {\n  // For simplicity, always return true in this example.\n  // Implement your own logic based on application requirements.\n  return props.modeConfig?.allowHoles ?? false;\n}\n\n// Helper function to determine if a polygon can intersect itself\nfunction canPolygonOverlap(props: ModeProps<FeatureCollection>): boolean {\n  // Return the value of allowSelfIntersection (defaults to false for safety)\n  return props.modeConfig?.allowSelfIntersection ?? false;\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport bboxPolygon from '@turf/bbox-polygon';\nimport {Position, Polygon, Feature} from '../utils/geojson-types';\nimport {TwoClickPolygonMode} from './two-click-polygon-mode';\n\nexport class DrawRectangleMode extends TwoClickPolygonMode {\n  getTwoClickPolygon(coord1: Position, coord2: Position, modeConfig: any): Feature<Polygon> {\n    const rectangle = bboxPolygon([coord1[0], coord1[1], coord2[0], coord2[1]]);\n    rectangle.properties = rectangle.properties || {};\n    rectangle.properties.shape = 'Rectangle';\n\n    return rectangle;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n  ClickEvent,\n  StartDraggingEvent,\n  StopDraggingEvent,\n  PointerMoveEvent,\n  ModeProps,\n  GuideFeatureCollection,\n  TentativeFeature\n} from './types';\nimport {\n  Polygon,\n  FeatureCollection,\n  Feature,\n  Position,\n  SimpleFeatureCollection\n} from '../utils/geojson-types';\nimport {GeoJsonEditMode} from './geojson-edit-mode';\nimport omit from 'lodash.omit';\n\nexport class TwoClickPolygonMode extends GeoJsonEditMode {\n  handleClick(event: ClickEvent, props: ModeProps<SimpleFeatureCollection>) {\n    if (props.modeConfig && props.modeConfig.dragToDraw) {\n      // handled in drag handlers\n      return;\n    }\n\n    this.addClickSequence(event);\n\n    this.checkAndFinishPolygon(props);\n  }\n\n  handleStartDragging(event: StartDraggingEvent, props: ModeProps<SimpleFeatureCollection>): void {\n    if (!props.modeConfig || !props.modeConfig.dragToDraw) {\n      // handled in click handlers\n      return;\n    }\n\n    this.addClickSequence(event);\n    event.cancelPan();\n  }\n\n  handleStopDragging(event: StopDraggingEvent, props: ModeProps<SimpleFeatureCollection>): void {\n    if (!props.modeConfig || !props.modeConfig.dragToDraw) {\n      // handled in click handlers\n      return;\n    }\n    this.addClickSequence(event);\n\n    this.checkAndFinishPolygon(props);\n  }\n\n  checkAndFinishPolygon(props: ModeProps<SimpleFeatureCollection>) {\n    const clickSequence = this.getClickSequence();\n    const tentativeFeature = this.getTentativeGuide(props);\n\n    if (\n      clickSequence.length > 1 &&\n      tentativeFeature &&\n      tentativeFeature.geometry.type === 'Polygon'\n    ) {\n      const feature: Feature<Polygon> = {\n        type: 'Feature',\n        properties: omit(tentativeFeature.properties, 'guideType'),\n        geometry: {\n          type: 'Polygon',\n          coordinates: tentativeFeature.geometry.coordinates\n        }\n      };\n      const editAction = this.getAddFeatureOrBooleanPolygonAction(feature, props);\n\n      this.resetClickSequence();\n\n      if (editAction) {\n        props.onEdit(editAction);\n      }\n    }\n  }\n\n  getGuides(props: ModeProps<FeatureCollection>): GuideFeatureCollection {\n    const {lastPointerMoveEvent, modeConfig} = props;\n    const clickSequence = this.getClickSequence();\n\n    const guides: GuideFeatureCollection = {\n      type: 'FeatureCollection',\n      features: []\n    };\n\n    if (clickSequence.length === 0 || !lastPointerMoveEvent) {\n      // nothing to do yet\n      return guides;\n    }\n\n    const corner1 = clickSequence[0];\n    const corner2 = lastPointerMoveEvent.mapCoords;\n\n    const polygon = this.getTwoClickPolygon(corner1, corner2, modeConfig);\n    if (polygon) {\n      guides.features.push({\n        type: 'Feature',\n        properties: {\n          ...polygon.properties,\n          guideType: 'tentative'\n        },\n        geometry: polygon.geometry\n      });\n    }\n\n    return guides;\n  }\n\n  getTwoClickPolygon(\n    coord1: Position,\n    coord2: Position,\n    modeConfig: any\n  ): Feature<Polygon> | null | undefined {\n    return null;\n  }\n\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>) {\n    props.onUpdateCursor('cell');\n    super.handlePointerMove(event, props);\n  }\n\n  createTentativeFeature(props: ModeProps<FeatureCollection>): TentativeFeature {\n    const {lastPointerMoveEvent} = props;\n    const clickSequence = this.getClickSequence();\n\n    const lastCoords = lastPointerMoveEvent ? [lastPointerMoveEvent.mapCoords] : [];\n\n    let tentativeFeature;\n    if (clickSequence.length === 1) {\n      tentativeFeature = this.getTwoClickPolygon(clickSequence[0], lastCoords[0], props.modeConfig);\n    }\n\n    return tentativeFeature;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport bboxPolygon from '@turf/bbox-polygon';\nimport turfDistance from '@turf/distance';\nimport turfAlong from '@turf/along';\nimport {point, lineString as turfLineString} from '@turf/helpers';\nimport {Position, Polygon, Feature} from '../utils/geojson-types';\nimport {TwoClickPolygonMode} from './two-click-polygon-mode';\n\nexport class DrawSquareMode extends TwoClickPolygonMode {\n  getTwoClickPolygon(coord1: Position, coord2: Position, modeConfig: any): Feature<Polygon> {\n    // get the coordinates of the other two rectangle vertices\n    const coord3 = [coord2[0], coord1[1]];\n    const coord4 = [coord1[0], coord2[1]];\n\n    // determine the shortest distance to the origin, which will be the length of each square side\n    const distance1 = turfDistance(point(coord3), point(coord1));\n    const distance2 = turfDistance(point(coord4), point(coord1));\n    const shortestDistance = distance1 <= distance2 ? distance1 : distance2;\n\n    // determine which coordinate pair of the two is closest to the origin\n    const closestPoint = distance1 <= distance2 ? coord3 : coord4;\n\n    // create a linestring which will used to locate the second square vertex\n    const line = turfLineString([closestPoint, coord2]);\n\n    // get the coordinates of the second square vertex\n    const newPoint = turfAlong(line, shortestDistance);\n    const corner = newPoint.geometry.coordinates;\n\n    const square = bboxPolygon([coord1[0], coord1[1], corner[0], corner[1]]);\n    square.properties = square.properties || {};\n    square.properties.shape = 'Square';\n\n    return square;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport bboxPolygon from '@turf/bbox-polygon';\nimport {Position, Polygon, Feature} from '../utils/geojson-types';\nimport {TwoClickPolygonMode} from './two-click-polygon-mode';\n\nexport class DrawRectangleFromCenterMode extends TwoClickPolygonMode {\n  getTwoClickPolygon(coord1: Position, coord2: Position, modeConfig: any): Feature<Polygon> {\n    const longitude =\n      coord1[0] > coord2[0]\n        ? coord1[0] + Math.abs(coord1[0] - coord2[0])\n        : coord1[0] - Math.abs(coord1[0] - coord2[0]);\n    const latitude =\n      coord1[1] > coord2[1]\n        ? coord1[1] + Math.abs(coord1[1] - coord2[1])\n        : coord1[1] - Math.abs(coord1[1] - coord2[1]);\n\n    const rectangle = bboxPolygon([longitude, latitude, coord2[0], coord2[1]]);\n    rectangle.properties = rectangle.properties || {};\n    rectangle.properties.shape = 'Rectangle';\n\n    return rectangle;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport bboxPolygon from '@turf/bbox-polygon';\nimport turfDistance from '@turf/distance';\nimport turfAlong from '@turf/along';\nimport {point, lineString as turfLineString} from '@turf/helpers';\nimport {Position, Polygon, Feature} from '../utils/geojson-types';\nimport {TwoClickPolygonMode} from './two-click-polygon-mode';\n\nexport class DrawSquareFromCenterMode extends TwoClickPolygonMode {\n  getTwoClickPolygon(coord1: Position, coord2: Position, modeConfig: any): Feature<Polygon> {\n    // get the coordinates of the other two rectangle vertices\n    const coord3 = [coord2[0], coord1[1]];\n    const coord4 = [coord1[0], coord2[1]];\n\n    // determine the shortest distance to the origin, which will be the length of each square side\n    const distance1 = turfDistance(point(coord3), point(coord1));\n    const distance2 = turfDistance(point(coord4), point(coord1));\n    const shortestDistance = distance1 <= distance2 ? distance1 : distance2;\n\n    // determine which coordinate pair of the two is closest to the origin\n    const closestPoint = distance1 <= distance2 ? coord3 : coord4;\n\n    // create a linestring which will used to locate the second square vertex\n    const line = turfLineString([closestPoint, coord2]);\n\n    // get the coordinates of the second square vertex\n    const newPoint = turfAlong(line, shortestDistance);\n    const corner = newPoint.geometry.coordinates;\n\n    // determine the longitude and latitude values of the opposite corner\n    const longitude =\n      coord1[0] > corner[0]\n        ? coord1[0] + Math.abs(coord1[0] - corner[0])\n        : coord1[0] - Math.abs(coord1[0] - corner[0]);\n    const latitude =\n      coord1[1] > corner[1]\n        ? coord1[1] + Math.abs(coord1[1] - corner[1])\n        : coord1[1] - Math.abs(coord1[1] - corner[1]);\n\n    const square = bboxPolygon([longitude, latitude, corner[0], corner[1]]);\n    square.properties = square.properties || {};\n    square.properties.shape = 'Square';\n\n    return square;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport circle from '@turf/circle';\nimport distance from '@turf/distance';\nimport area from '@turf/area';\nimport {memoize} from '../utils/memoize';\nimport {ModeProps, Tooltip} from './types';\nimport {Position, Polygon, Feature, FeatureCollection} from '../utils/geojson-types';\nimport {TwoClickPolygonMode} from './two-click-polygon-mode';\n\nexport class DrawCircleFromCenterMode extends TwoClickPolygonMode {\n  radius: number | null | undefined = null;\n  position: Position = null!;\n  areaCircle: number | null | undefined = null;\n  getTwoClickPolygon(coord1: Position, coord2: Position, modeConfig: any): Feature<Polygon> {\n    // Default turf value for circle is 64\n    const {steps = 64} = modeConfig || {};\n    const options = {steps};\n    // setting with position of center of circle\n    this.position = coord2;\n\n    if (steps < 4) {\n      console.warn('Minimum steps to draw a circle is 4 '); // eslint-disable-line no-console,no-undef\n      options.steps = 4;\n    }\n\n    // setting value of radius as distance of center and other point\n    this.radius = Math.max(distance(coord1, coord2), 0.001);\n    const geometry = circle(coord1, this.radius, options);\n\n    geometry.properties = geometry.properties || {};\n    geometry.properties.shape = 'Circle';\n    geometry.properties.editProperties = geometry.properties.editProperties || {};\n    geometry.properties.editProperties.shape = 'Circle';\n    geometry.properties.editProperties.radius = {value: this.radius, unit: 'kilometers'};\n    geometry.properties.editProperties.center = coord1;\n    // calculate area of circle with turf function\n    this.areaCircle = area(geometry);\n\n    return geometry;\n  }\n\n  /**\n   * define the default function to display the tooltip for\n   * nebula geometry mode type\n   * @param props properties of geometry nebula mode\n   */\n  getTooltips(props: ModeProps<FeatureCollection>): Tooltip[] {\n    return this._getTooltips({\n      modeConfig: props?.modeConfig,\n      radius: this.radius,\n      areaCircle: this.areaCircle\n    });\n  }\n\n  /**\n   * redefine the tooltip of geometry\n   * @param modeConfig\n   * @param radius\n   * @param areaCircle\n   */\n  _getTooltips = memoize(({modeConfig, radius, areaCircle}) => {\n    let tooltips: Tooltip[] = [];\n    const {formatTooltip} = modeConfig || {};\n    let text: string;\n    if (radius && areaCircle) {\n      if (formatTooltip) {\n        text = formatTooltip(radius);\n      } else {\n        // By default, round to 2 decimal places and append units\n        text = `Radius: ${parseFloat(radius).toFixed(2)} kilometers\n      \\n Area: ${parseFloat(areaCircle).toFixed(2)}`;\n      }\n\n      tooltips = [\n        {\n          position: this.position,\n          text\n        }\n      ];\n    }\n\n    return tooltips;\n  });\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport circle from '@turf/circle';\nimport distance from '@turf/distance';\nimport area from '@turf/area';\nimport {memoize} from '../utils/memoize';\nimport {ModeProps, Tooltip} from './types';\nimport {Position, Polygon, Feature, FeatureCollection} from '../utils/geojson-types';\nimport {getIntermediatePosition} from './geojson-edit-mode';\nimport {TwoClickPolygonMode} from './two-click-polygon-mode';\n\nexport class DrawCircleByDiameterMode extends TwoClickPolygonMode {\n  radius: number | null | undefined = null;\n  position: Position = null!;\n  areaCircle: number | null | undefined = null;\n  diameter: number | null | undefined = null;\n  getTwoClickPolygon(coord1: Position, coord2: Position, modeConfig: any): Feature<Polygon> {\n    // Default turf value for circle is 64\n    const {steps = 64} = modeConfig || {};\n    const options = {steps};\n\n    if (steps < 4) {\n      console.warn('Minimum steps to draw a circle is 4 '); // eslint-disable-line no-console,no-undef\n      options.steps = 4;\n    }\n\n    const centerCoordinates = getIntermediatePosition(coord1, coord2);\n    // setting value of radius as distance of center and other point\n    this.radius = Math.max(distance(coord1, centerCoordinates), 0.001);\n    // setting value of diameter as distance of points\n    this.diameter = Math.max(distance(coord1, coord2), 0.001);\n    // setting position tooltip as center of circle\n    this.position = centerCoordinates;\n\n    const geometry = circle(centerCoordinates, this.radius, options);\n\n    geometry.properties = geometry.properties || {};\n    geometry.properties.shape = 'Circle';\n    geometry.properties.editProperties = geometry.properties.editProperties || {};\n    geometry.properties.editProperties.shape = 'Circle';\n    geometry.properties.editProperties.radius = {value: this.radius, unit: 'kilometers'};\n    geometry.properties.editProperties.center = centerCoordinates;\n    // calculate area of circle with turf function\n    this.areaCircle = area(geometry);\n\n    return geometry;\n  }\n\n  /**\n   * define the default function to display the tooltip for\n   * nebula geometry mode type\n   * @param props properties of geometry nebula mode\n   */\n  getTooltips(props: ModeProps<FeatureCollection>): Tooltip[] {\n    return this._getTooltips({\n      modeConfig: props.modeConfig,\n      radius: this.radius,\n      areaCircle: this.areaCircle,\n      diameter: this.diameter\n    });\n  }\n\n  /**\n   * redefine the tooltip of geometry\n   * @param modeConfig\n   * @param radius\n   * @param areaCircle\n   * @param diameter\n   */\n  _getTooltips = memoize(({modeConfig, radius, areaCircle, diameter}) => {\n    let tooltips: Tooltip[] = [];\n    const {formatTooltip} = modeConfig || {};\n    let text;\n    if (radius && areaCircle) {\n      if (formatTooltip) {\n        text = formatTooltip(radius);\n      } else {\n        // By default, round to 2 decimal places and append units\n        text = `Radius: ${parseFloat(radius).toFixed(2)} kilometers\n      \\n Area: ${parseFloat(areaCircle).toFixed(2)}\n      \\n Diameter: ${parseFloat(diameter).toFixed(2)} kilometers`;\n      }\n\n      tooltips = [\n        {\n          position: this.position,\n          text\n        }\n      ];\n    }\n\n    return tooltips;\n  });\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport bboxPolygon from '@turf/bbox-polygon';\nimport distance from '@turf/distance';\nimport ellipse from '@turf/ellipse';\nimport {point} from '@turf/helpers';\nimport {Position, Polygon, Feature} from '../utils/geojson-types';\nimport {getIntermediatePosition} from './geojson-edit-mode';\nimport {TwoClickPolygonMode} from './two-click-polygon-mode';\n\nexport class DrawEllipseByBoundingBoxMode extends TwoClickPolygonMode {\n  getTwoClickPolygon(coord1: Position, coord2: Position, modeConfig: any): Feature<Polygon> {\n    const minX = Math.min(coord1[0], coord2[0]);\n    const minY = Math.min(coord1[1], coord2[1]);\n    const maxX = Math.max(coord1[0], coord2[0]);\n    const maxY = Math.max(coord1[1], coord2[1]);\n\n    const polygonPoints = bboxPolygon([minX, minY, maxX, maxY]).geometry.coordinates[0];\n    const centerCoordinates = getIntermediatePosition(coord1, coord2);\n\n    const xSemiAxis = Math.max(distance(point(polygonPoints[0]), point(polygonPoints[1])), 0.001);\n    const ySemiAxis = Math.max(distance(point(polygonPoints[0]), point(polygonPoints[3])), 0.001);\n\n    const geometry = ellipse(centerCoordinates, xSemiAxis, ySemiAxis, {});\n\n    geometry.properties = geometry.properties || {};\n    geometry.properties.editProperties = geometry.properties.editProperties || {};\n    geometry.properties.editProperties.shape = 'Ellipse';\n    geometry.properties.editProperties.xSemiAxis = {value: xSemiAxis, unit: 'kilometers'};\n    geometry.properties.editProperties.ySemiAxis = {value: ySemiAxis, unit: 'kilometers'};\n    geometry.properties.editProperties.angle = 0;\n    geometry.properties.editProperties.center = centerCoordinates;\n\n    return geometry;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n  ClickEvent,\n  PointerMoveEvent,\n  ModeProps,\n  GuideFeatureCollection,\n  TentativeFeature\n} from './types';\nimport {\n  Position,\n  Polygon,\n  Feature,\n  FeatureCollection,\n  SimpleFeatureCollection\n} from '../utils/geojson-types';\nimport {GeoJsonEditMode} from './geojson-edit-mode';\n\nexport class ThreeClickPolygonMode extends GeoJsonEditMode {\n  handleClick(event: ClickEvent, props: ModeProps<SimpleFeatureCollection>) {\n    this.addClickSequence(event);\n\n    const {modeConfig} = props;\n    const clickSequence = this.getClickSequence();\n\n    if (clickSequence.length > 2) {\n      const {geometry, properties} = this.getThreeClickPolygon(\n        clickSequence[0],\n        clickSequence[1],\n        clickSequence[2],\n        modeConfig\n      );\n\n      const editAction = this.getAddFeatureOrBooleanPolygonAction(geometry, props, properties);\n      this.resetClickSequence();\n\n      if (editAction) {\n        props.onEdit(editAction);\n      }\n    }\n  }\n\n  getGuides(props: ModeProps<FeatureCollection>): GuideFeatureCollection {\n    const {lastPointerMoveEvent, modeConfig} = props;\n    const clickSequence = this.getClickSequence();\n\n    const guides: GuideFeatureCollection = {\n      type: 'FeatureCollection',\n      features: []\n    };\n\n    const coords = [\n      ...clickSequence,\n      ...(lastPointerMoveEvent ? [lastPointerMoveEvent.mapCoords] : [])\n    ];\n\n    if (coords.length === 2) {\n      guides.features.push({\n        type: 'Feature',\n        properties: {\n          guideType: 'tentative'\n        },\n        geometry: {\n          type: 'LineString',\n          coordinates: [coords[0], coords[1]]\n        }\n      });\n    } else if (coords.length > 2) {\n      const polygon = this.getThreeClickPolygon(coords[0], coords[1], coords[2], modeConfig);\n      if (polygon) {\n        guides.features.push({\n          ...polygon,\n          properties: {\n            ...polygon.properties,\n            guideType: 'tentative'\n          }\n        });\n      }\n    }\n\n    return guides;\n  }\n\n  getThreeClickPolygon(\n    coord1: Position,\n    coord2: Position,\n    coord3: Position,\n    modeConfig: any\n  ): Feature<Polygon> | null | undefined {\n    return null;\n  }\n\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>) {\n    props.onUpdateCursor('cell');\n    super.handlePointerMove(event, props);\n  }\n\n  createTentativeFeature(props: ModeProps<FeatureCollection>): TentativeFeature {\n    const {lastPointerMoveEvent} = props;\n    const clickSequence = this.getClickSequence();\n\n    const lastCoords = lastPointerMoveEvent ? [lastPointerMoveEvent.mapCoords] : [];\n\n    let tentativeFeature;\n    if (clickSequence.length === 2) {\n      tentativeFeature = this.getThreeClickPolygon(\n        clickSequence[0],\n        clickSequence[1],\n        lastCoords[0],\n        props.modeConfig\n      );\n    }\n\n    return tentativeFeature;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {generatePointsParallelToLinePoints} from './utils';\nimport {Position, Polygon, Feature} from '../utils/geojson-types';\nimport {ThreeClickPolygonMode} from './three-click-polygon-mode';\n\nexport class DrawRectangleUsingThreePointsMode extends ThreeClickPolygonMode {\n  getThreeClickPolygon(\n    coord1: Position,\n    coord2: Position,\n    coord3: Position,\n    modeConfig: any\n  ): Feature<Polygon> | null | undefined {\n    const [p3, p4] = generatePointsParallelToLinePoints(coord1, coord2, coord3);\n\n    return {\n      type: 'Feature',\n      properties: {\n        shape: 'Rectangle'\n      },\n      geometry: {\n        type: 'Polygon',\n        coordinates: [\n          [\n            // Draw a polygon containing all the points of the LineString,\n            // then the points orthogonal to the lineString,\n            // then back to the starting position\n            coord1,\n            coord2,\n            p3,\n            p4,\n            coord1\n          ]\n        ]\n      }\n    };\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport distance from '@turf/distance';\nimport ellipse from '@turf/ellipse';\nimport bearing from '@turf/bearing';\nimport {point} from '@turf/helpers';\nimport {Position, Polygon, Feature} from '../utils/geojson-types';\nimport {getIntermediatePosition} from './geojson-edit-mode';\nimport {ThreeClickPolygonMode} from './three-click-polygon-mode';\n\nexport class DrawEllipseUsingThreePointsMode extends ThreeClickPolygonMode {\n  getThreeClickPolygon(\n    coord1: Position,\n    coord2: Position,\n    coord3: Position,\n    modeConfig: any\n  ): Feature<Polygon> | null | undefined {\n    const centerCoordinates = getIntermediatePosition(coord1, coord2);\n    const xSemiAxis = Math.max(distance(centerCoordinates, point(coord3)), 0.001);\n    const ySemiAxis = Math.max(distance(coord1, coord2), 0.001) / 2;\n    const options = {angle: bearing(coord1, coord2)};\n    const geometry = ellipse(centerCoordinates, xSemiAxis, ySemiAxis, options);\n\n    geometry.properties = geometry.properties || {};\n    geometry.properties.editProperties = geometry.properties.editProperties || {};\n    geometry.properties.editProperties.shape = 'Ellipse';\n    geometry.properties.editProperties.xSemiAxis = {value: xSemiAxis, unit: 'kilometers'};\n    geometry.properties.editProperties.ySemiAxis = {value: ySemiAxis, unit: 'kilometers'};\n    geometry.properties.editProperties.angle = options.angle;\n    geometry.properties.editProperties.center = centerCoordinates;\n\n    return geometry;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport destination from '@turf/destination';\nimport bearing from '@turf/bearing';\nimport lineIntersect from '@turf/line-intersect';\nimport turfDistance from '@turf/distance';\nimport {point, lineString as turfLineString} from '@turf/helpers';\nimport {\n  generatePointsParallelToLinePoints,\n  getPickedEditHandle,\n  getEditHandlesForGeometry\n} from './utils';\nimport {\n  ClickEvent,\n  PointerMoveEvent,\n  ModeProps,\n  GuideFeatureCollection,\n  TentativeFeature\n} from './types';\nimport {\n  Polygon,\n  LineString,\n  Position,\n  FeatureCollection,\n  SimpleFeatureCollection\n} from '../utils/geojson-types';\nimport {GeoJsonEditMode} from './geojson-edit-mode';\n\nexport class Draw90DegreePolygonMode extends GeoJsonEditMode {\n  createTentativeFeature(props: ModeProps<FeatureCollection>): TentativeFeature {\n    const clickSequence = this.getClickSequence();\n\n    const {mapCoords} = props.lastPointerMoveEvent;\n\n    let p3;\n    if (clickSequence.length <= 1) {\n      p3 = mapCoords;\n    } else {\n      const p1 = clickSequence[clickSequence.length - 2];\n      const p2 = clickSequence[clickSequence.length - 1];\n      [p3] = generatePointsParallelToLinePoints(p1, p2, mapCoords);\n    }\n\n    let tentativeFeature;\n\n    if (clickSequence.length < 3) {\n      // Draw a LineString connecting all the clicked points with the hovered point\n      tentativeFeature = {\n        type: 'Feature',\n        properties: {\n          guideType: 'tentative'\n        },\n        geometry: {\n          type: 'LineString',\n          coordinates: [...clickSequence, p3]\n        }\n      };\n    } else {\n      // Draw a Polygon connecting all the clicked points with the hovered point\n      tentativeFeature = {\n        type: 'Feature',\n        properties: {\n          guideType: 'tentative'\n        },\n        geometry: {\n          type: 'Polygon',\n          coordinates: [[...clickSequence, p3, clickSequence[0]]]\n        }\n      };\n    }\n\n    return tentativeFeature;\n  }\n\n  getGuides(props: ModeProps<FeatureCollection>): GuideFeatureCollection {\n    const guides: GuideFeatureCollection = {\n      type: 'FeatureCollection',\n      features: []\n    };\n\n    const clickSequence = this.getClickSequence();\n\n    if (clickSequence.length === 0 || !props.lastPointerMoveEvent) {\n      return guides;\n    }\n    const tentativeFeature = this.createTentativeFeature(props);\n\n    guides.features.push(tentativeFeature);\n\n    guides.features = guides.features.concat(\n      getEditHandlesForGeometry(tentativeFeature.geometry, -1)\n    );\n\n    // Slice off the handles that are are next to the pointer\n    guides.features = guides.features.slice(0, -1);\n\n    return guides;\n  }\n\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>) {\n    props.onUpdateCursor('cell');\n    super.handlePointerMove(event, props);\n  }\n\n  handleClick(event: ClickEvent, props: ModeProps<SimpleFeatureCollection>) {\n    const {picks} = event;\n    const tentativeFeature = this.getTentativeGuide(props);\n    this.addClickSequence(event);\n    const clickSequence = this.getClickSequence();\n\n    if (!tentativeFeature) {\n      // nothing else to do\n      return;\n    }\n\n    if (clickSequence.length === 3 && tentativeFeature.geometry.type === 'LineString') {\n      const lineString: LineString = tentativeFeature.geometry;\n\n      // Tweak the clicked position to be the snapped 90 degree point along the polygon\n      clickSequence[clickSequence.length - 1] =\n        lineString.coordinates[lineString.coordinates.length - 1];\n    } else if (clickSequence.length > 3 && tentativeFeature.geometry.type === 'Polygon') {\n      const polygon: Polygon = tentativeFeature.geometry;\n\n      // Tweak the clicked position to be the snapped 90 degree point along the polygon\n      clickSequence[clickSequence.length - 1] =\n        polygon.coordinates[0][polygon.coordinates[0].length - 2];\n\n      const clickedEditHandle = getPickedEditHandle(picks);\n\n      if (\n        clickedEditHandle &&\n        Array.isArray(clickedEditHandle.properties.positionIndexes) &&\n        (clickedEditHandle.properties.positionIndexes[1] === 0 ||\n          clickedEditHandle.properties.positionIndexes[1] === polygon.coordinates[0].length - 3)\n      ) {\n        // They clicked the first or last point (or double-clicked), so complete the polygon\n        const polygonToAdd: Polygon = {\n          type: 'Polygon',\n          coordinates: this.finalizedCoordinates([...polygon.coordinates[0]])\n        };\n\n        this.resetClickSequence();\n\n        const editAction = this.getAddFeatureOrBooleanPolygonAction(polygonToAdd, props);\n        if (editAction) {\n          props.onEdit(editAction);\n        }\n      }\n    } else {\n      // Trigger pointer move right away in order for it to update edit handles (to support double-click)\n      const fakePointerMoveEvent: PointerMoveEvent = {\n        screenCoords: [-1, -1],\n        mapCoords: event.mapCoords,\n        picks: [],\n        pointerDownPicks: null,\n        pointerDownScreenCoords: null,\n        pointerDownMapCoords: null,\n        cancelPan: () => {},\n        sourceEvent: null\n      };\n\n      this.handlePointerMove(fakePointerMoveEvent, props);\n    }\n  }\n\n  finalizedCoordinates(coords: Position[]) {\n    // Remove the hovered position\n    let coordinates = [[...coords.slice(0, -2), coords[0]]];\n    let pt = this.getIntermediatePoint([...coords]);\n    if (!pt) {\n      // if intermediate point with 90 degree not available\n      // try remove the last clicked point and get the intermediate point.\n      const tc = [...coords];\n      tc.splice(-3, 1);\n      pt = this.getIntermediatePoint([...tc]);\n      if (pt) {\n        coordinates = [[...coords.slice(0, -3), pt, coords[0]]];\n      }\n    } else {\n      coordinates = [[...coords.slice(0, -2), pt, coords[0]]];\n    }\n    return coordinates;\n  }\n\n  getIntermediatePoint(coordinates: Position[]): Position | null {\n    let pt: Position | null = null;\n    if (coordinates.length > 4) {\n      const [p1, p2] = [...coordinates];\n      const angle1 = bearing(p1, p2);\n      const p3 = coordinates[coordinates.length - 3];\n      const p4 = coordinates[coordinates.length - 4];\n      const angle2 = bearing(p3, p4);\n\n      const angles = {first: [] as number[], second: [] as number[]};\n      // calculate 3 right angle points for first and last points in lineString\n      [1, 2, 3].forEach((factor) => {\n        const newAngle1 = angle1 + factor * 90;\n        // convert angles to 0 to -180 for anti-clock and 0 to 180 for clock wise\n        angles.first.push(newAngle1 > 180 ? newAngle1 - 360 : newAngle1);\n        const newAngle2 = angle2 + factor * 90;\n        angles.second.push(newAngle2 > 180 ? newAngle2 - 360 : newAngle2);\n      });\n\n      const distance = turfDistance(point(p1), point(p3));\n      // Draw imaginary right angle lines for both first and last points in lineString\n      // If there is intersection point for any 2 lines, will be the 90 degree point.\n      [0, 1, 2].forEach((indexFirst) => {\n        const line1 = turfLineString([\n          p1,\n          destination(p1, distance, angles.first[indexFirst]).geometry.coordinates\n        ]);\n        [0, 1, 2].forEach((indexSecond) => {\n          const line2 = turfLineString([\n            p3,\n            destination(p3, distance, angles.second[indexSecond]).geometry.coordinates\n          ]);\n          const fc = lineIntersect(line1, line2);\n          if (fc && fc.features.length) {\n            // found the intersect point\n            pt = fc.features[0].geometry.coordinates;\n          }\n        });\n      });\n    }\n    return pt;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport throttle from 'lodash.throttle';\nimport {ClickEvent, StartDraggingEvent, StopDraggingEvent, DraggingEvent, ModeProps} from './types';\nimport {Polygon, SimpleFeatureCollection} from '../utils/geojson-types';\nimport {getPickedEditHandle} from './utils';\nimport {DrawPolygonMode} from './draw-polygon-mode';\n\ntype DraggingHandler = (event: DraggingEvent, props: ModeProps<SimpleFeatureCollection>) => void;\n\nexport class DrawPolygonByDraggingMode extends DrawPolygonMode {\n  handleDraggingThrottled: DraggingHandler | null | undefined = null;\n\n  handleClick(event: ClickEvent, props: ModeProps<SimpleFeatureCollection>) {\n    // No-op\n  }\n\n  handleStartDragging(event: StartDraggingEvent, props: ModeProps<SimpleFeatureCollection>) {\n    event.cancelPan();\n    if (props.modeConfig && props.modeConfig.throttleMs) {\n      // eslint-disable-next-line @typescript-eslint/unbound-method\n      this.handleDraggingThrottled = throttle(this.handleDraggingAux, props.modeConfig.throttleMs);\n    } else {\n      // eslint-disable-next-line @typescript-eslint/unbound-method\n      this.handleDraggingThrottled = this.handleDraggingAux;\n    }\n  }\n\n  handleStopDragging(event: StopDraggingEvent, props: ModeProps<SimpleFeatureCollection>) {\n    this.addClickSequence(event);\n    const clickSequence = this.getClickSequence();\n    // @ts-expect-error cancel() not typed\n    if (this.handleDraggingThrottled && this.handleDraggingThrottled.cancel) {\n      // @ts-expect-error cancel() not typed\n      this.handleDraggingThrottled.cancel();\n    }\n\n    if (clickSequence.length > 2) {\n      // Complete the polygon.\n      const polygonToAdd: Polygon = {\n        type: 'Polygon',\n        coordinates: [[...clickSequence, clickSequence[0]]]\n      };\n\n      const editAction = this.getAddFeatureOrBooleanPolygonAction(polygonToAdd, props);\n      if (editAction) {\n        props.onEdit(editAction);\n      }\n    }\n    this.resetClickSequence();\n  }\n\n  handleDraggingAux(event: DraggingEvent, props: ModeProps<SimpleFeatureCollection>) {\n    const {picks} = event;\n    const clickedEditHandle = getPickedEditHandle(picks);\n\n    if (!clickedEditHandle) {\n      // Don't add another point right next to an existing one.\n      this.addClickSequence(event);\n      props.onEdit({\n        updatedData: props.data,\n        editType: 'addTentativePosition',\n        editContext: {\n          position: event.mapCoords\n        }\n      });\n    }\n  }\n\n  handleDragging(event: DraggingEvent, props: ModeProps<SimpleFeatureCollection>) {\n    if (this.handleDraggingThrottled) {\n      this.handleDraggingThrottled(event, props);\n    }\n  }\n\n  handleKeyUp(event: KeyboardEvent, props: ModeProps<SimpleFeatureCollection>) {\n    if (event.key === 'Enter') {\n      const clickSequence = this.getClickSequence();\n      if (clickSequence.length > 2) {\n        const polygonToAdd: Polygon = {\n          type: 'Polygon',\n          coordinates: [[...clickSequence, clickSequence[0]]]\n        };\n        this.resetClickSequence();\n\n        const editAction = this.getAddFeatureOrBooleanPolygonAction(polygonToAdd, props);\n        if (editAction) {\n          props.onEdit(editAction);\n        }\n      }\n    } else if (event.key === 'Escape') {\n      this.resetClickSequence();\n      if (this.handleDraggingThrottled) {\n        this.handleDraggingThrottled = null;\n      }\n      props.onEdit({\n        // Because the new drawing feature is dropped, so the data will keep as the same.\n        updatedData: props.data,\n        editType: 'cancelFeature',\n        editContext: {}\n      });\n    }\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n  Position,\n  FeatureCollection,\n  SimpleFeatureCollection,\n  SimpleFeature\n} from '../utils/geojson-types';\nimport {\n  PointerMoveEvent,\n  StartDraggingEvent,\n  StopDraggingEvent,\n  DraggingEvent,\n  ModeProps,\n  Pick,\n  GuideFeatureCollection,\n  EditHandleFeature\n} from './types';\nimport {\n  getPickedSnapSourceEditHandle,\n  getPickedEditHandles,\n  getEditHandlesForGeometry\n} from './utils';\nimport {GeoJsonEditMode} from './geojson-edit-mode';\n\ntype MovementTypeEvent = PointerMoveEvent | StartDraggingEvent | StopDraggingEvent | DraggingEvent;\n\nexport class SnappableMode extends GeoJsonEditMode {\n  _handler: GeoJsonEditMode;\n\n  constructor(handler: GeoJsonEditMode) {\n    super();\n    this._handler = handler;\n  }\n\n  _getSnappedMouseEvent<T extends MovementTypeEvent>(\n    event: T,\n    snapSource: EditHandleFeature,\n    snapTarget: EditHandleFeature\n  ): T {\n    return Object.assign(event, {\n      mapCoords: snapTarget.geometry.coordinates,\n      pointerDownMapCoords: snapSource && snapSource.geometry.coordinates\n    });\n  }\n\n  _getPickedSnapTarget(picks: Pick[]): EditHandleFeature | null | undefined {\n    return getPickedEditHandles(picks).find(\n      (handle) => handle.properties.editHandleType === 'snap-target'\n    );\n  }\n\n  _getPickedSnapSource(\n    pointerDownPicks: Pick[] | null | undefined\n  ): EditHandleFeature | null | undefined {\n    return getPickedSnapSourceEditHandle(pointerDownPicks);\n  }\n\n  _getUpdatedSnapSourceHandle(\n    snapSourceHandle: EditHandleFeature,\n    data: SimpleFeatureCollection\n  ): EditHandleFeature {\n    const {featureIndex, positionIndexes} = snapSourceHandle.properties;\n    if (!Array.isArray(positionIndexes)) {\n      return snapSourceHandle;\n    }\n    const snapSourceFeature = data.features[featureIndex];\n\n    // $FlowFixMe\n    const snapSourceCoordinates = positionIndexes.reduce(\n      (a: any[], b: number) => a[b],\n      snapSourceFeature.geometry.coordinates\n    ) as Position;\n\n    return {\n      ...snapSourceHandle,\n      geometry: {\n        type: 'Point',\n        coordinates: snapSourceCoordinates\n      }\n    };\n  }\n\n  // If additionalSnapTargets is present in modeConfig and is populated, this\n  // method will return those features along with the features\n  // that live in the current layer. Otherwise, this method will simply return the\n  // features from the current layer\n  _getSnapTargets(props: ModeProps<SimpleFeatureCollection>): SimpleFeature[] {\n    let {additionalSnapTargets} = props.modeConfig || {};\n    additionalSnapTargets = additionalSnapTargets || [];\n\n    const features = [...props.data.features, ...additionalSnapTargets];\n    return features;\n  }\n\n  _getSnapTargetHandles(props: ModeProps<SimpleFeatureCollection>): EditHandleFeature[] {\n    const handles: EditHandleFeature[] = [];\n    const features = this._getSnapTargets(props);\n\n    for (let i = 0; i < features.length; i++) {\n      // Filter out the currently selected feature(s)\n      const isCurrentIndexFeatureNotSelected = !props.selectedIndexes.includes(i);\n\n      if (isCurrentIndexFeatureNotSelected) {\n        const {geometry} = features[i];\n        handles.push(...getEditHandlesForGeometry(geometry, i, 'snap-target'));\n      }\n    }\n    return handles;\n  }\n\n  // If no snap handle has been picked, only display the edit handles of the\n  // selected feature. If a snap handle has been picked, display said snap handle\n  // along with all snappable points on all non-selected features.\n  getGuides(props: ModeProps<SimpleFeatureCollection>): GuideFeatureCollection {\n    const {modeConfig, lastPointerMoveEvent} = props;\n    const {enableSnapping} = modeConfig || {};\n\n    const guides: GuideFeatureCollection = {\n      type: 'FeatureCollection',\n      features: [...this._handler.getGuides(props).features]\n    };\n\n    if (!enableSnapping) {\n      return guides;\n    }\n\n    const snapSourceHandle: EditHandleFeature | null | undefined =\n      lastPointerMoveEvent && this._getPickedSnapSource(lastPointerMoveEvent.pointerDownPicks);\n\n    // They started dragging a handle\n    // So render the picked handle (in its updated location) and all possible snap targets\n    if (snapSourceHandle) {\n      guides.features.push(\n        ...this._getSnapTargetHandles(props),\n        this._getUpdatedSnapSourceHandle(snapSourceHandle, props.data)\n      );\n\n      return guides;\n    }\n\n    // Render the possible snap source handles\n    const {features} = props.data;\n    for (const index of props.selectedIndexes) {\n      if (index < features.length) {\n        const {geometry} = features[index];\n        guides.features.push(...getEditHandlesForGeometry(geometry, index, 'snap-source'));\n      }\n    }\n\n    return guides;\n  }\n\n  _getSnapAwareEvent<T extends MovementTypeEvent>(\n    event: T,\n    props: ModeProps<FeatureCollection>\n  ): T {\n    const snapSource = this._getPickedSnapSource(props.lastPointerMoveEvent.pointerDownPicks);\n    const snapTarget = this._getPickedSnapTarget(event.picks);\n\n    return snapSource && snapTarget\n      ? this._getSnappedMouseEvent(event, snapSource, snapTarget)\n      : event;\n  }\n\n  handleStartDragging(event: StartDraggingEvent, props: ModeProps<FeatureCollection>) {\n    this._handler.handleStartDragging(event, props);\n  }\n\n  handleStopDragging(event: StopDraggingEvent, props: ModeProps<FeatureCollection>) {\n    this._handler.handleStopDragging(this._getSnapAwareEvent(event, props), props);\n  }\n\n  handleDragging(event: DraggingEvent, props: ModeProps<FeatureCollection>) {\n    this._handler.handleDragging(this._getSnapAwareEvent(event, props), props);\n  }\n\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>) {\n    this._handler.handlePointerMove(this._getSnapAwareEvent(event, props), props);\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {featureCollection} from '@turf/helpers';\nimport {PointerMoveEvent, ModeProps, StartDraggingEvent} from './types';\nimport {FeatureCollection} from '../utils/geojson-types';\nimport {TranslateMode} from './translate-mode';\nimport {ScaleMode} from './scale-mode';\nimport {RotateMode} from './rotate-mode';\n\nimport {CompositeMode} from './composite-mode';\nimport {GeoJsonEditMode} from './geojson-edit-mode';\n\nexport class TransformMode extends CompositeMode {\n  constructor() {\n    super([new TranslateMode(), new ScaleMode(), new RotateMode()]);\n  }\n\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>) {\n    let updatedCursor: string | null = null;\n    super.handlePointerMove(event, {\n      ...props,\n      onUpdateCursor: (cursor) => {\n        updatedCursor = cursor || updatedCursor;\n      }\n    });\n    props.onUpdateCursor(updatedCursor);\n  }\n\n  handleStartDragging(event: StartDraggingEvent, props: ModeProps<FeatureCollection>) {\n    let scaleMode: ScaleMode | null = null;\n    let translateMode: TranslateMode | null = null;\n    const filteredModes: GeoJsonEditMode[] = [];\n\n    if (event.picks.length) {\n      event.cancelPan();\n    }\n\n    // If the user selects a scaling edit handle that overlaps with part of the selected feature,\n    // it is possible for both scale and translate actions to be triggered. This logic prevents\n    // this simultaneous action trigger from happening by putting a higher priority on scaling\n    // since the user needs to be more precise to hover over a scaling edit handle.\n    this._modes.forEach((mode) => {\n      if (mode instanceof TranslateMode) {\n        translateMode = mode;\n      } else {\n        if (mode instanceof ScaleMode) {\n          scaleMode = mode;\n        }\n        filteredModes.push(mode);\n      }\n    });\n\n    if (scaleMode instanceof ScaleMode && !scaleMode.isEditHandleSelected()) {\n      filteredModes.push(translateMode);\n    }\n\n    filteredModes.filter(Boolean).forEach((mode) => mode.handleStartDragging(event, props));\n  }\n\n  getGuides(props: ModeProps<FeatureCollection>) {\n    let compositeGuides = super.getGuides(props);\n    const rotateMode = (this._modes || []).find((mode) => mode instanceof RotateMode);\n\n    if (rotateMode instanceof RotateMode) {\n      const nonEnvelopeGuides = compositeGuides.features.filter((guide) => {\n        const {editHandleType, mode} = (guide.properties as any) || {};\n        // Both scale and rotate modes have the same enveloping box as a guide - only need one\n        const guidesToFilterOut = [mode];\n        // Do not render scaling edit handles if rotating\n        if (rotateMode.getIsRotating()) {\n          guidesToFilterOut.push(editHandleType);\n        }\n        return !guidesToFilterOut.includes('scale');\n      });\n\n      // @ts-expect-error turf types\n      compositeGuides = featureCollection(nonEnvelopeGuides);\n    }\n    return compositeGuides;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {FeatureCollection} from '../utils/geojson-types';\nimport {\n  ModeProps,\n  ClickEvent,\n  PointerMoveEvent,\n  StartDraggingEvent,\n  StopDraggingEvent,\n  DraggingEvent,\n  GuideFeatureCollection,\n  GuideFeature\n} from './types';\nimport {GeoJsonEditMode} from './geojson-edit-mode';\n\nexport class CompositeMode extends GeoJsonEditMode {\n  _modes: Array<GeoJsonEditMode>;\n\n  constructor(modes: Array<GeoJsonEditMode>) {\n    super();\n    this._modes = modes;\n  }\n\n  _coalesce<T>(\n    callback: (arg0: GeoJsonEditMode) => T,\n    resultEval: ((arg0: T) => boolean | null | undefined) | null = null\n  ): T {\n    let result: T | null = null;\n\n    for (let i = 0; i < this._modes.length; i++) {\n      // eslint-disable-next-line callback-return\n      result = callback(this._modes[i]);\n      if (resultEval ? resultEval(result) : result) {\n        break;\n      }\n    }\n\n    return result;\n  }\n\n  handleClick(event: ClickEvent, props: ModeProps<FeatureCollection>): void {\n    this._coalesce((handler) => handler.handleClick(event, props));\n  }\n\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>): void {\n    return this._coalesce((handler) => handler.handlePointerMove(event, props));\n  }\n\n  handleStartDragging(event: StartDraggingEvent, props: ModeProps<FeatureCollection>): void {\n    return this._coalesce((handler) => handler.handleStartDragging(event, props));\n  }\n\n  handleStopDragging(event: StopDraggingEvent, props: ModeProps<FeatureCollection>): void {\n    return this._coalesce((handler) => handler.handleStopDragging(event, props));\n  }\n\n  handleDragging(event: DraggingEvent, props: ModeProps<FeatureCollection>): void {\n    return this._coalesce((handler) => handler.handleDragging(event, props));\n  }\n\n  getGuides(props: ModeProps<FeatureCollection>): GuideFeatureCollection {\n    // TODO: Combine the guides *BUT* make sure if none of the results have\n    // changed to return the same object so that \"guides !== this.state.guides\"\n    // in editable-geojson-layer works.\n\n    const allGuides: GuideFeature[] = [];\n    for (const mode of this._modes) {\n      allGuides.push(...mode.getGuides(props).features);\n    }\n\n    return {\n      type: 'FeatureCollection',\n      features: allGuides\n    };\n  }\n}\n", "import {FeatureCollection} from '../utils/geojson-types';\n\nimport {GeoJsonEditMode} from './geojson-edit-mode';\nimport {ClickEvent, ModeProps} from './types';\nexport class DeleteMode extends GeoJsonEditMode {\n  handleClick(_event: ClickEvent, props: ModeProps<FeatureCollection>): void {\n    const selectedFeatureIndexes = props.lastPointerMoveEvent.picks.map((pick) => pick.index);\n    if (selectedFeatureIndexes.length > 0) {\n      const indexToDelete = selectedFeatureIndexes[0];\n\n      const features = props.data.features.filter((_, index) => index !== indexToDelete);\n      const updatedData = {\n        ...props.data,\n        features\n      };\n\n      const editAction = {\n        updatedData,\n        editType: 'deleteFeature',\n        editContext: {\n          featureIndexes: selectedFeatureIndexes\n        }\n      };\n\n      props.onEdit(editAction);\n    }\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/**\n * A multiplier for screen-space width/scale for Arc, Line, Icon and Text layers.\n * Required in order to maintain the same appearance after upgrading to deck.gl v8.5.\n * https://github.com/visgl/deck.gl/blob/master/docs/upgrade-guide.md\n */\nexport const PROJECTED_PIXEL_SIZE_MULTIPLIER = 2 / 3;\n\n/**\n * Unit literal to shader unit number conversion.\n */\nexport const UNIT = {\n  common: 0,\n  meters: 1,\n  pixels: 2\n};\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* eslint-env browser */\n\nimport type {CompositeLayerProps} from '@deck.gl/core';\nimport {CompositeLayer} from '@deck.gl/core';\nimport {\n  DraggingEvent,\n  ClickEvent,\n  StartDraggingEvent,\n  StopDraggingEvent,\n  PointerMoveEvent,\n  DoubleClickEvent\n} from '../edit-modes/types';\nimport {Position} from '../utils/geojson-types';\n\nconst EVENT_TYPES = ['click', 'pointermove', 'panstart', 'panmove', 'panend', 'keyup', 'dblclick'];\n\n// TODO(v9): remove generic layer\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport type EditableLayerProps<DataType = any> = CompositeLayerProps & {\n  pickingRadius?: number;\n  pickingDepth?: number;\n  onCancelPan?: () => void;\n};\n\nexport abstract class EditableLayer<\n  DataT = any,\n  ExtraPropsT = Record<string, unknown>\n> extends CompositeLayer<ExtraPropsT & Required<EditableLayerProps<DataT>>> {\n  static layerName = 'EditableLayer';\n\n  state: {_editableLayerState: any} = undefined!;\n\n  // Overridable interaction event handlers\n  onLayerClick(event: ClickEvent): void {\n    // default implementation - do nothing\n  }\n  onLayerDoubleClick(event: DoubleClickEvent): void {\n    // default implementation - do nothing\n  }\n\n  onStartDragging(event: StartDraggingEvent): void {\n    // default implementation - do nothing\n  }\n\n  onStopDragging(event: StopDraggingEvent): void {\n    // default implementation - do nothing\n  }\n\n  onDragging(event: DraggingEvent): void {\n    // default implementation - do nothing\n  }\n\n  onPointerMove(event: PointerMoveEvent): void {\n    // default implementation - do nothing\n  }\n\n  onLayerKeyUp(event: KeyboardEvent): void {\n    // default implementation - do nothing;\n  }\n  // TODO: implement onCancelDragging (e.g. drag off screen)\n\n  initializeState() {\n    this.setState({\n      _editableLayerState: {\n        // Picked objects at the time the pointer went down\n        pointerDownPicks: null,\n        // Screen coordinates where the pointer went down\n        pointerDownScreenCoords: null,\n        // Ground coordinates where the pointer went down\n        pointerDownMapCoords: null,\n\n        // Keep track of the mjolnir.js event handler so it can be deregistered\n        eventHandler: this._forwardEventToCurrentLayer.bind(this)\n      }\n    });\n\n    this._addEventHandlers();\n  }\n\n  finalizeState() {\n    this._removeEventHandlers();\n  }\n\n  _addEventHandlers() {\n    // @ts-expect-error accessing protected props\n    const {eventManager} = this.context.deck;\n    const {eventHandler} = this.state._editableLayerState;\n\n    for (const eventType of EVENT_TYPES) {\n      eventManager.on(eventType as any, eventHandler, {\n        // give nebula a higher priority so that it can stop propagation to deck.gl's map panning handlers\n        priority: 100\n      });\n    }\n  }\n\n  _removeEventHandlers() {\n    // @ts-expect-error accessing protected props\n    const {eventManager} = this.context.deck;\n    const {eventHandler} = this.state._editableLayerState;\n\n    for (const eventType of EVENT_TYPES) {\n      eventManager.off(eventType as any, eventHandler);\n    }\n  }\n\n  // A new layer instance is created on every render, so forward the event to the current layer\n  // This means that the first layer instance will stick around to be the event listener, but will forward the event\n  // to the latest layer instance.\n  _forwardEventToCurrentLayer(event: any) {\n    const currentLayer = this.getCurrentLayer();\n\n    // Use a naming convention to find the event handling function for this event type\n    const func = currentLayer[`_on${event.type}`].bind(currentLayer);\n    if (!func) {\n      console.warn(`no handler for mjolnir.js event ${event.type}`); // eslint-disable-line\n      return;\n    }\n    func(event);\n  }\n\n  _onclick({srcEvent}: any) {\n    const screenCoords = this.getScreenCoords(srcEvent) as [number, number];\n    const mapCoords = this.getMapCoords(screenCoords);\n\n    const picks = this.getPicks(screenCoords);\n\n    this.onLayerClick({\n      mapCoords,\n      screenCoords,\n      picks,\n      sourceEvent: srcEvent\n    });\n  }\n\n  _ondblclick({srcEvent}: any) {\n    this.onLayerDoubleClick(srcEvent);\n  }\n\n  _onkeyup({srcEvent}: {srcEvent: KeyboardEvent}) {\n    this.onLayerKeyUp(srcEvent);\n  }\n\n  _onpanstart(event: any) {\n    const screenCoords = this.getScreenCoords(event.srcEvent) as [number, number];\n    const mapCoords = this.getMapCoords(screenCoords);\n    const picks = this.getPicks(screenCoords);\n\n    this.setState({\n      _editableLayerState: {\n        ...this.state._editableLayerState,\n        pointerDownScreenCoords: screenCoords,\n        pointerDownMapCoords: mapCoords,\n        pointerDownPicks: picks\n      }\n    });\n\n    this.onStartDragging({\n      picks,\n      screenCoords,\n      mapCoords,\n      pointerDownScreenCoords: screenCoords,\n      pointerDownMapCoords: mapCoords,\n      cancelPan: () => {\n        if (this.props.onCancelPan) {\n          this.props.onCancelPan();\n        }\n\n        event.stopImmediatePropagation();\n      },\n      sourceEvent: event.srcEvent\n    });\n  }\n\n  _onpanmove(event: any) {\n    const {srcEvent} = event;\n    const screenCoords = this.getScreenCoords(srcEvent) as [number, number];\n    const mapCoords = this.getMapCoords(screenCoords);\n\n    const {pointerDownPicks, pointerDownScreenCoords, pointerDownMapCoords} =\n      this.state._editableLayerState;\n\n    const picks = this.getPicks(screenCoords);\n\n    this.onDragging({\n      screenCoords,\n      mapCoords,\n      picks,\n      pointerDownPicks,\n      pointerDownScreenCoords,\n      pointerDownMapCoords,\n      sourceEvent: srcEvent,\n      cancelPan: event.stopImmediatePropagation\n      // another (hacky) approach for cancelling map panning\n      // const controller = this.context.deck.viewManager.controllers[\n      //   Object.keys(this.context.deck.viewManager.controllers)[0]\n      // ];\n      // controller._state.isDragging = false;\n    });\n  }\n\n  _onpanend({srcEvent}: any) {\n    const screenCoords = this.getScreenCoords(srcEvent) as [number, number];\n    const mapCoords = this.getMapCoords(screenCoords);\n\n    const {pointerDownPicks, pointerDownScreenCoords, pointerDownMapCoords} =\n      this.state._editableLayerState;\n\n    const picks = this.getPicks(screenCoords);\n\n    this.onStopDragging({\n      picks,\n      screenCoords,\n      mapCoords,\n      pointerDownPicks,\n      pointerDownScreenCoords,\n      pointerDownMapCoords,\n      sourceEvent: srcEvent\n    });\n\n    this.setState({\n      _editableLayerState: {\n        ...this.state._editableLayerState,\n        pointerDownScreenCoords: null,\n        pointerDownMapCoords: null,\n        pointerDownPicks: null\n      }\n    });\n  }\n\n  _onpointermove(event: any) {\n    const {srcEvent} = event;\n    const screenCoords = this.getScreenCoords(srcEvent) as [number, number];\n    const mapCoords = this.getMapCoords(screenCoords);\n\n    const {pointerDownPicks, pointerDownScreenCoords, pointerDownMapCoords} =\n      this.state._editableLayerState;\n\n    const picks = this.getPicks(screenCoords);\n\n    this.onPointerMove({\n      screenCoords,\n      mapCoords,\n      picks,\n      pointerDownPicks,\n      pointerDownScreenCoords,\n      pointerDownMapCoords,\n      sourceEvent: srcEvent,\n      cancelPan: event.stopImmediatePropagation\n    });\n  }\n\n  getPicks(screenCoords: [number, number]) {\n    return this.context.deck.pickMultipleObjects({\n      x: screenCoords[0],\n      y: screenCoords[1],\n      layerIds: [this.props.id],\n      radius: this.props.pickingRadius,\n      depth: this.props.pickingDepth\n    });\n  }\n\n  getScreenCoords(pointerEvent: any): Position {\n    return [\n      pointerEvent.clientX -\n        (this.context.gl.canvas as HTMLCanvasElement).getBoundingClientRect().left,\n      pointerEvent.clientY -\n        (this.context.gl.canvas as HTMLCanvasElement).getBoundingClientRect().top\n    ];\n  }\n\n  getMapCoords(screenCoords: Position): Position {\n    return this.context.viewport.unproject([screenCoords[0], screenCoords[1]]) as Position;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {PathLayerProps} from '@deck.gl/layers';\nimport {PathLayer} from '@deck.gl/layers';\nimport type {ShaderModule} from '@luma.gl/shadertools';\n\nimport {insertBefore} from '../utils/utils';\n\nconst uniformBlock = `\\\nuniform pickingLineWidthUniforms {\n  float extraPixels;\n} pickingLineWidth;\n`;\n\nexport type PickingLineWidthProps = {\n  extraPixels: number;\n};\n\nexport const pickingUniforms = {\n  name: 'pickingLineWidth',\n  vs: uniformBlock,\n  fs: uniformBlock,\n  uniformTypes: {\n    extraPixels: 'f32'\n  }\n} as const satisfies ShaderModule<PickingLineWidthProps>;\n\ninterface EditablePathLayerProps extends PathLayerProps<any> {\n  pickingLineWidthExtraPixels?: number;\n}\n\nconst defaultProps = {\n  ...PathLayer.defaultProps,\n  pickingLineWidthExtraPixels: {type: 'number', min: 0, value: Number.MAX_SAFE_INTEGER}\n};\n\nexport class EditablePathLayer extends PathLayer<any, EditablePathLayerProps> {\n  getShaders() {\n    const shaders = super.getShaders();\n\n    shaders.vs = insertBefore(\n      shaders.vs,\n      'vec3 width;',\n      `\n       if(bool(picking.isActive)){\n        widthPixels.xy += pickingLineWidth.extraPixels;\n       }\n      `\n    );\n\n    return {\n      ...shaders,\n      modules: [...shaders.modules, pickingUniforms]\n    };\n  }\n\n  draw(props) {\n    const {pickingLineWidthExtraPixels} = this.props;\n    const pickingProps: PickingLineWidthProps = {extraPixels: pickingLineWidthExtraPixels};\n    const model = this.state.model;\n    model.shaderInputs.setProps({pickingLineWidth: pickingProps});\n    super.draw(props);\n  }\n}\n\nEditablePathLayer.defaultProps = defaultProps;\nEditablePathLayer.layerName = 'EditablePathLayer';\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* eslint-env browser */\n\nimport type {DefaultProps} from '@deck.gl/core';\nimport {H3ClusterLayer} from '@deck.gl/geo-layers';\n// TODO: Fix H3 support.\n// import { polyfill, geoToH3 } from 'h3-js';\nimport {PROJECTED_PIXEL_SIZE_MULTIPLIER} from '../constants';\nimport {EditableGeoJsonLayer} from './editable-geojson-layer';\nimport {EditableLayer, EditableLayerProps} from './editable-layer';\nimport {ViewMode} from '../edit-modes/view-mode';\n\nconst DEFAULT_EDIT_MODE = ViewMode;\nconst DEFAULT_H3_RESOLUTION = 9;\nconst EMPTY_FEATURE_COLLECTION = {\n  type: 'FeatureCollection',\n  features: []\n};\n\nexport type EditableH3ClusterLayerProps<DataT> = EditableLayerProps & {\n  data: DataT;\n  resolution?: number;\n  mode?: any;\n  modeConfig?: any;\n  selectedIndexes?: number[];\n  getEditedCluster?: (updatedHexagons: any[], existingCluster: any) => any;\n  getHexagons?: (d) => number[];\n  onEdit?: (updatedData?, editType?: string, featureIndexes?: number[], editContext?) => void;\n  filled?: boolean;\n  stroked?: boolean;\n  lineWidthScale?: number;\n  lineWidthMinPixels?: number;\n  lineWidthMaxPixels?: number;\n  lineWidthUnits?: string;\n};\n\nconst defaultProps: DefaultProps<EditableH3ClusterLayerProps<any>> = {\n  mode: DEFAULT_EDIT_MODE,\n\n  ...EditableGeoJsonLayer.defaultProps,\n\n  // h3 layer\n  data: [],\n  selectedIndexes: [],\n  filled: false,\n  stroked: true,\n  lineWidthScale: PROJECTED_PIXEL_SIZE_MULTIPLIER,\n  lineWidthMinPixels: 1,\n  lineWidthMaxPixels: Number.MAX_SAFE_INTEGER,\n  lineWidthUnits: 'pixels',\n  getHexagons: (d) => d.hexIds,\n  getEditedCluster: (updatedHexagons, existingCluster) => {\n    if (existingCluster) {\n      return {\n        ...existingCluster,\n        hexIds: updatedHexagons\n      };\n    }\n    return {\n      hexIds: updatedHexagons\n    };\n  },\n  resolution: DEFAULT_H3_RESOLUTION\n};\n\nexport class EditableH3ClusterLayer extends EditableLayer<any, EditableH3ClusterLayerProps<any>> {\n  static layerName = 'EditableH3ClusterLayer';\n  static defaultProps = defaultProps;\n\n  state: EditableLayer['state'] & {\n    cursor?: 'grabbing' | 'grab' | null;\n    tentativeHexagonIDs: string[];\n  } = undefined!;\n\n  initializeState() {\n    super.initializeState();\n\n    this.setState({\n      tentativeHexagonIDs: []\n    });\n  }\n\n  // convert array of (lng, lat) coords to cluster of hexes\n  getDerivedHexagonIDs(coords) {\n    throw new Error('not implemented'); // TODO\n    // return polyfill(coords, this.props.resolution, true);\n  }\n\n  // convert pair of (lng, lat) coords into single hex\n  getDerivedHexagonID(coords) {\n    throw new Error('not implemented'); // TODO\n    // return geoToH3(coords[1], coords[0], this.props.resolution);\n  }\n\n  renderLayers() {\n    const layers: any = [\n      new EditableGeoJsonLayer(\n        this.getSubLayerProps({\n          id: 'editable-geojson',\n\n          mode: this.props.mode,\n          data: EMPTY_FEATURE_COLLECTION,\n          selectedFeatureIndexes: [],\n\n          onEdit: (editAction) => {\n            const {editType, editContext} = editAction;\n\n            switch (editType) {\n              case 'updateTentativeFeature':\n                // tentative feature updates, updated on every pointer move\n                if (editContext.feature.geometry.type === 'Polygon') {\n                  const coords = editContext.feature.geometry.coordinates;\n                  const hexIDs = this.getDerivedHexagonIDs(coords);\n\n                  this.setState({tentativeHexagonIDs: hexIDs});\n                } else if (editContext.feature.geometry.type === 'Point') {\n                  const coords = editContext.feature.geometry.coordinates;\n                  const hexID = this.getDerivedHexagonID(coords);\n\n                  this.setState({tentativeHexagonIDs: [hexID]});\n                }\n                break;\n              case 'addFeature':\n                const updatedData = [...this.props.data];\n                const {modeConfig} = this.props;\n\n                if (!modeConfig || !modeConfig.booleanOperation) {\n                  // add new h3 cluster\n                  updatedData.push(\n                    this.props.getEditedCluster(this.state.tentativeHexagonIDs, null)\n                  );\n                } else if (this.props.selectedIndexes.length !== 1) {\n                  // eslint-disable-next-line no-console,no-undef\n                  console.warn('booleanOperation only supported for single cluster selection');\n                } else {\n                  // they're affecting a selected cluster\n                  let finalHexagonIDs: (string | number)[];\n                  const committedHexagonIDs = new Set<string | number>(this.getSelectedHexIDs());\n                  const tentativeHexagonIDs = new Set<string | number>(\n                    this.state.tentativeHexagonIDs\n                  );\n\n                  switch (modeConfig.booleanOperation) {\n                    case 'union':\n                    default:\n                      finalHexagonIDs = [\n                        ...new Set([...committedHexagonIDs, ...tentativeHexagonIDs])\n                      ];\n                      break;\n                    case 'intersection':\n                      finalHexagonIDs = [...committedHexagonIDs].filter((hexID: string | number) =>\n                        tentativeHexagonIDs.has(hexID)\n                      );\n                      break;\n                    case 'difference':\n                      finalHexagonIDs = [...committedHexagonIDs].filter(\n                        (hexID: string | number) => !tentativeHexagonIDs.has(hexID)\n                      );\n                      break;\n                  }\n\n                  const selectedIndex = this.props.selectedIndexes[0];\n                  const existingCluster = this.props.data[selectedIndex];\n                  updatedData[selectedIndex] = this.props.getEditedCluster(\n                    finalHexagonIDs,\n                    existingCluster\n                  );\n                }\n\n                this.setState({\n                  tentativeHexagonIDs: []\n                });\n\n                this.props.onEdit({updatedData});\n\n                break;\n              default:\n                break;\n            }\n          }\n        })\n      ),\n\n      new H3ClusterLayer(\n        this.getSubLayerProps({\n          id: 'hexagons',\n          data: this.props.data,\n          getHexagons: this.props.getHexagons\n        })\n      ),\n      new H3ClusterLayer(\n        this.getSubLayerProps({\n          id: 'tentative-hexagons',\n          data: [\n            {\n              hexIds: this.state.tentativeHexagonIDs\n            }\n          ],\n          getHexagons: (d) => d.hexIds\n        })\n      )\n    ];\n    return layers;\n  }\n\n  // because data is an array of hexagon data, we take the cumulative of all selected indexes,\n  // using props.getHexagons to support multiple data types\n  getSelectedHexIDs() {\n    let cumulativeHexIDs: number[] = [];\n    this.props.selectedIndexes.forEach((index) => {\n      const selectedCluster = this.props.data[index];\n      const hexIDs = this.props.getHexagons(selectedCluster);\n      cumulativeHexIDs = cumulativeHexIDs.concat(hexIDs);\n    });\n    return cumulativeHexIDs;\n  }\n\n  getCursor({isDragging}: {isDragging: boolean}): 'grabbing' | 'grab' {\n    let {cursor} = this.state || {};\n    if (!cursor) {\n      // default cursor\n      cursor = isDragging ? 'grabbing' : 'grab';\n    }\n    return cursor;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* eslint-env browser */\n\nimport type {CompositeLayerProps, DefaultProps} from '@deck.gl/core';\nimport {CompositeLayer} from '@deck.gl/core';\nimport {PolygonLayer} from '@deck.gl/layers';\nimport {featureCollection, polygon} from '@turf/helpers';\nimport turfBuffer from '@turf/buffer';\nimport turfDifference from '@turf/difference';\n\nimport {EditableGeoJsonLayer} from './editable-geojson-layer';\nimport {DrawRectangleMode} from '../edit-modes/draw-rectangle-mode';\nimport {DrawPolygonMode} from '../edit-modes/draw-polygon-mode';\nimport {ViewMode} from '../edit-modes/view-mode';\n\nexport const SELECTION_TYPE = {\n  NONE: null,\n  RECTANGLE: 'rectangle',\n  POLYGON: 'polygon'\n};\n\nconst MODE_MAP = {\n  [SELECTION_TYPE.RECTANGLE]: DrawRectangleMode,\n  [SELECTION_TYPE.POLYGON]: DrawPolygonMode\n};\n\nconst MODE_CONFIG_MAP = {\n  [SELECTION_TYPE.RECTANGLE]: {dragToDraw: true}\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport interface SelectionLayerProps<DataT> extends CompositeLayerProps {\n  layerIds: any[];\n  onSelect: (info: any) => any;\n  selectionType: string | null;\n}\n\nconst defaultProps: DefaultProps<SelectionLayerProps<any>> = {\n  selectionType: SELECTION_TYPE.RECTANGLE,\n  layerIds: [],\n  onSelect: () => {}\n};\n\nconst EMPTY_DATA = {\n  type: 'FeatureCollection',\n  features: []\n};\n\nconst EXPANSION_KM = 50;\nconst LAYER_ID_GEOJSON = 'selection-geojson';\nconst LAYER_ID_BLOCKER = 'selection-blocker';\n\nconst PASS_THROUGH_PROPS = [\n  'lineWidthScale',\n  'lineWidthMinPixels',\n  'lineWidthMaxPixels',\n  'lineWidthUnits',\n  'lineJointRounded',\n  'lineCapRounded',\n  'lineMiterLimit',\n  'pointRadiusScale',\n  'pointRadiusMinPixels',\n  'pointRadiusMaxPixels',\n  'lineDashJustified',\n  'getLineColor',\n  'getFillColor',\n  'getRadius',\n  'getLineWidth',\n  'getLineDashArray',\n  'getTentativeLineDashArray',\n  'getTentativeLineColor',\n  'getTentativeFillColor',\n  'getTentativeLineWidth'\n];\nexport class SelectionLayer<DataT, ExtraPropsT> extends CompositeLayer<\n  ExtraPropsT & Required<SelectionLayerProps<DataT>>\n> {\n  static layerName = 'SelectionLayer';\n  static defaultProps = defaultProps;\n\n  state: {\n    pendingPolygonSelection: {\n      bigPolygon: ReturnType<typeof turfDifference>;\n    };\n  } = undefined!;\n\n  _selectRectangleObjects(coordinates: any) {\n    const {layerIds, onSelect} = this.props;\n    const [x1, y1] = this.context.viewport.project(coordinates[0][0]);\n    const [x2, y2] = this.context.viewport.project(coordinates[0][2]);\n    const pickingInfos = this.context.deck.pickObjects({\n      x: Math.min(x1, x2),\n      y: Math.min(y1, y2),\n      width: Math.abs(x2 - x1),\n      height: Math.abs(y2 - y1),\n      layerIds\n    });\n\n    onSelect({pickingInfos});\n  }\n\n  _selectPolygonObjects(coordinates: any) {\n    const {layerIds, onSelect} = this.props;\n    const mousePoints = coordinates[0].map((c) => this.context.viewport.project(c));\n\n    const allX = mousePoints.map((mousePoint) => mousePoint[0]);\n    const allY = mousePoints.map((mousePoint) => mousePoint[1]);\n    const x = Math.min(...allX);\n    const y = Math.min(...allY);\n    const maxX = Math.max(...allX);\n    const maxY = Math.max(...allY);\n\n    // Use a polygon to hide the outside, because pickObjects()\n    // does not support polygons\n    const landPointsPoly = polygon(coordinates);\n    const bigBuffer = turfBuffer(landPointsPoly, EXPANSION_KM);\n    let bigPolygon;\n    try {\n      // turfDifference throws an exception if the polygon\n      // intersects with itself (TODO: check if true in all versions)\n      bigPolygon = turfDifference(featureCollection([bigBuffer, landPointsPoly]));\n    } catch (e) {\n      // invalid selection polygon\n      console.log('turfDifference() error', e); // eslint-disable-line\n      return;\n    }\n\n    this.setState({\n      pendingPolygonSelection: {\n        bigPolygon\n      }\n    });\n\n    const blockerId = `${this.props.id}-${LAYER_ID_BLOCKER}`;\n\n    // HACK, find a better way\n    setTimeout(() => {\n      const pickingInfos = this.context.deck.pickObjects({\n        x,\n        y,\n        width: maxX - x,\n        height: maxY - y,\n        layerIds: [blockerId, ...layerIds]\n      });\n\n      onSelect({\n        pickingInfos: pickingInfos.filter((item) => item.layer.id !== this.props.id)\n      });\n    }, 250);\n  }\n\n  renderLayers() {\n    const {pendingPolygonSelection} = this.state;\n\n    const mode = MODE_MAP[this.props.selectionType] || ViewMode;\n    const modeConfig = MODE_CONFIG_MAP[this.props.selectionType];\n\n    const inheritedProps = {};\n    PASS_THROUGH_PROPS.forEach((p) => {\n      if (this.props[p] !== undefined) inheritedProps[p] = this.props[p];\n    });\n\n    const layers: any[] = [\n      new EditableGeoJsonLayer(\n        this.getSubLayerProps({\n          id: LAYER_ID_GEOJSON,\n          pickable: true,\n          mode,\n          modeConfig,\n          selectedFeatureIndexes: [],\n          data: EMPTY_DATA,\n          onEdit: ({updatedData, editType}) => {\n            if (editType === 'addFeature') {\n              const {coordinates} = updatedData.features[0].geometry;\n\n              if (this.props.selectionType === SELECTION_TYPE.RECTANGLE) {\n                this._selectRectangleObjects(coordinates);\n              } else if (this.props.selectionType === SELECTION_TYPE.POLYGON) {\n                this._selectPolygonObjects(coordinates);\n              }\n            }\n          },\n          ...inheritedProps\n        })\n      )\n    ];\n\n    if (pendingPolygonSelection) {\n      const {bigPolygon} = pendingPolygonSelection as any;\n      layers.push(\n        new PolygonLayer(\n          this.getSubLayerProps({\n            id: LAYER_ID_BLOCKER,\n            pickable: true,\n            stroked: false,\n            opacity: 1.0,\n            data: [bigPolygon],\n            getLineColor: (obj) => [0, 0, 0, 1],\n            getFillColor: (obj) => [0, 0, 0, 1],\n            getPolygon: (o) => o.geometry.coordinates\n          })\n        )\n      );\n    }\n\n    return layers;\n  }\n\n  shouldUpdateState({changeFlags: {stateChanged, propsOrDataChanged}}: Record<string, any>) {\n    return stateChanged || propsOrDataChanged;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n/* eslint-env browser */\n\nimport {CompositeLayer} from '@deck.gl/core';\nimport {ScatterplotLayer, LineLayer} from '@deck.gl/layers';\n\nconst defaultProps = {};\n\nexport class ElevatedEditHandleLayer extends CompositeLayer<any> {\n  static layerName = 'ElevatedEditHandleLayer';\n  static defaultProps = defaultProps;\n  renderLayers() {\n    const handles = new ScatterplotLayer(\n      Object.assign({}, this.props, {\n        id: `${this.props.id}-ScatterplotLayer`,\n        data: this.props.data\n      })\n    );\n\n    const lines = new LineLayer(\n      Object.assign({}, this.props, {\n        id: `${this.props.id}-LineLayer`,\n        data: this.props.data,\n        pickable: false,\n        getSourcePosition: ({position}) => [position[0], position[1], 0],\n        getTargetPosition: ({position}) => [position[0], position[1], position[2] || 0],\n        getColor: [150, 150, 150, 200],\n        getStrokeWidth: 3\n      })\n    );\n\n    return [handles, lines];\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {render} from 'preact';\nimport type {ComponentChild, JSX} from 'preact';\nimport {Widget, type WidgetProps, type WidgetPlacement, type Deck} from '@deck.gl/core';\nimport type {\n  GeoJsonEditModeConstructor,\n  GeoJsonEditModeType\n} from '../edit-modes/geojson-edit-mode';\n\nexport type EditModeTrayWidgetModeOption = {\n  /**\n   * Optional identifier for the mode button.\n   * If not provided, one will be inferred from the supplied mode.\n   */\n  id?: string;\n  /** Edit mode constructor or instance that the button should activate. */\n  mode: GeoJsonEditModeConstructor | GeoJsonEditModeType;\n  /**\n   * The icon or element rendered inside the button.\n   * A simple string can also be supplied for text labels.\n   */\n  icon?: ComponentChild;\n  /** Optional text label rendered below the icon when provided. */\n  label?: string;\n  /** Optional tooltip text applied to the button element. */\n  title?: string;\n};\n\nexport type EditModeTrayWidgetSelectEvent = {\n  id: string;\n  mode: GeoJsonEditModeConstructor | GeoJsonEditModeType;\n  option: EditModeTrayWidgetModeOption;\n};\n\nexport type EditModeTrayWidgetProps = WidgetProps & {\n  /** Placement for the widget root element. */\n  placement?: WidgetPlacement;\n  /** Layout direction for mode buttons. */\n  layout?: 'vertical' | 'horizontal';\n  /** Collection of modes rendered in the tray. */\n  modes?: EditModeTrayWidgetModeOption[];\n  /** Identifier of the currently active mode. */\n  selectedModeId?: string | null;\n  /** Currently active mode instance/constructor. */\n  activeMode?: GeoJsonEditModeConstructor | GeoJsonEditModeType | null;\n  /** Callback fired when the user selects a mode. */\n  onSelectMode?: (event: EditModeTrayWidgetSelectEvent) => void;\n};\n\nconst ROOT_STYLE: Partial<CSSStyleDeclaration> = {\n  position: 'absolute',\n  display: 'flex',\n  pointerEvents: 'auto',\n  userSelect: 'none',\n  zIndex: '99'\n};\n\nconst TRAY_BASE_STYLE: JSX.CSSProperties = {\n  display: 'flex',\n  gap: '6px',\n  background: 'rgba(36, 40, 41, 0.88)',\n  borderRadius: '999px',\n  padding: '6px',\n  alignItems: 'center',\n  justifyContent: 'center',\n  boxShadow: '0 4px 12px rgba(0, 0, 0, 0.25)'\n};\n\nconst BUTTON_BASE_STYLE: JSX.CSSProperties = {\n  appearance: 'none',\n  background: 'transparent',\n  border: 'none',\n  color: '#f0f0f0',\n  width: '34px',\n  height: '34px',\n  display: 'flex',\n  flexDirection: 'column',\n  alignItems: 'center',\n  justifyContent: 'center',\n  borderRadius: '50%',\n  cursor: 'pointer',\n  padding: '0',\n  transition: 'background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease'\n};\n\nconst BUTTON_ACTIVE_STYLE: JSX.CSSProperties = {\n  background: '#0071e3',\n  color: '#ffffff',\n  boxShadow: '0 0 0 2px rgba(255, 255, 255, 0.35)'\n};\n\nconst BUTTON_LABEL_STYLE: JSX.CSSProperties = {\n  fontSize: '10px',\n  marginTop: '2px',\n  lineHeight: '12px'\n};\n\nexport class EditModeTrayWidget extends Widget<EditModeTrayWidgetProps> {\n  static override defaultProps = {\n    id: 'edit-mode-tray',\n    _container: null,\n    placement: 'top-left',\n    layout: 'vertical',\n    modes: [],\n    style: {},\n    className: ''\n  } satisfies Required<WidgetProps> &\n    Required<Pick<EditModeTrayWidgetProps, 'placement' | 'layout'>> &\n    EditModeTrayWidgetProps;\n\n  placement: WidgetPlacement = 'top-left';\n  className = 'deck-widget-edit-mode-tray';\n  layout: 'vertical' | 'horizontal' = 'vertical';\n  selectedModeId: string | null = null;\n  deck?: Deck | null = null;\n  private appliedCustomClassName: string | null = null;\n\n  constructor(props: EditModeTrayWidgetProps = {}) {\n    super({...EditModeTrayWidget.defaultProps, ...props});\n    this.placement = props.placement ?? EditModeTrayWidget.defaultProps.placement;\n    this.layout = props.layout ?? EditModeTrayWidget.defaultProps.layout;\n    this.selectedModeId = this.resolveSelectedModeId(props.modes ?? [], props);\n  }\n\n  override setProps(props: Partial<EditModeTrayWidgetProps>): void {\n    if (props.placement !== undefined) {\n      this.placement = props.placement;\n    }\n    if (props.layout !== undefined) {\n      this.layout = props.layout;\n    }\n\n    const modes = props.modes ?? this.props.modes ?? [];\n    this.selectedModeId = this.resolveSelectedModeId(modes, props);\n\n    super.setProps(props);\n    this.renderTray();\n  }\n\n  override onAdd({deck}: {deck: Deck}): void {\n    this.deck = deck;\n  }\n\n  override onRemove(): void {\n    this.deck = null;\n    const root = this.rootElement;\n    if (root) {\n      render(null, root);\n    }\n    this.rootElement = null;\n  }\n\n  override onRenderHTML(rootElement: HTMLElement): void {\n    const style = {...ROOT_STYLE, ...this.props.style};\n    Object.assign(rootElement.style, style);\n    if (this.appliedCustomClassName && this.appliedCustomClassName !== this.props.className) {\n      rootElement.classList.remove(this.appliedCustomClassName);\n      this.appliedCustomClassName = null;\n    }\n    if (this.props.className) {\n      rootElement.classList.add(this.props.className);\n      this.appliedCustomClassName = this.props.className;\n    }\n    rootElement.classList.add(this.className);\n\n    this.renderTray();\n  }\n\n  private renderTray() {\n    const root = this.rootElement;\n    if (!root) {\n      return;\n    }\n\n    const modes = this.props.modes ?? [];\n    const selectedId = this.selectedModeId;\n    const direction = this.layout === 'horizontal' ? 'row' : 'column';\n\n    const trayStyle: JSX.CSSProperties = {\n      ...TRAY_BASE_STYLE,\n      flexDirection: direction\n    };\n\n    const stopEvent = (event: Event) => {\n      event.stopPropagation();\n      if (typeof (event as any).stopImmediatePropagation === 'function') {\n        (event as any).stopImmediatePropagation();\n      }\n    };\n\n    const ui = (\n      <div\n        style={trayStyle}\n        onPointerDown={stopEvent}\n        onPointerMove={stopEvent}\n        onPointerUp={stopEvent}\n        onMouseDown={stopEvent}\n        onMouseMove={stopEvent}\n        onMouseUp={stopEvent}\n        onTouchStart={stopEvent}\n        onTouchMove={stopEvent}\n        onTouchEnd={stopEvent}\n      >\n        {modes.map((option, index) => {\n          const id = this.getModeId(option, index);\n          const active = id === selectedId;\n          const label = option.label ?? '';\n          const title = option.title ?? label;\n\n          const buttonStyle: JSX.CSSProperties = {\n            ...BUTTON_BASE_STYLE,\n            ...(active ? BUTTON_ACTIVE_STYLE : {})\n          };\n\n          return (\n            <button\n              key={id}\n              type=\"button\"\n              title={title || undefined}\n              aria-pressed={active}\n              style={buttonStyle}\n              onClick={(event) => {\n                stopEvent(event);\n                this.handleSelect(option, id);\n              }}\n            >\n              {option.icon}\n              {label ? <span style={BUTTON_LABEL_STYLE}>{label}</span> : null}\n            </button>\n          );\n        })}\n      </div>\n    );\n\n    render(ui, root);\n  }\n\n  private handleSelect(option: EditModeTrayWidgetModeOption, id: string) {\n    if (this.selectedModeId !== id) {\n      this.selectedModeId = id;\n      this.renderTray();\n    }\n\n    this.props.onSelectMode?.({\n      id,\n      mode: option.mode,\n      option\n    });\n  }\n\n  private resolveSelectedModeId(\n    modes: EditModeTrayWidgetModeOption[],\n    props: Partial<EditModeTrayWidgetProps>\n  ): string | null {\n    if (props.selectedModeId !== undefined) {\n      return props.selectedModeId;\n    }\n\n    const activeMode = props.activeMode ?? this.props?.activeMode ?? null;\n    if (activeMode) {\n      const match = this.findOptionByMode(modes, activeMode);\n      if (match) {\n        return this.getModeId(match.option, match.index);\n      }\n    }\n\n    if (this.selectedModeId) {\n      const existing = this.findOptionById(modes, this.selectedModeId);\n      if (existing) {\n        return this.selectedModeId;\n      }\n    }\n\n    const first = modes[0];\n    return first ? this.getModeId(first, 0) : null;\n  }\n\n  private findOptionByMode(\n    modes: EditModeTrayWidgetModeOption[],\n    activeMode: GeoJsonEditModeConstructor | GeoJsonEditModeType\n  ): {option: EditModeTrayWidgetModeOption; index: number} | null {\n    for (let index = 0; index < modes.length; index++) {\n      const option = modes[index];\n      if (option.mode === activeMode) {\n        return {option, index};\n      }\n      if (this.isSameMode(option.mode, activeMode)) {\n        return {option, index};\n      }\n    }\n    return null;\n  }\n\n  private findOptionById(\n    modes: EditModeTrayWidgetModeOption[],\n    id: string\n  ): {option: EditModeTrayWidgetModeOption; index: number} | null {\n    for (let index = 0; index < modes.length; index++) {\n      if (this.getModeId(modes[index], index) === id) {\n        return {option: modes[index], index};\n      }\n    }\n    return null;\n  }\n\n  private getModeId(option: EditModeTrayWidgetModeOption, index: number): string {\n    if (option.id) {\n      return option.id;\n    }\n\n    const mode = option.mode as any;\n    if (mode) {\n      if (typeof mode === 'function' && mode.name) {\n        return mode.name;\n      }\n      if (mode && mode.constructor && mode.constructor.name) {\n        return mode.constructor.name;\n      }\n    }\n\n    return `mode-${index}`;\n  }\n\n  private isSameMode(\n    modeA: GeoJsonEditModeConstructor | GeoJsonEditModeType,\n    modeB: GeoJsonEditModeConstructor | GeoJsonEditModeType\n  ): boolean {\n    if (modeA === modeB) {\n      return true;\n    }\n    const constructorA = (modeA as GeoJsonEditModeType)?.constructor;\n    const constructorB = (modeB as GeoJsonEditModeType)?.constructor;\n    return Boolean(constructorA && constructorB && constructorA === constructorB);\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {render} from 'preact';\nimport type {JSX} from 'preact';\nimport {Widget, type WidgetProps, type WidgetPlacement, type Deck} from '@deck.gl/core';\n\nexport type BooleanOperation = 'union' | 'difference' | 'intersection' | null;\n\nexport type EditorToolbarWidgetProps = WidgetProps & {\n  /** Placement for the widget root element. */\n  placement?: WidgetPlacement;\n  /** Currently active boolean operation. */\n  booleanOperation?: BooleanOperation;\n  /** Number of features in the current dataset. */\n  featureCount?: number;\n  /** Callback fired when the user selects a boolean operation. */\n  onSetBooleanOperation?: (op: BooleanOperation) => void;\n  /** Callback fired when the user clicks the clear button. */\n  onClear?: () => void;\n  /** Callback fired when the user clicks the export button. */\n  onExport?: () => void;\n};\n\n// --- Styles (match EditModeTrayWidget visual language) ---\n\nconst ROOT_STYLE: Partial<CSSStyleDeclaration> = {\n  position: 'absolute',\n  display: 'flex',\n  flexDirection: 'column',\n  gap: '6px',\n  pointerEvents: 'auto',\n  userSelect: 'none',\n  zIndex: '99'\n};\n\nconst TRAY_STYLE: JSX.CSSProperties = {\n  display: 'flex',\n  gap: '4px',\n  background: 'rgba(36, 40, 41, 0.88)',\n  borderRadius: '999px',\n  padding: '5px 8px',\n  alignItems: 'center',\n  justifyContent: 'center',\n  boxShadow: '0 4px 12px rgba(0, 0, 0, 0.25)'\n};\n\nconst BUTTON_STYLE: JSX.CSSProperties = {\n  appearance: 'none',\n  background: 'transparent',\n  border: 'none',\n  color: '#f0f0f0',\n  height: '30px',\n  padding: '0 8px',\n  display: 'flex',\n  alignItems: 'center',\n  justifyContent: 'center',\n  gap: '4px',\n  borderRadius: '15px',\n  cursor: 'pointer',\n  fontSize: '11px',\n  fontFamily: '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n  fontWeight: '500',\n  transition: 'background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease',\n  whiteSpace: 'nowrap'\n};\n\nconst BUTTON_ACTIVE_STYLE: JSX.CSSProperties = {\n  background: '#0071e3',\n  color: '#ffffff',\n  boxShadow: '0 0 0 2px rgba(255, 255, 255, 0.35)'\n};\n\nconst DIVIDER_STYLE: JSX.CSSProperties = {\n  width: '1px',\n  height: '20px',\n  background: 'rgba(255, 255, 255, 0.2)',\n  margin: '0 2px',\n  flexShrink: '0'\n};\n\nconst BADGE_STYLE: JSX.CSSProperties = {\n  color: 'rgba(255, 255, 255, 0.6)',\n  fontSize: '11px',\n  padding: '0 6px',\n  fontFamily: '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n  whiteSpace: 'nowrap'\n};\n\n// --- SVG Icons (14x14) ---\n\nfunction PencilIcon() {\n  return (\n    <svg\n      width=\"14\"\n      height=\"14\"\n      viewBox=\"0 0 14 14\"\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth=\"1.5\"\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n    >\n      <path d=\"M10 1.5l2.5 2.5L4.5 12H2v-2.5z\" />\n    </svg>\n  );\n}\n\nfunction SubtractIcon() {\n  return (\n    <svg\n      width=\"14\"\n      height=\"14\"\n      viewBox=\"0 0 14 14\"\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth=\"1.1\"\n    >\n      <rect x=\"1\" y=\"1\" width=\"8\" height=\"8\" rx=\"1.5\" />\n      <rect x=\"5\" y=\"5\" width=\"8\" height=\"8\" rx=\"1.5\" fill=\"rgba(36,40,41,0.88)\" />\n    </svg>\n  );\n}\n\nfunction UnionIcon() {\n  return (\n    <svg\n      width=\"14\"\n      height=\"14\"\n      viewBox=\"0 0 14 14\"\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth=\"1.1\"\n    >\n      <rect x=\"1\" y=\"1\" width=\"8\" height=\"8\" rx=\"1.5\" />\n      <rect x=\"5\" y=\"5\" width=\"8\" height=\"8\" rx=\"1.5\" />\n    </svg>\n  );\n}\n\nfunction IntersectIcon() {\n  return (\n    <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\" strokeWidth=\"1.1\">\n      <rect x=\"1\" y=\"1\" width=\"8\" height=\"8\" rx=\"1.5\" stroke=\"currentColor\" opacity=\"0.4\" />\n      <rect x=\"5\" y=\"5\" width=\"8\" height=\"8\" rx=\"1.5\" stroke=\"currentColor\" opacity=\"0.4\" />\n      <rect x=\"5\" y=\"5\" width=\"4\" height=\"4\" fill=\"currentColor\" opacity=\"0.6\" />\n    </svg>\n  );\n}\n\nfunction TrashIcon() {\n  return (\n    <svg\n      width=\"14\"\n      height=\"14\"\n      viewBox=\"0 0 14 14\"\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth=\"1.3\"\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n    >\n      <path d=\"M2.5 4h9M5.5 4V2.5h3V4M3.5 4l.5 8h6l.5-8\" />\n    </svg>\n  );\n}\n\nfunction DownloadIcon() {\n  return (\n    <svg\n      width=\"14\"\n      height=\"14\"\n      viewBox=\"0 0 14 14\"\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth=\"1.3\"\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n    >\n      <path d=\"M7 2v7M4.5 6.5L7 9l2.5-2.5M2.5 11.5h9\" />\n    </svg>\n  );\n}\n\n// --- Widget ---\n\nconst BOOLEAN_OPS: Array<{\n  op: BooleanOperation;\n  icon: () => JSX.Element;\n  label: string;\n  title: string;\n}> = [\n  {op: null, icon: PencilIcon, label: 'Edit', title: 'Draw new features'},\n  {op: 'difference', icon: SubtractIcon, label: 'Sub', title: 'Subtract from selection'},\n  {op: 'union', icon: UnionIcon, label: 'Union', title: 'Union with selection'},\n  {op: 'intersection', icon: IntersectIcon, label: 'Sect', title: 'Intersect with selection'}\n];\n\nexport class EditorToolbarWidget extends Widget<EditorToolbarWidgetProps> {\n  static override defaultProps = {\n    id: 'editor-toolbar',\n    _container: null,\n    placement: 'bottom-left',\n    booleanOperation: null,\n    featureCount: 0,\n    style: {},\n    className: ''\n  } satisfies Required<WidgetProps> &\n    Required<Pick<EditorToolbarWidgetProps, 'placement'>> &\n    EditorToolbarWidgetProps;\n\n  placement: WidgetPlacement = 'bottom-left';\n  className = 'deck-widget-editor-toolbar';\n  deck?: Deck | null = null;\n  private appliedCustomClassName: string | null = null;\n\n  constructor(props: EditorToolbarWidgetProps = {}) {\n    super({...EditorToolbarWidget.defaultProps, ...props});\n    this.placement = props.placement ?? EditorToolbarWidget.defaultProps.placement;\n  }\n\n  override setProps(props: Partial<EditorToolbarWidgetProps>): void {\n    if (props.placement !== undefined) {\n      this.placement = props.placement;\n    }\n    super.setProps(props);\n    this.renderToolbar();\n  }\n\n  override onAdd({deck}: {deck: Deck}): void {\n    this.deck = deck;\n  }\n\n  override onRemove(): void {\n    this.deck = null;\n    const root = this.rootElement;\n    if (root) {\n      render(null, root);\n    }\n    this.rootElement = null;\n  }\n\n  override onRenderHTML(rootElement: HTMLElement): void {\n    const style = {...ROOT_STYLE, ...this.props.style};\n    Object.assign(rootElement.style, style);\n    if (this.appliedCustomClassName && this.appliedCustomClassName !== this.props.className) {\n      rootElement.classList.remove(this.appliedCustomClassName);\n      this.appliedCustomClassName = null;\n    }\n    if (this.props.className) {\n      rootElement.classList.add(this.props.className);\n      this.appliedCustomClassName = this.props.className;\n    }\n    rootElement.classList.add(this.className);\n    this.renderToolbar();\n  }\n\n  private renderToolbar() {\n    const root = this.rootElement;\n    if (!root) {\n      return;\n    }\n\n    const booleanOp = this.props.booleanOperation ?? null;\n    const featureCount = this.props.featureCount ?? 0;\n\n    const stopEvent = (event: Event) => {\n      event.stopPropagation();\n      if (typeof (event as any).stopImmediatePropagation === 'function') {\n        (event as any).stopImmediatePropagation();\n      }\n    };\n\n    const ui = (\n      <div\n        style={TRAY_STYLE}\n        onPointerDown={stopEvent}\n        onPointerMove={stopEvent}\n        onPointerUp={stopEvent}\n        onMouseDown={stopEvent}\n        onMouseMove={stopEvent}\n        onMouseUp={stopEvent}\n        onTouchStart={stopEvent}\n        onTouchMove={stopEvent}\n        onTouchEnd={stopEvent}\n      >\n        {/* Boolean operation toggle buttons */}\n        {BOOLEAN_OPS.map(({op, icon: Icon, label, title}) => {\n          const active = booleanOp === op;\n          return (\n            <button\n              key={label}\n              type=\"button\"\n              title={title}\n              aria-pressed={active}\n              style={{...BUTTON_STYLE, ...(active ? BUTTON_ACTIVE_STYLE : {})}}\n              onClick={(event) => {\n                stopEvent(event);\n                this.props.onSetBooleanOperation?.(op);\n              }}\n            >\n              <Icon />\n              <span>{label}</span>\n            </button>\n          );\n        })}\n\n        <div style={DIVIDER_STYLE} />\n\n        {/* Clear button */}\n        <button\n          type=\"button\"\n          title=\"Clear all features\"\n          style={BUTTON_STYLE}\n          onClick={(event) => {\n            stopEvent(event);\n            this.props.onClear?.();\n          }}\n        >\n          <TrashIcon />\n        </button>\n\n        {/* Export button */}\n        <button\n          type=\"button\"\n          title=\"Download as GeoJSON\"\n          style={BUTTON_STYLE}\n          onClick={(event) => {\n            stopEvent(event);\n            this.props.onExport?.();\n          }}\n        >\n          <DownloadIcon />\n        </button>\n\n        <div style={DIVIDER_STYLE} />\n\n        {/* Feature count badge */}\n        <span style={BADGE_STYLE}>\n          {featureCount} feature{featureCount !== 1 ? 's' : ''}\n        </span>\n      </div>\n    );\n\n    render(ui, root);\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {CompositeLayerProps, DefaultProps} from '@deck.gl/core';\nimport {CompositeLayer} from '@deck.gl/core';\nimport type {ScatterplotLayerProps} from '@deck.gl/layers';\nimport {ScatterplotLayer} from '@deck.gl/layers';\n\nimport {Color} from '../utils/types';\n\ntype JunctionScatterplotLayerProps = CompositeLayerProps &\n  Omit<ScatterplotLayerProps, 'getFillColor'> & {\n    getFillColor?: Color | ((d) => Color);\n    getStrokeColor?: Color | ((d) => Color);\n    getInnerRadius?: number | ((d) => number);\n  };\n\nexport class JunctionScatterplotLayer extends CompositeLayer<JunctionScatterplotLayerProps> {\n  static layerName = 'JunctionScatterplotLayer';\n  static defaultProps: DefaultProps<JunctionScatterplotLayerProps> = {\n    ...ScatterplotLayer.defaultProps,\n    getFillColor: (d) => [0, 0, 0, 255],\n    getStrokeColor: (d) => [255, 255, 255, 255],\n    getInnerRadius: (d) => 1\n  };\n\n  renderLayers() {\n    const {id, getFillColor, getStrokeColor, getInnerRadius, updateTriggers} = this.props;\n\n    // data needs to be passed explicitly after deck.gl 5.3\n    return [\n      // the full circles\n      new ScatterplotLayer<any>({\n        ...this.props,\n        id: `${id}-full`,\n        data: this.props.data as any,\n        getLineColor: getStrokeColor,\n        updateTriggers: {\n          ...updateTriggers,\n          getStrokeColor: updateTriggers.getStrokeColor\n        }\n      }), // the inner part\n      new ScatterplotLayer<any>({\n        ...this.props,\n        id: `${id}-inner`,\n        data: this.props.data as any,\n        getFillColor,\n        getRadius: getInnerRadius,\n        pickable: false,\n        updateTriggers: {\n          ...updateTriggers,\n          getFillColor: updateTriggers.getFillColor,\n          getRadius: updateTriggers.getInnerRadius\n        }\n      })\n    ];\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport nearestPointOnLine from '@turf/nearest-point-on-line';\nimport {point, lineString as toLineString} from '@turf/helpers';\nimport circle from '@turf/circle';\nimport distance from '@turf/distance';\nimport turfCenter from '@turf/center';\nimport {\n  recursivelyTraverseNestedArrays,\n  nearestPointOnProjectedLine,\n  getPickedEditHandles,\n  getPickedEditHandle,\n  NearestPointType\n} from './utils';\nimport {\n  LineString,\n  Point,\n  FeatureCollection,\n  Feature,\n  SimpleFeatureCollection\n} from '../utils/geojson-types';\nimport {Viewport} from '../utils/types';\nimport {\n  ModeProps,\n  PointerMoveEvent,\n  StartDraggingEvent,\n  StopDraggingEvent,\n  DraggingEvent,\n  EditHandleFeature,\n  GuideFeatureCollection,\n  GuideFeature\n} from './types';\nimport {GeoJsonEditMode} from './geojson-edit-mode';\nimport {ImmutableFeatureCollection} from './immutable-feature-collection';\n\nexport class ResizeCircleMode extends GeoJsonEditMode {\n  _selectedEditHandle: EditHandleFeature | null | undefined;\n  _isResizing = false;\n\n  // eslint-disable-next-line complexity\n  getGuides(props: ModeProps<FeatureCollection>): GuideFeatureCollection {\n    const handles: GuideFeature[] = [];\n    const selectedFeatureIndexes = props.selectedIndexes;\n\n    const {lastPointerMoveEvent} = props;\n    const picks = lastPointerMoveEvent && lastPointerMoveEvent.picks;\n    const mapCoords = lastPointerMoveEvent && lastPointerMoveEvent.mapCoords;\n\n    // intermediate edit handle\n    if (\n      picks &&\n      picks.length &&\n      mapCoords &&\n      selectedFeatureIndexes.length === 1 &&\n      !this._isResizing\n    ) {\n      const featureAsPick = picks.find((pick) => !pick.isGuide);\n\n      // is the feature in the pick selected\n      if (\n        featureAsPick &&\n        featureAsPick.object.properties.shape &&\n        featureAsPick.object.properties.shape.includes('Circle') &&\n        props.selectedIndexes.includes(featureAsPick.index)\n      ) {\n        let intermediatePoint: NearestPointType | null = null;\n        let positionIndexPrefix: number[] = [];\n        const referencePoint = point(mapCoords);\n        // process all lines of the (single) feature\n        recursivelyTraverseNestedArrays(\n          featureAsPick.object.geometry.coordinates,\n          [],\n          (lineString, prefix) => {\n            const lineStringFeature = toLineString(lineString);\n            const candidateIntermediatePoint = this.getNearestPoint(\n              lineStringFeature,\n              referencePoint,\n              props.modeConfig && props.modeConfig.viewport\n            );\n            if (\n              !intermediatePoint ||\n              candidateIntermediatePoint.properties.dist < intermediatePoint.properties.dist\n            ) {\n              intermediatePoint = candidateIntermediatePoint;\n              positionIndexPrefix = prefix;\n            }\n          }\n        );\n        // tack on the lone intermediate point to the set of handles\n        if (intermediatePoint) {\n          const {\n            geometry: {coordinates: position},\n            properties: {index}\n          } = intermediatePoint;\n          handles.push({\n            type: 'Feature',\n            properties: {\n              guideType: 'editHandle',\n              editHandleType: 'intermediate',\n              featureIndex: featureAsPick.index,\n              positionIndexes: [...positionIndexPrefix, index + 1]\n            },\n            geometry: {\n              type: 'Point',\n              coordinates: position\n            }\n          });\n        }\n      }\n    }\n\n    return {\n      type: 'FeatureCollection',\n      features: handles\n    };\n  }\n\n  // turf.js does not support elevation for nearestPointOnLine\n  getNearestPoint(\n    line: Feature<LineString>,\n    inPoint: Feature<Point>,\n    viewport: Viewport | null | undefined\n  ): NearestPointType {\n    const {coordinates} = line.geometry;\n    if (coordinates.some((coord) => coord.length > 2)) {\n      if (viewport) {\n        // This line has elevation, we need to use alternative algorithm\n        return nearestPointOnProjectedLine(line, inPoint, viewport);\n      }\n      // eslint-disable-next-line no-console,no-undef\n      console.log(\n        'Editing 3D point but modeConfig.viewport not provided. Falling back to 2D logic.'\n      );\n    }\n    return nearestPointOnLine(line, inPoint);\n  }\n\n  handleDragging(event: DraggingEvent, props: ModeProps<SimpleFeatureCollection>): void {\n    const editHandle = getPickedEditHandle(event.pointerDownPicks);\n\n    if (editHandle) {\n      // Cancel map panning if pointer went down on an edit handle\n      event.cancelPan();\n\n      const editHandleProperties = editHandle.properties;\n\n      const feature = this.getSelectedFeature(props);\n      const center = turfCenter(feature).geometry.coordinates;\n      const numberOfSteps = Object.entries(feature.geometry.coordinates[0]).length - 1;\n      const radius = Math.max(distance(center, event.mapCoords), 0.001);\n\n      const {steps = numberOfSteps} = {};\n      const options = {steps};\n      const updatedFeature = circle(center, radius, options);\n      const geometry = updatedFeature.geometry;\n\n      const updatedData = new ImmutableFeatureCollection(props.data)\n        .replaceGeometry(editHandleProperties.featureIndex, geometry)\n        .getObject();\n\n      props.onEdit({\n        updatedData,\n        editType: 'unionGeometry',\n        editContext: {\n          featureIndexes: [editHandleProperties.featureIndex]\n        }\n      });\n    }\n  }\n\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>): void {\n    if (!this._isResizing) {\n      const selectedEditHandle = getPickedEditHandle(event.picks);\n      this._selectedEditHandle =\n        selectedEditHandle && selectedEditHandle.properties.editHandleType === 'intermediate'\n          ? selectedEditHandle\n          : null;\n    }\n\n    const cursor = this.getCursor(event);\n    props.onUpdateCursor(cursor);\n  }\n\n  handleStartDragging(event: StartDraggingEvent, props: ModeProps<FeatureCollection>) {\n    if (this._selectedEditHandle) {\n      event.cancelPan();\n      this._isResizing = true;\n    }\n  }\n\n  handleStopDragging(event: StopDraggingEvent, props: ModeProps<FeatureCollection>) {\n    if (this._isResizing) {\n      this._selectedEditHandle = null;\n      this._isResizing = false;\n    }\n  }\n\n  getCursor(event: PointerMoveEvent): string | null | undefined {\n    const picks = (event && event.picks) || [];\n\n    const handlesPicked = getPickedEditHandles(picks);\n    if (handlesPicked.length) {\n      return 'cell';\n    }\n    return null;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {\n  Position,\n  LineString,\n  FeatureCollection,\n  SimpleFeatureCollection\n} from '../utils/geojson-types';\nimport {ClickEvent, PointerMoveEvent, ModeProps, GuideFeatureCollection} from './types';\nimport {GeoJsonEditMode} from './geojson-edit-mode';\nimport {ImmutableFeatureCollection} from './immutable-feature-collection';\n\nexport class ExtendLineStringMode extends GeoJsonEditMode {\n  getSingleSelectedLineString(\n    props: ModeProps<SimpleFeatureCollection>\n  ): LineString | null | undefined {\n    const selectedGeometry = this.getSelectedGeometry(props);\n\n    if (selectedGeometry && selectedGeometry.type === 'LineString') {\n      return selectedGeometry;\n    }\n    return null;\n  }\n\n  handleClick(event: ClickEvent, props: ModeProps<SimpleFeatureCollection>) {\n    const {selectedIndexes} = props;\n    const selectedLineString = this.getSingleSelectedLineString(props);\n\n    if (!selectedLineString) {\n      console.warn(`ExtendLineStringMode only supported for single LineString selection`); // eslint-disable-line\n      return;\n    }\n\n    // Extend the LineString\n    let positionIndexes = [selectedLineString.coordinates.length];\n\n    const modeConfig = props.modeConfig;\n    if (modeConfig && modeConfig.drawAtFront) {\n      positionIndexes = [0];\n    }\n    const featureIndex = selectedIndexes[0];\n    const updatedData = new ImmutableFeatureCollection(props.data)\n      .addPosition(featureIndex, positionIndexes, event.mapCoords)\n      .getObject();\n\n    props.onEdit({\n      updatedData,\n      editType: 'addPosition',\n      editContext: {\n        featureIndexes: [featureIndex],\n        positionIndexes,\n        position: event.mapCoords\n      }\n    });\n  }\n\n  getGuides(props: ModeProps<SimpleFeatureCollection>): GuideFeatureCollection {\n    const guides: GuideFeatureCollection = {\n      type: 'FeatureCollection',\n      features: []\n    };\n\n    const selectedLineString = this.getSingleSelectedLineString(props);\n    if (!selectedLineString) {\n      return guides;\n    }\n\n    const mapCoords = props.lastPointerMoveEvent && props.lastPointerMoveEvent.mapCoords;\n\n    if (!mapCoords) {\n      return guides;\n    }\n\n    // Draw an extension line starting from one end of the selected LineString to the cursor\n    let startPosition: Position | null | undefined = null;\n    const {modeConfig} = props;\n    if (modeConfig && modeConfig.drawAtFront) {\n      startPosition = selectedLineString.coordinates[0];\n    } else {\n      startPosition = selectedLineString.coordinates[selectedLineString.coordinates.length - 1];\n    }\n\n    guides.features.push({\n      type: 'Feature',\n      properties: {\n        guideType: 'tentative'\n      },\n      geometry: {\n        type: 'LineString',\n        coordinates: [startPosition, mapCoords]\n      }\n    });\n\n    return guides;\n  }\n\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>) {\n    props.onUpdateCursor('cell');\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport turfDistance from '@turf/distance';\nimport turfMidpoint from '@turf/midpoint';\nimport {FeatureCollection} from '../utils/geojson-types';\nimport {\n  ClickEvent,\n  PointerMoveEvent,\n  ModeProps,\n  GuideFeatureCollection,\n  Tooltip,\n  GuideFeature\n} from './types';\nimport {getPickedEditHandle} from './utils';\nimport {GeoJsonEditMode} from './geojson-edit-mode';\n\nexport class MeasureDistanceMode extends GeoJsonEditMode {\n  _isMeasuringSessionFinished = false;\n  _currentTooltips: Tooltip[] = [];\n  _currentDistance = 0;\n\n  _calculateDistanceForTooltip = ({positionA, positionB, modeConfig}) => {\n    const {turfOptions, measurementCallback} = modeConfig || {};\n    const distance = turfDistance(positionA, positionB, turfOptions);\n\n    if (measurementCallback) {\n      measurementCallback(distance);\n    }\n\n    return distance;\n  };\n\n  _formatTooltip(distance, modeConfig?) {\n    const {formatTooltip, turfOptions} = modeConfig || {};\n    const units = (turfOptions && turfOptions.units) || 'kilometers';\n\n    let text;\n    if (formatTooltip) {\n      text = formatTooltip(distance);\n    } else {\n      // By default, round to 2 decimal places and append units\n      text = `${parseFloat(distance).toFixed(2)} ${units}`;\n    }\n\n    return text;\n  }\n\n  handleClick(event: ClickEvent, props: ModeProps<FeatureCollection>) {\n    const {modeConfig, data, onEdit} = props;\n    const {centerTooltipsOnLine = false} = modeConfig || {};\n\n    // restart measuring session\n    if (this._isMeasuringSessionFinished) {\n      this._isMeasuringSessionFinished = false;\n      this.resetClickSequence();\n      this._currentTooltips = [];\n      this._currentDistance = 0;\n    }\n\n    const {picks} = event;\n    const clickedEditHandle = getPickedEditHandle(picks);\n\n    let positionAdded = false;\n    if (!clickedEditHandle) {\n      // Don't add another point right next to an existing one\n      this.addClickSequence(event);\n      positionAdded = true;\n    }\n    const clickSequence = this.getClickSequence();\n\n    if (\n      clickSequence.length > 1 &&\n      clickedEditHandle &&\n      Array.isArray(clickedEditHandle.properties.positionIndexes) &&\n      clickedEditHandle.properties.positionIndexes[0] === clickSequence.length - 1\n    ) {\n      // They clicked the last point (or double-clicked), so add the LineString\n      this._isMeasuringSessionFinished = true;\n    } else if (positionAdded) {\n      if (clickSequence.length > 1) {\n        this._currentDistance += this._calculateDistanceForTooltip({\n          positionA: clickSequence[clickSequence.length - 2],\n          positionB: clickSequence[clickSequence.length - 1],\n          modeConfig\n        });\n\n        const tooltipPosition = centerTooltipsOnLine\n          ? turfMidpoint(\n              clickSequence[clickSequence.length - 2],\n              clickSequence[clickSequence.length - 1]\n            ).geometry.coordinates\n          : event.mapCoords;\n\n        this._currentTooltips.push({\n          position: tooltipPosition,\n          text: this._formatTooltip(this._currentDistance, modeConfig)\n        });\n      }\n\n      // new tentative point\n      onEdit({\n        // data is the same\n        updatedData: data,\n        editType: 'addTentativePosition',\n        editContext: {\n          position: event.mapCoords\n        }\n      });\n    }\n  }\n\n  handleKeyUp(event: KeyboardEvent, props: ModeProps<FeatureCollection>) {\n    if (this._isMeasuringSessionFinished) return;\n\n    event.stopPropagation();\n    const {key} = event;\n\n    const clickSequenceLength = this.getClickSequence().length;\n\n    switch (key) {\n      case 'Escape':\n        this._isMeasuringSessionFinished = true;\n        if (clickSequenceLength === 1) {\n          this.resetClickSequence();\n          this._currentTooltips = [];\n        }\n        // force update drawings\n        props.onUpdateCursor('cell');\n        break;\n      case 'Enter':\n        this.handleClick(props.lastPointerMoveEvent, props);\n        this._isMeasuringSessionFinished = true;\n        break;\n      default:\n        break;\n    }\n  }\n\n  getGuides(props: ModeProps<FeatureCollection>): GuideFeatureCollection {\n    const {lastPointerMoveEvent} = props;\n    const clickSequence = this.getClickSequence();\n\n    const lastCoords =\n      lastPointerMoveEvent && !this._isMeasuringSessionFinished\n        ? [lastPointerMoveEvent.mapCoords]\n        : [];\n\n    const guides: GuideFeatureCollection = {\n      type: 'FeatureCollection',\n      features: []\n    };\n\n    if (clickSequence.length > 0) {\n      guides.features.push({\n        type: 'Feature',\n        properties: {\n          guideType: 'tentative'\n        },\n        geometry: {\n          type: 'LineString',\n          coordinates: [...clickSequence, ...lastCoords]\n        }\n      });\n    }\n\n    const editHandles: GuideFeature[] = clickSequence.map((clickedCoord, index) => ({\n      type: 'Feature',\n      properties: {\n        guideType: 'editHandle',\n        editHandleType: 'existing',\n        featureIndex: -1,\n        positionIndexes: [index]\n      },\n      geometry: {\n        type: 'Point',\n        coordinates: clickedCoord\n      }\n    }));\n\n    guides.features.push(...editHandles);\n\n    return guides;\n  }\n\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>) {\n    props.onUpdateCursor('cell');\n  }\n\n  getTooltips(props: ModeProps<FeatureCollection>): Tooltip[] {\n    const {lastPointerMoveEvent, modeConfig} = props;\n    const {centerTooltipsOnLine = false} = modeConfig || {};\n    const positions = this.getClickSequence();\n\n    if (positions.length > 0 && lastPointerMoveEvent && !this._isMeasuringSessionFinished) {\n      const distance = this._calculateDistanceForTooltip({\n        positionA: positions[positions.length - 1],\n        positionB: lastPointerMoveEvent.mapCoords,\n        modeConfig: props.modeConfig\n      });\n\n      const tooltipPosition = centerTooltipsOnLine\n        ? turfMidpoint(positions[positions.length - 1], lastPointerMoveEvent.mapCoords).geometry\n            .coordinates\n        : lastPointerMoveEvent.mapCoords;\n\n      return [\n        ...this._currentTooltips,\n        {\n          position: tooltipPosition,\n          text: this._formatTooltip(this._currentDistance + distance, modeConfig)\n        }\n      ];\n    }\n\n    return this._currentTooltips;\n  }\n}\n", "// deck.gl-community\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport turfArea from '@turf/area';\nimport turfCentroid from '@turf/centroid';\nimport {ClickEvent, Tooltip, ModeProps} from './types';\nimport {FeatureCollection, SimpleFeatureCollection} from '../utils/geojson-types';\nimport {DrawPolygonMode} from './draw-polygon-mode';\n\nconst DEFAULT_TOOLTIPS = [];\n\nexport class MeasureAreaMode extends DrawPolygonMode {\n  handleClick(event: ClickEvent, props: ModeProps<SimpleFeatureCollection>) {\n    const propsWithoutEdit = {\n      ...props,\n      onEdit: () => {}\n    };\n\n    super.handleClick(event, propsWithoutEdit);\n  }\n\n  handleKeyUp(event: KeyboardEvent, props: ModeProps<SimpleFeatureCollection>): void {\n    const propsWithoutEdit = {\n      ...props,\n      onEdit: () => {}\n    };\n\n    super.handleKeyUp(event, propsWithoutEdit);\n  }\n\n  getTooltips(props: ModeProps<FeatureCollection>): Tooltip[] {\n    const tentativeGuide = this.getTentativeGuide(props);\n\n    if (tentativeGuide && tentativeGuide.geometry.type === 'Polygon') {\n      const {modeConfig} = props;\n      const {formatTooltip, measurementCallback} = modeConfig || {};\n      const units = 'sq. m';\n\n      const centroid = turfCentroid(tentativeGuide);\n      const area = turfArea(tentativeGuide);\n\n      let text: string;\n      if (formatTooltip) {\n        text = formatTooltip(area);\n      } else {\n        // By default, round to 2 decimal places and append units\n        // @ts-expect-error are isn't string\n        text = `${parseFloat(area).toFixed(2)} ${units}`;\n      }\n\n      if (measurementCallback) {\n        measurementCallback(area);\n      }\n\n      return [\n        {\n          position: centroid.geometry.coordinates,\n          text\n        }\n      ];\n    }\n    return DEFAULT_TOOLTIPS;\n  }\n}\n", "import turfBearing from '@turf/bearing';\nimport turfCenter from '@turf/center';\nimport {memoize} from '../utils/memoize';\n\nimport {ClickEvent, PointerMoveEvent, Tooltip, ModeProps, GuideFeatureCollection} from './types';\nimport {FeatureCollection, Position} from '../utils/geojson-types';\nimport {GeoJsonEditMode} from './geojson-edit-mode';\n\nconst DEFAULT_TOOLTIPS: Tooltip[] = [];\n\nexport class MeasureAngleMode extends GeoJsonEditMode {\n  _getTooltips = memoize(\n    ({\n      modeConfig,\n      vertex,\n      point1,\n      point2\n    }: {\n      modeConfig: any;\n      vertex: any;\n      point1: Position;\n      point2: Position;\n    }): Tooltip[] => {\n      let tooltips = DEFAULT_TOOLTIPS;\n\n      if (vertex && point1 && point2) {\n        const {formatTooltip, measurementCallback} = modeConfig || {};\n        const units = 'deg';\n\n        const angle1 = turfBearing(vertex, point1);\n        const angle2 = turfBearing(vertex, point2);\n        let angle = Math.abs(angle1 - angle2);\n        if (angle > 180) {\n          angle = 360 - angle;\n        }\n\n        let text: string;\n        if (formatTooltip) {\n          text = formatTooltip(angle);\n        } else {\n          // By default, round to 2 decimal places and append units\n          // @ts-expect-error angle isn't string\n          text = `${parseFloat(angle).toFixed(2)} ${units}`;\n        }\n\n        if (measurementCallback) {\n          measurementCallback(angle);\n        }\n\n        const position = turfCenter({\n          type: 'FeatureCollection',\n          features: [point1, point2].map((p) => ({\n            type: 'Feature',\n            geometry: {\n              type: 'Point',\n              coordinates: p\n            },\n            properties: {}\n          }))\n        }).geometry.coordinates;\n\n        tooltips = [{position, text}];\n      }\n\n      return tooltips;\n    }\n  );\n\n  handleClick(event: ClickEvent, props: ModeProps<FeatureCollection>): void {\n    if (this.getClickSequence().length >= 3) {\n      this.resetClickSequence();\n    }\n\n    this.addClickSequence(event);\n  }\n\n  // Called when the pointer moved, regardless of whether the pointer is down, up, and whether something was picked\n  handlePointerMove(event: PointerMoveEvent, props: ModeProps<FeatureCollection>): void {\n    props.onUpdateCursor('cell');\n  }\n\n  getPoints(props: ModeProps<FeatureCollection>): Position[] {\n    const clickSequence = this.getClickSequence();\n\n    const points = [...clickSequence];\n\n    if (clickSequence.length < 3 && props.lastPointerMoveEvent) {\n      points.push(props.lastPointerMoveEvent.mapCoords);\n    }\n\n    return points;\n  }\n\n  // Return features that can be used as a guide for editing the data\n  getGuides(props: ModeProps<FeatureCollection>): GuideFeatureCollection {\n    const guides: GuideFeatureCollection = {type: 'FeatureCollection', features: []};\n    const {features} = guides;\n\n    const points = this.getPoints(props);\n\n    if (points.length > 2) {\n      features.push({\n        type: 'Feature',\n        properties: {guideType: 'tentative'},\n        geometry: {\n          type: 'LineString',\n          coordinates: [points[1], points[0], points[2]]\n        }\n      });\n    } else if (points.length > 1) {\n      features.push({\n        type: 'Feature',\n        properties: {guideType: 'tentative'},\n        geometry: {\n          type: 'LineString',\n          coordinates: [points[1], points[0]]\n        }\n      });\n    }\n\n    return guides;\n  }\n\n  getTooltips(props: ModeProps<FeatureCollection>): Tooltip[] {\n    const points = this.getPoints(props);\n\n    return this._getTooltips({\n      modeConfig: props.modeConfig,\n      vertex: points[0],\n      point1: points[1],\n      point2: points[2]\n    }) as Tooltip[];\n  }\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;AAIA,yBAAwB;AACxB,qBAAoB;AACpB,oCAAgC;AAChC,qBAAoB;AACpB,0BAAkC;AAQ5B,SAAU,YACd,OACA,eAAiD,CAAC,KAAK,GAA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UAAM,eAAe,MAAM;EAC7B;EAEA,UAAU,OAAmC;AAC3C,UAAM,gBAAgB,KAAK,iBAAgB;AAE3C,UAAM,SAAS,CAAC,GAAG,aAAa;AAEhC,QAAI,cAAc,SAAS,KAAK,MAAM,sBAAsB;AAC1D,aAAO,KAAK,MAAM,qBAAqB,SAAS;IAClD;AAEA,WAAO;EACT;;EAGA,UAAU,OAAmC;AAC3C,UAAM,SAAiC,EAAC,MAAM,qBAAqB,UAAU,CAAA,EAAE;AAC/E,UAAM,EAAC,SAAQ,IAAI;AAEnB,UAAM,SAAS,KAAK,UAAU,KAAK;AAEnC,QAAI,OAAO,SAAS,GAAG;AACrB,eAAS,KAAK;QACZ,MAAM;QACN,YAAY,EAAC,WAAW,YAAW;QACnC,UAAU;UACR,MAAM;UACN,aAAa,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;;OAEhD;IACH,WAAW,OAAO,SAAS,GAAG;AAC5B,eAAS,KAAK;QACZ,MAAM;QACN,YAAY,EAAC,WAAW,YAAW;QACnC,UAAU;UACR,MAAM;UACN,aAAa,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;;OAErC;IACH;AAEA,WAAO;EACT;EAEA,YAAY,OAAmC;AAC7C,UAAM,SAAS,KAAK,UAAU,KAAK;AAEnC,WAAO,KAAK,aAAa;MACvB,YAAY,MAAM;MAClB,QAAQ,OAAO,CAAC;MAChB,QAAQ,OAAO,CAAC;MAChB,QAAQ,OAAO,CAAC;KACjB;EACH;;",
  "names": ["mapCoords", "lineString", "pointToLineDistance", "bearing", "destination", "x", "y", "x2", "y2", "index", "x1", "y1", "distance", "import_layers", "import_helpers", "import_destination", "import_bearing", "import_point_to_line_distance", "import_helpers", "import_web_mercator", "recursivelyTraverseNestedArrays", "generatePointsParallelToLinePoints", "lineString", "pointToLineDistance", "bearing", "destination", "distance2d", "mix", "nearestPointOnProjectedLine", "x", "y", "x2", "y2", "index", "x1", "y1", "distance", "featureCollection", "polygon", "lineString", "mapCoords", "rewind", "turfUnion", "turfDifference", "turfIntersect", "import_bearing", "import_helpers", "import_web_mercator", "distance", "turfCenter", "turfRhumbDestination", "turfRhumbDistance", "turfRhumbBearing", "turfDistance", "turfBearing", "clone", "import_helpers", "mapCoords", "recursivelyTraverseNestedArrays", "lineString", "toLineString", "nearestPointOnProjectedLine", "import_bearing", "import_helpers", "import_meta", "import_distance", "import_invariant", "turfTransformScale", "turfCentroid", "bearing", "turfBearing", "bboxPolygon", "bbox", "turfDistance", "import_bbox", "import_centroid", "import_bearing", "import_bbox_polygon", "import_distance", "import_meta", "import_invariant", "import_helpers", "import_polygon_to_line", "turfCentroid", "bboxPolygon", "bbox", "turfDistance", "turfTransformRotate", "turfBearing", "bearing2", "import_difference", "import_helpers", "import_bearing", "import_distance", "import_destination", "import_polygon_to_line", "mapCoords", "turfPolygonToLine", "nearestPointOnLine", "turfDistance", "turfBearing", "turfDestination", "generatePointsParallelToLinePoints", "booleanPointInPolygon", "lineIntersect", "turfBuffer", "turfDifference", "turfFeature", "import_bearing", "generatePointsParallelToLinePoints", "bearing", "mapCoords", "import_distance", "distance", "import_line_intersect", "import_helpers", "polygon", "turfPolygon", "import_bbox_polygon", "omit", "polygon", "bboxPolygon", "import_bbox_polygon", "import_distance", "import_helpers", "turfDistance", "distance2", "turfLineString", "turfAlong", "bboxPolygon", "import_bbox_polygon", "bboxPolygon", "import_bbox_polygon", "import_distance", "import_along", "import_helpers", "turfDistance", "distance2", "turfLineString", "turfAlong", "bboxPolygon", "import_distance", "distance", "circle", "area", "import_circle", "import_distance", "import_area", "distance", "circle", "area", "import_bbox_polygon", "import_distance", "import_helpers", "bboxPolygon", "distance", "ellipse", "polygon", "generatePointsParallelToLinePoints", "import_distance", "import_ellipse", "import_bearing", "import_helpers", "distance", "bearing", "ellipse", "import_destination", "import_bearing", "import_line_intersect", "import_distance", "import_helpers", "mapCoords", "generatePointsParallelToLinePoints", "lineString", "polygon", "bearing", "distance", "turfDistance", "turfLineString", "destination", "lineIntersect", "import_lodash", "throttle", "import_helpers", "mapCoords", "defaultProps", "DEFAULT_EDIT_MODE", "defaultProps", "import_core", "import_layers", "import_helpers", "import_buffer", "import_difference", "defaultProps", "turfBuffer", "turfDifference", "import_core", "import_layers", "defaultProps", "import_core", "_jsx", "_jsxs", "import_preact", "import_core", "ROOT_STYLE", "BUTTON_ACTIVE_STYLE", "_jsx", "_jsxs", "import_core", "import_layers", "import_nearest_point_on_line", "import_helpers", "import_circle", "import_distance", "import_center", "mapCoords", "recursivelyTraverseNestedArrays", "lineString", "toLineString", "nearestPointOnProjectedLine", "nearestPointOnLine", "turfCenter", "distance", "circle", "mapCoords", "import_distance", "distance", "turfDistance", "turfMidpoint", "import_area", "import_centroid", "DEFAULT_TOOLTIPS", "turfCentroid", "area", "turfArea", "import_bearing", "import_center", "DEFAULT_TOOLTIPS", "point2", "turfBearing", "turfCenter"]
}
