earthsdk3-ol 3.7.0-beta.1 → 3.7.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/earthsdk3-ol.iife.js +4 -4
- package/dist/earthsdk3-ol.js +217 -218
- package/dist/earthsdk3-ol.umd.cjs +4 -4
- package/dist/types/ESJTypesOl/index.d.ts +0 -1
- package/dist/types/ESJTypesOl/olObject/OlArcType.d.ts +0 -1
- package/dist/types/ESJTypesOl/olObject/OlImageryProviderJsonType.d.ts +0 -1
- package/dist/types/ESJTypesOl/olObject/OlTilingSchemaJsonType.d.ts +0 -1
- package/dist/types/ESJTypesOl/olObject/OlTimeIntervalJsonType.d.ts +0 -1
- package/dist/types/ESJTypesOl/olObject/index.d.ts +0 -1
- package/dist/types/ESObjects/ESGeoIcon/ESGeoIcon.d.ts +0 -1
- package/dist/types/ESObjects/ESGeoIcon/OlESGeoIcon.d.ts +0 -1
- package/dist/types/ESObjects/ESGeoIcon/index.d.ts +0 -1
- package/dist/types/ESObjects/ESGeoPoint.d.ts +0 -1
- package/dist/types/ESObjects/ESXYZLayer/ESXYZLayer.d.ts +0 -1
- package/dist/types/ESObjects/ESXYZLayer/OlESXYZLayer.d.ts +0 -1
- package/dist/types/ESObjects/ESXYZLayer/index.d.ts +0 -1
- package/dist/types/ESObjects/base/colorManipulation/Color.d.ts +0 -1
- package/dist/types/ESObjects/base/getCenterFromPositions.d.ts +0 -1
- package/dist/types/ESObjects/base/getMinMaxCoordinates.d.ts +0 -1
- package/dist/types/ESObjects/base/index.d.ts +0 -1
- package/dist/types/ESObjects/base/moveAllPositionsWithCenter.d.ts +0 -1
- package/dist/types/ESObjects/base/types.d.ts +0 -1
- package/dist/types/ESObjects/index.d.ts +0 -1
- package/dist/types/ESOlViewer/OlMapCreating.d.ts +0 -1
- package/dist/types/ESOlViewer/ViewerExtensions/CursorPositionInfo.d.ts +0 -1
- package/dist/types/ESOlViewer/ViewerExtensions/ImageriesManager.d.ts +0 -1
- package/dist/types/ESOlViewer/ViewerExtensions/LabelManager.d.ts +0 -1
- package/dist/types/ESOlViewer/ViewerExtensions/PickingManager.d.ts +0 -1
- package/dist/types/ESOlViewer/ViewerExtensions/index.d.ts +0 -1
- package/dist/types/ESOlViewer/ViewerInstance.d.ts +0 -1
- package/dist/types/ESOlViewer/index.d.ts +2 -1
- package/dist/types/EditingSystem/base/Editing.d.ts +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/EditingPoint.d.ts +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsAppendEditing/AddEditingPoint.d.ts +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsAppendEditing/CircularAppendEditing.d.ts +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsAppendEditing/DoublePointsAppendEditing.d.ts +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsAppendEditing/LineStringAppendEditing.d.ts +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsAppendEditing/ScatterAppendEditing.d.ts +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsAppendEditing/VisibilityAppendEditing.d.ts +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsAppendEditing/index.d.ts +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsModifyEditing/CircularInsertEditing.d.ts +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsModifyEditing/DoublePointsModifyEditing.d.ts +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsModifyEditing/HeightModifyEditing.d.ts +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsModifyEditing/LineStringInsertEditing.d.ts +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsModifyEditing/ModifyEditingPoint.d.ts +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsModifyEditing/ScatterModifyEditing.d.ts +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsModifyEditing/VisibilityModifyEditing.d.ts +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsModifyEditing/index.d.ts +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/index.d.ts +0 -1
- package/dist/types/EditingSystem/base/PlaceEditing.d.ts +0 -1
- package/dist/types/EditingSystem/base/PointEditing/RotationEditing/GeoRotatorCircle.d.ts +0 -1
- package/dist/types/EditingSystem/base/PointEditing/RotationEditing/GeoRotatorPlane.d.ts +0 -1
- package/dist/types/EditingSystem/base/PointEditing/RotationEditing/RotatorRunning.d.ts +0 -1
- package/dist/types/EditingSystem/base/PointEditing/RotationEditing/index.d.ts +0 -1
- package/dist/types/EditingSystem/base/PointEditing/ScaleEditing/GeoScale.d.ts +0 -1
- package/dist/types/EditingSystem/base/PointEditing/ScaleEditing/index.d.ts +0 -1
- package/dist/types/EditingSystem/base/PointEditing/TranslationEditing/GeoCoordinates.d.ts +0 -1
- package/dist/types/EditingSystem/base/PointEditing/TranslationEditing/index.d.ts +0 -1
- package/dist/types/EditingSystem/base/PointEditing/index.d.ts +0 -1
- package/dist/types/EditingSystem/base/index.d.ts +0 -1
- package/dist/types/EditingSystem/editingProcessing.d.ts +0 -1
- package/dist/types/EditingSystem/index.d.ts +0 -1
- package/dist/types/EditingSystem/wrapper/BaseEditingWrapper.d.ts +0 -1
- package/dist/types/EditingSystem/wrapper/CircularAppendEditingWrapper.d.ts +0 -1
- package/dist/types/EditingSystem/wrapper/CircularInsertEditingWrapper.d.ts +0 -1
- package/dist/types/EditingSystem/wrapper/DoublePointsAppendEditingWrapper.d.ts +0 -1
- package/dist/types/EditingSystem/wrapper/DoublePointsModifyEditingWrapper.d.ts +0 -1
- package/dist/types/EditingSystem/wrapper/LineStringAppendEditingWrapper.d.ts +0 -1
- package/dist/types/EditingSystem/wrapper/LineStringInsertEditingWrapper.d.ts +0 -1
- package/dist/types/EditingSystem/wrapper/PlaceEditingWrapper.d.ts +0 -1
- package/dist/types/EditingSystem/wrapper/RotationEditingWrapper.d.ts +0 -1
- package/dist/types/EditingSystem/wrapper/ScaleEditingWrapper.d.ts +0 -1
- package/dist/types/EditingSystem/wrapper/TranslationEditingWrapper.d.ts +0 -1
- package/dist/types/EditingSystem/wrapper/index.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlImagery/index.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlMultiPoint/index.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/GeoCanvasImagePoi/impl/CanvasImagePoi.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/GeoCanvasImagePoi/impl/drawUtils.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/GeoCanvasImagePoi/impl/indext.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/GeoCanvasImagePoi/index.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/GeoCanvasMenuPoi/index.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/GeoCanvasPoi/index.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/GeoCustomDivPoi/index.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/GeoDivTextPoi/index.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/OlPoisImpl/OlBasePoi.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/OlPoisImpl/OlCancasPoi.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/OlPoisImpl/OlCanvasAndDivSwitchPoi.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/OlPoisImpl/OlDivPoi.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/OlPoisImpl/OlPoisContext.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/OlPoisImpl/index.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/index.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlView/OlCameraHelper.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlView/index.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/Point/index.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/Polygon/index.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/Polyline/index.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/Polylines/index.d.ts +0 -1
- package/dist/types/OlObjects/base/InnerClass/index.d.ts +0 -1
- package/dist/types/OlObjects/base/OlESGeoVector.d.ts +0 -1
- package/dist/types/OlObjects/base/OlESLabel.d.ts +0 -1
- package/dist/types/OlObjects/base/OlESLocalVector.d.ts +0 -1
- package/dist/types/OlObjects/base/OlESObjectWithLocation.d.ts +0 -1
- package/dist/types/OlObjects/base/OlESVisualObject.d.ts +0 -1
- package/dist/types/OlObjects/base/index.d.ts +0 -1
- package/dist/types/OlObjects/general/OlESAreaMeasurement/GeoAreaMeasurement.d.ts +0 -1
- package/dist/types/OlObjects/general/OlESAreaMeasurement/index.d.ts +0 -1
- package/dist/types/OlObjects/general/OlESAreaMeasurement/utils.d.ts +0 -1
- package/dist/types/OlObjects/general/OlESCameraView/index.d.ts +0 -1
- package/dist/types/OlObjects/general/OlESDirectionMeasurement/GeoDirectionMeasurement.d.ts +0 -1
- package/dist/types/OlObjects/general/OlESDirectionMeasurement/index.d.ts +0 -1
- package/dist/types/OlObjects/general/OlESDistanceMeasurement/GeoDistanceMeasurement.d.ts +0 -1
- package/dist/types/OlObjects/general/OlESDistanceMeasurement/index.d.ts +0 -1
- package/dist/types/OlObjects/general/OlESGeoLineString/index.d.ts +0 -1
- package/dist/types/OlObjects/general/OlESGeoPoint/index.d.ts +0 -1
- package/dist/types/OlObjects/general/OlESGeoPoints/index.d.ts +0 -1
- package/dist/types/OlObjects/general/OlESGeoPolygon/OlESGeoPolygonImpl/index.d.ts +0 -1
- package/dist/types/OlObjects/general/OlESGeoPolygon/index.d.ts +0 -1
- package/dist/types/OlObjects/general/OlESImageLabel/index.d.ts +0 -1
- package/dist/types/OlObjects/general/OlESImageryLayer/index.d.ts +0 -1
- package/dist/types/OlObjects/general/OlESLocationMeasurement/index.d.ts +0 -1
- package/dist/types/OlObjects/general/OlESPath/arrows.d.ts +0 -1
- package/dist/types/OlObjects/general/OlESPath/index.d.ts +0 -1
- package/dist/types/OlObjects/general/OlESTextLabel/index.d.ts +0 -1
- package/dist/types/OlObjects/general/index.d.ts +0 -1
- package/dist/types/OlObjects/index.d.ts +0 -1
- package/dist/types/copyright.d.ts +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/utlis/base/AroundPoint.d.ts +0 -1
- package/dist/types/utlis/base/capture.d.ts +0 -1
- package/dist/types/utlis/base/flyTo.d.ts +0 -1
- package/dist/types/utlis/base/index.d.ts +0 -1
- package/dist/types/utlis/base/walk.d.ts +0 -1
- package/dist/types/utlis/generalUtils/bindNorthRotation.d.ts +0 -1
- package/dist/types/utlis/generalUtils/createInfoPoi.d.ts +0 -1
- package/dist/types/utlis/generalUtils/createInnerHtmlWithWhiteTextBlackgrounds.d.ts +0 -1
- package/dist/types/utlis/generalUtils/getFuncFromStr.d.ts +0 -1
- package/dist/types/utlis/generalUtils/getObjectProperties.d.ts +0 -1
- package/dist/types/utlis/generalUtils/getPointerEventButtion.d.ts +0 -1
- package/dist/types/utlis/generalUtils/humanStr/angleToHumanStr.d.ts +0 -1
- package/dist/types/utlis/generalUtils/humanStr/distanceToHumanStr.d.ts +0 -1
- package/dist/types/utlis/generalUtils/humanStr/index.d.ts +0 -1
- package/dist/types/utlis/generalUtils/humanStr/positionToHumanStr.d.ts +0 -1
- package/dist/types/utlis/generalUtils/index.d.ts +0 -1
- package/dist/types/utlis/index.d.ts +0 -1
- package/dist/types/utlis/olUtils/CurrentScale.d.ts +0 -1
- package/dist/types/utlis/olUtils/GeoCoordinatesComputing/CurrentScale.d.ts +0 -1
- package/dist/types/utlis/olUtils/GeoCoordinatesComputing/computePickingInfoWithCoordinates.d.ts +0 -1
- package/dist/types/utlis/olUtils/GeoCoordinatesComputing/geoNeareastPointOnRhumbLine.d.ts +0 -1
- package/dist/types/utlis/olUtils/GeoCoordinatesComputing/index.d.ts +0 -1
- package/dist/types/utlis/olUtils/OlViewDistanceRangeControl.d.ts +0 -1
- package/dist/types/utlis/olUtils/Pick/index.d.ts +0 -1
- package/dist/types/utlis/olUtils/Pick/pickPosition.d.ts +0 -1
- package/dist/types/utlis/olUtils/WinPosFromCoordinate.d.ts +0 -1
- package/dist/types/utlis/olUtils/calculate.d.ts +0 -1
- package/dist/types/utlis/olUtils/cameraUtils.d.ts +0 -1
- package/dist/types/utlis/olUtils/getGeodesicCenter.d.ts +0 -1
- package/dist/types/utlis/olUtils/getQuaternion.d.ts +0 -1
- package/dist/types/utlis/olUtils/index.d.ts +0 -1
- package/dist/types/utlis/olUtils/olConverts.d.ts +0 -1
- package/dist/types/utlis/olUtils/olcameraUtils.d.ts +0 -1
- package/dist/types/utlis/olUtils/todo/index.d.ts +0 -1
- package/dist/types/utlis/olUtils/todo/numberTypes.d.ts +0 -1
- package/dist/types/utlis/olUtils/todo/positionsToLocalPositions.d.ts +0 -1
- package/package.json +2 -2
- package/dist/types/ESJTypesOl/index.d.ts.map +0 -1
- package/dist/types/ESJTypesOl/olObject/OlArcType.d.ts.map +0 -1
- package/dist/types/ESJTypesOl/olObject/OlImageryProviderJsonType.d.ts.map +0 -1
- package/dist/types/ESJTypesOl/olObject/OlTilingSchemaJsonType.d.ts.map +0 -1
- package/dist/types/ESJTypesOl/olObject/OlTimeIntervalJsonType.d.ts.map +0 -1
- package/dist/types/ESJTypesOl/olObject/index.d.ts.map +0 -1
- package/dist/types/ESObjects/ESGeoIcon/ESGeoIcon.d.ts.map +0 -1
- package/dist/types/ESObjects/ESGeoIcon/OlESGeoIcon.d.ts.map +0 -1
- package/dist/types/ESObjects/ESGeoIcon/index.d.ts.map +0 -1
- package/dist/types/ESObjects/ESGeoPoint.d.ts.map +0 -1
- package/dist/types/ESObjects/ESXYZLayer/ESXYZLayer.d.ts.map +0 -1
- package/dist/types/ESObjects/ESXYZLayer/OlESXYZLayer.d.ts.map +0 -1
- package/dist/types/ESObjects/ESXYZLayer/index.d.ts.map +0 -1
- package/dist/types/ESObjects/base/colorManipulation/Color.d.ts.map +0 -1
- package/dist/types/ESObjects/base/getCenterFromPositions.d.ts.map +0 -1
- package/dist/types/ESObjects/base/getMinMaxCoordinates.d.ts.map +0 -1
- package/dist/types/ESObjects/base/index.d.ts.map +0 -1
- package/dist/types/ESObjects/base/moveAllPositionsWithCenter.d.ts.map +0 -1
- package/dist/types/ESObjects/base/types.d.ts.map +0 -1
- package/dist/types/ESObjects/index.d.ts.map +0 -1
- package/dist/types/ESOlViewer/OlMapCreating.d.ts.map +0 -1
- package/dist/types/ESOlViewer/ViewerExtensions/CursorPositionInfo.d.ts.map +0 -1
- package/dist/types/ESOlViewer/ViewerExtensions/ImageriesManager.d.ts.map +0 -1
- package/dist/types/ESOlViewer/ViewerExtensions/LabelManager.d.ts.map +0 -1
- package/dist/types/ESOlViewer/ViewerExtensions/PickingManager.d.ts.map +0 -1
- package/dist/types/ESOlViewer/ViewerExtensions/index.d.ts.map +0 -1
- package/dist/types/ESOlViewer/ViewerInstance.d.ts.map +0 -1
- package/dist/types/ESOlViewer/index.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/Editing.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/EditingPoint.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsAppendEditing/AddEditingPoint.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsAppendEditing/CircularAppendEditing.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsAppendEditing/DoublePointsAppendEditing.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsAppendEditing/LineStringAppendEditing.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsAppendEditing/ScatterAppendEditing.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsAppendEditing/VisibilityAppendEditing.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsAppendEditing/index.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsModifyEditing/CircularInsertEditing.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsModifyEditing/DoublePointsModifyEditing.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsModifyEditing/HeightModifyEditing.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsModifyEditing/LineStringInsertEditing.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsModifyEditing/ModifyEditingPoint.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsModifyEditing/ScatterModifyEditing.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsModifyEditing/VisibilityModifyEditing.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/MultiPointsModifyEditing/index.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/MultiPointsEditing/index.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/PlaceEditing.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/PointEditing/RotationEditing/GeoRotatorCircle.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/PointEditing/RotationEditing/GeoRotatorPlane.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/PointEditing/RotationEditing/RotatorRunning.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/PointEditing/RotationEditing/index.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/PointEditing/ScaleEditing/GeoScale.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/PointEditing/ScaleEditing/index.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/PointEditing/TranslationEditing/GeoCoordinates.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/PointEditing/TranslationEditing/index.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/PointEditing/index.d.ts.map +0 -1
- package/dist/types/EditingSystem/base/index.d.ts.map +0 -1
- package/dist/types/EditingSystem/editingProcessing.d.ts.map +0 -1
- package/dist/types/EditingSystem/index.d.ts.map +0 -1
- package/dist/types/EditingSystem/wrapper/BaseEditingWrapper.d.ts.map +0 -1
- package/dist/types/EditingSystem/wrapper/CircularAppendEditingWrapper.d.ts.map +0 -1
- package/dist/types/EditingSystem/wrapper/CircularInsertEditingWrapper.d.ts.map +0 -1
- package/dist/types/EditingSystem/wrapper/DoublePointsAppendEditingWrapper.d.ts.map +0 -1
- package/dist/types/EditingSystem/wrapper/DoublePointsModifyEditingWrapper.d.ts.map +0 -1
- package/dist/types/EditingSystem/wrapper/LineStringAppendEditingWrapper.d.ts.map +0 -1
- package/dist/types/EditingSystem/wrapper/LineStringInsertEditingWrapper.d.ts.map +0 -1
- package/dist/types/EditingSystem/wrapper/PlaceEditingWrapper.d.ts.map +0 -1
- package/dist/types/EditingSystem/wrapper/RotationEditingWrapper.d.ts.map +0 -1
- package/dist/types/EditingSystem/wrapper/ScaleEditingWrapper.d.ts.map +0 -1
- package/dist/types/EditingSystem/wrapper/TranslationEditingWrapper.d.ts.map +0 -1
- package/dist/types/EditingSystem/wrapper/index.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlImagery/index.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlMultiPoint/index.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/GeoCanvasImagePoi/impl/CanvasImagePoi.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/GeoCanvasImagePoi/impl/drawUtils.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/GeoCanvasImagePoi/impl/indext.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/GeoCanvasImagePoi/index.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/GeoCanvasMenuPoi/index.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/GeoCanvasPoi/index.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/GeoCustomDivPoi/index.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/GeoDivTextPoi/index.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/OlPoisImpl/OlBasePoi.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/OlPoisImpl/OlCancasPoi.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/OlPoisImpl/OlCanvasAndDivSwitchPoi.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/OlPoisImpl/OlDivPoi.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/OlPoisImpl/OlPoisContext.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/OlPoisImpl/index.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlPois/index.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlView/OlCameraHelper.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/OlView/index.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/Point/index.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/Polygon/index.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/Polyline/index.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/Polylines/index.d.ts.map +0 -1
- package/dist/types/OlObjects/base/InnerClass/index.d.ts.map +0 -1
- package/dist/types/OlObjects/base/OlESGeoVector.d.ts.map +0 -1
- package/dist/types/OlObjects/base/OlESLabel.d.ts.map +0 -1
- package/dist/types/OlObjects/base/OlESLocalVector.d.ts.map +0 -1
- package/dist/types/OlObjects/base/OlESObjectWithLocation.d.ts.map +0 -1
- package/dist/types/OlObjects/base/OlESVisualObject.d.ts.map +0 -1
- package/dist/types/OlObjects/base/index.d.ts.map +0 -1
- package/dist/types/OlObjects/general/OlESAreaMeasurement/GeoAreaMeasurement.d.ts.map +0 -1
- package/dist/types/OlObjects/general/OlESAreaMeasurement/index.d.ts.map +0 -1
- package/dist/types/OlObjects/general/OlESAreaMeasurement/utils.d.ts.map +0 -1
- package/dist/types/OlObjects/general/OlESCameraView/index.d.ts.map +0 -1
- package/dist/types/OlObjects/general/OlESDirectionMeasurement/GeoDirectionMeasurement.d.ts.map +0 -1
- package/dist/types/OlObjects/general/OlESDirectionMeasurement/index.d.ts.map +0 -1
- package/dist/types/OlObjects/general/OlESDistanceMeasurement/GeoDistanceMeasurement.d.ts.map +0 -1
- package/dist/types/OlObjects/general/OlESDistanceMeasurement/index.d.ts.map +0 -1
- package/dist/types/OlObjects/general/OlESGeoLineString/index.d.ts.map +0 -1
- package/dist/types/OlObjects/general/OlESGeoPoint/index.d.ts.map +0 -1
- package/dist/types/OlObjects/general/OlESGeoPoints/index.d.ts.map +0 -1
- package/dist/types/OlObjects/general/OlESGeoPolygon/OlESGeoPolygonImpl/index.d.ts.map +0 -1
- package/dist/types/OlObjects/general/OlESGeoPolygon/index.d.ts.map +0 -1
- package/dist/types/OlObjects/general/OlESImageLabel/index.d.ts.map +0 -1
- package/dist/types/OlObjects/general/OlESImageryLayer/index.d.ts.map +0 -1
- package/dist/types/OlObjects/general/OlESLocationMeasurement/index.d.ts.map +0 -1
- package/dist/types/OlObjects/general/OlESPath/arrows.d.ts.map +0 -1
- package/dist/types/OlObjects/general/OlESPath/index.d.ts.map +0 -1
- package/dist/types/OlObjects/general/OlESTextLabel/index.d.ts.map +0 -1
- package/dist/types/OlObjects/general/index.d.ts.map +0 -1
- package/dist/types/OlObjects/index.d.ts.map +0 -1
- package/dist/types/copyright.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/utlis/base/AroundPoint.d.ts.map +0 -1
- package/dist/types/utlis/base/capture.d.ts.map +0 -1
- package/dist/types/utlis/base/flyTo.d.ts.map +0 -1
- package/dist/types/utlis/base/index.d.ts.map +0 -1
- package/dist/types/utlis/base/walk.d.ts.map +0 -1
- package/dist/types/utlis/generalUtils/bindNorthRotation.d.ts.map +0 -1
- package/dist/types/utlis/generalUtils/createInfoPoi.d.ts.map +0 -1
- package/dist/types/utlis/generalUtils/createInnerHtmlWithWhiteTextBlackgrounds.d.ts.map +0 -1
- package/dist/types/utlis/generalUtils/getFuncFromStr.d.ts.map +0 -1
- package/dist/types/utlis/generalUtils/getObjectProperties.d.ts.map +0 -1
- package/dist/types/utlis/generalUtils/getPointerEventButtion.d.ts.map +0 -1
- package/dist/types/utlis/generalUtils/humanStr/angleToHumanStr.d.ts.map +0 -1
- package/dist/types/utlis/generalUtils/humanStr/distanceToHumanStr.d.ts.map +0 -1
- package/dist/types/utlis/generalUtils/humanStr/index.d.ts.map +0 -1
- package/dist/types/utlis/generalUtils/humanStr/positionToHumanStr.d.ts.map +0 -1
- package/dist/types/utlis/generalUtils/index.d.ts.map +0 -1
- package/dist/types/utlis/index.d.ts.map +0 -1
- package/dist/types/utlis/olUtils/CurrentScale.d.ts.map +0 -1
- package/dist/types/utlis/olUtils/GeoCoordinatesComputing/CurrentScale.d.ts.map +0 -1
- package/dist/types/utlis/olUtils/GeoCoordinatesComputing/computePickingInfoWithCoordinates.d.ts.map +0 -1
- package/dist/types/utlis/olUtils/GeoCoordinatesComputing/geoNeareastPointOnRhumbLine.d.ts.map +0 -1
- package/dist/types/utlis/olUtils/GeoCoordinatesComputing/index.d.ts.map +0 -1
- package/dist/types/utlis/olUtils/OlViewDistanceRangeControl.d.ts.map +0 -1
- package/dist/types/utlis/olUtils/Pick/index.d.ts.map +0 -1
- package/dist/types/utlis/olUtils/Pick/pickPosition.d.ts.map +0 -1
- package/dist/types/utlis/olUtils/WinPosFromCoordinate.d.ts.map +0 -1
- package/dist/types/utlis/olUtils/calculate.d.ts.map +0 -1
- package/dist/types/utlis/olUtils/cameraUtils.d.ts.map +0 -1
- package/dist/types/utlis/olUtils/getGeodesicCenter.d.ts.map +0 -1
- package/dist/types/utlis/olUtils/getQuaternion.d.ts.map +0 -1
- package/dist/types/utlis/olUtils/index.d.ts.map +0 -1
- package/dist/types/utlis/olUtils/olConverts.d.ts.map +0 -1
- package/dist/types/utlis/olUtils/olcameraUtils.d.ts.map +0 -1
- package/dist/types/utlis/olUtils/todo/index.d.ts.map +0 -1
- package/dist/types/utlis/olUtils/todo/numberTypes.d.ts.map +0 -1
- package/dist/types/utlis/olUtils/todo/positionsToLocalPositions.d.ts.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var EarthSDK3_OL=function(W,f,Rn){"use strict";var mE=Object.defineProperty;var _E=(W,f,Rn)=>f in W?mE(W,f,{enumerable:!0,configurable:!0,writable:!0,value:Rn}):W[f]=Rn;var R=(W,f,Rn)=>_E(W,typeof f!="symbol"?f+"":f,Rn);var as=typeof document<"u"?document.currentScript:null;W.copyright=void 0;try{const i="earthsdk3-ol",t="3.7.0-beta.
|
|
1
|
+
var EarthSDK3_OL=function(W,f,Rn){"use strict";var mE=Object.defineProperty;var _E=(W,f,Rn)=>f in W?mE(W,f,{enumerable:!0,configurable:!0,writable:!0,value:Rn}):W[f]=Rn;var R=(W,f,Rn)=>_E(W,typeof f!="symbol"?f+"":f,Rn);var as=typeof document<"u"?document.currentScript:null;W.copyright=void 0;try{const i="earthsdk3-ol",t="3.7.0-beta.15",e="2025-12-18T03:39:35.000Z",n="北京西部世界科技有限公司",s="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",o="bf43a4be94d72dcbd6f2dac7f9881efa9d414a29",a=((Date.now()-1766029175e3)/36e5).toFixed(1),c=`%c🌏 ${i}%c ${t}.${o.slice(0,8)}.${e} (距今${a}个小时)
|
|
2
2
|
%c${s?s+`
|
|
3
3
|
`:""}当前网站正在使用${i},此软件版权归${n}所有
|
|
4
|
-
`;W.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","
|
|
4
|
+
`;W.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","bf43a4be94d72dcbd6f2dac7f9881efa9d414a29")},get info(){return c},get date(){return"2025-12-18T03:39:35.000Z"},get author(){return"suplyang"},get version(){return"3.7.0-beta.15"},get name(){return"earthsdk3-ol"},get commitId(){return"bf43a4be94d72dcbd6f2dac7f9881efa9d414a29"},print(h=!1){!h&&window._xe2_no_copy_print||console.info(this.info,`
|
|
5
5
|
font-size: 18px;
|
|
6
6
|
font-weight: 1000;
|
|
7
7
|
line-height: 1;
|
|
@@ -26,7 +26,7 @@ var EarthSDK3_OL=function(W,f,Rn){"use strict";var mE=Object.defineProperty;var
|
|
|
26
26
|
`||h===l){o=Math.max(o,r),s.push(r),r=0,a+=c;continue}const d=t[h+1]||i.font,g=Xr(d,u);e.push(g),r+=g;const _=t0(d);n.push(_),c=Math.max(c,_)}return{width:o,height:a,widths:e,heights:n,lineWidths:s}}function i0(i,t,e,n,s,o,r,a,c,h,l){i.save(),e!==1&&(i.globalAlpha*=e),t&&i.setTransform.apply(i,t),n.contextInstructions?(i.translate(c,h),i.scale(l[0],l[1]),n0(n,i)):l[0]<0||l[1]<0?(i.translate(c,h),i.scale(l[0],l[1]),i.drawImage(n,s,o,r,a,0,0,r,a)):i.drawImage(n,s,o,r,a,c,h,r*l[0],a*l[1]),i.restore()}function n0(i,t){const e=i.contextInstructions;for(let n=0,s=e.length;n<s;n+=2)Array.isArray(e[n+1])?t[e[n]].apply(t,e[n+1]):t[e[n]]=e[n+1]}class mo extends Wr{constructor(t){const e=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:1,rotateWithView:e,rotation:t.rotation!==void 0?t.rotation:0,scale:t.scale!==void 0?t.scale:1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode}),this.canvas_=void 0,this.hitDetectionCanvas_=null,this.fill_=t.fill!==void 0?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius_=t.radius!==void 0?t.radius:t.radius1,this.radius2_=t.radius2,this.angle_=t.angle!==void 0?t.angle:0,this.stroke_=t.stroke!==void 0?t.stroke:null,this.size_=null,this.renderOptions_=null,this.render()}clone(){const t=this.getScale(),e=new mo({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_;if(!t)return null;const e=this.getDisplacement(),n=this.getScaleArray();return[t[0]/2-e[0]/n[0],t[1]/2+e[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_}getImage(t){let e=this.canvas_[t];if(!e){const n=this.renderOptions_,s=Bt(n.size*t,n.size*t);this.draw_(n,s,t),e=s.canvas,this.canvas_[t]=e}return e}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return ot.LOADED}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius_}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,n){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let s=this.radius_,o=this.radius2_===void 0?s:this.radius2_;if(s<o){const D=s;s=o,o=D}const r=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/r,c=o*Math.sin(a),h=Math.sqrt(o*o-c*c),l=s-h,u=Math.sqrt(c*c+l*l),d=u/c;if(t==="miter"&&d<=n)return d*e;const g=e/2/d,_=e/2*(l/u),w=Math.sqrt((s+g)*(s+g)+_*_)-s;if(this.radius2_===void 0||t==="bevel")return w*2;const E=s*Math.sin(a),b=Math.sqrt(s*s-E*E),P=o-b,M=Math.sqrt(E*E+P*P)/E;if(M<=n){const D=M*e/2-o-s;return 2*Math.max(w,D)}return w*2}createRenderOptions(){let t=ms,e=0,n=null,s=0,o,r=0;this.stroke_&&(o=this.stroke_.getColor(),o===null&&(o=fo),o=ei(o),r=this.stroke_.getWidth(),r===void 0&&(r=po),n=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset(),t=this.stroke_.getLineJoin(),t===void 0&&(t=ms),e=this.stroke_.getMiterLimit(),e===void 0&&(e=uo));const a=this.calculateLineJoinSize_(t,r,e),c=Math.max(this.radius_,this.radius2_||0),h=Math.ceil(2*c+a);return{strokeStyle:o,strokeWidth:r,size:h,lineDash:n,lineDashOffset:s,lineJoin:t,miterLimit:e}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.canvas_={},this.size_=[t,t]}draw_(t,e,n){if(e.scale(n,n),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let s=this.fill_.getColor();s===null&&(s=ge),e.fillStyle=ei(s),e.fill()}this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){if(this.fill_){let e=this.fill_.getColor(),n=0;if(typeof e=="string"&&(e=qr(e)),e===null?n=1:Array.isArray(e)&&(n=e.length===4?e[3]:1),n===0){const s=Bt(t.size,t.size);this.hitDetectionCanvas_=s.canvas,this.drawHitDetectionCanvas_(t,s)}}this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.getImage(1))}createPath_(t){let e=this.points_;const n=this.radius_;if(e===1/0)t.arc(0,0,n,0,2*Math.PI);else{const s=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(e*=2);const o=this.angle_-Math.PI/2,r=2*Math.PI/e;for(let a=0;a<e;a++){const c=o+a*r,h=a%2===0?n:s;t.lineTo(h*Math.cos(c),h*Math.sin(c))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=ge,e.fill(),this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}}class ii extends mo{constructor(t){t=t||{radius:5},super({points:1/0,fill:t.fill,radius:t.radius,stroke:t.stroke,scale:t.scale!==void 0?t.scale:1,rotation:t.rotation!==void 0?t.rotation:0,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new ii({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}setRadius(t){this.radius_=t,this.render()}}class Xt{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=sd,t.geometry!==void 0&&this.setGeometry(t.geometry),this.fill_=t.fill!==void 0?t.fill:null,this.image_=t.image!==void 0?t.image:null,this.renderer_=t.renderer!==void 0?t.renderer:null,this.hitDetectionRenderer_=t.hitDetectionRenderer!==void 0?t.hitDetectionRenderer:null,this.stroke_=t.stroke!==void 0?t.stroke:null,this.text_=t.text!==void 0?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&typeof t=="object"&&(t=t.clone()),new Xt({geometry:t,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer(),stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){typeof t=="function"?this.geometryFunction_=t:typeof t=="string"?this.geometryFunction_=function(e){return e.get(t)}:t?t!==void 0&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=sd,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function s0(i){let t;if(typeof i=="function")t=i;else{let e;Array.isArray(i)?e=i:(pt(typeof i.getZIndex=="function",41),e=[i]),t=function(){return e}}return t}let Gc=null;function o0(i,t){if(!Gc){const e=new de({color:"rgba(255,255,255,0.4)"}),n=new Se({color:"#3399CC",width:1.25});Gc=[new Xt({image:new ii({fill:e,stroke:n,radius:5}),fill:e,stroke:n})]}return Gc}function sd(i){return i.getGeometry()}const r0="#333";class _o{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.scale_=t.scale,this.scaleArray_=fe(t.scale!==void 0?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=t.fill!==void 0?t.fill:new de({color:r0}),this.maxAngle_=t.maxAngle!==void 0?t.maxAngle:Math.PI/4,this.placement_=t.placement!==void 0?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=t.stroke!==void 0?t.stroke:null,this.offsetX_=t.offsetX!==void 0?t.offsetX:0,this.offsetY_=t.offsetY!==void 0?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=t.padding===void 0?null:t.padding}clone(){const t=this.getScale();return new _o({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=fe(t!==void 0?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}const It={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};class od extends Ke{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);typeof t.properties=="object"&&(delete e.properties,Object.assign(e,t.properties)),e[It.OPACITY]=t.opacity!==void 0?t.opacity:1,pt(typeof e[It.OPACITY]=="number",64),e[It.VISIBLE]=t.visible!==void 0?t.visible:!0,e[It.Z_INDEX]=t.zIndex,e[It.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[It.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[It.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[It.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:t===void 0?!0:t},n=this.getZIndex();return e.opacity=qt(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=n===void 0&&!e.managed?1/0:n,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return vt()}getLayerStatesArray(t){return vt()}getExtent(){return this.get(It.EXTENT)}getMaxResolution(){return this.get(It.MAX_RESOLUTION)}getMinResolution(){return this.get(It.MIN_RESOLUTION)}getMinZoom(){return this.get(It.MIN_ZOOM)}getMaxZoom(){return this.get(It.MAX_ZOOM)}getOpacity(){return this.get(It.OPACITY)}getSourceState(){return vt()}getVisible(){return this.get(It.VISIBLE)}getZIndex(){return this.get(It.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(It.EXTENT,t)}setMaxResolution(t){this.set(It.MAX_RESOLUTION,t)}setMinResolution(t){this.set(It.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(It.MAX_ZOOM,t)}setMinZoom(t){this.set(It.MIN_ZOOM,t)}setOpacity(t){pt(typeof t=="number",64),this.set(It.OPACITY,t)}setVisible(t){this.set(It.VISIBLE,t)}setZIndex(t){this.set(It.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const Vt={ANIMATING:0,INTERACTING:1},Be={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"},a0=42,Bc=256;function rd(i,t,e){return function(n,s,o,r,a){if(!n)return;if(!s&&!t)return n;const c=t?0:o[0]*s,h=t?0:o[1]*s,l=a?a[0]:0,u=a?a[1]:0;let d=i[0]+c/2+l,g=i[2]-c/2+l,_=i[1]+h/2+u,y=i[3]-h/2+u;d>g&&(d=(g+d)/2,g=d),_>y&&(_=(y+_)/2,y=_);let w=qt(n[0],d,g),E=qt(n[1],_,y);if(r&&e&&s){const b=30*s;w+=-b*Math.log(1+Math.max(0,d-n[0])/b)+b*Math.log(1+Math.max(0,n[0]-g)/b),E+=-b*Math.log(1+Math.max(0,_-n[1])/b)+b*Math.log(1+Math.max(0,n[1]-y)/b)}return[w,E]}}function c0(i){return i}function Vc(i,t,e,n){const s=_t(t)/e[0],o=Ht(t)/e[1];return n?Math.min(i,Math.max(s,o)):Math.min(i,Math.min(s,o))}function Yc(i,t,e){let n=Math.min(i,t);const s=50;return n*=Math.log(1+s*Math.max(0,i/t-1))/s+1,e&&(n=Math.max(n,e),n/=Math.log(1+s*Math.max(0,e/i-1))/s+1),qt(n,e/2,t*2)}function h0(i,t,e,n){return t=t!==void 0?t:!0,function(s,o,r,a){if(s!==void 0){const c=i[0],h=i[i.length-1],l=e?Vc(c,e,r,n):c;if(a)return t?Yc(s,l,h):qt(s,h,l);const u=Math.min(l,s),d=Math.floor(Sr(i,u,o));return i[d]>l&&d<i.length-1?i[d+1]:i[d]}}}function l0(i,t,e,n,s,o){return n=n!==void 0?n:!0,e=e!==void 0?e:0,function(r,a,c,h){if(r!==void 0){const l=s?Vc(t,s,c,o):t;if(h)return n?Yc(r,l,e):qt(r,e,l);const u=1e-9,d=Math.ceil(Math.log(t/l)/Math.log(i)-u),g=-a*(.5-u)+.5,_=Math.min(l,r),y=Math.floor(Math.log(t/_)/Math.log(i)+g),w=Math.max(d,y),E=t/Math.pow(i,w);return qt(E,e,l)}}}function ad(i,t,e,n,s){return e=e!==void 0?e:!0,function(o,r,a,c){if(o!==void 0){const h=n?Vc(i,n,a,s):i;return!e||!c?qt(o,t,h):Yc(o,h,t)}}}function Hc(i){if(i!==void 0)return 0}function cd(i){if(i!==void 0)return i}function u0(i){const t=2*Math.PI/i;return function(e,n){if(n)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e}}function d0(i){return i=i||Fr(5),function(t,e){if(e)return t;if(t!==void 0)return Math.abs(t)<=i?0:t}}const Xc=0;class ni extends Ke{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Ac(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&wu(),t.center&&(t.center=mi(t.center,this.projection_)),t.extent&&(t.extent=_i(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in Be)delete e[a];this.setProperties(e,!0);const n=g0(t);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=n.minZoom;const s=f0(t),o=n.constraint,r=p0(t);this.constraints_={center:s,resolution:o,rotation:r},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const n=this.getCenterInternal();if(n){const s=t||[0,0,0,0];e=e||[0,0,0,0];const o=this.getResolution(),r=o/2*(s[3]-e[3]+e[1]-s[1]),a=o/2*(s[0]-e[0]+e[2]-s[2]);this.setCenterInternal([n[0]+r,n[1]-a])}}getUpdatedOptions_(t){const e=this.getProperties();return e.resolution!==void 0?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let n=0;n<e.length;++n){let s=arguments[n];s.center&&(s=Object.assign({},s),s.center=mi(s.center,this.getProjection())),s.anchor&&(s=Object.assign({},s),s.anchor=mi(s.anchor,this.getProjection())),e[n]=s}this.animateInternal.apply(this,e)}animateInternal(t){let e=arguments.length,n;e>1&&typeof arguments[e-1]=="function"&&(n=arguments[e-1],--e);let s=0;for(;s<e&&!this.isDef();++s){const l=arguments[s];l.center&&this.setCenterInternal(l.center),l.zoom!==void 0?this.setZoom(l.zoom):l.resolution&&this.setResolution(l.resolution),l.rotation!==void 0&&this.setRotation(l.rotation)}if(s===e){n&&$r(n,!0);return}let o=Date.now(),r=this.targetCenter_.slice(),a=this.targetResolution_,c=this.targetRotation_;const h=[];for(;s<e;++s){const l=arguments[s],u={start:o,complete:!1,anchor:l.anchor,duration:l.duration!==void 0?l.duration:1e3,easing:l.easing||Lp,callback:n};if(l.center&&(u.sourceCenter=r,u.targetCenter=l.center.slice(),r=u.targetCenter),l.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(l.zoom),a=u.targetResolution):l.resolution&&(u.sourceResolution=a,u.targetResolution=l.resolution,a=u.targetResolution),l.rotation!==void 0){u.sourceRotation=c;const d=$i(l.rotation-c+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=c+d,c=u.targetRotation}m0(u)?u.complete=!0:o+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(Vt.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Vt.ANIMATING]>0}getInteracting(){return this.hints_[Vt.INTERACTING]>0}cancelAnimations(){this.setHint(Vt.ANIMATING,-this.hints_[Vt.ANIMATING]);let t;for(let e=0,n=this.animations_.length;e<n;++e){const s=this.animations_[e];if(s[0].callback&&$r(s[0].callback,!1),!t)for(let o=0,r=s.length;o<r;++o){const a=s[o];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let n=this.animations_.length-1;n>=0;--n){const s=this.animations_[n];let o=!0;for(let r=0,a=s.length;r<a;++r){const c=s[r];if(c.complete)continue;const h=t-c.start;let l=c.duration>0?h/c.duration:1;l>=1?(c.complete=!0,l=1):o=!1;const u=c.easing(l);if(c.sourceCenter){const d=c.sourceCenter[0],g=c.sourceCenter[1],_=c.targetCenter[0],y=c.targetCenter[1];this.nextCenter_=c.targetCenter;const w=d+u*(_-d),E=g+u*(y-g);this.targetCenter_=[w,E]}if(c.sourceResolution&&c.targetResolution){const d=u===1?c.targetResolution:c.sourceResolution+u*(c.targetResolution-c.sourceResolution);if(c.anchor){const g=this.getViewportSize_(this.getRotation()),_=this.constraints_.resolution(d,0,g,!0);this.targetCenter_=this.calculateCenterZoom(_,c.anchor)}this.nextResolution_=c.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(c.sourceRotation!==void 0&&c.targetRotation!==void 0){const d=u===1?$i(c.targetRotation+Math.PI,2*Math.PI)-Math.PI:c.sourceRotation+u*(c.targetRotation-c.sourceRotation);if(c.anchor){const g=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(g,c.anchor)}this.nextRotation_=c.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),e=!0,!c.complete)break}if(o){this.animations_[n]=null,this.setHint(Vt.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const r=s[0].callback;r&&$r(r,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let n;const s=this.getCenterInternal();return s!==void 0&&(n=[s[0]-e[0],s[1]-e[1]],Rc(n,t-this.getRotation()),Em(n,e)),n}calculateCenterZoom(t,e){let n;const s=this.getCenterInternal(),o=this.getResolution();if(s!==void 0&&o!==void 0){const r=e[0]-t*(e[0]-s[0])/o,a=e[1]-t*(e[1]-s[1])/o;n=[r,a]}return n}getViewportSize_(t){const e=this.viewportSize_;if(t){const n=e[0],s=e[1];return[Math.abs(n*Math.cos(t))+Math.abs(s*Math.sin(t)),Math.abs(n*Math.sin(t))+Math.abs(s*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t&&Dc(t,this.getProjection())}getCenterInternal(){return this.get(Be.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return Pu(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();pt(e,1);const n=this.getResolution();pt(n!==void 0,2);const s=this.getRotation();return pt(s!==void 0,3),vc(e,n,s,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(Be.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(_i(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const n=_t(t)/e[0],s=Ht(t)/e[1];return Math.max(n,s)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,s=Math.log(e/n)/Math.log(t);return function(o){return e/Math.pow(t,o*s)}}getRotation(){return this.get(Be.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),n=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,o=Math.log(n/s)/e;return function(r){return Math.log(n/r)/e/o}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const n=this.padding_;return n&&(e=[e[0]-n[1]-n[3],e[1]-n[0]-n[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),n=this.getRotation();let s=this.getCenterInternal();const o=this.padding_;if(o){const r=this.getViewportSizeMinusPadding_();s=$c(s,this.getViewportSize_(),[r[0]/2+o[3],r[1]/2+o[0]],e,n)}return{center:s.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,n,s;if(this.resolutions_){const o=Sr(this.resolutions_,t,1);e=o,n=this.resolutions_[o],o==this.resolutions_.length-1?s=2:s=n/this.resolutions_[o+1]}else n=this.maxResolution_,s=this.zoomFactor_;return e+Math.log(n/t)/Math.log(s)}getResolutionForZoom(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const e=qt(Math.floor(t),0,this.resolutions_.length-2),n=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(n,qt(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let n;if(pt(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function",24),Array.isArray(t)){pt(!Xi(t),25);const s=_i(t,this.getProjection());n=Nc(s)}else if(t.getType()==="Circle"){const s=_i(t.getExtent(),this.getProjection());n=Nc(s),n.rotate(this.getRotation(),Hi(s))}else n=t;this.fitInternal(n,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),n=Math.cos(e),s=Math.sin(-e),o=t.getFlatCoordinates(),r=t.getStride();let a=1/0,c=1/0,h=-1/0,l=-1/0;for(let u=0,d=o.length;u<d;u+=r){const g=o[u]*n-o[u+1]*s,_=o[u]*s+o[u+1]*n;a=Math.min(a,g),c=Math.min(c,_),h=Math.max(h,g),l=Math.max(l,_)}return[a,c,h,l]}fitInternal(t,e){e=e||{};let n=e.size;n||(n=this.getViewportSizeMinusPadding_());const s=e.padding!==void 0?e.padding:[0,0,0,0],o=e.nearest!==void 0?e.nearest:!1;let r;e.minResolution!==void 0?r=e.minResolution:e.maxZoom!==void 0?r=this.getResolutionForZoom(e.maxZoom):r=0;const a=this.rotatedExtentForGeometry(t);let c=this.getResolutionForExtentInternal(a,[n[0]-s[1]-s[3],n[1]-s[0]-s[2]]);c=isNaN(c)?r:Math.max(c,r),c=this.getConstrainedResolution(c,o?0:1);const h=this.getRotation(),l=Math.sin(h),u=Math.cos(h),d=Hi(a);d[0]+=(s[1]-s[3])/2*c,d[1]+=(s[0]-s[2])/2*c;const g=d[0]*u-d[1]*l,_=d[1]*u+d[0]*l,y=this.getConstrainedCenter([g,_],c),w=e.callback?e.callback:hs;e.duration!==void 0?this.animateInternal({resolution:c,center:y,duration:e.duration,easing:e.easing},w):(this.targetResolution_=c,this.targetCenter_=y,this.applyTargetState_(!1,!0),$r(w,!0))}centerOn(t,e,n){this.centerOnInternal(mi(t,this.getProjection()),e,n)}centerOnInternal(t,e,n){this.setCenterInternal($c(t,e,n,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,n,s){let o;const r=this.padding_;if(r&&t){const a=this.getViewportSizeMinusPadding_(-n),c=$c(t,s,[a[0]/2+r[3],a[1]/2+r[0]],e,n);o=[t[0]-c[0],t[1]-c[1]]}return o}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){const e=Dc(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&mi(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const n=this.getAnimating()||this.getInteracting(),s=this.getViewportSize_(this.getRotation()),o=this.constraints_.resolution(this.targetResolution_*t,0,s,n);e&&(this.targetCenter_=this.calculateCenterZoom(o,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=mi(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const n=this.getAnimating()||this.getInteracting(),s=this.constraints_.rotation(this.targetRotation_+t,n);e&&(this.targetCenter_=this.calculateCenterRotate(s,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&mi(t,this.getProjection()))}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const n=this.getAnimating()||this.getInteracting()||e,s=this.constraints_.rotation(this.targetRotation_,n),o=this.getViewportSize_(s),r=this.constraints_.resolution(this.targetResolution_,0,o,n),a=this.constraints_.center(this.targetCenter_,r,o,n,this.calculateCenterShift(this.targetCenter_,r,s,o));this.get(Be.ROTATION)!==s&&this.set(Be.ROTATION,s),this.get(Be.RESOLUTION)!==r&&(this.set(Be.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Be.CENTER)||!Nr(this.get(Be.CENTER),a))&&this.set(Be.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,n){t=t!==void 0?t:200;const s=e||0,o=this.constraints_.rotation(this.targetRotation_),r=this.getViewportSize_(o),a=this.constraints_.resolution(this.targetResolution_,s,r),c=this.constraints_.center(this.targetCenter_,a,r,!1,this.calculateCenterShift(this.targetCenter_,a,o,r));if(t===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=o,this.targetCenter_=c,this.applyTargetState_();return}n=n||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==o||!this.getCenterInternal()||!Nr(this.getCenterInternal(),c))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:o,center:c,resolution:a,duration:t,easing:Pn,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Vt.INTERACTING,1)}endInteraction(t,e,n){n=n&&mi(n,this.getProjection()),this.endInteractionInternal(t,e,n)}endInteractionInternal(t,e,n){this.getInteracting()&&(this.setHint(Vt.INTERACTING,-1),this.resolveConstraints(t,e,n))}getConstrainedCenter(t,e){const n=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),n)}getConstrainedZoom(t,e){const n=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(n,e))}getConstrainedResolution(t,e){e=e||0;const n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,n)}}function $r(i,t){setTimeout(function(){i(t)},0)}function f0(i){if(i.extent!==void 0){const e=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return rd(i.extent,i.constrainOnlyCenter,e)}const t=Ac(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,rd(e,!1,!1)}return c0}function g0(i){let t,e,n,r=i.minZoom!==void 0?i.minZoom:Xc,a=i.maxZoom!==void 0?i.maxZoom:28;const c=i.zoomFactor!==void 0?i.zoomFactor:2,h=i.multiWorld!==void 0?i.multiWorld:!1,l=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,u=i.showFullExtent!==void 0?i.showFullExtent:!1,d=Ac(i.projection,"EPSG:3857"),g=d.getExtent();let _=i.constrainOnlyCenter,y=i.extent;if(!h&&!y&&d.isGlobal()&&(_=!1,y=g),i.resolutions!==void 0){const w=i.resolutions;e=w[r],n=w[a]!==void 0?w[a]:w[w.length-1],i.constrainResolution?t=h0(w,l,!_&&y,u):t=ad(e,n,l,!_&&y,u)}else{const E=(g?Math.max(_t(g),Ht(g)):360*Cc.degrees/d.getMetersPerUnit())/Bc/Math.pow(2,Xc),b=E/Math.pow(2,28-Xc);e=i.maxResolution,e!==void 0?r=0:e=E/Math.pow(c,r),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=e/Math.pow(c,a):n=E/Math.pow(c,a):n=b),a=r+Math.floor(Math.log(e/n)/Math.log(c)),n=e/Math.pow(c,a-r),i.constrainResolution?t=l0(c,e,n,l,!_&&y,u):t=ad(e,n,l,!_&&y,u)}return{constraint:t,maxResolution:e,minResolution:n,minZoom:r,zoomFactor:c}}function p0(i){if(i.enableRotation!==void 0?i.enableRotation:!0){const e=i.constrainRotation;return e===void 0||e===!0?d0():e===!1?cd:typeof e=="number"?u0(e):cd}return Hc}function m0(i){return!(i.sourceCenter&&i.targetCenter&&!Nr(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function $c(i,t,e,n,s){const o=Math.cos(-s);let r=Math.sin(-s),a=i[0]*o-i[1]*r,c=i[1]*o+i[0]*r;a+=(t[0]/2-e[0])*n,c+=(e[1]-t[1]/2)*n,r=-r;const h=a*o-c*r,l=c*o+a*r;return[h,l]}class yo extends od{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(It.SOURCE,this.handleSourcePropertyChange_);const n=t.source?t.source:null;this.setSource(n)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(It.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(Mt(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=Ct(t,ht.CHANGE,this.handleSourceChange_,this),t.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}isVisible(t){let e;const n=this.getMapInternal();!t&&n&&(t=n.getView()),t instanceof ni?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&n&&(e.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let s;e.layerStatesArray?s=e.layerStatesArray.find(r=>r.layer===this):s=this.getLayerState();const o=this.getExtent();return Zc(s,e.viewState)&&(!o||te(o,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e;const n=this.getSource();if(n&&(e=n.getAttributions()),!e)return[];const s=t instanceof ni?t.getViewStateAndExtent():t;let o=e(s);return Array.isArray(o)||(o=[o]),o}render(t,e){const n=this.getRenderer();return n.prepareFrame(t)?(this.rendered=!0,n.renderFrame(t,e)):null}unrender(){this.rendered=!1}setMapInternal(t){t||this.unrender(),this.set(It.MAP,t)}getMapInternal(){return this.get(It.MAP)}setMap(t){this.mapPrecomposeKey_&&(Mt(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(Mt(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=Ct(t,ti.PRECOMPOSE,function(e){const s=e.frameState.layerStatesArray,o=this.getLayerState(!1);pt(!s.some(function(r){return r.layer===o.layer}),67),s.push(o)},this),this.mapRenderKey_=Ct(this,ht.CHANGE,t.render,t),this.changed())}setSource(t){this.set(It.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}}function Zc(i,t){if(!i.visible)return!1;const e=t.resolution;if(e<i.minResolution||e>=i.maxResolution)return!1;const n=t.zoom;return n>i.minZoom&&n<=i.maxZoom}function _0(i,t,e,n,s){hd(i,t,e||0,n||i.length-1,s||y0)}function hd(i,t,e,n,s){for(;n>e;){if(n-e>600){var o=n-e+1,r=t-e+1,a=Math.log(o),c=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*c*(o-c)/o)*(r-o/2<0?-1:1),l=Math.max(e,Math.floor(t-r*c/o+h)),u=Math.min(n,Math.floor(t+(o-r)*c/o+h));hd(i,t,l,u,s)}var d=i[t],g=e,_=n;for(wo(i,e,t),s(i[n],d)>0&&wo(i,e,n);g<_;){for(wo(i,g,_),g++,_--;s(i[g],d)<0;)g++;for(;s(i[_],d)>0;)_--}s(i[e],d)===0?wo(i,e,_):(_++,wo(i,_,n)),_<=t&&(e=_+1),t<=_&&(n=_-1)}}function wo(i,t,e){var n=i[t];i[t]=i[e],i[e]=n}function y0(i,t){return i<t?-1:i>t?1:0}let Kc=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const n=[];if(!Kr(t,e))return n;const s=this.toBBox,o=[];for(;e;){for(let r=0;r<e.children.length;r++){const a=e.children[r],c=e.leaf?s(a):a;Kr(t,c)&&(e.leaf?n.push(a):Jc(t,c)?this._all(a,n):o.push(a))}e=o.pop()}return n}collides(t){let e=this.data;if(!Kr(t,e))return!1;const n=[];for(;e;){for(let s=0;s<e.children.length;s++){const o=e.children[s],r=e.leaf?this.toBBox(o):o;if(Kr(t,r)){if(e.leaf||Jc(t,r))return!0;n.push(o)}}e=n.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let n=0;n<t.length;n++)this.insert(t[n]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=e;else if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const n=this.data;this.data=e,e=n}this._insert(e,this.data.height-e.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=ws([]),this}remove(t,e){if(!t)return this;let n=this.data;const s=this.toBBox(t),o=[],r=[];let a,c,h;for(;n||o.length;){if(n||(n=o.pop(),c=o[o.length-1],a=r.pop(),h=!0),n.leaf){const l=w0(t,n.children,e);if(l!==-1)return n.children.splice(l,1),o.push(n),this._condense(o),this}!h&&!n.leaf&&Jc(n,s)?(o.push(n),r.push(a),a=0,c=n,n=n.children[0]):c?(a++,n=c.children[a],h=!1):n=null}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const n=[];for(;t;)t.leaf?e.push(...t.children):n.push(...t.children),t=n.pop();return e}_build(t,e,n,s){const o=n-e+1;let r=this._maxEntries,a;if(o<=r)return a=ws(t.slice(e,n+1)),ys(a,this.toBBox),a;s||(s=Math.ceil(Math.log(o)/Math.log(r)),r=Math.ceil(o/Math.pow(r,s-1))),a=ws([]),a.leaf=!1,a.height=s;const c=Math.ceil(o/r),h=c*Math.ceil(Math.sqrt(r));ld(t,e,n,h,this.compareMinX);for(let l=e;l<=n;l+=h){const u=Math.min(l+h-1,n);ld(t,l,u,c,this.compareMinY);for(let d=l;d<=u;d+=c){const g=Math.min(d+c-1,u);a.children.push(this._build(t,d,g,s-1))}}return ys(a,this.toBBox),a}_chooseSubtree(t,e,n,s){for(;s.push(e),!(e.leaf||s.length-1===n);){let o=1/0,r=1/0,a;for(let c=0;c<e.children.length;c++){const h=e.children[c],l=Qc(h),u=C0(t,h)-l;u<r?(r=u,o=l<o?l:o,a=h):u===r&&l<o&&(o=l,a=h)}e=a||e.children[0]}return e}_insert(t,e,n){const s=n?t:this.toBBox(t),o=[],r=this._chooseSubtree(s,this.data,e,o);for(r.children.push(t),Eo(r,s);e>=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(s,o,e)}_split(t,e){const n=t[e],s=n.children.length,o=this._minEntries;this._chooseSplitAxis(n,o,s);const r=this._chooseSplitIndex(n,o,s),a=ws(n.children.splice(r,n.children.length-r));a.height=n.height,a.leaf=n.leaf,ys(n,this.toBBox),ys(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(n,a)}_splitRoot(t,e){this.data=ws([t,e]),this.data.height=t.height+1,this.data.leaf=!1,ys(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let s,o=1/0,r=1/0;for(let a=e;a<=n-e;a++){const c=vo(t,0,a,this.toBBox),h=vo(t,a,n,this.toBBox),l=b0(c,h),u=Qc(c)+Qc(h);l<o?(o=l,s=a,r=u<r?u:r):l===o&&u<r&&(r=u,s=a)}return s||n-e}_chooseSplitAxis(t,e,n){const s=t.leaf?this.compareMinX:v0,o=t.leaf?this.compareMinY:E0,r=this._allDistMargin(t,e,n,s),a=this._allDistMargin(t,e,n,o);r<a&&t.children.sort(s)}_allDistMargin(t,e,n,s){t.children.sort(s);const o=this.toBBox,r=vo(t,0,e,o),a=vo(t,n-e,n,o);let c=Zr(r)+Zr(a);for(let h=e;h<n-e;h++){const l=t.children[h];Eo(r,t.leaf?o(l):l),c+=Zr(r)}for(let h=n-e-1;h>=e;h--){const l=t.children[h];Eo(a,t.leaf?o(l):l),c+=Zr(a)}return c}_adjustParentBBoxes(t,e,n){for(let s=n;s>=0;s--)Eo(e[s],t)}_condense(t){for(let e=t.length-1,n;e>=0;e--)t[e].children.length===0?e>0?(n=t[e-1].children,n.splice(n.indexOf(t[e]),1)):this.clear():ys(t[e],this.toBBox)}};function w0(i,t,e){if(!e)return t.indexOf(i);for(let n=0;n<t.length;n++)if(e(i,t[n]))return n;return-1}function ys(i,t){vo(i,0,i.children.length,t,i)}function vo(i,t,e,n,s){s||(s=ws(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let o=t;o<e;o++){const r=i.children[o];Eo(s,i.leaf?n(r):r)}return s}function Eo(i,t){return i.minX=Math.min(i.minX,t.minX),i.minY=Math.min(i.minY,t.minY),i.maxX=Math.max(i.maxX,t.maxX),i.maxY=Math.max(i.maxY,t.maxY),i}function v0(i,t){return i.minX-t.minX}function E0(i,t){return i.minY-t.minY}function Qc(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function Zr(i){return i.maxX-i.minX+(i.maxY-i.minY)}function C0(i,t){return(Math.max(t.maxX,i.maxX)-Math.min(t.minX,i.minX))*(Math.max(t.maxY,i.maxY)-Math.min(t.minY,i.minY))}function b0(i,t){const e=Math.max(i.minX,t.minX),n=Math.max(i.minY,t.minY),s=Math.min(i.maxX,t.maxX),o=Math.min(i.maxY,t.maxY);return Math.max(0,s-e)*Math.max(0,o-n)}function Jc(i,t){return i.minX<=t.minX&&i.minY<=t.minY&&t.maxX<=i.maxX&&t.maxY<=i.maxY}function Kr(i,t){return t.minX<=i.maxX&&t.minY<=i.maxY&&t.maxX>=i.minX&&t.maxY>=i.minY}function ws(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ld(i,t,e,n,s){const o=[t,e];for(;o.length;){if(e=o.pop(),t=o.pop(),e-t<=n)continue;const r=t+Math.ceil((e-t)/n/2)*n;_0(i,r,t,e,s),o.push(t,r,r,e)}}class x0{constructor(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}clear(){this.cache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const n=this.cache_[e];(t++&3)===0&&!n.hasListener()&&(delete this.cache_[e],--this.cacheSize_)}}}get(t,e,n){const s=ud(t,e,n);return s in this.cache_?this.cache_[s]:null}set(t,e,n,s){const o=ud(t,e,n);this.cache_[o]=s,++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function ud(i,t,e){const n=e?Xu(e):"null";return t+":"+i+":"+n}const Qr=new x0;class th extends to{constructor(t,e,n,s){super(),this.extent=t,this.pixelRatio_=n,this.resolution=e,this.state=s}changed(){this.dispatchEvent(ht.CHANGE)}getExtent(){return this.extent}getImage(){return vt()}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){vt()}}class S0 extends th{constructor(t,e,n,s,o,r,a){super(t,e,n,ot.IDLE),this.src_=s,this.image_=new Image,o!==null&&(this.image_.crossOrigin=o),this.context_=a,this.unlisten_=null,this.state=ot.IDLE,this.imageLoadFunction_=r}getImage(){if(this.state==ot.LOADED&&this.context_&&!(this.image_ instanceof HTMLCanvasElement)){const t=this.context_.canvas;t.width=this.image_.width,t.height=this.image_.height,this.context_.drawImage(this.image_,0,0),this.image_=this.context_.canvas}return this.image_}handleImageError_(){this.state=ot.ERROR,this.unlistenImage_(),this.changed()}handleImageLoad_(){this.resolution===void 0&&(this.resolution=Ht(this.extent)/this.image_.height),this.state=ot.LOADED,this.unlistenImage_(),this.changed()}load(){(this.state==ot.IDLE||this.state==ot.ERROR)&&(this.state=ot.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=eh(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}setImage(t){this.image_=t,this.resolution=Ht(this.extent)/this.image_.height}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function eh(i,t,e){const n=i;let s=!0,o=!1,r=!1;const a=[Pr(n,ht.LOAD,function(){r=!0,o||t()})];return n.src&&Vp?(o=!0,n.decode().then(function(){s&&t()}).catch(function(c){s&&(r?t():e())})):a.push(Pr(n,ht.ERROR,e)),function(){s=!1,a.forEach(Mt)}}let Co=null;class R0 extends to{constructor(t,e,n,s,o,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=s,this.canvas_={},this.color_=r,this.unlisten_=null,this.imageState_=o,this.size_=n,this.src_=e,this.tainted_}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===ot.LOADED){Co||(Co=Bt(1,1,void 0,{willReadFrequently:!0})),Co.drawImage(this.image_,0,0);try{Co.getImageData(0,0,1,1),this.tainted_=!1}catch{Co=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(ht.CHANGE)}handleImageError_(){this.imageState_=ot.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=ot.LOADED,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],n=Bt(t,e);n.fillRect(0,0,t,e),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===ot.IDLE){this.image_||this.initializeImage_(),this.imageState_=ot.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=eh(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==ot.LOADED)return;const e=this.image_,n=document.createElement("canvas");n.width=Math.ceil(e.width*t),n.height=Math.ceil(e.height*t);const s=n.getContext("2d");s.scale(t,t),s.drawImage(e,0,0),s.globalCompositeOperation="multiply",s.fillStyle=Xu(this.color_),s.fillRect(0,0,n.width/t,n.height/t),s.globalCompositeOperation="destination-in",s.drawImage(e,0,0),this.canvas_[t]=n}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function P0(i,t,e,n,s,o){let r=Qr.get(t,n,o);return r||(r=new R0(i,t,e,n,s,o),Qr.set(t,n,o,r)),r}function dd(i,t,e,n){return e!==void 0&&n!==void 0?[e/i,n/t]:e!==void 0?e/i:n!==void 0?n/t:1}class vs extends Wr{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,n=t.rotation!==void 0?t.rotation:0,s=t.scale!==void 0?t.scale:1,o=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:n,scale:s,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:o,declutterMode:t.declutterMode}),this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null;const r=t.img!==void 0?t.img:null;this.imgSize_=t.imgSize;let a=t.src;pt(!(a!==void 0&&r),4),pt(!r||r&&this.imgSize_,5),(a===void 0||a.length===0)&&r&&(a=r.src||St(r)),pt(a!==void 0&&a.length>0,6),pt(!((t.width!==void 0||t.height!==void 0)&&t.scale!==void 0),69);const c=t.src!==void 0?ot.IDLE:ot.LOADED;if(this.color_=t.color!==void 0?qr(t.color):null,this.iconImage_=P0(r,a,this.imgSize_!==void 0?this.imgSize_:null,this.crossOrigin_,c,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null,t.width!==void 0||t.height!==void 0){let h,l;if(t.size)[h,l]=t.size;else{const u=this.getImage(1);if(u instanceof HTMLCanvasElement||u.src&&u.complete)h=u.width,l=u.height;else{this.initialOptions_=t;const d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const g=this.iconImage_.getSize();this.setScale(dd(g[0],g[1],t.width,t.height))};this.listenImageChange(d);return}}h!==void 0&&this.setScale(dd(h,l,t.width,t.height))}}clone(){let t,e,n;return this.initialOptions_?(e=this.initialOptions_.width,n=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new vs({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const s=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!s)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=s[0]),this.anchorYUnits_=="fraction"&&(t[1]*=s[1])}if(this.anchorOrigin_!="top-left"){if(!s)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+s[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+s[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),n=this.getScaleArray();return[t[0]-e[0]/n[0],t[1]+e[1]/n[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){const e=this.getSize(),n=this.iconImage_.getSize();if(!e||!n)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=n[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=n[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==ot.LOADED)return this.iconImage_.getSize()[0]*t[0]}getHeight(){const t=this.getScaleArray();if(this.size_)return this.size_[1]*t[1];if(this.iconImage_.getImageState()==ot.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(ht.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(ht.CHANGE,t)}}function fd(i){return new Xt({fill:bo(i,""),stroke:xo(i,""),text:O0(i),image:I0(i)})}function bo(i,t){const e=i[t+"fill-color"];if(e)return e==="none"?null:new de({color:e})}function xo(i,t){const e=i[t+"stroke-width"],n=i[t+"stroke-color"];if(!(!e&&!n))return new Se({width:e,color:n,lineCap:i[t+"stroke-line-cap"],lineJoin:i[t+"stroke-line-join"],lineDash:i[t+"stroke-line-dash"],lineDashOffset:i[t+"stroke-line-dash-offset"],miterLimit:i[t+"stroke-miter-limit"]})}function O0(i){const t=i["text-value"];return t?new _o({text:t,font:i["text-font"],maxAngle:i["text-max-angle"],offsetX:i["text-offset-x"],offsetY:i["text-offset-y"],overflow:i["text-overflow"],placement:i["text-placement"],repeat:i["text-repeat"],scale:i["text-scale"],rotateWithView:i["text-rotate-with-view"],rotation:i["text-rotation"],textAlign:i["text-align"],justify:i["text-justify"],textBaseline:i["text-baseline"],padding:i["text-padding"],fill:bo(i,"text-"),backgroundFill:bo(i,"text-background-"),stroke:xo(i,"text-"),backgroundStroke:xo(i,"text-background-")}):void 0}function I0(i){const t=i["icon-src"],e=i["icon-img"];if(t||e)return new vs({src:t,img:e,imgSize:i["icon-img-size"],anchor:i["icon-anchor"],anchorOrigin:i["icon-anchor-origin"],anchorXUnits:i["icon-anchor-x-units"],anchorYUnits:i["icon-anchor-y-units"],color:i["icon-color"],crossOrigin:i["icon-cross-origin"],offset:i["icon-offset"],displacement:i["icon-displacement"],opacity:i["icon-opacity"],scale:i["icon-scale"],width:i["icon-width"],height:i["icon-height"],rotation:i["icon-rotation"],rotateWithView:i["icon-rotate-with-view"],size:i["icon-size"],declutterMode:i["icon-declutter-mode"]});const n=i["shape-points"];if(n){const o="shape-";return new mo({points:n,fill:bo(i,o),stroke:xo(i,o),radius:i["shape-radius"],radius1:i["shape-radius1"],radius2:i["shape-radius2"],angle:i["shape-angle"],displacement:i["shape-displacement"],rotation:i["shape-rotation"],rotateWithView:i["shape-rotate-with-view"],scale:i["shape-scale"],declutterMode:i["shape-declutter-mode"]})}const s=i["circle-radius"];if(s){const o="circle-";return new ii({radius:s,fill:bo(i,o),stroke:xo(i,o),displacement:i["circle-displacement"],scale:i["circle-scale"],rotation:i["circle-rotation"],rotateWithView:i["circle-rotate-with-view"],declutterMode:i["circle-declutter-mode"]})}}const gd={RENDER_ORDER:"renderOrder"};class pd extends yo{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter!==void 0?t.declutter:!1,this.renderBuffer_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(gd.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t){t.declutterTree||(t.declutterTree=new Kc(9)),this.getRenderer().renderDeclutter(t)}setRenderOrder(t){this.set(gd.RENDER_ORDER,t)}setStyle(t){let e;if(t===void 0)e=o0;else if(t===null)e=null;else if(typeof t=="function")e=t;else if(t instanceof Xt)e=t;else if(Array.isArray(t)){const n=t.length,s=new Array(n);for(let o=0;o<n;++o){const r=t[o];r instanceof Xt?s[o]=r:s[o]=fd(r)}e=s}else e=fd(t);this.style_=e,this.styleFunction_=t===null?void 0:s0(this.style_),this.changed()}}const st={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},Jr=[st.FILL],Qi=[st.STROKE],Un=[st.BEGIN_PATH],md=[st.CLOSE_PATH];class _d{drawCustom(t,e,n,s){}drawGeometry(t){}setStyle(t){}drawCircle(t,e){}drawFeature(t,e){}drawGeometryCollection(t,e){}drawLineString(t,e){}drawMultiLineString(t,e){}drawMultiPoint(t,e){}drawMultiPolygon(t,e){}drawPoint(t,e){}drawPolygon(t,e){}drawText(t,e){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}class So extends _d{constructor(t,e,n,s){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=s,this.maxLineWidth=0,this.resolution=n,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return e==1?t:t.map(function(n){return n*e})}appendFlatPointCoordinates(t,e){const n=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,o=this.coordinates;let r=o.length;for(let a=0,c=t.length;a<c;a+=e)s[0]=t[a],s[1]=t[a+1],so(n,s)&&(o[r++]=s[0],o[r++]=s[1]);return r}appendFlatLineCoordinates(t,e,n,s,o,r){const a=this.coordinates;let c=a.length;const h=this.getBufferedMaxExtent();r&&(e+=s);let l=t[e],u=t[e+1];const d=this.tmpCoordinate_;let g=!0,_,y,w;for(_=e+s;_<n;_+=s)d[0]=t[_],d[1]=t[_+1],w=yc(h,d),w!==y?(g&&(a[c++]=l,a[c++]=u,g=!1),a[c++]=d[0],a[c++]=d[1]):w===Zt.INTERSECTING?(a[c++]=d[0],a[c++]=d[1],g=!1):g=!0,l=d[0],u=d[1],y=w;return(o&&g||_===e+s)&&(a[c++]=l,a[c++]=u),c}drawCustomCoordinates_(t,e,n,s,o){for(let r=0,a=n.length;r<a;++r){const c=n[r],h=this.appendFlatLineCoordinates(t,e,c,s,!1,!1);o.push(h),e=c}return e}drawCustom(t,e,n,s){this.beginGeometry(t,e);const o=t.getType(),r=t.getStride(),a=this.coordinates.length;let c,h,l,u,d;switch(o){case"MultiPolygon":c=t.getOrientedFlatCoordinates(),u=[];const g=t.getEndss();d=0;for(let _=0,y=g.length;_<y;++_){const w=[];d=this.drawCustomCoordinates_(c,d,g[_],r,w),u.push(w)}this.instructions.push([st.CUSTOM,a,u,t,n,Lu]),this.hitDetectionInstructions.push([st.CUSTOM,a,u,t,s||n,Lu]);break;case"Polygon":case"MultiLineString":l=[],c=o=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(c,0,t.getEnds(),r,l),this.instructions.push([st.CUSTOM,a,l,t,n,ho]),this.hitDetectionInstructions.push([st.CUSTOM,a,l,t,s||n,ho]);break;case"LineString":case"Circle":c=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(c,0,c.length,r,!1,!1),this.instructions.push([st.CUSTOM,a,h,t,n,Ki]),this.hitDetectionInstructions.push([st.CUSTOM,a,h,t,s||n,Ki]);break;case"MultiPoint":c=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(c,r),h>a&&(this.instructions.push([st.CUSTOM,a,h,t,n,Ki]),this.hitDetectionInstructions.push([st.CUSTOM,a,h,t,s||n,Ki]));break;case"Point":c=t.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),h=this.coordinates.length,this.instructions.push([st.CUSTOM,a,h,t,n]),this.hitDetectionInstructions.push([st.CUSTOM,a,h,t,s||n]);break}this.endGeometry(e)}beginGeometry(t,e){this.beginGeometryInstruction1_=[st.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[st.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;t.reverse();let e;const n=t.length;let s,o,r=-1;for(e=0;e<n;++e)s=t[e],o=s[0],o==st.END_GEOMETRY?r=e:o==st.BEGIN_GEOMETRY&&(s[2]=e,Up(this.hitDetectionInstructions,r,e),r=-1)}setFillStrokeStyle(t,e){const n=this.state;if(t){const s=t.getColor();n.fillStyle=ei(s||ge)}else n.fillStyle=void 0;if(e){const s=e.getColor();n.strokeStyle=ei(s||fo);const o=e.getLineCap();n.lineCap=o!==void 0?o:Yr;const r=e.getLineDash();n.lineDash=r?r.slice():vi;const a=e.getLineDashOffset();n.lineDashOffset=a||Ei;const c=e.getLineJoin();n.lineJoin=c!==void 0?c:ms;const h=e.getWidth();n.lineWidth=h!==void 0?h:po;const l=e.getMiterLimit();n.miterLimit=l!==void 0?l:uo,n.lineWidth>this.maxLineWidth&&(this.maxLineWidth=n.lineWidth,this.bufferedMaxExtent_=null)}else n.strokeStyle=void 0,n.lineCap=void 0,n.lineDash=null,n.lineDashOffset=void 0,n.lineJoin=void 0,n.lineWidth=void 0,n.miterLimit=void 0}createFill(t){const e=t.fillStyle,n=[st.SET_FILL_STYLE,e];return typeof e!="string"&&n.push(!0),n}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[st.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const n=t.fillStyle;(typeof n!="string"||t.currentFillStyle!=n)&&(n!==void 0&&this.instructions.push(e.call(this,t)),t.currentFillStyle=n)}updateStrokeStyle(t,e){const n=t.strokeStyle,s=t.lineCap,o=t.lineDash,r=t.lineDashOffset,a=t.lineJoin,c=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=n||t.currentLineCap!=s||o!=t.currentLineDash&&!Bi(t.currentLineDash,o)||t.currentLineDashOffset!=r||t.currentLineJoin!=a||t.currentLineWidth!=c||t.currentMiterLimit!=h)&&(n!==void 0&&e.call(this,t),t.currentStrokeStyle=n,t.currentLineCap=s,t.currentLineDash=o,t.currentLineDashOffset=r,t.currentLineJoin=a,t.currentLineWidth=c,t.currentMiterLimit=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[st.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=cu(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;io(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class T0 extends So{constructor(t,e,n,s){super(t,e,n,s),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const n=t.getFlatCoordinates(),s=t.getStride(),o=this.coordinates.length,r=this.appendFlatPointCoordinates(n,s);this.instructions.push([st.DRAW_IMAGE,o,r,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([st.DRAW_IMAGE,o,r,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const n=t.getFlatCoordinates(),s=t.getStride(),o=this.coordinates.length,r=this.appendFlatPointCoordinates(n,s);this.instructions.push([st.DRAW_IMAGE,o,r,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([st.DRAW_IMAGE,o,r,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const n=t.getAnchor(),s=t.getSize(),o=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=s[1],this.opacity_=t.getOpacity(),this.originX_=o[0],this.originY_=o[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=s[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}class A0 extends So{constructor(t,e,n,s){super(t,e,n,s)}drawFlatCoordinates_(t,e,n,s){const o=this.coordinates.length,r=this.appendFlatLineCoordinates(t,e,n,s,!1,!1),a=[st.MOVE_TO_LINE_TO,o,r];return this.instructions.push(a),this.hitDetectionInstructions.push(a),n}drawLineString(t,e){const n=this.state,s=n.strokeStyle,o=n.lineWidth;if(s===void 0||o===void 0)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([st.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,vi,Ei],Un);const r=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(r,0,r.length,a),this.hitDetectionInstructions.push(Qi),this.endGeometry(e)}drawMultiLineString(t,e){const n=this.state,s=n.strokeStyle,o=n.lineWidth;if(s===void 0||o===void 0)return;this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([st.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,vi,Ei],Un);const r=t.getEnds(),a=t.getFlatCoordinates(),c=t.getStride();let h=0;for(let l=0,u=r.length;l<u;++l)h=this.drawFlatCoordinates_(a,h,r[l],c);this.hitDetectionInstructions.push(Qi),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Qi),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Qi),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(Un)}}class yd extends So{constructor(t,e,n,s){super(t,e,n,s)}drawFlatCoordinatess_(t,e,n,s){const o=this.state,r=o.fillStyle!==void 0,a=o.strokeStyle!==void 0,c=n.length;this.instructions.push(Un),this.hitDetectionInstructions.push(Un);for(let h=0;h<c;++h){const l=n[h],u=this.coordinates.length,d=this.appendFlatLineCoordinates(t,e,l,s,!0,!a),g=[st.MOVE_TO_LINE_TO,u,d];this.instructions.push(g),this.hitDetectionInstructions.push(g),a&&(this.instructions.push(md),this.hitDetectionInstructions.push(md)),e=l}return r&&(this.instructions.push(Jr),this.hitDetectionInstructions.push(Jr)),a&&(this.instructions.push(Qi),this.hitDetectionInstructions.push(Qi)),e}drawCircle(t,e){const n=this.state,s=n.fillStyle,o=n.strokeStyle;if(s===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),n.fillStyle!==void 0&&this.hitDetectionInstructions.push([st.SET_FILL_STYLE,ge]),n.strokeStyle!==void 0&&this.hitDetectionInstructions.push([st.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,vi,Ei]);const r=t.getFlatCoordinates(),a=t.getStride(),c=this.coordinates.length;this.appendFlatLineCoordinates(r,0,r.length,a,!1,!1);const h=[st.CIRCLE,c];this.instructions.push(Un,h),this.hitDetectionInstructions.push(Un,h),n.fillStyle!==void 0&&(this.instructions.push(Jr),this.hitDetectionInstructions.push(Jr)),n.strokeStyle!==void 0&&(this.instructions.push(Qi),this.hitDetectionInstructions.push(Qi)),this.endGeometry(e)}drawPolygon(t,e){const n=this.state,s=n.fillStyle,o=n.strokeStyle;if(s===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),n.fillStyle!==void 0&&this.hitDetectionInstructions.push([st.SET_FILL_STYLE,ge]),n.strokeStyle!==void 0&&this.hitDetectionInstructions.push([st.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,vi,Ei]);const r=t.getEnds(),a=t.getOrientedFlatCoordinates(),c=t.getStride();this.drawFlatCoordinatess_(a,0,r,c),this.endGeometry(e)}drawMultiPolygon(t,e){const n=this.state,s=n.fillStyle,o=n.strokeStyle;if(s===void 0&&o===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),n.fillStyle!==void 0&&this.hitDetectionInstructions.push([st.SET_FILL_STYLE,ge]),n.strokeStyle!==void 0&&this.hitDetectionInstructions.push([st.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,vi,Ei]);const r=t.getEndss(),a=t.getOrientedFlatCoordinates(),c=t.getStride();let h=0;for(let l=0,u=r.length;l<u;++l)h=this.drawFlatCoordinatess_(a,h,r[l],c);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(t!==0){const e=this.coordinates;for(let n=0,s=e.length;n<s;++n)e[n]=Ln(e[n],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;t.fillStyle!==void 0&&this.updateFillStyle(t,this.createFill),t.strokeStyle!==void 0&&this.updateStrokeStyle(t,this.applyStroke)}}function M0(i,t,e,n,s){const o=[];let r=e,a=0,c=t.slice(e,2);for(;a<i&&r+s<n;){const[h,l]=c.slice(-2),u=t[r+s],d=t[r+s+1],g=Math.sqrt((u-h)*(u-h)+(d-l)*(d-l));if(a+=g,a>=i){const _=(i-a+g)/g,y=xe(h,u,_),w=xe(l,d,_);c.push(y,w),o.push(c),c=[y,w],a==i&&(r+=s),a=0}else if(a<i)c.push(t[r+s],t[r+s+1]),r+=s;else{const _=g-a,y=xe(h,u,_/g),w=xe(l,d,_/g);c.push(y,w),o.push(c),c=[y,w],a=0,r+=s}}return a>0&&o.push(c),o}function D0(i,t,e,n,s){let o=e,r=e,a=0,c=0,h=e,l,u,d,g,_,y,w,E,b,P;for(u=e;u<n;u+=s){const I=t[u],M=t[u+1];_!==void 0&&(b=I-_,P=M-y,g=Math.sqrt(b*b+P*P),w!==void 0&&(c+=d,l=Math.acos((w*b+E*P)/(d*g)),l>i&&(c>a&&(a=c,o=h,r=u),c=0,h=u-s)),d=g,w=b,E=P),_=I,y=M}return c+=g,c>a?[h,u]:[o,r]}const ta={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class F0 extends So{constructor(t,e,n,s){super(t,e,n,s),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[ge]={fillStyle:ge},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e){const n=this.textFillState_,s=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!n&&!s)return;const r=this.coordinates;let a=r.length;const c=t.getType();let h=null,l=t.getStride();if(o.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){if(!te(this.getBufferedMaxExtent(),t.getExtent()))return;let u;if(h=t.getFlatCoordinates(),c=="LineString")u=[h.length];else if(c=="MultiLineString")u=t.getEnds();else if(c=="Polygon")u=t.getEnds().slice(0,1);else if(c=="MultiPolygon"){const y=t.getEndss();u=[];for(let w=0,E=y.length;w<E;++w)u.push(y[w][0])}this.beginGeometry(t,e);const d=o.repeat,g=d?void 0:o.textAlign;let _=0;for(let y=0,w=u.length;y<w;++y){let E;d?E=M0(d*this.resolution,h,_,u[y],l):E=[h.slice(_,u[y])];for(let b=0,P=E.length;b<P;++b){const I=E[b];let M=0,D=I.length;if(g==null){const z=D0(o.maxAngle,I,0,I.length,2);M=z[0],D=z[1]}for(let z=M;z<D;z+=l)r.push(I[z],I[z+1]);const L=r.length;_=u[y],this.drawChars_(a,L),a=L}}this.endGeometry(e)}else{let u=o.overflow?null:[];switch(c){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),l=2;break;case"Polygon":h=t.getFlatInteriorPoint(),o.overflow||u.push(h[2]/this.resolution),l=3;break;case"MultiPolygon":const E=t.getFlatInteriorPoints();h=[];for(let b=0,P=E.length;b<P;b+=3)o.overflow||u.push(E[b+2]/this.resolution),h.push(E[b],E[b+1]);if(h.length===0)return;l=2;break}const d=this.appendFlatPointCoordinates(h,l);if(d===a)return;if(u&&(d-a)/2!==h.length/l){let E=a/2;u=u.filter((b,P)=>{const I=r[(E+P)*2]===h[P*l]&&r[(E+P)*2+1]===h[P*l+1];return I||--E,I})}this.saveTextStates_(),(o.backgroundFill||o.backgroundStroke)&&(this.setFillStrokeStyle(o.backgroundFill,o.backgroundStroke),o.backgroundFill&&this.updateFillStyle(this.state,this.createFill),o.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e);let g=o.padding;if(g!=Nn&&(o.scale[0]<0||o.scale[1]<0)){let E=o.padding[0],b=o.padding[1],P=o.padding[2],I=o.padding[3];o.scale[0]<0&&(b=-b,I=-I),o.scale[1]<0&&(E=-E,P=-P),g=[E,b,P,I]}const _=this.pixelRatio;this.instructions.push([st.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,g==Nn?Nn:g.map(function(E){return E*_}),!!o.backgroundFill,!!o.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]);const y=1/_,w=this.state.fillStyle;o.backgroundFill&&(this.state.fillStyle=ge,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([st.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[y,y],NaN,void 0,this.declutterImageWithText_,g,!!o.backgroundFill,!!o.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?ge:this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]),o.backgroundFill&&(this.state.fillStyle=w,this.hitDetectionInstructions.push(this.createFill(this.state))),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,n=this.textFillState_,s=this.strokeKey_;t&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const o=this.textKey_;o in this.textStates||(this.textStates[o]={font:e.font,textAlign:e.textAlign||go,justify:e.justify,textBaseline:e.textBaseline||Hr,scale:e.scale});const r=this.fillKey_;n&&(r in this.fillStates||(this.fillStates[r]={fillStyle:n.fillStyle}))}drawChars_(t,e){const n=this.textStrokeState_,s=this.textState_,o=this.strokeKey_,r=this.textKey_,a=this.fillKey_;this.saveTextStates_();const c=this.pixelRatio,h=ta[s.textBaseline],l=this.textOffsetY_*c,u=this.text_,d=n?n.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([st.DRAW_CHARS,t,e,h,s.overflow,a,s.maxAngle,c,l,o,d*c,u,r,1]),this.hitDetectionInstructions.push([st.DRAW_CHARS,t,e,h,s.overflow,a&&ge,s.maxAngle,1,l,o,d,u,r,1/c])}setTextStyle(t,e){let n,s,o;if(!t)this.text_="";else{const r=t.getFill();r?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=ei(r.getColor()||ge)):(s=null,this.textFillState_=s);const a=t.getStroke();if(!a)o=null,this.textStrokeState_=o;else{o=this.textStrokeState_,o||(o={},this.textStrokeState_=o);const _=a.getLineDash(),y=a.getLineDashOffset(),w=a.getWidth(),E=a.getMiterLimit();o.lineCap=a.getLineCap()||Yr,o.lineDash=_?_.slice():vi,o.lineDashOffset=y===void 0?Ei:y,o.lineJoin=a.getLineJoin()||ms,o.lineWidth=w===void 0?po:w,o.miterLimit=E===void 0?uo:E,o.strokeStyle=ei(a.getColor()||fo)}n=this.textState_;const c=t.getFont()||ed;Jm(c);const h=t.getScaleArray();n.overflow=t.getOverflow(),n.font=c,n.maxAngle=t.getMaxAngle(),n.placement=t.getPlacement(),n.textAlign=t.getTextAlign(),n.repeat=t.getRepeat(),n.justify=t.getJustify(),n.textBaseline=t.getTextBaseline()||Hr,n.backgroundFill=t.getBackgroundFill(),n.backgroundStroke=t.getBackgroundStroke(),n.padding=t.getPadding()||Nn,n.scale=h===void 0?[1,1]:h;const l=t.getOffsetX(),u=t.getOffsetY(),d=t.getRotateWithView(),g=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=l===void 0?0:l,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textRotation_=g===void 0?0:g,this.strokeKey_=o?(typeof o.strokeStyle=="string"?o.strokeStyle:St(o.strokeStyle))+o.lineCap+o.lineDashOffset+"|"+o.lineWidth+o.lineJoin+o.miterLimit+"["+o.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=s?typeof s.fillStyle=="string"?s.fillStyle:"|"+St(s.fillStyle):""}this.declutterImageWithText_=e}}const L0={Circle:yd,Default:So,Image:T0,LineString:A0,Polygon:yd,Text:F0};class wd{constructor(t,e,n,s){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=s,this.resolution_=n,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const n=this.buildersByZIndex_[e];for(const s in n){const o=n[s].finish();t[e][s]=o}}return t}getBuilder(t,e){const n=t!==void 0?t.toString():"0";let s=this.buildersByZIndex_[n];s===void 0&&(s={},this.buildersByZIndex_[n]=s);let o=s[e];if(o===void 0){const r=L0[e];o=new r(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=o}return o}}class z0 extends eo{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return vt()}getData(t){return null}prepareFrame(t){return vt()}renderFrame(t,e){return vt()}loadedTileCallback(t,e,n){t[e]||(t[e]={}),t[e][n.tileCoord.toString()]=n}createLoadedTileFinder(t,e,n){return(s,o)=>{const r=this.loadedTileCallback.bind(this,n,s);return t.forEachLoadedTile(e,s,o,r)}}forEachFeatureAtCoordinate(t,e,n,s,o){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===ot.LOADED||e.getState()===ot.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=ot.LOADED&&e!=ot.ERROR&&t.addEventListener(ht.CHANGE,this.boundHandleImageChange_),e==ot.IDLE&&(t.load(),e=t.getState()),e==ot.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}class vd extends We{constructor(t,e,n,s){super(t),this.inversePixelTransform=e,this.frameState=n,this.context=s}}const Ed=[];let Es=null;function N0(){Es=Bt(1,1,void 0,{willReadFrequently:!0})}class ih extends z0{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=be(),this.pixelTransform=be(),this.inversePixelTransform=be(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,n){Es||N0(),Es.clearRect(0,0,1,1);let s;try{Es.drawImage(t,e,n,1,1,0,0,1,1),s=Es.getImageData(0,0,1,1).data}catch{return Es=null,null}return s}getBackground(t){let n=this.getLayer().getBackground();return typeof n=="function"&&(n=n(t.viewState.resolution)),n||void 0}useContainer(t,e,n){const s=this.getLayer().getClassName();let o,r;if(t&&t.className===s&&(!n||t&&t.style.backgroundColor&&Bi(qr(t.style.backgroundColor),qr(n)))){const a=t.firstElementChild;a instanceof HTMLCanvasElement&&(r=a.getContext("2d"))}if(r&&r.canvas.style.transform===e?(this.container=t,this.context=r,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){o=document.createElement("div"),o.className=s;let a=o.style;a.position="absolute",a.width="100%",a.height="100%",r=Bt();const c=r.canvas;o.appendChild(c),a=c.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=o,this.context=r}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(t,e,n){const s=Ae(n),o=Mr(n),r=Ar(n),a=Tr(n);Ut(e.coordinateToPixelTransform,s),Ut(e.coordinateToPixelTransform,o),Ut(e.coordinateToPixelTransform,r),Ut(e.coordinateToPixelTransform,a);const c=this.inversePixelTransform;Ut(c,s),Ut(c,o),Ut(c,r),Ut(c,a),t.save(),t.beginPath(),t.moveTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}dispatchRenderEvent_(t,e,n){const s=this.getLayer();if(s.hasListener(t)){const o=new vd(t,this.inversePixelTransform,n,e);s.dispatchEvent(o)}}preRender(t,e){this.frameState=e,this.dispatchRenderEvent_(ti.PRERENDER,t,e)}postRender(t,e){this.dispatchRenderEvent_(ti.POSTRENDER,t,e)}getRenderTransform(t,e,n,s,o,r,a){const c=o/2,h=r/2,l=s/e,u=-l,d=-t[0]+a,g=-t[1];return qe(this.tempTransform,c,h,l,u,-n,d,g)}disposeInternal(){delete this.frameState,super.disposeInternal()}}function U0(i,t,e,n,s,o,r,a,c,h,l,u){let d=i[t],g=i[t+1],_=0,y=0,w=0,E=0;function b(){_=d,y=g,t+=n,d=i[t],g=i[t+1],E+=w,w=Math.sqrt((d-_)*(d-_)+(g-y)*(g-y))}do b();while(t<e-n&&E+w<o);let P=w===0?0:(o-E)/w;const I=xe(_,d,P),M=xe(y,g,P),D=t-n,L=E,z=o+a*c(h,s,l);for(;t<e-n&&E+w<z;)b();P=w===0?0:(z-E)/w;const q=xe(_,d,P),Y=xe(y,g,P);let X;if(u){const A=[I,M,q,Y];Ou(A,0,4,2,u,A,A),X=A[0]>A[2]}else X=I>q;const Q=Math.PI,m=[],v=D+n===t;t=D,w=0,E=L,d=i[t],g=i[t+1];let S;if(v){b(),S=Math.atan2(g-y,d-_),X&&(S+=S>0?-Q:Q);const A=(q+I)/2,F=(Y+M)/2;return m[0]=[A,F,(z-o)/2,S,s],m}s=s.replace(/\n/g," ");for(let A=0,F=s.length;A<F;){b();let N=Math.atan2(g-y,d-_);if(X&&(N+=N>0?-Q:Q),S!==void 0){let et=N-S;if(et+=et>Q?-2*Q:et<-Q?2*Q:0,Math.abs(et)>r)return null}S=N;const G=A;let B=0;for(;A<F;++A){const et=X?F-A-1:A,it=a*c(h,s[et],l);if(t+n<e&&E+w<o+B+it/2)break;B+=it}if(A===G)continue;const Z=X?s.substring(F-G,F-A):s.substring(G,A);P=w===0?0:(o+B/2-E)/w;const V=xe(_,d,P),at=xe(y,g,P);m.push([V,at,B/2,N,Z]),o+=B}return m}const Cs=Te(),Ji=[],bi=[],xi=[],tn=[];function Cd(i){return i[3].declutterBox}const bd=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ--]");function nh(i,t){return t==="start"?t=bd.test(i)?"right":"left":t==="end"&&(t=bd.test(i)?"left":"right"),ta[t]}function j0(i,t,e){return e>0&&i.push(`
|
|
27
27
|
`,""),i.push(t,""),i}class k0{constructor(t,e,n,s){this.overlaps=n,this.pixelRatio=e,this.resolution=t,this.alignFill_,this.instructions=s.instructions,this.coordinates=s.coordinates,this.coordinateCache_={},this.renderedTransform_=be(),this.hitDetectionInstructions=s.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=s.fillStates||{},this.strokeStates=s.strokeStates||{},this.textStates=s.textStates||{},this.widths_={},this.labels_={}}createLabel(t,e,n,s){const o=t+e+n+s;if(this.labels_[o])return this.labels_[o];const r=s?this.strokeStates[s]:null,a=n?this.fillStates[n]:null,c=this.textStates[e],h=this.pixelRatio,l=[c.scale[0]*h,c.scale[1]*h],u=Array.isArray(t),d=c.justify?ta[c.justify]:nh(Array.isArray(t)?t[0]:t,c.textAlign||go),g=s&&r.lineWidth?r.lineWidth:0,_=u?t:t.split(`
|
|
28
28
|
`).reduce(j0,[]),{width:y,height:w,widths:E,heights:b,lineWidths:P}=e0(c,_),I=y+g,M=[],D=(I+2)*l[0],L=(w+g)*l[1],z={width:D<0?Math.floor(D):Math.ceil(D),height:L<0?Math.floor(L):Math.ceil(L),contextInstructions:M};(l[0]!=1||l[1]!=1)&&M.push("scale",l),s&&(M.push("strokeStyle",r.strokeStyle),M.push("lineWidth",g),M.push("lineCap",r.lineCap),M.push("lineJoin",r.lineJoin),M.push("miterLimit",r.miterLimit),M.push("setLineDash",[r.lineDash]),M.push("lineDashOffset",r.lineDashOffset)),n&&M.push("fillStyle",a.fillStyle),M.push("textBaseline","middle"),M.push("textAlign","center");const q=.5-d;let Y=d*I+q*g;const X=[],Q=[];let m=0,v=0,S=0,A=0,F;for(let N=0,G=_.length;N<G;N+=2){const B=_[N];if(B===`
|
|
29
|
-
`){v+=m,m=0,Y=d*I+q*g,++A;continue}const Z=_[N+1]||c.font;Z!==F&&(s&&X.push("font",Z),n&&Q.push("font",Z),F=Z),m=Math.max(m,b[S]);const V=[B,Y+q*E[S]+d*(E[S]-P[A]),.5*(g+m)+v];Y+=E[S],s&&X.push("strokeText",V),n&&Q.push("fillText",V),++S}return Array.prototype.push.apply(M,X),Array.prototype.push.apply(M,Q),this.labels_[o]=z,z}replayTextBackground_(t,e,n,s,o,r,a){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,n),t.lineTo.apply(t,s),t.lineTo.apply(t,o),t.lineTo.apply(t,e),r&&(this.alignFill_=r[2],this.fill_(t)),a&&(this.setStrokeStyle_(t,a),t.stroke())}calculateImageOrLabelDimensions_(t,e,n,s,o,r,a,c,h,l,u,d,g,_,y,w){a*=d[0],c*=d[1];let E=n-a,b=s-c;const P=o+h>t?t-h:o,I=r+l>e?e-l:r,M=_[3]+P*d[0]+_[1],D=_[0]+I*d[1]+_[2],L=E-_[3],z=b-_[0];(y||u!==0)&&(Ji[0]=L,tn[0]=L,Ji[1]=z,bi[1]=z,bi[0]=L+M,xi[0]=bi[0],xi[1]=z+D,tn[1]=xi[1]);let q;return u!==0?(q=qe(be(),n,s,1,1,u,-n,-s),Ut(q,Ji),Ut(q,bi),Ut(q,xi),Ut(q,tn),pi(Math.min(Ji[0],bi[0],xi[0],tn[0]),Math.min(Ji[1],bi[1],xi[1],tn[1]),Math.max(Ji[0],bi[0],xi[0],tn[0]),Math.max(Ji[1],bi[1],xi[1],tn[1]),Cs)):pi(Math.min(L,L+M),Math.min(z,z+D),Math.max(L,L+M),Math.max(z,z+D),Cs),g&&(E=Math.round(E),b=Math.round(b)),{drawImageX:E,drawImageY:b,drawImageW:P,drawImageH:I,originX:h,originY:l,declutterBox:{minX:Cs[0],minY:Cs[1],maxX:Cs[2],maxY:Cs[3],value:w},canvasTransform:q,scale:d}}replayImageOrLabel_(t,e,n,s,o,r,a){const c=!!(r||a),h=s.declutterBox,l=t.canvas,u=a?a[2]*s.scale[0]/2:0;return h.minX-u<=l.width/e&&h.maxX+u>=0&&h.minY-u<=l.height/e&&h.maxY+u>=0&&(c&&this.replayTextBackground_(t,Ji,bi,xi,tn,r,a),i0(t,s.canvasTransform,o,n,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(t){if(this.alignFill_){const e=Ut(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(e[0]%n,e[1]%n),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6])}drawLabelWithPointPlacement_(t,e,n,s){const o=this.textStates[e],r=this.createLabel(t,e,s,n),a=this.strokeStates[n],c=this.pixelRatio,h=nh(Array.isArray(t)?t[0]:t,o.textAlign||go),l=ta[o.textBaseline||Hr],u=a&&a.lineWidth?a.lineWidth:0,d=r.width/c-2*o.scale[0],g=h*d+2*(.5-h)*u,_=l*r.height/c+2*(.5-l)*u;return{label:r,anchorX:g,anchorY:_}}execute_(t,e,n,s,o,r,a,c){let h;this.pixelCoordinates_&&Bi(n,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=yi(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),$p(this.renderedTransform_,n));let l=0;const u=s.length;let d=0,g,_,y,w,E,b,P,I,M,D,L,z,q=0,Y=0,X=null,Q=null;const m=this.coordinateCache_,v=this.viewRotation_,S=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,A={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:v},F=this.instructions!=s||this.overlaps?0:200;let N,G,B,Z;for(;l<u;){const V=s[l];switch(V[0]){case st.BEGIN_GEOMETRY:N=V[1],Z=V[3],N.getGeometry()?a!==void 0&&!te(a,Z.getExtent())?l=V[2]+1:++l:l=V[2];break;case st.BEGIN_PATH:q>F&&(this.fill_(t),q=0),Y>F&&(t.stroke(),Y=0),!q&&!Y&&(t.beginPath(),w=NaN,E=NaN),++l;break;case st.CIRCLE:d=V[1];const et=h[d],it=h[d+1],gt=h[d+2],wt=h[d+3],dt=gt-et,Et=wt-it,ft=Math.sqrt(dt*dt+Et*Et);t.moveTo(et+ft,it),t.arc(et,it,ft,0,2*Math.PI,!0),++l;break;case st.CLOSE_PATH:t.closePath(),++l;break;case st.CUSTOM:d=V[1],g=V[2];const xt=V[3],Ft=V[4],kt=V.length==6?V[5]:void 0;A.geometry=xt,A.feature=N,l in m||(m[l]=[]);const Wt=m[l];kt?kt(h,d,g,2,Wt):(Wt[0]=h[d],Wt[1]=h[d+1],Wt.length=2),Ft(Wt,A),++l;break;case st.DRAW_IMAGE:d=V[1],g=V[2],I=V[3],_=V[4],y=V[5];let he=V[6];const ye=V[7],ns=V[8],we=V[9],En=V[10];let Cn=V[11];const bn=V[12];let ae=V[13];const ve=V[14],Oe=V[15];if(!I&&V.length>=20){M=V[19],D=V[20],L=V[21],z=V[22];const $t=this.drawLabelWithPointPlacement_(M,D,L,z);I=$t.label,V[3]=I;const Zs=V[23];_=($t.anchorX-Zs)*this.pixelRatio,V[4]=_;const je=V[24];y=($t.anchorY-je)*this.pixelRatio,V[5]=y,he=I.height,V[6]=he,ae=I.width,V[13]=ae}let Ne;V.length>25&&(Ne=V[25]);let ki,fi,Rt;V.length>17?(ki=V[16],fi=V[17],Rt=V[18]):(ki=Nn,fi=!1,Rt=!1),En&&S?Cn+=v:!En&&!S&&(Cn-=v);let Ee=0;for(;d<g;d+=2){if(Ne&&Ne[Ee++]<ae/this.pixelRatio)continue;const $t=this.calculateImageOrLabelDimensions_(I.width,I.height,h[d],h[d+1],ae,he,_,y,ns,we,Cn,bn,o,ki,fi||Rt,N),Zs=[t,e,I,$t,ye,fi?X:null,Rt?Q:null];if(c){if(ve==="none")continue;if(ve==="obstacle"){c.insert($t.declutterBox);continue}else{let je,qi;if(Oe){const Ie=g-d;if(!Oe[Ie]){Oe[Ie]=Zs;continue}if(je=Oe[Ie],delete Oe[Ie],qi=Cd(je),c.collides(qi))continue}if(c.collides($t.declutterBox))continue;je&&(c.insert(qi),this.replayImageOrLabel_.apply(this,je)),c.insert($t.declutterBox)}}this.replayImageOrLabel_.apply(this,Zs)}++l;break;case st.DRAW_CHARS:const Ze=V[1],At=V[2],Ue=V[3],lc=V[4];z=V[5];const uc=V[6],Er=V[7],Wi=V[8];L=V[9];const Cr=V[10];M=V[11],D=V[12];const dc=[V[13],V[13]],br=this.textStates[D],ss=br.font,os=[br.scale[0]*Er,br.scale[1]*Er];let rs;ss in this.widths_?rs=this.widths_[ss]:(rs={},this.widths_[ss]=rs);const xn=Bu(h,Ze,At,2),Sn=Math.abs(os[0])*nd(ss,M,rs);if(lc||Sn<=xn){const $t=this.textStates[D].textAlign,Zs=(xn-Sn)*nh(M,$t),je=U0(h,Ze,At,2,M,Zs,uc,Math.abs(os[0]),nd,ss,rs,S?0:this.viewRotation_);t:if(je){const qi=[];let Ie,fc,gc,Ce,ke;if(L)for(Ie=0,fc=je.length;Ie<fc;++Ie){ke=je[Ie],gc=ke[4],Ce=this.createLabel(gc,D,"",L),_=ke[2]+(os[0]<0?-Cr:Cr),y=Ue*Ce.height+(.5-Ue)*2*Cr*os[1]/os[0]-Wi;const Gi=this.calculateImageOrLabelDimensions_(Ce.width,Ce.height,ke[0],ke[1],Ce.width,Ce.height,_,y,0,0,ke[3],dc,!1,Nn,!1,N);if(c&&c.collides(Gi.declutterBox))break t;qi.push([t,e,Ce,Gi,1,null,null])}if(z)for(Ie=0,fc=je.length;Ie<fc;++Ie){ke=je[Ie],gc=ke[4],Ce=this.createLabel(gc,D,z,""),_=ke[2],y=Ue*Ce.height-Wi;const Gi=this.calculateImageOrLabelDimensions_(Ce.width,Ce.height,ke[0],ke[1],Ce.width,Ce.height,_,y,0,0,ke[3],dc,!1,Nn,!1,N);if(c&&c.collides(Gi.declutterBox))break t;qi.push([t,e,Ce,Gi,1,null,null])}c&&c.load(qi.map(Cd));for(let Gi=0,pE=qi.length;Gi<pE;++Gi)this.replayImageOrLabel_.apply(this,qi[Gi])}}++l;break;case st.END_GEOMETRY:if(r!==void 0){N=V[1];const $t=r(N,Z);if($t)return $t}++l;break;case st.FILL:F?q++:this.fill_(t),++l;break;case st.MOVE_TO_LINE_TO:for(d=V[1],g=V[2],G=h[d],B=h[d+1],b=G+.5|0,P=B+.5|0,(b!==w||P!==E)&&(t.moveTo(G,B),w=b,E=P),d+=2;d<g;d+=2)G=h[d],B=h[d+1],b=G+.5|0,P=B+.5|0,(d==g-2||b!==w||P!==E)&&(t.lineTo(G,B),w=b,E=P);++l;break;case st.SET_FILL_STYLE:X=V,this.alignFill_=V[2],q&&(this.fill_(t),q=0,Y&&(t.stroke(),Y=0)),t.fillStyle=V[1],++l;break;case st.SET_STROKE_STYLE:Q=V,Y&&(t.stroke(),Y=0),this.setStrokeStyle_(t,V),++l;break;case st.STROKE:F?Y++:t.stroke(),++l;break;default:++l;break}}q&&this.fill_(t),Y&&t.stroke()}execute(t,e,n,s,o,r){this.viewRotation_=s,this.execute_(t,e,n,this.instructions,o,void 0,void 0,r)}executeHitDetection(t,e,n,s,o){return this.viewRotation_=n,this.execute_(t,1,e,this.hitDetectionInstructions,!0,s,o)}}const sh=["Polygon","Circle","LineString","Image","Text","Default"];class xd{constructor(t,e,n,s,o,r){this.maxExtent_=t,this.overlaps_=s,this.pixelRatio_=n,this.resolution_=e,this.renderBuffer_=r,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=be(),this.createExecutors_(o)}clip(t,e){const n=this.getClipCoords(e);t.beginPath(),t.moveTo(n[0],n[1]),t.lineTo(n[2],n[3]),t.lineTo(n[4],n[5]),t.lineTo(n[6],n[7]),t.clip()}createExecutors_(t){for(const e in t){let n=this.executorsByZIndex_[e];n===void 0&&(n={},this.executorsByZIndex_[e]=n);const s=t[e];for(const o in s){const r=s[o];n[o]=new k0(this.resolution_,this.pixelRatio_,this.overlaps_,r)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const n=this.executorsByZIndex_[e];for(let s=0,o=t.length;s<o;++s)if(t[s]in n)return!0}return!1}forEachFeatureAtCoordinate(t,e,n,s,o,r){s=Math.round(s);const a=s*2+1,c=qe(this.hitDetectionTransform_,s+.5,s+.5,1/e,-1/e,-n,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=Bt(a,a,void 0,{willReadFrequently:!0}));const l=this.hitDetectionContext_;l.canvas.width!==a||l.canvas.height!==a?(l.canvas.width=a,l.canvas.height=a):h||l.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=Te(),ro(u,t),io(u,e*(this.renderBuffer_+s),u));const d=W0(s);let g;function _(M,D){const L=l.getImageData(0,0,a,a).data;for(let z=0,q=d.length;z<q;z++)if(L[d[z]]>0){if(!r||g!=="Image"&&g!=="Text"||r.includes(M)){const Y=(d[z]-3)/4,X=s-Y%a,Q=s-(Y/a|0),m=o(M,D,X*X+Q*Q);if(m)return m}l.clearRect(0,0,a,a);break}}const y=Object.keys(this.executorsByZIndex_).map(Number);y.sort(On);let w,E,b,P,I;for(w=y.length-1;w>=0;--w){const M=y[w].toString();for(b=this.executorsByZIndex_[M],E=sh.length-1;E>=0;--E)if(g=sh[E],P=b[g],P!==void 0&&(I=P.executeHitDetection(l,c,n,_,u),I))return I}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const n=e[0],s=e[1],o=e[2],r=e[3],a=[n,s,n,r,o,r,o,s];return yi(a,0,8,2,t,a),a}isEmpty(){return Js(this.executorsByZIndex_)}execute(t,e,n,s,o,r,a){const c=Object.keys(this.executorsByZIndex_).map(Number);c.sort(On),this.maxExtent_&&(t.save(),this.clip(t,n)),r=r||sh;let h,l,u,d,g,_;for(a&&c.reverse(),h=0,l=c.length;h<l;++h){const y=c[h].toString();for(g=this.executorsByZIndex_[y],u=0,d=r.length;u<d;++u){const w=r[u];_=g[w],_!==void 0&&_.execute(t,e,n,s,o,a)}}this.maxExtent_&&t.restore()}}const oh={};function W0(i){if(oh[i]!==void 0)return oh[i];const t=i*2+1,e=i*i,n=new Array(e+1);for(let o=0;o<=i;++o)for(let r=0;r<=i;++r){const a=o*o+r*r;if(a>e)break;let c=n[a];c||(c=[],n[a]=c),c.push(((i+o)*t+(i+r))*4+3),o>0&&c.push(((i-o)*t+(i+r))*4+3),r>0&&(c.push(((i+o)*t+(i-r))*4+3),o>0&&c.push(((i-o)*t+(i-r))*4+3))}const s=[];for(let o=0,r=n.length;o<r;++o)n[o]&&s.push(...n[o]);return oh[i]=s,s}class Sd extends _d{constructor(t,e,n,s,o,r,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=n,this.transform_=s,this.transformRotation_=s?Sc(Math.atan2(s[1],s[0]),10):0,this.viewRotation_=o,this.squaredTolerance_=r,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=be()}drawImages_(t,e,n,s){if(!this.image_)return;const o=yi(t,e,n,s,this.transform_,this.pixelCoordinates_),r=this.context_,a=this.tmpLocalTransform_,c=r.globalAlpha;this.imageOpacity_!=1&&(r.globalAlpha=c*this.imageOpacity_);let h=this.imageRotation_;this.transformRotation_===0&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let l=0,u=o.length;l<u;l+=2){const d=o[l]-this.imageAnchorX_,g=o[l+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const _=d+this.imageAnchorX_,y=g+this.imageAnchorY_;qe(a,_,y,1,1,h,-_,-y),r.setTransform.apply(r,a),r.translate(_,y),r.scale(this.imageScale_[0],this.imageScale_[1]),r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),r.setTransform(1,0,0,1,0,0)}else r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,g,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(r.globalAlpha=c)}drawText_(t,e,n,s){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const o=yi(t,e,n,s,this.transform_,this.pixelCoordinates_),r=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);e<n;e+=s){const c=o[e]+this.textOffsetX_,h=o[e+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(r.translate(c-this.textOffsetX_,h-this.textOffsetY_),r.rotate(a),r.translate(this.textOffsetX_,this.textOffsetY_),r.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&r.strokeText(this.text_,0,0),this.textFillState_&&r.fillText(this.text_,0,0),r.setTransform(1,0,0,1,0,0)):(this.textStrokeState_&&r.strokeText(this.text_,c,h),this.textFillState_&&r.fillText(this.text_,c,h))}}moveToLineTo_(t,e,n,s,o){const r=this.context_,a=yi(t,e,n,s,this.transform_,this.pixelCoordinates_);r.moveTo(a[0],a[1]);let c=a.length;o&&(c-=2);for(let h=2;h<c;h+=2)r.lineTo(a[h],a[h+1]);return o&&r.closePath(),n}drawRings_(t,e,n,s){for(let o=0,r=n.length;o<r;++o)e=this.moveToLineTo_(t,e,n[o],s,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!te(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=Am(t,this.transform_,this.pixelCoordinates_),n=e[2]-e[0],s=e[3]-e[1],o=Math.sqrt(n*n+s*s),r=this.context_;r.beginPath(),r.arc(e[0],e[1],o,0,2*Math.PI),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}this.text_!==""&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t);break}}drawFeature(t,e){const n=e.getGeometryFunction()(t);n&&(this.setStyle(e),this.drawGeometry(n))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let n=0,s=e.length;n<s;++n)this.drawGeometry(e[n])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),n=t.getStride();this.image_&&this.drawImages_(e,0,e.length,n),this.text_!==""&&this.drawText_(e,0,e.length,n)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),n=t.getStride();this.image_&&this.drawImages_(e,0,e.length,n),this.text_!==""&&this.drawText_(e,0,e.length,n)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!te(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,n=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(n,0,n.length,t.getStride(),!1),e.stroke()}if(this.text_!==""){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(te(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const n=this.context_,s=t.getFlatCoordinates();let o=0;const r=t.getEnds(),a=t.getStride();n.beginPath();for(let c=0,h=r.length;c<h;++c)o=this.moveToLineTo_(s,o,r[c],a,!1);n.stroke()}if(this.text_!==""){const n=t.getFlatMidpoints();this.drawText_(n,0,n.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!te(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!te(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,n=t.getOrientedFlatCoordinates();let s=0;const o=t.getEndss(),r=t.getStride();e.beginPath();for(let a=0,c=o.length;a<c;++a){const h=o[a];s=this.drawRings_(n,s,h,r)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,n=this.contextFillState_;n?n.fillStyle!=t.fillStyle&&(n.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=t.lineCap&&(n.lineCap=t.lineCap,e.lineCap=t.lineCap),Bi(n.lineDash,t.lineDash)||e.setLineDash(n.lineDash=t.lineDash),n.lineDashOffset!=t.lineDashOffset&&(n.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),n.lineJoin!=t.lineJoin&&(n.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),n.lineWidth!=t.lineWidth&&(n.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),n.miterLimit!=t.miterLimit&&(n.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),n.strokeStyle!=t.strokeStyle&&(n.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,n=this.contextTextState_,s=t.textAlign?t.textAlign:go;n?(n.font!=t.font&&(n.font=t.font,e.font=t.font),n.textAlign!=s&&(n.textAlign=s,e.textAlign=s),n.textBaseline!=t.textBaseline&&(n.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=s,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:s,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(!t)this.fillState_=null;else{const n=t.getColor();this.fillState_={fillStyle:ei(n||ge)}}if(!e)this.strokeState_=null;else{const n=e.getColor(),s=e.getLineCap(),o=e.getLineDash(),r=e.getLineDashOffset(),a=e.getLineJoin(),c=e.getWidth(),h=e.getMiterLimit(),l=o||vi;this.strokeState_={lineCap:s!==void 0?s:Yr,lineDash:this.pixelRatio_===1?l:l.map(u=>u*this.pixelRatio_),lineDashOffset:(r||Ei)*this.pixelRatio_,lineJoin:a!==void 0?a:ms,lineWidth:(c!==void 0?c:po)*this.pixelRatio_,miterLimit:h!==void 0?h:uo,strokeStyle:ei(n||fo)}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const n=t.getPixelRatio(this.pixelRatio_),s=t.getAnchor(),o=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*n,this.imageAnchorY_=s[1]*n,this.imageHeight_=e[1]*n,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=o[0],this.imageOriginY_=o[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const r=t.getScaleArray();this.imageScale_=[r[0]*this.pixelRatio_/n,r[1]*this.pixelRatio_/n],this.imageWidth_=e[0]*n}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const g=e.getColor();this.textFillState_={fillStyle:ei(g||ge)}}const n=t.getStroke();if(!n)this.textStrokeState_=null;else{const g=n.getColor(),_=n.getLineCap(),y=n.getLineDash(),w=n.getLineDashOffset(),E=n.getLineJoin(),b=n.getWidth(),P=n.getMiterLimit();this.textStrokeState_={lineCap:_!==void 0?_:Yr,lineDash:y||vi,lineDashOffset:w||Ei,lineJoin:E!==void 0?E:ms,lineWidth:b!==void 0?b:po,miterLimit:P!==void 0?P:uo,strokeStyle:ei(g||fo)}}const s=t.getFont(),o=t.getOffsetX(),r=t.getOffsetY(),a=t.getRotateWithView(),c=t.getRotation(),h=t.getScaleArray(),l=t.getText(),u=t.getTextAlign(),d=t.getTextBaseline();this.textState_={font:s!==void 0?s:ed,textAlign:u!==void 0?u:go,textBaseline:d!==void 0?d:Hr},this.text_=l!==void 0?Array.isArray(l)?l.reduce((g,_,y)=>g+=y%2?" ":_,""):l:"",this.textOffsetX_=o!==void 0?this.pixelRatio_*o:0,this.textOffsetY_=r!==void 0?this.pixelRatio_*r:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=c!==void 0?c:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}const si=.5;function q0(i,t,e,n,s,o,r){const a=i[0]*si,c=i[1]*si,h=Bt(a,c);h.imageSmoothingEnabled=!1;const l=h.canvas,u=new Sd(h,si,s,null,r),d=e.length,g=Math.floor((256*256*256-1)/d),_={};for(let w=1;w<=d;++w){const E=e[w-1],b=E.getStyleFunction()||n;if(!b)continue;let P=b(E,o);if(!P)continue;Array.isArray(P)||(P=[P]);const M=(w*g).toString(16).padStart(7,"#00000");for(let D=0,L=P.length;D<L;++D){const z=P[D],q=z.getGeometryFunction()(E);if(!q||!te(s,q.getExtent()))continue;const Y=z.clone(),X=Y.getFill();X&&X.setColor(M);const Q=Y.getStroke();Q&&(Q.setColor(M),Q.setLineDash(null)),Y.setText(void 0);const m=z.getImage();if(m){const F=m.getImageSize();if(!F)continue;const N=Bt(F[0],F[1],void 0,{alpha:!1}),G=N.canvas;N.fillStyle=M,N.fillRect(0,0,G.width,G.height),Y.setImage(new vs({img:G,imgSize:F,anchor:m.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:m.getOrigin(),opacity:1,size:m.getSize(),scale:m.getScale(),rotation:m.getRotation(),rotateWithView:m.getRotateWithView()}))}const v=Y.getZIndex()||0;let S=_[v];S||(S={},_[v]=S,S.Polygon=[],S.Circle=[],S.LineString=[],S.Point=[]);const A=q.getType();if(A==="GeometryCollection"){const F=q.getGeometriesArrayRecursive();for(let N=0,G=F.length;N<G;++N){const B=F[N];S[B.getType().replace("Multi","")].push(B,Y)}}else S[A.replace("Multi","")].push(q,Y)}}const y=Object.keys(_).map(Number).sort(On);for(let w=0,E=y.length;w<E;++w){const b=_[y[w]];for(const P in b){const I=b[P];for(let M=0,D=I.length;M<D;M+=2){u.setStyle(I[M+1]);for(let L=0,z=t.length;L<z;++L)u.setTransform(t[L]),u.drawGeometry(I[M])}}}return h.getImageData(0,0,l.width,l.height)}function G0(i,t,e){const n=[];if(e){const s=Math.floor(Math.round(i[0])*si),o=Math.floor(Math.round(i[1])*si),r=(qt(s,0,e.width-1)+qt(o,0,e.height-1)*e.width)*4,a=e.data[r],c=e.data[r+1],l=e.data[r+2]+256*(c+256*a),u=Math.floor((256*256*256-1)/t.length);l&&l%u===0&&n.push(t[l/u-1])}return n}const B0=.5,Rd={Point:Q0,LineString:$0,Polygon:t_,MultiPoint:J0,MultiLineString:Z0,MultiPolygon:K0,GeometryCollection:X0,Circle:Y0};function V0(i,t){return parseInt(St(i),10)-parseInt(St(t),10)}function Pd(i,t){const e=rh(i,t);return e*e}function rh(i,t){return B0*i/t}function Y0(i,t,e,n,s){const o=e.getFill(),r=e.getStroke();if(o||r){const c=i.getBuilder(e.getZIndex(),"Circle");c.setFillStrokeStyle(o,r),c.drawCircle(t,n)}const a=e.getText();if(a&&a.getText()){const c=(s||i).getBuilder(e.getZIndex(),"Text");c.setTextStyle(a),c.drawText(t,n)}}function Od(i,t,e,n,s,o,r){let a=!1;const c=e.getImage();if(c){const h=c.getImageState();h==ot.LOADED||h==ot.ERROR?c.unlistenImageChange(s):(h==ot.IDLE&&c.load(),c.listenImageChange(s),a=!0)}return H0(i,t,e,n,o,r),a}function H0(i,t,e,n,s,o){const r=e.getGeometryFunction()(t);if(!r)return;const a=r.simplifyTransformed(n,s);if(e.getRenderer())Id(i,a,e,t);else{const h=Rd[a.getType()];h(i,a,e,t,o)}}function Id(i,t,e,n){if(t.getType()=="GeometryCollection"){const o=t.getGeometries();for(let r=0,a=o.length;r<a;++r)Id(i,o[r],e,n);return}i.getBuilder(e.getZIndex(),"Default").drawCustom(t,n,e.getRenderer(),e.getHitDetectionRenderer())}function X0(i,t,e,n,s){const o=t.getGeometriesArray();let r,a;for(r=0,a=o.length;r<a;++r){const c=Rd[o[r].getType()];c(i,o[r],e,n,s)}}function $0(i,t,e,n,s){const o=e.getStroke();if(o){const a=i.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,o),a.drawLineString(t,n)}const r=e.getText();if(r&&r.getText()){const a=(s||i).getBuilder(e.getZIndex(),"Text");a.setTextStyle(r),a.drawText(t,n)}}function Z0(i,t,e,n,s){const o=e.getStroke();if(o){const a=i.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,o),a.drawMultiLineString(t,n)}const r=e.getText();if(r&&r.getText()){const a=(s||i).getBuilder(e.getZIndex(),"Text");a.setTextStyle(r),a.drawText(t,n)}}function K0(i,t,e,n,s){const o=e.getFill(),r=e.getStroke();if(r||o){const c=i.getBuilder(e.getZIndex(),"Polygon");c.setFillStrokeStyle(o,r),c.drawMultiPolygon(t,n)}const a=e.getText();if(a&&a.getText()){const c=(s||i).getBuilder(e.getZIndex(),"Text");c.setTextStyle(a),c.drawText(t,n)}}function Q0(i,t,e,n,s){const o=e.getImage(),r=e.getText();let a;if(o){if(o.getImageState()!=ot.LOADED)return;let c=i;if(s){const l=o.getDeclutterMode();if(l!=="none")if(c=s,l==="obstacle"){const u=i.getBuilder(e.getZIndex(),"Image");u.setImageStyle(o,a),u.drawPoint(t,n)}else r&&r.getText()&&(a={})}const h=c.getBuilder(e.getZIndex(),"Image");h.setImageStyle(o,a),h.drawPoint(t,n)}if(r&&r.getText()){let c=i;s&&(c=s);const h=c.getBuilder(e.getZIndex(),"Text");h.setTextStyle(r,a),h.drawText(t,n)}}function J0(i,t,e,n,s){const o=e.getImage(),r=e.getText();let a;if(o){if(o.getImageState()!=ot.LOADED)return;let c=i;if(s){const l=o.getDeclutterMode();if(l!=="none")if(c=s,l==="obstacle"){const u=i.getBuilder(e.getZIndex(),"Image");u.setImageStyle(o,a),u.drawMultiPoint(t,n)}else r&&r.getText()&&(a={})}const h=c.getBuilder(e.getZIndex(),"Image");h.setImageStyle(o,a),h.drawMultiPoint(t,n)}if(r&&r.getText()){let c=i;s&&(c=s);const h=c.getBuilder(e.getZIndex(),"Text");h.setTextStyle(r,a),h.drawText(t,n)}}function t_(i,t,e,n,s){const o=e.getFill(),r=e.getStroke();if(o||r){const c=i.getBuilder(e.getZIndex(),"Polygon");c.setFillStrokeStyle(o,r),c.drawPolygon(t,n)}const a=e.getText();if(a&&a.getText()){const c=(s||i).getBuilder(e.getZIndex(),"Text");c.setTextStyle(a),c.drawText(t,n)}}class Td extends ih{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Te(),this.wrappedRenderedExtent_=Te(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedRenderOrder_=null,this.replayGroup_=null,this.replayGroupChanged=!0,this.declutterExecutorGroup=null,this.clipping=!0,this.compositionContext_=null,this.opacity_=1}renderWorlds(t,e,n){const s=e.extent,o=e.viewState,r=o.center,a=o.resolution,c=o.projection,h=o.rotation,l=c.getExtent(),u=this.getLayer().getSource(),d=e.pixelRatio,g=e.viewHints,_=!(g[Vt.ANIMATING]||g[Vt.INTERACTING]),y=this.compositionContext_,w=Math.round(e.size[0]*d),E=Math.round(e.size[1]*d),b=u.getWrapX()&&c.canWrapX(),P=b?_t(l):null,I=b?Math.ceil((s[2]-l[2])/P)+1:1;let M=b?Math.floor((s[0]-l[0])/P):0;do{const D=this.getRenderTransform(r,a,h,d,w,E,M*P);t.execute(y,1,D,h,_,void 0,n)}while(++M<I)}setupCompositionContext_(){if(this.opacity_!==1){const t=Bt(this.context.canvas.width,this.context.canvas.height,Ed);this.compositionContext_=t}else this.compositionContext_=this.context}releaseCompositionContext_(){if(this.opacity_!==1){const t=this.context.globalAlpha;this.context.globalAlpha=this.opacity_,this.context.drawImage(this.compositionContext_.canvas,0,0),this.context.globalAlpha=t,Gr(this.compositionContext_),Ed.push(this.compositionContext_.canvas),this.compositionContext_=null}}renderDeclutter(t){this.declutterExecutorGroup&&(this.setupCompositionContext_(),this.renderWorlds(this.declutterExecutorGroup,t,t.declutterTree),this.releaseCompositionContext_())}renderFrame(t,e){const n=t.pixelRatio,s=t.layerStatesArray[t.layerIndex];Zp(this.pixelTransform,1/n,1/n),Or(this.inversePixelTransform,this.pixelTransform);const o=mc(this.pixelTransform);this.useContainer(e,o,this.getBackground(t));const r=this.context,a=r.canvas,c=this.replayGroup_,h=this.declutterExecutorGroup;let l=c&&!c.isEmpty()||h&&!h.isEmpty();if(!l&&!(this.getLayer().hasListener(ti.PRERENDER)||this.getLayer().hasListener(ti.POSTRENDER)))return null;const u=Math.round(t.size[0]*n),d=Math.round(t.size[1]*n);a.width!=u||a.height!=d?(a.width=u,a.height=d,a.style.transform!==o&&(a.style.transform=o)):this.containerReused||r.clearRect(0,0,u,d),this.preRender(r,t);const g=t.viewState;g.projection,this.opacity_=s.opacity,this.setupCompositionContext_();let _=!1;if(l&&s.extent&&this.clipping){const y=_i(s.extent);l=te(y,t.extent),_=l&&!Tn(y,t.extent),_&&this.clipUnrotated(this.compositionContext_,t,y)}return l&&this.renderWorlds(c,t),_&&this.compositionContext_.restore(),this.releaseCompositionContext_(),this.postRender(r,t),this.renderedRotation_!==g.rotation&&(this.renderedRotation_=g.rotation,this.hitDetectionImageData_=null),this.container}getFeatures(t){return new Promise(e=>{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const n=[this.context.canvas.width,this.context.canvas.height];Ut(this.pixelTransform,n);const s=this.renderedCenter_,o=this.renderedResolution_,r=this.renderedRotation_,a=this.renderedProjection_,c=this.wrappedRenderedExtent_,h=this.getLayer(),l=[],u=n[0]*si,d=n[1]*si;l.push(this.getRenderTransform(s,o,r,si,u,d,0).slice());const g=h.getSource(),_=a.getExtent();if(g.getWrapX()&&a.canWrapX()&&!Tn(_,c)){let y=c[0];const w=_t(_);let E=0,b;for(;y<_[0];)--E,b=w*E,l.push(this.getRenderTransform(s,o,r,si,u,d,b).slice()),y+=w;for(E=0,y=c[2];y>_[2];)++E,b=w*E,l.push(this.getRenderTransform(s,o,r,si,u,d,b).slice()),y-=w}this.hitDetectionImageData_=q0(n,l,this.renderedFeatures_,h.getStyleFunction(),c,o,r)}e(G0(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,n,s,o){if(!this.replayGroup_)return;const r=e.viewState.resolution,a=e.viewState.rotation,c=this.getLayer(),h={},l=function(g,_,y){const w=St(g),E=h[w];if(E){if(E!==!0&&y<E.distanceSq){if(y===0)return h[w]=!0,o.splice(o.lastIndexOf(E),1),s(g,c,_);E.geometry=_,E.distanceSq=y}}else{if(y===0)return h[w]=!0,s(g,c,_);o.push(h[w]={feature:g,layer:c,geometry:_,distanceSq:y,callback:s})}};let u;const d=[this.replayGroup_];return this.declutterExecutorGroup&&d.push(this.declutterExecutorGroup),d.some(g=>u=g.forEachFeatureAtCoordinate(t,r,a,n,l,g===this.declutterExecutorGroup&&e.declutterTree?e.declutterTree.all().map(_=>_.value):null)),u}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),n=e.getSource();if(!n)return!1;const s=t.viewHints[Vt.ANIMATING],o=t.viewHints[Vt.INTERACTING],r=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!r&&s||!a&&o)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const c=t.extent,h=t.viewState,l=h.projection,u=h.resolution,d=t.pixelRatio,g=e.getRevision(),_=e.getRenderBuffer();let y=e.getRenderOrder();y===void 0&&(y=V0);const w=h.center.slice(),E=io(c,_*u),b=E.slice(),P=[E.slice()],I=l.getExtent();if(n.getWrapX()&&l.canWrapX()&&!Tn(I,t.extent)){const S=_t(I),A=Math.max(_t(E)/2,S);E[0]=I[0]-A,E[2]=I[2]+A,pu(w,l);const F=uu(P[0],l);F[0]<I[0]&&F[2]<I[2]?P.push([F[0]+S,F[1],F[2]+S,F[3]]):F[0]>I[0]&&F[2]>I[2]&&P.push([F[0]-S,F[1],F[2]-S,F[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==g&&this.renderedRenderOrder_==y&&Tn(this.wrappedRenderedExtent_,E))return Bi(this.renderedExtent_,b)||(this.hitDetectionImageData_=null,this.renderedExtent_=b),this.renderedCenter_=w,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const M=new wd(rh(u,d),E,u,d);let D;this.getLayer().getDeclutter()&&(D=new wd(rh(u,d),E,u,d));let L;for(let S=0,A=P.length;S<A;++S)n.loadFeatures(P[S],u,l);const z=Pd(u,d);let q=!0;const Y=S=>{let A;const F=S.getStyleFunction()||e.getStyleFunction();if(F&&(A=F(S,u)),A){const N=this.renderFeature(S,z,A,M,L,D);q=q&&!N}},X=Pu(E),Q=n.getFeaturesInExtent(X);y&&Q.sort(y);for(let S=0,A=Q.length;S<A;++S)Y(Q[S]);this.renderedFeatures_=Q,this.ready=q;const m=M.finish(),v=new xd(E,u,d,n.getOverlaps(),m,e.getRenderBuffer());return D&&(this.declutterExecutorGroup=new xd(E,u,d,n.getOverlaps(),D.finish(),e.getRenderBuffer())),this.renderedResolution_=u,this.renderedRevision_=g,this.renderedRenderOrder_=y,this.renderedExtent_=b,this.wrappedRenderedExtent_=E,this.renderedCenter_=w,this.renderedProjection_=l,this.replayGroup_=v,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,n,s,o,r){if(!n)return!1;let a=!1;if(Array.isArray(n))for(let c=0,h=n.length;c<h;++c)a=Od(s,t,n[c],e,this.boundHandleStyleImageChange_,o,r)||a;else a=Od(s,t,n,e,this.boundHandleStyleImageChange_,o,r);return a}}class oi extends pd{constructor(t){super(t)}createRenderer(){return new Td(this)}}class Ad{constructor(t){this.rbush_=new Kc(t),this.items_={}}insert(t,e){const n={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(n),this.items_[St(e)]=n}load(t,e){const n=new Array(e.length);for(let s=0,o=e.length;s<o;s++){const r=t[s],a=e[s],c={minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],value:a};n[s]=c,this.items_[St(a)]=c}this.rbush_.load(n)}remove(t){const e=St(t),n=this.items_[e];return delete this.items_[e],this.rbush_.remove(n)!==null}update(t,e){const n=this.items_[St(e)],s=[n.minX,n.minY,n.maxX,n.maxY];Yi(s,t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(s){return s.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let n;for(let s=0,o=t.length;s<o;s++)if(n=e(t[s]),n)return n;return n}isEmpty(){return Js(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return pi(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}}class Ro extends Ke{constructor(t){super(),this.projection=Gt(t.projection),this.attributions_=Md(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible!==void 0?t.attributionsCollapsible:!0,this.loading=!1,this.state_=t.state!==void 0?t.state:"ready",this.wrapX_=t.wrapX!==void 0?t.wrapX:!1,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(n,s){e.viewResolver=n,e.viewRejector=s})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=Md(t),this.changed()}setState(t){this.state_=t,this.changed()}}function Md(i){return i?Array.isArray(i)?function(t){return i}:typeof i=="function"?i:function(t){return[i]}:null}const Ve={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function e_(i,t){return[[-1/0,-1/0,1/0,1/0]]}let i_=!1;function n_(i,t,e,n,s,o,r){const a=new XMLHttpRequest;a.open("GET",typeof i=="function"?i(e,n,s):i,!0),t.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=i_,a.onload=function(c){if(!a.status||a.status>=200&&a.status<300){const h=t.getType();let l;h=="json"||h=="text"?l=a.responseText:h=="xml"?(l=a.responseXML,l||(l=new DOMParser().parseFromString(a.responseText,"application/xml"))):h=="arraybuffer"&&(l=a.response),l?o(t.readFeatures(l,{extent:e,featureProjection:s}),t.readProjection(l)):r()}else r()},a.onerror=r,a.send()}function Dd(i,t){return function(e,n,s,o,r){const a=this;n_(i,t,e,n,s,function(c,h){a.addFeatures(c),o!==void 0&&o(c)},r||hs)}}class en extends We{constructor(t,e,n){super(t),this.feature=e,this.features=n}}class Si extends Ro{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:t.wrapX!==void 0?t.wrapX:!0}),this.on,this.once,this.un,this.loader_=hs,this.format_=t.format,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(pt(this.format_,7),this.loader_=Dd(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:e_;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Ad:null,this.loadedExtentsRtree_=new Ad,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,s;Array.isArray(t.features)?s=t.features:t.features&&(n=t.features,s=n.getArray()),!e&&n===void 0&&(n=new Qe(s)),s!==void 0&&this.addFeaturesInternal(s),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=St(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);const n=t.getGeometry();if(n){const s=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new en(Ve.ADDFEATURE,t))}setupChangeEvents_(t,e){this.featureChangeKeys_[t]=[Ct(e,ht.CHANGE,this.handleFeatureChange_,this),Ct(e,cs.PROPERTYCHANGE,this.handleFeatureChange_,this)]}addToIndex_(t,e){let n=!0;const s=e.getId();return s!==void 0&&(s.toString()in this.idIndex_?n=!1:this.idIndex_[s.toString()]=e),n&&(pt(!(t in this.uidIndex_),30),this.uidIndex_[t]=e),n}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],n=[],s=[];for(let o=0,r=t.length;o<r;o++){const a=t[o],c=St(a);this.addToIndex_(c,a)&&n.push(a)}for(let o=0,r=n.length;o<r;o++){const a=n[o],c=St(a);this.setupChangeEvents_(c,a);const h=a.getGeometry();if(h){const l=h.getExtent();e.push(l),s.push(a)}else this.nullGeometryFeatures_[c]=a}if(this.featuresRtree_&&this.featuresRtree_.load(e,s),this.hasListener(Ve.ADDFEATURE))for(let o=0,r=n.length;o<r;o++)this.dispatchEvent(new en(Ve.ADDFEATURE,n[o]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(Ve.ADDFEATURE,function(n){e||(e=!0,t.push(n.feature),e=!1)}),this.addEventListener(Ve.REMOVEFEATURE,function(n){e||(e=!0,t.remove(n.feature),e=!1)}),t.addEventListener(ue.ADD,n=>{e||(e=!0,this.addFeature(n.element),e=!1)}),t.addEventListener(ue.REMOVE,n=>{e||(e=!0,this.removeFeature(n.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const n in this.featureChangeKeys_)this.featureChangeKeys_[n].forEach(Mt);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const n=s=>{this.removeFeatureInternal(s)};this.featuresRtree_.forEach(n);for(const s in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[s])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new en(Ve.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const n=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(n,function(s){if(s.getGeometry().intersectsCoordinate(t))return e(s)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(n){if(n.getGeometry().intersectsExtent(t)){const o=e(n);if(o)return o}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),Js(this.nullGeometryFeatures_)||In(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(n){e.push(n)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const s=cm(t,e);return[].concat(...s.map(o=>this.featuresRtree_.getInExtent(o)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const n=t[0],s=t[1];let o=null;const r=[NaN,NaN];let a=1/0;const c=[-1/0,-1/0,1/0,1/0];return e=e||Ks,this.featuresRtree_.forEachInExtent(c,function(h){if(e(h)){const l=h.getGeometry(),u=a;if(a=l.closestPointXY(n,s,r,a),a<u){o=h;const d=Math.sqrt(a);c[0]=n-d,c[1]=s-d,c[2]=n+d,c[3]=s+d}}}),o}getExtent(t){return this.featuresRtree_.getExtent(t)}getFeatureById(t){const e=this.idIndex_[t.toString()];return e!==void 0?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return e!==void 0?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,n=St(e),s=e.getGeometry();if(!s)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[n]=e);else{const r=s.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(r,e)):this.featuresRtree_&&this.featuresRtree_.update(r,e)}const o=e.getId();if(o!==void 0){const r=o.toString();this.idIndex_[r]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[r]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[n]=e;this.changed(),this.dispatchEvent(new en(Ve.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:St(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Js(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(t,e,n){const s=this.loadedExtentsRtree_,o=this.strategy_(t,e,n);for(let r=0,a=o.length;r<a;++r){const c=o[r];s.forEachInExtent(c,function(l){return Tn(l.extent,c)})||(++this.loadingExtentsCount_,this.dispatchEvent(new en(Ve.FEATURESLOADSTART)),this.loader_.call(this,c,e,n,l=>{--this.loadingExtentsCount_,this.dispatchEvent(new en(Ve.FEATURESLOADEND,void 0,l))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new en(Ve.FEATURESLOADERROR))}),s.insert(c,{extent:c.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_;let n;e.forEachInExtent(t,function(s){if(Yi(s.extent,t))return n=s,!0}),n&&e.remove(n)}removeFeature(t){if(!t)return;const e=St(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=St(t),n=this.featureChangeKeys_[e];if(!n)return;n.forEach(Mt),delete this.featureChangeKeys_[e];const s=t.getId();return s!==void 0&&delete this.idIndex_[s.toString()],delete this.uidIndex_[e],this.dispatchEvent(new en(Ve.REMOVEFEATURE,t)),t}removeFromIdIndex_(t){let e=!1;for(const n in this.idIndex_)if(this.idIndex_[n]===t){delete this.idIndex_[n],e=!0;break}return e}setLoader(t){this.loader_=t}setUrl(t){pt(this.format_,7),this.url_=t,this.setLoader(Dd(t,this.format_))}}function Fd(i){if(!(i.context instanceof CanvasRenderingContext2D))throw new Error("Only works for render events from Canvas 2D layers");const t=i.inversePixelTransform[0],e=i.inversePixelTransform[1],n=Math.sqrt(t*t+e*e),s=i.frameState,o=Hp(i.inversePixelTransform.slice(),s.coordinateToPixelTransform),r=Pd(s.viewState.resolution,n);let a;return new Sd(i.context,n,s.extent,o,s.viewState.rotation,r,a)}class Ld extends th{constructor(t,e,n,s,o){const r=o!==void 0?ot.IDLE:ot.LOADED;super(t,e,n,r),this.loader_=o!==void 0?o:null,this.canvas_=s,this.error_=null}getError(){return this.error_}handleLoad_(t){t?(this.error_=t,this.state=ot.ERROR):this.state=ot.LOADED,this.changed()}load(){this.state==ot.IDLE&&(this.state=ot.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}const rt={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class zd extends to{constructor(t,e,n){super(),n=n||{},this.tileCoord=t,this.state=e,this.interimTile=null,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(ht.CHANGE)}release(){this.state===rt.ERROR&&this.setState(rt.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){if(!this.interimTile)return this;let t=this.interimTile;do{if(t.getState()==rt.LOADED)return this.transition_=0,t;t=t.interimTile}while(t);return this}refreshInterimChain(){if(!this.interimTile)return;let t=this.interimTile,e=this;do{if(t.getState()==rt.LOADED){t.interimTile=null;break}else t.getState()==rt.LOADING?e=t:t.getState()==rt.IDLE?e.interimTile=t.interimTile:e=t;t=e.interimTile}while(t)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==rt.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){vt()}getAlpha(t,e){if(!this.transition_)return 1;let n=this.transitionStarts_[t];if(!n)n=e,this.transitionStarts_[t]=n;else if(n===-1)return 1;const s=e-n+1e3/60;return s>=this.transition_?1:eu(s/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}}class Nd extends zd{constructor(t,e,n,s,o,r){super(t,e,r),this.crossOrigin_=s,this.src_=n,this.key=n,this.image_=new Image,s!==null&&(this.image_.crossOrigin=s),this.unlisten_=null,this.tileLoadFunction_=o}getImage(){return this.image_}setImage(t){this.image_=t,this.state=rt.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=rt.ERROR,this.unlistenImage_(),this.image_=s_(),this.changed()}handleImageLoad_(){const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=rt.LOADED:this.state=rt.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==rt.ERROR&&(this.state=rt.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==rt.IDLE&&(this.state=rt.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=eh(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function s_(){const i=Bt(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}class o_{constructor(t,e,n){this.decay_=t,this.minVelocity_=e,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let n=e-3;for(;n>0&&this.points_[n+2]>t;)n-=3;const s=this.points_[e+2]-this.points_[n+2];if(s<16.666666666666668)return!1;const o=this.points_[e]-this.points_[n],r=this.points_[e+1]-this.points_[n+1];return this.angle_=Math.atan2(r,o),this.initialVelocity_=Math.sqrt(o*o+r*r)/s,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}class r_ extends xr{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){vt()}calculateMatrices2D(t){const e=t.viewState,n=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;qe(n,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Or(s,n)}forEachFeatureAtCoordinate(t,e,n,s,o,r,a,c){let h;const l=e.viewState;function u(I,M,D,L){return o.call(r,M,I?D:null,L)}const d=l.projection,g=pu(t.slice(),d),_=[[0,0]];if(d.canWrapX()&&s){const I=d.getExtent(),M=_t(I);_.push([-M,0],[M,0])}const y=e.layerStatesArray,w=y.length,E=[],b=[];for(let I=0;I<_.length;I++)for(let M=w-1;M>=0;--M){const D=y[M],L=D.layer;if(L.hasRenderer()&&Zc(D,l)&&a.call(c,L)){const z=L.getRenderer(),q=L.getSource();if(z&&q){const Y=q.getWrapX()?g:t,X=u.bind(null,D.managed);b[0]=Y[0]+_[I][0],b[1]=Y[1]+_[I][1],h=z.forEachFeatureAtCoordinate(b,e,n,X,E)}if(h)return h}}if(E.length===0)return;const P=1/E.length;return E.forEach((I,M)=>I.distanceSq+=M*P),E.sort((I,M)=>I.distanceSq-M.distanceSq),E.some(I=>h=I.callback(I.feature,I.layer,I.geometry)),h}hasFeatureAtCoordinate(t,e,n,s,o,r){return this.forEachFeatureAtCoordinate(t,e,n,s,Ks,this,o,r)!==void 0}getMap(){return this.map_}renderFrame(t){vt()}flushDeclutterItems(t){}scheduleExpireIconCache(t){Qr.canExpireCache()&&t.postRenderFunctions.push(a_)}}function a_(i,t){Qr.expire()}class c_ extends r_{constructor(t){super(t),this.fontChangeListenerKey_=Ct(Ci,cs.PROPERTYCHANGE,t.redrawText.bind(t)),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Vr+" ol-layers";const n=t.getViewport();n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0,this.declutterLayers_=[]}dispatchRenderEvent(t,e){const n=this.getMap();if(n.hasListener(t)){const s=new vd(t,void 0,e);n.dispatchEvent(s)}}disposeInternal(){Mt(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(ti.PRECOMPOSE,t);const e=t.layerStatesArray.sort(function(r,a){return r.zIndex-a.zIndex}),n=t.viewState;this.children_.length=0;const s=this.declutterLayers_;s.length=0;let o=null;for(let r=0,a=e.length;r<a;++r){const c=e[r];t.layerIndex=r;const h=c.layer,l=h.getSourceState();if(!Zc(c,n)||l!="ready"&&l!="undefined"){h.unrender();continue}const u=h.render(t,o);u&&(u!==o&&(this.children_.push(u),o=u),"getDeclutter"in h&&s.push(h))}this.flushDeclutterItems(t),Km(this.element_,this.children_),this.dispatchRenderEvent(ti.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}flushDeclutterItems(t){const e=this.declutterLayers_;for(let n=e.length-1;n>=0;--n)e[n].renderDeclutter(t);e.length=0}}class nn extends We{constructor(t,e){super(t),this.layer=e}}const ah={LAYERS:"layers"};class sn extends od{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let n=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(ah.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new Qe(n.slice(),{unique:!0}):pt(typeof n.getArray=="function",43):n=new Qe(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(Mt),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(Ct(t,ue.ADD,this.handleLayersAdd_,this),Ct(t,ue.REMOVE,this.handleLayersRemove_,this));for(const n in this.listenerKeys_)this.listenerKeys_[n].forEach(Mt);Qs(this.listenerKeys_);const e=t.getArray();for(let n=0,s=e.length;n<s;n++){const o=e[n];this.registerLayerListeners_(o),this.dispatchEvent(new nn("addlayer",o))}this.changed()}registerLayerListeners_(t){const e=[Ct(t,cs.PROPERTYCHANGE,this.handleLayerChange_,this),Ct(t,ht.CHANGE,this.handleLayerChange_,this)];t instanceof sn&&e.push(Ct(t,"addlayer",this.handleLayerGroupAdd_,this),Ct(t,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[St(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new nn("addlayer",t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new nn("removelayer",t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new nn("addlayer",e)),this.changed()}handleLayersRemove_(t){const e=t.element,n=St(e);this.listenerKeys_[n].forEach(Mt),delete this.listenerKeys_[n],this.dispatchEvent(new nn("removelayer",e)),this.changed()}getLayers(){return this.get(ah.LAYERS)}setLayers(t){const e=this.getLayers();if(e){const n=e.getArray();for(let s=0,o=n.length;s<o;++s)this.dispatchEvent(new nn("removelayer",n[s]))}this.set(ah.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=t!==void 0?t:[],n=e.length;this.getLayers().forEach(function(r){r.getLayerStatesArray(e)});const s=this.getLayerState();let o=s.zIndex;!t&&s.zIndex===void 0&&(o=0);for(let r=n,a=e.length;r<a;r++){const c=e[r];c.opacity*=s.opacity,c.visible=c.visible&&s.visible,c.maxResolution=Math.min(c.maxResolution,s.maxResolution),c.minResolution=Math.max(c.minResolution,s.minResolution),c.minZoom=Math.max(c.minZoom,s.minZoom),c.maxZoom=Math.min(c.maxZoom,s.maxZoom),s.extent!==void 0&&(c.extent!==void 0?c.extent=An(c.extent,s.extent):c.extent=s.extent),c.zIndex===void 0&&(c.zIndex=o)}return e}getSourceState(){return"ready"}}class bs extends We{constructor(t,e,n){super(t),this.map=e,this.frameState=n!==void 0?n:null}}class on extends bs{constructor(t,e,n,s,o,r){super(t,e,o),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=s!==void 0?s:!1,this.activePointers=r}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const zt={SINGLECLICK:"singleclick",CLICK:ht.CLICK,DBLCLICK:ht.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},ch={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class h_ extends to{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;const n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=Ct(n,ch.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=Ct(n,ch.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(ht.TOUCHMOVE,this.boundHandleTouchMove_,ou?{passive:!1}:!1)}emulateClick_(t){let e=new on(zt.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new on(zt.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const n=new on(zt.SINGLECLICK,this.map_,t);this.dispatchEvent(n)},250)}updateActivePointers_(t){const e=t,n=e.pointerId;if(e.type==zt.POINTERUP||e.type==zt.POINTERCANCEL){delete this.trackedTouches_[n];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==e.target){delete this.trackedTouches_[s];break}}else(e.type==zt.POINTERDOWN||e.type==zt.POINTERMOVE)&&(this.trackedTouches_[n]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new on(zt.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(Mt),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return t.button===0}handlePointerDown_(t){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(t);const e=new on(zt.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){const n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(Ct(n,zt.POINTERMOVE,this.handlePointerMove_,this),Ct(n,zt.POINTERUP,this.handlePointerUp_,this),Ct(this.element_,zt.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(Ct(this.element_.getRootNode(),zt.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new on(zt.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new on(zt.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;(!e||e.defaultPrevented)&&(typeof t.cancelable!="boolean"||t.cancelable===!0)&&t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(Mt(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(ht.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(Mt(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(Mt),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const rn={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},ee={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},ea=1/0;class l_{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Qs(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,n=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(n);return delete this.queuedElements_[s],n}enqueue(t){pt(!(this.keyFunction_(t)in this.queuedElements_),31);const e=this.priorityFunction_(t);return e!=ea?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,n=this.priorities_,s=e.length,o=e[t],r=n[t],a=t;for(;t<s>>1;){const c=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),l=h<s&&n[h]<n[c]?h:c;e[t]=e[l],n[t]=n[l],t=l}e[t]=o,n[t]=r,this.siftDown_(a,t)}siftDown_(t,e){const n=this.elements_,s=this.priorities_,o=n[e],r=s[e];for(;e>t;){const a=this.getParentIndex_(e);if(s[a]>r)n[e]=n[a],s[e]=s[a],e=a;else break}n[e]=o,s[e]=r}reprioritize(){const t=this.priorityFunction_,e=this.elements_,n=this.priorities_;let s=0;const o=e.length;let r,a,c;for(a=0;a<o;++a)r=e[a],c=t(r),c==ea?delete this.queuedElements_[this.keyFunction_(r)]:(n[s]=c,e[s++]=r);e.length=s,n.length=s,this.heapify_()}}class Ud extends l_{constructor(t,e){super(function(n){return t.apply(null,n)},function(n){return n[0].getKey()}),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(ht.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,n=e.getState();if(n===rt.LOADED||n===rt.ERROR||n===rt.EMPTY){n!==rt.ERROR&&e.removeEventListener(ht.CHANGE,this.boundHandleTileChange_);const s=e.getKey();s in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[s],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let n=0,s,o,r;for(;this.tilesLoading_<t&&n<e&&this.getCount()>0;)o=this.dequeue()[0],r=o.getKey(),s=o.getState(),s===rt.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++n,o.load())}}function u_(i,t,e,n,s){if(!i||!(e in i.wantedTiles)||!i.wantedTiles[e][t.getKey()])return ea;const o=i.viewState.center,r=n[0]-o[0],a=n[1]-o[1];return 65536*Math.log(s)+Math.sqrt(r*r+a*a)/s}class hh extends Ke{constructor(t){super();const e=t.element;e&&!t.target&&!e.style.pointerEvents&&(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){jc(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&jc(this.element);for(let e=0,n=this.listenerKeys.length;e<n;++e)Mt(this.listenerKeys[e]);this.listenerKeys.length=0,this.map_=t,t&&((this.target_?this.target_:t.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==hs&&this.listenerKeys.push(Ct(t,rn.POSTRENDER,this.render,this)),t.render())}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}class d_ extends hh{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=t.collapsible!==void 0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1);const e=t.className!==void 0?t.className:"ol-attribution",n=t.tipLabel!==void 0?t.tipLabel:"Attributions",s=t.expandClassName!==void 0?t.expandClassName:e+"-expand",o=t.collapseLabel!==void 0?t.collapseLabel:"›",r=t.collapseClassName!==void 0?t.collapseClassName:e+"-collapse";typeof o=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=o,this.collapseLabel_.className=r):this.collapseLabel_=o;const a=t.label!==void 0?t.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=s):this.label_=a;const c=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(c),this.toggleButton_.addEventListener(ht.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+Vr+" "+kc+(this.collapsed_&&this.collapsible_?" "+Qu:"")+(this.collapsible_?"":" ol-uncollapsible"),l=this.element;l.className=h,l.appendChild(this.toggleButton_),l.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=Array.from(new Set(this.getMap().getAllLayers().flatMap(s=>s.getAttributions(t)))),n=!this.getMap().getAllLayers().some(s=>s.getSource()&&s.getSource().getAttributionsCollapsible()===!1);return this.overrideCollapsible_||this.setCollapsible(n),e}updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=this.collectSourceAttributions_(t),n=e.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Bi(e,this.renderedAttributions_)){Zm(this.ulElement_);for(let s=0,o=e.length;s<o;++s){const r=document.createElement("li");r.innerHTML=e[s],this.ulElement_.appendChild(r)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Qu),this.collapsed_?Ku(this.collapseLabel_,this.label_):Ku(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,!(!this.collapsible_||this.collapsed_===t)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}class f_ extends hh{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=t.className!==void 0?t.className:"ol-rotate",n=t.label!==void 0?t.label:"⇧",s=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof n=="string"?(this.label_=document.createElement("span"),this.label_.className=s,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(s));const o=t.tipLabel?t.tipLabel:"Reset rotation",r=document.createElement("button");r.className=e+"-reset",r.setAttribute("type","button"),r.title=o,r.appendChild(this.label_),r.addEventListener(ht.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+Vr+" "+kc,c=this.element;c.className=a,c.appendChild(r),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=t.duration!==void 0?t.duration:250,this.autoHide_=t.autoHide!==void 0?t.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Br)}handleClick_(t){t.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const e=this.getMap().getView();if(!e)return;const n=e.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:Pn}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const n=e.viewState.rotation;if(n!=this.rotation_){const s="rotate("+n+"rad)";if(this.autoHide_){const o=this.element.classList.contains(Br);!o&&n===0?this.element.classList.add(Br):o&&n!==0&&this.element.classList.remove(Br)}this.label_.style.transform=s}this.rotation_=n}}class g_ extends hh{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",n=t.delta!==void 0?t.delta:1,s=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",o=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",r=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"–",c=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",l=document.createElement("button");l.className=s,l.setAttribute("type","button"),l.title=c,l.appendChild(typeof r=="string"?document.createTextNode(r):r),l.addEventListener(ht.CLICK,this.handleClick_.bind(this,n),!1);const u=document.createElement("button");u.className=o,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(ht.CLICK,this.handleClick_.bind(this,-n),!1);const d=e+" "+Vr+" "+kc,g=this.element;g.className=d,g.appendChild(l),g.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const n=this.getMap().getView();if(!n)return;const s=n.getZoom();if(s!==void 0){const o=n.getConstrainedZoom(s+t);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:o,duration:this.duration_,easing:Pn})):n.setZoom(o)}}}function jd(i){i=i||{};const t=new Qe;return(i.zoom!==void 0?i.zoom:!0)&&t.push(new g_(i.zoomOptions)),(i.rotate!==void 0?i.rotate:!0)&&t.push(new f_(i.rotateOptions)),(i.attribution!==void 0?i.attribution:!0)&&t.push(new d_(i.attributionOptions)),t}const kd={ACTIVE:"active"};class Po extends Ke{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(kd.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(kd.ACTIVE,t)}setMap(t){this.map_=t}}function p_(i,t,e){const n=i.getCenterInternal();if(n){const s=[n[0]+t[0],n[1]+t[1]];i.animateInternal({duration:e!==void 0?e:250,easing:zp,center:i.getConstrainedCenter(s)})}}function lh(i,t,e,n){const s=i.getZoom();if(s===void 0)return;const o=i.getConstrainedZoom(s+t),r=i.getResolutionForZoom(o);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:r,anchor:e,duration:n!==void 0?n:250,easing:Pn})}class m_ extends Po{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:250}handleEvent(t){let e=!1;if(t.type==zt.DBLCLICK){const n=t.originalEvent,s=t.map,o=t.coordinate,r=n.shiftKey?-this.delta_:this.delta_,a=s.getView();lh(a,r,o,this.duration_),n.preventDefault(),e=!0}return!e}}class Oo extends Po{constructor(t){t=t||{},super(t),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==zt.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==zt.POINTERUP){const n=this.handleUpEvent(t);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(t.type==zt.POINTERDOWN){const n=this.handleDownEvent(t);this.handlingDownUpSequence=n,e=this.stopDown(n)}else t.type==zt.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function uh(i){const t=i.length;let e=0,n=0;for(let s=0;s<t;s++)e+=i[s].clientX,n+=i[s].clientY;return{clientX:e/t,clientY:n/t}}function dh(i){const t=arguments;return function(e){let n=!0;for(let s=0,o=t.length;s<o&&(n=n&&t[s](e),!!n);++s);return n}}const __=function(i){const t=i.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},y_=function(i){const t=i.map.getTargetElement(),e=i.map.getOwnerDocument().activeElement;return t.contains(e)},Wd=function(i){return i.map.getTargetElement().hasAttribute("tabindex")?y_(i):!0},w_=Ks,qd=function(i){const t=i.originalEvent;return t.button==0&&!(Bp&&nu&&t.ctrlKey)},Gd=function(i){const t=i.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},v_=function(i){const t=i.originalEvent;return nu?t.metaKey:t.ctrlKey},E_=function(i){const t=i.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Bd=function(i){const t=i.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},fh=function(i){const t=i.originalEvent;return pt(t!==void 0,56),t.pointerType=="mouse"},C_=function(i){const t=i.originalEvent;return pt(t!==void 0,56),t.isPrimary&&t.button===0};class b_ extends Oo{constructor(t){super({stopDown:Rr}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:dh(Gd,C_);this.condition_=t.onFocusOnly?dh(Wd,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const n=this.targetPointers,s=e.getEventPixel(uh(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(s[0],s[1]),this.lastCentroid){const o=[this.lastCentroid[0]-s[0],s[1]-this.lastCentroid[1]],a=t.map.getView();Cm(o,a.getResolution()),Rc(o,a.getRotation()),a.adjustCenterInternal(o)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=s,this.lastPointersCount_=n.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,n=e.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const s=this.kinetic_.getDistance(),o=this.kinetic_.getAngle(),r=n.getCenterInternal(),a=e.getPixelFromCoordinateInternal(r),c=e.getCoordinateFromPixelInternal([a[0]-s*Math.cos(o),a[1]-s*Math.sin(o)]);n.animateInternal({center:n.getConstrainedCenter(c),duration:500,easing:Pn})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const n=t.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}class x_ extends Oo{constructor(t){t=t||{},super({stopDown:Rr}),this.condition_=t.condition?t.condition:__,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!fh(t))return;const e=t.map,n=e.getView();if(n.getConstraints().rotation===Hc)return;const s=e.getSize(),o=t.pixel,r=Math.atan2(s[1]/2-o[1],o[0]-s[0]/2);if(this.lastAngle_!==void 0){const a=r-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=r}handleUpEvent(t){return fh(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return fh(t)&&qd(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class S_ extends xr{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,n="px",s=this.element_.style;s.left=Math.min(t[0],e[0])+n,s.top=Math.min(t[1],e[1])+n,s.width=Math.abs(e[0]-t[0])+n,s.height=Math.abs(e[1]-t[1])+n}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){const t=this.startPixel_,e=this.endPixel_,s=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);s[4]=s[0].slice(),this.geometry_?this.geometry_.setCoordinates([s]):this.geometry_=new ps([s])}getGeometry(){return this.geometry_}}const ia={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class gh extends We{constructor(t,e,n){super(t),this.coordinate=e,this.mapBrowserEvent=n}}class R_ extends Oo{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.box_=new S_(t.className||"ol-dragbox"),this.minArea_=t.minArea!==void 0?t.minArea:64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition?t.condition:qd,this.boxEndCondition_=t.boxEndCondition?t.boxEndCondition:this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,n){const s=n[0]-e[0],o=n[1]-e[1];return s*s+o*o>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new gh(ia.BOXDRAG,t.coordinate,t))}handleUpEvent(t){this.box_.setMap(null);const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new gh(e?ia.BOXEND:ia.BOXCANCEL,t.coordinate,t)),!1}handleDownEvent(t){return this.condition_(t)?(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new gh(ia.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}}class P_ extends R_{constructor(t){t=t||{};const e=t.condition?t.condition:E_;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){const n=this.getMap().getView();let s=this.getGeometry();if(this.out_){const o=n.rotatedExtentForGeometry(s),r=n.getResolutionForExtentInternal(o),a=n.getResolution()/r;s=s.clone(),s.scale(a*a)}n.fitInternal(s,{duration:this.duration_,easing:Pn})}}const jn={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class O_ extends Po{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return Gd(e)&&Bd(e)},this.condition_=t.condition!==void 0?t.condition:this.defaultCondition_,this.duration_=t.duration!==void 0?t.duration:100,this.pixelDelta_=t.pixelDelta!==void 0?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==ht.KEYDOWN){const n=t.originalEvent,s=n.key;if(this.condition_(t)&&(s==jn.DOWN||s==jn.LEFT||s==jn.RIGHT||s==jn.UP)){const r=t.map.getView(),a=r.getResolution()*this.pixelDelta_;let c=0,h=0;s==jn.DOWN?h=-a:s==jn.LEFT?c=-a:s==jn.RIGHT?c=a:h=a;const l=[c,h];Rc(l,r.getRotation()),p_(r,l,this.duration_),n.preventDefault(),e=!0}}return!e}}class I_ extends Po{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!v_(e)&&Bd(e)},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:100}handleEvent(t){let e=!1;if(t.type==ht.KEYDOWN||t.type==ht.KEYPRESS){const n=t.originalEvent,s=n.key;if(this.condition_(t)&&(s==="+"||s==="-")){const o=t.map,r=s==="+"?this.delta_:-this.delta_,a=o.getView();lh(a,r,void 0,this.duration_),n.preventDefault(),e=!0}}return!e}}class T_ extends Po{constructor(t){t=t||{},super(t),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=t.maxDelta!==void 0?t.maxDelta:1,this.duration_=t.duration!==void 0?t.duration:250,this.timeout_=t.timeout!==void 0?t.timeout:80,this.useAnchor_=t.useAnchor!==void 0?t.useAnchor:!0,this.constrainResolution_=t.constrainResolution!==void 0?t.constrainResolution:!1;const e=t.condition?t.condition:w_;this.condition_=t.onFocusOnly?dh(Wd,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(t){if(!this.condition_(t)||t.type!==ht.WHEEL)return!0;const n=t.map,s=t.originalEvent;s.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate);let o;if(t.type==ht.WHEEL&&(o=s.deltaY,Gp&&s.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(o/=su),s.deltaMode===WheelEvent.DOM_DELTA_LINE&&(o*=40)),o===0)return!1;this.lastDelta_=o;const r=Date.now();this.startTime_===void 0&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(o)<4?"trackpad":"wheel");const a=n.getView();if(this.mode_==="trackpad"&&!(a.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=r,!1;this.totalDelta_+=o;const c=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),c),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let n=-qt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),lh(e,n,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}class A_ extends Oo{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Rr),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=t.threshold!==void 0?t.threshold:.3,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){let e=0;const n=this.targetPointers[0],s=this.targetPointers[1],o=Math.atan2(s.clientY-n.clientY,s.clientX-n.clientX);if(this.lastAngle_!==void 0){const c=o-this.lastAngle_;this.rotationDelta_+=c,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=c}this.lastAngle_=o;const r=t.map,a=r.getView();a.getConstraints().rotation!==Hc&&(this.anchor_=r.getCoordinateFromPixelInternal(r.getEventPixel(uh(this.targetPointers))),this.rotating_&&(r.render(),a.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return this.targetPointers.length<2?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}class M_ extends Oo{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Rr),super(e),this.anchor_=null,this.duration_=t.duration!==void 0?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const n=this.targetPointers[0],s=this.targetPointers[1],o=n.clientX-s.clientX,r=n.clientY-s.clientY,a=Math.sqrt(o*o+r*r);this.lastDistance_!==void 0&&(e=this.lastDistance_/a),this.lastDistance_=a;const c=t.map,h=c.getView();e!=1&&(this.lastScaleDelta_=e),this.anchor_=c.getCoordinateFromPixelInternal(c.getEventPixel(uh(this.targetPointers))),c.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const n=t.map.getView(),s=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,s),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}function Vd(i){i=i||{};const t=new Qe,e=new o_(-.005,.05,100);return(i.altShiftDragRotate!==void 0?i.altShiftDragRotate:!0)&&t.push(new x_),(i.doubleClickZoom!==void 0?i.doubleClickZoom:!0)&&t.push(new m_({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan!==void 0?i.dragPan:!0)&&t.push(new b_({onFocusOnly:i.onFocusOnly,kinetic:e})),(i.pinchRotate!==void 0?i.pinchRotate:!0)&&t.push(new A_),(i.pinchZoom!==void 0?i.pinchZoom:!0)&&t.push(new M_({duration:i.zoomDuration})),(i.keyboard!==void 0?i.keyboard:!0)&&(t.push(new O_),t.push(new I_({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom!==void 0?i.mouseWheelZoom:!0)&&t.push(new T_({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom!==void 0?i.shiftDragZoom:!0)&&t.push(new P_({duration:i.zoomDuration})),t}function Yd(i){if(i instanceof yo){i.setMapInternal(null);return}i instanceof sn&&i.getLayers().forEach(Yd)}function Hd(i,t){if(i instanceof yo){i.setMapInternal(t);return}if(i instanceof sn){const e=i.getLayers().getArray();for(let n=0,s=e.length;n<s;++n)Hd(e[n],t)}}let D_=class extends Ke{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=F_(t);this.renderComplete_,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading!==void 0?t.maxTilesLoading:16,this.pixelRatio_=t.pixelRatio!==void 0?t.pixelRatio:su,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=be(),this.pixelToCoordinateTransform_=be(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,this.resizeObserver_=new ResizeObserver(()=>this.updateSize()),this.controls=e.controls||jd(),this.interactions=e.interactions||Vd({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Ud(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(ee.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(ee.VIEW,this.handleViewChanged_),this.addChangeListener(ee.SIZE,this.handleSizeChanged_),this.addChangeListener(ee.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const n=this;t.view&&!(t.view instanceof ni)&&t.view.then(function(s){n.setView(new ni(s))}),this.controls.addEventListener(ue.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(ue.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(ue.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(ue.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(ue.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(ue.REMOVE,s=>{const o=s.element.getId();o!==void 0&&delete this.overlayIdIndex_[o.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){Hd(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,n){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);n=n!==void 0?n:{};const o=n.hitTolerance!==void 0?n.hitTolerance:0,r=n.layerFilter!==void 0?n.layerFilter:Ks,a=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,o,a,e,null,r,null)}getFeaturesAtPixel(t,e){const n=[];return this.forEachFeatureAtPixel(t,function(s){n.push(s)},e),n}getAllLayers(){const t=[];function e(n){n.forEach(function(s){s instanceof sn?e(s.getLayers()):t.push(s)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const n=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};const s=e.layerFilter!==void 0?e.layerFilter:Ks,o=e.hitTolerance!==void 0?e.hitTolerance:0,r=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,o,r,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const n=this.viewport_.getBoundingClientRect(),s=this.getSize(),o=n.width/s[0],r=n.height/s[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-n.left)/o,(a.clientY-n.top)/r]}getTarget(){return this.get(ee.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Dc(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?Ut(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return e!==void 0?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(ee.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Qe){e.setLayers(t);return}const n=e.getLayers();n.clear(),n.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,n=t.length;e<n;++e){const s=t[e];if(!s.visible)continue;const o=s.layer.getRenderer();if(o&&!o.ready)return!0;const r=s.layer.getSource();if(r&&r.loading)return!0}return!1}getPixelFromCoordinate(t){const e=mi(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?Ut(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(ee.SIZE)}getView(){return this.get(ee.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,n,s){return u_(this.frameState_,t,e,n,s)}handleBrowserEvent(t,e){e=e||t.type;const n=new on(e,this,t);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,n=e.type;if(n===ch.POINTERDOWN||n===ht.WHEEL||n===ht.KEYDOWN){const s=this.getOwnerDocument(),o=this.viewport_.getRootNode?this.viewport_.getRootNode():s,r=e.target;if(this.overlayContainerStopEvent_.contains(r)||!(o===s?s.documentElement:o).contains(r))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){const s=this.getInteractions().getArray().slice();for(let o=s.length-1;o>=0;o--){const r=s[o];if(r.getMap()!==this||!r.getActive()||!this.getTargetElement())continue;if(!r.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let s=this.maxTilesLoading_,o=s;if(t){const r=t.viewHints;if(r[Vt.ANIMATING]||r[Vt.INTERACTING]){const a=Date.now()-t.time>8;s=a?0:8,o=a?0:2}}e.getTilesLoading()<s&&(e.reprioritize(),e.loadMoreTiles(s,o))}t&&this.renderer_&&!t.animate&&(this.renderComplete_===!0?(this.hasListener(ti.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(ti.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new bs(rn.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new bs(rn.LOADSTART,this,t))));const n=this.postRenderFunctions_;for(let s=0,o=n.length;s<o;++s)n[s](this,t);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let n=0,s=this.targetChangeHandlerKeys_.length;n<s;++n)Mt(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(ht.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(ht.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,jc(this.viewport_)}if(this.targetElement_){this.resizeObserver_.unobserve(this.targetElement_);const n=this.targetElement_.getRootNode();n instanceof ShadowRoot&&this.resizeObserver_.unobserve(n.host),this.setSize(void 0)}const t=this.getTarget(),e=typeof t=="string"?document.getElementById(t):t;if(this.targetElement_=e,!e)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new c_(this)),this.mapBrowserEventHandler_=new h_(this,this.moveTolerance_);for(const o in zt)this.mapBrowserEventHandler_.addEventListener(zt[o],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(ht.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(ht.WHEEL,this.boundHandleBrowserEvent_,ou?{passive:!1}:!1);const n=this.keyboardEventTarget_?this.keyboardEventTarget_:e;this.targetChangeHandlerKeys_=[Ct(n,ht.KEYDOWN,this.handleBrowserEvent,this),Ct(n,ht.KEYPRESS,this.handleBrowserEvent,this)];const s=e.getRootNode();s instanceof ShadowRoot&&this.resizeObserver_.observe(s.host),this.resizeObserver_.observe(e)}this.updateSize()}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(Mt(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(Mt(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(),this.viewPropertyListenerKey_=Ct(t,cs.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=Ct(t,ht.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(Mt),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new nn("addlayer",t)),this.layerGroupPropertyListenerKeys_=[Ct(t,cs.PROPERTYCHANGE,this.render,this),Ct(t,ht.CHANGE,this.render,this),Ct(t,"addlayer",this.handleLayerAdd_,this),Ct(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,n=t.length;e<n;++e){const s=t[e].layer;s.hasRenderer()&&s.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}flushDeclutterItems(){const t=this.frameState_;t&&this.renderer_.flushDeclutterItems(t)}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){Yd(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),n=this.getView(),s=this.frameState_;let o=null;if(e!==void 0&&Yu(e)&&n&&n.isDef()){const r=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(o={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutterTree:null,extent:vc(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:r,wantedTiles:{},mapId:St(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const c=isNaN(a.nextRotation)?a.rotation:a.nextRotation;o.nextExtent=vc(a.nextCenter,a.nextResolution,c,e)}}this.frameState_=o,this.renderer_.renderFrame(o),o&&(o.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,o.postRenderFunctions),s&&(!this.previousExtent_||!Xi(this.previousExtent_)&&!Yi(o.extent,this.previousExtent_))&&(this.dispatchEvent(new bs(rn.MOVESTART,this,s)),this.previousExtent_=oo(this.previousExtent_)),this.previousExtent_&&!o.viewHints[Vt.ANIMATING]&&!o.viewHints[Vt.INTERACTING]&&!Yi(o.extent,this.previousExtent_)&&(this.dispatchEvent(new bs(rn.MOVEEND,this,o)),cu(o.extent,this.previousExtent_))),this.dispatchEvent(new bs(rn.POSTRENDER,this,o)),this.renderComplete_=this.hasListener(rn.LOADSTART)||this.hasListener(rn.LOADEND)||this.hasListener(ti.RENDERCOMPLETE)?!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady():void 0,this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new nn("removelayer",e)),this.set(ee.LAYERGROUP,t)}setSize(t){this.set(ee.SIZE,t)}setTarget(t){this.set(ee.TARGET,t)}setView(t){if(!t||t instanceof ni){this.set(ee.VIEW,t);return}this.set(ee.VIEW,new ni);const e=this;t.then(function(n){e.setView(new ni(n))})}updateSize(){const t=this.getTargetElement();let e;if(t){const s=getComputedStyle(t),o=t.offsetWidth-parseFloat(s.borderLeftWidth)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)-parseFloat(s.borderRightWidth),r=t.offsetHeight-parseFloat(s.borderTopWidth)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)-parseFloat(s.borderBottomWidth);!isNaN(o)&&!isNaN(r)&&(e=[o,r],!Yu(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&yu("No map visible because the map container's width or height are 0."))}const n=this.getSize();e&&(!n||!Bi(e,n))&&(this.setSize(e),this.updateViewportSize_())}updateViewportSize_(){const t=this.getView();if(t){let e;const n=getComputedStyle(this.viewport_);n.width&&n.height&&(e=[parseInt(n.width,10),parseInt(n.height,10)]),t.setViewportSize(e)}}};function F_(i){let t=null;i.keyboardEventTarget!==void 0&&(t=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);const e={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new sn({layers:i.layers});e[ee.LAYERGROUP]=n,e[ee.TARGET]=i.target,e[ee.VIEW]=i.view instanceof ni?i.view:new ni;let s;i.controls!==void 0&&(Array.isArray(i.controls)?s=new Qe(i.controls.slice()):(pt(typeof i.controls.getArray=="function",47),s=i.controls));let o;i.interactions!==void 0&&(Array.isArray(i.interactions)?o=new Qe(i.interactions.slice()):(pt(typeof i.interactions.getArray=="function",48),o=i.interactions));let r;return i.overlays!==void 0?Array.isArray(i.overlays)?r=new Qe(i.overlays.slice()):(pt(typeof i.overlays.getArray=="function",49),r=i.overlays):r=new Qe,{controls:s,interactions:o,keyboardEventTarget:t,overlays:r,values:e}}class L_{constructor(t){this.highWaterMark=t!==void 0?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const n=this.entries_[t];return pt(n!==void 0,15),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(t){const e=this.entries_[t];return pt(e!==void 0,15),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e=0,n;for(n=this.newest_;n;n=n.older)t[e++]=n.key_;return t}getValues(){const t=new Array(this.count_);let e=0,n;for(n=this.newest_;n;n=n.older)t[e++]=n.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){if(this.containsKey(t))return this.entries_[t].value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){pt(!(t in this.entries_),16);const n={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[t]=n,++this.count_}setSize(t){this.highWaterMark=t}}function Xd(i,t,e,n){return n!==void 0?(n[0]=i,n[1]=t,n[2]=e,n):[i,t,e]}function na(i,t,e){return i+"/"+t+"/"+e}function $d(i){return na(i[0],i[1],i[2])}function z_(i){return i.split("/").map(Number)}function Zd(i){return(i[1]<<i[0])+i[2]}function N_(i,t){const e=i[0],n=i[1],s=i[2];if(t.getMinZoom()>e||e>t.getMaxZoom())return!1;const o=t.getFullTileRange(e);return o?o.containsXY(n,s):!0}class Kd extends L_{clear(){for(;this.getCount()>0;)this.pop().release();super.clear()}expireCache(t){for(;this.canExpireCache()&&!(this.peekLast().getKey()in t);)this.pop().release()}pruneExceptNewestZ(){if(this.getCount()===0)return;const t=this.peekFirstKey(),n=z_(t)[0];this.forEach(s=>{s.tileCoord[0]!==n&&(this.remove($d(s.tileCoord)),s.release())})}}class ph{constructor(t,e,n,s){this.minX=t,this.maxX=e,this.minY=n,this.maxY=s}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function xs(i,t,e,n,s){return s!==void 0?(s.minX=i,s.maxX=t,s.minY=e,s.maxY=n,s):new ph(i,t,e,n)}async function Qd(i,t=128,e=128,n="map",s=1){return new Promise((o,r)=>{i.once("rendercomplete",()=>{try{const a=i.getSize()||[t,e],c=document.createElement("canvas"),h=a[0]*s,l=a[1]*s;c.width=h,c.height=l;const u=c.getContext("2d",{willReadFrequently:!0});if(!u)throw new Error("Failed to create canvas context");Array.from(i.getViewport().querySelectorAll(".ol-layer canvas, canvas.ol-layer")).filter(_=>{if(!(_ instanceof HTMLCanvasElement)||_.width===0)return!1;try{return _.toDataURL("image/png"),!0}catch{return console.warn("跳过跨域图层:",_),!1}}).forEach(_=>{var b;const y=parseFloat(_.style.opacity||"1");u.globalAlpha=y;let w=[1,0,0,1,0,0];const E=_.style.transform;if(E){const[P,I,M,D,L,z]=((b=E.match(/^matrix\(([^)]+)\)$/))==null?void 0:b[1].split(",").map(Number))||[1,0,0,1,0,0];u.setTransform({a:P,b:I,c:M,d:D,e:L,f:z})}u.drawImage(_,0,0,h,l)}),u.globalAlpha=1,u.setTransform(1,0,0,1,0,0);const g=c.toDataURL("image/png");o(g)}catch(a){r(a)}}),i.renderSync()})}function Jd(i,t){const{center:e,orbitPeriod:n,heading:s=0}=t,o=i.getView(),a=(d=>d*Math.PI/180)(s);let c,h,l=!0;const u=d=>{h||(h=d);const _=(d-h)%n/n,y=2*Math.PI*_+a;o.setRotation(-y),i.render(),l&&(c=requestAnimationFrame(u))};return c=requestAnimationFrame(u),{stop(){l=!1,cancelAnimationFrame(c),o.setRotation(0)}}}function U_(i,t){const e=yt(t),n=new Je({geometry:new Ge(e)});n.setStyle(new Xt({image:new ii({radius:6,fill:new de({color:"red"}),stroke:new Se({color:"white",width:2})}),text:new _o({text:"中心点可视化-测试后删除",font:"14px sans-serif",fill:new de({color:"black"}),stroke:new Se({color:"white",width:3}),offsetY:-15})}));const s=new oi({source:new Si({features:[n]})});i.addLayer(s)}class tf extends f.Destroyable{constructor(e,n,s){super();R(this,"keysPressed",{w:!1,a:!1,s:!1,d:!1});R(this,"animationId",0);R(this,"view");R(this,"updatePosition",()=>{const e=this.view.getCenter();if(!e)return;const n=this.view.getZoom()??10,s=1e3/Math.pow(2,n-10);let[o,r]=e;this.keysPressed.w&&(r+=s),this.keysPressed.s&&(r-=s),this.keysPressed.a&&(o-=s),this.keysPressed.d&&(o+=s),this.view.setCenter([o,r]),this.animationId=requestAnimationFrame(this.updatePosition)});this.map=n,this.view=n.getView(),this.view.setCenter(yt(s));const o=c=>{c.key in this.keysPressed&&(this.keysPressed[c.key]=!0)},r=c=>{c.key in this.keysPressed&&(this.keysPressed[c.key]=!1)},a=c=>{c.preventDefault();const h=this.view.getZoom()??10,l=c.deltaY>0?-1:1;this.view.setZoom(h+l)};e.addEventListener("keydown",o),e.addEventListener("keyup",r),n.getTargetElement().addEventListener("wheel",a,{passive:!1}),this.d(()=>e.removeEventListener("keydown",o)),this.d(()=>e.removeEventListener("keyup",r)),this.d(()=>n.getTargetElement().removeEventListener("wheel",a)),this.animationId=requestAnimationFrame(this.updatePosition),this.d(()=>cancelAnimationFrame(this.animationId))}}function j_(i){const e=Math.PI/3,n=256,s=i*2*Math.tan(e/2)/i,o=Math.log2(2*Math.PI*6378137/(s*n));return parseFloat(o.toFixed(3))}function Io(i){return 6378137/Math.pow(2,i-5)}function kn(i){const e=Math.log2(6378137/i)+5+0;return Math.min(28,Math.max(0,e))}class ef extends f.Destroyable{constructor(e){super();R(this,"lastTime",performance.now());R(this,"frameCount",0);R(this,"currentFPS",0);R(this,"map");R(this,"calculateFPS",()=>{const e=performance.now();this.frameCount++,e-this.lastTime>=1e3&&(this.currentFPS=Math.round(this.frameCount*1e3/(e-this.lastTime)),this.frameCount=0,this.lastTime=e)});this.map=e,this.map.on("postrender",this.calculateFPS),this.d(()=>{this.map.un("postrender",this.calculateFPS)})}getFPS(){return this.currentFPS}}const nf=[0,-90,0];function sf(i,t){const e=i.viewer;if(!e)return;const n=e.getView(),{position:s,rotation:o,duration:r=1e3,hdelta:a,pdelta:c,cancelCallback:h}=t;if(!s)return;const[l,u,d]=s,g=yt([l,u]),_=(kn==null?void 0:kn(d))??n.getZoom(),w=(((o==null?void 0:o[0])??0)+(a??0))*Math.PI/180,E={center:g,zoom:_,rotation:-w,duration:r};try{return n.animate(E,()=>{}),Promise.resolve(!0)}catch{return h==null||h(),Promise.resolve(!1)}}function Ri(i,t,e,n,s,o){return(i==null?void 0:i.viewer)&&sf(i,{position:t,rotation:n,duration:s&&s*1e3,cancelCallback:o})}function sa(i){const t=i.map(e=>yt([e[0],e[1]]));return Ir(t)}const To=(i,t,e=1,n=350)=>{i.getView().fit(t,{duration:e*1e3,padding:Array.isArray(n)?n:[n,n,n,n]})},k_=(i,t,e=1,n=350)=>{const s=sa(t);To(i,s,e,n)},mh=(i,t,e=1,n=350)=>{const s=yt([t[0],t[1]]),o=Ir([s]);To(i,o,e,n)},W_=(i,t,e)=>{};function of(i,t){const e=i.viewer;if(!e)throw new Error("viewer.map is undefined");const n=e.getView(),s=n.getCenter();if(!s)throw new Error("view center is undefined");const o=n.getZoom(),r=(Io==null?void 0:Io(o??0))??0;return[s[0],s[1],r]}class q_ extends f.Destroyable{constructor(e,n){super();R(this,"_map");R(this,"_view");R(this,"_enabled",!0);R(this,"_keys",[]);R(this,"_changed",new f.Event);R(this,"_options");R(this,"_rafPending",!1);R(this,"_rafId",null);R(this,"_lastEmit",0);if(this._options={emitImmediately:!0,usePostRender:!1,throttleMs:0,useRaf:!0,...n},e instanceof Rn.Map){this._map=e;const s=this._map.getView();if(!s)throw new Error("OlViewChanged: map.getView() is undefined");this._view=s}else this._view=e;this._attach(),this.dispose(()=>this._detach()),this._options.emitImmediately&&this._emit()}get changed(){return this._changed}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,e&&this._emit())}attachMap(e){this._map!==e&&(this._detach(),this._map=e,this._attach(),this._emit())}_on(e,n,s){const o=e.on(n,s);return this._keys.push(o),this.dispose(()=>gi(o)),o}_attach(){this._on(this._view,"change:center",()=>this._scheduleEmit()),this._on(this._view,"change:resolution",()=>this._scheduleEmit()),this._on(this._view,"change:rotation",()=>this._scheduleEmit()),this._map&&(this._on(this._map,"change:size",()=>this._scheduleEmit()),this._options.usePostRender&&this._on(this._map,"postrender",()=>this._scheduleEmit()))}_detach(){this._keys.forEach(gi),this._keys.length=0,this._rafId!=null&&(cancelAnimationFrame(this._rafId),this._rafId=null,this._rafPending=!1)}_scheduleEmit(){if(this._enabled){if(this._options.useRaf){if(this._rafPending)return;this._rafPending=!0,this._rafId=requestAnimationFrame(()=>{this._rafPending=!1,this._rafId=null,this._emitWithThrottle()});return}this._emitWithThrottle()}}_emitWithThrottle(){const e=performance.now();this._options.throttleMs>0&&e-this._lastEmit<this._options.throttleMs||(this._lastEmit=e,this._emit())}_emit(){this._enabled&&this._changed.emit()}}async function rf(i,t,e,n){if(!i)throw new Error("olMap is undefined");await Promise.resolve();const s=i.getEventPixel(t);if(!s)return;const o=i.getCoordinateFromPixel(s);if(!o)return;const[r,a]=Kt(o),c=e??0;return n?(n[0]=r,n[1]=a,n[2]=c,n):[r,a,c]}function af(i,t,e,n,s,o){s.constraintMode="none",s.startDragPos=[0,0,0];const r=t.getEventPixel(i),a=t.getCoordinateFromPixel(r);if(!a)return!1;const c=Kt(a),h=[c[0],c[1],e.position[2]],l=e.position,u=e.heading,d=G_(t,n,l),g=(_,y)=>{const w=B_(l,h,_),E=f.geoRhumbDistance(l,h);if(w>.98&&E<d&&!(o!=null&&o[y])){s.constraintMode=y;const b=f.geoRhumbDestination(l,E,_);if(b)return s.startDragPos=[b[0],b[1],l[2]],!0}return!1};return g(u+90,"x")||g(u,"y")?!0:!(o!=null&&o.xy)&&f.geoRhumbDistance(l,h)<d?(s.constraintMode="xy",s.startDragPos=h,!0):!1}function G_(i,t,e){const n=i.getPixelFromCoordinate(yt([e[0],e[1]])),s=[n[0]+t,n[1]],o=Kt(i.getCoordinateFromPixel(s));return f.geoRhumbDistance([e[0],e[1],0],[o[0],o[1],0])}function B_(i,t,e){const n=f.geoRhumbHeading(i,t),s=e*Math.PI/180,o=n*Math.PI/180;return Math.cos(s)*Math.cos(o)+Math.sin(s)*Math.sin(o)}function an(i,t,e,n){const s=f.geoRhumbDistance(i,e),o=f.geoRhumbHeading(i,e),r=Math.cos(o*Math.PI/180)*Math.cos(t*Math.PI/180)+Math.sin(o*Math.PI/180)*Math.sin(t*Math.PI/180);return r>0?f.geoRhumbDestination(i,s,t,n):f.geoRhumbDestination(i,s,t+180,n),[r>0?s:-s,n]}function V_(i,t,e){const n=e*.1,s=[];for(let o=-9;o<10;++o){const r=f.geoRhumbDestination(i,n*o,t);r&&s.push(r)}return s}function Y_(i,t){return f.geoNearestPointOnLine(i,t).geometry.coordinates}function H_(i,t,e,n=10){const s={constraintMode:"none",startDragPos:[0,0,0]},o=i.getPixelFromCoordinate(yt([e.position[0],e.position[1]])),r=i.getEventPixel(t),a=r[0]-o[0],c=r[1]-o[1],l=(Math.atan2(-c,a)*(180/Math.PI)-e.heading+360)%360;Math.abs(a)<n&&Math.abs(c)<n?s.constraintMode="xy":l>=75&&l<=105||l>=255&&l<=285?s.constraintMode="y":l<=15||l>=345||l>=165&&l<=195?s.constraintMode="x":s.constraintMode="xy";const[u,d]=Kt(i.getCoordinateFromPixel(r));return s.startDragPos=[u,d,e.position[2]],s}function X_(i,t,e){const n=i.getPixelFromCoordinate(t),s=[n[0]+e,n[1]],o=i.getCoordinateFromPixel(s);if(!o)return 1/0;const[r,a]=Kt(o),[c,h]=Kt(t);return Math.abs(f.geoRhumbDistance([c,h,0],[r,a,0]))}function cf(i,t,e,n,s,o){const r=s-e,a=o-n,c=i-e,h=t-n,l=r*c+a*h;if(l<=0)return Math.hypot(i-e,t-n);const u=r*r+a*a;if(u<=l)return Math.hypot(i-s,t-o);const d=l/u,g=e+d*r,_=n+d*a;return Math.hypot(i-g,t-_)}function hf(i,t,e,n=8,s,o){const r=s??{constraintMode:"none",startDragPos:[0,0,0]};r.constraintMode="none",r.startDragPos=[0,0,0];const a=yt([e.position[0],e.position[1]]),c=i.getPixelFromCoordinate(a);if(!c)return r;const h=i.getEventPixel(t),[l,u]=h,d=Math.max(1e-6,e.dimensions[0]),g=e.heading,_=f.geoRhumbDestination(e.position,d,g+90),y=f.geoRhumbDestination(e.position,d,g+0);if(!_||!y)return r;const w=a,E=a,b=yt([_[0],_[1]]),P=yt([y[0],y[1]]),I=i.getPixelFromCoordinate(w),M=i.getPixelFromCoordinate(b),D=i.getPixelFromCoordinate(E),L=i.getPixelFromCoordinate(P),z=X_(i,a,n),Y=Math.hypot(l-c[0],u-c[1])<=n,X=cf(l,u,I[0],I[1],M[0],M[1]),Q=cf(l,u,D[0],D[1],L[0],L[1]);if(!(o!=null&&o.zAxis)){const S=d,A=f.geoRhumbDestination(e.position,S,g);if(!A)return r;const F=i.getPixelFromCoordinate(yt([A[0],A[1]]));Math.hypot(F[0]-c[0],F[1]-c[1])}let m="none";!(o!=null&&o.x)&&X<=n&&X<Q&&(m="x"),!(o!=null&&o.y)&&Q<=n&&Q<X&&(m="y");const v=Kt(i.getCoordinateFromPixel(h));if(m==="x"||m==="y"){const S=m==="x"?g+90:g+0,[A,F]=an(e.position,S,[v[0],v[1],e.position[2]]);if(A>0&&F&&f.geoDistance(F,[v[0],v[1],e.position[2]])<=z)return r.constraintMode=m,r.startDragPos=[F[0],F[1],e.position[2]],r}return!(o!=null&&o.xy)&&(Y||!0)&&(r.constraintMode="xy",r.startDragPos=[v[0],v[1],e.position[2]]),r}class lf extends f.Destroyable{constructor(t,e,n,s=100){super();const o=t.getView(),[r,a]=f.getReactFuncs(n),c=()=>{const l=o.getZoom()??0,u=s*Math.pow(2,10-l);a([u,u,u])};c();const h=()=>c();o.on("change:resolution",h),this.ad(()=>o.un("change:resolution",h))}}function C(i){return i!=null}function j(i){this.name="DeveloperError",this.message=i;let t;try{throw new Error}catch(e){t=e.stack}this.stack=t}C(Object.create)&&(j.prototype=Object.create(Error.prototype),j.prototype.constructor=j),j.prototype.toString=function(){let i=`${this.name}: ${this.message}`;return C(this.stack)&&(i+=`
|
|
29
|
+
`){v+=m,m=0,Y=d*I+q*g,++A;continue}const Z=_[N+1]||c.font;Z!==F&&(s&&X.push("font",Z),n&&Q.push("font",Z),F=Z),m=Math.max(m,b[S]);const V=[B,Y+q*E[S]+d*(E[S]-P[A]),.5*(g+m)+v];Y+=E[S],s&&X.push("strokeText",V),n&&Q.push("fillText",V),++S}return Array.prototype.push.apply(M,X),Array.prototype.push.apply(M,Q),this.labels_[o]=z,z}replayTextBackground_(t,e,n,s,o,r,a){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,n),t.lineTo.apply(t,s),t.lineTo.apply(t,o),t.lineTo.apply(t,e),r&&(this.alignFill_=r[2],this.fill_(t)),a&&(this.setStrokeStyle_(t,a),t.stroke())}calculateImageOrLabelDimensions_(t,e,n,s,o,r,a,c,h,l,u,d,g,_,y,w){a*=d[0],c*=d[1];let E=n-a,b=s-c;const P=o+h>t?t-h:o,I=r+l>e?e-l:r,M=_[3]+P*d[0]+_[1],D=_[0]+I*d[1]+_[2],L=E-_[3],z=b-_[0];(y||u!==0)&&(Ji[0]=L,tn[0]=L,Ji[1]=z,bi[1]=z,bi[0]=L+M,xi[0]=bi[0],xi[1]=z+D,tn[1]=xi[1]);let q;return u!==0?(q=qe(be(),n,s,1,1,u,-n,-s),Ut(q,Ji),Ut(q,bi),Ut(q,xi),Ut(q,tn),pi(Math.min(Ji[0],bi[0],xi[0],tn[0]),Math.min(Ji[1],bi[1],xi[1],tn[1]),Math.max(Ji[0],bi[0],xi[0],tn[0]),Math.max(Ji[1],bi[1],xi[1],tn[1]),Cs)):pi(Math.min(L,L+M),Math.min(z,z+D),Math.max(L,L+M),Math.max(z,z+D),Cs),g&&(E=Math.round(E),b=Math.round(b)),{drawImageX:E,drawImageY:b,drawImageW:P,drawImageH:I,originX:h,originY:l,declutterBox:{minX:Cs[0],minY:Cs[1],maxX:Cs[2],maxY:Cs[3],value:w},canvasTransform:q,scale:d}}replayImageOrLabel_(t,e,n,s,o,r,a){const c=!!(r||a),h=s.declutterBox,l=t.canvas,u=a?a[2]*s.scale[0]/2:0;return h.minX-u<=l.width/e&&h.maxX+u>=0&&h.minY-u<=l.height/e&&h.maxY+u>=0&&(c&&this.replayTextBackground_(t,Ji,bi,xi,tn,r,a),i0(t,s.canvasTransform,o,n,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(t){if(this.alignFill_){const e=Ut(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(e[0]%n,e[1]%n),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6])}drawLabelWithPointPlacement_(t,e,n,s){const o=this.textStates[e],r=this.createLabel(t,e,s,n),a=this.strokeStates[n],c=this.pixelRatio,h=nh(Array.isArray(t)?t[0]:t,o.textAlign||go),l=ta[o.textBaseline||Hr],u=a&&a.lineWidth?a.lineWidth:0,d=r.width/c-2*o.scale[0],g=h*d+2*(.5-h)*u,_=l*r.height/c+2*(.5-l)*u;return{label:r,anchorX:g,anchorY:_}}execute_(t,e,n,s,o,r,a,c){let h;this.pixelCoordinates_&&Bi(n,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=yi(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),$p(this.renderedTransform_,n));let l=0;const u=s.length;let d=0,g,_,y,w,E,b,P,I,M,D,L,z,q=0,Y=0,X=null,Q=null;const m=this.coordinateCache_,v=this.viewRotation_,S=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,A={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:v},F=this.instructions!=s||this.overlaps?0:200;let N,G,B,Z;for(;l<u;){const V=s[l];switch(V[0]){case st.BEGIN_GEOMETRY:N=V[1],Z=V[3],N.getGeometry()?a!==void 0&&!te(a,Z.getExtent())?l=V[2]+1:++l:l=V[2];break;case st.BEGIN_PATH:q>F&&(this.fill_(t),q=0),Y>F&&(t.stroke(),Y=0),!q&&!Y&&(t.beginPath(),w=NaN,E=NaN),++l;break;case st.CIRCLE:d=V[1];const et=h[d],it=h[d+1],gt=h[d+2],wt=h[d+3],dt=gt-et,Et=wt-it,ft=Math.sqrt(dt*dt+Et*Et);t.moveTo(et+ft,it),t.arc(et,it,ft,0,2*Math.PI,!0),++l;break;case st.CLOSE_PATH:t.closePath(),++l;break;case st.CUSTOM:d=V[1],g=V[2];const xt=V[3],Ft=V[4],kt=V.length==6?V[5]:void 0;A.geometry=xt,A.feature=N,l in m||(m[l]=[]);const Wt=m[l];kt?kt(h,d,g,2,Wt):(Wt[0]=h[d],Wt[1]=h[d+1],Wt.length=2),Ft(Wt,A),++l;break;case st.DRAW_IMAGE:d=V[1],g=V[2],I=V[3],_=V[4],y=V[5];let he=V[6];const ye=V[7],ns=V[8],we=V[9],En=V[10];let Cn=V[11];const bn=V[12];let ae=V[13];const ve=V[14],Oe=V[15];if(!I&&V.length>=20){M=V[19],D=V[20],L=V[21],z=V[22];const $t=this.drawLabelWithPointPlacement_(M,D,L,z);I=$t.label,V[3]=I;const Zs=V[23];_=($t.anchorX-Zs)*this.pixelRatio,V[4]=_;const je=V[24];y=($t.anchorY-je)*this.pixelRatio,V[5]=y,he=I.height,V[6]=he,ae=I.width,V[13]=ae}let Ne;V.length>25&&(Ne=V[25]);let ki,fi,Rt;V.length>17?(ki=V[16],fi=V[17],Rt=V[18]):(ki=Nn,fi=!1,Rt=!1),En&&S?Cn+=v:!En&&!S&&(Cn-=v);let Ee=0;for(;d<g;d+=2){if(Ne&&Ne[Ee++]<ae/this.pixelRatio)continue;const $t=this.calculateImageOrLabelDimensions_(I.width,I.height,h[d],h[d+1],ae,he,_,y,ns,we,Cn,bn,o,ki,fi||Rt,N),Zs=[t,e,I,$t,ye,fi?X:null,Rt?Q:null];if(c){if(ve==="none")continue;if(ve==="obstacle"){c.insert($t.declutterBox);continue}else{let je,qi;if(Oe){const Ie=g-d;if(!Oe[Ie]){Oe[Ie]=Zs;continue}if(je=Oe[Ie],delete Oe[Ie],qi=Cd(je),c.collides(qi))continue}if(c.collides($t.declutterBox))continue;je&&(c.insert(qi),this.replayImageOrLabel_.apply(this,je)),c.insert($t.declutterBox)}}this.replayImageOrLabel_.apply(this,Zs)}++l;break;case st.DRAW_CHARS:const Ze=V[1],At=V[2],Ue=V[3],lc=V[4];z=V[5];const uc=V[6],Er=V[7],Wi=V[8];L=V[9];const Cr=V[10];M=V[11],D=V[12];const dc=[V[13],V[13]],br=this.textStates[D],ss=br.font,os=[br.scale[0]*Er,br.scale[1]*Er];let rs;ss in this.widths_?rs=this.widths_[ss]:(rs={},this.widths_[ss]=rs);const xn=Bu(h,Ze,At,2),Sn=Math.abs(os[0])*nd(ss,M,rs);if(lc||Sn<=xn){const $t=this.textStates[D].textAlign,Zs=(xn-Sn)*nh(M,$t),je=U0(h,Ze,At,2,M,Zs,uc,Math.abs(os[0]),nd,ss,rs,S?0:this.viewRotation_);t:if(je){const qi=[];let Ie,fc,gc,Ce,ke;if(L)for(Ie=0,fc=je.length;Ie<fc;++Ie){ke=je[Ie],gc=ke[4],Ce=this.createLabel(gc,D,"",L),_=ke[2]+(os[0]<0?-Cr:Cr),y=Ue*Ce.height+(.5-Ue)*2*Cr*os[1]/os[0]-Wi;const Gi=this.calculateImageOrLabelDimensions_(Ce.width,Ce.height,ke[0],ke[1],Ce.width,Ce.height,_,y,0,0,ke[3],dc,!1,Nn,!1,N);if(c&&c.collides(Gi.declutterBox))break t;qi.push([t,e,Ce,Gi,1,null,null])}if(z)for(Ie=0,fc=je.length;Ie<fc;++Ie){ke=je[Ie],gc=ke[4],Ce=this.createLabel(gc,D,z,""),_=ke[2],y=Ue*Ce.height-Wi;const Gi=this.calculateImageOrLabelDimensions_(Ce.width,Ce.height,ke[0],ke[1],Ce.width,Ce.height,_,y,0,0,ke[3],dc,!1,Nn,!1,N);if(c&&c.collides(Gi.declutterBox))break t;qi.push([t,e,Ce,Gi,1,null,null])}c&&c.load(qi.map(Cd));for(let Gi=0,pE=qi.length;Gi<pE;++Gi)this.replayImageOrLabel_.apply(this,qi[Gi])}}++l;break;case st.END_GEOMETRY:if(r!==void 0){N=V[1];const $t=r(N,Z);if($t)return $t}++l;break;case st.FILL:F?q++:this.fill_(t),++l;break;case st.MOVE_TO_LINE_TO:for(d=V[1],g=V[2],G=h[d],B=h[d+1],b=G+.5|0,P=B+.5|0,(b!==w||P!==E)&&(t.moveTo(G,B),w=b,E=P),d+=2;d<g;d+=2)G=h[d],B=h[d+1],b=G+.5|0,P=B+.5|0,(d==g-2||b!==w||P!==E)&&(t.lineTo(G,B),w=b,E=P);++l;break;case st.SET_FILL_STYLE:X=V,this.alignFill_=V[2],q&&(this.fill_(t),q=0,Y&&(t.stroke(),Y=0)),t.fillStyle=V[1],++l;break;case st.SET_STROKE_STYLE:Q=V,Y&&(t.stroke(),Y=0),this.setStrokeStyle_(t,V),++l;break;case st.STROKE:F?Y++:t.stroke(),++l;break;default:++l;break}}q&&this.fill_(t),Y&&t.stroke()}execute(t,e,n,s,o,r){this.viewRotation_=s,this.execute_(t,e,n,this.instructions,o,void 0,void 0,r)}executeHitDetection(t,e,n,s,o){return this.viewRotation_=n,this.execute_(t,1,e,this.hitDetectionInstructions,!0,s,o)}}const sh=["Polygon","Circle","LineString","Image","Text","Default"];class xd{constructor(t,e,n,s,o,r){this.maxExtent_=t,this.overlaps_=s,this.pixelRatio_=n,this.resolution_=e,this.renderBuffer_=r,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=be(),this.createExecutors_(o)}clip(t,e){const n=this.getClipCoords(e);t.beginPath(),t.moveTo(n[0],n[1]),t.lineTo(n[2],n[3]),t.lineTo(n[4],n[5]),t.lineTo(n[6],n[7]),t.clip()}createExecutors_(t){for(const e in t){let n=this.executorsByZIndex_[e];n===void 0&&(n={},this.executorsByZIndex_[e]=n);const s=t[e];for(const o in s){const r=s[o];n[o]=new k0(this.resolution_,this.pixelRatio_,this.overlaps_,r)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const n=this.executorsByZIndex_[e];for(let s=0,o=t.length;s<o;++s)if(t[s]in n)return!0}return!1}forEachFeatureAtCoordinate(t,e,n,s,o,r){s=Math.round(s);const a=s*2+1,c=qe(this.hitDetectionTransform_,s+.5,s+.5,1/e,-1/e,-n,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=Bt(a,a,void 0,{willReadFrequently:!0}));const l=this.hitDetectionContext_;l.canvas.width!==a||l.canvas.height!==a?(l.canvas.width=a,l.canvas.height=a):h||l.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=Te(),ro(u,t),io(u,e*(this.renderBuffer_+s),u));const d=W0(s);let g;function _(M,D){const L=l.getImageData(0,0,a,a).data;for(let z=0,q=d.length;z<q;z++)if(L[d[z]]>0){if(!r||g!=="Image"&&g!=="Text"||r.includes(M)){const Y=(d[z]-3)/4,X=s-Y%a,Q=s-(Y/a|0),m=o(M,D,X*X+Q*Q);if(m)return m}l.clearRect(0,0,a,a);break}}const y=Object.keys(this.executorsByZIndex_).map(Number);y.sort(On);let w,E,b,P,I;for(w=y.length-1;w>=0;--w){const M=y[w].toString();for(b=this.executorsByZIndex_[M],E=sh.length-1;E>=0;--E)if(g=sh[E],P=b[g],P!==void 0&&(I=P.executeHitDetection(l,c,n,_,u),I))return I}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const n=e[0],s=e[1],o=e[2],r=e[3],a=[n,s,n,r,o,r,o,s];return yi(a,0,8,2,t,a),a}isEmpty(){return Js(this.executorsByZIndex_)}execute(t,e,n,s,o,r,a){const c=Object.keys(this.executorsByZIndex_).map(Number);c.sort(On),this.maxExtent_&&(t.save(),this.clip(t,n)),r=r||sh;let h,l,u,d,g,_;for(a&&c.reverse(),h=0,l=c.length;h<l;++h){const y=c[h].toString();for(g=this.executorsByZIndex_[y],u=0,d=r.length;u<d;++u){const w=r[u];_=g[w],_!==void 0&&_.execute(t,e,n,s,o,a)}}this.maxExtent_&&t.restore()}}const oh={};function W0(i){if(oh[i]!==void 0)return oh[i];const t=i*2+1,e=i*i,n=new Array(e+1);for(let o=0;o<=i;++o)for(let r=0;r<=i;++r){const a=o*o+r*r;if(a>e)break;let c=n[a];c||(c=[],n[a]=c),c.push(((i+o)*t+(i+r))*4+3),o>0&&c.push(((i-o)*t+(i+r))*4+3),r>0&&(c.push(((i+o)*t+(i-r))*4+3),o>0&&c.push(((i-o)*t+(i-r))*4+3))}const s=[];for(let o=0,r=n.length;o<r;++o)n[o]&&s.push(...n[o]);return oh[i]=s,s}class Sd extends _d{constructor(t,e,n,s,o,r,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=n,this.transform_=s,this.transformRotation_=s?Sc(Math.atan2(s[1],s[0]),10):0,this.viewRotation_=o,this.squaredTolerance_=r,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=be()}drawImages_(t,e,n,s){if(!this.image_)return;const o=yi(t,e,n,s,this.transform_,this.pixelCoordinates_),r=this.context_,a=this.tmpLocalTransform_,c=r.globalAlpha;this.imageOpacity_!=1&&(r.globalAlpha=c*this.imageOpacity_);let h=this.imageRotation_;this.transformRotation_===0&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let l=0,u=o.length;l<u;l+=2){const d=o[l]-this.imageAnchorX_,g=o[l+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const _=d+this.imageAnchorX_,y=g+this.imageAnchorY_;qe(a,_,y,1,1,h,-_,-y),r.setTransform.apply(r,a),r.translate(_,y),r.scale(this.imageScale_[0],this.imageScale_[1]),r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),r.setTransform(1,0,0,1,0,0)}else r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,g,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(r.globalAlpha=c)}drawText_(t,e,n,s){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const o=yi(t,e,n,s,this.transform_,this.pixelCoordinates_),r=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);e<n;e+=s){const c=o[e]+this.textOffsetX_,h=o[e+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(r.translate(c-this.textOffsetX_,h-this.textOffsetY_),r.rotate(a),r.translate(this.textOffsetX_,this.textOffsetY_),r.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&r.strokeText(this.text_,0,0),this.textFillState_&&r.fillText(this.text_,0,0),r.setTransform(1,0,0,1,0,0)):(this.textStrokeState_&&r.strokeText(this.text_,c,h),this.textFillState_&&r.fillText(this.text_,c,h))}}moveToLineTo_(t,e,n,s,o){const r=this.context_,a=yi(t,e,n,s,this.transform_,this.pixelCoordinates_);r.moveTo(a[0],a[1]);let c=a.length;o&&(c-=2);for(let h=2;h<c;h+=2)r.lineTo(a[h],a[h+1]);return o&&r.closePath(),n}drawRings_(t,e,n,s){for(let o=0,r=n.length;o<r;++o)e=this.moveToLineTo_(t,e,n[o],s,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!te(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=Am(t,this.transform_,this.pixelCoordinates_),n=e[2]-e[0],s=e[3]-e[1],o=Math.sqrt(n*n+s*s),r=this.context_;r.beginPath(),r.arc(e[0],e[1],o,0,2*Math.PI),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}this.text_!==""&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t);break}}drawFeature(t,e){const n=e.getGeometryFunction()(t);n&&(this.setStyle(e),this.drawGeometry(n))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let n=0,s=e.length;n<s;++n)this.drawGeometry(e[n])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),n=t.getStride();this.image_&&this.drawImages_(e,0,e.length,n),this.text_!==""&&this.drawText_(e,0,e.length,n)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),n=t.getStride();this.image_&&this.drawImages_(e,0,e.length,n),this.text_!==""&&this.drawText_(e,0,e.length,n)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!te(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,n=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(n,0,n.length,t.getStride(),!1),e.stroke()}if(this.text_!==""){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(te(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const n=this.context_,s=t.getFlatCoordinates();let o=0;const r=t.getEnds(),a=t.getStride();n.beginPath();for(let c=0,h=r.length;c<h;++c)o=this.moveToLineTo_(s,o,r[c],a,!1);n.stroke()}if(this.text_!==""){const n=t.getFlatMidpoints();this.drawText_(n,0,n.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!te(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!te(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,n=t.getOrientedFlatCoordinates();let s=0;const o=t.getEndss(),r=t.getStride();e.beginPath();for(let a=0,c=o.length;a<c;++a){const h=o[a];s=this.drawRings_(n,s,h,r)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,n=this.contextFillState_;n?n.fillStyle!=t.fillStyle&&(n.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=t.lineCap&&(n.lineCap=t.lineCap,e.lineCap=t.lineCap),Bi(n.lineDash,t.lineDash)||e.setLineDash(n.lineDash=t.lineDash),n.lineDashOffset!=t.lineDashOffset&&(n.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),n.lineJoin!=t.lineJoin&&(n.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),n.lineWidth!=t.lineWidth&&(n.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),n.miterLimit!=t.miterLimit&&(n.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),n.strokeStyle!=t.strokeStyle&&(n.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,n=this.contextTextState_,s=t.textAlign?t.textAlign:go;n?(n.font!=t.font&&(n.font=t.font,e.font=t.font),n.textAlign!=s&&(n.textAlign=s,e.textAlign=s),n.textBaseline!=t.textBaseline&&(n.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=s,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:s,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(!t)this.fillState_=null;else{const n=t.getColor();this.fillState_={fillStyle:ei(n||ge)}}if(!e)this.strokeState_=null;else{const n=e.getColor(),s=e.getLineCap(),o=e.getLineDash(),r=e.getLineDashOffset(),a=e.getLineJoin(),c=e.getWidth(),h=e.getMiterLimit(),l=o||vi;this.strokeState_={lineCap:s!==void 0?s:Yr,lineDash:this.pixelRatio_===1?l:l.map(u=>u*this.pixelRatio_),lineDashOffset:(r||Ei)*this.pixelRatio_,lineJoin:a!==void 0?a:ms,lineWidth:(c!==void 0?c:po)*this.pixelRatio_,miterLimit:h!==void 0?h:uo,strokeStyle:ei(n||fo)}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const n=t.getPixelRatio(this.pixelRatio_),s=t.getAnchor(),o=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*n,this.imageAnchorY_=s[1]*n,this.imageHeight_=e[1]*n,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=o[0],this.imageOriginY_=o[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const r=t.getScaleArray();this.imageScale_=[r[0]*this.pixelRatio_/n,r[1]*this.pixelRatio_/n],this.imageWidth_=e[0]*n}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const g=e.getColor();this.textFillState_={fillStyle:ei(g||ge)}}const n=t.getStroke();if(!n)this.textStrokeState_=null;else{const g=n.getColor(),_=n.getLineCap(),y=n.getLineDash(),w=n.getLineDashOffset(),E=n.getLineJoin(),b=n.getWidth(),P=n.getMiterLimit();this.textStrokeState_={lineCap:_!==void 0?_:Yr,lineDash:y||vi,lineDashOffset:w||Ei,lineJoin:E!==void 0?E:ms,lineWidth:b!==void 0?b:po,miterLimit:P!==void 0?P:uo,strokeStyle:ei(g||fo)}}const s=t.getFont(),o=t.getOffsetX(),r=t.getOffsetY(),a=t.getRotateWithView(),c=t.getRotation(),h=t.getScaleArray(),l=t.getText(),u=t.getTextAlign(),d=t.getTextBaseline();this.textState_={font:s!==void 0?s:ed,textAlign:u!==void 0?u:go,textBaseline:d!==void 0?d:Hr},this.text_=l!==void 0?Array.isArray(l)?l.reduce((g,_,y)=>g+=y%2?" ":_,""):l:"",this.textOffsetX_=o!==void 0?this.pixelRatio_*o:0,this.textOffsetY_=r!==void 0?this.pixelRatio_*r:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=c!==void 0?c:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}const si=.5;function q0(i,t,e,n,s,o,r){const a=i[0]*si,c=i[1]*si,h=Bt(a,c);h.imageSmoothingEnabled=!1;const l=h.canvas,u=new Sd(h,si,s,null,r),d=e.length,g=Math.floor((256*256*256-1)/d),_={};for(let w=1;w<=d;++w){const E=e[w-1],b=E.getStyleFunction()||n;if(!b)continue;let P=b(E,o);if(!P)continue;Array.isArray(P)||(P=[P]);const M=(w*g).toString(16).padStart(7,"#00000");for(let D=0,L=P.length;D<L;++D){const z=P[D],q=z.getGeometryFunction()(E);if(!q||!te(s,q.getExtent()))continue;const Y=z.clone(),X=Y.getFill();X&&X.setColor(M);const Q=Y.getStroke();Q&&(Q.setColor(M),Q.setLineDash(null)),Y.setText(void 0);const m=z.getImage();if(m){const F=m.getImageSize();if(!F)continue;const N=Bt(F[0],F[1],void 0,{alpha:!1}),G=N.canvas;N.fillStyle=M,N.fillRect(0,0,G.width,G.height),Y.setImage(new vs({img:G,imgSize:F,anchor:m.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:m.getOrigin(),opacity:1,size:m.getSize(),scale:m.getScale(),rotation:m.getRotation(),rotateWithView:m.getRotateWithView()}))}const v=Y.getZIndex()||0;let S=_[v];S||(S={},_[v]=S,S.Polygon=[],S.Circle=[],S.LineString=[],S.Point=[]);const A=q.getType();if(A==="GeometryCollection"){const F=q.getGeometriesArrayRecursive();for(let N=0,G=F.length;N<G;++N){const B=F[N];S[B.getType().replace("Multi","")].push(B,Y)}}else S[A.replace("Multi","")].push(q,Y)}}const y=Object.keys(_).map(Number).sort(On);for(let w=0,E=y.length;w<E;++w){const b=_[y[w]];for(const P in b){const I=b[P];for(let M=0,D=I.length;M<D;M+=2){u.setStyle(I[M+1]);for(let L=0,z=t.length;L<z;++L)u.setTransform(t[L]),u.drawGeometry(I[M])}}}return h.getImageData(0,0,l.width,l.height)}function G0(i,t,e){const n=[];if(e){const s=Math.floor(Math.round(i[0])*si),o=Math.floor(Math.round(i[1])*si),r=(qt(s,0,e.width-1)+qt(o,0,e.height-1)*e.width)*4,a=e.data[r],c=e.data[r+1],l=e.data[r+2]+256*(c+256*a),u=Math.floor((256*256*256-1)/t.length);l&&l%u===0&&n.push(t[l/u-1])}return n}const B0=.5,Rd={Point:Q0,LineString:$0,Polygon:t_,MultiPoint:J0,MultiLineString:Z0,MultiPolygon:K0,GeometryCollection:X0,Circle:Y0};function V0(i,t){return parseInt(St(i),10)-parseInt(St(t),10)}function Pd(i,t){const e=rh(i,t);return e*e}function rh(i,t){return B0*i/t}function Y0(i,t,e,n,s){const o=e.getFill(),r=e.getStroke();if(o||r){const c=i.getBuilder(e.getZIndex(),"Circle");c.setFillStrokeStyle(o,r),c.drawCircle(t,n)}const a=e.getText();if(a&&a.getText()){const c=(s||i).getBuilder(e.getZIndex(),"Text");c.setTextStyle(a),c.drawText(t,n)}}function Od(i,t,e,n,s,o,r){let a=!1;const c=e.getImage();if(c){const h=c.getImageState();h==ot.LOADED||h==ot.ERROR?c.unlistenImageChange(s):(h==ot.IDLE&&c.load(),c.listenImageChange(s),a=!0)}return H0(i,t,e,n,o,r),a}function H0(i,t,e,n,s,o){const r=e.getGeometryFunction()(t);if(!r)return;const a=r.simplifyTransformed(n,s);if(e.getRenderer())Id(i,a,e,t);else{const h=Rd[a.getType()];h(i,a,e,t,o)}}function Id(i,t,e,n){if(t.getType()=="GeometryCollection"){const o=t.getGeometries();for(let r=0,a=o.length;r<a;++r)Id(i,o[r],e,n);return}i.getBuilder(e.getZIndex(),"Default").drawCustom(t,n,e.getRenderer(),e.getHitDetectionRenderer())}function X0(i,t,e,n,s){const o=t.getGeometriesArray();let r,a;for(r=0,a=o.length;r<a;++r){const c=Rd[o[r].getType()];c(i,o[r],e,n,s)}}function $0(i,t,e,n,s){const o=e.getStroke();if(o){const a=i.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,o),a.drawLineString(t,n)}const r=e.getText();if(r&&r.getText()){const a=(s||i).getBuilder(e.getZIndex(),"Text");a.setTextStyle(r),a.drawText(t,n)}}function Z0(i,t,e,n,s){const o=e.getStroke();if(o){const a=i.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,o),a.drawMultiLineString(t,n)}const r=e.getText();if(r&&r.getText()){const a=(s||i).getBuilder(e.getZIndex(),"Text");a.setTextStyle(r),a.drawText(t,n)}}function K0(i,t,e,n,s){const o=e.getFill(),r=e.getStroke();if(r||o){const c=i.getBuilder(e.getZIndex(),"Polygon");c.setFillStrokeStyle(o,r),c.drawMultiPolygon(t,n)}const a=e.getText();if(a&&a.getText()){const c=(s||i).getBuilder(e.getZIndex(),"Text");c.setTextStyle(a),c.drawText(t,n)}}function Q0(i,t,e,n,s){const o=e.getImage(),r=e.getText();let a;if(o){if(o.getImageState()!=ot.LOADED)return;let c=i;if(s){const l=o.getDeclutterMode();if(l!=="none")if(c=s,l==="obstacle"){const u=i.getBuilder(e.getZIndex(),"Image");u.setImageStyle(o,a),u.drawPoint(t,n)}else r&&r.getText()&&(a={})}const h=c.getBuilder(e.getZIndex(),"Image");h.setImageStyle(o,a),h.drawPoint(t,n)}if(r&&r.getText()){let c=i;s&&(c=s);const h=c.getBuilder(e.getZIndex(),"Text");h.setTextStyle(r,a),h.drawText(t,n)}}function J0(i,t,e,n,s){const o=e.getImage(),r=e.getText();let a;if(o){if(o.getImageState()!=ot.LOADED)return;let c=i;if(s){const l=o.getDeclutterMode();if(l!=="none")if(c=s,l==="obstacle"){const u=i.getBuilder(e.getZIndex(),"Image");u.setImageStyle(o,a),u.drawMultiPoint(t,n)}else r&&r.getText()&&(a={})}const h=c.getBuilder(e.getZIndex(),"Image");h.setImageStyle(o,a),h.drawMultiPoint(t,n)}if(r&&r.getText()){let c=i;s&&(c=s);const h=c.getBuilder(e.getZIndex(),"Text");h.setTextStyle(r,a),h.drawText(t,n)}}function t_(i,t,e,n,s){const o=e.getFill(),r=e.getStroke();if(o||r){const c=i.getBuilder(e.getZIndex(),"Polygon");c.setFillStrokeStyle(o,r),c.drawPolygon(t,n)}const a=e.getText();if(a&&a.getText()){const c=(s||i).getBuilder(e.getZIndex(),"Text");c.setTextStyle(a),c.drawText(t,n)}}class Td extends ih{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Te(),this.wrappedRenderedExtent_=Te(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedRenderOrder_=null,this.replayGroup_=null,this.replayGroupChanged=!0,this.declutterExecutorGroup=null,this.clipping=!0,this.compositionContext_=null,this.opacity_=1}renderWorlds(t,e,n){const s=e.extent,o=e.viewState,r=o.center,a=o.resolution,c=o.projection,h=o.rotation,l=c.getExtent(),u=this.getLayer().getSource(),d=e.pixelRatio,g=e.viewHints,_=!(g[Vt.ANIMATING]||g[Vt.INTERACTING]),y=this.compositionContext_,w=Math.round(e.size[0]*d),E=Math.round(e.size[1]*d),b=u.getWrapX()&&c.canWrapX(),P=b?_t(l):null,I=b?Math.ceil((s[2]-l[2])/P)+1:1;let M=b?Math.floor((s[0]-l[0])/P):0;do{const D=this.getRenderTransform(r,a,h,d,w,E,M*P);t.execute(y,1,D,h,_,void 0,n)}while(++M<I)}setupCompositionContext_(){if(this.opacity_!==1){const t=Bt(this.context.canvas.width,this.context.canvas.height,Ed);this.compositionContext_=t}else this.compositionContext_=this.context}releaseCompositionContext_(){if(this.opacity_!==1){const t=this.context.globalAlpha;this.context.globalAlpha=this.opacity_,this.context.drawImage(this.compositionContext_.canvas,0,0),this.context.globalAlpha=t,Gr(this.compositionContext_),Ed.push(this.compositionContext_.canvas),this.compositionContext_=null}}renderDeclutter(t){this.declutterExecutorGroup&&(this.setupCompositionContext_(),this.renderWorlds(this.declutterExecutorGroup,t,t.declutterTree),this.releaseCompositionContext_())}renderFrame(t,e){const n=t.pixelRatio,s=t.layerStatesArray[t.layerIndex];Zp(this.pixelTransform,1/n,1/n),Or(this.inversePixelTransform,this.pixelTransform);const o=mc(this.pixelTransform);this.useContainer(e,o,this.getBackground(t));const r=this.context,a=r.canvas,c=this.replayGroup_,h=this.declutterExecutorGroup;let l=c&&!c.isEmpty()||h&&!h.isEmpty();if(!l&&!(this.getLayer().hasListener(ti.PRERENDER)||this.getLayer().hasListener(ti.POSTRENDER)))return null;const u=Math.round(t.size[0]*n),d=Math.round(t.size[1]*n);a.width!=u||a.height!=d?(a.width=u,a.height=d,a.style.transform!==o&&(a.style.transform=o)):this.containerReused||r.clearRect(0,0,u,d),this.preRender(r,t);const g=t.viewState;g.projection,this.opacity_=s.opacity,this.setupCompositionContext_();let _=!1;if(l&&s.extent&&this.clipping){const y=_i(s.extent);l=te(y,t.extent),_=l&&!Tn(y,t.extent),_&&this.clipUnrotated(this.compositionContext_,t,y)}return l&&this.renderWorlds(c,t),_&&this.compositionContext_.restore(),this.releaseCompositionContext_(),this.postRender(r,t),this.renderedRotation_!==g.rotation&&(this.renderedRotation_=g.rotation,this.hitDetectionImageData_=null),this.container}getFeatures(t){return new Promise(e=>{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const n=[this.context.canvas.width,this.context.canvas.height];Ut(this.pixelTransform,n);const s=this.renderedCenter_,o=this.renderedResolution_,r=this.renderedRotation_,a=this.renderedProjection_,c=this.wrappedRenderedExtent_,h=this.getLayer(),l=[],u=n[0]*si,d=n[1]*si;l.push(this.getRenderTransform(s,o,r,si,u,d,0).slice());const g=h.getSource(),_=a.getExtent();if(g.getWrapX()&&a.canWrapX()&&!Tn(_,c)){let y=c[0];const w=_t(_);let E=0,b;for(;y<_[0];)--E,b=w*E,l.push(this.getRenderTransform(s,o,r,si,u,d,b).slice()),y+=w;for(E=0,y=c[2];y>_[2];)++E,b=w*E,l.push(this.getRenderTransform(s,o,r,si,u,d,b).slice()),y-=w}this.hitDetectionImageData_=q0(n,l,this.renderedFeatures_,h.getStyleFunction(),c,o,r)}e(G0(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,n,s,o){if(!this.replayGroup_)return;const r=e.viewState.resolution,a=e.viewState.rotation,c=this.getLayer(),h={},l=function(g,_,y){const w=St(g),E=h[w];if(E){if(E!==!0&&y<E.distanceSq){if(y===0)return h[w]=!0,o.splice(o.lastIndexOf(E),1),s(g,c,_);E.geometry=_,E.distanceSq=y}}else{if(y===0)return h[w]=!0,s(g,c,_);o.push(h[w]={feature:g,layer:c,geometry:_,distanceSq:y,callback:s})}};let u;const d=[this.replayGroup_];return this.declutterExecutorGroup&&d.push(this.declutterExecutorGroup),d.some(g=>u=g.forEachFeatureAtCoordinate(t,r,a,n,l,g===this.declutterExecutorGroup&&e.declutterTree?e.declutterTree.all().map(_=>_.value):null)),u}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),n=e.getSource();if(!n)return!1;const s=t.viewHints[Vt.ANIMATING],o=t.viewHints[Vt.INTERACTING],r=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!r&&s||!a&&o)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const c=t.extent,h=t.viewState,l=h.projection,u=h.resolution,d=t.pixelRatio,g=e.getRevision(),_=e.getRenderBuffer();let y=e.getRenderOrder();y===void 0&&(y=V0);const w=h.center.slice(),E=io(c,_*u),b=E.slice(),P=[E.slice()],I=l.getExtent();if(n.getWrapX()&&l.canWrapX()&&!Tn(I,t.extent)){const S=_t(I),A=Math.max(_t(E)/2,S);E[0]=I[0]-A,E[2]=I[2]+A,pu(w,l);const F=uu(P[0],l);F[0]<I[0]&&F[2]<I[2]?P.push([F[0]+S,F[1],F[2]+S,F[3]]):F[0]>I[0]&&F[2]>I[2]&&P.push([F[0]-S,F[1],F[2]-S,F[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==g&&this.renderedRenderOrder_==y&&Tn(this.wrappedRenderedExtent_,E))return Bi(this.renderedExtent_,b)||(this.hitDetectionImageData_=null,this.renderedExtent_=b),this.renderedCenter_=w,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const M=new wd(rh(u,d),E,u,d);let D;this.getLayer().getDeclutter()&&(D=new wd(rh(u,d),E,u,d));let L;for(let S=0,A=P.length;S<A;++S)n.loadFeatures(P[S],u,l);const z=Pd(u,d);let q=!0;const Y=S=>{let A;const F=S.getStyleFunction()||e.getStyleFunction();if(F&&(A=F(S,u)),A){const N=this.renderFeature(S,z,A,M,L,D);q=q&&!N}},X=Pu(E),Q=n.getFeaturesInExtent(X);y&&Q.sort(y);for(let S=0,A=Q.length;S<A;++S)Y(Q[S]);this.renderedFeatures_=Q,this.ready=q;const m=M.finish(),v=new xd(E,u,d,n.getOverlaps(),m,e.getRenderBuffer());return D&&(this.declutterExecutorGroup=new xd(E,u,d,n.getOverlaps(),D.finish(),e.getRenderBuffer())),this.renderedResolution_=u,this.renderedRevision_=g,this.renderedRenderOrder_=y,this.renderedExtent_=b,this.wrappedRenderedExtent_=E,this.renderedCenter_=w,this.renderedProjection_=l,this.replayGroup_=v,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,n,s,o,r){if(!n)return!1;let a=!1;if(Array.isArray(n))for(let c=0,h=n.length;c<h;++c)a=Od(s,t,n[c],e,this.boundHandleStyleImageChange_,o,r)||a;else a=Od(s,t,n,e,this.boundHandleStyleImageChange_,o,r);return a}}class oi extends pd{constructor(t){super(t)}createRenderer(){return new Td(this)}}class Ad{constructor(t){this.rbush_=new Kc(t),this.items_={}}insert(t,e){const n={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(n),this.items_[St(e)]=n}load(t,e){const n=new Array(e.length);for(let s=0,o=e.length;s<o;s++){const r=t[s],a=e[s],c={minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],value:a};n[s]=c,this.items_[St(a)]=c}this.rbush_.load(n)}remove(t){const e=St(t),n=this.items_[e];return delete this.items_[e],this.rbush_.remove(n)!==null}update(t,e){const n=this.items_[St(e)],s=[n.minX,n.minY,n.maxX,n.maxY];Yi(s,t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(s){return s.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let n;for(let s=0,o=t.length;s<o;s++)if(n=e(t[s]),n)return n;return n}isEmpty(){return Js(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return pi(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}}class Ro extends Ke{constructor(t){super(),this.projection=Gt(t.projection),this.attributions_=Md(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible!==void 0?t.attributionsCollapsible:!0,this.loading=!1,this.state_=t.state!==void 0?t.state:"ready",this.wrapX_=t.wrapX!==void 0?t.wrapX:!1,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(n,s){e.viewResolver=n,e.viewRejector=s})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=Md(t),this.changed()}setState(t){this.state_=t,this.changed()}}function Md(i){return i?Array.isArray(i)?function(t){return i}:typeof i=="function"?i:function(t){return[i]}:null}const Ve={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function e_(i,t){return[[-1/0,-1/0,1/0,1/0]]}let i_=!1;function n_(i,t,e,n,s,o,r){const a=new XMLHttpRequest;a.open("GET",typeof i=="function"?i(e,n,s):i,!0),t.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=i_,a.onload=function(c){if(!a.status||a.status>=200&&a.status<300){const h=t.getType();let l;h=="json"||h=="text"?l=a.responseText:h=="xml"?(l=a.responseXML,l||(l=new DOMParser().parseFromString(a.responseText,"application/xml"))):h=="arraybuffer"&&(l=a.response),l?o(t.readFeatures(l,{extent:e,featureProjection:s}),t.readProjection(l)):r()}else r()},a.onerror=r,a.send()}function Dd(i,t){return function(e,n,s,o,r){const a=this;n_(i,t,e,n,s,function(c,h){a.addFeatures(c),o!==void 0&&o(c)},r||hs)}}class en extends We{constructor(t,e,n){super(t),this.feature=e,this.features=n}}class Si extends Ro{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:t.wrapX!==void 0?t.wrapX:!0}),this.on,this.once,this.un,this.loader_=hs,this.format_=t.format,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(pt(this.format_,7),this.loader_=Dd(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:e_;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new Ad:null,this.loadedExtentsRtree_=new Ad,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,s;Array.isArray(t.features)?s=t.features:t.features&&(n=t.features,s=n.getArray()),!e&&n===void 0&&(n=new Qe(s)),s!==void 0&&this.addFeaturesInternal(s),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=St(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);const n=t.getGeometry();if(n){const s=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new en(Ve.ADDFEATURE,t))}setupChangeEvents_(t,e){this.featureChangeKeys_[t]=[Ct(e,ht.CHANGE,this.handleFeatureChange_,this),Ct(e,cs.PROPERTYCHANGE,this.handleFeatureChange_,this)]}addToIndex_(t,e){let n=!0;const s=e.getId();return s!==void 0&&(s.toString()in this.idIndex_?n=!1:this.idIndex_[s.toString()]=e),n&&(pt(!(t in this.uidIndex_),30),this.uidIndex_[t]=e),n}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],n=[],s=[];for(let o=0,r=t.length;o<r;o++){const a=t[o],c=St(a);this.addToIndex_(c,a)&&n.push(a)}for(let o=0,r=n.length;o<r;o++){const a=n[o],c=St(a);this.setupChangeEvents_(c,a);const h=a.getGeometry();if(h){const l=h.getExtent();e.push(l),s.push(a)}else this.nullGeometryFeatures_[c]=a}if(this.featuresRtree_&&this.featuresRtree_.load(e,s),this.hasListener(Ve.ADDFEATURE))for(let o=0,r=n.length;o<r;o++)this.dispatchEvent(new en(Ve.ADDFEATURE,n[o]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(Ve.ADDFEATURE,function(n){e||(e=!0,t.push(n.feature),e=!1)}),this.addEventListener(Ve.REMOVEFEATURE,function(n){e||(e=!0,t.remove(n.feature),e=!1)}),t.addEventListener(ue.ADD,n=>{e||(e=!0,this.addFeature(n.element),e=!1)}),t.addEventListener(ue.REMOVE,n=>{e||(e=!0,this.removeFeature(n.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const n in this.featureChangeKeys_)this.featureChangeKeys_[n].forEach(Mt);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const n=s=>{this.removeFeatureInternal(s)};this.featuresRtree_.forEach(n);for(const s in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[s])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new en(Ve.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const n=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(n,function(s){if(s.getGeometry().intersectsCoordinate(t))return e(s)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(n){if(n.getGeometry().intersectsExtent(t)){const o=e(n);if(o)return o}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),Js(this.nullGeometryFeatures_)||In(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(n){e.push(n)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const s=cm(t,e);return[].concat(...s.map(o=>this.featuresRtree_.getInExtent(o)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const n=t[0],s=t[1];let o=null;const r=[NaN,NaN];let a=1/0;const c=[-1/0,-1/0,1/0,1/0];return e=e||Ks,this.featuresRtree_.forEachInExtent(c,function(h){if(e(h)){const l=h.getGeometry(),u=a;if(a=l.closestPointXY(n,s,r,a),a<u){o=h;const d=Math.sqrt(a);c[0]=n-d,c[1]=s-d,c[2]=n+d,c[3]=s+d}}}),o}getExtent(t){return this.featuresRtree_.getExtent(t)}getFeatureById(t){const e=this.idIndex_[t.toString()];return e!==void 0?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return e!==void 0?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,n=St(e),s=e.getGeometry();if(!s)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[n]=e);else{const r=s.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(r,e)):this.featuresRtree_&&this.featuresRtree_.update(r,e)}const o=e.getId();if(o!==void 0){const r=o.toString();this.idIndex_[r]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[r]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[n]=e;this.changed(),this.dispatchEvent(new en(Ve.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:St(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Js(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(t,e,n){const s=this.loadedExtentsRtree_,o=this.strategy_(t,e,n);for(let r=0,a=o.length;r<a;++r){const c=o[r];s.forEachInExtent(c,function(l){return Tn(l.extent,c)})||(++this.loadingExtentsCount_,this.dispatchEvent(new en(Ve.FEATURESLOADSTART)),this.loader_.call(this,c,e,n,l=>{--this.loadingExtentsCount_,this.dispatchEvent(new en(Ve.FEATURESLOADEND,void 0,l))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new en(Ve.FEATURESLOADERROR))}),s.insert(c,{extent:c.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_;let n;e.forEachInExtent(t,function(s){if(Yi(s.extent,t))return n=s,!0}),n&&e.remove(n)}removeFeature(t){if(!t)return;const e=St(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=St(t),n=this.featureChangeKeys_[e];if(!n)return;n.forEach(Mt),delete this.featureChangeKeys_[e];const s=t.getId();return s!==void 0&&delete this.idIndex_[s.toString()],delete this.uidIndex_[e],this.dispatchEvent(new en(Ve.REMOVEFEATURE,t)),t}removeFromIdIndex_(t){let e=!1;for(const n in this.idIndex_)if(this.idIndex_[n]===t){delete this.idIndex_[n],e=!0;break}return e}setLoader(t){this.loader_=t}setUrl(t){pt(this.format_,7),this.url_=t,this.setLoader(Dd(t,this.format_))}}function Fd(i){if(!(i.context instanceof CanvasRenderingContext2D))throw new Error("Only works for render events from Canvas 2D layers");const t=i.inversePixelTransform[0],e=i.inversePixelTransform[1],n=Math.sqrt(t*t+e*e),s=i.frameState,o=Hp(i.inversePixelTransform.slice(),s.coordinateToPixelTransform),r=Pd(s.viewState.resolution,n);let a;return new Sd(i.context,n,s.extent,o,s.viewState.rotation,r,a)}class Ld extends th{constructor(t,e,n,s,o){const r=o!==void 0?ot.IDLE:ot.LOADED;super(t,e,n,r),this.loader_=o!==void 0?o:null,this.canvas_=s,this.error_=null}getError(){return this.error_}handleLoad_(t){t?(this.error_=t,this.state=ot.ERROR):this.state=ot.LOADED,this.changed()}load(){this.state==ot.IDLE&&(this.state=ot.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}const rt={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class zd extends to{constructor(t,e,n){super(),n=n||{},this.tileCoord=t,this.state=e,this.interimTile=null,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(ht.CHANGE)}release(){this.state===rt.ERROR&&this.setState(rt.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){if(!this.interimTile)return this;let t=this.interimTile;do{if(t.getState()==rt.LOADED)return this.transition_=0,t;t=t.interimTile}while(t);return this}refreshInterimChain(){if(!this.interimTile)return;let t=this.interimTile,e=this;do{if(t.getState()==rt.LOADED){t.interimTile=null;break}else t.getState()==rt.LOADING?e=t:t.getState()==rt.IDLE?e.interimTile=t.interimTile:e=t;t=e.interimTile}while(t)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==rt.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){vt()}getAlpha(t,e){if(!this.transition_)return 1;let n=this.transitionStarts_[t];if(!n)n=e,this.transitionStarts_[t]=n;else if(n===-1)return 1;const s=e-n+1e3/60;return s>=this.transition_?1:eu(s/this.transition_)}inTransition(t){return this.transition_?this.transitionStarts_[t]!==-1:!1}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}}class Nd extends zd{constructor(t,e,n,s,o,r){super(t,e,r),this.crossOrigin_=s,this.src_=n,this.key=n,this.image_=new Image,s!==null&&(this.image_.crossOrigin=s),this.unlisten_=null,this.tileLoadFunction_=o}getImage(){return this.image_}setImage(t){this.image_=t,this.state=rt.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=rt.ERROR,this.unlistenImage_(),this.image_=s_(),this.changed()}handleImageLoad_(){const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=rt.LOADED:this.state=rt.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==rt.ERROR&&(this.state=rt.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==rt.IDLE&&(this.state=rt.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=eh(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function s_(){const i=Bt(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}class o_{constructor(t,e,n){this.decay_=t,this.minVelocity_=e,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let n=e-3;for(;n>0&&this.points_[n+2]>t;)n-=3;const s=this.points_[e+2]-this.points_[n+2];if(s<16.666666666666668)return!1;const o=this.points_[e]-this.points_[n],r=this.points_[e+1]-this.points_[n+1];return this.angle_=Math.atan2(r,o),this.initialVelocity_=Math.sqrt(o*o+r*r)/s,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}class r_ extends xr{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){vt()}calculateMatrices2D(t){const e=t.viewState,n=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;qe(n,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Or(s,n)}forEachFeatureAtCoordinate(t,e,n,s,o,r,a,c){let h;const l=e.viewState;function u(I,M,D,L){return o.call(r,M,I?D:null,L)}const d=l.projection,g=pu(t.slice(),d),_=[[0,0]];if(d.canWrapX()&&s){const I=d.getExtent(),M=_t(I);_.push([-M,0],[M,0])}const y=e.layerStatesArray,w=y.length,E=[],b=[];for(let I=0;I<_.length;I++)for(let M=w-1;M>=0;--M){const D=y[M],L=D.layer;if(L.hasRenderer()&&Zc(D,l)&&a.call(c,L)){const z=L.getRenderer(),q=L.getSource();if(z&&q){const Y=q.getWrapX()?g:t,X=u.bind(null,D.managed);b[0]=Y[0]+_[I][0],b[1]=Y[1]+_[I][1],h=z.forEachFeatureAtCoordinate(b,e,n,X,E)}if(h)return h}}if(E.length===0)return;const P=1/E.length;return E.forEach((I,M)=>I.distanceSq+=M*P),E.sort((I,M)=>I.distanceSq-M.distanceSq),E.some(I=>h=I.callback(I.feature,I.layer,I.geometry)),h}hasFeatureAtCoordinate(t,e,n,s,o,r){return this.forEachFeatureAtCoordinate(t,e,n,s,Ks,this,o,r)!==void 0}getMap(){return this.map_}renderFrame(t){vt()}flushDeclutterItems(t){}scheduleExpireIconCache(t){Qr.canExpireCache()&&t.postRenderFunctions.push(a_)}}function a_(i,t){Qr.expire()}class c_ extends r_{constructor(t){super(t),this.fontChangeListenerKey_=Ct(Ci,cs.PROPERTYCHANGE,t.redrawText.bind(t)),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Vr+" ol-layers";const n=t.getViewport();n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0,this.declutterLayers_=[]}dispatchRenderEvent(t,e){const n=this.getMap();if(n.hasListener(t)){const s=new vd(t,void 0,e);n.dispatchEvent(s)}}disposeInternal(){Mt(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(ti.PRECOMPOSE,t);const e=t.layerStatesArray.sort(function(r,a){return r.zIndex-a.zIndex}),n=t.viewState;this.children_.length=0;const s=this.declutterLayers_;s.length=0;let o=null;for(let r=0,a=e.length;r<a;++r){const c=e[r];t.layerIndex=r;const h=c.layer,l=h.getSourceState();if(!Zc(c,n)||l!="ready"&&l!="undefined"){h.unrender();continue}const u=h.render(t,o);u&&(u!==o&&(this.children_.push(u),o=u),"getDeclutter"in h&&s.push(h))}this.flushDeclutterItems(t),Km(this.element_,this.children_),this.dispatchRenderEvent(ti.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}flushDeclutterItems(t){const e=this.declutterLayers_;for(let n=e.length-1;n>=0;--n)e[n].renderDeclutter(t);e.length=0}}class nn extends We{constructor(t,e){super(t),this.layer=e}}const ah={LAYERS:"layers"};class sn extends od{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let n=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(ah.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new Qe(n.slice(),{unique:!0}):pt(typeof n.getArray=="function",43):n=new Qe(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(Mt),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(Ct(t,ue.ADD,this.handleLayersAdd_,this),Ct(t,ue.REMOVE,this.handleLayersRemove_,this));for(const n in this.listenerKeys_)this.listenerKeys_[n].forEach(Mt);Qs(this.listenerKeys_);const e=t.getArray();for(let n=0,s=e.length;n<s;n++){const o=e[n];this.registerLayerListeners_(o),this.dispatchEvent(new nn("addlayer",o))}this.changed()}registerLayerListeners_(t){const e=[Ct(t,cs.PROPERTYCHANGE,this.handleLayerChange_,this),Ct(t,ht.CHANGE,this.handleLayerChange_,this)];t instanceof sn&&e.push(Ct(t,"addlayer",this.handleLayerGroupAdd_,this),Ct(t,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[St(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new nn("addlayer",t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new nn("removelayer",t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new nn("addlayer",e)),this.changed()}handleLayersRemove_(t){const e=t.element,n=St(e);this.listenerKeys_[n].forEach(Mt),delete this.listenerKeys_[n],this.dispatchEvent(new nn("removelayer",e)),this.changed()}getLayers(){return this.get(ah.LAYERS)}setLayers(t){const e=this.getLayers();if(e){const n=e.getArray();for(let s=0,o=n.length;s<o;++s)this.dispatchEvent(new nn("removelayer",n[s]))}this.set(ah.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=t!==void 0?t:[],n=e.length;this.getLayers().forEach(function(r){r.getLayerStatesArray(e)});const s=this.getLayerState();let o=s.zIndex;!t&&s.zIndex===void 0&&(o=0);for(let r=n,a=e.length;r<a;r++){const c=e[r];c.opacity*=s.opacity,c.visible=c.visible&&s.visible,c.maxResolution=Math.min(c.maxResolution,s.maxResolution),c.minResolution=Math.max(c.minResolution,s.minResolution),c.minZoom=Math.max(c.minZoom,s.minZoom),c.maxZoom=Math.min(c.maxZoom,s.maxZoom),s.extent!==void 0&&(c.extent!==void 0?c.extent=An(c.extent,s.extent):c.extent=s.extent),c.zIndex===void 0&&(c.zIndex=o)}return e}getSourceState(){return"ready"}}class bs extends We{constructor(t,e,n){super(t),this.map=e,this.frameState=n!==void 0?n:null}}class on extends bs{constructor(t,e,n,s,o,r){super(t,e,o),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=s!==void 0?s:!1,this.activePointers=r}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const zt={SINGLECLICK:"singleclick",CLICK:ht.CLICK,DBLCLICK:ht.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},ch={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class h_ extends to{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;const n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=Ct(n,ch.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=Ct(n,ch.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(ht.TOUCHMOVE,this.boundHandleTouchMove_,ou?{passive:!1}:!1)}emulateClick_(t){let e=new on(zt.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new on(zt.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const n=new on(zt.SINGLECLICK,this.map_,t);this.dispatchEvent(n)},250)}updateActivePointers_(t){const e=t,n=e.pointerId;if(e.type==zt.POINTERUP||e.type==zt.POINTERCANCEL){delete this.trackedTouches_[n];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==e.target){delete this.trackedTouches_[s];break}}else(e.type==zt.POINTERDOWN||e.type==zt.POINTERMOVE)&&(this.trackedTouches_[n]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new on(zt.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(Mt),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return t.button===0}handlePointerDown_(t){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(t);const e=new on(zt.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){const n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(Ct(n,zt.POINTERMOVE,this.handlePointerMove_,this),Ct(n,zt.POINTERUP,this.handlePointerUp_,this),Ct(this.element_,zt.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(Ct(this.element_.getRootNode(),zt.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new on(zt.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new on(zt.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;(!e||e.defaultPrevented)&&(typeof t.cancelable!="boolean"||t.cancelable===!0)&&t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(Mt(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(ht.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(Mt(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(Mt),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const rn={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},ee={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},ea=1/0;class l_{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Qs(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,n=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(n);return delete this.queuedElements_[s],n}enqueue(t){pt(!(this.keyFunction_(t)in this.queuedElements_),31);const e=this.priorityFunction_(t);return e!=ea?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,n=this.priorities_,s=e.length,o=e[t],r=n[t],a=t;for(;t<s>>1;){const c=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),l=h<s&&n[h]<n[c]?h:c;e[t]=e[l],n[t]=n[l],t=l}e[t]=o,n[t]=r,this.siftDown_(a,t)}siftDown_(t,e){const n=this.elements_,s=this.priorities_,o=n[e],r=s[e];for(;e>t;){const a=this.getParentIndex_(e);if(s[a]>r)n[e]=n[a],s[e]=s[a],e=a;else break}n[e]=o,s[e]=r}reprioritize(){const t=this.priorityFunction_,e=this.elements_,n=this.priorities_;let s=0;const o=e.length;let r,a,c;for(a=0;a<o;++a)r=e[a],c=t(r),c==ea?delete this.queuedElements_[this.keyFunction_(r)]:(n[s]=c,e[s++]=r);e.length=s,n.length=s,this.heapify_()}}class Ud extends l_{constructor(t,e){super(function(n){return t.apply(null,n)},function(n){return n[0].getKey()}),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(ht.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,n=e.getState();if(n===rt.LOADED||n===rt.ERROR||n===rt.EMPTY){n!==rt.ERROR&&e.removeEventListener(ht.CHANGE,this.boundHandleTileChange_);const s=e.getKey();s in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[s],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let n=0,s,o,r;for(;this.tilesLoading_<t&&n<e&&this.getCount()>0;)o=this.dequeue()[0],r=o.getKey(),s=o.getState(),s===rt.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++n,o.load())}}function u_(i,t,e,n,s){if(!i||!(e in i.wantedTiles)||!i.wantedTiles[e][t.getKey()])return ea;const o=i.viewState.center,r=n[0]-o[0],a=n[1]-o[1];return 65536*Math.log(s)+Math.sqrt(r*r+a*a)/s}class hh extends Ke{constructor(t){super();const e=t.element;e&&!t.target&&!e.style.pointerEvents&&(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){jc(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&jc(this.element);for(let e=0,n=this.listenerKeys.length;e<n;++e)Mt(this.listenerKeys[e]);this.listenerKeys.length=0,this.map_=t,t&&((this.target_?this.target_:t.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==hs&&this.listenerKeys.push(Ct(t,rn.POSTRENDER,this.render,this)),t.render())}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}class d_ extends hh{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=t.collapsible!==void 0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1);const e=t.className!==void 0?t.className:"ol-attribution",n=t.tipLabel!==void 0?t.tipLabel:"Attributions",s=t.expandClassName!==void 0?t.expandClassName:e+"-expand",o=t.collapseLabel!==void 0?t.collapseLabel:"›",r=t.collapseClassName!==void 0?t.collapseClassName:e+"-collapse";typeof o=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=o,this.collapseLabel_.className=r):this.collapseLabel_=o;const a=t.label!==void 0?t.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=s):this.label_=a;const c=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(c),this.toggleButton_.addEventListener(ht.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+Vr+" "+kc+(this.collapsed_&&this.collapsible_?" "+Qu:"")+(this.collapsible_?"":" ol-uncollapsible"),l=this.element;l.className=h,l.appendChild(this.toggleButton_),l.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=Array.from(new Set(this.getMap().getAllLayers().flatMap(s=>s.getAttributions(t)))),n=!this.getMap().getAllLayers().some(s=>s.getSource()&&s.getSource().getAttributionsCollapsible()===!1);return this.overrideCollapsible_||this.setCollapsible(n),e}updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=this.collectSourceAttributions_(t),n=e.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Bi(e,this.renderedAttributions_)){Zm(this.ulElement_);for(let s=0,o=e.length;s<o;++s){const r=document.createElement("li");r.innerHTML=e[s],this.ulElement_.appendChild(r)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Qu),this.collapsed_?Ku(this.collapseLabel_,this.label_):Ku(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,!(!this.collapsible_||this.collapsed_===t)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}class f_ extends hh{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=t.className!==void 0?t.className:"ol-rotate",n=t.label!==void 0?t.label:"⇧",s=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof n=="string"?(this.label_=document.createElement("span"),this.label_.className=s,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(s));const o=t.tipLabel?t.tipLabel:"Reset rotation",r=document.createElement("button");r.className=e+"-reset",r.setAttribute("type","button"),r.title=o,r.appendChild(this.label_),r.addEventListener(ht.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+Vr+" "+kc,c=this.element;c.className=a,c.appendChild(r),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=t.duration!==void 0?t.duration:250,this.autoHide_=t.autoHide!==void 0?t.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Br)}handleClick_(t){t.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const e=this.getMap().getView();if(!e)return;const n=e.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:Pn}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const n=e.viewState.rotation;if(n!=this.rotation_){const s="rotate("+n+"rad)";if(this.autoHide_){const o=this.element.classList.contains(Br);!o&&n===0?this.element.classList.add(Br):o&&n!==0&&this.element.classList.remove(Br)}this.label_.style.transform=s}this.rotation_=n}}class g_ extends hh{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",n=t.delta!==void 0?t.delta:1,s=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",o=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",r=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"–",c=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",l=document.createElement("button");l.className=s,l.setAttribute("type","button"),l.title=c,l.appendChild(typeof r=="string"?document.createTextNode(r):r),l.addEventListener(ht.CLICK,this.handleClick_.bind(this,n),!1);const u=document.createElement("button");u.className=o,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(ht.CLICK,this.handleClick_.bind(this,-n),!1);const d=e+" "+Vr+" "+kc,g=this.element;g.className=d,g.appendChild(l),g.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const n=this.getMap().getView();if(!n)return;const s=n.getZoom();if(s!==void 0){const o=n.getConstrainedZoom(s+t);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:o,duration:this.duration_,easing:Pn})):n.setZoom(o)}}}function jd(i){i=i||{};const t=new Qe;return(i.zoom!==void 0?i.zoom:!0)&&t.push(new g_(i.zoomOptions)),(i.rotate!==void 0?i.rotate:!0)&&t.push(new f_(i.rotateOptions)),(i.attribution!==void 0?i.attribution:!0)&&t.push(new d_(i.attributionOptions)),t}const kd={ACTIVE:"active"};class Po extends Ke{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(kd.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(kd.ACTIVE,t)}setMap(t){this.map_=t}}function p_(i,t,e){const n=i.getCenterInternal();if(n){const s=[n[0]+t[0],n[1]+t[1]];i.animateInternal({duration:e!==void 0?e:250,easing:zp,center:i.getConstrainedCenter(s)})}}function lh(i,t,e,n){const s=i.getZoom();if(s===void 0)return;const o=i.getConstrainedZoom(s+t),r=i.getResolutionForZoom(o);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:r,anchor:e,duration:n!==void 0?n:250,easing:Pn})}class m_ extends Po{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:250}handleEvent(t){let e=!1;if(t.type==zt.DBLCLICK){const n=t.originalEvent,s=t.map,o=t.coordinate,r=n.shiftKey?-this.delta_:this.delta_,a=s.getView();lh(a,r,o,this.duration_),n.preventDefault(),e=!0}return!e}}class Oo extends Po{constructor(t){t=t||{},super(t),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==zt.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==zt.POINTERUP){const n=this.handleUpEvent(t);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(t.type==zt.POINTERDOWN){const n=this.handleDownEvent(t);this.handlingDownUpSequence=n,e=this.stopDown(n)}else t.type==zt.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function uh(i){const t=i.length;let e=0,n=0;for(let s=0;s<t;s++)e+=i[s].clientX,n+=i[s].clientY;return{clientX:e/t,clientY:n/t}}function dh(i){const t=arguments;return function(e){let n=!0;for(let s=0,o=t.length;s<o&&(n=n&&t[s](e),!!n);++s);return n}}const __=function(i){const t=i.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},y_=function(i){const t=i.map.getTargetElement(),e=i.map.getOwnerDocument().activeElement;return t.contains(e)},Wd=function(i){return i.map.getTargetElement().hasAttribute("tabindex")?y_(i):!0},w_=Ks,qd=function(i){const t=i.originalEvent;return t.button==0&&!(Bp&&nu&&t.ctrlKey)},Gd=function(i){const t=i.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},v_=function(i){const t=i.originalEvent;return nu?t.metaKey:t.ctrlKey},E_=function(i){const t=i.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Bd=function(i){const t=i.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},fh=function(i){const t=i.originalEvent;return pt(t!==void 0,56),t.pointerType=="mouse"},C_=function(i){const t=i.originalEvent;return pt(t!==void 0,56),t.isPrimary&&t.button===0};class b_ extends Oo{constructor(t){super({stopDown:Rr}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:dh(Gd,C_);this.condition_=t.onFocusOnly?dh(Wd,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const n=this.targetPointers,s=e.getEventPixel(uh(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(s[0],s[1]),this.lastCentroid){const o=[this.lastCentroid[0]-s[0],s[1]-this.lastCentroid[1]],a=t.map.getView();Cm(o,a.getResolution()),Rc(o,a.getRotation()),a.adjustCenterInternal(o)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=s,this.lastPointersCount_=n.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,n=e.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const s=this.kinetic_.getDistance(),o=this.kinetic_.getAngle(),r=n.getCenterInternal(),a=e.getPixelFromCoordinateInternal(r),c=e.getCoordinateFromPixelInternal([a[0]-s*Math.cos(o),a[1]-s*Math.sin(o)]);n.animateInternal({center:n.getConstrainedCenter(c),duration:500,easing:Pn})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const n=t.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}class x_ extends Oo{constructor(t){t=t||{},super({stopDown:Rr}),this.condition_=t.condition?t.condition:__,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!fh(t))return;const e=t.map,n=e.getView();if(n.getConstraints().rotation===Hc)return;const s=e.getSize(),o=t.pixel,r=Math.atan2(s[1]/2-o[1],o[0]-s[0]/2);if(this.lastAngle_!==void 0){const a=r-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=r}handleUpEvent(t){return fh(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return fh(t)&&qd(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}class S_ extends xr{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,n="px",s=this.element_.style;s.left=Math.min(t[0],e[0])+n,s.top=Math.min(t[1],e[1])+n,s.width=Math.abs(e[0]-t[0])+n,s.height=Math.abs(e[1]-t[1])+n}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){const t=this.startPixel_,e=this.endPixel_,s=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);s[4]=s[0].slice(),this.geometry_?this.geometry_.setCoordinates([s]):this.geometry_=new ps([s])}getGeometry(){return this.geometry_}}const ia={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class gh extends We{constructor(t,e,n){super(t),this.coordinate=e,this.mapBrowserEvent=n}}class R_ extends Oo{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.box_=new S_(t.className||"ol-dragbox"),this.minArea_=t.minArea!==void 0?t.minArea:64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition?t.condition:qd,this.boxEndCondition_=t.boxEndCondition?t.boxEndCondition:this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,n){const s=n[0]-e[0],o=n[1]-e[1];return s*s+o*o>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new gh(ia.BOXDRAG,t.coordinate,t))}handleUpEvent(t){this.box_.setMap(null);const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new gh(e?ia.BOXEND:ia.BOXCANCEL,t.coordinate,t)),!1}handleDownEvent(t){return this.condition_(t)?(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new gh(ia.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}}class P_ extends R_{constructor(t){t=t||{};const e=t.condition?t.condition:E_;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){const n=this.getMap().getView();let s=this.getGeometry();if(this.out_){const o=n.rotatedExtentForGeometry(s),r=n.getResolutionForExtentInternal(o),a=n.getResolution()/r;s=s.clone(),s.scale(a*a)}n.fitInternal(s,{duration:this.duration_,easing:Pn})}}const jn={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class O_ extends Po{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return Gd(e)&&Bd(e)},this.condition_=t.condition!==void 0?t.condition:this.defaultCondition_,this.duration_=t.duration!==void 0?t.duration:100,this.pixelDelta_=t.pixelDelta!==void 0?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==ht.KEYDOWN){const n=t.originalEvent,s=n.key;if(this.condition_(t)&&(s==jn.DOWN||s==jn.LEFT||s==jn.RIGHT||s==jn.UP)){const r=t.map.getView(),a=r.getResolution()*this.pixelDelta_;let c=0,h=0;s==jn.DOWN?h=-a:s==jn.LEFT?c=-a:s==jn.RIGHT?c=a:h=a;const l=[c,h];Rc(l,r.getRotation()),p_(r,l,this.duration_),n.preventDefault(),e=!0}}return!e}}class I_ extends Po{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!v_(e)&&Bd(e)},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:100}handleEvent(t){let e=!1;if(t.type==ht.KEYDOWN||t.type==ht.KEYPRESS){const n=t.originalEvent,s=n.key;if(this.condition_(t)&&(s==="+"||s==="-")){const o=t.map,r=s==="+"?this.delta_:-this.delta_,a=o.getView();lh(a,r,void 0,this.duration_),n.preventDefault(),e=!0}}return!e}}class T_ extends Po{constructor(t){t=t||{},super(t),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=t.maxDelta!==void 0?t.maxDelta:1,this.duration_=t.duration!==void 0?t.duration:250,this.timeout_=t.timeout!==void 0?t.timeout:80,this.useAnchor_=t.useAnchor!==void 0?t.useAnchor:!0,this.constrainResolution_=t.constrainResolution!==void 0?t.constrainResolution:!1;const e=t.condition?t.condition:w_;this.condition_=t.onFocusOnly?dh(Wd,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(t){if(!this.condition_(t)||t.type!==ht.WHEEL)return!0;const n=t.map,s=t.originalEvent;s.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate);let o;if(t.type==ht.WHEEL&&(o=s.deltaY,Gp&&s.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(o/=su),s.deltaMode===WheelEvent.DOM_DELTA_LINE&&(o*=40)),o===0)return!1;this.lastDelta_=o;const r=Date.now();this.startTime_===void 0&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(o)<4?"trackpad":"wheel");const a=n.getView();if(this.mode_==="trackpad"&&!(a.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=r,!1;this.totalDelta_+=o;const c=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),c),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let n=-qt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),lh(e,n,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}class A_ extends Oo{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Rr),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=t.threshold!==void 0?t.threshold:.3,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){let e=0;const n=this.targetPointers[0],s=this.targetPointers[1],o=Math.atan2(s.clientY-n.clientY,s.clientX-n.clientX);if(this.lastAngle_!==void 0){const c=o-this.lastAngle_;this.rotationDelta_+=c,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=c}this.lastAngle_=o;const r=t.map,a=r.getView();a.getConstraints().rotation!==Hc&&(this.anchor_=r.getCoordinateFromPixelInternal(r.getEventPixel(uh(this.targetPointers))),this.rotating_&&(r.render(),a.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return this.targetPointers.length<2?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}class M_ extends Oo{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=Rr),super(e),this.anchor_=null,this.duration_=t.duration!==void 0?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const n=this.targetPointers[0],s=this.targetPointers[1],o=n.clientX-s.clientX,r=n.clientY-s.clientY,a=Math.sqrt(o*o+r*r);this.lastDistance_!==void 0&&(e=this.lastDistance_/a),this.lastDistance_=a;const c=t.map,h=c.getView();e!=1&&(this.lastScaleDelta_=e),this.anchor_=c.getCoordinateFromPixelInternal(c.getEventPixel(uh(this.targetPointers))),c.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const n=t.map.getView(),s=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,s),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}function Vd(i){i=i||{};const t=new Qe,e=new o_(-.005,.05,100);return(i.altShiftDragRotate!==void 0?i.altShiftDragRotate:!0)&&t.push(new x_),(i.doubleClickZoom!==void 0?i.doubleClickZoom:!0)&&t.push(new m_({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan!==void 0?i.dragPan:!0)&&t.push(new b_({onFocusOnly:i.onFocusOnly,kinetic:e})),(i.pinchRotate!==void 0?i.pinchRotate:!0)&&t.push(new A_),(i.pinchZoom!==void 0?i.pinchZoom:!0)&&t.push(new M_({duration:i.zoomDuration})),(i.keyboard!==void 0?i.keyboard:!0)&&(t.push(new O_),t.push(new I_({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom!==void 0?i.mouseWheelZoom:!0)&&t.push(new T_({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom!==void 0?i.shiftDragZoom:!0)&&t.push(new P_({duration:i.zoomDuration})),t}function Yd(i){if(i instanceof yo){i.setMapInternal(null);return}i instanceof sn&&i.getLayers().forEach(Yd)}function Hd(i,t){if(i instanceof yo){i.setMapInternal(t);return}if(i instanceof sn){const e=i.getLayers().getArray();for(let n=0,s=e.length;n<s;++n)Hd(e[n],t)}}let D_=class extends Ke{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=F_(t);this.renderComplete_,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading!==void 0?t.maxTilesLoading:16,this.pixelRatio_=t.pixelRatio!==void 0?t.pixelRatio:su,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=be(),this.pixelToCoordinateTransform_=be(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,this.resizeObserver_=new ResizeObserver(()=>this.updateSize()),this.controls=e.controls||jd(),this.interactions=e.interactions||Vd({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Ud(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(ee.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(ee.VIEW,this.handleViewChanged_),this.addChangeListener(ee.SIZE,this.handleSizeChanged_),this.addChangeListener(ee.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const n=this;t.view&&!(t.view instanceof ni)&&t.view.then(function(s){n.setView(new ni(s))}),this.controls.addEventListener(ue.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(ue.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(ue.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(ue.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(ue.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(ue.REMOVE,s=>{const o=s.element.getId();o!==void 0&&delete this.overlayIdIndex_[o.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){Hd(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,n){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);n=n!==void 0?n:{};const o=n.hitTolerance!==void 0?n.hitTolerance:0,r=n.layerFilter!==void 0?n.layerFilter:Ks,a=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,o,a,e,null,r,null)}getFeaturesAtPixel(t,e){const n=[];return this.forEachFeatureAtPixel(t,function(s){n.push(s)},e),n}getAllLayers(){const t=[];function e(n){n.forEach(function(s){s instanceof sn?e(s.getLayers()):t.push(s)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const n=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};const s=e.layerFilter!==void 0?e.layerFilter:Ks,o=e.hitTolerance!==void 0?e.hitTolerance:0,r=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,o,r,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const n=this.viewport_.getBoundingClientRect(),s=this.getSize(),o=n.width/s[0],r=n.height/s[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-n.left)/o,(a.clientY-n.top)/r]}getTarget(){return this.get(ee.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return Dc(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?Ut(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return e!==void 0?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(ee.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Qe){e.setLayers(t);return}const n=e.getLayers();n.clear(),n.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,n=t.length;e<n;++e){const s=t[e];if(!s.visible)continue;const o=s.layer.getRenderer();if(o&&!o.ready)return!0;const r=s.layer.getSource();if(r&&r.loading)return!0}return!1}getPixelFromCoordinate(t){const e=mi(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?Ut(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(ee.SIZE)}getView(){return this.get(ee.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,n,s){return u_(this.frameState_,t,e,n,s)}handleBrowserEvent(t,e){e=e||t.type;const n=new on(e,this,t);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,n=e.type;if(n===ch.POINTERDOWN||n===ht.WHEEL||n===ht.KEYDOWN){const s=this.getOwnerDocument(),o=this.viewport_.getRootNode?this.viewport_.getRootNode():s,r=e.target;if(this.overlayContainerStopEvent_.contains(r)||!(o===s?s.documentElement:o).contains(r))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){const s=this.getInteractions().getArray().slice();for(let o=s.length-1;o>=0;o--){const r=s[o];if(r.getMap()!==this||!r.getActive()||!this.getTargetElement())continue;if(!r.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let s=this.maxTilesLoading_,o=s;if(t){const r=t.viewHints;if(r[Vt.ANIMATING]||r[Vt.INTERACTING]){const a=Date.now()-t.time>8;s=a?0:8,o=a?0:2}}e.getTilesLoading()<s&&(e.reprioritize(),e.loadMoreTiles(s,o))}t&&this.renderer_&&!t.animate&&(this.renderComplete_===!0?(this.hasListener(ti.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(ti.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new bs(rn.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new bs(rn.LOADSTART,this,t))));const n=this.postRenderFunctions_;for(let s=0,o=n.length;s<o;++s)n[s](this,t);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let n=0,s=this.targetChangeHandlerKeys_.length;n<s;++n)Mt(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(ht.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(ht.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,jc(this.viewport_)}if(this.targetElement_){this.resizeObserver_.unobserve(this.targetElement_);const n=this.targetElement_.getRootNode();n instanceof ShadowRoot&&this.resizeObserver_.unobserve(n.host),this.setSize(void 0)}const t=this.getTarget(),e=typeof t=="string"?document.getElementById(t):t;if(this.targetElement_=e,!e)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new c_(this)),this.mapBrowserEventHandler_=new h_(this,this.moveTolerance_);for(const o in zt)this.mapBrowserEventHandler_.addEventListener(zt[o],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(ht.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(ht.WHEEL,this.boundHandleBrowserEvent_,ou?{passive:!1}:!1);const n=this.keyboardEventTarget_?this.keyboardEventTarget_:e;this.targetChangeHandlerKeys_=[Ct(n,ht.KEYDOWN,this.handleBrowserEvent,this),Ct(n,ht.KEYPRESS,this.handleBrowserEvent,this)];const s=e.getRootNode();s instanceof ShadowRoot&&this.resizeObserver_.observe(s.host),this.resizeObserver_.observe(e)}this.updateSize()}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(Mt(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(Mt(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(),this.viewPropertyListenerKey_=Ct(t,cs.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=Ct(t,ht.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(Mt),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new nn("addlayer",t)),this.layerGroupPropertyListenerKeys_=[Ct(t,cs.PROPERTYCHANGE,this.render,this),Ct(t,ht.CHANGE,this.render,this),Ct(t,"addlayer",this.handleLayerAdd_,this),Ct(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,n=t.length;e<n;++e){const s=t[e].layer;s.hasRenderer()&&s.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}flushDeclutterItems(){const t=this.frameState_;t&&this.renderer_.flushDeclutterItems(t)}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){Yd(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),n=this.getView(),s=this.frameState_;let o=null;if(e!==void 0&&Yu(e)&&n&&n.isDef()){const r=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(o={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutterTree:null,extent:vc(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:r,wantedTiles:{},mapId:St(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const c=isNaN(a.nextRotation)?a.rotation:a.nextRotation;o.nextExtent=vc(a.nextCenter,a.nextResolution,c,e)}}this.frameState_=o,this.renderer_.renderFrame(o),o&&(o.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,o.postRenderFunctions),s&&(!this.previousExtent_||!Xi(this.previousExtent_)&&!Yi(o.extent,this.previousExtent_))&&(this.dispatchEvent(new bs(rn.MOVESTART,this,s)),this.previousExtent_=oo(this.previousExtent_)),this.previousExtent_&&!o.viewHints[Vt.ANIMATING]&&!o.viewHints[Vt.INTERACTING]&&!Yi(o.extent,this.previousExtent_)&&(this.dispatchEvent(new bs(rn.MOVEEND,this,o)),cu(o.extent,this.previousExtent_))),this.dispatchEvent(new bs(rn.POSTRENDER,this,o)),this.renderComplete_=this.hasListener(rn.LOADSTART)||this.hasListener(rn.LOADEND)||this.hasListener(ti.RENDERCOMPLETE)?!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady():void 0,this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new nn("removelayer",e)),this.set(ee.LAYERGROUP,t)}setSize(t){this.set(ee.SIZE,t)}setTarget(t){this.set(ee.TARGET,t)}setView(t){if(!t||t instanceof ni){this.set(ee.VIEW,t);return}this.set(ee.VIEW,new ni);const e=this;t.then(function(n){e.setView(new ni(n))})}updateSize(){const t=this.getTargetElement();let e;if(t){const s=getComputedStyle(t),o=t.offsetWidth-parseFloat(s.borderLeftWidth)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)-parseFloat(s.borderRightWidth),r=t.offsetHeight-parseFloat(s.borderTopWidth)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)-parseFloat(s.borderBottomWidth);!isNaN(o)&&!isNaN(r)&&(e=[o,r],!Yu(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&yu("No map visible because the map container's width or height are 0."))}const n=this.getSize();e&&(!n||!Bi(e,n))&&(this.setSize(e),this.updateViewportSize_())}updateViewportSize_(){const t=this.getView();if(t){let e;const n=getComputedStyle(this.viewport_);n.width&&n.height&&(e=[parseInt(n.width,10),parseInt(n.height,10)]),t.setViewportSize(e)}}};function F_(i){let t=null;i.keyboardEventTarget!==void 0&&(t=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);const e={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new sn({layers:i.layers});e[ee.LAYERGROUP]=n,e[ee.TARGET]=i.target,e[ee.VIEW]=i.view instanceof ni?i.view:new ni;let s;i.controls!==void 0&&(Array.isArray(i.controls)?s=new Qe(i.controls.slice()):(pt(typeof i.controls.getArray=="function",47),s=i.controls));let o;i.interactions!==void 0&&(Array.isArray(i.interactions)?o=new Qe(i.interactions.slice()):(pt(typeof i.interactions.getArray=="function",48),o=i.interactions));let r;return i.overlays!==void 0?Array.isArray(i.overlays)?r=new Qe(i.overlays.slice()):(pt(typeof i.overlays.getArray=="function",49),r=i.overlays):r=new Qe,{controls:s,interactions:o,keyboardEventTarget:t,overlays:r,values:e}}class L_{constructor(t){this.highWaterMark=t!==void 0?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const n=this.entries_[t];return pt(n!==void 0,15),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(t){const e=this.entries_[t];return pt(e!==void 0,15),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e=0,n;for(n=this.newest_;n;n=n.older)t[e++]=n.key_;return t}getValues(){const t=new Array(this.count_);let e=0,n;for(n=this.newest_;n;n=n.older)t[e++]=n.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){if(this.containsKey(t))return this.entries_[t].value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){pt(!(t in this.entries_),16);const n={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[t]=n,++this.count_}setSize(t){this.highWaterMark=t}}function Xd(i,t,e,n){return n!==void 0?(n[0]=i,n[1]=t,n[2]=e,n):[i,t,e]}function na(i,t,e){return i+"/"+t+"/"+e}function $d(i){return na(i[0],i[1],i[2])}function z_(i){return i.split("/").map(Number)}function Zd(i){return(i[1]<<i[0])+i[2]}function N_(i,t){const e=i[0],n=i[1],s=i[2];if(t.getMinZoom()>e||e>t.getMaxZoom())return!1;const o=t.getFullTileRange(e);return o?o.containsXY(n,s):!0}class Kd extends L_{clear(){for(;this.getCount()>0;)this.pop().release();super.clear()}expireCache(t){for(;this.canExpireCache()&&!(this.peekLast().getKey()in t);)this.pop().release()}pruneExceptNewestZ(){if(this.getCount()===0)return;const t=this.peekFirstKey(),n=z_(t)[0];this.forEach(s=>{s.tileCoord[0]!==n&&(this.remove($d(s.tileCoord)),s.release())})}}class ph{constructor(t,e,n,s){this.minX=t,this.maxX=e,this.minY=n,this.maxY=s}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function xs(i,t,e,n,s){return s!==void 0?(s.minX=i,s.maxX=t,s.minY=e,s.maxY=n,s):new ph(i,t,e,n)}async function Qd(i,t=128,e=128,n="map",s=1){return new Promise((o,r)=>{i.renderSync();try{const a=i.getSize()||[t,e],c=document.createElement("canvas"),h=a[0]*s,l=a[1]*s;c.width=h,c.height=l;const u=c.getContext("2d",{willReadFrequently:!0});if(!u)throw new Error("Failed to create canvas context");Array.from(i.getViewport().querySelectorAll(".ol-layer canvas, canvas.ol-layer")).filter(_=>{if(!(_ instanceof HTMLCanvasElement)||_.width===0)return!1;try{return _.toDataURL("image/png"),!0}catch{return console.warn("跳过跨域图层:",_),!1}}).forEach(_=>{var b;const y=parseFloat(_.style.opacity||"1");u.globalAlpha=y;let w=[1,0,0,1,0,0];const E=_.style.transform;if(E){const[P,I,M,D,L,z]=((b=E.match(/^matrix\(([^)]+)\)$/))==null?void 0:b[1].split(",").map(Number))||[1,0,0,1,0,0];u.setTransform({a:P,b:I,c:M,d:D,e:L,f:z})}u.drawImage(_,0,0,h,l)}),u.globalAlpha=1,u.setTransform(1,0,0,1,0,0);const g=c.toDataURL("image/png");o(g)}catch(a){r(a)}})}function Jd(i,t){const{center:e,orbitPeriod:n,heading:s=0}=t,o=i.getView(),a=(d=>d*Math.PI/180)(s);let c,h,l=!0;const u=d=>{h||(h=d);const _=(d-h)%n/n,y=2*Math.PI*_+a;o.setRotation(-y),i.render(),l&&(c=requestAnimationFrame(u))};return c=requestAnimationFrame(u),{stop(){l=!1,cancelAnimationFrame(c),o.setRotation(0)}}}function U_(i,t){const e=yt(t),n=new Je({geometry:new Ge(e)});n.setStyle(new Xt({image:new ii({radius:6,fill:new de({color:"red"}),stroke:new Se({color:"white",width:2})}),text:new _o({text:"中心点可视化-测试后删除",font:"14px sans-serif",fill:new de({color:"black"}),stroke:new Se({color:"white",width:3}),offsetY:-15})}));const s=new oi({source:new Si({features:[n]})});i.addLayer(s)}class tf extends f.Destroyable{constructor(e,n,s){super();R(this,"keysPressed",{w:!1,a:!1,s:!1,d:!1});R(this,"animationId",0);R(this,"view");R(this,"updatePosition",()=>{const e=this.view.getCenter();if(!e)return;const n=this.view.getZoom()??10,s=1e3/Math.pow(2,n-10);let[o,r]=e;this.keysPressed.w&&(r+=s),this.keysPressed.s&&(r-=s),this.keysPressed.a&&(o-=s),this.keysPressed.d&&(o+=s),this.view.setCenter([o,r]),this.animationId=requestAnimationFrame(this.updatePosition)});this.map=n,this.view=n.getView(),this.view.setCenter(yt(s));const o=c=>{c.key in this.keysPressed&&(this.keysPressed[c.key]=!0)},r=c=>{c.key in this.keysPressed&&(this.keysPressed[c.key]=!1)},a=c=>{c.preventDefault();const h=this.view.getZoom()??10,l=c.deltaY>0?-1:1;this.view.setZoom(h+l)};e.addEventListener("keydown",o),e.addEventListener("keyup",r),n.getTargetElement().addEventListener("wheel",a,{passive:!1}),this.d(()=>e.removeEventListener("keydown",o)),this.d(()=>e.removeEventListener("keyup",r)),this.d(()=>n.getTargetElement().removeEventListener("wheel",a)),this.animationId=requestAnimationFrame(this.updatePosition),this.d(()=>cancelAnimationFrame(this.animationId))}}function j_(i){const e=Math.PI/3,n=256,s=i*2*Math.tan(e/2)/i,o=Math.log2(2*Math.PI*6378137/(s*n));return parseFloat(o.toFixed(3))}function Io(i){return 6378137/Math.pow(2,i-5)}function kn(i){const e=Math.log2(6378137/i)+5+0;return Math.min(28,Math.max(0,e))}class ef extends f.Destroyable{constructor(e){super();R(this,"lastTime",performance.now());R(this,"frameCount",0);R(this,"currentFPS",0);R(this,"map");R(this,"calculateFPS",()=>{const e=performance.now();this.frameCount++,e-this.lastTime>=1e3&&(this.currentFPS=Math.round(this.frameCount*1e3/(e-this.lastTime)),this.frameCount=0,this.lastTime=e)});this.map=e,this.map.on("postrender",this.calculateFPS),this.d(()=>{this.map.un("postrender",this.calculateFPS)})}getFPS(){return this.currentFPS}}const nf=[0,-90,0];function sf(i,t){const e=i.viewer;if(!e)return;const n=e.getView(),{position:s,rotation:o,duration:r=1e3,hdelta:a,pdelta:c,cancelCallback:h}=t;if(!s)return;const[l,u,d]=s,g=yt([l,u]),_=(kn==null?void 0:kn(d))??n.getZoom(),w=(((o==null?void 0:o[0])??0)+(a??0))*Math.PI/180,E={center:g,zoom:_,rotation:-w,duration:r};try{return n.animate(E,()=>{}),Promise.resolve(!0)}catch{return h==null||h(),Promise.resolve(!1)}}function Ri(i,t,e,n,s,o){return(i==null?void 0:i.viewer)&&sf(i,{position:t,rotation:n,duration:s&&s*1e3,cancelCallback:o})}function sa(i){const t=i.map(e=>yt([e[0],e[1]]));return Ir(t)}const To=(i,t,e=1,n=350)=>{i.getView().fit(t,{duration:e*1e3,padding:Array.isArray(n)?n:[n,n,n,n]})},k_=(i,t,e=1,n=350)=>{const s=sa(t);To(i,s,e,n)},mh=(i,t,e=1,n=350)=>{const s=yt([t[0],t[1]]),o=Ir([s]);To(i,o,e,n)},W_=(i,t,e)=>{};function of(i,t){const e=i.viewer;if(!e)throw new Error("viewer.map is undefined");const n=e.getView(),s=n.getCenter();if(!s)throw new Error("view center is undefined");const o=n.getZoom(),r=(Io==null?void 0:Io(o??0))??0;return[s[0],s[1],r]}class q_ extends f.Destroyable{constructor(e,n){super();R(this,"_map");R(this,"_view");R(this,"_enabled",!0);R(this,"_keys",[]);R(this,"_changed",new f.Event);R(this,"_options");R(this,"_rafPending",!1);R(this,"_rafId",null);R(this,"_lastEmit",0);if(this._options={emitImmediately:!0,usePostRender:!1,throttleMs:0,useRaf:!0,...n},e instanceof Rn.Map){this._map=e;const s=this._map.getView();if(!s)throw new Error("OlViewChanged: map.getView() is undefined");this._view=s}else this._view=e;this._attach(),this.dispose(()=>this._detach()),this._options.emitImmediately&&this._emit()}get changed(){return this._changed}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,e&&this._emit())}attachMap(e){this._map!==e&&(this._detach(),this._map=e,this._attach(),this._emit())}_on(e,n,s){const o=e.on(n,s);return this._keys.push(o),this.dispose(()=>gi(o)),o}_attach(){this._on(this._view,"change:center",()=>this._scheduleEmit()),this._on(this._view,"change:resolution",()=>this._scheduleEmit()),this._on(this._view,"change:rotation",()=>this._scheduleEmit()),this._map&&(this._on(this._map,"change:size",()=>this._scheduleEmit()),this._options.usePostRender&&this._on(this._map,"postrender",()=>this._scheduleEmit()))}_detach(){this._keys.forEach(gi),this._keys.length=0,this._rafId!=null&&(cancelAnimationFrame(this._rafId),this._rafId=null,this._rafPending=!1)}_scheduleEmit(){if(this._enabled){if(this._options.useRaf){if(this._rafPending)return;this._rafPending=!0,this._rafId=requestAnimationFrame(()=>{this._rafPending=!1,this._rafId=null,this._emitWithThrottle()});return}this._emitWithThrottle()}}_emitWithThrottle(){const e=performance.now();this._options.throttleMs>0&&e-this._lastEmit<this._options.throttleMs||(this._lastEmit=e,this._emit())}_emit(){this._enabled&&this._changed.emit()}}async function rf(i,t,e,n){if(!i)throw new Error("olMap is undefined");await Promise.resolve();const s=i.getEventPixel(t);if(!s)return;const o=i.getCoordinateFromPixel(s);if(!o)return;const[r,a]=Kt(o),c=e??0;return n?(n[0]=r,n[1]=a,n[2]=c,n):[r,a,c]}function af(i,t,e,n,s,o){s.constraintMode="none",s.startDragPos=[0,0,0];const r=t.getEventPixel(i),a=t.getCoordinateFromPixel(r);if(!a)return!1;const c=Kt(a),h=[c[0],c[1],e.position[2]],l=e.position,u=e.heading,d=G_(t,n,l),g=(_,y)=>{const w=B_(l,h,_),E=f.geoRhumbDistance(l,h);if(w>.98&&E<d&&!(o!=null&&o[y])){s.constraintMode=y;const b=f.geoRhumbDestination(l,E,_);if(b)return s.startDragPos=[b[0],b[1],l[2]],!0}return!1};return g(u+90,"x")||g(u,"y")?!0:!(o!=null&&o.xy)&&f.geoRhumbDistance(l,h)<d?(s.constraintMode="xy",s.startDragPos=h,!0):!1}function G_(i,t,e){const n=i.getPixelFromCoordinate(yt([e[0],e[1]])),s=[n[0]+t,n[1]],o=Kt(i.getCoordinateFromPixel(s));return f.geoRhumbDistance([e[0],e[1],0],[o[0],o[1],0])}function B_(i,t,e){const n=f.geoRhumbHeading(i,t),s=e*Math.PI/180,o=n*Math.PI/180;return Math.cos(s)*Math.cos(o)+Math.sin(s)*Math.sin(o)}function an(i,t,e,n){const s=f.geoRhumbDistance(i,e),o=f.geoRhumbHeading(i,e),r=Math.cos(o*Math.PI/180)*Math.cos(t*Math.PI/180)+Math.sin(o*Math.PI/180)*Math.sin(t*Math.PI/180);return r>0?f.geoRhumbDestination(i,s,t,n):f.geoRhumbDestination(i,s,t+180,n),[r>0?s:-s,n]}function V_(i,t,e){const n=e*.1,s=[];for(let o=-9;o<10;++o){const r=f.geoRhumbDestination(i,n*o,t);r&&s.push(r)}return s}function Y_(i,t){return f.geoNearestPointOnLine(i,t).geometry.coordinates}function H_(i,t,e,n=10){const s={constraintMode:"none",startDragPos:[0,0,0]},o=i.getPixelFromCoordinate(yt([e.position[0],e.position[1]])),r=i.getEventPixel(t),a=r[0]-o[0],c=r[1]-o[1],l=(Math.atan2(-c,a)*(180/Math.PI)-e.heading+360)%360;Math.abs(a)<n&&Math.abs(c)<n?s.constraintMode="xy":l>=75&&l<=105||l>=255&&l<=285?s.constraintMode="y":l<=15||l>=345||l>=165&&l<=195?s.constraintMode="x":s.constraintMode="xy";const[u,d]=Kt(i.getCoordinateFromPixel(r));return s.startDragPos=[u,d,e.position[2]],s}function X_(i,t,e){const n=i.getPixelFromCoordinate(t),s=[n[0]+e,n[1]],o=i.getCoordinateFromPixel(s);if(!o)return 1/0;const[r,a]=Kt(o),[c,h]=Kt(t);return Math.abs(f.geoRhumbDistance([c,h,0],[r,a,0]))}function cf(i,t,e,n,s,o){const r=s-e,a=o-n,c=i-e,h=t-n,l=r*c+a*h;if(l<=0)return Math.hypot(i-e,t-n);const u=r*r+a*a;if(u<=l)return Math.hypot(i-s,t-o);const d=l/u,g=e+d*r,_=n+d*a;return Math.hypot(i-g,t-_)}function hf(i,t,e,n=8,s,o){const r=s??{constraintMode:"none",startDragPos:[0,0,0]};r.constraintMode="none",r.startDragPos=[0,0,0];const a=yt([e.position[0],e.position[1]]),c=i.getPixelFromCoordinate(a);if(!c)return r;const h=i.getEventPixel(t),[l,u]=h,d=Math.max(1e-6,e.dimensions[0]),g=e.heading,_=f.geoRhumbDestination(e.position,d,g+90),y=f.geoRhumbDestination(e.position,d,g+0);if(!_||!y)return r;const w=a,E=a,b=yt([_[0],_[1]]),P=yt([y[0],y[1]]),I=i.getPixelFromCoordinate(w),M=i.getPixelFromCoordinate(b),D=i.getPixelFromCoordinate(E),L=i.getPixelFromCoordinate(P),z=X_(i,a,n),Y=Math.hypot(l-c[0],u-c[1])<=n,X=cf(l,u,I[0],I[1],M[0],M[1]),Q=cf(l,u,D[0],D[1],L[0],L[1]);if(!(o!=null&&o.zAxis)){const S=d,A=f.geoRhumbDestination(e.position,S,g);if(!A)return r;const F=i.getPixelFromCoordinate(yt([A[0],A[1]]));Math.hypot(F[0]-c[0],F[1]-c[1])}let m="none";!(o!=null&&o.x)&&X<=n&&X<Q&&(m="x"),!(o!=null&&o.y)&&Q<=n&&Q<X&&(m="y");const v=Kt(i.getCoordinateFromPixel(h));if(m==="x"||m==="y"){const S=m==="x"?g+90:g+0,[A,F]=an(e.position,S,[v[0],v[1],e.position[2]]);if(A>0&&F&&f.geoDistance(F,[v[0],v[1],e.position[2]])<=z)return r.constraintMode=m,r.startDragPos=[F[0],F[1],e.position[2]],r}return!(o!=null&&o.xy)&&(Y||!0)&&(r.constraintMode="xy",r.startDragPos=[v[0],v[1],e.position[2]]),r}class lf extends f.Destroyable{constructor(t,e,n,s=100){super();const o=t.getView(),[r,a]=f.getReactFuncs(n),c=()=>{const l=o.getZoom()??0,u=s*Math.pow(2,10-l);a([u,u,u])};c();const h=()=>c();o.on("change:resolution",h),this.ad(()=>o.un("change:resolution",h))}}function C(i){return i!=null}function j(i){this.name="DeveloperError",this.message=i;let t;try{throw new Error}catch(e){t=e.stack}this.stack=t}C(Object.create)&&(j.prototype=Object.create(Error.prototype),j.prototype.constructor=j),j.prototype.toString=function(){let i=`${this.name}: ${this.message}`;return C(this.stack)&&(i+=`
|
|
30
30
|
${this.stack.toString()}`),i},j.throwInstantiationError=function(){throw new j("This function defines an interface and should not be called directly.")};const p={};p.typeOf={};function $_(i){return`${i} is required, actual value was undefined`}function Ss(i,t,e){return`Expected ${e} to be typeof ${t}, actual typeof was ${i}`}p.defined=function(i,t){if(!C(t))throw new j($_(i))},p.typeOf.func=function(i,t){if(typeof t!="function")throw new j(Ss(typeof t,"function",i))},p.typeOf.string=function(i,t){if(typeof t!="string")throw new j(Ss(typeof t,"string",i))},p.typeOf.number=function(i,t){if(typeof t!="number")throw new j(Ss(typeof t,"number",i))},p.typeOf.number.lessThan=function(i,t,e){if(p.typeOf.number(i,t),t>=e)throw new j(`Expected ${i} to be less than ${e}, actual value was ${t}`)},p.typeOf.number.lessThanOrEquals=function(i,t,e){if(p.typeOf.number(i,t),t>e)throw new j(`Expected ${i} to be less than or equal to ${e}, actual value was ${t}`)},p.typeOf.number.greaterThan=function(i,t,e){if(p.typeOf.number(i,t),t<=e)throw new j(`Expected ${i} to be greater than ${e}, actual value was ${t}`)},p.typeOf.number.greaterThanOrEquals=function(i,t,e){if(p.typeOf.number(i,t),t<e)throw new j(`Expected ${i} to be greater than or equal to ${e}, actual value was ${t}`)},p.typeOf.object=function(i,t){if(typeof t!="object")throw new j(Ss(typeof t,"object",i))},p.typeOf.bool=function(i,t){if(typeof t!="boolean")throw new j(Ss(typeof t,"boolean",i))},p.typeOf.bigint=function(i,t){if(typeof t!="bigint")throw new j(Ss(typeof t,"bigint",i))},p.typeOf.number.equals=function(i,t,e,n){if(p.typeOf.number(i,e),p.typeOf.number(t,n),e!==n)throw new j(`${i} must be equal to ${t}, the actual values are ${e} and ${n}`)};var uf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function df(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var _h,ff;function Z_(){if(ff)return _h;ff=1;var i=function(t){t==null&&(t=new Date().getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,t.constructor==Array?this.init_by_array(t,t.length):this.init_seed(t)};return i.prototype.init_seed=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti<this.N;this.mti++){var t=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(((t&4294901760)>>>16)*1812433253<<16)+(t&65535)*1812433253+this.mti,this.mt[this.mti]>>>=0}},i.prototype.init_by_array=function(t,e){var n,s,o;for(this.init_seed(19650218),n=1,s=0,o=this.N>e?this.N:e;o;o--){var r=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(((r&4294901760)>>>16)*1664525<<16)+(r&65535)*1664525)+t[s]+s,this.mt[n]>>>=0,n++,s++,n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1),s>=e&&(s=0)}for(o=this.N-1;o;o--){var r=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(((r&4294901760)>>>16)*1566083941<<16)+(r&65535)*1566083941)-n,this.mt[n]>>>=0,n++,n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1)}this.mt[0]=2147483648},i.prototype.random_int=function(){var t,e=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_seed(5489),n=0;n<this.N-this.M;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^t>>>1^e[t&1];for(;n<this.N-1;n++)t=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^t>>>1^e[t&1];t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^t>>>1^e[t&1],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=t<<7&2636928640,t^=t<<15&4022730752,t^=t>>>18,t>>>0},i.prototype.random_int31=function(){return this.random_int()>>>1},i.prototype.random_incl=function(){return this.random_int()*23283064370807974e-26},i.prototype.random=function(){return this.random_int()*23283064365386963e-26},i.prototype.random_excl=function(){return(this.random_int()+.5)*23283064365386963e-26},i.prototype.random_long=function(){var t=this.random_int()>>>5,e=this.random_int()>>>6;return(t*67108864+e)*11102230246251565e-32},_h=i,_h}var K_=Z_();const gf=df(K_),T={};T.EPSILON1=.1,T.EPSILON2=.01,T.EPSILON3=.001,T.EPSILON4=1e-4,T.EPSILON5=1e-5,T.EPSILON6=1e-6,T.EPSILON7=1e-7,T.EPSILON8=1e-8,T.EPSILON9=1e-9,T.EPSILON10=1e-10,T.EPSILON11=1e-11,T.EPSILON12=1e-12,T.EPSILON13=1e-13,T.EPSILON14=1e-14,T.EPSILON15=1e-15,T.EPSILON16=1e-16,T.EPSILON17=1e-17,T.EPSILON18=1e-18,T.EPSILON19=1e-19,T.EPSILON20=1e-20,T.EPSILON21=1e-21,T.GRAVITATIONALPARAMETER=3986004418e5,T.SOLAR_RADIUS=6955e5,T.LUNAR_RADIUS=1737400,T.SIXTY_FOUR_KILOBYTES=65536,T.FOUR_GIGABYTES=4294967296,T.sign=Math.sign??function(t){return t=+t,t===0||t!==t?t:t>0?1:-1},T.signNotZero=function(i){return i<0?-1:1},T.toSNorm=function(i,t){return t=t??255,Math.round((T.clamp(i,-1,1)*.5+.5)*t)},T.fromSNorm=function(i,t){return t=t??255,T.clamp(i,0,t)/t*2-1},T.normalize=function(i,t,e){return e=Math.max(e-t,0),e===0?0:T.clamp((i-t)/e,0,1)},T.sinh=Math.sinh??function(t){return(Math.exp(t)-Math.exp(-t))/2},T.cosh=Math.cosh??function(t){return(Math.exp(t)+Math.exp(-t))/2},T.lerp=function(i,t,e){return(1-e)*i+e*t},T.PI=Math.PI,T.ONE_OVER_PI=1/Math.PI,T.PI_OVER_TWO=Math.PI/2,T.PI_OVER_THREE=Math.PI/3,T.PI_OVER_FOUR=Math.PI/4,T.PI_OVER_SIX=Math.PI/6,T.THREE_PI_OVER_TWO=3*Math.PI/2,T.TWO_PI=2*Math.PI,T.ONE_OVER_TWO_PI=1/(2*Math.PI),T.RADIANS_PER_DEGREE=Math.PI/180,T.DEGREES_PER_RADIAN=180/Math.PI,T.RADIANS_PER_ARCSECOND=T.RADIANS_PER_DEGREE/3600,T.toRadians=function(i){if(!C(i))throw new j("degrees is required.");return i*T.RADIANS_PER_DEGREE},T.toDegrees=function(i){if(!C(i))throw new j("radians is required.");return i*T.DEGREES_PER_RADIAN},T.convertLongitudeRange=function(i){if(!C(i))throw new j("angle is required.");const t=T.TWO_PI,e=i-Math.floor(i/t)*t;return e<-Math.PI?e+t:e>=Math.PI?e-t:e},T.clampToLatitudeRange=function(i){if(!C(i))throw new j("angle is required.");return T.clamp(i,-1*T.PI_OVER_TWO,T.PI_OVER_TWO)},T.negativePiToPi=function(i){if(!C(i))throw new j("angle is required.");return i>=-T.PI&&i<=T.PI?i:T.zeroToTwoPi(i+T.PI)-T.PI},T.zeroToTwoPi=function(i){if(!C(i))throw new j("angle is required.");if(i>=0&&i<=T.TWO_PI)return i;const t=T.mod(i,T.TWO_PI);return Math.abs(t)<T.EPSILON14&&Math.abs(i)>T.EPSILON14?T.TWO_PI:t},T.mod=function(i,t){if(!C(i))throw new j("m is required.");if(!C(t))throw new j("n is required.");if(t===0)throw new j("divisor cannot be 0.");return T.sign(i)===T.sign(t)&&Math.abs(i)<Math.abs(t)?i:(i%t+t)%t},T.equalsEpsilon=function(i,t,e,n){if(!C(i))throw new j("left is required.");if(!C(t))throw new j("right is required.");e=e??0,n=n??e;const s=Math.abs(i-t);return s<=n||s<=e*Math.max(Math.abs(i),Math.abs(t))},T.lessThan=function(i,t,e){if(!C(i))throw new j("first is required.");if(!C(t))throw new j("second is required.");if(!C(e))throw new j("absoluteEpsilon is required.");return i-t<-e},T.lessThanOrEquals=function(i,t,e){if(!C(i))throw new j("first is required.");if(!C(t))throw new j("second is required.");if(!C(e))throw new j("absoluteEpsilon is required.");return i-t<e},T.greaterThan=function(i,t,e){if(!C(i))throw new j("first is required.");if(!C(t))throw new j("second is required.");if(!C(e))throw new j("absoluteEpsilon is required.");return i-t>e},T.greaterThanOrEquals=function(i,t,e){if(!C(i))throw new j("first is required.");if(!C(t))throw new j("second is required.");if(!C(e))throw new j("absoluteEpsilon is required.");return i-t>-e};const oa=[1];T.factorial=function(i){if(typeof i!="number"||i<0)throw new j("A number greater than or equal to 0 is required.");const t=oa.length;if(i>=t){let e=oa[t-1];for(let n=t;n<=i;n++){const s=e*n;oa.push(s),e=s}}return oa[i]},T.incrementWrap=function(i,t,e){if(e=e??0,!C(i))throw new j("n is required.");if(t<=e)throw new j("maximumValue must be greater than minimumValue.");return++i,i>t&&(i=e),i},T.isPowerOfTwo=function(i){if(typeof i!="number"||i<0||i>4294967295)throw new j("A number between 0 and (2^32)-1 is required.");return i!==0&&(i&i-1)===0},T.nextPowerOfTwo=function(i){if(typeof i!="number"||i<0||i>2147483648)throw new j("A number between 0 and 2^31 is required.");return--i,i|=i>>1,i|=i>>2,i|=i>>4,i|=i>>8,i|=i>>16,++i,i},T.previousPowerOfTwo=function(i){if(typeof i!="number"||i<0||i>4294967295)throw new j("A number between 0 and (2^32)-1 is required.");return i|=i>>1,i|=i>>2,i|=i>>4,i|=i>>8,i|=i>>16,i|=i>>32,i=(i>>>0)-(i>>>1),i},T.clamp=function(i,t,e){return p.typeOf.number("value",i),p.typeOf.number("min",t),p.typeOf.number("max",e),i<t?t:i>e?e:i};let pf=new gf;T.setRandomNumberSeed=function(i){if(!C(i))throw new j("seed is required.");pf=new gf(i)},T.nextRandomNumber=function(){return pf.random()},T.randomBetween=function(i,t){return T.nextRandomNumber()*(t-i)+i},T.acosClamped=function(i){if(!C(i))throw new j("value is required.");return Math.acos(T.clamp(i,-1,1))},T.asinClamped=function(i){if(!C(i))throw new j("value is required.");return Math.asin(T.clamp(i,-1,1))},T.chordLength=function(i,t){if(!C(i))throw new j("angle is required.");if(!C(t))throw new j("radius is required.");return 2*t*Math.sin(i*.5)},T.logBase=function(i,t){if(!C(i))throw new j("number is required.");if(!C(t))throw new j("base is required.");return Math.log(i)/Math.log(t)},T.cbrt=Math.cbrt??function(t){const e=Math.pow(Math.abs(t),.3333333333333333);return t<0?-e:e},T.log2=Math.log2??function(t){return Math.log(t)*Math.LOG2E},T.fog=function(i,t){const e=i*t;return 1-Math.exp(-(e*e))},T.fastApproximateAtan=function(i){return p.typeOf.number("x",i),i*(-.1784*Math.abs(i)-.0663*i*i+1.0301)},T.fastApproximateAtan2=function(i,t){p.typeOf.number("x",i),p.typeOf.number("y",t);let e,n=Math.abs(i);e=Math.abs(t);const s=Math.max(n,e);e=Math.min(n,e);const o=e/s;if(isNaN(o))throw new j("either x or y must be nonzero");return n=T.fastApproximateAtan(o),n=Math.abs(t)>Math.abs(i)?T.PI_OVER_TWO-n:n,n=i<0?T.PI-n:n,n=t<0?-n:n,n};function O(i,t,e){this.x=i??0,this.y=t??0,this.z=e??0}O.fromSpherical=function(i,t){p.typeOf.object("spherical",i),C(t)||(t=new O);const e=i.clock,n=i.cone,s=i.magnitude??1,o=s*Math.sin(n);return t.x=o*Math.cos(e),t.y=o*Math.sin(e),t.z=s*Math.cos(n),t},O.fromElements=function(i,t,e,n){return C(n)?(n.x=i,n.y=t,n.z=e,n):new O(i,t,e)},O.clone=function(i,t){if(C(i))return C(t)?(t.x=i.x,t.y=i.y,t.z=i.z,t):new O(i.x,i.y,i.z)},O.fromCartesian4=O.clone,O.packedLength=3,O.pack=function(i,t,e){return p.typeOf.object("value",i),p.defined("array",t),e=e??0,t[e++]=i.x,t[e++]=i.y,t[e]=i.z,t},O.unpack=function(i,t,e){return p.defined("array",i),t=t??0,C(e)||(e=new O),e.x=i[t++],e.y=i[t++],e.z=i[t],e},O.packArray=function(i,t){p.defined("array",i);const e=i.length,n=e*3;if(!C(t))t=new Array(n);else{if(!Array.isArray(t)&&t.length!==n)throw new j("If result is a typed array, it must have exactly array.length * 3 elements");t.length!==n&&(t.length=n)}for(let s=0;s<e;++s)O.pack(i[s],t,s*3);return t},O.unpackArray=function(i,t){if(p.defined("array",i),p.typeOf.number.greaterThanOrEquals("array.length",i.length,3),i.length%3!==0)throw new j("array length must be a multiple of 3.");const e=i.length;C(t)?t.length=e/3:t=new Array(e/3);for(let n=0;n<e;n+=3){const s=n/3;t[s]=O.unpack(i,n,t[s])}return t},O.fromArray=O.unpack,O.maximumComponent=function(i){return p.typeOf.object("cartesian",i),Math.max(i.x,i.y,i.z)},O.minimumComponent=function(i){return p.typeOf.object("cartesian",i),Math.min(i.x,i.y,i.z)},O.minimumByComponent=function(i,t,e){return p.typeOf.object("first",i),p.typeOf.object("second",t),p.typeOf.object("result",e),e.x=Math.min(i.x,t.x),e.y=Math.min(i.y,t.y),e.z=Math.min(i.z,t.z),e},O.maximumByComponent=function(i,t,e){return p.typeOf.object("first",i),p.typeOf.object("second",t),p.typeOf.object("result",e),e.x=Math.max(i.x,t.x),e.y=Math.max(i.y,t.y),e.z=Math.max(i.z,t.z),e},O.clamp=function(i,t,e,n){p.typeOf.object("value",i),p.typeOf.object("min",t),p.typeOf.object("max",e),p.typeOf.object("result",n);const s=T.clamp(i.x,t.x,e.x),o=T.clamp(i.y,t.y,e.y),r=T.clamp(i.z,t.z,e.z);return n.x=s,n.y=o,n.z=r,n},O.magnitudeSquared=function(i){return p.typeOf.object("cartesian",i),i.x*i.x+i.y*i.y+i.z*i.z},O.magnitude=function(i){return Math.sqrt(O.magnitudeSquared(i))};const ra=new O;O.distance=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),O.subtract(i,t,ra),O.magnitude(ra)},O.distanceSquared=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),O.subtract(i,t,ra),O.magnitudeSquared(ra)},O.normalize=function(i,t){p.typeOf.object("cartesian",i),p.typeOf.object("result",t);const e=O.magnitude(i);if(t.x=i.x/e,t.y=i.y/e,t.z=i.z/e,isNaN(t.x)||isNaN(t.y)||isNaN(t.z))throw new j("normalized result is not a number");return t},O.dot=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),i.x*t.x+i.y*t.y+i.z*t.z},O.multiplyComponents=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x*t.x,e.y=i.y*t.y,e.z=i.z*t.z,e},O.divideComponents=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x/t.x,e.y=i.y/t.y,e.z=i.z/t.z,e},O.add=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x+t.x,e.y=i.y+t.y,e.z=i.z+t.z,e},O.subtract=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x-t.x,e.y=i.y-t.y,e.z=i.z-t.z,e},O.multiplyByScalar=function(i,t,e){return p.typeOf.object("cartesian",i),p.typeOf.number("scalar",t),p.typeOf.object("result",e),e.x=i.x*t,e.y=i.y*t,e.z=i.z*t,e},O.divideByScalar=function(i,t,e){return p.typeOf.object("cartesian",i),p.typeOf.number("scalar",t),p.typeOf.object("result",e),e.x=i.x/t,e.y=i.y/t,e.z=i.z/t,e},O.negate=function(i,t){return p.typeOf.object("cartesian",i),p.typeOf.object("result",t),t.x=-i.x,t.y=-i.y,t.z=-i.z,t},O.abs=function(i,t){return p.typeOf.object("cartesian",i),p.typeOf.object("result",t),t.x=Math.abs(i.x),t.y=Math.abs(i.y),t.z=Math.abs(i.z),t};const mf=new O;O.lerp=function(i,t,e,n){return p.typeOf.object("start",i),p.typeOf.object("end",t),p.typeOf.number("t",e),p.typeOf.object("result",n),O.multiplyByScalar(t,e,mf),n=O.multiplyByScalar(i,1-e,n),O.add(mf,n,n)};const aa=new O,yh=new O;O.angleBetween=function(i,t){p.typeOf.object("left",i),p.typeOf.object("right",t),O.normalize(i,aa),O.normalize(t,yh);const e=O.dot(aa,yh),n=O.magnitude(O.cross(aa,yh,aa));return Math.atan2(n,e)};const Q_=new O;O.mostOrthogonalAxis=function(i,t){p.typeOf.object("cartesian",i),p.typeOf.object("result",t);const e=O.normalize(i,Q_);return O.abs(e,e),e.x<=e.y?e.x<=e.z?t=O.clone(O.UNIT_X,t):t=O.clone(O.UNIT_Z,t):e.y<=e.z?t=O.clone(O.UNIT_Y,t):t=O.clone(O.UNIT_Z,t),t},O.projectVector=function(i,t,e){p.defined("a",i),p.defined("b",t),p.defined("result",e);const n=O.dot(i,t)/O.dot(t,t);return O.multiplyByScalar(t,n,e)},O.equals=function(i,t){return i===t||C(i)&&C(t)&&i.x===t.x&&i.y===t.y&&i.z===t.z},O.equalsArray=function(i,t,e){return i.x===t[e]&&i.y===t[e+1]&&i.z===t[e+2]},O.equalsEpsilon=function(i,t,e,n){return i===t||C(i)&&C(t)&&T.equalsEpsilon(i.x,t.x,e,n)&&T.equalsEpsilon(i.y,t.y,e,n)&&T.equalsEpsilon(i.z,t.z,e,n)},O.cross=function(i,t,e){p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e);const n=i.x,s=i.y,o=i.z,r=t.x,a=t.y,c=t.z,h=s*c-o*a,l=o*r-n*c,u=n*a-s*r;return e.x=h,e.y=l,e.z=u,e},O.midpoint=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=(i.x+t.x)*.5,e.y=(i.y+t.y)*.5,e.z=(i.z+t.z)*.5,e},O.fromDegrees=function(i,t,e,n,s){return p.typeOf.number("longitude",i),p.typeOf.number("latitude",t),i=T.toRadians(i),t=T.toRadians(t),O.fromRadians(i,t,e,n,s)};let Me=new O,Rs=new O;O._ellipsoidRadiiSquared=new O(40680631590769,40680631590769,40408299984661445e-3),O.fromRadians=function(i,t,e,n,s){p.typeOf.number("longitude",i),p.typeOf.number("latitude",t),e=e??0;const o=C(n)?n.radiiSquared:O._ellipsoidRadiiSquared,r=Math.cos(t);Me.x=r*Math.cos(i),Me.y=r*Math.sin(i),Me.z=Math.sin(t),Me=O.normalize(Me,Me),O.multiplyComponents(o,Me,Rs);const a=Math.sqrt(O.dot(Me,Rs));return Rs=O.divideByScalar(Rs,a,Rs),Me=O.multiplyByScalar(Me,e,Me),C(s)||(s=new O),O.add(Rs,Me,s)},O.fromDegreesArray=function(i,t,e){if(p.defined("coordinates",i),i.length<2||i.length%2!==0)throw new j("the number of coordinates must be a multiple of 2 and at least 2");const n=i.length;C(e)?e.length=n/2:e=new Array(n/2);for(let s=0;s<n;s+=2){const o=i[s],r=i[s+1],a=s/2;e[a]=O.fromDegrees(o,r,0,t,e[a])}return e},O.fromRadiansArray=function(i,t,e){if(p.defined("coordinates",i),i.length<2||i.length%2!==0)throw new j("the number of coordinates must be a multiple of 2 and at least 2");const n=i.length;C(e)?e.length=n/2:e=new Array(n/2);for(let s=0;s<n;s+=2){const o=i[s],r=i[s+1],a=s/2;e[a]=O.fromRadians(o,r,0,t,e[a])}return e},O.fromDegreesArrayHeights=function(i,t,e){if(p.defined("coordinates",i),i.length<3||i.length%3!==0)throw new j("the number of coordinates must be a multiple of 3 and at least 3");const n=i.length;C(e)?e.length=n/3:e=new Array(n/3);for(let s=0;s<n;s+=3){const o=i[s],r=i[s+1],a=i[s+2],c=s/3;e[c]=O.fromDegrees(o,r,a,t,e[c])}return e},O.fromRadiansArrayHeights=function(i,t,e){if(p.defined("coordinates",i),i.length<3||i.length%3!==0)throw new j("the number of coordinates must be a multiple of 3 and at least 3");const n=i.length;C(e)?e.length=n/3:e=new Array(n/3);for(let s=0;s<n;s+=3){const o=i[s],r=i[s+1],a=i[s+2],c=s/3;e[c]=O.fromRadians(o,r,a,t,e[c])}return e},O.ZERO=Object.freeze(new O(0,0,0)),O.ONE=Object.freeze(new O(1,1,1)),O.UNIT_X=Object.freeze(new O(1,0,0)),O.UNIT_Y=Object.freeze(new O(0,1,0)),O.UNIT_Z=Object.freeze(new O(0,0,1)),O.prototype.clone=function(i){return O.clone(this,i)},O.prototype.equals=function(i){return O.equals(this,i)},O.prototype.equalsEpsilon=function(i,t,e){return O.equalsEpsilon(this,i,t,e)},O.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z})`};const J_=new O,ty=new O;function _f(i,t,e,n,s){if(!C(i))throw new j("cartesian is required.");if(!C(t))throw new j("oneOverRadii is required.");if(!C(e))throw new j("oneOverRadiiSquared is required.");if(!C(n))throw new j("centerToleranceSquared is required.");const o=i.x,r=i.y,a=i.z,c=t.x,h=t.y,l=t.z,u=o*o*c*c,d=r*r*h*h,g=a*a*l*l,_=u+d+g,y=Math.sqrt(1/_),w=O.multiplyByScalar(i,y,J_);if(_<n)return isFinite(y)?O.clone(w,s):void 0;const E=e.x,b=e.y,P=e.z,I=ty;I.x=w.x*E*2,I.y=w.y*b*2,I.z=w.z*P*2;let M=(1-y)*O.magnitude(i)/(.5*O.magnitude(I)),D=0,L,z,q,Y,X,Q,m,v,S,A,F;do{M-=D,q=1/(1+M*E),Y=1/(1+M*b),X=1/(1+M*P),Q=q*q,m=Y*Y,v=X*X,S=Q*q,A=m*Y,F=v*X,L=u*Q+d*m+g*v-1,z=u*S*E+d*A*b+g*F*P;const N=-2*z;D=L/N}while(Math.abs(L)>T.EPSILON12);return C(s)?(s.x=o*q,s.y=r*Y,s.z=a*X,s):new O(o*q,r*Y,a*X)}function lt(i,t,e){this.longitude=i??0,this.latitude=t??0,this.height=e??0}lt.fromRadians=function(i,t,e,n){return p.typeOf.number("longitude",i),p.typeOf.number("latitude",t),e=e??0,C(n)?(n.longitude=i,n.latitude=t,n.height=e,n):new lt(i,t,e)},lt.fromDegrees=function(i,t,e,n){return p.typeOf.number("longitude",i),p.typeOf.number("latitude",t),i=T.toRadians(i),t=T.toRadians(t),lt.fromRadians(i,t,e,n)};const ey=new O,iy=new O,ny=new O;lt._ellipsoidOneOverRadii=new O(1567855942887398e-22,1567855942887398e-22,1573130351105623e-22),lt._ellipsoidOneOverRadiiSquared=new O(2458172257647332e-29,2458172257647332e-29,24747391015697002e-30),lt._ellipsoidCenterToleranceSquared=T.EPSILON1,lt.fromCartesian=function(i,t,e){const n=C(t)?t.oneOverRadii:lt._ellipsoidOneOverRadii,s=C(t)?t.oneOverRadiiSquared:lt._ellipsoidOneOverRadiiSquared,o=C(t)?t._centerToleranceSquared:lt._ellipsoidCenterToleranceSquared,r=_f(i,n,s,o,iy);if(!C(r))return;let a=O.multiplyComponents(r,s,ey);a=O.normalize(a,a);const c=O.subtract(i,r,ny),h=Math.atan2(a.y,a.x),l=Math.asin(a.z),u=T.sign(O.dot(c,i))*O.magnitude(c);return C(e)?(e.longitude=h,e.latitude=l,e.height=u,e):new lt(h,l,u)},lt.toCartesian=function(i,t,e){return p.defined("cartographic",i),O.fromRadians(i.longitude,i.latitude,i.height,t,e)},lt.clone=function(i,t){if(C(i))return C(t)?(t.longitude=i.longitude,t.latitude=i.latitude,t.height=i.height,t):new lt(i.longitude,i.latitude,i.height)},lt.equals=function(i,t){return i===t||C(i)&&C(t)&&i.longitude===t.longitude&&i.latitude===t.latitude&&i.height===t.height},lt.equalsEpsilon=function(i,t,e){return e=e??0,i===t||C(i)&&C(t)&&Math.abs(i.longitude-t.longitude)<=e&&Math.abs(i.latitude-t.latitude)<=e&&Math.abs(i.height-t.height)<=e},lt.ZERO=Object.freeze(new lt(0,0,0)),lt.prototype.clone=function(i){return lt.clone(this,i)},lt.prototype.equals=function(i){return lt.equals(this,i)},lt.prototype.equalsEpsilon=function(i,t){return lt.equalsEpsilon(this,i,t)},lt.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`};function tt(i,t){this.x=i??0,this.y=t??0}tt.fromElements=function(i,t,e){return C(e)?(e.x=i,e.y=t,e):new tt(i,t)},tt.clone=function(i,t){if(C(i))return C(t)?(t.x=i.x,t.y=i.y,t):new tt(i.x,i.y)},tt.fromCartesian3=tt.clone,tt.fromCartesian4=tt.clone,tt.packedLength=2,tt.pack=function(i,t,e){return p.typeOf.object("value",i),p.defined("array",t),e=e??0,t[e++]=i.x,t[e]=i.y,t},tt.unpack=function(i,t,e){return p.defined("array",i),t=t??0,C(e)||(e=new tt),e.x=i[t++],e.y=i[t],e},tt.packArray=function(i,t){p.defined("array",i);const e=i.length,n=e*2;if(!C(t))t=new Array(n);else{if(!Array.isArray(t)&&t.length!==n)throw new j("If result is a typed array, it must have exactly array.length * 2 elements");t.length!==n&&(t.length=n)}for(let s=0;s<e;++s)tt.pack(i[s],t,s*2);return t},tt.unpackArray=function(i,t){if(p.defined("array",i),p.typeOf.number.greaterThanOrEquals("array.length",i.length,2),i.length%2!==0)throw new j("array length must be a multiple of 2.");const e=i.length;C(t)?t.length=e/2:t=new Array(e/2);for(let n=0;n<e;n+=2){const s=n/2;t[s]=tt.unpack(i,n,t[s])}return t},tt.fromArray=tt.unpack,tt.maximumComponent=function(i){return p.typeOf.object("cartesian",i),Math.max(i.x,i.y)},tt.minimumComponent=function(i){return p.typeOf.object("cartesian",i),Math.min(i.x,i.y)},tt.minimumByComponent=function(i,t,e){return p.typeOf.object("first",i),p.typeOf.object("second",t),p.typeOf.object("result",e),e.x=Math.min(i.x,t.x),e.y=Math.min(i.y,t.y),e},tt.maximumByComponent=function(i,t,e){return p.typeOf.object("first",i),p.typeOf.object("second",t),p.typeOf.object("result",e),e.x=Math.max(i.x,t.x),e.y=Math.max(i.y,t.y),e},tt.clamp=function(i,t,e,n){p.typeOf.object("value",i),p.typeOf.object("min",t),p.typeOf.object("max",e),p.typeOf.object("result",n);const s=T.clamp(i.x,t.x,e.x),o=T.clamp(i.y,t.y,e.y);return n.x=s,n.y=o,n},tt.magnitudeSquared=function(i){return p.typeOf.object("cartesian",i),i.x*i.x+i.y*i.y},tt.magnitude=function(i){return Math.sqrt(tt.magnitudeSquared(i))};const ca=new tt;tt.distance=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),tt.subtract(i,t,ca),tt.magnitude(ca)},tt.distanceSquared=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),tt.subtract(i,t,ca),tt.magnitudeSquared(ca)},tt.normalize=function(i,t){p.typeOf.object("cartesian",i),p.typeOf.object("result",t);const e=tt.magnitude(i);if(t.x=i.x/e,t.y=i.y/e,isNaN(t.x)||isNaN(t.y))throw new j("normalized result is not a number");return t},tt.dot=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),i.x*t.x+i.y*t.y},tt.cross=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),i.x*t.y-i.y*t.x},tt.multiplyComponents=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x*t.x,e.y=i.y*t.y,e},tt.divideComponents=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x/t.x,e.y=i.y/t.y,e},tt.add=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x+t.x,e.y=i.y+t.y,e},tt.subtract=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x-t.x,e.y=i.y-t.y,e},tt.multiplyByScalar=function(i,t,e){return p.typeOf.object("cartesian",i),p.typeOf.number("scalar",t),p.typeOf.object("result",e),e.x=i.x*t,e.y=i.y*t,e},tt.divideByScalar=function(i,t,e){return p.typeOf.object("cartesian",i),p.typeOf.number("scalar",t),p.typeOf.object("result",e),e.x=i.x/t,e.y=i.y/t,e},tt.negate=function(i,t){return p.typeOf.object("cartesian",i),p.typeOf.object("result",t),t.x=-i.x,t.y=-i.y,t},tt.abs=function(i,t){return p.typeOf.object("cartesian",i),p.typeOf.object("result",t),t.x=Math.abs(i.x),t.y=Math.abs(i.y),t};const yf=new tt;tt.lerp=function(i,t,e,n){return p.typeOf.object("start",i),p.typeOf.object("end",t),p.typeOf.number("t",e),p.typeOf.object("result",n),tt.multiplyByScalar(t,e,yf),n=tt.multiplyByScalar(i,1-e,n),tt.add(yf,n,n)};const wf=new tt,vf=new tt;tt.angleBetween=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),tt.normalize(i,wf),tt.normalize(t,vf),T.acosClamped(tt.dot(wf,vf))};const sy=new tt;tt.mostOrthogonalAxis=function(i,t){p.typeOf.object("cartesian",i),p.typeOf.object("result",t);const e=tt.normalize(i,sy);return tt.abs(e,e),e.x<=e.y?t=tt.clone(tt.UNIT_X,t):t=tt.clone(tt.UNIT_Y,t),t},tt.equals=function(i,t){return i===t||C(i)&&C(t)&&i.x===t.x&&i.y===t.y},tt.equalsArray=function(i,t,e){return i.x===t[e]&&i.y===t[e+1]},tt.equalsEpsilon=function(i,t,e,n){return i===t||C(i)&&C(t)&&T.equalsEpsilon(i.x,t.x,e,n)&&T.equalsEpsilon(i.y,t.y,e,n)},tt.ZERO=Object.freeze(new tt(0,0)),tt.ONE=Object.freeze(new tt(1,1)),tt.UNIT_X=Object.freeze(new tt(1,0)),tt.UNIT_Y=Object.freeze(new tt(0,1)),tt.prototype.clone=function(i){return tt.clone(this,i)},tt.prototype.equals=function(i){return tt.equals(this,i)},tt.prototype.equalsEpsilon=function(i,t,e){return tt.equalsEpsilon(this,i,t,e)},tt.prototype.toString=function(){return`(${this.x}, ${this.y})`};function Ef(i,t,e,n){t=t??0,e=e??0,n=n??0,p.typeOf.number.greaterThanOrEquals("x",t,0),p.typeOf.number.greaterThanOrEquals("y",e,0),p.typeOf.number.greaterThanOrEquals("z",n,0),i._radii=new O(t,e,n),i._radiiSquared=new O(t*t,e*e,n*n),i._radiiToTheFourth=new O(t*t*t*t,e*e*e*e,n*n*n*n),i._oneOverRadii=new O(t===0?0:1/t,e===0?0:1/e,n===0?0:1/n),i._oneOverRadiiSquared=new O(t===0?0:1/(t*t),e===0?0:1/(e*e),n===0?0:1/(n*n)),i._minimumRadius=Math.min(t,e,n),i._maximumRadius=Math.max(t,e,n),i._centerToleranceSquared=T.EPSILON1,i._radiiSquared.z!==0&&(i._squaredXOverSquaredZ=i._radiiSquared.x/i._radiiSquared.z)}function ct(i,t,e){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,this._squaredXOverSquaredZ=void 0,Ef(this,i,t,e)}Object.defineProperties(ct.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}}),ct.clone=function(i,t){if(!C(i))return;const e=i._radii;return C(t)?(O.clone(e,t._radii),O.clone(i._radiiSquared,t._radiiSquared),O.clone(i._radiiToTheFourth,t._radiiToTheFourth),O.clone(i._oneOverRadii,t._oneOverRadii),O.clone(i._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=i._minimumRadius,t._maximumRadius=i._maximumRadius,t._centerToleranceSquared=i._centerToleranceSquared,t):new ct(e.x,e.y,e.z)},ct.fromCartesian3=function(i,t){return C(t)||(t=new ct),C(i)&&Ef(t,i.x,i.y,i.z),t},ct.WGS84=Object.freeze(new ct(6378137,6378137,6356752314245179e-9)),ct.UNIT_SPHERE=Object.freeze(new ct(1,1,1)),ct.MOON=Object.freeze(new ct(T.LUNAR_RADIUS,T.LUNAR_RADIUS,T.LUNAR_RADIUS)),ct.MARS=Object.freeze(new ct(3396190,3396190,3376200)),ct._default=ct.WGS84,Object.defineProperties(ct,{default:{get:function(){return ct._default},set:function(i){p.typeOf.object("value",i),ct._default=i,O._ellipsoidRadiiSquared=i.radiiSquared,lt._ellipsoidOneOverRadii=i.oneOverRadii,lt._ellipsoidOneOverRadiiSquared=i.oneOverRadiiSquared,lt._ellipsoidCenterToleranceSquared=i._centerToleranceSquared}}}),ct.prototype.clone=function(i){return ct.clone(this,i)},ct.packedLength=O.packedLength,ct.pack=function(i,t,e){return p.typeOf.object("value",i),p.defined("array",t),e=e??0,O.pack(i._radii,t,e),t},ct.unpack=function(i,t,e){p.defined("array",i),t=t??0;const n=O.unpack(i,t);return ct.fromCartesian3(n,e)},ct.prototype.geocentricSurfaceNormal=O.normalize,ct.prototype.geodeticSurfaceNormalCartographic=function(i,t){p.typeOf.object("cartographic",i);const e=i.longitude,n=i.latitude,s=Math.cos(n),o=s*Math.cos(e),r=s*Math.sin(e),a=Math.sin(n);return C(t)||(t=new O),t.x=o,t.y=r,t.z=a,O.normalize(t,t)},ct.prototype.geodeticSurfaceNormal=function(i,t){if(p.typeOf.object("cartesian",i),isNaN(i.x)||isNaN(i.y)||isNaN(i.z))throw new j("cartesian has a NaN component");if(!O.equalsEpsilon(i,O.ZERO,T.EPSILON14))return C(t)||(t=new O),t=O.multiplyComponents(i,this._oneOverRadiiSquared,t),O.normalize(t,t)};const oy=new O,ry=new O;ct.prototype.cartographicToCartesian=function(i,t){const e=oy,n=ry;this.geodeticSurfaceNormalCartographic(i,e),O.multiplyComponents(this._radiiSquared,e,n);const s=Math.sqrt(O.dot(e,n));return O.divideByScalar(n,s,n),O.multiplyByScalar(e,i.height,e),C(t)||(t=new O),O.add(n,e,t)},ct.prototype.cartographicArrayToCartesianArray=function(i,t){p.defined("cartographics",i);const e=i.length;C(t)?t.length=e:t=new Array(e);for(let n=0;n<e;n++)t[n]=this.cartographicToCartesian(i[n],t[n]);return t};const ay=new O,cy=new O,hy=new O;ct.prototype.cartesianToCartographic=function(i,t){const e=this.scaleToGeodeticSurface(i,cy);if(!C(e))return;const n=this.geodeticSurfaceNormal(e,ay),s=O.subtract(i,e,hy),o=Math.atan2(n.y,n.x),r=Math.asin(n.z),a=T.sign(O.dot(s,i))*O.magnitude(s);return C(t)?(t.longitude=o,t.latitude=r,t.height=a,t):new lt(o,r,a)},ct.prototype.cartesianArrayToCartographicArray=function(i,t){p.defined("cartesians",i);const e=i.length;C(t)?t.length=e:t=new Array(e);for(let n=0;n<e;++n)t[n]=this.cartesianToCartographic(i[n],t[n]);return t},ct.prototype.scaleToGeodeticSurface=function(i,t){return _f(i,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)},ct.prototype.scaleToGeocentricSurface=function(i,t){p.typeOf.object("cartesian",i),C(t)||(t=new O);const e=i.x,n=i.y,s=i.z,o=this._oneOverRadiiSquared,r=1/Math.sqrt(e*e*o.x+n*n*o.y+s*s*o.z);return O.multiplyByScalar(i,r,t)},ct.prototype.transformPositionToScaledSpace=function(i,t){return C(t)||(t=new O),O.multiplyComponents(i,this._oneOverRadii,t)},ct.prototype.transformPositionFromScaledSpace=function(i,t){return C(t)||(t=new O),O.multiplyComponents(i,this._radii,t)},ct.prototype.equals=function(i){return this===i||C(i)&&O.equals(this._radii,i._radii)},ct.prototype.toString=function(){return this._radii.toString()},ct.prototype.getSurfaceNormalIntersectionWithZAxis=function(i,t,e){if(p.typeOf.object("position",i),!T.equalsEpsilon(this._radii.x,this._radii.y,T.EPSILON15))throw new j("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");p.typeOf.number.greaterThan("Ellipsoid.radii.z",this._radii.z,0),t=t??0;const n=this._squaredXOverSquaredZ;if(C(e)||(e=new O),e.x=0,e.y=0,e.z=i.z*(1-n),!(Math.abs(e.z)>=this._radii.z-t))return e};const ly=new O;ct.prototype.getLocalCurvature=function(i,t){p.typeOf.object("surfacePosition",i),C(t)||(t=new tt);const e=this.getSurfaceNormalIntersectionWithZAxis(i,0,ly),n=O.distance(i,e),s=this.minimumRadius*n/this.maximumRadius**2,o=n*s**2;return tt.fromElements(1/n,1/o,t)};const uy=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],dy=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function Cf(i,t,e){p.typeOf.number("a",i),p.typeOf.number("b",t),p.typeOf.func("func",e);const n=.5*(t+i),s=.5*(t-i);let o=0;for(let r=0;r<5;r++){const a=s*uy[r];o+=dy[r]*(e(n+a)+e(n-a))}return o*=s,o}ct.prototype.surfaceArea=function(i){p.typeOf.object("rectangle",i);const t=i.west;let e=i.east;const n=i.south,s=i.north;for(;e<t;)e+=T.TWO_PI;const o=this._radiiSquared,r=o.x,a=o.y,c=o.z,h=r*a;return Cf(n,s,function(l){const u=Math.cos(l),d=Math.sin(l);return Math.cos(l)*Cf(t,e,function(g){const _=Math.cos(g),y=Math.sin(g);return Math.sqrt(h*d*d+c*(a*_*_+r*y*y)*u*u)})})};function k(i,t,e,n,s,o,r,a,c){this[0]=i??0,this[1]=n??0,this[2]=r??0,this[3]=t??0,this[4]=s??0,this[5]=a??0,this[6]=e??0,this[7]=o??0,this[8]=c??0}k.packedLength=9,k.pack=function(i,t,e){return p.typeOf.object("value",i),p.defined("array",t),e=e??0,t[e++]=i[0],t[e++]=i[1],t[e++]=i[2],t[e++]=i[3],t[e++]=i[4],t[e++]=i[5],t[e++]=i[6],t[e++]=i[7],t[e++]=i[8],t},k.unpack=function(i,t,e){return p.defined("array",i),t=t??0,C(e)||(e=new k),e[0]=i[t++],e[1]=i[t++],e[2]=i[t++],e[3]=i[t++],e[4]=i[t++],e[5]=i[t++],e[6]=i[t++],e[7]=i[t++],e[8]=i[t++],e},k.packArray=function(i,t){p.defined("array",i);const e=i.length,n=e*9;if(!C(t))t=new Array(n);else{if(!Array.isArray(t)&&t.length!==n)throw new j("If result is a typed array, it must have exactly array.length * 9 elements");t.length!==n&&(t.length=n)}for(let s=0;s<e;++s)k.pack(i[s],t,s*9);return t},k.unpackArray=function(i,t){if(p.defined("array",i),p.typeOf.number.greaterThanOrEquals("array.length",i.length,9),i.length%9!==0)throw new j("array length must be a multiple of 9.");const e=i.length;C(t)?t.length=e/9:t=new Array(e/9);for(let n=0;n<e;n+=9){const s=n/9;t[s]=k.unpack(i,n,t[s])}return t},k.clone=function(i,t){if(C(i))return C(t)?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t):new k(i[0],i[3],i[6],i[1],i[4],i[7],i[2],i[5],i[8])},k.fromArray=k.unpack,k.fromColumnMajorArray=function(i,t){return p.defined("values",i),k.clone(i,t)},k.fromRowMajorArray=function(i,t){return p.defined("values",i),C(t)?(t[0]=i[0],t[1]=i[3],t[2]=i[6],t[3]=i[1],t[4]=i[4],t[5]=i[7],t[6]=i[2],t[7]=i[5],t[8]=i[8],t):new k(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8])},k.fromQuaternion=function(i,t){p.typeOf.object("quaternion",i);const e=i.x*i.x,n=i.x*i.y,s=i.x*i.z,o=i.x*i.w,r=i.y*i.y,a=i.y*i.z,c=i.y*i.w,h=i.z*i.z,l=i.z*i.w,u=i.w*i.w,d=e-r-h+u,g=2*(n-l),_=2*(s+c),y=2*(n+l),w=-e+r-h+u,E=2*(a-o),b=2*(s-c),P=2*(a+o),I=-e-r+h+u;return C(t)?(t[0]=d,t[1]=y,t[2]=b,t[3]=g,t[4]=w,t[5]=P,t[6]=_,t[7]=E,t[8]=I,t):new k(d,g,_,y,w,E,b,P,I)},k.fromHeadingPitchRoll=function(i,t){p.typeOf.object("headingPitchRoll",i);const e=Math.cos(-i.pitch),n=Math.cos(-i.heading),s=Math.cos(i.roll),o=Math.sin(-i.pitch),r=Math.sin(-i.heading),a=Math.sin(i.roll),c=e*n,h=-s*r+a*o*n,l=a*r+s*o*n,u=e*r,d=s*n+a*o*r,g=-a*n+s*o*r,_=-o,y=a*e,w=s*e;return C(t)?(t[0]=c,t[1]=u,t[2]=_,t[3]=h,t[4]=d,t[5]=y,t[6]=l,t[7]=g,t[8]=w,t):new k(c,h,l,u,d,g,_,y,w)},k.fromScale=function(i,t){return p.typeOf.object("scale",i),C(t)?(t[0]=i.x,t[1]=0,t[2]=0,t[3]=0,t[4]=i.y,t[5]=0,t[6]=0,t[7]=0,t[8]=i.z,t):new k(i.x,0,0,0,i.y,0,0,0,i.z)},k.fromUniformScale=function(i,t){return p.typeOf.number("scale",i),C(t)?(t[0]=i,t[1]=0,t[2]=0,t[3]=0,t[4]=i,t[5]=0,t[6]=0,t[7]=0,t[8]=i,t):new k(i,0,0,0,i,0,0,0,i)},k.fromCrossProduct=function(i,t){return p.typeOf.object("vector",i),C(t)?(t[0]=0,t[1]=i.z,t[2]=-i.y,t[3]=-i.z,t[4]=0,t[5]=i.x,t[6]=i.y,t[7]=-i.x,t[8]=0,t):new k(0,-i.z,i.y,i.z,0,-i.x,-i.y,i.x,0)},k.fromRotationX=function(i,t){p.typeOf.number("angle",i);const e=Math.cos(i),n=Math.sin(i);return C(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=n,t[6]=0,t[7]=-n,t[8]=e,t):new k(1,0,0,0,e,-n,0,n,e)},k.fromRotationY=function(i,t){p.typeOf.number("angle",i);const e=Math.cos(i),n=Math.sin(i);return C(t)?(t[0]=e,t[1]=0,t[2]=-n,t[3]=0,t[4]=1,t[5]=0,t[6]=n,t[7]=0,t[8]=e,t):new k(e,0,n,0,1,0,-n,0,e)},k.fromRotationZ=function(i,t){p.typeOf.number("angle",i);const e=Math.cos(i),n=Math.sin(i);return C(t)?(t[0]=e,t[1]=n,t[2]=0,t[3]=-n,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new k(e,-n,0,n,e,0,0,0,1)},k.toArray=function(i,t){return p.typeOf.object("matrix",i),C(t)?(t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t):[i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8]]},k.getElementIndex=function(i,t){return p.typeOf.number.greaterThanOrEquals("row",t,0),p.typeOf.number.lessThanOrEquals("row",t,2),p.typeOf.number.greaterThanOrEquals("column",i,0),p.typeOf.number.lessThanOrEquals("column",i,2),i*3+t},k.getColumn=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.number.greaterThanOrEquals("index",t,0),p.typeOf.number.lessThanOrEquals("index",t,2),p.typeOf.object("result",e);const n=t*3,s=i[n],o=i[n+1],r=i[n+2];return e.x=s,e.y=o,e.z=r,e},k.setColumn=function(i,t,e,n){p.typeOf.object("matrix",i),p.typeOf.number.greaterThanOrEquals("index",t,0),p.typeOf.number.lessThanOrEquals("index",t,2),p.typeOf.object("cartesian",e),p.typeOf.object("result",n),n=k.clone(i,n);const s=t*3;return n[s]=e.x,n[s+1]=e.y,n[s+2]=e.z,n},k.getRow=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.number.greaterThanOrEquals("index",t,0),p.typeOf.number.lessThanOrEquals("index",t,2),p.typeOf.object("result",e);const n=i[t],s=i[t+3],o=i[t+6];return e.x=n,e.y=s,e.z=o,e},k.setRow=function(i,t,e,n){return p.typeOf.object("matrix",i),p.typeOf.number.greaterThanOrEquals("index",t,0),p.typeOf.number.lessThanOrEquals("index",t,2),p.typeOf.object("cartesian",e),p.typeOf.object("result",n),n=k.clone(i,n),n[t]=e.x,n[t+3]=e.y,n[t+6]=e.z,n};const fy=new O;k.setScale=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.object("scale",t),p.typeOf.object("result",e);const n=k.getScale(i,fy),s=t.x/n.x,o=t.y/n.y,r=t.z/n.z;return e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e[3]=i[3]*o,e[4]=i[4]*o,e[5]=i[5]*o,e[6]=i[6]*r,e[7]=i[7]*r,e[8]=i[8]*r,e};const gy=new O;k.setUniformScale=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.number("scale",t),p.typeOf.object("result",e);const n=k.getScale(i,gy),s=t/n.x,o=t/n.y,r=t/n.z;return e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e[3]=i[3]*o,e[4]=i[4]*o,e[5]=i[5]*o,e[6]=i[6]*r,e[7]=i[7]*r,e[8]=i[8]*r,e};const wh=new O;k.getScale=function(i,t){return p.typeOf.object("matrix",i),p.typeOf.object("result",t),t.x=O.magnitude(O.fromElements(i[0],i[1],i[2],wh)),t.y=O.magnitude(O.fromElements(i[3],i[4],i[5],wh)),t.z=O.magnitude(O.fromElements(i[6],i[7],i[8],wh)),t};const bf=new O;k.getMaximumScale=function(i){return k.getScale(i,bf),O.maximumComponent(bf)};const py=new O;k.setRotation=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.object("result",e);const n=k.getScale(i,py);return e[0]=t[0]*n.x,e[1]=t[1]*n.x,e[2]=t[2]*n.x,e[3]=t[3]*n.y,e[4]=t[4]*n.y,e[5]=t[5]*n.y,e[6]=t[6]*n.z,e[7]=t[7]*n.z,e[8]=t[8]*n.z,e};const my=new O;k.getRotation=function(i,t){p.typeOf.object("matrix",i),p.typeOf.object("result",t);const e=k.getScale(i,my);return t[0]=i[0]/e.x,t[1]=i[1]/e.x,t[2]=i[2]/e.x,t[3]=i[3]/e.y,t[4]=i[4]/e.y,t[5]=i[5]/e.y,t[6]=i[6]/e.z,t[7]=i[7]/e.z,t[8]=i[8]/e.z,t},k.multiply=function(i,t,e){p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e);const n=i[0]*t[0]+i[3]*t[1]+i[6]*t[2],s=i[1]*t[0]+i[4]*t[1]+i[7]*t[2],o=i[2]*t[0]+i[5]*t[1]+i[8]*t[2],r=i[0]*t[3]+i[3]*t[4]+i[6]*t[5],a=i[1]*t[3]+i[4]*t[4]+i[7]*t[5],c=i[2]*t[3]+i[5]*t[4]+i[8]*t[5],h=i[0]*t[6]+i[3]*t[7]+i[6]*t[8],l=i[1]*t[6]+i[4]*t[7]+i[7]*t[8],u=i[2]*t[6]+i[5]*t[7]+i[8]*t[8];return e[0]=n,e[1]=s,e[2]=o,e[3]=r,e[4]=a,e[5]=c,e[6]=h,e[7]=l,e[8]=u,e},k.add=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e[0]=i[0]+t[0],e[1]=i[1]+t[1],e[2]=i[2]+t[2],e[3]=i[3]+t[3],e[4]=i[4]+t[4],e[5]=i[5]+t[5],e[6]=i[6]+t[6],e[7]=i[7]+t[7],e[8]=i[8]+t[8],e},k.subtract=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e[0]=i[0]-t[0],e[1]=i[1]-t[1],e[2]=i[2]-t[2],e[3]=i[3]-t[3],e[4]=i[4]-t[4],e[5]=i[5]-t[5],e[6]=i[6]-t[6],e[7]=i[7]-t[7],e[8]=i[8]-t[8],e},k.multiplyByVector=function(i,t,e){p.typeOf.object("matrix",i),p.typeOf.object("cartesian",t),p.typeOf.object("result",e);const n=t.x,s=t.y,o=t.z,r=i[0]*n+i[3]*s+i[6]*o,a=i[1]*n+i[4]*s+i[7]*o,c=i[2]*n+i[5]*s+i[8]*o;return e.x=r,e.y=a,e.z=c,e},k.multiplyByScalar=function(i,t,e){return p.typeOf.object("matrix",i),p.typeOf.number("scalar",t),p.typeOf.object("result",e),e[0]=i[0]*t,e[1]=i[1]*t,e[2]=i[2]*t,e[3]=i[3]*t,e[4]=i[4]*t,e[5]=i[5]*t,e[6]=i[6]*t,e[7]=i[7]*t,e[8]=i[8]*t,e},k.multiplyByScale=function(i,t,e){return p.typeOf.object("matrix",i),p.typeOf.object("scale",t),p.typeOf.object("result",e),e[0]=i[0]*t.x,e[1]=i[1]*t.x,e[2]=i[2]*t.x,e[3]=i[3]*t.y,e[4]=i[4]*t.y,e[5]=i[5]*t.y,e[6]=i[6]*t.z,e[7]=i[7]*t.z,e[8]=i[8]*t.z,e},k.multiplyByUniformScale=function(i,t,e){return p.typeOf.object("matrix",i),p.typeOf.number("scale",t),p.typeOf.object("result",e),e[0]=i[0]*t,e[1]=i[1]*t,e[2]=i[2]*t,e[3]=i[3]*t,e[4]=i[4]*t,e[5]=i[5]*t,e[6]=i[6]*t,e[7]=i[7]*t,e[8]=i[8]*t,e},k.negate=function(i,t){return p.typeOf.object("matrix",i),p.typeOf.object("result",t),t[0]=-i[0],t[1]=-i[1],t[2]=-i[2],t[3]=-i[3],t[4]=-i[4],t[5]=-i[5],t[6]=-i[6],t[7]=-i[7],t[8]=-i[8],t},k.transpose=function(i,t){p.typeOf.object("matrix",i),p.typeOf.object("result",t);const e=i[0],n=i[3],s=i[6],o=i[1],r=i[4],a=i[7],c=i[2],h=i[5],l=i[8];return t[0]=e,t[1]=n,t[2]=s,t[3]=o,t[4]=r,t[5]=a,t[6]=c,t[7]=h,t[8]=l,t};function _y(i){let t=0;for(let e=0;e<9;++e){const n=i[e];t+=n*n}return Math.sqrt(t)}const vh=[1,0,0],Eh=[2,2,1];function yy(i){let t=0;for(let e=0;e<3;++e){const n=i[k.getElementIndex(Eh[e],vh[e])];t+=2*n*n}return Math.sqrt(t)}function wy(i,t){const e=T.EPSILON15;let n=0,s=1;for(let h=0;h<3;++h){const l=Math.abs(i[k.getElementIndex(Eh[h],vh[h])]);l>n&&(s=h,n=l)}let o=1,r=0;const a=vh[s],c=Eh[s];if(Math.abs(i[k.getElementIndex(c,a)])>e){const h=i[k.getElementIndex(c,c)],l=i[k.getElementIndex(a,a)],u=i[k.getElementIndex(c,a)],d=(h-l)/2/u;let g;d<0?g=-1/(-d+Math.sqrt(1+d*d)):g=1/(d+Math.sqrt(1+d*d)),o=1/Math.sqrt(1+g*g),r=g*o}return t=k.clone(k.IDENTITY,t),t[k.getElementIndex(a,a)]=t[k.getElementIndex(c,c)]=o,t[k.getElementIndex(c,a)]=r,t[k.getElementIndex(a,c)]=-r,t}const ha=new k,xf=new k;k.computeEigenDecomposition=function(i,t){p.typeOf.object("matrix",i);const e=T.EPSILON20,n=10;let s=0,o=0;C(t)||(t={});const r=t.unitary=k.clone(k.IDENTITY,t.unitary),a=t.diagonal=k.clone(i,t.diagonal),c=e*_y(a);for(;o<n&&yy(a)>c;)wy(a,ha),k.transpose(ha,xf),k.multiply(a,ha,a),k.multiply(xf,a,a),k.multiply(r,ha,r),++s>2&&(++o,s=0);return t},k.abs=function(i,t){return p.typeOf.object("matrix",i),p.typeOf.object("result",t),t[0]=Math.abs(i[0]),t[1]=Math.abs(i[1]),t[2]=Math.abs(i[2]),t[3]=Math.abs(i[3]),t[4]=Math.abs(i[4]),t[5]=Math.abs(i[5]),t[6]=Math.abs(i[6]),t[7]=Math.abs(i[7]),t[8]=Math.abs(i[8]),t},k.determinant=function(i){p.typeOf.object("matrix",i);const t=i[0],e=i[3],n=i[6],s=i[1],o=i[4],r=i[7],a=i[2],c=i[5],h=i[8];return t*(o*h-c*r)+s*(c*n-e*h)+a*(e*r-o*n)},k.inverse=function(i,t){p.typeOf.object("matrix",i),p.typeOf.object("result",t);const e=i[0],n=i[1],s=i[2],o=i[3],r=i[4],a=i[5],c=i[6],h=i[7],l=i[8],u=k.determinant(i);if(Math.abs(u)<=T.EPSILON15)throw new j("matrix is not invertible");t[0]=r*l-h*a,t[1]=h*s-n*l,t[2]=n*a-r*s,t[3]=c*a-o*l,t[4]=e*l-c*s,t[5]=o*s-e*a,t[6]=o*h-c*r,t[7]=c*n-e*h,t[8]=e*r-o*n;const d=1/u;return k.multiplyByScalar(t,d,t)};const vy=new k;k.inverseTranspose=function(i,t){return p.typeOf.object("matrix",i),p.typeOf.object("result",t),k.inverse(k.transpose(i,vy),t)},k.equals=function(i,t){return i===t||C(i)&&C(t)&&i[0]===t[0]&&i[1]===t[1]&&i[2]===t[2]&&i[3]===t[3]&&i[4]===t[4]&&i[5]===t[5]&&i[6]===t[6]&&i[7]===t[7]&&i[8]===t[8]},k.equalsEpsilon=function(i,t,e){return e=e??0,i===t||C(i)&&C(t)&&Math.abs(i[0]-t[0])<=e&&Math.abs(i[1]-t[1])<=e&&Math.abs(i[2]-t[2])<=e&&Math.abs(i[3]-t[3])<=e&&Math.abs(i[4]-t[4])<=e&&Math.abs(i[5]-t[5])<=e&&Math.abs(i[6]-t[6])<=e&&Math.abs(i[7]-t[7])<=e&&Math.abs(i[8]-t[8])<=e},k.IDENTITY=Object.freeze(new k(1,0,0,0,1,0,0,0,1)),k.ZERO=Object.freeze(new k(0,0,0,0,0,0,0,0,0)),k.COLUMN0ROW0=0,k.COLUMN0ROW1=1,k.COLUMN0ROW2=2,k.COLUMN1ROW0=3,k.COLUMN1ROW1=4,k.COLUMN1ROW2=5,k.COLUMN2ROW0=6,k.COLUMN2ROW1=7,k.COLUMN2ROW2=8,Object.defineProperties(k.prototype,{length:{get:function(){return k.packedLength}}}),k.prototype.clone=function(i){return k.clone(this,i)},k.prototype.equals=function(i){return k.equals(this,i)},k.equalsArray=function(i,t,e){return i[0]===t[e]&&i[1]===t[e+1]&&i[2]===t[e+2]&&i[3]===t[e+3]&&i[4]===t[e+4]&&i[5]===t[e+5]&&i[6]===t[e+6]&&i[7]===t[e+7]&&i[8]===t[e+8]},k.prototype.equalsEpsilon=function(i,t){return k.equalsEpsilon(this,i,t)},k.prototype.toString=function(){return`(${this[0]}, ${this[3]}, ${this[6]})
|
|
31
31
|
(${this[1]}, ${this[4]}, ${this[7]})
|
|
32
32
|
(${this[2]}, ${this[5]}, ${this[8]})`};function K(i,t,e,n){this.x=i??0,this.y=t??0,this.z=e??0,this.w=n??0}K.fromElements=function(i,t,e,n,s){return C(s)?(s.x=i,s.y=t,s.z=e,s.w=n,s):new K(i,t,e,n)},K.fromColor=function(i,t){return p.typeOf.object("color",i),C(t)?(t.x=i.red,t.y=i.green,t.z=i.blue,t.w=i.alpha,t):new K(i.red,i.green,i.blue,i.alpha)},K.clone=function(i,t){if(C(i))return C(t)?(t.x=i.x,t.y=i.y,t.z=i.z,t.w=i.w,t):new K(i.x,i.y,i.z,i.w)},K.packedLength=4,K.pack=function(i,t,e){return p.typeOf.object("value",i),p.defined("array",t),e=e??0,t[e++]=i.x,t[e++]=i.y,t[e++]=i.z,t[e]=i.w,t},K.unpack=function(i,t,e){return p.defined("array",i),t=t??0,C(e)||(e=new K),e.x=i[t++],e.y=i[t++],e.z=i[t++],e.w=i[t],e},K.packArray=function(i,t){p.defined("array",i);const e=i.length,n=e*4;if(!C(t))t=new Array(n);else{if(!Array.isArray(t)&&t.length!==n)throw new j("If result is a typed array, it must have exactly array.length * 4 elements");t.length!==n&&(t.length=n)}for(let s=0;s<e;++s)K.pack(i[s],t,s*4);return t},K.unpackArray=function(i,t){if(p.defined("array",i),p.typeOf.number.greaterThanOrEquals("array.length",i.length,4),i.length%4!==0)throw new j("array length must be a multiple of 4.");const e=i.length;C(t)?t.length=e/4:t=new Array(e/4);for(let n=0;n<e;n+=4){const s=n/4;t[s]=K.unpack(i,n,t[s])}return t},K.fromArray=K.unpack,K.maximumComponent=function(i){return p.typeOf.object("cartesian",i),Math.max(i.x,i.y,i.z,i.w)},K.minimumComponent=function(i){return p.typeOf.object("cartesian",i),Math.min(i.x,i.y,i.z,i.w)},K.minimumByComponent=function(i,t,e){return p.typeOf.object("first",i),p.typeOf.object("second",t),p.typeOf.object("result",e),e.x=Math.min(i.x,t.x),e.y=Math.min(i.y,t.y),e.z=Math.min(i.z,t.z),e.w=Math.min(i.w,t.w),e},K.maximumByComponent=function(i,t,e){return p.typeOf.object("first",i),p.typeOf.object("second",t),p.typeOf.object("result",e),e.x=Math.max(i.x,t.x),e.y=Math.max(i.y,t.y),e.z=Math.max(i.z,t.z),e.w=Math.max(i.w,t.w),e},K.clamp=function(i,t,e,n){p.typeOf.object("value",i),p.typeOf.object("min",t),p.typeOf.object("max",e),p.typeOf.object("result",n);const s=T.clamp(i.x,t.x,e.x),o=T.clamp(i.y,t.y,e.y),r=T.clamp(i.z,t.z,e.z),a=T.clamp(i.w,t.w,e.w);return n.x=s,n.y=o,n.z=r,n.w=a,n},K.magnitudeSquared=function(i){return p.typeOf.object("cartesian",i),i.x*i.x+i.y*i.y+i.z*i.z+i.w*i.w},K.magnitude=function(i){return Math.sqrt(K.magnitudeSquared(i))};const la=new K;K.distance=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),K.subtract(i,t,la),K.magnitude(la)},K.distanceSquared=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),K.subtract(i,t,la),K.magnitudeSquared(la)},K.normalize=function(i,t){p.typeOf.object("cartesian",i),p.typeOf.object("result",t);const e=K.magnitude(i);if(t.x=i.x/e,t.y=i.y/e,t.z=i.z/e,t.w=i.w/e,isNaN(t.x)||isNaN(t.y)||isNaN(t.z)||isNaN(t.w))throw new j("normalized result is not a number");return t},K.dot=function(i,t){return p.typeOf.object("left",i),p.typeOf.object("right",t),i.x*t.x+i.y*t.y+i.z*t.z+i.w*t.w},K.multiplyComponents=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x*t.x,e.y=i.y*t.y,e.z=i.z*t.z,e.w=i.w*t.w,e},K.divideComponents=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x/t.x,e.y=i.y/t.y,e.z=i.z/t.z,e.w=i.w/t.w,e},K.add=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x+t.x,e.y=i.y+t.y,e.z=i.z+t.z,e.w=i.w+t.w,e},K.subtract=function(i,t,e){return p.typeOf.object("left",i),p.typeOf.object("right",t),p.typeOf.object("result",e),e.x=i.x-t.x,e.y=i.y-t.y,e.z=i.z-t.z,e.w=i.w-t.w,e},K.multiplyByScalar=function(i,t,e){return p.typeOf.object("cartesian",i),p.typeOf.number("scalar",t),p.typeOf.object("result",e),e.x=i.x*t,e.y=i.y*t,e.z=i.z*t,e.w=i.w*t,e},K.divideByScalar=function(i,t,e){return p.typeOf.object("cartesian",i),p.typeOf.number("scalar",t),p.typeOf.object("result",e),e.x=i.x/t,e.y=i.y/t,e.z=i.z/t,e.w=i.w/t,e},K.negate=function(i,t){return p.typeOf.object("cartesian",i),p.typeOf.object("result",t),t.x=-i.x,t.y=-i.y,t.z=-i.z,t.w=-i.w,t},K.abs=function(i,t){return p.typeOf.object("cartesian",i),p.typeOf.object("result",t),t.x=Math.abs(i.x),t.y=Math.abs(i.y),t.z=Math.abs(i.z),t.w=Math.abs(i.w),t};const Sf=new K;K.lerp=function(i,t,e,n){return p.typeOf.object("start",i),p.typeOf.object("end",t),p.typeOf.number("t",e),p.typeOf.object("result",n),K.multiplyByScalar(t,e,Sf),n=K.multiplyByScalar(i,1-e,n),K.add(Sf,n,n)};const Ey=new K;K.mostOrthogonalAxis=function(i,t){p.typeOf.object("cartesian",i),p.typeOf.object("result",t);const e=K.normalize(i,Ey);return K.abs(e,e),e.x<=e.y?e.x<=e.z?e.x<=e.w?t=K.clone(K.UNIT_X,t):t=K.clone(K.UNIT_W,t):e.z<=e.w?t=K.clone(K.UNIT_Z,t):t=K.clone(K.UNIT_W,t):e.y<=e.z?e.y<=e.w?t=K.clone(K.UNIT_Y,t):t=K.clone(K.UNIT_W,t):e.z<=e.w?t=K.clone(K.UNIT_Z,t):t=K.clone(K.UNIT_W,t),t},K.equals=function(i,t){return i===t||C(i)&&C(t)&&i.x===t.x&&i.y===t.y&&i.z===t.z&&i.w===t.w},K.equalsArray=function(i,t,e){return i.x===t[e]&&i.y===t[e+1]&&i.z===t[e+2]&&i.w===t[e+3]},K.equalsEpsilon=function(i,t,e,n){return i===t||C(i)&&C(t)&&T.equalsEpsilon(i.x,t.x,e,n)&&T.equalsEpsilon(i.y,t.y,e,n)&&T.equalsEpsilon(i.z,t.z,e,n)&&T.equalsEpsilon(i.w,t.w,e,n)},K.ZERO=Object.freeze(new K(0,0,0,0)),K.ONE=Object.freeze(new K(1,1,1,1)),K.UNIT_X=Object.freeze(new K(1,0,0,0)),K.UNIT_Y=Object.freeze(new K(0,1,0,0)),K.UNIT_Z=Object.freeze(new K(0,0,1,0)),K.UNIT_W=Object.freeze(new K(0,0,0,1)),K.prototype.clone=function(i){return K.clone(this,i)},K.prototype.equals=function(i){return K.equals(this,i)},K.prototype.equalsEpsilon=function(i,t,e){return K.equalsEpsilon(this,i,t,e)},K.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`};const Ch=new Float32Array(1),ie=new Uint8Array(Ch.buffer),Cy=new Uint32Array([287454020]),Rf=new Uint8Array(Cy.buffer)[0]===68;K.packFloat=function(i,t){return p.typeOf.number("value",i),C(t)||(t=new K),Ch[0]=i,Rf?(t.x=ie[0],t.y=ie[1],t.z=ie[2],t.w=ie[3]):(t.x=ie[3],t.y=ie[2],t.z=ie[1],t.w=ie[0]),t},K.unpackFloat=function(i){return p.typeOf.object("packedFloat",i),Rf?(ie[0]=i.x,ie[1]=i.y,ie[2]=i.z,ie[3]=i.w):(ie[0]=i.w,ie[1]=i.z,ie[2]=i.y,ie[3]=i.x),Ch[0]};const ri={};ri.EMPTY_OBJECT=Object.freeze({}),ri.EMPTY_ARRAY=Object.freeze([]);function De(i){this.name="RuntimeError",this.message=i;let t;try{throw new Error}catch(e){t=e.stack}this.stack=t}C(Object.create)&&(De.prototype=Object.create(Error.prototype),De.prototype.constructor=De),De.prototype.toString=function(){let i=`${this.name}: ${this.message}`;return C(this.stack)&&(i+=`
|
|
@@ -155,7 +155,7 @@ ${jg}
|
|
|
155
155
|
destroy() {
|
|
156
156
|
this._container.removeChild(this._div);
|
|
157
157
|
}
|
|
158
|
-
}`;this.instanceClassStr=b};E(),this.dispose(this.innerHTMLChanged.disposableOn(E))}}update(e){this._updateEvent.emit(e)}get instanceClass(){return this._instanceClassReact.value}set instanceClass(e){this._instanceClassReact.value=e}get instanceClassChanged(){return this._instanceClassReact.changed}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get pickedEvent(){return this._pickedEvent}pickFromDiv(e,n){(this.allowPicking??!1)&&this.pickedEvent.emit(new f.ESJPickedResult({element:e,...n}))}get innerHtmlMounted(){return this._innerHtmlMounted}get olDivPoi(){return this._olDivPoi}set olDivPoi(e){this._olDivPoi=e}get objResetting(){return this._objResetting}get olViewerVisibleDistanceRangeControl(){return this._olViewVisibleDistanceRangeControl}get visibleAlpha(){return this._olViewVisibleDistanceRangeControl.visibleAlpha}get visibleAlphaChanged(){return this._olViewVisibleDistanceRangeControl.visibleAlphaChanged}}R(Qt,"defaultOLInstanceClassStr",pl),R(Qt,"olInstanceClassStrReadMe",Ug),R(Qt,"defaults",{position:[116.39,39.9,0],instanceClassStr:pl,instanceClassStrReadMe:Ug,innerHTML:jg,innerHTMLReadMe:fv,viewDistanceRange:[1e3,1e4,3e4,6e4],zOrder:0}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,opacity:1,position:f.reactArrayWithUndefined(void 0),originRatioAndOffset:f.reactArray([.5,1,0,0]),instanceClassStr:void 0,innerHTML:void 0,viewDistanceRange:f.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,shadowDom:!1,cssAllInitial:!1,zOrder:0})})(Qt||(Qt={})),f.extendClassProps(Qt.prototype,Qt.createDefaultProps);class gv extends f.Destroyable{constructor(t,e,n){super(),this._container=t}}const rc=class rc extends f.Destroyable{constructor(e,n){super();R(this,"_pickedEvent",this.disposeVar(new f.Event));R(this,"_divEvent",this.disposeVar(new f.Event));R(this,"_divCreatedEvent",this.disposeVar(new f.Event));R(this,"_divToDestroyEvent",this.disposeVar(new f.Event));R(this,"_pc",this.disposeVar(new f.PointerClick));R(this,"_flyToEvent",this.disposeVar(new f.Event));R(this,"_customDivPoi");this._customDivPoi=this.disposeVar(new Qt(e,n));const s=this,o=this._customDivPoi;this.dispose(this.flyToEvent.disposableOn(r=>{o.flyTo(r)})),this.dispose(f.bind([o,"show"],[this,"show"])),this.dispose(f.bind([o,"position"],[this,"position"])),this.dispose(f.bind([o,"originRatioAndOffset"],[this,"originRatioAndOffset"])),this.dispose(f.bind([o,"opacity"],[this,"opacity"])),this.dispose(f.bind([o,"viewDistanceRange"],[this,"viewDistanceRange"])),this.dispose(f.bind([o,"viewDistanceDebug"],[this,"viewDistanceDebug"])),this.dispose(f.bind([o,"shadowDom"],[this,"shadowDom"])),this.dispose(f.bind([o,"cssAllInitial"],[this,"cssAllInitial"])),this.dispose(f.bind([o,"allowPicking"],[this,"pickOnClick"])),this.d(f.bind([o,"zOrder"],[this,"zOrder"]));{class r extends gv{constructor(c,h,l){super(c,h,l);const u=document.createElement("div");u.style.overflow="hidden",u.style.whiteSpace="nowrap",u.addEventListener("mouseover",()=>{s.divEvent.emit(!0)}),u.addEventListener("mouseout",()=>{s.divEvent.emit(!1)});{{const g=()=>{o.show=s.show??!0,u.style.pointerEvents="all",s.width===void 0?u.style.width="auto":u.style.width=`${s.width}px`,s.height===void 0?u.style.height="auto":u.style.height=`${s.height}px`,s.text!==void 0?u.innerHTML=`${s.text.replace(/\n/g,"<br/>")??"请输入文字"}`:u.innerHTML="请输入文字",u.style.fontSize=`${s.fontSize??14}px`,u.style.fontFamily=`${s.fontFamily??rc.defaults.fontFamily}`;const y=s.borderRadius??[6,6,6,6];u.style.borderRadius=`${y[0]}px ${y[1]}px ${y[2]}px ${y[3]}px`;const w=s.color??[1,1,1,1];u.style.color=`rgba(${w[0]*255},${w[1]*255},${w[2]*255},${w[3]})`;const E=s.backgroundColor??[0,0,0,.8];u.style.backgroundColor=`rgba(${E[0]*255},${E[1]*255},${E[2]*255},${E[3]})`;const b=s.padding??[5,5,5,5];u.style.padding=`${b[0]}px ${b[1]}px ${b[2]}px ${b[3]}px`,u.style.borderWidth=`${s.borderWidth??0}px`;const P=s.borderColor??[1,1,1,1];u.style.borderColor=`rgba(${P[0]*255},${P[1]*255},${P[2]*255},${P[3]})`,u.style.borderStyle=`${s.borderStyle??"solid"}`,u.style.textAlign=`${s.textAlign??"left"}`,u.style.transform=`scale(${s.scale[0]??1},${s.scale[1]??1}) rotate(${s.rotate??0}deg)`};g();const _=this.disposeVar(f.createNextAnimateFrameEvent(s.showChanged,s.widthChanged,s.heightChanged,s.textChanged,s.fontSizeChanged,s.borderRadiusChanged,s.colorChanged,s.backgroundColorChanged,s.paddingChanged,s.borderWidthChanged,s.borderColorChanged,s.borderStyleChanged,s.fontFamilyChanged,s.textAlignChanged,s.scaleChanged,s.rotateChanged));this.dispose(_.disposableOn(g))}{const g=()=>{s.textEditing?(u.contentEditable="true",u.focus(),document.execCommand("selectAll",!1,null)):(u.contentEditable="false",document.execCommand("unselect",!1,null))};g(),this.dispose(s.textEditingChanged.disposableOn(g))}{const g=()=>{s.textEditingInteraction||(s.positionEditing??!1?u.style.pointerEvents="none":u.style.pointerEvents="all")};g(),this.dispose(s.positionEditingChanged.disposableOn(g))}let d=null;this.dispose(()=>clearInterval(d));{const g=()=>{u.ondblclick=()=>{s.positionEditing&&(s.positionEditing=!1),s.textEditingInteraction&&(s.textEditing=!0)},u.onblur=()=>{s.text=u.innerText,s.textEditingInteraction&&(d&&clearTimeout(d),d=setTimeout(()=>{s.textEditing=!1},100))},u.addEventListener("keydown",function(_){s.textEditingInteraction&&(_.code==="Enter"&&!_.shiftKey&&u.blur(),_.code==="Escape"&&u.blur())})};g(),this.dispose(s.textEditingInteractionChanged.disposableOn(g))}}this._container.appendChild(u),this.dispose(()=>{this._container.removeChild(u)}),s._divCreatedEvent.emit(u),this.dispose(()=>s._divToDestroyEvent.emit(u))}}o.instanceClass=r}this.dispose(o.pickedEvent.don(r=>{(o.allowPicking??!1)&&s.pickedEvent.emit(r)}))}get pickedEvent(){return this._pickedEvent}get divEvent(){return this._divEvent}get divCreatedEvent(){return this._divCreatedEvent}get divToDestroyEvent(){return this._divToDestroyEvent}get pc(){return this._pc}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get customDivPoi(){return this._customDivPoi}};R(rc,"defaults",{width:80,height:28,text:"请输入文字",borderStyle:"solid",fontFamily:"",viewDistanceRange:[1e3,1e4,3e4,6e4],scale:[1,1],zOrder:0});let pn=rc;(i=>{i.createDefaultProps=()=>({show:!0,position:f.reactArrayWithUndefined(void 0),text:void 0,width:void 0,height:void 0,fontFamily:void 0,positionEditing:!1,textEditing:!1,textEditingInteraction:!1,originRatioAndOffset:f.reactArray([.5,1,0,0]),opacity:1,fontSize:14,textAlign:"left",color:f.reactArray([1,1,1,1]),backgroundColor:f.reactArray([0,0,0,.8]),padding:f.reactArray([5,5,5,5]),borderRadius:f.reactArray([6,6,6,6]),borderWidth:0,borderColor:f.reactArray([1,1,1,1]),borderStyle:"solid",viewDistanceRange:f.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,pickOnClick:!1,shadowDom:!1,cssAllInitial:!1,scale:f.reactArray([1,1]),zOrder:0,rotate:0})})(pn||(pn={})),f.extendClassProps(pn.prototype,pn.createDefaultProps);class kg extends f.Destroyable{constructor(e){super();R(this,"_enabled",this.disposeVar(f.react(!1)));R(this,"_cursorPosition",f.react(void 0));R(this,"quickPickPosition",!0);let n=new f.Destroyable;const s=()=>{n&&(n.destroy(),n=void 0)};this.dispose(s);const o=()=>{var d;if(s(),!this._enabled.value||!e)return;const r=Mi(e);if(!r)return;n=new f.Destroyable;const a=n.disposeVar(f.react(void 0)),c=n.disposeVar(f.createNextAnimateFrameEvent(a.changed)),h=(d=e.getTargetElement)==null?void 0:d.call(e);if(!h)return;const l=g=>{const _=f.getDomEventCurrentTargetPos(g);a.value=_};h.addEventListener("mousemove",l),n.dispose(()=>h.removeEventListener("mousemove",l));const u=n.disposeVar(f.createProcessingFromAsyncFunc(async g=>{const _=r.pickingManager;if(!_||!a.value)return;const y=a.value,w=this.quickPickPosition?await g.promise(f.createCancelablePromise(_.quickPickPosition(y))):await g.promise(f.createCancelablePromise(_.pickPosition(y)));this._cursorPosition.value=w}));n.dispose(c.disposableOn(()=>{u.restart()}))};o(),this.dispose(this._enabled.changed.disposableOn(o))}get enabled(){return this._enabled.value}set enabled(e){this._enabled.value=e}get enabledChanged(){return this._enabled.changed}get cursorPosition(){return this._cursorPosition.value}get cursorPositionChanged(){return this._cursorPosition.changed}}class Wg extends f.Destroyable{constructor(e){super();R(this,"_baseLayers",new Set);R(this,"_imageryGroup",new sn({zIndex:-9999,visible:!0}));this._map=e,this._map.addLayer(this._imageryGroup),this.d(()=>this._map.removeLayer(this._imageryGroup))}get baseLayers(){return this._baseLayers}get map(){return this._map}add(e){if(this._baseLayers.has(e)){console.warn("imageriesManager add error: has already added!",e);return}this._imageryGroup.getLayers().push(e),this._baseLayers.add(e)}delete(e){if(!this._baseLayers.has(e)){console.warn("imageriesManager delete error: has not added!",e);return}this._imageryGroup.getLayers().remove(e),this._baseLayers.delete(e)}setZindex(e,n){if(!this._baseLayers.has(e)){console.warn("imageriesManager setZindex error: has not added!",e);return}e.setZIndex(n-9999)}}class qg extends f.Destroyable{constructor(e){super();R(this,"_labelMap",{div:new globalThis.Map,canvas:new globalThis.Map});this._map=e;const n=e.getView(),s=[];s.push(n.on("change:center",()=>this._updateZOrder())),s.push(n.on("change:resolution",()=>this._updateZOrder())),s.push(n.on("change:rotation",()=>this._updateZOrder())),s.push(e.on("moveend",()=>this._updateZOrder())),this.dispose(()=>gi(s))}add(e){const n=e instanceof Qt?"div":"canvas";if(this._labelMap[n].has(e)){console.warn(`Label already exists in ${n} map`,e);return}const s=new f.Destroyable;{const o=s.dv(f.createNextAnimateFrameEvent(e.zOrderChanged,e.positionChanged));s.dispose(o.don(()=>this._updateZOrder()))}this._labelMap[n].set(e,()=>s.destroy()),this._updateZOrder()}delete(e){const n=e instanceof Qt?"div":"canvas";if(!this._labelMap[n].has(e)){console.warn(`Label not found in ${n} map`,e);return}const s=this._labelMap[n].get(e);s==null||s(),this._labelMap[n].delete(e),this._updateZOrder()}_updateZOrder(){for(const e in this._labelMap)Object.prototype.hasOwnProperty.call(this._labelMap,e)&&this._updateLabelZOrder(this._labelMap[e],e)}_updateLabelZOrder(e,n){var a;const s={};for(const c of e.keys()){const h=c.zOrder.toString();s[h]||(s[h]=new globalThis.Map);const l=c instanceof Qt&&c.olDivPoi?c.olDivPoi.depth:c instanceof Ai&&c.canvasObj&&((a=c.canvasObj.olCanvasPoi)==null?void 0:a.depth)||0;s[h].set(c,l)}const o=Object.keys(s).sort((c,h)=>n==="div"?Number(h)-Number(c):Number(c)-Number(h));let r=e.size;o.forEach(c=>{new globalThis.Map([...s[c]].sort((l,u)=>u[1]-l[1])).forEach((l,u)=>{var d;u instanceof Qt&&u.olDivPoi?u.olDivPoi.zOrder=r:u instanceof Ai&&((d=u.canvasObj)!=null&&d.olCanvasPoi)&&(u.canvasObj.olCanvasPoi.zOrder=r),r--})})}}class Gg extends ih{constructor(t){super(t),this.image_=null}getImage(){return this.image_?this.image_.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],n=t.pixelRatio,s=t.viewState,o=s.resolution,r=this.getLayer().getSource(),a=t.viewHints;let c=t.extent;if(e.extent!==void 0&&(c=An(c,_i(e.extent,s.projection))),!a[Vt.ANIMATING]&&!a[Vt.INTERACTING]&&!Xi(c))if(r){const h=s.projection,l=r.getImage(c,o,n,h);l&&(this.loadImage(l)?this.image_=l:l.getState()===ot.EMPTY&&(this.image_=null))}else this.image_=null;return!!this.image_}getData(t){const e=this.frameState;if(!e)return null;const n=this.getLayer(),s=Ut(e.pixelToCoordinateTransform,t.slice()),o=n.getExtent();if(o&&!so(o,s))return null;const r=this.image_.getExtent(),a=this.getImage(),c=_t(r),h=Math.floor(a.width*((s[0]-r[0])/c));if(h<0||h>=a.width)return null;const l=Ht(r),u=Math.floor(a.height*((r[3]-s[1])/l));return u<0||u>=a.height?null:this.getImageData(a,h,u)}renderFrame(t,e){const n=this.image_,s=n.getExtent(),o=n.getResolution(),r=n.getPixelRatio(),a=t.layerStatesArray[t.layerIndex],c=t.pixelRatio,h=t.viewState,l=h.center,u=h.resolution,d=c*o/(u*r),g=t.extent,_=h.resolution,y=h.rotation,w=Math.round(_t(g)/_*c),E=Math.round(Ht(g)/_*c);qe(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/c,1/c,y,-w/2,-E/2),Or(this.inversePixelTransform,this.pixelTransform);const b=mc(this.pixelTransform);this.useContainer(e,b,this.getBackground(t));const P=this.context,I=P.canvas;I.width!=w||I.height!=E?(I.width=w,I.height=E):this.containerReused||P.clearRect(0,0,w,E);let M=!1,D=!0;if(a.extent){const X=_i(a.extent,h.projection);D=te(X,t.extent),M=D&&!Tn(X,t.extent),M&&this.clipUnrotated(P,t,X)}const L=this.getImage(),z=qe(this.tempTransform,w/2,E/2,d,d,0,r*(s[0]-l[0])/o,r*(l[1]-s[3])/o);this.renderedResolution=o*c/r;const q=L.width*z[0],Y=L.height*z[3];if(this.getLayer().getSource().getInterpolate()||(P.imageSmoothingEnabled=!1),this.preRender(P,t),D&&q>=.5&&Y>=.5){const X=z[4],Q=z[5],m=a.opacity;let v;m!==1&&(v=P.globalAlpha,P.globalAlpha=m),P.drawImage(L,0,0,+L.width,+L.height,X,Q,q,Y),m!==1&&(P.globalAlpha=v)}return this.postRender(P,t),M&&P.restore(),P.imageSmoothingEnabled=!0,b!==I.style.transform&&(I.style.transform=b),this.container}}class pv extends Gg{constructor(t){super(t),this.vectorRenderer_=new Td(t),this.layerImageRatio_=t.getImageRatio(),this.coordinateToVectorPixelTransform_=be(),this.renderedPixelToCoordinateTransform_=null}disposeInternal(){this.vectorRenderer_.dispose(),super.disposeInternal()}getFeatures(t){if(!this.vectorRenderer_)return Promise.resolve([]);const e=Ut(this.coordinateToVectorPixelTransform_,Ut(this.renderedPixelToCoordinateTransform_,t.slice()));return this.vectorRenderer_.getFeatures(e)}handleFontsChanged(){this.vectorRenderer_.handleFontsChanged()}prepareFrame(t){const e=t.pixelRatio,n=t.viewState,s=n.resolution,o=t.viewHints,r=this.vectorRenderer_;let a=t.extent;this.layerImageRatio_!==1&&(a=a.slice(0),om(a,this.layerImageRatio_));const c=_t(a)/s,h=Ht(a)/s;if(!o[Vt.ANIMATING]&&!o[Vt.INTERACTING]&&!Xi(a)){r.useContainer(null,null);const l=r.context,u=t.layerStatesArray[t.layerIndex],d=Object.assign({},u,{opacity:1}),g=Object.assign({},t,{declutterTree:new Kc(9),extent:a,size:[c,h],viewState:Object.assign({},t.viewState,{rotation:0}),layerStatesArray:[d],layerIndex:0});let _=!0;const y=new Ld(a,s,e,l.canvas,function(w){r.prepareFrame(g)&&r.replayGroupChanged&&(r.clipping=!1,r.renderFrame(g,null)&&(r.renderDeclutter(g),_=!1),w())});y.addEventListener(ht.CHANGE,()=>{if(y.getState()!==ot.LOADED)return;this.image_=_?null:y;const w=y.getResolution(),E=y.getPixelRatio(),b=w*e/E;this.renderedResolution=b,this.coordinateToVectorPixelTransform_=qe(this.coordinateToVectorPixelTransform_,c/2,h/2,1/b,-1/b,0,-n.center[0],-n.center[1])}),y.load()}return this.image_&&(this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice()),!!this.image_}preRender(){}postRender(){}renderDeclutter(){}forEachFeatureAtCoordinate(t,e,n,s,o){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(t,e,n,s,o):super.forEachFeatureAtCoordinate(t,e,n,s,o)}}class mv extends pd{constructor(t){t=t||{};const e=Object.assign({},t);delete e.imageRatio,super(e),this.imageRatio_=t.imageRatio!==void 0?t.imageRatio:1}getImageRatio(){return this.imageRatio_}createRenderer(){return new pv(this)}}class Bg extends f.Destroyable{constructor(e){super();R(this,"_map");this._map=e.viewer}async pickPosition(e){return new Promise(n=>{try{if(!this._map)return n(void 0);const s=this._map.getCoordinateFromPixel(e),[o,r]=Kt(s);n([o,r,0])}catch(s){return console.error(s),n(void 0)}})}async quickPickPosition(e){return await this.pickPosition(e)}async pick(e,n,s){return new Promise(o=>{try{if(!this._map)return o(void 0);const r=[];this._map.forEachFeatureAtPixel(e,(g,_)=>{console.log("forEachFeatureAtPixel",g,_),r.push([g,_])}),console.log("pickedObjects",r);const a=r.length>0?r[0]:void 0;if(!a)return o(void 0);const c=a[0].getId();if(!c)return o(void 0);let h=f.ESSceneObject.getSceneObjectById(c.toString());if(h&&h.parentID&&(h=f.ESSceneObject.getSceneObjectById(h.parentID)),!h)return o(void 0);console.log("sceneObject:",h);const l=new f.ESJPickedResult(a,h,void 0,void 0,s,e);return h&&Reflect.has(h,"allowPicking")&&Reflect.has(h,"pickedEvent")&&(h.allowPicking??!1)&&h.pickedEvent.emit(l),h&&Reflect.has(h,"allowPicking")&&!(h.allowPicking??!1)?o(new f.ESJPickedResult):o(l)}catch(r){return console.error(r),o(void 0)}})}_layerPickable(e){return!e||e instanceof sn?!1:e instanceof oi||e instanceof mv}_resolveSceneObject(e,n){var a,c;let s;const o=(a=e==null?void 0:e.get)==null?void 0:a.call(e,"ESSceneObjectID");if(typeof o=="string"&&(s=o),!s){const h=(c=n==null?void 0:n.get)==null?void 0:c.call(n,"ESSceneObjectID");typeof h=="string"&&(s=h)}let r=s?f.ESSceneObject.getSceneObject(s):void 0;return r&&r.parentID&&(r=f.ESSceneObject.getSceneObject(r.parentID)),r}_buildGeoJsonPickInfo(e,n,s){var l;const o=e.getGeometry(),r=((l=o==null?void 0:o.getType)==null?void 0:l.call(o))??"Point",a=e.getProperties?e.getProperties():{},{geometry:c,...h}=a||{};return r==="Point"?{type:"Point",coordinates:[n,s,0],properties:h}:{type:r,coordinates:void 0,properties:h}}}function Mi(i){return f.getExtProp(i,"_viewerExtensions")}function Ba(i,t){f.setExtProp(i,"_viewerExtensions",t)}class Vg extends f.Destroyable{constructor(e,n){super();R(this,"_imageriesManager");R(this,"_labelManager");R(this,"_pickingManager");R(this,"_poiContext");R(this,"_cursorPositionInfo");this._viewer=e,this._olViewer=n,this._imageriesManager=this.dv(new Wg(e)),this._labelManager=this.dv(new qg(e)),this._poiContext=this.disposeVar(new Ng(this._viewer)),this._cursorPositionInfo=this.dv(new kg(e)),this.ad(n.viewerChanged.don(()=>{this._pickingManager=this.dv(new Bg(n))}))}get viewer(){return this._viewer}get olViewer(){return this._olViewer}get imageriesManager(){return this._imageriesManager}get labelManager(){return this._labelManager}get pickingManager(){return this._pickingManager}get poiContext(){return this._poiContext}get cursorPositionInfo(){return this._cursorPositionInfo}}class _v extends f.Destroyable{constructor(t,e){super(),this._olViewer=t,this._viewer=e;const n=this._viewer,s=n.getView();{let o=this._olViewer.disabledInputStack===0;const r=()=>{var c;const a=this._olViewer.disabledInputStack===0;a!==o&&(o=a,a?this._olViewer.restoreMapInteraction():(this._olViewer.changeToMap(),(c=s.cancelAnimations)==null||c.call(s),this._olViewer.suspendMapInteraction()))};r(),this.dispose(this._olViewer.disabledInputStackChanged.don(r))}{const o=()=>{this._olViewer.cameraChanged.emit()},r=s.on("change:center",()=>o()),a=s.on("change:resolution",()=>o()),c=s.on("change:rotation",()=>o());this.d(()=>{gi([r,a,c])})}{let o=performance.now(),r=0;const a=()=>{var u;const h=performance.now();r++;const l=h-o;l>1e3&&(((u=this._olViewer._fps)==null?void 0:u.value)!==void 0&&(this._olViewer._fps.value=r*1e3/l|0),o=h,r=0)},c=n.on("postrender",a);this.d(()=>gi(c))}}get olViewer(){return this._olViewer}get viewer(){return this._viewer}}const Xs=class Xs extends f.ESViewer{constructor(e){super(e);R(this,"_viewer",this.dv(f.react(void 0)));R(this,"orbitController",null);R(this,"_fpsMonitor",null);R(this,"wasdController",null);R(this,"_disabledInputStack",this.disposeVar(f.react(0)));R(this,"_interactionBackup",null);R(this,"_notSupportEditingCount",this.disposeVar(f.react(0)));R(this,"_editingSystem",this.ad(Fp()));if(e.type!==Xs.type)throw new Error("option.type must be ESOlViewer");this.d(this._viewer.changed.don(n=>{this.viewerChanged.emit(n)})),this.dv(new f.ObjResettingWithEvent(this.viewerChanged,()=>{if(this.viewer)return new _v(this,this.viewer)})),this.dv(new f.ObjResettingWithEvent(this.subContainerChanged,()=>{if(this.setStatus("Raw"),this.setStatusLog(""),!!this.subContainer)return new tv(this.subContainer,this,n=>this._viewer.value=n)}))}get viewer(){return this._viewer.value}get extensions(){return this.viewer&&Mi(this.viewer)}get disabledInputStack(){return this._disabledInputStack.value}set disabledInputStack(e){this._disabledInputStack.value=e}get disabledInputStackChanged(){return this._disabledInputStack.changed}incrementDisabledInputStack(){++this._disabledInputStack.value}decrementDisabledInputStack(){--this._disabledInputStack.value}_suspendMapInteraction(){!this.viewer||this._interactionBackup||(this._interactionBackup=this.viewer.getInteractions().getArray().slice(),this.viewer.getInteractions().clear())}_restoreMapInteraction(){!this.viewer||!this._interactionBackup||(this._interactionBackup.forEach(e=>{var n;return(n=this.viewer)==null?void 0:n.getInteractions().push(e)}),this._interactionBackup=null)}restoreMapInteraction(){this._restoreMapInteraction()}suspendMapInteraction(){this._suspendMapInteraction()}_func(e=!1){return console.warn("ESOlViewer 暂未实现该方法!"),Promise.resolve(void 0)}setRotation(e){if(!this.viewer)return;this.viewer.getView().setRotation(e*Math.PI/180)}async pick(e,n,s){if(!this.extensions)return;const{pickingManager:o}=this.extensions;return await o.pick(e,void 0,n)}async pickPosition(e){if(!this.extensions)return;const{pickingManager:n}=this.extensions;return await n.pickPosition(e)}async quickPickPosition(e){if(!this.extensions)return;const{pickingManager:n}=this.extensions;return await n.quickPickPosition(e)}flyIn(e,n,s){if(!this.viewer)return;const o=kn(e[2]);this.viewer.getView().animate({center:yt([e[0],e[1]]),zoom:o,duration:(s??1)*1e3})}flyTo(e,n){if(!this.viewer)return;const s=kn(e.distance);this.viewer.getView().animate({center:yt([n[0],n[1]]),zoom:s,duration:(e.flyDuration??1)*1e3})}flyToBoundingSphere(e,n,s){if(!this.viewer)return;const o={_duration:(s??1)*1e3};console.log(e);const r=yt([e[0],e[1]]),a=yt([e[2],e[3]]);this.viewer.getView().fit(Nc([r[0],r[1],a[0],a[1]]),{duration:o._duration,easing:Pn,padding:[10,10,10,10]})}async getTerrainHeight(e){return console.warn("openlayers不支持获取地形高度!"),0}getCurrentCameraInfo(){if(!this.viewer)return;const e=this.viewer.getView().getZoom();if(!e)return;const n=Io(e),s=this.viewer.getView().getCenter();if(!s)return;const o=Kt(s),r=this.viewer.getView().getRotation(),c={position:[o[0],o[1],n],rotation:[0,r/(Math.PI/180),0]};return console.log("视图中心点:",c),c}transformFlyParam(e,n){}calcFlyToParam(e){const n=this.getCurrentCameraInfo();if(!n)return;const{position:s,rotation:o}=n,r=f.geoRhumbDistance(s,e),a=e[0]-s[0],c=e[1]-s[1],l=Math.atan2(a,c)*180/Math.PI,u=e[2]-s[2],g=Math.atan2(u,r)*180/Math.PI,_=l+90;return{distance:r,heading:_,pitch:g,flyDuration:1,hDelta:-(o[0]-_),pDelta:o[1]-g}}getLengthInPixel(){if(this.viewer)return this.viewer.getView().getResolution()}changeToWalk(e){this.viewer&&(this.changeToMap(),this.container&&(this.wasdController=this.dv(new tf(this.container,this.viewer,[e[0],e[1]]))))}changeToMap(){var e;this.wasdController&&(this.wasdController.destroy(),this.wasdController=null),this.orbitController&&(this.orbitController.stop(),this.orbitController=null,(e=this.viewer)==null||e.getView().setRotation(0))}changeToRotateGlobe(e,n,s){this.changeToMap(),console.warn("Openlayers引擎暂不支持全球旋转,已切换为Map模式")}changeToLine(e,n,s,o,r,a){this._func()}changeToUserDefined(e){this.changeToMap(),console.warn("Openlayers引擎暂不支持自定义漫游,已切换为Map模式")}changeToRotatePoint(e,n=5e4,s=60,o=90,r=0){if(!this.viewer)return;const a=this.viewer.getView();this.changeToMap();const c={_distance:n,_orbitPeriod:s*1e3,heading:o},h=kn(c._distance);a.setZoom(h),this.orbitController=Jd(this.viewer,{center:[e[0],e[1]],orbitPeriod:c._orbitPeriod,heading:c.heading})}changeToFollow(e,n,s,o){this._func()}getFPS(){return this.viewer&&!this._fpsMonitor&&(this._fpsMonitor=this.dv(new ef(this.viewer))),this._fpsMonitor?this._fpsMonitor.getFPS():0}async getVersion(){const e=window.g_XE3CopyRights??{};return e.openlayers=qp,e}getHeightByLonLat(e,n,s){return console.warn("getHeightByLonLat is not supported in OpenLayers"),Promise.resolve(0)}getHeightsByLonLats(e,n){return console.warn("getHeightsByLonLats is not supported in OpenLayers"),Promise.resolve([])}async capture(e,n){if(this.viewer)return await Qd(this.viewer,e,n)}lonLatAltToScreenPosition(e){return this._func()}getBoundSphere(e){return this._func()}get notSupportEditingCount(){return this._notSupportEditingCount.value}set notSupportEditingCount(e){this._notSupportEditingCount.value=e}get notSupportEditingCountChanged(){return this._notSupportEditingCount.changed}startEditing(e,n,s){s=Object.assign({useKeyToSwitch:!0,callSource:"outer"},s);const o=e.components.main??e;o&&n!=null&&(o.editingID=`${s.callSource}_${f.createGuid()}`,this._editingSystem.restart(void 0,this,o,n,s.useKeyToSwitch))}stopEditing(){this._editingSystem.isRunning&&this._editingSystem.cancel()}moveObjects(e){this._func()}getViewExtent(){if(!this.viewer)return console.warn("ESOlViewer: OpenLayers viewer not initialized."),Promise.resolve(void 0);const n=this.viewer.getView().calculateExtent(this.viewer.getSize());if(console.log(n),!n)return Promise.resolve(void 0);const s=Kt([n[0],n[1]]),o=Kt([n[2],n[3]]),r=[s[0],s[1],o[0],o[1]];return console.log(r),Promise.resolve(r)}};R(Xs,"type",Xs.register("ESOlViewer",Xs));let ui=Xs;(i=>{i.createDefaultProps=()=>({...f.ESViewer.createDefaultProps()})})(ui||(ui={})),f.extendClassProps(ui.prototype,ui.createDefaultProps);class yv extends yo{constructor(t){t=t||{},super(t)}}class ml extends yv{constructor(t){super(t)}createRenderer(){return new Gg(this)}getData(t){return super.getData(t)}}const Va={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class wv extends yo{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getPreload(){return this.get(Va.PRELOAD)}setPreload(t){this.set(Va.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(Va.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(Va.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}const Yg=.5,vv=10,Hg=.25;class Xg{constructor(t,e,n,s,o,r){this.sourceProj_=t,this.targetProj_=e;let a={};const c=Fn(this.targetProj_,this.sourceProj_);this.transformInv_=function(b){const P=b[0]+"/"+b[1];return a[P]||(a[P]=c(b)),a[P]},this.maxSourceExtent_=s,this.errorThresholdSquared_=o*o,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&_t(s)>=_t(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?_t(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?_t(this.targetProj_.getExtent()):null;const h=Ae(n),l=Mr(n),u=Ar(n),d=Tr(n),g=this.transformInv_(h),_=this.transformInv_(l),y=this.transformInv_(u),w=this.transformInv_(d),E=vv+(r?Math.max(0,Math.ceil(Math.log2(wc(n)/(r*r*256*256)))):0);if(this.addQuad_(h,l,u,d,g,_,y,w,E),this.wrapsXInSource_){let b=1/0;this.triangles_.forEach(function(P,I,M){b=Math.min(b,P.source[0][0],P.source[1][0],P.source[2][0])}),this.triangles_.forEach(P=>{if(Math.max(P.source[0][0],P.source[1][0],P.source[2][0])-b>this.sourceWorldWidth_/2){const I=[[P.source[0][0],P.source[0][1]],[P.source[1][0],P.source[1][1]],[P.source[2][0],P.source[2][1]]];I[0][0]-b>this.sourceWorldWidth_/2&&(I[0][0]-=this.sourceWorldWidth_),I[1][0]-b>this.sourceWorldWidth_/2&&(I[1][0]-=this.sourceWorldWidth_),I[2][0]-b>this.sourceWorldWidth_/2&&(I[2][0]-=this.sourceWorldWidth_);const M=Math.min(I[0][0],I[1][0],I[2][0]);Math.max(I[0][0],I[1][0],I[2][0])-M<this.sourceWorldWidth_/2&&(P.source=I)}})}a={}}addTriangle_(t,e,n,s,o,r){this.triangles_.push({source:[s,o,r],target:[t,e,n]})}addQuad_(t,e,n,s,o,r,a,c,h){const l=Ir([o,r,a,c]),u=this.sourceWorldWidth_?_t(l)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,g=this.sourceProj_.canWrapX()&&u>.5&&u<1;let _=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const w=Ir([t,e,n,s]);_=_t(w)/this.targetWorldWidth_>Hg||_}!g&&this.sourceProj_.isGlobal()&&u&&(_=u>Hg||_)}if(!_&&this.maxSourceExtent_&&isFinite(l[0])&&isFinite(l[1])&&isFinite(l[2])&&isFinite(l[3])&&!te(l,this.maxSourceExtent_))return;let y=0;if(!_&&(!isFinite(o[0])||!isFinite(o[1])||!isFinite(r[0])||!isFinite(r[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(c[0])||!isFinite(c[1]))){if(h>0)_=!0;else if(y=(!isFinite(o[0])||!isFinite(o[1])?8:0)+(!isFinite(r[0])||!isFinite(r[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(c[0])||!isFinite(c[1])?1:0),y!=1&&y!=2&&y!=4&&y!=8)return}if(h>0){if(!_){const w=[(t[0]+n[0])/2,(t[1]+n[1])/2],E=this.transformInv_(w);let b;g?b=($i(o[0],d)+$i(a[0],d))/2-$i(E[0],d):b=(o[0]+a[0])/2-E[0];const P=(o[1]+a[1])/2-E[1];_=b*b+P*P>this.errorThresholdSquared_}if(_){if(Math.abs(t[0]-n[0])<=Math.abs(t[1]-n[1])){const w=[(e[0]+n[0])/2,(e[1]+n[1])/2],E=this.transformInv_(w),b=[(s[0]+t[0])/2,(s[1]+t[1])/2],P=this.transformInv_(b);this.addQuad_(t,e,w,b,o,r,E,P,h-1),this.addQuad_(b,w,n,s,P,E,a,c,h-1)}else{const w=[(t[0]+e[0])/2,(t[1]+e[1])/2],E=this.transformInv_(w),b=[(n[0]+s[0])/2,(n[1]+s[1])/2],P=this.transformInv_(b);this.addQuad_(t,w,b,s,o,E,P,c,h-1),this.addQuad_(w,e,n,b,E,r,a,P,h-1)}return}}if(g){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(y&11)==0&&this.addTriangle_(t,n,s,o,a,c),(y&14)==0&&this.addTriangle_(t,n,e,o,a,r),y&&((y&13)==0&&this.addTriangle_(e,s,t,r,c,o),(y&7)==0&&this.addTriangle_(e,s,n,r,c,a))}calculateSourceExtent(){const t=Te();return this.triangles_.forEach(function(e,n,s){const o=e.source;ro(t,o[0]),ro(t,o[1]),ro(t,o[2])}),t}getTriangles(){return this.triangles_}}let _l;const ks=[];function $g(i,t,e,n,s){i.beginPath(),i.moveTo(0,0),i.lineTo(t,e),i.lineTo(n,s),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(t,n)+1,Math.max(e,s)),i.restore()}function yl(i,t){return Math.abs(i[t*4]-210)>2||Math.abs(i[t*4+3]-191.25)>2}function Ev(){if(_l===void 0){const i=Bt(6,6,ks);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",$g(i,4,5,4,0),$g(i,4,5,0,5);const t=i.getImageData(0,0,3,3).data;_l=yl(t,0)||yl(t,4)||yl(t,8),Gr(i),ks.push(i.canvas)}return _l}function Ya(i,t,e,n){const s=co(e,t,i);let o=Cu(t,n,e);const r=t.getMetersPerUnit();r!==void 0&&(o*=r);const a=i.getMetersPerUnit();a!==void 0&&(o/=a);const c=i.getExtent();if(!c||so(c,s)){const h=Cu(i,o,s)/o;isFinite(h)&&h>0&&(o/=h)}return o}function Cv(i,t,e,n){const s=Hi(e);let o=Ya(i,t,s,n);return(!isFinite(o)||o<=0)&&lu(e,function(r){return o=Ya(i,t,r,n),isFinite(o)&&o>0}),o}function Zg(i,t,e,n,s,o,r,a,c,h,l,u){const d=Bt(Math.round(e*i),Math.round(e*t),ks);if(u||(d.imageSmoothingEnabled=!1),c.length===0)return d.canvas;d.scale(e,e);function g(I){return Math.round(I*e)/e}d.globalCompositeOperation="lighter";const _=Te();c.forEach(function(I,M,D){em(_,I.extent)});const y=_t(_),w=Ht(_),E=Bt(Math.round(e*y/n),Math.round(e*w/n),ks);u||(E.imageSmoothingEnabled=!1);const b=e/n;c.forEach(function(I,M,D){const L=I.extent[0]-_[0],z=-(I.extent[3]-_[3]),q=_t(I.extent),Y=Ht(I.extent);I.image.width>0&&I.image.height>0&&E.drawImage(I.image,h,h,I.image.width-2*h,I.image.height-2*h,L*b,z*b,q*b,Y*b)});const P=Ae(r);return a.getTriangles().forEach(function(I,M,D){const L=I.source,z=I.target;let q=L[0][0],Y=L[0][1],X=L[1][0],Q=L[1][1],m=L[2][0],v=L[2][1];const S=g((z[0][0]-P[0])/o),A=g(-(z[0][1]-P[1])/o),F=g((z[1][0]-P[0])/o),N=g(-(z[1][1]-P[1])/o),G=g((z[2][0]-P[0])/o),B=g(-(z[2][1]-P[1])/o),Z=q,V=Y;q=0,Y=0,X-=Z,Q-=V,m-=Z,v-=V;const at=[[X,Q,0,0,F-S],[m,v,0,0,G-S],[0,0,X,Q,N-A],[0,0,m,v,B-A]],et=wm(at);if(et){if(d.save(),d.beginPath(),Ev()||!u){d.moveTo(F,N);const it=4,gt=S-F,wt=A-N;for(let dt=0;dt<it;dt++)d.lineTo(F+g((dt+1)*gt/it),N+g(dt*wt/(it-1))),dt!=it-1&&d.lineTo(F+g((dt+1)*gt/it),N+g((dt+1)*wt/(it-1)));d.lineTo(G,B)}else d.moveTo(F,N),d.lineTo(S,A),d.lineTo(G,B);d.clip(),d.transform(et[0],et[2],et[1],et[3],S,A),d.translate(_[0]-Z,_[3]-V),d.scale(n/e,-n/e),d.drawImage(E.canvas,0,0),d.restore()}}),Gr(E),ks.push(E.canvas),l&&(d.save(),d.globalCompositeOperation="source-over",d.strokeStyle="black",d.lineWidth=1,a.getTriangles().forEach(function(I,M,D){const L=I.target,z=(L[0][0]-P[0])/o,q=-(L[0][1]-P[1])/o,Y=(L[1][0]-P[0])/o,X=-(L[1][1]-P[1])/o,Q=(L[2][0]-P[0])/o,m=-(L[2][1]-P[1])/o;d.beginPath(),d.moveTo(Y,X),d.lineTo(z,q),d.lineTo(Q,m),d.closePath(),d.stroke()}),d.restore()),d.canvas}class wl extends zd{constructor(t,e,n,s,o,r,a,c,h,l,u,d){super(o,rt.IDLE,{interpolate:!!d}),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=c,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=s,this.wrappedTileCoord_=r||o,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const g=s.getTileCoordExtent(this.wrappedTileCoord_),_=this.targetTileGrid_.getExtent();let y=this.sourceTileGrid_.getExtent();const w=_?An(g,_):g;if(wc(w)===0){this.state=rt.EMPTY;return}const E=t.getExtent();E&&(y?y=An(y,E):y=E);const b=s.getResolution(this.wrappedTileCoord_[0]),P=Cv(t,n,w,b);if(!isFinite(P)||P<=0){this.state=rt.EMPTY;return}const I=l!==void 0?l:Yg;if(this.triangulation_=new Xg(t,n,w,y,P*I,b),this.triangulation_.getTriangles().length===0){this.state=rt.EMPTY;return}this.sourceZ_=e.getZForResolution(P);let M=this.triangulation_.calculateSourceExtent();if(y&&(t.canWrapX()?(M[1]=qt(M[1],y[1],y[3]),M[3]=qt(M[3],y[1],y[3])):M=An(M,y)),!wc(M))this.state=rt.EMPTY;else{const D=e.getTileRangeForExtentAndZ(M,this.sourceZ_);for(let L=D.minX;L<=D.maxX;L++)for(let z=D.minY;z<=D.maxY;z++){const q=h(this.sourceZ_,L,z,a);q&&this.sourceTiles_.push(q)}this.sourceTiles_.length===0&&(this.state=rt.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{e&&e.getState()==rt.LOADED&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}),this.sourceTiles_.length=0,t.length===0)this.state=rt.ERROR;else{const e=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(e),s=typeof n=="number"?n:n[0],o=typeof n=="number"?n:n[1],r=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),c=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Zg(s,o,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),r,c,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=rt.LOADED}this.changed()}load(){if(this.state==rt.IDLE){this.state=rt.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(e=>{const n=e.getState();if(n==rt.IDLE||n==rt.LOADING){t++;const s=Ct(e,ht.CHANGE,function(o){const r=e.getState();(r==rt.LOADED||r==rt.ERROR||r==rt.EMPTY)&&(Mt(s),t--,t===0&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(s)}}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(e,n,s){e.getState()==rt.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(Mt),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Gr(this.canvas_.getContext("2d")),ks.push(this.canvas_),this.canvas_=null),super.release()}}class bv extends ih{constructor(t){super(t),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=Te(),this.tmpTileRange_=new ph(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),n=t.getState(),s=e.getUseInterimTilesOnError();return n==rt.LOADED||n==rt.EMPTY||n==rt.ERROR&&!s}getTile(t,e,n,s){const o=s.pixelRatio,r=s.viewState.projection,a=this.getLayer();let h=a.getSource().getTile(t,e,n,o,r);return h.getState()==rt.ERROR&&a.getUseInterimTilesOnError()&&a.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(h)||(h=h.getInterimTile()),h}getData(t){const e=this.frameState;if(!e)return null;const n=this.getLayer(),s=Ut(e.pixelToCoordinateTransform,t.slice()),o=n.getExtent();if(o&&!so(o,s))return null;const r=e.pixelRatio,a=e.viewState.projection,c=e.viewState,h=n.getRenderSource(),l=h.getTileGridForProjection(c.projection),u=h.getTilePixelRatio(e.pixelRatio);for(let d=l.getZForResolution(c.resolution);d>=l.getMinZoom();--d){const g=l.getTileCoordForCoordAndZ(s,d),_=h.getTile(d,g[1],g[2],r,a);if(!(_ instanceof Nd||_ instanceof wl)||_ instanceof wl&&_.getState()===rt.EMPTY)return null;if(_.getState()!==rt.LOADED)continue;const y=l.getOrigin(d),w=fe(l.getTileSize(d)),E=l.getResolution(d),b=Math.floor(u*((s[0]-y[0])/E-g[1]*w[0])),P=Math.floor(u*((y[1]-s[1])/E-g[2]*w[1])),I=Math.round(u*h.getGutterForProjection(c.projection));return this.getImageData(_.getImage(),b+I,P+I)}return null}loadedTileCallback(t,e,n){return this.isDrawableTile(n)?super.loadedTileCallback(t,e,n):!1}prepareFrame(t){return!!this.getLayer().getSource()}renderFrame(t,e){const n=t.layerStatesArray[t.layerIndex],s=t.viewState,o=s.projection,r=s.resolution,a=s.center,c=s.rotation,h=t.pixelRatio,l=this.getLayer(),u=l.getSource(),d=u.getRevision(),g=u.getTileGridForProjection(o),_=g.getZForResolution(r,u.zDirection),y=g.getResolution(_);let w=t.extent;const E=t.viewState.resolution,b=u.getTilePixelRatio(h),P=Math.round(_t(w)/E*h),I=Math.round(Ht(w)/E*h),M=n.extent&&_i(n.extent);M&&(w=An(w,_i(n.extent)));const D=y*P/2/b,L=y*I/2/b,z=[a[0]-D,a[1]-L,a[0]+D,a[1]+L],q=g.getTileRangeForExtentAndZ(w,_),Y={};Y[_]={};const X=this.createLoadedTileFinder(u,o,Y),Q=this.tmpExtent,m=this.tmpTileRange_;this.newTiles_=!1;const v=c?Ec(s.center,E,c,t.size):void 0;for(let at=q.minX;at<=q.maxX;++at)for(let et=q.minY;et<=q.maxY;++et){if(c&&!g.tileCoordIntersectsViewport([_,at,et],v))continue;const it=this.getTile(_,at,et,t);if(this.isDrawableTile(it)){const dt=St(this);if(it.getState()==rt.LOADED){Y[_][it.tileCoord.toString()]=it;let Et=it.inTransition(dt);Et&&n.opacity!==1&&(it.endTransition(dt),Et=!1),!this.newTiles_&&(Et||!this.renderedTiles.includes(it))&&(this.newTiles_=!0)}if(it.getAlpha(dt,t.time)===1)continue}const gt=g.getTileCoordChildTileRange(it.tileCoord,m,Q);let wt=!1;gt&&(wt=X(_+1,gt)),wt||g.forEachTileCoordParentTileRange(it.tileCoord,X,m,Q)}const S=y/r*h/b;qe(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/h,1/h,c,-P/2,-I/2);const A=mc(this.pixelTransform);this.useContainer(e,A,this.getBackground(t));const F=this.context,N=F.canvas;Or(this.inversePixelTransform,this.pixelTransform),qe(this.tempTransform,P/2,I/2,S,S,0,-P/2,-I/2),N.width!=P||N.height!=I?(N.width=P,N.height=I):this.containerReused||F.clearRect(0,0,P,I),M&&this.clipUnrotated(F,t,M),u.getInterpolate()||(F.imageSmoothingEnabled=!1),this.preRender(F,t),this.renderedTiles.length=0;let G=Object.keys(Y).map(Number);G.sort(On);let B,Z,V;n.opacity===1&&(!this.containerReused||u.getOpaque(t.viewState.projection))?G=G.reverse():(B=[],Z=[]);for(let at=G.length-1;at>=0;--at){const et=G[at],it=u.getTilePixelSize(et,h,o),wt=g.getResolution(et)/y,dt=it[0]*wt*S,Et=it[1]*wt*S,ft=g.getTileCoordForCoordAndZ(Ae(z),et),xt=g.getTileCoordExtent(ft),Ft=Ut(this.tempTransform,[b*(xt[0]-z[0])/y,b*(z[3]-xt[3])/y]),kt=b*u.getGutterForProjection(o),Wt=Y[et];for(const he in Wt){const ye=Wt[he],ns=ye.tileCoord,we=ft[1]-ns[1],En=Math.round(Ft[0]-(we-1)*dt),Cn=ft[2]-ns[2],bn=Math.round(Ft[1]-(Cn-1)*Et),ae=Math.round(Ft[0]-we*dt),ve=Math.round(Ft[1]-Cn*Et),Oe=En-ae,Ne=bn-ve,ki=_===et,fi=ki&&ye.getAlpha(St(this),t.time)!==1;let Rt=!1;if(!fi)if(B){V=[ae,ve,ae+Oe,ve,ae+Oe,ve+Ne,ae,ve+Ne];for(let Ee=0,Ze=B.length;Ee<Ze;++Ee)if(_!==et&&et<Z[Ee]){const At=B[Ee];te([ae,ve,ae+Oe,ve+Ne],[At[0],At[3],At[4],At[7]])&&(Rt||(F.save(),Rt=!0),F.beginPath(),F.moveTo(V[0],V[1]),F.lineTo(V[2],V[3]),F.lineTo(V[4],V[5]),F.lineTo(V[6],V[7]),F.moveTo(At[6],At[7]),F.lineTo(At[4],At[5]),F.lineTo(At[2],At[3]),F.lineTo(At[0],At[1]),F.clip())}B.push(V),Z.push(et)}else F.clearRect(ae,ve,Oe,Ne);this.drawTileImage(ye,t,ae,ve,Oe,Ne,kt,ki),B&&!fi?(Rt&&F.restore(),this.renderedTiles.unshift(ye)):this.renderedTiles.push(ye),this.updateUsedTiles(t.usedTiles,u,ye)}}return this.renderedRevision=d,this.renderedResolution=y,this.extentChanged=!this.renderedExtent_||!Yi(this.renderedExtent_,z),this.renderedExtent_=z,this.renderedPixelRatio=h,this.renderedProjection=o,this.manageTilePyramid(t,u,g,h,o,w,_,l.getPreload()),this.scheduleExpireCache(t,u),this.postRender(F,t),n.extent&&F.restore(),F.imageSmoothingEnabled=!0,A!==N.style.transform&&(N.style.transform=A),this.container}drawTileImage(t,e,n,s,o,r,a,c){const h=this.getTileImage(t);if(!h)return;const l=St(this),u=e.layerStatesArray[e.layerIndex],d=u.opacity*(c?t.getAlpha(l,e.time):1),g=d!==this.context.globalAlpha;g&&(this.context.save(),this.context.globalAlpha=d),this.context.drawImage(h,a,a,h.width-2*a,h.height-2*a,n,s,o,r),g&&this.context.restore(),d!==u.opacity?e.animate=!0:c&&t.endTransition(l)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}scheduleExpireCache(t,e){if(e.canExpireCache()){const n=(function(s,o,r){const a=St(s);a in r.usedTiles&&s.expireCache(r.viewState.projection,r.usedTiles[a])}).bind(null,e);t.postRenderFunctions.push(n)}}updateUsedTiles(t,e,n){const s=St(e);s in t||(t[s]={}),t[s][n.getKey()]=!0}manageTilePyramid(t,e,n,s,o,r,a,c,h){const l=St(e);l in t.wantedTiles||(t.wantedTiles[l]={});const u=t.wantedTiles[l],d=t.tileQueue,g=n.getMinZoom(),_=t.viewState.rotation,y=_?Ec(t.viewState.center,t.viewState.resolution,_,t.size):void 0;let w=0,E,b,P,I,M,D;for(D=g;D<=a;++D)for(b=n.getTileRangeForExtentAndZ(r,D,b),P=n.getResolution(D),I=b.minX;I<=b.maxX;++I)for(M=b.minY;M<=b.maxY;++M)_&&!n.tileCoordIntersectsViewport([D,I,M],y)||(a-D<=c?(++w,E=e.getTile(D,I,M,s,o),E.getState()==rt.IDLE&&(u[E.getKey()]=!0,d.isKeyQueued(E.getKey())||d.enqueue([E,l,n.getTileCoordCenter(E.tileCoord),P])),h!==void 0&&h(E)):e.useTile(D,I,M,o));e.updateCacheSize(w,o)}}class Ha extends wv{constructor(t){super(t)}createRenderer(){return new bv(this)}}class xv extends th{constructor(t,e,n,s,o,r,a){let c=t.getExtent();c&&t.canWrapX()&&(c=c.slice(),c[0]=-1/0,c[2]=1/0);let h=e.getExtent();h&&e.canWrapX()&&(h=h.slice(),h[0]=-1/0,h[2]=1/0);const l=h?An(n,h):n,u=Hi(l),d=Ya(t,e,u,s),g=Yg,_=new Xg(t,e,l,c,d*g,s),y=_.calculateSourceExtent(),w=Xi(y)?null:r(y,d,o),E=w?ot.IDLE:ot.EMPTY,b=w?w.getPixelRatio():1;super(n,s,b,E),this.targetProj_=e,this.maxSourceExtent_=c,this.triangulation_=_,this.targetResolution_=s,this.targetExtent_=n,this.sourceImage_=w,this.sourcePixelRatio_=b,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==ot.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==ot.LOADED){const e=_t(this.targetExtent_)/this.targetResolution_,n=Ht(this.targetExtent_)/this.targetResolution_;this.canvas_=Zg(e,n,this.sourcePixelRatio_,this.sourceImage_.getResolution(),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_)}this.state=t,this.changed()}load(){if(this.state==ot.IDLE){this.state=ot.LOADING,this.changed();const t=this.sourceImage_.getState();t==ot.LOADED||t==ot.ERROR?this.reproject_():(this.sourceListenerKey_=Ct(this.sourceImage_,ht.CHANGE,function(e){const n=this.sourceImage_.getState();(n==ot.LOADED||n==ot.ERROR)&&(this.unlistenSource_(),this.reproject_())},this),this.sourceImage_.load())}}unlistenSource_(){Mt(this.sourceListenerKey_),this.sourceListenerKey_=null}}const vl={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class Sv extends We{constructor(t,e){super(t),this.image=e}}class El extends Ro{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:t.interpolate!==void 0?t.interpolate:!0}),this.on,this.once,this.un,this.resolutions_=t.resolutions!==void 0?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();if(e){const n=Sr(e,t,0);t=e[n]}return t}getImage(t,e,n,s){const o=this.getProjection();if(!o||!s||Zi(o,s))return o&&(s=o),this.getImageInternal(t,e,n,s);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Zi(this.reprojectedImage_.getProjection(),s)&&this.reprojectedImage_.getResolution()==e&&Yi(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new xv(o,s,t,e,n,(r,a,c)=>this.getImageInternal(r,a,c,o),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,n,s){return vt()}handleImageChange(t){const e=t.target;let n;switch(e.getState()){case ot.LOADING:this.loading=!0,n=vl.IMAGELOADSTART;break;case ot.LOADED:this.loading=!1,n=vl.IMAGELOADEND;break;case ot.ERROR:this.loading=!1,n=vl.IMAGELOADERROR;break;default:return}this.hasListener(n)&&this.dispatchEvent(new Sv(n,e))}}function Rv(i,t){i.getImage().src=t}class Kg extends El{constructor(t){const e=t.crossOrigin!==void 0?t.crossOrigin:null,n=t.imageLoadFunction!==void 0?t.imageLoadFunction:Rv;super({attributions:t.attributions,interpolate:t.interpolate,projection:Gt(t.projection)}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image_=new S0(this.imageExtent_,void 0,1,this.url_,e,n,Bt(1,1)),this.imageSize_=t.imageSize?t.imageSize:null,this.image_.addEventListener(ht.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(t,e,n,s){return te(t,this.image_.getExtent())?this.image_:null}getUrl(){return this.url_}handleImageChange(t){if(this.image_.getState()==ot.LOADED){const e=this.image_.getExtent(),n=this.image_.getImage();let s,o;this.imageSize_?(s=this.imageSize_[0],o=this.imageSize_[1]):(s=n.width,o=n.height);const r=_t(e),a=Ht(e),c=r/s,h=a/o;let l=s,u=o;if(c>h?l=Math.round(r/h):u=Math.round(a/c),l!==s||u!==o){const d=Bt(l,u);this.getInterpolate()||(d.imageSmoothingEnabled=!1);const g=d.canvas;d.drawImage(n,0,0,s,o,0,0,g.width,g.height),this.image_.setImage(g)}}super.handleImageChange(t)}}const Ws=[0,0,0],mn=5;class qs{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,pt(jp(this.resolutions_,function(s,o){return o-s}),17);let e;if(!t.origins){for(let s=0,o=this.resolutions_.length-1;s<o;++s)if(!e)e=this.resolutions_[s]/this.resolutions_[s+1];else if(this.resolutions_[s]/this.resolutions_[s+1]!==e){e=void 0;break}}this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=t.origin!==void 0?t.origin:null,this.origins_=null,t.origins!==void 0&&(this.origins_=t.origins,pt(this.origins_.length==this.resolutions_.length,20));const n=t.extent;n!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=Ae(n)),pt(!this.origin_&&this.origins_||this.origin_&&!this.origins_,18),this.tileSizes_=null,t.tileSizes!==void 0&&(this.tileSizes_=t.tileSizes,pt(this.tileSizes_.length==this.resolutions_.length,19)),this.tileSize_=t.tileSize!==void 0?t.tileSize:this.tileSizes_?null:Bc,pt(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,22),this.extent_=n!==void 0?n:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],t.sizes!==void 0?this.fullTileRanges_=t.sizes.map(function(s,o){const r=new ph(Math.min(0,s[0]),Math.max(s[0]-1,-1),Math.min(0,s[1]),Math.max(s[1]-1,-1));if(n){const a=this.getTileRangeForExtentAndZ(n,o);r.minX=Math.max(a.minX,r.minX),r.maxX=Math.min(a.maxX,r.maxX),r.minY=Math.max(a.minY,r.minY),r.maxY=Math.min(a.maxY,r.maxY)}return r},this):n&&this.calculateTileRanges_(n)}forEachTileCoord(t,e,n){const s=this.getTileRangeForExtentAndZ(t,e);for(let o=s.minX,r=s.maxX;o<=r;++o)for(let a=s.minY,c=s.maxY;a<=c;++a)n([e,o,a])}forEachTileCoordParentTileRange(t,e,n,s){let o,r,a,c=null,h=t[0]-1;for(this.zoomFactor_===2?(r=t[1],a=t[2]):c=this.getTileCoordExtent(t,s);h>=this.minZoom;){if(this.zoomFactor_===2?(r=Math.floor(r/2),a=Math.floor(a/2),o=xs(r,r,a,a,n)):o=this.getTileRangeForExtentAndZ(c,h,n),e(h,o))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,n){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){const o=t[1]*2,r=t[2]*2;return xs(o,o+1,r,r+1,e)}const s=this.getTileCoordExtent(t,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,n){if(e>this.maxZoom||e<this.minZoom)return null;const s=t[0],o=t[1],r=t[2];if(e===s)return xs(o,r,o,r,n);if(this.zoomFactor_){const c=Math.pow(this.zoomFactor_,e-s),h=Math.floor(o*c),l=Math.floor(r*c);if(e<s)return xs(h,h,l,l,n);const u=Math.floor(c*(o+1))-1,d=Math.floor(c*(r+1))-1;return xs(h,u,l,d,n)}const a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,n)}getTileRangeForExtentAndZ(t,e,n){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,Ws);const s=Ws[1],o=Ws[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,Ws);const r=Ws[1],a=Ws[2];return xs(s,r,o,a,n)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),n=this.getResolution(t[0]),s=fe(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*s[0]*n,e[1]-(t[2]+.5)*s[1]*n]}getTileCoordExtent(t,e){const n=this.getOrigin(t[0]),s=this.getResolution(t[0]),o=fe(this.getTileSize(t[0]),this.tmpSize_),r=n[0]+t[1]*o[0]*s,a=n[1]-(t[2]+1)*o[1]*s,c=r+o[0]*s,h=a+o[1]*s;return pi(r,a,c,h,e)}getTileCoordForCoordAndResolution(t,e,n){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,n)}getTileCoordForXYAndResolution_(t,e,n,s,o){const r=this.getZForResolution(n),a=n/this.getResolution(r),c=this.getOrigin(r),h=fe(this.getTileSize(r),this.tmpSize_);let l=a*(t-c[0])/n/h[0],u=a*(c[1]-e)/n/h[1];return s?(l=zr(l,mn)-1,u=zr(u,mn)-1):(l=Lr(l,mn),u=Lr(u,mn)),Xd(r,l,u,o)}getTileCoordForXYAndZ_(t,e,n,s,o){const r=this.getOrigin(n),a=this.getResolution(n),c=fe(this.getTileSize(n),this.tmpSize_);let h=(t-r[0])/a/c[0],l=(r[1]-e)/a/c[1];return s?(h=zr(h,mn)-1,l=zr(l,mn)-1):(h=Lr(h,mn),l=Lr(l,mn)),Xd(n,h,l,o)}getTileCoordForCoordAndZ(t,e,n){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,n)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){const n=Sr(this.resolutions_,t,e||0);return qt(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return ju(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,n=new Array(e);for(let s=this.minZoom;s<e;++s)n[s]=this.getTileRangeForExtentAndZ(t,s);this.fullTileRanges_=n}}function Qg(i){let t=i.getDefaultTileGrid();return t||(t=Iv(i),i.setDefaultTileGrid(t)),t}function Pv(i,t,e){const n=t[0],s=i.getTileCoordCenter(t),o=Cl(e);if(!so(o,s)){const r=_t(o),a=Math.ceil((o[0]-s[0])/r);return s[0]+=r*a,i.getTileCoordForCoordAndZ(s,n)}return t}function Ov(i,t,e,n){n=n!==void 0?n:"top-left";const s=tp(i,t,e);return new qs({extent:i,origin:nm(i,n),resolutions:s,tileSize:e})}function Jg(i){const t=i||{},e=t.extent||Gt("EPSG:3857").getExtent(),n={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:tp(e,t.maxZoom,t.tileSize,t.maxResolution)};return new qs(n)}function tp(i,t,e,n){t=t!==void 0?t:a0,e=fe(e!==void 0?e:Bc);const s=Ht(i),o=_t(i);n=n>0?n:Math.max(o/e[0],s/e[1]);const r=t+1,a=new Array(r);for(let c=0;c<r;++c)a[c]=n/Math.pow(2,c);return a}function Iv(i,t,e,n){const s=Cl(i);return Ov(s,t,e,n)}function Cl(i){i=Gt(i);let t=i.getExtent();if(!t){const e=180*Cc.degrees/i.getMetersPerUnit();t=pi(-e,-e,e,e)}return t}class ep extends Ro{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.opaque_=t.opaque!==void 0?t.opaque:!1,this.tilePixelRatio_=t.tilePixelRatio!==void 0?t.tilePixelRatio:1,this.tileGrid=t.tileGrid!==void 0?t.tileGrid:null;const e=[256,256];this.tileGrid&&fe(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tileCache=new Kd(t.cacheSize||0),this.tmpSize=[0,0],this.key_=t.key||"",this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}canExpireCache(){return this.tileCache.canExpireCache()}expireCache(t,e){const n=this.getTileCacheForProjection(t);n&&n.expireCache(e)}forEachLoadedTile(t,e,n,s){const o=this.getTileCacheForProjection(t);if(!o)return!1;let r=!0,a,c,h;for(let l=n.minX;l<=n.maxX;++l)for(let u=n.minY;u<=n.maxY;++u)c=na(e,l,u),h=!1,o.containsKey(c)&&(a=o.get(c),h=a.getState()===rt.LOADED,h&&(h=s(a)!==!1)),h||(r=!1);return r}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getOpaque(t){return this.opaque_}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,n,s,o){return vt()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Qg(t)}getTileCacheForProjection(t){const e=this.getProjection();return pt(e===null||Zi(e,t),68),this.tileCache}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,n){const s=this.getTileGridForProjection(n),o=this.getTilePixelRatio(e),r=fe(s.getTileSize(t),this.tmpSize);return o==1?r:Hu(r,o,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){e=e!==void 0?e:this.getProjection();const n=this.getTileGridForProjection(e);return this.getWrapX()&&e.isGlobal()&&(t=Pv(n,t,e)),N_(t,n)?t:null}clear(){this.tileCache.clear()}refresh(){this.clear(),super.refresh()}updateCacheSize(t,e){const n=this.getTileCacheForProjection(e);t>n.highWaterMark&&(n.highWaterMark=t)}useTile(t,e,n,s){}}class Tv extends We{constructor(t,e){super(t),this.tile=e}}let ip=!0;try{new ImageData(10,10)}catch{ip=!1}let bl;function Av(i,t,e){if(ip)return new ImageData(i,t,e);bl||(bl=document.createElement("canvas").getContext("2d"));const n=bl.createImageData(t,e);return n.data.set(i),n}function np(i){let t=!0;try{new ImageData(10,10)}catch{t=!1}function e(n,s,o){return t?new ImageData(n,s,o):{data:n,width:s,height:o}}return function(n){const s=n.buffers,o=n.meta,r=n.imageOps,a=n.width,c=n.height,h=s.length,l=s[0].byteLength;if(r){const _=new Array(h);for(let w=0;w<h;++w)_[w]=e(new Uint8ClampedArray(s[w]),a,c);return i(_,o).data.buffer}const u=new Uint8ClampedArray(l),d=new Array(h),g=new Array(h);for(let _=0;_<h;++_)d[_]=new Uint8ClampedArray(s[_]),g[_]=[0,0,0,0];for(let _=0;_<l;_+=4){for(let w=0;w<h;++w){const E=d[w];g[w][0]=E[_],g[w][1]=E[_+1],g[w][2]=E[_+2],g[w][3]=E[_+3]}const y=i(g,o);u[_]=y[0],u[_+1]=y[1],u[_+2]=y[2],u[_+3]=y[3]}return u.buffer}}function Mv(i,t){const n=Object.keys(i.lib||{}).map(function(o){return"const "+o+" = "+i.lib[o].toString()+";"}).concat(["const __minion__ = ("+np.toString()+")(",i.operation.toString(),");",'self.addEventListener("message", function(event) {'," const buffer = __minion__(event.data);"," self.postMessage({buffer: buffer, meta: event.data.meta}, [buffer]);","});"]),s=new Worker(typeof Blob>"u"?"data:text/javascript;base64,"+Buffer.from(n.join(`
|
|
158
|
+
}`;this.instanceClassStr=b};E(),this.dispose(this.innerHTMLChanged.disposableOn(E))}}update(e){this._updateEvent.emit(e)}get instanceClass(){return this._instanceClassReact.value}set instanceClass(e){this._instanceClassReact.value=e}get instanceClassChanged(){return this._instanceClassReact.changed}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get pickedEvent(){return this._pickedEvent}pickFromDiv(e,n){(this.allowPicking??!1)&&this.pickedEvent.emit(new f.ESJPickedResult({element:e,...n}))}get innerHtmlMounted(){return this._innerHtmlMounted}get olDivPoi(){return this._olDivPoi}set olDivPoi(e){this._olDivPoi=e}get objResetting(){return this._objResetting}get olViewerVisibleDistanceRangeControl(){return this._olViewVisibleDistanceRangeControl}get visibleAlpha(){return this._olViewVisibleDistanceRangeControl.visibleAlpha}get visibleAlphaChanged(){return this._olViewVisibleDistanceRangeControl.visibleAlphaChanged}}R(Qt,"defaultOLInstanceClassStr",pl),R(Qt,"olInstanceClassStrReadMe",Ug),R(Qt,"defaults",{position:[116.39,39.9,0],instanceClassStr:pl,instanceClassStrReadMe:Ug,innerHTML:jg,innerHTMLReadMe:fv,viewDistanceRange:[1e3,1e4,3e4,6e4],zOrder:0}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,opacity:1,position:f.reactArrayWithUndefined(void 0),originRatioAndOffset:f.reactArray([.5,1,0,0]),instanceClassStr:void 0,innerHTML:void 0,viewDistanceRange:f.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,shadowDom:!1,cssAllInitial:!1,zOrder:0})})(Qt||(Qt={})),f.extendClassProps(Qt.prototype,Qt.createDefaultProps);class gv extends f.Destroyable{constructor(t,e,n){super(),this._container=t}}const rc=class rc extends f.Destroyable{constructor(e,n){super();R(this,"_pickedEvent",this.disposeVar(new f.Event));R(this,"_divEvent",this.disposeVar(new f.Event));R(this,"_divCreatedEvent",this.disposeVar(new f.Event));R(this,"_divToDestroyEvent",this.disposeVar(new f.Event));R(this,"_pc",this.disposeVar(new f.PointerClick));R(this,"_flyToEvent",this.disposeVar(new f.Event));R(this,"_customDivPoi");this._customDivPoi=this.disposeVar(new Qt(e,n));const s=this,o=this._customDivPoi;this.dispose(this.flyToEvent.disposableOn(r=>{o.flyTo(r)})),this.dispose(f.bind([o,"show"],[this,"show"])),this.dispose(f.bind([o,"position"],[this,"position"])),this.dispose(f.bind([o,"originRatioAndOffset"],[this,"originRatioAndOffset"])),this.dispose(f.bind([o,"opacity"],[this,"opacity"])),this.dispose(f.bind([o,"viewDistanceRange"],[this,"viewDistanceRange"])),this.dispose(f.bind([o,"viewDistanceDebug"],[this,"viewDistanceDebug"])),this.dispose(f.bind([o,"shadowDom"],[this,"shadowDom"])),this.dispose(f.bind([o,"cssAllInitial"],[this,"cssAllInitial"])),this.dispose(f.bind([o,"allowPicking"],[this,"pickOnClick"])),this.d(f.bind([o,"zOrder"],[this,"zOrder"]));{class r extends gv{constructor(c,h,l){super(c,h,l);const u=document.createElement("div");u.style.overflow="hidden",u.style.whiteSpace="nowrap",u.addEventListener("mouseover",()=>{s.divEvent.emit(!0)}),u.addEventListener("mouseout",()=>{s.divEvent.emit(!1)});{{const g=()=>{o.show=s.show??!0,u.style.pointerEvents="all",s.width===void 0?u.style.width="auto":u.style.width=`${s.width}px`,s.height===void 0?u.style.height="auto":u.style.height=`${s.height}px`,s.text!==void 0?u.innerHTML=`${s.text.replace(/\n/g,"<br/>")??"请输入文字"}`:u.innerHTML="请输入文字",u.style.fontSize=`${s.fontSize??14}px`,u.style.fontFamily=`${s.fontFamily??rc.defaults.fontFamily}`;const y=s.borderRadius??[6,6,6,6];u.style.borderRadius=`${y[0]}px ${y[1]}px ${y[2]}px ${y[3]}px`;const w=s.color??[1,1,1,1];u.style.color=`rgba(${w[0]*255},${w[1]*255},${w[2]*255},${w[3]})`;const E=s.backgroundColor??[0,0,0,.8];u.style.backgroundColor=`rgba(${E[0]*255},${E[1]*255},${E[2]*255},${E[3]})`;const b=s.padding??[5,5,5,5];u.style.padding=`${b[0]}px ${b[1]}px ${b[2]}px ${b[3]}px`,u.style.borderWidth=`${s.borderWidth??0}px`;const P=s.borderColor??[1,1,1,1];u.style.borderColor=`rgba(${P[0]*255},${P[1]*255},${P[2]*255},${P[3]})`,u.style.borderStyle=`${s.borderStyle??"solid"}`,u.style.textAlign=`${s.textAlign??"left"}`,u.style.transform=`scale(${s.scale[0]??1},${s.scale[1]??1}) rotate(${s.rotate??0}deg)`};g();const _=this.disposeVar(f.createNextAnimateFrameEvent(s.showChanged,s.widthChanged,s.heightChanged,s.textChanged,s.fontSizeChanged,s.borderRadiusChanged,s.colorChanged,s.backgroundColorChanged,s.paddingChanged,s.borderWidthChanged,s.borderColorChanged,s.borderStyleChanged,s.fontFamilyChanged,s.textAlignChanged,s.scaleChanged,s.rotateChanged));this.dispose(_.disposableOn(g))}{const g=()=>{s.textEditing?(u.contentEditable="true",u.focus(),document.execCommand("selectAll",!1,null)):(u.contentEditable="false",document.execCommand("unselect",!1,null))};g(),this.dispose(s.textEditingChanged.disposableOn(g))}{const g=()=>{s.textEditingInteraction||(s.positionEditing??!1?u.style.pointerEvents="none":u.style.pointerEvents="all")};g(),this.dispose(s.positionEditingChanged.disposableOn(g))}let d=null;this.dispose(()=>clearInterval(d));{const g=()=>{u.ondblclick=()=>{s.positionEditing&&(s.positionEditing=!1),s.textEditingInteraction&&(s.textEditing=!0)},u.onblur=()=>{s.text=u.innerText,s.textEditingInteraction&&(d&&clearTimeout(d),d=setTimeout(()=>{s.textEditing=!1},100))},u.addEventListener("keydown",function(_){s.textEditingInteraction&&(_.code==="Enter"&&!_.shiftKey&&u.blur(),_.code==="Escape"&&u.blur())})};g(),this.dispose(s.textEditingInteractionChanged.disposableOn(g))}}this._container.appendChild(u),this.dispose(()=>{this._container.removeChild(u)}),s._divCreatedEvent.emit(u),this.dispose(()=>s._divToDestroyEvent.emit(u))}}o.instanceClass=r}this.dispose(o.pickedEvent.don(r=>{(o.allowPicking??!1)&&s.pickedEvent.emit(r)}))}get pickedEvent(){return this._pickedEvent}get divEvent(){return this._divEvent}get divCreatedEvent(){return this._divCreatedEvent}get divToDestroyEvent(){return this._divToDestroyEvent}get pc(){return this._pc}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get customDivPoi(){return this._customDivPoi}};R(rc,"defaults",{width:80,height:28,text:"请输入文字",borderStyle:"solid",fontFamily:"",viewDistanceRange:[1e3,1e4,3e4,6e4],scale:[1,1],zOrder:0});let pn=rc;(i=>{i.createDefaultProps=()=>({show:!0,position:f.reactArrayWithUndefined(void 0),text:void 0,width:void 0,height:void 0,fontFamily:void 0,positionEditing:!1,textEditing:!1,textEditingInteraction:!1,originRatioAndOffset:f.reactArray([.5,1,0,0]),opacity:1,fontSize:14,textAlign:"left",color:f.reactArray([1,1,1,1]),backgroundColor:f.reactArray([0,0,0,.8]),padding:f.reactArray([5,5,5,5]),borderRadius:f.reactArray([6,6,6,6]),borderWidth:0,borderColor:f.reactArray([1,1,1,1]),borderStyle:"solid",viewDistanceRange:f.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,pickOnClick:!1,shadowDom:!1,cssAllInitial:!1,scale:f.reactArray([1,1]),zOrder:0,rotate:0})})(pn||(pn={})),f.extendClassProps(pn.prototype,pn.createDefaultProps);class kg extends f.Destroyable{constructor(e){super();R(this,"_enabled",this.disposeVar(f.react(!1)));R(this,"_cursorPosition",f.react(void 0));R(this,"quickPickPosition",!0);let n=new f.Destroyable;const s=()=>{n&&(n.destroy(),n=void 0)};this.dispose(s);const o=()=>{var d;if(s(),!this._enabled.value||!e)return;const r=Mi(e);if(!r)return;n=new f.Destroyable;const a=n.disposeVar(f.react(void 0)),c=n.disposeVar(f.createNextAnimateFrameEvent(a.changed)),h=(d=e.getTargetElement)==null?void 0:d.call(e);if(!h)return;const l=g=>{const _=f.getDomEventCurrentTargetPos(g);a.value=_};h.addEventListener("mousemove",l),n.dispose(()=>h.removeEventListener("mousemove",l));const u=n.disposeVar(f.createProcessingFromAsyncFunc(async g=>{const _=r.pickingManager;if(!_||!a.value)return;const y=a.value,w=this.quickPickPosition?await g.promise(f.createCancelablePromise(_.quickPickPosition(y))):await g.promise(f.createCancelablePromise(_.pickPosition(y)));this._cursorPosition.value=w}));n.dispose(c.disposableOn(()=>{u.restart()}))};o(),this.dispose(this._enabled.changed.disposableOn(o))}get enabled(){return this._enabled.value}set enabled(e){this._enabled.value=e}get enabledChanged(){return this._enabled.changed}get cursorPosition(){return this._cursorPosition.value}get cursorPositionChanged(){return this._cursorPosition.changed}}class Wg extends f.Destroyable{constructor(e){super();R(this,"_baseLayers",new Set);R(this,"_imageryGroup",new sn({zIndex:-9999,visible:!0}));this._map=e,this._map.addLayer(this._imageryGroup),this.d(()=>this._map.removeLayer(this._imageryGroup))}get baseLayers(){return this._baseLayers}get map(){return this._map}add(e){if(this._baseLayers.has(e)){console.warn("imageriesManager add error: has already added!",e);return}this._imageryGroup.getLayers().push(e),this._baseLayers.add(e)}delete(e){if(!this._baseLayers.has(e)){console.warn("imageriesManager delete error: has not added!",e);return}this._imageryGroup.getLayers().remove(e),this._baseLayers.delete(e)}setZindex(e,n){if(!this._baseLayers.has(e)){console.warn("imageriesManager setZindex error: has not added!",e);return}e.setZIndex(n-9999)}}class qg extends f.Destroyable{constructor(e){super();R(this,"_labelMap",{div:new globalThis.Map,canvas:new globalThis.Map});this._map=e;const n=e.getView(),s=[];s.push(n.on("change:center",()=>this._updateZOrder())),s.push(n.on("change:resolution",()=>this._updateZOrder())),s.push(n.on("change:rotation",()=>this._updateZOrder())),s.push(e.on("moveend",()=>this._updateZOrder())),this.dispose(()=>gi(s))}add(e){const n=e instanceof Qt?"div":"canvas";if(this._labelMap[n].has(e)){console.warn(`Label already exists in ${n} map`,e);return}const s=new f.Destroyable;{const o=s.dv(f.createNextAnimateFrameEvent(e.zOrderChanged,e.positionChanged));s.dispose(o.don(()=>this._updateZOrder()))}this._labelMap[n].set(e,()=>s.destroy()),this._updateZOrder()}delete(e){const n=e instanceof Qt?"div":"canvas";if(!this._labelMap[n].has(e)){console.warn(`Label not found in ${n} map`,e);return}const s=this._labelMap[n].get(e);s==null||s(),this._labelMap[n].delete(e),this._updateZOrder()}_updateZOrder(){for(const e in this._labelMap)Object.prototype.hasOwnProperty.call(this._labelMap,e)&&this._updateLabelZOrder(this._labelMap[e],e)}_updateLabelZOrder(e,n){var a;const s={};for(const c of e.keys()){const h=c.zOrder.toString();s[h]||(s[h]=new globalThis.Map);const l=c instanceof Qt&&c.olDivPoi?c.olDivPoi.depth:c instanceof Ai&&c.canvasObj&&((a=c.canvasObj.olCanvasPoi)==null?void 0:a.depth)||0;s[h].set(c,l)}const o=Object.keys(s).sort((c,h)=>n==="div"?Number(h)-Number(c):Number(c)-Number(h));let r=e.size;o.forEach(c=>{new globalThis.Map([...s[c]].sort((l,u)=>u[1]-l[1])).forEach((l,u)=>{var d;u instanceof Qt&&u.olDivPoi?u.olDivPoi.zOrder=r:u instanceof Ai&&((d=u.canvasObj)!=null&&d.olCanvasPoi)&&(u.canvasObj.olCanvasPoi.zOrder=r),r--})})}}class Gg extends ih{constructor(t){super(t),this.image_=null}getImage(){return this.image_?this.image_.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],n=t.pixelRatio,s=t.viewState,o=s.resolution,r=this.getLayer().getSource(),a=t.viewHints;let c=t.extent;if(e.extent!==void 0&&(c=An(c,_i(e.extent,s.projection))),!a[Vt.ANIMATING]&&!a[Vt.INTERACTING]&&!Xi(c))if(r){const h=s.projection,l=r.getImage(c,o,n,h);l&&(this.loadImage(l)?this.image_=l:l.getState()===ot.EMPTY&&(this.image_=null))}else this.image_=null;return!!this.image_}getData(t){const e=this.frameState;if(!e)return null;const n=this.getLayer(),s=Ut(e.pixelToCoordinateTransform,t.slice()),o=n.getExtent();if(o&&!so(o,s))return null;const r=this.image_.getExtent(),a=this.getImage(),c=_t(r),h=Math.floor(a.width*((s[0]-r[0])/c));if(h<0||h>=a.width)return null;const l=Ht(r),u=Math.floor(a.height*((r[3]-s[1])/l));return u<0||u>=a.height?null:this.getImageData(a,h,u)}renderFrame(t,e){const n=this.image_,s=n.getExtent(),o=n.getResolution(),r=n.getPixelRatio(),a=t.layerStatesArray[t.layerIndex],c=t.pixelRatio,h=t.viewState,l=h.center,u=h.resolution,d=c*o/(u*r),g=t.extent,_=h.resolution,y=h.rotation,w=Math.round(_t(g)/_*c),E=Math.round(Ht(g)/_*c);qe(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/c,1/c,y,-w/2,-E/2),Or(this.inversePixelTransform,this.pixelTransform);const b=mc(this.pixelTransform);this.useContainer(e,b,this.getBackground(t));const P=this.context,I=P.canvas;I.width!=w||I.height!=E?(I.width=w,I.height=E):this.containerReused||P.clearRect(0,0,w,E);let M=!1,D=!0;if(a.extent){const X=_i(a.extent,h.projection);D=te(X,t.extent),M=D&&!Tn(X,t.extent),M&&this.clipUnrotated(P,t,X)}const L=this.getImage(),z=qe(this.tempTransform,w/2,E/2,d,d,0,r*(s[0]-l[0])/o,r*(l[1]-s[3])/o);this.renderedResolution=o*c/r;const q=L.width*z[0],Y=L.height*z[3];if(this.getLayer().getSource().getInterpolate()||(P.imageSmoothingEnabled=!1),this.preRender(P,t),D&&q>=.5&&Y>=.5){const X=z[4],Q=z[5],m=a.opacity;let v;m!==1&&(v=P.globalAlpha,P.globalAlpha=m),P.drawImage(L,0,0,+L.width,+L.height,X,Q,q,Y),m!==1&&(P.globalAlpha=v)}return this.postRender(P,t),M&&P.restore(),P.imageSmoothingEnabled=!0,b!==I.style.transform&&(I.style.transform=b),this.container}}class pv extends Gg{constructor(t){super(t),this.vectorRenderer_=new Td(t),this.layerImageRatio_=t.getImageRatio(),this.coordinateToVectorPixelTransform_=be(),this.renderedPixelToCoordinateTransform_=null}disposeInternal(){this.vectorRenderer_.dispose(),super.disposeInternal()}getFeatures(t){if(!this.vectorRenderer_)return Promise.resolve([]);const e=Ut(this.coordinateToVectorPixelTransform_,Ut(this.renderedPixelToCoordinateTransform_,t.slice()));return this.vectorRenderer_.getFeatures(e)}handleFontsChanged(){this.vectorRenderer_.handleFontsChanged()}prepareFrame(t){const e=t.pixelRatio,n=t.viewState,s=n.resolution,o=t.viewHints,r=this.vectorRenderer_;let a=t.extent;this.layerImageRatio_!==1&&(a=a.slice(0),om(a,this.layerImageRatio_));const c=_t(a)/s,h=Ht(a)/s;if(!o[Vt.ANIMATING]&&!o[Vt.INTERACTING]&&!Xi(a)){r.useContainer(null,null);const l=r.context,u=t.layerStatesArray[t.layerIndex],d=Object.assign({},u,{opacity:1}),g=Object.assign({},t,{declutterTree:new Kc(9),extent:a,size:[c,h],viewState:Object.assign({},t.viewState,{rotation:0}),layerStatesArray:[d],layerIndex:0});let _=!0;const y=new Ld(a,s,e,l.canvas,function(w){r.prepareFrame(g)&&r.replayGroupChanged&&(r.clipping=!1,r.renderFrame(g,null)&&(r.renderDeclutter(g),_=!1),w())});y.addEventListener(ht.CHANGE,()=>{if(y.getState()!==ot.LOADED)return;this.image_=_?null:y;const w=y.getResolution(),E=y.getPixelRatio(),b=w*e/E;this.renderedResolution=b,this.coordinateToVectorPixelTransform_=qe(this.coordinateToVectorPixelTransform_,c/2,h/2,1/b,-1/b,0,-n.center[0],-n.center[1])}),y.load()}return this.image_&&(this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice()),!!this.image_}preRender(){}postRender(){}renderDeclutter(){}forEachFeatureAtCoordinate(t,e,n,s,o){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(t,e,n,s,o):super.forEachFeatureAtCoordinate(t,e,n,s,o)}}class mv extends pd{constructor(t){t=t||{};const e=Object.assign({},t);delete e.imageRatio,super(e),this.imageRatio_=t.imageRatio!==void 0?t.imageRatio:1}getImageRatio(){return this.imageRatio_}createRenderer(){return new pv(this)}}class Bg extends f.Destroyable{constructor(e){super();R(this,"_map");this._map=e.viewer}async pickPosition(e){return new Promise(n=>{try{if(!this._map)return n(void 0);const s=this._map.getCoordinateFromPixel(e),[o,r]=Kt(s);n([o,r,0])}catch(s){return console.error(s),n(void 0)}})}async quickPickPosition(e){return await this.pickPosition(e)}async pick(e,n,s){return new Promise(o=>{try{if(!this._map)return o(void 0);const r=[];this._map.forEachFeatureAtPixel(e,(g,_)=>{console.log("forEachFeatureAtPixel",g,_),r.push([g,_])}),console.log("pickedObjects",r);const a=r.length>0?r[0]:void 0;if(!a)return o(void 0);const c=a[0].getId();if(!c)return o(void 0);let h=f.ESSceneObject.getSceneObjectById(c.toString());if(h&&h.parentID&&(h=f.ESSceneObject.getSceneObjectById(h.parentID)),!h)return o(void 0);console.log("sceneObject:",h);const l=new f.ESJPickedResult(a,h,void 0,void 0,s,e);return h&&Reflect.has(h,"allowPicking")&&Reflect.has(h,"pickedEvent")&&(h.allowPicking??!1)&&h.pickedEvent.emit(l),h&&Reflect.has(h,"allowPicking")&&!(h.allowPicking??!1)?o(new f.ESJPickedResult):o(l)}catch(r){return console.error(r),o(void 0)}})}_layerPickable(e){return!e||e instanceof sn?!1:e instanceof oi||e instanceof mv}_resolveSceneObject(e,n){var a,c;let s;const o=(a=e==null?void 0:e.get)==null?void 0:a.call(e,"ESSceneObjectID");if(typeof o=="string"&&(s=o),!s){const h=(c=n==null?void 0:n.get)==null?void 0:c.call(n,"ESSceneObjectID");typeof h=="string"&&(s=h)}let r=s?f.ESSceneObject.getSceneObject(s):void 0;return r&&r.parentID&&(r=f.ESSceneObject.getSceneObject(r.parentID)),r}_buildGeoJsonPickInfo(e,n,s){var l;const o=e.getGeometry(),r=((l=o==null?void 0:o.getType)==null?void 0:l.call(o))??"Point",a=e.getProperties?e.getProperties():{},{geometry:c,...h}=a||{};return r==="Point"?{type:"Point",coordinates:[n,s,0],properties:h}:{type:r,coordinates:void 0,properties:h}}}function Mi(i){return f.getExtProp(i,"_viewerExtensions")}function Ba(i,t){f.setExtProp(i,"_viewerExtensions",t)}class Vg extends f.Destroyable{constructor(e,n){super();R(this,"_imageriesManager");R(this,"_labelManager");R(this,"_pickingManager");R(this,"_poiContext");R(this,"_cursorPositionInfo");this._viewer=e,this._olViewer=n,this._imageriesManager=this.dv(new Wg(e)),this._labelManager=this.dv(new qg(e)),this._poiContext=this.disposeVar(new Ng(this._viewer)),this._cursorPositionInfo=this.dv(new kg(e)),this.ad(n.viewerChanged.don(()=>{this._pickingManager=this.dv(new Bg(n))}))}get viewer(){return this._viewer}get olViewer(){return this._olViewer}get imageriesManager(){return this._imageriesManager}get labelManager(){return this._labelManager}get pickingManager(){return this._pickingManager}get poiContext(){return this._poiContext}get cursorPositionInfo(){return this._cursorPositionInfo}}class _v extends f.Destroyable{constructor(t,e){super(),this._olViewer=t,this._viewer=e;const n=this._viewer,s=n.getView();{let o=this._olViewer.disabledInputStack===0;const r=()=>{var c;const a=this._olViewer.disabledInputStack===0;a!==o&&(o=a,a?this._olViewer.restoreMapInteraction():(this._olViewer.changeToMap(),(c=s.cancelAnimations)==null||c.call(s),this._olViewer.suspendMapInteraction()))};r(),this.dispose(this._olViewer.disabledInputStackChanged.don(r))}{const o=()=>{this._olViewer.cameraChanged.emit()},r=s.on("change:center",()=>o()),a=s.on("change:resolution",()=>o()),c=s.on("change:rotation",()=>o());this.d(()=>{gi([r,a,c])})}{let o=performance.now(),r=0;const a=()=>{var u;const h=performance.now();r++;const l=h-o;l>1e3&&(((u=this._olViewer._fps)==null?void 0:u.value)!==void 0&&(this._olViewer._fps.value=r*1e3/l|0),o=h,r=0)},c=n.on("postrender",a);this.d(()=>gi(c))}}get olViewer(){return this._olViewer}get viewer(){return this._viewer}}const Xs=class Xs extends f.ESViewer{constructor(e){super(e);R(this,"_viewer",this.dv(f.react(void 0)));R(this,"orbitController",null);R(this,"_fpsMonitor",null);R(this,"wasdController",null);R(this,"_disabledInputStack",this.disposeVar(f.react(0)));R(this,"_interactionBackup",null);R(this,"_notSupportEditingCount",this.disposeVar(f.react(0)));R(this,"_editingSystem",this.ad(Fp()));if(e.type!==Xs.type)throw new Error("option.type must be ESOlViewer");this.d(this._viewer.changed.don(n=>{this.viewerChanged.emit(n)})),this.dv(new f.ObjResettingWithEvent(this.viewerChanged,()=>{if(this.viewer)return new _v(this,this.viewer)})),this.dv(new f.ObjResettingWithEvent(this.subContainerChanged,()=>{if(this.setStatus("Raw"),this.setStatusLog(""),!!this.subContainer)return new tv(this.subContainer,this,n=>this._viewer.value=n)}))}get viewer(){return this._viewer.value}get extensions(){return this.viewer&&Mi(this.viewer)}get disabledInputStack(){return this._disabledInputStack.value}set disabledInputStack(e){this._disabledInputStack.value=e}get disabledInputStackChanged(){return this._disabledInputStack.changed}incrementDisabledInputStack(){++this._disabledInputStack.value}decrementDisabledInputStack(){--this._disabledInputStack.value}_suspendMapInteraction(){!this.viewer||this._interactionBackup||(this._interactionBackup=this.viewer.getInteractions().getArray().slice(),this.viewer.getInteractions().clear())}_restoreMapInteraction(){!this.viewer||!this._interactionBackup||(this._interactionBackup.forEach(e=>{var n;return(n=this.viewer)==null?void 0:n.getInteractions().push(e)}),this._interactionBackup=null)}restoreMapInteraction(){this._restoreMapInteraction()}suspendMapInteraction(){this._suspendMapInteraction()}_func(e=!1){return console.warn("ESOlViewer 暂未实现该方法!"),Promise.resolve(void 0)}setRotation(e){if(!this.viewer)return;this.viewer.getView().setRotation(e*Math.PI/180)}async pick(e,n,s){if(!this.extensions)return;const{pickingManager:o}=this.extensions;return await o.pick(e,void 0,n)}async pickPosition(e){if(!this.extensions)return;const{pickingManager:n}=this.extensions;return await n.pickPosition(e)}async quickPickPosition(e){if(!this.extensions)return;const{pickingManager:n}=this.extensions;return await n.quickPickPosition(e)}flyIn(e,n,s){if(!this.viewer)return;const o=kn(e[2]);this.viewer.getView().animate({center:yt([e[0],e[1]]),zoom:o,duration:(s??1)*1e3})}flyTo(e,n){if(!this.viewer)return;const s=kn(e.distance);this.viewer.getView().animate({center:yt([n[0],n[1]]),zoom:s,duration:(e.flyDuration??1)*1e3})}flyToBoundingSphere(e,n,s){if(!this.viewer)return;const o={_duration:(s??1)*1e3};console.log(e);const r=yt([e[0],e[1]]),a=yt([e[2],e[3]]);this.viewer.getView().fit(Nc([r[0],r[1],a[0],a[1]]),{duration:o._duration,easing:Pn,padding:[10,10,10,10]})}async getTerrainHeight(e){return console.warn("openlayers不支持获取地形高度!"),0}getCurrentCameraInfo(){if(!this.viewer)return;const e=this.viewer.getView().getZoom();if(!e)return;const n=Io(e),s=this.viewer.getView().getCenter();if(!s)return;const o=Kt(s),r=this.viewer.getView().getRotation();return{position:[o[0],o[1],n],rotation:[0,r/(Math.PI/180),0]}}transformFlyParam(e,n){}calcFlyToParam(e){const n=this.getCurrentCameraInfo();if(!n)return;const{position:s,rotation:o}=n,r=f.geoRhumbDistance(s,e),a=e[0]-s[0],c=e[1]-s[1],l=Math.atan2(a,c)*180/Math.PI,u=e[2]-s[2],g=Math.atan2(u,r)*180/Math.PI,_=l+90;return{distance:r,heading:_,pitch:g,flyDuration:1,hDelta:-(o[0]-_),pDelta:o[1]-g}}getLengthInPixel(){if(this.viewer)return this.viewer.getView().getResolution()}changeToWalk(e){this.viewer&&(this.changeToMap(),this.container&&(this.wasdController=this.dv(new tf(this.container,this.viewer,[e[0],e[1]]))))}changeToMap(){var e;this.wasdController&&(this.wasdController.destroy(),this.wasdController=null),this.orbitController&&(this.orbitController.stop(),this.orbitController=null,(e=this.viewer)==null||e.getView().setRotation(0))}changeToRotateGlobe(e,n,s){this.changeToMap(),console.warn("Openlayers引擎暂不支持全球旋转,已切换为Map模式")}changeToLine(e,n,s,o,r,a){this._func()}changeToUserDefined(e){this.changeToMap(),console.warn("Openlayers引擎暂不支持自定义漫游,已切换为Map模式")}changeToRotatePoint(e,n=5e4,s=60,o=90,r=0){if(!this.viewer)return;const a=this.viewer.getView();this.changeToMap();const c={_distance:n,_orbitPeriod:s*1e3,heading:o},h=kn(c._distance);a.setZoom(h),this.orbitController=Jd(this.viewer,{center:[e[0],e[1]],orbitPeriod:c._orbitPeriod,heading:c.heading})}changeToFollow(e,n,s,o){this._func()}getFPS(){return this.viewer&&!this._fpsMonitor&&(this._fpsMonitor=this.dv(new ef(this.viewer))),this._fpsMonitor?this._fpsMonitor.getFPS():0}async getVersion(){const e=window.g_XE3CopyRights??{};return e.openlayers=qp,e}getHeightByLonLat(e,n,s){return console.warn("getHeightByLonLat is not supported in OpenLayers"),Promise.resolve(0)}getHeightsByLonLats(e,n){return console.warn("getHeightsByLonLats is not supported in OpenLayers"),Promise.resolve([])}async capture(e,n){if(this.viewer)return await Qd(this.viewer,e,n)}lonLatAltToScreenPosition(e){return this._func()}getBoundSphere(e){return this._func()}get notSupportEditingCount(){return this._notSupportEditingCount.value}set notSupportEditingCount(e){this._notSupportEditingCount.value=e}get notSupportEditingCountChanged(){return this._notSupportEditingCount.changed}startEditing(e,n,s){s=Object.assign({useKeyToSwitch:!0,callSource:"outer"},s);const o=e.components.main??e;o&&n!=null&&(o.editingID=`${s.callSource}_${f.createGuid()}`,this._editingSystem.restart(void 0,this,o,n,s.useKeyToSwitch))}stopEditing(){this._editingSystem.isRunning&&this._editingSystem.cancel()}moveObjects(e){this._func()}getViewExtent(){if(!this.viewer)return console.warn("ESOlViewer: OpenLayers viewer not initialized."),Promise.resolve(void 0);const n=this.viewer.getView().calculateExtent(this.viewer.getSize());if(console.log(n),!n)return Promise.resolve(void 0);const s=Kt([n[0],n[1]]),o=Kt([n[2],n[3]]),r=[s[0],s[1],o[0],o[1]];return console.log(r),Promise.resolve(r)}};R(Xs,"type",Xs.register("ESOlViewer",Xs));let ui=Xs;(i=>{i.createDefaultProps=()=>({...f.ESViewer.createDefaultProps()})})(ui||(ui={})),f.extendClassProps(ui.prototype,ui.createDefaultProps);class yv extends yo{constructor(t){t=t||{},super(t)}}class ml extends yv{constructor(t){super(t)}createRenderer(){return new Gg(this)}getData(t){return super.getData(t)}}const Va={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class wv extends yo{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getPreload(){return this.get(Va.PRELOAD)}setPreload(t){this.set(Va.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(Va.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(Va.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}const Yg=.5,vv=10,Hg=.25;class Xg{constructor(t,e,n,s,o,r){this.sourceProj_=t,this.targetProj_=e;let a={};const c=Fn(this.targetProj_,this.sourceProj_);this.transformInv_=function(b){const P=b[0]+"/"+b[1];return a[P]||(a[P]=c(b)),a[P]},this.maxSourceExtent_=s,this.errorThresholdSquared_=o*o,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&_t(s)>=_t(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?_t(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?_t(this.targetProj_.getExtent()):null;const h=Ae(n),l=Mr(n),u=Ar(n),d=Tr(n),g=this.transformInv_(h),_=this.transformInv_(l),y=this.transformInv_(u),w=this.transformInv_(d),E=vv+(r?Math.max(0,Math.ceil(Math.log2(wc(n)/(r*r*256*256)))):0);if(this.addQuad_(h,l,u,d,g,_,y,w,E),this.wrapsXInSource_){let b=1/0;this.triangles_.forEach(function(P,I,M){b=Math.min(b,P.source[0][0],P.source[1][0],P.source[2][0])}),this.triangles_.forEach(P=>{if(Math.max(P.source[0][0],P.source[1][0],P.source[2][0])-b>this.sourceWorldWidth_/2){const I=[[P.source[0][0],P.source[0][1]],[P.source[1][0],P.source[1][1]],[P.source[2][0],P.source[2][1]]];I[0][0]-b>this.sourceWorldWidth_/2&&(I[0][0]-=this.sourceWorldWidth_),I[1][0]-b>this.sourceWorldWidth_/2&&(I[1][0]-=this.sourceWorldWidth_),I[2][0]-b>this.sourceWorldWidth_/2&&(I[2][0]-=this.sourceWorldWidth_);const M=Math.min(I[0][0],I[1][0],I[2][0]);Math.max(I[0][0],I[1][0],I[2][0])-M<this.sourceWorldWidth_/2&&(P.source=I)}})}a={}}addTriangle_(t,e,n,s,o,r){this.triangles_.push({source:[s,o,r],target:[t,e,n]})}addQuad_(t,e,n,s,o,r,a,c,h){const l=Ir([o,r,a,c]),u=this.sourceWorldWidth_?_t(l)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,g=this.sourceProj_.canWrapX()&&u>.5&&u<1;let _=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const w=Ir([t,e,n,s]);_=_t(w)/this.targetWorldWidth_>Hg||_}!g&&this.sourceProj_.isGlobal()&&u&&(_=u>Hg||_)}if(!_&&this.maxSourceExtent_&&isFinite(l[0])&&isFinite(l[1])&&isFinite(l[2])&&isFinite(l[3])&&!te(l,this.maxSourceExtent_))return;let y=0;if(!_&&(!isFinite(o[0])||!isFinite(o[1])||!isFinite(r[0])||!isFinite(r[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(c[0])||!isFinite(c[1]))){if(h>0)_=!0;else if(y=(!isFinite(o[0])||!isFinite(o[1])?8:0)+(!isFinite(r[0])||!isFinite(r[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(c[0])||!isFinite(c[1])?1:0),y!=1&&y!=2&&y!=4&&y!=8)return}if(h>0){if(!_){const w=[(t[0]+n[0])/2,(t[1]+n[1])/2],E=this.transformInv_(w);let b;g?b=($i(o[0],d)+$i(a[0],d))/2-$i(E[0],d):b=(o[0]+a[0])/2-E[0];const P=(o[1]+a[1])/2-E[1];_=b*b+P*P>this.errorThresholdSquared_}if(_){if(Math.abs(t[0]-n[0])<=Math.abs(t[1]-n[1])){const w=[(e[0]+n[0])/2,(e[1]+n[1])/2],E=this.transformInv_(w),b=[(s[0]+t[0])/2,(s[1]+t[1])/2],P=this.transformInv_(b);this.addQuad_(t,e,w,b,o,r,E,P,h-1),this.addQuad_(b,w,n,s,P,E,a,c,h-1)}else{const w=[(t[0]+e[0])/2,(t[1]+e[1])/2],E=this.transformInv_(w),b=[(n[0]+s[0])/2,(n[1]+s[1])/2],P=this.transformInv_(b);this.addQuad_(t,w,b,s,o,E,P,c,h-1),this.addQuad_(w,e,n,b,E,r,a,P,h-1)}return}}if(g){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(y&11)==0&&this.addTriangle_(t,n,s,o,a,c),(y&14)==0&&this.addTriangle_(t,n,e,o,a,r),y&&((y&13)==0&&this.addTriangle_(e,s,t,r,c,o),(y&7)==0&&this.addTriangle_(e,s,n,r,c,a))}calculateSourceExtent(){const t=Te();return this.triangles_.forEach(function(e,n,s){const o=e.source;ro(t,o[0]),ro(t,o[1]),ro(t,o[2])}),t}getTriangles(){return this.triangles_}}let _l;const ks=[];function $g(i,t,e,n,s){i.beginPath(),i.moveTo(0,0),i.lineTo(t,e),i.lineTo(n,s),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(t,n)+1,Math.max(e,s)),i.restore()}function yl(i,t){return Math.abs(i[t*4]-210)>2||Math.abs(i[t*4+3]-191.25)>2}function Ev(){if(_l===void 0){const i=Bt(6,6,ks);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",$g(i,4,5,4,0),$g(i,4,5,0,5);const t=i.getImageData(0,0,3,3).data;_l=yl(t,0)||yl(t,4)||yl(t,8),Gr(i),ks.push(i.canvas)}return _l}function Ya(i,t,e,n){const s=co(e,t,i);let o=Cu(t,n,e);const r=t.getMetersPerUnit();r!==void 0&&(o*=r);const a=i.getMetersPerUnit();a!==void 0&&(o/=a);const c=i.getExtent();if(!c||so(c,s)){const h=Cu(i,o,s)/o;isFinite(h)&&h>0&&(o/=h)}return o}function Cv(i,t,e,n){const s=Hi(e);let o=Ya(i,t,s,n);return(!isFinite(o)||o<=0)&&lu(e,function(r){return o=Ya(i,t,r,n),isFinite(o)&&o>0}),o}function Zg(i,t,e,n,s,o,r,a,c,h,l,u){const d=Bt(Math.round(e*i),Math.round(e*t),ks);if(u||(d.imageSmoothingEnabled=!1),c.length===0)return d.canvas;d.scale(e,e);function g(I){return Math.round(I*e)/e}d.globalCompositeOperation="lighter";const _=Te();c.forEach(function(I,M,D){em(_,I.extent)});const y=_t(_),w=Ht(_),E=Bt(Math.round(e*y/n),Math.round(e*w/n),ks);u||(E.imageSmoothingEnabled=!1);const b=e/n;c.forEach(function(I,M,D){const L=I.extent[0]-_[0],z=-(I.extent[3]-_[3]),q=_t(I.extent),Y=Ht(I.extent);I.image.width>0&&I.image.height>0&&E.drawImage(I.image,h,h,I.image.width-2*h,I.image.height-2*h,L*b,z*b,q*b,Y*b)});const P=Ae(r);return a.getTriangles().forEach(function(I,M,D){const L=I.source,z=I.target;let q=L[0][0],Y=L[0][1],X=L[1][0],Q=L[1][1],m=L[2][0],v=L[2][1];const S=g((z[0][0]-P[0])/o),A=g(-(z[0][1]-P[1])/o),F=g((z[1][0]-P[0])/o),N=g(-(z[1][1]-P[1])/o),G=g((z[2][0]-P[0])/o),B=g(-(z[2][1]-P[1])/o),Z=q,V=Y;q=0,Y=0,X-=Z,Q-=V,m-=Z,v-=V;const at=[[X,Q,0,0,F-S],[m,v,0,0,G-S],[0,0,X,Q,N-A],[0,0,m,v,B-A]],et=wm(at);if(et){if(d.save(),d.beginPath(),Ev()||!u){d.moveTo(F,N);const it=4,gt=S-F,wt=A-N;for(let dt=0;dt<it;dt++)d.lineTo(F+g((dt+1)*gt/it),N+g(dt*wt/(it-1))),dt!=it-1&&d.lineTo(F+g((dt+1)*gt/it),N+g((dt+1)*wt/(it-1)));d.lineTo(G,B)}else d.moveTo(F,N),d.lineTo(S,A),d.lineTo(G,B);d.clip(),d.transform(et[0],et[2],et[1],et[3],S,A),d.translate(_[0]-Z,_[3]-V),d.scale(n/e,-n/e),d.drawImage(E.canvas,0,0),d.restore()}}),Gr(E),ks.push(E.canvas),l&&(d.save(),d.globalCompositeOperation="source-over",d.strokeStyle="black",d.lineWidth=1,a.getTriangles().forEach(function(I,M,D){const L=I.target,z=(L[0][0]-P[0])/o,q=-(L[0][1]-P[1])/o,Y=(L[1][0]-P[0])/o,X=-(L[1][1]-P[1])/o,Q=(L[2][0]-P[0])/o,m=-(L[2][1]-P[1])/o;d.beginPath(),d.moveTo(Y,X),d.lineTo(z,q),d.lineTo(Q,m),d.closePath(),d.stroke()}),d.restore()),d.canvas}class wl extends zd{constructor(t,e,n,s,o,r,a,c,h,l,u,d){super(o,rt.IDLE,{interpolate:!!d}),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=c,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=s,this.wrappedTileCoord_=r||o,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const g=s.getTileCoordExtent(this.wrappedTileCoord_),_=this.targetTileGrid_.getExtent();let y=this.sourceTileGrid_.getExtent();const w=_?An(g,_):g;if(wc(w)===0){this.state=rt.EMPTY;return}const E=t.getExtent();E&&(y?y=An(y,E):y=E);const b=s.getResolution(this.wrappedTileCoord_[0]),P=Cv(t,n,w,b);if(!isFinite(P)||P<=0){this.state=rt.EMPTY;return}const I=l!==void 0?l:Yg;if(this.triangulation_=new Xg(t,n,w,y,P*I,b),this.triangulation_.getTriangles().length===0){this.state=rt.EMPTY;return}this.sourceZ_=e.getZForResolution(P);let M=this.triangulation_.calculateSourceExtent();if(y&&(t.canWrapX()?(M[1]=qt(M[1],y[1],y[3]),M[3]=qt(M[3],y[1],y[3])):M=An(M,y)),!wc(M))this.state=rt.EMPTY;else{const D=e.getTileRangeForExtentAndZ(M,this.sourceZ_);for(let L=D.minX;L<=D.maxX;L++)for(let z=D.minY;z<=D.maxY;z++){const q=h(this.sourceZ_,L,z,a);q&&this.sourceTiles_.push(q)}this.sourceTiles_.length===0&&(this.state=rt.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{e&&e.getState()==rt.LOADED&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}),this.sourceTiles_.length=0,t.length===0)this.state=rt.ERROR;else{const e=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(e),s=typeof n=="number"?n:n[0],o=typeof n=="number"?n:n[1],r=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),c=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Zg(s,o,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),r,c,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=rt.LOADED}this.changed()}load(){if(this.state==rt.IDLE){this.state=rt.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(e=>{const n=e.getState();if(n==rt.IDLE||n==rt.LOADING){t++;const s=Ct(e,ht.CHANGE,function(o){const r=e.getState();(r==rt.LOADED||r==rt.ERROR||r==rt.EMPTY)&&(Mt(s),t--,t===0&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(s)}}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(e,n,s){e.getState()==rt.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(Mt),this.sourcesListenerKeys_=null}release(){this.canvas_&&(Gr(this.canvas_.getContext("2d")),ks.push(this.canvas_),this.canvas_=null),super.release()}}class bv extends ih{constructor(t){super(t),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=Te(),this.tmpTileRange_=new ph(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),n=t.getState(),s=e.getUseInterimTilesOnError();return n==rt.LOADED||n==rt.EMPTY||n==rt.ERROR&&!s}getTile(t,e,n,s){const o=s.pixelRatio,r=s.viewState.projection,a=this.getLayer();let h=a.getSource().getTile(t,e,n,o,r);return h.getState()==rt.ERROR&&a.getUseInterimTilesOnError()&&a.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(h)||(h=h.getInterimTile()),h}getData(t){const e=this.frameState;if(!e)return null;const n=this.getLayer(),s=Ut(e.pixelToCoordinateTransform,t.slice()),o=n.getExtent();if(o&&!so(o,s))return null;const r=e.pixelRatio,a=e.viewState.projection,c=e.viewState,h=n.getRenderSource(),l=h.getTileGridForProjection(c.projection),u=h.getTilePixelRatio(e.pixelRatio);for(let d=l.getZForResolution(c.resolution);d>=l.getMinZoom();--d){const g=l.getTileCoordForCoordAndZ(s,d),_=h.getTile(d,g[1],g[2],r,a);if(!(_ instanceof Nd||_ instanceof wl)||_ instanceof wl&&_.getState()===rt.EMPTY)return null;if(_.getState()!==rt.LOADED)continue;const y=l.getOrigin(d),w=fe(l.getTileSize(d)),E=l.getResolution(d),b=Math.floor(u*((s[0]-y[0])/E-g[1]*w[0])),P=Math.floor(u*((y[1]-s[1])/E-g[2]*w[1])),I=Math.round(u*h.getGutterForProjection(c.projection));return this.getImageData(_.getImage(),b+I,P+I)}return null}loadedTileCallback(t,e,n){return this.isDrawableTile(n)?super.loadedTileCallback(t,e,n):!1}prepareFrame(t){return!!this.getLayer().getSource()}renderFrame(t,e){const n=t.layerStatesArray[t.layerIndex],s=t.viewState,o=s.projection,r=s.resolution,a=s.center,c=s.rotation,h=t.pixelRatio,l=this.getLayer(),u=l.getSource(),d=u.getRevision(),g=u.getTileGridForProjection(o),_=g.getZForResolution(r,u.zDirection),y=g.getResolution(_);let w=t.extent;const E=t.viewState.resolution,b=u.getTilePixelRatio(h),P=Math.round(_t(w)/E*h),I=Math.round(Ht(w)/E*h),M=n.extent&&_i(n.extent);M&&(w=An(w,_i(n.extent)));const D=y*P/2/b,L=y*I/2/b,z=[a[0]-D,a[1]-L,a[0]+D,a[1]+L],q=g.getTileRangeForExtentAndZ(w,_),Y={};Y[_]={};const X=this.createLoadedTileFinder(u,o,Y),Q=this.tmpExtent,m=this.tmpTileRange_;this.newTiles_=!1;const v=c?Ec(s.center,E,c,t.size):void 0;for(let at=q.minX;at<=q.maxX;++at)for(let et=q.minY;et<=q.maxY;++et){if(c&&!g.tileCoordIntersectsViewport([_,at,et],v))continue;const it=this.getTile(_,at,et,t);if(this.isDrawableTile(it)){const dt=St(this);if(it.getState()==rt.LOADED){Y[_][it.tileCoord.toString()]=it;let Et=it.inTransition(dt);Et&&n.opacity!==1&&(it.endTransition(dt),Et=!1),!this.newTiles_&&(Et||!this.renderedTiles.includes(it))&&(this.newTiles_=!0)}if(it.getAlpha(dt,t.time)===1)continue}const gt=g.getTileCoordChildTileRange(it.tileCoord,m,Q);let wt=!1;gt&&(wt=X(_+1,gt)),wt||g.forEachTileCoordParentTileRange(it.tileCoord,X,m,Q)}const S=y/r*h/b;qe(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/h,1/h,c,-P/2,-I/2);const A=mc(this.pixelTransform);this.useContainer(e,A,this.getBackground(t));const F=this.context,N=F.canvas;Or(this.inversePixelTransform,this.pixelTransform),qe(this.tempTransform,P/2,I/2,S,S,0,-P/2,-I/2),N.width!=P||N.height!=I?(N.width=P,N.height=I):this.containerReused||F.clearRect(0,0,P,I),M&&this.clipUnrotated(F,t,M),u.getInterpolate()||(F.imageSmoothingEnabled=!1),this.preRender(F,t),this.renderedTiles.length=0;let G=Object.keys(Y).map(Number);G.sort(On);let B,Z,V;n.opacity===1&&(!this.containerReused||u.getOpaque(t.viewState.projection))?G=G.reverse():(B=[],Z=[]);for(let at=G.length-1;at>=0;--at){const et=G[at],it=u.getTilePixelSize(et,h,o),wt=g.getResolution(et)/y,dt=it[0]*wt*S,Et=it[1]*wt*S,ft=g.getTileCoordForCoordAndZ(Ae(z),et),xt=g.getTileCoordExtent(ft),Ft=Ut(this.tempTransform,[b*(xt[0]-z[0])/y,b*(z[3]-xt[3])/y]),kt=b*u.getGutterForProjection(o),Wt=Y[et];for(const he in Wt){const ye=Wt[he],ns=ye.tileCoord,we=ft[1]-ns[1],En=Math.round(Ft[0]-(we-1)*dt),Cn=ft[2]-ns[2],bn=Math.round(Ft[1]-(Cn-1)*Et),ae=Math.round(Ft[0]-we*dt),ve=Math.round(Ft[1]-Cn*Et),Oe=En-ae,Ne=bn-ve,ki=_===et,fi=ki&&ye.getAlpha(St(this),t.time)!==1;let Rt=!1;if(!fi)if(B){V=[ae,ve,ae+Oe,ve,ae+Oe,ve+Ne,ae,ve+Ne];for(let Ee=0,Ze=B.length;Ee<Ze;++Ee)if(_!==et&&et<Z[Ee]){const At=B[Ee];te([ae,ve,ae+Oe,ve+Ne],[At[0],At[3],At[4],At[7]])&&(Rt||(F.save(),Rt=!0),F.beginPath(),F.moveTo(V[0],V[1]),F.lineTo(V[2],V[3]),F.lineTo(V[4],V[5]),F.lineTo(V[6],V[7]),F.moveTo(At[6],At[7]),F.lineTo(At[4],At[5]),F.lineTo(At[2],At[3]),F.lineTo(At[0],At[1]),F.clip())}B.push(V),Z.push(et)}else F.clearRect(ae,ve,Oe,Ne);this.drawTileImage(ye,t,ae,ve,Oe,Ne,kt,ki),B&&!fi?(Rt&&F.restore(),this.renderedTiles.unshift(ye)):this.renderedTiles.push(ye),this.updateUsedTiles(t.usedTiles,u,ye)}}return this.renderedRevision=d,this.renderedResolution=y,this.extentChanged=!this.renderedExtent_||!Yi(this.renderedExtent_,z),this.renderedExtent_=z,this.renderedPixelRatio=h,this.renderedProjection=o,this.manageTilePyramid(t,u,g,h,o,w,_,l.getPreload()),this.scheduleExpireCache(t,u),this.postRender(F,t),n.extent&&F.restore(),F.imageSmoothingEnabled=!0,A!==N.style.transform&&(N.style.transform=A),this.container}drawTileImage(t,e,n,s,o,r,a,c){const h=this.getTileImage(t);if(!h)return;const l=St(this),u=e.layerStatesArray[e.layerIndex],d=u.opacity*(c?t.getAlpha(l,e.time):1),g=d!==this.context.globalAlpha;g&&(this.context.save(),this.context.globalAlpha=d),this.context.drawImage(h,a,a,h.width-2*a,h.height-2*a,n,s,o,r),g&&this.context.restore(),d!==u.opacity?e.animate=!0:c&&t.endTransition(l)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}scheduleExpireCache(t,e){if(e.canExpireCache()){const n=(function(s,o,r){const a=St(s);a in r.usedTiles&&s.expireCache(r.viewState.projection,r.usedTiles[a])}).bind(null,e);t.postRenderFunctions.push(n)}}updateUsedTiles(t,e,n){const s=St(e);s in t||(t[s]={}),t[s][n.getKey()]=!0}manageTilePyramid(t,e,n,s,o,r,a,c,h){const l=St(e);l in t.wantedTiles||(t.wantedTiles[l]={});const u=t.wantedTiles[l],d=t.tileQueue,g=n.getMinZoom(),_=t.viewState.rotation,y=_?Ec(t.viewState.center,t.viewState.resolution,_,t.size):void 0;let w=0,E,b,P,I,M,D;for(D=g;D<=a;++D)for(b=n.getTileRangeForExtentAndZ(r,D,b),P=n.getResolution(D),I=b.minX;I<=b.maxX;++I)for(M=b.minY;M<=b.maxY;++M)_&&!n.tileCoordIntersectsViewport([D,I,M],y)||(a-D<=c?(++w,E=e.getTile(D,I,M,s,o),E.getState()==rt.IDLE&&(u[E.getKey()]=!0,d.isKeyQueued(E.getKey())||d.enqueue([E,l,n.getTileCoordCenter(E.tileCoord),P])),h!==void 0&&h(E)):e.useTile(D,I,M,o));e.updateCacheSize(w,o)}}class Ha extends wv{constructor(t){super(t)}createRenderer(){return new bv(this)}}class xv extends th{constructor(t,e,n,s,o,r,a){let c=t.getExtent();c&&t.canWrapX()&&(c=c.slice(),c[0]=-1/0,c[2]=1/0);let h=e.getExtent();h&&e.canWrapX()&&(h=h.slice(),h[0]=-1/0,h[2]=1/0);const l=h?An(n,h):n,u=Hi(l),d=Ya(t,e,u,s),g=Yg,_=new Xg(t,e,l,c,d*g,s),y=_.calculateSourceExtent(),w=Xi(y)?null:r(y,d,o),E=w?ot.IDLE:ot.EMPTY,b=w?w.getPixelRatio():1;super(n,s,b,E),this.targetProj_=e,this.maxSourceExtent_=c,this.triangulation_=_,this.targetResolution_=s,this.targetExtent_=n,this.sourceImage_=w,this.sourcePixelRatio_=b,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==ot.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==ot.LOADED){const e=_t(this.targetExtent_)/this.targetResolution_,n=Ht(this.targetExtent_)/this.targetResolution_;this.canvas_=Zg(e,n,this.sourcePixelRatio_,this.sourceImage_.getResolution(),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_)}this.state=t,this.changed()}load(){if(this.state==ot.IDLE){this.state=ot.LOADING,this.changed();const t=this.sourceImage_.getState();t==ot.LOADED||t==ot.ERROR?this.reproject_():(this.sourceListenerKey_=Ct(this.sourceImage_,ht.CHANGE,function(e){const n=this.sourceImage_.getState();(n==ot.LOADED||n==ot.ERROR)&&(this.unlistenSource_(),this.reproject_())},this),this.sourceImage_.load())}}unlistenSource_(){Mt(this.sourceListenerKey_),this.sourceListenerKey_=null}}const vl={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class Sv extends We{constructor(t,e){super(t),this.image=e}}class El extends Ro{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:t.interpolate!==void 0?t.interpolate:!0}),this.on,this.once,this.un,this.resolutions_=t.resolutions!==void 0?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();if(e){const n=Sr(e,t,0);t=e[n]}return t}getImage(t,e,n,s){const o=this.getProjection();if(!o||!s||Zi(o,s))return o&&(s=o),this.getImageInternal(t,e,n,s);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Zi(this.reprojectedImage_.getProjection(),s)&&this.reprojectedImage_.getResolution()==e&&Yi(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new xv(o,s,t,e,n,(r,a,c)=>this.getImageInternal(r,a,c,o),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,n,s){return vt()}handleImageChange(t){const e=t.target;let n;switch(e.getState()){case ot.LOADING:this.loading=!0,n=vl.IMAGELOADSTART;break;case ot.LOADED:this.loading=!1,n=vl.IMAGELOADEND;break;case ot.ERROR:this.loading=!1,n=vl.IMAGELOADERROR;break;default:return}this.hasListener(n)&&this.dispatchEvent(new Sv(n,e))}}function Rv(i,t){i.getImage().src=t}class Kg extends El{constructor(t){const e=t.crossOrigin!==void 0?t.crossOrigin:null,n=t.imageLoadFunction!==void 0?t.imageLoadFunction:Rv;super({attributions:t.attributions,interpolate:t.interpolate,projection:Gt(t.projection)}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image_=new S0(this.imageExtent_,void 0,1,this.url_,e,n,Bt(1,1)),this.imageSize_=t.imageSize?t.imageSize:null,this.image_.addEventListener(ht.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(t,e,n,s){return te(t,this.image_.getExtent())?this.image_:null}getUrl(){return this.url_}handleImageChange(t){if(this.image_.getState()==ot.LOADED){const e=this.image_.getExtent(),n=this.image_.getImage();let s,o;this.imageSize_?(s=this.imageSize_[0],o=this.imageSize_[1]):(s=n.width,o=n.height);const r=_t(e),a=Ht(e),c=r/s,h=a/o;let l=s,u=o;if(c>h?l=Math.round(r/h):u=Math.round(a/c),l!==s||u!==o){const d=Bt(l,u);this.getInterpolate()||(d.imageSmoothingEnabled=!1);const g=d.canvas;d.drawImage(n,0,0,s,o,0,0,g.width,g.height),this.image_.setImage(g)}}super.handleImageChange(t)}}const Ws=[0,0,0],mn=5;class qs{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,pt(jp(this.resolutions_,function(s,o){return o-s}),17);let e;if(!t.origins){for(let s=0,o=this.resolutions_.length-1;s<o;++s)if(!e)e=this.resolutions_[s]/this.resolutions_[s+1];else if(this.resolutions_[s]/this.resolutions_[s+1]!==e){e=void 0;break}}this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=t.origin!==void 0?t.origin:null,this.origins_=null,t.origins!==void 0&&(this.origins_=t.origins,pt(this.origins_.length==this.resolutions_.length,20));const n=t.extent;n!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=Ae(n)),pt(!this.origin_&&this.origins_||this.origin_&&!this.origins_,18),this.tileSizes_=null,t.tileSizes!==void 0&&(this.tileSizes_=t.tileSizes,pt(this.tileSizes_.length==this.resolutions_.length,19)),this.tileSize_=t.tileSize!==void 0?t.tileSize:this.tileSizes_?null:Bc,pt(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,22),this.extent_=n!==void 0?n:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],t.sizes!==void 0?this.fullTileRanges_=t.sizes.map(function(s,o){const r=new ph(Math.min(0,s[0]),Math.max(s[0]-1,-1),Math.min(0,s[1]),Math.max(s[1]-1,-1));if(n){const a=this.getTileRangeForExtentAndZ(n,o);r.minX=Math.max(a.minX,r.minX),r.maxX=Math.min(a.maxX,r.maxX),r.minY=Math.max(a.minY,r.minY),r.maxY=Math.min(a.maxY,r.maxY)}return r},this):n&&this.calculateTileRanges_(n)}forEachTileCoord(t,e,n){const s=this.getTileRangeForExtentAndZ(t,e);for(let o=s.minX,r=s.maxX;o<=r;++o)for(let a=s.minY,c=s.maxY;a<=c;++a)n([e,o,a])}forEachTileCoordParentTileRange(t,e,n,s){let o,r,a,c=null,h=t[0]-1;for(this.zoomFactor_===2?(r=t[1],a=t[2]):c=this.getTileCoordExtent(t,s);h>=this.minZoom;){if(this.zoomFactor_===2?(r=Math.floor(r/2),a=Math.floor(a/2),o=xs(r,r,a,a,n)):o=this.getTileRangeForExtentAndZ(c,h,n),e(h,o))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,n){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){const o=t[1]*2,r=t[2]*2;return xs(o,o+1,r,r+1,e)}const s=this.getTileCoordExtent(t,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,n){if(e>this.maxZoom||e<this.minZoom)return null;const s=t[0],o=t[1],r=t[2];if(e===s)return xs(o,r,o,r,n);if(this.zoomFactor_){const c=Math.pow(this.zoomFactor_,e-s),h=Math.floor(o*c),l=Math.floor(r*c);if(e<s)return xs(h,h,l,l,n);const u=Math.floor(c*(o+1))-1,d=Math.floor(c*(r+1))-1;return xs(h,u,l,d,n)}const a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,n)}getTileRangeForExtentAndZ(t,e,n){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,Ws);const s=Ws[1],o=Ws[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,Ws);const r=Ws[1],a=Ws[2];return xs(s,r,o,a,n)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),n=this.getResolution(t[0]),s=fe(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*s[0]*n,e[1]-(t[2]+.5)*s[1]*n]}getTileCoordExtent(t,e){const n=this.getOrigin(t[0]),s=this.getResolution(t[0]),o=fe(this.getTileSize(t[0]),this.tmpSize_),r=n[0]+t[1]*o[0]*s,a=n[1]-(t[2]+1)*o[1]*s,c=r+o[0]*s,h=a+o[1]*s;return pi(r,a,c,h,e)}getTileCoordForCoordAndResolution(t,e,n){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,n)}getTileCoordForXYAndResolution_(t,e,n,s,o){const r=this.getZForResolution(n),a=n/this.getResolution(r),c=this.getOrigin(r),h=fe(this.getTileSize(r),this.tmpSize_);let l=a*(t-c[0])/n/h[0],u=a*(c[1]-e)/n/h[1];return s?(l=zr(l,mn)-1,u=zr(u,mn)-1):(l=Lr(l,mn),u=Lr(u,mn)),Xd(r,l,u,o)}getTileCoordForXYAndZ_(t,e,n,s,o){const r=this.getOrigin(n),a=this.getResolution(n),c=fe(this.getTileSize(n),this.tmpSize_);let h=(t-r[0])/a/c[0],l=(r[1]-e)/a/c[1];return s?(h=zr(h,mn)-1,l=zr(l,mn)-1):(h=Lr(h,mn),l=Lr(l,mn)),Xd(n,h,l,o)}getTileCoordForCoordAndZ(t,e,n){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,n)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){const n=Sr(this.resolutions_,t,e||0);return qt(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return ju(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,n=new Array(e);for(let s=this.minZoom;s<e;++s)n[s]=this.getTileRangeForExtentAndZ(t,s);this.fullTileRanges_=n}}function Qg(i){let t=i.getDefaultTileGrid();return t||(t=Iv(i),i.setDefaultTileGrid(t)),t}function Pv(i,t,e){const n=t[0],s=i.getTileCoordCenter(t),o=Cl(e);if(!so(o,s)){const r=_t(o),a=Math.ceil((o[0]-s[0])/r);return s[0]+=r*a,i.getTileCoordForCoordAndZ(s,n)}return t}function Ov(i,t,e,n){n=n!==void 0?n:"top-left";const s=tp(i,t,e);return new qs({extent:i,origin:nm(i,n),resolutions:s,tileSize:e})}function Jg(i){const t=i||{},e=t.extent||Gt("EPSG:3857").getExtent(),n={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:tp(e,t.maxZoom,t.tileSize,t.maxResolution)};return new qs(n)}function tp(i,t,e,n){t=t!==void 0?t:a0,e=fe(e!==void 0?e:Bc);const s=Ht(i),o=_t(i);n=n>0?n:Math.max(o/e[0],s/e[1]);const r=t+1,a=new Array(r);for(let c=0;c<r;++c)a[c]=n/Math.pow(2,c);return a}function Iv(i,t,e,n){const s=Cl(i);return Ov(s,t,e,n)}function Cl(i){i=Gt(i);let t=i.getExtent();if(!t){const e=180*Cc.degrees/i.getMetersPerUnit();t=pi(-e,-e,e,e)}return t}class ep extends Ro{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.opaque_=t.opaque!==void 0?t.opaque:!1,this.tilePixelRatio_=t.tilePixelRatio!==void 0?t.tilePixelRatio:1,this.tileGrid=t.tileGrid!==void 0?t.tileGrid:null;const e=[256,256];this.tileGrid&&fe(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tileCache=new Kd(t.cacheSize||0),this.tmpSize=[0,0],this.key_=t.key||"",this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}canExpireCache(){return this.tileCache.canExpireCache()}expireCache(t,e){const n=this.getTileCacheForProjection(t);n&&n.expireCache(e)}forEachLoadedTile(t,e,n,s){const o=this.getTileCacheForProjection(t);if(!o)return!1;let r=!0,a,c,h;for(let l=n.minX;l<=n.maxX;++l)for(let u=n.minY;u<=n.maxY;++u)c=na(e,l,u),h=!1,o.containsKey(c)&&(a=o.get(c),h=a.getState()===rt.LOADED,h&&(h=s(a)!==!1)),h||(r=!1);return r}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getOpaque(t){return this.opaque_}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,n,s,o){return vt()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Qg(t)}getTileCacheForProjection(t){const e=this.getProjection();return pt(e===null||Zi(e,t),68),this.tileCache}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,n){const s=this.getTileGridForProjection(n),o=this.getTilePixelRatio(e),r=fe(s.getTileSize(t),this.tmpSize);return o==1?r:Hu(r,o,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){e=e!==void 0?e:this.getProjection();const n=this.getTileGridForProjection(e);return this.getWrapX()&&e.isGlobal()&&(t=Pv(n,t,e)),N_(t,n)?t:null}clear(){this.tileCache.clear()}refresh(){this.clear(),super.refresh()}updateCacheSize(t,e){const n=this.getTileCacheForProjection(e);t>n.highWaterMark&&(n.highWaterMark=t)}useTile(t,e,n,s){}}class Tv extends We{constructor(t,e){super(t),this.tile=e}}let ip=!0;try{new ImageData(10,10)}catch{ip=!1}let bl;function Av(i,t,e){if(ip)return new ImageData(i,t,e);bl||(bl=document.createElement("canvas").getContext("2d"));const n=bl.createImageData(t,e);return n.data.set(i),n}function np(i){let t=!0;try{new ImageData(10,10)}catch{t=!1}function e(n,s,o){return t?new ImageData(n,s,o):{data:n,width:s,height:o}}return function(n){const s=n.buffers,o=n.meta,r=n.imageOps,a=n.width,c=n.height,h=s.length,l=s[0].byteLength;if(r){const _=new Array(h);for(let w=0;w<h;++w)_[w]=e(new Uint8ClampedArray(s[w]),a,c);return i(_,o).data.buffer}const u=new Uint8ClampedArray(l),d=new Array(h),g=new Array(h);for(let _=0;_<h;++_)d[_]=new Uint8ClampedArray(s[_]),g[_]=[0,0,0,0];for(let _=0;_<l;_+=4){for(let w=0;w<h;++w){const E=d[w];g[w][0]=E[_],g[w][1]=E[_+1],g[w][2]=E[_+2],g[w][3]=E[_+3]}const y=i(g,o);u[_]=y[0],u[_+1]=y[1],u[_+2]=y[2],u[_+3]=y[3]}return u.buffer}}function Mv(i,t){const n=Object.keys(i.lib||{}).map(function(o){return"const "+o+" = "+i.lib[o].toString()+";"}).concat(["const __minion__ = ("+np.toString()+")(",i.operation.toString(),");",'self.addEventListener("message", function(event) {'," const buffer = __minion__(event.data);"," self.postMessage({buffer: buffer, meta: event.data.meta}, [buffer]);","});"]),s=new Worker(typeof Blob>"u"?"data:text/javascript;base64,"+Buffer.from(n.join(`
|
|
159
159
|
`),"binary").toString("base64"):URL.createObjectURL(new Blob(n,{type:"text/javascript"})));return s.addEventListener("message",t),s}function Dv(i,t){const e=np(i.operation);let n=!1;return{postMessage:function(s){setTimeout(function(){n||t({data:{buffer:e(s),meta:s.meta}})},0)},terminate:function(){n=!0}}}class Fv extends xr{constructor(t){super(),this._imageOps=!!t.imageOps;let e;t.threads===0?e=0:this._imageOps?e=1:e=t.threads||1;const n=new Array(e);if(e)for(let s=0;s<e;++s)n[s]=Mv(t,this._onWorkerMessage.bind(this,s));else n[0]=Dv(t,this._onWorkerMessage.bind(this,0));this._workers=n,this._queue=[],this._maxQueueLength=t.queue||1/0,this._running=0,this._dataLookup={},this._job=null}process(t,e,n){this._enqueue({inputs:t,meta:e,callback:n}),this._dispatch()}_enqueue(t){for(this._queue.push(t);this._queue.length>this._maxQueueLength;)this._queue.shift().callback(null,null)}_dispatch(){if(this._running||this._queue.length===0)return;const t=this._queue.shift();this._job=t;const e=t.inputs[0].width,n=t.inputs[0].height,s=t.inputs.map(function(c){return c.data.buffer}),o=this._workers.length;if(this._running=o,o===1){this._workers[0].postMessage({buffers:s,meta:t.meta,imageOps:this._imageOps,width:e,height:n},s);return}const r=t.inputs[0].data.length,a=4*Math.ceil(r/4/o);for(let c=0;c<o;++c){const h=c*a,l=[];for(let u=0,d=s.length;u<d;++u)l.push(s[u].slice(h,h+a));this._workers[c].postMessage({buffers:l,meta:t.meta,imageOps:this._imageOps,width:e,height:n},l)}}_onWorkerMessage(t,e){this.disposed||(this._dataLookup[t]=e.data,--this._running,this._running===0&&this._resolveJob())}_resolveJob(){const t=this._job,e=this._workers.length;let n,s;if(e===1)n=new Uint8ClampedArray(this._dataLookup[0].buffer),s=this._dataLookup[0].meta;else{const o=t.inputs[0].data.length;n=new Uint8ClampedArray(o),s=new Array(e);const r=4*Math.ceil(o/4/e);for(let a=0;a<e;++a){const c=this._dataLookup[a].buffer,h=a*r;n.set(new Uint8ClampedArray(c),h),s[a]=this._dataLookup[a].meta}}this._job=null,this._dataLookup={},t.callback(null,Av(n,t.inputs[0].width,t.inputs[0].height),s),this._dispatch()}disposeInternal(){for(let t=0;t<this._workers.length;++t)this._workers[t].terminate();this._workers.length=0}}const sp={BEFOREOPERATIONS:"beforeoperations",AFTEROPERATIONS:"afteroperations"};class op extends We{constructor(t,e,n){super(t),this.extent=e.extent,this.resolution=e.viewState.resolution/e.pixelRatio,this.data=n}}class xl extends El{constructor(t){super({projection:null}),this.on,this.once,this.un,this.processor_=null,this.operationType_=t.operationType!==void 0?t.operationType:"pixel",this.threads_=t.threads!==void 0?t.threads:1,this.layers_=Nv(t.sources);const e=this.changed.bind(this);for(let n=0,s=this.layers_.length;n<s;++n)this.layers_[n].addEventListener(ht.CHANGE,e);this.useResolutions_=t.resolutions!==null,this.tileQueue_=new Ud(function(){return 1},this.processSources_.bind(this)),this.requestedFrameState_,this.renderedImageCanvas_=null,this.renderedRevision_,this.frameState_={animate:!1,coordinateToPixelTransform:be(),declutterTree:null,extent:null,index:0,layerIndex:0,layerStatesArray:zv(this.layers_),pixelRatio:1,pixelToCoordinateTransform:be(),postRenderFunctions:[],size:[0,0],tileQueue:this.tileQueue_,time:Date.now(),usedTiles:{},viewState:{rotation:0},viewHints:[],wantedTiles:{},mapId:St(this),renderTargets:{}},this.setAttributions(function(n){const s=[];for(let o=0,r=t.sources.length;o<r;++o){const a=t.sources[o],c=a instanceof Ro?a:a.getSource();if(!c)continue;const h=c.getAttributions();if(typeof h=="function"){const l=h(n);s.push.apply(s,l)}}return s.length!==0?s:null}),t.operation!==void 0&&this.setOperation(t.operation,t.lib)}setOperation(t,e){this.processor_&&this.processor_.dispose(),this.processor_=new Fv({operation:t,imageOps:this.operationType_==="image",queue:1,lib:e,threads:this.threads_}),this.changed()}updateFrameState_(t,e,n){const s=Object.assign({},this.frameState_);s.viewState=Object.assign({},s.viewState);const o=Hi(t);s.size[0]=Math.ceil(_t(t)/e),s.size[1]=Math.ceil(Ht(t)/e),s.extent=[o[0]-s.size[0]*e/2,o[1]-s.size[1]*e/2,o[0]+s.size[0]*e/2,o[1]+s.size[1]*e/2],s.time=Date.now();const r=s.viewState;return r.center=o,r.projection=n,r.resolution=e,s}allSourcesReady_(){let t=!0,e;for(let n=0,s=this.layers_.length;n<s;++n)if(e=this.layers_[n].getSource(),!e||e.getState()!=="ready"){t=!1;break}return t}getImage(t,e,n,s){if(!this.allSourcesReady_())return null;this.tileQueue_.loadMoreTiles(16,16),e=this.findNearestResolution(e);const o=this.updateFrameState_(t,e,s);if(this.requestedFrameState_=o,this.renderedImageCanvas_){const r=this.renderedImageCanvas_.getResolution(),a=this.renderedImageCanvas_.getExtent();(e!==r||!Yi(o.extent,a))&&(this.renderedImageCanvas_=null)}return(!this.renderedImageCanvas_||this.getRevision()!==this.renderedRevision_)&&this.processSources_(),o.animate&&requestAnimationFrame(this.changed.bind(this)),this.renderedImageCanvas_}processSources_(){const t=this.requestedFrameState_,e=this.layers_.length,n=new Array(e);for(let o=0;o<e;++o){t.layerIndex=o,t.renderTargets={};const r=Lv(this.layers_[o],t);if(r)n[o]=r;else return}const s={};this.dispatchEvent(new op(sp.BEFOREOPERATIONS,t,s)),this.processor_.process(n,s,this.onWorkerComplete_.bind(this,t))}onWorkerComplete_(t,e,n,s){if(e||!n)return;const o=t.extent,r=t.viewState.resolution;if(r!==this.requestedFrameState_.viewState.resolution||!Yi(o,this.requestedFrameState_.extent))return;let a;if(this.renderedImageCanvas_)a=this.renderedImageCanvas_.getImage().getContext("2d");else{const c=Math.round(_t(o)/r),h=Math.round(Ht(o)/r);a=Bt(c,h),this.renderedImageCanvas_=new Ld(o,r,1,a.canvas)}a.putImageData(n,0,0),t.animate?requestAnimationFrame(this.changed.bind(this)):this.changed(),this.renderedRevision_=this.getRevision(),this.dispatchEvent(new op(sp.AFTEROPERATIONS,t,s))}getResolutions(t){if(!this.useResolutions_)return null;let e=super.getResolutions();if(!e)for(let n=0,s=this.layers_.length;n<s&&(e=this.layers_[n].getSource().getResolutions(t),!e);++n);return e}disposeInternal(){this.processor_&&this.processor_.dispose(),super.disposeInternal()}}xl.prototype.dispose;let Yn=null;function Lv(i,t){const e=i.getRenderer();if(!e)throw new Error("Unsupported layer type: "+i);if(!e.prepareFrame(t))return null;const n=t.size[0],s=t.size[1];if(n===0||s===0)return null;const o=e.renderFrame(t,null);let r;if(o instanceof HTMLCanvasElement)r=o;else{if(o&&(r=o.firstElementChild),!(r instanceof HTMLCanvasElement))throw new Error("Unsupported rendered element: "+r);if(r.width===n&&r.height===s)return r.getContext("2d").getImageData(0,0,n,s)}if(!Yn)Yn=Bt(n,s,void 0,{willReadFrequently:!0});else{const a=Yn.canvas;a.width!==n||a.height!==s?Yn=Bt(n,s,void 0,{willReadFrequently:!0}):Yn.clearRect(0,0,n,s)}return Yn.drawImage(r,0,0,n,s),Yn.getImageData(0,0,n,s)}function zv(i){return i.map(function(t){return t.getLayerState()})}function Nv(i){const t=i.length,e=new Array(t);for(let n=0;n<t;++n)e[n]=Uv(i[n]);return e}function Uv(i){let t;return i instanceof Ro?i instanceof ep?t=new Ha({source:i}):i instanceof El&&(t=new ml({source:i})):t=i,t}const Sl={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};function jv(i,t){const e=/\{z\}/g,n=/\{x\}/g,s=/\{y\}/g,o=/\{-y\}/g;return function(r,a,c){if(r)return i.replace(e,r[0].toString()).replace(n,r[1].toString()).replace(s,r[2].toString()).replace(o,function(){const h=r[0],l=t.getFullTileRange(h);return pt(l,55),(l.getHeight()-r[2]-1).toString()})}}function kv(i,t){const e=i.length,n=new Array(e);for(let s=0;s<e;++s)n[s]=jv(i[s],t);return Rl(n)}function Rl(i){return i.length===1?i[0]:function(t,e,n){if(!t)return;const s=Zd(t),o=$i(s,i.length);return i[o](t,e,n)}}function rp(i){const t=[];let e=/\{([a-z])-([a-z])\}/.exec(i);if(e){const n=e[1].charCodeAt(0),s=e[2].charCodeAt(0);let o;for(o=n;o<=s;++o)t.push(i.replace(e[0],String.fromCharCode(o)));return t}if(e=/\{(\d+)-(\d+)\}/.exec(i),e){const n=parseInt(e[2],10);for(let s=parseInt(e[1],10);s<=n;s++)t.push(i.replace(e[0],s.toString()));return t}return t.push(i),t}class Pl extends ep{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===Pl.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,n=St(e),s=e.getState();let o;s==rt.LOADING?(this.tileLoadingKeys_[n]=!0,o=Sl.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],o=s==rt.ERROR?Sl.TILELOADERROR:s==rt.LOADED?Sl.TILELOADEND:void 0),o!=null&&this.dispatchEvent(new Tv(o,e))}setTileLoadFunction(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),typeof e<"u"?this.setKey(e):this.changed()}setUrl(t){const e=rp(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join(`
|
|
160
160
|
`);this.generateTileUrlFunction_?this.setTileUrlFunction(kv(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,n){}useTile(t,e,n){const s=na(t,e,n);this.tileCache.containsKey(s)&&this.tileCache.get(s)}}class Ol extends Pl{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:Wv,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate!==void 0?t.interpolate:!0,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=t.crossOrigin!==void 0?t.crossOrigin:null,this.tileClass=t.tileClass!==void 0?t.tileClass:Nd,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}canExpireCache(){if(this.tileCache.canExpireCache())return!0;for(const t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1}expireCache(t,e){const n=this.getTileCacheForProjection(t);this.tileCache.expireCache(this.tileCache==n?e:{});for(const s in this.tileCacheForProjection){const o=this.tileCacheForProjection[s];o.expireCache(o==n?e:{})}}getGutterForProjection(t){return this.getProjection()&&t&&!Zi(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getOpaque(t){return this.getProjection()&&t&&!Zi(this.getProjection(),t)?!1:super.getOpaque(t)}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||Zi(e,t)))return this.tileGrid;const n=St(t);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=Qg(t)),this.tileGridForProjection[n]}getTileCacheForProjection(t){const e=this.getProjection();if(!e||Zi(e,t))return this.tileCache;const n=St(t);return n in this.tileCacheForProjection||(this.tileCacheForProjection[n]=new Kd(this.tileCache.highWaterMark)),this.tileCacheForProjection[n]}createTile_(t,e,n,s,o,r){const a=[t,e,n],c=this.getTileCoordForTileUrlFunction(a,o),h=c?this.tileUrlFunction(c,s,o):void 0,l=new this.tileClass(a,h!==void 0?rt.IDLE:rt.EMPTY,h!==void 0?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return l.key=r,l.addEventListener(ht.CHANGE,this.handleTileChange.bind(this)),l}getTile(t,e,n,s,o){const r=this.getProjection();if(!r||!o||Zi(r,o))return this.getTileInternal(t,e,n,s,r||o);const a=this.getTileCacheForProjection(o),c=[t,e,n];let h;const l=$d(c);a.containsKey(l)&&(h=a.get(l));const u=this.getKey();if(h&&h.key==u)return h;const d=this.getTileGridForProjection(r),g=this.getTileGridForProjection(o),_=this.getTileCoordForTileUrlFunction(c,o),y=new wl(r,d,o,g,c,_,this.getTilePixelRatio(s),this.getGutter(),(w,E,b,P)=>this.getTileInternal(w,E,b,P,r),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.getInterpolate());return y.key=u,h?(y.interimTile=h,y.refreshInterimChain(),a.replace(l,y)):a.set(l,y),y}getTileInternal(t,e,n,s,o){let r=null;const a=na(t,e,n),c=this.getKey();if(!this.tileCache.containsKey(a))r=this.createTile_(t,e,n,s,o,c),this.tileCache.set(a,r);else if(r=this.tileCache.get(a),r.key!=c){const h=r;r=this.createTile_(t,e,n,s,o,c),h.getState()==rt.IDLE?r.interimTile=h.interimTile:r.interimTile=h,r.refreshInterimChain(),this.tileCache.replace(a,r)}return r}setRenderReprojectionEdges(t){if(this.renderReprojectionEdges_!=t){this.renderReprojectionEdges_=t;for(const e in this.tileCacheForProjection)this.tileCacheForProjection[e].clear();this.changed()}}setTileGridForProjection(t,e){const n=Gt(t);if(n){const s=St(n);s in this.tileGridForProjection||(this.tileGridForProjection[s]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}}function Wv(i,t){i.getImage().src=t}const Xa="1.3.0";function $a(i,t){const e=[];Object.keys(t).forEach(function(s){t[s]!==null&&t[s]!==void 0&&e.push(s+"="+encodeURIComponent(t[s]))});const n=e.join("&");return i=i.replace(/[?&]$/,""),i+=i.includes("?")?"&":"?",i+n}class qv extends Ol{constructor(t){t=t||{};const e=Object.assign({},t.params),n="TRANSPARENT"in e?e.TRANSPARENT:!0;super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:!n,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0,this.params_=e,this.v13_=!0,this.serverType_=t.serverType,this.hidpi_=t.hidpi!==void 0?t.hidpi:!0,this.tmpExtent_=Te(),this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(t,e,n,s){const o=Gt(n),r=this.getProjection();let a=this.getTileGrid();a||(a=this.getTileGridForProjection(o));const c=a.getZForResolution(e,this.zDirection),h=a.getTileCoordForCoordAndZ(t,c);if(a.getResolutions().length<=h[0])return;let l=a.getResolution(h[0]),u=a.getTileCoordExtent(h,this.tmpExtent_),d=fe(a.getTileSize(h[0]),this.tmpSize);const g=this.gutter_;g!==0&&(d=Vu(d,g,this.tmpSize),u=io(u,l*g,u)),r&&r!==o&&(l=Ya(r,o,t,l),u=Ru(u,o,r),t=co(t,o,r));const _={SERVICE:"WMS",VERSION:Xa,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};Object.assign(_,this.params_,s);const y=Math.floor((t[0]-u[0])/l),w=Math.floor((u[3]-t[1])/l);return _[this.v13_?"I":"X"]=y,_[this.v13_?"J":"Y"]=w,this.getRequestUrl_(h,d,u,1,r||o,_)}getLegendUrl(t,e){if(this.urls[0]===void 0)return;const n={SERVICE:"WMS",VERSION:Xa,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(e===void 0||e.LAYER===void 0){const s=this.params_.LAYERS;if(!(!Array.isArray(s)||s.length===1))return;n.LAYER=s}if(t!==void 0){const s=this.getProjection()?this.getProjection().getMetersPerUnit():1,o=28e-5;n.SCALE=t*s/o}return Object.assign(n,e),$a(this.urls[0],n)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(t,e,n,s,o,r){const a=this.urls;if(!a)return;if(r.WIDTH=e[0],r.HEIGHT=e[1],r[this.v13_?"CRS":"SRS"]=o.getCode(),"STYLES"in this.params_||(r.STYLES=""),s!=1)switch(this.serverType_){case"geoserver":const u=90*s+.5|0;"FORMAT_OPTIONS"in r?r.FORMAT_OPTIONS+=";dpi:"+u:r.FORMAT_OPTIONS="dpi:"+u;break;case"mapserver":r.MAP_RESOLUTION=90*s;break;case"carmentaserver":case"qgis":r.DPI=90*s;break;default:pt(!1,52);break}const c=o.getAxisOrientation(),h=n;if(this.v13_&&c.substr(0,2)=="ne"){let u;u=n[0],h[0]=n[1],h[1]=u,u=n[2],h[2]=n[3],h[3]=u}r.BBOX=h.join(",");let l;if(a.length==1)l=a[0];else{const u=$i(Zd(t),a.length);l=a[u]}return $a(l,r)}getTilePixelRatio(t){return!this.hidpi_||this.serverType_===void 0?1:t}getKeyForParams_(){let t=0;const e=[];for(const n in this.params_)e[t++]=n+"-"+this.params_[n];return e.join("/")}updateParams(t){Object.assign(this.params_,t),this.updateV13_(),this.setKey(this.getKeyForParams_())}updateV13_(){const t=this.params_.VERSION||Xa;this.v13_=vm(t,"1.3")>=0}tileUrlFunction(t,e,n){let s=this.getTileGrid();if(s||(s=this.getTileGridForProjection(n)),s.getResolutions().length<=t[0])return;e!=1&&(!this.hidpi_||this.serverType_===void 0)&&(e=1);const o=s.getResolution(t[0]);let r=s.getTileCoordExtent(t,this.tmpExtent_),a=fe(s.getTileSize(t[0]),this.tmpSize);const c=this.gutter_;c!==0&&(a=Vu(a,c,this.tmpSize),r=io(r,o*c,r)),e!=1&&(a=Hu(a,e,this.tmpSize));const h={SERVICE:"WMS",VERSION:Xa,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return Object.assign(h,this.params_),this.getRequestUrl_(t,a,r,e,n,h)}}class Gv extends qs{constructor(t){super({extent:t.extent,origin:t.origin,origins:t.origins,resolutions:t.resolutions,tileSize:t.tileSize,tileSizes:t.tileSizes,sizes:t.sizes}),this.matrixIds_=t.matrixIds}getMatrixId(t){return this.matrixIds_[t]}getMatrixIds(){return this.matrixIds_}}class Bv extends Ol{constructor(t){const e=t.requestEncoding!==void 0?t.requestEncoding:"KVP",n=t.tileGrid;let s=t.urls;s===void 0&&t.url!==void 0&&(s=rp(t.url)),super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:n,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,urls:s,wrapX:t.wrapX!==void 0?t.wrapX:!1,transition:t.transition,zDirection:t.zDirection}),this.version_=t.version!==void 0?t.version:"1.0.0",this.format_=t.format!==void 0?t.format:"image/jpeg",this.dimensions_=t.dimensions!==void 0?t.dimensions:{},this.layer_=t.layer,this.matrixSet_=t.matrixSet,this.style_=t.style,this.requestEncoding_=e,this.setKey(this.getKeyForDimensions_()),s&&s.length>0&&(this.tileUrlFunction=Rl(s.map(this.createFromWMTSTemplate.bind(this))))}setUrls(t){this.urls=t;const e=t.join(`
|
|
161
161
|
`);this.setTileUrlFunction(Rl(t.map(this.createFromWMTSTemplate.bind(this))),e)}getDimensions(){return this.dimensions_}getFormat(){return this.format_}getLayer(){return this.layer_}getMatrixSet(){return this.matrixSet_}getRequestEncoding(){return this.requestEncoding_}getStyle(){return this.style_}getVersion(){return this.version_}getKeyForDimensions_(){const t=this.urls?this.urls.slice(0):[];for(const e in this.dimensions_)t.push(e+"-"+this.dimensions_[e]);return t.join("/")}updateDimensions(t){Object.assign(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())}createFromWMTSTemplate(t){const e=this.requestEncoding_,n={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};e=="KVP"&&Object.assign(n,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t=e=="KVP"?$a(t,n):t.replace(/\{(\w+?)\}/g,function(r,a){return a.toLowerCase()in n?n[a.toLowerCase()]:r});const s=this.tileGrid,o=this.dimensions_;return function(r,a,c){if(!r)return;const h={TileMatrix:s.getMatrixId(r[0]),TileCol:r[1],TileRow:r[2]};Object.assign(h,o);let l=t;return e=="KVP"?l=$a(l,h):l=l.replace(/\{(\w+?)\}/g,function(u,d){return h[d]}),l}}}class Za extends Ol{constructor(t){t=t||{};const e=t.projection!==void 0?t.projection:"EPSG:3857",n=t.tileGrid!==void 0?t.tileGrid:Jg({extent:Cl(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:t.opaque,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0}getGutter(){return this.gutter_}}class ap extends f.Destroyable{constructor(e,n){super();R(this,"_imageriesManager");R(this,"_map");R(this,"_raster");R(this,"_layer",this.dv(f.react(void 0)));R(this,"_rShow",this.dv(f.react(!0)));R(this,"_rAlpha",this.dv(f.react(1)));R(this,"_rZIndex",this.dv(f.react(0)));R(this,"_rRectangle",this.dv(f.react(void 0)));R(this,"_rSplitDirection",this.dv(f.react("NONE")));R(this,"_rBrightness",this.dv(f.react(1)));R(this,"_rContrast",this.dv(f.react(1)));R(this,"_rHue",this.dv(f.react(0)));R(this,"_rSaturation",this.dv(f.react(1)));R(this,"_rGamma",this.dv(f.react(1)));R(this,"_raf");this.id=n;const s=e.viewer;if(!s)return;this._map=s;const o=Mi(s);if(!o)return;const{imageriesManager:r}=o;this._imageriesManager=r,this.d(()=>this._destroyLayer())}get layer(){return this._layer.value}set layer(e){this._layer.value=e}get layerChanged(){return this._layer.changed}get show(){return this._rShow.value}get alpha(){return this._rAlpha.value}get zIndex(){return this._rZIndex.value}get rectangle(){return this._rRectangle.value}get splitDirection(){return this._rSplitDirection.value}get brightness(){return this._rBrightness.value}get contrast(){return this._rContrast.value}get hue(){return this._rHue.value}get saturation(){return this._rSaturation.value}get gamma(){return this._rGamma.value}get showChanged(){return this._rShow.changed}get alphaChanged(){return this._rAlpha.changed}get zIndexChanged(){return this._rZIndex.changed}get rectangleChanged(){return this._rRectangle.changed}get splitDirectionChanged(){return this._rSplitDirection.changed}get brightnessChanged(){return this._rBrightness.changed}get contrastChanged(){return this._rContrast.changed}get hueChanged(){return this._rHue.changed}get saturationChanged(){return this._rSaturation.changed}get gammaChanged(){return this._rGamma.changed}set show(e){var s;const n=e??!0;this._rShow.value=n,(s=this._layer.value)==null||s.setVisible(n)}set alpha(e){var s;const n=e??1;this._rAlpha.value=n,(s=this._layer.value)==null||s.setOpacity(n)}set zIndex(e){const n=e??0;this._rZIndex.value=n,this._layer.value&&this._imageriesManager&&this._imageriesManager.setZindex(this._layer.value,n)}set rectangle(e){this._rRectangle.value=e}set splitDirection(e){this._rSplitDirection.value=e??"NONE"}set brightness(e){this._rBrightness.value=e??1,this._applyColorAdjustments()}set contrast(e){this._rContrast.value=e??1,this._applyColorAdjustments()}set hue(e){this._rHue.value=e??0,this._applyColorAdjustments()}set saturation(e){this._rSaturation.value=e??1,this._applyColorAdjustments()}set gamma(e){this._rGamma.value=e??1,this._applyColorAdjustments()}_applyColorAdjustments(){this._raf||(this._raf=requestAnimationFrame(()=>{var s,o,r;this._raf=void 0;const e=this._layer.value,n=(s=e==null?void 0:e.getSource)==null?void 0:s.call(e);(r=(o=this._raster)==null?void 0:o.changed)==null||r.call(o),n!=null&&n.refresh?n.refresh():e!=null&&e.changed&&e.changed()}))}set imageryProvider(e){this._createFromProvider(e)}flyTo(e){}_destroyLayer(){var n,s,o;const e=(n=this._layer)==null?void 0:n.value;this._map&&e&&this._imageriesManager&&this._imageriesManager.delete(e),this._raf&&(cancelAnimationFrame(this._raf),this._raf=void 0),(o=(s=this._raster)==null?void 0:s.dispose)==null||o.call(s),this._raster=void 0,this._layer.value=void 0}_wrapWithRaster(e){const n=Math.min(4,Math.max(1,(typeof navigator<"u"&&navigator.hardwareConcurrency||4)-1)),s=new xl({sources:[e],operationType:"pixel",threads:n,operation:function(o,r){function a(y,w,E){return .2126*y+.7152*w+.0722*E}function c(y,w,E,b,P){const I=.299*y+.587*w+.114*E,M=.595716*y-.274453*w-.321263*E,D=.211456*y-.522591*w+.311135*E,L=M*b-D*P,z=M*P+D*b;let q=I+.9563*L+.621*z,Y=I-.2721*L-.6474*z,X=I-1.107*L+1.7046*z;const Q=m=>m<0?0:m>1?1:m;return[Q(q),Q(Y),Q(X)]}const h=o[0];let l=h[0]/255,u=h[1]/255,d=h[2]/255;const g=h[3]/255;if(r.hueCos!==1||r.hueSin!==0){const y=c(l,u,d,r.hueCos,r.hueSin);l=y[0],u=y[1],d=y[2]}if(r.saturation!==1){const y=a(l,u,d);l=y+(l-y)*r.saturation,u=y+(u-y)*r.saturation,d=y+(d-y)*r.saturation}r.brightness!==1&&(l*=r.brightness,u*=r.brightness,d*=r.brightness),r.contrast!==1&&(l=(l-.5)*r.contrast+.5,u=(u-.5)*r.contrast+.5,d=(d-.5)*r.contrast+.5),r.gammaInv!==1&&(l=Math.pow(Math.max(l,0),r.gammaInv),u=Math.pow(Math.max(u,0),r.gammaInv),d=Math.pow(Math.max(d,0),r.gammaInv));const _=y=>Math.max(0,Math.min(255,Math.round(y*255)));return h[0]=_(l),h[1]=_(u),h[2]=_(d),h[3]=_(g),h}});return s.on("beforeoperations",o=>{const r=this._rHue.value??0;o.data.brightness=this._rBrightness.value??1,o.data.contrast=this._rContrast.value??1,o.data.saturation=this._rSaturation.value??1,o.data.gammaInv=1/Math.max(1e-4,this._rGamma.value??1),o.data.hueCos=Math.cos(r),o.data.hueSin=Math.sin(r)}),this._raster=s,s}_makeLayerForSource(e){return e instanceof xl?new ml({source:e}):e instanceof Kg?new ml({source:e}):new Ha({source:e})}_createFromProvider(e){var _,y;if(!this._map)return;this._destroyLayer();const s=Gt("EPSG:3857").getExtent(),o=_t(s)/256,r=e,a=r.crossOrigin??"anonymous",c=Math.max((r.maximumLevel??18)+1,19),h=Array.from({length:c},(w,E)=>o/Math.pow(2,E));Array.from({length:c},(w,E)=>E.toString());const l=(w,E)=>{if(!E)return{url:w};const b=Array.isArray(E)?E:E.split("");return b.length?w.includes("{s}")?{urls:b.map(P=>w.replace("{s}",P))}:{url:w}:{url:w}},u=w=>typeof w=="string"?w:w&&w.url||"",d=r.minimumLevel??0,g=r.maximumLevel??18;switch(e.type){case"UrlTemplateImageryProvider":{const w=e,E=u(w.url),b=l(E,w.subdomains),P=new Za({...b.urls?{urls:b.urls}:{url:b.url},attributions:r.attributions,crossOrigin:a,wrapX:!0,minZoom:d,maxZoom:g,transition:0}),I=this._wrapWithRaster(P);this._layer.value=this._makeLayerForSource(I);break}case"WebMapTileServiceImageryProvider":{const w=e,E=(w.matrixSet??w.tileMatrixSetID??"EPSG:3857").toUpperCase(),b=E==="EPSG:4326",P=(w.minimumLevel??d)|0,I=(w.maximumLevel??g)|0,M=w.tileMatrixLabels||w.TileMatrixLabels,D=b?Array.from({length:22},(N,G)=>`${E}:${G}`):Array.from({length:22},(N,G)=>String(G)),L=M&&M.length?M:D,z=L.length,q=Math.max(0,Math.min(P,z-1)),Y=Math.max(q,Math.min(I,z-1)),X=Math.max(1,Y-q+1),Q=L.slice(q,q+X),m=256;let v,S,A;if(b){S=[-180,-90,180,90],v=Ae(S);const N=360/(m*2);A=Array.from({length:X},(G,B)=>N/Math.pow(2,q+B))}else{S=s,v=Ae(S);const N=_t(S)/m;A=Array.from({length:X},(G,B)=>N/Math.pow(2,q+B))}const F=new Bv({url:u(w.url),layer:w.layer,matrixSet:E,format:w.format??"image/png",style:w.style??"default",tileGrid:w.tileGrid??new Gv({origin:v,extent:S,resolutions:A,matrixIds:Q,tileSize:m}),requestEncoding:w.requestEncoding||w.requestencoding||"KVP",...b?{projection:Gt("EPSG:4326")}:{},attributions:r.attributions,crossOrigin:a,wrapX:!0,transition:0,tileLoadFunction:(N,G)=>{const B=new Image;B.crossOrigin=a||"anonymous",B.onload=()=>{var ki,fi;const Z=this._rBrightness.value??1,V=this._rContrast.value??1,at=this._rSaturation.value??1,et=this._rHue.value??0,it=this._rGamma.value??1;if(et===0&&at===1&&Z===1&&V===1&&it===1){const Rt=(ki=N.getImage)==null?void 0:ki.call(N);if(Rt){Rt.src=G;return}}const gt=B.naturalWidth||B.width,wt=B.naturalHeight||B.height;if(!gt||!wt){N.getImage().src=G;return}const dt=document.createElement("canvas");dt.width=gt,dt.height=wt;const Et=dt.getContext("2d",{willReadFrequently:!0});Et.drawImage(B,0,0);const ft=Et.getImageData(0,0,gt,wt),xt=ft.data,Ft=Math.cos(et),kt=Math.sin(et),Wt=[[.299,.587,.114],[.595716,-.274453,-.321263],[.211456,-.522591,.311135]],he=[[1,.9563,.621],[1,-.2721,-.6474],[1,-1.107,1.7046]],ye=[[1,0,0],[0,Ft,-kt],[0,kt,Ft]],ns=(Rt,Ee)=>{const Ze=Array.from({length:3},()=>[0,0,0]);for(let At=0;At<3;At++)for(let Ue=0;Ue<3;Ue++)Ze[At][Ue]=Rt[At][0]*Ee[0][Ue]+Rt[At][1]*Ee[1][Ue]+Rt[At][2]*Ee[2][Ue];return Ze},we=ns(he,ns(ye,Wt)),En=.5-.5*V,Cn=1/Math.max(1e-4,it),bn=new Uint8ClampedArray(256);for(let Rt=0;Rt<256;Rt++)bn[Rt]=Math.max(0,Math.min(255,Math.round(Math.pow(Rt/255,Cn)*255)));const ae=.2126,ve=.7152,Oe=.0722;for(let Rt=0;Rt<xt.length;Rt+=4){let Ee=xt[Rt]/255,Ze=xt[Rt+1]/255,At=xt[Rt+2]/255;const Ue=xt[Rt+3],lc=we[0][0]*Ee+we[0][1]*Ze+we[0][2]*At,uc=we[1][0]*Ee+we[1][1]*Ze+we[1][2]*At,Er=we[2][0]*Ee+we[2][1]*Ze+we[2][2]*At,Wi=ae*lc+ve*uc+Oe*Er,Cr=Wi+(lc-Wi)*at,dc=Wi+(uc-Wi)*at,br=Wi+(Er-Wi)*at,ss=Cr*Z,os=dc*Z,rs=br*Z;let xn=ss*V+En,Sn=os*V+En,$t=rs*V+En;xn=xn<0?0:xn>1?1:xn,Sn=Sn<0?0:Sn>1?1:Sn,$t=$t<0?0:$t>1?1:$t,xt[Rt]=bn[Math.round(xn*255)],xt[Rt+1]=bn[Math.round(Sn*255)],xt[Rt+2]=bn[Math.round($t*255)],xt[Rt+3]=Ue}Et.putImageData(ft,0,0);const Ne=(fi=N.setImage)==null?void 0:fi.bind(N);Ne?Ne(dt):N.getImage().src=dt.toDataURL("image/png")},B.onerror=()=>{N.getImage().src=G},B.src=G}});this._layer.value=new Ha({source:F});break}case"WebMapServiceImageryProvider":{const w=e,E={LAYERS:w.layers,TILED:!0,VERSION:((_=w.parameters)==null?void 0:_.VERSION)??((y=w.parameters)==null?void 0:y.version)??"1.3.0",...w.parameters},b=new qv({url:u(w.url),params:E,attributions:r.attributions,crossOrigin:a,transition:0}),P=this._wrapWithRaster(b);this._layer.value=this._makeLayerForSource(P);break}case"TileMapServiceImageryProvider":{const w=e,E=w.url?u(w.url):"",b=E.includes("{-y}"),P=/4326/.test(E)?"EPSG:4326":"EPSG:3857",I=Gt(P),M=b?Jg({extent:I.getExtent(),minZoom:d,maxZoom:g,tileSize:256}):void 0,D=w.url?u(w.url):"",L=new Za({url:D,attributions:r.attributions,crossOrigin:a,wrapX:!0,minZoom:d,maxZoom:g,tileGrid:new qs({origin:Ae(s),resolutions:h.slice(d,g+1)}),zDirection:-1,transition:0,...M?{tileGrid:M}:{}}),z=this._wrapWithRaster(L);this._layer.value=this._makeLayerForSource(z);break}case"OpenStreetMapImageryProvider":{const w=e,E=new Za({url:w.url,attributions:r.attributions,crossOrigin:a,wrapX:!0,transition:0}),b=this._wrapWithRaster(E);this._layer.value=this._makeLayerForSource(b);break}case"SingleTileImageryProvider":{const w=e,E=typeof w.url=="string"?w.url:w.url.url,b=w.rectangle?Ru(w.rectangle,"EPSG:4326","EPSG:3857"):s,P=new Kg({url:E,imageExtent:b,attributions:r.attributions,crossOrigin:a,interpolate:!0}),I=this._wrapWithRaster(P);this._layer.value=this._makeLayerForSource(I);break}default:{console.warn("[OlImagery] 未实现的 provider.type:",e.type,e);return}}this._layer.value.setOpacity(this._rAlpha.value),this._layer.value.setVisible(this._rShow.value),this._imageriesManager&&this._imageriesManager.add(this._layer.value),this._imageriesManager&&this._imageriesManager.setZindex(this._layer.value,this._rZIndex.value)}}const ac=class ac extends f.Destroyable{constructor(e,n){super();R(this,"_pickedEvent",this.disposeVar(new f.Event));R(this,"_flyToEvent",this.disposeVar(new f.Event));R(this,"_clickEvent",this.disposeVar(new f.Event));R(this,"_hovered",this.disposeVar(f.react(!1)));R(this,"_feature");R(this,"_source");R(this,"_layer");R(this,"_initialized",!1);const s=new Ge([]);this._feature=new Je({geometry:s}),this._feature.setId(n??f.createGuid());const o=e.viewer;if(!o)return;this._source=new Si,this.dispose(()=>{var h;return(h=this._source)==null?void 0:h.dispose()}),this._layer=new oi({source:this._source}),this.dispose(()=>{var h;return(h=this._layer)==null?void 0:h.dispose()});const r=()=>{var h;(h=this._layer)==null||h.setVisible(this.show??!0)};this.d(f.createEventsCallFunc(this.showChanged,r,{immediate:!0})),o.addLayer(this._layer),this.dispose(()=>o.removeLayer(this._layer));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.position))return;const h=yt([this.position[0][0],this.position[0][1]]);s.setCoordinates(h);const l=this.radius??5,u=this.strokeWidth??2,d=this.fillColor??[255,255,255,1],g=this.strokeColor??[0,153/255,1,1],_=new de({color:`rgba(${d.map(E=>E*255).join(",")})`}),y=new Se({color:`rgba(${g.map(E=>E*255).join(",")})`,width:u}),w=new Xt({image:new ii({radius:l,fill:_,stroke:y})});this._feature.setStyle(w),this._source.addFeature(this._feature)};a();const c=this.disposeVar(f.createNextAnimateFrameEvent(this.positionChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged));this.dispose(c.disposableOn(a)),this.dispose(this.flyToEvent.disposableOn(h=>{this.position&&Ri(e,this.position)})),this.dispose(this.positionChanged.disposableOn(()=>{!this._initialized&&this.position&&(this._initializePoint(),this._initialized=!0)}))}get typeName(){return"OlPoint"}get defaultProps(){return ac.createDefaultProps()}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get clickEvent(){return this._clickEvent}get hovered(){return this._hovered.value}set hovered(e){this._hovered.value=e}get feature(){return this._feature}_initializePoint(){const e=()=>{var g;if(!this.position)return;const s=yt([this.position[0],this.position[1]]);if(!this._feature)return;this._feature.getGeometry().setCoordinates(s);const r=this.radius??5,a=this.strokeWidth??2,c=this.fillColor??[1,1,1,1],h=this.strokeColor??[0,153/255,1,1],l=new de({color:`rgba(${c.map(_=>_*255).join(",")})`}),u=new Se({color:`rgba(${h.map(_=>_*255).join(",")})`,width:a}),d=new Xt({image:new ii({radius:r,fill:l,stroke:u})});this._feature.setStyle(d),this._feature.set("visible",this.show??!0),(g=this._source)==null||g.addFeature(this._feature)};e();const n=f.createNextAnimateFrameEvent(this.positionChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged);this.dispose(n.disposableOn(e))}};R(ac,"defaults",{position:[],width:2,loop:!1,color:[1,1,1,.5],outlineColor:[0,0,0,1],show:!0,allowPicking:!1,strokeColor:[0,.6,1,1],fillColor:[1,1,1,1],strokeWidth:2,radius:5});let Xe=ac;(i=>{i.createDefaultProps=()=>({show:void 0,position:f.reactArrayWithUndefined(void 0),editting:void 0,allowPicking:!1,pixelSize:void 0,color:f.reactArrayWithUndefined(void 0),outlineColor:f.reactArrayWithUndefined(void 0),outlineWidth:void 0,fillColor:f.reactArrayWithUndefined(void 0),strokeColor:f.reactArrayWithUndefined(void 0),strokeWidth:void 0,radius:void 0,zIndex:void 0})})(Xe||(Xe={})),f.extendClassProps(Xe.prototype,Xe.createDefaultProps);const cc=class cc extends f.Destroyable{constructor(e,n){super();R(this,"_flyToEvent",this.disposeVar(new f.Event));R(this,"_layer");R(this,"_feature");R(this,"_source");R(this,"_lineString");const s=new wi([]);this._lineString=s,this.d(()=>{var h;return(h=this._lineString)==null?void 0:h.dispose()}),this._feature=new Je({geometry:s}),this._feature.setId(n??f.createGuid()),this.d(()=>{var h;return(h=this._feature)==null?void 0:h.dispose()}),this._source=new Si,this.d(()=>{var h;return(h=this._source)==null?void 0:h.dispose()}),this._layer=new oi({zIndex:0,source:this._source}),this.d(()=>{var h;return(h=this._layer)==null?void 0:h.dispose()});const o=e.viewer;if(!o)return;o.addLayer(this._layer),this.d(()=>o.removeLayer(this._layer));const r=()=>{var h;(h=this._layer)==null||h.setVisible(this.show??!0)};r(),this.ad(this.showChanged.don(r)),this.d(f.createEventsCallFunc(this.zIndexChanged,()=>{var h;(h=this._layer)==null||h.setZIndex(this.zIndex)},{immediate:!0}));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.positions||this.positions.length<2))return;const h=this.positions.map(d=>yt([d[0],d[1]]));this.loop&&h.length>=3&&h.push(h[0]),this._feature.getGeometry().setCoordinates(h);const u=(d,g)=>{const _=[],y=new Se({color:`rgba(${this.color[0]*255}, ${this.color[1]*255}, ${this.color[2]*255}, ${this.color[3]})`,width:this.width??2,lineDash:this.hasDash?[this.dashLength??16,(this.dashLength??16)/2]:void 0});if(_.push(new Xt({stroke:y})),this.hasArrow&&h.length>=2){const[w,E]=h[h.length-2],[b,P]=h[h.length-1],I=Vv(b-w,P-E);_.push(new Xt({geometry:new Ge([b,P]),image:new mo({points:3,radius:8,rotation:I,rotateWithView:!0,fill:new de({color:`rgba(${this.color[0]*255}, ${this.color[1]*255}, ${this.color[2]*255}, ${this.color[3]})`})})}))}return _};this._feature.setStyle(u),this._source.addFeature(this._feature)};a();const c=this.disposeVar(f.createNextAnimateFrameEvent(this.positionsChanged,this.loopChanged,this.widthChanged,this.colorChanged,this.hasDashChanged,this.dashLengthChanged,this.hasArrowChanged,this.showChanged));this.d(c.disposableOn(a)),this.d(this.flyToEvent.disposableOn(h=>{if(!this.positions||this.positions.length===0)return;const l=this.positions[Math.floor(this.positions.length/2)];Ri(e,l)}))}get typeName(){return"OlPolyline"}get defaultProps(){return cc.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}};R(cc,"defaults",{positions:[],width:2,loop:!1,color:[1,1,1,1],hasDash:!1,dashLength:16,hasArrow:!1});let Jt=cc;(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:f.reactPositions(void 0),loop:!1,width:2,color:f.reactArray([1,1,1,1]),hasDash:!1,dashLength:16,hasArrow:!1,arcType:"GEODESIC",depthTest:!1,zIndex:0,dashPattern:255,gapColor:f.reactArray([0,0,0,0])})})(Jt||(Jt={})),f.extendClassProps(Jt.prototype,Jt.createDefaultProps);function Vv(i,t){const e=Math.atan2(t,i);return(Math.PI/2-e+2*Math.PI)%(2*Math.PI)}class Yv extends f.Destroyable{constructor(e,n){super();R(this,"_geoPoint");R(this,"_geoAxis");this._geoPoint=this.disposeVar(new Xe(n,e.id)),this._geoAxis=this.disposeVar(new Jt(n,e.id)),this._geoAxis.width=6,this._geoAxis.color=[1,1,0,.7]}get geoPoint(){return this._geoPoint}get geoAxis(){return this._geoAxis}}const Ni=class Ni extends f.Destroyable{constructor(e,n){super();R(this,"_captureEvent",this.disposeVar(new f.Event));R(this,"_id",this.disposeVar(f.react(f.createGuid())));if(this._olViewer=e,n&&(this.id=n),!e.viewer)return;this.disposeVar(new f.ObjResettingWithEvent(this.showChanged,()=>{if(this.show&&this.position)return new Yv(this,e)})),this.default&&this.flyTo(void 0,!1);const o=this.disposeVar(f.createProcessingFromAsyncFunc(async a=>{const{position:c,rotation:h,viewDistance:l,duration:u=1e3}=this;if(c){const d=Ri(this._olViewer,c,l,h,u,()=>{this.enabled=!1});d&&await a.promise(d),this.enabled=!1}}));this.dispose(this.enabledChanged.disposableOn(()=>{o.isRunning&&o.cancel(),this.enabled&&o.restart()}));const r=this.disposeVar(f.createProcessingFromAsyncFunc(async(a,c,h)=>{var d,g;const l=(g=(d=this._olViewer).capture)==null?void 0:g.call(d,c,h);if(!l)return;const u=await a.promise(l);u&&(this.thumbnail=u)}));this.dispose(this.captureEvent.disposableOn((a,c)=>{r.restart(void 0,a??Ni.defaults.thumbnailWidth,c??Ni.defaults.thumbnailHeight)}))}get captureEvent(){return this._captureEvent}capture(e,n){this._captureEvent.emit(e,n)}get id(){return this._id.value}set id(e){this._id.value=e}get idChanged(){return this._id.changed}resetWithCurrentCamera(e){if(!this._olViewer.actived)return;const n=this._olViewer.getCurrentCameraInfo();n&&(e&Ni.ResetFlag.Position&&(this.position=n.position),e&Ni.ResetFlag.Rotation&&(this.rotation=n.rotation),e&Ni.ResetFlag.ViewDistance&&(this.viewDistance=0))}flyTo(e,n){if((n??!0)&&!this._olViewer.actived)return;const{position:s,rotation:o,viewDistance:r,duration:a}=this;s&&Ri(this._olViewer,s,r,o,e??a)}};R(Ni,"ResetFlag",{Position:1,Rotation:2,ViewDistance:4,Zoom:10}),R(Ni,"defaults",{thumbnailWidth:64,thumbnailHeight:64,enabled:!0,show:!1,position:[116.39,39.9,100],duration:1e3,default:!1,thumbnail:""});let Hn=Ni;(i=>{i.createDefaultProps=()=>({enabled:!0,position:f.reactArrayWithUndefined(void 0),positionEditing:!1,show:!1,rotation:f.reactArray([0,0,0]),viewDistance:0,duration:void 0,default:!1,thumbnail:""})})(Hn||(Hn={})),f.extendClassProps(Hn.prototype,Hn.createDefaultProps);class Di extends f.Destroyable{constructor(e,n){super();R(this,"_flyToEvent",this.disposeVar(new f.Event));R(this,"_feature");R(this,"_layer");R(this,"_source");const s=new ps([[]]);this._feature=new Je({geometry:s}),this._feature.setId(n??f.createGuid());const o=e.viewer;if(!o)return;this._source=new Si,this.dispose(()=>{var h;return(h=this._source)==null?void 0:h.dispose()}),this._layer=new oi({source:this._source}),this.dispose(()=>{var h;return(h=this._layer)==null?void 0:h.dispose()}),o.addLayer(this._layer),this.dispose(()=>o.removeLayer(this._layer));const r=()=>{var h,l;(h=this._layer)==null||h.setVisible(this.show??!0),(l=this._layer)==null||l.setZIndex(this.zIndex)};this.d(f.createEventsCallFunc([this.showChanged,this.zIndexChanged],r,{immediate:!0}));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.positions||this.positions.length<3))return;const h=hp(this.positions);if(h.length<4)return;this._feature.getGeometry().setCoordinates([h]);const l=this.filled?this.fillColor:[0,0,0,0],u=this.stroked?this.outlineColor:[0,0,0,0];this._feature.setStyle(new Xt({fill:new de({color:cp(l)}),stroke:new Se({color:cp(u),width:this.outlineWidth??1.5,lineDash:this.hasDash?[this.dashLength??16,(this.dashLength??16)/2]:void 0})})),this._source.addFeature(this._feature)};a();const c=this.disposeVar(f.createNextAnimateFrameEvent(this.positionsChanged,this.fillColorChanged,this.outlineColorChanged,this.outlineWidthChanged,this.hasDashChanged,this.dashLengthChanged,this.strokedChanged,this.filledChanged));this.dispose(c.disposableOn(a)),this.dispose(this.flyToEvent.disposableOn(h=>{if(!this.positions||this.positions.length===0)return;const l=hp(this.positions),[u,d]=Hv(l),[g,_]=Kt([u,d]);Ri(e,[g,_,0])}))}get typeName(){return"OlPolygon"}get defaultProps(){return Di.createDefaultProps()}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}}(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:f.reactJsonWithUndefined(void 0),fillColor:f.reactArray([1,1,1,.4]),outlineColor:f.reactArray([1,1,1,1]),outlineWidth:1.5,hasDash:!1,dashLength:16,zIndex:0,stroked:!0,filled:!0})})(Di||(Di={})),f.extendClassProps(Di.prototype,Di.createDefaultProps);function cp(i){return`rgba(${i[0]*255}, ${i[1]*255}, ${i[2]*255}, ${i[3]})`}function hp(i){const t=i.map(s=>yt([s[0],s[1]])),e=t[0],n=t[t.length-1];return(!e||!n||e[0]!==n[0]||e[1]!==n[1])&&t.push(e),t}function Hv(i){let t=0,e=0,n=0;for(let s=0,o=i.length-1;s<i.length;o=s++){const[r,a]=i[o],[c,h]=i[s],l=r*h-c*a;t+=l,e+=(r+c)*l,n+=(a+h)*l}return t*=.5,Math.abs(t)<1e-9?i[0]:(e/=6*t,n/=6*t,[e,n])}class Il extends gs{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){this.flatCoordinates?In(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.changed()}clone(){const t=new Il(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,n,s){if(s<no(this.getExtent(),t,e))return s;const o=this.flatCoordinates,r=this.stride;for(let a=0,c=o.length;a<c;a+=r){const h=Dn(t,e,o[a],o[a+1]);if(h<s){s=h;for(let l=0;l<r;++l)n[l]=o[a+l];n.length=r}}return s}getCoordinates(){return Ki(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return t<0||e<=t?null:new Ge(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,n=this.stride,s=[];for(let o=0,r=t.length;o<r;o+=n){const a=new Ge(t.slice(o,o+n),e);s.push(a)}return s}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,n=this.stride;for(let s=0,o=e.length;s<o;s+=n){const r=e[s],a=e[s+1];if(_c(t,r,a))return!0}return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ur(this.flatCoordinates,0,t,this.stride),this.changed()}}const hc=class hc extends f.Destroyable{constructor(e,n){super();R(this,"_pickedEvent",this.disposeVar(new f.Event));R(this,"_flyToEvent",this.disposeVar(new f.Event));R(this,"_clickEvent",this.disposeVar(new f.Event));R(this,"_hovered",this.disposeVar(f.react(!1)));R(this,"_feature");R(this,"_source");R(this,"_layer");R(this,"_initialized",!1);const s=new Il([]);this._feature=new Je({geometry:s}),this._feature.setId(n??f.createGuid());const o=e.viewer;if(!o)return;this._source=new Si,this.dispose(()=>{var h;return(h=this._source)==null?void 0:h.dispose()}),this._layer=new oi({source:this._source}),this.dispose(()=>{var h;return(h=this._layer)==null?void 0:h.dispose()});const r=()=>{var h;(h=this._layer)==null||h.setVisible(this.show??!0)};r(),this.ad(this.showChanged.don(r)),o.addLayer(this._layer),this.dispose(()=>o.removeLayer(this._layer));const a=()=>{if(!this._source||!this._feature||(this._source.clear(),!this.points))return;const h=this.points.map(b=>yt([b[0],b[1]]));if(!this._feature)return;const l=this._feature.getGeometry();l&&l.setCoordinates(h);const u=this.radius??5,d=this.strokeWidth??2,g=this.fillColor??[255,255,255,1],_=this.strokeColor??[0,153/255,1,1],y=new de({color:`rgba(${g.map(b=>b*255).join(",")})`}),w=new Se({color:`rgba(${_.map(b=>b*255).join(",")})`,width:d}),E=new Xt({image:new ii({radius:u,fill:y,stroke:w})});this._feature.setStyle(E),this._source.addFeature(this._feature)};a();const c=this.disposeVar(f.createNextAnimateFrameEvent(this.pointsChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged));this.dispose(c.disposableOn(a)),this.dispose(this.pointsChanged.don(()=>{!this._initialized&&this.points&&(this._initializePoint(),this._initialized=!0)}))}get typeName(){return"OlMultiPoint"}get defaultProps(){return hc.createDefaultProps()}get pickedEvent(){return this._pickedEvent}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get clickEvent(){return this._clickEvent}get hovered(){return this._hovered.value}set hovered(e){this._hovered.value=e}get feature(){return this._feature}_initializePoint(){const e=()=>{var g;if(!this.points)return;const s=this.points.map(_=>yt([_[0],_[1]]));if(!this._feature)return;const o=this._feature.getGeometry();o&&o.setCoordinates(s);const r=this.radius??5,a=this.strokeWidth??2,c=this.fillColor??[1,1,1,1],h=this.strokeColor??[0,153/255,1,1],l=new de({color:`rgba(${c.map(_=>_*255).join(",")})`}),u=new Se({color:`rgba(${h.map(_=>_*255).join(",")})`,width:a}),d=new Xt({image:new ii({radius:r,fill:l,stroke:u})});this._feature.setStyle(d),this._feature.set("visible",this.show??!0),(g=this._source)==null||g.addFeature(this._feature)};e();const n=f.createNextAnimateFrameEvent(this.pointsChanged,this.showChanged,this.radiusChanged,this.strokeColorChanged,this.strokeWidthChanged,this.fillColorChanged);this.dispose(n.disposableOn(e))}};R(hc,"defaults",{position:[],width:2,loop:!1,color:[1,1,1,.5],outlineColor:[0,0,0,1],show:!0,allowPicking:!1,strokeColor:[0,.6,1,1],fillColor:[1,1,1,1],strokeWidth:2,radius:5});let _n=hc;(i=>{i.createDefaultProps=()=>({show:void 0,points:f.reactPositions(void 0),editting:void 0,allowPicking:!1,pixelSize:void 0,color:f.reactArrayWithUndefined(void 0),outlineColor:f.reactArrayWithUndefined(void 0),outlineWidth:void 0,fillColor:f.reactArrayWithUndefined(void 0),strokeColor:f.reactArrayWithUndefined(void 0),strokeWidth:void 0,radius:void 0,zIndex:void 0})})(_n||(_n={})),f.extendClassProps(_n.prototype,_n.createDefaultProps);class Ka extends f.EngineObject{constructor(t,e){if(super(t,e),!e.viewer){console.warn("map is undefined!");return}this.d(t.flyToEvent.don((s,o)=>this.flyTo(s,o))),this.d(t.flyInEvent.don((s,o)=>this.flyIn(s,o))),this.dispose(t.calcFlyInParamEvent.disposableOn(()=>{if(!e.actived)return;const s=e.getCurrentCameraInfo();if(!s)return;const{position:o,rotation:r}=s;t.flyInParam={position:o,rotation:r,flyDuration:1}})),this.dispose(t.calcFlyToParamEvent.disposableOn(()=>{t.useCalcFlyToParamInESObjectWithLocation||console.warn("calcFlyToParam无法调用,该对象缺少position属性!")}))}flyToWithPromise(t,e,n,s,o,r,a){const{sceneObject:c,olViewer:h}=this;h.flyTo({distance:n??0,heading:s?s[0]:0,pitch:s?s[1]:0,flyDuration:o??1,hDelta:r??0,pDelta:a??0},e)}flyTo(t,e){const{sceneObject:n,olViewer:s}=this;return s.actived?(n.flyToParam&&(n.useCalcFlyToParamInESObjectWithLocation||console.warn("flyToParam无法使用,该对象缺少position属性,若飞行失败,请清空flyToParam后重试!")),n.flyInParam?this.flyIn(t,e):!1):!1}flyIn(t,e){const{sceneObject:n,olViewer:s}=this;if(!s.actived)return!1;if(n.flyInParam){const{position:o,rotation:r,flyDuration:a}=n.flyInParam,c=t??a;return this.olViewer.flyIn(o,r,c),!0}return!1}get olViewer(){return this.viewer}}class Go extends Ka{constructor(e,n){super(e,n);R(this,"_smoothMoving");this._smoothMoving=this.dv(new f.SmoothMoveController(n)),this.d(this._smoothMoving.currentPositionChanged.don(o=>{o&&(e.position=o)})),this.d(this._smoothMoving.currentRotationChanged.don(o=>{o&&this._smoothMoving.isRotating&&(e.rotation=o)})),this.d(this._smoothMoving.currentHeadingChanged.don(o=>{if(o!==void 0&&!this._smoothMoving.isRotating){const r=e.rotation;e.rotation=[o-90,r[1],r[2]]}})),this.d(e.smoothMoveEvent.don((o,r)=>this.smoothMove(o,r*1e3))),this.d(e.smoothMoveWithRotationEvent.don((o,r,a)=>this.smoothMoveWithRotation(o,r,a*1e3))),this.d(e.smoothMoveOnGroundEvent.don((o,r,a)=>this.smoothMoveOnGround(o,r,a*1e3))),this.d(e.smoothMoveWithRotationOnGroundEvent.don((o,r,a,c)=>this.smoothMoveWithRotationOnGround(o,r,a,c*1e3))),this.d(e.calcFlyToParamEvent.don(()=>{if(!e.useCalcFlyToParamInESObjectWithLocation||!e.position)return;const o=n.calcFlyToParam(e.position);if(!o){console.warn("olViewer.calcFlyToParam failed.");return}console.log("olViewer.calcFlyToParam success.",o),e.flyToParam=o})),this.d(e.automaticLandingEvent.don(async()=>{console.warn("ESOlViewer automaticLandingEvent is not supported.")}));const s=this.dv(f.createNextAnimateFrameEvent(e.minVisibleDistanceChanged,e.maxVisibleDistanceChanged));this.d(s.don(()=>this.visibleDistance(e,n))),this.d(n.cameraChanged.don(()=>this.visibleDistance(e,n)))}smoothMove(e,n){this._smoothMoving.isGround=!1,this._smoothMoving.isRotating=!1,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart(e,this.sceneObject.rotation,n)}smoothMoveWithRotation(e,n,s){this._smoothMoving.isGround=!1,this._smoothMoving.isRotating=!0,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart(e,n,s)}async smoothMoveOnGround(e,n,s){const o=await this.olViewer.getTerrainHeight([e,n])??0;this._smoothMoving.isGround=!0,this._smoothMoving.isRotating=!1,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart([e,n,o],this.sceneObject.rotation,s)}async smoothMoveWithRotationOnGround(e,n,s,o){const r=await this.olViewer.getTerrainHeight([n,s])??0;this._smoothMoving.isGround=!0,this._smoothMoving.isRotating=!0,this._smoothMoving.restart(this.sceneObject.position,this.sceneObject.rotation,0),this._smoothMoving.restart([n,s,r],e,o)}visibleDistance(e,n){if(!e.show||!e.position)return;const s=f.getDistancesFromPositions([e.position,of(n)],"NONE")[0];e.minVisibleDistance<e.maxVisibleDistance?s>e.minVisibleDistance&&s<e.maxVisibleDistance:e.maxVisibleDistance===0&&s>e.minVisibleDistance}flyTo(e,n){const{sceneObject:s,olViewer:o}=this;if(!o.actived||!o.viewer)return!1;if(s.flyToParam&&s.position){const{position:r,flyToParam:a}=s,{distance:c,heading:h,pitch:l,flyDuration:u,hDelta:d,pDelta:g}=a;return this.flyToWithPromise(n,r,c,[h,l,0],e??u,d,g),!0}else return mh(o.viewer,s.position,e),!0}flyIn(e,n){const{sceneObject:s,olViewer:o}=this;return!o.actived||!o.viewer?!1:!super.flyIn(e,n)&&s.position?(mh(o.viewer,s.position,e),!0):!1}}class Tl extends Go{constructor(e,n){super(e,n);R(this,"_lastHoverResult",this.dv(f.react(void 0)));if(!n.viewer){console.warn("viewer is undefined!");return}this.ad(f.createProcessingFromAsyncFunc(async(o,r)=>{const a=await o.promise(n.pick(r.screenPosition,"innerHoverEvent"));this.lastHoverResult=Object.assign({},a,r)}))}get lastHoverResult(){return this._lastHoverResult.value}set lastHoverResult(e){this._lastHoverResult.value=e}get lastHoverResultChanged(){return this._lastHoverResult.changed}}const Xv=i=>{const t=[];if(i){const e=i.length;let n=0;for(let s=0;s<e;++s){const o=(s+1)%e,r=f.geoDistance(i[s],i[o]),a=Math.abs(i[s][2]-i[o][2]),c=Math.sqrt(r*r+a*a);n+=c,t.push(n)}}return t},$v=i=>{let t;return i?(i.length<3?t=0:t=f.geoArea(i),t):0},Zv=i=>{let t;return i?(i.length<3?t=void 0:t=f.geoCenterOfMass(i),t):void 0},Ko=class Ko extends Ka{constructor(t,e){if(super(t,e),!e.viewer){console.warn("viewer is undefined!");return}}flyIn(t,e){if(!super.flyIn(t,e)){if(!this.olViewer.actived||!this.olViewer.viewer)return!1;const s=this.sceneObject.points;if(!s||s.length===0)return!1;const o=sa(s);return To(this.olViewer.viewer,o,t),console.log("OlESGeoVector flyIn"),!0}return!0}flyTo(t,e){if(!super.flyTo(t,e)){if(!this.olViewer.actived||!this.olViewer.viewer)return!1;const s=this.sceneObject.points;if(!s||s.length===0)return!1;const o=sa(s);return To(this.olViewer.viewer,o,t),console.log("OlESGeoVector flyTo"),!0}return!0}};R(Ko,"type",Ko.register("ESOlViewer",f.ESGeoVector.type,Ko));let Gs=Ko;class Xn extends f.Destroyable{constructor(e,n){super();R(this,"_flyToEvent",this.disposeVar(new f.Event));if(!e.viewer)return;const o=this.ad(new Di(e,n)),r=this.ad(new Jt(e,n));r.loop=!0,this.ad(f.bind([r,"depthTest"],[this,"depthTest"])),this.d(f.track([o,"allowPicking"],[this,"allowPicking"]));const a=()=>{r.show=!!(this.show&&this.outline),o.show=!!(this.show&&this.fill),r.positions=this.positions,o.positions=o.show?this.positions||[]:[],r.color=this.outlineColor,r.width=this.outlineWidth;const[h=1,l=1,u=1,d=.5]=this.color||[1,1,1,.5];o.fillColor=[h,l,u,d]};a();const c=this.disposeVar(f.createNextAnimateFrameEvent(this.showChanged,this.outlineChanged,this.outlineColorChanged,this.outlineWidthChanged,this.fillChanged,this.colorChanged,this.positionsChanged));this.d(c.disposableOn(a)),this.d(this.flyToEvent.disposableOn(h=>{o.show?o.flyTo(h):r.show&&r.flyTo(h)}))}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}}R(Xn,"defaults",{viewDistanceRange:[1e3,1e4,3e4,6e4],positions:[]}),(i=>{i.createDefaultProps=()=>({show:!0,allowPicking:!1,outline:!0,strokeGround:!1,outlineColor:f.reactArray([1,1,1,1]),outlineWidth:2,ground:!1,fill:!0,color:f.reactArray([1,1,1,.5]),positions:f.reactPositions(void 0),viewDistanceRange:f.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,depthTest:!1})})(Xn||(Xn={})),f.extendClassProps(Xn.prototype,Xn.createDefaultProps);const Qo=class Qo extends Gs{constructor(e,n){super(e,n);R(this,"_geoPolygon");if(!n.viewer){console.warn("viewer is undefined!");return}this._geoPolygon=this.ad(new Di(this.olViewer,e.id));const o=this.geoPolygon;o&&(this.d(f.track([o,"show"],[e,"show"])),this.d(f.track([o,"allowPicking"],[e,"allowPicking"])),this.d(f.bind([o,"positions"],[e,"points"])),this.d(f.track([o,"stroked"],[e,"stroked"])),this.d(f.track([o,"outlineColor"],[e,"strokeColor"])),this.d(f.track([o,"outlineWidth"],[e,"strokeWidth"])),this.d(f.track([o,"filled"],[e,"filled"])),this.d(f.track([o,"fillColor"],[e,"fillColor"])))}get geoPolygon(){return this._geoPolygon}};R(Qo,"type",Qo.register("ESOlViewer",f.ESGeoPolygon.type,Qo));let Qa=Qo;function Bo(i){var e;const t=(e=fl(i,"pickResult"))==null?void 0:e.pointerEvent;return(t==null?void 0:t.buttons)!=0?(t==null?void 0:t.button)??0:-1}function Kv(i,t,e){const n=[];for(const s of e)switch(s){case"SquareMeter_SquareKilometer":i>=1e6?n.push(`面积:${(i/1e6).toFixed(2)} km²`):n.push(`面积:${i.toFixed(2)} m²`);break;case"MU_Hectare":const o=i*(1/666.7);if(o>=15){const r=o/15;n.push(`面积:${r.toFixed(2)} 公顷`)}else n.push(`面积:${o.toFixed(2)} 亩`);break;case"PerimeterMeter_PerimeterKilometer":t>=1e3?n.push(`周长:${(t/1e3).toFixed(2)} km`):n.push(`周长:${t.toFixed(2)} m`);break}return n}class Bs extends f.Destroyable{constructor(e,n){super();R(this,"_pickedEvent",this.dv(new f.Event));R(this,"_flyToEvent",this.dv(new f.Event));R(this,"_area",this.dv(f.react(0)));R(this,"_centerOfMass",this.dv(f.reactArrayWithUndefined(void 0)));R(this,"_distances",this.dv(f.reactArray([])));R(this,"_geoPolyline");R(this,"_id",this.dv(f.react(f.createGuid())));n&&(this.id=n);{const s=()=>{this._distances.value=Xv(this.positions),this._area.value=$v(this.positions),this._centerOfMass.value=Zv(this.positions)};s();const o=this.dv(f.createNextAnimateFrameEvent(this.positionsChanged));this.dispose(o.disposableOn(s))}{const s=this._geoPolyline=this.dv(new Jt(e,n));s.loop=!0,s.arcType="GEODESIC",this.dispose(f.bind([s,"color"],[this,"color"])),this.dispose(f.bind([s,"dashLength"],[this,"dashLength"])),this.dispose(f.bind([s,"dashPattern"],[this,"dashPattern"])),this.dispose(f.bind([s,"gapColor"],[this,"gapColor"])),this.dispose(f.bind([s,"hasArrow"],[this,"hasArrow"])),this.dispose(f.bind([s,"hasDash"],[this,"hasDash"])),this.dispose(f.bind([s,"positions"],[this,"positions"])),this.dispose(f.bind([s,"show"],[this,"show"])),this.dispose(f.bind([s,"allowPicking"],[this,"allowPicking"])),this.dispose(f.bind([s,"width"],[this,"width"])),this.dispose(f.bind([s,"depthTest"],[this,"depthTest"]))}{const s=this.dv(new Xn(e,n));s.outline=!1;const o=()=>{s.positions=this.positions};o(),this.dispose(this.positionsChanged.disposableOn(o));const r=()=>{const a=this.fillColor;s.color=[a[0],a[1],a[2],a[3]*.5]};r(),this.dispose(this.fillColorChanged.disposableOn(r)),this.dispose(f.track([s,"show"],[this,"show"])),this.dispose(f.track([s,"ground"],[this,"ground"])),this.dispose(f.track([s,"allowPicking"],[this,"allowPicking"])),this.dispose(f.bind([s,"depthTest"],[this,"depthTest"])),this.d(this.flyToEvent.don(a=>{s.flyTo(a)}))}{const s=this.dv(new Qt(e,n)),o=this.dv(f.createNextAnimateFrameEvent(this.areaChanged,this.centerOfMassChanged,this.distancesChanged,this.unitsChanged)),r=()=>{if(this.distances.length===0){s.innerHTML="";return}const a=Kv(this.area,this.distances[this.distances.length-1],this.units);s.innerHTML=ja([...a].join(`
|